marked-conductor 1.0.1 → 1.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +12 -0
- data/README.md +8 -1
- data/lib/conductor/condition.rb +2 -1
- data/lib/conductor/env.rb +3 -3
- data/lib/conductor/version.rb +1 -1
- data/lib/conductor.rb +1 -1
- data/src/_README.md +8 -2
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: '079981390f00381e4d8a8e72d4601689bfbd337a53c08a82fbb03f00e92e4fbf'
|
4
|
+
data.tar.gz: afded28efba89f40cb679d186dd073d1f7c021bf187d3dae69a755c82a0ed5e9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b73034fc92df9060a6544ce9b259af347a1388121d2497f57011f58fdbb4e180bea986297e7383a55743cb391d9736f009351fc9b838df2c40b7ce39fd04c33a
|
7
|
+
data.tar.gz: c42bbcee82174272b59eeda49b6632c4437038ddc260c0597ce20003dfc73bc56c7640651953d7e2ee6239ab5cc338d7a7998bc3ef95397f8bdc78b2722d97d5
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
|
2
|
+
[![RubyGems.org](https://img.shields.io/gem/v/marked-conductor)](https://rubygems.org/gems/marked-conductor)
|
2
3
|
|
3
4
|
# Marked Conductor
|
4
5
|
|
@@ -72,7 +73,7 @@ Available conditions are:
|
|
72
73
|
- `path`: This tests just the path itself, allowing conditions like `path contains _drafts` or `path does not contain _posts`.
|
73
74
|
- `phase`: Tests whether Marked is in Preprocessor or Processor phase, allowing conditions like `phase is preprocess` or `phase is process` (which can be shortened to `pre` and `pro`).
|
74
75
|
- `text`: This tests for any string match within the text of the document being processed. This can be used with operators `starts with`, `ends with`, or `contains`, e.g. `text contains @taskpaper` or `text does not contain <!--more-->`.
|
75
|
-
- If the test value is surrounded by forward slashes, it will be treated as a regular expression. Regexes are always flagged as case insensitive. Use it like `text
|
76
|
+
- If the test value is surrounded by forward slashes, it will be treated as a regular expression. Regexes are always flagged as case insensitive. Use it like `text contains /@\w+/`.
|
76
77
|
- `yaml`, `headers`, or `frontmatter` will test for YAML headers. If a `yaml:KEY` is defined, a specific YAML key will be tested for. If a value is defined with an operator, it will be tested against the value key.
|
77
78
|
- `yaml` tests for the presence of YAML frontmatter.
|
78
79
|
- `yaml:comments` tests for the presence of a `comments` key.
|
@@ -107,6 +108,12 @@ Commands are interpreted as shell commands. If a command exists in the `$PATH`,
|
|
107
108
|
|
108
109
|
Using `$file` as an argument to a script or command will bypass processing of STDIN input, and instead use the value of $MARKED_PATH to read the contents of the specified file.
|
109
110
|
|
111
|
+
## Custom Processors
|
112
|
+
|
113
|
+
All of the [capabilities and requirements](https://marked2app.com/help/Custom_Processor) of a Custom Processor script or command still apply, and all of the [environment variables that Marked sets](https://marked2app.com/help/Custom_Processor#environmentvariables) are still available. You just no longer have to have one huge script that forks on the various environment variables and you don't have to write your own tests for handling different scenarios.
|
114
|
+
|
115
|
+
A script run by Conductor already knows it has the right type of file with the expected data and path, so your script can focus on just processing one file type. It's recommended to separate all of that logic you may already have written out into separate scripts and let Conductor handle the forking based on various criteria.
|
116
|
+
|
110
117
|
## Testing
|
111
118
|
|
112
119
|
In order to test from the command line, you'll need certain environment variables set. This can be done by exporting the following variables with your own definitions, or by running conductor with all of the variables preceding the command, e.g. `$ MARKED_ORIGIN=/path/to/markdown_file.md [...] conductor`.
|
data/lib/conductor/condition.rb
CHANGED
@@ -182,10 +182,11 @@ module Conductor
|
|
182
182
|
test_string(IO.read(@env[:filepath]), value, operator) ? true : false
|
183
183
|
when /^(yaml|headers|frontmatter)(?::(.*?))?$/i
|
184
184
|
m = Regexp.last_match
|
185
|
-
content = IO.read(@env[:filepath])
|
185
|
+
content = IO.read(@env[:filepath]).force_encoding('utf-8')
|
186
186
|
return false unless content =~ /^---/
|
187
187
|
|
188
188
|
yaml = YAML.safe_load(content.split(/(---|\.\.\.)/)[1])
|
189
|
+
return false unless yaml
|
189
190
|
if m[2]
|
190
191
|
value1 = yaml[m[2]]
|
191
192
|
value1 = value1.join(',') if value1.is_a?(Array)
|
data/lib/conductor/env.rb
CHANGED
@@ -28,11 +28,11 @@ module Conductor
|
|
28
28
|
css_path: '/Applications/Marked 2.app/Contents/Resources/swiss.css',
|
29
29
|
ext: 'md',
|
30
30
|
includes: [],
|
31
|
-
origin: '/Users/ttscoff/
|
32
|
-
filepath: '/Users/ttscoff/
|
31
|
+
origin: '/Users/ttscoff/Dropbox/Work/Oracle/oci-ai-industry-dbsolutions/text-analysis-and-translation/',
|
32
|
+
filepath: '/Users/ttscoff/Dropbox/Work/Oracle/oci-ai-industry-dbsolutions/text-analysis-and-translation/README.md',
|
33
33
|
phase: 'PREPROCESS',
|
34
34
|
outline: 'NONE',
|
35
|
-
path: '/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/Users/ttscoff/
|
35
|
+
path: '/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/Users/ttscoff/Dropbox/Work/Oracle/oci-ai-industry-dbsolutions/text-analysis-and-translation/'
|
36
36
|
}
|
37
37
|
end
|
38
38
|
|
data/lib/conductor/version.rb
CHANGED
data/lib/conductor.rb
CHANGED
@@ -19,7 +19,7 @@ require_relative 'conductor/condition'
|
|
19
19
|
module Conductor
|
20
20
|
class << self
|
21
21
|
def stdin
|
22
|
-
@stdin ||= $stdin.read.strip if $stdin.stat.size.positive? || $stdin.fcntl(Fcntl::F_GETFL, 0).zero?
|
22
|
+
@stdin ||= $stdin.read.strip.force_encoding('utf-8') if $stdin.stat.size.positive? || $stdin.fcntl(Fcntl::F_GETFL, 0).zero?
|
23
23
|
end
|
24
24
|
end
|
25
25
|
end
|
data/src/_README.md
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
<!--README-->
|
2
|
-
[![RubyGems.org](https://img.shields.io/gem/v/
|
2
|
+
[![RubyGems.org](https://img.shields.io/gem/v/marked-conductor)](https://rubygems.org/gems/marked-conductor)
|
3
3
|
|
4
4
|
# Marked Conductor
|
5
5
|
|
@@ -73,7 +73,7 @@ Available conditions are:
|
|
73
73
|
- `path`: This tests just the path itself, allowing conditions like `path contains _drafts` or `path does not contain _posts`.
|
74
74
|
- `phase`: Tests whether Marked is in Preprocessor or Processor phase, allowing conditions like `phase is preprocess` or `phase is process` (which can be shortened to `pre` and `pro`).
|
75
75
|
- `text`: This tests for any string match within the text of the document being processed. This can be used with operators `starts with`, `ends with`, or `contains`, e.g. `text contains @taskpaper` or `text does not contain <!--more-->`.
|
76
|
-
- If the test value is surrounded by forward slashes, it will be treated as a regular expression. Regexes are always flagged as case insensitive. Use it like `text
|
76
|
+
- If the test value is surrounded by forward slashes, it will be treated as a regular expression. Regexes are always flagged as case insensitive. Use it like `text contains /@\w+/`.
|
77
77
|
- `yaml`, `headers`, or `frontmatter` will test for YAML headers. If a `yaml:KEY` is defined, a specific YAML key will be tested for. If a value is defined with an operator, it will be tested against the value key.
|
78
78
|
- `yaml` tests for the presence of YAML frontmatter.
|
79
79
|
- `yaml:comments` tests for the presence of a `comments` key.
|
@@ -108,6 +108,12 @@ Commands are interpreted as shell commands. If a command exists in the `$PATH`,
|
|
108
108
|
|
109
109
|
Using `$file` as an argument to a script or command will bypass processing of STDIN input, and instead use the value of $MARKED_PATH to read the contents of the specified file.
|
110
110
|
|
111
|
+
## Custom Processors
|
112
|
+
|
113
|
+
All of the [capabilities and requirements](https://marked2app.com/help/Custom_Processor) of a Custom Processor script or command still apply, and all of the [environment variables that Marked sets](https://marked2app.com/help/Custom_Processor#environmentvariables) are still available. You just no longer have to have one huge script that forks on the various environment variables and you don't have to write your own tests for handling different scenarios.
|
114
|
+
|
115
|
+
A script run by Conductor already knows it has the right type of file with the expected data and path, so your script can focus on just processing one file type. It's recommended to separate all of that logic you may already have written out into separate scripts and let Conductor handle the forking based on various criteria.
|
116
|
+
|
111
117
|
## Testing
|
112
118
|
|
113
119
|
In order to test from the command line, you'll need certain environment variables set. This can be done by exporting the following variables with your own definitions, or by running conductor with all of the variables preceding the command, e.g. `$ MARKED_ORIGIN=/path/to/markdown_file.md [...] conductor`.
|