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 # cat add category links
12 # ill add inter-language links
13 # subpage enable subpages (disabled by default)
14 # title=[[XXX]] run test using article title XXX
15 # disabled do not run test
17 # For testing purposes, temporary articles can created:
18 # !!article / NAMESPACE:TITLE / !!text / ARTICLE TEXT / !!endarticle
19 # where '/' denotes a newline.
21 # This is the standard article assumed to exist.
41 This is a simple paragraph.
43 <p>This is a simple paragraph.
63 * plain''italic''plain
64 * plain''italic''plain''italic''plain
65 * plain'''bold'''plain
66 * plain'''bold'''plain'''bold'''plain
67 * plain''italic''plain'''bold'''plain
68 * plain'''bold'''plain''italic''plain
69 * plain''italic'''bold-italic'''italic''plain
70 * plain'''bold''bold-italic''bold'''plain
71 * plain'''''bold-italic'''italic''plain
72 * plain'''''bold-italic''bold'''plain
73 * plain''italic'''bold-italic'''''plain
74 * plain'''bold''bold-italic'''''plain
75 * plain l'''italic''plain
78 </li><li> plain<i>italic</i>plain
79 </li><li> plain<i>italic</i>plain<i>italic</i>plain
80 </li><li> plain<b>bold</b>plain
81 </li><li> plain<b>bold</b>plain<b>bold</b>plain
82 </li><li> plain<i>italic</i>plain<b>bold</b>plain
83 </li><li> plain<b>bold</b>plain<i>italic</i>plain
84 </li><li> plain<i>italic<b>bold-italic</b>italic</i>plain
85 </li><li> plain<b>bold<i>bold-italic</i>bold</b>plain
86 </li><li> plain<i><b>bold-italic</b>italic</i>plain
87 </li><li> plain<b><i>bold-italic</i>bold</b>plain
88 </li><li> plain<i>italic<b>bold-italic</b></i>plain
89 </li><li> plain<b>bold<i>bold-italic</i></b>plain
90 </li><li> plain l'<i>italic</i>plain
96 ### <nowiki> test cases
100 <nowiki> unordered list
102 <nowiki>* This is not an unordered list item.</nowiki>
104 <p>* This is not an unordered list item.
111 <nowiki>Lorem ipsum dolor
132 :There is not nowiki.
133 :There is <nowiki>nowiki</nowiki>.
135 #There is not nowiki.
136 #There is <nowiki>nowiki</nowiki>.
138 *There is not nowiki.
139 *There is <nowiki>nowiki</nowiki>.
141 <dl><dd>There is not nowiki.
142 </dd><dd>There is nowiki.
144 <ol><li>There is not nowiki.
145 </li><li>There is nowiki.
147 <ul><li>There is not nowiki.
148 </li><li>There is nowiki.
154 ### comment test cases
159 <!-- comment 1 --> asdf
195 asdf<!-- comment 1 -->jkl
205 <!-- foo --> b <!-- bar -->
217 ### Preformatted text
226 And a [[Main Page|link]]
232 And a <a href="/wiki/Main_Page" title="Main Page">link</a>
244 <dl><dt> name </dt><dd> Definition
254 <dl><dd> Indented text
263 External links: non-bracketed
265 Non-bracketed: http://example.com
267 <p>Non-bracketed: <a href="http://example.com" class='external'>http://example.com</a>
272 External links: numbered
274 Numbered: [http://example.com]
276 <p>Numbered: <a href="http://example.com" class='external' title="http://example.com">[1]</a><span class='urlexpansion'> (<i>http://example.com</i>)</span>
281 External links: specified text
283 Specified text: [http://example.com link]
285 <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>
290 External links: trail
292 Trail (not sure if this is meant to work): [http://example.com link]s
294 <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>
299 External links: dollar sign in URL
301 http://example.com/1$2345
303 <p><a href="http://example.com/1$2345" class='external'>http://example.com/1$2345</a>
308 External links: dollar sign in URL (named)
310 [http://example.com/1$2345]
312 <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>
319 External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
321 <p>External image: <img src="http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" />
326 External image from https
328 External image from https: https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
330 <p>External image from https: <img src="https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" />
335 Link to non-http image, no img tag
337 Link to non-http image, no img tag: ftp://example.com/test.jpg
339 <p>Link to non-http image, no img tag: <a href="ftp://example.com/test.jpg" class='external'>ftp://example.com/test.jpg</a>
344 External links: terminating separator
346 Terminating separator: http://example.com/thing,
348 <p>Terminating separator: <a href="http://example.com/thing" class='external'>http://example.com/thing</a>,
353 External links: intervening separator
355 Intervening separator: http://example.com/1,2,3
357 <p>Intervening separator: <a href="http://example.com/1,2,3" class='external'>http://example.com/1,2,3</a>
362 External links: old bug with URL in query
364 Old bug with URL in query: [http://example.com/thing?url=http://example.com link]
366 <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>
371 External links: old URL-in-URL bug, mixed protocols
373 And again with mixed protocols: [ftp://example.com?url=http://example.com link]
375 <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>
380 External links: URL in text
382 URL in text: [http://example.com http://example.com]
384 <p>URL in text: <a href="http://example.com" class='external'>http://example.com</a>
389 External links: Clickable images
391 ja-style clickable images: [http://example.com http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png]
393 <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>
398 External links: raw ampersand
400 Old & use: http://x&y
402 <p>Old & use: <a href="http://x&y" class='external'>http://x&y</a>
407 External links: www.jpeg.org (bug 554)
411 <p><a href="http://www.jpeg.org" class='external'>http://www.jpeg.org</a>
416 External links: URL within URL (original bug 2)
418 [http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp]
420 <p><a href="http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp" class='external' title="http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp">[1]</a><span class='urlexpansion'> (<i>http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp</i>)</span>
431 Normal text. '''Bold text.''' Normal text. ''Italic text.''
433 Normal text. '''''Bold italic text.''''' Normal text.
435 <p>Normal text. <b>Bold text.</b> Normal text. <i>Italic text.</i>
436 </p><p>Normal text. <i><b>Bold italic text.</b></i> Normal text.
442 Unclosed and unmatched quotes
444 '''''Bold italic text '''with bold deactivated''' in between.'''''
446 '''''Bold italic text ''with italic deactivated'' in between.'''''
450 ..spanning two paragraphs (should not work).'''
452 '''Bold tag left open
454 ''Italic tag left open
458 <!-- Unmatching number of opening, closing tags: -->
459 '''This year''''s election ''should'' beat '''last year''''s.
461 ''Tom'''s car is bigger than ''Susan'''s.
463 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
464 </p><p><b><i>Bold italic text </i>with italic deactivated<i> in between.</i></b>
465 </p><p><b>Bold text..</b>
466 </p><p>..spanning two paragraphs (should not work).<b></b>
467 </p><p><b>Bold tag left open</b>
468 </p><p><i>Italic tag left open</i>
470 </p><p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
471 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
478 ### content taken from http://meta.wikimedia.org/wiki/MediaWiki_User%27s_Guide:_Using_tables
502 {| border="1" cellpadding="2"
503 |+Multiplication table
505 ! × !! 1 !! 2 !! 3
523 <table border="1" cellpadding="2">
524 <caption>Multiplication table
527 <th> × </th><th> 1 </th><th> 2 </th><th> 3
531 </th><td> 1 </td><td> 2 </td><td> 3
535 </th><td> 2 </td><td> 4 </td><td> 6
539 </th><td> 3 </td><td> 6 </td><td> 9
543 </th><td> 4 </td><td> 8 </td><td> 12
547 </th><td> 5 </td><td> 10 </td><td> 15
555 {| align=right border=1
557 |rowspan=2| Cell 2, row 1 (and 2)
564 <table align=right border=1>
567 </td><td rowspan=2> Cell 2, row 1 (and 2)
568 </td><td> Cell 3, row 1
572 </td><td> Cell 3, row 2
583 {| bgcolor=#ABCDEF border=2
588 |the original table again
595 <table bgcolor=#ABCDEF border=2>
602 </td><td>the original table again
611 Plain link, capitalized
615 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
620 Plain link, uncapitalized
624 <p><a href="/wiki/Main_Page" title="Main Page">main Page</a>
631 [[Main Page|The Main Page]]
633 <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
642 <p><a href="/index.php?title=Zigzagzogzagzig&action=edit" class="new" title="Zigzagzogzagzig">Zigzagzogzagzig</a>
649 xxx[[main Page]], xxx[[Main Page]], Xxx[[main Page]] XXX[[main Page]], XXX[[Main Page]]
651 <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>
658 [[Main Page]]xxx, [[Main Page]]XXX
660 <p><a href="/wiki/Main_Page" title="Main Page">Main Pagexxx</a>, <a href="/wiki/Main_Page" title="Main Page">Main Page</a>XXX
674 Piped link with 3 brackets
676 [[[main page|the main page]]]
678 <p>[[[main page|the main page]]]
685 [[Talk:Parser testing]], [[Meta:Disclaimers]]
687 <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>
692 Piped link to namespace
694 [[Meta:Disclaimers|The disclaimers]]
696 <p><a href="/index.php?title=Meta:Disclaimers&action=edit" class="new" title="Meta:Disclaimers">The disclaimers</a>
703 [[Usually caused by a typo (oops}]]
705 <p>[[Usually caused by a typo (oops}]]
713 [[http://www.example.org]]
715 <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>]
719 # I'm fairly sure the expected result here is wrong.
720 # We want these to be URL links, not pseudo-pages with URLs for titles....
721 # However the current output is also pretty screwy.
724 # I'm changing it to match the current output--it arguably makes more
725 # sense in the light of the test above. Old expected result was:
726 #<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>
728 # But I think this test is bordering on "garbage in, garbage out" anyway.
733 Piped link to URL: [[http://www.example.org|an example URL]]
735 <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>]
740 BUG 2: [[page|http://url/]] should link to page, not http://url/
742 [[Main Page|http://url/]]
744 <p><a href="/wiki/Main_Page" title="Main Page">http://url/</a>
754 Inline interwiki link
756 [[MeatBall:SoftSecurity]]
758 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity" class='extiw'>MeatBall:SoftSecurity</a>
784 ### Block-level elements
807 <ol><li>Numbered list
824 ***#Number on level 4
832 <ol><li> with numbers
838 </li><li>bullets again
839 <ul><li>bullet level 2
840 <ul><li>bullet level 3
841 <ol><li>Number on level 4
844 </li><li>bullet level 2
845 <ol><li>Number on level 3
846 </li><li>Number on level 3
849 <ol><li>number level 2
872 Magic links: internal link to RFC
876 <p><a href="/index.php?title=RFC_123&action=edit" class="new" title="RFC 123">RFC 123</a>
885 <p><a href="/index.php?title=Special:Booksources&isbn=0306406152" class="internal">ISBN 0-306-40615-2</a>
896 {{thistemplatedoesnotexist}}
898 <p><a href="/index.php?title=Template:Thistemplatedoesnotexist&action=edit" class="new" title="Template:Thistemplatedoesnotexist">Template:Thistemplatedoesnotexist</a>
905 This is a test template
913 <p>This is a test template
918 Template with explicit namespace
922 <p>This is a test template
930 This is a test template with parameter {{{param}}}
936 {{paramtest|param=foo}}
938 <p>This is a test template with parameter foo
943 Magic variable as template parameter
945 {{paramtest|param={{SITENAME}}}}
947 <p>This is a test template with parameter MediaWiki
958 Template parameter as link source
960 {{linktest|param=Main Page}}
962 <p><a href="/wiki/Main_Page" title="Main Page">link</a>
970 including another template, {{paramtest|param={{{arg}}}}}
974 Template passing argument to another template
976 {{paramtest2|arg='hmm'}}
978 <p>including another template, This is a test template with parameter 'hmm'
989 Template as link source
993 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
1011 Template infinite loop
1015 <p>{{loop2}}<!-- WARNING: template loop detected -->
1031 BUG 529: Template with table, not included at beginning of line
1048 BUG 523: Template shouldn't eat newline (or add an extra one before table)
1066 BUG 41: Template parameters shown as broken links
1075 ### Pre-save transform tests
1078 pre-save transform: subst:
1084 This is a test template
1088 pre-save transform: normal template
1098 pre-save transform: nonexistant template
1102 {{thistemplatedoesnotexist}}
1104 {{thistemplatedoesnotexist}}
1109 pre-save transform: subst magic variables
1118 # This is bug 89, which I fixed. -- wtm
1120 pre-save transform: subst: templates with parameters
1124 {{subst:paramtest|param="something else"}}
1126 This is a test template with parameter "something else"
1130 ### Message transform tests
1133 message transform: magic variables
1143 message transform: should not transform wiki markup
1160 <p><a href="/wiki/Image:Test" class="image" title="Image: test"><img src="/%7Ewmahan/phase3/images/0/0c/Test" alt="Image: test" /></a>
1167 [[Image:test|right]]
1169 <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>
1176 [[Image:test|right|Caption text]]
1178 <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>
1183 Image with frame and link
1185 [[Image:Foobar.jpg|frame|left|This is a test image [[Main Page]]]]
1187 <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>
1196 <p><a href="/wiki/Image:Test" title="Image:Test">Image:test</a>
1204 Subpage test/subpage
1212 subpage title=[[Subpage test]]
1216 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a>
1221 Subpage noslash link
1223 subpage title=[[Subpage test]]
1227 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">subpage</a>
1231 # bug 561: it would be nice if this linked to /subpage -- wtm
1237 <p><a href="/index.php?title=Subpage&action=edit" class="new" title="Subpage">subpage</a>
1242 BUG 561: {{/Subpage}}
1248 <p><a href="/index.php?title=Page/Subpage&action=edit" class="new" title="Page/Subpage">Page/Subpage</a>
1256 Category:MediaWiki User's Guide
1264 [[:Category:MediaWiki User's Guide]]
1266 <p><a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">Category:MediaWiki User's Guide</a>
1275 [[Category: MediaWiki User's Guide]]
1277 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
1281 ### Inter-language links
1284 Inter-language links
1290 [[zh:食品]]
1292 es:Alimento fr:Nourriture zh:食品
1299 Basic section headings
1306 ===Smaller headline===
1309 <div class="editsection" style="float:right;margin-left:5px;">[<a href="/index.php?title=Parser_test_script&action=edit&section=1" title="Parser test script">edit</a>]</div><a name="Headline_1"></a><h2> Headline 1 </h2>
1312 <div class="editsection" style="float:right;margin-left:5px;">[<a href="/index.php?title=Parser_test_script&action=edit&section=2" title="Parser test script">edit</a>]</div><a name="Headline_2"></a><h2>Headline 2</h2>
1315 <div class="editsection" style="float:right;margin-left:5px;">[<a href="/index.php?title=Parser_test_script&action=edit&section=3" title="Parser test script">edit</a>]</div><a name="Smaller_headline"></a><h3>Smaller headline</h3>
1321 Section headings with TOC
1324 === Subheadline 1 ===
1325 ===== Skipping a level =====
1326 ====== Skipping a level ======
1330 ===Another headline===
1332 <table border="0" id="toc"><tr id="toctitle"><td align="center">
1333 <b>Table of contents</b> <script type="text/javascript">showTocToggle("show","hide")</script></td></tr><tr id="tocinside"><td>
1334 <div class="tocline"><a href="#Headline_1">1 Headline 1</a><br /></div>
1335 <div class="tocindent">
1336 <p><a href="#Subheadline_1">1.1 Subheadline 1</a><br />
1338 <div class="tocindent">
1339 <div class="tocindent">
1340 <p><a href="#Skipping_a_level">1.1.1 Skipping a level</a><br />
1342 <div class="tocindent">
1343 <p><a href="#Skipping_a_level_2">1.1.1.1 Skipping a level</a><br />
1349 <div class="tocline"><a href="#Headline_2">2 Headline 2</a><br /></div>
1350 <div class="tocindent">
1351 <p><a href="#Another_headline">2.1 Another headline</a><br />
1355 <div class="editsection" style="float:right;margin-left:5px;">[<a href="/index.php?title=Parser_test_script&action=edit&section=1" title="Parser test script">edit</a>]</div><a name="Headline_1"></a><h2> Headline 1 </h2>
1356 <div class="editsection" style="float:right;margin-left:5px;">[<a href="/index.php?title=Parser_test_script&action=edit&section=2" title="Parser test script">edit</a>]</div><a name="Subheadline_1"></a><h3> Subheadline 1 </h3>
1357 <div class="editsection" style="float:right;margin-left:5px;">[<a href="/index.php?title=Parser_test_script&action=edit&section=3" title="Parser test script">edit</a>]</div><a name="Skipping_a_level"></a><h5> Skipping a level </h5>
1358 <div class="editsection" style="float:right;margin-left:5px;">[<a href="/index.php?title=Parser_test_script&action=edit&section=4" title="Parser test script">edit</a>]</div><a name="Skipping_a_level_2"></a><h6> Skipping a level </h6>
1359 <div class="editsection" style="float:right;margin-left:5px;">[<a href="/index.php?title=Parser_test_script&action=edit&section=5" title="Parser test script">edit</a>]</div><a name="Headline_2"></a><h2> Headline 2 </h2>
1362 <div class="editsection" style="float:right;margin-left:5px;">[<a href="/index.php?title=Parser_test_script&action=edit&section=6" title="Parser test script">edit</a>]</div><a name="Another_headline"></a><h3>Another headline</h3>
1367 Resolving duplicate section names
1372 <div class="editsection" style="float:right;margin-left:5px;">[<a href="/index.php?title=Parser_test_script&action=edit&section=1" title="Parser test script">edit</a>]</div><a name="Foo_bar"></a><h2> Foo bar </h2>
1373 <div class="editsection" style="float:right;margin-left:5px;">[<a href="/index.php?title=Parser_test_script&action=edit&section=2" title="Parser test script">edit</a>]</div><a name="Foo_bar_2"></a><h2>Foo bar</h2>