jeremy-RedCloth 4.1.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (57) hide show
  1. data/CHANGELOG +135 -0
  2. data/COPYING +18 -0
  3. data/Manifest +56 -0
  4. data/README +171 -0
  5. data/Rakefile +205 -0
  6. data/bin/redcloth +28 -0
  7. data/ext/mingw-rbconfig.rb +176 -0
  8. data/ext/redcloth_scan/extconf.rb +9 -0
  9. data/ext/redcloth_scan/redcloth.h +178 -0
  10. data/ext/redcloth_scan/redcloth_attributes.c.rl +56 -0
  11. data/ext/redcloth_scan/redcloth_attributes.java.rl +96 -0
  12. data/ext/redcloth_scan/redcloth_attributes.rl +33 -0
  13. data/ext/redcloth_scan/redcloth_common.c.rl +18 -0
  14. data/ext/redcloth_scan/redcloth_common.java.rl +18 -0
  15. data/ext/redcloth_scan/redcloth_common.rl +111 -0
  16. data/ext/redcloth_scan/redcloth_inline.c.rl +159 -0
  17. data/ext/redcloth_scan/redcloth_inline.java.rl +108 -0
  18. data/ext/redcloth_scan/redcloth_inline.rl +159 -0
  19. data/ext/redcloth_scan/redcloth_scan.c.rl +237 -0
  20. data/ext/redcloth_scan/redcloth_scan.java.rl +573 -0
  21. data/ext/redcloth_scan/redcloth_scan.rl +325 -0
  22. data/extras/ragel_profiler.rb +73 -0
  23. data/lib/case_sensitive_require/RedCloth.rb +6 -0
  24. data/lib/redcloth.rb +37 -0
  25. data/lib/redcloth/erb_extension.rb +27 -0
  26. data/lib/redcloth/formatters/base.rb +57 -0
  27. data/lib/redcloth/formatters/html.rb +353 -0
  28. data/lib/redcloth/formatters/latex.rb +275 -0
  29. data/lib/redcloth/formatters/latex_entities.yml +2414 -0
  30. data/lib/redcloth/textile_doc.rb +103 -0
  31. data/lib/redcloth/version.rb +28 -0
  32. data/setup.rb +1585 -0
  33. data/test/basic.yml +922 -0
  34. data/test/code.yml +229 -0
  35. data/test/definitions.yml +82 -0
  36. data/test/extra_whitespace.yml +64 -0
  37. data/test/filter_html.yml +177 -0
  38. data/test/filter_pba.yml +20 -0
  39. data/test/helper.rb +108 -0
  40. data/test/html.yml +311 -0
  41. data/test/images.yml +254 -0
  42. data/test/instiki.yml +38 -0
  43. data/test/links.yml +275 -0
  44. data/test/lists.yml +283 -0
  45. data/test/poignant.yml +89 -0
  46. data/test/sanitize_html.yml +42 -0
  47. data/test/table.yml +336 -0
  48. data/test/test_custom_tags.rb +58 -0
  49. data/test/test_erb.rb +13 -0
  50. data/test/test_extensions.rb +31 -0
  51. data/test/test_formatters.rb +24 -0
  52. data/test/test_parser.rb +73 -0
  53. data/test/test_restrictions.rb +41 -0
  54. data/test/textism.yml +480 -0
  55. data/test/threshold.yml +772 -0
  56. data/test/validate_fixtures.rb +74 -0
  57. metadata +133 -0
@@ -0,0 +1,20 @@
1
+ ---
2
+ name: filter styles
3
+ in: "p{color:red}. Test"
4
+ style_filtered_html: "<p>Test</p>"
5
+ ---
6
+ name: filter classes
7
+ in: "p(myclass). Test"
8
+ class_filtered_html: "<p>Test</p>"
9
+ ---
10
+ name: filter ids
11
+ in: "p(#myid). Test"
12
+ id_filtered_html: "<p>Test</p>"
13
+ ---
14
+ name: correct application of double quote entity when using styles
15
+ in: 'p{background: #white url("../chunky_bacon.jpg")}. The quick brown "cartoon" fox jumps over the lazy dog'
16
+ html: '<p style="background: #white url(&quot;../chunky_bacon.jpg&quot;);">The quick brown &#8220;cartoon&#8221; fox jumps over the lazy dog</p>'
17
+ ---
18
+ name: correct application of single quote entity when using styles
19
+ in: "p{background: #white url('../chunky_bacon.jpg')}. The quick brown 'cartoon' fox jumps over the lazy dog"
20
+ html: '<p style="background: #white url(&#39;../chunky_bacon.jpg&#39;);">The quick brown &#8216;cartoon&#8217; fox jumps over the lazy dog</p>'
@@ -0,0 +1,108 @@
1
+ require 'test/unit'
2
+ $:.unshift File.dirname(__FILE__) + "/../lib"
3
+ require 'redcloth'
4
+ require 'yaml'
5
+
6
+ module Test
7
+ module Unit
8
+
9
+ class TestCase
10
+ def self.generate_formatter_tests(formatter, &block)
11
+ define_method("format_as_#{formatter}", &block)
12
+
13
+ fixtures.each do |name, doc|
14
+ if doc[formatter]
15
+ define_method("test_#{formatter}_#{name}") do
16
+ output = method("format_as_#{formatter}").call(doc)
17
+ assert_equal doc[formatter], output
18
+ end
19
+ else
20
+ define_method("test_#{formatter}_#{name}_raises_nothing") do
21
+ assert_nothing_raised(Exception) { method("format_as_#{formatter}").call(doc) }
22
+ end
23
+ end
24
+ end
25
+ end
26
+
27
+ def self.fixtures
28
+ return @fixtures if @fixtures
29
+ @fixtures = {}
30
+ Dir[File.join(File.dirname(__FILE__), "*.yml")].each do |testfile|
31
+ testgroup = File.basename(testfile, '.yml')
32
+ num = 0
33
+ YAML::load_documents(File.open(testfile)) do |doc|
34
+ name = doc['name'] ? doc['name'].downcase.gsub(/[- ]/, '_') : num
35
+ @fixtures["#{testgroup}_#{name}"] = doc
36
+ num += 1
37
+ end
38
+ end
39
+ @fixtures
40
+ end
41
+
42
+ end
43
+
44
+ module Assertions
45
+ # Browsers ignore tabs and newlines (generally), so don't quibble
46
+ def assert_html_equal(expected, actual, message=nil)
47
+ assert_equal(expected.gsub(/[\n\t]+/, ''), actual.gsub(/[\n\t]+/, ''), message)
48
+ end
49
+ end
50
+ end
51
+ end
52
+
53
+ # Colorize differences in assert_equal failure messages.
54
+ begin
55
+ require 'rubygems'
56
+ require 'diff/lcs'
57
+ require 'test/unit'
58
+
59
+ DIFF_COLOR = "\e[7m" unless defined?(DIFF_COLOR)
60
+ DEFAULT_COLOR = "\e[0m" unless defined?(DEFAULT_COLOR)
61
+
62
+ def highlight_differences(a, b)
63
+ sdiff = Diff::LCS.sdiff(a, b, Diff::LCS::ContextDiffCallbacks)
64
+ return highlight_string(sdiff, :old, a), highlight_string(sdiff, :new, b)
65
+ end
66
+
67
+ def highlight_string(sdiff, pos, s)
68
+ s = s.dup
69
+ offset = 0
70
+ sdiff.each do |hunk|
71
+ if hunk.first.send("#{pos}_element")
72
+ s.insert(hunk.first.send("#{pos}_position") + offset, DIFF_COLOR)
73
+ offset += DIFF_COLOR.length
74
+ end
75
+ if hunk.last.send("#{pos}_element")
76
+ s.insert(hunk.last.send("#{pos}_position") + 1 + offset, DEFAULT_COLOR)
77
+ offset += DEFAULT_COLOR.length
78
+ end
79
+ end
80
+ s = DEFAULT_COLOR + s + DEFAULT_COLOR
81
+ end
82
+
83
+ module Test::Unit::Assertions
84
+ # Show differences in expected and actual
85
+ def assert_equal(expected, actual, message=nil)
86
+ full_message = build_message(message, <<EOT, *highlight_differences(expected, actual))
87
+ expected: ?
88
+ but was: ?
89
+ EOT
90
+ assert_block(full_message) { expected == actual }
91
+ end
92
+ end
93
+
94
+
95
+ module ShowColorCodes
96
+ def self.included(base)
97
+ base.class_eval do
98
+ alias_method :result_without_color_codes, :result unless method_defined?(:result_without_color_codes)
99
+ alias_method :result, :result_with_color_codes
100
+ end
101
+ end
102
+ def result_with_color_codes(parameters)
103
+ result_without_color_codes(parameters.collect {|p| p.gsub(/\\e\[(\d+)m/) {"\e[#{$1}m"} })
104
+ end
105
+ end
106
+ Test::Unit::Assertions::AssertionMessage::Template.send(:include, ShowColorCodes)
107
+ rescue LoadError
108
+ end
@@ -0,0 +1,311 @@
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: mixing of textile and XHTML
33
+ in: |-
34
+ <img src="test.jpg" alt="test" />
35
+
36
+ Regular *paragraph*.
37
+
38
+ <div class="test">
39
+ This is one paragraph.
40
+
41
+ This is another.
42
+
43
+ !an/image.jpg!
44
+
45
+ * A list
46
+ * in a div.
47
+
48
+ </div>
49
+
50
+ Another paragraph.
51
+ html: |-
52
+ <p><img src="test.jpg" alt="test" /></p>
53
+ <p>Regular <strong>paragraph</strong>.</p>
54
+ <div class="test">
55
+ <p>This is one paragraph.</p>
56
+ <p>This is another.</p>
57
+ <p><img src="an/image.jpg" alt="" /></p>
58
+ <ul>
59
+ <li>A list</li>
60
+ <li>in a div.</li>
61
+ </ul>
62
+ </div>
63
+ <p>Another paragraph.</p>
64
+ ---
65
+ name: mixing of textile and XHTML
66
+ in: |-
67
+ <img src="test.jpg" alt="test" />
68
+
69
+ Regular *paragraph*.
70
+ html: |-
71
+ <p><img src="test.jpg" alt="test" /></p>
72
+ <p>Regular <strong>paragraph</strong>.</p>
73
+ ---
74
+ name: wraps inline HTML in paragraphs
75
+ in: '<em>asd</em> blabla "google":http://google.com'
76
+ html: '<p><em>asd</em> blabla <a href="http://google.com">google</a></p>'
77
+ ---
78
+ name: self closing XHTML with following text not recognized
79
+ comment: it will not recognize the self-closing block element
80
+ in: '<hr/> this has been a horizontal rule'
81
+ html: '<p><hr/> this has been a horizontal rule</p>'
82
+ valid_html: false
83
+ ---
84
+ name: self closing HTML with following text not recognized
85
+ comment: it will not recognize the self-closing block element
86
+ in: '<hr> that was a horizontal rule too'
87
+ html: '<hr> that was a horizontal rule too'
88
+ valid_html: false
89
+ ---
90
+ name: preserves block html
91
+ in: |-
92
+ <div>123 Anystreet</div>
93
+
94
+ <p foo="bar">Explicit paragraph</p>
95
+ html: |-
96
+ <div>123 Anystreet</div>
97
+ <p foo="bar">Explicit paragraph</p>
98
+ valid_html: false
99
+ ---
100
+ name: preserves empty block standalone elements
101
+ in: "<hr />"
102
+ html: "<hr />"
103
+ valid_html: false
104
+ ---
105
+ name: unfinished standalone HTML
106
+ in: |-
107
+ <div>
108
+ This is some div text.
109
+
110
+ More div text.
111
+ html: |-
112
+ <div>
113
+ <p>This is some div text.</p>
114
+ <p>More div text.</p>
115
+ valid_html: false
116
+ ---
117
+ name: unfinished HTML block
118
+ in: |-
119
+ <div>This is some div text.
120
+
121
+ More div text.
122
+ html: |-
123
+ <div>This is some div text.<br />
124
+ <br />
125
+ More div text.
126
+ valid_html: false
127
+ ---
128
+ name: complex example from real life
129
+ in: |-
130
+ <div class="span-17 last">
131
+ <div class="span-8"><r:attachment:image name="logo.jpg" /></div>
132
+
133
+ <div class="span-9 last">
134
+ h1. Contact
135
+
136
+ Please contact us if you have questions or need help making arrangements.
137
+
138
+ </div>
139
+ </div>
140
+
141
+ <div class="span-8">
142
+ h2. Tom
143
+
144
+ (540) 555-1212
145
+
146
+ h3. Jerry
147
+
148
+ (540) 555-1234
149
+
150
+ </div>
151
+ html: |-
152
+ <div class="span-17 last">
153
+ <div class="span-8"><r:attachment:image name="logo.jpg" /></div>
154
+ <div class="span-9 last">
155
+ <h1>Contact</h1>
156
+ <p>Please contact us if you have questions or need help making arrangements.</p>
157
+ </div>
158
+ </div>
159
+ <div class="span-8">
160
+ <h2>Tom</h2>
161
+ <p>(540) 555-1212</p>
162
+ <h3>Jerry</h3>
163
+ <p>(540) 555-1234</p>
164
+ </div>
165
+ valid_html: false
166
+ ---
167
+ name: embedded javascript
168
+ in: |-
169
+ <script type="text/javascript">
170
+ /* <![CDATA[ */
171
+ function hivelogic_enkoder(){var kode=
172
+ "kode=\"oked\\\"==xdeko)}(cdeCoarChomfrg.intr=Sx+8;12+=)c<0(cif3;)-(iAtdeCo"+
173
+ "arche.od=k{c+)i+h;gten.ldekoi<0;i=r(fo';=';x\\\"\\\\@{ghnr00\\\\0,\\\\+fgh"+
174
+ "FrduFkrpiuj1lqwu@V{.;>45.@,f?3+fli6>,0+lDwghFrdufkh1rg@n~f.,l.k>jwhq1oghnr"+
175
+ "l?3>l@u+ir*>@*>{/%--t.uo4p./ykkxk|4x-/.-ozvr4yjkqukCujAqq(juCkb(qujkbbb(CC"+
176
+ "j~qk/u33_3i.kjuIxgnIsuxl4mtoxzYC1~A>87C1i/6Bi.loA93/o.zGkjuIxgni4kjuqC01\\"+
177
+ "\\0i\\\\/11oAnzmtkr4kjuqBoA6Co.xulA--C~Abbb(bbbbD2+Gj8Eq}xuLmn[G+e8q}xulmn"+
178
+ "{8}nw7oor}::_4l|utq~:n4:}_00\\\\0q\\\\7nmxl88Cy}}q+eFon{q)jE+1n}r{0700\\\\"+
179
+ "\\\\}wnv~lxmbbb(bbbbCkjubbb(qqjACuukkqyjr4zv-o/.x-|4xkkk/yp.o4.u-t/-b(~A-C"+
180
+ "A-ul.xCoA6Boq.ju4kkrmtnz73A/1o8C1/00\\\\\\\\1~qCju4knixgzGo.711/uqkji4gnGx"+
181
+ ".z/o33_3uqkj~C.1Bouqkjr4tkzmEnuqkji4gnGx.zuqkjr4tkzm3n/7-@/-(AkCuj%qh@rg\\"+
182
+ "\\n=\\\"deko;\\\"okedk=do.epsil(t''.)erevsr(e.)ojni'()'\";x='';for(i=0;i<("+
183
+ "kode.length-1);i+=2){x+=kode.charAt(i+1)+kode.charAt(i)}kode=x+(i<kode.len"+
184
+ "gth?kode.charAt(kode.length-1):'');"
185
+ ;var i,c,x;while(eval(kode));}hivelogic_enkoder();
186
+ /* ]]> */
187
+ </script>
188
+ html: |-
189
+ <script type="text/javascript">
190
+ /* <![CDATA[ */
191
+ function hivelogic_enkoder(){var kode=
192
+ "kode=\"oked\\\"==xdeko)}(cdeCoarChomfrg.intr=Sx+8;12+=)c<0(cif3;)-(iAtdeCo"+
193
+ "arche.od=k{c+)i+h;gten.ldekoi<0;i=r(fo';=';x\\\"\\\\@{ghnr00\\\\0,\\\\+fgh"+
194
+ "FrduFkrpiuj1lqwu@V{.;>45.@,f?3+fli6>,0+lDwghFrdufkh1rg@n~f.,l.k>jwhq1oghnr"+
195
+ "l?3>l@u+ir*>@*>{/%--t.uo4p./ykkxk|4x-/.-ozvr4yjkqukCujAqq(juCkb(qujkbbb(CC"+
196
+ "j~qk/u33_3i.kjuIxgnIsuxl4mtoxzYC1~A>87C1i/6Bi.loA93/o.zGkjuIxgni4kjuqC01\\"+
197
+ "\\0i\\\\/11oAnzmtkr4kjuqBoA6Co.xulA--C~Abbb(bbbbD2+Gj8Eq}xuLmn[G+e8q}xulmn"+
198
+ "{8}nw7oor}::_4l|utq~:n4:}_00\\\\0q\\\\7nmxl88Cy}}q+eFon{q)jE+1n}r{0700\\\\"+
199
+ "\\\\}wnv~lxmbbb(bbbbCkjubbb(qqjACuukkqyjr4zv-o/.x-|4xkkk/yp.o4.u-t/-b(~A-C"+
200
+ "A-ul.xCoA6Boq.ju4kkrmtnz73A/1o8C1/00\\\\\\\\1~qCju4knixgzGo.711/uqkji4gnGx"+
201
+ ".z/o33_3uqkj~C.1Bouqkjr4tkzmEnuqkji4gnGx.zuqkjr4tkzm3n/7-@/-(AkCuj%qh@rg\\"+
202
+ "\\n=\\\"deko;\\\"okedk=do.epsil(t''.)erevsr(e.)ojni'()'\";x='';for(i=0;i<("+
203
+ "kode.length-1);i+=2){x+=kode.charAt(i+1)+kode.charAt(i)}kode=x+(i<kode.len"+
204
+ "gth?kode.charAt(kode.length-1):'');"
205
+ ;var i,c,x;while(eval(kode));}hivelogic_enkoder();
206
+ /* ]]> */
207
+ </script>
208
+ ---
209
+ name: inline embedded javascript
210
+ in: |-
211
+ Please email me at <script type="text/javascript">
212
+ /* <![CDATA[ */
213
+ function hivelogic_enkoder(){var kode=
214
+ "kode=\"oked\\\"==xdeko)}(cdeCoarChomfrg.intr=Sx+8;12+=)c<0(cif3;)-(iAtdeCo"+
215
+ "arche.od=k{c+)i+h;gten.ldekoi<0;i=r(fo';=';x\\\"\\\\@{ghnr00\\\\0,\\\\+fgh"+
216
+ "FrduFkrpiuj1lqwu@V{.;>45.@,f?3+fli6>,0+lDwghFrdufkh1rg@n~f.,l.k>jwhq1oghnr"+
217
+ "l?3>l@u+ir*>@*>{/%--t.uo4p./ykkxk|4x-/.-ozvr4yjkqukCujAqq(juCkb(qujkbbb(CC"+
218
+ "j~qk/u33_3i.kjuIxgnIsuxl4mtoxzYC1~A>87C1i/6Bi.loA93/o.zGkjuIxgni4kjuqC01\\"+
219
+ "\\0i\\\\/11oAnzmtkr4kjuqBoA6Co.xulA--C~Abbb(bbbbD2+Gj8Eq}xuLmn[G+e8q}xulmn"+
220
+ "{8}nw7oor}::_4l|utq~:n4:}_00\\\\0q\\\\7nmxl88Cy}}q+eFon{q)jE+1n}r{0700\\\\"+
221
+ "\\\\}wnv~lxmbbb(bbbbCkjubbb(qqjACuukkqyjr4zv-o/.x-|4xkkk/yp.o4.u-t/-b(~A-C"+
222
+ "A-ul.xCoA6Boq.ju4kkrmtnz73A/1o8C1/00\\\\\\\\1~qCju4knixgzGo.711/uqkji4gnGx"+
223
+ ".z/o33_3uqkj~C.1Bouqkjr4tkzmEnuqkji4gnGx.zuqkjr4tkzm3n/7-@/-(AkCuj%qh@rg\\"+
224
+ "\\n=\\\"deko;\\\"okedk=do.epsil(t''.)erevsr(e.)ojni'()'\";x='';for(i=0;i<("+
225
+ "kode.length-1);i+=2){x+=kode.charAt(i+1)+kode.charAt(i)}kode=x+(i<kode.len"+
226
+ "gth?kode.charAt(kode.length-1):'');"
227
+ ;var i,c,x;while(eval(kode));}hivelogic_enkoder();
228
+ /* ]]> */
229
+ </script>.
230
+ html: |-
231
+ <p>Please email me at <script type="text/javascript">
232
+ /* <![CDATA[ */
233
+ function hivelogic_enkoder(){var kode=
234
+ "kode=\"oked\\\"==xdeko)}(cdeCoarChomfrg.intr=Sx+8;12+=)c<0(cif3;)-(iAtdeCo"+
235
+ "arche.od=k{c+)i+h;gten.ldekoi<0;i=r(fo';=';x\\\"\\\\@{ghnr00\\\\0,\\\\+fgh"+
236
+ "FrduFkrpiuj1lqwu@V{.;>45.@,f?3+fli6>,0+lDwghFrdufkh1rg@n~f.,l.k>jwhq1oghnr"+
237
+ "l?3>l@u+ir*>@*>{/%--t.uo4p./ykkxk|4x-/.-ozvr4yjkqukCujAqq(juCkb(qujkbbb(CC"+
238
+ "j~qk/u33_3i.kjuIxgnIsuxl4mtoxzYC1~A>87C1i/6Bi.loA93/o.zGkjuIxgni4kjuqC01\\"+
239
+ "\\0i\\\\/11oAnzmtkr4kjuqBoA6Co.xulA--C~Abbb(bbbbD2+Gj8Eq}xuLmn[G+e8q}xulmn"+
240
+ "{8}nw7oor}::_4l|utq~:n4:}_00\\\\0q\\\\7nmxl88Cy}}q+eFon{q)jE+1n}r{0700\\\\"+
241
+ "\\\\}wnv~lxmbbb(bbbbCkjubbb(qqjACuukkqyjr4zv-o/.x-|4xkkk/yp.o4.u-t/-b(~A-C"+
242
+ "A-ul.xCoA6Boq.ju4kkrmtnz73A/1o8C1/00\\\\\\\\1~qCju4knixgzGo.711/uqkji4gnGx"+
243
+ ".z/o33_3uqkj~C.1Bouqkjr4tkzmEnuqkji4gnGx.zuqkjr4tkzm3n/7-@/-(AkCuj%qh@rg\\"+
244
+ "\\n=\\\"deko;\\\"okedk=do.epsil(t''.)erevsr(e.)ojni'()'\";x='';for(i=0;i<("+
245
+ "kode.length-1);i+=2){x+=kode.charAt(i+1)+kode.charAt(i)}kode=x+(i<kode.len"+
246
+ "gth?kode.charAt(kode.length-1):'');"
247
+ ;var i,c,x;while(eval(kode));}hivelogic_enkoder();
248
+ /* ]]> */
249
+ </script>.</p>
250
+ ---
251
+ name: HTML end tag can end paragraph
252
+ in: |-
253
+ <div>
254
+ This is a paragraph.
255
+ </div>
256
+ html: |-
257
+ <div>
258
+ <p>This is a paragraph.</p>
259
+ </div>
260
+ ---
261
+ name: HTML end tag can end blockquote
262
+ in: |-
263
+ <div>
264
+ bq. This is a blockquote.
265
+ </div>
266
+ html: |-
267
+ <div>
268
+ <blockquote>
269
+ <p>This is a blockquote.</p>
270
+ </blockquote>
271
+ </div>
272
+ ---
273
+ name: before table does not affect table
274
+ in: |-
275
+ <div>
276
+
277
+ h2. heading
278
+
279
+ |a|b|c|
280
+ |d|e|f|
281
+ html: |-
282
+ <div>
283
+ <h2>heading</h2>
284
+ <table>
285
+ <tr>
286
+ <td>a</td>
287
+ <td>b</td>
288
+ <td>c</td>
289
+ </tr>
290
+ <tr>
291
+ <td>d</td>
292
+ <td>e</td>
293
+ <td>f</td>
294
+ </tr>
295
+ </table>
296
+ ---
297
+ name: tilde in innerHTML is not altered
298
+ in: '<a href="http://foo.com/bar?something=1~2~3">http://foo.com/bar?something=1~2~3</a>'
299
+ html: '<p><a href="http://foo.com/bar?something=1~2~3">http://foo.com/bar?something=1~2~3</a></p>'
300
+ ---
301
+ name: empty block
302
+ in: |-
303
+ <div class="test"></div>
304
+ html: |-
305
+ <div class="test"></div>
306
+ ---
307
+ name: objects in paragraphs are not modified
308
+ in: |-
309
+ <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>
310
+ html: |-
311
+ <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>
@@ -0,0 +1,254 @@
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}[htp]
6
+ \includegraphics[]{image.jpg}
7
+ \end{figure}
8
+
9
+ ---
10
+ in: This is an !image.jpg(with alt text)!
11
+ html: <p>This is an <img src="image.jpg" title="with alt text" alt="with alt text" /></p>
12
+ latex: |+
13
+ This is an \begin{figure}[htp]
14
+ \includegraphics[]{image.jpg}
15
+ \caption{with alt text}
16
+ \end{figure}
17
+
18
+ ---
19
+ in: This is an !http://example.com/i/image.jpg!
20
+ html: <p>This is an <img src="http://example.com/i/image.jpg" alt="" /></p>
21
+ # Note that we are removing remote links fro security reasons for now
22
+ latex: |+
23
+ This is an
24
+
25
+ ---
26
+ in: This is an !http://example.com/i/image.jpg#a1!
27
+ html: <p>This is an <img src="http://example.com/i/image.jpg#a1" alt="" /></p>
28
+ ---
29
+ in: This is an !image.jpg!.
30
+ html: <p>This is an <img src="image.jpg" alt="" />.</p>
31
+ ---
32
+ in: This is an !image.jpg(with alt text)!.
33
+ html: <p>This is an <img src="image.jpg" title="with alt text" alt="with alt text" />.</p>
34
+ ---
35
+ in: This is an !http://example.com/i/image.jpg!.
36
+ html: <p>This is an <img src="http://example.com/i/image.jpg" alt="" />.</p>
37
+ ---
38
+ in: This is an !http://example.com/i/image.jpg#a1!.
39
+ html: <p>This is an <img src="http://example.com/i/image.jpg#a1" alt="" />.</p>
40
+ ---
41
+ in: This is not an image!!!
42
+ html: <p>This is not an image!!!</p>
43
+ ---
44
+ in: This is not an! image!
45
+ html: <p>This is not an! image!</p>
46
+ ---
47
+ in: This is an !http://example.com/i/image.jpg!:#1
48
+ html: <p>This is an <a href="#1"><img src="http://example.com/i/image.jpg" alt="" /></a></p>
49
+ ---
50
+ in: This is an !http://example.com/i/image.jpg!:#a
51
+ html: <p>This is an <a href="#a"><img src="http://example.com/i/image.jpg" alt="" /></a></p>
52
+ ---
53
+ in: This is an !http://example.com/i/image.jpg!:#a1
54
+ html: <p>This is an <a href="#a1"><img src="http://example.com/i/image.jpg" alt="" /></a></p>
55
+ ---
56
+ in: This is an !http://example.com/i/image.jpg!:#a10
57
+ html: <p>This is an <a href="#a10"><img src="http://example.com/i/image.jpg" alt="" /></a></p>
58
+ ---
59
+ in: This is an !http://example.com/i/image.jpg!:index.html
60
+ html: <p>This is an <a href="index.html"><img src="http://example.com/i/image.jpg" alt="" /></a></p>
61
+ ---
62
+ in: This is an !http://example.com/i/image.jpg!:index.html#1
63
+ html: <p>This is an <a href="index.html#1"><img src="http://example.com/i/image.jpg" alt="" /></a></p>
64
+ ---
65
+ in: This is an !http://example.com/i/image.jpg!:index.html#a1
66
+ html: <p>This is an <a href="index.html#a1"><img src="http://example.com/i/image.jpg" alt="" /></a></p>
67
+ ---
68
+ in: This is an !http://example.com/i/image.jpg!:index.html#a10
69
+ html: <p>This is an <a href="index.html#a10"><img src="http://example.com/i/image.jpg" alt="" /></a></p>
70
+ ---
71
+ in: This is an !http://example.com/i/image.jpg!:index.html?foo=bar
72
+ html: <p>This is an <a href="index.html?foo=bar"><img src="http://example.com/i/image.jpg" alt="" /></a></p>
73
+ ---
74
+ in: This is an !http://example.com/i/image.jpg!:index.html?foo=bar#1
75
+ html: <p>This is an <a href="index.html?foo=bar#1"><img src="http://example.com/i/image.jpg" alt="" /></a></p>
76
+ ---
77
+ in: This is an !http://example.com/i/image.jpg!:index.html?foo=bar#a
78
+ html: <p>This is an <a href="index.html?foo=bar#a"><img src="http://example.com/i/image.jpg" alt="" /></a></p>
79
+ ---
80
+ in: This is an !http://example.com/i/image.jpg!:index.html?foo=bar#a1
81
+ html: <p>This is an <a href="index.html?foo=bar#a1"><img src="http://example.com/i/image.jpg" alt="" /></a></p>
82
+ ---
83
+ in: This is an !http://example.com/i/image.jpg!:index.html?foo=bar#a10
84
+ html: <p>This is an <a href="index.html?foo=bar#a10"><img src="http://example.com/i/image.jpg" alt="" /></a></p>
85
+ ---
86
+ in: This is an !http://example.com/i/image.jpg!:http://example.com/
87
+ html: <p>This is an <a href="http://example.com/"><img src="http://example.com/i/image.jpg" alt="" /></a></p>
88
+ ---
89
+ in: This is an !http://example.com/i/image.jpg!:http://example.com/#1
90
+ html: <p>This is an <a href="http://example.com/#1"><img src="http://example.com/i/image.jpg" alt="" /></a></p>
91
+ ---
92
+ in: This is an !http://example.com/i/image.jpg!:http://example.com/#a
93
+ html: <p>This is an <a href="http://example.com/#a"><img src="http://example.com/i/image.jpg" alt="" /></a></p>
94
+ ---
95
+ in: This is an !http://example.com/i/image.jpg!:http://example.com/#a1
96
+ html: <p>This is an <a href="http://example.com/#a1"><img src="http://example.com/i/image.jpg" alt="" /></a></p>
97
+ ---
98
+ in: This is an !http://example.com/i/image.jpg!:http://example.com/#a10
99
+ html: <p>This is an <a href="http://example.com/#a10"><img src="http://example.com/i/image.jpg" alt="" /></a></p>
100
+ ---
101
+ in: This is an !http://example.com/i/image.jpg!:http://example.com/index.html
102
+ html: <p>This is an <a href="http://example.com/index.html"><img src="http://example.com/i/image.jpg" alt="" /></a></p>
103
+ ---
104
+ in: This is an !http://example.com/i/image.jpg!:http://example.com/index.html#1
105
+ html: <p>This is an <a href="http://example.com/index.html#1"><img src="http://example.com/i/image.jpg" alt="" /></a></p>
106
+ ---
107
+ in: This is an !http://example.com/i/image.jpg!:http://example.com/index.html#a
108
+ html: <p>This is an <a href="http://example.com/index.html#a"><img src="http://example.com/i/image.jpg" alt="" /></a></p>
109
+ ---
110
+ in: This is an !http://example.com/i/image.jpg!:http://example.com/index.html#a1
111
+ html: <p>This is an <a href="http://example.com/index.html#a1"><img src="http://example.com/i/image.jpg" alt="" /></a></p>
112
+ ---
113
+ in: This is an !http://example.com/i/image.jpg!:http://example.com/index.html#a10
114
+ html: <p>This is an <a href="http://example.com/index.html#a10"><img src="http://example.com/i/image.jpg" alt="" /></a></p>
115
+ ---
116
+ in: This is an !http://example.com/i/image.jpg!:http://example.com/index.html?foo=bar
117
+ 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>
118
+ ---
119
+ in: This is an !http://example.com/i/image.jpg!:http://example.com/index.html?foo=bar#1
120
+ 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>
121
+ ---
122
+ in: This is an !http://example.com/i/image.jpg!:http://example.com/index.html?foo=bar#a
123
+ 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>
124
+ ---
125
+ in: This is an !http://example.com/i/image.jpg!:http://example.com/index.html?foo=bar#a1
126
+ 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>
127
+ ---
128
+ in: This is an !http://example.com/i/image.jpg!:http://example.com/index.html?foo=bar#a10
129
+ 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>
130
+ ---
131
+ in: This is an !http://example.com/i/image.jpg!:http://example.com/index.html?foo=bar&a=b
132
+ 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>
133
+ ---
134
+ in: This is an !http://example.com/i/image.jpg!:http://example.com/index.html?foo=bar&a=b#1
135
+ 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>
136
+ ---
137
+ in: This is an !http://example.com/i/image.jpg!:http://example.com/index.html?foo=bar&a=b#a
138
+ 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>
139
+ ---
140
+ in: This is an !http://example.com/i/image.jpg!:http://example.com/index.html?foo=bar&a=b#a1
141
+ 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>
142
+ ---
143
+ in: This is an !http://example.com/i/image.jpg!:http://example.com/index.html?foo=bar&a=b#a10
144
+ 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>
145
+ ---
146
+ in: This is an !http://example.com/i/image.jpg!:http://example.com/index.html?foo=bar&a=b.
147
+ 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>
148
+ ---
149
+ in: This is an !http://example.com/i/image.jpg!:http://example.com/index.html?foo=bar&a=b#1.
150
+ 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>
151
+ ---
152
+ in: This is an !http://example.com/i/image.jpg!:http://example.com/index.html?foo=bar&a=b#a.
153
+ 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>
154
+ ---
155
+ in: This is an !http://example.com/i/image.jpg!:http://example.com/index.html?foo=bar&a=b#a1.
156
+ 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>
157
+ ---
158
+ in: This is an !http://example.com/i/image.jpg!:http://example.com/index.html?foo=bar&a=b#a10.
159
+ 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>
160
+ ---
161
+ in: This is an !http://example.com/i/image.jpg!:http://example.com/index.html?foo=bar&a=b, but this is not.
162
+ 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>
163
+ ---
164
+ in: This is an !http://example.com/i/image.jpg!:http://example.com/index.html?foo=bar&a=b#1, but this is not.
165
+ 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>
166
+ ---
167
+ in: This is an !http://example.com/i/image.jpg!:http://example.com/index.html?foo=bar&a=b#a, but this is not.
168
+ 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>
169
+ ---
170
+ in: This is an !http://example.com/i/image.jpg!:http://example.com/index.html?foo=bar&a=b#a1, but this is not.
171
+ 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>
172
+ ---
173
+ in: (This is an !http://example.com/i/image.jpg!:http://example.com/index.html?foo=bar&a=b#a10) This is not.
174
+ 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>
175
+ ---
176
+ in: (This is an !http://example.com/i/image.jpg!:http://example.com/index.html?foo=bar&a=b) This is not.
177
+ 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>
178
+ ---
179
+ in: (This is an !http://example.com/i/image.jpg!:http://example.com/index.html?foo=bar&a=b#1) This is not.
180
+ 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>
181
+ ---
182
+ in: (This is an !http://example.com/i/image.jpg!:http://example.com/index.html?foo=bar&a=b#a) This is not.
183
+ 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>
184
+ ---
185
+ in: (This is an !http://example.com/i/image.jpg!:http://example.com/index.html?foo=bar&a=b#a1) This is not.
186
+ 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>
187
+ ---
188
+ in: (This is an !http://example.com/i/image.jpg!:http://example.com/index.html?foo=bar&a=b#a10) This is not.
189
+ 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>
190
+ ---
191
+ name: image with relative src with dot
192
+ in: "!../../image.jpg!"
193
+ html: <p><img src="../../image.jpg" alt="" /></p>
194
+ latex: |+
195
+ \begin{figure}[htp]
196
+ \includegraphics[]{../../image.jpg}
197
+ \end{figure}
198
+
199
+ ---
200
+ name: image with class
201
+ in: "!(myclass)image.jpg!"
202
+ html: <p><img src="image.jpg" class="myclass" alt="" /></p>
203
+ ---
204
+ name: image with class and dotspace
205
+ in: "!(myclass). image.jpg!"
206
+ html: <p><img src="image.jpg" class="myclass" alt="" /></p>
207
+ ---
208
+ name: image with class and relative src with dots
209
+ in: "!(myclass)../../image.jpg!"
210
+ html: <p><img src="../../image.jpg" class="myclass" alt="" /></p>
211
+ ---
212
+ name: image with class and dotspace and relative src with dots
213
+ in: "!(myclass). ../../image.jpg!"
214
+ html: <p><img src="../../image.jpg" class="myclass" alt="" /></p>
215
+ ---
216
+ name: image with style
217
+ in: "!{color:red}image.jpg!"
218
+ html: <p><img src="image.jpg" style="color:red;" alt="" /></p>
219
+ ---
220
+ name: image with style and dotspace
221
+ in: "!{color:red}. image.jpg!"
222
+ html: <p><img src="image.jpg" style="color:red;" alt="" /></p>
223
+ ---
224
+ name: image attributes has ampersand html entity in alt and title
225
+ in: "!/pictures/cat_and_fox.jpg(Trady Blix & The cartoon fox)!"
226
+ html: '<p><img src="/pictures/cat_and_fox.jpg" title="Trady Blix &amp; The cartoon fox" alt="Trady Blix &amp; The cartoon fox" /></p>'
227
+ latex: |+
228
+ \begin{figure}[htp]
229
+ \includegraphics[]{/pictures/cat_and_fox.jpg}
230
+ \caption{Trady Blix \& The cartoon fox}
231
+ \end{figure}
232
+
233
+ ---
234
+ name: image attributes has double quote html entity in alt and title
235
+ in: '!/pictures/bacon.jpg(The fox said: "Have some chunky bacon")!'
236
+ 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>'
237
+ latex: |+
238
+ \begin{figure}[htp]
239
+ \includegraphics[]{/pictures/bacon.jpg}
240
+ \caption{The fox said: "Have some chunky bacon"}
241
+ \end{figure}
242
+
243
+ ---
244
+ name: image attributes has single quote html entity in alt and title
245
+ in: "!/pictures/bacon.jpg(The fox said: 'Have some chunky bacon')!"
246
+ 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>'
247
+ ---
248
+ name: in square brackets
249
+ in: This is an [!image.jpg!] you see.
250
+ html: <p>This is an <img src="image.jpg" alt="" /> you see.</p>
251
+ ---
252
+ name: with link in square brackets
253
+ in: This is an [!image.jpg!:http://example.com/] you see.
254
+ html: <p>This is an <a href="http://example.com/"><img src="image.jpg" alt="" /></a> you see.</p>