Some [[media:]] link tests
[mediawiki.git] / maintenance / parserTests.txt
blob648ffb7cf49633cca9f92fcd092b5ef254c17c74
1 # MediaWiki Parser test cases
2 # Some taken from http://meta.wikimedia.org/wiki/Parser_testing
3 # All (C) their respective authors and released under the GPL
5 # The syntax should be fairly self-explanatory.
7 # Currently supported test options:
8 #       One of the following three:
10 #       (default)       generate HTML output
11 #       pst             apply pre-save transform
12 #       msg             apply message transform
14 #       Plus any combination of these:
16 #       cat             add category links
17 #       ill             add inter-language links
18 #       subpage         enable subpages (disabled by default)
19 #       title=[[XXX]]   run test using article title XXX
20 #       disabled        do not run test
22 # For testing purposes, temporary articles can created:
23 # !!article / NAMESPACE:TITLE / !!text / ARTICLE TEXT / !!endarticle
24 # where '/' denotes a newline.
26 # This is the standard article assumed to exist.
27 !! article
28 Main Page
29 !! text
30 blah blah
31 !! endarticle
33 ###
34 ### Basic tests
35 ###
36 !! test
37 Blank input
38 !! input
39 !! result
40 !! end
43 !! test
44 Simple paragraph
45 !! input
46 This is a simple paragraph.
47 !! result
48 <p>This is a simple paragraph.
49 </p>
50 !! end
52 !! test
53 Simple list
54 !! input
55 * Item 1
56 * Item 2
57 !! result
58 <ul><li> Item 1
59 </li><li> Item 2
60 </li></ul>
62 !! end
64 !! test
65 Italics and bold
66 !! input
67 * plain
68 * plain''italic''plain
69 * plain''italic''plain''italic''plain
70 * plain'''bold'''plain
71 * plain'''bold'''plain'''bold'''plain
72 * plain''italic''plain'''bold'''plain
73 * plain'''bold'''plain''italic''plain
74 * plain''italic'''bold-italic'''italic''plain
75 * plain'''bold''bold-italic''bold'''plain
76 * plain'''''bold-italic'''italic''plain
77 * plain'''''bold-italic''bold'''plain
78 * plain''italic'''bold-italic'''''plain
79 * plain'''bold''bold-italic'''''plain
80 * plain l'''italic''plain
81 !! result
82 <ul><li> plain
83 </li><li> plain<i>italic</i>plain
84 </li><li> plain<i>italic</i>plain<i>italic</i>plain
85 </li><li> plain<b>bold</b>plain
86 </li><li> plain<b>bold</b>plain<b>bold</b>plain
87 </li><li> plain<i>italic</i>plain<b>bold</b>plain
88 </li><li> plain<b>bold</b>plain<i>italic</i>plain
89 </li><li> plain<i>italic<b>bold-italic</b>italic</i>plain
90 </li><li> plain<b>bold<i>bold-italic</i>bold</b>plain
91 </li><li> plain<i><b>bold-italic</b>italic</i>plain
92 </li><li> plain<b><i>bold-italic</i>bold</b>plain
93 </li><li> plain<i>italic<b>bold-italic</b></i>plain
94 </li><li> plain<b>bold<i>bold-italic</i></b>plain
95 </li><li> plain l'<i>italic</i>plain
96 </li></ul>
98 !! end
101 ### <nowiki> test cases
104 !! test
105 <nowiki> unordered list
106 !! input
107 <nowiki>* This is not an unordered list item.</nowiki>
108 !! result
109 <p>* This is not an unordered list item.
110 </p>
111 !! end
113 !! test
114 <nowiki> spacing
115 !! input
116 <nowiki>Lorem ipsum dolor
118 sed abit.
119   sed nullum.
121 :and a colon
122 </nowiki>
123 !! result
124 <p>Lorem ipsum dolor
126 sed abit.
127   sed nullum.
129 :and a colon
131 </p>
132 !! end
134 !! test
135 nowiki 3
136 !! input
137 :There is not nowiki.
138 :There is <nowiki>nowiki</nowiki>.
140 #There is not nowiki.
141 #There is <nowiki>nowiki</nowiki>.
143 *There is not nowiki.
144 *There is <nowiki>nowiki</nowiki>.
145 !! result
146 <dl><dd>There is not nowiki.
147 </dd><dd>There is nowiki.
148 </dd></dl>
149 <ol><li>There is not nowiki.
150 </li><li>There is nowiki.
151 </li></ol>
152 <ul><li>There is not nowiki.
153 </li><li>There is nowiki.
154 </li></ul>
156 !! end
159 ### comment test cases
161 !! test
162 Comment test 1
163 !! input
164 <!-- comment 1 --> asdf
165 <!-- comment 2 -->
166 !! result
167 <pre>asdf
168 </pre>
170 !! end
172 !! test
173 Comment test 2
174 !! input
175 asdf
176 <!-- comment 1 -->
178 !! result
179 <p>asdf
181 </p>
182 !! end
184 !! test
185 Comment test 3
186 !! input
187 asdf
188 <!-- comment 1 -->
189 <!-- comment 2 -->
191 !! result
192 <p>asdf
194 </p>
195 !! end
197 !! test
198 Comment test 4
199 !! input
200 asdf<!-- comment 1 -->jkl
201 !! result
202 <p>asdfjkl
203 </p>
204 !! end
206 !! test
207 Comment spacing
208 !! input
210  <!-- foo --> b <!-- bar -->
212 !! result
213 <p>a
214 </p>
215 <pre> b 
216 </pre>
217 <p>c
218 </p>
219 !! end
222 ### Preformatted text
224 !! test
225 Preformatted text
226 !! input
227  This is some
228  Preformatted text
229  With ''italic''
230  And '''bold'''
231  And a [[Main Page|link]]
232 !! result
233 <pre>This is some
234 Preformatted text
235 With <i>italic</i>
236 And <b>bold</b>
237 And a <a href="/wiki/Main_Page" title="Main Page">link</a>
238 </pre>
239 !! end
242 ### Definition list
244 !! test
245 Simple definition
246 !! input
247 ; name : Definition
248 !! result
249 <dl><dt> name&nbsp;</dt><dd> Definition
250 </dd></dl>
252 !! end
254 !! test
255 Simple definition
256 !! input
257 : Indented text
258 !! result
259 <dl><dd> Indented text
260 </dd></dl>
262 !! end
264 !! test
265 Definition list with no space
266 !! input
267 ;name:Definition
268 !! result
269 <dl><dt>name</dt><dd>Definition
270 </dd></dl>
272 !!end
274 !! test
275 Definition list with URL link
276 !! input
277 ; http://example.com/ : definition
278 !! result
279 <dl><dt> <a href="http://example.com/" class='external free' rel="nofollow">http://example.com/</a>&nbsp;</dt><dd> definition
280 </dd></dl>
282 !! end
284 !! test
285 Definition list with bracketed URL link
286 !! input
287 ;[http://www.google.com/ Google]:Number one search engine
288 !! result
289 <dl><dt><a href="http://www.google.com/" class='external text' title="http://www.google.com/" rel="nofollow">Google</a></dt><dd>Number one search engine
290 </dd></dl>
292 !! end
294 !! test
295 Definition list with wikilink containing colon
296 !! input
297 ; [[Wikipedia:FAQ]]: The least-read page on Wikipedia
298 !! result
299 <dl><dt> <a href="http://en.wikipedia.org/wiki/FAQ" class='extiw'>Wikipedia:FAQ</a></dt><dd> The least-read page on Wikipedia
300 </dd></dl>
302 !! end
304 # At Brion's and JeLuF's insistence... :)
305 !! test
306 Definition list with wikilink containing colon
307 !! input
308 ;  news:alt.wikipedia.rox: This isn't even a real newsgroup!
309 !! result
310 <dl><dt>  <a href="news:alt.wikipedia.rox" class='external free' rel="nofollow">news:alt.wikipedia.rox</a></dt><dd> This isn't even a real newsgroup!
311 </dd></dl>
313 !! end
315 !! test
316 Malformed definition list with colon
317 !! input
318 ;  news:alt.wikipedia.rox -- don't crash or enter an infinite loop
319 !! result
320 <dl><dt>  <a href="news:alt.wikipedia.rox" class='external free' rel="nofollow">news:alt.wikipedia.rox</a> -- don't crash or enter an infinite loop
321 </dt></dl>
323 !! end
325 !! test
326 Definition lists: colon in external link text
327 !! input
328 ; [http://www.wikipedia2.org/ Wikipedia : The Next Generation]: OK, I made that up
329 !! result
330 <dl><dt> <a href="http://www.wikipedia2.org/" class='external text' title="http://www.wikipedia2.org/" rel="nofollow">Wikipedia&nbsp;: The Next Generation</a></dt><dd> OK, I made that up
331 </dd></dl>
333 !! end
337 ### External links
339 !! test
340 External links: non-bracketed
341 !! input
342 Non-bracketed: http://example.com
343 !! result
344 <p>Non-bracketed: <a href="http://example.com" class='external free' rel="nofollow">http://example.com</a>
345 </p>
346 !! end
348 !! test
349 External links: numbered
350 !! input
351 Numbered: [http://example.com]
352 !! result
353 <p>Numbered: <a href="http://example.com" class='external autonumber' title="http://example.com" rel="nofollow">[1]</a>
354 </p>
355 !!end
357 !! test
358 External links: specified text
359 !! input
360 Specified text: [http://example.com link]
361 !! result
362 <p>Specified text: <a href="http://example.com" class='external text' title="http://example.com" rel="nofollow">link</a>
363 </p>
364 !!end
366 !! test
367 External links: trail
368 !! input
369 Trail (not sure if this is meant to work): [http://example.com link]s
370 !! result
371 <p>Trail (not sure if this is meant to work): <a href="http://example.com" class='external text' title="http://example.com" rel="nofollow">link</a>s
372 </p>
373 !! end
375 !! test
376 External links: dollar sign in URL
377 !! input
378 http://example.com/1$2345
379 !! result
380 <p><a href="http://example.com/1$2345" class='external free' rel="nofollow">http://example.com/1$2345</a>
381 </p>
382 !! end
384 !! test
385 External links: dollar sign in URL (named)
386 !! input
387 [http://example.com/1$2345]
388 !! result
389 <p><a href="http://example.com/1$2345" class='external autonumber' title="http://example.com/1$2345" rel="nofollow">[1]</a>
390 </p>
391 !!end
393 !! test
394 External image
395 !! input
396 External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
397 !! result
398 <p>External image: <img src="http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" />
399 </p>
400 !! end
402 !! test
403 External image from https
404 !! input
405 External image from https: https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
406 !! result
407 <p>External image from https: <img src="https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" />
408 </p>
409 !! end
411 !! test
412 Link to non-http image, no img tag
413 !! input
414 Link to non-http image, no img tag: ftp://example.com/test.jpg
415 !! result
416 <p>Link to non-http image, no img tag: <a href="ftp://example.com/test.jpg" class='external free' rel="nofollow">ftp://example.com/test.jpg</a>
417 </p>
418 !! end
420 !! test
421 External links: terminating separator
422 !! input
423 Terminating separator: http://example.com/thing,
424 !! result
425 <p>Terminating separator: <a href="http://example.com/thing" class='external free' rel="nofollow">http://example.com/thing</a>,
426 </p>
427 !! end
429 !! test
430 External links: intervening separator
431 !! input
432 Intervening separator: http://example.com/1,2,3
433 !! result
434 <p>Intervening separator: <a href="http://example.com/1,2,3" class='external free' rel="nofollow">http://example.com/1,2,3</a>
435 </p>
436 !! end
438 !! test
439 External links: old bug with URL in query
440 !! input
441 Old bug with URL in query: [http://example.com/thing?url=http://example.com link]
442 !! result
443 <p>Old bug with URL in query: <a href="http://example.com/thing?url=http://example.com" class='external text' title="http://example.com/thing?url=http://example.com" rel="nofollow">link</a>
444 </p>
445 !! end
447 !! test
448 External links: old URL-in-URL bug, mixed protocols
449 !! input
450 And again with mixed protocols: [ftp://example.com?url=http://example.com link]
451 !! result
452 <p>And again with mixed protocols: <a href="ftp://example.com?url=http://example.com" class='external text' title="ftp://example.com?url=http://example.com" rel="nofollow">link</a>
453 </p>
454 !!end
456 !! test
457 External links: URL in text
458 !! input
459 URL in text: [http://example.com http://example.com]
460 !! result
461 <p>URL in text: <a href="http://example.com" class='external free' rel="nofollow">http://example.com</a>
462 </p>
463 !! end
465 !! test
466 External links: Clickable images
467 !! input
468 ja-style clickable images: [http://example.com http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png]
469 !! result
470 <p>ja-style clickable images: <a href="http://example.com" class='external text' title="http://example.com" rel="nofollow"><img src="http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" /></a>
471 </p>
472 !!end
474 !! test
475 External links: raw ampersand
476 !! input
477 Old &amp; use: http://x&y
478 !! result
479 <p>Old &amp; use: <a href="http://x&amp;y" class='external free' rel="nofollow">http://x&amp;y</a>
480 </p>
481 !! end
483 !! test
484 External links: encoded ampersand
485 !! input
486 Old &amp; use: http://x&amp;y
487 !! result
488 <p>Old &amp; use: <a href="http://x&amp;y" class='external free' rel="nofollow">http://x&amp;y</a>
489 </p>
490 !! end
492 !! test
493 External links: [raw ampersand]
494 !! input
495 Old &amp; use: [http://x&y]
496 !! result
497 <p>Old &amp; use: <a href="http://x&amp;y" class='external autonumber' title="http://x&amp;y" rel="nofollow">[1]</a>
498 </p>
499 !! end
501 !! test
502 External links: [encoded ampersand]
503 !! input
504 Old &amp; use: [http://x&amp;y]
505 !! result
506 <p>Old &amp; use: <a href="http://x&amp;y" class='external autonumber' title="http://x&amp;y" rel="nofollow">[1]</a>
507 </p>
508 !! end
510 !! test
511 External links: www.jpeg.org (bug 554)
512 !! input
513 http://www.jpeg.org
514 !!result
515 <p><a href="http://www.jpeg.org" class='external free' rel="nofollow">http://www.jpeg.org</a>
516 </p>
517 !! end
519 !! test
520 External links: URL within URL (original bug 2)
521 !! input
522 [http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp]
523 !! result
524 <p><a href="http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp" class='external autonumber' title="http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp" rel="nofollow">[1]</a>
525 </p>
526 !! end
528 !! test
529 BUG 361: URL inside bracketed URL
530 !! input
531 [http://www.example.com/foo http://www.example.com/bar]
532 !! result
533 <p><a href="http://www.example.com/foo" class='external text' title="http://www.example.com/foo" rel="nofollow">http://www.example.com/bar</a>
534 </p>
535 !! end
537 !! test
538 BUG 289: ">"-token in URL-tail
539 !! input
540 http://www.example.com/<hello>
541 !! result
542 <p><a href="http://www.example.com/" class='external free' rel="nofollow">http://www.example.com/</a>&lt;hello&gt;
543 </p>
544 !!end
546 !! test
547 BUG 289: literal ">"-token in URL-tail
548 !! input
549 http://www.example.com/<b>html</b>
550 !! result
551 <p><a href="http://www.example.com/" class='external free' rel="nofollow">http://www.example.com/</a><b>html</b>
552 </p>
553 !!end
555 !! test
556 BUG 289: ">"-token in bracketed URL
557 !! input
558 [http://www.example.com/<hello> stuff]
559 !! result
560 <p><a href="http://www.example.com/" class='external text' title="http://www.example.com/" rel="nofollow">&lt;hello&gt; stuff</a>
561 </p>
562 !!end
564 !! test
565 BUG 289: literal ">"-token in bracketed URL
566 !! input
567 [http://www.example.com/<b>html</b> stuff]
568 !! result
569 <p><a href="http://www.example.com/" class='external text' title="http://www.example.com/" rel="nofollow"><b>html</b> stuff</a>
570 </p>
571 !!end
573 !! test
574 BUG 289: literal double quote at end of URL
575 !! input
576 http://www.example.com/"hello"
577 !! result
578 <p><a href="http://www.example.com/" class='external free' rel="nofollow">http://www.example.com/</a>"hello"
579 </p>
580 !!end
582 !! test
583 BUG 289: literal double quote in bracketed URL
584 !! input
585 [http://www.example.com/"hello" stuff]
586 !! result
587 <p><a href="http://www.example.com/" class='external text' title="http://www.example.com/" rel="nofollow">"hello" stuff</a>
588 </p>
589 !!end
591 !! test
592 External links: invalid character
593 !! input
594 [http://www.example.com\0 test]
595 !! result
596 <p>[<a href="http://www.example.com" class='external free' rel="nofollow">http://www.example.com</a>\0 test]
597 </p>
598 !! end
601 ### Quotes
604 !! test
605 Quotes
606 !! input
607 Normal text. '''Bold text.''' Normal text. ''Italic text.''
609 Normal text. '''''Bold italic text.''''' Normal text.
610 !!result
611 <p>Normal text. <b>Bold text.</b> Normal text. <i>Italic text.</i>
612 </p><p>Normal text. <i><b>Bold italic text.</b></i> Normal text.
613 </p>
614 !! end
617 !! test
618 Unclosed and unmatched quotes
619 !! input
620 '''''Bold italic text '''with bold deactivated''' in between.'''''
622 '''''Bold italic text ''with italic deactivated'' in between.'''''
624 '''Bold text..
626 ..spanning two paragraphs (should not work).'''
628 '''Bold tag left open
630 ''Italic tag left open
632 Normal text.
634 <!-- Unmatching number of opening, closing tags: -->
635 '''This year''''s election ''should'' beat '''last year''''s.
637 ''Tom'''s car is bigger than ''Susan'''s.
638 !! result
639 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
640 </p><p><b><i>Bold italic text </i>with italic deactivated<i> in between.</i></b>
641 </p><p><b>Bold text..</b>
642 </p><p>..spanning two paragraphs (should not work).<b></b>
643 </p><p><b>Bold tag left open</b>
644 </p><p><i>Italic tag left open</i>
645 </p><p>Normal text.
646 </p><p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
647 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
648 </p>
649 !! end
652 ### Tables
654 ### content taken from http://meta.wikimedia.org/wiki/MediaWiki_User%27s_Guide:_Using_tables
656 !! test
657 Simple table
658 !! input
659 {| 
660 | 1 || 2
661 |- 
662 | 3 || 4
664 !! result
665 <table>
666 <tr>
667 <td> 1 </td><td> 2
668 </td></tr>
669 <tr>
670 <td> 3 </td><td> 4
671 </td></tr></table>
673 !! end
675 !! test
676 Multiplication table
677 !! input
678 {| border="1" cellpadding="2"
679 |+Multiplication table
681 ! &times; !! 1 !! 2 !! 3
683 ! 1
684 | 1 || 2 || 3
686 ! 2
687 | 2 || 4 || 6
689 ! 3
690 | 3 || 6 || 9
692 ! 4
693 | 4 || 8 || 12
695 ! 5
696 | 5 || 10 || 15
698 !! result
699 <table border="1" cellpadding="2">
700 <caption>Multiplication table
701 </caption>
702 <tr>
703 <th> &times; </th><th> 1 </th><th> 2 </th><th> 3
704 </th></tr>
705 <tr>
706 <th> 1
707 </th><td> 1 </td><td> 2 </td><td> 3
708 </td></tr>
709 <tr>
710 <th> 2
711 </th><td> 2 </td><td> 4 </td><td> 6
712 </td></tr>
713 <tr>
714 <th> 3
715 </th><td> 3 </td><td> 6 </td><td> 9
716 </td></tr>
717 <tr>
718 <th> 4
719 </th><td> 4 </td><td> 8 </td><td> 12
720 </td></tr>
721 <tr>
722 <th> 5
723 </th><td> 5 </td><td> 10 </td><td> 15
724 </td></tr></table>
726 !! end
728 !! test
729 Table rowspan
730 !! input
731 {| align=right border=1
732 | Cell 1, row 1 
733 |rowspan=2| Cell 2, row 1 (and 2) 
734 | Cell 3, row 1 
735 |- 
736 | Cell 1, row 2 
737 | Cell 3, row 2 
739 !! result
740 <table align="right" border="1">
741 <tr>
742 <td> Cell 1, row 1
743 </td><td rowspan="2"> Cell 2, row 1 (and 2)
744 </td><td> Cell 3, row 1
745 </td></tr>
746 <tr>
747 <td> Cell 1, row 2
748 </td><td> Cell 3, row 2
749 </td></tr></table>
751 !! end
753 !! test
754 Nested table
755 !! input
756 {| border=1
757 | &alpha;
759 {| bgcolor=#ABCDEF border=2
760 |nested
762 |table
764 |the original table again
766 !! result
767 <table border="1">
768 <tr>
769 <td> &alpha;
770 </td><td>
771 <table bgcolor="#ABCDEF" border="2">
772 <tr>
773 <td>nested
774 </td></tr>
775 <tr>
776 <td>table
777 </td></tr></table>
778 </td><td>the original table again
779 </td></tr></table>
781 !! end
784 ### Internal links
786 !! test
787 Plain link, capitalized
788 !! input
789 [[Main Page]]
790 !! result
791 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
792 </p>
793 !! end
795 !! test
796 Plain link, uncapitalized
797 !! input
798 [[main Page]]
799 !! result
800 <p><a href="/wiki/Main_Page" title="Main Page">main Page</a>
801 </p>
802 !! end
804 !! test
805 Piped link
806 !! input
807 [[Main Page|The Main Page]]
808 !! result
809 <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
810 </p>
811 !! end
813 !! test
814 Broken link
815 !! input
816 [[Zigzagzogzagzig]]
817 !! result
818 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit" class="new" title="Zigzagzogzagzig">Zigzagzogzagzig</a>
819 </p>
820 !! end
822 !! test
823 Link with prefix
824 !! input
825 xxx[[main Page]], xxx[[Main Page]], Xxx[[main Page]] XXX[[main Page]], XXX[[Main Page]]
826 !! result
827 <p>xxx<a href="/wiki/Main_Page" title="Main Page">main Page</a>, xxx<a href="/wiki/Main_Page" title="Main Page">Main Page</a>, Xxx<a href="/wiki/Main_Page" title="Main Page">main Page</a> XXX<a href="/wiki/Main_Page" title="Main Page">main Page</a>, XXX<a href="/wiki/Main_Page" title="Main Page">Main Page</a>
828 </p>
829 !! end
831 !! test
832 Link with suffix
833 !! input
834 [[Main Page]]xxx, [[Main Page]]XXX
835 !! result
836 <p><a href="/wiki/Main_Page" title="Main Page">Main Pagexxx</a>, <a href="/wiki/Main_Page" title="Main Page">Main Page</a>XXX
837 </p>
838 !! end
840 !! test
841 Link with 3 brackets
842 !! input
843 [[[main page]]]
844 !! result
845 <p>[[[main page]]]
846 </p>
847 !! end
849 !! test
850 Piped link with 3 brackets
851 !! input
852 [[[main page|the main page]]]
853 !! result
854 <p>[[[main page|the main page]]]
855 </p>
856 !! end
858 !! test
859 Link to namespaces
860 !! input
861 [[Talk:Parser testing]], [[Meta:Disclaimers]]
862 !! result
863 <p><a href="/index.php?title=Talk:Parser_testing&amp;action=edit" class="new" title="Talk:Parser testing">Talk:Parser testing</a>, <a href="/index.php?title=Meta:Disclaimers&amp;action=edit" class="new" title="Meta:Disclaimers">Meta:Disclaimers</a>
864 </p>
865 !! end
867 !! test
868 Piped link to namespace
869 !! input
870 [[Meta:Disclaimers|The disclaimers]]
871 !! result
872 <p><a href="/index.php?title=Meta:Disclaimers&amp;action=edit" class="new" title="Meta:Disclaimers">The disclaimers</a>
873 </p>
874 !! end
876 !! test
877 Link containing }
878 !! input
879 [[Usually caused by a typo (oops}]]
880 !! result
881 <p>[[Usually caused by a typo (oops}]]
882 </p>
883 !! end
885 !! test
886 Link containing % (not as a hex sequence)
887 !! input
888 [[7% Solution]]
889 !! result
890 <p><a href="/index.php?title=7%25_Solution&amp;action=edit" class="new" title="7% Solution">7% Solution</a>
891 </p>
892 !! end
894 !! test
895 Link containing % as a single hex sequence interpreted to char
896 !! input
897 [[7%25 Solution]]
898 !! result
899 <p><a href="/index.php?title=7%25_Solution&amp;action=edit" class="new" title="7% Solution">7% Solution</a>
900 </p>
901 !!end
903 !! test
904 Link containing % as a double hex sequence interpreted to hex sequence
905 !! input
906 [[7%2525 Solution]]
907 !! result
908 <p>[[7%2525 Solution]]
909 </p>
910 !!end
912 !! test
913 Plain link to URL
914 !! input
915 [[http://www.example.org]]
916 !! result
917 <p>[<a href="http://www.example.org" class='external autonumber' title="http://www.example.org" rel="nofollow">[1]</a>]
918 </p>
919 !! end
921 # I'm fairly sure the expected result here is wrong.
922 # We want these to be URL links, not pseudo-pages with URLs for titles....
923 # However the current output is also pretty screwy.
925 # ----
926 # I'm changing it to match the current output--it arguably makes more
927 # sense in the light of the test above. Old expected result was:
928 #<p>Piped link to URL: <a href="/index.php?title=Http://www.example.org&amp;action=edit" class="new" title="Http://www.example.org">an example URL</a>
929 #</p>
930 # But I think this test is bordering on "garbage in, garbage out" anyway.
931 # -- wtm
932 !! test
933 Piped link to URL
934 !! input
935 Piped link to URL: [[http://www.example.org|an example URL]]
936 !! result
937 <p>Piped link to URL: [<a href="http://www.example.org|an" class='external text' title="http://www.example.org|an" rel="nofollow">example URL</a>]
938 </p>
939 !! end
941 !! test
942 BUG 2: [[page|http://url/]] should link to page, not http://url/
943 !! input
944 [[Main Page|http://url/]]
945 !! result
946 <p><a href="/wiki/Main_Page" title="Main Page">http://url/</a>
947 </p>
948 !! end
950 !! test
951 BUG 337: Escaped self-links should be bold
952 !! options
953 title=[[Bug462]]
954 !! input
955 [[Bu&#103;462]] [[Bug462]]
956 !! result
957 <p><strong>Bu&#103;462</strong> <strong>Bug462</strong>
958 </p>
959 !! end
961 !! test
962 Self-link to section should not be bold
963 !! options
964 title=[[Main Page]]
965 !! input
966 [[Main Page#section]]
967 !! result
968 <p><a href="/wiki/Main_Page#section" title="Main Page">Main Page#section</a>
969 </p>
970 !! end
972 !! test
973 <nowiki> inside a link
974 !! input
975 [[Main<nowiki> Page</nowiki>]] [[Main Page|the main page <nowiki>[it's not very good]</nowiki>]]
976 !! result
977 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a> <a href="/wiki/Main_Page" title="Main Page">the main page [it's not very good]</a>
978 </p>
979 !! end
982 ### Interwiki links
985 !! test
986 Inline interwiki link
987 !! input
988 [[MeatBall:SoftSecurity]]
989 !! result
990 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity" class='extiw'>MeatBall:SoftSecurity</a>
991 </p>
992 !! end
995 ## XHTML tidiness
998 !! test
999 <br> to <br />
1000 !! input
1001 1<br>2<br />3
1002 !! result
1003 <p>1<br />2<br />3
1004 </p>
1005 !! end
1008 ### Block-level elements
1010 !! test
1011 Common list
1012 !! input
1013 *Common list
1014 * item 2
1015 *item 3
1016 !! result
1017 <ul><li>Common list
1018 </li><li> item 2
1019 </li><li>item 3
1020 </li></ul>
1022 !! end
1024 !! test
1025 Numbered list
1026 !! input
1027 #Numbered list
1028 #item 2
1029 # item 3
1030 !! result
1031 <ol><li>Numbered list
1032 </li><li>item 2
1033 </li><li> item 3
1034 </li></ol>
1036 !! end
1038 !! test
1039 Mixed list
1040 !! input
1041 *Mixed list
1042 *# with numbers
1043 ** and bullets
1044 *# and numbers
1045 *bullets again
1046 **bullet level 2
1047 ***bullet level 3
1048 ***#Number on level 4
1049 **bullet level 2
1050 **#Number on level 3
1051 **#Number on level 3
1052 *#number level 2
1053 *Level 1
1054 !! result
1055 <ul><li>Mixed list
1056 <ol><li> with numbers
1057 </li></ol>
1058 <ul><li> and bullets
1059 </li></ul>
1060 <ol><li> and numbers
1061 </li></ol>
1062 </li><li>bullets again
1063 <ul><li>bullet level 2
1064 <ul><li>bullet level 3
1065 <ol><li>Number on level 4
1066 </li></ol>
1067 </li></ul>
1068 </li><li>bullet level 2
1069 <ol><li>Number on level 3
1070 </li><li>Number on level 3
1071 </li></ol>
1072 </li></ul>
1073 <ol><li>number level 2
1074 </li></ol>
1075 </li><li>Level 1
1076 </li></ul>
1078 !! end
1081 ### Magic variables
1083 !! test
1084 Magic variables
1085 !! input
1086 {{SITENAME}}
1087 !! result
1088 <p>MediaWiki
1089 </p>
1090 !! end
1093 ### Magic links
1095 !! test
1096 Magic links: internal link to RFC
1097 !! input
1098 [[RFC 123]]
1099 !! result
1100 <p><a href="/index.php?title=RFC_123&amp;action=edit" class="new" title="RFC 123">RFC 123</a>
1101 </p>
1102 !! end
1104 !! test
1105 Magic links: RFC
1106 !! input
1107 RFC 822
1108 !! result
1109 <p><a href='http://www.faqs.org/rfcs/rfc822.html' class='external' title="http://www.faqs.org/rfcs/rfc822.html">RFC 822</a>
1110 </p>
1111 !! end
1113 !! test
1114 Magic links: ISBN
1115 !! input
1116 ISBN 0-306-40615-2
1117 !! result
1118 <p><a href="/index.php?title=Special:Booksources&amp;isbn=0306406152" class="internal">ISBN 0-306-40615-2</a>
1119 </p>
1120 !! end
1123 ### Templates
1124 ####
1126 !! test
1127 Nonexistant template
1128 !! input
1129 {{thistemplatedoesnotexist}}
1130 !! result
1131 <p><a href="/index.php?title=Template:Thistemplatedoesnotexist&amp;action=edit" class="new" title="Template:Thistemplatedoesnotexist">Template:Thistemplatedoesnotexist</a>
1132 </p>
1133 !! end
1135 !! article
1136 Template:test
1137 !! text
1138 This is a test template
1139 !! endarticle
1141 !! test
1142 Simple template
1143 !! input
1144 {{test}}
1145 !! result
1146 <p>This is a test template
1147 </p>
1148 !! end
1150 !! test
1151 Template with explicit namespace
1152 !! input
1153 {{Template:test}}
1154 !! result
1155 <p>This is a test template
1156 </p>
1157 !! end
1160 !! article
1161 Template:paramtest
1162 !! text
1163 This is a test template with parameter {{{param}}}
1164 !! endarticle
1166 !! test
1167 Template parameter
1168 !! input
1169 {{paramtest|param=foo}}
1170 !! result
1171 <p>This is a test template with parameter foo
1172 </p>
1173 !! end
1175 !! article
1176 Template:paramtestnum
1177 !! text
1178 [[{{{1}}}|{{{2}}}]]
1179 !! endarticle
1181 !! test
1182 Template unnamed parameter
1183 !! input
1184 {{paramtestnum|Main Page|the main page}}
1185 !! result
1186 <p><a href="/wiki/Main_Page" title="Main Page">the main page</a>
1187 </p>
1188 !! end
1190 !! test
1191 BUG 553: link with two variables in a piped link
1192 !! input
1193 {| 
1194 |[[{{{1}}}|{{{2}}}]]
1196 !! result
1197 <table>
1198 <tr>
1199 <td>[[{{{1}}}|{{{2}}}]]
1200 </td></tr></table>
1202 !! end
1204 !! test
1205 Magic variable as template parameter
1206 !! input
1207 {{paramtest|param={{SITENAME}}}}
1208 !! result
1209 <p>This is a test template with parameter MediaWiki
1210 </p>
1211 !! end
1213 !! article
1214 Template:linktest
1215 !! text
1216 [[{{{param}}}|link]]
1217 !! endarticle
1219 !! test
1220 Template parameter as link source
1221 !! input
1222 {{linktest|param=Main Page}}
1223 !! result
1224 <p><a href="/wiki/Main_Page" title="Main Page">link</a>
1225 </p>
1226 !! end
1229 !!article
1230 Template:paramtest2
1231 !! text
1232 including another template, {{paramtest|param={{{arg}}}}}
1233 !! endarticle
1235 !! test
1236 Template passing argument to another template
1237 !! input
1238 {{paramtest2|arg='hmm'}}
1239 !! result
1240 <p>including another template, This is a test template with parameter 'hmm'
1241 </p>
1242 !! end
1244 !! article
1245 Template:Linktest2
1246 !! text
1247 Main Page
1248 !! endarticle
1250 !! test
1251 Template as link source
1252 !! input
1253 [[{{linktest2}}]]
1254 !! result
1255 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
1256 </p>
1257 !! end
1260 !! article
1261 Template:loop1
1262 !! text
1263 {{loop2}}
1264 !! endarticle
1266 !! article
1267 Template:loop2
1268 !! text
1269 {{loop1}}
1270 !! endarticle
1272 !! test
1273 Template infinite loop
1274 !! input
1275 {{loop1}}
1276 !! result
1277 <p>{{loop2}}<!-- WARNING: template loop detected -->
1278 </p>
1279 !! end
1281 !! test
1282 Template from main namespace
1283 !! input
1284 {{:Main Page}}
1285 !! result
1286 <p>blah blah
1287 </p>
1288 !! end
1290 !! article
1291 Template:table
1292 !! text
1293 {| 
1294 | 1 || 2
1295 |- 
1296 | 3 || 4
1298 !! endarticle
1300 !! test
1301 BUG 529: Template with table, not included at beginning of line
1302 !! input
1303 foo {{table}}
1304 !! result
1305 <p>foo 
1306 </p>
1307 <table>
1308 <tr>
1309 <td> 1 </td><td> 2
1310 </td></tr>
1311 <tr>
1312 <td> 3 </td><td> 4
1313 </td></tr></table>
1315 !! end
1317 !! test
1318 BUG 523: Template shouldn't eat newline (or add an extra one before table)
1319 !! input
1321 {{table}}
1322 !! result
1323 <p>foo
1324 </p>
1325 <table>
1326 <tr>
1327 <td> 1 </td><td> 2
1328 </td></tr>
1329 <tr>
1330 <td> 3 </td><td> 4
1331 </td></tr></table>
1333 !! end
1335 !! test
1336 BUG 41: Template parameters shown as broken links
1337 !! input
1338 {{{parameter}}}
1339 !! result
1340 <p>{{{parameter}}}
1341 </p>
1342 !! end
1345 !! article
1346 Template:MSGNW test
1347 !! text
1348 ''None'' of '''this''' should be 
1349 * interepreted
1350  but rather passed unmodified
1351 {{test}}
1352 !! endarticle
1354 # hmm, fix this or just deprecate msgnw and document its behavior?
1355 !! test
1356 msgnw keyword
1357 !! options
1358 disabled
1359 !! input
1360 {{msgnw:MSGNW test}}
1361 !! result
1362 <p>''None'' of '''this''' should be 
1363 * interepreted
1364  but rather passed unmodified
1365 {{test}}
1366 </p>
1367 !! end
1369 !! test
1370 int keyword
1371 !! input
1372 {{int:newmessages|lots of money}}
1373 !! result
1374 <p>You have lots of money.
1375 </p>
1376 !! end
1379 ### Pre-save transform tests
1381 !! test
1382 pre-save transform: subst:
1383 !! options
1385 !! input
1386 {{subst:test}}
1387 !! result
1388 This is a test template
1389 !! end
1391 !! test
1392 pre-save transform: normal template
1393 !! options
1395 !! input
1396 {{test}}
1397 !! result
1398 {{test}}
1399 !! end
1401 !! test
1402 pre-save transform: nonexistant template
1403 !! options
1405 !! input
1406 {{thistemplatedoesnotexist}}
1407 !! result
1408 {{thistemplatedoesnotexist}}
1409 !! end
1412 !! test
1413 pre-save transform: subst magic variables
1414 !! options
1416 !! input
1417 {{subst:SITENAME}}
1418 !! result
1419 MediaWiki
1420 !! end
1422 # This is bug 89, which I fixed. -- wtm
1423 !! test
1424 pre-save transform: subst: templates with parameters
1425 !! options
1427 !! input
1428 {{subst:paramtest|param="something else"}}
1429 !! result
1430 This is a test template with parameter "something else"
1431 !! end
1434 ### Message transform tests
1436 !! test
1437 message transform: magic variables
1438 !! options
1440 !! input
1441 {{SITENAME}}
1442 !! result
1443 MediaWiki
1444 !! end
1446 !! test
1447 message transform: should not transform wiki markup
1448 !! options
1450 !! input
1451 ''test''
1452 !! result
1453 ''test''
1454 !! end
1457 ### Images
1459 !! test
1460 Simple image
1461 !! input
1462 [[Image:foobar.jpg]]
1463 !! result
1464 <p><a href="/wiki/Image:Foobar.jpg" class="image" title="Image:foobar.jpg"><img src="/images/3/3a/Foobar.jpg" alt="Image:foobar.jpg" longdesc="/wiki/Image:Foobar.jpg" /></a>
1465 </p>
1466 !! end
1468 !! test
1469 Right-aligned image
1470 !! input
1471 [[Image:foobar.jpg|right]]
1472 !! result
1473 <div class="floatright"><span><a href="/wiki/Image:Foobar.jpg" class="image" title=""><img src="/images/3/3a/Foobar.jpg" alt="" longdesc="/wiki/Image:Foobar.jpg" /></a></span></div>
1475 !! end
1477 !! test
1478 Image with caption
1479 !! input
1480 [[Image:foobar.jpg|right|Caption text]]
1481 !! result
1482 <div class="floatright"><span><a href="/wiki/Image:Foobar.jpg" class="image" title="Caption text"><img src="/images/3/3a/Foobar.jpg" alt="Caption text" longdesc="/wiki/Image:Foobar.jpg" /></a></span></div>
1484 !! end
1486 !! test
1487 Image with frame and link
1488 !! input
1489 [[Image:Foobar.jpg|frame|left|This is a test image [[Main Page]]]]
1490 !! result
1491 <div class="thumb tleft"><div style="width:202px;"><a href="/wiki/Image:Foobar.jpg" class="internal" title="This is a test image "><img src="/images/3/3a/Foobar.jpg" alt="This is a test image " width="200" height="200" longdesc="/wiki/Image:Foobar.jpg" /></a>  <div class="thumbcaption" >This is a test image <a href="/wiki/Main_Page" title="Main Page">Main Page</a></div></div></div>
1493 !! end
1495 !! test
1496 Link to image page
1497 !! input
1498 [[:Image:test]]
1499 !! result
1500 <p><a href="/wiki/Image:Test" title="Image:Test">Image:test</a>
1501 </p>
1502 !! end
1504 !! test
1505 Frameless image caption with a free URL
1506 !! input
1507 [[Image:foobar.jpg|http://example.com]]
1508 !! result
1509 <p><a href="/wiki/Image:Foobar.jpg" class="image" title="http://example.com"><img src="/images/3/3a/Foobar.jpg" alt="http://example.com" longdesc="/wiki/Image:Foobar.jpg" /></a>
1510 </p>
1511 !! end
1513 !! test
1514 Thumbnail image caption with a free URL
1515 !! input
1516 [[Image:foobar.jpg|thumb|http://example.com]]
1517 !! result
1518 <div class="thumb tright"><div style="width:182px;"><a href="/wiki/Image:Foobar.jpg" class="internal" title="http://example.com"><img src="/images/3/3a/Foobar.jpg" alt="http://example.com" width="180" height="180" longdesc="/wiki/Image:Foobar.jpg" /></a>  <div class="thumbcaption" ><div class="magnify" style="float:right"><a href="/wiki/Image:Foobar.jpg" class="internal" title="Enlarge"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="Enlarge" /></a></div><a href="http://example.com" class='external free' rel="nofollow">http://example.com</a></div></div></div>
1520 !! end
1522 # Pending resolution to bug 368
1523 !! test
1524 BUG 648: Frameless image caption with a link
1525 !! input
1526 [[Image:foobar.jpg|text with a [[link]] in it]]
1527 !! result
1528 <p><a href="/wiki/Image:Foobar.jpg" class="image" title="text with a link in it"><img src="/images/3/3a/Foobar.jpg" alt="text with a link in it" longdesc="/wiki/Image:Foobar.jpg" /></a>
1529 </p>
1530 !! end
1532 !! test
1533 Escape HTML special chars in image alt text
1534 !! input
1535 [[Image:foobar.jpg|& < > "]]
1536 !! result
1537 <p><a href="/wiki/Image:Foobar.jpg" class="image" title="&amp; &lt; &gt; &quot;"><img src="/images/3/3a/Foobar.jpg" alt="&amp; &lt; &gt; &quot;" longdesc="/wiki/Image:Foobar.jpg" /></a>
1538 </p>
1539 !! end
1541 !! test
1542 BUG 499: Alt text should have &#1234;, not &amp;1234;
1543 !! input
1544 [[Image:foobar.jpg|&#9792;]]
1545 !! result
1546 <p><a href="/wiki/Image:Foobar.jpg" class="image" title="&#9792;"><img src="/images/3/3a/Foobar.jpg" alt="&#9792;" longdesc="/wiki/Image:Foobar.jpg" /></a>
1547 </p>
1548 !! end
1550 !! test
1551 Broken image caption with link
1552 !! input
1553 [[Image:Foobar.jpg|thumb|This is a broken caption. But [[Main Page|this]] is just an ordinary link.
1554 !! result
1555 <p>[[Image:Foobar.jpg|thumb|This is a broken caption. But <a href="/wiki/Main_Page" title="Main Page">this</a> is just an ordinary link.
1556 </p>
1557 !! end
1559 !! test
1560 Image caption containing another image
1561 !! input
1562 [[Image:Foobar.jpg|thumb|This is a caption with another [[Image:icon.png|image]] inside it!]]
1563 !! result
1564 <div class="thumb tright"><div style="width:182px;"><b>Missing image</b><br /><i>Foobar.jpg</i>   <div class="thumbcaption" >This is a caption with another <a href="/wiki/Image:Icon.png" class="image" title="image"><img src="/images/9/96/Icon.png" alt="image" longdesc="/wiki/Image:Icon.png" /></a> inside it!</div></div></div>
1566 !! end
1568 !! test
1569 Image caption containing a newline
1570 !! input
1571 [[Image:Foobar.jpg|This
1572 *is some text]]
1573 !! result
1574 <p><a href="/wiki/Image:Foobar.jpg" class="image" title="This *is some text"><img src="/images/3/3a/Foobar.jpg" alt="This *is some text" longdesc="/wiki/Image:Foobar.jpg" /></a>
1575 </p>
1576 !!end
1581 ### Subpages
1583 !! article
1584 Subpage test/subpage
1585 !! text
1587 !! endarticle
1589 !! test
1590 Subpage link
1591 !! options
1592 subpage title=[[Subpage test]]
1593 !! input
1594 [[/subpage]]
1595 !! result
1596 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a>
1597 </p>
1598 !! end
1600 !! test
1601 Subpage noslash link
1602 !! options
1603 subpage title=[[Subpage test]]
1604 !!input
1605 [[/subpage/]]
1606 !! result
1607 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">subpage</a>
1608 </p>
1609 !! end
1611 !! test
1612 Disabled subpages
1613 !! input
1614 [[/subpage]]
1615 !! result
1616 <p><a href="/index.php?title=/subpage&amp;action=edit" class="new" title="/subpage">/subpage</a>
1617 </p>
1618 !! end
1620 !! test
1621 BUG 561: {{/Subpage}}
1622 !! options
1623 subpage title=[[Page]]
1624 !! input
1625 {{/Subpage}}
1626 !! result
1627 <p><a href="/index.php?title=Page/Subpage&amp;action=edit" class="new" title="Page/Subpage">Page/Subpage</a>
1628 </p>
1629 !! end
1632 ### Categories
1634 !! article
1635 Category:MediaWiki User's Guide
1636 !! text
1637 blah
1638 !! endarticle
1640 !! test
1641 Link to category
1642 !! input
1643 [[:Category:MediaWiki User's Guide]]
1644 !! result
1645 <p><a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">Category:MediaWiki User's Guide</a>
1646 </p>
1647 !! end
1649 !! test
1650 Simple category
1651 !! options
1653 !! input
1654 [[Category: MediaWiki User's Guide]]
1655 !! result
1656 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
1657 !! end
1660 ### Inter-language links
1662 !! test
1663 Inter-language links
1664 !! options
1666 !! input
1667 [[es:Alimento]]
1668 [[fr:Nourriture]]
1669 [[zh:&#39135;&#21697;]]
1670 !! result
1671 es:Alimento fr:Nourriture zh:食品
1672 !! end
1675 ### Sections
1677 !! test
1678 Basic section headings
1679 !! options
1680 title=[[Parser test script]]
1681 !! input
1682 == Headline 1 ==
1683 Some text
1685 ==Headline 2==
1686 More
1687 ===Smaller headline===
1688 Blah blah
1689 !! result
1690 <div class="editsection" style="float:right;margin-left:5px;">[<a href="/index.php?title=Parser_test_script&amp;action=edit&amp;section=1" title="Parser test script">edit</a>]</div><a name="Headline_1"></a><h2> Headline 1 </h2>
1691 <p>Some text
1692 </p>
1693 <div class="editsection" style="float:right;margin-left:5px;">[<a href="/index.php?title=Parser_test_script&amp;action=edit&amp;section=2" title="Parser test script">edit</a>]</div><a name="Headline_2"></a><h2>Headline 2</h2>
1694 <p>More
1695 </p>
1696 <div class="editsection" style="float:right;margin-left:5px;">[<a href="/index.php?title=Parser_test_script&amp;action=edit&amp;section=3" title="Parser test script">edit</a>]</div><a name="Smaller_headline"></a><h3>Smaller headline</h3>
1697 <p>Blah blah
1698 </p>
1699 !! end
1701 !! test
1702 Section headings with TOC
1703 !! options
1704 title=[[Parser test script]]
1705 !! input
1706 == Headline 1 ==
1707 === Subheadline 1 ===
1708 ===== Skipping a level =====
1709 ====== Skipping a level ======
1711 == Headline 2 ==
1712 Some text
1713 ===Another headline===
1714 !! result
1715 <div id='toc'>
1716 <div id='toctitle'><h2>Table of contents</h2></div>
1717 <ul>
1718 <li class='toclevel-1'><a href="#Headline_1"><span class="tocnumber">1</span> <span class="toctext">Headline 1</span></a>
1719 <ul>
1720 <li class='toclevel-2'><a href="#Subheadline_1"><span class="tocnumber">1.1</span> <span class="toctext">Subheadline 1</span></a>
1721 <ul>
1722 <li class='toclevel-3'><a href="#Skipping_a_level"><span class="tocnumber">1.1.1</span> <span class="toctext">Skipping a level</span></a>
1723 <ul>
1724 <li class='toclevel-4'><a href="#Skipping_a_level_2"><span class="tocnumber">1.1.1.1</span> <span class="toctext">Skipping a level</span></a></li>
1725 </ul>
1726 </li>
1727 </ul>
1728 </li>
1729 </ul>
1730 </li>
1731 <li class='toclevel-1'><a href="#Headline_2"><span class="tocnumber">2</span> <span class="toctext">Headline 2</span></a>
1732 <ul>
1733 <li class='toclevel-2'><a href="#Another_headline"><span class="tocnumber">2.1</span> <span class="toctext">Another headline</span></a></li>
1734 </ul>
1735 </li>
1736 </ul>
1737 </div>
1738 <script type="text/javascript"> if (window.showTocToggle) { var tocShowText = "show"; var tocHideText = "hide";  showTocToggle(); } </script><div class='visualClear'></div>
1739 <div class="editsection" style="float:right;margin-left:5px;">[<a href="/index.php?title=Parser_test_script&amp;action=edit&amp;section=1" title="Parser test script">edit</a>]</div><a name="Headline_1"></a><h2> Headline 1 </h2>
1740 <div class="editsection" style="float:right;margin-left:5px;">[<a href="/index.php?title=Parser_test_script&amp;action=edit&amp;section=2" title="Parser test script">edit</a>]</div><a name="Subheadline_1"></a><h3> Subheadline 1 </h3>
1741 <div class="editsection" style="float:right;margin-left:5px;">[<a href="/index.php?title=Parser_test_script&amp;action=edit&amp;section=3" title="Parser test script">edit</a>]</div><a name="Skipping_a_level"></a><h5> Skipping a level </h5>
1742 <div class="editsection" style="float:right;margin-left:5px;">[<a href="/index.php?title=Parser_test_script&amp;action=edit&amp;section=4" title="Parser test script">edit</a>]</div><a name="Skipping_a_level_2"></a><h6> Skipping a level </h6>
1743 <div class="editsection" style="float:right;margin-left:5px;">[<a href="/index.php?title=Parser_test_script&amp;action=edit&amp;section=5" title="Parser test script">edit</a>]</div><a name="Headline_2"></a><h2> Headline 2 </h2>
1744 <p>Some text
1745 </p>
1746 <div class="editsection" style="float:right;margin-left:5px;">[<a href="/index.php?title=Parser_test_script&amp;action=edit&amp;section=6" title="Parser test script">edit</a>]</div><a name="Another_headline"></a><h3>Another headline</h3>
1748 !! end
1750 !! test
1751 Resolving duplicate section names
1752 !! options
1753 title=[[Parser test script]]
1754 !! input
1755 == Foo bar ==
1756 ==Foo bar==
1757 !! result
1758 <div class="editsection" style="float:right;margin-left:5px;">[<a href="/index.php?title=Parser_test_script&amp;action=edit&amp;section=1" title="Parser test script">edit</a>]</div><a name="Foo_bar"></a><h2> Foo bar </h2>
1759 <div class="editsection" style="float:right;margin-left:5px;">[<a href="/index.php?title=Parser_test_script&amp;action=edit&amp;section=2" title="Parser test script">edit</a>]</div><a name="Foo_bar_2"></a><h2>Foo bar</h2>
1761 !! end
1763 !! article
1764 Template:sections
1765 !! text
1766 ===Section 1===
1767 ==Section 2==
1768 !! endarticle
1770 !! test
1771 Template with sections, __NOTOC__
1772 !! options
1773 title=[[Parser test script]]
1774 !! input
1775 __NOTOC__
1776 ==Section 0==
1777 {{sections}}
1778 ==Section 4==
1779 !! result
1780 <div class="editsection" style="float:right;margin-left:5px;">[<a href="/index.php?title=Parser_test_script&amp;action=edit&amp;section=1" title="Parser test script">edit</a>]</div><a name="Section_0"></a><h2>Section 0</h2>
1781 <div class="editsection" style="float:right;margin-left:5px;">[<a href="/index.php?title=Template:Sections&amp;action=edit&amp;section=1" title="Template:Sections">edit</a>]</div><a name="Section_1"></a><h3>Section 1</h3>
1782 <div class="editsection" style="float:right;margin-left:5px;">[<a href="/index.php?title=Template:Sections&amp;action=edit&amp;section=2" title="Template:Sections">edit</a>]</div><a name="Section_2"></a><h2>Section 2</h2>
1783 <div class="editsection" style="float:right;margin-left:5px;">[<a href="/index.php?title=Parser_test_script&amp;action=edit&amp;section=2" title="Parser test script">edit</a>]</div><a name="Section_4"></a><h2>Section 4</h2>
1785 !! end
1787 !! test
1788 __NOEDITSECTION__ keyword
1789 !! input
1790 __NOEDITSECTION__
1791 ==Section 1==
1792 ==Section 2==
1793 !! result
1794 <a name="Section_1"></a><h2>Section 1</h2>
1795 <a name="Section_2"></a><h2>Section 2</h2>
1797 !! end
1799 !! test
1800 Link inside a section heading
1801 !! options
1802 title=[[Parser test script]]
1803 !! input
1804 ==Section with a [[Main Page|link]] in it==
1805 !! result
1806 <div class="editsection" style="float:right;margin-left:5px;">[<a href="/index.php?title=Parser_test_script&amp;action=edit&amp;section=1" title="Parser test script">edit</a>]</div><a name="Section_with_a_link_in_it"></a><h2>Section with a <a href="/wiki/Main_Page" title="Main Page">link</a> in it</h2>
1808 !! end
1811 !! test
1812 Bug 1219 URL next to image (good)
1813 !! input
1814 http://example.com [[Image:foobar.jpg]]
1815 !! result
1816 <p><a href="http://example.com" class='external free' rel="nofollow">http://example.com</a> <a href="/wiki/Image:Foobar.jpg" class="image" title="Image:foobar.jpg"><img src="/images/3/3a/Foobar.jpg" alt="Image:foobar.jpg" longdesc="/wiki/Image:Foobar.jpg" /></a>
1817 </p>
1818 !!end
1820 !! test
1821 Bug 1219 URL next to image (broken)
1822 !! input
1823 http://example.com[[Image:foobar.jpg]]
1824 !! result
1825 <p><a href="http://example.com" class='external free' rel="nofollow">http://example.com</a><a href="/wiki/Image:Foobar.jpg" class="image" title="Image:foobar.jpg"><img src="/images/3/3a/Foobar.jpg" alt="Image:foobar.jpg" longdesc="/wiki/Image:Foobar.jpg" /></a>
1826 </p>
1827 !!end
1829 !! test
1830 Bug 1186 news: in the middle of text
1831 !! input
1832 http://en.wikinews.org/wiki/Wikinews:Workplace
1833 !! result
1834 <p><a href="http://en.wikinews.org/wiki/Wikinews:Workplace" class='external free' rel="nofollow">http://en.wikinews.org/wiki/Wikinews:Workplace</a>
1835 </p>
1836 !!end
1839 !! test
1840 Namespaced link must have a title
1841 !! input
1842 [[Project:]]
1843 !! result
1844 <p>[[Project:]]
1845 </p>
1846 !!end
1848 !! test
1849 Namespaced link must have a title (bad fragment version)
1850 !! input
1851 [[Project:#fragment]]
1852 !! result
1853 <p>[[Project:#fragment]]
1854 </p>
1855 !!end
1858 !! test
1859 div with no attributes
1860 !! input
1861 <div>HTML rocks</div>
1862 !! result
1863 <div>HTML rocks</div>
1865 !! end
1867 !! test
1868 div with double-quoted attribute
1869 !! input
1870 <div id="rock">HTML rocks</div>
1871 !! result
1872 <div id="rock">HTML rocks</div>
1874 !! end
1876 !! test
1877 div with single-quoted attribute
1878 !! input
1879 <div id='rock'>HTML rocks</div>
1880 !! result
1881 <div id="rock">HTML rocks</div>
1883 !! end
1885 !! test
1886 div with unquoted attribute
1887 !! input
1888 <div id=rock>HTML rocks</div>
1889 !! result
1890 <div id="rock">HTML rocks</div>
1892 !! end
1894 !! test
1895 div with illegal double attributes
1896 !! input
1897 <div align="center" align="right">HTML rocks</div>
1898 !! result
1899 <div align="center">HTML rocks</div>
1901 !!end
1903 !! test
1904 DIV IN UPPERCASE
1905 !! input
1906 <DIV ALIGN="center">HTML ROCKS</DIV>
1907 !! result
1908 <div align="center">HTML ROCKS</div>
1910 !!end
1913 !! test
1914 text with amp in the middle of nowhere
1915 !! input
1916 Remember AT&T?
1917 !!result
1918 <p>Remember AT&amp;T?
1919 </p>
1920 !! end
1922 !! test
1923 text with character entity: eacute
1924 !! input
1925 I always thought &eacute; was a cute letter.
1926 !! result
1927 <p>I always thought &eacute; was a cute letter.
1928 </p>
1929 !! end
1931 !! test
1932 text with undefined character entity: xacute
1933 !! input
1934 I always thought &xacute; was a cute letter.
1935 !! result
1936 <p>I always thought &amp;xacute; was a cute letter.
1937 </p>
1938 !! end
1941 !! test
1942 Media link
1943 !! input
1944 [[Media:Foobar.jpg]]
1945 !! result
1946 <p><a href="/images/3/3a/Foobar.jpg" class='internal' title="Foobar.jpg">Media:Foobar.jpg</a>
1947 </p>
1948 !! end
1950 !! test
1951 Media link with text
1952 !! input
1953 [[Media:Foobar.jpg|A neat file to look at]]
1954 !! result
1955 <p><a href="/images/3/3a/Foobar.jpg" class='internal' title="Foobar.jpg">A neat file to look at</a>
1956 </p>
1957 !! end
1959 # FIXME: this is still bad HTML tag nesting
1960 !! test
1961 Media link with nasty text
1962 !! input
1963 [[Media:Foobar.jpg|Safe Link<div style=display:none>" onmouseover="alert(document.cookie)" onfoo="</div>]]
1964 !! result
1965 <p><a href="/images/3/3a/Foobar.jpg" class='internal' title="Foobar.jpg">Safe Link<div style="display:none">" onmouseover="alert(document.cookie) onfoo="</div></a>
1966 </p>
1967 !! end
1969 TODO:
1970 more images
1971 more tables
1972 math
1973 character entities
1974 and much more