mbrao 1.4.4 → 1.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +29 -0
- data/.travis.yml +3 -4
- data/CHANGELOG.md +5 -0
- data/Gemfile +4 -4
- data/doc/ActionView.html +125 -0
- data/doc/ActionView/Template.html +140 -0
- data/doc/ActionView/Template/Handlers.html +3 -3
- data/doc/ActionView/Template/Handlers/MbraoTemplate.html +26 -26
- data/doc/HTML.html +2 -2
- data/doc/HTML/Pipeline.html +2 -2
- data/doc/HTML/Pipeline/KramdownFilter.html +4 -4
- data/doc/Mbrao.html +3 -3
- data/doc/Mbrao/Author.html +29 -29
- data/doc/Mbrao/Content.html +1977 -3644
- data/doc/Mbrao/ContentInterface.html +817 -0
- data/doc/Mbrao/ContentInterface/ClassMethods.html +388 -0
- data/doc/Mbrao/Exceptions.html +1 -1
- data/doc/Mbrao/Exceptions/InvalidDate.html +1 -1
- data/doc/Mbrao/Exceptions/InvalidMetadata.html +1 -1
- data/doc/Mbrao/Exceptions/Parsing.html +1 -1
- data/doc/Mbrao/Exceptions/Rendering.html +1 -1
- data/doc/Mbrao/Exceptions/UnavailableLocalization.html +1 -1
- data/doc/Mbrao/Exceptions/Unimplemented.html +1 -1
- data/doc/Mbrao/Exceptions/UnknownEngine.html +1 -1
- data/doc/Mbrao/Parser.html +12 -12
- data/doc/Mbrao/ParserInterface.html +134 -0
- data/doc/Mbrao/ParserInterface/ClassMethods.html +1724 -0
- data/doc/Mbrao/ParserValidations.html +134 -0
- data/doc/Mbrao/ParserValidations/ClassMethods.html +348 -0
- data/doc/Mbrao/ParsingEngines.html +1 -1
- data/doc/Mbrao/ParsingEngines/Base.html +4 -4
- data/doc/Mbrao/ParsingEngines/PlainText.html +25 -15
- data/doc/Mbrao/RenderingEngines.html +1 -1
- data/doc/Mbrao/RenderingEngines/Base.html +2 -2
- data/doc/Mbrao/RenderingEngines/HtmlPipeline.html +173 -169
- data/doc/Mbrao/Version.html +3 -3
- data/doc/_index.html +51 -24
- data/doc/class_list.html +1 -1
- data/doc/file.README.html +1 -1
- data/doc/index.html +1 -1
- data/doc/method_list.html +63 -69
- data/doc/top-level-namespace.html +2 -2
- data/lib/mbrao.rb +7 -2
- data/lib/mbrao/author.rb +5 -5
- data/lib/mbrao/content.rb +110 -256
- data/lib/mbrao/content_interface.rb +146 -0
- data/lib/mbrao/exceptions.rb +1 -1
- data/lib/mbrao/integrations/rails.rb +48 -42
- data/lib/mbrao/parser.rb +24 -176
- data/lib/mbrao/parser_interface.rb +143 -0
- data/lib/mbrao/parser_validations.rb +41 -0
- data/lib/mbrao/parsing_engines/base.rb +4 -4
- data/lib/mbrao/parsing_engines/plain_text.rb +136 -121
- data/lib/mbrao/rendering_engines/base.rb +2 -2
- data/lib/mbrao/rendering_engines/html_pipeline.rb +52 -77
- data/lib/mbrao/rendering_engines/html_pipeline/kramdown_filter.rb +31 -0
- data/lib/mbrao/version.rb +2 -2
- data/mbrao.gemspec +3 -3
- data/spec/mbrao/author_spec.rb +1 -1
- data/spec/mbrao/content_spec.rb +1 -1
- data/spec/mbrao/parser_spec.rb +16 -16
- data/spec/mbrao/rendering_engines/html_pipeline/kramdown_filter_spec.rb +28 -0
- data/spec/mbrao/rendering_engines/html_pipeline_spec.rb +0 -21
- metadata +23 -8
@@ -118,7 +118,7 @@
|
|
118
118
|
</div>
|
119
119
|
|
120
120
|
<div id="footer">
|
121
|
-
Generated on
|
121
|
+
Generated on Sun May 11 18:17:17 2014 by
|
122
122
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
123
123
|
0.8.7.4 (ruby-2.1.0).
|
124
124
|
</div>
|
@@ -346,7 +346,7 @@ returned, else a <code>HashWithIndifferentAccess</code> with locales as keys.</p
|
|
346
346
|
<pre class="code"><span class="info file"># File 'lib/mbrao/parsing_engines/base.rb', line 37</span>
|
347
347
|
|
348
348
|
<span class='kw'>def</span> <span class='id identifier rubyid_filter_content'>filter_content</span><span class='lparen'>(</span><span class='id identifier rubyid__content'>_content</span><span class='comma'>,</span> <span class='id identifier rubyid__locales'>_locales</span> <span class='op'>=</span> <span class='lbracket'>[</span><span class='rbracket'>]</span><span class='comma'>,</span> <span class='id identifier rubyid__options'>_options</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span><span class='rparen'>)</span>
|
349
|
-
<span class='id identifier rubyid_raise'>raise</span> <span class='const'>Mbrao</span><span class='op'>::</span><span class='const'>Exceptions</span><span class='op'>::</span><span class='const'>Unimplemented</span
|
349
|
+
<span class='id identifier rubyid_raise'>raise</span> <span class='const'>Mbrao</span><span class='op'>::</span><span class='const'>Exceptions</span><span class='op'>::</span><span class='const'>Unimplemented</span>
|
350
350
|
<span class='kw'>end</span></pre>
|
351
351
|
</td>
|
352
352
|
</tr>
|
@@ -532,7 +532,7 @@ returned, else a <code>HashWithIndifferentAccess</code> with locales as keys.</p
|
|
532
532
|
<pre class="code"><span class="info file"># File 'lib/mbrao/parsing_engines/base.rb', line 26</span>
|
533
533
|
|
534
534
|
<span class='kw'>def</span> <span class='id identifier rubyid_parse_metadata'>parse_metadata</span><span class='lparen'>(</span><span class='id identifier rubyid__content'>_content</span><span class='comma'>,</span> <span class='id identifier rubyid__options'>_options</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span><span class='rparen'>)</span>
|
535
|
-
<span class='id identifier rubyid_raise'>raise</span> <span class='const'>Mbrao</span><span class='op'>::</span><span class='const'>Exceptions</span><span class='op'>::</span><span class='const'>Unimplemented</span
|
535
|
+
<span class='id identifier rubyid_raise'>raise</span> <span class='const'>Mbrao</span><span class='op'>::</span><span class='const'>Exceptions</span><span class='op'>::</span><span class='const'>Unimplemented</span>
|
536
536
|
<span class='kw'>end</span></pre>
|
537
537
|
</td>
|
538
538
|
</tr>
|
@@ -638,7 +638,7 @@ returned, else a <code>HashWithIndifferentAccess</code> with locales as keys.</p
|
|
638
638
|
<pre class="code"><span class="info file"># File 'lib/mbrao/parsing_engines/base.rb', line 17</span>
|
639
639
|
|
640
640
|
<span class='kw'>def</span> <span class='id identifier rubyid_separate_components'>separate_components</span><span class='lparen'>(</span><span class='id identifier rubyid__content'>_content</span><span class='comma'>,</span> <span class='id identifier rubyid__options'>_options</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span><span class='rparen'>)</span>
|
641
|
-
<span class='id identifier rubyid_raise'>raise</span> <span class='const'>Mbrao</span><span class='op'>::</span><span class='const'>Exceptions</span><span class='op'>::</span><span class='const'>Unimplemented</span
|
641
|
+
<span class='id identifier rubyid_raise'>raise</span> <span class='const'>Mbrao</span><span class='op'>::</span><span class='const'>Exceptions</span><span class='op'>::</span><span class='const'>Unimplemented</span>
|
642
642
|
<span class='kw'>end</span></pre>
|
643
643
|
</td>
|
644
644
|
</tr>
|
@@ -650,7 +650,7 @@ returned, else a <code>HashWithIndifferentAccess</code> with locales as keys.</p
|
|
650
650
|
</div>
|
651
651
|
|
652
652
|
<div id="footer">
|
653
|
-
Generated on
|
653
|
+
Generated on Sun May 11 18:17:19 2014 by
|
654
654
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
655
655
|
0.8.7.4 (ruby-2.1.0).
|
656
656
|
</div>
|
@@ -311,20 +311,20 @@ returned, else a <code>HashWithIndifferentAccess</code> with locales as keys.</p
|
|
311
311
|
<pre class="lines">
|
312
312
|
|
313
313
|
|
314
|
-
52
|
315
|
-
53
|
316
|
-
54
|
317
|
-
55
|
318
|
-
56
|
319
314
|
57
|
320
315
|
58
|
321
316
|
59
|
322
317
|
60
|
323
318
|
61
|
324
|
-
62
|
319
|
+
62
|
320
|
+
63
|
321
|
+
64
|
322
|
+
65
|
323
|
+
66
|
324
|
+
67</pre>
|
325
325
|
</td>
|
326
326
|
<td>
|
327
|
-
<pre class="code"><span class="info file"># File 'lib/mbrao/parsing_engines/plain_text.rb', line
|
327
|
+
<pre class="code"><span class="info file"># File 'lib/mbrao/parsing_engines/plain_text.rb', line 57</span>
|
328
328
|
|
329
329
|
<span class='kw'>def</span> <span class='id identifier rubyid_filter_content'>filter_content</span><span class='lparen'>(</span><span class='id identifier rubyid_content'>content</span><span class='comma'>,</span> <span class='id identifier rubyid_locales'>locales</span> <span class='op'>=</span> <span class='lbracket'>[</span><span class='rbracket'>]</span><span class='comma'>,</span> <span class='id identifier rubyid_options'>options</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span><span class='rparen'>)</span>
|
330
330
|
<span class='id identifier rubyid_body'>body</span> <span class='op'>=</span> <span class='id identifier rubyid_content'>content</span><span class='period'>.</span><span class='id identifier rubyid_body'>body</span><span class='period'>.</span><span class='id identifier rubyid_ensure_string'>ensure_string</span><span class='period'>.</span><span class='id identifier rubyid_strip'>strip</span>
|
@@ -426,16 +426,26 @@ returned, else a <code>HashWithIndifferentAccess</code> with locales as keys.</p
|
|
426
426
|
40
|
427
427
|
41
|
428
428
|
42
|
429
|
-
43
|
429
|
+
43
|
430
|
+
44
|
431
|
+
45
|
432
|
+
46
|
433
|
+
47
|
434
|
+
48</pre>
|
430
435
|
</td>
|
431
436
|
<td>
|
432
437
|
<pre class="code"><span class="info file"># File 'lib/mbrao/parsing_engines/plain_text.rb', line 37</span>
|
433
438
|
|
434
439
|
<span class='kw'>def</span> <span class='id identifier rubyid_parse_metadata'>parse_metadata</span><span class='lparen'>(</span><span class='id identifier rubyid_content'>content</span><span class='comma'>,</span> <span class='id identifier rubyid_options'>options</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span><span class='rparen'>)</span>
|
435
|
-
<span class='
|
436
|
-
|
437
|
-
<span class='
|
438
|
-
|
440
|
+
<span class='id identifier rubyid_rv'>rv</span> <span class='op'>=</span> <span class='const'>YAML</span><span class='period'>.</span><span class='id identifier rubyid_load'>load</span><span class='lparen'>(</span><span class='id identifier rubyid_content'>content</span><span class='rparen'>)</span>
|
441
|
+
<span class='id identifier rubyid_rv'>rv</span> <span class='op'>||=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span>
|
442
|
+
<span class='id identifier rubyid_raise'>raise</span> <span class='const'>ArgumentError</span> <span class='kw'>unless</span> <span class='id identifier rubyid_rv'>rv</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span><span class='lparen'>(</span><span class='const'>Hash</span><span class='rparen'>)</span>
|
443
|
+
<span class='id identifier rubyid_rv'>rv</span>
|
444
|
+
<span class='kw'>rescue</span> <span class='op'>=></span> <span class='id identifier rubyid_e'>e</span>
|
445
|
+
<span class='kw'>if</span> <span class='id identifier rubyid_options'>options</span><span class='lbracket'>[</span><span class='symbol'>:default</span><span class='rbracket'>]</span>
|
446
|
+
<span class='id identifier rubyid_options'>options</span><span class='lbracket'>[</span><span class='symbol'>:default</span><span class='rbracket'>]</span>
|
447
|
+
<span class='kw'>else</span>
|
448
|
+
<span class='id identifier rubyid_raise'>raise</span> <span class='op'>::</span><span class='const'>Mbrao</span><span class='op'>::</span><span class='const'>Exceptions</span><span class='op'>::</span><span class='const'>InvalidMetadata</span><span class='comma'>,</span> <span class='id identifier rubyid_e'>e</span><span class='period'>.</span><span class='id identifier rubyid_to_s'>to_s</span>
|
439
449
|
<span class='kw'>end</span>
|
440
450
|
<span class='kw'>end</span></pre>
|
441
451
|
</td>
|
@@ -542,10 +552,10 @@ returned, else a <code>HashWithIndifferentAccess</code> with locales as keys.</p
|
|
542
552
|
<span class='kw'>def</span> <span class='id identifier rubyid_separate_components'>separate_components</span><span class='lparen'>(</span><span class='id identifier rubyid_content'>content</span><span class='comma'>,</span> <span class='id identifier rubyid_options'>options</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span><span class='rparen'>)</span>
|
543
553
|
<span class='id identifier rubyid_metadata'>metadata</span><span class='comma'>,</span> <span class='id identifier rubyid_content'>content</span><span class='comma'>,</span> <span class='id identifier rubyid_scanner'>scanner</span><span class='comma'>,</span> <span class='id identifier rubyid_start_tag'>start_tag</span><span class='comma'>,</span> <span class='id identifier rubyid_end_tag'>end_tag</span> <span class='op'>=</span> <span class='id identifier rubyid_prepare_for_separation'>prepare_for_separation</span><span class='lparen'>(</span><span class='id identifier rubyid_content'>content</span><span class='comma'>,</span> <span class='id identifier rubyid_options'>options</span><span class='rparen'>)</span>
|
544
554
|
|
545
|
-
<span class='kw'>if</span> <span class='id identifier rubyid_scanner'>scanner</span><span class='period'>.</span><span class='id identifier rubyid_scan_until'>scan_until</span><span class='lparen'>(</span><span class='id identifier rubyid_start_tag'>start_tag</span><span class='rparen'>)</span>
|
555
|
+
<span class='kw'>if</span> <span class='id identifier rubyid_scanner'>scanner</span><span class='period'>.</span><span class='id identifier rubyid_scan_until'>scan_until</span><span class='lparen'>(</span><span class='id identifier rubyid_start_tag'>start_tag</span><span class='rparen'>)</span>
|
546
556
|
<span class='id identifier rubyid_metadata'>metadata</span> <span class='op'>=</span> <span class='id identifier rubyid_scanner'>scanner</span><span class='period'>.</span><span class='id identifier rubyid_scan_until'>scan_until</span><span class='lparen'>(</span><span class='id identifier rubyid_end_tag'>end_tag</span><span class='rparen'>)</span>
|
547
557
|
|
548
|
-
<span class='kw'>if</span> <span class='id identifier rubyid_metadata'>metadata</span>
|
558
|
+
<span class='kw'>if</span> <span class='id identifier rubyid_metadata'>metadata</span>
|
549
559
|
<span class='id identifier rubyid_metadata'>metadata</span> <span class='op'>=</span> <span class='id identifier rubyid_metadata'>metadata</span><span class='period'>.</span><span class='id identifier rubyid_partition'>partition</span><span class='lparen'>(</span><span class='id identifier rubyid_end_tag'>end_tag</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_first'>first</span>
|
550
560
|
<span class='id identifier rubyid_content'>content</span> <span class='op'>=</span> <span class='id identifier rubyid_scanner'>scanner</span><span class='period'>.</span><span class='id identifier rubyid_rest'>rest</span><span class='period'>.</span><span class='id identifier rubyid_strip'>strip</span>
|
551
561
|
<span class='kw'>end</span>
|
@@ -563,7 +573,7 @@ returned, else a <code>HashWithIndifferentAccess</code> with locales as keys.</p
|
|
563
573
|
</div>
|
564
574
|
|
565
575
|
<div id="footer">
|
566
|
-
Generated on
|
576
|
+
Generated on Sun May 11 18:17:19 2014 by
|
567
577
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
568
578
|
0.8.7.4 (ruby-2.1.0).
|
569
579
|
</div>
|
@@ -118,7 +118,7 @@
|
|
118
118
|
</div>
|
119
119
|
|
120
120
|
<div id="footer">
|
121
|
-
Generated on
|
121
|
+
Generated on Sun May 11 18:17:17 2014 by
|
122
122
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
123
123
|
0.8.7.4 (ruby-2.1.0).
|
124
124
|
</div>
|
@@ -259,7 +259,7 @@
|
|
259
259
|
<pre class="code"><span class="info file"># File 'lib/mbrao/rendering_engines/base.rb', line 17</span>
|
260
260
|
|
261
261
|
<span class='kw'>def</span> <span class='id identifier rubyid_render'>render</span><span class='lparen'>(</span><span class='id identifier rubyid__content'>_content</span><span class='comma'>,</span> <span class='id identifier rubyid__options'>_options</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span><span class='comma'>,</span> <span class='id identifier rubyid__context'>_context</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span><span class='rparen'>)</span>
|
262
|
-
<span class='id identifier rubyid_raise'>raise</span> <span class='const'>Mbrao</span><span class='op'>::</span><span class='const'>Exceptions</span><span class='op'>::</span><span class='const'>Unimplemented</span
|
262
|
+
<span class='id identifier rubyid_raise'>raise</span> <span class='const'>Mbrao</span><span class='op'>::</span><span class='const'>Exceptions</span><span class='op'>::</span><span class='const'>Unimplemented</span>
|
263
263
|
<span class='kw'>end</span></pre>
|
264
264
|
</td>
|
265
265
|
</tr>
|
@@ -271,7 +271,7 @@
|
|
271
271
|
</div>
|
272
272
|
|
273
273
|
<div id="footer">
|
274
|
-
Generated on
|
274
|
+
Generated on Sun May 11 18:17:19 2014 by
|
275
275
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
276
276
|
0.8.7.4 (ruby-2.1.0).
|
277
277
|
</div>
|
@@ -263,6 +263,32 @@
|
|
263
263
|
<pre class="lines">
|
264
264
|
|
265
265
|
|
266
|
+
18
|
267
|
+
19
|
268
|
+
20
|
269
|
+
21
|
270
|
+
22
|
271
|
+
23
|
272
|
+
24
|
273
|
+
25
|
274
|
+
26
|
275
|
+
27
|
276
|
+
28
|
277
|
+
29
|
278
|
+
30
|
279
|
+
31
|
280
|
+
32
|
281
|
+
33
|
282
|
+
34
|
283
|
+
35
|
284
|
+
36
|
285
|
+
37
|
286
|
+
38
|
287
|
+
39
|
288
|
+
40
|
289
|
+
41
|
290
|
+
42
|
291
|
+
43
|
266
292
|
44
|
267
293
|
45
|
268
294
|
46
|
@@ -344,35 +370,10 @@
|
|
344
370
|
122
|
345
371
|
123
|
346
372
|
124
|
347
|
-
125
|
348
|
-
126
|
349
|
-
127
|
350
|
-
128
|
351
|
-
129
|
352
|
-
130
|
353
|
-
131
|
354
|
-
132
|
355
|
-
133
|
356
|
-
134
|
357
|
-
135
|
358
|
-
136
|
359
|
-
137
|
360
|
-
138
|
361
|
-
139
|
362
|
-
140
|
363
|
-
141
|
364
|
-
142
|
365
|
-
143
|
366
|
-
144
|
367
|
-
145
|
368
|
-
146
|
369
|
-
147
|
370
|
-
148
|
371
|
-
149
|
372
|
-
150</pre>
|
373
|
+
125</pre>
|
373
374
|
</td>
|
374
375
|
<td>
|
375
|
-
<pre class="code"><span class="info file"># File 'lib/mbrao/rendering_engines/html_pipeline.rb', line
|
376
|
+
<pre class="code"><span class="info file"># File 'lib/mbrao/rendering_engines/html_pipeline.rb', line 18</span>
|
376
377
|
|
377
378
|
<span class='kw'>class</span> <span class='const'>HtmlPipeline</span> <span class='op'><</span> <span class='const'>Mbrao</span><span class='op'>::</span><span class='const'>RenderingEngines</span><span class='op'>::</span><span class='const'>Base</span>
|
378
379
|
<span class='id identifier rubyid_attr_accessor'>attr_accessor</span> <span class='symbol'>:default_pipeline</span>
|
@@ -392,7 +393,7 @@
|
|
392
393
|
<span class='kw'>rescue</span> <span class='const'>Mbrao</span><span class='op'>::</span><span class='const'>Exceptions</span><span class='op'>::</span><span class='const'>UnavailableLocalization</span> <span class='op'>=></span> <span class='id identifier rubyid_le'>le</span>
|
393
394
|
<span class='id identifier rubyid_raise'>raise</span> <span class='id identifier rubyid_le'>le</span>
|
394
395
|
<span class='kw'>rescue</span> <span class='op'>=></span> <span class='id identifier rubyid_e'>e</span>
|
395
|
-
<span class='id identifier rubyid_raise'>raise</span> <span class='op'>::</span><span class='const'>Mbrao</span><span class='op'>::</span><span class='const'>Exceptions</span><span class='op'>::</span><span class='const'>Rendering</span><span class='
|
396
|
+
<span class='id identifier rubyid_raise'>raise</span> <span class='op'>::</span><span class='const'>Mbrao</span><span class='op'>::</span><span class='const'>Exceptions</span><span class='op'>::</span><span class='const'>Rendering</span><span class='comma'>,</span> <span class='id identifier rubyid_e'>e</span><span class='period'>.</span><span class='id identifier rubyid_to_s'>to_s</span>
|
396
397
|
<span class='kw'>end</span>
|
397
398
|
<span class='kw'>end</span>
|
398
399
|
|
@@ -407,7 +408,7 @@
|
|
407
408
|
</span> <span class='comment'>#
|
408
409
|
</span> <span class='comment'># @return [Array] The default pipeline.
|
409
410
|
</span> <span class='kw'>def</span> <span class='id identifier rubyid_default_pipeline='>default_pipeline=</span><span class='lparen'>(</span><span class='id identifier rubyid_value'>value</span><span class='rparen'>)</span>
|
410
|
-
<span class='ivar'>@default_pipeline</span> <span class='op'>=</span> <span class='id identifier rubyid_value'>value</span><span class='period'>.</span><span class='id identifier rubyid_ensure_array'>ensure_array</span><span class='lparen'>(</span><span class='kw'>nil</span><span class='comma'>,</span> <span class='kw'>false</span><span class='comma'>,</span> <span class='kw'>false</span><span class='rparen'>)</span> <span class='lbrace'>{</span
|
411
|
+
<span class='ivar'>@default_pipeline</span> <span class='op'>=</span> <span class='id identifier rubyid_value'>value</span><span class='period'>.</span><span class='id identifier rubyid_ensure_array'>ensure_array</span><span class='lparen'>(</span><span class='kw'>nil</span><span class='comma'>,</span> <span class='kw'>false</span><span class='comma'>,</span> <span class='kw'>false</span><span class='rparen'>)</span> <span class='lbrace'>{</span> <span class='op'>|</span><span class='id identifier rubyid_v'>v</span><span class='op'>|</span> <span class='id identifier rubyid_v'>v</span><span class='period'>.</span><span class='id identifier rubyid_ensure_array'>ensure_array</span><span class='lparen'>(</span><span class='kw'>nil</span><span class='comma'>,</span> <span class='kw'>true</span><span class='comma'>,</span> <span class='kw'>true</span><span class='comma'>,</span> <span class='kw'>true</span><span class='rparen'>)</span> <span class='lbrace'>{</span> <span class='op'>|</span><span class='id identifier rubyid_p'>p</span><span class='op'>|</span> <span class='id identifier rubyid_p'>p</span><span class='period'>.</span><span class='id identifier rubyid_ensure_string'>ensure_string</span><span class='period'>.</span><span class='id identifier rubyid_to_sym'>to_sym</span> <span class='rbrace'>}</span> <span class='rbrace'>}</span>
|
411
412
|
<span class='kw'>end</span>
|
412
413
|
|
413
414
|
<span class='comment'># Gets the default options.
|
@@ -425,61 +426,62 @@
|
|
425
426
|
<span class='kw'>end</span>
|
426
427
|
|
427
428
|
<span class='id identifier rubyid_private'>private</span>
|
428
|
-
<span class='comment'># Sanitizes options.
|
429
|
-
</span> <span class='comment'>#
|
430
|
-
</span> <span class='comment'># @param options [Hash] The options to sanitize.
|
431
|
-
</span> <span class='comment'># @return [Hash] The sanitized options.
|
432
|
-
</span> <span class='kw'>def</span> <span class='id identifier rubyid_sanitize_options'>sanitize_options</span><span class='lparen'>(</span><span class='id identifier rubyid_options'>options</span><span class='rparen'>)</span>
|
433
|
-
<span class='id identifier rubyid_options'>options</span> <span class='op'>=</span> <span class='id identifier rubyid_options'>options</span><span class='period'>.</span><span class='id identifier rubyid_ensure_hash'>ensure_hash</span><span class='lparen'>(</span><span class='symbol'>:symbols</span><span class='rparen'>)</span>
|
434
|
-
<span class='id identifier rubyid_options'>options</span> <span class='op'>=</span> <span class='id identifier rubyid_filter_filters'>filter_filters</span><span class='lparen'>(</span><span class='id identifier rubyid_options'>options</span><span class='rparen'>)</span>
|
435
|
-
<span class='id identifier rubyid_options'>options</span><span class='lbracket'>[</span><span class='symbol'>:pipeline_options</span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_default_options'>default_options</span><span class='period'>.</span><span class='id identifier rubyid_merge'>merge</span><span class='lparen'>(</span><span class='id identifier rubyid_options'>options</span><span class='lbracket'>[</span><span class='symbol'>:pipeline_options</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_ensure_hash'>ensure_hash</span><span class='lparen'>(</span><span class='symbol'>:symbols</span><span class='rparen'>)</span><span class='rparen'>)</span>
|
436
|
-
|
437
|
-
<span class='id identifier rubyid_options'>options</span>
|
438
|
-
<span class='kw'>end</span>
|
439
429
|
|
440
|
-
|
441
|
-
</span>
|
442
|
-
</span>
|
443
|
-
</span>
|
444
|
-
</span>
|
445
|
-
|
446
|
-
|
447
|
-
|
448
|
-
|
430
|
+
<span class='comment'># Sanitizes options.
|
431
|
+
</span> <span class='comment'>#
|
432
|
+
</span> <span class='comment'># @param options [Hash] The options to sanitize.
|
433
|
+
</span> <span class='comment'># @return [Hash] The sanitized options.
|
434
|
+
</span> <span class='kw'>def</span> <span class='id identifier rubyid_sanitize_options'>sanitize_options</span><span class='lparen'>(</span><span class='id identifier rubyid_options'>options</span><span class='rparen'>)</span>
|
435
|
+
<span class='id identifier rubyid_options'>options</span> <span class='op'>=</span> <span class='id identifier rubyid_options'>options</span><span class='period'>.</span><span class='id identifier rubyid_ensure_hash'>ensure_hash</span><span class='lparen'>(</span><span class='symbol'>:symbols</span><span class='rparen'>)</span>
|
436
|
+
<span class='id identifier rubyid_options'>options</span> <span class='op'>=</span> <span class='id identifier rubyid_filter_filters'>filter_filters</span><span class='lparen'>(</span><span class='id identifier rubyid_options'>options</span><span class='rparen'>)</span>
|
437
|
+
<span class='id identifier rubyid_options'>options</span><span class='lbracket'>[</span><span class='symbol'>:pipeline_options</span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='id identifier rubyid_default_options'>default_options</span><span class='period'>.</span><span class='id identifier rubyid_merge'>merge</span><span class='lparen'>(</span><span class='id identifier rubyid_options'>options</span><span class='lbracket'>[</span><span class='symbol'>:pipeline_options</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_ensure_hash'>ensure_hash</span><span class='lparen'>(</span><span class='symbol'>:symbols</span><span class='rparen'>)</span><span class='rparen'>)</span>
|
438
|
+
|
439
|
+
<span class='id identifier rubyid_options'>options</span>
|
440
|
+
<span class='kw'>end</span>
|
449
441
|
|
450
|
-
|
451
|
-
</span>
|
452
|
-
</span>
|
453
|
-
</span>
|
454
|
-
</span>
|
455
|
-
</span>
|
456
|
-
|
457
|
-
|
458
|
-
|
459
|
-
<span class='rparen'>)</span>
|
460
|
-
<span class='kw'>end</span>
|
442
|
+
<span class='comment'># Get body of a content.
|
443
|
+
</span> <span class='comment'>#
|
444
|
+
</span> <span class='comment'># @param content [Content|String] The content to sanitize.
|
445
|
+
</span> <span class='comment'># @param options [Hash] A list of options for renderer.
|
446
|
+
</span> <span class='comment'># @return [Array] The body to parse.
|
447
|
+
</span> <span class='kw'>def</span> <span class='id identifier rubyid_get_body'>get_body</span><span class='lparen'>(</span><span class='id identifier rubyid_content'>content</span><span class='comma'>,</span> <span class='id identifier rubyid_options'>options</span><span class='rparen'>)</span>
|
448
|
+
<span class='id identifier rubyid_content'>content</span> <span class='op'>=</span> <span class='op'>::</span><span class='const'>Mbrao</span><span class='op'>::</span><span class='const'>Content</span><span class='period'>.</span><span class='id identifier rubyid_create'>create</span><span class='lparen'>(</span><span class='kw'>nil</span><span class='comma'>,</span> <span class='id identifier rubyid_content'>content</span><span class='period'>.</span><span class='id identifier rubyid_ensure_string'>ensure_string</span><span class='rparen'>)</span> <span class='kw'>unless</span> <span class='id identifier rubyid_content'>content</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span><span class='lparen'>(</span><span class='op'>::</span><span class='const'>Mbrao</span><span class='op'>::</span><span class='const'>Content</span><span class='rparen'>)</span>
|
449
|
+
<span class='id identifier rubyid_content'>content</span><span class='period'>.</span><span class='id identifier rubyid_get_body'>get_body</span><span class='lparen'>(</span><span class='id identifier rubyid_options'>options</span><span class='period'>.</span><span class='id identifier rubyid_fetch'>fetch</span><span class='lparen'>(</span><span class='symbol'>:locales</span><span class='comma'>,</span> <span class='op'>::</span><span class='const'>Mbrao</span><span class='op'>::</span><span class='const'>Parser</span><span class='period'>.</span><span class='id identifier rubyid_locale'>locale</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_ensure_string'>ensure_string</span><span class='rparen'>)</span>
|
450
|
+
<span class='kw'>end</span>
|
461
451
|
|
462
|
-
|
463
|
-
</span>
|
464
|
-
</span>
|
465
|
-
</span>
|
466
|
-
</span>
|
467
|
-
|
452
|
+
<span class='comment'># Creates the pipeline for rendering.
|
453
|
+
</span> <span class='comment'>#
|
454
|
+
</span> <span class='comment'># @param options [Hash] A list of options for renderer.
|
455
|
+
</span> <span class='comment'># @param context [Hash] A context for rendering.
|
456
|
+
</span> <span class='comment'># @return [HTML::Pipeline] The pipeline
|
457
|
+
</span> <span class='kw'>def</span> <span class='id identifier rubyid_create_pipeline'>create_pipeline</span><span class='lparen'>(</span><span class='id identifier rubyid_options'>options</span><span class='comma'>,</span> <span class='id identifier rubyid_context'>context</span><span class='rparen'>)</span>
|
458
|
+
<span class='op'>::</span><span class='const'>HTML</span><span class='op'>::</span><span class='const'>Pipeline</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span>
|
459
|
+
<span class='id identifier rubyid_options'>options</span><span class='lbracket'>[</span><span class='symbol'>:pipeline</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_map'>map</span> <span class='lbrace'>{</span> <span class='op'>|</span><span class='id identifier rubyid_f'>f</span><span class='op'>|</span> <span class='op'>::</span><span class='const'>Lazier</span><span class='period'>.</span><span class='id identifier rubyid_find_class'>find_class</span><span class='lparen'>(</span><span class='id identifier rubyid_f'>f</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>::HTML::Pipeline::%CLASS%Filter</span><span class='tstring_end'>"</span></span><span class='comma'>,</span> <span class='kw'>true</span><span class='rparen'>)</span> <span class='rbrace'>}</span><span class='comma'>,</span>
|
460
|
+
<span class='id identifier rubyid_options'>options</span><span class='lbracket'>[</span><span class='symbol'>:pipeline_options</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_merge'>merge</span><span class='lparen'>(</span><span class='id identifier rubyid_context'>context</span><span class='rparen'>)</span>
|
461
|
+
<span class='rparen'>)</span>
|
462
|
+
<span class='kw'>end</span>
|
468
463
|
|
469
|
-
|
470
|
-
|
471
|
-
|
464
|
+
<span class='comment'># Filters pipeline filters basing on the options provided.
|
465
|
+
</span> <span class='comment'>#
|
466
|
+
</span> <span class='comment'># @param options [Hash] The original options.
|
467
|
+
</span> <span class='comment'># @return [Hash] The options with the new set of filters.
|
468
|
+
</span> <span class='kw'>def</span> <span class='id identifier rubyid_filter_filters'>filter_filters</span><span class='lparen'>(</span><span class='id identifier rubyid_options'>options</span><span class='rparen'>)</span>
|
469
|
+
<span class='id identifier rubyid_options'>options</span><span class='lbracket'>[</span><span class='symbol'>:pipeline</span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='id identifier rubyid_get_pipeline'>get_pipeline</span><span class='lparen'>(</span><span class='id identifier rubyid_options'>options</span><span class='rparen'>)</span>
|
472
470
|
|
473
|
-
|
471
|
+
<span class='id identifier rubyid_default_pipeline'>default_pipeline</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_f'>f</span><span class='op'>|</span>
|
472
|
+
<span class='id identifier rubyid_options'>options</span><span class='lbracket'>[</span><span class='symbol'>:pipeline</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_delete'>delete</span><span class='lparen'>(</span><span class='id identifier rubyid_f'>f</span><span class='period'>.</span><span class='id identifier rubyid_first'>first</span><span class='rparen'>)</span> <span class='kw'>unless</span> <span class='id identifier rubyid_options'>options</span><span class='period'>.</span><span class='id identifier rubyid_fetch'>fetch</span><span class='lparen'>(</span><span class='id identifier rubyid_f'>f</span><span class='period'>.</span><span class='id identifier rubyid_last'>last</span><span class='comma'>,</span> <span class='kw'>true</span><span class='rparen'>)</span>
|
474
473
|
<span class='kw'>end</span>
|
475
474
|
|
476
|
-
<span class='
|
477
|
-
|
478
|
-
|
479
|
-
|
480
|
-
</span>
|
481
|
-
|
482
|
-
|
475
|
+
<span class='id identifier rubyid_options'>options</span>
|
476
|
+
<span class='kw'>end</span>
|
477
|
+
|
478
|
+
<span class='comment'># Gets the pipeline for the current options.
|
479
|
+
</span> <span class='comment'>#
|
480
|
+
</span> <span class='comment'># @param options [Hash] The options to parse.
|
481
|
+
</span> <span class='comment'># @return [Array] The pipeline to process.
|
482
|
+
</span> <span class='kw'>def</span> <span class='id identifier rubyid_get_pipeline'>get_pipeline</span><span class='lparen'>(</span><span class='id identifier rubyid_options'>options</span><span class='rparen'>)</span>
|
483
|
+
<span class='id identifier rubyid_options'>options</span><span class='period'>.</span><span class='id identifier rubyid_fetch'>fetch</span><span class='lparen'>(</span><span class='symbol'>:pipeline</span><span class='comma'>,</span> <span class='id identifier rubyid_default_pipeline'>default_pipeline</span><span class='period'>.</span><span class='id identifier rubyid_map'>map</span><span class='lparen'>(</span><span class='op'>&</span><span class='symbol'>:first</span><span class='rparen'>)</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_map'>map</span><span class='lparen'>(</span><span class='op'>&</span><span class='symbol'>:to_sym</span><span class='rparen'>)</span>
|
484
|
+
<span class='kw'>end</span>
|
483
485
|
<span class='kw'>end</span></pre>
|
484
486
|
</td>
|
485
487
|
</tr>
|
@@ -530,6 +532,32 @@
|
|
530
532
|
<pre class="lines">
|
531
533
|
|
532
534
|
|
535
|
+
18
|
536
|
+
19
|
537
|
+
20
|
538
|
+
21
|
539
|
+
22
|
540
|
+
23
|
541
|
+
24
|
542
|
+
25
|
543
|
+
26
|
544
|
+
27
|
545
|
+
28
|
546
|
+
29
|
547
|
+
30
|
548
|
+
31
|
549
|
+
32
|
550
|
+
33
|
551
|
+
34
|
552
|
+
35
|
553
|
+
36
|
554
|
+
37
|
555
|
+
38
|
556
|
+
39
|
557
|
+
40
|
558
|
+
41
|
559
|
+
42
|
560
|
+
43
|
533
561
|
44
|
534
562
|
45
|
535
563
|
46
|
@@ -611,35 +639,10 @@
|
|
611
639
|
122
|
612
640
|
123
|
613
641
|
124
|
614
|
-
125
|
615
|
-
126
|
616
|
-
127
|
617
|
-
128
|
618
|
-
129
|
619
|
-
130
|
620
|
-
131
|
621
|
-
132
|
622
|
-
133
|
623
|
-
134
|
624
|
-
135
|
625
|
-
136
|
626
|
-
137
|
627
|
-
138
|
628
|
-
139
|
629
|
-
140
|
630
|
-
141
|
631
|
-
142
|
632
|
-
143
|
633
|
-
144
|
634
|
-
145
|
635
|
-
146
|
636
|
-
147
|
637
|
-
148
|
638
|
-
149
|
639
|
-
150</pre>
|
642
|
+
125</pre>
|
640
643
|
</td>
|
641
644
|
<td>
|
642
|
-
<pre class="code"><span class="info file"># File 'lib/mbrao/rendering_engines/html_pipeline.rb', line
|
645
|
+
<pre class="code"><span class="info file"># File 'lib/mbrao/rendering_engines/html_pipeline.rb', line 18</span>
|
643
646
|
|
644
647
|
<span class='kw'>class</span> <span class='const'>HtmlPipeline</span> <span class='op'><</span> <span class='const'>Mbrao</span><span class='op'>::</span><span class='const'>RenderingEngines</span><span class='op'>::</span><span class='const'>Base</span>
|
645
648
|
<span class='id identifier rubyid_attr_accessor'>attr_accessor</span> <span class='symbol'>:default_pipeline</span>
|
@@ -659,7 +662,7 @@
|
|
659
662
|
<span class='kw'>rescue</span> <span class='const'>Mbrao</span><span class='op'>::</span><span class='const'>Exceptions</span><span class='op'>::</span><span class='const'>UnavailableLocalization</span> <span class='op'>=></span> <span class='id identifier rubyid_le'>le</span>
|
660
663
|
<span class='id identifier rubyid_raise'>raise</span> <span class='id identifier rubyid_le'>le</span>
|
661
664
|
<span class='kw'>rescue</span> <span class='op'>=></span> <span class='id identifier rubyid_e'>e</span>
|
662
|
-
<span class='id identifier rubyid_raise'>raise</span> <span class='op'>::</span><span class='const'>Mbrao</span><span class='op'>::</span><span class='const'>Exceptions</span><span class='op'>::</span><span class='const'>Rendering</span><span class='
|
665
|
+
<span class='id identifier rubyid_raise'>raise</span> <span class='op'>::</span><span class='const'>Mbrao</span><span class='op'>::</span><span class='const'>Exceptions</span><span class='op'>::</span><span class='const'>Rendering</span><span class='comma'>,</span> <span class='id identifier rubyid_e'>e</span><span class='period'>.</span><span class='id identifier rubyid_to_s'>to_s</span>
|
663
666
|
<span class='kw'>end</span>
|
664
667
|
<span class='kw'>end</span>
|
665
668
|
|
@@ -674,7 +677,7 @@
|
|
674
677
|
</span> <span class='comment'>#
|
675
678
|
</span> <span class='comment'># @return [Array] The default pipeline.
|
676
679
|
</span> <span class='kw'>def</span> <span class='id identifier rubyid_default_pipeline='>default_pipeline=</span><span class='lparen'>(</span><span class='id identifier rubyid_value'>value</span><span class='rparen'>)</span>
|
677
|
-
<span class='ivar'>@default_pipeline</span> <span class='op'>=</span> <span class='id identifier rubyid_value'>value</span><span class='period'>.</span><span class='id identifier rubyid_ensure_array'>ensure_array</span><span class='lparen'>(</span><span class='kw'>nil</span><span class='comma'>,</span> <span class='kw'>false</span><span class='comma'>,</span> <span class='kw'>false</span><span class='rparen'>)</span> <span class='lbrace'>{</span
|
680
|
+
<span class='ivar'>@default_pipeline</span> <span class='op'>=</span> <span class='id identifier rubyid_value'>value</span><span class='period'>.</span><span class='id identifier rubyid_ensure_array'>ensure_array</span><span class='lparen'>(</span><span class='kw'>nil</span><span class='comma'>,</span> <span class='kw'>false</span><span class='comma'>,</span> <span class='kw'>false</span><span class='rparen'>)</span> <span class='lbrace'>{</span> <span class='op'>|</span><span class='id identifier rubyid_v'>v</span><span class='op'>|</span> <span class='id identifier rubyid_v'>v</span><span class='period'>.</span><span class='id identifier rubyid_ensure_array'>ensure_array</span><span class='lparen'>(</span><span class='kw'>nil</span><span class='comma'>,</span> <span class='kw'>true</span><span class='comma'>,</span> <span class='kw'>true</span><span class='comma'>,</span> <span class='kw'>true</span><span class='rparen'>)</span> <span class='lbrace'>{</span> <span class='op'>|</span><span class='id identifier rubyid_p'>p</span><span class='op'>|</span> <span class='id identifier rubyid_p'>p</span><span class='period'>.</span><span class='id identifier rubyid_ensure_string'>ensure_string</span><span class='period'>.</span><span class='id identifier rubyid_to_sym'>to_sym</span> <span class='rbrace'>}</span> <span class='rbrace'>}</span>
|
678
681
|
<span class='kw'>end</span>
|
679
682
|
|
680
683
|
<span class='comment'># Gets the default options.
|
@@ -692,61 +695,62 @@
|
|
692
695
|
<span class='kw'>end</span>
|
693
696
|
|
694
697
|
<span class='id identifier rubyid_private'>private</span>
|
695
|
-
<span class='comment'># Sanitizes options.
|
696
|
-
</span> <span class='comment'>#
|
697
|
-
</span> <span class='comment'># @param options [Hash] The options to sanitize.
|
698
|
-
</span> <span class='comment'># @return [Hash] The sanitized options.
|
699
|
-
</span> <span class='kw'>def</span> <span class='id identifier rubyid_sanitize_options'>sanitize_options</span><span class='lparen'>(</span><span class='id identifier rubyid_options'>options</span><span class='rparen'>)</span>
|
700
|
-
<span class='id identifier rubyid_options'>options</span> <span class='op'>=</span> <span class='id identifier rubyid_options'>options</span><span class='period'>.</span><span class='id identifier rubyid_ensure_hash'>ensure_hash</span><span class='lparen'>(</span><span class='symbol'>:symbols</span><span class='rparen'>)</span>
|
701
|
-
<span class='id identifier rubyid_options'>options</span> <span class='op'>=</span> <span class='id identifier rubyid_filter_filters'>filter_filters</span><span class='lparen'>(</span><span class='id identifier rubyid_options'>options</span><span class='rparen'>)</span>
|
702
|
-
<span class='id identifier rubyid_options'>options</span><span class='lbracket'>[</span><span class='symbol'>:pipeline_options</span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_default_options'>default_options</span><span class='period'>.</span><span class='id identifier rubyid_merge'>merge</span><span class='lparen'>(</span><span class='id identifier rubyid_options'>options</span><span class='lbracket'>[</span><span class='symbol'>:pipeline_options</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_ensure_hash'>ensure_hash</span><span class='lparen'>(</span><span class='symbol'>:symbols</span><span class='rparen'>)</span><span class='rparen'>)</span>
|
703
|
-
|
704
|
-
<span class='id identifier rubyid_options'>options</span>
|
705
|
-
<span class='kw'>end</span>
|
706
698
|
|
707
|
-
|
708
|
-
</span>
|
709
|
-
</span>
|
710
|
-
</span>
|
711
|
-
</span>
|
712
|
-
|
713
|
-
|
714
|
-
|
715
|
-
|
699
|
+
<span class='comment'># Sanitizes options.
|
700
|
+
</span> <span class='comment'>#
|
701
|
+
</span> <span class='comment'># @param options [Hash] The options to sanitize.
|
702
|
+
</span> <span class='comment'># @return [Hash] The sanitized options.
|
703
|
+
</span> <span class='kw'>def</span> <span class='id identifier rubyid_sanitize_options'>sanitize_options</span><span class='lparen'>(</span><span class='id identifier rubyid_options'>options</span><span class='rparen'>)</span>
|
704
|
+
<span class='id identifier rubyid_options'>options</span> <span class='op'>=</span> <span class='id identifier rubyid_options'>options</span><span class='period'>.</span><span class='id identifier rubyid_ensure_hash'>ensure_hash</span><span class='lparen'>(</span><span class='symbol'>:symbols</span><span class='rparen'>)</span>
|
705
|
+
<span class='id identifier rubyid_options'>options</span> <span class='op'>=</span> <span class='id identifier rubyid_filter_filters'>filter_filters</span><span class='lparen'>(</span><span class='id identifier rubyid_options'>options</span><span class='rparen'>)</span>
|
706
|
+
<span class='id identifier rubyid_options'>options</span><span class='lbracket'>[</span><span class='symbol'>:pipeline_options</span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='id identifier rubyid_default_options'>default_options</span><span class='period'>.</span><span class='id identifier rubyid_merge'>merge</span><span class='lparen'>(</span><span class='id identifier rubyid_options'>options</span><span class='lbracket'>[</span><span class='symbol'>:pipeline_options</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_ensure_hash'>ensure_hash</span><span class='lparen'>(</span><span class='symbol'>:symbols</span><span class='rparen'>)</span><span class='rparen'>)</span>
|
707
|
+
|
708
|
+
<span class='id identifier rubyid_options'>options</span>
|
709
|
+
<span class='kw'>end</span>
|
716
710
|
|
717
|
-
|
718
|
-
</span>
|
719
|
-
</span>
|
720
|
-
</span>
|
721
|
-
</span>
|
722
|
-
</span>
|
723
|
-
|
724
|
-
|
725
|
-
|
726
|
-
<span class='rparen'>)</span>
|
727
|
-
<span class='kw'>end</span>
|
711
|
+
<span class='comment'># Get body of a content.
|
712
|
+
</span> <span class='comment'>#
|
713
|
+
</span> <span class='comment'># @param content [Content|String] The content to sanitize.
|
714
|
+
</span> <span class='comment'># @param options [Hash] A list of options for renderer.
|
715
|
+
</span> <span class='comment'># @return [Array] The body to parse.
|
716
|
+
</span> <span class='kw'>def</span> <span class='id identifier rubyid_get_body'>get_body</span><span class='lparen'>(</span><span class='id identifier rubyid_content'>content</span><span class='comma'>,</span> <span class='id identifier rubyid_options'>options</span><span class='rparen'>)</span>
|
717
|
+
<span class='id identifier rubyid_content'>content</span> <span class='op'>=</span> <span class='op'>::</span><span class='const'>Mbrao</span><span class='op'>::</span><span class='const'>Content</span><span class='period'>.</span><span class='id identifier rubyid_create'>create</span><span class='lparen'>(</span><span class='kw'>nil</span><span class='comma'>,</span> <span class='id identifier rubyid_content'>content</span><span class='period'>.</span><span class='id identifier rubyid_ensure_string'>ensure_string</span><span class='rparen'>)</span> <span class='kw'>unless</span> <span class='id identifier rubyid_content'>content</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span><span class='lparen'>(</span><span class='op'>::</span><span class='const'>Mbrao</span><span class='op'>::</span><span class='const'>Content</span><span class='rparen'>)</span>
|
718
|
+
<span class='id identifier rubyid_content'>content</span><span class='period'>.</span><span class='id identifier rubyid_get_body'>get_body</span><span class='lparen'>(</span><span class='id identifier rubyid_options'>options</span><span class='period'>.</span><span class='id identifier rubyid_fetch'>fetch</span><span class='lparen'>(</span><span class='symbol'>:locales</span><span class='comma'>,</span> <span class='op'>::</span><span class='const'>Mbrao</span><span class='op'>::</span><span class='const'>Parser</span><span class='period'>.</span><span class='id identifier rubyid_locale'>locale</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_ensure_string'>ensure_string</span><span class='rparen'>)</span>
|
719
|
+
<span class='kw'>end</span>
|
728
720
|
|
729
|
-
|
730
|
-
</span>
|
731
|
-
</span>
|
732
|
-
</span>
|
733
|
-
</span>
|
734
|
-
|
721
|
+
<span class='comment'># Creates the pipeline for rendering.
|
722
|
+
</span> <span class='comment'>#
|
723
|
+
</span> <span class='comment'># @param options [Hash] A list of options for renderer.
|
724
|
+
</span> <span class='comment'># @param context [Hash] A context for rendering.
|
725
|
+
</span> <span class='comment'># @return [HTML::Pipeline] The pipeline
|
726
|
+
</span> <span class='kw'>def</span> <span class='id identifier rubyid_create_pipeline'>create_pipeline</span><span class='lparen'>(</span><span class='id identifier rubyid_options'>options</span><span class='comma'>,</span> <span class='id identifier rubyid_context'>context</span><span class='rparen'>)</span>
|
727
|
+
<span class='op'>::</span><span class='const'>HTML</span><span class='op'>::</span><span class='const'>Pipeline</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span>
|
728
|
+
<span class='id identifier rubyid_options'>options</span><span class='lbracket'>[</span><span class='symbol'>:pipeline</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_map'>map</span> <span class='lbrace'>{</span> <span class='op'>|</span><span class='id identifier rubyid_f'>f</span><span class='op'>|</span> <span class='op'>::</span><span class='const'>Lazier</span><span class='period'>.</span><span class='id identifier rubyid_find_class'>find_class</span><span class='lparen'>(</span><span class='id identifier rubyid_f'>f</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>::HTML::Pipeline::%CLASS%Filter</span><span class='tstring_end'>"</span></span><span class='comma'>,</span> <span class='kw'>true</span><span class='rparen'>)</span> <span class='rbrace'>}</span><span class='comma'>,</span>
|
729
|
+
<span class='id identifier rubyid_options'>options</span><span class='lbracket'>[</span><span class='symbol'>:pipeline_options</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_merge'>merge</span><span class='lparen'>(</span><span class='id identifier rubyid_context'>context</span><span class='rparen'>)</span>
|
730
|
+
<span class='rparen'>)</span>
|
731
|
+
<span class='kw'>end</span>
|
735
732
|
|
736
|
-
|
737
|
-
|
738
|
-
|
733
|
+
<span class='comment'># Filters pipeline filters basing on the options provided.
|
734
|
+
</span> <span class='comment'>#
|
735
|
+
</span> <span class='comment'># @param options [Hash] The original options.
|
736
|
+
</span> <span class='comment'># @return [Hash] The options with the new set of filters.
|
737
|
+
</span> <span class='kw'>def</span> <span class='id identifier rubyid_filter_filters'>filter_filters</span><span class='lparen'>(</span><span class='id identifier rubyid_options'>options</span><span class='rparen'>)</span>
|
738
|
+
<span class='id identifier rubyid_options'>options</span><span class='lbracket'>[</span><span class='symbol'>:pipeline</span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='id identifier rubyid_get_pipeline'>get_pipeline</span><span class='lparen'>(</span><span class='id identifier rubyid_options'>options</span><span class='rparen'>)</span>
|
739
739
|
|
740
|
-
|
740
|
+
<span class='id identifier rubyid_default_pipeline'>default_pipeline</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_f'>f</span><span class='op'>|</span>
|
741
|
+
<span class='id identifier rubyid_options'>options</span><span class='lbracket'>[</span><span class='symbol'>:pipeline</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_delete'>delete</span><span class='lparen'>(</span><span class='id identifier rubyid_f'>f</span><span class='period'>.</span><span class='id identifier rubyid_first'>first</span><span class='rparen'>)</span> <span class='kw'>unless</span> <span class='id identifier rubyid_options'>options</span><span class='period'>.</span><span class='id identifier rubyid_fetch'>fetch</span><span class='lparen'>(</span><span class='id identifier rubyid_f'>f</span><span class='period'>.</span><span class='id identifier rubyid_last'>last</span><span class='comma'>,</span> <span class='kw'>true</span><span class='rparen'>)</span>
|
741
742
|
<span class='kw'>end</span>
|
742
743
|
|
743
|
-
<span class='
|
744
|
-
|
745
|
-
|
746
|
-
|
747
|
-
</span>
|
748
|
-
|
749
|
-
|
744
|
+
<span class='id identifier rubyid_options'>options</span>
|
745
|
+
<span class='kw'>end</span>
|
746
|
+
|
747
|
+
<span class='comment'># Gets the pipeline for the current options.
|
748
|
+
</span> <span class='comment'>#
|
749
|
+
</span> <span class='comment'># @param options [Hash] The options to parse.
|
750
|
+
</span> <span class='comment'># @return [Array] The pipeline to process.
|
751
|
+
</span> <span class='kw'>def</span> <span class='id identifier rubyid_get_pipeline'>get_pipeline</span><span class='lparen'>(</span><span class='id identifier rubyid_options'>options</span><span class='rparen'>)</span>
|
752
|
+
<span class='id identifier rubyid_options'>options</span><span class='period'>.</span><span class='id identifier rubyid_fetch'>fetch</span><span class='lparen'>(</span><span class='symbol'>:pipeline</span><span class='comma'>,</span> <span class='id identifier rubyid_default_pipeline'>default_pipeline</span><span class='period'>.</span><span class='id identifier rubyid_map'>map</span><span class='lparen'>(</span><span class='op'>&</span><span class='symbol'>:first</span><span class='rparen'>)</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_map'>map</span><span class='lparen'>(</span><span class='op'>&</span><span class='symbol'>:to_sym</span><span class='rparen'>)</span>
|
753
|
+
<span class='kw'>end</span>
|
750
754
|
<span class='kw'>end</span></pre>
|
751
755
|
</td>
|
752
756
|
</tr>
|
@@ -838,21 +842,21 @@
|
|
838
842
|
<pre class="lines">
|
839
843
|
|
840
844
|
|
841
|
-
|
842
|
-
|
843
|
-
|
844
|
-
|
845
|
-
|
846
|
-
|
847
|
-
|
848
|
-
|
849
|
-
|
850
|
-
|
851
|
-
|
852
|
-
|
845
|
+
27
|
846
|
+
28
|
847
|
+
29
|
848
|
+
30
|
849
|
+
31
|
850
|
+
32
|
851
|
+
33
|
852
|
+
34
|
853
|
+
35
|
854
|
+
36
|
855
|
+
37
|
856
|
+
38</pre>
|
853
857
|
</td>
|
854
858
|
<td>
|
855
|
-
<pre class="code"><span class="info file"># File 'lib/mbrao/rendering_engines/html_pipeline.rb', line
|
859
|
+
<pre class="code"><span class="info file"># File 'lib/mbrao/rendering_engines/html_pipeline.rb', line 27</span>
|
856
860
|
|
857
861
|
<span class='kw'>def</span> <span class='id identifier rubyid_render'>render</span><span class='lparen'>(</span><span class='id identifier rubyid_content'>content</span><span class='comma'>,</span> <span class='id identifier rubyid_options'>options</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span><span class='comma'>,</span> <span class='id identifier rubyid_context'>context</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span><span class='rparen'>)</span>
|
858
862
|
<span class='id identifier rubyid_options'>options</span> <span class='op'>=</span> <span class='id identifier rubyid_sanitize_options'>sanitize_options</span><span class='lparen'>(</span><span class='id identifier rubyid_options'>options</span><span class='rparen'>)</span>
|
@@ -863,7 +867,7 @@
|
|
863
867
|
<span class='kw'>rescue</span> <span class='const'>Mbrao</span><span class='op'>::</span><span class='const'>Exceptions</span><span class='op'>::</span><span class='const'>UnavailableLocalization</span> <span class='op'>=></span> <span class='id identifier rubyid_le'>le</span>
|
864
868
|
<span class='id identifier rubyid_raise'>raise</span> <span class='id identifier rubyid_le'>le</span>
|
865
869
|
<span class='kw'>rescue</span> <span class='op'>=></span> <span class='id identifier rubyid_e'>e</span>
|
866
|
-
<span class='id identifier rubyid_raise'>raise</span> <span class='op'>::</span><span class='const'>Mbrao</span><span class='op'>::</span><span class='const'>Exceptions</span><span class='op'>::</span><span class='const'>Rendering</span><span class='
|
870
|
+
<span class='id identifier rubyid_raise'>raise</span> <span class='op'>::</span><span class='const'>Mbrao</span><span class='op'>::</span><span class='const'>Exceptions</span><span class='op'>::</span><span class='const'>Rendering</span><span class='comma'>,</span> <span class='id identifier rubyid_e'>e</span><span class='period'>.</span><span class='id identifier rubyid_to_s'>to_s</span>
|
867
871
|
<span class='kw'>end</span>
|
868
872
|
<span class='kw'>end</span></pre>
|
869
873
|
</td>
|
@@ -876,7 +880,7 @@
|
|
876
880
|
</div>
|
877
881
|
|
878
882
|
<div id="footer">
|
879
|
-
Generated on
|
883
|
+
Generated on Sun May 11 18:17:19 2014 by
|
880
884
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
881
885
|
0.8.7.4 (ruby-2.1.0).
|
882
886
|
</div>
|