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