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 # (default) generate HTML output
9 # pst apply pre-save transform
10 # msg apply message transform
11 # subpage enable subpages (disabled by default)
13 # Tests can be disabled with the '!!disabled' flag.
15 # For testing purposes, temporary articles can created:
16 # !!article / NAMESPACE:TITLE / !!text / ARTICLE TEXT / !!endarticle
17 # where '/' denotes a newline.
19 # This is the standard article assumed to exist.
39 This is a simple paragraph.
41 <p>This is a simple paragraph.
61 * plain''italic''plain
62 * plain''italic''plain''italic''plain
63 * plain'''bold'''plain
64 * plain'''bold'''plain'''bold'''plain
65 * plain''italic''plain'''bold'''plain
66 * plain'''bold'''plain''italic''plain
67 * plain''italic'''bold-italic'''italic''plain
68 * plain'''bold''bold-italic''bold'''plain
69 * plain'''''bold-italic'''italic''plain
70 * plain'''''bold-italic''bold'''plain
71 * plain''italic'''bold-italic'''''plain
72 * plain'''bold''bold-italic'''''plain
73 * plain l'''italic''plain
76 </li><li> plain<i>italic</i>plain
77 </li><li> plain<i>italic</i>plain<i>italic</i>plain
78 </li><li> plain<b>bold</b>plain
79 </li><li> plain<b>bold</b>plain<b>bold</b>plain
80 </li><li> plain<i>italic</i>plain<b>bold</b>plain
81 </li><li> plain<b>bold</b>plain<i>italic</i>plain
82 </li><li> plain<i>italic<b>bold-italic</b>italic</i>plain
83 </li><li> plain<b>bold<i>bold-italic</i>bold</b>plain
84 </li><li> plain<i><b>bold-italic</b>italic</i>plain
85 </li><li> plain<b><i>bold-italic</i>bold</b>plain
86 </li><li> plain<i>italic<b>bold-italic</b></i>plain
87 </li><li> plain<b>bold<i>bold-italic</i></b>plain
88 </li><li> plain l'<i>italic</i>plain
94 ### <nowiki> test cases
98 <nowiki> unordered list
100 <nowiki>* This is not an unordered list item.</nowiki>
102 <p>* This is not an unordered list item.
109 <nowiki>Lorem ipsum dolor
130 :There is not nowiki.
131 :There is <nowiki>nowiki</nowiki>.
133 #There is not nowiki.
134 #There is <nowiki>nowiki</nowiki>.
136 *There is not nowiki.
137 *There is <nowiki>nowiki</nowiki>.
139 <dl><dd>There is not nowiki.
140 </dd><dd>There is nowiki.
142 <ol><li>There is not nowiki.
143 </li><li>There is nowiki.
145 <ul><li>There is not nowiki.
146 </li><li>There is nowiki.
152 ### comment test cases
157 <!-- comment 1 --> asdf
193 asdf<!-- comment 1 -->jkl
203 <!-- foo --> b <!-- bar -->
215 ### Preformatted text
224 And a [[Main Page|link]]
230 And a <a href="/wiki/Main_Page" title="Main Page">link</a>
242 <dl><dt> name </dt><dd> Definition
252 <dl><dd> Indented text
261 External links: non-bracketed
263 Non-bracketed: http://example.com
265 <p>Non-bracketed: <a href="http://example.com" class='external'>http://example.com</a>
270 External links: numbered
272 Numbered: [http://example.com]
274 <p>Numbered: <a href="http://example.com" class='external' title="http://example.com">[1]</a><span class='urlexpansion'> (<i>http://example.com</i>)</span>
279 External links: specified text
281 Specified text: [http://example.com link]
283 <p>Specified text: <a href="http://example.com" class='external' title="http://example.com">link</a><span class='urlexpansion'> (<i>http://example.com</i>)</span>
288 External links: trail
290 Trail (not sure if this is meant to work): [http://example.com link]s
292 <p>Trail (not sure if this is meant to work): <a href="http://example.com" class='external' title="http://example.com">link</a>s<span class='urlexpansion'> (<i>http://example.com</i>)</span>
297 External links: dollar sign in URL
299 http://example.com/1$2345
301 <p><a href="http://example.com/1$2345" class='external'>http://example.com/1$2345</a>
306 External links: dollar sign in URL (named)
308 [http://example.com/1$2345]
310 <p><a href="http://example.com/1$2345" class='external' title="http://example.com/1$2345">[1]</a><span class='urlexpansion'> (<i>http://example.com/1$2345</i>)</span>
317 External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
319 <p>External image: <img src="http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" />
324 External image from https
326 External image from https: https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
328 <p>External image from https: <img src="https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" />
333 Link to non-http image, no img tag
335 Link to non-http image, no img tag: ftp://example.com/test.jpg
337 <p>Link to non-http image, no img tag: <a href="ftp://example.com/test.jpg" class='external'>ftp://example.com/test.jpg</a>
342 External links: terminating separator
344 Terminating separator: http://example.com/thing,
346 <p>Terminating separator: <a href="http://example.com/thing" class='external'>http://example.com/thing</a>,
351 External links: intervening separator
353 Intervening separator: http://example.com/1,2,3
355 <p>Intervening separator: <a href="http://example.com/1,2,3" class='external'>http://example.com/1,2,3</a>
360 External links: old bug with URL in query
362 Old bug with URL in query: [http://example.com/thing?url=http://example.com link]
364 <p>Old bug with URL in query: <a href="http://example.com/thing?url=http://example.com" class='external' title="http://example.com/thing?url=http://example.com">link</a><span class='urlexpansion'> (<i>http://example.com/thing?url=http://example.com</i>)</span>
369 External links: old URL-in-URL bug, mixed protocols
371 And again with mixed protocols: [ftp://example.com?url=http://example.com link]
373 <p>And again with mixed protocols: <a href="ftp://example.com?url=http://example.com" class='external' title="ftp://example.com?url=http://example.com">link</a><span class='urlexpansion'> (<i>ftp://example.com?url=http://example.com</i>)</span>
378 External links: URL in text
380 URL in text: [http://example.com http://example.com]
382 <p>URL in text: <a href="http://example.com" class='external'>http://example.com</a>
387 External links: Clickable images
389 ja-style clickable images: [http://example.com http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png]
391 <p>ja-style clickable images: <a href="http://example.com" class='external' title="http://example.com"><img src="http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" /></a><span class='urlexpansion'> (<i>http://example.com</i>)</span>
396 External links: raw ampersand
398 Old & use: http://x&y
400 <p>Old & use: <a href="http://x&y" class='external'>http://x&y</a>
405 External links: www.jpeg.org (bug 554)
409 <p><a href="http://www.jpeg.org" class='external'>http://www.jpeg.org</a>
420 Normal text. '''Bold text.''' Normal text. ''Italic text.''
422 Normal text. '''''Bold italic text.''''' Normal text.
424 <p>Normal text. <b>Bold text.</b> Normal text. <i>Italic text.</i>
425 </p><p>Normal text. <i><b>Bold italic text.</b></i> Normal text.
431 Unclosed and unmatched quotes
433 '''''Bold italic text '''with bold deactivated''' in between.'''''
435 '''''Bold italic text ''with italic deactivated'' in between.'''''
439 ..spanning two paragraphs (should not work).'''
441 '''Bold tag left open
443 ''Italic tag left open
447 <!-- Unmatching number of opening, closing tags: -->
448 '''This year''''s election ''should'' beat '''last year''''s.
450 ''Tom'''s car is bigger than ''Susan'''s.
452 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
453 </p><p><b><i>Bold italic text </i>with italic deactivated<i> in between.</i></b>
454 </p><p><b>Bold text..</b>
455 </p><p>..spanning two paragraphs (should not work).<b></b>
456 </p><p><b>Bold tag left open</b>
457 </p><p><i>Italic tag left open</i>
459 </p><p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
460 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
467 ### content taken from http://meta.wikimedia.org/wiki/MediaWiki_User%27s_Guide:_Using_tables
491 {| border="1" cellpadding="2"
492 |+Multiplication table
494 ! × !! 1 !! 2 !! 3
512 <table border="1" cellpadding="2">
513 <caption>Multiplication table
516 <th> × </th><th> 1 </th><th> 2 </th><th> 3
520 </th><td> 1 </td><td> 2 </td><td> 3
524 </th><td> 2 </td><td> 4 </td><td> 6
528 </th><td> 3 </td><td> 6 </td><td> 9
532 </th><td> 4 </td><td> 8 </td><td> 12
536 </th><td> 5 </td><td> 10 </td><td> 15
544 {| align=right border=1
546 |rowspan=2| Cell 2, row 1 (and 2)
553 <table align=right border=1>
556 </td><td rowspan=2> Cell 2, row 1 (and 2)
557 </td><td> Cell 3, row 1
561 </td><td> Cell 3, row 2
572 {| bgcolor=#ABCDEF border=2
577 |the original table again
584 <table bgcolor=#ABCDEF border=2>
591 </td><td>the original table again
600 Plain link, capitalized
604 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
609 Plain link, uncapitalized
613 <p><a href="/wiki/Main_Page" title="Main Page">main Page</a>
620 [[Main Page|The Main Page]]
622 <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
631 <p><a href="/index.php?title=Zigzagzogzagzig&action=edit" class="new" title="Zigzagzogzagzig">Zigzagzogzagzig</a>
638 xxx[[main Page]], xxx[[Main Page]], Xxx[[main Page]] XXX[[main Page]], XXX[[Main Page]]
640 <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>
647 [[Main Page]]xxx, [[Main Page]]XXX
649 <p><a href="/wiki/Main_Page" title="Main Page">Main Pagexxx</a>, <a href="/wiki/Main_Page" title="Main Page">Main Page</a>XXX
663 Piped link with 3 brackets
665 [[[main page|the main page]]]
667 <p>[[[main page|the main page]]]
674 [[Talk:Parser testing]], [[Meta:Disclaimers]]
676 <p><a href="/index.php?title=Talk:Parser_testing&action=edit" class="new" title="Talk:Parser testing">Talk:Parser testing</a>, <a href="/index.php?title=Meta:Disclaimers&action=edit" class="new" title="Meta:Disclaimers">Meta:Disclaimers</a>
681 Piped link to namespace
683 [[Meta:Disclaimers|The disclaimers]]
685 <p><a href="/index.php?title=Meta:Disclaimers&action=edit" class="new" title="Meta:Disclaimers">The disclaimers</a>
690 Category:MediaWiki User's Guide
698 [[:Category:MediaWiki User's Guide]]
700 <p><a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">Category:MediaWiki User's Guide</a>
707 [[:Image:Ncwikicol.png]]
709 <p><a href="/wiki/Image:Ncwikicol.png" title="Image:Ncwikicol.png">Image:Ncwikicol.png</a>
716 [[http://www.example.org]]
718 <p>[<a href="http://www.example.org" class='external' title="http://www.example.org">[1]</a><span class='urlexpansion'> (<i>http://www.example.org</i>)</span>]
722 # I'm fairly sure the expected result here is wrong.
723 # We want these to be URL links, not pseudo-pages with URLs for titles....
724 # However the current output is also pretty screwy.
727 # I'm changing it to match the current output--it arguably makes more
728 # sense in the light of the test above. Old expected result was:
729 #<p>Piped link to URL: <a href="/index.php?title=Http://www.example.org&action=edit" class="new" title="Http://www.example.org">an example URL</a>
731 # But I think this test is bordering on "garbage in, garbage out" anyway.
736 Piped link to URL: [[http://www.example.org|an example URL]]
738 <p>Piped link to URL: [<a href="http://www.example.org|an" class='external' title="http://www.example.org|an">example URL</a><span class='urlexpansion'> (<i>http://www.example.org|an</i>)</span>]
743 BUG 2: [[page|http://url/]] should link to page, not http://url/
745 [[Main Page|http://url/]]
747 <p><a href="/wiki/Main_Page" title="Main Page">http://url/</a>
757 Inline interwiki link
759 [[MeatBall:SoftSecurity]]
761 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity" class='extiw'>MeatBall:SoftSecurity</a>
787 ### Block-level elements
810 <ol><li>Numbered list
827 ***#Number on level 4
835 <ol><li> with numbers
841 </li><li>bullets again
842 <ul><li>bullet level 2
843 <ul><li>bullet level 3
844 <ol><li>Number on level 4
847 </li><li>bullet level 2
848 <ol><li>Number on level 3
849 </li><li>Number on level 3
852 <ol><li>number level 2
875 Magic links: internal link to RFC
879 <p><a href="/index.php?title=RFC_123&action=edit" class="new" title="RFC 123">RFC 123</a>
888 <p><a href="/index.php?title=Special:Booksources&isbn=0306406152" class="internal">ISBN 0-306-40615-2</a>
893 ### Nonexistant template
898 {{thistemplatedoesnotexist}}
900 <p><a href="/index.php?title=Template:Thistemplatedoesnotexist&action=edit" class="new" title="Template:Thistemplatedoesnotexist">Template:Thistemplatedoesnotexist</a>
910 This is a test template
918 <p>This is a test template
923 Template with explicit namespace
927 <p>This is a test template
935 This is a test template with parameter {{{param}}}
941 {{paramtest|param=foo}}
943 <p>This is a test template with parameter foo
948 Magic variable as template parameter
950 {{paramtest|param={{SITENAME}}}}
952 <p>This is a test template with parameter MediaWiki
963 Template parameter as link source
965 {{linktest|param=Main Page}}
967 <p><a href="/wiki/Main_Page" title="Main Page">link</a>
975 including another template, {{paramtest|param={{{arg}}}}}
979 Template passing argument to another template
981 {{paramtest2|arg='hmm'}}
983 <p>including another template, This is a test template with parameter 'hmm'
994 Template as link source
998 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
1016 Template infinite loop
1020 <p>{{loop2}}<!-- WARNING: template loop detected -->
1026 ### Pre-save transform tests
1029 pre-save transform: subst:
1035 This is a test template
1039 pre-save transform: normal template
1049 pre-save transform: nonexistant template
1053 {{thistemplatedoesnotexist}}
1055 {{thistemplatedoesnotexist}}
1060 pre-save transform: subst magic variables
1069 # This is bug 89, which I fixed. -- wtm
1071 pre-save transform: subst: templates with parameters
1075 {{subst:paramtest|param="something else"}}
1077 This is a test template with parameter "something else"
1081 ### Message transform tests
1084 message transform: magic variables
1094 message transform: should not transform wiki markup
1111 <p><a href="/wiki/Image:Test" class="image" title="Image: test"><img src="/%7Ewmahan/phase3/images/0/0c/Test" alt="Image: test" /></a>
1118 [[Image:test|right]]
1120 <div class="floatright"><span><a href="/wiki/Image:Test" class="image" title="right"><img src="/%7Ewmahan/phase3/images/0/0c/Test" alt="right" /></a></span></div>
1127 [[Image:test|right|Caption text]]
1129 <div class="floatright"><span><a href="/wiki/Image:Test" class="image" title="Caption text"><img src="/%7Ewmahan/phase3/images/0/0c/Test" alt="Caption text" /></a></span></div>
1134 Image with frame and link
1136 [[Image:Foobar.jpg|frame|left|This is a test image [[Main Page]]]]
1138 <div class="thumb tleft"><div style="width:202px;"><a href="/wiki/Image:Foobar.jpg" class="internal" title="This is a test image "><img src="/%7Ewmahan/phase3/images/3/3a/Foobar.jpg" alt="This is a test image " width="200" height="200" /></a> <div class="thumbcaption" >This is a test image <a href="/wiki/Main_Page" title="Main Page">Main Page</a></div></div></div>
1147 <p><a href="/wiki/Image:Test" title="Image:Test">Image:test</a>
1167 <p><a href="/wiki/Parser_test/subpage" title="Parser test/subpage">/subpage</a>
1172 Subpage noslash link
1178 <p><a href="/wiki/Parser_test/subpage" title="Parser test/subpage">subpage</a>
1182 # bug 561: it would be nice if this linked to /subpage -- wtm
1188 <p><a href="/index.php?title=Subpage&action=edit" class="new" title="Subpage">subpage</a>