marked-conductor 1.0.14 → 1.0.16

Sign up to get free protection for your applications and to get access to all the features.
data/html/String.html CHANGED
@@ -82,14 +82,21 @@
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_css">#insert_css</a>
90
+ <li ><a href="#method-i-insert_file">#insert_file</a>
87
91
  <li ><a href="#method-i-insert_script">#insert_script</a>
88
92
  <li ><a href="#method-i-insert_title">#insert_title</a>
93
+ <li ><a href="#method-i-insert_toc">#insert_toc</a>
89
94
  <li ><a href="#method-i-meta-3F">#meta?</a>
90
95
  <li ><a href="#method-i-meta_insert_point">#meta_insert_point</a>
91
96
  <li ><a href="#method-i-meta_type">#meta_type</a>
92
97
  <li ><a href="#method-i-normalize_filter">#normalize_filter</a>
98
+ <li ><a href="#method-i-normalize_include_type">#normalize_include_type</a>
99
+ <li ><a href="#method-i-normalize_position">#normalize_position</a>
93
100
  <li ><a href="#method-i-number-3F">#number?</a>
94
101
  <li ><a href="#method-i-replace">#replace</a>
95
102
  <li ><a href="#method-i-replace_all">#replace_all</a>
@@ -105,6 +112,7 @@
105
112
  <li ><a href="#method-i-to_day">#to_day</a>
106
113
  <li ><a href="#method-i-to_pattern">#to_pattern</a>
107
114
  <li ><a href="#method-i-to_rx">#to_rx</a>
115
+ <li ><a href="#method-i-wrap_style">#wrap_style</a>
108
116
  <li ><a href="#method-i-yaml-3F">#yaml?</a>
109
117
  </ul>
110
118
  </div>
@@ -149,7 +157,7 @@
149
157
 
150
158
 
151
159
  <div class="method-source-code" id="add_comment-source">
152
- <pre><span class="ruby-comment"># File lib/conductor/filter.rb, line 164</span>
160
+ <pre><span class="ruby-comment"># File lib/conductor/filter.rb, line 267</span>
153
161
  <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
162
  <span class="ruby-keyword">if</span> <span class="ruby-identifier">has_comment?</span>(<span class="ruby-identifier">key</span>)
155
163
  <span class="ruby-identifier">sub</span>(<span class="ruby-regexp">/ *#{key}: .*?$/</span>, <span class="ruby-node">&quot;#{key}: #{value}&quot;</span>)
@@ -178,7 +186,7 @@
178
186
 
179
187
 
180
188
  <div class="method-source-code" id="add_mmd-source">
181
- <pre><span class="ruby-comment"># File lib/conductor/filter.rb, line 146</span>
189
+ <pre><span class="ruby-comment"># File lib/conductor/filter.rb, line 249</span>
182
190
  <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
191
  <span class="ruby-keyword">if</span> <span class="ruby-identifier">match</span>(<span class="ruby-regexp">/(\A|\n) *#{key}: *\S+/i</span>)
184
192
  <span class="ruby-identifier">sub</span>(<span class="ruby-regexp">/^ *#{key}:.*?\n/i</span>, <span class="ruby-node">&quot;#{key}: #{value}\n&quot;</span>)
@@ -207,7 +215,7 @@
207
215
 
208
216
 
209
217
  <div class="method-source-code" id="add_yaml-source">
210
- <pre><span class="ruby-comment"># File lib/conductor/filter.rb, line 128</span>
218
+ <pre><span class="ruby-comment"># File lib/conductor/filter.rb, line 231</span>
211
219
  <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
220
  <span class="ruby-identifier">sub</span>(<span class="ruby-regexp">/^---.*?\n(---|\.\.\.)/m</span>) <span class="ruby-keyword">do</span>
213
221
  <span class="ruby-identifier">m</span> = <span class="ruby-constant">Regexp</span>.<span class="ruby-identifier">last_match</span>
@@ -235,7 +243,7 @@
235
243
 
236
244
 
237
245
  <div class="method-source-code" id="append-source">
238
- <pre><span class="ruby-comment"># File lib/conductor/filter.rb, line 50</span>
246
+ <pre><span class="ruby-comment"># File lib/conductor/filter.rb, line 153</span>
239
247
  <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">append</span>(<span class="ruby-identifier">string</span>)
240
248
  <span class="ruby-node">&quot;#{self}\n#{string}&quot;</span>
241
249
  <span class="ruby-keyword">end</span></pre>
@@ -260,7 +268,7 @@
260
268
  <p>@return [Boolean] test result</p>
261
269
 
262
270
  <div class="method-source-code" id="bool-3F-source">
263
- <pre><span class="ruby-comment"># File lib/conductor/string.rb, line 86</span>
271
+ <pre><span class="ruby-comment"># File lib/conductor/string.rb, line 108</span>
264
272
  <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">bool?</span>
265
273
  <span class="ruby-identifier">dup</span>.<span class="ruby-identifier">force_encoding</span>(<span class="ruby-string">&quot;utf-8&quot;</span>).<span class="ruby-identifier">match?</span>(<span class="ruby-regexp">/^(?:y(?:es)?|no?|t(?:rue)?|f(?:alse)?)$/</span>)
266
274
  <span class="ruby-keyword">end</span></pre>
@@ -285,7 +293,7 @@
285
293
  <p>@return [Symbol] symbolized version</p>
286
294
 
287
295
  <div class="method-source-code" id="bool_to_symbol-source">
288
- <pre><span class="ruby-comment"># File lib/conductor/string.rb, line 19</span>
296
+ <pre><span class="ruby-comment"># File lib/conductor/string.rb, line 41</span>
289
297
  <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">bool_to_symbol</span>
290
298
  <span class="ruby-keyword">case</span> <span class="ruby-keyword">self</span>
291
299
  <span class="ruby-keyword">when</span> <span class="ruby-regexp">/(NOT|!!)/</span>
@@ -317,7 +325,7 @@
317
325
  <p>@return [Boolean] test result</p>
318
326
 
319
327
  <div class="method-source-code" id="date-3F-source">
320
- <pre><span class="ruby-comment"># File lib/conductor/string.rb, line 35</span>
328
+ <pre><span class="ruby-comment"># File lib/conductor/string.rb, line 57</span>
321
329
  <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">date?</span>
322
330
  <span class="ruby-identifier">dup</span>.<span class="ruby-identifier">force_encoding</span>(<span class="ruby-string">&quot;utf-8&quot;</span>).<span class="ruby-identifier">match?</span>(<span class="ruby-regexp">/^\d{4}-\d{2}-\d{2}( \d\d:\d\d)?$/</span>)
323
331
  <span class="ruby-keyword">end</span></pre>
@@ -340,7 +348,7 @@
340
348
 
341
349
 
342
350
  <div class="method-source-code" id="delete_meta-source">
343
- <pre><span class="ruby-comment"># File lib/conductor/filter.rb, line 174</span>
351
+ <pre><span class="ruby-comment"># File lib/conductor/filter.rb, line 277</span>
344
352
  <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">delete_meta</span>(<span class="ruby-identifier">key</span>)
345
353
  <span class="ruby-keyword">case</span> <span class="ruby-identifier">meta_type</span>
346
354
  <span class="ruby-keyword">when</span> <span class="ruby-value">:yaml</span>
@@ -368,7 +376,7 @@
368
376
 
369
377
 
370
378
  <div class="method-source-code" id="delete_mmd-source">
371
- <pre><span class="ruby-comment"># File lib/conductor/filter.rb, line 156</span>
379
+ <pre><span class="ruby-comment"># File lib/conductor/filter.rb, line 259</span>
372
380
  <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">delete_mmd</span>(<span class="ruby-identifier">key</span>)
373
381
  <span class="ruby-identifier">sub</span>(<span class="ruby-regexp">/^ *#{key}:.*?\n/i</span>, <span class="ruby-string">&quot;&quot;</span>)
374
382
  <span class="ruby-keyword">end</span></pre>
@@ -391,7 +399,7 @@
391
399
 
392
400
 
393
401
  <div class="method-source-code" id="delete_yaml-source">
394
- <pre><span class="ruby-comment"># File lib/conductor/filter.rb, line 137</span>
402
+ <pre><span class="ruby-comment"># File lib/conductor/filter.rb, line 240</span>
395
403
  <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">delete_yaml</span>(<span class="ruby-identifier">key</span>)
396
404
  <span class="ruby-identifier">sub</span>(<span class="ruby-regexp">/^---.*?\n(---|\.\.\.)/m</span>) <span class="ruby-keyword">do</span>
397
405
  <span class="ruby-identifier">m</span> = <span class="ruby-constant">Regexp</span>.<span class="ruby-identifier">last_match</span>
@@ -404,6 +412,66 @@
404
412
  </div>
405
413
 
406
414
 
415
+ </div>
416
+
417
+ <div id="method-i-first_h1" class="method-detail ">
418
+ <div class="method-header">
419
+ <div class="method-heading">
420
+ <span class="method-name">first_h1</span><span
421
+ class="method-args">()</span>
422
+ <span class="method-click-advice">click to toggle source</span>
423
+ </div>
424
+ </div>
425
+
426
+ <div class="method-description">
427
+
428
+
429
+ <div class="method-source-code" id="first_h1-source">
430
+ <pre><span class="ruby-comment"># File lib/conductor/filter.rb, line 50</span>
431
+ <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">first_h1</span>
432
+ <span class="ruby-identifier">first</span> = <span class="ruby-value">0</span>
433
+ <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>
434
+ <span class="ruby-keyword">if</span> <span class="ruby-identifier">line</span> <span class="ruby-operator">=~</span> <span class="ruby-regexp">/^(# *\S|={2,} *$)/</span>
435
+ <span class="ruby-identifier">first</span> = <span class="ruby-identifier">idx</span>
436
+ <span class="ruby-keyword">break</span>
437
+ <span class="ruby-keyword">end</span>
438
+ <span class="ruby-keyword">end</span>
439
+ <span class="ruby-identifier">first</span>
440
+ <span class="ruby-keyword">end</span></pre>
441
+ </div>
442
+ </div>
443
+
444
+
445
+ </div>
446
+
447
+ <div id="method-i-first_h2" class="method-detail ">
448
+ <div class="method-header">
449
+ <div class="method-heading">
450
+ <span class="method-name">first_h2</span><span
451
+ class="method-args">()</span>
452
+ <span class="method-click-advice">click to toggle source</span>
453
+ </div>
454
+ </div>
455
+
456
+ <div class="method-description">
457
+
458
+
459
+ <div class="method-source-code" id="first_h2-source">
460
+ <pre><span class="ruby-comment"># File lib/conductor/filter.rb, line 61</span>
461
+ <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">first_h2</span>
462
+ <span class="ruby-identifier">first</span> = <span class="ruby-value">0</span>
463
+ <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>
464
+ <span class="ruby-keyword">if</span> <span class="ruby-identifier">line</span> <span class="ruby-operator">=~</span> <span class="ruby-regexp">/^(## *\S|-{2,} *$)/</span>
465
+ <span class="ruby-identifier">first</span> = <span class="ruby-identifier">idx</span>
466
+ <span class="ruby-keyword">break</span>
467
+ <span class="ruby-keyword">end</span>
468
+ <span class="ruby-keyword">end</span>
469
+ <span class="ruby-identifier">first</span>
470
+ <span class="ruby-keyword">end</span></pre>
471
+ </div>
472
+ </div>
473
+
474
+
407
475
  </div>
408
476
 
409
477
  <div id="method-i-get_title" class="method-detail ">
@@ -419,7 +487,7 @@
419
487
 
420
488
 
421
489
  <div class="method-source-code" id="get_title-source">
422
- <pre><span class="ruby-comment"># File lib/conductor/filter.rb, line 83</span>
490
+ <pre><span class="ruby-comment"># File lib/conductor/filter.rb, line 186</span>
423
491
  <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">get_title</span>
424
492
  <span class="ruby-identifier">title</span> = <span class="ruby-keyword">nil</span>
425
493
 
@@ -463,7 +531,7 @@
463
531
 
464
532
 
465
533
  <div class="method-source-code" id="has_comment-3F-source">
466
- <pre><span class="ruby-comment"># File lib/conductor/filter.rb, line 160</span>
534
+ <pre><span class="ruby-comment"># File lib/conductor/filter.rb, line 263</span>
467
535
  <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">has_comment?</span>(<span class="ruby-identifier">key</span>)
468
536
  <span class="ruby-identifier">match</span>(<span class="ruby-regexp">/^&lt;!--.*?#{key}: \S.*?--&gt;/m</span>)
469
537
  <span class="ruby-keyword">end</span></pre>
@@ -471,6 +539,102 @@
471
539
  </div>
472
540
 
473
541
 
542
+ </div>
543
+
544
+ <div id="method-i-insert_css" class="method-detail ">
545
+ <div class="method-header">
546
+ <div class="method-heading">
547
+ <span class="method-name">insert_css</span><span
548
+ class="method-args">(path)</span>
549
+ <span class="method-click-advice">click to toggle source</span>
550
+ </div>
551
+ </div>
552
+
553
+ <div class="method-description">
554
+
555
+
556
+ <div class="method-source-code" id="insert_css-source">
557
+ <pre><span class="ruby-comment"># File lib/conductor/filter.rb, line 95</span>
558
+ <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">insert_css</span>(<span class="ruby-identifier">path</span>)
559
+ <span class="ruby-identifier">path</span>.<span class="ruby-identifier">sub!</span>(<span class="ruby-regexp">/(\.css)?$/</span>, <span class="ruby-string">&#39;.css&#39;</span>)
560
+
561
+ <span class="ruby-keyword">if</span> <span class="ruby-identifier">path</span> <span class="ruby-operator">=~</span> <span class="ruby-regexp">%r{^[~/]}</span>
562
+ <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>)
563
+ <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">&quot;~/.config/conductor/css&quot;</span>))
564
+ <span class="ruby-identifier">new_path</span> = <span class="ruby-constant">File</span>.<span class="ruby-identifier">expand_path</span>(<span class="ruby-node">&quot;~/.config/conductor/css/#{path}&quot;</span>)
565
+ <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>)
566
+ <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">&quot;~/.config/conductor/files&quot;</span>))
567
+ <span class="ruby-identifier">new_path</span> = <span class="ruby-constant">File</span>.<span class="ruby-identifier">expand_path</span>(<span class="ruby-node">&quot;~/.config/conductor/files/#{path}&quot;</span>)
568
+ <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>)
569
+ <span class="ruby-keyword">end</span>
570
+
571
+ <span class="ruby-keyword">if</span> <span class="ruby-constant">File</span>.<span class="ruby-identifier">exist?</span>(<span class="ruby-identifier">path</span>)
572
+ <span class="ruby-identifier">content</span> = <span class="ruby-constant">IO</span>.<span class="ruby-identifier">read</span>(<span class="ruby-identifier">path</span>)
573
+ <span class="ruby-identifier">yui</span> = <span class="ruby-constant">YuiCompressor</span><span class="ruby-operator">::</span><span class="ruby-constant">Yui</span>.<span class="ruby-identifier">new</span>
574
+ <span class="ruby-identifier">content</span> = <span class="ruby-identifier">yui</span>.<span class="ruby-identifier">compress</span>(<span class="ruby-identifier">content</span>)
575
+ <span class="ruby-identifier">lines</span> = <span class="ruby-identifier">split</span>(<span class="ruby-regexp">/\n/</span>)
576
+ <span class="ruby-identifier">insert_point</span> = <span class="ruby-identifier">meta_insert_point</span>
577
+ <span class="ruby-identifier">insert_at</span> = <span class="ruby-identifier">insert_point</span>.<span class="ruby-identifier">positive?</span> <span class="ruby-operator">?</span> <span class="ruby-identifier">insert_point</span> <span class="ruby-operator">+</span> <span class="ruby-value">1</span> <span class="ruby-operator">:</span> <span class="ruby-value">0</span>
578
+ <span class="ruby-identifier">lines</span>.<span class="ruby-identifier">insert</span>(<span class="ruby-identifier">insert_at</span>, <span class="ruby-node">&quot;#{content.wrap_style}\n\n&quot;</span>)
579
+ <span class="ruby-identifier">lines</span>.<span class="ruby-identifier">join</span>(<span class="ruby-string">&quot;\n&quot;</span>)
580
+ <span class="ruby-keyword">else</span>
581
+ <span class="ruby-identifier">warn</span> <span class="ruby-node">&quot;File not found (#{path})&quot;</span>
582
+ <span class="ruby-keyword">self</span>
583
+ <span class="ruby-keyword">end</span>
584
+ <span class="ruby-keyword">end</span></pre>
585
+ </div>
586
+ </div>
587
+
588
+
589
+ </div>
590
+
591
+ <div id="method-i-insert_file" class="method-detail ">
592
+ <div class="method-header">
593
+ <div class="method-heading">
594
+ <span class="method-name">insert_file</span><span
595
+ class="method-args">(path, type = :file, position = :end)</span>
596
+ <span class="method-click-advice">click to toggle source</span>
597
+ </div>
598
+ </div>
599
+
600
+ <div class="method-description">
601
+
602
+
603
+ <div class="method-source-code" id="insert_file-source">
604
+ <pre><span class="ruby-comment"># File lib/conductor/filter.rb, line 123</span>
605
+ <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>)
606
+ <span class="ruby-identifier">path</span>.<span class="ruby-identifier">strip!</span>
607
+
608
+ <span class="ruby-keyword">if</span> <span class="ruby-identifier">path</span> <span class="ruby-operator">=~</span> <span class="ruby-regexp">%r{^[~/]}</span>
609
+ <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>)
610
+ <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">&quot;~/.config/conductor/files&quot;</span>))
611
+ <span class="ruby-identifier">new_path</span> = <span class="ruby-constant">File</span>.<span class="ruby-identifier">expand_path</span>(<span class="ruby-node">&quot;~/.config/conductor/files/#{path}&quot;</span>)
612
+ <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>)
613
+ <span class="ruby-keyword">end</span>
614
+
615
+ <span class="ruby-identifier">out</span> = <span class="ruby-keyword">case</span> <span class="ruby-identifier">type</span>
616
+ <span class="ruby-keyword">when</span> <span class="ruby-value">:code</span>
617
+ <span class="ruby-node">&quot;&lt;&lt;(#{path})&quot;</span>
618
+ <span class="ruby-keyword">when</span> <span class="ruby-value">:raw</span>
619
+ <span class="ruby-node">&quot;&lt;&lt;{#{path}}&quot;</span>
620
+ <span class="ruby-keyword">else</span>
621
+ <span class="ruby-node">&quot;&lt;&lt;[#{path}]&quot;</span>
622
+ <span class="ruby-keyword">end</span>
623
+ <span class="ruby-identifier">out</span> = <span class="ruby-node">&quot;\n#{out}\n&quot;</span>
624
+
625
+ <span class="ruby-keyword">case</span> <span class="ruby-identifier">position</span>
626
+ <span class="ruby-keyword">when</span> <span class="ruby-value">:start</span>
627
+ <span class="ruby-node">&quot;#{out}\n#{self}&quot;</span>
628
+ <span class="ruby-keyword">when</span> <span class="ruby-value">:h1</span>
629
+ <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">&quot;\n&quot;</span>)
630
+ <span class="ruby-keyword">else</span>
631
+ <span class="ruby-node">&quot;#{self}\n#{out}&quot;</span>
632
+ <span class="ruby-keyword">end</span>
633
+ <span class="ruby-keyword">end</span></pre>
634
+ </div>
635
+ </div>
636
+
637
+
474
638
  </div>
475
639
 
476
640
  <div id="method-i-insert_script" class="method-detail ">
@@ -486,7 +650,7 @@
486
650
 
487
651
 
488
652
  <div class="method-source-code" id="insert_script-source">
489
- <pre><span class="ruby-comment"># File lib/conductor/filter.rb, line 54</span>
653
+ <pre><span class="ruby-comment"># File lib/conductor/filter.rb, line 157</span>
490
654
  <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">insert_script</span>(<span class="ruby-identifier">path</span>)
491
655
  <span class="ruby-identifier">path</span>.<span class="ruby-identifier">strip!</span>
492
656
  <span class="ruby-identifier">path</span> = <span class="ruby-node">&quot;#{path}.js&quot;</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 +690,7 @@
526
690
 
527
691
 
528
692
  <div class="method-source-code" id="insert_title-source">
529
- <pre><span class="ruby-comment"># File lib/conductor/filter.rb, line 108</span>
693
+ <pre><span class="ruby-comment"># File lib/conductor/filter.rb, line 211</span>
530
694
  <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">insert_title</span>
531
695
  <span class="ruby-identifier">title</span> = <span class="ruby-identifier">get_title</span>
532
696
  <span class="ruby-identifier">lines</span> = <span class="ruby-identifier">split</span>(<span class="ruby-regexp">/\n/</span>)
@@ -539,6 +703,40 @@
539
703
  </div>
540
704
 
541
705
 
706
+ </div>
707
+
708
+ <div id="method-i-insert_toc" class="method-detail ">
709
+ <div class="method-header">
710
+ <div class="method-heading">
711
+ <span class="method-name">insert_toc</span><span
712
+ class="method-args">(max = nil, after = :h1)</span>
713
+ <span class="method-click-advice">click to toggle source</span>
714
+ </div>
715
+ </div>
716
+
717
+ <div class="method-description">
718
+
719
+
720
+ <div class="method-source-code" id="insert_toc-source">
721
+ <pre><span class="ruby-comment"># File lib/conductor/filter.rb, line 72</span>
722
+ <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>)
723
+ <span class="ruby-identifier">lines</span> = <span class="ruby-identifier">split</span>(<span class="ruby-regexp">/\n/</span>)
724
+ <span class="ruby-identifier">max</span> = <span class="ruby-identifier">max</span> <span class="ruby-operator">&amp;&amp;</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">&quot; max#{max}&quot;</span> <span class="ruby-operator">:</span> <span class="ruby-string">&quot;&quot;</span>
725
+ <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>
726
+ <span class="ruby-keyword">when</span> <span class="ruby-value">:h2</span>
727
+ <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>
728
+ <span class="ruby-keyword">when</span> <span class="ruby-value">:h1</span>
729
+ <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>
730
+ <span class="ruby-keyword">else</span>
731
+ <span class="ruby-value">0</span>
732
+ <span class="ruby-keyword">end</span>
733
+
734
+ <span class="ruby-identifier">lines</span>.<span class="ruby-identifier">insert</span>(<span class="ruby-identifier">line</span>, <span class="ruby-node">&quot;\n&lt;!--toc#{max}--&gt;\n&quot;</span>).<span class="ruby-identifier">join</span>(<span class="ruby-string">&quot;\n&quot;</span>)
735
+ <span class="ruby-keyword">end</span></pre>
736
+ </div>
737
+ </div>
738
+
739
+
542
740
  </div>
543
741
 
544
742
  <div id="method-i-meta-3F" class="method-detail ">
@@ -556,7 +754,7 @@
556
754
  <p>@return [Boolean] test result</p>
557
755
 
558
756
  <div class="method-source-code" id="meta-3F-source">
559
- <pre><span class="ruby-comment"># File lib/conductor/string.rb, line 104</span>
757
+ <pre><span class="ruby-comment"># File lib/conductor/string.rb, line 126</span>
560
758
  <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">meta?</span>
561
759
  <span class="ruby-identifier">dup</span>.<span class="ruby-identifier">force_encoding</span>(<span class="ruby-string">&#39;utf-8&#39;</span>).<span class="ruby-identifier">match?</span>(<span class="ruby-regexp">/^\w+: +\S+/m</span>)
562
760
  <span class="ruby-keyword">end</span></pre>
@@ -666,6 +864,66 @@
666
864
  </div>
667
865
 
668
866
 
867
+ </div>
868
+
869
+ <div id="method-i-normalize_include_type" class="method-detail ">
870
+ <div class="method-header">
871
+ <div class="method-heading">
872
+ <span class="method-name">normalize_include_type</span><span
873
+ class="method-args">()</span>
874
+ <span class="method-click-advice">click to toggle source</span>
875
+ </div>
876
+ </div>
877
+
878
+ <div class="method-description">
879
+
880
+
881
+ <div class="method-source-code" id="normalize_include_type-source">
882
+ <pre><span class="ruby-comment"># File lib/conductor/string.rb, line 25</span>
883
+ <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">normalize_include_type</span>
884
+ <span class="ruby-keyword">case</span> <span class="ruby-keyword">self</span>
885
+ <span class="ruby-keyword">when</span> <span class="ruby-regexp">/^c/</span>
886
+ <span class="ruby-value">:code</span>
887
+ <span class="ruby-keyword">when</span> <span class="ruby-regexp">/^r/</span>
888
+ <span class="ruby-value">:raw</span>
889
+ <span class="ruby-keyword">else</span>
890
+ <span class="ruby-value">:file</span>
891
+ <span class="ruby-keyword">end</span>
892
+ <span class="ruby-keyword">end</span></pre>
893
+ </div>
894
+ </div>
895
+
896
+
897
+ </div>
898
+
899
+ <div id="method-i-normalize_position" class="method-detail ">
900
+ <div class="method-header">
901
+ <div class="method-heading">
902
+ <span class="method-name">normalize_position</span><span
903
+ class="method-args">()</span>
904
+ <span class="method-click-advice">click to toggle source</span>
905
+ </div>
906
+ </div>
907
+
908
+ <div class="method-description">
909
+
910
+
911
+ <div class="method-source-code" id="normalize_position-source">
912
+ <pre><span class="ruby-comment"># File lib/conductor/string.rb, line 14</span>
913
+ <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">normalize_position</span>
914
+ <span class="ruby-keyword">case</span> <span class="ruby-keyword">self</span>
915
+ <span class="ruby-keyword">when</span> <span class="ruby-regexp">/^(be|s|t)/</span>
916
+ <span class="ruby-value">:start</span>
917
+ <span class="ruby-keyword">when</span> <span class="ruby-regexp">/h1/</span>
918
+ <span class="ruby-value">:h1</span>
919
+ <span class="ruby-keyword">else</span>
920
+ <span class="ruby-value">:end</span>
921
+ <span class="ruby-keyword">end</span>
922
+ <span class="ruby-keyword">end</span></pre>
923
+ </div>
924
+ </div>
925
+
926
+
669
927
  </div>
670
928
 
671
929
  <div id="method-i-number-3F" class="method-detail ">
@@ -683,7 +941,7 @@
683
941
  <p>@return [Boolean] test result</p>
684
942
 
685
943
  <div class="method-source-code" id="number-3F-source">
686
- <pre><span class="ruby-comment"># File lib/conductor/string.rb, line 77</span>
944
+ <pre><span class="ruby-comment"># File lib/conductor/string.rb, line 99</span>
687
945
  <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">number?</span>
688
946
  <span class="ruby-identifier">to_f</span>.<span class="ruby-identifier">positive?</span>
689
947
  <span class="ruby-keyword">end</span></pre>
@@ -706,7 +964,7 @@
706
964
 
707
965
 
708
966
  <div class="method-source-code" id="replace-source">
709
- <pre><span class="ruby-comment"># File lib/conductor/filter.rb, line 197</span>
967
+ <pre><span class="ruby-comment"># File lib/conductor/filter.rb, line 300</span>
710
968
  <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
969
  <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
970
  <span class="ruby-keyword">end</span></pre>
@@ -729,7 +987,7 @@
729
987
 
730
988
 
731
989
  <div class="method-source-code" id="replace_all-source">
732
- <pre><span class="ruby-comment"># File lib/conductor/filter.rb, line 193</span>
990
+ <pre><span class="ruby-comment"># File lib/conductor/filter.rb, line 296</span>
733
991
  <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
992
  <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
993
  <span class="ruby-keyword">end</span></pre>
@@ -752,7 +1010,7 @@
752
1010
 
753
1011
 
754
1012
  <div class="method-source-code" id="set_meta-source">
755
- <pre><span class="ruby-comment"># File lib/conductor/filter.rb, line 117</span>
1013
+ <pre><span class="ruby-comment"># File lib/conductor/filter.rb, line 220</span>
756
1014
  <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
1015
  <span class="ruby-keyword">case</span> <span class="ruby-identifier">style</span>
758
1016
  <span class="ruby-keyword">when</span> <span class="ruby-value">:yaml</span>
@@ -782,7 +1040,7 @@
782
1040
 
783
1041
 
784
1042
  <div class="method-source-code" id="strip_meta-source">
785
- <pre><span class="ruby-comment"># File lib/conductor/filter.rb, line 183</span>
1043
+ <pre><span class="ruby-comment"># File lib/conductor/filter.rb, line 286</span>
786
1044
  <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">strip_meta</span>
787
1045
  <span class="ruby-keyword">case</span> <span class="ruby-identifier">meta_type</span>
788
1046
  <span class="ruby-keyword">when</span> <span class="ruby-value">:yaml</span>
@@ -813,7 +1071,7 @@
813
1071
  <p>@return [String] string with time removed</p>
814
1072
 
815
1073
  <div class="method-source-code" id="strip_time-source">
816
- <pre><span class="ruby-comment"># File lib/conductor/string.rb, line 63</span>
1074
+ <pre><span class="ruby-comment"># File lib/conductor/string.rb, line 85</span>
817
1075
  <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">strip_time</span>
818
1076
  <span class="ruby-identifier">dup</span>.<span class="ruby-identifier">force_encoding</span>(<span class="ruby-string">&quot;utf-8&quot;</span>).<span class="ruby-identifier">sub</span>(<span class="ruby-regexp">/ \d{1,2}(:\d\d)? *([ap]m)?/i</span>, <span class="ruby-string">&quot;&quot;</span>)
819
1077
  <span class="ruby-keyword">end</span></pre>
@@ -838,7 +1096,7 @@
838
1096
  <p>@return [Boolean] test result</p>
839
1097
 
840
1098
  <div class="method-source-code" id="time-3F-source">
841
- <pre><span class="ruby-comment"># File lib/conductor/string.rb, line 44</span>
1099
+ <pre><span class="ruby-comment"># File lib/conductor/string.rb, line 66</span>
842
1100
  <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">time?</span>
843
1101
  <span class="ruby-identifier">dup</span>.<span class="ruby-identifier">force_encoding</span>(<span class="ruby-string">&quot;utf-8&quot;</span>).<span class="ruby-identifier">match</span>(<span class="ruby-regexp">/ \d{1,2}(:\d\d)? *([ap]m)?/i</span>)
844
1102
  <span class="ruby-keyword">end</span></pre>
@@ -861,7 +1119,7 @@
861
1119
 
862
1120
 
863
1121
  <div class="method-source-code" id="title_from_slug-source">
864
- <pre><span class="ruby-comment"># File lib/conductor/filter.rb, line 75</span>
1122
+ <pre><span class="ruby-comment"># File lib/conductor/filter.rb, line 178</span>
865
1123
  <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">title_from_slug</span>
866
1124
  <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">&quot;&quot;</span>)
867
1125
  <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">&quot;&quot;</span>)
@@ -915,7 +1173,7 @@
915
1173
  <p>@return [Boolean] Bool representation of the object.</p>
916
1174
 
917
1175
  <div class="method-source-code" id="to_bool-source">
918
- <pre><span class="ruby-comment"># File lib/conductor/string.rb, line 123</span>
1176
+ <pre><span class="ruby-comment"># File lib/conductor/string.rb, line 145</span>
919
1177
  <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">to_bool</span>
920
1178
  <span class="ruby-keyword">case</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier">force_encoding</span>(<span class="ruby-string">&#39;utf-8&#39;</span>)
921
1179
  <span class="ruby-keyword">when</span> <span class="ruby-regexp">/^[yt]/i</span>
@@ -945,7 +1203,7 @@
945
1203
  <p>@see <a href="String.html#method-i-to_bool"><code>to_bool</code></a></p>
946
1204
 
947
1205
  <div class="method-source-code" id="to_bool-21-source">
948
- <pre><span class="ruby-comment"># File lib/conductor/string.rb, line 114</span>
1206
+ <pre><span class="ruby-comment"># File lib/conductor/string.rb, line 136</span>
949
1207
  <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">to_bool!</span>
950
1208
  <span class="ruby-identifier">replace</span> <span class="ruby-identifier">to_bool</span>
951
1209
  <span class="ruby-keyword">end</span></pre>
@@ -973,7 +1231,7 @@
973
1231
  <p>@return [Date] Resulting Date object</p>
974
1232
 
975
1233
  <div class="method-source-code" id="to_date-source">
976
- <pre><span class="ruby-comment"># File lib/conductor/string.rb, line 54</span>
1234
+ <pre><span class="ruby-comment"># File lib/conductor/string.rb, line 76</span>
977
1235
  <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">to_date</span>
978
1236
  <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">&quot;utf-8&quot;</span>))
979
1237
  <span class="ruby-keyword">end</span></pre>
@@ -996,7 +1254,7 @@
996
1254
 
997
1255
 
998
1256
  <div class="method-source-code" id="to_day-source">
999
- <pre><span class="ruby-comment"># File lib/conductor/string.rb, line 67</span>
1257
+ <pre><span class="ruby-comment"># File lib/conductor/string.rb, line 89</span>
1000
1258
  <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
1259
  <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">&quot;23:59&quot;</span> <span class="ruby-operator">:</span> <span class="ruby-string">&quot;00:00&quot;</span>
1002
1260
  <span class="ruby-constant">Chronic</span>.<span class="ruby-identifier">parse</span>(<span class="ruby-node">&quot;#{strip_time} #{t}&quot;</span>)
@@ -1020,7 +1278,7 @@
1020
1278
 
1021
1279
 
1022
1280
  <div class="method-source-code" id="to_pattern-source">
1023
- <pre><span class="ruby-comment"># File lib/conductor/filter.rb, line 212</span>
1281
+ <pre><span class="ruby-comment"># File lib/conductor/filter.rb, line 315</span>
1024
1282
  <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">to_pattern</span>
1025
1283
  <span class="ruby-identifier">gsub</span>(<span class="ruby-regexp">/\$(\d+)/</span>, <span class="ruby-string">&#39;\\\\\1&#39;</span>).<span class="ruby-identifier">gsub</span>(<span class="ruby-regexp">/(^[&quot;&#39;]|[&quot;&#39;]$)/</span>, <span class="ruby-string">&quot;&quot;</span>)
1026
1284
  <span class="ruby-keyword">end</span></pre>
@@ -1043,7 +1301,7 @@
1043
1301
 
1044
1302
 
1045
1303
  <div class="method-source-code" id="to_rx-source">
1046
- <pre><span class="ruby-comment"># File lib/conductor/filter.rb, line 201</span>
1304
+ <pre><span class="ruby-comment"># File lib/conductor/filter.rb, line 304</span>
1047
1305
  <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">to_rx</span>
1048
1306
  <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
1307
  <span class="ruby-identifier">m</span> = <span class="ruby-constant">Regexp</span>.<span class="ruby-identifier">last_match</span>
@@ -1058,6 +1316,33 @@
1058
1316
  </div>
1059
1317
 
1060
1318
 
1319
+ </div>
1320
+
1321
+ <div id="method-i-wrap_style" class="method-detail ">
1322
+ <div class="method-header">
1323
+ <div class="method-heading">
1324
+ <span class="method-name">wrap_style</span><span
1325
+ class="method-args">()</span>
1326
+ <span class="method-click-advice">click to toggle source</span>
1327
+ </div>
1328
+ </div>
1329
+
1330
+ <div class="method-description">
1331
+
1332
+
1333
+ <div class="method-source-code" id="wrap_style-source">
1334
+ <pre><span class="ruby-comment"># File lib/conductor/filter.rb, line 87</span>
1335
+ <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">wrap_style</span>
1336
+ <span class="ruby-keyword">if</span> <span class="ruby-identifier">match</span>(<span class="ruby-regexp">%r{&lt;style&gt;.*?&lt;/style&gt;}m</span>)
1337
+ <span class="ruby-keyword">self</span>
1338
+ <span class="ruby-keyword">else</span>
1339
+ <span class="ruby-node">&quot;&lt;style&gt;#{self}&lt;/style&gt;&quot;</span>
1340
+ <span class="ruby-keyword">end</span>
1341
+ <span class="ruby-keyword">end</span></pre>
1342
+ </div>
1343
+ </div>
1344
+
1345
+
1061
1346
  </div>
1062
1347
 
1063
1348
  <div id="method-i-yaml-3F" class="method-detail ">
@@ -1075,7 +1360,7 @@
1075
1360
  <p>@return [Boolean] test result</p>
1076
1361
 
1077
1362
  <div class="method-source-code" id="yaml-3F-source">
1078
- <pre><span class="ruby-comment"># File lib/conductor/string.rb, line 95</span>
1363
+ <pre><span class="ruby-comment"># File lib/conductor/string.rb, line 117</span>
1079
1364
  <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">yaml?</span>
1080
1365
  <span class="ruby-identifier">dup</span>.<span class="ruby-identifier">force_encoding</span>(<span class="ruby-string">&#39;utf-8&#39;</span>).<span class="ruby-identifier">match?</span>(<span class="ruby-regexp">/^---/m</span>)
1081
1366
  <span class="ruby-keyword">end</span></pre>
@@ -1093,7 +1378,7 @@
1093
1378
 
1094
1379
  <footer id="validator-badges" role="contentinfo">
1095
1380
  <p><a href="https://validator.w3.org/check/referer">Validate</a>
1096
- <p>Generated by <a href="https://ruby.github.io/rdoc/">RDoc</a> 6.6.2.
1381
+ <p>Generated by <a href="https://ruby.github.io/rdoc/">RDoc</a> 6.7.0.
1097
1382
  <p>Based on <a href="http://deveiate.org/projects/Darkfish-RDoc/">Darkfish</a> by <a href="http://deveiate.org">Michael Granger</a>.
1098
1383
  </footer>
1099
1384