marked-conductor 1.0.14 → 1.0.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +9 -0
- data/README.md +6 -2
- data/html/Filter.html +23 -4
- data/html/String.html +239 -30
- data/html/created.rid +4 -4
- data/html/js/search_index.js +1 -1
- data/html/js/search_index.js.gz +0 -0
- data/html/table_of_contents.html +50 -20
- data/lib/conductor/filter.rb +88 -2
- data/lib/conductor/string.rb +22 -0
- data/lib/conductor/version.rb +1 -1
- data/src/_README.md +6 -2
- data/test.md +14 -0
- data/test.sh +4 -7
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d289620d1960ec33f53d30e34fe0b2dda1590f59ab97f6c84dc1051ec59556e6
|
4
|
+
data.tar.gz: f8f52753f27e15303deaeb3558f9506c944b1d8c8de4883173e19c6ded4b975f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f25710fb5a955089af61f9afd82a6e6c0a7ca2472f81d6063c130e806e92a29ab78b014887421acfc72253e8875b6537146a19cc4cbe2b7957e459725e988818
|
7
|
+
data.tar.gz: 0d88105def3581ba8c025a090a22d97ef60f89a3eaf5b06c04888a10b5f5470ae2239e5ebebbd65ca46d64a25d069726621698dd0b74f5e77442e4042df5673e
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,12 @@
|
|
1
|
+
### 1.0.15
|
2
|
+
|
3
|
+
2024-05-25 11:14
|
4
|
+
|
5
|
+
#### NEW
|
6
|
+
|
7
|
+
- New filter insertTOC(max, after) to insert a table of contents, optionally with max levels and after (start, *h1, or h2)
|
8
|
+
- New filter prepend/appendFile(path) to include a file (also pre/appendRaw and pre/appendCode)
|
9
|
+
|
1
10
|
### 1.0.14
|
2
11
|
|
3
12
|
2024-05-25 06:41
|
data/README.md
CHANGED
@@ -144,12 +144,16 @@ The action can be `script`, `command`, or `filter`.
|
|
144
144
|
| :---- | :---------- |
|
145
145
|
| `setMeta(key, value)` | adds or updates a meta key, aware of YAML and MMD |
|
146
146
|
| `stripMeta` | strips all metadata (YAML or MMD) from the content |
|
147
|
-
| `
|
148
|
-
| `setStyle(name)` | sets the Marked preview style to a preconfigured Style name
|
147
|
+
| `deleteMeta(key)` | removes a specific key (YAML or MMD) |
|
148
|
+
| `setStyle(name)` | sets the Marked preview style to a preconfigured Style name |
|
149
149
|
| `replace(search, replace)` | performs a (single) search and replace on content |
|
150
150
|
| `replaceAll(search, replace)` | global version of `replaceAll`) |
|
151
151
|
| `insertTitle` | adds a title to the document, either from metadata or filename |
|
152
152
|
| `insertScript(path[,path])` | injects javascript(s) |
|
153
|
+
| `insertTOC(max, after)` | insert TOC (max=max levels, after=start, \*h1, or h2) |
|
154
|
+
| `prepend/appendFile(path)` | insert a file as Markdown at beginning or end of content |
|
155
|
+
| `prepend/appendRaw(path)` | insert a file as raw HTML at beginning or end of content |
|
156
|
+
| `prepend/appendCode(path)` | insert a file as a code block at beginning or end of content |
|
153
157
|
|
154
158
|
For `insertScript`, if path is just a filename it will look for a match in `~/.config/conductor/javascript` or `~/.config/conductor/scripts` and turn that into an absolute path if the file is found.
|
155
159
|
|
data/html/Filter.html
CHANGED
@@ -145,7 +145,7 @@
|
|
145
145
|
</div>
|
146
146
|
|
147
147
|
<div class="method-source-code" id="new-source">
|
148
|
-
<pre><span class="ruby-comment"># File lib/conductor/filter.rb, line
|
148
|
+
<pre><span class="ruby-comment"># File lib/conductor/filter.rb, line 288</span>
|
149
149
|
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">initialize</span>(<span class="ruby-identifier">filter</span>)
|
150
150
|
<span class="ruby-ivar">@filter</span>, <span class="ruby-ivar">@params</span> = <span class="ruby-identifier">filter</span>.<span class="ruby-identifier">normalize_filter</span>
|
151
151
|
<span class="ruby-keyword">super</span>
|
@@ -176,7 +176,7 @@
|
|
176
176
|
|
177
177
|
|
178
178
|
<div class="method-source-code" id="process-source">
|
179
|
-
<pre><span class="ruby-comment"># File lib/conductor/filter.rb, line
|
179
|
+
<pre><span class="ruby-comment"># File lib/conductor/filter.rb, line 293</span>
|
180
180
|
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">process</span>
|
181
181
|
<span class="ruby-identifier">content</span> = <span class="ruby-constant">Conductor</span>.<span class="ruby-identifier">stdin</span>
|
182
182
|
|
@@ -189,6 +189,25 @@
|
|
189
189
|
<span class="ruby-identifier">content</span> = <span class="ruby-identifier">content</span>.<span class="ruby-identifier">insert_script</span>(<span class="ruby-identifier">script</span>)
|
190
190
|
<span class="ruby-keyword">end</span>
|
191
191
|
<span class="ruby-node">"#{content}</div>"</span>
|
192
|
+
<span class="ruby-keyword">when</span> <span class="ruby-regexp">/(prepend|append|insert|inject)(raw|file|code)/</span>
|
193
|
+
<span class="ruby-identifier">m</span> = <span class="ruby-constant">Regexp</span>.<span class="ruby-identifier">last_match</span>
|
194
|
+
|
195
|
+
<span class="ruby-identifier">position</span> = <span class="ruby-keyword">if</span> <span class="ruby-ivar">@params</span>.<span class="ruby-identifier">count</span> <span class="ruby-operator">==</span> <span class="ruby-value">2</span>
|
196
|
+
<span class="ruby-ivar">@params</span>[<span class="ruby-value">1</span>].<span class="ruby-identifier">normalize_position</span>
|
197
|
+
<span class="ruby-keyword">else</span>
|
198
|
+
<span class="ruby-identifier">m</span>[<span class="ruby-value">1</span>].<span class="ruby-identifier">normalize_position</span>
|
199
|
+
<span class="ruby-keyword">end</span>
|
200
|
+
<span class="ruby-identifier">content</span>.<span class="ruby-identifier">insert_file</span>(<span class="ruby-ivar">@params</span>[<span class="ruby-value">0</span>], <span class="ruby-identifier">m</span>[<span class="ruby-value">2</span>].<span class="ruby-identifier">normalize_include_type</span>, <span class="ruby-identifier">position</span>)
|
201
|
+
<span class="ruby-keyword">when</span> <span class="ruby-regexp">/inserttoc/</span>
|
202
|
+
<span class="ruby-identifier">max</span> = <span class="ruby-ivar">@params</span>.<span class="ruby-identifier">count</span>.<span class="ruby-identifier">positive?</span> <span class="ruby-operator">?</span> <span class="ruby-ivar">@params</span>[<span class="ruby-value">0</span>] <span class="ruby-operator">:</span> <span class="ruby-keyword">nil</span>
|
203
|
+
|
204
|
+
<span class="ruby-keyword">if</span> <span class="ruby-ivar">@params</span>.<span class="ruby-identifier">count</span> <span class="ruby-operator">==</span> <span class="ruby-value">2</span>
|
205
|
+
<span class="ruby-identifier">after</span> = <span class="ruby-ivar">@params</span>[<span class="ruby-value">1</span>] <span class="ruby-operator">=~</span> <span class="ruby-regexp">/2/</span> <span class="ruby-operator">?</span> <span class="ruby-value">:h2</span> <span class="ruby-operator">:</span> <span class="ruby-value">:h1</span>
|
206
|
+
<span class="ruby-keyword">else</span>
|
207
|
+
<span class="ruby-identifier">after</span> = <span class="ruby-value">:start</span>
|
208
|
+
<span class="ruby-keyword">end</span>
|
209
|
+
|
210
|
+
<span class="ruby-identifier">content</span>.<span class="ruby-identifier">insert_toc</span>(<span class="ruby-identifier">max</span>, <span class="ruby-identifier">after</span>)
|
192
211
|
<span class="ruby-keyword">when</span> <span class="ruby-regexp">/(add|set)meta/</span>
|
193
212
|
<span class="ruby-keyword">unless</span> <span class="ruby-ivar">@params</span>.<span class="ruby-identifier">count</span> <span class="ruby-operator">==</span> <span class="ruby-value">2</span>
|
194
213
|
<span class="ruby-identifier">warn</span> <span class="ruby-node">"Invalid filter parameters: #{@filter}(#{@params.join(",")})"</span>
|
@@ -198,8 +217,8 @@
|
|
198
217
|
<span class="ruby-comment"># needs to test for existing meta, setting key if exists, adding if not</span>
|
199
218
|
<span class="ruby-comment"># should recognize yaml and mmd</span>
|
200
219
|
<span class="ruby-identifier">content</span>.<span class="ruby-identifier">set_meta</span>(<span class="ruby-ivar">@params</span>[<span class="ruby-value">0</span>], <span class="ruby-ivar">@params</span>[<span class="ruby-value">1</span>], <span class="ruby-value">style:</span> <span class="ruby-identifier">content</span>.<span class="ruby-identifier">meta_type</span>)
|
201
|
-
<span class="ruby-keyword">when</span> <span class="ruby-regexp">/(strip|remove)meta/</span>
|
202
|
-
<span class="ruby-keyword">if</span> <span class="ruby-ivar">@params</span>
|
220
|
+
<span class="ruby-keyword">when</span> <span class="ruby-regexp">/(strip|remove|delete)meta/</span>
|
221
|
+
<span class="ruby-keyword">if</span> <span class="ruby-ivar">@params</span>&.<span class="ruby-identifier">count</span>.<span class="ruby-identifier">positive?</span>
|
203
222
|
<span class="ruby-identifier">content</span>.<span class="ruby-identifier">delete_meta</span>(<span class="ruby-ivar">@params</span>[<span class="ruby-value">0</span>])
|
204
223
|
<span class="ruby-keyword">else</span>
|
205
224
|
<span class="ruby-identifier">content</span>.<span class="ruby-identifier">strip_meta</span>
|
data/html/String.html
CHANGED
@@ -82,14 +82,20 @@
|
|
82
82
|
<li ><a href="#method-i-delete_meta">#delete_meta</a>
|
83
83
|
<li ><a href="#method-i-delete_mmd">#delete_mmd</a>
|
84
84
|
<li ><a href="#method-i-delete_yaml">#delete_yaml</a>
|
85
|
+
<li ><a href="#method-i-first_h1">#first_h1</a>
|
86
|
+
<li ><a href="#method-i-first_h2">#first_h2</a>
|
85
87
|
<li ><a href="#method-i-get_title">#get_title</a>
|
86
88
|
<li ><a href="#method-i-has_comment-3F">#has_comment?</a>
|
89
|
+
<li ><a href="#method-i-insert_file">#insert_file</a>
|
87
90
|
<li ><a href="#method-i-insert_script">#insert_script</a>
|
88
91
|
<li ><a href="#method-i-insert_title">#insert_title</a>
|
92
|
+
<li ><a href="#method-i-insert_toc">#insert_toc</a>
|
89
93
|
<li ><a href="#method-i-meta-3F">#meta?</a>
|
90
94
|
<li ><a href="#method-i-meta_insert_point">#meta_insert_point</a>
|
91
95
|
<li ><a href="#method-i-meta_type">#meta_type</a>
|
92
96
|
<li ><a href="#method-i-normalize_filter">#normalize_filter</a>
|
97
|
+
<li ><a href="#method-i-normalize_include_type">#normalize_include_type</a>
|
98
|
+
<li ><a href="#method-i-normalize_position">#normalize_position</a>
|
93
99
|
<li ><a href="#method-i-number-3F">#number?</a>
|
94
100
|
<li ><a href="#method-i-replace">#replace</a>
|
95
101
|
<li ><a href="#method-i-replace_all">#replace_all</a>
|
@@ -149,7 +155,7 @@
|
|
149
155
|
|
150
156
|
|
151
157
|
<div class="method-source-code" id="add_comment-source">
|
152
|
-
<pre><span class="ruby-comment"># File lib/conductor/filter.rb, line
|
158
|
+
<pre><span class="ruby-comment"># File lib/conductor/filter.rb, line 231</span>
|
153
159
|
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">add_comment</span>(<span class="ruby-identifier">key</span>, <span class="ruby-identifier">value</span>)
|
154
160
|
<span class="ruby-keyword">if</span> <span class="ruby-identifier">has_comment?</span>(<span class="ruby-identifier">key</span>)
|
155
161
|
<span class="ruby-identifier">sub</span>(<span class="ruby-regexp">/ *#{key}: .*?$/</span>, <span class="ruby-node">"#{key}: #{value}"</span>)
|
@@ -178,7 +184,7 @@
|
|
178
184
|
|
179
185
|
|
180
186
|
<div class="method-source-code" id="add_mmd-source">
|
181
|
-
<pre><span class="ruby-comment"># File lib/conductor/filter.rb, line
|
187
|
+
<pre><span class="ruby-comment"># File lib/conductor/filter.rb, line 213</span>
|
182
188
|
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">add_mmd</span>(<span class="ruby-identifier">key</span>, <span class="ruby-identifier">value</span>)
|
183
189
|
<span class="ruby-keyword">if</span> <span class="ruby-identifier">match</span>(<span class="ruby-regexp">/(\A|\n) *#{key}: *\S+/i</span>)
|
184
190
|
<span class="ruby-identifier">sub</span>(<span class="ruby-regexp">/^ *#{key}:.*?\n/i</span>, <span class="ruby-node">"#{key}: #{value}\n"</span>)
|
@@ -207,7 +213,7 @@
|
|
207
213
|
|
208
214
|
|
209
215
|
<div class="method-source-code" id="add_yaml-source">
|
210
|
-
<pre><span class="ruby-comment"># File lib/conductor/filter.rb, line
|
216
|
+
<pre><span class="ruby-comment"># File lib/conductor/filter.rb, line 195</span>
|
211
217
|
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">add_yaml</span>(<span class="ruby-identifier">key</span>, <span class="ruby-identifier">value</span>)
|
212
218
|
<span class="ruby-identifier">sub</span>(<span class="ruby-regexp">/^---.*?\n(---|\.\.\.)/m</span>) <span class="ruby-keyword">do</span>
|
213
219
|
<span class="ruby-identifier">m</span> = <span class="ruby-constant">Regexp</span>.<span class="ruby-identifier">last_match</span>
|
@@ -235,7 +241,7 @@
|
|
235
241
|
|
236
242
|
|
237
243
|
<div class="method-source-code" id="append-source">
|
238
|
-
<pre><span class="ruby-comment"># File lib/conductor/filter.rb, line
|
244
|
+
<pre><span class="ruby-comment"># File lib/conductor/filter.rb, line 117</span>
|
239
245
|
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">append</span>(<span class="ruby-identifier">string</span>)
|
240
246
|
<span class="ruby-node">"#{self}\n#{string}"</span>
|
241
247
|
<span class="ruby-keyword">end</span></pre>
|
@@ -260,7 +266,7 @@
|
|
260
266
|
<p>@return [Boolean] test result</p>
|
261
267
|
|
262
268
|
<div class="method-source-code" id="bool-3F-source">
|
263
|
-
<pre><span class="ruby-comment"># File lib/conductor/string.rb, line
|
269
|
+
<pre><span class="ruby-comment"># File lib/conductor/string.rb, line 108</span>
|
264
270
|
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">bool?</span>
|
265
271
|
<span class="ruby-identifier">dup</span>.<span class="ruby-identifier">force_encoding</span>(<span class="ruby-string">"utf-8"</span>).<span class="ruby-identifier">match?</span>(<span class="ruby-regexp">/^(?:y(?:es)?|no?|t(?:rue)?|f(?:alse)?)$/</span>)
|
266
272
|
<span class="ruby-keyword">end</span></pre>
|
@@ -285,7 +291,7 @@
|
|
285
291
|
<p>@return [Symbol] symbolized version</p>
|
286
292
|
|
287
293
|
<div class="method-source-code" id="bool_to_symbol-source">
|
288
|
-
<pre><span class="ruby-comment"># File lib/conductor/string.rb, line
|
294
|
+
<pre><span class="ruby-comment"># File lib/conductor/string.rb, line 41</span>
|
289
295
|
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">bool_to_symbol</span>
|
290
296
|
<span class="ruby-keyword">case</span> <span class="ruby-keyword">self</span>
|
291
297
|
<span class="ruby-keyword">when</span> <span class="ruby-regexp">/(NOT|!!)/</span>
|
@@ -317,7 +323,7 @@
|
|
317
323
|
<p>@return [Boolean] test result</p>
|
318
324
|
|
319
325
|
<div class="method-source-code" id="date-3F-source">
|
320
|
-
<pre><span class="ruby-comment"># File lib/conductor/string.rb, line
|
326
|
+
<pre><span class="ruby-comment"># File lib/conductor/string.rb, line 57</span>
|
321
327
|
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">date?</span>
|
322
328
|
<span class="ruby-identifier">dup</span>.<span class="ruby-identifier">force_encoding</span>(<span class="ruby-string">"utf-8"</span>).<span class="ruby-identifier">match?</span>(<span class="ruby-regexp">/^\d{4}-\d{2}-\d{2}( \d\d:\d\d)?$/</span>)
|
323
329
|
<span class="ruby-keyword">end</span></pre>
|
@@ -340,7 +346,7 @@
|
|
340
346
|
|
341
347
|
|
342
348
|
<div class="method-source-code" id="delete_meta-source">
|
343
|
-
<pre><span class="ruby-comment"># File lib/conductor/filter.rb, line
|
349
|
+
<pre><span class="ruby-comment"># File lib/conductor/filter.rb, line 241</span>
|
344
350
|
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">delete_meta</span>(<span class="ruby-identifier">key</span>)
|
345
351
|
<span class="ruby-keyword">case</span> <span class="ruby-identifier">meta_type</span>
|
346
352
|
<span class="ruby-keyword">when</span> <span class="ruby-value">:yaml</span>
|
@@ -368,7 +374,7 @@
|
|
368
374
|
|
369
375
|
|
370
376
|
<div class="method-source-code" id="delete_mmd-source">
|
371
|
-
<pre><span class="ruby-comment"># File lib/conductor/filter.rb, line
|
377
|
+
<pre><span class="ruby-comment"># File lib/conductor/filter.rb, line 223</span>
|
372
378
|
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">delete_mmd</span>(<span class="ruby-identifier">key</span>)
|
373
379
|
<span class="ruby-identifier">sub</span>(<span class="ruby-regexp">/^ *#{key}:.*?\n/i</span>, <span class="ruby-string">""</span>)
|
374
380
|
<span class="ruby-keyword">end</span></pre>
|
@@ -391,7 +397,7 @@
|
|
391
397
|
|
392
398
|
|
393
399
|
<div class="method-source-code" id="delete_yaml-source">
|
394
|
-
<pre><span class="ruby-comment"># File lib/conductor/filter.rb, line
|
400
|
+
<pre><span class="ruby-comment"># File lib/conductor/filter.rb, line 204</span>
|
395
401
|
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">delete_yaml</span>(<span class="ruby-identifier">key</span>)
|
396
402
|
<span class="ruby-identifier">sub</span>(<span class="ruby-regexp">/^---.*?\n(---|\.\.\.)/m</span>) <span class="ruby-keyword">do</span>
|
397
403
|
<span class="ruby-identifier">m</span> = <span class="ruby-constant">Regexp</span>.<span class="ruby-identifier">last_match</span>
|
@@ -404,6 +410,66 @@
|
|
404
410
|
</div>
|
405
411
|
|
406
412
|
|
413
|
+
</div>
|
414
|
+
|
415
|
+
<div id="method-i-first_h1" class="method-detail ">
|
416
|
+
<div class="method-header">
|
417
|
+
<div class="method-heading">
|
418
|
+
<span class="method-name">first_h1</span><span
|
419
|
+
class="method-args">()</span>
|
420
|
+
<span class="method-click-advice">click to toggle source</span>
|
421
|
+
</div>
|
422
|
+
</div>
|
423
|
+
|
424
|
+
<div class="method-description">
|
425
|
+
|
426
|
+
|
427
|
+
<div class="method-source-code" id="first_h1-source">
|
428
|
+
<pre><span class="ruby-comment"># File lib/conductor/filter.rb, line 50</span>
|
429
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">first_h1</span>
|
430
|
+
<span class="ruby-identifier">first</span> = <span class="ruby-value">0</span>
|
431
|
+
<span class="ruby-identifier">split</span>(<span class="ruby-regexp">/\n/</span>).<span class="ruby-identifier">each_with_index</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">line</span>, <span class="ruby-identifier">idx</span><span class="ruby-operator">|</span>
|
432
|
+
<span class="ruby-keyword">if</span> <span class="ruby-identifier">line</span> <span class="ruby-operator">=~</span> <span class="ruby-regexp">/^(# *\S|={2,} *$)/</span>
|
433
|
+
<span class="ruby-identifier">first</span> = <span class="ruby-identifier">idx</span>
|
434
|
+
<span class="ruby-keyword">break</span>
|
435
|
+
<span class="ruby-keyword">end</span>
|
436
|
+
<span class="ruby-keyword">end</span>
|
437
|
+
<span class="ruby-identifier">first</span>
|
438
|
+
<span class="ruby-keyword">end</span></pre>
|
439
|
+
</div>
|
440
|
+
</div>
|
441
|
+
|
442
|
+
|
443
|
+
</div>
|
444
|
+
|
445
|
+
<div id="method-i-first_h2" class="method-detail ">
|
446
|
+
<div class="method-header">
|
447
|
+
<div class="method-heading">
|
448
|
+
<span class="method-name">first_h2</span><span
|
449
|
+
class="method-args">()</span>
|
450
|
+
<span class="method-click-advice">click to toggle source</span>
|
451
|
+
</div>
|
452
|
+
</div>
|
453
|
+
|
454
|
+
<div class="method-description">
|
455
|
+
|
456
|
+
|
457
|
+
<div class="method-source-code" id="first_h2-source">
|
458
|
+
<pre><span class="ruby-comment"># File lib/conductor/filter.rb, line 61</span>
|
459
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">first_h2</span>
|
460
|
+
<span class="ruby-identifier">first</span> = <span class="ruby-value">0</span>
|
461
|
+
<span class="ruby-identifier">split</span>(<span class="ruby-regexp">/\n/</span>).<span class="ruby-identifier">each_with_index</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">line</span>, <span class="ruby-identifier">idx</span><span class="ruby-operator">|</span>
|
462
|
+
<span class="ruby-keyword">if</span> <span class="ruby-identifier">line</span> <span class="ruby-operator">=~</span> <span class="ruby-regexp">/^(## *\S|-{2,} *$)/</span>
|
463
|
+
<span class="ruby-identifier">first</span> = <span class="ruby-identifier">idx</span>
|
464
|
+
<span class="ruby-keyword">break</span>
|
465
|
+
<span class="ruby-keyword">end</span>
|
466
|
+
<span class="ruby-keyword">end</span>
|
467
|
+
<span class="ruby-identifier">first</span>
|
468
|
+
<span class="ruby-keyword">end</span></pre>
|
469
|
+
</div>
|
470
|
+
</div>
|
471
|
+
|
472
|
+
|
407
473
|
</div>
|
408
474
|
|
409
475
|
<div id="method-i-get_title" class="method-detail ">
|
@@ -419,7 +485,7 @@
|
|
419
485
|
|
420
486
|
|
421
487
|
<div class="method-source-code" id="get_title-source">
|
422
|
-
<pre><span class="ruby-comment"># File lib/conductor/filter.rb, line
|
488
|
+
<pre><span class="ruby-comment"># File lib/conductor/filter.rb, line 150</span>
|
423
489
|
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">get_title</span>
|
424
490
|
<span class="ruby-identifier">title</span> = <span class="ruby-keyword">nil</span>
|
425
491
|
|
@@ -463,7 +529,7 @@
|
|
463
529
|
|
464
530
|
|
465
531
|
<div class="method-source-code" id="has_comment-3F-source">
|
466
|
-
<pre><span class="ruby-comment"># File lib/conductor/filter.rb, line
|
532
|
+
<pre><span class="ruby-comment"># File lib/conductor/filter.rb, line 227</span>
|
467
533
|
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">has_comment?</span>(<span class="ruby-identifier">key</span>)
|
468
534
|
<span class="ruby-identifier">match</span>(<span class="ruby-regexp">/^<!--.*?#{key}: \S.*?-->/m</span>)
|
469
535
|
<span class="ruby-keyword">end</span></pre>
|
@@ -471,6 +537,55 @@
|
|
471
537
|
</div>
|
472
538
|
|
473
539
|
|
540
|
+
</div>
|
541
|
+
|
542
|
+
<div id="method-i-insert_file" class="method-detail ">
|
543
|
+
<div class="method-header">
|
544
|
+
<div class="method-heading">
|
545
|
+
<span class="method-name">insert_file</span><span
|
546
|
+
class="method-args">(path, type = :file, position = :end)</span>
|
547
|
+
<span class="method-click-advice">click to toggle source</span>
|
548
|
+
</div>
|
549
|
+
</div>
|
550
|
+
|
551
|
+
<div class="method-description">
|
552
|
+
|
553
|
+
|
554
|
+
<div class="method-source-code" id="insert_file-source">
|
555
|
+
<pre><span class="ruby-comment"># File lib/conductor/filter.rb, line 87</span>
|
556
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">insert_file</span>(<span class="ruby-identifier">path</span>, <span class="ruby-identifier">type</span> = <span class="ruby-value">:file</span>, <span class="ruby-identifier">position</span> = <span class="ruby-value">:end</span>)
|
557
|
+
<span class="ruby-identifier">path</span>.<span class="ruby-identifier">strip!</span>
|
558
|
+
|
559
|
+
<span class="ruby-keyword">if</span> <span class="ruby-identifier">path</span> <span class="ruby-operator">=~</span> <span class="ruby-regexp">%r{^[~/]}</span>
|
560
|
+
<span class="ruby-identifier">path</span> = <span class="ruby-constant">File</span>.<span class="ruby-identifier">expand_path</span>(<span class="ruby-identifier">path</span>)
|
561
|
+
<span class="ruby-keyword">elsif</span> <span class="ruby-constant">File</span>.<span class="ruby-identifier">directory?</span>(<span class="ruby-constant">File</span>.<span class="ruby-identifier">expand_path</span>(<span class="ruby-string">"~/.config/conductor/files"</span>))
|
562
|
+
<span class="ruby-identifier">new_path</span> = <span class="ruby-constant">File</span>.<span class="ruby-identifier">expand_path</span>(<span class="ruby-node">"~/.config/conductor/files/#{path}"</span>)
|
563
|
+
<span class="ruby-identifier">path</span> = <span class="ruby-identifier">new_path</span> <span class="ruby-keyword">if</span> <span class="ruby-constant">File</span>.<span class="ruby-identifier">exist?</span>(<span class="ruby-identifier">new_path</span>)
|
564
|
+
<span class="ruby-keyword">end</span>
|
565
|
+
|
566
|
+
<span class="ruby-identifier">out</span> = <span class="ruby-keyword">case</span> <span class="ruby-identifier">type</span>
|
567
|
+
<span class="ruby-keyword">when</span> <span class="ruby-value">:code</span>
|
568
|
+
<span class="ruby-node">"<<(#{path})"</span>
|
569
|
+
<span class="ruby-keyword">when</span> <span class="ruby-value">:raw</span>
|
570
|
+
<span class="ruby-node">"<<{#{path}}"</span>
|
571
|
+
<span class="ruby-keyword">else</span>
|
572
|
+
<span class="ruby-node">"<<[#{path}]"</span>
|
573
|
+
<span class="ruby-keyword">end</span>
|
574
|
+
<span class="ruby-identifier">out</span> = <span class="ruby-node">"\n#{out}\n"</span>
|
575
|
+
|
576
|
+
<span class="ruby-keyword">case</span> <span class="ruby-identifier">position</span>
|
577
|
+
<span class="ruby-keyword">when</span> <span class="ruby-value">:start</span>
|
578
|
+
<span class="ruby-node">"#{out}\n#{self}"</span>
|
579
|
+
<span class="ruby-keyword">when</span> <span class="ruby-value">:h1</span>
|
580
|
+
<span class="ruby-identifier">split</span>(<span class="ruby-regexp">/\n/</span>).<span class="ruby-identifier">insert</span>(<span class="ruby-identifier">first_h1</span> <span class="ruby-operator">+</span> <span class="ruby-value">1</span>, <span class="ruby-identifier">out</span>).<span class="ruby-identifier">join</span>(<span class="ruby-string">"\n"</span>)
|
581
|
+
<span class="ruby-keyword">else</span>
|
582
|
+
<span class="ruby-node">"#{self}\n#{out}"</span>
|
583
|
+
<span class="ruby-keyword">end</span>
|
584
|
+
<span class="ruby-keyword">end</span></pre>
|
585
|
+
</div>
|
586
|
+
</div>
|
587
|
+
|
588
|
+
|
474
589
|
</div>
|
475
590
|
|
476
591
|
<div id="method-i-insert_script" class="method-detail ">
|
@@ -486,7 +601,7 @@
|
|
486
601
|
|
487
602
|
|
488
603
|
<div class="method-source-code" id="insert_script-source">
|
489
|
-
<pre><span class="ruby-comment"># File lib/conductor/filter.rb, line
|
604
|
+
<pre><span class="ruby-comment"># File lib/conductor/filter.rb, line 121</span>
|
490
605
|
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">insert_script</span>(<span class="ruby-identifier">path</span>)
|
491
606
|
<span class="ruby-identifier">path</span>.<span class="ruby-identifier">strip!</span>
|
492
607
|
<span class="ruby-identifier">path</span> = <span class="ruby-node">"#{path}.js"</span> <span class="ruby-keyword">unless</span> <span class="ruby-identifier">path</span> <span class="ruby-operator">=~</span> <span class="ruby-regexp">/\.js$/</span>
|
@@ -526,7 +641,7 @@
|
|
526
641
|
|
527
642
|
|
528
643
|
<div class="method-source-code" id="insert_title-source">
|
529
|
-
<pre><span class="ruby-comment"># File lib/conductor/filter.rb, line
|
644
|
+
<pre><span class="ruby-comment"># File lib/conductor/filter.rb, line 175</span>
|
530
645
|
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">insert_title</span>
|
531
646
|
<span class="ruby-identifier">title</span> = <span class="ruby-identifier">get_title</span>
|
532
647
|
<span class="ruby-identifier">lines</span> = <span class="ruby-identifier">split</span>(<span class="ruby-regexp">/\n/</span>)
|
@@ -539,6 +654,40 @@
|
|
539
654
|
</div>
|
540
655
|
|
541
656
|
|
657
|
+
</div>
|
658
|
+
|
659
|
+
<div id="method-i-insert_toc" class="method-detail ">
|
660
|
+
<div class="method-header">
|
661
|
+
<div class="method-heading">
|
662
|
+
<span class="method-name">insert_toc</span><span
|
663
|
+
class="method-args">(max = nil, after = :h1)</span>
|
664
|
+
<span class="method-click-advice">click to toggle source</span>
|
665
|
+
</div>
|
666
|
+
</div>
|
667
|
+
|
668
|
+
<div class="method-description">
|
669
|
+
|
670
|
+
|
671
|
+
<div class="method-source-code" id="insert_toc-source">
|
672
|
+
<pre><span class="ruby-comment"># File lib/conductor/filter.rb, line 72</span>
|
673
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">insert_toc</span>(<span class="ruby-identifier">max</span> = <span class="ruby-keyword">nil</span>, <span class="ruby-identifier">after</span> = <span class="ruby-value">:h1</span>)
|
674
|
+
<span class="ruby-identifier">lines</span> = <span class="ruby-identifier">split</span>(<span class="ruby-regexp">/\n/</span>)
|
675
|
+
<span class="ruby-identifier">max</span> = <span class="ruby-identifier">max</span> <span class="ruby-operator">&&</span> <span class="ruby-identifier">max</span>.<span class="ruby-identifier">to_i</span>.<span class="ruby-identifier">positive?</span> <span class="ruby-operator">?</span> <span class="ruby-node">" max#{max}"</span> <span class="ruby-operator">:</span> <span class="ruby-string">""</span>
|
676
|
+
<span class="ruby-identifier">line</span> = <span class="ruby-keyword">case</span> <span class="ruby-identifier">after</span>.<span class="ruby-identifier">to_sym</span>
|
677
|
+
<span class="ruby-keyword">when</span> <span class="ruby-value">:h2</span>
|
678
|
+
<span class="ruby-identifier">first_h2</span>.<span class="ruby-identifier">positive?</span> <span class="ruby-operator">?</span> <span class="ruby-identifier">first_h2</span> <span class="ruby-operator">+</span> <span class="ruby-value">1</span> <span class="ruby-operator">:</span> <span class="ruby-value">0</span>
|
679
|
+
<span class="ruby-keyword">when</span> <span class="ruby-value">:h1</span>
|
680
|
+
<span class="ruby-identifier">first_h1</span>.<span class="ruby-identifier">positive?</span> <span class="ruby-operator">?</span> <span class="ruby-identifier">first_h1</span> <span class="ruby-operator">+</span> <span class="ruby-value">1</span> <span class="ruby-operator">:</span> <span class="ruby-value">0</span>
|
681
|
+
<span class="ruby-keyword">else</span>
|
682
|
+
<span class="ruby-value">0</span>
|
683
|
+
<span class="ruby-keyword">end</span>
|
684
|
+
|
685
|
+
<span class="ruby-identifier">lines</span>.<span class="ruby-identifier">insert</span>(<span class="ruby-identifier">line</span>, <span class="ruby-node">"\n<!--toc#{max}-->\n"</span>).<span class="ruby-identifier">join</span>(<span class="ruby-string">"\n"</span>)
|
686
|
+
<span class="ruby-keyword">end</span></pre>
|
687
|
+
</div>
|
688
|
+
</div>
|
689
|
+
|
690
|
+
|
542
691
|
</div>
|
543
692
|
|
544
693
|
<div id="method-i-meta-3F" class="method-detail ">
|
@@ -556,7 +705,7 @@
|
|
556
705
|
<p>@return [Boolean] test result</p>
|
557
706
|
|
558
707
|
<div class="method-source-code" id="meta-3F-source">
|
559
|
-
<pre><span class="ruby-comment"># File lib/conductor/string.rb, line
|
708
|
+
<pre><span class="ruby-comment"># File lib/conductor/string.rb, line 126</span>
|
560
709
|
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">meta?</span>
|
561
710
|
<span class="ruby-identifier">dup</span>.<span class="ruby-identifier">force_encoding</span>(<span class="ruby-string">'utf-8'</span>).<span class="ruby-identifier">match?</span>(<span class="ruby-regexp">/^\w+: +\S+/m</span>)
|
562
711
|
<span class="ruby-keyword">end</span></pre>
|
@@ -666,6 +815,66 @@
|
|
666
815
|
</div>
|
667
816
|
|
668
817
|
|
818
|
+
</div>
|
819
|
+
|
820
|
+
<div id="method-i-normalize_include_type" class="method-detail ">
|
821
|
+
<div class="method-header">
|
822
|
+
<div class="method-heading">
|
823
|
+
<span class="method-name">normalize_include_type</span><span
|
824
|
+
class="method-args">()</span>
|
825
|
+
<span class="method-click-advice">click to toggle source</span>
|
826
|
+
</div>
|
827
|
+
</div>
|
828
|
+
|
829
|
+
<div class="method-description">
|
830
|
+
|
831
|
+
|
832
|
+
<div class="method-source-code" id="normalize_include_type-source">
|
833
|
+
<pre><span class="ruby-comment"># File lib/conductor/string.rb, line 25</span>
|
834
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">normalize_include_type</span>
|
835
|
+
<span class="ruby-keyword">case</span> <span class="ruby-keyword">self</span>
|
836
|
+
<span class="ruby-keyword">when</span> <span class="ruby-regexp">/^c/</span>
|
837
|
+
<span class="ruby-value">:code</span>
|
838
|
+
<span class="ruby-keyword">when</span> <span class="ruby-regexp">/^r/</span>
|
839
|
+
<span class="ruby-value">:raw</span>
|
840
|
+
<span class="ruby-keyword">else</span>
|
841
|
+
<span class="ruby-value">:file</span>
|
842
|
+
<span class="ruby-keyword">end</span>
|
843
|
+
<span class="ruby-keyword">end</span></pre>
|
844
|
+
</div>
|
845
|
+
</div>
|
846
|
+
|
847
|
+
|
848
|
+
</div>
|
849
|
+
|
850
|
+
<div id="method-i-normalize_position" class="method-detail ">
|
851
|
+
<div class="method-header">
|
852
|
+
<div class="method-heading">
|
853
|
+
<span class="method-name">normalize_position</span><span
|
854
|
+
class="method-args">()</span>
|
855
|
+
<span class="method-click-advice">click to toggle source</span>
|
856
|
+
</div>
|
857
|
+
</div>
|
858
|
+
|
859
|
+
<div class="method-description">
|
860
|
+
|
861
|
+
|
862
|
+
<div class="method-source-code" id="normalize_position-source">
|
863
|
+
<pre><span class="ruby-comment"># File lib/conductor/string.rb, line 14</span>
|
864
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">normalize_position</span>
|
865
|
+
<span class="ruby-keyword">case</span> <span class="ruby-keyword">self</span>
|
866
|
+
<span class="ruby-keyword">when</span> <span class="ruby-regexp">/^(be|s|t)/</span>
|
867
|
+
<span class="ruby-value">:start</span>
|
868
|
+
<span class="ruby-keyword">when</span> <span class="ruby-regexp">/h1/</span>
|
869
|
+
<span class="ruby-value">:h1</span>
|
870
|
+
<span class="ruby-keyword">else</span>
|
871
|
+
<span class="ruby-value">:end</span>
|
872
|
+
<span class="ruby-keyword">end</span>
|
873
|
+
<span class="ruby-keyword">end</span></pre>
|
874
|
+
</div>
|
875
|
+
</div>
|
876
|
+
|
877
|
+
|
669
878
|
</div>
|
670
879
|
|
671
880
|
<div id="method-i-number-3F" class="method-detail ">
|
@@ -683,7 +892,7 @@
|
|
683
892
|
<p>@return [Boolean] test result</p>
|
684
893
|
|
685
894
|
<div class="method-source-code" id="number-3F-source">
|
686
|
-
<pre><span class="ruby-comment"># File lib/conductor/string.rb, line
|
895
|
+
<pre><span class="ruby-comment"># File lib/conductor/string.rb, line 99</span>
|
687
896
|
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">number?</span>
|
688
897
|
<span class="ruby-identifier">to_f</span>.<span class="ruby-identifier">positive?</span>
|
689
898
|
<span class="ruby-keyword">end</span></pre>
|
@@ -706,7 +915,7 @@
|
|
706
915
|
|
707
916
|
|
708
917
|
<div class="method-source-code" id="replace-source">
|
709
|
-
<pre><span class="ruby-comment"># File lib/conductor/filter.rb, line
|
918
|
+
<pre><span class="ruby-comment"># File lib/conductor/filter.rb, line 264</span>
|
710
919
|
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">replace</span>(<span class="ruby-identifier">regex</span>, <span class="ruby-identifier">pattern</span>)
|
711
920
|
<span class="ruby-identifier">sub</span>(<span class="ruby-identifier">regex</span>.<span class="ruby-identifier">to_rx</span>, <span class="ruby-identifier">pattern</span>.<span class="ruby-identifier">to_pattern</span>)
|
712
921
|
<span class="ruby-keyword">end</span></pre>
|
@@ -729,7 +938,7 @@
|
|
729
938
|
|
730
939
|
|
731
940
|
<div class="method-source-code" id="replace_all-source">
|
732
|
-
<pre><span class="ruby-comment"># File lib/conductor/filter.rb, line
|
941
|
+
<pre><span class="ruby-comment"># File lib/conductor/filter.rb, line 260</span>
|
733
942
|
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">replace_all</span>(<span class="ruby-identifier">regex</span>, <span class="ruby-identifier">pattern</span>)
|
734
943
|
<span class="ruby-identifier">gsub</span>(<span class="ruby-identifier">regex</span>.<span class="ruby-identifier">to_rx</span>, <span class="ruby-identifier">pattern</span>.<span class="ruby-identifier">to_pattern</span>)
|
735
944
|
<span class="ruby-keyword">end</span></pre>
|
@@ -752,7 +961,7 @@
|
|
752
961
|
|
753
962
|
|
754
963
|
<div class="method-source-code" id="set_meta-source">
|
755
|
-
<pre><span class="ruby-comment"># File lib/conductor/filter.rb, line
|
964
|
+
<pre><span class="ruby-comment"># File lib/conductor/filter.rb, line 184</span>
|
756
965
|
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">set_meta</span>(<span class="ruby-identifier">key</span>, <span class="ruby-identifier">value</span>, <span class="ruby-value">style:</span> <span class="ruby-value">:comment</span>)
|
757
966
|
<span class="ruby-keyword">case</span> <span class="ruby-identifier">style</span>
|
758
967
|
<span class="ruby-keyword">when</span> <span class="ruby-value">:yaml</span>
|
@@ -782,7 +991,7 @@
|
|
782
991
|
|
783
992
|
|
784
993
|
<div class="method-source-code" id="strip_meta-source">
|
785
|
-
<pre><span class="ruby-comment"># File lib/conductor/filter.rb, line
|
994
|
+
<pre><span class="ruby-comment"># File lib/conductor/filter.rb, line 250</span>
|
786
995
|
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">strip_meta</span>
|
787
996
|
<span class="ruby-keyword">case</span> <span class="ruby-identifier">meta_type</span>
|
788
997
|
<span class="ruby-keyword">when</span> <span class="ruby-value">:yaml</span>
|
@@ -813,7 +1022,7 @@
|
|
813
1022
|
<p>@return [String] string with time removed</p>
|
814
1023
|
|
815
1024
|
<div class="method-source-code" id="strip_time-source">
|
816
|
-
<pre><span class="ruby-comment"># File lib/conductor/string.rb, line
|
1025
|
+
<pre><span class="ruby-comment"># File lib/conductor/string.rb, line 85</span>
|
817
1026
|
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">strip_time</span>
|
818
1027
|
<span class="ruby-identifier">dup</span>.<span class="ruby-identifier">force_encoding</span>(<span class="ruby-string">"utf-8"</span>).<span class="ruby-identifier">sub</span>(<span class="ruby-regexp">/ \d{1,2}(:\d\d)? *([ap]m)?/i</span>, <span class="ruby-string">""</span>)
|
819
1028
|
<span class="ruby-keyword">end</span></pre>
|
@@ -838,7 +1047,7 @@
|
|
838
1047
|
<p>@return [Boolean] test result</p>
|
839
1048
|
|
840
1049
|
<div class="method-source-code" id="time-3F-source">
|
841
|
-
<pre><span class="ruby-comment"># File lib/conductor/string.rb, line
|
1050
|
+
<pre><span class="ruby-comment"># File lib/conductor/string.rb, line 66</span>
|
842
1051
|
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">time?</span>
|
843
1052
|
<span class="ruby-identifier">dup</span>.<span class="ruby-identifier">force_encoding</span>(<span class="ruby-string">"utf-8"</span>).<span class="ruby-identifier">match</span>(<span class="ruby-regexp">/ \d{1,2}(:\d\d)? *([ap]m)?/i</span>)
|
844
1053
|
<span class="ruby-keyword">end</span></pre>
|
@@ -861,7 +1070,7 @@
|
|
861
1070
|
|
862
1071
|
|
863
1072
|
<div class="method-source-code" id="title_from_slug-source">
|
864
|
-
<pre><span class="ruby-comment"># File lib/conductor/filter.rb, line
|
1073
|
+
<pre><span class="ruby-comment"># File lib/conductor/filter.rb, line 142</span>
|
865
1074
|
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">title_from_slug</span>
|
866
1075
|
<span class="ruby-identifier">filename</span> = <span class="ruby-constant">File</span>.<span class="ruby-identifier">basename</span>(<span class="ruby-constant">Conductor</span><span class="ruby-operator">::</span><span class="ruby-constant">Env</span>.<span class="ruby-identifier">env</span>[<span class="ruby-value">:filepath</span>]).<span class="ruby-identifier">sub</span>(<span class="ruby-regexp">/\.[a-z]+$/i</span>, <span class="ruby-string">""</span>)
|
867
1076
|
<span class="ruby-identifier">filename</span>.<span class="ruby-identifier">sub!</span>(<span class="ruby-regexp">/-?\d{4}-\d{2}-\d{2}-?/</span>, <span class="ruby-string">""</span>)
|
@@ -915,7 +1124,7 @@
|
|
915
1124
|
<p>@return [Boolean] Bool representation of the object.</p>
|
916
1125
|
|
917
1126
|
<div class="method-source-code" id="to_bool-source">
|
918
|
-
<pre><span class="ruby-comment"># File lib/conductor/string.rb, line
|
1127
|
+
<pre><span class="ruby-comment"># File lib/conductor/string.rb, line 145</span>
|
919
1128
|
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">to_bool</span>
|
920
1129
|
<span class="ruby-keyword">case</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier">force_encoding</span>(<span class="ruby-string">'utf-8'</span>)
|
921
1130
|
<span class="ruby-keyword">when</span> <span class="ruby-regexp">/^[yt]/i</span>
|
@@ -945,7 +1154,7 @@
|
|
945
1154
|
<p>@see <a href="String.html#method-i-to_bool"><code>to_bool</code></a></p>
|
946
1155
|
|
947
1156
|
<div class="method-source-code" id="to_bool-21-source">
|
948
|
-
<pre><span class="ruby-comment"># File lib/conductor/string.rb, line
|
1157
|
+
<pre><span class="ruby-comment"># File lib/conductor/string.rb, line 136</span>
|
949
1158
|
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">to_bool!</span>
|
950
1159
|
<span class="ruby-identifier">replace</span> <span class="ruby-identifier">to_bool</span>
|
951
1160
|
<span class="ruby-keyword">end</span></pre>
|
@@ -973,7 +1182,7 @@
|
|
973
1182
|
<p>@return [Date] Resulting Date object</p>
|
974
1183
|
|
975
1184
|
<div class="method-source-code" id="to_date-source">
|
976
|
-
<pre><span class="ruby-comment"># File lib/conductor/string.rb, line
|
1185
|
+
<pre><span class="ruby-comment"># File lib/conductor/string.rb, line 76</span>
|
977
1186
|
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">to_date</span>
|
978
1187
|
<span class="ruby-constant">Chronic</span>.<span class="ruby-identifier">parse</span>(<span class="ruby-identifier">dup</span>.<span class="ruby-identifier">force_encoding</span>(<span class="ruby-string">"utf-8"</span>))
|
979
1188
|
<span class="ruby-keyword">end</span></pre>
|
@@ -996,7 +1205,7 @@
|
|
996
1205
|
|
997
1206
|
|
998
1207
|
<div class="method-source-code" id="to_day-source">
|
999
|
-
<pre><span class="ruby-comment"># File lib/conductor/string.rb, line
|
1208
|
+
<pre><span class="ruby-comment"># File lib/conductor/string.rb, line 89</span>
|
1000
1209
|
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">to_day</span>(<span class="ruby-identifier">time</span> = <span class="ruby-value">:end</span>)
|
1001
1210
|
<span class="ruby-identifier">t</span> = <span class="ruby-identifier">time</span> <span class="ruby-operator">==</span> <span class="ruby-value">:end</span> <span class="ruby-operator">?</span> <span class="ruby-string">"23:59"</span> <span class="ruby-operator">:</span> <span class="ruby-string">"00:00"</span>
|
1002
1211
|
<span class="ruby-constant">Chronic</span>.<span class="ruby-identifier">parse</span>(<span class="ruby-node">"#{strip_time} #{t}"</span>)
|
@@ -1020,7 +1229,7 @@
|
|
1020
1229
|
|
1021
1230
|
|
1022
1231
|
<div class="method-source-code" id="to_pattern-source">
|
1023
|
-
<pre><span class="ruby-comment"># File lib/conductor/filter.rb, line
|
1232
|
+
<pre><span class="ruby-comment"># File lib/conductor/filter.rb, line 279</span>
|
1024
1233
|
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">to_pattern</span>
|
1025
1234
|
<span class="ruby-identifier">gsub</span>(<span class="ruby-regexp">/\$(\d+)/</span>, <span class="ruby-string">'\\\\\1'</span>).<span class="ruby-identifier">gsub</span>(<span class="ruby-regexp">/(^["']|["']$)/</span>, <span class="ruby-string">""</span>)
|
1026
1235
|
<span class="ruby-keyword">end</span></pre>
|
@@ -1043,7 +1252,7 @@
|
|
1043
1252
|
|
1044
1253
|
|
1045
1254
|
<div class="method-source-code" id="to_rx-source">
|
1046
|
-
<pre><span class="ruby-comment"># File lib/conductor/filter.rb, line
|
1255
|
+
<pre><span class="ruby-comment"># File lib/conductor/filter.rb, line 268</span>
|
1047
1256
|
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">to_rx</span>
|
1048
1257
|
<span class="ruby-keyword">if</span> <span class="ruby-keyword">self</span> <span class="ruby-operator">=~</span> <span class="ruby-regexp">%r{^/(.*?)/([im]+)?$}</span>
|
1049
1258
|
<span class="ruby-identifier">m</span> = <span class="ruby-constant">Regexp</span>.<span class="ruby-identifier">last_match</span>
|
@@ -1075,7 +1284,7 @@
|
|
1075
1284
|
<p>@return [Boolean] test result</p>
|
1076
1285
|
|
1077
1286
|
<div class="method-source-code" id="yaml-3F-source">
|
1078
|
-
<pre><span class="ruby-comment"># File lib/conductor/string.rb, line
|
1287
|
+
<pre><span class="ruby-comment"># File lib/conductor/string.rb, line 117</span>
|
1079
1288
|
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">yaml?</span>
|
1080
1289
|
<span class="ruby-identifier">dup</span>.<span class="ruby-identifier">force_encoding</span>(<span class="ruby-string">'utf-8'</span>).<span class="ruby-identifier">match?</span>(<span class="ruby-regexp">/^---/m</span>)
|
1081
1290
|
<span class="ruby-keyword">end</span></pre>
|
data/html/created.rid
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
Sat, 25 May 2024
|
1
|
+
Sat, 25 May 2024 11:14:11 -0500
|
2
2
|
README.rdoc Sun, 28 Apr 2024 13:21:34 -0500
|
3
3
|
lib/conductor.rb Fri, 24 May 2024 12:23:17 -0500
|
4
4
|
lib/conductor/array.rb Sat, 27 Apr 2024 11:54:28 -0500
|
@@ -7,9 +7,9 @@ lib/conductor/command.rb Sat, 27 Apr 2024 11:54:28 -0500
|
|
7
7
|
lib/conductor/condition.rb Mon, 29 Apr 2024 09:19:15 -0500
|
8
8
|
lib/conductor/config.rb Sat, 27 Apr 2024 11:54:28 -0500
|
9
9
|
lib/conductor/env.rb Mon, 29 Apr 2024 09:28:21 -0500
|
10
|
-
lib/conductor/filter.rb Sat, 25 May 2024
|
10
|
+
lib/conductor/filter.rb Sat, 25 May 2024 11:13:46 -0500
|
11
11
|
lib/conductor/hash.rb Sat, 27 Apr 2024 11:54:28 -0500
|
12
12
|
lib/conductor/script.rb Sun, 28 Apr 2024 16:21:49 -0500
|
13
|
-
lib/conductor/string.rb Sat, 25 May 2024
|
14
|
-
lib/conductor/version.rb
|
13
|
+
lib/conductor/string.rb Sat, 25 May 2024 10:58:38 -0500
|
14
|
+
lib/conductor/version.rb Sat, 25 May 2024 06:41:33 -0500
|
15
15
|
bin/conductor Fri, 24 May 2024 12:39:06 -0500
|
data/html/js/search_index.js
CHANGED
@@ -1 +1 @@
|
|
1
|
-
var search_data = {"index":{"searchIndex":["array","conductor","command","condition","config","env","script","falseclass","filter","hash","object","string","trueclass","add_comment()","add_mmd()","add_yaml()","append()","args=()","args=()","bool?()","bool?()","bool?()","bool_to_symbol()","clean_condition()","conduct()","create_config()","date?()","delete_meta()","delete_mmd()","delete_yaml()","env()","execute_track()","get_title()","has_comment?()","insert_script()","insert_title()","load_test_env()","meta?()","meta_insert_point()","meta_type()","new()","new()","new()","new()","new()","normalize_filter()","number?()","operator_to_symbol()","parse_condition()","path=()","path=()","process()","replace()","replace_all()","run()","run()","sample_config()","set_meta()","split_booleans()","split_condition()","stdin()","strip_meta()","strip_time()","symbolize_keys()","symbolize_keys()","symbolize_keys!()","symbolize_keys!()","test_condition()","test_meta()","test_operator()","test_pandoc()","test_string()","test_tree()","test_truthy()","test_type()","test_yaml()","time?()","title_from_slug()","titleize()","to_bool()","to_bool!()","to_date()","to_day()","to_pattern()","to_rx()","to_s()","true?()","yaml?()","readme"],"longSearchIndex":["array","conductor","conductor::command","conductor::condition","conductor::config","conductor::env","conductor::script","falseclass","filter","hash","object","string","trueclass","string#add_comment()","string#add_mmd()","string#add_yaml()","string#append()","conductor::command#args=()","conductor::script#args=()","falseclass#bool?()","string#bool?()","trueclass#bool?()","string#bool_to_symbol()","object#clean_condition()","conductor::conduct()","conductor#create_config()","string#date?()","string#delete_meta()","string#delete_mmd()","string#delete_yaml()","conductor::env::env()","conductor::execute_track()","string#get_title()","string#has_comment?()","string#insert_script()","string#insert_title()","conductor::env::load_test_env()","string#meta?()","string#meta_insert_point()","string#meta_type()","conductor::command::new()","conductor::condition::new()","conductor::config::new()","conductor::script::new()","filter::new()","string#normalize_filter()","string#number?()","conductor::condition#operator_to_symbol()","conductor::condition#parse_condition()","conductor::command#path=()","conductor::script#path=()","filter#process()","string#replace()","string#replace_all()","conductor::command#run()","conductor::script#run()","conductor#sample_config()","string#set_meta()","conductor::condition#split_booleans()","conductor::condition#split_condition()","conductor::stdin()","string#strip_meta()","string#strip_time()","array#symbolize_keys()","hash#symbolize_keys()","array#symbolize_keys!()","hash#symbolize_keys!()","conductor::condition#test_condition()","conductor::condition#test_meta()","conductor::condition#test_operator()","conductor::condition#test_pandoc()","conductor::condition#test_string()","conductor::condition#test_tree()","conductor::condition#test_truthy()","conductor::condition#test_type()","conductor::condition#test_yaml()","string#time?()","string#title_from_slug()","string#titleize()","string#to_bool()","string#to_bool!()","string#to_date()","string#to_day()","string#to_pattern()","string#to_rx()","conductor::env::to_s()","conductor::condition#true?()","string#yaml?()",""],"info":[["Array","","Array.html","",""],["Conductor","","Conductor.html","","<p>Main Conductor class\n"],["Conductor::Command","","Conductor/Command.html","","<p>Command runner\n"],["Conductor::Condition","","Conductor/Condition.html","",""],["Conductor::Config","","Conductor/Config.html","","<p>Configuration methods\n"],["Conductor::Env","","Conductor/Env.html","","<p>Environment variables\n"],["Conductor::Script","","Conductor/Script.html","","<p>Script runner\n"],["FalseClass","","FalseClass.html","","<p>False class\n"],["Filter","","Filter.html","","<p>String filtering\n"],["Hash","","Hash.html","",""],["Object","","Object.html","",""],["String","","String.html","","<p>String helpers\n<p>String helpers\n"],["TrueClass","","TrueClass.html","","<p>True class\n"],["add_comment","String","String.html#method-i-add_comment","(key, value)",""],["add_mmd","String","String.html#method-i-add_mmd","(key, value)",""],["add_yaml","String","String.html#method-i-add_yaml","(key, value)",""],["append","String","String.html#method-i-append","(string)",""],["args=","Conductor::Command","Conductor/Command.html#method-i-args-3D","(array)",""],["args=","Conductor::Script","Conductor/Script.html#method-i-args-3D","(array)","<p>Set the args array\n<p>@param array The array\n"],["bool?","FalseClass","FalseClass.html#method-i-bool-3F","()",""],["bool?","String","String.html#method-i-bool-3F","()","<p>Test if a string is a boolean\n<p>@return [Boolean] test result\n"],["bool?","TrueClass","TrueClass.html#method-i-bool-3F","()",""],["bool_to_symbol","String","String.html#method-i-bool_to_symbol","()","<p>Convert a string boolean to symbol\n<p>@return [Symbol] symbolized version\n"],["clean_condition","Object","Object.html#method-i-clean_condition","(condition)","<p>Clean up conditions for output\n<p>@param condition The condition\n"],["conduct","Conductor","Conductor.html#method-c-conduct","(tracks, res = nil, condition = nil)","<p>Main function to parse conditions and\n\n<pre>execute actions. Executes recursively for\nsub-tracks.</pre>\n<p>@param …\n"],["create_config","Conductor","Conductor.html#method-i-create_config","(config_file)",""],["date?","String","String.html#method-i-date-3F","()","<p>Test a string to see if it’s a UTC date\n<p>@return [Boolean] test result\n"],["delete_meta","String","String.html#method-i-delete_meta","(key)",""],["delete_mmd","String","String.html#method-i-delete_mmd","(key)",""],["delete_yaml","String","String.html#method-i-delete_yaml","(key)",""],["env","Conductor::Env","Conductor/Env.html#method-c-env","()","<p>Define @env using Marked environment variables\n"],["execute_track","Conductor","Conductor.html#method-c-execute_track","(track)","<p>Execute commands/scripts in the track\n<p>@param track The track\n<p>@return Resulting STDOUT output …\n"],["get_title","String","String.html#method-i-get_title","()",""],["has_comment?","String","String.html#method-i-has_comment-3F","(key)",""],["insert_script","String","String.html#method-i-insert_script","(path)",""],["insert_title","String","String.html#method-i-insert_title","()",""],["load_test_env","Conductor::Env","Conductor/Env.html#method-c-load_test_env","()","<p>Loads a test environment.\n"],["meta?","String","String.html#method-i-meta-3F","()","<p>Test if a string starts with MMD metadata\n<p>@return [Boolean] test result\n"],["meta_insert_point","String","String.html#method-i-meta_insert_point","()",""],["meta_type","String","String.html#method-i-meta_type","()",""],["new","Conductor::Command","Conductor/Command.html#method-c-new","(command)",""],["new","Conductor::Condition","Conductor/Condition.html#method-c-new","(condition)","<p>Initializes the given condition.\n<p>@param condition The condition\n"],["new","Conductor::Config","Conductor/Config.html#method-c-new","()",""],["new","Conductor::Script","Conductor/Script.html#method-c-new","(script)","<p>Initializes the given script.\n<p>@param script The script/path\n"],["new","Filter","Filter.html#method-c-new","(filter)",""],["normalize_filter","String","String.html#method-i-normalize_filter","()",""],["number?","String","String.html#method-i-number-3F","()","<p>Test if a string is a number\n<p>@return [Boolean] test result\n"],["operator_to_symbol","Conductor::Condition","Conductor/Condition.html#method-i-operator_to_symbol","(operator)",""],["parse_condition","Conductor::Condition","Conductor/Condition.html#method-i-parse_condition","()",""],["path=","Conductor::Command","Conductor/Command.html#method-i-path-3D","(path)",""],["path=","Conductor::Script","Conductor/Script.html#method-i-path-3D","(path)","<p>Set script path, automatically expands/tests\n<p>@param path The path\n"],["process","Filter","Filter.html#method-i-process","()",""],["replace","String","String.html#method-i-replace","(regex, pattern)",""],["replace_all","String","String.html#method-i-replace_all","(regex, pattern)",""],["run","Conductor::Command","Conductor/Command.html#method-i-run","()",""],["run","Conductor::Script","Conductor/Script.html#method-i-run","()","<p>Execute the script\n<p>@return [String] script results (STDOUT)\n"],["sample_config","Conductor","Conductor.html#method-i-sample_config","()",""],["set_meta","String","String.html#method-i-set_meta","(key, value, style: :comment)",""],["split_booleans","Conductor::Condition","Conductor/Condition.html#method-i-split_booleans","(condition)","<p>Splits booleans and tests components.\n<p>@param condition The condition to test\n<p>@return [Boolean] …\n"],["split_condition","Conductor::Condition","Conductor/Condition.html#method-i-split_condition","(condition)","<p>Splits a natural language condition.\n<p>@param condition The condition @return [Array] Value, value …\n"],["stdin","Conductor","Conductor.html#method-c-stdin","()",""],["strip_meta","String","String.html#method-i-strip_meta","()",""],["strip_time","String","String.html#method-i-strip_time","()","<p>Remove time from string\n<p>@return [String] string with time removed\n"],["symbolize_keys","Array","Array.html#method-i-symbolize_keys","()",""],["symbolize_keys","Hash","Hash.html#method-i-symbolize_keys","()",""],["symbolize_keys!","Array","Array.html#method-i-symbolize_keys-21","()",""],["symbolize_keys!","Hash","Hash.html#method-i-symbolize_keys-21","()",""],["test_condition","Conductor::Condition","Conductor/Condition.html#method-i-test_condition","(condition)",""],["test_meta","Conductor::Condition","Conductor/Condition.html#method-i-test_meta","(content, value, key, operator)","<p>Test for MultiMarkdown metadata,\n\n<pre class=\"ruby\"><span class=\"ruby-identifier\">optionally</span> <span class=\"ruby-identifier\">key</span> <span class=\"ruby-keyword\">and</span> <span class=\"ruby-identifier\">value</span>\n</pre>\n<p>@param content [String] The text content …\n"],["test_operator","Conductor::Condition","Conductor/Condition.html#method-i-test_operator","(value1, value2, operator)","<p>Test operators\n<p>@param value1 Value @param value2 Value to test @param operator …\n"],["test_pandoc","Conductor::Condition","Conductor/Condition.html#method-i-test_pandoc","(content, operator)",""],["test_string","Conductor::Condition","Conductor/Condition.html#method-i-test_string","(val1, val2, operator)","<p>Compare a string based on operator\n<p>@param val1 The string to test against @param val2 …\n"],["test_tree","Conductor::Condition","Conductor/Condition.html#method-i-test_tree","(origin, value, operator)","<p>Test for the existince of a\n\n<pre>file/directory in the parent tree</pre>\n<p>@param origin Starting directory …\n"],["test_truthy","Conductor::Condition","Conductor/Condition.html#method-i-test_truthy","(value1, value2, operator)","<p>Test “truthiness”\n<p>@param value1 Value to test against @param value2 Value to …\n"],["test_type","Conductor::Condition","Conductor/Condition.html#method-i-test_type","(val1, val2, operator)","<p>Test for type of value\n<p>@param val1 value @param val2 value to test against @param …\n"],["test_yaml","Conductor::Condition","Conductor/Condition.html#method-i-test_yaml","(content, value, key, operator)","<p>Test for presence of yaml, optionall for\n\n<pre>a key, optionally for a key's value</pre>\n<p>@param content Text …\n"],["time?","String","String.html#method-i-time-3F","()","<p>Test a string to see if it includes a time\n<p>@return [Boolean] test result\n"],["title_from_slug","String","String.html#method-i-title_from_slug","()",""],["titleize","String","String.html#method-i-titleize","()","<p>Titlecase a string\n<p>@return Titleized string\n"],["to_bool","String","String.html#method-i-to_bool","()","<p>Returns a bool representation of the string.\n<p>@return [Boolean] Bool representation of the object. …\n"],["to_bool!","String","String.html#method-i-to_bool-21","()","<p>Destructive version of #to_bool\n<p>@see #to_bool\n"],["to_date","String","String.html#method-i-to_date","()","<p>Convert a natural language string to a Date\n\n<pre class=\"ruby\"><span class=\"ruby-identifier\">object</span>\n</pre>\n<p>@return [Date] Resulting Date object\n"],["to_day","String","String.html#method-i-to_day","(time = :end)",""],["to_pattern","String","String.html#method-i-to_pattern","()",""],["to_rx","String","String.html#method-i-to_rx","()",""],["to_s","Conductor::Env","Conductor/Env.html#method-c-to_s","()","<p>env to string\n<p>@return [String] shell-compatible string representation of @env\n"],["true?","Conductor::Condition","Conductor/Condition.html#method-i-true-3F","()","<p>Tests condition\n<p>@return [Boolean] test result\n"],["yaml?","String","String.html#method-i-yaml-3F","()","<p>Test if string starts with YAML\n<p>@return [Boolean] test result\n"],["README","","README_rdoc.html","","<p>Marked Conductor\n<p>A command line tool that functions as a custom processor handler for Marked 2.\n"]]}}
|
1
|
+
var search_data = {"index":{"searchIndex":["array","conductor","command","condition","config","env","script","falseclass","filter","hash","object","string","trueclass","add_comment()","add_mmd()","add_yaml()","append()","args=()","args=()","bool?()","bool?()","bool?()","bool_to_symbol()","clean_condition()","conduct()","create_config()","date?()","delete_meta()","delete_mmd()","delete_yaml()","env()","execute_track()","first_h1()","first_h2()","get_title()","has_comment?()","insert_file()","insert_script()","insert_title()","insert_toc()","load_test_env()","meta?()","meta_insert_point()","meta_type()","new()","new()","new()","new()","new()","normalize_filter()","normalize_include_type()","normalize_position()","number?()","operator_to_symbol()","parse_condition()","path=()","path=()","process()","replace()","replace_all()","run()","run()","sample_config()","set_meta()","split_booleans()","split_condition()","stdin()","strip_meta()","strip_time()","symbolize_keys()","symbolize_keys()","symbolize_keys!()","symbolize_keys!()","test_condition()","test_meta()","test_operator()","test_pandoc()","test_string()","test_tree()","test_truthy()","test_type()","test_yaml()","time?()","title_from_slug()","titleize()","to_bool()","to_bool!()","to_date()","to_day()","to_pattern()","to_rx()","to_s()","true?()","yaml?()","readme"],"longSearchIndex":["array","conductor","conductor::command","conductor::condition","conductor::config","conductor::env","conductor::script","falseclass","filter","hash","object","string","trueclass","string#add_comment()","string#add_mmd()","string#add_yaml()","string#append()","conductor::command#args=()","conductor::script#args=()","falseclass#bool?()","string#bool?()","trueclass#bool?()","string#bool_to_symbol()","object#clean_condition()","conductor::conduct()","conductor#create_config()","string#date?()","string#delete_meta()","string#delete_mmd()","string#delete_yaml()","conductor::env::env()","conductor::execute_track()","string#first_h1()","string#first_h2()","string#get_title()","string#has_comment?()","string#insert_file()","string#insert_script()","string#insert_title()","string#insert_toc()","conductor::env::load_test_env()","string#meta?()","string#meta_insert_point()","string#meta_type()","conductor::command::new()","conductor::condition::new()","conductor::config::new()","conductor::script::new()","filter::new()","string#normalize_filter()","string#normalize_include_type()","string#normalize_position()","string#number?()","conductor::condition#operator_to_symbol()","conductor::condition#parse_condition()","conductor::command#path=()","conductor::script#path=()","filter#process()","string#replace()","string#replace_all()","conductor::command#run()","conductor::script#run()","conductor#sample_config()","string#set_meta()","conductor::condition#split_booleans()","conductor::condition#split_condition()","conductor::stdin()","string#strip_meta()","string#strip_time()","array#symbolize_keys()","hash#symbolize_keys()","array#symbolize_keys!()","hash#symbolize_keys!()","conductor::condition#test_condition()","conductor::condition#test_meta()","conductor::condition#test_operator()","conductor::condition#test_pandoc()","conductor::condition#test_string()","conductor::condition#test_tree()","conductor::condition#test_truthy()","conductor::condition#test_type()","conductor::condition#test_yaml()","string#time?()","string#title_from_slug()","string#titleize()","string#to_bool()","string#to_bool!()","string#to_date()","string#to_day()","string#to_pattern()","string#to_rx()","conductor::env::to_s()","conductor::condition#true?()","string#yaml?()",""],"info":[["Array","","Array.html","",""],["Conductor","","Conductor.html","","<p>Main Conductor class\n"],["Conductor::Command","","Conductor/Command.html","","<p>Command runner\n"],["Conductor::Condition","","Conductor/Condition.html","",""],["Conductor::Config","","Conductor/Config.html","","<p>Configuration methods\n"],["Conductor::Env","","Conductor/Env.html","","<p>Environment variables\n"],["Conductor::Script","","Conductor/Script.html","","<p>Script runner\n"],["FalseClass","","FalseClass.html","","<p>False class\n"],["Filter","","Filter.html","","<p>String filtering\n"],["Hash","","Hash.html","",""],["Object","","Object.html","",""],["String","","String.html","","<p>String helpers\n<p>String helpers\n"],["TrueClass","","TrueClass.html","","<p>True class\n"],["add_comment","String","String.html#method-i-add_comment","(key, value)",""],["add_mmd","String","String.html#method-i-add_mmd","(key, value)",""],["add_yaml","String","String.html#method-i-add_yaml","(key, value)",""],["append","String","String.html#method-i-append","(string)",""],["args=","Conductor::Command","Conductor/Command.html#method-i-args-3D","(array)",""],["args=","Conductor::Script","Conductor/Script.html#method-i-args-3D","(array)","<p>Set the args array\n<p>@param array The array\n"],["bool?","FalseClass","FalseClass.html#method-i-bool-3F","()",""],["bool?","String","String.html#method-i-bool-3F","()","<p>Test if a string is a boolean\n<p>@return [Boolean] test result\n"],["bool?","TrueClass","TrueClass.html#method-i-bool-3F","()",""],["bool_to_symbol","String","String.html#method-i-bool_to_symbol","()","<p>Convert a string boolean to symbol\n<p>@return [Symbol] symbolized version\n"],["clean_condition","Object","Object.html#method-i-clean_condition","(condition)","<p>Clean up conditions for output\n<p>@param condition The condition\n"],["conduct","Conductor","Conductor.html#method-c-conduct","(tracks, res = nil, condition = nil)","<p>Main function to parse conditions and\n\n<pre>execute actions. Executes recursively for\nsub-tracks.</pre>\n<p>@param …\n"],["create_config","Conductor","Conductor.html#method-i-create_config","(config_file)",""],["date?","String","String.html#method-i-date-3F","()","<p>Test a string to see if it’s a UTC date\n<p>@return [Boolean] test result\n"],["delete_meta","String","String.html#method-i-delete_meta","(key)",""],["delete_mmd","String","String.html#method-i-delete_mmd","(key)",""],["delete_yaml","String","String.html#method-i-delete_yaml","(key)",""],["env","Conductor::Env","Conductor/Env.html#method-c-env","()","<p>Define @env using Marked environment variables\n"],["execute_track","Conductor","Conductor.html#method-c-execute_track","(track)","<p>Execute commands/scripts in the track\n<p>@param track The track\n<p>@return Resulting STDOUT output …\n"],["first_h1","String","String.html#method-i-first_h1","()",""],["first_h2","String","String.html#method-i-first_h2","()",""],["get_title","String","String.html#method-i-get_title","()",""],["has_comment?","String","String.html#method-i-has_comment-3F","(key)",""],["insert_file","String","String.html#method-i-insert_file","(path, type = :file, position = :end)",""],["insert_script","String","String.html#method-i-insert_script","(path)",""],["insert_title","String","String.html#method-i-insert_title","()",""],["insert_toc","String","String.html#method-i-insert_toc","(max = nil, after = :h1)",""],["load_test_env","Conductor::Env","Conductor/Env.html#method-c-load_test_env","()","<p>Loads a test environment.\n"],["meta?","String","String.html#method-i-meta-3F","()","<p>Test if a string starts with MMD metadata\n<p>@return [Boolean] test result\n"],["meta_insert_point","String","String.html#method-i-meta_insert_point","()",""],["meta_type","String","String.html#method-i-meta_type","()",""],["new","Conductor::Command","Conductor/Command.html#method-c-new","(command)",""],["new","Conductor::Condition","Conductor/Condition.html#method-c-new","(condition)","<p>Initializes the given condition.\n<p>@param condition The condition\n"],["new","Conductor::Config","Conductor/Config.html#method-c-new","()",""],["new","Conductor::Script","Conductor/Script.html#method-c-new","(script)","<p>Initializes the given script.\n<p>@param script The script/path\n"],["new","Filter","Filter.html#method-c-new","(filter)",""],["normalize_filter","String","String.html#method-i-normalize_filter","()",""],["normalize_include_type","String","String.html#method-i-normalize_include_type","()",""],["normalize_position","String","String.html#method-i-normalize_position","()",""],["number?","String","String.html#method-i-number-3F","()","<p>Test if a string is a number\n<p>@return [Boolean] test result\n"],["operator_to_symbol","Conductor::Condition","Conductor/Condition.html#method-i-operator_to_symbol","(operator)",""],["parse_condition","Conductor::Condition","Conductor/Condition.html#method-i-parse_condition","()",""],["path=","Conductor::Command","Conductor/Command.html#method-i-path-3D","(path)",""],["path=","Conductor::Script","Conductor/Script.html#method-i-path-3D","(path)","<p>Set script path, automatically expands/tests\n<p>@param path The path\n"],["process","Filter","Filter.html#method-i-process","()",""],["replace","String","String.html#method-i-replace","(regex, pattern)",""],["replace_all","String","String.html#method-i-replace_all","(regex, pattern)",""],["run","Conductor::Command","Conductor/Command.html#method-i-run","()",""],["run","Conductor::Script","Conductor/Script.html#method-i-run","()","<p>Execute the script\n<p>@return [String] script results (STDOUT)\n"],["sample_config","Conductor","Conductor.html#method-i-sample_config","()",""],["set_meta","String","String.html#method-i-set_meta","(key, value, style: :comment)",""],["split_booleans","Conductor::Condition","Conductor/Condition.html#method-i-split_booleans","(condition)","<p>Splits booleans and tests components.\n<p>@param condition The condition to test\n<p>@return [Boolean] …\n"],["split_condition","Conductor::Condition","Conductor/Condition.html#method-i-split_condition","(condition)","<p>Splits a natural language condition.\n<p>@param condition The condition @return [Array] Value, value …\n"],["stdin","Conductor","Conductor.html#method-c-stdin","()",""],["strip_meta","String","String.html#method-i-strip_meta","()",""],["strip_time","String","String.html#method-i-strip_time","()","<p>Remove time from string\n<p>@return [String] string with time removed\n"],["symbolize_keys","Array","Array.html#method-i-symbolize_keys","()",""],["symbolize_keys","Hash","Hash.html#method-i-symbolize_keys","()",""],["symbolize_keys!","Array","Array.html#method-i-symbolize_keys-21","()",""],["symbolize_keys!","Hash","Hash.html#method-i-symbolize_keys-21","()",""],["test_condition","Conductor::Condition","Conductor/Condition.html#method-i-test_condition","(condition)",""],["test_meta","Conductor::Condition","Conductor/Condition.html#method-i-test_meta","(content, value, key, operator)","<p>Test for MultiMarkdown metadata,\n\n<pre class=\"ruby\"><span class=\"ruby-identifier\">optionally</span> <span class=\"ruby-identifier\">key</span> <span class=\"ruby-keyword\">and</span> <span class=\"ruby-identifier\">value</span>\n</pre>\n<p>@param content [String] The text content …\n"],["test_operator","Conductor::Condition","Conductor/Condition.html#method-i-test_operator","(value1, value2, operator)","<p>Test operators\n<p>@param value1 Value @param value2 Value to test @param operator …\n"],["test_pandoc","Conductor::Condition","Conductor/Condition.html#method-i-test_pandoc","(content, operator)",""],["test_string","Conductor::Condition","Conductor/Condition.html#method-i-test_string","(val1, val2, operator)","<p>Compare a string based on operator\n<p>@param val1 The string to test against @param val2 …\n"],["test_tree","Conductor::Condition","Conductor/Condition.html#method-i-test_tree","(origin, value, operator)","<p>Test for the existince of a\n\n<pre>file/directory in the parent tree</pre>\n<p>@param origin Starting directory …\n"],["test_truthy","Conductor::Condition","Conductor/Condition.html#method-i-test_truthy","(value1, value2, operator)","<p>Test “truthiness”\n<p>@param value1 Value to test against @param value2 Value to …\n"],["test_type","Conductor::Condition","Conductor/Condition.html#method-i-test_type","(val1, val2, operator)","<p>Test for type of value\n<p>@param val1 value @param val2 value to test against @param …\n"],["test_yaml","Conductor::Condition","Conductor/Condition.html#method-i-test_yaml","(content, value, key, operator)","<p>Test for presence of yaml, optionall for\n\n<pre>a key, optionally for a key's value</pre>\n<p>@param content Text …\n"],["time?","String","String.html#method-i-time-3F","()","<p>Test a string to see if it includes a time\n<p>@return [Boolean] test result\n"],["title_from_slug","String","String.html#method-i-title_from_slug","()",""],["titleize","String","String.html#method-i-titleize","()","<p>Titlecase a string\n<p>@return Titleized string\n"],["to_bool","String","String.html#method-i-to_bool","()","<p>Returns a bool representation of the string.\n<p>@return [Boolean] Bool representation of the object. …\n"],["to_bool!","String","String.html#method-i-to_bool-21","()","<p>Destructive version of #to_bool\n<p>@see #to_bool\n"],["to_date","String","String.html#method-i-to_date","()","<p>Convert a natural language string to a Date\n\n<pre class=\"ruby\"><span class=\"ruby-identifier\">object</span>\n</pre>\n<p>@return [Date] Resulting Date object\n"],["to_day","String","String.html#method-i-to_day","(time = :end)",""],["to_pattern","String","String.html#method-i-to_pattern","()",""],["to_rx","String","String.html#method-i-to_rx","()",""],["to_s","Conductor::Env","Conductor/Env.html#method-c-to_s","()","<p>env to string\n<p>@return [String] shell-compatible string representation of @env\n"],["true?","Conductor::Condition","Conductor/Condition.html#method-i-true-3F","()","<p>Tests condition\n<p>@return [Boolean] test result\n"],["yaml?","String","String.html#method-i-yaml-3F","()","<p>Test if string starts with YAML\n<p>@return [Boolean] test result\n"],["README","","README_rdoc.html","","<p>Marked Conductor\n<p>A command line tool that functions as a custom processor handler for Marked 2.\n"]]}}
|
data/html/js/search_index.js.gz
CHANGED
Binary file
|
data/html/table_of_contents.html
CHANGED
@@ -108,24 +108,24 @@
|
|
108
108
|
<span class="container">Conductor::Config</span>
|
109
109
|
|
110
110
|
<li class="method">
|
111
|
-
<a href="Conductor/
|
111
|
+
<a href="Conductor/Script.html#method-c-new">::new</a>
|
112
112
|
—
|
113
|
-
<span class="container">Conductor::
|
113
|
+
<span class="container">Conductor::Script</span>
|
114
114
|
|
115
115
|
<li class="method">
|
116
|
-
<a href="
|
116
|
+
<a href="Filter.html#method-c-new">::new</a>
|
117
117
|
—
|
118
|
-
<span class="container">
|
118
|
+
<span class="container">Filter</span>
|
119
119
|
|
120
120
|
<li class="method">
|
121
|
-
<a href="Conductor/
|
121
|
+
<a href="Conductor/Condition.html#method-c-new">::new</a>
|
122
122
|
—
|
123
|
-
<span class="container">Conductor::
|
123
|
+
<span class="container">Conductor::Condition</span>
|
124
124
|
|
125
125
|
<li class="method">
|
126
|
-
<a href="
|
126
|
+
<a href="Conductor/Command.html#method-c-new">::new</a>
|
127
127
|
—
|
128
|
-
<span class="container">
|
128
|
+
<span class="container">Conductor::Command</span>
|
129
129
|
|
130
130
|
<li class="method">
|
131
131
|
<a href="Conductor.html#method-c-stdin">::stdin</a>
|
@@ -173,14 +173,14 @@
|
|
173
173
|
<span class="container">String</span>
|
174
174
|
|
175
175
|
<li class="method">
|
176
|
-
<a href="
|
176
|
+
<a href="TrueClass.html#method-i-bool-3F">#bool?</a>
|
177
177
|
—
|
178
|
-
<span class="container">
|
178
|
+
<span class="container">TrueClass</span>
|
179
179
|
|
180
180
|
<li class="method">
|
181
|
-
<a href="
|
181
|
+
<a href="FalseClass.html#method-i-bool-3F">#bool?</a>
|
182
182
|
—
|
183
|
-
<span class="container">
|
183
|
+
<span class="container">FalseClass</span>
|
184
184
|
|
185
185
|
<li class="method">
|
186
186
|
<a href="String.html#method-i-bool_to_symbol">#bool_to_symbol</a>
|
@@ -217,6 +217,16 @@
|
|
217
217
|
—
|
218
218
|
<span class="container">String</span>
|
219
219
|
|
220
|
+
<li class="method">
|
221
|
+
<a href="String.html#method-i-first_h1">#first_h1</a>
|
222
|
+
—
|
223
|
+
<span class="container">String</span>
|
224
|
+
|
225
|
+
<li class="method">
|
226
|
+
<a href="String.html#method-i-first_h2">#first_h2</a>
|
227
|
+
—
|
228
|
+
<span class="container">String</span>
|
229
|
+
|
220
230
|
<li class="method">
|
221
231
|
<a href="String.html#method-i-get_title">#get_title</a>
|
222
232
|
—
|
@@ -227,6 +237,11 @@
|
|
227
237
|
—
|
228
238
|
<span class="container">String</span>
|
229
239
|
|
240
|
+
<li class="method">
|
241
|
+
<a href="String.html#method-i-insert_file">#insert_file</a>
|
242
|
+
—
|
243
|
+
<span class="container">String</span>
|
244
|
+
|
230
245
|
<li class="method">
|
231
246
|
<a href="String.html#method-i-insert_script">#insert_script</a>
|
232
247
|
—
|
@@ -237,6 +252,11 @@
|
|
237
252
|
—
|
238
253
|
<span class="container">String</span>
|
239
254
|
|
255
|
+
<li class="method">
|
256
|
+
<a href="String.html#method-i-insert_toc">#insert_toc</a>
|
257
|
+
—
|
258
|
+
<span class="container">String</span>
|
259
|
+
|
240
260
|
<li class="method">
|
241
261
|
<a href="String.html#method-i-meta-3F">#meta?</a>
|
242
262
|
—
|
@@ -257,6 +277,16 @@
|
|
257
277
|
—
|
258
278
|
<span class="container">String</span>
|
259
279
|
|
280
|
+
<li class="method">
|
281
|
+
<a href="String.html#method-i-normalize_include_type">#normalize_include_type</a>
|
282
|
+
—
|
283
|
+
<span class="container">String</span>
|
284
|
+
|
285
|
+
<li class="method">
|
286
|
+
<a href="String.html#method-i-normalize_position">#normalize_position</a>
|
287
|
+
—
|
288
|
+
<span class="container">String</span>
|
289
|
+
|
260
290
|
<li class="method">
|
261
291
|
<a href="String.html#method-i-number-3F">#number?</a>
|
262
292
|
—
|
@@ -273,14 +303,14 @@
|
|
273
303
|
<span class="container">Conductor::Condition</span>
|
274
304
|
|
275
305
|
<li class="method">
|
276
|
-
<a href="Conductor/
|
306
|
+
<a href="Conductor/Script.html#method-i-path-3D">#path=</a>
|
277
307
|
—
|
278
|
-
<span class="container">Conductor::
|
308
|
+
<span class="container">Conductor::Script</span>
|
279
309
|
|
280
310
|
<li class="method">
|
281
|
-
<a href="Conductor/
|
311
|
+
<a href="Conductor/Command.html#method-i-path-3D">#path=</a>
|
282
312
|
—
|
283
|
-
<span class="container">Conductor::
|
313
|
+
<span class="container">Conductor::Command</span>
|
284
314
|
|
285
315
|
<li class="method">
|
286
316
|
<a href="Filter.html#method-i-process">#process</a>
|
@@ -338,14 +368,14 @@
|
|
338
368
|
<span class="container">String</span>
|
339
369
|
|
340
370
|
<li class="method">
|
341
|
-
<a href="
|
371
|
+
<a href="Hash.html#method-i-symbolize_keys">#symbolize_keys</a>
|
342
372
|
—
|
343
|
-
<span class="container">
|
373
|
+
<span class="container">Hash</span>
|
344
374
|
|
345
375
|
<li class="method">
|
346
|
-
<a href="
|
376
|
+
<a href="Array.html#method-i-symbolize_keys">#symbolize_keys</a>
|
347
377
|
—
|
348
|
-
<span class="container">
|
378
|
+
<span class="container">Array</span>
|
349
379
|
|
350
380
|
<li class="method">
|
351
381
|
<a href="Array.html#method-i-symbolize_keys-21">#symbolize_keys!</a>
|
data/lib/conductor/filter.rb
CHANGED
@@ -47,6 +47,73 @@ class ::String
|
|
47
47
|
insert_point
|
48
48
|
end
|
49
49
|
|
50
|
+
def first_h1
|
51
|
+
first = 0
|
52
|
+
split(/\n/).each_with_index do |line, idx|
|
53
|
+
if line =~ /^(# *\S|={2,} *$)/
|
54
|
+
first = idx
|
55
|
+
break
|
56
|
+
end
|
57
|
+
end
|
58
|
+
first
|
59
|
+
end
|
60
|
+
|
61
|
+
def first_h2
|
62
|
+
first = 0
|
63
|
+
split(/\n/).each_with_index do |line, idx|
|
64
|
+
if line =~ /^(## *\S|-{2,} *$)/
|
65
|
+
first = idx
|
66
|
+
break
|
67
|
+
end
|
68
|
+
end
|
69
|
+
first
|
70
|
+
end
|
71
|
+
|
72
|
+
def insert_toc(max = nil, after = :h1)
|
73
|
+
lines = split(/\n/)
|
74
|
+
max = max && max.to_i.positive? ? " max#{max}" : ""
|
75
|
+
line = case after.to_sym
|
76
|
+
when :h2
|
77
|
+
first_h2.positive? ? first_h2 + 1 : 0
|
78
|
+
when :h1
|
79
|
+
first_h1.positive? ? first_h1 + 1 : 0
|
80
|
+
else
|
81
|
+
0
|
82
|
+
end
|
83
|
+
|
84
|
+
lines.insert(line, "\n<!--toc#{max}-->\n").join("\n")
|
85
|
+
end
|
86
|
+
|
87
|
+
def insert_file(path, type = :file, position = :end)
|
88
|
+
path.strip!
|
89
|
+
|
90
|
+
if path =~ %r{^[~/]}
|
91
|
+
path = File.expand_path(path)
|
92
|
+
elsif File.directory?(File.expand_path("~/.config/conductor/files"))
|
93
|
+
new_path = File.expand_path("~/.config/conductor/files/#{path}")
|
94
|
+
path = new_path if File.exist?(new_path)
|
95
|
+
end
|
96
|
+
|
97
|
+
out = case type
|
98
|
+
when :code
|
99
|
+
"<<(#{path})"
|
100
|
+
when :raw
|
101
|
+
"<<{#{path}}"
|
102
|
+
else
|
103
|
+
"<<[#{path}]"
|
104
|
+
end
|
105
|
+
out = "\n#{out}\n"
|
106
|
+
|
107
|
+
case position
|
108
|
+
when :start
|
109
|
+
"#{out}\n#{self}"
|
110
|
+
when :h1
|
111
|
+
split(/\n/).insert(first_h1 + 1, out).join("\n")
|
112
|
+
else
|
113
|
+
"#{self}\n#{out}"
|
114
|
+
end
|
115
|
+
end
|
116
|
+
|
50
117
|
def append(string)
|
51
118
|
"#{self}\n#{string}"
|
52
119
|
end
|
@@ -235,6 +302,25 @@ class Filter < String
|
|
235
302
|
content = content.insert_script(script)
|
236
303
|
end
|
237
304
|
"#{content}</div>"
|
305
|
+
when /(prepend|append|insert|inject)(raw|file|code)/
|
306
|
+
m = Regexp.last_match
|
307
|
+
|
308
|
+
position = if @params.count == 2
|
309
|
+
@params[1].normalize_position
|
310
|
+
else
|
311
|
+
m[1].normalize_position
|
312
|
+
end
|
313
|
+
content.insert_file(@params[0], m[2].normalize_include_type, position)
|
314
|
+
when /inserttoc/
|
315
|
+
max = @params.count.positive? ? @params[0] : nil
|
316
|
+
|
317
|
+
if @params.count == 2
|
318
|
+
after = @params[1] =~ /2/ ? :h2 : :h1
|
319
|
+
else
|
320
|
+
after = :start
|
321
|
+
end
|
322
|
+
|
323
|
+
content.insert_toc(max, after)
|
238
324
|
when /(add|set)meta/
|
239
325
|
unless @params.count == 2
|
240
326
|
warn "Invalid filter parameters: #{@filter}(#{@params.join(",")})"
|
@@ -244,8 +330,8 @@ class Filter < String
|
|
244
330
|
# needs to test for existing meta, setting key if exists, adding if not
|
245
331
|
# should recognize yaml and mmd
|
246
332
|
content.set_meta(@params[0], @params[1], style: content.meta_type)
|
247
|
-
when /(strip|remove)meta/
|
248
|
-
if @params
|
333
|
+
when /(strip|remove|delete)meta/
|
334
|
+
if @params&.count.positive?
|
249
335
|
content.delete_meta(@params[0])
|
250
336
|
else
|
251
337
|
content.strip_meta
|
data/lib/conductor/string.rb
CHANGED
@@ -11,6 +11,28 @@ class ::String
|
|
11
11
|
split(/(\W)/).map(&:capitalize).join
|
12
12
|
end
|
13
13
|
|
14
|
+
def normalize_position
|
15
|
+
case self
|
16
|
+
when /^(be|s|t)/
|
17
|
+
:start
|
18
|
+
when /h1/
|
19
|
+
:h1
|
20
|
+
else
|
21
|
+
:end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
def normalize_include_type
|
26
|
+
case self
|
27
|
+
when /^c/
|
28
|
+
:code
|
29
|
+
when /^r/
|
30
|
+
:raw
|
31
|
+
else
|
32
|
+
:file
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
14
36
|
##
|
15
37
|
## Convert a string boolean to symbol
|
16
38
|
##
|
data/lib/conductor/version.rb
CHANGED
data/src/_README.md
CHANGED
@@ -144,12 +144,16 @@ The action can be `script`, `command`, or `filter`.
|
|
144
144
|
| :---- | :---------- |
|
145
145
|
| `setMeta(key, value)` | adds or updates a meta key, aware of YAML and MMD |
|
146
146
|
| `stripMeta` | strips all metadata (YAML or MMD) from the content |
|
147
|
-
| `
|
148
|
-
| `setStyle(name)` | sets the Marked preview style to a preconfigured Style name
|
147
|
+
| `deleteMeta(key)` | removes a specific key (YAML or MMD) |
|
148
|
+
| `setStyle(name)` | sets the Marked preview style to a preconfigured Style name |
|
149
149
|
| `replace(search, replace)` | performs a (single) search and replace on content |
|
150
150
|
| `replaceAll(search, replace)` | global version of `replaceAll`) |
|
151
151
|
| `insertTitle` | adds a title to the document, either from metadata or filename |
|
152
152
|
| `insertScript(path[,path])` | injects javascript(s) |
|
153
|
+
| `insertTOC(max, after)` | insert TOC (max=max levels, after=start, \*h1, or h2) |
|
154
|
+
| `prepend/appendFile(path)` | insert a file as Markdown at beginning or end of content |
|
155
|
+
| `prepend/appendRaw(path)` | insert a file as raw HTML at beginning or end of content |
|
156
|
+
| `prepend/appendCode(path)` | insert a file as a code block at beginning or end of content |
|
153
157
|
|
154
158
|
For `insertScript`, if path is just a filename it will look for a match in `~/.config/conductor/javascript` or `~/.config/conductor/scripts` and turn that into an absolute path if the file is found.
|
155
159
|
|
data/test.md
ADDED
data/test.sh
CHANGED
@@ -1,12 +1,9 @@
|
|
1
1
|
#!/bin/bash
|
2
2
|
|
3
|
-
# ./test.sh PATH
|
3
|
+
# ./test.sh OPTIONS PATH
|
4
|
+
# test.sh -h for options
|
4
5
|
|
5
|
-
OPTIND=1
|
6
|
-
|
7
|
-
# Initialize our own variables:
|
8
|
-
output_file=""
|
9
|
-
verbose=0
|
6
|
+
OPTIND=1
|
10
7
|
|
11
8
|
show_help() {
|
12
9
|
echo "$(basename $0): Shortcut for testing conductor with a given file"
|
@@ -18,7 +15,7 @@ show_help() {
|
|
18
15
|
echo " $0 [-p PHASE] [-o OUTPUT] FILE_PATH"
|
19
16
|
}
|
20
17
|
|
21
|
-
if [[ -
|
18
|
+
if [[ -f bin/conductor ]]; then
|
22
19
|
CMD="./bin/conductor"
|
23
20
|
else
|
24
21
|
CMD="$(which 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.
|
4
|
+
version: 1.0.15
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Brett Terpstra
|
@@ -277,6 +277,7 @@ files:
|
|
277
277
|
- lib/conductor/version.rb
|
278
278
|
- marked-conductor.gemspec
|
279
279
|
- src/_README.md
|
280
|
+
- test.md
|
280
281
|
- test.sh
|
281
282
|
homepage: https://github.com/ttscoff/marked-conductor
|
282
283
|
licenses:
|