marked-conductor 1.0.11 → 1.0.13

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: '0804a21e0ec1796869b539e638b140293ad0557da8f2821c8b2707ea52ca2f4c'
4
- data.tar.gz: 1da80616e987b04f403fd17ac9b5016b5d18990af9b8ba1754ff16cce5f10961
3
+ metadata.gz: 55f1d24332aec42ce9808bd2cf18ba75cd69c89828930a97239bcfb9d9b9d629
4
+ data.tar.gz: 4995332673049ee5235307a2b938e0e3e71a8085748597789484efde02a4ec56
5
5
  SHA512:
6
- metadata.gz: c50d075a5eb9abef4071b72405e41c60299b4df36eb49da590366dda00f82f1b7317806727b47a9d11c76c24244a916bbdcd57855dfb66a5d277398f12db15b9
7
- data.tar.gz: 47170b144559d23b5c5a988467efcfd14402961885951e805b0e5a8af66a76ed90a44454faea0572cb0d535867f232d37e20ae05ea9c5f3e601793a35f2f0d7a
6
+ metadata.gz: 89fa260f9b5efc1edcc7cb18ebd50ea5b3ab63669639dce30e0b7d43bcf20434f3c693316f77deea811475dc8a6d2387dc1a45e0c04014fb30125a97d774524e
7
+ data.tar.gz: 259f9e19257859cf0efeb6b69299dde021100ea27775c948b0c8bbf869f389e58d78307deb7498abfb68969542a3c5e5b32c068d9e05c7a9847fe6c06621b8fe
data/CHANGELOG.md CHANGED
@@ -1,3 +1,19 @@
1
+ ### 1.0.13
2
+
3
+ 2024-05-24 13:12
4
+
5
+ #### NEW
6
+
7
+ - New type of command -- filter: filterName(parameters), allows things like setStyle(github) or replace_all(regex, pattern) instead of having to write scripts for simple things like this. Can be run in sequences.
8
+
9
+ ### 1.0.12
10
+
11
+ 2024-05-01 13:06
12
+
13
+ #### FIXED
14
+
15
+ - Attempt to fix encoding error
16
+
1
17
  ### 1.0.11
2
18
 
3
19
  2024-04-29 09:46
data/README.md CHANGED
@@ -142,8 +142,8 @@ A script run by Conductor already knows it has the right type of file with the e
142
142
  ## Tips
143
143
 
144
144
  - Config file must be valid YAML. Any value containing colons, brackets, or other special characters should be quoted, e.g. (`condition: "text contains my:text"`)
145
- - You can see what condition matched in Marked by opening <b>Help->Show Custom Processor Log</b> and checking the STDERR output.
146
- - To run [a custom processor for Bear](https://brettterpstra.com/2023/10/08/marked-and-bear/), use the condition `"text contains <!-- source: bear.app -->"`
145
+ - You can see what condition matched in Marked by opening **Help->Show Custom Processor Log** and checking the STDERR output.
146
+ - To run [a custom processor for Bear](https://brettterpstra.com/2023/10/08/marked-and-bear/), use the condition `"text contains <!-- source: bear.app -->"`. You might consider running a commonmark CLI with Bear to support more of its syntax.
147
147
  - To run a custom processor for Obsidian, use the condition `tree contains .obsidian`
148
148
 
149
149
  ## Testing
@@ -154,6 +154,8 @@ In Marked's Custom Processor Log, you can see both the STDOUT output and the STD
154
154
 
155
155
  ### From the command line
156
156
 
157
+ > There's a script included in the repo called [test.sh](https://github.com/ttscoff/marked-conductor/blob/main/test.sh) that will take a file path as an argument and set all of the environment variables for testing. Run `test.sh -h` for usage instructions.
158
+
157
159
  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`.
158
160
 
159
161
  The following need to be defined. Some can be left as empty or to defaults, such as `MARKED_INCLUDES` and `MARKED_OUTLINE`, but all need to be set to something.
data/bin/conductor CHANGED
@@ -25,6 +25,10 @@ module Conductor
25
25
  command = Command.new(cmd[:command])
26
26
 
27
27
  res = command.run
28
+ elsif cmd[:filter]
29
+ filter = Filter.new(cmd[:filter])
30
+
31
+ res = filter.process
28
32
  end
29
33
 
30
34
  Conductor.stdin = res unless res.nil?
@@ -37,6 +41,10 @@ module Conductor
37
41
  command = Command.new(track[:command])
38
42
 
39
43
  Conductor.stdin = command.run
44
+ elsif track[:filter]
45
+ filter = Filter.new(track[:filter])
46
+
47
+ Conductor.stdin = filter.process
40
48
  end
41
49
 
42
50
  Conductor.stdin
data/html/Conductor.html CHANGED
@@ -154,7 +154,7 @@ sub-tracks.</pre>
154
154
  <p>@return [Array] result, matched condition(s)</p>
155
155
 
156
156
  <div class="method-source-code" id="conduct-source">
157
- <pre><span class="ruby-comment"># File bin/conductor, line 56</span>
157
+ <pre><span class="ruby-comment"># File bin/conductor, line 64</span>
158
158
  <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">conduct</span>(<span class="ruby-identifier">tracks</span>, <span class="ruby-identifier">res</span> = <span class="ruby-keyword">nil</span>, <span class="ruby-identifier">condition</span> = <span class="ruby-keyword">nil</span>)
159
159
  <span class="ruby-identifier">tracks</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">track</span><span class="ruby-operator">|</span>
160
160
  <span class="ruby-identifier">cond</span> = <span class="ruby-constant">Condition</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">track</span>[<span class="ruby-value">:condition</span>])
@@ -221,6 +221,10 @@ sub-tracks.</pre>
221
221
  <span class="ruby-identifier">command</span> = <span class="ruby-constant">Command</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">cmd</span>[<span class="ruby-value">:command</span>])
222
222
 
223
223
  <span class="ruby-identifier">res</span> = <span class="ruby-identifier">command</span>.<span class="ruby-identifier">run</span>
224
+ <span class="ruby-keyword">elsif</span> <span class="ruby-identifier">cmd</span>[<span class="ruby-value">:filter</span>]
225
+ <span class="ruby-identifier">filter</span> = <span class="ruby-constant">Filter</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">cmd</span>[<span class="ruby-value">:filter</span>])
226
+
227
+ <span class="ruby-identifier">res</span> = <span class="ruby-identifier">filter</span>.<span class="ruby-identifier">process</span>
224
228
  <span class="ruby-keyword">end</span>
225
229
 
226
230
  <span class="ruby-constant">Conductor</span>.<span class="ruby-identifier">stdin</span> = <span class="ruby-identifier">res</span> <span class="ruby-keyword">unless</span> <span class="ruby-identifier">res</span>.<span class="ruby-identifier">nil?</span>
@@ -233,6 +237,10 @@ sub-tracks.</pre>
233
237
  <span class="ruby-identifier">command</span> = <span class="ruby-constant">Command</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">track</span>[<span class="ruby-value">:command</span>])
234
238
 
235
239
  <span class="ruby-constant">Conductor</span>.<span class="ruby-identifier">stdin</span> = <span class="ruby-identifier">command</span>.<span class="ruby-identifier">run</span>
240
+ <span class="ruby-keyword">elsif</span> <span class="ruby-identifier">track</span>[<span class="ruby-value">:filter</span>]
241
+ <span class="ruby-identifier">filter</span> = <span class="ruby-constant">Filter</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">track</span>[<span class="ruby-value">:filter</span>])
242
+
243
+ <span class="ruby-constant">Conductor</span>.<span class="ruby-identifier">stdin</span> = <span class="ruby-identifier">filter</span>.<span class="ruby-identifier">process</span>
236
244
  <span class="ruby-keyword">end</span>
237
245
 
238
246
  <span class="ruby-constant">Conductor</span>.<span class="ruby-identifier">stdin</span>
@@ -256,10 +264,10 @@ sub-tracks.</pre>
256
264
 
257
265
 
258
266
  <div class="method-source-code" id="stdin-source">
259
- <pre><span class="ruby-comment"># File lib/conductor.rb, line 26</span>
267
+ <pre><span class="ruby-comment"># File lib/conductor.rb, line 27</span>
260
268
  <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">stdin</span>
261
269
  <span class="ruby-identifier">warn</span> <span class="ruby-string">&quot;input on STDIN required&quot;</span> <span class="ruby-keyword">unless</span> <span class="ruby-identifier">$stdin</span>.<span class="ruby-identifier">stat</span>.<span class="ruby-identifier">size</span>.<span class="ruby-identifier">positive?</span> <span class="ruby-operator">||</span> <span class="ruby-identifier">$stdin</span>.<span class="ruby-identifier">fcntl</span>(<span class="ruby-constant">Fcntl</span><span class="ruby-operator">::</span><span class="ruby-constant">F_GETFL</span>, <span class="ruby-value">0</span>).<span class="ruby-identifier">zero?</span>
262
- <span class="ruby-ivar">@stdin</span> <span class="ruby-operator">||=</span> <span class="ruby-identifier">$stdin</span>.<span class="ruby-identifier">read</span>.<span class="ruby-identifier">strip</span>.<span class="ruby-identifier">force_encoding</span>(<span class="ruby-string">&quot;utf-8&quot;</span>)
270
+ <span class="ruby-ivar">@stdin</span> <span class="ruby-operator">||=</span> <span class="ruby-identifier">$stdin</span>.<span class="ruby-identifier">read</span>.<span class="ruby-identifier">force_encoding</span>(<span class="ruby-string">&quot;utf-8&quot;</span>)
263
271
  <span class="ruby-keyword">end</span></pre>
264
272
  </div>
265
273
  </div>
data/html/Object.html CHANGED
@@ -114,7 +114,7 @@
114
114
  <p>@param condition The condition</p>
115
115
 
116
116
  <div class="method-source-code" id="clean_condition-source">
117
- <pre><span class="ruby-comment"># File bin/conductor, line 119</span>
117
+ <pre><span class="ruby-comment"># File bin/conductor, line 127</span>
118
118
  <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">clean_condition</span>(<span class="ruby-identifier">condition</span>)
119
119
  <span class="ruby-identifier">condition</span>.<span class="ruby-identifier">join</span>(<span class="ruby-string">&quot;&quot;</span>).<span class="ruby-identifier">sub</span>(<span class="ruby-regexp">/ *(-&gt;|,) *$/</span>, <span class="ruby-string">&quot;&quot;</span>)
120
120
  <span class="ruby-keyword">end</span></pre>