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
12 # Tests can be disabled with the '!!disabled' flag.
14 # For testing purposes, temporary articles can created:
15 # !!article / NAMESPACE:TITLE / !!text / ARTICLE TEXT / !!endarticle
16 # where '/' denotes a newline.
30 This is a simple paragraph.
32 <p>This is a simple paragraph.
52 * plain''italic''plain
53 * plain''italic''plain''italic''plain
54 * plain'''bold'''plain
55 * plain'''bold'''plain'''bold'''plain
56 * plain''italic''plain'''bold'''plain
57 * plain'''bold'''plain''italic''plain
58 * plain''italic'''bold-italic'''italic''plain
59 * plain'''bold''bold-italic''bold'''plain
60 * plain'''''bold-italic'''italic''plain
61 * plain'''''bold-italic''bold'''plain
62 * plain''italic'''bold-italic'''''plain
63 * plain'''bold''bold-italic'''''plain
64 * plain l'''italic''plain
67 </li><li> plain<i>italic</i>plain
68 </li><li> plain<i>italic</i>plain<i>italic</i>plain
69 </li><li> plain<b>bold</b>plain
70 </li><li> plain<b>bold</b>plain<b>bold</b>plain
71 </li><li> plain<i>italic</i>plain<b>bold</b>plain
72 </li><li> plain<b>bold</b>plain<i>italic</i>plain
73 </li><li> plain<i>italic<b>bold-italic</b>italic</i>plain
74 </li><li> plain<b>bold<i>bold-italic</i>bold</b>plain
75 </li><li> plain<i><b>bold-italic</b>italic</i>plain
76 </li><li> plain<b><i>bold-italic</i>bold</b>plain
77 </li><li> plain<i>italic<b>bold-italic</b></i>plain
78 </li><li> plain<b>bold<i>bold-italic</i></b>plain
79 </li><li> plain l'<i>italic</i>plain
85 ### <nowiki> test cases
89 <nowiki> unordered list
91 <nowiki>* This is not an unordered list item.</nowiki>
93 <p>* This is not an unordered list item.
100 <nowiki>Lorem ipsum dolor
121 :There is not nowiki.
122 :There is <nowiki>nowiki</nowiki>.
124 #There is not nowiki.
125 #There is <nowiki>nowiki</nowiki>.
127 *There is not nowiki.
128 *There is <nowiki>nowiki</nowiki>.
130 <dl><dd>There is not nowiki.
131 </dd><dd>There is nowiki.
133 <ol><li>There is not nowiki.
134 </li><li>There is nowiki.
136 <ul><li>There is not nowiki.
137 </li><li>There is nowiki.
143 ### comment test cases
148 <!-- comment 1 --> asdf
184 asdf<!-- comment 1 -->jkl
194 External links: non-bracketed
196 Non-bracketed: http://example.com
198 <p>Non-bracketed: <a href="http://example.com" class='external'>http://example.com</a>
203 External links: numbered
205 Numbered: [http://example.com]
207 <p>Numbered: <a href="http://example.com" class='external' title="http://example.com">[1]</a><span class='urlexpansion'> (<i>http://example.com</i>)</span>
212 External links: specified text
214 Specified text: [http://example.com link]
216 <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>
221 External links: trail
223 Trail (not sure if this is meant to work): [http://example.com link]s
225 <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>
230 External links: dollar sign in URL
232 http://example.com/1$2345
234 <p><a href="http://example.com/1$2345" class='external'>http://example.com/1$2345</a>
239 External links: dollar sign in URL (named)
241 [http://example.com/1$2345]
243 <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>
250 External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
252 <p>External image: <img src="http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" />
257 External image from https
259 External image from https: https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
261 <p>External image from https: <img src="https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" />
266 Link to non-http image, no img tag
268 Link to non-http image, no img tag: ftp://example.com/test.jpg
270 <p>Link to non-http image, no img tag: <a href="ftp://example.com/test.jpg" class='external'>ftp://example.com/test.jpg</a>
275 External links: terminating separator
277 Terminating separator: http://example.com/thing,
279 <p>Terminating separator: <a href="http://example.com/thing" class='external'>http://example.com/thing</a>,
284 External links: intervening separator
286 Intervening separator: http://example.com/1,2,3
288 <p>Intervening separator: <a href="http://example.com/1,2,3" class='external'>http://example.com/1,2,3</a>
293 External links: old bug with URL in query
295 Old bug with URL in query: [http://example.com/thing?url=http://example.com link]
297 <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>
302 External links: old URL-in-URL bug, mixed protocols
304 And again with mixed protocols: [ftp://example.com?url=http://example.com link]
306 <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>
311 External links: URL in text
313 URL in text: [http://example.com http://example.com]
315 <p>URL in text: <a href="http://example.com" class='external'>http://example.com</a>
320 External links: Clickable images
322 ja-style clickable images: [http://example.com http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png]
324 <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>
329 External links: raw ampersand
331 Old & use: http://x&y
333 <p>Old & use: <a href="http://x&y" class='external'>http://x&y</a>
338 External links: www.jpeg.org (bug 554)
342 <p><a href="http://www.jpeg.org" class='external'>http://www.jpeg.org</a>
353 Normal text. '''Bold text.''' Normal text. ''Italic text.''
355 Normal text. '''''Bold italic text.''''' Normal text.
357 <p>Normal text. <b>Bold text.</b> Normal text. <i>Italic text.</i>
358 </p><p>Normal text. <i><b>Bold italic text.</b></i> Normal text.
364 Unclosed and unmatched quotes
366 '''''Bold italic text '''with bold deactivated''' in between.'''''
368 '''''Bold italic text ''with italic deactivated'' in between.'''''
372 ..spanning two paragraphs (should not work).'''
374 '''Bold tag left open
376 ''Italic tag left open
380 <!-- Unmatching number of opening, closing tags: -->
381 '''This year''''s election ''should'' beat '''last year''''s.
383 ''Tom'''s car is bigger than ''Susan'''s.
385 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
386 </p><p><b><i>Bold italic text </i>with italic deactivated<i> in between.</i></b>
387 </p><p><b>Bold text..</b>
388 </p><p>..spanning two paragraphs (should not work).<b></b>
389 </p><p><b>Bold tag left open</b>
390 </p><p><i>Italic tag left open</i>
392 </p><p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
393 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
400 ### content taken from http://meta.wikimedia.org/wiki/MediaWiki_User%27s_Guide:_Using_tables
424 {| border="1" cellpadding="2"
425 |+Multiplication table
427 ! × !! 1 !! 2 !! 3
445 <table border="1" cellpadding="2">
446 <caption>Multiplication table
449 <th> × </th><th> 1 </th><th> 2 </th><th> 3
453 </th><td> 1 </td><td> 2 </td><td> 3
457 </th><td> 2 </td><td> 4 </td><td> 6
461 </th><td> 3 </td><td> 6 </td><td> 9
465 </th><td> 4 </td><td> 8 </td><td> 12
469 </th><td> 5 </td><td> 10 </td><td> 15
477 {| align=right border=1
479 |rowspan=2| Cell 2, row 1 (and 2)
486 <table align=right border=1>
489 </td><td rowspan=2> Cell 2, row 1 (and 2)
490 </td><td> Cell 3, row 1
494 </td><td> Cell 3, row 2
505 {| bgcolor=#ABCDEF border=2
510 |the original table again
517 <table bgcolor=#ABCDEF border=2>
524 </td><td>the original table again
539 Plain link, capitalized
543 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
548 Plain link, uncapitalized
552 <p><a href="/wiki/Main_Page" title="Main Page">main Page</a>
559 [[Main Page|The Main Page]]
561 <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
570 <p><a href="/index.php?title=Zigzagzogzagzig&action=edit" class="new" title="Zigzagzogzagzig">Zigzagzogzagzig</a>
577 xxx[[main Page]], xxx[[Main Page]], Xxx[[main Page]] XXX[[main Page]], XXX[[Main Page]]
579 <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>
586 [[Main Page]]xxx, [[Main Page]]XXX
588 <p><a href="/wiki/Main_Page" title="Main Page">Main Pagexxx</a>, <a href="/wiki/Main_Page" title="Main Page">Main Page</a>XXX
602 Piped link with 3 brackets
604 [[[main page|the main page]]]
606 <p>[[[main page|the main page]]]
613 [[Talk:Parser testing]], [[Meta:Disclaimers]]
615 <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>
620 Piped link to namespace
622 [[Meta:Disclaimers|The disclaimers]]
624 <p><a href="/index.php?title=Meta:Disclaimers&action=edit" class="new" title="Meta:Disclaimers">The disclaimers</a>
629 Category:MediaWiki User's Guide
637 [[:Category:MediaWiki User's Guide]]
639 <p><a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">Category:MediaWiki User's Guide</a>
646 [[:Image:Ncwikicol.png]]
648 <p><a href="/wiki/Image:Ncwikicol.png" title="Image:Ncwikicol.png">Image:Ncwikicol.png</a>
655 [[http://www.example.org]]
657 <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>]
661 # I'm fairly sure the expected result here is wrong.
662 # We want these to be URL links, not pseudo-pages with URLs for titles....
663 # However the current output is also pretty screwy.
667 Piped link to URL: [[http://www.example.org|an example URL]]
669 <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>
674 BUG 2: [[page|http://url/]] should link to page, not http://url/
676 [[Main Page|http://url/]]
678 <p><a href="/wiki/Main_Page" title="Main Page">http://url/</a>
688 Inline interwiki link
690 [[MeatBall:SoftSecurity]]
692 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity" class='extiw'>MeatBall:SoftSecurity</a>
718 ### Block-level elements
741 <ol><li>Numbered list
758 ***#Number on level 4
766 <ol><li> with numbers
772 </li><li>bullets again
773 <ul><li>bullet level 2
774 <ul><li>bullet level 3
775 <ol><li>Number on level 4
778 </li><li>bullet level 2
779 <ol><li>Number on level 3
780 </li><li>Number on level 3
783 <ol><li>number level 2
806 Magic links: internal link to RFC
810 <p><a href="/index.php?title=RFC_123&action=edit" class="new" title="RFC 123">RFC 123</a>
819 <p><a href="/index.php?title=Special:Booksources&isbn=0306406152" class="internal">ISBN 0-306-40615-2</a>
824 ### Nonexistant template
829 {{thistemplatedoesnotexist}}
831 <p><a href="/index.php?title=Template:Thistemplatedoesnotexist&action=edit" class="new" title="Template:Thistemplatedoesnotexist">Template:Thistemplatedoesnotexist</a>
841 This is a test template
849 <p>This is a test template
854 Template with explicit namespace
858 <p>This is a test template
866 This is a test template with parameter {{{param}}}
872 {{paramtest|param=foo}}
874 <p>This is a test template with parameter foo
879 Magic variable as template parameter
881 {{paramtest|param={{SITENAME}}}}
883 <p>This is a test template with parameter MediaWiki
894 Template parameter as link source
896 {{linktest|param=Main Page}}
898 <p><a href="/wiki/Main_Page" title="Main Page">link</a>
910 Template as link source
914 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
931 Template infinite loop
935 <p>{{loop2}}<!-- WARNING: template loop detected -->
941 ### Pre-save transform tests
944 pre-save transform: subst:
950 This is a test template
954 pre-save transform: normal template
964 pre-save transform: nonexistant template
968 {{thistemplatedoesnotexist}}
970 {{thistemplatedoesnotexist}}
974 pre-save transform: subst magic variables
984 ### Message transform tests
987 message transform: magic variables
997 message transform: should not transform wiki markup