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,348 @@
1
+ ---
2
+ in: '*this <span></span> is strong*'
3
+ html: '<p><strong>this <span></span> is strong</strong></p>'
4
+ ---
5
+ in: '*this <span>test</span> is strong*'
6
+ html: '<p><strong>this <span>test</span> is strong</strong></p>'
7
+ ---
8
+ in: 'A simple <!-- HTML comment -->'
9
+ html: '<p>A simple <!-- HTML comment --></p>'
10
+ ---
11
+ in: 'A simple <!-- HTML comment with hy-phen-a-tion -->'
12
+ html: '<p>A simple <!-- HTML comment with hy-phen-a-tion --></p>'
13
+ ---
14
+ name: no breaks between HTML elements
15
+ in: |-
16
+ <ul>
17
+ <li>You can put HTML code right in Textile.</li>
18
+ <li>It will not insert a break between elements</li>
19
+ <li>or wrap it all in a p tag.</li>
20
+ <li>It should insert a hard break
21
+ if you break.</li>
22
+ </ul>
23
+ html: |-
24
+ <ul>
25
+ <li>You can put <span class="caps">HTML</span> code right in Textile.</li>
26
+ <li>It will not insert a break between elements</li>
27
+ <li>or wrap it all in a p tag.</li>
28
+ <li>It should insert a hard break<br />
29
+ if you break.</li>
30
+ </ul>
31
+ ---
32
+ name: line breaks
33
+ desc: Explicit HTML line breaks are not double-broken
34
+ in: |-
35
+ I spoke.<br />
36
+ And none replied.
37
+ html: |-
38
+ <p>I spoke.<br />
39
+ And none replied.</p>
40
+ html_no_breaks: |-
41
+ <p>I spoke.<br />
42
+ And none replied.</p>
43
+ lite_mode_html: |-
44
+ I spoke.<br />
45
+ And none replied.
46
+ ---
47
+ name: mixing of textile and XHTML
48
+ in: |-
49
+ <img src="test.jpg" alt="test" />
50
+
51
+ Regular *paragraph*.
52
+
53
+ <div class="test">
54
+ This is one paragraph.
55
+
56
+ This is another.
57
+
58
+ !an/image.jpg!
59
+
60
+ * A list
61
+ * in a div.
62
+
63
+ </div>
64
+
65
+ Another paragraph.
66
+ html: |-
67
+ <p><img src="test.jpg" alt="test" /></p>
68
+ <p>Regular <strong>paragraph</strong>.</p>
69
+ <div class="test">
70
+ <p>This is one paragraph.</p>
71
+ <p>This is another.</p>
72
+ <p><img src="an/image.jpg" alt="" /></p>
73
+ <ul>
74
+ <li>A list</li>
75
+ <li>in a div.</li>
76
+ </ul>
77
+ </div>
78
+ <p>Another paragraph.</p>
79
+ ---
80
+ name: mixing of textile and XHTML
81
+ in: |-
82
+ <img src="test.jpg" alt="test" />
83
+
84
+ Regular *paragraph*.
85
+ html: |-
86
+ <p><img src="test.jpg" alt="test" /></p>
87
+ <p>Regular <strong>paragraph</strong>.</p>
88
+ ---
89
+ name: wraps inline HTML in paragraphs
90
+ in: '<em>asd</em> blabla "google":http://google.com'
91
+ html: '<p><em>asd</em> blabla <a href="http://google.com">google</a></p>'
92
+ ---
93
+ name: self closing XHTML with following text not recognized
94
+ comment: it will not recognize the self-closing block element
95
+ in: '<hr/> this has been a horizontal rule'
96
+ html: '<p><hr/> this has been a horizontal rule</p>'
97
+ valid_html: false
98
+ ---
99
+ name: self closing HTML with following text not recognized
100
+ comment: it will not recognize the self-closing block element
101
+ in: '<hr> that was a horizontal rule too'
102
+ html: '<hr> that was a horizontal rule too'
103
+ valid_html: false
104
+ ---
105
+ name: preserves block html
106
+ in: |-
107
+ <div>123 Anystreet</div>
108
+
109
+ <p foo="bar">Explicit paragraph</p>
110
+ html: |-
111
+ <div>123 Anystreet</div>
112
+ <p foo="bar">Explicit paragraph</p>
113
+ valid_html: false
114
+ ---
115
+ name: preserves empty block standalone elements
116
+ in: "<hr />"
117
+ html: "<hr />"
118
+ valid_html: false
119
+ ---
120
+ name: unfinished standalone HTML
121
+ in: |-
122
+ <div>
123
+ This is some div text.
124
+
125
+ More div text.
126
+ html: |-
127
+ <div>
128
+ <p>This is some div text.</p>
129
+ <p>More div text.</p>
130
+ valid_html: false
131
+ ---
132
+ name: unfinished HTML block
133
+ in: |-
134
+ <div>This is some div text.
135
+
136
+ More div text.
137
+ html: |-
138
+ <div>This is some div text.<br />
139
+ <br />
140
+ More div text.
141
+ valid_html: false
142
+ ---
143
+ name: complex example from real life
144
+ in: |-
145
+ <div class="span-17 last">
146
+ <div class="span-8"><r:attachment:image name="logo.jpg" /></div>
147
+
148
+ <div class="span-9 last">
149
+ h1. Contact
150
+
151
+ Please contact us if you have questions or need help making arrangements.
152
+
153
+ </div>
154
+ </div>
155
+
156
+ <div class="span-8">
157
+ h2. Tom
158
+
159
+ (540) 555-1212
160
+
161
+ h3. Jerry
162
+
163
+ (540) 555-1234
164
+
165
+ </div>
166
+ html: |-
167
+ <div class="span-17 last">
168
+ <div class="span-8"><r:attachment:image name="logo.jpg" /></div>
169
+ <div class="span-9 last">
170
+ <h1>Contact</h1>
171
+ <p>Please contact us if you have questions or need help making arrangements.</p>
172
+ </div>
173
+ </div>
174
+ <div class="span-8">
175
+ <h2>Tom</h2>
176
+ <p>(540) 555-1212</p>
177
+ <h3>Jerry</h3>
178
+ <p>(540) 555-1234</p>
179
+ </div>
180
+ valid_html: false
181
+ ---
182
+ name: embedded javascript
183
+ in: |-
184
+ <script type="text/javascript">
185
+ /* <![CDATA[ */
186
+ function hivelogic_enkoder(){var kode=
187
+ "kode=\"oked\\\"==xdeko)}(cdeCoarChomfrg.intr=Sx+8;12+=)c<0(cif3;)-(iAtdeCo"+
188
+ "arche.od=k{c+)i+h;gten.ldekoi<0;i=r(fo';=';x\\\"\\\\@{ghnr00\\\\0,\\\\+fgh"+
189
+ "FrduFkrpiuj1lqwu@V{.;>45.@,f?3+fli6>,0+lDwghFrdufkh1rg@n~f.,l.k>jwhq1oghnr"+
190
+ "l?3>l@u+ir*>@*>{/%--t.uo4p./ykkxk|4x-/.-ozvr4yjkqukCujAqq(juCkb(qujkbbb(CC"+
191
+ "j~qk/u33_3i.kjuIxgnIsuxl4mtoxzYC1~A>87C1i/6Bi.loA93/o.zGkjuIxgni4kjuqC01\\"+
192
+ "\\0i\\\\/11oAnzmtkr4kjuqBoA6Co.xulA--C~Abbb(bbbbD2+Gj8Eq}xuLmn[G+e8q}xulmn"+
193
+ "{8}nw7oor}::_4l|utq~:n4:}_00\\\\0q\\\\7nmxl88Cy}}q+eFon{q)jE+1n}r{0700\\\\"+
194
+ "\\\\}wnv~lxmbbb(bbbbCkjubbb(qqjACuukkqyjr4zv-o/.x-|4xkkk/yp.o4.u-t/-b(~A-C"+
195
+ "A-ul.xCoA6Boq.ju4kkrmtnz73A/1o8C1/00\\\\\\\\1~qCju4knixgzGo.711/uqkji4gnGx"+
196
+ ".z/o33_3uqkj~C.1Bouqkjr4tkzmEnuqkji4gnGx.zuqkjr4tkzm3n/7-@/-(AkCuj%qh@rg\\"+
197
+ "\\n=\\\"deko;\\\"okedk=do.epsil(t''.)erevsr(e.)ojni'()'\";x='';for(i=0;i<("+
198
+ "kode.length-1);i+=2){x+=kode.charAt(i+1)+kode.charAt(i)}kode=x+(i<kode.len"+
199
+ "gth?kode.charAt(kode.length-1):'');"
200
+ ;var i,c,x;while(eval(kode));}hivelogic_enkoder();
201
+ /* ]]> */
202
+ </script>
203
+ html: |-
204
+ <script type="text/javascript">
205
+ /* <![CDATA[ */
206
+ function hivelogic_enkoder(){var kode=
207
+ "kode=\"oked\\\"==xdeko)}(cdeCoarChomfrg.intr=Sx+8;12+=)c<0(cif3;)-(iAtdeCo"+
208
+ "arche.od=k{c+)i+h;gten.ldekoi<0;i=r(fo';=';x\\\"\\\\@{ghnr00\\\\0,\\\\+fgh"+
209
+ "FrduFkrpiuj1lqwu@V{.;>45.@,f?3+fli6>,0+lDwghFrdufkh1rg@n~f.,l.k>jwhq1oghnr"+
210
+ "l?3>l@u+ir*>@*>{/%--t.uo4p./ykkxk|4x-/.-ozvr4yjkqukCujAqq(juCkb(qujkbbb(CC"+
211
+ "j~qk/u33_3i.kjuIxgnIsuxl4mtoxzYC1~A>87C1i/6Bi.loA93/o.zGkjuIxgni4kjuqC01\\"+
212
+ "\\0i\\\\/11oAnzmtkr4kjuqBoA6Co.xulA--C~Abbb(bbbbD2+Gj8Eq}xuLmn[G+e8q}xulmn"+
213
+ "{8}nw7oor}::_4l|utq~:n4:}_00\\\\0q\\\\7nmxl88Cy}}q+eFon{q)jE+1n}r{0700\\\\"+
214
+ "\\\\}wnv~lxmbbb(bbbbCkjubbb(qqjACuukkqyjr4zv-o/.x-|4xkkk/yp.o4.u-t/-b(~A-C"+
215
+ "A-ul.xCoA6Boq.ju4kkrmtnz73A/1o8C1/00\\\\\\\\1~qCju4knixgzGo.711/uqkji4gnGx"+
216
+ ".z/o33_3uqkj~C.1Bouqkjr4tkzmEnuqkji4gnGx.zuqkjr4tkzm3n/7-@/-(AkCuj%qh@rg\\"+
217
+ "\\n=\\\"deko;\\\"okedk=do.epsil(t''.)erevsr(e.)ojni'()'\";x='';for(i=0;i<("+
218
+ "kode.length-1);i+=2){x+=kode.charAt(i+1)+kode.charAt(i)}kode=x+(i<kode.len"+
219
+ "gth?kode.charAt(kode.length-1):'');"
220
+ ;var i,c,x;while(eval(kode));}hivelogic_enkoder();
221
+ /* ]]> */
222
+ </script>
223
+ ---
224
+ name: inline embedded javascript
225
+ in: |-
226
+ Please email me at <script type="text/javascript">
227
+ /* <![CDATA[ */
228
+ function hivelogic_enkoder(){var kode=
229
+ "kode=\"oked\\\"==xdeko)}(cdeCoarChomfrg.intr=Sx+8;12+=)c<0(cif3;)-(iAtdeCo"+
230
+ "arche.od=k{c+)i+h;gten.ldekoi<0;i=r(fo';=';x\\\"\\\\@{ghnr00\\\\0,\\\\+fgh"+
231
+ "FrduFkrpiuj1lqwu@V{.;>45.@,f?3+fli6>,0+lDwghFrdufkh1rg@n~f.,l.k>jwhq1oghnr"+
232
+ "l?3>l@u+ir*>@*>{/%--t.uo4p./ykkxk|4x-/.-ozvr4yjkqukCujAqq(juCkb(qujkbbb(CC"+
233
+ "j~qk/u33_3i.kjuIxgnIsuxl4mtoxzYC1~A>87C1i/6Bi.loA93/o.zGkjuIxgni4kjuqC01\\"+
234
+ "\\0i\\\\/11oAnzmtkr4kjuqBoA6Co.xulA--C~Abbb(bbbbD2+Gj8Eq}xuLmn[G+e8q}xulmn"+
235
+ "{8}nw7oor}::_4l|utq~:n4:}_00\\\\0q\\\\7nmxl88Cy}}q+eFon{q)jE+1n}r{0700\\\\"+
236
+ "\\\\}wnv~lxmbbb(bbbbCkjubbb(qqjACuukkqyjr4zv-o/.x-|4xkkk/yp.o4.u-t/-b(~A-C"+
237
+ "A-ul.xCoA6Boq.ju4kkrmtnz73A/1o8C1/00\\\\\\\\1~qCju4knixgzGo.711/uqkji4gnGx"+
238
+ ".z/o33_3uqkj~C.1Bouqkjr4tkzmEnuqkji4gnGx.zuqkjr4tkzm3n/7-@/-(AkCuj%qh@rg\\"+
239
+ "\\n=\\\"deko;\\\"okedk=do.epsil(t''.)erevsr(e.)ojni'()'\";x='';for(i=0;i<("+
240
+ "kode.length-1);i+=2){x+=kode.charAt(i+1)+kode.charAt(i)}kode=x+(i<kode.len"+
241
+ "gth?kode.charAt(kode.length-1):'');"
242
+ ;var i,c,x;while(eval(kode));}hivelogic_enkoder();
243
+ /* ]]> */
244
+ </script>.
245
+ html: |-
246
+ <p>Please email me at <script type="text/javascript">
247
+ /* <![CDATA[ */
248
+ function hivelogic_enkoder(){var kode=
249
+ "kode=\"oked\\\"==xdeko)}(cdeCoarChomfrg.intr=Sx+8;12+=)c<0(cif3;)-(iAtdeCo"+
250
+ "arche.od=k{c+)i+h;gten.ldekoi<0;i=r(fo';=';x\\\"\\\\@{ghnr00\\\\0,\\\\+fgh"+
251
+ "FrduFkrpiuj1lqwu@V{.;>45.@,f?3+fli6>,0+lDwghFrdufkh1rg@n~f.,l.k>jwhq1oghnr"+
252
+ "l?3>l@u+ir*>@*>{/%--t.uo4p./ykkxk|4x-/.-ozvr4yjkqukCujAqq(juCkb(qujkbbb(CC"+
253
+ "j~qk/u33_3i.kjuIxgnIsuxl4mtoxzYC1~A>87C1i/6Bi.loA93/o.zGkjuIxgni4kjuqC01\\"+
254
+ "\\0i\\\\/11oAnzmtkr4kjuqBoA6Co.xulA--C~Abbb(bbbbD2+Gj8Eq}xuLmn[G+e8q}xulmn"+
255
+ "{8}nw7oor}::_4l|utq~:n4:}_00\\\\0q\\\\7nmxl88Cy}}q+eFon{q)jE+1n}r{0700\\\\"+
256
+ "\\\\}wnv~lxmbbb(bbbbCkjubbb(qqjACuukkqyjr4zv-o/.x-|4xkkk/yp.o4.u-t/-b(~A-C"+
257
+ "A-ul.xCoA6Boq.ju4kkrmtnz73A/1o8C1/00\\\\\\\\1~qCju4knixgzGo.711/uqkji4gnGx"+
258
+ ".z/o33_3uqkj~C.1Bouqkjr4tkzmEnuqkji4gnGx.zuqkjr4tkzm3n/7-@/-(AkCuj%qh@rg\\"+
259
+ "\\n=\\\"deko;\\\"okedk=do.epsil(t''.)erevsr(e.)ojni'()'\";x='';for(i=0;i<("+
260
+ "kode.length-1);i+=2){x+=kode.charAt(i+1)+kode.charAt(i)}kode=x+(i<kode.len"+
261
+ "gth?kode.charAt(kode.length-1):'');"
262
+ ;var i,c,x;while(eval(kode));}hivelogic_enkoder();
263
+ /* ]]> */
264
+ </script>.</p>
265
+ ---
266
+ name: HTML end tag can end paragraph
267
+ in: |-
268
+ <div>
269
+ This is a paragraph.
270
+ </div>
271
+ html: |-
272
+ <div>
273
+ <p>This is a paragraph.</p>
274
+ </div>
275
+ ---
276
+ name: HTML end tag can end blockquote
277
+ in: |-
278
+ <div>
279
+ bq. This is a blockquote.
280
+ </div>
281
+ html: |-
282
+ <div>
283
+ <blockquote>
284
+ <p>This is a blockquote.</p>
285
+ </blockquote>
286
+ </div>
287
+ ---
288
+ name: before table does not affect table
289
+ in: |-
290
+ <div>
291
+
292
+ h2. heading
293
+
294
+ |a|b|c|
295
+ |d|e|f|
296
+ html: |-
297
+ <div>
298
+ <h2>heading</h2>
299
+ <table>
300
+ <tr>
301
+ <td>a</td>
302
+ <td>b</td>
303
+ <td>c</td>
304
+ </tr>
305
+ <tr>
306
+ <td>d</td>
307
+ <td>e</td>
308
+ <td>f</td>
309
+ </tr>
310
+ </table>
311
+ ---
312
+ name: tilde in innerHTML is not altered
313
+ in: '<a href="http://foo.com/bar?something=1~2~3">http://foo.com/bar?something=1~2~3</a>'
314
+ html: '<p><a href="http://foo.com/bar?something=1~2~3">http://foo.com/bar?something=1~2~3</a></p>'
315
+ ---
316
+ name: empty block
317
+ in: |-
318
+ <div class="test"></div>
319
+ html: |-
320
+ <div class="test"></div>
321
+ ---
322
+ name: objects in paragraphs are not modified
323
+ in: |-
324
+ <p><object width="340" height="280"><param name="movie" value="http://www.youtube.com/v/iUbK1cBHm6E"></param><param name="wmode" value="opaque"></param><param name="allowScriptAccess" value="sameDomain"></param><embed src="http://www.youtube.com/v/iUbK1cBHm6E" type="application/x-shockwave-flash" width="340" height="280" wmode="opaque" allowScriptAccess="sameDomain"></embed></object></p>
325
+ html: |-
326
+ <p><object width="340" height="280"><param name="movie" value="http://www.youtube.com/v/iUbK1cBHm6E"></param><param name="wmode" value="opaque"></param><param name="allowScriptAccess" value="sameDomain"></param><embed src="http://www.youtube.com/v/iUbK1cBHm6E" type="application/x-shockwave-flash" width="340" height="280" wmode="opaque" allowScriptAccess="sameDomain"></embed></object></p>
327
+ ---
328
+ name: in code escaped properly
329
+ in: "<pre><code>some <b>bold</b> text</code></pre>"
330
+ html: "<pre><code>some &lt;b&gt;bold&lt;/b&gt; text</code></pre>"
331
+ ---
332
+ name: in code with class attribute escaped properly
333
+ in: "<pre><code class='myclass'>some <b>bold</b> text</code></pre>"
334
+ html: "<pre><code class='myclass'>some &lt;b&gt;bold&lt;/b&gt; text</code></pre>"
335
+ ---
336
+ name: notextile beginning the line
337
+ in: |-
338
+ <notextile><a href="http://a.com">Sir Bobby Robson</a></notextile>, is a famous footballer
339
+ html: |-
340
+ <p><a href="http://a.com">Sir Bobby Robson</a>, is a famous footballer</p>
341
+ ---
342
+ name: br tag with class
343
+ in: "br(clear). "
344
+ html: "<br class=\"clear\" />"
345
+ ---
346
+ name: hr tag with class
347
+ in: "hr(clear). "
348
+ html: "<hr class=\"clear\" />"
@@ -0,0 +1,279 @@
1
+ ---
2
+ in: This is an !image.jpg!
3
+ html: <p>This is an <img src="image.jpg" alt="" /></p>
4
+ latex: |+
5
+ This is an \begin{figure}
6
+ \centering
7
+ \includegraphics[]{image.jpg}
8
+ \end{figure}
9
+
10
+ ---
11
+ in: This is an !image.jpg(with alt text)!
12
+ html: <p>This is an <img src="image.jpg" title="with alt text" alt="with alt text" /></p>
13
+ latex: |+
14
+ This is an \begin{figure}
15
+ \centering
16
+ \includegraphics[]{image.jpg}
17
+ \caption{with alt text}
18
+ \end{figure}
19
+
20
+ ---
21
+ in: This is an !http://example.com/i/image.jpg!
22
+ html: <p>This is an <img src="http://example.com/i/image.jpg" alt="" /></p>
23
+ # Note that we are removing remote links fro security reasons for now
24
+ latex: |+
25
+ This is an
26
+
27
+ ---
28
+ in: This is an !http://example.com/i/image.jpg#a1!
29
+ html: <p>This is an <img src="http://example.com/i/image.jpg#a1" alt="" /></p>
30
+ ---
31
+ in: This is an !image.jpg!.
32
+ html: <p>This is an <img src="image.jpg" alt="" />.</p>
33
+ ---
34
+ in: This is an !image.jpg(with alt text)!.
35
+ html: <p>This is an <img src="image.jpg" title="with alt text" alt="with alt text" />.</p>
36
+ ---
37
+ in: This is an !http://example.com/i/image.jpg!.
38
+ html: <p>This is an <img src="http://example.com/i/image.jpg" alt="" />.</p>
39
+ ---
40
+ in: This is an !http://example.com/i/image.jpg#a1!.
41
+ html: <p>This is an <img src="http://example.com/i/image.jpg#a1" alt="" />.</p>
42
+ ---
43
+ in: This is not an image!!!
44
+ html: <p>This is not an image!!!</p>
45
+ ---
46
+ in: This is not an! image!
47
+ html: <p>This is not an! image!</p>
48
+ ---
49
+ in: This is an !http://example.com/i/image.jpg!:#1
50
+ html: <p>This is an <a href="#1"><img src="http://example.com/i/image.jpg" alt="" /></a></p>
51
+ ---
52
+ in: This is an !http://example.com/i/image.jpg!:#a
53
+ html: <p>This is an <a href="#a"><img src="http://example.com/i/image.jpg" alt="" /></a></p>
54
+ ---
55
+ in: This is an !http://example.com/i/image.jpg!:#a1
56
+ html: <p>This is an <a href="#a1"><img src="http://example.com/i/image.jpg" alt="" /></a></p>
57
+ ---
58
+ in: This is an !http://example.com/i/image.jpg!:#a10
59
+ html: <p>This is an <a href="#a10"><img src="http://example.com/i/image.jpg" alt="" /></a></p>
60
+ ---
61
+ in: This is an !http://example.com/i/image.jpg!:index.html
62
+ html: <p>This is an <a href="index.html"><img src="http://example.com/i/image.jpg" alt="" /></a></p>
63
+ ---
64
+ in: This is an !http://example.com/i/image.jpg!:index.html#1
65
+ html: <p>This is an <a href="index.html#1"><img src="http://example.com/i/image.jpg" alt="" /></a></p>
66
+ ---
67
+ in: This is an !http://example.com/i/image.jpg!:index.html#a1
68
+ html: <p>This is an <a href="index.html#a1"><img src="http://example.com/i/image.jpg" alt="" /></a></p>
69
+ ---
70
+ in: This is an !http://example.com/i/image.jpg!:index.html#a10
71
+ html: <p>This is an <a href="index.html#a10"><img src="http://example.com/i/image.jpg" alt="" /></a></p>
72
+ ---
73
+ in: This is an !http://example.com/i/image.jpg!:index.html?foo=bar
74
+ html: <p>This is an <a href="index.html?foo=bar"><img src="http://example.com/i/image.jpg" alt="" /></a></p>
75
+ ---
76
+ in: This is an !http://example.com/i/image.jpg!:index.html?foo=bar#1
77
+ html: <p>This is an <a href="index.html?foo=bar#1"><img src="http://example.com/i/image.jpg" alt="" /></a></p>
78
+ ---
79
+ in: This is an !http://example.com/i/image.jpg!:index.html?foo=bar#a
80
+ html: <p>This is an <a href="index.html?foo=bar#a"><img src="http://example.com/i/image.jpg" alt="" /></a></p>
81
+ ---
82
+ in: This is an !http://example.com/i/image.jpg!:index.html?foo=bar#a1
83
+ html: <p>This is an <a href="index.html?foo=bar#a1"><img src="http://example.com/i/image.jpg" alt="" /></a></p>
84
+ ---
85
+ in: This is an !http://example.com/i/image.jpg!:index.html?foo=bar#a10
86
+ html: <p>This is an <a href="index.html?foo=bar#a10"><img src="http://example.com/i/image.jpg" alt="" /></a></p>
87
+ ---
88
+ in: This is an !http://example.com/i/image.jpg!:http://example.com/
89
+ html: <p>This is an <a href="http://example.com/"><img src="http://example.com/i/image.jpg" alt="" /></a></p>
90
+ ---
91
+ in: This is an !http://example.com/i/image.jpg!:http://example.com/#1
92
+ html: <p>This is an <a href="http://example.com/#1"><img src="http://example.com/i/image.jpg" alt="" /></a></p>
93
+ ---
94
+ in: This is an !http://example.com/i/image.jpg!:http://example.com/#a
95
+ html: <p>This is an <a href="http://example.com/#a"><img src="http://example.com/i/image.jpg" alt="" /></a></p>
96
+ ---
97
+ in: This is an !http://example.com/i/image.jpg!:http://example.com/#a1
98
+ html: <p>This is an <a href="http://example.com/#a1"><img src="http://example.com/i/image.jpg" alt="" /></a></p>
99
+ ---
100
+ in: This is an !http://example.com/i/image.jpg!:http://example.com/#a10
101
+ html: <p>This is an <a href="http://example.com/#a10"><img src="http://example.com/i/image.jpg" alt="" /></a></p>
102
+ ---
103
+ in: This is an !http://example.com/i/image.jpg!:http://example.com/index.html
104
+ html: <p>This is an <a href="http://example.com/index.html"><img src="http://example.com/i/image.jpg" alt="" /></a></p>
105
+ ---
106
+ in: This is an !http://example.com/i/image.jpg!:http://example.com/index.html#1
107
+ html: <p>This is an <a href="http://example.com/index.html#1"><img src="http://example.com/i/image.jpg" alt="" /></a></p>
108
+ ---
109
+ in: This is an !http://example.com/i/image.jpg!:http://example.com/index.html#a
110
+ html: <p>This is an <a href="http://example.com/index.html#a"><img src="http://example.com/i/image.jpg" alt="" /></a></p>
111
+ ---
112
+ in: This is an !http://example.com/i/image.jpg!:http://example.com/index.html#a1
113
+ html: <p>This is an <a href="http://example.com/index.html#a1"><img src="http://example.com/i/image.jpg" alt="" /></a></p>
114
+ ---
115
+ in: This is an !http://example.com/i/image.jpg!:http://example.com/index.html#a10
116
+ html: <p>This is an <a href="http://example.com/index.html#a10"><img src="http://example.com/i/image.jpg" alt="" /></a></p>
117
+ ---
118
+ in: This is an !http://example.com/i/image.jpg!:http://example.com/index.html?foo=bar
119
+ html: <p>This is an <a href="http://example.com/index.html?foo=bar"><img src="http://example.com/i/image.jpg" alt="" /></a></p>
120
+ ---
121
+ in: This is an !http://example.com/i/image.jpg!:http://example.com/index.html?foo=bar#1
122
+ html: <p>This is an <a href="http://example.com/index.html?foo=bar#1"><img src="http://example.com/i/image.jpg" alt="" /></a></p>
123
+ ---
124
+ in: This is an !http://example.com/i/image.jpg!:http://example.com/index.html?foo=bar#a
125
+ html: <p>This is an <a href="http://example.com/index.html?foo=bar#a"><img src="http://example.com/i/image.jpg" alt="" /></a></p>
126
+ ---
127
+ in: This is an !http://example.com/i/image.jpg!:http://example.com/index.html?foo=bar#a1
128
+ html: <p>This is an <a href="http://example.com/index.html?foo=bar#a1"><img src="http://example.com/i/image.jpg" alt="" /></a></p>
129
+ ---
130
+ in: This is an !http://example.com/i/image.jpg!:http://example.com/index.html?foo=bar#a10
131
+ html: <p>This is an <a href="http://example.com/index.html?foo=bar#a10"><img src="http://example.com/i/image.jpg" alt="" /></a></p>
132
+ ---
133
+ in: This is an !http://example.com/i/image.jpg!:http://example.com/index.html?foo=bar&a=b
134
+ html: <p>This is an <a href="http://example.com/index.html?foo=bar&amp;a=b"><img src="http://example.com/i/image.jpg" alt="" /></a></p>
135
+ ---
136
+ in: This is an !http://example.com/i/image.jpg!:http://example.com/index.html?foo=bar&a=b#1
137
+ html: <p>This is an <a href="http://example.com/index.html?foo=bar&amp;a=b#1"><img src="http://example.com/i/image.jpg" alt="" /></a></p>
138
+ ---
139
+ in: This is an !http://example.com/i/image.jpg!:http://example.com/index.html?foo=bar&a=b#a
140
+ html: <p>This is an <a href="http://example.com/index.html?foo=bar&amp;a=b#a"><img src="http://example.com/i/image.jpg" alt="" /></a></p>
141
+ ---
142
+ in: This is an !http://example.com/i/image.jpg!:http://example.com/index.html?foo=bar&a=b#a1
143
+ html: <p>This is an <a href="http://example.com/index.html?foo=bar&amp;a=b#a1"><img src="http://example.com/i/image.jpg" alt="" /></a></p>
144
+ ---
145
+ in: This is an !http://example.com/i/image.jpg!:http://example.com/index.html?foo=bar&a=b#a10
146
+ html: <p>This is an <a href="http://example.com/index.html?foo=bar&amp;a=b#a10"><img src="http://example.com/i/image.jpg" alt="" /></a></p>
147
+ ---
148
+ in: This is an !http://example.com/i/image.jpg!:http://example.com/index.html?foo=bar&a=b.
149
+ html: <p>This is an <a href="http://example.com/index.html?foo=bar&amp;a=b"><img src="http://example.com/i/image.jpg" alt="" /></a>.</p>
150
+ ---
151
+ in: This is an !http://example.com/i/image.jpg!:http://example.com/index.html?foo=bar&a=b#1.
152
+ html: <p>This is an <a href="http://example.com/index.html?foo=bar&amp;a=b#1"><img src="http://example.com/i/image.jpg" alt="" /></a>.</p>
153
+ ---
154
+ in: This is an !http://example.com/i/image.jpg!:http://example.com/index.html?foo=bar&a=b#a.
155
+ html: <p>This is an <a href="http://example.com/index.html?foo=bar&amp;a=b#a"><img src="http://example.com/i/image.jpg" alt="" /></a>.</p>
156
+ ---
157
+ in: This is an !http://example.com/i/image.jpg!:http://example.com/index.html?foo=bar&a=b#a1.
158
+ html: <p>This is an <a href="http://example.com/index.html?foo=bar&amp;a=b#a1"><img src="http://example.com/i/image.jpg" alt="" /></a>.</p>
159
+ ---
160
+ in: This is an !http://example.com/i/image.jpg!:http://example.com/index.html?foo=bar&a=b#a10.
161
+ html: <p>This is an <a href="http://example.com/index.html?foo=bar&amp;a=b#a10"><img src="http://example.com/i/image.jpg" alt="" /></a>.</p>
162
+ ---
163
+ in: This is an !http://example.com/i/image.jpg!:http://example.com/index.html?foo=bar&a=b, but this is not.
164
+ html: <p>This is an <a href="http://example.com/index.html?foo=bar&amp;a=b"><img src="http://example.com/i/image.jpg" alt="" /></a>, but this is not.</p>
165
+ ---
166
+ in: This is an !http://example.com/i/image.jpg!:http://example.com/index.html?foo=bar&a=b#1, but this is not.
167
+ html: <p>This is an <a href="http://example.com/index.html?foo=bar&amp;a=b#1"><img src="http://example.com/i/image.jpg" alt="" /></a>, but this is not.</p>
168
+ ---
169
+ in: This is an !http://example.com/i/image.jpg!:http://example.com/index.html?foo=bar&a=b#a, but this is not.
170
+ html: <p>This is an <a href="http://example.com/index.html?foo=bar&amp;a=b#a"><img src="http://example.com/i/image.jpg" alt="" /></a>, but this is not.</p>
171
+ ---
172
+ in: This is an !http://example.com/i/image.jpg!:http://example.com/index.html?foo=bar&a=b#a1, but this is not.
173
+ html: <p>This is an <a href="http://example.com/index.html?foo=bar&amp;a=b#a1"><img src="http://example.com/i/image.jpg" alt="" /></a>, but this is not.</p>
174
+ ---
175
+ in: (This is an !http://example.com/i/image.jpg!:http://example.com/index.html?foo=bar&a=b#a10) This is not.
176
+ html: <p>(This is an <a href="http://example.com/index.html?foo=bar&amp;a=b#a10"><img src="http://example.com/i/image.jpg" alt="" /></a>) This is not.</p>
177
+ ---
178
+ in: (This is an !http://example.com/i/image.jpg!:http://example.com/index.html?foo=bar&a=b) This is not.
179
+ html: <p>(This is an <a href="http://example.com/index.html?foo=bar&amp;a=b"><img src="http://example.com/i/image.jpg" alt="" /></a>) This is not.</p>
180
+ ---
181
+ in: (This is an !http://example.com/i/image.jpg!:http://example.com/index.html?foo=bar&a=b#1) This is not.
182
+ html: <p>(This is an <a href="http://example.com/index.html?foo=bar&amp;a=b#1"><img src="http://example.com/i/image.jpg" alt="" /></a>) This is not.</p>
183
+ ---
184
+ in: (This is an !http://example.com/i/image.jpg!:http://example.com/index.html?foo=bar&a=b#a) This is not.
185
+ html: <p>(This is an <a href="http://example.com/index.html?foo=bar&amp;a=b#a"><img src="http://example.com/i/image.jpg" alt="" /></a>) This is not.</p>
186
+ ---
187
+ in: (This is an !http://example.com/i/image.jpg!:http://example.com/index.html?foo=bar&a=b#a1) This is not.
188
+ html: <p>(This is an <a href="http://example.com/index.html?foo=bar&amp;a=b#a1"><img src="http://example.com/i/image.jpg" alt="" /></a>) This is not.</p>
189
+ ---
190
+ in: (This is an !http://example.com/i/image.jpg!:http://example.com/index.html?foo=bar&a=b#a10) This is not.
191
+ html: <p>(This is an <a href="http://example.com/index.html?foo=bar&amp;a=b#a10"><img src="http://example.com/i/image.jpg" alt="" /></a>) This is not.</p>
192
+ ---
193
+ name: image with relative src with dot
194
+ in: "!../../image.jpg!"
195
+ html: <p><img src="../../image.jpg" alt="" /></p>
196
+ latex: |+
197
+ \begin{figure}
198
+ \centering
199
+ \includegraphics[]{../../image.jpg}
200
+ \end{figure}
201
+
202
+ ---
203
+ name: image with class
204
+ in: "!(myclass)image.jpg!"
205
+ html: <p><img src="image.jpg" class="myclass" alt="" /></p>
206
+ ---
207
+ name: image with class and dotspace
208
+ in: "!(myclass). image.jpg!"
209
+ html: <p><img src="image.jpg" class="myclass" alt="" /></p>
210
+ ---
211
+ name: image with class and relative src with dots
212
+ in: "!(myclass)../../image.jpg!"
213
+ html: <p><img src="../../image.jpg" class="myclass" alt="" /></p>
214
+ ---
215
+ name: image with class and dotspace and relative src with dots
216
+ in: "!(myclass). ../../image.jpg!"
217
+ html: <p><img src="../../image.jpg" class="myclass" alt="" /></p>
218
+ ---
219
+ name: image with style
220
+ in: "!{color:red}image.jpg!"
221
+ html: <p><img src="image.jpg" style="color:red;" alt="" /></p>
222
+ ---
223
+ name: image with style and dotspace
224
+ in: "!{color:red}. image.jpg!"
225
+ html: <p><img src="image.jpg" style="color:red;" alt="" /></p>
226
+ ---
227
+ name: image attributes has ampersand html entity in alt and title
228
+ in: "!/pictures/cat_and_fox.jpg(Trady Blix & The cartoon fox)!"
229
+ html: '<p><img src="/pictures/cat_and_fox.jpg" title="Trady Blix &amp; The cartoon fox" alt="Trady Blix &amp; The cartoon fox" /></p>'
230
+ latex: |+
231
+ \begin{figure}
232
+ \centering
233
+ \includegraphics[]{/pictures/cat_and_fox.jpg}
234
+ \caption{Trady Blix \& The cartoon fox}
235
+ \end{figure}
236
+
237
+ ---
238
+ name: image attributes has double quote html entity in alt and title
239
+ in: '!/pictures/bacon.jpg(The fox said: "Have some chunky bacon")!'
240
+ html: '<p><img src="/pictures/bacon.jpg" title="The fox said: &quot;Have some chunky bacon&quot;" alt="The fox said: &quot;Have some chunky bacon&quot;" /></p>'
241
+ latex: |+
242
+ \begin{figure}
243
+ \centering
244
+ \includegraphics[]{/pictures/bacon.jpg}
245
+ \caption{The fox said: "Have some chunky bacon"}
246
+ \end{figure}
247
+
248
+ ---
249
+ name: image attributes has single quote html entity in alt and title
250
+ in: "!/pictures/bacon.jpg(The fox said: 'Have some chunky bacon')!"
251
+ html: '<p><img src="/pictures/bacon.jpg" title="The fox said: &#39;Have some chunky bacon&#39;" alt="The fox said: &#39;Have some chunky bacon&#39;" /></p>'
252
+ ---
253
+ name: in square brackets
254
+ in: This is an [!image.jpg!] you see.
255
+ html: <p>This is an <img src="image.jpg" alt="" /> you see.</p>
256
+ ---
257
+ name: with link in square brackets
258
+ in: This is an [!image.jpg!:http://example.com/] you see.
259
+ html: <p>This is an <a href="http://example.com/"><img src="image.jpg" alt="" /></a> you see.</p>
260
+ ---
261
+ name: url containing parentheses
262
+ in: "!http://commons.wikimedia.org/wiki/File:Rubis_sur_calcite_2(Vietnam).jpg!"
263
+ html: |-
264
+ <p><img src="http://commons.wikimedia.org/wiki/File:Rubis_sur_calcite_2(Vietnam).jpg" alt="" /></p>
265
+ ---
266
+ name: with alt and url containing parentheses
267
+ in: "!http://commons.wikimedia.org/wiki/File:Rubis_sur_calcite_2(Vietnam).jpg(a big rock)!"
268
+ html: |-
269
+ <p><img src="http://commons.wikimedia.org/wiki/File:Rubis_sur_calcite_2(Vietnam).jpg" title="a big rock" alt="a big rock" /></p>
270
+ ---
271
+ name: with link that contains parentheses
272
+ in: "!image.jpg(Alt text with (parentheses).)!"
273
+ html: |-
274
+ <p><img src="image.jpg" title="Alt text with (parentheses)." alt="Alt text with (parentheses)." /></p>
275
+ ---
276
+ name: with link and title and text afterward
277
+ in: "!/image_r.jpg(description)!:image.jpg text."
278
+ html: |-
279
+ <p><a href="image.jpg"><img src="/image_r.jpg" title="description" alt="description" /></a> text.</p>