RedCloth 3.0.4 → 4.0.0

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 (63) hide show
  1. data/CHANGELOG +17 -0
  2. data/COPYING +18 -0
  3. data/README +156 -0
  4. data/Rakefile +238 -0
  5. data/bin/redcloth +27 -2
  6. data/ext/redcloth_scan/extconf.rb +9 -0
  7. data/ext/redcloth_scan/redcloth.h +149 -0
  8. data/ext/redcloth_scan/redcloth_attributes.c +650 -0
  9. data/ext/redcloth_scan/redcloth_attributes.rl +78 -0
  10. data/ext/redcloth_scan/redcloth_common.rl +113 -0
  11. data/ext/redcloth_scan/redcloth_inline.c +5102 -0
  12. data/ext/redcloth_scan/redcloth_inline.rl +282 -0
  13. data/ext/redcloth_scan/redcloth_scan.c +9300 -0
  14. data/ext/redcloth_scan/redcloth_scan.rl +523 -0
  15. data/extras/mingw-rbconfig.rb +176 -0
  16. data/extras/ragel_profiler.rb +73 -0
  17. data/lib/redcloth.rb +22 -1128
  18. data/lib/redcloth/formatters/base.rb +50 -0
  19. data/lib/redcloth/formatters/html.rb +342 -0
  20. data/lib/redcloth/formatters/latex.rb +227 -0
  21. data/lib/redcloth/formatters/latex_entities.yml +2414 -0
  22. data/lib/redcloth/textile_doc.rb +105 -0
  23. data/lib/redcloth/version.rb +18 -0
  24. data/test/basic.yml +794 -0
  25. data/test/code.yml +195 -0
  26. data/test/definitions.yml +71 -0
  27. data/test/extra_whitespace.yml +64 -0
  28. data/test/filter_html.yml +177 -0
  29. data/test/filter_pba.yml +12 -0
  30. data/test/helper.rb +108 -0
  31. data/test/html.yml +271 -0
  32. data/test/images.yml +202 -0
  33. data/{tests → test}/instiki.yml +14 -15
  34. data/test/links.yml +214 -0
  35. data/test/lists.yml +283 -0
  36. data/test/poignant.yml +89 -0
  37. data/test/sanitize_html.yml +42 -0
  38. data/test/table.yml +267 -0
  39. data/test/test_custom_tags.rb +46 -0
  40. data/test/test_extensions.rb +31 -0
  41. data/test/test_formatters.rb +15 -0
  42. data/test/test_parser.rb +68 -0
  43. data/test/test_restrictions.rb +41 -0
  44. data/test/textism.yml +480 -0
  45. data/test/threshold.yml +772 -0
  46. data/test/validate_fixtures.rb +73 -0
  47. metadata +94 -60
  48. data/doc/CHANGELOG +0 -160
  49. data/doc/COPYING +0 -25
  50. data/doc/README +0 -106
  51. data/doc/REFERENCE +0 -216
  52. data/doc/make.rb +0 -359
  53. data/run-tests.rb +0 -28
  54. data/setup.rb +0 -1376
  55. data/tests/code.yml +0 -105
  56. data/tests/hard_breaks.yml +0 -26
  57. data/tests/images.yml +0 -171
  58. data/tests/links.yml +0 -155
  59. data/tests/lists.yml +0 -77
  60. data/tests/markdown.yml +0 -218
  61. data/tests/poignant.yml +0 -64
  62. data/tests/table.yml +0 -198
  63. data/tests/textism.yml +0 -406
@@ -0,0 +1,12 @@
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>"
@@ -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,271 @@
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>
@@ -0,0 +1,202 @@
1
+ ---
2
+ in: This is an !image.jpg!
3
+ html: <p>This is an <img src="image.jpg" alt="" /></p>
4
+ ---
5
+ in: This is an !image.jpg(with alt text)!
6
+ html: <p>This is an <img src="image.jpg" title="with alt text" alt="with alt text" /></p>
7
+ ---
8
+ in: This is an !http://example.com/i/image.jpg!
9
+ html: <p>This is an <img src="http://example.com/i/image.jpg" alt="" /></p>
10
+ ---
11
+ in: This is an !http://example.com/i/image.jpg#a1!
12
+ html: <p>This is an <img src="http://example.com/i/image.jpg#a1" alt="" /></p>
13
+ ---
14
+ in: This is an !image.jpg!.
15
+ html: <p>This is an <img src="image.jpg" alt="" />.</p>
16
+ ---
17
+ in: This is an !image.jpg(with alt text)!.
18
+ html: <p>This is an <img src="image.jpg" title="with alt text" alt="with alt text" />.</p>
19
+ ---
20
+ in: This is an !http://example.com/i/image.jpg!.
21
+ html: <p>This is an <img src="http://example.com/i/image.jpg" alt="" />.</p>
22
+ ---
23
+ in: This is an !http://example.com/i/image.jpg#a1!.
24
+ html: <p>This is an <img src="http://example.com/i/image.jpg#a1" alt="" />.</p>
25
+ ---
26
+ in: This is not an image!!!
27
+ html: <p>This is not an image!!!</p>
28
+ ---
29
+ in: This is not an! image!
30
+ html: <p>This is not an! image!</p>
31
+ ---
32
+ in: This is an !http://example.com/i/image.jpg!:#1
33
+ html: <p>This is an <a href="#1"><img src="http://example.com/i/image.jpg" alt="" /></a></p>
34
+ ---
35
+ in: This is an !http://example.com/i/image.jpg!:#a
36
+ html: <p>This is an <a href="#a"><img src="http://example.com/i/image.jpg" alt="" /></a></p>
37
+ ---
38
+ in: This is an !http://example.com/i/image.jpg!:#a1
39
+ html: <p>This is an <a href="#a1"><img src="http://example.com/i/image.jpg" alt="" /></a></p>
40
+ ---
41
+ in: This is an !http://example.com/i/image.jpg!:#a10
42
+ html: <p>This is an <a href="#a10"><img src="http://example.com/i/image.jpg" alt="" /></a></p>
43
+ ---
44
+ in: This is an !http://example.com/i/image.jpg!:index.html
45
+ html: <p>This is an <a href="index.html"><img src="http://example.com/i/image.jpg" alt="" /></a></p>
46
+ ---
47
+ in: This is an !http://example.com/i/image.jpg!:index.html#1
48
+ html: <p>This is an <a href="index.html#1"><img src="http://example.com/i/image.jpg" alt="" /></a></p>
49
+ ---
50
+ in: This is an !http://example.com/i/image.jpg!:index.html#a1
51
+ html: <p>This is an <a href="index.html#a1"><img src="http://example.com/i/image.jpg" alt="" /></a></p>
52
+ ---
53
+ in: This is an !http://example.com/i/image.jpg!:index.html#a10
54
+ html: <p>This is an <a href="index.html#a10"><img src="http://example.com/i/image.jpg" alt="" /></a></p>
55
+ ---
56
+ in: This is an !http://example.com/i/image.jpg!:index.html?foo=bar
57
+ html: <p>This is an <a href="index.html?foo=bar"><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?foo=bar#1
60
+ html: <p>This is an <a href="index.html?foo=bar#1"><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?foo=bar#a
63
+ html: <p>This is an <a href="index.html?foo=bar#a"><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?foo=bar#a1
66
+ html: <p>This is an <a href="index.html?foo=bar#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?foo=bar#a10
69
+ html: <p>This is an <a href="index.html?foo=bar#a10"><img src="http://example.com/i/image.jpg" alt="" /></a></p>
70
+ ---
71
+ in: This is an !http://example.com/i/image.jpg!:http://example.com/
72
+ html: <p>This is an <a href="http://example.com/"><img src="http://example.com/i/image.jpg" alt="" /></a></p>
73
+ ---
74
+ in: This is an !http://example.com/i/image.jpg!:http://example.com/#1
75
+ html: <p>This is an <a href="http://example.com/#1"><img src="http://example.com/i/image.jpg" alt="" /></a></p>
76
+ ---
77
+ in: This is an !http://example.com/i/image.jpg!:http://example.com/#a
78
+ html: <p>This is an <a href="http://example.com/#a"><img src="http://example.com/i/image.jpg" alt="" /></a></p>
79
+ ---
80
+ in: This is an !http://example.com/i/image.jpg!:http://example.com/#a1
81
+ html: <p>This is an <a href="http://example.com/#a1"><img src="http://example.com/i/image.jpg" alt="" /></a></p>
82
+ ---
83
+ in: This is an !http://example.com/i/image.jpg!:http://example.com/#a10
84
+ html: <p>This is an <a href="http://example.com/#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/index.html
87
+ html: <p>This is an <a href="http://example.com/index.html"><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/index.html#1
90
+ html: <p>This is an <a href="http://example.com/index.html#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/index.html#a
93
+ html: <p>This is an <a href="http://example.com/index.html#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/index.html#a1
96
+ html: <p>This is an <a href="http://example.com/index.html#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/index.html#a10
99
+ html: <p>This is an <a href="http://example.com/index.html#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?foo=bar
102
+ 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>
103
+ ---
104
+ in: This is an !http://example.com/i/image.jpg!:http://example.com/index.html?foo=bar#1
105
+ 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>
106
+ ---
107
+ in: This is an !http://example.com/i/image.jpg!:http://example.com/index.html?foo=bar#a
108
+ 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>
109
+ ---
110
+ in: This is an !http://example.com/i/image.jpg!:http://example.com/index.html?foo=bar#a1
111
+ 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>
112
+ ---
113
+ in: This is an !http://example.com/i/image.jpg!:http://example.com/index.html?foo=bar#a10
114
+ 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>
115
+ ---
116
+ in: This is an !http://example.com/i/image.jpg!:http://example.com/index.html?foo=bar&a=b
117
+ 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>
118
+ ---
119
+ in: This is an !http://example.com/i/image.jpg!:http://example.com/index.html?foo=bar&a=b#1
120
+ 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>
121
+ ---
122
+ in: This is an !http://example.com/i/image.jpg!:http://example.com/index.html?foo=bar&a=b#a
123
+ 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>
124
+ ---
125
+ in: This is an !http://example.com/i/image.jpg!:http://example.com/index.html?foo=bar&a=b#a1
126
+ 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>
127
+ ---
128
+ in: This is an !http://example.com/i/image.jpg!:http://example.com/index.html?foo=bar&a=b#a10
129
+ 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>
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, but this is not.
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>, but this is not.</p>
148
+ ---
149
+ in: This is an !http://example.com/i/image.jpg!:http://example.com/index.html?foo=bar&a=b#1, but this is not.
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>, but this is not.</p>
151
+ ---
152
+ in: This is an !http://example.com/i/image.jpg!:http://example.com/index.html?foo=bar&a=b#a, but this is not.
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>, but this is not.</p>
154
+ ---
155
+ in: This is an !http://example.com/i/image.jpg!:http://example.com/index.html?foo=bar&a=b#a1, but this is not.
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>, but this is not.</p>
157
+ ---
158
+ in: (This is an !http://example.com/i/image.jpg!:http://example.com/index.html?foo=bar&a=b#a10) This is not.
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>) This is not.</p>
160
+ ---
161
+ in: (This is an !http://example.com/i/image.jpg!:http://example.com/index.html?foo=bar&a=b) 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>) 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) 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>) 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) 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>) 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) 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>) 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
+ name: image with relative src with dot
177
+ in: "!../../image.jpg!"
178
+ html: <p><img src="../../image.jpg" alt="" /></p>
179
+ ---
180
+ name: image with class
181
+ in: "!(myclass)image.jpg!"
182
+ html: <p><img src="image.jpg" class="myclass" alt="" /></p>
183
+ ---
184
+ name: image with class and dotspace
185
+ in: "!(myclass). image.jpg!"
186
+ html: <p><img src="image.jpg" class="myclass" alt="" /></p>
187
+ ---
188
+ name: image with class and relative src with dots
189
+ in: "!(myclass)../../image.jpg!"
190
+ html: <p><img src="../../image.jpg" class="myclass" alt="" /></p>
191
+ ---
192
+ name: image with class and dotspace and relative src with dots
193
+ in: "!(myclass). ../../image.jpg!"
194
+ html: <p><img src="../../image.jpg" class="myclass" alt="" /></p>
195
+ ---
196
+ name: image with style
197
+ in: "!{color:red}image.jpg!"
198
+ html: <p><img src="image.jpg" style="color:red;" alt="" /></p>
199
+ ---
200
+ name: image with style and dotspace
201
+ in: "!{color:red}. image.jpg!"
202
+ html: <p><img src="image.jpg" style="color:red;" alt="" /></p>