marked-conductor 1.0.0 → 1.0.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f5d347b6741e69e739cca5e8884cc77c156e2f451297d68a47e34b0593355736
4
- data.tar.gz: 8c2bf87b1a8ce9f044cde76cb734d416b70d5a7a5ff701430df0c80344ddfe58
3
+ metadata.gz: '079981390f00381e4d8a8e72d4601689bfbd337a53c08a82fbb03f00e92e4fbf'
4
+ data.tar.gz: afded28efba89f40cb679d186dd073d1f7c021bf187d3dae69a755c82a0ed5e9
5
5
  SHA512:
6
- metadata.gz: b99b245f450a1977b77bceffa87290217465451356e0674c04f66e831c8fac450ec478c8fd25ab84ab532aa9d4a5496e9e8a6269a120d8cf4a00dcc2f6e795c9
7
- data.tar.gz: d4282745b2540640262c850000e893bc7cbf545674e233982e1ff64a543546c7070b23d0240b82dfdf5ca88ad7a26f20ab1017d6b632c30ad921285657b17ad0
6
+ metadata.gz: b73034fc92df9060a6544ce9b259af347a1388121d2497f57011f58fdbb4e180bea986297e7383a55743cb391d9736f009351fc9b838df2c40b7ce39fd04c33a
7
+ data.tar.gz: c42bbcee82174272b59eeda49b6632c4437038ddc260c0597ce20003dfc73bc56c7640651953d7e2ee6239ab5cc338d7a7998bc3ef95397f8bdc78b2722d97d5
data/CHANGELOG.md CHANGED
@@ -1,3 +1,15 @@
1
+ ### 1.0.2
2
+
3
+ 2024-04-25 14:15
4
+
5
+ #### CHANGED
6
+
7
+ - Prepped for gem release
8
+
9
+ #### FIXED
10
+
11
+ - Encoding issue affecting Shellwords.escape
12
+
1
13
  ### 1.0.0
2
14
 
3
15
  2024-04-25 10:51
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 matches @\w+`.
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`.
@@ -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/Library/Mobile Documents/9CR7T2DMDG~com~ngocluu~onewriter/Documents/nvALT2.2/',
32
- filepath: '/Users/ttscoff/Library/Mobile Documents/9CR7T2DMDG~com~ngocluu~onewriter/Documents/nvALT2.2/bt.com App Review- AeroPress timer for iPhone.md',
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/Library/Mobile Documents/9CR7T2DMDG~com~ngocluu~onewriter/Documents/nvALT2.2'
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
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Conductor
4
- VERSION = '1.0.0'
4
+ VERSION = '1.0.2'
5
5
  end
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/journal-cli)](https://rubygems.org/gems/journal-cli)
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 matches @\w+`.
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`.
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: marked-conductor
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brett Terpstra