parity-RedCloth 4.2.9

Sign up to get free protection for your applications and to get access to all the features.
Files changed (65) hide show
  1. checksums.yaml +7 -0
  2. data/.gemtest +0 -0
  3. data/.rspec +1 -0
  4. data/CHANGELOG +265 -0
  5. data/COPYING +18 -0
  6. data/Gemfile +7 -0
  7. data/README.rdoc +215 -0
  8. data/Rakefile +18 -0
  9. data/bin/redcloth +28 -0
  10. data/doc/textile_reference.html +631 -0
  11. data/ext/redcloth_scan/extconf.rb +6 -0
  12. data/ext/redcloth_scan/redcloth.h +220 -0
  13. data/ext/redcloth_scan/redcloth_attributes.c +650 -0
  14. data/ext/redcloth_scan/redcloth_inline.c +8153 -0
  15. data/ext/redcloth_scan/redcloth_scan.c +24407 -0
  16. data/lib/case_sensitive_require/RedCloth.rb +6 -0
  17. data/lib/redcloth/erb_extension.rb +27 -0
  18. data/lib/redcloth/formatters/base.rb +63 -0
  19. data/lib/redcloth/formatters/html.rb +352 -0
  20. data/lib/redcloth/formatters/latex.rb +331 -0
  21. data/lib/redcloth/formatters/latex_entities.yml +2414 -0
  22. data/lib/redcloth/textile_doc.rb +113 -0
  23. data/lib/redcloth/version.rb +34 -0
  24. data/lib/redcloth.rb +45 -0
  25. data/lib/tasks/pureruby.rake +17 -0
  26. data/redcloth.gemspec +54 -0
  27. data/spec/benchmark_spec.rb +15 -0
  28. data/spec/custom_tags_spec.rb +50 -0
  29. data/spec/erb_spec.rb +10 -0
  30. data/spec/extension_spec.rb +26 -0
  31. data/spec/fixtures/basic.yml +1028 -0
  32. data/spec/fixtures/code.yml +257 -0
  33. data/spec/fixtures/definitions.yml +82 -0
  34. data/spec/fixtures/extra_whitespace.yml +64 -0
  35. data/spec/fixtures/filter_html.yml +177 -0
  36. data/spec/fixtures/filter_pba.yml +20 -0
  37. data/spec/fixtures/html.yml +348 -0
  38. data/spec/fixtures/images.yml +279 -0
  39. data/spec/fixtures/instiki.yml +38 -0
  40. data/spec/fixtures/links.yml +291 -0
  41. data/spec/fixtures/lists.yml +462 -0
  42. data/spec/fixtures/poignant.yml +89 -0
  43. data/spec/fixtures/sanitize_html.yml +42 -0
  44. data/spec/fixtures/table.yml +434 -0
  45. data/spec/fixtures/textism.yml +509 -0
  46. data/spec/fixtures/threshold.yml +762 -0
  47. data/spec/formatters/class_filtered_html_spec.rb +7 -0
  48. data/spec/formatters/filtered_html_spec.rb +7 -0
  49. data/spec/formatters/html_no_breaks_spec.rb +9 -0
  50. data/spec/formatters/html_spec.rb +13 -0
  51. data/spec/formatters/id_filtered_html_spec.rb +7 -0
  52. data/spec/formatters/latex_spec.rb +13 -0
  53. data/spec/formatters/lite_mode_html_spec.rb +7 -0
  54. data/spec/formatters/no_span_caps_html_spec.rb +7 -0
  55. data/spec/formatters/sanitized_html_spec.rb +7 -0
  56. data/spec/formatters/style_filtered_html_spec.rb +7 -0
  57. data/spec/parser_spec.rb +102 -0
  58. data/spec/spec_helper.rb +36 -0
  59. data/tasks/compile.rake +47 -0
  60. data/tasks/gems.rake +37 -0
  61. data/tasks/ragel_extension_task.rb +127 -0
  62. data/tasks/release.rake +15 -0
  63. data/tasks/rspec.rake +13 -0
  64. data/tasks/rvm.rake +79 -0
  65. metadata +239 -0
@@ -0,0 +1,509 @@
1
+ ---
2
+ name: header one
3
+ in: h1. Header 1
4
+ html: <h1>Header 1</h1>
5
+ latex: "\\section{Header 1}\n\n"
6
+ ---
7
+ name: header two
8
+ in: h2. Header 2
9
+ html: <h2>Header 2</h2>
10
+ latex: "\\subsection{Header 2}\n\n"
11
+ ---
12
+ name: header three
13
+ in: h3. Header 3
14
+ html: <h3>Header 3</h3>
15
+ latex: "\\subsubsection{Header 3}\n\n"
16
+ ---
17
+ name: header four
18
+ in: h4. Header 4
19
+ html: <h4>Header 4</h4>
20
+ latex: "\\paragraph{Header 4}\n\n"
21
+ ---
22
+ name: header five
23
+ in: h5. Header 5
24
+ html: <h5>Header 5</h5>
25
+ latex: "\\subparagraph{Header 5}\n\n"
26
+ ---
27
+ name: header six
28
+ in: h6. Header 6
29
+ html: <h6>Header 6</h6>
30
+ latex: "\\textbf{Header 6}\n\n"
31
+ ---
32
+ name: blockquote
33
+ in: |-
34
+ Any old text.
35
+
36
+ bq. A block quotation.
37
+
38
+ Any old text.
39
+
40
+ html: |-
41
+ <p>Any old text.</p>
42
+ <blockquote>
43
+ <p>A block quotation.</p>
44
+ </blockquote>
45
+ <p>Any old text.</p>
46
+
47
+ latex: |+
48
+ Any old text.
49
+
50
+ \begin{quotation}
51
+ A block quotation.
52
+
53
+ \end{quotation}
54
+
55
+ Any old text.
56
+
57
+ ---
58
+ in: |-
59
+ # A first item
60
+ # A second item
61
+ # A third item
62
+ # A fourth item
63
+ html: |-
64
+ <ol>
65
+ <li>A first item</li>
66
+ <li>A second item</li>
67
+ <li>A third item</li>
68
+ <li>A fourth item</li>
69
+ </ol>
70
+ latex: |+
71
+ \begin{enumerate}
72
+ \item A first item
73
+ \item A second item
74
+ \item A third item
75
+ \item A fourth item
76
+ \end{enumerate}
77
+
78
+ ---
79
+ in: |-
80
+ * A first item
81
+ * A second item
82
+ * A third item
83
+ * A fourth item
84
+
85
+ html: |-
86
+ <ul>
87
+ <li>A first item</li>
88
+ <li>A second item</li>
89
+ <li>A third item</li>
90
+ <li>A fourth item</li>
91
+ </ul>
92
+ latex: |+
93
+ \begin{itemize}
94
+ \item A first item
95
+ \item A second item
96
+ \item A third item
97
+ \item A fourth item
98
+ \end{itemize}
99
+
100
+ ---
101
+ in: _a phrase_
102
+ html: <p><em>a phrase</em></p>
103
+ latex: "\\emph{a phrase}\n\n"
104
+ ---
105
+ in: __a phrase__
106
+ html: <p><i>a phrase</i></p>
107
+ latex: "\\textit{a phrase}\n\n"
108
+ ---
109
+ in: '*a phrase*'
110
+ html: <p><strong>a phrase</strong></p>
111
+ latex: "\\textbf{a phrase}\n\n"
112
+ ---
113
+ in: '**a phrase**'
114
+ html: <p><b>a phrase</b></p>
115
+ latex: "\\textbf{a phrase}\n\n"
116
+ ---
117
+ in: Nabokov's ??Pnin??
118
+ html: <p>Nabokov&#8217;s <cite>Pnin</cite></p>
119
+ latex: "Nabokov's \\begin{quote}Pnin\\end{quote}\n\n"
120
+ ---
121
+ name: del part of word
122
+ in: 'A very [-extra-]ordinary day.'
123
+ html: "<p>A very <del>extra</del>ordinary day.</p>"
124
+ latex: "A very \\sout{extra}ordinary day.\n\n"
125
+ ---
126
+ name: del part of word that contains a hyphen
127
+ in: 'An [-extra-extra-]ordinary day.'
128
+ html: <p>An <del>extra-extra</del>ordinary day.</p>
129
+ latex: "An \\sout{extra-extra}ordinary day.\n\n"
130
+ ---
131
+ name: del a phrase
132
+ in: 'Delete -a phrase- this way.'
133
+ html: <p>Delete <del>a phrase</del> this way.</p>
134
+ latex: "Delete \\sout{a phrase} this way.\n\n"
135
+ ---
136
+ name: del a phrase that contains hyphens
137
+ in: 'Delete -a no-nonsense phrase- this way.'
138
+ html: <p>Delete <del>a no-nonsense phrase</del> this way.</p>
139
+ latex: "Delete \\sout{a no-nonsense phrase} this way.\n\n"
140
+ ---
141
+ in: +a phrase+
142
+ html: <p><ins>a phrase</ins></p>
143
+ latex: "\\underline{a phrase}\n\n"
144
+ ---
145
+ in: ^a phrase^
146
+ html: <p><sup>a phrase</sup></p>
147
+ latex: "\\textsuperscript{a phrase}\n\n"
148
+ ---
149
+ in: ~a phrase~
150
+ html: <p><sub>a phrase</sub></p>
151
+ latex: "\\textsubscript{a phrase}\n\n"
152
+ ---
153
+ in: "%(myclass)SPAN%"
154
+ html: <p><span class="myclass"><span class="caps">SPAN</span></span></p>
155
+ no_span_caps_html: <p><span class="myclass">SPAN</span></p>
156
+ ---
157
+ in: "%{color:red}red%"
158
+ html: <p><span style="color:red;">red</span></p>
159
+ ---
160
+ in: "%[fr]rouge%"
161
+ html: <p><span lang="fr">rouge</span></p>
162
+ ---
163
+ in: _(big)red_
164
+ html: <p><em class="big">red</em></p>
165
+ ---
166
+ in: p=. A centered paragraph.
167
+ html: <p style="text-align:center;">A centered paragraph.</p>
168
+ latex: "\\begin{center}A centered paragraph.\\end{center}\n\n"
169
+ ---
170
+ in: p(bob). A paragraph
171
+ html: <p class="bob">A paragraph</p>
172
+ ---
173
+ in: p{color:#ddd}. A paragraph
174
+ html: <p style="color:#ddd;">A paragraph</p>
175
+ ---
176
+ in: p[fr]. A paragraph
177
+ html: <p lang="fr">A paragraph</p>
178
+ ---
179
+ in: h2()>. right-aligned header2, indented 1em both side
180
+ html: <h2 style="padding-left:1em;padding-right:1em;text-align:right;">right-aligned header2, indented 1em both side</h2>
181
+ ---
182
+ in: h3=. centered header
183
+ html: <h3 style="text-align:center;">centered header</h3>
184
+ latex: "\\begin{center}\\subsubsection{centered header}\\end{center}\n\n"
185
+ ---
186
+ in: '!>/image.gif! right-aligned image'
187
+ html: <p style="float:right;"><img src="/image.gif" alt="" /> right-aligned image</p>
188
+ ---
189
+ in: p[no]{color:red}. A Norse of a different colour.
190
+ html: <p style="color:red;" lang="no">A Norse of a different colour.</p>
191
+ ---
192
+ in: |-
193
+ |This|is|a|simple|table|
194
+ |This|is|a|simple|row|
195
+ html: |-
196
+ <table>
197
+ <tr>
198
+ <td>This</td>
199
+ <td>is</td>
200
+ <td>a</td>
201
+ <td>simple</td>
202
+ <td>table</td>
203
+ </tr>
204
+ <tr>
205
+ <td>This</td>
206
+ <td>is</td>
207
+ <td>a</td>
208
+ <td>simple</td>
209
+ <td>row</td>
210
+ </tr>
211
+ </table>
212
+ latex: |
213
+ \begin{table}
214
+ \centering
215
+ \begin{tabular}{ l l l l l }
216
+ This & is & a & simple & table \\
217
+ This & is & a & simple & row \\
218
+ \end{tabular}
219
+ \end{table}
220
+ ---
221
+ in: |-
222
+ table{border:1px solid black}.
223
+ |This|is|a|row|
224
+ |This|is|a|row|
225
+ html: |-
226
+ <table style="border:1px solid black;">
227
+ <tr>
228
+ <td>This</td>
229
+ <td>is</td>
230
+ <td>a</td>
231
+ <td>row</td>
232
+ </tr>
233
+ <tr>
234
+ <td>This</td>
235
+ <td>is</td>
236
+ <td>a</td>
237
+ <td>row</td>
238
+ </tr>
239
+ </table>
240
+ ---
241
+ in: '{background:#ddd}. |This|is|a|row|'
242
+ html: |-
243
+ <table>
244
+ <tr style="background:#ddd;">
245
+ <td>This</td>
246
+ <td>is</td>
247
+ <td>a</td>
248
+ <td>row</td>
249
+ </tr>
250
+ </table>
251
+ ---
252
+ in: |-
253
+ |{background:#ddd}. Cell with gray background|
254
+ |\2. Cell spanning 2 columns|
255
+ |/3. Cell spanning 3 rows|
256
+ |>. Right-aligned cell|
257
+ html: |-
258
+ <table>
259
+ <tr>
260
+ <td style="background:#ddd;">Cell with gray background</td>
261
+ </tr>
262
+ <tr>
263
+ <td colspan="2">Cell spanning 2 columns</td>
264
+ </tr>
265
+ <tr>
266
+ <td rowspan="3">Cell spanning 3 rows</td>
267
+ </tr>
268
+ <tr>
269
+ <td style="text-align:right;">Right-aligned cell</td>
270
+ </tr>
271
+ </table>
272
+ ---
273
+ name: basics
274
+ in: |-
275
+ h2{color:green}. This is a title
276
+
277
+ h3. This is a subhead
278
+
279
+ p{color:red}. This is some text of dubious character. Isn't the use of "quotes" just lazy writing -- and theft of 'intellectual property' besides? I think the time has come to see a block quote.
280
+
281
+ bq[fr]. This is a block quote. I'll admit it's not the most exciting block quote ever devised.
282
+
283
+ Simple list:
284
+
285
+ # one
286
+ # two
287
+ # three
288
+
289
+ Multi-level list:
290
+
291
+ # one
292
+ ## aye
293
+ ## bee
294
+ ## see
295
+ # two
296
+ ## x
297
+ ## y
298
+ # three
299
+
300
+ html: |-
301
+ <h2 style="color:green;">This is a title</h2>
302
+ <h3>This is a subhead</h3>
303
+ <p style="color:red;">This is some text of dubious character. Isn&#8217;t the use of &#8220;quotes&#8221; just lazy writing &#8212; and theft of &#8216;intellectual property&#8217; besides? I think the time has come to see a block quote.</p>
304
+ <blockquote lang="fr">
305
+ <p lang="fr">This is a block quote. I&#8217;ll admit it&#8217;s not the most exciting block quote ever devised.</p>
306
+ </blockquote>
307
+ <p>Simple list:</p>
308
+ <ol>
309
+ <li>one</li>
310
+ <li>two</li>
311
+ <li>three</li>
312
+ </ol>
313
+ <p>Multi-level list:</p>
314
+ <ol>
315
+ <li>one
316
+ <ol>
317
+ <li>aye</li>
318
+ <li>bee</li>
319
+ <li>see</li>
320
+ </ol></li>
321
+ <li>two
322
+ <ol>
323
+ <li>x</li>
324
+ <li>y</li>
325
+ </ol></li>
326
+ <li>three</li>
327
+ </ol>
328
+ ---
329
+ name: tougher stuff
330
+ in: |-
331
+
332
+ Multi-level list:
333
+
334
+ # one
335
+ ## aye
336
+ ## bee
337
+ ## see
338
+ # two
339
+ ## x
340
+ ## y
341
+ # three
342
+
343
+ Mixed list:
344
+
345
+ * Point one
346
+ * Point two
347
+ ## Step 1
348
+ ## Step 2
349
+ ## Step 3
350
+ * Point three
351
+ ** Sub point 1
352
+ ** Sub point 2
353
+
354
+
355
+ Well, that went well. How about we insert an <a href="/" title="watch out">old-fashioned hypertext link</a>? Will the quote marks in the tags get messed up? No!
356
+
357
+ "This is a link (optional title)":http://www.textism.com
358
+
359
+ html: |-
360
+ <p>Multi-level list:</p>
361
+ <ol>
362
+ <li>one
363
+ <ol>
364
+ <li>aye</li>
365
+ <li>bee</li>
366
+ <li>see</li>
367
+ </ol></li>
368
+ <li>two
369
+ <ol>
370
+ <li>x</li>
371
+ <li>y</li>
372
+ </ol></li>
373
+ <li>three</li>
374
+ </ol>
375
+ <p>Mixed list:</p>
376
+ <ul>
377
+ <li>Point one</li>
378
+ <li>Point two
379
+ <ol>
380
+ <li>Step 1</li>
381
+ <li>Step 2</li>
382
+ <li>Step 3</li>
383
+ </ol></li>
384
+ <li>Point three
385
+ <ul>
386
+ <li>Sub point 1</li>
387
+ <li>Sub point 2</li>
388
+ </ul></li>
389
+ </ul>
390
+ <p>Well, that went well. How about we insert an <a href="/" title="watch out">old-fashioned hypertext link</a>? Will the quote marks in the tags get messed up? No!</p>
391
+ <p><a href="http://www.textism.com" title="optional title">This is a link</a></p>
392
+ ---
393
+ name: table
394
+ in: |-
395
+ table{border:1px solid black}.
396
+ |_. this|_. is|_. a|_. header|
397
+ <{background:gray}. |\2. this is|{background:red;width:200px}. a|^<>{height:200px}. row|
398
+ |this|<>{padding:10px}. is|^. another|(bob#bob). row|
399
+ html: |-
400
+ <table style="border:1px solid black;">
401
+ <tr>
402
+ <th>this</th>
403
+ <th>is</th>
404
+ <th>a</th>
405
+ <th>header</th>
406
+ </tr>
407
+ <tr style="text-align:left;background:gray;">
408
+ <td colspan="2">this is</td>
409
+ <td style="background:red;width:200px;">a</td>
410
+ <td style="vertical-align:top;text-align:justify;height:200px;">row</td>
411
+ </tr>
412
+ <tr>
413
+ <td>this</td>
414
+ <td style="text-align:justify;padding:10px;">is</td>
415
+ <td style="vertical-align:top;">another</td>
416
+ <td class="bob" id="bob">row</td>
417
+ </tr>
418
+ </table>
419
+ ---
420
+ in: |-
421
+ An image:
422
+
423
+ !/common/textist.gif(optional alt text)!
424
+
425
+ # Librarians rule
426
+ # Yes they do
427
+ # But you knew that
428
+
429
+ Some more text of dubious character. Here is a noisome string of CAPITAL letters. Here is something we want to _emphasize_.
430
+ That was a linebreak. And something to indicate *strength*. Of course I could use <em>my own HTML tags</em> if I <strong>felt</strong> like it.
431
+ html: |-
432
+ <p>An image:</p>
433
+ <p><img src="/common/textist.gif" title="optional alt text" alt="optional alt text" /></p>
434
+ <ol>
435
+ <li>Librarians rule</li>
436
+ <li>Yes they do</li>
437
+ <li>But you knew that</li>
438
+ </ol>
439
+ <p>Some more text of dubious character. Here is a noisome string of <span class="caps">CAPITAL</span> letters. Here is something we want to <em>emphasize</em>.<br />
440
+ That was a linebreak. And something to indicate <strong>strength</strong>. Of course I could use <em>my own <span class="caps">HTML</span> tags</em> if I <strong>felt</strong> like it.</p>
441
+ ---
442
+ name: code
443
+ in: |-
444
+ h3. Coding
445
+
446
+ This <code>is some code, "isn't it"</code>. Watch those quote marks! Now for some preformatted text:
447
+
448
+ <pre>
449
+ <code>
450
+ $text = str_replace("<p>%::%</p>","",$text);
451
+ $text = str_replace("%::%</p>","",$text);
452
+ $text = str_replace("%::%","",$text);
453
+
454
+ </code>
455
+ </pre>
456
+
457
+ This isn't code.
458
+
459
+
460
+ html: |-
461
+ <h3>Coding</h3>
462
+ <p>This <code>is some code, "isn't it"</code>. Watch those quote marks! Now for some preformatted text:</p>
463
+ <pre>
464
+ <code>
465
+ $text = str_replace("&lt;p&gt;%::%&lt;/p&gt;","",$text);
466
+ $text = str_replace("%::%&lt;/p&gt;","",$text);
467
+ $text = str_replace("%::%","",$text);
468
+
469
+ </code>
470
+ </pre>
471
+ <p>This isn&#8217;t code.</p>
472
+ ---
473
+ name: hard break
474
+ in: |-
475
+ trivial
476
+ break
477
+
478
+ next
479
+ html: |-
480
+ <p>trivial<br />
481
+ break</p>
482
+ <p>next</p>
483
+ ---
484
+ name: normal paragraphs
485
+ in: |-
486
+ trivial
487
+
488
+ paragraphs
489
+ html: |-
490
+ <p>trivial</p>
491
+ <p>paragraphs</p>
492
+ ---
493
+ name: hard break in a list
494
+ in: |-
495
+ * first line
496
+ * second
497
+ line
498
+ * third line
499
+ html: |-
500
+ <ul>
501
+ <li>first line</li>
502
+ <li>second<br />
503
+ line</li>
504
+ <li>third line</li>
505
+ </ul>
506
+ ---
507
+ name: copyright symbol at line start
508
+ in: "(C) copyright conversion (C) test."
509
+ html: "<p>&#169; copyright conversion &#169; test.</p>"