1) Use CREATE TEMPORARY TABLE ... LIKE for MySQL >= 4.1
[mediawiki.git] / maintenance / parserTests.txt
blobabe4107be6716668437b33d3a55105e9430382ce
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.
27 !! article
28 Main Page
29 !! text
30 blah blah
31 !! endarticle
33 ###
34 ### Basic tests
35 ###
36 !! test
37 Blank input
38 !! input
39 !! result
40 !! end
43 !! test
44 Simple paragraph
45 !! input
46 This is a simple paragraph.
47 !! result
48 <p>This is a simple paragraph.
49 </p>
50 !! end
52 !! test
53 Simple list
54 !! input
55 * Item 1
56 * Item 2
57 !! result
58 <ul><li> Item 1
59 </li><li> Item 2
60 </li></ul>
62 !! end
64 !! test
65 Italics and bold
66 !! input
67 * plain
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
81 !! result
82 <ul><li> 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
96 </li></ul>
98 !! end
101 ### <nowiki> test cases
104 !! test
105 <nowiki> unordered list
106 !! input
107 <nowiki>* This is not an unordered list item.</nowiki>
108 !! result
109 <p>* This is not an unordered list item.
110 </p>
111 !! end
113 !! test
114 <nowiki> spacing
115 !! input
116 <nowiki>Lorem ipsum dolor
118 sed abit.
119   sed nullum.
121 :and a colon
122 </nowiki>
123 !! result
124 <p>Lorem ipsum dolor
126 sed abit.
127   sed nullum.
129 :and a colon
131 </p>
132 !! end
134 !! test
135 nowiki 3
136 !! input
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>.
145 !! result
146 <dl><dd>There is not nowiki.
147 </dd><dd>There is nowiki.
148 </dd></dl>
149 <ol><li>There is not nowiki.
150 </li><li>There is nowiki.
151 </li></ol>
152 <ul><li>There is not nowiki.
153 </li><li>There is nowiki.
154 </li></ul>
156 !! end
159 ### comment test cases
161 !! test
162 Comment test 1
163 !! input
164 <!-- comment 1 --> asdf
165 <!-- comment 2 -->
166 !! result
167 <pre>asdf
168 </pre>
170 !! end
172 !! test
173 Comment test 2
174 !! input
175 asdf
176 <!-- comment 1 -->
178 !! result
179 <p>asdf
181 </p>
182 !! end
184 !! test
185 Comment test 3
186 !! input
187 asdf
188 <!-- comment 1 -->
189 <!-- comment 2 -->
191 !! result
192 <p>asdf
194 </p>
195 !! end
197 !! test
198 Comment test 4
199 !! input
200 asdf<!-- comment 1 -->jkl
201 !! result
202 <p>asdfjkl
203 </p>
204 !! end
206 !! test
207 Comment spacing
208 !! input
210  <!-- foo --> b <!-- bar -->
212 !! result
213 <p>a
214 </p>
215 <pre> b 
216 </pre>
217 <p>c
218 </p>
219 !! end
222 ### Preformatted text
224 !! test
225 Preformatted text
226 !! input
227  This is some
228  Preformatted text
229  With ''italic''
230  And '''bold'''
231  And a [[Main Page|link]]
232 !! result
233 <pre>This is some
234 Preformatted text
235 With <i>italic</i>
236 And <b>bold</b>
237 And a <a href="/wiki/Main_Page" title="Main Page">link</a>
238 </pre>
239 !! end
242 ### Definition list
244 !! test
245 Simple definition
246 !! input
247 ; name : Definition
248 !! result
249 <dl><dt> name&nbsp;</dt><dd> Definition
250 </dd></dl>
252 !! end
254 !! test
255 Simple definition
256 !! input
257 : Indented text
258 !! result
259 <dl><dd> Indented text
260 </dd></dl>
262 !! end
264 !! test
265 Definition list with no space
266 !! input
267 ;name:Definition
268 !! result
269 <dl><dt>name</dt><dd>Definition
270 </dd></dl>
272 !!end
274 !! test
275 Definition list with URL link
276 !! input
277 ; http://example.com/ : definition
278 !! result
279 <dl><dt> <a href="http://example.com/" class='external'>http://example.com/</a>&nbsp;</dt><dd> definition
280 </dd></dl>
282 !! end
284 !! test
285 Definition list with bracketed URL link
286 !! input
287 ;[http://www.google.com/ Google]:Number one search engine
288 !! result
289 <dl><dt><a href="http://www.google.com/" class='external' title="http://www.google.com/">Google</a><span class='urlexpansion'> (<i>http://www.google.com/</i>)</span></dt><dd>Number one search engine
290 </dd></dl>
292 !! end
294 !! test
295 Definition list with wikilink containing colon
296 !! input
297 ; [[Wikipedia:FAQ]]: The least-read page on Wikipedia
298 !! result
299 <dl><dt> <a href="http://en.wikipedia.org/wiki/FAQ" class='extiw'>Wikipedia:FAQ</a></dt><dd> The least-read page on Wikipedia
300 </dd></dl>
302 !! end
304 # At Brion's and JeLuF's insistence... :)
305 !! test
306 Definition list with wikilink containing colon
307 !! input
308 ;  news:alt.wikipedia.rox: This isn't even a real newsgroup!
309 !! result
310 <dl><dt>  <a href="news:alt.wikipedia.rox" class='external'>news:alt.wikipedia.rox</a></dt><dd> This isn't even a real newsgroup!
311 </dd></dl>
313 !! end
315 !! test
316 Malformed definition list with colon
317 !! input
318 ;  news:alt.wikipedia.rox -- don't crash or enter an infinite loop
319 !! result
320 <dl><dt>  <a href="news:alt.wikipedia.rox" class='external'>news:alt.wikipedia.rox</a> -- don't crash or enter an infinite loop
321 </dt></dl>
323 !! end
325 !! test
326 Definition lists: colon in external link text
327 !! input
328 ; [http://www.wikipedia2.org/ Wikipedia : The Next Generation]: OK, I made that up
329 !! result
330 <dl><dt> <a href="http://www.wikipedia2.org/" class='external' title="http://www.wikipedia2.org/">Wikipedia&nbsp;: The Next Generation</a><span class='urlexpansion'> (<i>http://www.wikipedia2.org/</i>)</span></dt><dd> OK, I made that up
331 </dd></dl>
333 !! end
337 ### External links
339 !! test
340 External links: non-bracketed
341 !! input
342 Non-bracketed: http://example.com
343 !! result
344 <p>Non-bracketed: <a href="http://example.com" class='external'>http://example.com</a>
345 </p>
346 !! end
348 !! test
349 External links: numbered
350 !! input
351 Numbered: [http://example.com]
352 !! result
353 <p>Numbered: <a href="http://example.com" class='external' title="http://example.com">[1]</a><span class='urlexpansion'> (<i>http://example.com</i>)</span>
354 </p>
355 !!end
357 !! test
358 External links: specified text
359 !! input
360 Specified text: [http://example.com link]
361 !! result
362 <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>
363 </p>
364 !!end
366 !! test
367 External links: trail
368 !! input
369 Trail (not sure if this is meant to work): [http://example.com link]s
370 !! result
371 <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>
372 </p>
373 !! end
375 !! test
376 External links: dollar sign in URL
377 !! input
378 http://example.com/1$2345
379 !! result
380 <p><a href="http://example.com/1$2345" class='external'>http://example.com/1$2345</a>
381 </p>
382 !! end
384 !! test
385 External links: dollar sign in URL (named)
386 !! input
387 [http://example.com/1$2345]
388 !! result
389 <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>
390 </p>
391 !!end
393 !! test
394 External image
395 !! input
396 External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
397 !! result
398 <p>External image: <img src="http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" />
399 </p>
400 !! end
402 !! test
403 External image from https
404 !! input
405 External image from https: https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
406 !! result
407 <p>External image from https: <img src="https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" />
408 </p>
409 !! end
411 !! test
412 Link to non-http image, no img tag
413 !! input
414 Link to non-http image, no img tag: ftp://example.com/test.jpg
415 !! result
416 <p>Link to non-http image, no img tag: <a href="ftp://example.com/test.jpg" class='external'>ftp://example.com/test.jpg</a>
417 </p>
418 !! end
420 !! test
421 External links: terminating separator
422 !! input
423 Terminating separator: http://example.com/thing,
424 !! result
425 <p>Terminating separator: <a href="http://example.com/thing" class='external'>http://example.com/thing</a>,
426 </p>
427 !! end
429 !! test
430 External links: intervening separator
431 !! input
432 Intervening separator: http://example.com/1,2,3
433 !! result
434 <p>Intervening separator: <a href="http://example.com/1,2,3" class='external'>http://example.com/1,2,3</a>
435 </p>
436 !! end
438 !! test
439 External links: old bug with URL in query
440 !! input
441 Old bug with URL in query: [http://example.com/thing?url=http://example.com link]
442 !! result
443 <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>
444 </p>
445 !! end
447 !! test
448 External links: old URL-in-URL bug, mixed protocols
449 !! input
450 And again with mixed protocols: [ftp://example.com?url=http://example.com link]
451 !! result
452 <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>
453 </p>
454 !!end
456 !! test
457 External links: URL in text
458 !! input
459 URL in text: [http://example.com http://example.com]
460 !! result
461 <p>URL in text: <a href="http://example.com" class='external'>http://example.com</a>
462 </p>
463 !! end
465 !! test
466 External links: Clickable images
467 !! input
468 ja-style clickable images: [http://example.com http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png]
469 !! result
470 <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>
471 </p>
472 !!end
474 !! test
475 External links: raw ampersand
476 !! input
477 Old &amp; use: http://x&y
478 !! result
479 <p>Old &amp; use: <a href="http://x&amp;y" class='external'>http://x&amp;y</a>
480 </p>
481 !! end
483 !! test
484 External links: www.jpeg.org (bug 554)
485 !! input
486 http://www.jpeg.org
487 !!result
488 <p><a href="http://www.jpeg.org" class='external'>http://www.jpeg.org</a>
489 </p>
490 !! end
492 !! test
493 External links: URL within URL (original bug 2)
494 !! input
495 [http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp]
496 !! result
497 <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>
498 </p>
499 !! end
502 ### Quotes
505 !! test
506 Quotes
507 !! input
508 Normal text. '''Bold text.''' Normal text. ''Italic text.''
510 Normal text. '''''Bold italic text.''''' Normal text.
511 !!result
512 <p>Normal text. <b>Bold text.</b> Normal text. <i>Italic text.</i>
513 </p><p>Normal text. <i><b>Bold italic text.</b></i> Normal text.
514 </p>
515 !! end
518 !! test
519 Unclosed and unmatched quotes
520 !! input
521 '''''Bold italic text '''with bold deactivated''' in between.'''''
523 '''''Bold italic text ''with italic deactivated'' in between.'''''
525 '''Bold text..
527 ..spanning two paragraphs (should not work).'''
529 '''Bold tag left open
531 ''Italic tag left open
533 Normal text.
535 <!-- Unmatching number of opening, closing tags: -->
536 '''This year''''s election ''should'' beat '''last year''''s.
538 ''Tom'''s car is bigger than ''Susan'''s.
539 !! result
540 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
541 </p><p><b><i>Bold italic text </i>with italic deactivated<i> in between.</i></b>
542 </p><p><b>Bold text..</b>
543 </p><p>..spanning two paragraphs (should not work).<b></b>
544 </p><p><b>Bold tag left open</b>
545 </p><p><i>Italic tag left open</i>
546 </p><p>Normal text.
547 </p><p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
548 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
549 </p>
550 !! end
553 ### Tables
555 ### content taken from http://meta.wikimedia.org/wiki/MediaWiki_User%27s_Guide:_Using_tables
557 !! test
558 Simple table
559 !! input
560 {| 
561 | 1 || 2
562 |- 
563 | 3 || 4
565 !! result
566 <table >
567 <tr >
568 <td> 1 </td><td> 2
569 </td></tr>
570 <tr >
571 <td> 3 </td><td> 4
572 </td></tr></table>
574 !! end
576 !! test
577 Multiplication table
578 !! input
579 {| border="1" cellpadding="2"
580 |+Multiplication table
582 ! &times; !! 1 !! 2 !! 3
584 ! 1
585 | 1 || 2 || 3
587 ! 2
588 | 2 || 4 || 6
590 ! 3
591 | 3 || 6 || 9
593 ! 4
594 | 4 || 8 || 12
596 ! 5
597 | 5 || 10 || 15
599 !! result
600 <table border="1" cellpadding="2">
601 <caption>Multiplication table
602 </caption>
603 <tr >
604 <th> &times; </th><th> 1 </th><th> 2 </th><th> 3
605 </th></tr>
606 <tr >
607 <th> 1
608 </th><td> 1 </td><td> 2 </td><td> 3
609 </td></tr>
610 <tr >
611 <th> 2
612 </th><td> 2 </td><td> 4 </td><td> 6
613 </td></tr>
614 <tr >
615 <th> 3
616 </th><td> 3 </td><td> 6 </td><td> 9
617 </td></tr>
618 <tr >
619 <th> 4
620 </th><td> 4 </td><td> 8 </td><td> 12
621 </td></tr>
622 <tr >
623 <th> 5
624 </th><td> 5 </td><td> 10 </td><td> 15
625 </td></tr></table>
627 !! end
629 !! test
630 Table rowspan
631 !! input
632 {| align=right border=1
633 | Cell 1, row 1 
634 |rowspan=2| Cell 2, row 1 (and 2) 
635 | Cell 3, row 1 
636 |- 
637 | Cell 1, row 2 
638 | Cell 3, row 2 
640 !! result
641 <table align=right border=1>
642 <tr >
643 <td> Cell 1, row 1
644 </td><td rowspan=2> Cell 2, row 1 (and 2)
645 </td><td> Cell 3, row 1
646 </td></tr>
647 <tr >
648 <td> Cell 1, row 2
649 </td><td> Cell 3, row 2
650 </td></tr></table>
652 !! end
654 !! test
655 Nested table
656 !! input
657 {| border=1
658 | &alpha;
660 {| bgcolor=#ABCDEF border=2
661 |nested
663 |table
665 |the original table again
667 !! result
668 <table border=1>
669 <tr >
670 <td> &alpha;
671 </td><td>
672 <table bgcolor=#ABCDEF border=2>
673 <tr >
674 <td>nested
675 </td></tr>
676 <tr >
677 <td>table
678 </td></tr></table>
679 </td><td>the original table again
680 </td></tr></table>
682 !! end
685 ### Internal links
687 !! test
688 Plain link, capitalized
689 !! input
690 [[Main Page]]
691 !! result
692 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
693 </p>
694 !! end
696 !! test
697 Plain link, uncapitalized
698 !! input
699 [[main Page]]
700 !! result
701 <p><a href="/wiki/Main_Page" title="Main Page">main Page</a>
702 </p>
703 !! end
705 !! test
706 Piped link
707 !! input
708 [[Main Page|The Main Page]]
709 !! result
710 <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
711 </p>
712 !! end
714 !! test
715 Broken link
716 !! input
717 [[Zigzagzogzagzig]]
718 !! result
719 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit" class="new" title="Zigzagzogzagzig">Zigzagzogzagzig</a>
720 </p>
721 !! end
723 !! test
724 Link with prefix
725 !! input
726 xxx[[main Page]], xxx[[Main Page]], Xxx[[main Page]] XXX[[main Page]], XXX[[Main Page]]
727 !! result
728 <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>
729 </p>
730 !! end
732 !! test
733 Link with suffix
734 !! input
735 [[Main Page]]xxx, [[Main Page]]XXX
736 !! result
737 <p><a href="/wiki/Main_Page" title="Main Page">Main Pagexxx</a>, <a href="/wiki/Main_Page" title="Main Page">Main Page</a>XXX
738 </p>
739 !! end
741 !! test
742 Link with 3 brackets
743 !! input
744 [[[main page]]]
745 !! result
746 <p>[[[main page]]]
747 </p>
748 !! end
750 !! test
751 Piped link with 3 brackets
752 !! input
753 [[[main page|the main page]]]
754 !! result
755 <p>[[[main page|the main page]]]
756 </p>
757 !! end
759 !! test
760 Link to namespaces
761 !! input
762 [[Talk:Parser testing]], [[Meta:Disclaimers]]
763 !! result
764 <p><a href="/index.php?title=Talk:Parser_testing&amp;action=edit" class="new" title="Talk:Parser testing">Talk:Parser testing</a>, <a href="/index.php?title=Meta:Disclaimers&amp;action=edit" class="new" title="Meta:Disclaimers">Meta:Disclaimers</a>
765 </p>
766 !! end
768 !! test
769 Piped link to namespace
770 !! input
771 [[Meta:Disclaimers|The disclaimers]]
772 !! result
773 <p><a href="/index.php?title=Meta:Disclaimers&amp;action=edit" class="new" title="Meta:Disclaimers">The disclaimers</a>
774 </p>
775 !! end
777 !! test
778 Link containing }
779 !! input
780 [[Usually caused by a typo (oops}]]
781 !! result
782 <p>[[Usually caused by a typo (oops}]]
783 </p>
784 !! end
787 !! test
788 Plain link to URL
789 !! input
790 [[http://www.example.org]]
791 !! result
792 <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>]
793 </p>
794 !! end
796 # I'm fairly sure the expected result here is wrong.
797 # We want these to be URL links, not pseudo-pages with URLs for titles....
798 # However the current output is also pretty screwy.
800 # ----
801 # I'm changing it to match the current output--it arguably makes more
802 # sense in the light of the test above. Old expected result was:
803 #<p>Piped link to URL: <a href="/index.php?title=Http://www.example.org&amp;action=edit" class="new" title="Http://www.example.org">an example URL</a>
804 #</p>
805 # But I think this test is bordering on "garbage in, garbage out" anyway.
806 # -- wtm
807 !! test
808 Piped link to URL
809 !! input
810 Piped link to URL: [[http://www.example.org|an example URL]]
811 !! result
812 <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>]
813 </p>
814 !! end
816 !! test
817 BUG 2: [[page|http://url/]] should link to page, not http://url/
818 !! input
819 [[Main Page|http://url/]]
820 !! result
821 <p><a href="/wiki/Main_Page" title="Main Page">http://url/</a>
822 </p>
823 !! end
827 ### Interwiki links
830 !! test
831 Inline interwiki link
832 !! input
833 [[MeatBall:SoftSecurity]]
834 !! result
835 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity" class='extiw'>MeatBall:SoftSecurity</a>
836 </p>
837 !! end
840 ## XHTML tidiness
843 !! test
844 <br> to <br />
845 !! input
846 1<br>2<br />3
847 !! result
848 <p>1<br />2<br />3
849 </p>
850 !! end
853 ### Block-level elements
855 !! test
856 Common list
857 !! input
858 *Common list
859 * item 2
860 *item 3
861 !! result
862 <ul><li>Common list
863 </li><li> item 2
864 </li><li>item 3
865 </li></ul>
867 !! end
869 !! test
870 Numbered list
871 !! input
872 #Numbered list
873 #item 2
874 # item 3
875 !! result
876 <ol><li>Numbered list
877 </li><li>item 2
878 </li><li> item 3
879 </li></ol>
881 !! end
883 !! test
884 Mixed list
885 !! input
886 *Mixed list
887 *# with numbers
888 ** and bullets
889 *# and numbers
890 *bullets again
891 **bullet level 2
892 ***bullet level 3
893 ***#Number on level 4
894 **bullet level 2
895 **#Number on level 3
896 **#Number on level 3
897 *#number level 2
898 *Level 1
899 !! result
900 <ul><li>Mixed list
901 <ol><li> with numbers
902 </li></ol>
903 <ul><li> and bullets
904 </li></ul>
905 <ol><li> and numbers
906 </li></ol>
907 </li><li>bullets again
908 <ul><li>bullet level 2
909 <ul><li>bullet level 3
910 <ol><li>Number on level 4
911 </li></ol>
912 </li></ul>
913 </li><li>bullet level 2
914 <ol><li>Number on level 3
915 </li><li>Number on level 3
916 </li></ol>
917 </li></ul>
918 <ol><li>number level 2
919 </li></ol>
920 </li><li>Level 1
921 </li></ul>
923 !! end
926 ### Magic variables
928 !! test
929 Magic variables
930 !! input
931 {{SITENAME}}
932 !! result
933 <p>MediaWiki
934 </p>
935 !! end
938 ### Magic links
940 !! test
941 Magic links: internal link to RFC
942 !! input
943 [[RFC 123]]
944 !! result
945 <p><a href="/index.php?title=RFC_123&amp;action=edit" class="new" title="RFC 123">RFC 123</a>
946 </p>
947 !! end
949 !! test
950 Magic links: RFC
951 !! input
952 RFC 822
953 !! result
954 <p><a href='http://www.faqs.org/rfcs/rfc822.html' class='external' title="http://www.faqs.org/rfcs/rfc822.html">RFC 822</a>
955 </p>
956 !! end
958 !! test
959 Magic links: ISBN
960 !! input
961 ISBN 0-306-40615-2
962 !! result
963 <p><a href="/index.php?title=Special:Booksources&amp;isbn=0306406152" class="internal">ISBN 0-306-40615-2</a>
964 </p>
965 !! end
968 ### Templates
969 ####
971 !! test
972 Nonexistant template
973 !! input
974 {{thistemplatedoesnotexist}}
975 !! result
976 <p><a href="/index.php?title=Template:Thistemplatedoesnotexist&amp;action=edit" class="new" title="Template:Thistemplatedoesnotexist">Template:Thistemplatedoesnotexist</a>
977 </p>
978 !! end
980 !! article
981 Template:test
982 !! text
983 This is a test template
984 !! endarticle
986 !! test
987 Simple template
988 !! input
989 {{test}}
990 !! result
991 <p>This is a test template
992 </p>
993 !! end
995 !! test
996 Template with explicit namespace
997 !! input
998 {{Template:test}}
999 !! result
1000 <p>This is a test template
1001 </p>
1002 !! end
1005 !! article
1006 Template:paramtest
1007 !! text
1008 This is a test template with parameter {{{param}}}
1009 !! endarticle
1011 !! test
1012 Template parameter
1013 !! input
1014 {{paramtest|param=foo}}
1015 !! result
1016 <p>This is a test template with parameter foo
1017 </p>
1018 !! end
1020 !! test
1021 Magic variable as template parameter
1022 !! input
1023 {{paramtest|param={{SITENAME}}}}
1024 !! result
1025 <p>This is a test template with parameter MediaWiki
1026 </p>
1027 !! end
1029 !! article
1030 Template:linktest
1031 !! text
1032 [[{{{param}}}|link]]
1033 !! endarticle
1035 !! test
1036 Template parameter as link source
1037 !! input
1038 {{linktest|param=Main Page}}
1039 !! result
1040 <p><a href="/wiki/Main_Page" title="Main Page">link</a>
1041 </p>
1042 !! end
1045 !!article
1046 Template:paramtest2
1047 !! text
1048 including another template, {{paramtest|param={{{arg}}}}}
1049 !! endarticle
1051 !! test
1052 Template passing argument to another template
1053 !! input
1054 {{paramtest2|arg='hmm'}}
1055 !! result
1056 <p>including another template, This is a test template with parameter 'hmm'
1057 </p>
1058 !! end
1060 !! article
1061 Template:Linktest2
1062 !! text
1063 Main Page
1064 !! endarticle
1066 !! test
1067 Template as link source
1068 !! input
1069 [[{{linktest2}}]]
1070 !! result
1071 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
1072 </p>
1073 !! end
1076 !! article
1077 Template:loop1
1078 !! text
1079 {{loop2}}
1080 !! endarticle
1082 !! article
1083 Template:loop2
1084 !! text
1085 {{loop1}}
1086 !! endarticle
1088 !! test
1089 Template infinite loop
1090 !! input
1091 {{loop1}}
1092 !! result
1093 <p>{{loop2}}<!-- WARNING: template loop detected -->
1094 </p>
1095 !! end
1097 !! test
1098 Template from main namespace
1099 !! input
1100 {{:Main Page}}
1101 !! result
1102 <p>blah blah
1103 </p>
1104 !! end
1106 !! article
1107 Template:table
1108 !! text
1109 {| 
1110 | 1 || 2
1111 |- 
1112 | 3 || 4
1114 !! endarticle
1116 !! test
1117 BUG 529: Template with table, not included at beginning of line
1118 !! input
1119 foo {{table}}
1120 !! result
1121 <p>foo 
1122 </p>
1123 <table >
1124 <tr >
1125 <td> 1 </td><td> 2
1126 </td></tr>
1127 <tr >
1128 <td> 3 </td><td> 4
1129 </td></tr></table>
1131 !! end
1133 !! test
1134 BUG 523: Template shouldn't eat newline (or add an extra one before table)
1135 !! input
1137 {{table}}
1138 !! result
1139 <p>foo
1140 </p>
1141 <table >
1142 <tr >
1143 <td> 1 </td><td> 2
1144 </td></tr>
1145 <tr >
1146 <td> 3 </td><td> 4
1147 </td></tr></table>
1149 !! end
1151 !! test
1152 BUG 41: Template parameters shown as broken links
1153 !! input
1154 {{{parameter}}}
1155 !! result
1156 <p>{{{parameter}}}
1157 </p>
1158 !! end
1161 !! article
1162 Template:MSGNW test
1163 !! text
1164 ''None'' of '''this''' should be 
1165 * interepreted
1166  but rather passed unmodified
1167 {{test}}
1168 !! endarticle
1170 # hmm, fix this or just deprecate msgnw and document its behavior?
1171 !! test
1172 msgnw keyword
1173 !! options
1174 disabled
1175 !! input
1176 {{msgnw:MSGNW test}}
1177 !! result
1178 <p>''None'' of '''this''' should be 
1179 * interepreted
1180  but rather passed unmodified
1181 {{test}}
1182 </p>
1183 !! end
1185 !! test
1186 int keyword
1187 !! input
1188 {{int:newmessages|lots of money}}
1189 !! result
1190 <p>You have lots of money.
1191 </p>
1192 !! end
1195 ### Pre-save transform tests
1197 !! test
1198 pre-save transform: subst:
1199 !! options
1201 !! input
1202 {{subst:test}}
1203 !! result
1204 This is a test template
1205 !! end
1207 !! test
1208 pre-save transform: normal template
1209 !! options
1211 !! input
1212 {{test}}
1213 !! result
1214 {{test}}
1215 !! end
1217 !! test
1218 pre-save transform: nonexistant template
1219 !! options
1221 !! input
1222 {{thistemplatedoesnotexist}}
1223 !! result
1224 {{thistemplatedoesnotexist}}
1225 !! end
1228 !! test
1229 pre-save transform: subst magic variables
1230 !! options
1232 !! input
1233 {{subst:SITENAME}}
1234 !! result
1235 MediaWiki
1236 !! end
1238 # This is bug 89, which I fixed. -- wtm
1239 !! test
1240 pre-save transform: subst: templates with parameters
1241 !! options
1243 !! input
1244 {{subst:paramtest|param="something else"}}
1245 !! result
1246 This is a test template with parameter "something else"
1247 !! end
1250 ### Message transform tests
1252 !! test
1253 message transform: magic variables
1254 !! options
1256 !! input
1257 {{SITENAME}}
1258 !! result
1259 MediaWiki
1260 !! end
1262 !! test
1263 message transform: should not transform wiki markup
1264 !! options
1266 !! input
1267 ''test''
1268 !! result
1269 ''test''
1270 !! end
1273 ### Images
1275 !! test
1276 Simple image
1277 !! input
1278 [[Image: test]]
1279 !! result
1280 <p><a href="/wiki/Image:Test" class="image" title="Image: test"><img src="/images/0/0c/Test" alt="Image: test" /></a>
1281 </p>
1282 !! end
1284 !! test
1285 Right-aligned image
1286 !! input
1287 [[Image:test|right]]
1288 !! result
1289 <div class="floatright"><span><a href="/wiki/Image:Test" class="image" title="right"><img src="/images/0/0c/Test" alt="right" /></a></span></div>
1291 !! end
1293 !! test
1294 Image with caption
1295 !! input
1296 [[Image:test|right|Caption text]]
1297 !! result
1298 <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>
1300 !! end
1302 !! test
1303 Image with frame and link
1304 !! input
1305 [[Image:Foobar.jpg|frame|left|This is a test image [[Main Page]]]]
1306 !! result
1307 <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>
1309 !! end
1311 !! test
1312 Link to image page
1313 !! input
1314 [[:Image:test]]
1315 !! result
1316 <p><a href="/wiki/Image:Test" title="Image:Test">Image:test</a>
1317 </p>
1318 !! end
1321 ### Subpages
1323 !! article
1324 Subpage test/subpage
1325 !! text
1327 !! endarticle
1329 !! test
1330 Subpage link
1331 !! options
1332 subpage title=[[Subpage test]]
1333 !! input
1334 [[/subpage]]
1335 !! result
1336 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a>
1337 </p>
1338 !! end
1340 !! test
1341 Subpage noslash link
1342 !! options
1343 subpage title=[[Subpage test]]
1344 !!input
1345 [[/subpage/]]
1346 !! result
1347 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">subpage</a>
1348 </p>
1349 !! end
1351 !! test
1352 Disabled subpages
1353 !! input
1354 [[/subpage]]
1355 !! result
1356 <p><a href="/index.php?title=/subpage&amp;action=edit" class="new" title="/subpage">/subpage</a>
1357 </p>
1358 !! end
1360 !! test
1361 BUG 561: {{/Subpage}}
1362 !! options
1363 subpage title=[[Page]]
1364 !! input
1365 {{/Subpage}}
1366 !! result
1367 <p><a href="/index.php?title=Page/Subpage&amp;action=edit" class="new" title="Page/Subpage">Page/Subpage</a>
1368 </p>
1369 !! end
1372 ### Categories
1374 !! article
1375 Category:MediaWiki User's Guide
1376 !! text
1377 blah
1378 !! endarticle
1380 !! test
1381 Link to category
1382 !! input
1383 [[:Category:MediaWiki User's Guide]]
1384 !! result
1385 <p><a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">Category:MediaWiki User's Guide</a>
1386 </p>
1387 !! end
1389 !! test
1390 Simple category
1391 !! options
1393 !! input
1394 [[Category: MediaWiki User's Guide]]
1395 !! result
1396 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
1397 !! end
1400 ### Inter-language links
1402 !! test
1403 Inter-language links
1404 !! options
1406 !! input
1407 [[es:Alimento]]
1408 [[fr:Nourriture]]
1409 [[zh:&#39135;&#21697;]]
1410 !! result
1411 es:Alimento fr:Nourriture zh:食品
1412 !! end
1415 ### Sections
1417 !! test
1418 Basic section headings
1419 !! input
1420 == Headline 1 ==
1421 Some text
1423 ==Headline 2==
1424 More
1425 ===Smaller headline===
1426 Blah blah
1427 !! result
1428 <div class="editsection" style="float:right;margin-left:5px;">[<a href="/index.php?title=Parser_test_script&amp;action=edit&amp;section=1" title="Parser test script">edit</a>]</div><a name="Headline_1"></a><h2> Headline 1 </h2>
1429 <p>Some text
1430 </p>
1431 <div class="editsection" style="float:right;margin-left:5px;">[<a href="/index.php?title=Parser_test_script&amp;action=edit&amp;section=2" title="Parser test script">edit</a>]</div><a name="Headline_2"></a><h2>Headline 2</h2>
1432 <p>More
1433 </p>
1434 <div class="editsection" style="float:right;margin-left:5px;">[<a href="/index.php?title=Parser_test_script&amp;action=edit&amp;section=3" title="Parser test script">edit</a>]</div><a name="Smaller_headline"></a><h3>Smaller headline</h3>
1435 <p>Blah blah
1436 </p>
1437 !! end
1439 !! test
1440 Section headings with TOC
1441 !! input
1442 == Headline 1 ==
1443 === Subheadline 1 ===
1444 ===== Skipping a level =====
1445 ====== Skipping a level ======
1447 == Headline 2 ==
1448 Some text
1449 ===Another headline===
1450 !! result
1451 <table border="0" id="toc"><tr id="toctitle"><td align="center">
1452 <b>Table of contents</b> <script type="text/javascript">showTocToggle("show","hide")</script></td></tr><tr id="tocinside"><td>
1453 <div class="tocline"><a href="#Headline_1">1 Headline 1</a><br /></div>
1454 <div class="tocindent">
1455 <p><a href="#Subheadline_1">1.1 Subheadline 1</a><br />
1456 </p>
1457 <div class="tocindent">
1458 <div class="tocindent">
1459 <p><a href="#Skipping_a_level">1.1.1 Skipping a level</a><br />
1460 </p>
1461 <div class="tocindent">
1462 <p><a href="#Skipping_a_level_2">1.1.1.1 Skipping a level</a><br />
1463 </p>
1464 </div>
1465 </div>
1466 </div>
1467 </div>
1468 <div class="tocline"><a href="#Headline_2">2 Headline 2</a><br /></div>
1469 <div class="tocindent">
1470 <p><a href="#Another_headline">2.1 Another headline</a><br />
1471 </p>
1472 </div>
1473 </td></tr></table>
1474 <div class="editsection" style="float:right;margin-left:5px;">[<a href="/index.php?title=Parser_test_script&amp;action=edit&amp;section=1" title="Parser test script">edit</a>]</div><a name="Headline_1"></a><h2> Headline 1 </h2>
1475 <div class="editsection" style="float:right;margin-left:5px;">[<a href="/index.php?title=Parser_test_script&amp;action=edit&amp;section=2" title="Parser test script">edit</a>]</div><a name="Subheadline_1"></a><h3> Subheadline 1 </h3>
1476 <div class="editsection" style="float:right;margin-left:5px;">[<a href="/index.php?title=Parser_test_script&amp;action=edit&amp;section=3" title="Parser test script">edit</a>]</div><a name="Skipping_a_level"></a><h5> Skipping a level </h5>
1477 <div class="editsection" style="float:right;margin-left:5px;">[<a href="/index.php?title=Parser_test_script&amp;action=edit&amp;section=4" title="Parser test script">edit</a>]</div><a name="Skipping_a_level_2"></a><h6> Skipping a level </h6>
1478 <div class="editsection" style="float:right;margin-left:5px;">[<a href="/index.php?title=Parser_test_script&amp;action=edit&amp;section=5" title="Parser test script">edit</a>]</div><a name="Headline_2"></a><h2> Headline 2 </h2>
1479 <p>Some text
1480 </p>
1481 <div class="editsection" style="float:right;margin-left:5px;">[<a href="/index.php?title=Parser_test_script&amp;action=edit&amp;section=6" title="Parser test script">edit</a>]</div><a name="Another_headline"></a><h3>Another headline</h3>
1483 !! end
1485 !! test
1486 Resolving duplicate section names
1487 !! input
1488 == Foo bar ==
1489 ==Foo bar==
1490 !! result
1491 <div class="editsection" style="float:right;margin-left:5px;">[<a href="/index.php?title=Parser_test_script&amp;action=edit&amp;section=1" title="Parser test script">edit</a>]</div><a name="Foo_bar"></a><h2> Foo bar </h2>
1492 <div class="editsection" style="float:right;margin-left:5px;">[<a href="/index.php?title=Parser_test_script&amp;action=edit&amp;section=2" title="Parser test script">edit</a>]</div><a name="Foo_bar_2"></a><h2>Foo bar</h2>
1494 !! end
1496 !! article
1497 Template:sections
1498 !! text
1499 ===Section 1===
1500 ==Section 2==
1501 !! endarticle
1503 !! test
1504 Template with sections, __NOTOC__
1505 !! options title=[[Parser test script]]
1506 !! input
1507 __NOTOC__
1508 ==Section 0==
1509 {{sections}}
1510 ==Section 4==
1511 !! result
1512 <div class="editsection" style="float:right;margin-left:5px;">[<a href="/index.php?title=Parser_test_script&amp;action=edit&amp;section=1" title="Parser test script">edit</a>]</div><a name="Section_0"></a><h2>Section 0</h2>
1513 <div class="editsection" style="float:right;margin-left:5px;">[<a href="/index.php?title=Template:Sections&amp;action=edit&amp;section=1" title="Template:Sections">edit</a>]</div><a name="Section_1"></a><h3>Section 1</h3>
1514 <div class="editsection" style="float:right;margin-left:5px;">[<a href="/index.php?title=Template:Sections&amp;action=edit&amp;section=2" title="Template:Sections">edit</a>]</div><a name="Section_2"></a><h2>Section 2</h2>
1515 <div class="editsection" style="float:right;margin-left:5px;">[<a href="/index.php?title=Parser_test_script&amp;action=edit&amp;section=2" title="Parser test script">edit</a>]</div><a name="Section_4"></a><h2>Section 4</h2>
1517 !! end
1519 !! test
1520 __NOEDITSECTION__ keyword
1521 !! input
1522 __NOEDITSECTION__
1523 ==Section 1==
1524 ==Section 2==
1525 !! result
1526 <a name="Section_1"></a><h2>Section 1</h2>
1527 <a name="Section_2"></a><h2>Section 2</h2>
1529 !! end
1531 TODO:
1532 more images
1533 more tables
1534 math
1535 character entities
1536 and much more