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.
46 This is a simple paragraph.
48 <p>This is a simple paragraph.
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
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
101 ### <nowiki> test cases
105 <nowiki> unordered list
107 <nowiki>* This is not an unordered list item.</nowiki>
109 <p>* This is not an unordered list item.
116 <nowiki>Lorem ipsum dolor
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>.
146 <dl><dd>There is not nowiki.
147 </dd><dd>There is nowiki.
149 <ol><li>There is not nowiki.
150 </li><li>There is nowiki.
152 <ul><li>There is not nowiki.
153 </li><li>There is nowiki.
159 ### comment test cases
164 <!-- comment 1 --> asdf
200 asdf<!-- comment 1 -->jkl
210 <!-- foo --> b <!-- bar -->
222 ### Preformatted text
231 And a [[Main Page|link]]
237 And a <a href="/wiki/Main_Page" title="Main Page">link</a>
249 <dl><dt> name </dt><dd> Definition
259 <dl><dd> Indented text
265 Definition list with no space
269 <dl><dt>name</dt><dd>Definition
275 Definition list with URL link
277 ; http://example.com/ : definition
279 <dl><dt> <a href="http://example.com/" class='external'>http://example.com/</a></dt><dd> definition
288 External links: non-bracketed
290 Non-bracketed: http://example.com
292 <p>Non-bracketed: <a href="http://example.com" class='external'>http://example.com</a>
297 External links: numbered
299 Numbered: [http://example.com]
301 <p>Numbered: <a href="http://example.com" class='external' title="http://example.com">[1]</a><span class='urlexpansion'> (<i>http://example.com</i>)</span>
306 External links: specified text
308 Specified text: [http://example.com link]
310 <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>
315 External links: trail
317 Trail (not sure if this is meant to work): [http://example.com link]s
319 <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>
324 External links: dollar sign in URL
326 http://example.com/1$2345
328 <p><a href="http://example.com/1$2345" class='external'>http://example.com/1$2345</a>
333 External links: dollar sign in URL (named)
335 [http://example.com/1$2345]
337 <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>
344 External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
346 <p>External image: <img src="http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" />
351 External image from https
353 External image from https: https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
355 <p>External image from https: <img src="https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" />
360 Link to non-http image, no img tag
362 Link to non-http image, no img tag: ftp://example.com/test.jpg
364 <p>Link to non-http image, no img tag: <a href="ftp://example.com/test.jpg" class='external'>ftp://example.com/test.jpg</a>
369 External links: terminating separator
371 Terminating separator: http://example.com/thing,
373 <p>Terminating separator: <a href="http://example.com/thing" class='external'>http://example.com/thing</a>,
378 External links: intervening separator
380 Intervening separator: http://example.com/1,2,3
382 <p>Intervening separator: <a href="http://example.com/1,2,3" class='external'>http://example.com/1,2,3</a>
387 External links: old bug with URL in query
389 Old bug with URL in query: [http://example.com/thing?url=http://example.com link]
391 <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>
396 External links: old URL-in-URL bug, mixed protocols
398 And again with mixed protocols: [ftp://example.com?url=http://example.com link]
400 <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>
405 External links: URL in text
407 URL in text: [http://example.com http://example.com]
409 <p>URL in text: <a href="http://example.com" class='external'>http://example.com</a>
414 External links: Clickable images
416 ja-style clickable images: [http://example.com http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png]
418 <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>
423 External links: raw ampersand
425 Old & use: http://x&y
427 <p>Old & use: <a href="http://x&y" class='external'>http://x&y</a>
432 External links: www.jpeg.org (bug 554)
436 <p><a href="http://www.jpeg.org" class='external'>http://www.jpeg.org</a>
441 External links: URL within URL (original bug 2)
443 [http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp]
445 <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>
456 Normal text. '''Bold text.''' Normal text. ''Italic text.''
458 Normal text. '''''Bold italic text.''''' Normal text.
460 <p>Normal text. <b>Bold text.</b> Normal text. <i>Italic text.</i>
461 </p><p>Normal text. <i><b>Bold italic text.</b></i> Normal text.
467 Unclosed and unmatched quotes
469 '''''Bold italic text '''with bold deactivated''' in between.'''''
471 '''''Bold italic text ''with italic deactivated'' in between.'''''
475 ..spanning two paragraphs (should not work).'''
477 '''Bold tag left open
479 ''Italic tag left open
483 <!-- Unmatching number of opening, closing tags: -->
484 '''This year''''s election ''should'' beat '''last year''''s.
486 ''Tom'''s car is bigger than ''Susan'''s.
488 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
489 </p><p><b><i>Bold italic text </i>with italic deactivated<i> in between.</i></b>
490 </p><p><b>Bold text..</b>
491 </p><p>..spanning two paragraphs (should not work).<b></b>
492 </p><p><b>Bold tag left open</b>
493 </p><p><i>Italic tag left open</i>
495 </p><p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
496 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
503 ### content taken from http://meta.wikimedia.org/wiki/MediaWiki_User%27s_Guide:_Using_tables
527 {| border="1" cellpadding="2"
528 |+Multiplication table
530 ! × !! 1 !! 2 !! 3
548 <table border="1" cellpadding="2">
549 <caption>Multiplication table
552 <th> × </th><th> 1 </th><th> 2 </th><th> 3
556 </th><td> 1 </td><td> 2 </td><td> 3
560 </th><td> 2 </td><td> 4 </td><td> 6
564 </th><td> 3 </td><td> 6 </td><td> 9
568 </th><td> 4 </td><td> 8 </td><td> 12
572 </th><td> 5 </td><td> 10 </td><td> 15
580 {| align=right border=1
582 |rowspan=2| Cell 2, row 1 (and 2)
589 <table align=right border=1>
592 </td><td rowspan=2> Cell 2, row 1 (and 2)
593 </td><td> Cell 3, row 1
597 </td><td> Cell 3, row 2
608 {| bgcolor=#ABCDEF border=2
613 |the original table again
620 <table bgcolor=#ABCDEF border=2>
627 </td><td>the original table again
636 Plain link, capitalized
640 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
645 Plain link, uncapitalized
649 <p><a href="/wiki/Main_Page" title="Main Page">main Page</a>
656 [[Main Page|The Main Page]]
658 <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
667 <p><a href="/index.php?title=Zigzagzogzagzig&action=edit" class="new" title="Zigzagzogzagzig">Zigzagzogzagzig</a>
674 xxx[[main Page]], xxx[[Main Page]], Xxx[[main Page]] XXX[[main Page]], XXX[[Main Page]]
676 <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>
683 [[Main Page]]xxx, [[Main Page]]XXX
685 <p><a href="/wiki/Main_Page" title="Main Page">Main Pagexxx</a>, <a href="/wiki/Main_Page" title="Main Page">Main Page</a>XXX
699 Piped link with 3 brackets
701 [[[main page|the main page]]]
703 <p>[[[main page|the main page]]]
710 [[Talk:Parser testing]], [[Meta:Disclaimers]]
712 <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>
717 Piped link to namespace
719 [[Meta:Disclaimers|The disclaimers]]
721 <p><a href="/index.php?title=Meta:Disclaimers&action=edit" class="new" title="Meta:Disclaimers">The disclaimers</a>
728 [[Usually caused by a typo (oops}]]
730 <p>[[Usually caused by a typo (oops}]]
738 [[http://www.example.org]]
740 <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>]
744 # I'm fairly sure the expected result here is wrong.
745 # We want these to be URL links, not pseudo-pages with URLs for titles....
746 # However the current output is also pretty screwy.
749 # I'm changing it to match the current output--it arguably makes more
750 # sense in the light of the test above. Old expected result was:
751 #<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>
753 # But I think this test is bordering on "garbage in, garbage out" anyway.
758 Piped link to URL: [[http://www.example.org|an example URL]]
760 <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>]
765 BUG 2: [[page|http://url/]] should link to page, not http://url/
767 [[Main Page|http://url/]]
769 <p><a href="/wiki/Main_Page" title="Main Page">http://url/</a>
779 Inline interwiki link
781 [[MeatBall:SoftSecurity]]
783 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity" class='extiw'>MeatBall:SoftSecurity</a>
809 ### Block-level elements
832 <ol><li>Numbered list
849 ***#Number on level 4
857 <ol><li> with numbers
863 </li><li>bullets again
864 <ul><li>bullet level 2
865 <ul><li>bullet level 3
866 <ol><li>Number on level 4
869 </li><li>bullet level 2
870 <ol><li>Number on level 3
871 </li><li>Number on level 3
874 <ol><li>number level 2
897 Magic links: internal link to RFC
901 <p><a href="/index.php?title=RFC_123&action=edit" class="new" title="RFC 123">RFC 123</a>
910 <p><a href="/index.php?title=Special:Booksources&isbn=0306406152" class="internal">ISBN 0-306-40615-2</a>
921 {{thistemplatedoesnotexist}}
923 <p><a href="/index.php?title=Template:Thistemplatedoesnotexist&action=edit" class="new" title="Template:Thistemplatedoesnotexist">Template:Thistemplatedoesnotexist</a>
930 This is a test template
938 <p>This is a test template
943 Template with explicit namespace
947 <p>This is a test template
955 This is a test template with parameter {{{param}}}
961 {{paramtest|param=foo}}
963 <p>This is a test template with parameter foo
968 Magic variable as template parameter
970 {{paramtest|param={{SITENAME}}}}
972 <p>This is a test template with parameter MediaWiki
983 Template parameter as link source
985 {{linktest|param=Main Page}}
987 <p><a href="/wiki/Main_Page" title="Main Page">link</a>
995 including another template, {{paramtest|param={{{arg}}}}}
999 Template passing argument to another template
1001 {{paramtest2|arg='hmm'}}
1003 <p>including another template, This is a test template with parameter 'hmm'
1014 Template as link source
1018 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
1036 Template infinite loop
1040 <p>{{loop2}}<!-- WARNING: template loop detected -->
1045 Template from main namespace
1064 BUG 529: Template with table, not included at beginning of line
1081 BUG 523: Template shouldn't eat newline (or add an extra one before table)
1099 BUG 41: Template parameters shown as broken links
1111 ''None'' of '''this''' should be
1113 but rather passed unmodified
1117 # hmm, fix this or just disable/deprecate msgnw?
1121 {{msgnw:MSGNW test}}
1123 <p>''None'' of '''this''' should be
1125 but rather passed unmodified
1133 {{int:newmessages|lots of money}}
1135 <p>You have lots of money.
1140 ### Pre-save transform tests
1143 pre-save transform: subst:
1149 This is a test template
1153 pre-save transform: normal template
1163 pre-save transform: nonexistant template
1167 {{thistemplatedoesnotexist}}
1169 {{thistemplatedoesnotexist}}
1174 pre-save transform: subst magic variables
1183 # This is bug 89, which I fixed. -- wtm
1185 pre-save transform: subst: templates with parameters
1189 {{subst:paramtest|param="something else"}}
1191 This is a test template with parameter "something else"
1195 ### Message transform tests
1198 message transform: magic variables
1208 message transform: should not transform wiki markup
1225 <p><a href="/wiki/Image:Test" class="image" title="Image: test"><img src="/images/0/0c/Test" alt="Image: test" /></a>
1232 [[Image:test|right]]
1234 <div class="floatright"><span><a href="/wiki/Image:Test" class="image" title="right"><img src="/images/0/0c/Test" alt="right" /></a></span></div>
1241 [[Image:test|right|Caption text]]
1243 <div class="floatright"><span><a href="/wiki/Image:Test" class="image" title="Caption text"><img src="/images/0/0c/Test" alt="Caption text" /></a></span></div>
1248 Image with frame and link
1250 [[Image:Foobar.jpg|frame|left|This is a test image [[Main Page]]]]
1252 <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" /></a> <div class="thumbcaption" >This is a test image <a href="/wiki/Main_Page" title="Main Page">Main Page</a></div></div></div>
1261 <p><a href="/wiki/Image:Test" title="Image:Test">Image:test</a>
1269 Subpage test/subpage
1277 subpage title=[[Subpage test]]
1281 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a>
1286 Subpage noslash link
1288 subpage title=[[Subpage test]]
1292 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">subpage</a>
1301 <p><a href="/index.php?title=/subpage&action=edit" class="new" title="/subpage">/subpage</a>
1306 BUG 561: {{/Subpage}}
1308 subpage title=[[Page]]
1312 <p><a href="/index.php?title=Page/Subpage&action=edit" class="new" title="Page/Subpage">Page/Subpage</a>
1320 Category:MediaWiki User's Guide
1328 [[:Category:MediaWiki User's Guide]]
1330 <p><a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">Category:MediaWiki User's Guide</a>
1339 [[Category: MediaWiki User's Guide]]
1341 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
1345 ### Inter-language links
1348 Inter-language links
1354 [[zh:食品]]
1356 es:Alimento fr:Nourriture zh:食品
1363 Basic section headings
1370 ===Smaller headline===
1373 <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>
1376 <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>
1379 <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>
1385 Section headings with TOC
1388 === Subheadline 1 ===
1389 ===== Skipping a level =====
1390 ====== Skipping a level ======
1394 ===Another headline===
1396 <table border="0" id="toc"><tr id="toctitle"><td align="center">
1397 <b>Table of contents</b> <script type="text/javascript">showTocToggle("show","hide")</script></td></tr><tr id="tocinside"><td>
1398 <div class="tocline"><a href="#Headline_1">1 Headline 1</a><br /></div>
1399 <div class="tocindent">
1400 <p><a href="#Subheadline_1">1.1 Subheadline 1</a><br />
1402 <div class="tocindent">
1403 <div class="tocindent">
1404 <p><a href="#Skipping_a_level">1.1.1 Skipping a level</a><br />
1406 <div class="tocindent">
1407 <p><a href="#Skipping_a_level_2">1.1.1.1 Skipping a level</a><br />
1413 <div class="tocline"><a href="#Headline_2">2 Headline 2</a><br /></div>
1414 <div class="tocindent">
1415 <p><a href="#Another_headline">2.1 Another headline</a><br />
1419 <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>
1420 <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>
1421 <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>
1422 <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>
1423 <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>
1426 <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>
1431 Resolving duplicate section names
1436 <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>
1437 <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>
1449 Template with sections, __NOTOC__
1450 !! options title=[[Parser test script]]
1457 <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="Section_0"></a><h2>Section 0</h2>
1458 <div class="editsection" style="float:right;margin-left:5px;">[<a href="/index.php?title=Template:Sections&action=edit&section=1" title="Template:Sections">edit</a>]</div><a name="Section_1"></a><h3>Section 1</h3>
1459 <div class="editsection" style="float:right;margin-left:5px;">[<a href="/index.php?title=Template:Sections&action=edit&section=2" title="Template:Sections">edit</a>]</div><a name="Section_2"></a><h2>Section 2</h2>
1460 <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="Section_4"></a><h2>Section 4</h2>
1465 __NOEDITSECTION__ keyword
1471 <a name="Section_1"></a><h2>Section 1</h2>
1472 <a name="Section_2"></a><h2>Section 2</h2>