mbrao 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (73) hide show
  1. data/.gitignore +6 -0
  2. data/.travis-gemfile +13 -0
  3. data/.travis.yml +8 -0
  4. data/.yardopts +1 -0
  5. data/Gemfile +21 -0
  6. data/README.md +60 -0
  7. data/Rakefile +11 -0
  8. data/doc/ActionView/Template/Handlers/MbraoTemplate.html +568 -0
  9. data/doc/ActionView/Template/Handlers.html +125 -0
  10. data/doc/HTML/Pipeline/KramdownFilter.html +354 -0
  11. data/doc/HTML/Pipeline.html +140 -0
  12. data/doc/HTML.html +125 -0
  13. data/doc/Mbrao/Author.html +1402 -0
  14. data/doc/Mbrao/Content.html +4779 -0
  15. data/doc/Mbrao/ContentPublicInterface.html +658 -0
  16. data/doc/Mbrao/Exceptions/InvalidDate.html +133 -0
  17. data/doc/Mbrao/Exceptions/InvalidMetadata.html +133 -0
  18. data/doc/Mbrao/Exceptions/Parsing.html +133 -0
  19. data/doc/Mbrao/Exceptions/Rendering.html +133 -0
  20. data/doc/Mbrao/Exceptions/UnavailableLocalization.html +133 -0
  21. data/doc/Mbrao/Exceptions/Unimplemented.html +133 -0
  22. data/doc/Mbrao/Exceptions/UnknownEngine.html +133 -0
  23. data/doc/Mbrao/Exceptions.html +125 -0
  24. data/doc/Mbrao/Parser.html +418 -0
  25. data/doc/Mbrao/ParsingEngines/Base.html +658 -0
  26. data/doc/Mbrao/ParsingEngines/PlainText.html +571 -0
  27. data/doc/Mbrao/ParsingEngines.html +127 -0
  28. data/doc/Mbrao/PublicInterface/ClassMethods.html +1727 -0
  29. data/doc/Mbrao/PublicInterface.html +134 -0
  30. data/doc/Mbrao/RenderingEngines/Base.html +280 -0
  31. data/doc/Mbrao/RenderingEngines/HtmlPipeline.html +873 -0
  32. data/doc/Mbrao/RenderingEngines.html +127 -0
  33. data/doc/Mbrao/Validations/ClassMethods.html +692 -0
  34. data/doc/Mbrao/Validations.html +134 -0
  35. data/doc/Mbrao/Version.html +189 -0
  36. data/doc/Mbrao.html +130 -0
  37. data/doc/_index.html +395 -0
  38. data/doc/class_list.html +53 -0
  39. data/doc/css/common.css +1 -0
  40. data/doc/css/full_list.css +57 -0
  41. data/doc/css/style.css +338 -0
  42. data/doc/file.README.html +135 -0
  43. data/doc/file_list.html +55 -0
  44. data/doc/frames.html +28 -0
  45. data/doc/index.html +135 -0
  46. data/doc/js/app.js +214 -0
  47. data/doc/js/full_list.js +173 -0
  48. data/doc/js/jquery.js +4 -0
  49. data/doc/method_list.html +516 -0
  50. data/doc/top-level-namespace.html +112 -0
  51. data/lib/mbrao/author.rb +61 -0
  52. data/lib/mbrao/content.rb +300 -0
  53. data/lib/mbrao/exceptions.rb +38 -0
  54. data/lib/mbrao/integrations/rails.rb +51 -0
  55. data/lib/mbrao/parser.rb +276 -0
  56. data/lib/mbrao/parsing_engines/base.rb +51 -0
  57. data/lib/mbrao/parsing_engines/plain_text.rb +187 -0
  58. data/lib/mbrao/rendering_engines/base.rb +22 -0
  59. data/lib/mbrao/rendering_engines/html_pipeline.rb +147 -0
  60. data/lib/mbrao/version.rb +25 -0
  61. data/lib/mbrao.rb +24 -0
  62. data/mbrao.gemspec +31 -0
  63. data/spec/coverage_helper.rb +17 -0
  64. data/spec/mbrao/author_spec.rb +62 -0
  65. data/spec/mbrao/content_spec.rb +280 -0
  66. data/spec/mbrao/integrations/rails_spec.rb +92 -0
  67. data/spec/mbrao/parser_spec.rb +269 -0
  68. data/spec/mbrao/parsing_engines/base_spec.rb +52 -0
  69. data/spec/mbrao/parsing_engines/plain_text_spec.rb +141 -0
  70. data/spec/mbrao/rendering_engines/base_spec.rb +17 -0
  71. data/spec/mbrao/rendering_engines/html_pipeline_spec.rb +128 -0
  72. data/spec/spec_helper.rb +15 -0
  73. metadata +195 -0
@@ -0,0 +1,571 @@
1
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
2
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
4
+ <head>
5
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
6
+ <title>
7
+ Class: Mbrao::ParsingEngines::PlainText
8
+
9
+ &mdash; Documentation by YARD 0.8.5.2
10
+
11
+ </title>
12
+
13
+ <link rel="stylesheet" href="../../css/style.css" type="text/css" media="screen" charset="utf-8" />
14
+
15
+ <link rel="stylesheet" href="../../css/common.css" type="text/css" media="screen" charset="utf-8" />
16
+
17
+ <script type="text/javascript" charset="utf-8">
18
+ hasFrames = window.top.frames.main ? true : false;
19
+ relpath = '../../';
20
+ framesUrl = "../../frames.html#!" + escape(window.location.href);
21
+ </script>
22
+
23
+
24
+ <script type="text/javascript" charset="utf-8" src="../../js/jquery.js"></script>
25
+
26
+ <script type="text/javascript" charset="utf-8" src="../../js/app.js"></script>
27
+
28
+
29
+ </head>
30
+ <body>
31
+ <div id="header">
32
+ <div id="menu">
33
+
34
+ <a href="../../_index.html">Index (P)</a> &raquo;
35
+ <span class='title'><span class='object_link'><a href="../../Mbrao.html" title="Mbrao (module)">Mbrao</a></span></span> &raquo; <span class='title'><span class='object_link'><a href="../ParsingEngines.html" title="Mbrao::ParsingEngines (module)">ParsingEngines</a></span></span>
36
+ &raquo;
37
+ <span class="title">PlainText</span>
38
+
39
+
40
+ <div class="noframes"><span class="title">(</span><a href="." target="_top">no frames</a><span class="title">)</span></div>
41
+ </div>
42
+
43
+ <div id="search">
44
+
45
+ <a class="full_list_link" id="class_list_link"
46
+ href="../../class_list.html">
47
+ Class List
48
+ </a>
49
+
50
+ <a class="full_list_link" id="method_list_link"
51
+ href="../../method_list.html">
52
+ Method List
53
+ </a>
54
+
55
+ <a class="full_list_link" id="file_list_link"
56
+ href="../../file_list.html">
57
+ File List
58
+ </a>
59
+
60
+ </div>
61
+ <div class="clear"></div>
62
+ </div>
63
+
64
+ <iframe id="search_frame"></iframe>
65
+
66
+ <div id="content"><h1>Class: Mbrao::ParsingEngines::PlainText
67
+
68
+
69
+
70
+ </h1>
71
+
72
+ <dl class="box">
73
+
74
+ <dt class="r1">Inherits:</dt>
75
+ <dd class="r1">
76
+ <span class="inheritName"><span class='object_link'><a href="Base.html" title="Mbrao::ParsingEngines::Base (class)">Base</a></span></span>
77
+
78
+ <ul class="fullTree">
79
+ <li>Object</li>
80
+
81
+ <li class="next"><span class='object_link'><a href="Base.html" title="Mbrao::ParsingEngines::Base (class)">Base</a></span></li>
82
+
83
+ <li class="next">Mbrao::ParsingEngines::PlainText</li>
84
+
85
+ </ul>
86
+ <a href="#" class="inheritanceTree">show all</a>
87
+
88
+ </dd>
89
+
90
+
91
+
92
+
93
+
94
+
95
+
96
+
97
+
98
+ <dt class="r2 last">Defined in:</dt>
99
+ <dd class="r2 last">lib/mbrao/parsing_engines/plain_text.rb</dd>
100
+
101
+ </dl>
102
+ <div class="clear"></div>
103
+
104
+ <h2>Overview</h2><div class="docstring">
105
+ <div class="discussion">
106
+ <p>A class for parsing plain text files.</p>
107
+
108
+
109
+ </div>
110
+ </div>
111
+ <div class="tags">
112
+
113
+
114
+ </div>
115
+
116
+
117
+
118
+
119
+
120
+
121
+
122
+ <h2>
123
+ Instance Method Summary
124
+ <small>(<a href="#" class="summary_toggle">collapse</a>)</small>
125
+ </h2>
126
+
127
+ <ul class="summary">
128
+
129
+ <li class="public ">
130
+ <span class="summary_signature">
131
+
132
+ <a href="#filter_content-instance_method" title="#filter_content (instance method)">- (String|HashWithIndifferentAccess) <strong>filter_content</strong>(content, locales = [], options = {}) </a>
133
+
134
+
135
+
136
+ </span>
137
+
138
+
139
+
140
+
141
+
142
+
143
+
144
+
145
+
146
+ <span class="summary_desc"><div class='inline'><p>Filters content of a post by locale.</p>
147
+ </div></span>
148
+
149
+ </li>
150
+
151
+
152
+ <li class="public ">
153
+ <span class="summary_signature">
154
+
155
+ <a href="#parse_metadata-instance_method" title="#parse_metadata (instance method)">- (Hash) <strong>parse_metadata</strong>(content, options = {}) </a>
156
+
157
+
158
+
159
+ </span>
160
+
161
+
162
+
163
+
164
+
165
+
166
+
167
+
168
+
169
+ <span class="summary_desc"><div class='inline'><p>Parses metadata part and returns all valid metadata.</p>
170
+ </div></span>
171
+
172
+ </li>
173
+
174
+
175
+ <li class="public ">
176
+ <span class="summary_signature">
177
+
178
+ <a href="#separate_components-instance_method" title="#separate_components (instance method)">- (Array) <strong>separate_components</strong>(content, options = {}) </a>
179
+
180
+
181
+
182
+ </span>
183
+
184
+
185
+
186
+
187
+
188
+
189
+
190
+
191
+
192
+ <span class="summary_desc"><div class='inline'><p>Parses a whole post content and return its metadata and content parts.</p>
193
+ </div></span>
194
+
195
+ </li>
196
+
197
+
198
+ </ul>
199
+
200
+
201
+
202
+
203
+
204
+
205
+
206
+
207
+
208
+
209
+
210
+ <h3 class="inherited">Methods inherited from <span class='object_link'><a href="Base.html" title="Mbrao::ParsingEngines::Base (class)">Base</a></span></h3>
211
+ <p class="inherited"><span class='object_link'><a href="Base.html#parse-instance_method" title="Mbrao::ParsingEngines::Base#parse (method)">#parse</a></span></p>
212
+
213
+
214
+ <div id="instance_method_details" class="method_details_list">
215
+ <h2>Instance Method Details</h2>
216
+
217
+
218
+ <div class="method_details first">
219
+ <h3 class="signature first" id="filter_content-instance_method">
220
+
221
+ - (<tt>String|HashWithIndifferentAccess</tt>) <strong>filter_content</strong>(content, locales = [], options = {})
222
+
223
+
224
+
225
+
226
+
227
+ </h3><div class="docstring">
228
+ <div class="discussion">
229
+ <p>Filters content of a post by locale.</p>
230
+
231
+
232
+ </div>
233
+ </div>
234
+ <div class="tags">
235
+ <p class="tag_title">Parameters:</p>
236
+ <ul class="param">
237
+
238
+ <li>
239
+
240
+ <span class='name'>content</span>
241
+
242
+
243
+ <span class='type'>(<tt><span class='object_link'><a href="../Content.html" title="Mbrao::Content (class)">Content</a></span></tt>)</span>
244
+
245
+
246
+
247
+ &mdash;
248
+ <div class='inline'><p>The content to filter.</p>
249
+ </div>
250
+
251
+ </li>
252
+
253
+ <li>
254
+
255
+ <span class='name'>locales</span>
256
+
257
+
258
+ <span class='type'>(<tt>String|Array</tt>)</span>
259
+
260
+
261
+ <em class="default">(defaults to: <tt>[]</tt>)</em>
262
+
263
+
264
+ &mdash;
265
+ <div class='inline'><p>The desired locales. Can include <code>*</code> to match all. If none are specified, the default Mbrao locale will be requested.</p>
266
+ </div>
267
+
268
+ </li>
269
+
270
+ <li>
271
+
272
+ <span class='name'>options</span>
273
+
274
+
275
+ <span class='type'>(<tt>Hash</tt>)</span>
276
+
277
+
278
+ <em class="default">(defaults to: <tt>{}</tt>)</em>
279
+
280
+
281
+ &mdash;
282
+ <div class='inline'><p>Options to customize parsing.</p>
283
+ </div>
284
+
285
+ </li>
286
+
287
+ </ul>
288
+
289
+ <p class="tag_title">Returns:</p>
290
+ <ul class="return">
291
+
292
+ <li>
293
+
294
+
295
+ <span class='type'>(<tt>String|HashWithIndifferentAccess</tt>)</span>
296
+
297
+
298
+
299
+ &mdash;
300
+ <div class='inline'><p>Return the filtered content in the desired locales. If only one locale is required, then a <code>String</code> is returned, else a <code>HashWithIndifferentAccess</code> with locales as keys.</p>
301
+ </div>
302
+
303
+ </li>
304
+
305
+ </ul>
306
+
307
+ </div><table class="source_code">
308
+ <tr>
309
+ <td>
310
+ <pre class="lines">
311
+
312
+
313
+ 51
314
+ 52
315
+ 53
316
+ 54
317
+ 55
318
+ 56
319
+ 57
320
+ 58
321
+ 59
322
+ 60
323
+ 61</pre>
324
+ </td>
325
+ <td>
326
+ <pre class="code"><span class="info file"># File 'lib/mbrao/parsing_engines/plain_text.rb', line 51</span>
327
+
328
+ <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>
329
+ <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>
330
+ <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>
331
+ <span class='id identifier rubyid_locales'>locales</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_validate_locales'>validate_locales</span><span class='lparen'>(</span><span class='id identifier rubyid_locales'>locales</span><span class='comma'>,</span> <span class='id identifier rubyid_content'>content</span><span class='rparen'>)</span>
332
+
333
+ <span class='comment'># Split the content
334
+ </span> <span class='id identifier rubyid_result'>result</span> <span class='op'>=</span> <span class='id identifier rubyid_scan_content'>scan_content</span><span class='lparen'>(</span><span class='id identifier rubyid_body'>body</span><span class='comma'>,</span> <span class='id identifier rubyid_options'>options</span><span class='lbracket'>[</span><span class='symbol'>:content_tags</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_first'>first</span><span class='comma'>,</span> <span class='id identifier rubyid_options'>options</span><span class='lbracket'>[</span><span class='symbol'>:content_tags</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_last'>last</span><span class='rparen'>)</span>
335
+
336
+ <span class='comment'># Now filter results
337
+ </span> <span class='id identifier rubyid_perform_filter_content'>perform_filter_content</span><span class='lparen'>(</span><span class='id identifier rubyid_result'>result</span><span class='comma'>,</span> <span class='id identifier rubyid_locales'>locales</span><span class='rparen'>)</span>
338
+ <span class='kw'>end</span></pre>
339
+ </td>
340
+ </tr>
341
+ </table>
342
+ </div>
343
+
344
+ <div class="method_details ">
345
+ <h3 class="signature " id="parse_metadata-instance_method">
346
+
347
+ - (<tt>Hash</tt>) <strong>parse_metadata</strong>(content, options = {})
348
+
349
+
350
+
351
+
352
+
353
+ </h3><div class="docstring">
354
+ <div class="discussion">
355
+ <p>Parses metadata part and returns all valid metadata.</p>
356
+
357
+
358
+ </div>
359
+ </div>
360
+ <div class="tags">
361
+ <p class="tag_title">Parameters:</p>
362
+ <ul class="param">
363
+
364
+ <li>
365
+
366
+ <span class='name'>content</span>
367
+
368
+
369
+ <span class='type'>(<tt>String</tt>)</span>
370
+
371
+
372
+
373
+ &mdash;
374
+ <div class='inline'><p>The content to parse.</p>
375
+ </div>
376
+
377
+ </li>
378
+
379
+ <li>
380
+
381
+ <span class='name'>options</span>
382
+
383
+
384
+ <span class='type'>(<tt>Hash</tt>)</span>
385
+
386
+
387
+ <em class="default">(defaults to: <tt>{}</tt>)</em>
388
+
389
+
390
+ &mdash;
391
+ <div class='inline'><p>Options to customize parsing.</p>
392
+ </div>
393
+
394
+ </li>
395
+
396
+ </ul>
397
+
398
+ <p class="tag_title">Returns:</p>
399
+ <ul class="return">
400
+
401
+ <li>
402
+
403
+
404
+ <span class='type'>(<tt>Hash</tt>)</span>
405
+
406
+
407
+
408
+ &mdash;
409
+ <div class='inline'><p>All valid metadata for the content.</p>
410
+ </div>
411
+
412
+ </li>
413
+
414
+ </ul>
415
+
416
+ </div><table class="source_code">
417
+ <tr>
418
+ <td>
419
+ <pre class="lines">
420
+
421
+
422
+ 37
423
+ 38
424
+ 39
425
+ 40
426
+ 41
427
+ 42
428
+ 43</pre>
429
+ </td>
430
+ <td>
431
+ <pre class="code"><span class="info file"># File 'lib/mbrao/parsing_engines/plain_text.rb', line 37</span>
432
+
433
+ <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>
434
+ <span class='kw'>begin</span>
435
+ <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>
436
+ <span class='kw'>rescue</span> <span class='const'>Exception</span> <span class='op'>=&gt;</span> <span class='id identifier rubyid_e'>e</span>
437
+ <span class='id identifier rubyid_options'>options</span><span class='lbracket'>[</span><span class='symbol'>:default</span><span class='rbracket'>]</span> <span class='op'>?</span> <span class='id identifier rubyid_options'>options</span><span class='lbracket'>[</span><span class='symbol'>:default</span><span class='rbracket'>]</span> <span class='op'>:</span> <span class='lparen'>(</span><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='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='id identifier rubyid_e'>e</span><span class='period'>.</span><span class='id identifier rubyid_to_s'>to_s</span><span class='rparen'>)</span><span class='rparen'>)</span>
438
+ <span class='kw'>end</span>
439
+ <span class='kw'>end</span></pre>
440
+ </td>
441
+ </tr>
442
+ </table>
443
+ </div>
444
+
445
+ <div class="method_details ">
446
+ <h3 class="signature " id="separate_components-instance_method">
447
+
448
+ - (<tt>Array</tt>) <strong>separate_components</strong>(content, options = {})
449
+
450
+
451
+
452
+
453
+
454
+ </h3><div class="docstring">
455
+ <div class="discussion">
456
+ <p>Parses a whole post content and return its metadata and content parts.</p>
457
+
458
+
459
+ </div>
460
+ </div>
461
+ <div class="tags">
462
+ <p class="tag_title">Parameters:</p>
463
+ <ul class="param">
464
+
465
+ <li>
466
+
467
+ <span class='name'>content</span>
468
+
469
+
470
+ <span class='type'>(<tt>String</tt>)</span>
471
+
472
+
473
+
474
+ &mdash;
475
+ <div class='inline'><p>The content to parse.</p>
476
+ </div>
477
+
478
+ </li>
479
+
480
+ <li>
481
+
482
+ <span class='name'>options</span>
483
+
484
+
485
+ <span class='type'>(<tt>Hash</tt>)</span>
486
+
487
+
488
+ <em class="default">(defaults to: <tt>{}</tt>)</em>
489
+
490
+
491
+ &mdash;
492
+ <div class='inline'><p>Options to customize parsing.</p>
493
+ </div>
494
+
495
+ </li>
496
+
497
+ </ul>
498
+
499
+ <p class="tag_title">Returns:</p>
500
+ <ul class="return">
501
+
502
+ <li>
503
+
504
+
505
+ <span class='type'>(<tt>Array</tt>)</span>
506
+
507
+
508
+
509
+ &mdash;
510
+ <div class='inline'><p>An array of metadata and contents parts.</p>
511
+ </div>
512
+
513
+ </li>
514
+
515
+ </ul>
516
+
517
+ </div><table class="source_code">
518
+ <tr>
519
+ <td>
520
+ <pre class="lines">
521
+
522
+
523
+ 17
524
+ 18
525
+ 19
526
+ 20
527
+ 21
528
+ 22
529
+ 23
530
+ 24
531
+ 25
532
+ 26
533
+ 27
534
+ 28
535
+ 29
536
+ 30</pre>
537
+ </td>
538
+ <td>
539
+ <pre class="code"><span class="info file"># File 'lib/mbrao/parsing_engines/plain_text.rb', line 17</span>
540
+
541
+ <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>
542
+ <span class='id identifier rubyid_metadata'>metadata</span> <span class='op'>=</span> <span class='kw'>nil</span>
543
+ <span class='id identifier rubyid_content'>content</span> <span class='op'>=</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='period'>.</span><span class='id identifier rubyid_strip'>strip</span>
544
+ <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>
545
+ <span class='id identifier rubyid_scanner'>scanner</span> <span class='op'>=</span> <span class='const'>StringScanner</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='id identifier rubyid_content'>content</span><span class='rparen'>)</span>
546
+ <span class='id identifier rubyid_end_tag'>end_tag</span> <span class='op'>=</span> <span class='id identifier rubyid_options'>options</span><span class='lbracket'>[</span><span class='symbol'>:meta_tags</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_last'>last</span>
547
+
548
+ <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_options'>options</span><span class='lbracket'>[</span><span class='symbol'>:meta_tags</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_first'>first</span><span class='rparen'>)</span> <span class='op'>&amp;&amp;</span> <span class='lparen'>(</span><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><span class='rparen'>)</span> <span class='kw'>then</span>
549
+ <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
+ <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
+ <span class='kw'>end</span>
552
+
553
+ <span class='lbracket'>[</span><span class='id identifier rubyid_metadata'>metadata</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><span class='comma'>,</span> <span class='id identifier rubyid_content'>content</span><span class='rbracket'>]</span>
554
+ <span class='kw'>end</span></pre>
555
+ </td>
556
+ </tr>
557
+ </table>
558
+ </div>
559
+
560
+ </div>
561
+
562
+ </div>
563
+
564
+ <div id="footer">
565
+ Generated on Fri Mar 1 09:13:32 2013 by
566
+ <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
567
+ 0.8.5.2 (ruby-1.9.3).
568
+ </div>
569
+
570
+ </body>
571
+ </html>