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
16 # Tests can be disabled with the '!!disabled' flag.
18 # For testing purposes, temporary articles can created:
19 # !!article / NAMESPACE:TITLE / !!text / ARTICLE TEXT / !!endarticle
20 # where '/' denotes a newline.
22 # This is the standard article assumed to exist.
42 This is a simple paragraph.
44 <p>This is a simple paragraph.
64 * plain''italic''plain
65 * plain''italic''plain''italic''plain
66 * plain'''bold'''plain
67 * plain'''bold'''plain'''bold'''plain
68 * plain''italic''plain'''bold'''plain
69 * plain'''bold'''plain''italic''plain
70 * plain''italic'''bold-italic'''italic''plain
71 * plain'''bold''bold-italic''bold'''plain
72 * plain'''''bold-italic'''italic''plain
73 * plain'''''bold-italic''bold'''plain
74 * plain''italic'''bold-italic'''''plain
75 * plain'''bold''bold-italic'''''plain
76 * plain l'''italic''plain
79 </li><li> plain<i>italic</i>plain
80 </li><li> plain<i>italic</i>plain<i>italic</i>plain
81 </li><li> plain<b>bold</b>plain
82 </li><li> plain<b>bold</b>plain<b>bold</b>plain
83 </li><li> plain<i>italic</i>plain<b>bold</b>plain
84 </li><li> plain<b>bold</b>plain<i>italic</i>plain
85 </li><li> plain<i>italic<b>bold-italic</b>italic</i>plain
86 </li><li> plain<b>bold<i>bold-italic</i>bold</b>plain
87 </li><li> plain<i><b>bold-italic</b>italic</i>plain
88 </li><li> plain<b><i>bold-italic</i>bold</b>plain
89 </li><li> plain<i>italic<b>bold-italic</b></i>plain
90 </li><li> plain<b>bold<i>bold-italic</i></b>plain
91 </li><li> plain l'<i>italic</i>plain
97 ### <nowiki> test cases
101 <nowiki> unordered list
103 <nowiki>* This is not an unordered list item.</nowiki>
105 <p>* This is not an unordered list item.
112 <nowiki>Lorem ipsum dolor
133 :There is not nowiki.
134 :There is <nowiki>nowiki</nowiki>.
136 #There is not nowiki.
137 #There is <nowiki>nowiki</nowiki>.
139 *There is not nowiki.
140 *There is <nowiki>nowiki</nowiki>.
142 <dl><dd>There is not nowiki.
143 </dd><dd>There is nowiki.
145 <ol><li>There is not nowiki.
146 </li><li>There is nowiki.
148 <ul><li>There is not nowiki.
149 </li><li>There is nowiki.
155 ### comment test cases
160 <!-- comment 1 --> asdf
196 asdf<!-- comment 1 -->jkl
206 <!-- foo --> b <!-- bar -->
218 ### Preformatted text
227 And a [[Main Page|link]]
233 And a <a href="/wiki/Main_Page" title="Main Page">link</a>
245 <dl><dt> name </dt><dd> Definition
255 <dl><dd> Indented text
264 External links: non-bracketed
266 Non-bracketed: http://example.com
268 <p>Non-bracketed: <a href="http://example.com" class='external'>http://example.com</a>
273 External links: numbered
275 Numbered: [http://example.com]
277 <p>Numbered: <a href="http://example.com" class='external' title="http://example.com">[1]</a><span class='urlexpansion'> (<i>http://example.com</i>)</span>
282 External links: specified text
284 Specified text: [http://example.com link]
286 <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>
291 External links: trail
293 Trail (not sure if this is meant to work): [http://example.com link]s
295 <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>
300 External links: dollar sign in URL
302 http://example.com/1$2345
304 <p><a href="http://example.com/1$2345" class='external'>http://example.com/1$2345</a>
309 External links: dollar sign in URL (named)
311 [http://example.com/1$2345]
313 <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>
320 External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
322 <p>External image: <img src="http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" />
327 External image from https
329 External image from https: https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
331 <p>External image from https: <img src="https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" />
336 Link to non-http image, no img tag
338 Link to non-http image, no img tag: ftp://example.com/test.jpg
340 <p>Link to non-http image, no img tag: <a href="ftp://example.com/test.jpg" class='external'>ftp://example.com/test.jpg</a>
345 External links: terminating separator
347 Terminating separator: http://example.com/thing,
349 <p>Terminating separator: <a href="http://example.com/thing" class='external'>http://example.com/thing</a>,
354 External links: intervening separator
356 Intervening separator: http://example.com/1,2,3
358 <p>Intervening separator: <a href="http://example.com/1,2,3" class='external'>http://example.com/1,2,3</a>
363 External links: old bug with URL in query
365 Old bug with URL in query: [http://example.com/thing?url=http://example.com link]
367 <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>
372 External links: old URL-in-URL bug, mixed protocols
374 And again with mixed protocols: [ftp://example.com?url=http://example.com link]
376 <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>
381 External links: URL in text
383 URL in text: [http://example.com http://example.com]
385 <p>URL in text: <a href="http://example.com" class='external'>http://example.com</a>
390 External links: Clickable images
392 ja-style clickable images: [http://example.com http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png]
394 <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>
399 External links: raw ampersand
401 Old & use: http://x&y
403 <p>Old & use: <a href="http://x&y" class='external'>http://x&y</a>
408 External links: www.jpeg.org (bug 554)
412 <p><a href="http://www.jpeg.org" class='external'>http://www.jpeg.org</a>
423 Normal text. '''Bold text.''' Normal text. ''Italic text.''
425 Normal text. '''''Bold italic text.''''' Normal text.
427 <p>Normal text. <b>Bold text.</b> Normal text. <i>Italic text.</i>
428 </p><p>Normal text. <i><b>Bold italic text.</b></i> Normal text.
434 Unclosed and unmatched quotes
436 '''''Bold italic text '''with bold deactivated''' in between.'''''
438 '''''Bold italic text ''with italic deactivated'' in between.'''''
442 ..spanning two paragraphs (should not work).'''
444 '''Bold tag left open
446 ''Italic tag left open
450 <!-- Unmatching number of opening, closing tags: -->
451 '''This year''''s election ''should'' beat '''last year''''s.
453 ''Tom'''s car is bigger than ''Susan'''s.
455 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
456 </p><p><b><i>Bold italic text </i>with italic deactivated<i> in between.</i></b>
457 </p><p><b>Bold text..</b>
458 </p><p>..spanning two paragraphs (should not work).<b></b>
459 </p><p><b>Bold tag left open</b>
460 </p><p><i>Italic tag left open</i>
462 </p><p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
463 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
470 ### content taken from http://meta.wikimedia.org/wiki/MediaWiki_User%27s_Guide:_Using_tables
494 {| border="1" cellpadding="2"
495 |+Multiplication table
497 ! × !! 1 !! 2 !! 3
515 <table border="1" cellpadding="2">
516 <caption>Multiplication table
519 <th> × </th><th> 1 </th><th> 2 </th><th> 3
523 </th><td> 1 </td><td> 2 </td><td> 3
527 </th><td> 2 </td><td> 4 </td><td> 6
531 </th><td> 3 </td><td> 6 </td><td> 9
535 </th><td> 4 </td><td> 8 </td><td> 12
539 </th><td> 5 </td><td> 10 </td><td> 15
547 {| align=right border=1
549 |rowspan=2| Cell 2, row 1 (and 2)
556 <table align=right border=1>
559 </td><td rowspan=2> Cell 2, row 1 (and 2)
560 </td><td> Cell 3, row 1
564 </td><td> Cell 3, row 2
575 {| bgcolor=#ABCDEF border=2
580 |the original table again
587 <table bgcolor=#ABCDEF border=2>
594 </td><td>the original table again
603 Plain link, capitalized
607 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
612 Plain link, uncapitalized
616 <p><a href="/wiki/Main_Page" title="Main Page">main Page</a>
623 [[Main Page|The Main Page]]
625 <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
634 <p><a href="/index.php?title=Zigzagzogzagzig&action=edit" class="new" title="Zigzagzogzagzig">Zigzagzogzagzig</a>
641 xxx[[main Page]], xxx[[Main Page]], Xxx[[main Page]] XXX[[main Page]], XXX[[Main Page]]
643 <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>
650 [[Main Page]]xxx, [[Main Page]]XXX
652 <p><a href="/wiki/Main_Page" title="Main Page">Main Pagexxx</a>, <a href="/wiki/Main_Page" title="Main Page">Main Page</a>XXX
666 Piped link with 3 brackets
668 [[[main page|the main page]]]
670 <p>[[[main page|the main page]]]
677 [[Talk:Parser testing]], [[Meta:Disclaimers]]
679 <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>
684 Piped link to namespace
686 [[Meta:Disclaimers|The disclaimers]]
688 <p><a href="/index.php?title=Meta:Disclaimers&action=edit" class="new" title="Meta:Disclaimers">The disclaimers</a>
695 [[http://www.example.org]]
697 <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>]
701 # I'm fairly sure the expected result here is wrong.
702 # We want these to be URL links, not pseudo-pages with URLs for titles....
703 # However the current output is also pretty screwy.
706 # I'm changing it to match the current output--it arguably makes more
707 # sense in the light of the test above. Old expected result was:
708 #<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>
710 # But I think this test is bordering on "garbage in, garbage out" anyway.
715 Piped link to URL: [[http://www.example.org|an example URL]]
717 <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>]
722 BUG 2: [[page|http://url/]] should link to page, not http://url/
724 [[Main Page|http://url/]]
726 <p><a href="/wiki/Main_Page" title="Main Page">http://url/</a>
736 Inline interwiki link
738 [[MeatBall:SoftSecurity]]
740 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity" class='extiw'>MeatBall:SoftSecurity</a>
766 ### Block-level elements
789 <ol><li>Numbered list
806 ***#Number on level 4
814 <ol><li> with numbers
820 </li><li>bullets again
821 <ul><li>bullet level 2
822 <ul><li>bullet level 3
823 <ol><li>Number on level 4
826 </li><li>bullet level 2
827 <ol><li>Number on level 3
828 </li><li>Number on level 3
831 <ol><li>number level 2
854 Magic links: internal link to RFC
858 <p><a href="/index.php?title=RFC_123&action=edit" class="new" title="RFC 123">RFC 123</a>
867 <p><a href="/index.php?title=Special:Booksources&isbn=0306406152" class="internal">ISBN 0-306-40615-2</a>
872 ### Nonexistant template
877 {{thistemplatedoesnotexist}}
879 <p><a href="/index.php?title=Template:Thistemplatedoesnotexist&action=edit" class="new" title="Template:Thistemplatedoesnotexist">Template:Thistemplatedoesnotexist</a>
889 This is a test template
897 <p>This is a test template
902 Template with explicit namespace
906 <p>This is a test template
914 This is a test template with parameter {{{param}}}
920 {{paramtest|param=foo}}
922 <p>This is a test template with parameter foo
927 Magic variable as template parameter
929 {{paramtest|param={{SITENAME}}}}
931 <p>This is a test template with parameter MediaWiki
942 Template parameter as link source
944 {{linktest|param=Main Page}}
946 <p><a href="/wiki/Main_Page" title="Main Page">link</a>
954 including another template, {{paramtest|param={{{arg}}}}}
958 Template passing argument to another template
960 {{paramtest2|arg='hmm'}}
962 <p>including another template, This is a test template with parameter 'hmm'
973 Template as link source
977 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
995 Template infinite loop
999 <p>{{loop2}}<!-- WARNING: template loop detected -->
1005 ### Pre-save transform tests
1008 pre-save transform: subst:
1014 This is a test template
1018 pre-save transform: normal template
1028 pre-save transform: nonexistant template
1032 {{thistemplatedoesnotexist}}
1034 {{thistemplatedoesnotexist}}
1039 pre-save transform: subst magic variables
1048 # This is bug 89, which I fixed. -- wtm
1050 pre-save transform: subst: templates with parameters
1054 {{subst:paramtest|param="something else"}}
1056 This is a test template with parameter "something else"
1060 ### Message transform tests
1063 message transform: magic variables
1073 message transform: should not transform wiki markup
1090 <p><a href="/wiki/Image:Test" class="image" title="Image: test"><img src="/%7Ewmahan/phase3/images/0/0c/Test" alt="Image: test" /></a>
1097 [[Image:test|right]]
1099 <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>
1106 [[Image:test|right|Caption text]]
1108 <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>
1113 Image with frame and link
1115 [[Image:Foobar.jpg|frame|left|This is a test image [[Main Page]]]]
1117 <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>
1126 <p><a href="/wiki/Image:Test" title="Image:Test">Image:test</a>
1134 Subpage test/subpage
1142 subpage title=[[Subpage test]]
1146 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a>
1151 Subpage noslash link
1153 subpage title=[[Subpage test]]
1157 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">subpage</a>
1161 # bug 561: it would be nice if this linked to /subpage -- wtm
1167 <p><a href="/index.php?title=Subpage&action=edit" class="new" title="Subpage">subpage</a>
1175 Category:MediaWiki User's Guide
1183 [[:Category:MediaWiki User's Guide]]
1185 <p><a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">Category:MediaWiki User's Guide</a>
1194 [[Category: MediaWiki User's Guide]]
1196 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
1200 ### Inter-language links
1203 Inter-language links
1209 [[zh:食品]]
1211 es:Alimento fr:Nourriture zh:食品