1use strict;
2use warnings;
3use t::TestTextTrac;
4
5run_tests;
6
7__DATA__
8### h1 test
9--- input
10= heading 1 =
11--- expected
12<h1 id="heading1">heading 1</h1>
13
14### h2 test<
15--- input
16== heading 2 ==
17--- expected
18<h2 id="heading2">heading 2</h2>
19
20### h3 test
21--- input
22=== heading 3 ===
23--- expected
24<h3 id="heading3">heading 3</h3>
25
26### h4 test
27--- input
28==== heading 4 ====
29--- expected
30<h4 id="heading4">heading 4</h4>
31
32### h5 test
33--- input
34===== heading 5 =====
35--- expected
36<h5 id="heading5">heading 5</h5>
37
38### bold test
39--- input
40'''bold''' '''bold'''
41--- expected
42<p>
43<strong>bold</strong> <strong>bold</strong>
44</p>
45
46### italic test
47--- input
48''italic'' ''italic''
49--- expected
50<p>
51<i>italic</i> <i>italic</i>
52</p>
53
54### bolditalic test
55--- input
56'''''bolditalic''''' '''''bolditalic'''''
57--- expected
58<p>
59<strong><i>bolditalic</i></strong> <strong><i>bolditalic</i></strong>
60</p>
61
62### underline test
63--- input
64__underline__ __underline__
65--- expected
66<p>
67<span class="underline">underline</span> <span class="underline">underline</span>
68</p>
69
70### monospace test
71--- input
72`monospace` {{{monospace}}}
73--- expected
74<p>
75<tt>monospace</tt> <tt>monospace</tt>
76</p>
77
78### strike test
79--- input
80~~strike~~ ~~strike~~
81--- expected
82<p>
83<del>strike</del> <del>strike</del>
84</p>
85
86### sup test
87--- input
88^sup^ ^sup^
89--- expected
90<p>
91<sup>sup</sup> <sup>sup</sup>
92</p>
93
94### sub test
95--- input
96,,sub,, ,,sub,,
97--- expected
98<p>
99<sub>sub</sub> <sub>sub</sub>
100</p>
101
102### br test
103--- input
104line1[[BR]]line2
105--- expected
106<p>
107line1<br />line2
108</p>
109
110### p test
111--- input
112test
113test
114--- expected
115<p>
116test
117test
118</p>
119
120### ul test
121--- input
122 * list 1-1
123 * list 1-2
124   * list 2-1
125   * list 2-2
126--- expected
127<ul><li>list 1-1
128</li><li>list 1-2
129<ul><li>list 2-1
130</li><li>list 2-2</li></ul></li></ul>
131
132### ol test
133--- input
134 1. list 1-1
135 1. list 1-2
136   a. list a-1
137   a. list a-2
138--- expected
139<ol><li>list 1-1
140</li><li>list 1-2
141<ol class="loweralpha"><li>list a-1
142</li><li>list a-2</li></ol></li></ol>
143
144### blockquote test
145--- input
146  This text is a quote from someone else.
147--- expected
148<blockquote>
149<p>
150  This text is a quote from someone else.
151</p>
152</blockquote>
153
154### blockquote2 test
155--- input
156  Ask not what your country can do for you. Ask what you can do for your country.
157
158  --John F. Kennedy
159--- expected
160<blockquote>
161<p>
162  Ask not what your country can do for you. Ask what you can do for your country.
163</p>
164<p>
165  --John F. Kennedy
166</p>
167</blockquote>
168
169### pre test
170--- input
171{{{
172  This is pre-formatted text.
173  This also pre-formatted text.
174}}}
175--- expected
176<pre class="wiki">
177  This is pre-formatted text.
178  This also pre-formatted text.
179</pre>
180
181### table test
182--- input
183||Cell 1||Cell 2||Cell 3||
184||Cell 4||Cell 5||Cell 6||
185--- expected
186<table>
187<tr><td>Cell 1</td><td>Cell 2</td><td>Cell 3</td></tr>
188<tr><td>Cell 4</td><td>Cell 5</td><td>Cell 6</td></tr>
189</table>
190
191### hr test
192--- input
193line1
194----
195line2
196--- expected
197<p>
198line1
199</p>
200<hr />
201<p>
202line2
203</p>
204
205### dl test
206--- input
207 title1::
208  content 1-1
209  content 1-2
210 title2::
211  content 2-1
212  content 2-2
213  content 2-3
214--- expected
215<dl>
216<dt>title1</dt>
217<dd>
218content 1-1
219content 1-2
220</dd>
221<dt>title2</dt>
222<dd>
223content 2-1
224content 2-2
225content 2-3
226</dd>
227</dl>
228
229### autolink test
230--- input
231http://mizzy.org/
232[http://mizzy.org/ Title]
233--- expected
234<p>
235<a class="ext-link" href="http://mizzy.org/"><span class="icon"></span>http://mizzy.org/</a>
236<a class="ext-link" href="http://mizzy.org/"><span class="icon"></span>Title</a>
237</p>
238
239### auto image link test
240--- input
241http://mizzy.org/test.png
242[http://mizzy.org/test.png Image]
243--- expected
244<p>
245<a class="ext-link" href="http://mizzy.org/test.png"><span class="icon"></span>http://mizzy.org/test.png</a>
246<a class="ext-link" href="http://mizzy.org/test.png"><span class="icon"></span>Image</a>
247</p>
248
249### ul node with single space
250--- input
251 * indent with
252 * single space
253   * sublist with
254   * two spaces
255--- expected
256<ul><li>indent with
257</li><li>single space
258<ul><li>sublist with
259</li><li>two spaces</li></ul></li></ul>
260
261### ul node with double space
262--- input
263  * indent with
264  * two spaces
265    * sublist with
266    * two spaces
267--- expected
268<ul><li>indent with
269</li><li>two spaces
270<ul><li>sublist with
271</li><li>two spaces</li></ul></li></ul>
272
273### ol node with single space
274--- input
275 1. indent with
276 1. single space
277   a. sublist with
278   a. two spaces
279--- expected
280<ol><li>indent with
281</li><li>single space
282<ol class="loweralpha"><li>sublist with
283</li><li>two spaces</li></ol></li></ol>
284
285### ol node with double space
286--- input
287  1. indent with
288  1. two spaces
289    a. sublist with
290    a. two spaces
291--- expected
292<ol><li>indent with
293</li><li>two spaces
294<ol class="loweralpha"><li>sublist with
295</li><li>two spaces</li></ol></li></ol>
296
297### dl node with single space
298--- input
299 title1::
300   indent title
301   single space
302 title2::
303   indent content
304   double space
305--- expected
306<dl>
307<dt>title1</dt>
308<dd>
309indent title
310single space
311</dd>
312<dt>title2</dt>
313<dd>
314indent content
315double space
316</dd>
317</dl>
318
319### dl node with double space
320--- input
321  title1::
322    indent title
323    double space
324  title2::
325    indent content
326    double space
327--- expected
328<dl>
329<dt>title1</dt>
330<dd>
331indent title
332double space
333</dd>
334<dt>title2</dt>
335<dd>
336indent content
337double space
338</dd>
339</dl>
340
341### unknown short link
342--- input
343unknown:target
344--- expected
345<p>
346unknown:target
347</p>
348
349### unknown long link
350--- input
351[unknown:target label]
352--- expected
353<p>
354[unknown:target label]
355</p>
356
357### escape HTML meta-characters
358--- input
359foo <bar> baz.
360foo '''bar''' baz.
361
362 * foo <bar> bar.
363 * foo '''bar''' baz.
364
365 1. foo <bar> bar.
366 1. foo '''bar''' baz.
367
368||foo||<bar>||'''baz'''||
369
370{{{
371foo <bar> baz.
372foo '''bar''' baz.
373}}}
374--- expected
375<p>
376foo &lt;bar&gt; baz.
377foo <strong>bar</strong> baz.
378</p>
379<ul><li>foo &lt;bar&gt; bar.
380</li><li>foo <strong>bar</strong> baz.</li></ul>
381<ol><li>foo &lt;bar&gt; bar.
382</li><li>foo <strong>bar</strong> baz.</li></ol>
383<table>
384<tr><td>foo</td><td>&lt;bar&gt;</td><td><strong>baz</strong></td></tr>
385</table>
386<pre class="wiki">
387foo &lt;bar&gt; baz.
388foo '''bar''' baz.
389</pre>
390
391### citation link
392--- input
393>> Someone's original text
394>> Someone's original text
395>> Someone's original text
396> Someone else's reply text
397> Someone else's reply text
398My reply text
399
400>> Someone's original text
401My reply text
402--- expected
403<blockquote class="citation">
404<blockquote class="citation">
405<p>
406 Someone's original text
407 Someone's original text
408 Someone's original text
409</p>
410</blockquote>
411<p>
412 Someone else's reply text
413 Someone else's reply text
414</p>
415</blockquote>
416<p>
417My reply text
418</p>
419<blockquote class="citation">
420<blockquote class="citation">
421<p>
422 Someone's original text
423</p>
424</blockquote>
425</blockquote>
426<p>
427My reply text
428</p>
429
430#### List item
431#--- input
432#* First
433#* Second
434#--- expected
435#<ul>
436#  <li>First</li>
437#  <li>Second</li>
438#</ul>
439#
440#### Image
441#--- input
442#[[Image(cool_diff_box.png)]]
443#--- expected
444#<img src="cool_diff_box.png" />
445