RedCloth 4.1.9-x86-mswin32-60 → 4.2.0-x86-mswin32-60

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of RedCloth might be problematic. Click here for more details.

Files changed (68) hide show
  1. data/CHANGELOG +55 -0
  2. data/Manifest +34 -38
  3. data/README +17 -5
  4. data/Rakefile +79 -30
  5. data/RedCloth.gemspec +5 -6
  6. data/ext/redcloth_scan/redcloth.h +38 -13
  7. data/lib/redcloth.rb +9 -3
  8. data/lib/redcloth/formatters/html.rb +2 -2
  9. data/lib/redcloth/formatters/latex.rb +99 -54
  10. data/lib/redcloth/formatters/latex_entities.yml +2 -2
  11. data/lib/redcloth/version.rb +9 -4
  12. data/lib/redcloth_scan.so +0 -0
  13. data/lib/tasks/pureruby.rake +12 -0
  14. data/spec/custom_tags_spec.rb +50 -0
  15. data/spec/differs/inline.rb +48 -0
  16. data/{test/test_erb.rb → spec/erb_spec.rb} +6 -9
  17. data/spec/extension_spec.rb +26 -0
  18. data/{test → spec/fixtures}/basic.yml +90 -4
  19. data/{test → spec/fixtures}/code.yml +29 -0
  20. data/{test → spec/fixtures}/definitions.yml +0 -0
  21. data/{test → spec/fixtures}/extra_whitespace.yml +0 -0
  22. data/{test → spec/fixtures}/filter_html.yml +0 -0
  23. data/{test → spec/fixtures}/filter_pba.yml +0 -0
  24. data/{test → spec/fixtures}/html.yml +15 -0
  25. data/{test → spec/fixtures}/images.yml +16 -6
  26. data/{test → spec/fixtures}/instiki.yml +0 -0
  27. data/{test → spec/fixtures}/links.yml +7 -1
  28. data/{test → spec/fixtures}/lists.yml +162 -1
  29. data/{test → spec/fixtures}/poignant.yml +0 -0
  30. data/{test → spec/fixtures}/sanitize_html.yml +0 -0
  31. data/{test → spec/fixtures}/table.yml +121 -23
  32. data/{test → spec/fixtures}/textism.yml +44 -15
  33. data/{test → spec/fixtures}/threshold.yml +6 -14
  34. data/spec/formatters/class_filtered_html_spec.rb +7 -0
  35. data/spec/formatters/filtered_html_spec.rb +7 -0
  36. data/spec/formatters/html_no_breaks_spec.rb +9 -0
  37. data/spec/formatters/html_spec.rb +13 -0
  38. data/spec/formatters/id_filtered_html_spec.rb +7 -0
  39. data/spec/formatters/latex_spec.rb +13 -0
  40. data/spec/formatters/lite_mode_html_spec.rb +7 -0
  41. data/spec/formatters/no_span_caps_html_spec.rb +7 -0
  42. data/spec/formatters/sanitized_html_spec.rb +7 -0
  43. data/spec/formatters/style_filtered_html_spec.rb +7 -0
  44. data/spec/parser_spec.rb +95 -0
  45. data/spec/spec.opts +3 -0
  46. data/spec/spec_helper.rb +42 -0
  47. metadata +40 -49
  48. data/ext/mingw-rbconfig.rb +0 -176
  49. data/ext/redcloth_scan/redcloth_attributes.c.rl +0 -55
  50. data/ext/redcloth_scan/redcloth_attributes.java.rl +0 -95
  51. data/ext/redcloth_scan/redcloth_attributes.rl +0 -33
  52. data/ext/redcloth_scan/redcloth_common.c.rl +0 -18
  53. data/ext/redcloth_scan/redcloth_common.java.rl +0 -18
  54. data/ext/redcloth_scan/redcloth_common.rl +0 -115
  55. data/ext/redcloth_scan/redcloth_inline.c.rl +0 -193
  56. data/ext/redcloth_scan/redcloth_inline.java.rl +0 -140
  57. data/ext/redcloth_scan/redcloth_inline.rl +0 -156
  58. data/ext/redcloth_scan/redcloth_scan.c.rl +0 -228
  59. data/ext/redcloth_scan/redcloth_scan.java.rl +0 -577
  60. data/ext/redcloth_scan/redcloth_scan.rl +0 -320
  61. data/extras/ragel_profiler.rb +0 -73
  62. data/test/helper.rb +0 -108
  63. data/test/test_custom_tags.rb +0 -58
  64. data/test/test_extensions.rb +0 -31
  65. data/test/test_formatters.rb +0 -24
  66. data/test/test_parser.rb +0 -73
  67. data/test/test_restrictions.rb +0 -41
  68. data/test/validate_fixtures.rb +0 -74
File without changes
File without changes
@@ -19,11 +19,14 @@ html: |-
19
19
  </table>
20
20
  <h3>A header after the table</h3>
21
21
  latex: |+
22
- \begin{tabular}{ l l l }
23
- a & b & c \\
24
- 1 & 2 & 3 \\
25
- \end{tabular}
26
- \subsubsection*{A header after the table}
22
+ \begin{table}
23
+ \centering
24
+ \begin{tabular}{ l l l }
25
+ a & b & c \\
26
+ 1 & 2 & 3 \\
27
+ \end{tabular}
28
+ \end{table}
29
+ \subsubsection{A header after the table}
27
30
 
28
31
  ---
29
32
  in: |
@@ -64,10 +67,13 @@ html: |-
64
67
  </tr>
65
68
  </table>
66
69
  latex: |+
67
- \begin{tabular}{ l l l l l }
68
- This & is & a & simple & table \\
69
- This & is & a & simple & row \\
70
- \end{tabular}
70
+ \begin{table}
71
+ \centering
72
+ \begin{tabular}{ l l l l l }
73
+ This & is & a & simple & table \\
74
+ This & is & a & simple & row \\
75
+ \end{tabular}
76
+ \end{table}
71
77
  ---
72
78
  in: |-
73
79
  table{border:1px solid black}.
@@ -183,13 +189,16 @@ html: |-
183
189
  </tr>
184
190
  </table>
185
191
  latex: |+
186
- \begin{tabular}{ l l }
187
- Cell with gray background & Normal cell \\
188
- \multicolumn{2}{ l l }{Cell spanning 2 columns} \\
189
- \multirow{2}{*}{Cell spanning 2 rows} & one \\
190
- & two \\
191
- Right-aligned cell & Left-aligned cell \\
192
- \end{tabular}
192
+ \begin{table}
193
+ \centering
194
+ \begin{tabular}{ l l }
195
+ Cell with gray background & Normal cell \\
196
+ \multicolumn{2}{ l l }{Cell spanning 2 columns} \\
197
+ \multirow{2}{*}{Cell spanning 2 rows} & one \\
198
+ & two \\
199
+ Right-aligned cell & Left-aligned cell \\
200
+ \end{tabular}
201
+ \end{table}
193
202
  ---
194
203
  name: row spanning mid-row
195
204
  in: |-
@@ -225,13 +234,16 @@ html: |-
225
234
  </tr>
226
235
  </table>
227
236
  latex: |+
228
- \begin{tabular}{ l l l }
229
- 1 & 2 & 3 \\
230
- 1 & \multirow{3}{*}{2} & 3 \\
231
- 1 & & 3 \\
232
- 1 & & 3 \\
233
- 1 & 2 & 3 \\
234
- \end{tabular}
237
+ \begin{table}
238
+ \centering
239
+ \begin{tabular}{ l l l }
240
+ 1 & 2 & 3 \\
241
+ 1 & \multirow{3}{*}{2} & 3 \\
242
+ 1 & & 3 \\
243
+ 1 & & 3 \\
244
+ 1 & 2 & 3 \\
245
+ \end{tabular}
246
+ \end{table}
235
247
  ---
236
248
  in: |
237
249
  {background:#ddd}. |S|Target|Complete|App|Milestone|
@@ -334,3 +346,89 @@ html: |-
334
346
  <td>3</td>
335
347
  </tr>
336
348
  </table>
349
+ ---
350
+ name: with cell attributes
351
+ in: |[en]. lang-ok|{color:red;}. style-ok|(myclass). class-ok|
352
+ html: |-
353
+ <table>
354
+ <tr>
355
+ <td lang="en">lang-ok</td>
356
+ <td style="color:red;">style-ok</td>
357
+ <td class="myclass">class-ok</td>
358
+ </tr>
359
+ </table>
360
+ ---
361
+ name: with improper cell attributes
362
+ in: |[en]lang-bad|{color:red;}style-bad|(myclass)class-bad|
363
+ html: |-
364
+ <table>
365
+ <tr>
366
+ <td>[en]lang-bad</td>
367
+ <td>{color:red;}style-bad</td>
368
+ <td>(myclass)class-bad</td>
369
+ </tr>
370
+ </table>
371
+ ---
372
+ name: with line breaks in the cell
373
+ in: |-
374
+ |a|b
375
+ b|
376
+ |c
377
+ c|d|
378
+ html: |-
379
+ <table>
380
+ <tr>
381
+ <td>a</td>
382
+ <td>b<br />
383
+ b</td>
384
+ </tr>
385
+ <tr>
386
+ <td>c<br />
387
+ c</td>
388
+ <td>d</td>
389
+ </tr>
390
+ </table>
391
+ ---
392
+ name: with missing cells
393
+ desc: This is improper formatting, so as long as it doesn't choke, I don't care how it is handled
394
+ in: |-
395
+ |a|b|
396
+ |a|
397
+ |a|b|
398
+ html: |-
399
+ <table>
400
+ <tr>
401
+ <td>a</td>
402
+ <td>b</td>
403
+ </tr>
404
+ <tr>
405
+ <td>a</td>
406
+ </tr>
407
+ <tr>
408
+ <td>a</td>
409
+ <td>b</td>
410
+ </tr>
411
+ </table>
412
+ ---
413
+ name: with empty cells
414
+ desc: cells can be empty. Textile2 skips empties, but we don't want to do that.
415
+ in: |-
416
+ ||b|
417
+ |a||
418
+ |a| |
419
+ html: |-
420
+ <table>
421
+ <tr>
422
+ <td></td>
423
+ <td>b</td>
424
+ </tr>
425
+ <tr>
426
+ <td>a</td>
427
+ <td></td>
428
+ </tr>
429
+ <tr>
430
+ <td>a</td>
431
+ <td> </td>
432
+ </tr>
433
+ </table>
434
+
@@ -2,17 +2,32 @@
2
2
  name: header one
3
3
  in: h1. Header 1
4
4
  html: <h1>Header 1</h1>
5
- latex: "\section*{Header 1}\n\n"
5
+ latex: "\\section{Header 1}\n\n"
6
6
  ---
7
7
  name: header two
8
8
  in: h2. Header 2
9
9
  html: <h2>Header 2</h2>
10
- latex: "\subsection*{Header 2}\n\n"
10
+ latex: "\\subsection{Header 2}\n\n"
11
11
  ---
12
12
  name: header three
13
13
  in: h3. Header 3
14
14
  html: <h3>Header 3</h3>
15
- latex: "\subsubsection*{Header 3}\n\n"
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"
16
31
  ---
17
32
  name: blockquote
18
33
  in: |-
@@ -54,10 +69,10 @@ html: |-
54
69
  </ol>
55
70
  latex: |+
56
71
  \begin{enumerate}
57
- \item A first item
58
- \item A second item
59
- \item A third item
60
- \item A fourth item
72
+ \item A first item
73
+ \item A second item
74
+ \item A third item
75
+ \item A fourth item
61
76
  \end{enumerate}
62
77
 
63
78
  ---
@@ -76,10 +91,10 @@ html: |-
76
91
  </ul>
77
92
  latex: |+
78
93
  \begin{itemize}
79
- \item A first item
80
- \item A second item
81
- \item A third item
82
- \item A fourth item
94
+ \item A first item
95
+ \item A second item
96
+ \item A third item
97
+ \item A fourth item
83
98
  \end{itemize}
84
99
 
85
100
  ---
@@ -129,10 +144,11 @@ latex: "\\underline{a phrase}\n\n"
129
144
  ---
130
145
  in: ^a phrase^
131
146
  html: <p><sup>a phrase</sup></p>
132
- latex: "\\ensuremath{^\\textrm{a phrase}}\n\n"
147
+ latex: "\\textsuperscript{a phrase}\n\n"
133
148
  ---
134
149
  in: ~a phrase~
135
150
  html: <p><sub>a phrase</sub></p>
151
+ latex: "\\textsubscript{a phrase}\n\n"
136
152
  ---
137
153
  in: %(myclass)SPAN%
138
154
  html: <p><span class="myclass"><span class="caps">SPAN</span></span></p>
@@ -147,6 +163,10 @@ html: <p><span lang="fr">rouge</span></p>
147
163
  in: _(big)red_
148
164
  html: <p><em class="big">red</em></p>
149
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
+ ---
150
170
  in: p(bob). A paragraph
151
171
  html: <p class="bob">A paragraph</p>
152
172
  ---
@@ -161,6 +181,7 @@ html: <h2 style="padding-left:1em;padding-right:1em;text-align:right;">right-ali
161
181
  ---
162
182
  in: h3=. centered header
163
183
  html: <h3 style="text-align:center;">centered header</h3>
184
+ latex: "\\begin{center}\\subsubsection{centered header}\\end{center}\n\n"
164
185
  ---
165
186
  in: '!>/image.gif! right-aligned image'
166
187
  html: <p style="float:right;"><img src="/image.gif" alt="" /> right-aligned image</p>
@@ -188,6 +209,14 @@ html: |-
188
209
  <td>row</td>
189
210
  </tr>
190
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}
191
220
  ---
192
221
  in: |-
193
222
  table{border:1px solid black}.
@@ -253,7 +282,7 @@ in: |-
253
282
 
254
283
  Simple list:
255
284
 
256
- #{color:blue} one
285
+ # one
257
286
  # two
258
287
  # three
259
288
 
@@ -276,7 +305,7 @@ html: |-
276
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>
277
306
  </blockquote>
278
307
  <p>Simple list:</p>
279
- <ol style="color:blue;">
308
+ <ol>
280
309
  <li>one</li>
281
310
  <li>two</li>
282
311
  <li>three</li>
@@ -477,4 +506,4 @@ html: |-
477
506
  ---
478
507
  name: copyright symbol at line start
479
508
  in: "(C) copyright conversion (C) test."
480
- html: "<p>&#169; copyright conversion &#169; test.</p>"
509
+ html: "<p>&#169; copyright conversion &#169; test.</p>"
@@ -94,12 +94,14 @@ desc: Acronyms consist of three or more uppercase characters, followed immediate
94
94
  in: ABC(Always Be Closing)
95
95
  html: <p><acronym title="Always Be Closing"><span class="caps">ABC</span></acronym></p>
96
96
  no_span_caps_html: <p><acronym title="Always Be Closing">ABC</acronym></p>
97
+ latex: "Always Be Closing (ABC)\n\n"
97
98
  ---
98
99
  name: uppercase
99
100
  desc: Uppercase words of three or more characters are enclosed with a special span element.
100
101
  in: IBM or HAL
101
102
  html: <p><span class="caps">IBM</span> or <span class="caps">HAL</span></p>
102
103
  no_span_caps_html: <p>IBM or HAL</p>
104
+ latex: "IBM or HAL\n\n"
103
105
  ---
104
106
  name: emphasis
105
107
  desc: Emphasis is added with _ underscores.
@@ -279,6 +281,9 @@ in: |-
279
281
  html: |-
280
282
  <pre>Pre-formatted
281
283
  text</pre>
284
+ latex: |-
285
+ \begin{verbatim}Pre-formatted
286
+ text\end{verbatim}
282
287
  ---
283
288
  name: notextile
284
289
  desc: The notextile. block modifier applies no Textile processing at all to a block. Raw XHTML characters are passed through untouched, so this may be used to insert explicit XHTML markup, or execute Javascript or PHP code.
@@ -560,19 +565,6 @@ html: |-
560
565
  <li>Item C</li>
561
566
  </ul>
562
567
  ---
563
- name: list attributes
564
- desc: Attributes applied to the first list item will apply to the list itself.
565
- in: |-
566
- *{color:red} Item one
567
- * Item two
568
- * Item three
569
- html: |-
570
- <ul style="color:red;">
571
- <li>Item one</li>
572
- <li>Item two</li>
573
- <li>Item three</li>
574
- </ul>
575
- ---
576
568
  name: nested lists
577
569
  desc: Use multiple # or * symbols to create nested lists.
578
570
  in: |-
@@ -767,4 +759,4 @@ html: |-
767
759
  # html: |-
768
760
  # <p>A close<img src="/img.gif" alt="" />image.<br />
769
761
  # A tight<a href="http://thresholdstate.com/">text</a>link.<br />
770
- # A <a href="http://thresholdstate.com/">footnoted link</a><sup class="footnote"><a href="#fn1216642796463b1223ae29d">1</a></sup>.</p>
762
+ # A <a href="http://thresholdstate.com/">footnoted link</a><sup class="footnote"><a href="#fn1216642796463b1223ae29d">1</a></sup>.</p>
@@ -0,0 +1,7 @@
1
+ require File.dirname(__FILE__) + '/../spec_helper'
2
+
3
+ describe "class_filtered_html" do
4
+ examples_from_yaml do |doc|
5
+ RedCloth.new(doc['in'], [:filter_classes]).to_html
6
+ end
7
+ end
@@ -0,0 +1,7 @@
1
+ require File.dirname(__FILE__) + '/../spec_helper'
2
+
3
+ describe "filtered_html" do
4
+ examples_from_yaml do |doc|
5
+ RedCloth.new(doc['in'], [:filter_html]).to_html
6
+ end
7
+ end
@@ -0,0 +1,9 @@
1
+ require File.dirname(__FILE__) + '/../spec_helper'
2
+
3
+ describe "html_no_breaks" do
4
+ examples_from_yaml do |doc|
5
+ red = RedCloth.new(doc['in'])
6
+ red.hard_breaks = false
7
+ red.to_html
8
+ end
9
+ end
@@ -0,0 +1,13 @@
1
+ require File.dirname(__FILE__) + '/../spec_helper'
2
+
3
+ describe "HTML" do
4
+ examples_from_yaml do |doc|
5
+ RedCloth.new(doc['in']).to_html
6
+ end
7
+
8
+ it "should not raise an error when orphaned parentheses in a link are followed by punctuation and words in HTML" do
9
+ lambda {
10
+ RedCloth.new(%Q{Test "(read this":http://test.host), ok}).to_html
11
+ }.should_not raise_error
12
+ end
13
+ end
@@ -0,0 +1,7 @@
1
+ require File.dirname(__FILE__) + '/../spec_helper'
2
+
3
+ describe "id_filtered_html" do
4
+ examples_from_yaml do |doc|
5
+ RedCloth.new(doc['in'], [:filter_ids]).to_html
6
+ end
7
+ end
@@ -0,0 +1,13 @@
1
+ require File.dirname(__FILE__) + '/../spec_helper'
2
+
3
+ describe "LaTeX" do
4
+ examples_from_yaml do |doc|
5
+ RedCloth.new(doc['in']).to_latex
6
+ end
7
+
8
+ it "should not raise an error when orphaned parentheses in a link are followed by punctuation and words in LaTeX" do
9
+ lambda {
10
+ RedCloth.new(%Q{Test "(read this":http://test.host), ok}).to_latex
11
+ }.should_not raise_error
12
+ end
13
+ end
@@ -0,0 +1,7 @@
1
+ require File.dirname(__FILE__) + '/../spec_helper'
2
+
3
+ describe "lite_mode_html" do
4
+ examples_from_yaml do |doc|
5
+ RedCloth.new(doc['in'], [:lite_mode]).to_html
6
+ end
7
+ end
@@ -0,0 +1,7 @@
1
+ require File.dirname(__FILE__) + '/../spec_helper'
2
+
3
+ describe "no_span_caps_html" do
4
+ examples_from_yaml do |doc|
5
+ RedCloth.new(doc['in'], [:no_span_caps]).to_html
6
+ end
7
+ end