Disable pretty italics inside links. Now the italics inside a link alternate text...
[mediawiki.git] / maintenance / parserTests.txt
blobbf94ea81be3da8f1cc44c3708946143790652725
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 #       noxml           don't check for XML well formdness
20 #       title=[[XXX]]   run test using article title XXX
21 #       language=XXX    set content language to XXX for this test
22 #       variant=XXX     set the variant of language for this test (eg zh-tw)
23 #       disabled        do not run test
24 #       showtitle       make the first line the title
25 #   comment     run through Linker::formatComment() instead of main parser
26 #   local       format section links in edit comment text as local links
28 # For testing purposes, temporary articles can created:
29 # !!article / NAMESPACE:TITLE / !!text / ARTICLE TEXT / !!endarticle
30 # where '/' denotes a newline.
32 # This is the standard article assumed to exist.
33 !! article
34 Main Page
35 !! text
36 blah blah
37 !! endarticle
39 !!article 
40 Template:Foo
41 !!text
42 FOO
43 !!endarticle
45 !! article 
46 Template:Blank
47 !! text
48 !! endarticle
50 !! article
51 Template:!
52 !! text
54 !! endarticle
56 ###
57 ### Basic tests
58 ###
59 !! test
60 Blank input
61 !! input
62 !! result
63 !! end
66 !! test
67 Simple paragraph
68 !! input
69 This is a simple paragraph.
70 !! result
71 <p>This is a simple paragraph.
72 </p>
73 !! end
75 !! test
76 Simple list
77 !! input
78 * Item 1
79 * Item 2
80 !! result
81 <ul><li> Item 1
82 </li><li> Item 2
83 </li></ul>
85 !! end
87 !! test
88 Italics and bold
89 !! input
90 * plain
91 * plain''italic''plain
92 * plain''italic''plain''italic''plain
93 * plain'''bold'''plain
94 * plain'''bold'''plain'''bold'''plain
95 * plain''italic''plain'''bold'''plain
96 * plain'''bold'''plain''italic''plain
97 * plain''italic'''bold-italic'''italic''plain
98 * plain'''bold''bold-italic''bold'''plain
99 * plain'''''bold-italic'''italic''plain
100 * plain'''''bold-italic''bold'''plain
101 * plain''italic'''bold-italic'''''plain
102 * plain'''bold''bold-italic'''''plain
103 * plain l'''italic''plain
104 * plain l''''bold''' plain
105 !! result
106 <ul><li> plain
107 </li><li> plain<i>italic</i>plain
108 </li><li> plain<i>italic</i>plain<i>italic</i>plain
109 </li><li> plain<b>bold</b>plain
110 </li><li> plain<b>bold</b>plain<b>bold</b>plain
111 </li><li> plain<i>italic</i>plain<b>bold</b>plain
112 </li><li> plain<b>bold</b>plain<i>italic</i>plain
113 </li><li> plain<i>italic<b>bold-italic</b>italic</i>plain
114 </li><li> plain<b>bold<i>bold-italic</i>bold</b>plain
115 </li><li> plain<i><b>bold-italic</b>italic</i>plain
116 </li><li> plain<b><i>bold-italic</i>bold</b>plain
117 </li><li> plain<i>italic<b>bold-italic</b></i>plain
118 </li><li> plain<b>bold<i>bold-italic</i></b>plain
119 </li><li> plain l'<i>italic</i>plain
120 </li><li> plain l'<b>bold</b> plain
121 </li></ul>
123 !! end
126 ### <nowiki> test cases
129 !! test
130 <nowiki> unordered list
131 !! input
132 <nowiki>* This is not an unordered list item.</nowiki>
133 !! result
134 <p>* This is not an unordered list item.
135 </p>
136 !! end
138 !! test
139 <nowiki> spacing
140 !! input
141 <nowiki>Lorem ipsum dolor
143 sed abit.
144   sed nullum.
146 :and a colon
147 </nowiki>
148 !! result
149 <p>Lorem ipsum dolor
151 sed abit.
152   sed nullum.
154 :and a colon
156 </p>
157 !! end
159 !! test
160 nowiki 3
161 !! input
162 :There is not nowiki.
163 :There is <nowiki>nowiki</nowiki>.
165 #There is not nowiki.
166 #There is <nowiki>nowiki</nowiki>.
168 *There is not nowiki.
169 *There is <nowiki>nowiki</nowiki>.
170 !! result
171 <dl><dd>There is not nowiki.
172 </dd><dd>There is nowiki.
173 </dd></dl>
174 <ol><li>There is not nowiki.
175 </li><li>There is nowiki.
176 </li></ol>
177 <ul><li>There is not nowiki.
178 </li><li>There is nowiki.
179 </li></ul>
181 !! end
185 ### Comments
187 !! test
188 Comment test 1
189 !! input
190 <!-- comment 1 --> asdf
191 <!-- comment 2 -->
192 !! result
193 <pre>asdf
194 </pre>
196 !! end
198 !! test
199 Comment test 2
200 !! input
201 asdf
202 <!-- comment 1 -->
204 !! result
205 <p>asdf
207 </p>
208 !! end
210 !! test
211 Comment test 3
212 !! input
213 asdf
214 <!-- comment 1 -->
215 <!-- comment 2 -->
217 !! result
218 <p>asdf
220 </p>
221 !! end
223 !! test
224 Comment test 4
225 !! input
226 asdf<!-- comment 1 -->jkl
227 !! result
228 <p>asdfjkl
229 </p>
230 !! end
232 !! test
233 Comment spacing
234 !! input
236  <!-- foo --> b <!-- bar -->
238 !! result
239 <p>a
240 </p>
241 <pre> b 
242 </pre>
243 <p>c
244 </p>
245 !! end
247 !! test
248 Comment whitespace
249 !! input
250 <!-- returns a single newline, not nothing, since the newline after > is not stripped -->
251 !! result
253 !! end
255 !! test
256 Comment semantics and delimiters
257 !! input
258 <!-- --><!----><!-----><!------>
259 !! result
261 !! end
263 !! test
264 Comment semantics and delimiters, redux
265 !! input
266 <!-- In SGML every "foo" here would actually show up in the text -- foo -- bar
267 -- foo -- funky huh? ... -->
268 !! result
270 !! end
272 !! test
273 Comment semantics and delimiters: directors cut
274 !! input
275 <!-- ... However we like to keep things simple and somewhat XML-ish so we eat
276 everything starting with < followed by !-- until the first -- and > we see,
277 that wouldn't be valid XML however, since in XML -- has to terminate a comment
278 -->-->
279 !! result
280 <p>--&gt;
281 </p>
282 !! end
284 !! test
285 Comment semantics: nesting
286 !! input
287 <!--<!-- no, we're not going to do anything fancy here -->-->
288 !! result
289 <p>--&gt;
290 </p>
291 !! end
293 !! test
294 Comment semantics: unclosed comment at end
295 !! input
296 <!--This comment will run out to the end of the document
297 !! result
299 !! end
301 !! test
302 Comment in template title
303 !! input
304 {{f<!---->oo}}
305 !! result
306 <p>FOO
307 </p>
308 !! end
310 !! test
311 Comment on its own line post-expand
312 !! input
314 {{blank}}<!---->
316 !! result
317 <p>a
318 </p><p>b
319 </p>
320 !! end
323 ### Preformatted text
325 !! test
326 Preformatted text
327 !! input
328  This is some
329  Preformatted text
330  With ''italic''
331  And '''bold'''
332  And a [[Main Page|link]]
333 !! result
334 <pre>This is some
335 Preformatted text
336 With <i>italic</i>
337 And <b>bold</b>
338 And a <a href="/wiki/Main_Page" title="Main Page">link</a>
339 </pre>
340 !! end
342 !! test
343 <pre> with <nowiki> inside (compatibility with 1.6 and earlier)
344 !! input
345 <pre><nowiki>
347 <cite>
348 <em>
349 </nowiki></pre>
350 !! result
351 <pre>
352 &lt;b&gt;
353 &lt;cite&gt;
354 &lt;em&gt;
355 </pre>
357 !! end
359 !! test
360 Regression with preformatted in <center>
361 !! input
362 <center>
363  Blah
364 </center>
365 !! result
366 <center>
367 <pre>Blah
368 </pre>
369 </center>
371 !! end
373 !! test
374 <pre> with attributes (bug 3202)
375 !! input
376 <pre style="background: blue; color:white">Bluescreen of WikiDeath</pre>
377 !! result
378 <pre style="background: blue; color:white">Bluescreen of WikiDeath</pre>
380 !! end
382 !! test
383 <pre> with width attribute (bug 3202)
384 !! input
385 <pre width="8">Narrow screen goodies</pre>
386 !! result
387 <pre width="8">Narrow screen goodies</pre>
389 !! end
391 !! test
392 <pre> with forbidden attribute (bug 3202)
393 !! input
394 <pre width="8" onmouseover="alert(document.cookie)">Narrow screen goodies</pre>
395 !! result
396 <pre width="8">Narrow screen goodies</pre>
398 !! end
400 !! test
401 <pre> with forbidden attribute values (bug 3202)
402 !! input
403 <pre width="8" style="border-width: expression(alert(document.cookie))">Narrow screen goodies</pre>
404 !! result
405 <pre width="8" style="/* insecure input */">Narrow screen goodies</pre>
407 !! end
410 ### Definition lists
412 !! test
413 Simple definition
414 !! input
415 ; name : Definition
416 !! result
417 <dl><dt> name&#160;</dt><dd> Definition
418 </dd></dl>
420 !! end
422 !! test
423 Definition list for indentation only
424 !! input
425 : Indented text
426 !! result
427 <dl><dd> Indented text
428 </dd></dl>
430 !! end
432 !! test
433 Definition list with no space
434 !! input
435 ;name:Definition
436 !! result
437 <dl><dt>name</dt><dd>Definition
438 </dd></dl>
440 !!end
442 !! test
443 Definition list with URL link
444 !! input
445 ; http://example.com/ : definition
446 !! result
447 <dl><dt> <a href="http://example.com/" class="external free" rel="nofollow">http://example.com/</a>&#160;</dt><dd> definition
448 </dd></dl>
450 !! end
452 !! test
453 Definition list with bracketed URL link
454 !! input
455 ;[http://www.example.com/ Example]:Something about it
456 !! result
457 <dl><dt><a href="http://www.example.com/" class="external text" rel="nofollow">Example</a></dt><dd>Something about it
458 </dd></dl>
460 !! end
462 !! test
463 Definition list with wikilink containing colon
464 !! input
465 ; [[Help:FAQ]]: The least-read page on Wikipedia
466 !! result
467 <dl><dt> <a href="/index.php?title=Help:FAQ&amp;action=edit&amp;redlink=1" class="new" title="Help:FAQ (page does not exist)">Help:FAQ</a></dt><dd> The least-read page on Wikipedia
468 </dd></dl>
470 !! end
472 # At Brion's and JeLuF's insistence... :)
473 !! test
474 Definition list with news link containing colon
475 !! input
476 ;  news:alt.wikipedia.rox: This isn't even a real newsgroup!
477 !! result
478 <dl><dt>  <a href="news:alt.wikipedia.rox" class="external free" rel="nofollow">news:alt.wikipedia.rox</a></dt><dd> This isn't even a real newsgroup!
479 </dd></dl>
481 !! end
483 !! test
484 Malformed definition list with colon
485 !! input
486 ;  news:alt.wikipedia.rox -- don't crash or enter an infinite loop
487 !! result
488 <dl><dt>  <a href="news:alt.wikipedia.rox" class="external free" rel="nofollow">news:alt.wikipedia.rox</a> -- don't crash or enter an infinite loop
489 </dt></dl>
491 !! end
493 !! test
494 Definition lists: colon in external link text
495 !! input
496 ; [http://www.wikipedia2.org/ Wikipedia : The Next Generation]: OK, I made that up
497 !! result
498 <dl><dt> <a href="http://www.wikipedia2.org/" class="external text" rel="nofollow">Wikipedia&#160;: The Next Generation</a></dt><dd> OK, I made that up
499 </dd></dl>
501 !! end
503 !! test
504 Definition lists: colon in HTML attribute
505 !! input
506 ;<b style="display: inline">bold</b>
507 !! result
508 <dl><dt><b style="display: inline">bold</b>
509 </dt></dl>
511 !! end
514 !! test
515 Definition lists: self-closed tag
516 !! input
517 ;one<br/>two : two-line fun
518 !! result
519 <dl><dt>one<br />two&#160;</dt><dd> two-line fun
520 </dd></dl>
522 !! end
526 ### External links
528 !! test
529 External links: non-bracketed
530 !! input
531 Non-bracketed: http://example.com
532 !! result
533 <p>Non-bracketed: <a href="http://example.com" class="external free" rel="nofollow">http://example.com</a>
534 </p>
535 !! end
537 !! test
538 External links: numbered
539 !! input
540 Numbered: [http://example.com]
541 Numbered: [http://example.net]
542 Numbered: [http://example.com]
543 !! result
544 <p>Numbered: <a href="http://example.com" class="external autonumber" rel="nofollow">[1]</a>
545 Numbered: <a href="http://example.net" class="external autonumber" rel="nofollow">[2]</a>
546 Numbered: <a href="http://example.com" class="external autonumber" rel="nofollow">[3]</a>
547 </p>
548 !!end
550 !! test
551 External links: specified text
552 !! input
553 Specified text: [http://example.com link]
554 !! result
555 <p>Specified text: <a href="http://example.com" class="external text" rel="nofollow">link</a>
556 </p>
557 !!end
559 !! test
560 External links: trail
561 !! input
562 Linktrails should not work for external links: [http://example.com link]s
563 !! result
564 <p>Linktrails should not work for external links: <a href="http://example.com" class="external text" rel="nofollow">link</a>s
565 </p>
566 !! end
568 !! test
569 External links: dollar sign in URL
570 !! input
571 http://example.com/1$2345
572 !! result
573 <p><a href="http://example.com/1$2345" class="external free" rel="nofollow">http://example.com/1$2345</a>
574 </p>
575 !! end
577 !! test
578 External links: dollar sign in URL (named)
579 !! input
580 [http://example.com/1$2345]
581 !! result
582 <p><a href="http://example.com/1$2345" class="external autonumber" rel="nofollow">[1]</a>
583 </p>
584 !!end
586 !! test
587 External links: open square bracket forbidden in URL (bug 4377)
588 !! input
589 http://example.com/1[2345
590 !! result
591 <p><a href="http://example.com/1" class="external free" rel="nofollow">http://example.com/1</a>[2345
592 </p>
593 !! end
595 !! test
596 External links: open square bracket forbidden in URL (named) (bug 4377)
597 !! input
598 [http://example.com/1[2345]
599 !! result
600 <p><a href="http://example.com/1" class="external text" rel="nofollow">[2345</a>
601 </p>
602 !!end
604 !! test
605 External links: nowiki in URL link text (bug 6230)
606 !!input
607 [http://example.com/ <nowiki>''example site''</nowiki>]
608 !! result
609 <p><a href="http://example.com/" class="external text" rel="nofollow">''example site''</a>
610 </p>
611 !! end
613 !! test
614 External links: newline forbidden in text (bug 6230 regression check)
615 !! input
616 [http://example.com/ first
617 second]
618 !! result
619 <p>[<a href="http://example.com/" class="external free" rel="nofollow">http://example.com/</a> first
620 second]
621 </p>
622 !!end
624 !! test
625 External image
626 !! input
627 External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
628 !! result
629 <p>External image: <img src="http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" />
630 </p>
631 !! end
633 !! test
634 External image from https
635 !! input
636 External image from https: https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
637 !! result
638 <p>External image from https: <img src="https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" />
639 </p>
640 !! end
642 !! test
643 Link to non-http image, no img tag
644 !! input
645 Link to non-http image, no img tag: ftp://example.com/test.jpg
646 !! result
647 <p>Link to non-http image, no img tag: <a href="ftp://example.com/test.jpg" class="external free" rel="nofollow">ftp://example.com/test.jpg</a>
648 </p>
649 !! end
651 !! test
652 External links: terminating separator
653 !! input
654 Terminating separator: http://example.com/thing,
655 !! result
656 <p>Terminating separator: <a href="http://example.com/thing" class="external free" rel="nofollow">http://example.com/thing</a>,
657 </p>
658 !! end
660 !! test
661 External links: intervening separator
662 !! input
663 Intervening separator: http://example.com/1,2,3
664 !! result
665 <p>Intervening separator: <a href="http://example.com/1,2,3" class="external free" rel="nofollow">http://example.com/1,2,3</a>
666 </p>
667 !! end
669 !! test
670 External links: old bug with URL in query
671 !! input
672 Old bug with URL in query: [http://example.com/thing?url=http://example.com link]
673 !! result
674 <p>Old bug with URL in query: <a href="http://example.com/thing?url=http://example.com" class="external text" rel="nofollow">link</a>
675 </p>
676 !! end
678 !! test
679 External links: old URL-in-URL bug, mixed protocols
680 !! input
681 And again with mixed protocols: [ftp://example.com?url=http://example.com link]
682 !! result
683 <p>And again with mixed protocols: <a href="ftp://example.com?url=http://example.com" class="external text" rel="nofollow">link</a>
684 </p>
685 !!end
687 !! test
688 External links: URL in text
689 !! input
690 URL in text: [http://example.com http://example.com]
691 !! result
692 <p>URL in text: <a href="http://example.com" class="external free" rel="nofollow">http://example.com</a>
693 </p>
694 !! end
696 !! test
697 External links: Clickable images
698 !! input
699 ja-style clickable images: [http://example.com http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png]
700 !! result
701 <p>ja-style clickable images: <a href="http://example.com" class="external text" rel="nofollow"><img src="http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" /></a>
702 </p>
703 !!end
705 !! test
706 External links: raw ampersand
707 !! input
708 Old &amp; use: http://x&y
709 !! result
710 <p>Old &amp; use: <a href="http://x&amp;y" class="external free" rel="nofollow">http://x&amp;y</a>
711 </p>
712 !! end
714 !! test
715 External links: encoded ampersand
716 !! input
717 Old &amp; use: http://x&amp;y
718 !! result
719 <p>Old &amp; use: <a href="http://x&amp;y" class="external free" rel="nofollow">http://x&amp;y</a>
720 </p>
721 !! end
723 !! test
724 External links: encoded equals (bug 6102)
725 !! input
726 http://example.com/?foo&#61;bar
727 !! result
728 <p><a href="http://example.com/?foo=bar" class="external free" rel="nofollow">http://example.com/?foo=bar</a>
729 </p>
730 !! end
732 !! test
733 External links: [raw ampersand]
734 !! input
735 Old &amp; use: [http://x&y]
736 !! result
737 <p>Old &amp; use: <a href="http://x&amp;y" class="external autonumber" rel="nofollow">[1]</a>
738 </p>
739 !! end
741 !! test
742 External links: [encoded ampersand]
743 !! input
744 Old &amp; use: [http://x&amp;y]
745 !! result
746 <p>Old &amp; use: <a href="http://x&amp;y" class="external autonumber" rel="nofollow">[1]</a>
747 </p>
748 !! end
750 !! test
751 External links: [encoded equals] (bug 6102)
752 !! input
753 [http://example.com/?foo&#61;bar]
754 !! result
755 <p><a href="http://example.com/?foo=bar" class="external autonumber" rel="nofollow">[1]</a>
756 </p>
757 !! end
759 !! test
760 External links: [IDN ignored character reference in hostname; strip it right off]
761 !! input
762 [http://e&zwnj;xample.com/]
763 !! result
764 <p><a href="http://example.com/" class="external autonumber" rel="nofollow">[1]</a>
765 </p>
766 !! end
768 !! test
769 External links: IDN ignored character reference in hostname; strip it right off
770 !! input
771 http://e&zwnj;xample.com/
772 !! result
773 <p><a href="http://example.com/" class="external free" rel="nofollow">http://example.com/</a>
774 </p>
775 !! end
777 !! test
778 External links: www.jpeg.org (bug 554)
779 !! input
780 http://www.jpeg.org
781 !!result
782 <p><a href="http://www.jpeg.org" class="external free" rel="nofollow">http://www.jpeg.org</a>
783 </p>
784 !! end
786 !! test
787 External links: URL within URL (original bug 2)
788 !! input
789 [http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp]
790 !! result
791 <p><a href="http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp" class="external autonumber" rel="nofollow">[1]</a>
792 </p>
793 !! end
795 !! test
796 BUG 361: URL inside bracketed URL
797 !! input
798 [http://www.example.com/foo http://www.example.com/bar]
799 !! result
800 <p><a href="http://www.example.com/foo" class="external text" rel="nofollow">http://www.example.com/bar</a>
801 </p>
802 !! end
804 !! test
805 BUG 361: URL within URL, not bracketed
806 !! input
807 http://www.example.com/foo?=http://www.example.com/bar
808 !! result
809 <p><a href="http://www.example.com/foo?=http://www.example.com/bar" class="external free" rel="nofollow">http://www.example.com/foo?=http://www.example.com/bar</a>
810 </p>
811 !! end
813 !! test
814 BUG 289: ">"-token in URL-tail
815 !! input
816 http://www.example.com/<hello>
817 !! result
818 <p><a href="http://www.example.com/" class="external free" rel="nofollow">http://www.example.com/</a>&lt;hello&gt;
819 </p>
820 !!end
822 !! test
823 BUG 289: literal ">"-token in URL-tail
824 !! input
825 http://www.example.com/<b>html</b>
826 !! result
827 <p><a href="http://www.example.com/" class="external free" rel="nofollow">http://www.example.com/</a><b>html</b>
828 </p>
829 !!end
831 !! test
832 BUG 289: ">"-token in bracketed URL
833 !! input
834 [http://www.example.com/<hello> stuff]
835 !! result
836 <p><a href="http://www.example.com/" class="external text" rel="nofollow">&lt;hello&gt; stuff</a>
837 </p>
838 !!end
840 !! test
841 BUG 289: literal ">"-token in bracketed URL
842 !! input
843 [http://www.example.com/<b>html</b> stuff]
844 !! result
845 <p><a href="http://www.example.com/" class="external text" rel="nofollow"><b>html</b> stuff</a>
846 </p>
847 !!end
849 !! test
850 BUG 289: literal double quote at end of URL
851 !! input
852 http://www.example.com/"hello"
853 !! result
854 <p><a href="http://www.example.com/" class="external free" rel="nofollow">http://www.example.com/</a>"hello"
855 </p>
856 !!end
858 !! test
859 BUG 289: literal double quote in bracketed URL
860 !! input
861 [http://www.example.com/"hello" stuff]
862 !! result
863 <p><a href="http://www.example.com/" class="external text" rel="nofollow">"hello" stuff</a>
864 </p>
865 !!end
867 !! test
868 External links: multiple legal whitespace is fine, Magnus. Don't break it please. (bug 5081)
869 !! input
870 [http://www.example.com  test]
871 !! result
872 <p><a href="http://www.example.com" class="external text" rel="nofollow">test</a>
873 </p>
874 !! end
876 !! test
877 External links: wiki links within external link (Bug 3695)
878 !! input
879 [http://example.com [[wikilink]] embedded in ext link]
880 !! result
881 <p><a href="http://example.com" class="external text" rel="nofollow"></a><a href="/index.php?title=Wikilink&amp;action=edit&amp;redlink=1" class="new" title="Wikilink (page does not exist)">wikilink</a><a href="http://example.com" class="external text" rel="nofollow"> embedded in ext link</a>
882 </p>
883 !! end
885 !! test
886 BUG 787: Links with one slash after the url protocol are invalid
887 !! input
888 http:/example.com
890 [http:/example.com title]
891 !! result
892 <p>http:/example.com
893 </p><p>[http:/example.com title]
894 </p>
895 !! end
897 !! test
898 Bug 2702: Mismatched <i>, <b> and <a> tags are invalid
899 !! input
900 ''[http://example.com text'']
901 [http://example.com '''text]'''
902 ''Something [http://example.com in italic'']
903 ''Something [http://example.com mixed''''', even bold]'''
904 '''''Now [http://example.com both''''']
905 !! result
906 <p><a href="http://example.com" class="external text" rel="nofollow"><i>text</i></a>
907 <a href="http://example.com" class="external text" rel="nofollow"><b>text</b></a>
908 <i>Something </i><a href="http://example.com" class="external text" rel="nofollow"><i>in italic</i></a>
909 <i>Something </i><a href="http://example.com" class="external text" rel="nofollow"><i>mixed</i><b>, even bold</b></a>
910 <i><b>Now </b></i><a href="http://example.com" class="external text" rel="nofollow"><i><b>both</b></i></a>
911 </p>
912 !! end
915 !! test
916 Bug 4781: %26 in URL
917 !! input
918 http://www.example.com/?title=AT%26T
919 !! result
920 <p><a href="http://www.example.com/?title=AT%26T" class="external free" rel="nofollow">http://www.example.com/?title=AT%26T</a>
921 </p>
922 !! end
924 !! test
925 Bug 4781, 5267: %26 in URL
926 !! input
927 http://www.example.com/?title=100%25_Bran
928 !! result
929 <p><a href="http://www.example.com/?title=100%25_Bran" class="external free" rel="nofollow">http://www.example.com/?title=100%25_Bran</a>
930 </p>
931 !! end
933 !! test
934 Bug 4781, 5267: %28, %29 in URL
935 !! input
936 http://www.example.com/?title=Ben-Hur_%281959_film%29
937 !! result
938 <p><a href="http://www.example.com/?title=Ben-Hur_%281959_film%29" class="external free" rel="nofollow">http://www.example.com/?title=Ben-Hur_%281959_film%29</a>
939 </p>
940 !! end
943 !! test
944 Bug 4781: %26 in autonumber URL
945 !! input
946 [http://www.example.com/?title=AT%26T]
947 !! result
948 <p><a href="http://www.example.com/?title=AT%26T" class="external autonumber" rel="nofollow">[1]</a>
949 </p>
950 !! end
952 !! test
953 Bug 4781, 5267: %26 in autonumber URL
954 !! input
955 [http://www.example.com/?title=100%25_Bran]
956 !! result
957 <p><a href="http://www.example.com/?title=100%25_Bran" class="external autonumber" rel="nofollow">[1]</a>
958 </p>
959 !! end
961 !! test
962 Bug 4781, 5267: %28, %29 in autonumber URL
963 !! input
964 [http://www.example.com/?title=Ben-Hur_%281959_film%29]
965 !! result
966 <p><a href="http://www.example.com/?title=Ben-Hur_%281959_film%29" class="external autonumber" rel="nofollow">[1]</a>
967 </p>
968 !! end
971 !! test
972 Bug 4781: %26 in bracketed URL
973 !! input
974 [http://www.example.com/?title=AT%26T link]
975 !! result
976 <p><a href="http://www.example.com/?title=AT%26T" class="external text" rel="nofollow">link</a>
977 </p>
978 !! end
980 !! test
981 Bug 4781, 5267: %26 in bracketed URL
982 !! input
983 [http://www.example.com/?title=100%25_Bran link]
984 !! result
985 <p><a href="http://www.example.com/?title=100%25_Bran" class="external text" rel="nofollow">link</a>
986 </p>
987 !! end
989 !! test
990 Bug 4781, 5267: %28, %29 in bracketed URL
991 !! input
992 [http://www.example.com/?title=Ben-Hur_%281959_film%29 link]
993 !! result
994 <p><a href="http://www.example.com/?title=Ben-Hur_%281959_film%29" class="external text" rel="nofollow">link</a>
995 </p>
996 !! end
998 !! test
999 External link containing double-single-quotes in text '' (bug 4598 sanity check)
1000 !! input
1001 Some [http://example.com/ pretty ''italics'' and stuff]!
1002 !! result
1003 <p>Some <a href="http://example.com/" class="external text" rel="nofollow">pretty <i>italics</i> and stuff</a>!
1004 </p>
1005 !! end
1007 !! test
1008 External link containing double-single-quotes in text embedded in italics (bug 4598 sanity check)
1009 !! input
1010 ''Some [http://example.com/ pretty ''italics'' and stuff]!''
1011 !! result
1012 <p><i>Some </i><a href="http://example.com/" class="external text" rel="nofollow"><i>pretty </i>italics<i> and stuff</i></a><i>!</i>
1013 </p>
1014 !! end
1016 !! test
1017 URL-encoding in URL functions (single parameter)
1018 !! input
1019 {{localurl:Some page|amp=&}}
1020 !! result
1021 <p>/index.php?title=Some_page&amp;amp=&amp;
1022 </p>
1023 !! end
1025 !! test
1026 URL-encoding in URL functions (multiple parameters)
1027 !! input
1028 {{localurl:Some page|q=?&amp=&}}
1029 !! result
1030 <p>/index.php?title=Some_page&amp;q=?&amp;amp=&amp;
1031 </p>
1032 !! end
1035 ### Quotes
1038 !! test
1039 Quotes
1040 !! input
1041 Normal text. '''Bold text.''' Normal text. ''Italic text.''
1043 Normal text. '''''Bold italic text.''''' Normal text.
1044 !!result
1045 <p>Normal text. <b>Bold text.</b> Normal text. <i>Italic text.</i>
1046 </p><p>Normal text. <i><b>Bold italic text.</b></i> Normal text.
1047 </p>
1048 !! end
1051 !! test
1052 Unclosed and unmatched quotes
1053 !! input
1054 '''''Bold italic text '''with bold deactivated''' in between.'''''
1056 '''''Bold italic text ''with italic deactivated'' in between.'''''
1058 '''Bold text..
1060 ..spanning two paragraphs (should not work).'''
1062 '''Bold tag left open
1064 ''Italic tag left open
1066 Normal text.
1068 <!-- Unmatching number of opening, closing tags: -->
1069 '''This year''''s election ''should'' beat '''last year''''s.
1071 ''Tom'''s car is bigger than ''Susan'''s.
1072 !! result
1073 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
1074 </p><p><b><i>Bold italic text </i>with italic deactivated<i> in between.</i></b>
1075 </p><p><b>Bold text..</b>
1076 </p><p>..spanning two paragraphs (should not work).
1077 </p><p><b>Bold tag left open</b>
1078 </p><p><i>Italic tag left open</i>
1079 </p><p>Normal text.
1080 </p><p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
1081 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
1082 </p>
1083 !! end
1086 ### Tables
1088 ### some content taken from http://meta.wikimedia.org/wiki/MediaWiki_User%27s_Guide:_Using_tables
1091 # This should not produce <table></table> as <table><tr><td></td></tr></table>
1092 # is the bare minimun required by the spec, see:
1093 # http://www.w3.org/TR/xhtml-modularization/dtd_module_defs.html#a_module_Basic_Tables
1094 !! test
1095 A table with no data.
1096 !! input
1097 {||}
1098 !! result
1099 !! end
1101 # A table with nothing but a caption is invalid XHTML, we might want to render
1102 # this as <p>caption</p>
1103 !! test
1104 A table with nothing but a caption
1105 !! input 
1107 |+ caption
1109 !! result
1110 <table>
1111 <caption> caption
1112 </caption><tr><td></td></tr></table>
1114 !! end
1116 !! test
1117 Simple table
1118 !! input
1119 {| 
1120 | 1 || 2
1121 |- 
1122 | 3 || 4
1124 !! result
1125 <table>
1126 <tr>
1127 <td> 1 </td><td> 2
1128 </td></tr>
1129 <tr>
1130 <td> 3 </td><td> 4
1131 </td></tr></table>
1133 !! end
1135 !! test
1136 Multiplication table
1137 !! input
1138 {| border="1" cellpadding="2"
1139 |+Multiplication table
1141 ! &times; !! 1 !! 2 !! 3
1143 ! 1
1144 | 1 || 2 || 3
1146 ! 2
1147 | 2 || 4 || 6
1149 ! 3
1150 | 3 || 6 || 9
1152 ! 4
1153 | 4 || 8 || 12
1155 ! 5
1156 | 5 || 10 || 15
1158 !! result
1159 <table border="1" cellpadding="2">
1160 <caption>Multiplication table
1161 </caption>
1162 <tr>
1163 <th> &times; </th><th> 1 </th><th> 2 </th><th> 3
1164 </th></tr>
1165 <tr>
1166 <th> 1
1167 </th><td> 1 </td><td> 2 </td><td> 3
1168 </td></tr>
1169 <tr>
1170 <th> 2
1171 </th><td> 2 </td><td> 4 </td><td> 6
1172 </td></tr>
1173 <tr>
1174 <th> 3
1175 </th><td> 3 </td><td> 6 </td><td> 9
1176 </td></tr>
1177 <tr>
1178 <th> 4
1179 </th><td> 4 </td><td> 8 </td><td> 12
1180 </td></tr>
1181 <tr>
1182 <th> 5
1183 </th><td> 5 </td><td> 10 </td><td> 15
1184 </td></tr></table>
1186 !! end
1188 !! test
1189 Table rowspan
1190 !! input
1191 {| align=right border=1
1192 | Cell 1, row 1 
1193 |rowspan=2| Cell 2, row 1 (and 2) 
1194 | Cell 3, row 1 
1195 |- 
1196 | Cell 1, row 2 
1197 | Cell 3, row 2 
1199 !! result
1200 <table align="right" border="1">
1201 <tr>
1202 <td> Cell 1, row 1
1203 </td><td rowspan="2"> Cell 2, row 1 (and 2)
1204 </td><td> Cell 3, row 1
1205 </td></tr>
1206 <tr>
1207 <td> Cell 1, row 2
1208 </td><td> Cell 3, row 2
1209 </td></tr></table>
1211 !! end
1213 !! test
1214 Nested table
1215 !! input
1216 {| border=1
1217 | &alpha;
1219 {| bgcolor=#ABCDEF border=2
1220 |nested
1222 |table
1224 |the original table again
1226 !! result
1227 <table border="1">
1228 <tr>
1229 <td> &alpha;
1230 </td><td>
1231 <table bgcolor="#ABCDEF" border="2">
1232 <tr>
1233 <td>nested
1234 </td></tr>
1235 <tr>
1236 <td>table
1237 </td></tr></table>
1238 </td><td>the original table again
1239 </td></tr></table>
1241 !! end
1243 !! test
1244 Invalid attributes in table cell (bug 1830)
1245 !! input
1247 |Cell:|broken
1249 !! result
1250 <table>
1251 <tr>
1252 <td>broken
1253 </td></tr></table>
1255 !! end
1258 # FIXME: It's not clear at all that this is the result we want, but the actual
1259 # output right now is invalid XML, so clearly something is wrong.  The result
1260 # specified here is now valid XML, which is an improvement . . .
1261 !! test
1262 Table security: embedded pipes (http://lists.wikimedia.org/mailman/htdig/wikitech-l/2006-April/022293.html)
1263 !! options
1264 disabled
1265 !! input
1267 | |[ftp://|x||]" onmouseover="alert(document.cookie)">test
1268 !! result
1269 <table>
1270 <tr>
1271 <td><a href="ftp://|x||" class="external autonumber" title="ftp://|x||" rel="nofollow">[1]</a></td><td>" onmouseover="alert(document.cookie)"&gt;test
1272 </td>
1273 </tr>
1274 </table>
1276 !! end
1280 ### Internal links
1282 !! test
1283 Plain link, capitalized
1284 !! input
1285 [[Main Page]]
1286 !! result
1287 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
1288 </p>
1289 !! end
1291 !! test
1292 Plain link, uncapitalized
1293 !! input
1294 [[main Page]]
1295 !! result
1296 <p><a href="/wiki/Main_Page" title="Main Page">main Page</a>
1297 </p>
1298 !! end
1300 !! test
1301 Piped link
1302 !! input
1303 [[Main Page|The Main Page]]
1304 !! result
1305 <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
1306 </p>
1307 !! end
1309 !! test
1310 Broken link
1311 !! input
1312 [[Zigzagzogzagzig]]
1313 !! result
1314 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig</a>
1315 </p>
1316 !! end
1318 !! test
1319 Broken link with fragment
1320 !! input
1321 [[Zigzagzogzagzig#zug]]
1322 !! result
1323 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig#zug</a>
1324 </p>
1325 !! end
1327 !! test
1328 Special page link with fragment
1329 !! input
1330 [[Special:Version#anchor]]
1331 !! result
1332 <p><a href="/wiki/Special:Version#anchor" title="Special:Version">Special:Version#anchor</a>
1333 </p>
1334 !! end
1336 !! test
1337 Nonexistent special page link with fragment
1338 !! input
1339 [[Special:ThisNameWillHopefullyNeverBeUsed#anchor]]
1340 !! result
1341 <p><a href="/wiki/Special:ThisNameWillHopefullyNeverBeUsed" class="new" title="Special:ThisNameWillHopefullyNeverBeUsed (page does not exist)">Special:ThisNameWillHopefullyNeverBeUsed#anchor</a>
1342 </p>
1343 !! end
1345 !! test
1346 Link with prefix
1347 !! input
1348 xxx[[main Page]], xxx[[Main Page]], Xxx[[main Page]] XXX[[main Page]], XXX[[Main Page]]
1349 !! result
1350 <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>
1351 </p>
1352 !! end
1354 !! test
1355 Link with suffix
1356 !! input
1357 [[Main Page]]xxx, [[Main Page]]XXX, [[Main Page]]!!!
1358 !! result
1359 <p><a href="/wiki/Main_Page" title="Main Page">Main Pagexxx</a>, <a href="/wiki/Main_Page" title="Main Page">Main Page</a>XXX, <a href="/wiki/Main_Page" title="Main Page">Main Page</a>!!!
1360 </p>
1361 !! end
1363 !! test
1364 Link with 3 brackets
1365 !! input
1366 [[[main page]]]
1367 !! result
1368 <p>[[[main page]]]
1369 </p>
1370 !! end
1372 !! test
1373 Piped link with 3 brackets
1374 !! input
1375 [[[main page|the main page]]]
1376 !! result
1377 <p>[[[main page|the main page]]]
1378 </p>
1379 !! end
1381 !! test
1382 Link with multiple pipes
1383 !! input
1384 [[Main Page|The|Main|Page]]
1385 !! result
1386 <p><a href="/wiki/Main_Page" title="Main Page">The|Main|Page</a>
1387 </p>
1388 !! end
1390 !! test
1391 Link to namespaces
1392 !! input
1393 [[Talk:Parser testing]], [[Meta:Disclaimers]]
1394 !! result
1395 <p><a href="/index.php?title=Talk:Parser_testing&amp;action=edit&amp;redlink=1" class="new" title="Talk:Parser testing (page does not exist)">Talk:Parser testing</a>, <a href="/index.php?title=Meta:Disclaimers&amp;action=edit&amp;redlink=1" class="new" title="Meta:Disclaimers (page does not exist)">Meta:Disclaimers</a>
1396 </p>
1397 !! end
1399 !! test
1400 Piped link to namespace
1401 !! input
1402 [[Meta:Disclaimers|The disclaimers]]
1403 !! result
1404 <p><a href="/index.php?title=Meta:Disclaimers&amp;action=edit&amp;redlink=1" class="new" title="Meta:Disclaimers (page does not exist)">The disclaimers</a>
1405 </p>
1406 !! end
1408 !! test
1409 Link containing }
1410 !! input
1411 [[Usually caused by a typo (oops}]]
1412 !! result
1413 <p>[[Usually caused by a typo (oops}]]
1414 </p>
1415 !! end
1417 !! test
1418 Link containing % (not as a hex sequence)
1419 !! input
1420 [[7% Solution]]
1421 !! result
1422 <p><a href="/index.php?title=7%25_Solution&amp;action=edit&amp;redlink=1" class="new" title="7% Solution (page does not exist)">7% Solution</a>
1423 </p>
1424 !! end
1426 !! test
1427 Link containing % as a single hex sequence interpreted to char
1428 !! input
1429 [[7%25 Solution]]
1430 !! result
1431 <p><a href="/index.php?title=7%25_Solution&amp;action=edit&amp;redlink=1" class="new" title="7% Solution (page does not exist)">7% Solution</a>
1432 </p>
1433 !!end
1435 !! test
1436 Link containing % as a double hex sequence interpreted to hex sequence
1437 !! input
1438 [[7%2525 Solution]]
1439 !! result
1440 <p>[[7%2525 Solution]]
1441 </p>
1442 !!end
1444 !! test
1445 Link containing "#<" and "#>" % as a hex sequences- these are valid section anchors
1446 Example for such a section: == < ==
1447 !! input
1448 [[%23%3c]][[%23%3e]]
1449 !! result
1450 <p><a href="#.3C">#&lt;</a><a href="#.3E">#&gt;</a>
1451 </p>
1452 !! end
1454 !! test
1455 Link containing "<#" and ">#" as a hex sequences
1456 !! input
1457 [[%3c%23]][[%3e%23]]
1458 !! result
1459 <p>[[%3c%23]][[%3e%23]]
1460 </p>
1461 !! end
1463 !! test
1464 Link containing double-single-quotes '' (bug 4598)
1465 !! input
1466 [[Lista d''e paise d''o munno]]
1467 !! result
1468 <p><a href="/index.php?title=Lista_d%27%27e_paise_d%27%27o_munno&amp;action=edit&amp;redlink=1" class="new" title="Lista d''e paise d''o munno (page does not exist)">Lista d''e paise d''o munno</a>
1469 </p>
1470 !! end
1472 !! test
1473 Link containing double-single-quotes '' in text (bug 4598 sanity check)
1474 !! input
1475 Some [[Link|pretty ''italics'' and stuff]]!
1476 !! result
1477 <p>Some <a href="/index.php?title=Link&amp;action=edit&amp;redlink=1" class="new" title="Link (page does not exist)">pretty <i>italics</i> and stuff</a>!
1478 </p>
1479 !! end
1481 !! test
1482 Link containing double-single-quotes '' in text embedded in italics (bug 4598 sanity check)
1483 !! input
1484 ''Some [[Link|pretty ''italics'' and stuff]]!
1485 !! result
1486 <p><i>Some <a href="/index.php?title=Link&amp;action=edit&amp;redlink=1" class="new" title="Link (page does not exist)">pretty <i>italics</i> and stuff</a>!</i>
1487 </p>
1488 !! end
1490 !! test
1491 Link with double quotes in title part (literal) and alternate part (interpreted)
1492 !! input
1493 [[File:Denys Savchenko ''Pentecoste''.jpg]]
1495 [[''Pentecoste'']]
1497 [[''Pentecoste''|Pentecoste]]
1499 [[''Pentecoste''|''Pentecoste'']]
1500 !! result
1501 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=Denys_Savchenko_%27%27Pentecoste%27%27.jpg" class="new" title="File:Denys Savchenko &#39;&#39;Pentecoste&#39;&#39;.jpg">File:Denys Savchenko <i>Pentecoste</i>.jpg</a>
1502 </p><p><a href="/index.php?title=%27%27Pentecoste%27%27&amp;action=edit&amp;redlink=1" class="new" title="''Pentecoste'' (page does not exist)">''Pentecoste''</a>
1503 </p><p><a href="/index.php?title=%27%27Pentecoste%27%27&amp;action=edit&amp;redlink=1" class="new" title="''Pentecoste'' (page does not exist)">Pentecoste</a>
1504 </p><p><a href="/index.php?title=%27%27Pentecoste%27%27&amp;action=edit&amp;redlink=1" class="new" title="''Pentecoste'' (page does not exist)"><i>Pentecoste</i></a>
1505 </p>
1506 !! end
1508 !! test
1509 Plain link to URL
1510 !! input
1511 [[http://www.example.com]]
1512 !! result
1513 <p>[<a href="http://www.example.com" class="external autonumber" rel="nofollow">[1]</a>]
1514 </p>
1515 !! end
1517 # I'm fairly sure the expected result here is wrong.
1518 # We want these to be URL links, not pseudo-pages with URLs for titles....
1519 # However the current output is also pretty screwy.
1521 # ----
1522 # I'm changing it to match the current output--it arguably makes more
1523 # sense in the light of the test above. Old expected result was:
1524 #<p>Piped link to URL: <a href="/index.php?title=Http://www.example.com&amp;action=edit" class="new">an example URL</a>
1525 #</p>
1526 # But I think this test is bordering on "garbage in, garbage out" anyway.
1527 # -- wtm
1528 !! test
1529 Piped link to URL
1530 !! input
1531 Piped link to URL: [[http://www.example.com|an example URL]]
1532 !! result
1533 <p>Piped link to URL: [<a href="http://www.example.com%7Can" class="external text" rel="nofollow">example URL</a>]
1534 </p>
1535 !! end
1537 !! test
1538 BUG 2: [[page|http://url/]] should link to page, not http://url/
1539 !! input
1540 [[Main Page|http://url/]]
1541 !! result
1542 <p><a href="/wiki/Main_Page" title="Main Page">http://url/</a>
1543 </p>
1544 !! end
1546 !! test
1547 BUG 337: Escaped self-links should be bold
1548 !! options
1549 title=[[Bug462]]
1550 !! input
1551 [[Bu&#103;462]] [[Bug462]]
1552 !! result
1553 <p><strong class="selflink">Bu&#103;462</strong> <strong class="selflink">Bug462</strong>
1554 </p>
1555 !! end
1557 !! test
1558 Self-link to section should not be bold
1559 !! options
1560 title=[[Main Page]]
1561 !! input
1562 [[Main Page#section]]
1563 !! result
1564 <p><a href="/wiki/Main_Page#section" title="Main Page">Main Page#section</a>
1565 </p>
1566 !! end
1568 !! article
1570 !! text
1571 This is 00.
1572 !! endarticle
1574 !!test
1575 Self-link to numeric title
1576 !!options
1577 title=[[0]]
1578 !!input
1579 [[0]]
1580 !!result
1581 <p><strong class="selflink">0</strong>
1582 </p>
1583 !!end
1585 !!test
1586 Link to numeric-equivalent title
1587 !!options
1588 title=[[0]]
1589 !!input
1590 [[00]]
1591 !!result
1592 <p><a href="/wiki/00" title="00">00</a>
1593 </p>
1594 !!end
1596 !! test
1597 <nowiki> inside a link
1598 !! input
1599 [[Main<nowiki> Page</nowiki>]] [[Main Page|the main page <nowiki>[it's not very good]</nowiki>]]
1600 !! result
1601 <p>[[Main Page]] <a href="/wiki/Main_Page" title="Main Page">the main page [it's not very good]</a>
1602 </p>
1603 !! end
1605 !! test
1606 Non-breaking spaces in title
1607 !! input
1608 [[&nbsp; Main &nbsp; Page &nbsp;]]
1609 !! result
1610 <p><a href="/wiki/Main_Page" title="Main Page">&nbsp; Main &nbsp; Page &nbsp;</a>
1611 </p>
1612 !!end
1616 ### Interwiki links (see maintenance/interwiki.sql)
1619 !! test
1620 Inline interwiki link
1621 !! input
1622 [[MeatBall:SoftSecurity]]
1623 !! result
1624 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity</a>
1625 </p>
1626 !! end
1628 !! test
1629 Inline interwiki link with empty title (bug 2372)
1630 !! input
1631 [[MeatBall:]]
1632 !! result
1633 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?" class="extiw" title="meatball:">MeatBall:</a>
1634 </p>
1635 !! end
1637 !! test
1638 Interwiki link encoding conversion (bug 1636)
1639 !! input
1640 *[[Wikipedia:ro:Olteni&#0355;a]]
1641 *[[Wikipedia:ro:Olteni&#355;a]]
1642 !! result
1643 <ul><li><a href="http://en.wikipedia.org/wiki/ro:Olteni%C5%A3a" class="extiw" title="wikipedia:ro:Olteniţa">Wikipedia:ro:Olteni&#355;a</a>
1644 </li><li><a href="http://en.wikipedia.org/wiki/ro:Olteni%C5%A3a" class="extiw" title="wikipedia:ro:Olteniţa">Wikipedia:ro:Olteni&#355;a</a>
1645 </li></ul>
1647 !! end
1649 !! test
1650 Interwiki link with fragment (bug 2130)
1651 !! input
1652 [[MeatBall:SoftSecurity#foo]]
1653 !! result
1654 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity#foo" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity#foo</a>
1655 </p>
1656 !! end
1658 !! test
1659 Interlanguage link
1660 !! input
1661 Blah blah blah
1662 [[zh:Chinese]]
1663 !!result
1664 <p>Blah blah blah
1665 </p>
1666 !! end
1668 !! test
1669 Double interlanguage link
1670 !! input
1671 Blah blah blah
1672 [[es:Spanish]]
1673 [[zh:Chinese]]
1674 !!result
1675 <p>Blah blah blah
1676 </p>
1677 !! end
1679 !! test
1680 Interlanguage link, with prefix links
1681 !! options
1682 language=ln
1683 !! input
1684 Blah blah blah
1685 [[zh:Chinese]]
1686 !!result
1687 <p>Blah blah blah
1688 </p>
1689 !! end
1691 !! test
1692 Double interlanguage link, with prefix links (bug 8897)
1693 !! options
1694 language=ln
1695 !! input
1696 Blah blah blah
1697 [[es:Spanish]]
1698 [[zh:Chinese]]
1699 !!result
1700 <p>Blah blah blah
1701 </p>
1702 !! end
1706 ## XHTML tidiness
1709 !! test
1710 <br> to <br />
1711 !! input
1712 1<br>2<br />3
1713 !! result
1714 <p>1<br />2<br />3
1715 </p>
1716 !! end
1718 !! test
1719 Incorrecly removing closing slashes from correctly formed XHTML
1720 !! input
1721 <br style="clear:both;" />
1722 !! result
1723 <p><br style="clear:both;" />
1724 </p>
1725 !! end
1727 !! test 
1728 Failing to transform badly formed HTML into correct XHTML
1729 !! input
1730 <br clear=left>
1731 <br clear=right>
1732 <br clear=all>
1733 !! result
1734 <p><br clear="left" />
1735 <br clear="right" />
1736 <br clear="all" />
1737 </p>
1738 !!end
1740 !! test 
1741 Horizontal ruler (should it add that extra space?)
1742 !! input 
1743 <hr>
1744 <hr >
1745 foo <hr
1746 > bar
1747 !! result 
1748 <hr />
1749 <hr />
1750 foo <hr /> bar
1752 !! end
1755 ### Block-level elements
1757 !! test
1758 Common list
1759 !! input
1760 *Common list
1761 * item 2
1762 *item 3
1763 !! result
1764 <ul><li>Common list
1765 </li><li> item 2
1766 </li><li>item 3
1767 </li></ul>
1769 !! end
1771 !! test
1772 Numbered list
1773 !! input
1774 #Numbered list
1775 #item 2
1776 # item 3
1777 !! result
1778 <ol><li>Numbered list
1779 </li><li>item 2
1780 </li><li> item 3
1781 </li></ol>
1783 !! end
1785 !! test
1786 Mixed list
1787 !! input
1788 *Mixed list
1789 *# with numbers
1790 ** and bullets
1791 *# and numbers
1792 *bullets again
1793 **bullet level 2
1794 ***bullet level 3
1795 ***#Number on level 4
1796 **bullet level 2
1797 **#Number on level 3
1798 **#Number on level 3
1799 *#number level 2
1800 *Level 1
1801 !! result
1802 <ul><li>Mixed list
1803 <ol><li> with numbers
1804 </li></ol>
1805 <ul><li> and bullets
1806 </li></ul>
1807 <ol><li> and numbers
1808 </li></ol>
1809 </li><li>bullets again
1810 <ul><li>bullet level 2
1811 <ul><li>bullet level 3
1812 <ol><li>Number on level 4
1813 </li></ol>
1814 </li></ul>
1815 </li><li>bullet level 2
1816 <ol><li>Number on level 3
1817 </li><li>Number on level 3
1818 </li></ol>
1819 </li></ul>
1820 <ol><li>number level 2
1821 </li></ol>
1822 </li><li>Level 1
1823 </li></ul>
1825 !! end
1827 !! test
1828 List items are not parsed correctly following a <pre> block (bug 785)
1829 !! input
1830 * <pre>foo</pre>
1831 * <pre>bar</pre>
1832 * zar
1833 !! result
1834 <ul><li> <pre>foo</pre>
1835 </li><li> <pre>bar</pre>
1836 </li><li> zar
1837 </li></ul>
1839 !! end
1842 ### Magic Words
1845 !! test
1846 Magic Word: {{CURRENTDAY}}
1847 !! input
1848 {{CURRENTDAY}}
1849 !! result
1850 <p>1
1851 </p>
1852 !! end
1854 !! test
1855 Magic Word: {{CURRENTDAY2}}
1856 !! input
1857 {{CURRENTDAY2}}
1858 !! result
1859 <p>01
1860 </p>
1861 !! end
1863 !! test
1864 Magic Word: {{CURRENTDAYNAME}}
1865 !! input
1866 {{CURRENTDAYNAME}}
1867 !! result
1868 <p>Thursday
1869 </p>
1870 !! end
1872 !! test
1873 Magic Word: {{CURRENTDOW}}
1874 !! input
1875 {{CURRENTDOW}}
1876 !! result
1877 <p>4
1878 </p>
1879 !! end
1881 !! test
1882 Magic Word: {{CURRENTMONTH}}
1883 !! input
1884 {{CURRENTMONTH}}
1885 !! result
1886 <p>01
1887 </p>
1888 !! end
1890 !! test
1891 Magic Word: {{CURRENTMONTHABBREV}}
1892 !! input
1893 {{CURRENTMONTHABBREV}}
1894 !! result
1895 <p>Jan
1896 </p>
1897 !! end
1899 !! test
1900 Magic Word: {{CURRENTMONTHNAME}}
1901 !! input
1902 {{CURRENTMONTHNAME}}
1903 !! result
1904 <p>January
1905 </p>
1906 !! end
1908 !! test
1909 Magic Word: {{CURRENTMONTHNAMEGEN}}
1910 !! input
1911 {{CURRENTMONTHNAMEGEN}}
1912 !! result
1913 <p>January
1914 </p>
1915 !! end
1917 !! test
1918 Magic Word: {{CURRENTTIME}}
1919 !! input
1920 {{CURRENTTIME}}
1921 !! result
1922 <p>00:02
1923 </p>
1924 !! end
1926 !! test
1927 Magic Word: {{CURRENTWEEK}} (@bug 4594)
1928 !! input
1929 {{CURRENTWEEK}}
1930 !! result
1931 <p>1
1932 </p>
1933 !! end
1935 !! test
1936 Magic Word: {{CURRENTYEAR}}
1937 !! input
1938 {{CURRENTYEAR}}
1939 !! result
1940 <p>1970
1941 </p>
1942 !! end
1944 !! test
1945 Magic Word: {{FULLPAGENAME}}
1946 !! options
1947 title=[[User:Ævar Arnfjörð Bjarmason]]
1948 !! input
1949 {{FULLPAGENAME}}
1950 !! result
1951 <p>User:Ævar Arnfjörð Bjarmason
1952 </p>
1953 !! end
1955 !! test
1956 Magic Word: {{FULLPAGENAMEE}}
1957 !! options
1958 title=[[User:Ævar Arnfjörð Bjarmason]]
1959 !! input
1960 {{FULLPAGENAMEE}}
1961 !! result
1962 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
1963 </p>
1964 !! end
1966 !! test
1967 Magic Word: {{NAMESPACE}}
1968 !! options
1969 title=[[User:Ævar Arnfjörð Bjarmason]]
1970 !! input
1971 {{NAMESPACE}}
1972 !! result
1973 <p>User
1974 </p>
1975 !! end
1977 !! test
1978 Magic Word: {{NAMESPACEE}}
1979 !! options
1980 title=[[User:Ævar Arnfjörð Bjarmason]]
1981 !! input
1982 {{NAMESPACEE}}
1983 !! result
1984 <p>User
1985 </p>
1986 !! end
1988 !! test
1989 Magic Word: {{NUMBEROFARTICLES}}
1990 !! input
1991 {{NUMBEROFARTICLES}}
1992 !! result
1993 <p>2
1994 </p>
1995 !! end
1997 !! test
1998 Magic Word: {{NUMBEROFFILES}}
1999 !! input
2000 {{NUMBEROFFILES}}
2001 !! result
2002 <p>2
2003 </p>
2004 !! end
2006 !! test
2007 Magic Word: {{PAGENAME}}
2008 !! options
2009 title=[[User:Ævar Arnfjörð Bjarmason]]
2010 !! input
2011 {{PAGENAME}}
2012 !! result
2013 <p>Ævar Arnfjörð Bjarmason
2014 </p>
2015 !! end
2017 !! test
2018 Magic Word: {{PAGENAMEE}}
2019 !! options
2020 title=[[User:Ævar Arnfjörð Bjarmason]]
2021 !! input
2022 {{PAGENAMEE}}
2023 !! result
2024 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
2025 </p>
2026 !! end
2028 !! test
2029 Magic Word: {{REVISIONID}}
2030 !! input
2031 {{REVISIONID}}
2032 !! result
2033 <p>1337
2034 </p>
2035 !! end
2037 !! test
2038 Magic Word: {{SCRIPTPATH}}
2039 !! input
2040 {{SCRIPTPATH}}
2041 !! result
2042 <p>/
2043 </p>
2044 !! end
2046 !! test
2047 Magic Word: {{SERVER}}
2048 !! input
2049 {{SERVER}}
2050 !! result
2051 <p><a href="http://localhost" class="external free" rel="nofollow">http://localhost</a>
2052 </p>
2053 !! end
2055 !! test
2056 Magic Word: {{SERVERNAME}}
2057 !! input
2058 {{SERVERNAME}}
2059 !! result
2060 <p>Britney-Spears
2061 </p>
2062 !! end
2064 !! test
2065 Magic Word: {{SITENAME}}
2066 !! input
2067 {{SITENAME}}
2068 !! result
2069 <p>MediaWiki
2070 </p>
2071 !! end
2073 !! test
2074 Namespace 1 {{ns:1}}
2075 !! input
2076 {{ns:1}}
2077 !! result
2078 <p>Talk
2079 </p>
2080 !! end
2082 !! test
2083 Namespace 1 {{ns:01}}
2084 !! input
2085 {{ns:01}}
2086 !! result
2087 <p>Talk
2088 </p>
2089 !! end
2091 !! test
2092 Namespace 0 {{ns:0}} (bug 4783)
2093 !! input
2094 {{ns:0}}
2095 !! result
2097 !! end
2099 !! test
2100 Namespace 0 {{ns:00}} (bug 4783)
2101 !! input
2102 {{ns:00}}
2103 !! result
2105 !! end
2107 !! test
2108 Namespace -1 {{ns:-1}}
2109 !! input
2110 {{ns:-1}}
2111 !! result
2112 <p>Special
2113 </p>
2114 !! end
2116 !! test
2117 Namespace User {{ns:User}}
2118 !! input
2119 {{ns:User}}
2120 !! result
2121 <p>User
2122 </p>
2123 !! end
2125 !! test
2126 Namespace User talk {{ns:User_talk}}
2127 !! input
2128 {{ns:User_talk}}
2129 !! result
2130 <p>User talk
2131 </p>
2132 !! end
2134 !! test
2135 Namespace User talk {{ns:uSeR tAlK}}
2136 !! input
2137 {{ns:uSeR tAlK}}
2138 !! result
2139 <p>User talk
2140 </p>
2141 !! end
2143 !! test
2144 Namespace File {{ns:File}}
2145 !! input
2146 {{ns:File}}
2147 !! result
2148 <p>File
2149 </p>
2150 !! end
2152 !! test
2153 Namespace File {{ns:Image}}
2154 !! input
2155 {{ns:Image}}
2156 !! result
2157 <p>File
2158 </p>
2159 !! end
2161 !! test
2162 Namespace (lang=de) Benutzer {{ns:User}}
2163 !! options
2164 language=de
2165 !! input
2166 {{ns:User}}
2167 !! result
2168 <p>Benutzer
2169 </p>
2170 !! end
2172 !! test
2173 Namespace (lang=de) Benutzer Diskussion {{ns:3}}
2174 !! options
2175 language=de
2176 !! input
2177 {{ns:3}}
2178 !! result
2179 <p>Benutzer Diskussion
2180 </p>
2181 !! end
2184 !! test
2185 Urlencode
2186 !! input
2187 {{urlencode:hi world?!}}
2188 {{urlencode:hi world?!|WIKI}}
2189 {{urlencode:hi world?!|PATH}}
2190 {{urlencode:hi world?!|QUERY}}
2191 !! result
2192 <p>hi+world%3F%21
2193 hi_world%3F!
2194 hi%20world%3F%21
2195 hi+world%3F%21
2196 </p>
2197 !! end
2200 ### Magic links
2202 !! test
2203 Magic links: internal link to RFC (bug 479)
2204 !! input
2205 [[RFC 123]]
2206 !! result
2207 <p><a href="/index.php?title=RFC_123&amp;action=edit&amp;redlink=1" class="new" title="RFC 123 (page does not exist)">RFC 123</a>
2208 </p>
2209 !! end
2211 !! test
2212 Magic links: RFC (bug 479)
2213 !! input
2214 RFC 822
2215 !! result
2216 <p><a href="http://tools.ietf.org/html/rfc822" class="external mw-magiclink-rfc">RFC 822</a>
2217 </p>
2218 !! end
2220 !! test
2221 Magic links: ISBN (bug 1937)
2222 !! input
2223 ISBN 0-306-40615-2
2224 !! result
2225 <p><a href="/wiki/Special:BookSources/0306406152" class="internal mw-magiclink-isbn">ISBN 0-306-40615-2</a>
2226 </p>
2227 !! end
2229 !! test
2230 Magic links: PMID incorrectly converts space to underscore
2231 !! input
2232 PMID 1234
2233 !! result
2234 <p><a href="http://www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract" class="external mw-magiclink-pmid">PMID 1234</a>
2235 </p>
2236 !! end
2239 ### Templates
2240 ####
2242 !! test
2243 Nonexistent template
2244 !! input
2245 {{thistemplatedoesnotexist}}
2246 !! result
2247 <p><a href="/index.php?title=Template:Thistemplatedoesnotexist&amp;action=edit&amp;redlink=1" class="new" title="Template:Thistemplatedoesnotexist (page does not exist)">Template:Thistemplatedoesnotexist</a>
2248 </p>
2249 !! end
2251 !! article
2252 Template:test
2253 !! text
2254 This is a test template
2255 !! endarticle
2257 !! test
2258 Simple template
2259 !! input
2260 {{test}}
2261 !! result
2262 <p>This is a test template
2263 </p>
2264 !! end
2266 !! test
2267 Template with explicit namespace
2268 !! input
2269 {{Template:test}}
2270 !! result
2271 <p>This is a test template
2272 </p>
2273 !! end
2276 !! article
2277 Template:paramtest
2278 !! text
2279 This is a test template with parameter {{{param}}}
2280 !! endarticle
2282 !! test
2283 Template parameter
2284 !! input
2285 {{paramtest|param=foo}}
2286 !! result
2287 <p>This is a test template with parameter foo
2288 </p>
2289 !! end
2291 !! article
2292 Template:paramtestnum
2293 !! text
2294 [[{{{1}}}|{{{2}}}]]
2295 !! endarticle
2297 !! test
2298 Template unnamed parameter
2299 !! input
2300 {{paramtestnum|Main Page|the main page}}
2301 !! result
2302 <p><a href="/wiki/Main_Page" title="Main Page">the main page</a>
2303 </p>
2304 !! end
2306 !! article
2307 Template:templatesimple
2308 !! text
2309 (test)
2310 !! endarticle
2312 !! article
2313 Template:templateredirect
2314 !! text
2315 #redirect [[Template:templatesimple]]
2316 !! endarticle
2318 !! article
2319 Template:templateasargtestnum
2320 !! text
2321 {{{{{1}}}}}
2322 !! endarticle
2324 !! article
2325 Template:templateasargtest
2326 !! text
2327 {{template{{{templ}}}}}
2328 !! endarticle
2330 !! article
2331 Template:templateasargtest2
2332 !! text
2333 {{{{{templ}}}}}
2334 !! endarticle
2336 !! test
2337 Template with template name as unnamed argument
2338 !! input
2339 {{templateasargtestnum|templatesimple}}
2340 !! result
2341 <p>(test)
2342 </p>
2343 !! end
2345 !! test
2346 Template with template name as argument
2347 !! input
2348 {{templateasargtest|templ=simple}}
2349 !! result
2350 <p>(test)
2351 </p>
2352 !! end
2354 !! test
2355 Template with template name as argument (2)
2356 !! input
2357 {{templateasargtest2|templ=templatesimple}}
2358 !! result
2359 <p>(test)
2360 </p>
2361 !! end
2363 !! article
2364 Template:templateasargtestdefault
2365 !! text
2366 {{{{{templ|templatesimple}}}}}
2367 !! endarticle
2369 !! article
2370 Template:templa
2371 !! text
2372 '''templ'''
2373 !! endarticle
2375 !! test
2376 Template with default value
2377 !! input
2378 {{templateasargtestdefault}}
2379 !! result
2380 <p>(test)
2381 </p>
2382 !! end
2384 !! test
2385 Template with default value (value set)
2386 !! input
2387 {{templateasargtestdefault|templ=templa}}
2388 !! result
2389 <p><b>templ</b>
2390 </p>
2391 !! end
2393 !! test
2394 Template redirect
2395 !! input
2396 {{templateredirect}}
2397 !! result
2398 <p>(test)
2399 </p>
2400 !! end
2402 !! test
2403 Template with argument in separate line
2404 !! input
2405 {{ templateasargtest  |
2406  templ = simple }}
2407 !! result
2408 <p>(test)
2409 </p>
2410 !! end
2412 !! test
2413 Template with complex template as argument
2414 !! input
2415 {{paramtest|
2416   param ={{ templateasargtest  |
2417  templ = simple }}}}
2418 !! result
2419 <p>This is a test template with parameter (test)
2420 </p>
2421 !! end
2423 !! test
2424 Template with thumb image (with link in description)
2425 !! input
2426 {{paramtest|
2427   param =[[Image:noimage.png|thumb|[[no link|link]] [[no link|caption]]]]}}
2428 !! result
2429 This is a test template with parameter <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/index.php?title=Special:Upload&amp;wpDestFile=Noimage.png" class="new" title="File:Noimage.png">File:Noimage.png</a>  <div class="thumbcaption"><a href="/index.php?title=No_link&amp;action=edit&amp;redlink=1" class="new" title="No link (page does not exist)">link</a> <a href="/index.php?title=No_link&amp;action=edit&amp;redlink=1" class="new" title="No link (page does not exist)">caption</a></div></div></div>
2431 !! end
2433 !! article
2434 Template:complextemplate
2435 !! text
2436 {{{1}}} {{paramtest|
2437   param ={{{param}}}}}
2438 !! endarticle
2440 !! test
2441 Template with complex arguments
2442 !! input
2443 {{complextemplate|
2444   param ={{ templateasargtest  |
2445  templ = simple }}|[[Template:complextemplate|link]]}}
2446 !! result
2447 <p><a href="/wiki/Template:Complextemplate" title="Template:Complextemplate">link</a> This is a test template with parameter (test)
2448 </p>
2449 !! end
2451 !! test
2452 BUG 553: link with two variables in a piped link
2453 !! input
2454 {| 
2455 |[[{{{1}}}|{{{2}}}]]
2457 !! result
2458 <table>
2459 <tr>
2460 <td>[[{{{1}}}|{{{2}}}]]
2461 </td></tr></table>
2463 !! end
2465 !! test
2466 Magic variable as template parameter
2467 !! input
2468 {{paramtest|param={{SITENAME}}}}
2469 !! result
2470 <p>This is a test template with parameter MediaWiki
2471 </p>
2472 !! end
2474 !! article
2475 Template:linktest
2476 !! text
2477 [[{{{param}}}|link]]
2478 !! endarticle
2480 !! test
2481 Template parameter as link source
2482 !! input
2483 {{linktest|param=Main Page}}
2484 !! result
2485 <p><a href="/wiki/Main_Page" title="Main Page">link</a>
2486 </p>
2487 !! end
2490 !!article
2491 Template:paramtest2
2492 !! text
2493 including another template, {{paramtest|param={{{arg}}}}}
2494 !! endarticle
2496 !! test
2497 Template passing argument to another template
2498 !! input
2499 {{paramtest2|arg='hmm'}}
2500 !! result
2501 <p>including another template, This is a test template with parameter 'hmm'
2502 </p>
2503 !! end
2505 !! article
2506 Template:Linktest2
2507 !! text
2508 Main Page
2509 !! endarticle
2511 !! test
2512 Template as link source
2513 !! input
2514 [[{{linktest2}}]]
2515 !! result
2516 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
2517 </p>
2518 !! end
2521 !! article
2522 Template:loop1
2523 !! text
2524 {{loop2}}
2525 !! endarticle
2527 !! article
2528 Template:loop2
2529 !! text
2530 {{loop1}}
2531 !! endarticle
2533 !! test
2534 Template infinite loop
2535 !! input
2536 {{loop1}}
2537 !! result
2538 <p><span class="error">Template loop detected: <a href="/wiki/Template:Loop1" title="Template:Loop1">Template:Loop1</a></span>
2539 </p>
2540 !! end
2542 !! test
2543 Template from main namespace
2544 !! input
2545 {{:Main Page}}
2546 !! result
2547 <p>blah blah
2548 </p>
2549 !! end
2551 !! article
2552 Template:table
2553 !! text
2554 {| 
2555 | 1 || 2
2556 |- 
2557 | 3 || 4
2559 !! endarticle
2561 !! test
2562 BUG 529: Template with table, not included at beginning of line
2563 !! input
2564 foo {{table}}
2565 !! result
2566 <p>foo 
2567 </p>
2568 <table>
2569 <tr>
2570 <td> 1 </td><td> 2
2571 </td></tr>
2572 <tr>
2573 <td> 3 </td><td> 4
2574 </td></tr></table>
2576 !! end
2578 !! test
2579 BUG 523: Template shouldn't eat newline (or add an extra one before table)
2580 !! input
2582 {{table}}
2583 !! result
2584 <p>foo
2585 </p>
2586 <table>
2587 <tr>
2588 <td> 1 </td><td> 2
2589 </td></tr>
2590 <tr>
2591 <td> 3 </td><td> 4
2592 </td></tr></table>
2594 !! end
2596 !! test
2597 BUG 41: Template parameters shown as broken links
2598 !! input
2599 {{{parameter}}}
2600 !! result
2601 <p>{{{parameter}}}
2602 </p>
2603 !! end
2606 !! article
2607 Template:MSGNW test
2608 !! text
2609 ''None'' of '''this''' should be 
2610 * interpreted
2611  but rather passed unmodified
2612 {{test}}
2613 !! endarticle
2615 # hmm, fix this or just deprecate msgnw and document its behavior?
2616 !! test
2617 msgnw keyword
2618 !! options
2619 disabled
2620 !! input
2621 {{msgnw:MSGNW test}}
2622 !! result
2623 <p>''None'' of '''this''' should be 
2624 * interpreted
2625  but rather passed unmodified
2626 {{test}}
2627 </p>
2628 !! end
2630 !! test
2631 int keyword
2632 !! input
2633 {{int:youhavenewmessages|lots of money|not!}}
2634 !! result
2635 <p>You have lots of money (not!).
2636 </p>
2637 !! end
2639 !! article
2640 Template:Includes
2641 !! text
2642 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
2643 !! endarticle
2645 !! test
2646 <includeonly> and <noinclude> being included
2647 !! input
2648 {{Includes}}
2649 !! result
2650 <p>Foobar
2651 </p>
2652 !! end
2654 !! article
2655 Template:Includes2
2656 !! text
2657 <onlyinclude>Foo</onlyinclude>bar
2658 !! endarticle
2660 !! test
2661 <onlyinclude> being included
2662 !! input
2663 {{Includes2}}
2664 !! result
2665 <p>Foo
2666 </p>
2667 !! end
2670 !! article
2671 Template:Includes3
2672 !! text
2673 <onlyinclude>Foo</onlyinclude>bar<includeonly>zar</includeonly>
2674 !! endarticle
2676 !! test
2677 <onlyinclude> and <includeonly> being included
2678 !! input
2679 {{Includes3}}
2680 !! result
2681 <p>Foo
2682 </p>
2683 !! end
2685 !! test
2686 <includeonly> and <noinclude> on a page
2687 !! input
2688 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
2689 !! result
2690 <p>Foozar
2691 </p>
2692 !! end
2694 !! test
2695 <onlyinclude> on a page
2696 !! input
2697 <onlyinclude>Foo</onlyinclude>bar
2698 !! result
2699 <p>Foobar
2700 </p>
2701 !! end
2703 !! article
2704 Template:Includeonly section
2705 !! text
2706 <includeonly>
2707 ==Includeonly section==
2708 </includeonly>
2709 ==Section T-1==
2710 !!endarticle
2712 !! test
2713 Bug 6563: Edit link generation for section shown by <includeonly>
2714 !! input
2715 {{includeonly section}}
2716 !! result
2717 <h2><span class="editsection">[<a href="/index.php?title=Template:Includeonly_section&amp;action=edit&amp;section=T-1" title="Template:Includeonly section">edit</a>]</span> <span class="mw-headline" id="Includeonly_section">Includeonly section</span></h2>
2718 <h2><span class="editsection">[<a href="/index.php?title=Template:Includeonly_section&amp;action=edit&amp;section=T-2" title="Template:Includeonly section">edit</a>]</span> <span class="mw-headline" id="Section_T-1">Section T-1</span></h2>
2720 !! end
2722 # Uses same input as the contents of [[Template:Includeonly section]]
2723 !! test
2724 Bug 6563: Section extraction for section shown by <includeonly>
2725 !! options
2726 section=T-2
2727 !! input
2728 <includeonly>
2729 ==Includeonly section==
2730 </includeonly>
2731 ==Section T-2==
2732 !! result
2733 ==Section T-2==
2734 !! end
2736 !! test
2737 Bug 6563: Edit link generation for section suppressed by <includeonly>
2738 !! input
2739 <includeonly>
2740 ==Includeonly section==
2741 </includeonly>
2742 ==Section 1==
2743 !! result
2744 <h2><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: Section 1">edit</a>]</span> <span class="mw-headline" id="Section_1">Section 1</span></h2>
2746 !! end
2748 !! test
2749 Bug 6563: Section extraction for section suppressed by <includeonly>
2750 !! options
2751 section=1
2752 !! input
2753 <includeonly>
2754 ==Includeonly section==
2755 </includeonly>
2756 ==Section 1==
2757 !! result
2758 ==Section 1==
2759 !! end
2762 ### Pre-save transform tests
2764 !! test
2765 pre-save transform: subst:
2766 !! options
2768 !! input
2769 {{subst:test}}
2770 !! result
2771 This is a test template
2772 !! end
2774 !! test
2775 pre-save transform: normal template
2776 !! options
2778 !! input
2779 {{test}}
2780 !! result
2781 {{test}}
2782 !! end
2784 !! test
2785 pre-save transform: nonexistent template
2786 !! options
2788 !! input
2789 {{thistemplatedoesnotexist}}
2790 !! result
2791 {{thistemplatedoesnotexist}}
2792 !! end
2795 !! test
2796 pre-save transform: subst magic variables
2797 !! options
2799 !! input
2800 {{subst:SITENAME}}
2801 !! result
2802 MediaWiki
2803 !! end
2805 # This is bug 89, which I fixed. -- wtm
2806 !! test
2807 pre-save transform: subst: templates with parameters
2808 !! options
2810 !! input
2811 {{subst:paramtest|param="something else"}}
2812 !! result
2813 This is a test template with parameter "something else"
2814 !! end
2816 !! article
2817 Template:nowikitest
2818 !! text
2819 <nowiki>'''not wiki'''</nowiki>
2820 !! endarticle
2822 !! test
2823 pre-save transform: nowiki in subst (bug 1188)
2824 !! options
2826 !! input
2827 {{subst:nowikitest}}
2828 !! result
2829 <nowiki>'''not wiki'''</nowiki>
2830 !! end
2833 !! article
2834 Template:commenttest
2835 !! text
2836 This template has <!-- a comment --> in it.
2837 !! endarticle
2839 !! test
2840 pre-save transform: comment in subst (bug 1936)
2841 !! options
2843 !! input
2844 {{subst:commenttest}}
2845 !! result
2846 This template has <!-- a comment --> in it.
2847 !! end
2849 !! test
2850 pre-save transform: unclosed tag
2851 !! options
2852 pst noxml
2853 !! input
2854 <nowiki>'''not wiki'''
2855 !! result
2856 <nowiki>'''not wiki'''
2857 !! end
2859 !! test
2860 pre-save transform: mixed tag case
2861 !! options
2862 pst noxml
2863 !! input
2864 <NOwiki>'''not wiki'''</noWIKI>
2865 !! result
2866 <NOwiki>'''not wiki'''</noWIKI>
2867 !! end
2869 !! test
2870 pre-save transform: unclosed comment in <nowiki>
2871 !! options
2872 pst noxml
2873 !! input
2874 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
2875 !! result
2876 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
2877 !!end
2879 !! article
2880 Template:dangerous
2881 !!text
2882 <span onmouseover="alert('crap')">Oh no</span>
2883 !!endarticle
2885 !!test
2886 (confirming safety of fix for subst bug 1936)
2887 !! input
2888 {{Template:dangerous}}
2889 !! result
2890 <p><span>Oh no</span>
2891 </p>
2892 !! end
2894 !! test
2895 pre-save transform: comment containing gallery (bug 5024)
2896 !! options
2898 !! input
2899 <!-- <gallery>data</gallery> -->
2900 !!result
2901 <!-- <gallery>data</gallery> -->
2902 !!end
2904 !! test
2905 pre-save transform: comment containing extension
2906 !! options
2908 !! input
2909 <!-- <tag>data</tag> -->
2910 !!result
2911 <!-- <tag>data</tag> -->
2912 !!end
2914 !! test
2915 pre-save transform: comment containing nowiki
2916 !! options
2918 !! input
2919 <!-- <nowiki>data</nowiki> -->
2920 !!result
2921 <!-- <nowiki>data</nowiki> -->
2922 !!end
2924 !! test
2925 pre-save transform: comment containing math
2926 !! options
2928 !! input
2929 <!-- <math>data</math> -->
2930 !!result
2931 <!-- <math>data</math> -->
2932 !!end
2934 !! test
2935 pre-save transform: <noinclude> in subst (bug 3298)
2936 !! options
2938 !! input
2939 {{subst:Includes}}
2940 !! result
2941 Foobar
2942 !! end
2944 !! test
2945 pre-save transform: <onlyinclude> in subst (bug 3298)
2946 !! options
2948 !! input
2949 {{subst:Includes2}}
2950 !! result
2952 !! end
2954 !! article
2955 Template:SubstTest
2956 !!text
2957 {{<includeonly>subst:</includeonly>Includes}}
2958 !! endarticle
2960 !! article
2961 Template:SafeSubstTest
2962 !! text
2963 {{<includeonly>safesubst:</includeonly>Includes}}
2964 !! endarticle
2966 !! test
2967 bug 22297: safesubst: works during PST
2968 !! options
2970 !! input
2971 {{subst:SafeSubstTest}}{{safesubst:SubstTest}}
2972 !! result
2973 FoobarFoobar
2974 !! end
2976 !! test
2977 bug 22297: safesubst: works during normal parse
2978 !! input
2979 {{SafeSubstTest}}
2980 !! result
2981 <p>Foobar
2982 </p>
2983 !! end
2985 !! test:
2986 subst: does not work during normal parse
2987 !! input
2988 {{SubstTest}}
2989 !! result
2990 <p>{{subst:Includes}}
2991 </p>
2992 !! end
2994 !! test
2995 pre-save transform: context links ("pipe trick")
2996 !! options
2998 !! input
2999 [[Article (context)|]]
3000 [[Bar:Article|]]
3001 [[:Bar:Article|]]
3002 [[Bar:Article (context)|]]
3003 [[:Bar:Article (context)|]]
3004 [[|Article]]
3005 [[|Article (context)]]
3006 [[Bar:X (Y) Z|]]
3007 [[:Bar:X (Y) Z|]]
3008 !! result
3009 [[Article (context)|Article]]
3010 [[Bar:Article|Article]]
3011 [[:Bar:Article|Article]]
3012 [[Bar:Article (context)|Article]]
3013 [[:Bar:Article (context)|Article]]
3014 [[Article]]
3015 [[Article (context)]]
3016 [[Bar:X (Y) Z|X (Y) Z]]
3017 [[:Bar:X (Y) Z|X (Y) Z]]
3018 !! end
3020 !! test
3021 pre-save transform: context links ("pipe trick") with interwiki prefix
3022 !! options
3024 !! input
3025 [[interwiki:Article|]]
3026 [[:interwiki:Article|]]
3027 [[interwiki:Bar:Article|]]
3028 [[:interwiki:Bar:Article|]]
3029 !! result
3030 [[interwiki:Article|Article]]
3031 [[:interwiki:Article|Article]]
3032 [[interwiki:Bar:Article|Bar:Article]]
3033 [[:interwiki:Bar:Article|Bar:Article]]
3034 !! end
3036 !! test
3037 pre-save transform: context links ("pipe trick") with parens in title
3038 !! options
3039 pst title=[[Somearticle (context)]]
3040 !! input
3041 [[|Article]]
3042 !! result
3043 [[Article (context)|Article]]
3044 !! end
3046 !! test
3047 pre-save transform: context links ("pipe trick") with comma in title
3048 !! options
3049 pst title=[[Someplace, Somewhere]]
3050 !! input
3051 [[|Otherplace]]
3052 [[Otherplace, Elsewhere|]]
3053 [[Otherplace, Elsewhere, Anywhere|]]
3054 !! result
3055 [[Otherplace, Somewhere|Otherplace]]
3056 [[Otherplace, Elsewhere|Otherplace]]
3057 [[Otherplace, Elsewhere, Anywhere|Otherplace]]
3058 !! end
3060 !! test
3061 pre-save transform: context links ("pipe trick") with parens and comma
3062 !! options
3063 pst title=[[Someplace (IGNORED), Somewhere]]
3064 !! input
3065 [[|Otherplace]]
3066 [[Otherplace (place), Elsewhere|]]
3067 !! result
3068 [[Otherplace, Somewhere|Otherplace]]
3069 [[Otherplace (place), Elsewhere|Otherplace]]
3070 !! end
3072 !! test
3073 pre-save transform: context links ("pipe trick") with comma and parens
3074 !! options
3075 pst title=[[Who, me? (context)]]
3076 !! input
3077 [[|Yes, you.]]
3078 [[Me, Myself, and I (1937 song)|]]
3079 !! result
3080 [[Yes, you. (context)|Yes, you.]]
3081 [[Me, Myself, and I (1937 song)|Me, Myself, and I]]
3082 !! end
3084 !! test
3085 pre-save transform: context links ("pipe trick") with namespace
3086 !! options
3087 pst title=[[Ns:Somearticle]]
3088 !! input
3089 [[|Article]]
3090 !! result
3091 [[Ns:Article|Article]]
3092 !! end
3094 !! test
3095 pre-save transform: context links ("pipe trick") with namespace and parens
3096 !! options
3097 pst title=[[Ns:Somearticle (context)]]
3098 !! input
3099 [[|Article]]
3100 !! result
3101 [[Ns:Article (context)|Article]]
3102 !! end
3104 !! test
3105 pre-save transform: context links ("pipe trick") with namespace and comma
3106 !! options
3107 pst title=[[Ns:Somearticle, Context, Whatever]]
3108 !! input
3109 [[|Article]]
3110 !! result
3111 [[Ns:Article, Context, Whatever|Article]]
3112 !! end
3114 !! test
3115 pre-save transform: context links ("pipe trick") with namespace, comma and parens
3116 !! options
3117 pst title=[[Ns:Somearticle, Context (context)]]
3118 !! input
3119 [[|Article]]
3120 !! result
3121 [[Ns:Article (context)|Article]]
3122 !! end
3124 !! test
3125 pre-save transform: context links ("pipe trick") with namespace, parens and comma
3126 !! options
3127 pst title=[[Ns:Somearticle (IGNORED), Context]]
3128 !! input
3129 [[|Article]]
3130 !! result
3131 [[Ns:Article, Context|Article]]
3132 !! end
3136 ### Message transform tests
3138 !! test
3139 message transform: magic variables
3140 !! options
3142 !! input
3143 {{SITENAME}}
3144 !! result
3145 MediaWiki
3146 !! end
3148 !! test
3149 message transform: should not transform wiki markup
3150 !! options
3152 !! input
3153 ''test''
3154 !! result
3155 ''test''
3156 !! end
3158 !! test
3159 message transform: <noinclude> in transcluded template (bug 4926)
3160 !! options
3162 !! input
3163 {{Includes}}
3164 !! result
3165 Foobar
3166 !! end
3168 !! test
3169 message transform: <onlyinclude> in transcluded template (bug 4926)
3170 !! options
3172 !! input
3173 {{Includes2}}
3174 !! result
3176 !! end
3178 !! test
3179 {{#special:}} page name, known
3180 !! options
3182 !! input
3183 {{#special:Recentchanges}}
3184 !! result
3185 Special:RecentChanges
3186 !! end
3188 !! test
3189 {{#special:}} page name with subpage, known
3190 !! options
3192 !! input
3193 {{#special:Recentchanges/param}}
3194 !! result
3195 Special:RecentChanges/param
3196 !! end
3198 !! test
3199 {{#special:}} page name, unknown
3200 !! options
3202 !! input
3203 {{#special:foobarnonexistent}}
3204 !! result
3205 No such special page
3206 !! end
3209 ### Images
3211 !! test
3212 Simple image
3213 !! input
3214 [[Image:foobar.jpg]]
3215 !! result
3216 <p><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
3217 </p>
3218 !! end
3220 !! test
3221 Right-aligned image
3222 !! input
3223 [[Image:foobar.jpg|right]]
3224 !! result
3225 <div class="floatright"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a></div>
3227 !! end
3229 !! test
3230 Simple image (using File: namespace, now canonical)
3231 !! input
3232 [[File:foobar.jpg]]
3233 !! result
3234 <p><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
3235 </p>
3236 !! end
3238 !! test
3239 Image with caption
3240 !! input
3241 [[Image:foobar.jpg|right|Caption text]]
3242 !! result
3243 <div class="floatright"><a href="/wiki/File:Foobar.jpg" class="image" title="Caption text"><img alt="Caption text" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a></div>
3245 !! end
3247 !! test
3248 Image with link parameter, wiki target
3249 !! input
3250 [[Image:foobar.jpg|link=Target page]]
3251 !! result
3252 <p><a href="/wiki/Target_page" title="Target page"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
3253 </p>
3254 !! end
3256 !! test
3257 Image with link parameter, URL target
3258 !! input
3259 [[Image:foobar.jpg|link=http://example.com/]]
3260 !! result
3261 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
3262 </p>
3263 !! end
3265 !! test
3266 Image with empty link parameter
3267 !! input
3268 [[Image:foobar.jpg|link=]]
3269 !! result
3270 <p><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" />
3271 </p>
3272 !! end
3274 !! test
3275 Image with link parameter (wiki target) and unnamed parameter
3276 !! input
3277 [[Image:foobar.jpg|link=Target page|Title]]
3278 !! result
3279 <p><a href="/wiki/Target_page" title="Title"><img alt="Title" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
3280 </p>
3281 !! end
3283 !! test
3284 Image with link parameter (URL target) and unnamed parameter
3285 !! input
3286 [[Image:foobar.jpg|link=http://example.com/|Title]]
3287 !! result
3288 <p><a href="http://example.com/" title="Title"><img alt="Title" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
3289 </p>
3290 !! end
3294 !! test
3295 Image with frame and link
3296 !! input
3297 [[Image:Foobar.jpg|frame|left|This is a test image [[Main Page]]]]
3298 !! result
3299 <div class="thumb tleft"><div class="thumbinner" style="width:1943px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" class="thumbimage" /></a>  <div class="thumbcaption">This is a test image <a href="/wiki/Main_Page" title="Main Page">Main Page</a></div></div></div>
3301 !! end
3303 !! test
3304 Image with frame and link and explicit alt
3305 !! input
3306 [[Image:Foobar.jpg|frame|left|This is a test image [[Main Page]]|alt=Altitude]]
3307 !! result
3308 <div class="thumb tleft"><div class="thumbinner" style="width:1943px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Altitude" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" class="thumbimage" /></a>  <div class="thumbcaption">This is a test image <a href="/wiki/Main_Page" title="Main Page">Main Page</a></div></div></div>
3310 !! end
3312 !! test
3313 Image with wiki markup in implicit alt
3314 !! input
3315 [[Image:Foobar.jpg|testing '''bold''' in alt]]
3316 !! result
3317 <p><a href="/wiki/File:Foobar.jpg" class="image" title="testing bold in alt"><img alt="testing bold in alt" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
3318 </p>
3319 !! end
3321 !! test
3322 Image with wiki markup in explicit alt
3323 !! input
3324 [[Image:Foobar.jpg|alt=testing '''bold''' in alt]]
3325 !! result
3326 <p><a href="/wiki/File:Foobar.jpg" class="image"><img alt="testing bold in alt" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
3327 </p>
3328 !! end
3330 !! test
3331 Link to image page- image page normally doesn't exists, hence edit link
3332 Add test with existing image page
3333 #<p><a href="/wiki/File:Test" title="Image:Test">Image:test</a>
3334 !! input
3335 [[:Image:test]]
3336 !! result
3337 <p><a href="/index.php?title=File:Test&amp;action=edit&amp;redlink=1" class="new" title="File:Test (page does not exist)">Image:test</a>
3338 </p>
3339 !! end
3341 !! test
3342 bug 18784  Link to non-existent image page with caption should use caption as link text
3343 !! input
3344 [[:Image:test|caption]]
3345 !! result
3346 <p><a href="/index.php?title=File:Test&amp;action=edit&amp;redlink=1" class="new" title="File:Test (page does not exist)">caption</a>
3347 </p>
3348 !! end
3350 !! test
3351 Frameless image caption with a free URL
3352 !! input
3353 [[Image:foobar.jpg|http://example.com]]
3354 !! result
3355 <p><a href="/wiki/File:Foobar.jpg" class="image" title="http://example.com"><img alt="http://example.com" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
3356 </p>
3357 !! end
3359 !! test
3360 Thumbnail image caption with a free URL
3361 !! input
3362 [[Image:foobar.jpg|thumb|http://example.com]]
3363 !! result
3364 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/3/3a/Foobar.jpg" width="180" height="20" class="thumbimage" /></a>  <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div><a href="http://example.com" class="external free" rel="nofollow">http://example.com</a></div></div></div>
3366 !! end
3368 !! test
3369 Thumbnail image caption with a free URL and explicit alt
3370 !! input
3371 [[Image:foobar.jpg|thumb|http://example.com|alt=Alteration]]
3372 !! result
3373 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Alteration" src="http://example.com/images/3/3a/Foobar.jpg" width="180" height="20" class="thumbimage" /></a>  <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div><a href="http://example.com" class="external free" rel="nofollow">http://example.com</a></div></div></div>
3375 !! end
3377 !! test
3378 BUG 1887: A ISBN with a thumbnail
3379 !! input
3380 [[Image:foobar.jpg|thumb|ISBN 1235467890]]
3381 !! result
3382 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/3/3a/Foobar.jpg" width="180" height="20" class="thumbimage" /></a>  <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div><a href="/wiki/Special:BookSources/1235467890" class="internal mw-magiclink-isbn">ISBN 1235467890</a></div></div></div>
3384 !! end
3386 !! test
3387 BUG 1887: A RFC with a thumbnail
3388 !! input
3389 [[Image:foobar.jpg|thumb|This is RFC 12354]]
3390 !! result
3391 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/3/3a/Foobar.jpg" width="180" height="20" class="thumbimage" /></a>  <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>This is <a href="http://tools.ietf.org/html/rfc12354" class="external mw-magiclink-rfc">RFC 12354</a></div></div></div>
3393 !! end
3395 !! test
3396 BUG 1887: A mailto link with a thumbnail
3397 !! input
3398 [[Image:foobar.jpg|thumb|Please mailto:nobody@example.com]]
3399 !! result
3400 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/3/3a/Foobar.jpg" width="180" height="20" class="thumbimage" /></a>  <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>Please <a href="mailto:nobody@example.com" class="external free" rel="nofollow">mailto:nobody@example.com</a></div></div></div>
3402 !! end
3404 !! test
3405 BUG 1887: A <math> with a thumbnail- we don't render math in the parsertests by default,
3406 so math is not stripped and turns up as escaped &lt;math&gt; tags.
3407 !! input
3408 [[Image:foobar.jpg|thumb|<math>2+2</math>]]
3409 !! result
3410 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/3/3a/Foobar.jpg" width="180" height="20" class="thumbimage" /></a>  <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>&lt;math&gt;2+2&lt;/math&gt;</div></div></div>
3412 !! end
3414 !! test
3415 BUG 1887, part 2: A <math> with a thumbnail- math enabled
3416 !! options
3417 math
3418 !! input
3419 [[Image:foobar.jpg|thumb|<math>2+2</math>]]
3420 !! result
3421 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/3/3a/Foobar.jpg" width="180" height="20" class="thumbimage" /></a>  <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div><span class="texhtml">2 + 2</span></div></div></div>
3423 !! end
3425 # Pending resolution to bug 368
3426 !! test
3427 BUG 648: Frameless image caption with a link
3428 !! input
3429 [[Image:foobar.jpg|text with a [[link]] in it]]
3430 !! result
3431 <p><a href="/wiki/File:Foobar.jpg" class="image" title="text with a link in it"><img alt="text with a link in it" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
3432 </p>
3433 !! end
3435 !! test
3436 BUG 648: Frameless image caption with a link (suffix)
3437 !! input
3438 [[Image:foobar.jpg|text with a [[link]]foo in it]]
3439 !! result
3440 <p><a href="/wiki/File:Foobar.jpg" class="image" title="text with a linkfoo in it"><img alt="text with a linkfoo in it" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
3441 </p>
3442 !! end
3444 !! test
3445 BUG 648: Frameless image caption with an interwiki link
3446 !! input
3447 [[Image:foobar.jpg|text with a [[MeatBall:Link]] in it]]
3448 !! result
3449 <p><a href="/wiki/File:Foobar.jpg" class="image" title="text with a MeatBall:Link in it"><img alt="text with a MeatBall:Link in it" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
3450 </p>
3451 !! end
3453 !! test
3454 BUG 648: Frameless image caption with a piped interwiki link
3455 !! input
3456 [[Image:foobar.jpg|text with a [[MeatBall:Link|link]] in it]]
3457 !! result
3458 <p><a href="/wiki/File:Foobar.jpg" class="image" title="text with a link in it"><img alt="text with a link in it" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
3459 </p>
3460 !! end
3462 !! test
3463 Escape HTML special chars in image alt text
3464 !! input
3465 [[Image:foobar.jpg|& < > "]]
3466 !! result
3467 <p><a href="/wiki/File:Foobar.jpg" class="image" title="&amp; &lt; &gt; &quot;"><img alt="&amp; &lt; &gt; &quot;" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
3468 </p>
3469 !! end
3471 !! test
3472 BUG 499: Alt text should have &#1234;, not &amp;1234;
3473 !! input
3474 [[Image:foobar.jpg|&#9792;]]
3475 !! result
3476 <p><a href="/wiki/File:Foobar.jpg" class="image" title="♀"><img alt="♀" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
3477 </p>
3478 !! end
3480 !! test
3481 Broken image caption with link
3482 !! input
3483 [[Image:Foobar.jpg|thumb|This is a broken caption. But [[Main Page|this]] is just an ordinary link.
3484 !! result
3485 <p>[[Image:Foobar.jpg|thumb|This is a broken caption. But <a href="/wiki/Main_Page" title="Main Page">this</a> is just an ordinary link.
3486 </p>
3487 !! end
3489 !! test
3490 Image caption containing another image
3491 !! input
3492 [[Image:Foobar.jpg|thumb|This is a caption with another [[Image:icon.png|image]] inside it!]]
3493 !! result
3494 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/3/3a/Foobar.jpg" width="180" height="20" class="thumbimage" /></a>  <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>This is a caption with another <a href="/index.php?title=Special:Upload&amp;wpDestFile=Icon.png" class="new" title="File:Icon.png">image</a> inside it!</div></div></div>
3496 !! end
3498 !! test
3499 Image caption containing a newline
3500 !! input
3501 [[Image:Foobar.jpg|This
3502 *is some text]]
3503 !! result
3504 <p><a href="/wiki/File:Foobar.jpg" class="image" title="This *is some text"><img alt="This *is some text" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
3505 </p>
3506 !!end
3509 !! test
3510 Bug 3090: External links other than http: in image captions
3511 !! input
3512 [[Image:Foobar.jpg|thumb|200px|This caption has [irc://example.net irc] and [https://example.com Secure] ext links in it.]]
3513 !! result
3514 <div class="thumb tright"><div class="thumbinner" style="width:202px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/3/3a/Foobar.jpg" width="200" height="23" class="thumbimage" /></a>  <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>This caption has <a href="irc://example.net" class="external text" rel="nofollow">irc</a> and <a href="https://example.com" class="external text" rel="nofollow">Secure</a> ext links in it.</div></div></div>
3516 !! end
3520 ### Subpages
3522 !! article
3523 Subpage test/subpage
3524 !! text
3526 !! endarticle
3528 !! test
3529 Subpage link
3530 !! options
3531 subpage title=[[Subpage test]]
3532 !! input
3533 [[/subpage]]
3534 !! result
3535 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a>
3536 </p>
3537 !! end
3539 !! test
3540 Subpage noslash link
3541 !! options
3542 subpage title=[[Subpage test]]
3543 !!input
3544 [[/subpage/]]
3545 !! result
3546 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">subpage</a>
3547 </p>
3548 !! end
3550 !! test
3551 Disabled subpages
3552 !! input
3553 [[/subpage]]
3554 !! result
3555 <p><a href="/index.php?title=/subpage&amp;action=edit&amp;redlink=1" class="new" title="/subpage (page does not exist)">/subpage</a>
3556 </p>
3557 !! end
3559 !! test
3560 BUG 561: {{/Subpage}}
3561 !! options
3562 subpage title=[[Page]]
3563 !! input
3564 {{/Subpage}}
3565 !! result
3566 <p><a href="/index.php?title=Page/Subpage&amp;action=edit&amp;redlink=1" class="new" title="Page/Subpage (page does not exist)">Page/Subpage</a>
3567 </p>
3568 !! end
3571 ### Categories
3573 !! article
3574 Category:MediaWiki User's Guide
3575 !! text
3576 blah
3577 !! endarticle
3579 !! test
3580 Link to category
3581 !! input
3582 [[:Category:MediaWiki User's Guide]]
3583 !! result
3584 <p><a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">Category:MediaWiki User's Guide</a>
3585 </p>
3586 !! end
3588 !! test
3589 Simple category
3590 !! options
3592 !! input
3593 [[Category:MediaWiki User's Guide]]
3594 !! result
3595 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
3596 !! end
3598 !! test
3599 PAGESINCATEGORY invalid title fatal (r33546 fix)
3600 !! input
3601 {{PAGESINCATEGORY:<bogus>}}
3602 !! result
3603 <p>0
3604 </p>
3605 !! end
3608 ### Inter-language links
3610 !! test
3611 Inter-language links
3612 !! options
3614 !! input
3615 [[es:Alimento]]
3616 [[fr:Nourriture]]
3617 [[zh:&#39135;&#21697;]]
3618 !! result
3619 es:Alimento fr:Nourriture zh:食品
3620 !! end
3623 ### Sections
3625 !! test
3626 Basic section headings
3627 !! input
3628 == Headline 1 ==
3629 Some text
3631 ==Headline 2==
3632 More
3633 ===Smaller headline===
3634 Blah blah
3635 !! result
3636 <h2><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: Headline 1">edit</a>]</span> <span class="mw-headline" id="Headline_1"> Headline 1 </span></h2>
3637 <p>Some text
3638 </p>
3639 <h2><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: Headline 2">edit</a>]</span> <span class="mw-headline" id="Headline_2">Headline 2</span></h2>
3640 <p>More
3641 </p>
3642 <h3><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=3" title="Edit section: Smaller headline">edit</a>]</span> <span class="mw-headline" id="Smaller_headline">Smaller headline</span></h3>
3643 <p>Blah blah
3644 </p>
3645 !! end
3647 !! test
3648 Section headings with TOC
3649 !! input
3650 == Headline 1 ==
3651 === Subheadline 1 ===
3652 ===== Skipping a level =====
3653 ====== Skipping a level ======
3655 == Headline 2 ==
3656 Some text
3657 ===Another headline===
3658 !! result
3659 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
3660 <ul>
3661 <li class="toclevel-1 tocsection-1"><a href="#Headline_1"><span class="tocnumber">1</span> <span class="toctext">Headline 1</span></a>
3662 <ul>
3663 <li class="toclevel-2 tocsection-2"><a href="#Subheadline_1"><span class="tocnumber">1.1</span> <span class="toctext">Subheadline 1</span></a>
3664 <ul>
3665 <li class="toclevel-3 tocsection-3"><a href="#Skipping_a_level"><span class="tocnumber">1.1.1</span> <span class="toctext">Skipping a level</span></a>
3666 <ul>
3667 <li class="toclevel-4 tocsection-4"><a href="#Skipping_a_level_2"><span class="tocnumber">1.1.1.1</span> <span class="toctext">Skipping a level</span></a></li>
3668 </ul>
3669 </li>
3670 </ul>
3671 </li>
3672 </ul>
3673 </li>
3674 <li class="toclevel-1 tocsection-5"><a href="#Headline_2"><span class="tocnumber">2</span> <span class="toctext">Headline 2</span></a>
3675 <ul>
3676 <li class="toclevel-2 tocsection-6"><a href="#Another_headline"><span class="tocnumber">2.1</span> <span class="toctext">Another headline</span></a></li>
3677 </ul>
3678 </li>
3679 </ul>
3680 </td></tr></table><script>if (window.showTocToggle) { var tocShowText = "show"; var tocHideText = "hide"; showTocToggle(); } </script>
3681 <h2><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: Headline 1">edit</a>]</span> <span class="mw-headline" id="Headline_1"> Headline 1 </span></h2>
3682 <h3><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: Subheadline 1">edit</a>]</span> <span class="mw-headline" id="Subheadline_1"> Subheadline 1 </span></h3>
3683 <h5><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=3" title="Edit section: Skipping a level">edit</a>]</span> <span class="mw-headline" id="Skipping_a_level"> Skipping a level </span></h5>
3684 <h6><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=4" title="Edit section: Skipping a level">edit</a>]</span> <span class="mw-headline" id="Skipping_a_level_2"> Skipping a level </span></h6>
3685 <h2><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=5" title="Edit section: Headline 2">edit</a>]</span> <span class="mw-headline" id="Headline_2"> Headline 2 </span></h2>
3686 <p>Some text
3687 </p>
3688 <h3><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=6" title="Edit section: Another headline">edit</a>]</span> <span class="mw-headline" id="Another_headline">Another headline</span></h3>
3690 !! end
3692 # perl -e 'print "="x$_," Level $_ heading","="x$_,"\n" for 1..10'
3693 !! test
3694 Handling of sections up to level 6 and beyond
3695 !! input 
3696 = Level 1 Heading=
3697 == Level 2 Heading==
3698 === Level 3 Heading===
3699 ==== Level 4 Heading====
3700 ===== Level 5 Heading=====
3701 ====== Level 6 Heading======
3702 ======= Level 7 Heading=======
3703 ======== Level 8 Heading========
3704 ========= Level 9 Heading=========
3705 ========== Level 10 Heading==========
3706 !! result
3707 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
3708 <ul>
3709 <li class="toclevel-1 tocsection-1"><a href="#Level_1_Heading"><span class="tocnumber">1</span> <span class="toctext">Level 1 Heading</span></a>
3710 <ul>
3711 <li class="toclevel-2 tocsection-2"><a href="#Level_2_Heading"><span class="tocnumber">1.1</span> <span class="toctext">Level 2 Heading</span></a>
3712 <ul>
3713 <li class="toclevel-3 tocsection-3"><a href="#Level_3_Heading"><span class="tocnumber">1.1.1</span> <span class="toctext">Level 3 Heading</span></a>
3714 <ul>
3715 <li class="toclevel-4 tocsection-4"><a href="#Level_4_Heading"><span class="tocnumber">1.1.1.1</span> <span class="toctext">Level 4 Heading</span></a>
3716 <ul>
3717 <li class="toclevel-5 tocsection-5"><a href="#Level_5_Heading"><span class="tocnumber">1.1.1.1.1</span> <span class="toctext">Level 5 Heading</span></a>
3718 <ul>
3719 <li class="toclevel-6 tocsection-6"><a href="#Level_6_Heading"><span class="tocnumber">1.1.1.1.1.1</span> <span class="toctext">Level 6 Heading</span></a></li>
3720 <li class="toclevel-6 tocsection-7"><a href="#.3D_Level_7_Heading.3D"><span class="tocnumber">1.1.1.1.1.2</span> <span class="toctext">= Level 7 Heading=</span></a></li>
3721 <li class="toclevel-6 tocsection-8"><a href="#.3D.3D_Level_8_Heading.3D.3D"><span class="tocnumber">1.1.1.1.1.3</span> <span class="toctext">== Level 8 Heading==</span></a></li>
3722 <li class="toclevel-6 tocsection-9"><a href="#.3D.3D.3D_Level_9_Heading.3D.3D.3D"><span class="tocnumber">1.1.1.1.1.4</span> <span class="toctext">=== Level 9 Heading===</span></a></li>
3723 <li class="toclevel-6 tocsection-10"><a href="#.3D.3D.3D.3D_Level_10_Heading.3D.3D.3D.3D"><span class="tocnumber">1.1.1.1.1.5</span> <span class="toctext">==== Level 10 Heading====</span></a></li>
3724 </ul>
3725 </li>
3726 </ul>
3727 </li>
3728 </ul>
3729 </li>
3730 </ul>
3731 </li>
3732 </ul>
3733 </li>
3734 </ul>
3735 </td></tr></table><script>if (window.showTocToggle) { var tocShowText = "show"; var tocHideText = "hide"; showTocToggle(); } </script>
3736 <h1><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: Level 1 Heading">edit</a>]</span> <span class="mw-headline" id="Level_1_Heading"> Level 1 Heading</span></h1>
3737 <h2><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: Level 2 Heading">edit</a>]</span> <span class="mw-headline" id="Level_2_Heading"> Level 2 Heading</span></h2>
3738 <h3><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=3" title="Edit section: Level 3 Heading">edit</a>]</span> <span class="mw-headline" id="Level_3_Heading"> Level 3 Heading</span></h3>
3739 <h4><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=4" title="Edit section: Level 4 Heading">edit</a>]</span> <span class="mw-headline" id="Level_4_Heading"> Level 4 Heading</span></h4>
3740 <h5><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=5" title="Edit section: Level 5 Heading">edit</a>]</span> <span class="mw-headline" id="Level_5_Heading"> Level 5 Heading</span></h5>
3741 <h6><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=6" title="Edit section: Level 6 Heading">edit</a>]</span> <span class="mw-headline" id="Level_6_Heading"> Level 6 Heading</span></h6>
3742 <h6><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=7" title="Edit section: = Level 7 Heading=">edit</a>]</span> <span class="mw-headline" id=".3D_Level_7_Heading.3D">= Level 7 Heading=</span></h6>
3743 <h6><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=8" title="Edit section: == Level 8 Heading==">edit</a>]</span> <span class="mw-headline" id=".3D.3D_Level_8_Heading.3D.3D">== Level 8 Heading==</span></h6>
3744 <h6><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=9" title="Edit section: === Level 9 Heading===">edit</a>]</span> <span class="mw-headline" id=".3D.3D.3D_Level_9_Heading.3D.3D.3D">=== Level 9 Heading===</span></h6>
3745 <h6><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=10" title="Edit section: ==== Level 10 Heading====">edit</a>]</span> <span class="mw-headline" id=".3D.3D.3D.3D_Level_10_Heading.3D.3D.3D.3D">==== Level 10 Heading====</span></h6>
3747 !! end
3749 !! test
3750 TOC regression (bug 9764)
3751 !! input
3752 == title 1 ==
3753 === title 1.1 ===
3754 ==== title 1.1.1 ====
3755 === title 1.2 ===
3756 == title 2 ==
3757 === title 2.1 ===
3758 !! result
3759 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
3760 <ul>
3761 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
3762 <ul>
3763 <li class="toclevel-2 tocsection-2"><a href="#title_1.1"><span class="tocnumber">1.1</span> <span class="toctext">title 1.1</span></a>
3764 <ul>
3765 <li class="toclevel-3 tocsection-3"><a href="#title_1.1.1"><span class="tocnumber">1.1.1</span> <span class="toctext">title 1.1.1</span></a></li>
3766 </ul>
3767 </li>
3768 <li class="toclevel-2 tocsection-4"><a href="#title_1.2"><span class="tocnumber">1.2</span> <span class="toctext">title 1.2</span></a></li>
3769 </ul>
3770 </li>
3771 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
3772 <ul>
3773 <li class="toclevel-2 tocsection-6"><a href="#title_2.1"><span class="tocnumber">2.1</span> <span class="toctext">title 2.1</span></a></li>
3774 </ul>
3775 </li>
3776 </ul>
3777 </td></tr></table><script>if (window.showTocToggle) { var tocShowText = "show"; var tocHideText = "hide"; showTocToggle(); } </script>
3778 <h2><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: title 1">edit</a>]</span> <span class="mw-headline" id="title_1"> title 1 </span></h2>
3779 <h3><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: title 1.1">edit</a>]</span> <span class="mw-headline" id="title_1.1"> title 1.1 </span></h3>
3780 <h4><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=3" title="Edit section: title 1.1.1">edit</a>]</span> <span class="mw-headline" id="title_1.1.1"> title 1.1.1 </span></h4>
3781 <h3><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=4" title="Edit section: title 1.2">edit</a>]</span> <span class="mw-headline" id="title_1.2"> title 1.2 </span></h3>
3782 <h2><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=5" title="Edit section: title 2">edit</a>]</span> <span class="mw-headline" id="title_2"> title 2 </span></h2>
3783 <h3><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=6" title="Edit section: title 2.1">edit</a>]</span> <span class="mw-headline" id="title_2.1"> title 2.1 </span></h3>
3785 !! end
3787 !! test
3788 TOC with wgMaxTocLevel=3 (bug 6204)
3789 !! options
3790 wgMaxTocLevel=3
3791 !! input
3792 == title 1 ==
3793 === title 1.1 ===
3794 ==== title 1.1.1 ====
3795 === title 1.2 ===
3796 == title 2 ==
3797 === title 2.1 ===
3798 !! result
3799 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
3800 <ul>
3801 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
3802 <ul>
3803 <li class="toclevel-2 tocsection-2"><a href="#title_1.1"><span class="tocnumber">1.1</span> <span class="toctext">title 1.1</span></a></li>
3804 <li class="toclevel-2 tocsection-4"><a href="#title_1.2"><span class="tocnumber">1.2</span> <span class="toctext">title 1.2</span></a></li>
3805 </ul>
3806 </li>
3807 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
3808 <ul>
3809 <li class="toclevel-2 tocsection-6"><a href="#title_2.1"><span class="tocnumber">2.1</span> <span class="toctext">title 2.1</span></a></li>
3810 </ul>
3811 </li>
3812 </ul>
3813 </td></tr></table><script>if (window.showTocToggle) { var tocShowText = "show"; var tocHideText = "hide"; showTocToggle(); } </script>
3814 <h2><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: title 1">edit</a>]</span> <span class="mw-headline" id="title_1"> title 1 </span></h2>
3815 <h3><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: title 1.1">edit</a>]</span> <span class="mw-headline" id="title_1.1"> title 1.1 </span></h3>
3816 <h4><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=3" title="Edit section: title 1.1.1">edit</a>]</span> <span class="mw-headline" id="title_1.1.1"> title 1.1.1 </span></h4>
3817 <h3><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=4" title="Edit section: title 1.2">edit</a>]</span> <span class="mw-headline" id="title_1.2"> title 1.2 </span></h3>
3818 <h2><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=5" title="Edit section: title 2">edit</a>]</span> <span class="mw-headline" id="title_2"> title 2 </span></h2>
3819 <h3><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=6" title="Edit section: title 2.1">edit</a>]</span> <span class="mw-headline" id="title_2.1"> title 2.1 </span></h3>
3821 !! end
3823 !! test
3824 Resolving duplicate section names
3825 !! input
3826 == Foo bar ==
3827 == Foo bar ==
3828 !! result
3829 <h2><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: Foo bar">edit</a>]</span> <span class="mw-headline" id="Foo_bar"> Foo bar </span></h2>
3830 <h2><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: Foo bar">edit</a>]</span> <span class="mw-headline" id="Foo_bar_2"> Foo bar </span></h2>
3832 !! end
3834 !! test
3835 Resolving duplicate section names with differing case (bug 10721)
3836 !! input
3837 == Foo bar ==
3838 == Foo Bar ==
3839 !! result
3840 <h2><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: Foo bar">edit</a>]</span> <span class="mw-headline" id="Foo_bar"> Foo bar </span></h2>
3841 <h2><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: Foo Bar">edit</a>]</span> <span class="mw-headline" id="Foo_Bar_2"> Foo Bar </span></h2>
3843 !! end
3845 !! article
3846 Template:sections
3847 !! text
3848 ===Section 1===
3849 ==Section 2==
3850 !! endarticle
3852 !! test
3853 Template with sections, __NOTOC__
3854 !! input
3855 __NOTOC__
3856 ==Section 0==
3857 {{sections}}
3858 ==Section 4==
3859 !! result
3860 <h2><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: Section 0">edit</a>]</span> <span class="mw-headline" id="Section_0">Section 0</span></h2>
3861 <h3><span class="editsection">[<a href="/index.php?title=Template:Sections&amp;action=edit&amp;section=T-1" title="Template:Sections">edit</a>]</span> <span class="mw-headline" id="Section_1">Section 1</span></h3>
3862 <h2><span class="editsection">[<a href="/index.php?title=Template:Sections&amp;action=edit&amp;section=T-2" title="Template:Sections">edit</a>]</span> <span class="mw-headline" id="Section_2">Section 2</span></h2>
3863 <h2><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: Section 4">edit</a>]</span> <span class="mw-headline" id="Section_4">Section 4</span></h2>
3865 !! end
3867 !! test
3868 __NOEDITSECTION__ keyword
3869 !! input
3870 __NOEDITSECTION__
3871 ==Section 1==
3872 ==Section 2==
3873 !! result
3874 <h2> <span class="mw-headline" id="Section_1">Section 1</span></h2>
3875 <h2> <span class="mw-headline" id="Section_2">Section 2</span></h2>
3877 !! end
3879 !! test
3880 Link inside a section heading
3881 !! input
3882 ==Section with a [[Main Page|link]] in it==
3883 !! result
3884 <h2><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: Section with a link in it">edit</a>]</span> <span class="mw-headline" id="Section_with_a_link_in_it">Section with a <a href="/wiki/Main_Page" title="Main Page">link</a> in it</span></h2>
3886 !! end
3888 !! test
3889 TOC regression (bug 12077)
3890 !! input
3891 __TOC__
3892 == title 1 ==
3893 === title 1.1 ===
3894 == title 2 ==
3895 !! result
3896 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
3897 <ul>
3898 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
3899 <ul>
3900 <li class="toclevel-2 tocsection-2"><a href="#title_1.1"><span class="tocnumber">1.1</span> <span class="toctext">title 1.1</span></a></li>
3901 </ul>
3902 </li>
3903 <li class="toclevel-1 tocsection-3"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a></li>
3904 </ul>
3905 </td></tr></table><script>if (window.showTocToggle) { var tocShowText = "show"; var tocHideText = "hide"; showTocToggle(); } </script>
3906 <h2><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: title 1">edit</a>]</span> <span class="mw-headline" id="title_1"> title 1 </span></h2>
3907 <h3><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: title 1.1">edit</a>]</span> <span class="mw-headline" id="title_1.1"> title 1.1 </span></h3>
3908 <h2><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=3" title="Edit section: title 2">edit</a>]</span> <span class="mw-headline" id="title_2"> title 2 </span></h2>
3910 !! end
3912 !! test
3913 BUG 1219 URL next to image (good)
3914 !! input
3915 http://example.com [[Image:foobar.jpg]]
3916 !! result
3917 <p><a href="http://example.com" class="external free" rel="nofollow">http://example.com</a> <a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
3918 </p>
3919 !!end
3921 !! test
3922 Short headings with trailing space should match behaviour of Parser::doHeadings (bug 19910)
3923 !! input
3924 === 
3925 The line above must have a trailing space!
3926 === <!--
3927 --> <!-- -->
3928 But just in case it doesn't...
3929 !! result
3930 <h1><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: =">edit</a>]</span> <span class="mw-headline" id=".3D">=</span></h1>
3931 <p>The line above must have a trailing space!
3932 </p>
3933 <h1><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: =">edit</a>]</span> <span class="mw-headline" id=".3D_2">=</span></h1>
3934 <p>But just in case it doesn't...
3935 </p>
3936 !! end
3938 !! test
3939 BUG 1219 URL next to image (broken)
3940 !! input
3941 http://example.com[[Image:foobar.jpg]]
3942 !! result
3943 <p><a href="http://example.com" class="external free" rel="nofollow">http://example.com</a><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
3944 </p>
3945 !!end
3947 !! test
3948 Bug 1186 news: in the middle of text
3949 !! input
3950 http://en.wikinews.org/wiki/Wikinews:Workplace
3951 !! result
3952 <p><a href="http://en.wikinews.org/wiki/Wikinews:Workplace" class="external free" rel="nofollow">http://en.wikinews.org/wiki/Wikinews:Workplace</a>
3953 </p>
3954 !!end
3957 !! test
3958 Namespaced link must have a title
3959 !! input
3960 [[Project:]]
3961 !! result
3962 <p>[[Project:]]
3963 </p>
3964 !!end
3966 !! test
3967 Namespaced link must have a title (bad fragment version)
3968 !! input
3969 [[Project:#fragment]]
3970 !! result
3971 <p>[[Project:#fragment]]
3972 </p>
3973 !!end
3976 !! test
3977 div with no attributes
3978 !! input
3979 <div>HTML rocks</div>
3980 !! result
3981 <div>HTML rocks</div>
3983 !! end
3985 !! test
3986 div with double-quoted attribute
3987 !! input
3988 <div id="rock">HTML rocks</div>
3989 !! result
3990 <div id="rock">HTML rocks</div>
3992 !! end
3994 !! test
3995 div with single-quoted attribute
3996 !! input
3997 <div id='rock'>HTML rocks</div>
3998 !! result
3999 <div id="rock">HTML rocks</div>
4001 !! end
4003 !! test
4004 div with unquoted attribute
4005 !! input
4006 <div id=rock>HTML rocks</div>
4007 !! result
4008 <div id="rock">HTML rocks</div>
4010 !! end
4012 !! test
4013 div with illegal double attributes
4014 !! input
4015 <div align="center" align="right">HTML rocks</div>
4016 !! result
4017 <div align="right">HTML rocks</div>
4019 !!end
4021 !! test
4022 HTML multiple attributes correction
4023 !! input
4024 <p class="error" class="awesome">Awesome!</p>
4025 !! result
4026 <p class="awesome">Awesome!</p>
4028 !!end
4030 !! test
4031 Table multiple attributes correction
4032 !! input
4034 !+ class="error" class="awesome"| status
4036 !! result
4037 <table>
4038 <tr>
4039 <th class="awesome"> status
4040 </th></tr></table>
4042 !!end
4044 !! test
4045 DIV IN UPPERCASE
4046 !! input
4047 <DIV ALIGN="center">HTML ROCKS</DIV>
4048 !! result
4049 <div align="center">HTML ROCKS</div>
4051 !!end
4054 !! test
4055 text with amp in the middle of nowhere
4056 !! input
4057 Remember AT&T?
4058 !!result
4059 <p>Remember AT&amp;T?
4060 </p>
4061 !! end
4063 !! test
4064 text with character entity: eacute
4065 !! input
4066 I always thought &eacute; was a cute letter.
4067 !! result
4068 <p>I always thought &eacute; was a cute letter.
4069 </p>
4070 !! end
4072 !! test
4073 text with undefined character entity: xacute
4074 !! input
4075 I always thought &xacute; was a cute letter.
4076 !! result
4077 <p>I always thought &amp;xacute; was a cute letter.
4078 </p>
4079 !! end
4083 ### Media links
4086 !! test
4087 Media link
4088 !! input
4089 [[Media:Foobar.jpg]]
4090 !! result
4091 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Media:Foobar.jpg</a>
4092 </p>
4093 !! end
4095 !! test
4096 Media link with text
4097 !! input
4098 [[Media:Foobar.jpg|A neat file to look at]]
4099 !! result
4100 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">A neat file to look at</a>
4101 </p>
4102 !! end
4104 # FIXME: this is still bad HTML tag nesting
4105 !! test
4106 Media link with nasty text
4107 fixme: doBlockLevels won't wrap this in a paragraph because it contains a div
4108 !! input
4109 [[Media:Foobar.jpg|Safe Link<div style=display:none>" onmouseover="alert(document.cookie)" onfoo="</div>]]
4110 !! result
4111 <a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Safe Link&lt;div style="display:none"&gt;" onmouseover="alert(document.cookie)" onfoo="&lt;/div&gt;</a>
4113 !! end
4115 !! test
4116 Media link to nonexistent file (bug 1702)
4117 !! input
4118 [[Media:No such.jpg]]
4119 !! result
4120 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=No_such.jpg" class="new" title="No such.jpg">Media:No such.jpg</a>
4121 </p>
4122 !! end
4124 !! test
4125 Image link to nonexistent file (bug 1850 - good)
4126 !! input
4127 [[Image:No such.jpg]]
4128 !! result
4129 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=No_such.jpg" class="new" title="File:No such.jpg">File:No such.jpg</a>
4130 </p>
4131 !! end
4133 !! test
4134 :Image link to nonexistent file (bug 1850 - bad)
4135 !! input
4136 [[:Image:No such.jpg]]
4137 !! result
4138 <p><a href="/index.php?title=File:No_such.jpg&amp;action=edit&amp;redlink=1" class="new" title="File:No such.jpg (page does not exist)">Image:No such.jpg</a>
4139 </p>
4140 !! end
4144 !! test
4145 Character reference normalization in link text (bug 1938)
4146 !! input
4147 [[Main Page|this&that]]
4148 !! result
4149 <p><a href="/wiki/Main_Page" title="Main Page">this&amp;that</a>
4150 </p>
4151 !!end
4153 !! article
4154 אַ
4155 !! text
4156 Test for unicode normalization
4158 The page's name is U+05d0 U+05b7, with non-canonical form U+FB2E
4159 !! endarticle
4161 !! test
4162 (bug 19451) Links should refer to the normalized form.
4163 !! input
4164 [[&#xFB2E;]]
4165 [[&#x5d0;&#x5b7;]]
4166 [[&#x5d0;ַ]]
4167 [[א&#x5b7;]]
4168 [[אַ]]
4169 !! result
4170 <p><a href="/wiki/%D7%90%D6%B7" title="אַ">&#xfb2e;</a>
4171 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;&#x5b7;</a>
4172 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;ַ</a>
4173 <a href="/wiki/%D7%90%D6%B7" title="אַ">א&#x5b7;</a>
4174 <a href="/wiki/%D7%90%D6%B7" title="אַ">אַ</a>
4175 </p>
4176 !! end
4178 !! test
4179 Empty attribute crash test (bug 2067)
4180 !! input
4181 <font color="">foo</font>
4182 !! result
4183 <p><font color="">foo</font>
4184 </p>
4185 !! end
4187 !! test
4188 Empty attribute crash test single-quotes (bug 2067)
4189 !! input
4190 <font color=''>foo</font>
4191 !! result
4192 <p><font color="">foo</font>
4193 </p>
4194 !! end
4196 !! test
4197 Attribute test: equals, then nothing
4198 !! input
4199 <font color=>foo</font>
4200 !! result
4201 <p><font>foo</font>
4202 </p>
4203 !! end
4205 !! test
4206 Attribute test: unquoted value
4207 !! input
4208 <font color=x>foo</font>
4209 !! result
4210 <p><font color="x">foo</font>
4211 </p>
4212 !! end
4214 !! test
4215 Attribute test: unquoted but illegal value (hash)
4216 !! input
4217 <font color=#x>foo</font>
4218 !! result
4219 <p><font color="#x">foo</font>
4220 </p>
4221 !! end
4223 !! test
4224 Attribute test: no value
4225 !! input
4226 <font color>foo</font>
4227 !! result
4228 <p><font color="color">foo</font>
4229 </p>
4230 !! end
4232 !! test
4233 Bug 2095: link with three closing brackets
4234 !! input
4235 [[Main Page]]]
4236 !! result
4237 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>]
4238 </p>
4239 !! end
4241 !! test
4242 Bug 2095: link with pipe and three closing brackets
4243 !! input
4244 [[Main Page|link]]]
4245 !! result
4246 <p><a href="/wiki/Main_Page" title="Main Page">link</a>]
4247 </p>
4248 !! end
4250 !! test
4251 Bug 2095: link with pipe and three closing brackets, version 2
4252 !! input
4253 [[Main Page|[http://example.com/]]]
4254 !! result
4255 <p><a href="/wiki/Main_Page" title="Main Page">[http://example.com/]</a>
4256 </p>
4257 !! end
4261 ### Safety
4264 !! article
4265 Template:Dangerous attribute
4266 !! text
4267 " onmouseover="alert(document.cookie)
4268 !! endarticle
4270 !! article
4271 Template:Dangerous style attribute
4272 !! text
4273 border-size: expression(alert(document.cookie))
4274 !! endarticle
4276 !! article
4277 Template:Div style
4278 !! text
4279 <div style="float: right; {{{1}}}">Magic div</div>
4280 !! endarticle
4282 !! test
4283 Bug 2304: HTML attribute safety (safe template; regression bug 2309)
4284 !! input
4285 <div title="{{test}}"></div>
4286 !! result
4287 <div title="This is a test template"></div>
4289 !! end
4291 !! test
4292 Bug 2304: HTML attribute safety (dangerous template; 2309)
4293 !! input
4294 <div title="{{dangerous attribute}}"></div>
4295 !! result
4296 <div title=""></div>
4298 !! end
4300 !! test
4301 Bug 2304: HTML attribute safety (dangerous style template; 2309)
4302 !! input
4303 <div style="{{dangerous style attribute}}"></div>
4304 !! result
4305 <div style="/* insecure input */"></div>
4307 !! end
4309 !! test
4310 Bug 2304: HTML attribute safety (safe parameter; 2309)
4311 !! input
4312 {{div style|width: 200px}}
4313 !! result
4314 <div style="float: right; width: 200px">Magic div</div>
4316 !! end
4318 !! test
4319 Bug 2304: HTML attribute safety (unsafe parameter; 2309)
4320 !! input
4321 {{div style|width: expression(alert(document.cookie))}}
4322 !! result
4323 <div style="/* insecure input */">Magic div</div>
4325 !! end
4327 !! test
4328 Bug 2304: HTML attribute safety (unsafe breakout parameter; 2309)
4329 !! input
4330 {{div style|"><script>alert(document.cookie)</script>}}
4331 !! result
4332 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
4334 !! end
4336 !! test
4337 Bug 2304: HTML attribute safety (unsafe breakout parameter 2; 2309)
4338 !! input
4339 {{div style|" ><script>alert(document.cookie)</script>}}
4340 !! result
4341 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
4343 !! end
4345 !! test
4346 Bug 2304: HTML attribute safety (link)
4347 !! input
4348 <div title="[[Main Page]]"></div>
4349 !! result
4350 <div title="&#91;&#91;Main Page]]"></div>
4352 !! end
4354 !! test
4355 Bug 2304: HTML attribute safety (italics)
4356 !! input
4357 <div title="''foobar''"></div>
4358 !! result
4359 <div title="&#39;&#39;foobar&#39;&#39;"></div>
4361 !! end
4363 !! test
4364 Bug 2304: HTML attribute safety (bold)
4365 !! input
4366 <div title="'''foobar'''"></div>
4367 !! result
4368 <div title="&#39;&#39;&#39;foobar&#39;&#39;&#39;"></div>
4370 !! end
4373 !! test
4374 Bug 2304: HTML attribute safety (ISBN)
4375 !! input
4376 <div title="ISBN 1234567890"></div>
4377 !! result
4378 <div title="&#73;SBN 1234567890"></div>
4380 !! end
4382 !! test
4383 Bug 2304: HTML attribute safety (RFC)
4384 !! input
4385 <div title="RFC 1234"></div>
4386 !! result
4387 <div title="&#82;FC 1234"></div>
4389 !! end
4391 !! test
4392 Bug 2304: HTML attribute safety (PMID)
4393 !! input
4394 <div title="PMID 1234567890"></div>
4395 !! result
4396 <div title="&#80;MID 1234567890"></div>
4398 !! end
4400 !! test
4401 Bug 2304: HTML attribute safety (web link)
4402 !! input
4403 <div title="http://example.com/"></div>
4404 !! result
4405 <div title="http&#58;//example.com/"></div>
4407 !! end
4409 !! test
4410 Bug 2304: HTML attribute safety (named web link)
4411 !! input
4412 <div title="[http://example.com/ link]"></div>
4413 !! result
4414 <div title="&#91;http&#58;//example.com/ link]"></div>
4416 !! end
4418 !! test
4419 Bug 3244: HTML attribute safety (extension; safe)
4420 !! input
4421 <div style="<nowiki>background:blue</nowiki>"></div>
4422 !! result
4423 <div style="background:blue"></div>
4425 !! end
4427 !! test
4428 Bug 3244: HTML attribute safety (extension; unsafe)
4429 !! input
4430 <div style="<nowiki>border-left:expression(alert(document.cookie))</nowiki>"></div>
4431 !! result
4432 <div style="/* insecure input */"></div>
4434 !! end
4436 !! test
4437 Math section safety when disabled
4438 !! input
4439 <math><script>alert(document.cookies);</script></math>
4440 !! result
4441 <p>&lt;math&gt;&lt;script&gt;alert(document.cookies);&lt;/script&gt;&lt;/math&gt;
4442 </p>
4443 !! end
4445 # More MSIE fun discovered by Tom Gilder
4447 !! test
4448 MSIE CSS safety test: spurious slash
4449 !! input
4450 <div style="background-image:u\rl(javascript:alert('boo'))">evil</div>
4451 !! result
4452 <div style="/* insecure input */">evil</div>
4454 !! end
4456 !! test
4457 MSIE CSS safety test: hex code
4458 !! input
4459 <div style="background-image:u\72l(javascript:alert('boo'))">evil</div>
4460 !! result
4461 <div style="/* insecure input */">evil</div>
4463 !! end
4465 !! test
4466 MSIE CSS safety test: comment in url
4467 !! input
4468 <div style="background-image:u/**/rl(javascript:alert('boo'))">evil</div>
4469 !! result
4470 <div style="background-image:u rl(javascript:alert(&#39;boo&#39;))">evil</div>
4472 !! end
4474 !! test
4475 MSIE CSS safety test: comment in expression
4476 !! input
4477 <div style="background-image:expres/**/sion(alert('boo4'))">evil4</div>
4478 !! result
4479 <div style="background-image:expres sion(alert(&#39;boo4&#39;))">evil4</div>
4481 !! end
4484 !! test
4485 Table attribute legitimate extension
4486 !! input
4488 !+ style="<nowiki>color:blue</nowiki>"| status
4490 !! result
4491 <table>
4492 <tr>
4493 <th style="color:blue"> status
4494 </th></tr></table>
4496 !!end
4498 !! test
4499 Table attribute safety
4500 !! input
4502 !+ style="<nowiki>border-width:expression(0+alert(document.cookie))</nowiki>"| status
4504 !! result
4505 <table>
4506 <tr>
4507 <th style="/* insecure input */"> status
4508 </th></tr></table>
4510 !! end
4512 !! test
4513 CSS line continuation 1
4514 !! input
4515 <div style="background-image: u\&#10;rl(test.jpg);"></div>
4516 !! result
4517 <div style="/* insecure input */"></div>
4519 !! end
4521 !! test
4522 CSS line continuation 2
4523 !! input
4524 <div style="background-image: u\&#13;rl(test.jpg); "></div>
4525 !! result
4526 <div style="/* insecure input */"></div>
4528 !! end
4530 !! article
4531 Template:Identity
4532 !! text
4533 {{{1}}}
4534 !! endarticle
4536 !! test
4537 Expansion of multi-line templates in attribute values (bug 6255)
4538 !! input
4539 <div style="background: {{identity|#00FF00}}">-</div>
4540 !! result
4541 <div style="background: #00FF00">-</div>
4543 !! end
4546 !! test
4547 Expansion of multi-line templates in attribute values (bug 6255 sanity check)
4548 !! input
4549 <div style="background: 
4550 #00FF00">-</div>
4551 !! result
4552 <div style="background: #00FF00">-</div>
4554 !! end
4556 !! test
4557 Expansion of multi-line templates in attribute values (bug 6255 sanity check 2)
4558 !! input
4559 <div style="background: &#10;#00FF00">-</div>
4560 !! result
4561 <div style="background: &#10;#00FF00">-</div>
4563 !! end
4566 ### Parser hooks (see maintenance/parserTestsParserHook.php for the <tag> extension)
4568 !! test
4569 Parser hook: empty input
4570 !! input
4571 <tag></tag>
4572 !! result
4573 <pre>
4574 string(0) ""
4575 array(0) {
4577 </pre>
4579 !! end
4581 !! test
4582 Parser hook: empty input using terminated empty elements
4583 !! input
4584 <tag/>
4585 !! result
4586 <pre>
4587 NULL
4588 array(0) {
4590 </pre>
4592 !! end
4594 !! test
4595 Parser hook: empty input using terminated empty elements (space before)
4596 !! input
4597 <tag />
4598 !! result
4599 <pre>
4600 NULL
4601 array(0) {
4603 </pre>
4605 !! end
4607 !! test
4608 Parser hook: basic input
4609 !! input
4610 <tag>input</tag>
4611 !! result
4612 <pre>
4613 string(5) "input"
4614 array(0) {
4616 </pre>
4618 !! end
4621 !! test
4622 Parser hook: case insensitive
4623 !! input
4624 <TAG>input</TAG>
4625 !! result
4626 <pre>
4627 string(5) "input"
4628 array(0) {
4630 </pre>
4632 !! end
4635 !! test
4636 Parser hook: case insensitive, redux
4637 !! input
4638 <TaG>input</TAg>
4639 !! result
4640 <pre>
4641 string(5) "input"
4642 array(0) {
4644 </pre>
4646 !! end
4648 !! test
4649 Parser hook: nested tags
4650 !! options
4651 noxml
4652 !! input
4653 <tag><tag></tag></tag>
4654 !! result
4655 <pre>
4656 string(5) "<tag>"
4657 array(0) {
4659 </pre>&lt;/tag&gt;
4661 !! end
4663 !! test
4664 Parser hook: basic arguments
4665 !! input
4666 <tag width=200 height = "100" depth = '50' square></tag>
4667 !! result
4668 <pre>
4669 string(0) ""
4670 array(4) {
4671   ["width"]=>
4672   string(3) "200"
4673   ["height"]=>
4674   string(3) "100"
4675   ["depth"]=>
4676   string(2) "50"
4677   ["square"]=>
4678   string(6) "square"
4680 </pre>
4682 !! end
4684 !! test
4685 Parser hook: argument containing a forward slash (bug 5344)
4686 !! input
4687 <tag filename='/tmp/bla'></tag>
4688 !! result
4689 <pre>
4690 string(0) ""
4691 array(1) {
4692   ["filename"]=>
4693   string(8) "/tmp/bla"
4695 </pre>
4697 !! end
4699 !! test
4700 Parser hook: empty input using terminated empty elements (bug 2374)
4701 !! input
4702 <tag foo=bar/>text
4703 !! result
4704 <pre>
4705 NULL
4706 array(1) {
4707   ["foo"]=>
4708   string(3) "bar"
4710 </pre>text
4712 !! end
4714 # </tag> should be output literally since there is no matching tag that begins it
4715 !! test
4716 Parser hook: basic arguments using terminated empty elements (bug 2374)
4717 !! input
4718 <tag width=200 height = "100" depth = '50' square/>
4719 other stuff
4720 </tag>
4721 !! result
4722 <pre>
4723 NULL
4724 array(4) {
4725   ["width"]=>
4726   string(3) "200"
4727   ["height"]=>
4728   string(3) "100"
4729   ["depth"]=>
4730   string(2) "50"
4731   ["square"]=>
4732   string(6) "square"
4734 </pre>
4735 <p>other stuff
4736 &lt;/tag&gt;
4737 </p>
4738 !! end
4741 ### (see maintenance/parserTestsStaticParserHook.php for the <statictag> extension)
4744 !! test
4745 Parser hook: static parser hook not inside a comment
4746 !! input
4747 <statictag>hello, world</statictag>
4748 <statictag action=flush/>
4749 !! result
4750 <p>hello, world
4751 </p>
4752 !! end
4755 !! test
4756 Parser hook: static parser hook inside a comment
4757 !! input
4758 <!-- <statictag>hello, world</statictag> -->
4759 <statictag action=flush/>
4760 !! result
4761 <p><br />
4762 </p>
4763 !! end
4765 # Nested template calls; this case was broken by Parser.php rev 1.506,
4766 # since reverted.
4768 !! article
4769 Template:One-parameter
4770 !! text
4771 (My parameter is: {{{1}}})
4772 !! endarticle
4774 !! article
4775 Template:Map-one-parameter
4776 !! text
4777 {{{{{1}}}|{{{2}}}}}
4778 !! endarticle
4780 !! test
4781 Nested template calls
4782 !! input
4783 {{Map-one-parameter|One-parameter|param}}
4784 !! result
4785 <p>(My parameter is: param)
4786 </p>
4787 !! end
4791 ### Sanitizer
4793 !! test
4794 Sanitizer: Closing of open tags
4795 !! input
4796 <s></s><table></table>
4797 !! result
4798 <s></s><table></table>
4800 !! end
4802 !! test
4803 Sanitizer: Closing of open but not closed tags
4804 !! input
4805 <s>foo
4806 !! result
4807 <p><s>foo</s>
4808 </p>
4809 !! end
4811 !! test
4812 Sanitizer: Closing of closed but not open tags
4813 !! input
4814 </s>
4815 !! result
4816 <p>&lt;/s&gt;
4817 </p>
4818 !! end
4820 !! test
4821 Sanitizer: Closing of closed but not open table tags
4822 !! input
4823 Table not started</td></tr></table>
4824 !! result
4825 <p>Table not started&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
4826 </p>
4827 !! end
4829 !! test
4830 Sanitizer: Escaping of spaces, multibyte characters, colons & other stuff in id=""
4831 !! input
4832 <span id="æ: v">byte</span>[[#æ: v|backlink]]
4833 !! result
4834 <p><span id=".C3.A6:_v">byte</span><a href="#.C3.A6:_v">backlink</a>
4835 </p>
4836 !! end
4838 !! test
4839 Sanitizer: Validating the contents of the id attribute (bug 4515)
4840 !! options
4841 disabled
4842 !! input
4843 <br id=9 />
4844 !! result
4845 Something, but definitely not <br id="9" />...
4846 !! end
4848 !! test
4849 Sanitizer: Validating id attribute uniqueness (bug 4515, bug 6301)
4850 !! options
4851 disabled
4852 !! input
4853 <br id="foo" /><br id="foo" />
4854 !! result
4855 Something need to be done. foo-2 ? 
4856 !! end
4858 !! test
4859 Language converter: output gets cut off unexpectedly (bug 5757)
4860 !! options
4861 language=zh
4862 !! input
4863 this bit is safe: }-
4865 but if we add a conversion instance: -{zh-cn:xxx;zh-tw:yyy}-
4867 then we get cut off here: }-
4869 all additional text is vanished
4870 !! result
4871 <p>this bit is safe: }-
4872 </p><p>but if we add a conversion instance: xxx
4873 </p><p>then we get cut off here: }-
4874 </p><p>all additional text is vanished
4875 </p>
4876 !! end
4878 !! test
4879 Self closed html pairs (bug 5487)
4880 !! options
4881 !! input
4882 <center><font id="bug" />Centered text</center>
4883 <div><font id="bug2" />In div text</div>
4884 !! result
4885 <center>&lt;font id="bug" /&gt;Centered text</center>
4886 <div>&lt;font id="bug2" /&gt;In div text</div>
4888 !! end
4894 !! test
4895 Punctuation: nbsp before exclamation
4896 !! input
4897 C'est grave !
4898 !! result
4899 <p>C'est grave&#160;!
4900 </p>
4901 !! end
4903 !! test
4904 Punctuation: CSS !important (bug 11874)
4905 !! input
4906 <div style="width:50% !important">important</div>
4907 !! result
4908 <div style="width:50% !important">important</div>
4910 !!end
4912 !! test
4913 Punctuation: CSS ! important (bug 11874; with space after)
4914 !! input
4915 <div style="width:50% ! important">important</div>
4916 !! result
4917 <div style="width:50% ! important">important</div>
4919 !!end
4922 !! test
4923 HTML bullet list, closed tags (bug 5497)
4924 !! input
4925 <ul>
4926 <li>One</li>
4927 <li>Two</li>
4928 </ul>
4929 !! result
4930 <ul>
4931 <li>One</li>
4932 <li>Two</li>
4933 </ul>
4935 !! end
4937 !! test
4938 HTML bullet list, unclosed tags (bug 5497)
4939 !! options
4940 disabled
4941 !! input
4942 <ul>
4943 <li>One
4944 <li>Two
4945 </ul>
4946 !! result
4947 <ul>
4948 <li>One
4949 </li><li>Two
4950 </li></ul>
4952 !! end
4954 !! test
4955 HTML ordered list, closed tags (bug 5497)
4956 !! input
4957 <ol>
4958 <li>One</li>
4959 <li>Two</li>
4960 </ol>
4961 !! result
4962 <ol>
4963 <li>One</li>
4964 <li>Two</li>
4965 </ol>
4967 !! end
4969 !! test
4970 HTML ordered list, unclosed tags (bug 5497)
4971 !! options
4972 disabled
4973 !! input
4974 <ol>
4975 <li>One
4976 <li>Two
4977 </ol>
4978 !! result
4979 <ol>
4980 <li>One
4981 </li><li>Two
4982 </li></ol>
4984 !! end
4986 !! test
4987 HTML nested bullet list, closed tags (bug 5497)
4988 !! input
4989 <ul>
4990 <li>One</li>
4991 <li>Two:
4992 <ul>
4993 <li>Sub-one</li>
4994 <li>Sub-two</li>
4995 </ul>
4996 </li>
4997 </ul>
4998 !! result
4999 <ul>
5000 <li>One</li>
5001 <li>Two:
5002 <ul>
5003 <li>Sub-one</li>
5004 <li>Sub-two</li>
5005 </ul>
5006 </li>
5007 </ul>
5009 !! end
5011 !! test
5012 HTML nested bullet list, open tags (bug 5497)
5013 !! options
5014 disabled
5015 !! input
5016 <ul>
5017 <li>One
5018 <li>Two:
5019 <ul>
5020 <li>Sub-one
5021 <li>Sub-two
5022 </ul>
5023 </ul>
5024 !! result
5025 <ul>
5026 <li>One
5027 </li><li>Two:
5028 <ul>
5029 <li>Sub-one
5030 </li><li>Sub-two
5031 </li></ul>
5032 </li></ul>
5034 !! end
5036 !! test
5037 HTML nested ordered list, closed tags (bug 5497)
5038 !! input
5039 <ol>
5040 <li>One</li>
5041 <li>Two:
5042 <ol>
5043 <li>Sub-one</li>
5044 <li>Sub-two</li>
5045 </ol>
5046 </li>
5047 </ol>
5048 !! result
5049 <ol>
5050 <li>One</li>
5051 <li>Two:
5052 <ol>
5053 <li>Sub-one</li>
5054 <li>Sub-two</li>
5055 </ol>
5056 </li>
5057 </ol>
5059 !! end
5061 !! test
5062 HTML nested ordered list, open tags (bug 5497)
5063 !! options
5064 disabled
5065 !! input
5066 <ol>
5067 <li>One
5068 <li>Two:
5069 <ol>
5070 <li>Sub-one
5071 <li>Sub-two
5072 </ol>
5073 </ol>
5074 !! result
5075 <ol>
5076 <li>One
5077 </li><li>Two:
5078 <ol>
5079 <li>Sub-one
5080 </li><li>Sub-two
5081 </li></ol>
5082 </li></ol>
5084 !! end
5086 !! test
5087 HTML ordered list item with parameters oddity
5088 !! input
5089 <ol><li id="fragment">One</li></ol>
5090 !! result
5091 <ol><li id="fragment">One</li></ol>
5093 !! end
5095 !!test
5096 bug 5918: autonumbering
5097 !! input
5098 [http://first/] [http://second] [ftp://ftp]
5100 ftp://inlineftp
5102 [mailto:enclosed@mail.tld With target]
5104 [mailto:enclosed@mail.tld]
5106 mailto:inline@mail.tld
5107 !! result
5108 <p><a href="http://first/" class="external autonumber" rel="nofollow">[1]</a> <a href="http://second" class="external autonumber" rel="nofollow">[2]</a> <a href="ftp://ftp" class="external autonumber" rel="nofollow">[3]</a>
5109 </p><p><a href="ftp://inlineftp" class="external free" rel="nofollow">ftp://inlineftp</a>
5110 </p><p><a href="mailto:enclosed@mail.tld" class="external text" rel="nofollow">With target</a>
5111 </p><p><a href="mailto:enclosed@mail.tld" class="external autonumber" rel="nofollow">[4]</a>
5112 </p><p><a href="mailto:inline@mail.tld" class="external free" rel="nofollow">mailto:inline@mail.tld</a>
5113 </p>
5114 !! end
5118 # Security and HTML correctness
5119 # From Nick Jenkins' fuzz testing
5122 !! test
5123 Fuzz testing: Parser13
5124 !! input
5125 {| 
5126 | http://a|
5127 !! result
5128 <table>
5129 <tr>
5130 <td>
5131 </td>
5132 </tr>
5133 </table>
5135 !! end
5137 !! test
5138 Fuzz testing: Parser14
5139 !! input
5140 == onmouseover= ==
5141 http://__TOC__
5142 !! result
5143 <h2><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: onmouseover=">edit</a>]</span> <span class="mw-headline" id="onmouseover.3D"> onmouseover= </span></h2>
5144 http://<table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
5145 <ul>
5146 <li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
5147 </ul>
5148 </td></tr></table><script>if (window.showTocToggle) { var tocShowText = "show"; var tocHideText = "hide"; showTocToggle(); } </script>
5150 !! end
5152 !! test
5153 Fuzz testing: Parser14-table
5154 !! input
5155 ==a==
5156 {| STYLE=__TOC__
5157 !! result
5158 <h2><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: a">edit</a>]</span> <span class="mw-headline" id="a">a</span></h2>
5159 <table style="&#95;_TOC&#95;_">
5160 <tr><td></td></tr>
5161 </table>
5163 !! end
5165 # Known to produce bogus xml (extra </td>)
5166 !! test
5167 Fuzz testing: Parser16
5168 !! options
5169 noxml
5170 !! input
5172 !https://||||||
5173 !! result
5174 <table>
5175 <tr>
5176 <th>https://</th><th></th><th></th><th>
5177 </td>
5178 </tr>
5179 </table>
5181 !! end
5183 !! test
5184 Fuzz testing: Parser21
5185 !! input
5187 ! irc://{{ftp://a" onmouseover="alert('hello world');"
5189 !! result
5190 <table>
5191 <tr>
5192 <th> <a href="irc://{{ftp://a" class="external free" rel="nofollow">irc://{{ftp://a</a>" onmouseover="alert('hello world');"
5193 </th><td>
5194 </td>
5195 </tr>
5196 </table>
5198 !! end
5200 !! test
5201 Fuzz testing: Parser22
5202 !! input
5203 http://===r:::https://b
5206 !!result
5207 <p><a href="http://===r:::https://b" class="external free" rel="nofollow">http://===r:::https://b</a>
5208 </p>
5209 <table>
5210 <tr><td></td></tr>
5211 </table>
5213 !! end
5215 # Known to produce bad XML for now
5216 !! test
5217 Fuzz testing: Parser24
5218 !! options
5219 noxml
5220 !! input
5222 {{{|
5223 <u CLASS=
5224 | {{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx--><noinclude>}}}} >
5225 <br style="onmouseover='alert(document.cookie);' " />
5227 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
5229 !! result
5230 <table>
5231 {{{|
5232 <u class="&#124;">}}}} &gt;
5233 <br style="onmouseover=&#39;alert(document.cookie);&#39;" />
5235 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
5236 <tr>
5237 <td></u>
5238 </td>
5239 </tr>
5240 </table>
5242 !! end
5244 # Note: the current result listed for this is not what the original one was,
5245 # but the original bug was JavaScript injection, which is fixed in any case.
5246 # It's not clear that the original result listed was any more correct than the
5247 # current one.  Original result:
5248 # <p>{{{| 
5249 # </p>
5250 # <li class="&#124;&#124;">
5251 # }}}blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
5252 !!test
5253 Fuzz testing: Parser25 (bug 6055)
5254 !! input
5257 <LI CLASS=||
5259 }}}blah" onmouseover="alert('hello world');" align="left"'''MOVE MOUSE CURSOR OVER HERE
5260 !! result
5261 <p>&lt;LI CLASS=blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
5262 </p>
5263 !! end
5265 !!test
5266 Fuzz testing: URL adjacent extension (with space, clean)
5267 !! options
5268 !! input
5269 http://example.com <nowiki>junk</nowiki>
5270 !! result
5271 <p><a href="http://example.com" class="external free" rel="nofollow">http://example.com</a> junk
5272 </p>
5273 !!end
5275 !!test
5276 Fuzz testing: URL adjacent extension (no space, dirty; nowiki)
5277 !! options
5278 !! input
5279 http://example.com<nowiki>junk</nowiki>
5280 !! result
5281 <p><a href="http://example.com" class="external free" rel="nofollow">http://example.com</a>junk
5282 </p>
5283 !!end
5285 !!test
5286 Fuzz testing: URL adjacent extension (no space, dirty; pre)
5287 !! options
5288 !! input
5289 http://example.com<pre>junk</pre>
5290 !! result
5291 <a href="http://example.com" class="external free" rel="nofollow">http://example.com</a><pre>junk</pre>
5293 !!end
5295 !!test
5296 Fuzz testing: image with bogus manual thumbnail
5297 !!input
5298 [[Image:foobar.jpg|thumbnail= ]]
5299 !!result
5300 <div class="thumb tright"><div class="thumbinner" style="width:1943px;">Error creating thumbnail:   <div class="thumbcaption"></div></div></div>
5302 !!end
5304 !! test
5305 Fuzz testing: encoded newline in generated HTML replacements (bug 6577)
5306 !! input
5307 <pre dir="&#10;"></pre>
5308 !! result
5309 <pre dir="&#10;"></pre>
5311 !! end
5313 !! test
5314 Parsing optional HTML elements (Bug 6171)
5315 !! options
5316 !! input
5317 <table>
5318   <tr>
5319     <td> Some tabular data</td>
5320     <td> More tabular data ...
5321     <td> And yet som tabular data</td>
5322   </tr>
5323 </table>
5324 !! result
5325 <table>
5326   <tr>
5327     <td> Some tabular data</td>
5328     <td> More tabular data ...
5329     </td><td> And yet som tabular data</td>
5330   </tr>
5331 </table>
5333 !! end
5335 !! test
5336 Correct handling of <td>, <tr> (Bug 6171)
5337 !! options
5338 !! input
5339 <table>
5340   <tr>
5341     <td> Some tabular data</td>
5342     <td> More tabular data ...</td>
5343     <td> And yet som tabular data</td>
5344   </tr>
5345 </table>
5346 !! result
5347 <table>
5348   <tr>
5349     <td> Some tabular data</td>
5350     <td> More tabular data ...</td>
5351     <td> And yet som tabular data</td>
5352   </tr>
5353 </table>
5355 !! end
5358 !! test
5359 Parsing crashing regression (fr:JavaScript)
5360 !! input
5361 </body></x>
5362 !! result
5363 <p>&lt;/body&gt;&lt;/x&gt;
5364 </p>
5365 !! end
5367 !! test
5368 Inline wiki vs wiki block nesting
5369 !! input
5370 '''Bold paragraph
5372 New wiki paragraph
5373 !! result
5374 <p><b>Bold paragraph</b>
5375 </p><p>New wiki paragraph
5376 </p>
5377 !! end
5379 !! test
5380 Inline HTML vs wiki block nesting
5381 !! options
5382 disabled
5383 !! input
5384 <b>Bold paragraph
5386 New wiki paragraph
5387 !! result
5388 <p><b>Bold paragraph</b>
5389 </p><p>New wiki paragraph
5390 </p>
5391 !! end
5393 # Original result was this:
5394 # <p><b>bold</b><b>bold<i>bolditalics</i></b>
5395 # </p>
5396 # While that might be marginally more intuitive, maybe, the six-apostrophe
5397 # construct is clearly pathological and the result stated here (which is what
5398 # the parser actually does) is about as reasonable as anything.
5399 !!test
5400 Mixing markup for italics and bold
5401 !! options
5402 !! input
5403 '''bold''''''bold''bolditalics'''''
5404 !! result
5405 <p>'<i>bold'</i><b>bold<i>bolditalics</i></b>
5406 </p>
5407 !! end
5410 !! article
5411 Xyzzyx
5412 !! text
5413 Article for special page transclusion test
5414 !! endarticle
5416 !! test
5417 Special page transclusion
5418 !! options
5419 !! input
5420 {{Special:Prefixindex/Xyzzyx}}
5421 !! result
5422 <p><br />
5423 </p>
5424 <table border="0" id="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
5426 !! end
5428 !! test
5429 Special page transclusion twice (bug 5021)
5430 !! options
5431 !! input
5432 {{Special:Prefixindex/Xyzzyx}}
5433 {{Special:Prefixindex/Xyzzyx}}
5434 !! result
5435 <p><br />
5436 </p>
5437 <table border="0" id="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
5438 <p><br />
5439 </p>
5440 <table border="0" id="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
5442 !! end
5444 !! test
5445 Transclusion of default MediaWiki message
5446 !! input
5447 {{MediaWiki:Mainpage}}
5448 !!result
5449 <p>Main Page
5450 </p>
5451 !! end
5453 !! test
5454 Transclusion of nonexistent MediaWiki message
5455 !! input
5456 {{MediaWiki:Mainpagexxx}}
5457 !!result
5458 <p><a href="/index.php?title=MediaWiki:Mainpagexxx&amp;action=edit&amp;redlink=1" class="new" title="MediaWiki:Mainpagexxx (page does not exist)">MediaWiki:Mainpagexxx</a>
5459 </p>
5460 !! end
5462 !! test
5463 Transclusion of MediaWiki message with underscore
5464 !! input
5465 {{MediaWiki:history_short}}
5466 !! result
5467 <p>History
5468 </p>
5469 !! end
5471 !! test
5472 Transclusion of MediaWiki message with space
5473 !! input
5474 {{MediaWiki:history short}}
5475 !! result
5476 <p>History
5477 </p>
5478 !! end
5480 !! test
5481 Invalid header with following text
5482 !! input
5483 = x = y
5484 !! result
5485 <p>= x = y
5486 </p>
5487 !! end
5490 !! test
5491 Section extraction test (section 0)
5492 !! options
5493 section=0
5494 !! input
5495 start
5496 ==a==
5497 ===aa===
5498 ====aaa====
5499 ==b==
5500 ===ba===
5501 ===bb===
5502 ====bba====
5503 ===bc===
5504 ==c==
5505 ===ca===
5506 !! result
5507 start
5508 !! end
5510 !! test
5511 Section extraction test (section 1)
5512 !! options
5513 section=1
5514 !! input
5515 start
5516 ==a==
5517 ===aa===
5518 ====aaa====
5519 ==b==
5520 ===ba===
5521 ===bb===
5522 ====bba====
5523 ===bc===
5524 ==c==
5525 ===ca===
5526 !! result
5527 ==a==
5528 ===aa===
5529 ====aaa====
5530 !! end
5532 !! test
5533 Section extraction test (section 2)
5534 !! options
5535 section=2
5536 !! input
5537 start
5538 ==a==
5539 ===aa===
5540 ====aaa====
5541 ==b==
5542 ===ba===
5543 ===bb===
5544 ====bba====
5545 ===bc===
5546 ==c==
5547 ===ca===
5548 !! result
5549 ===aa===
5550 ====aaa====
5551 !! end
5553 !! test
5554 Section extraction test (section 3)
5555 !! options
5556 section=3
5557 !! input
5558 start
5559 ==a==
5560 ===aa===
5561 ====aaa====
5562 ==b==
5563 ===ba===
5564 ===bb===
5565 ====bba====
5566 ===bc===
5567 ==c==
5568 ===ca===
5569 !! result
5570 ====aaa====
5571 !! end
5573 !! test
5574 Section extraction test (section 4)
5575 !! options
5576 section=4
5577 !! input
5578 start
5579 ==a==
5580 ===aa===
5581 ====aaa====
5582 ==b==
5583 ===ba===
5584 ===bb===
5585 ====bba====
5586 ===bc===
5587 ==c==
5588 ===ca===
5589 !! result
5590 ==b==
5591 ===ba===
5592 ===bb===
5593 ====bba====
5594 ===bc===
5595 !! end
5597 !! test
5598 Section extraction test (section 5)
5599 !! options
5600 section=5
5601 !! input
5602 start
5603 ==a==
5604 ===aa===
5605 ====aaa====
5606 ==b==
5607 ===ba===
5608 ===bb===
5609 ====bba====
5610 ===bc===
5611 ==c==
5612 ===ca===
5613 !! result
5614 ===ba===
5615 !! end
5617 !! test
5618 Section extraction test (section 6)
5619 !! options
5620 section=6
5621 !! input
5622 start
5623 ==a==
5624 ===aa===
5625 ====aaa====
5626 ==b==
5627 ===ba===
5628 ===bb===
5629 ====bba====
5630 ===bc===
5631 ==c==
5632 ===ca===
5633 !! result
5634 ===bb===
5635 ====bba====
5636 !! end
5638 !! test
5639 Section extraction test (section 7)
5640 !! options
5641 section=7
5642 !! input
5643 start
5644 ==a==
5645 ===aa===
5646 ====aaa====
5647 ==b==
5648 ===ba===
5649 ===bb===
5650 ====bba====
5651 ===bc===
5652 ==c==
5653 ===ca===
5654 !! result
5655 ====bba====
5656 !! end
5658 !! test
5659 Section extraction test (section 8)
5660 !! options
5661 section=8
5662 !! input
5663 start
5664 ==a==
5665 ===aa===
5666 ====aaa====
5667 ==b==
5668 ===ba===
5669 ===bb===
5670 ====bba====
5671 ===bc===
5672 ==c==
5673 ===ca===
5674 !! result
5675 ===bc===
5676 !! end
5678 !! test
5679 Section extraction test (section 9)
5680 !! options
5681 section=9
5682 !! input
5683 start
5684 ==a==
5685 ===aa===
5686 ====aaa====
5687 ==b==
5688 ===ba===
5689 ===bb===
5690 ====bba====
5691 ===bc===
5692 ==c==
5693 ===ca===
5694 !! result
5695 ==c==
5696 ===ca===
5697 !! end
5699 !! test
5700 Section extraction test (section 10)
5701 !! options
5702 section=10
5703 !! input
5704 start
5705 ==a==
5706 ===aa===
5707 ====aaa====
5708 ==b==
5709 ===ba===
5710 ===bb===
5711 ====bba====
5712 ===bc===
5713 ==c==
5714 ===ca===
5715 !! result
5716 ===ca===
5717 !! end
5719 !! test
5720 Section extraction test (nonexistent section 11)
5721 !! options
5722 section=11
5723 !! input
5724 start
5725 ==a==
5726 ===aa===
5727 ====aaa====
5728 ==b==
5729 ===ba===
5730 ===bb===
5731 ====bba====
5732 ===bc===
5733 ==c==
5734 ===ca===
5735 !! result
5736 !! end
5738 !! test
5739 Section extraction test with bogus heading (section 1)
5740 !! options
5741 section=1
5742 !! input
5743 ==a==
5744 ==bogus== not a legal section
5745 ==b==
5746 !! result
5747 ==a==
5748 ==bogus== not a legal section
5749 !! end
5751 !! test
5752 Section extraction test with bogus heading (section 2)
5753 !! options
5754 section=2
5755 !! input
5756 ==a==
5757 ==bogus== not a legal section
5758 ==b==
5759 !! result
5760 ==b==
5761 !! end
5763 !! test
5764 Section extraction test with comment after heading (section 1)
5765 !! options
5766 section=1
5767 !! input
5768 ==a==
5769 ==b== <!-- -->
5770 ==c==
5771 !! result
5772 ==a==
5773 !! end
5775 !! test
5776 Section extraction test with comment after heading (section 2)
5777 !! options
5778 section=2
5779 !! input
5780 ==a==
5781 ==b== <!-- -->
5782 ==c==
5783 !! result
5784 ==b== <!-- -->
5785 !! end
5787 !! test
5788 Section extraction test with bogus <nowiki> heading (section 1)
5789 !! options
5790 section=1
5791 !! input
5792 ==a==
5793 ==bogus== <nowiki>not a legal section</nowiki>
5794 ==b==
5795 !! result
5796 ==a==
5797 ==bogus== <nowiki>not a legal section</nowiki>
5798 !! end
5800 !! test
5801 Section extraction test with bogus <nowiki> heading (section 2)
5802 !! options
5803 section=2
5804 !! input
5805 ==a==
5806 ==bogus== <nowiki>not a legal section</nowiki>
5807 ==b==
5808 !! result
5809 ==b==
5810 !! end
5813 # Formerly testing for bug 2587, now resolved by the use of unmarked sections 
5814 # instead of respecting commented sections
5815 !! test
5816 Section extraction prefixed by comment (section 1)
5817 !! options
5818 section=1
5819 !! input
5820 <!-- -->==sec1==
5821 ==sec2==
5822 !!result
5823 ==sec2==
5824 !!end
5826 !! test
5827 Section extraction prefixed by comment (section 2)
5828 !! options
5829 section=2
5830 !! input
5831 <!-- -->==sec1==
5832 ==sec2==
5833 !!result
5835 !!end
5838 # Formerly testing for bug 2607, now resolved by the use of unmarked sections 
5839 # instead of respecting HTML-style headings
5840 !! test
5841 Section extraction, mixed wiki and html (section 1)
5842 !! options
5843 section=1
5844 !! input
5845 <h2>unmarked</h2>
5846 unmarked
5847 ==1==
5849 ==2==
5851 !! result
5852 ==1==
5854 !! end
5856 !! test
5857 Section extraction, mixed wiki and html (section 2)
5858 !! options
5859 section=2
5860 !! input
5861 <h2>unmarked</h2>
5862 unmarked
5863 ==1==
5865 ==2==
5867 !! result
5868 ==2==
5870 !! end
5873 # Formerly testing for bug 3342
5874 !! test
5875 Section extraction, heading surrounded by <noinclude>
5876 !! options
5877 section=1
5878 !! input
5879 <noinclude>==unmarked==</noinclude>
5880 ==marked==
5881 !! result
5882 ==marked==
5883 !!end
5885 # Test behaviour of bug 19910
5886 !! test
5887 Sectiion with all-equals
5888 !! options
5889 section=2
5890 !! input
5891 === 
5892 The line above must have a trailing space
5893 === <!--
5894 --> <!-- -->
5895 But just in case it doesn't...
5896 !! result
5897 === <!--
5898 --> <!-- -->
5899 But just in case it doesn't...
5900 !! end
5902 !! test
5903 Section replacement test (section 0)
5904 !! options
5905 replace=0,"xxx"
5906 !! input
5907 start
5908 ==a==
5909 ===aa===
5910 ====aaa====
5911 ==b==
5912 ===ba===
5913 ===bb===
5914 ====bba====
5915 ===bc===
5916 ==c==
5917 ===ca===
5918 !! result
5921 ==a==
5922 ===aa===
5923 ====aaa====
5924 ==b==
5925 ===ba===
5926 ===bb===
5927 ====bba====
5928 ===bc===
5929 ==c==
5930 ===ca===
5931 !! end
5933 !! test
5934 Section replacement test (section 1)
5935 !! options
5936 replace=1,"xxx"
5937 !! input
5938 start
5939 ==a==
5940 ===aa===
5941 ====aaa====
5942 ==b==
5943 ===ba===
5944 ===bb===
5945 ====bba====
5946 ===bc===
5947 ==c==
5948 ===ca===
5949 !! result
5950 start
5953 ==b==
5954 ===ba===
5955 ===bb===
5956 ====bba====
5957 ===bc===
5958 ==c==
5959 ===ca===
5960 !! end
5962 !! test
5963 Section replacement test (section 2)
5964 !! options
5965 replace=2,"xxx"
5966 !! input
5967 start
5968 ==a==
5969 ===aa===
5970 ====aaa====
5971 ==b==
5972 ===ba===
5973 ===bb===
5974 ====bba====
5975 ===bc===
5976 ==c==
5977 ===ca===
5978 !! result
5979 start
5980 ==a==
5983 ==b==
5984 ===ba===
5985 ===bb===
5986 ====bba====
5987 ===bc===
5988 ==c==
5989 ===ca===
5990 !! end
5992 !! test
5993 Section replacement test (section 3)
5994 !! options
5995 replace=3,"xxx"
5996 !! input
5997 start
5998 ==a==
5999 ===aa===
6000 ====aaa====
6001 ==b==
6002 ===ba===
6003 ===bb===
6004 ====bba====
6005 ===bc===
6006 ==c==
6007 ===ca===
6008 !! result
6009 start
6010 ==a==
6011 ===aa===
6014 ==b==
6015 ===ba===
6016 ===bb===
6017 ====bba====
6018 ===bc===
6019 ==c==
6020 ===ca===
6021 !! end
6023 !! test
6024 Section replacement test (section 4)
6025 !! options
6026 replace=4,"xxx"
6027 !! input
6028 start
6029 ==a==
6030 ===aa===
6031 ====aaa====
6032 ==b==
6033 ===ba===
6034 ===bb===
6035 ====bba====
6036 ===bc===
6037 ==c==
6038 ===ca===
6039 !! result
6040 start
6041 ==a==
6042 ===aa===
6043 ====aaa====
6046 ==c==
6047 ===ca===
6048 !! end
6050 !! test
6051 Section replacement test (section 5)
6052 !! options
6053 replace=5,"xxx"
6054 !! input
6055 start
6056 ==a==
6057 ===aa===
6058 ====aaa====
6059 ==b==
6060 ===ba===
6061 ===bb===
6062 ====bba====
6063 ===bc===
6064 ==c==
6065 ===ca===
6066 !! result
6067 start
6068 ==a==
6069 ===aa===
6070 ====aaa====
6071 ==b==
6074 ===bb===
6075 ====bba====
6076 ===bc===
6077 ==c==
6078 ===ca===
6079 !! end
6081 !! test
6082 Section replacement test (section 6)
6083 !! options
6084 replace=6,"xxx"
6085 !! input
6086 start
6087 ==a==
6088 ===aa===
6089 ====aaa====
6090 ==b==
6091 ===ba===
6092 ===bb===
6093 ====bba====
6094 ===bc===
6095 ==c==
6096 ===ca===
6097 !! result
6098 start
6099 ==a==
6100 ===aa===
6101 ====aaa====
6102 ==b==
6103 ===ba===
6106 ===bc===
6107 ==c==
6108 ===ca===
6109 !! end
6111 !! test
6112 Section replacement test (section 7)
6113 !! options
6114 replace=7,"xxx"
6115 !! input
6116 start
6117 ==a==
6118 ===aa===
6119 ====aaa====
6120 ==b==
6121 ===ba===
6122 ===bb===
6123 ====bba====
6124 ===bc===
6125 ==c==
6126 ===ca===
6127 !! result
6128 start
6129 ==a==
6130 ===aa===
6131 ====aaa====
6132 ==b==
6133 ===ba===
6134 ===bb===
6137 ===bc===
6138 ==c==
6139 ===ca===
6140 !! end
6142 !! test
6143 Section replacement test (section 8)
6144 !! options
6145 replace=8,"xxx"
6146 !! input
6147 start
6148 ==a==
6149 ===aa===
6150 ====aaa====
6151 ==b==
6152 ===ba===
6153 ===bb===
6154 ====bba====
6155 ===bc===
6156 ==c==
6157 ===ca===
6158 !! result
6159 start
6160 ==a==
6161 ===aa===
6162 ====aaa====
6163 ==b==
6164 ===ba===
6165 ===bb===
6166 ====bba====
6169 ==c==
6170 ===ca===
6171 !!end
6173 !! test
6174 Section replacement test (section 9)
6175 !! options
6176 replace=9,"xxx"
6177 !! input
6178 start
6179 ==a==
6180 ===aa===
6181 ====aaa====
6182 ==b==
6183 ===ba===
6184 ===bb===
6185 ====bba====
6186 ===bc===
6187 ==c==
6188 ===ca===
6189 !! result
6190 start
6191 ==a==
6192 ===aa===
6193 ====aaa====
6194 ==b==
6195 ===ba===
6196 ===bb===
6197 ====bba====
6198 ===bc===
6200 !! end
6202 !! test
6203 Section replacement test (section 10)
6204 !! options
6205 replace=10,"xxx"
6206 !! input
6207 start
6208 ==a==
6209 ===aa===
6210 ====aaa====
6211 ==b==
6212 ===ba===
6213 ===bb===
6214 ====bba====
6215 ===bc===
6216 ==c==
6217 ===ca===
6218 !! result
6219 start
6220 ==a==
6221 ===aa===
6222 ====aaa====
6223 ==b==
6224 ===ba===
6225 ===bb===
6226 ====bba====
6227 ===bc===
6228 ==c==
6230 !! end
6232 !! test
6233 Section replacement test with initial whitespace (bug 13728)
6234 !! options
6235 replace=2,"xxx"
6236 !! input
6237  Preformatted initial line
6238 ==a==
6239 ===a===
6240 !! result
6241  Preformatted initial line
6242 ==a==
6244 !! end
6247 !! test
6248 Section extraction, heading followed by pre with 20 spaces (bug 6398)
6249 !! options
6250 section=1
6251 !! input
6252 ==a==
6253                     a
6254 !! result
6255 ==a==
6256                     a
6257 !! end
6259 !! test
6260 Section extraction, heading followed by pre with 19 spaces (bug 6398 sanity check)
6261 !! options
6262 section=1
6263 !! input
6264 ==a==
6265                    a
6266 !! result
6267 ==a==
6268                    a
6269 !! end
6272 !! test
6273 Section extraction, <pre> around bogus header (bug 10309)
6274 !! options
6275 noxml section=2
6276 !! input
6277 == Section One ==
6278 <pre>
6279 =======
6280 </pre>
6282 == Section Two ==
6283 stuff
6284 !! result
6285 == Section Two ==
6286 stuff
6287 !! end
6289 !! test
6290 Section replacement, <pre> around bogus header (bug 10309)
6291 !! options
6292 noxml replace=2,"xxx"
6293 !! input
6294 == Section One ==
6295 <pre>
6296 =======
6297 </pre>
6299 == Section Two ==
6300 stuff
6301 !! result
6302 == Section One ==
6303 <pre>
6304 =======
6305 </pre>
6308 !! end
6312 !! test
6313 Handling of &#x0A; in URLs
6314 !! input
6315 **irc://&#x0A;a
6316 !! result
6317 <ul><li><ul><li><a href="irc://%0Aa" class="external free" rel="nofollow">irc://%0Aa</a>
6318 </li></ul>
6319 </li></ul>
6321 !!end
6323 !! test
6324 5 quotes, code coverage +1 line
6325 !! input
6326 '''''
6327 !! result
6328 !! end
6330 !! test
6331 Special:Search page linking.
6332 !! input
6333 {{Special:search}}
6334 !! result
6335 <p><a href="/wiki/Special:Search" title="Special:Search">Special:Search</a>
6336 </p>
6337 !! end
6339 !! test
6340 Say the magic word
6341 !! input
6342 * {{PAGENAME}}
6343 * {{BASEPAGENAME}}
6344 * {{SUBPAGENAME}}
6345 * {{SUBPAGENAMEE}}
6346 * {{BASEPAGENAME}}
6347 * {{BASEPAGENAMEE}}
6348 * {{TALKPAGENAME}}
6349 * {{TALKPAGENAMEE}}
6350 * {{SUBJECTPAGENAME}}
6351 * {{SUBJECTPAGENAMEE}}
6352 * {{NAMESPACEE}}
6353 * {{NAMESPACE}}
6354 * {{TALKSPACE}}
6355 * {{TALKSPACEE}}
6356 * {{SUBJECTSPACE}}
6357 * {{SUBJECTSPACEE}}
6358 * {{Dynamic|{{NUMBEROFUSERS}}|{{NUMBEROFPAGES}}|{{CURRENTVERSION}}|{{CONTENTLANGUAGE}}|{{DIRECTIONMARK}}|{{CURRENTTIMESTAMP}}|{{NUMBEROFARTICLES}}}}
6359 !! result
6360 <ul><li> Parser test
6361 </li><li> Parser test
6362 </li><li> Parser test
6363 </li><li> Parser_test
6364 </li><li> Parser test
6365 </li><li> Parser_test
6366 </li><li> Talk:Parser test
6367 </li><li> Talk:Parser_test
6368 </li><li> Parser test
6369 </li><li> Parser_test
6370 </li><li> 
6371 </li><li> 
6372 </li><li> Talk
6373 </li><li> Talk
6374 </li><li> 
6375 </li><li> 
6376 </li><li> <a href="/index.php?title=Template:Dynamic&amp;action=edit&amp;redlink=1" class="new" title="Template:Dynamic (page does not exist)">Template:Dynamic</a>
6377 </li></ul>
6379 !! end
6380 ### Note: Above tests excludes the "{{NUMBEROFADMINS}}" magic word because it generates a MySQL error when included.
6382 !! test
6383 Gallery
6384 !! input
6385 <gallery>
6386 image1.png |
6387 image2.gif|||||
6389 image3|
6390 image4    |300px| centre
6391  image5.svg| http://///////
6392 [[x|xx]]]]
6393 * image6
6394 </gallery>
6395 !! result
6396 <table class="gallery" cellspacing="0" cellpadding="0">
6397         <tr>
6398                 <td><div class="gallerybox" style="width: 155px;">
6399                         <div style="height: 152px;">Image1.png</div>
6400                         <div class="gallerytext">
6401                         </div>
6402                 </div></td>
6403                 <td><div class="gallerybox" style="width: 155px;">
6404                         <div style="height: 152px;">Image2.gif</div>
6405                         <div class="gallerytext">
6406 <p>||||
6407 </p>
6408                         </div>
6409                 </div></td>
6410                 <td><div class="gallerybox" style="width: 155px;">
6411                         <div style="height: 152px;">Image3</div>
6412                         <div class="gallerytext">
6413                         </div>
6414                 </div></td>
6415                 <td><div class="gallerybox" style="width: 155px;">
6416                         <div style="height: 152px;">Image4</div>
6417                         <div class="gallerytext">
6418 <p>300px| centre
6419 </p>
6420                         </div>
6421                 </div></td>
6422         </tr>
6423         <tr>
6424                 <td><div class="gallerybox" style="width: 155px;">
6425                         <div style="height: 152px;">Image5.svg</div>
6426                         <div class="gallerytext">
6427 <p><a href="http://///////" class="external free" rel="nofollow">http://///////</a>
6428 </p>
6429                         </div>
6430                 </div></td>
6431                 <td><div class="gallerybox" style="width: 155px;">
6432                         <div style="height: 152px;">* image6</div>
6433                         <div class="gallerytext">
6434                         </div>
6435                 </div></td>
6436         </tr>
6437 </table>
6439 !! end
6441 !! test
6442 Gallery (with options)
6443 !! input
6444 <gallery widths='60px' heights='40px' perrow='2' caption='Foo [[Main Page]]' >
6445 File:Nonexistant.jpg|caption
6446 File:Nonexistant.jpg
6447 image:foobar.jpg|some '''caption''' [[Main Page]]
6448 image:foobar.jpg
6449 </gallery>
6450 !! result
6451 <table class="gallery" cellspacing="0" cellpadding="0">
6452         <caption>Foo <a href="/wiki/Main_Page" title="Main Page">Main Page</a></caption>
6453         <tr>
6454                 <td><div class="gallerybox" style="width: 95px;">
6455                         <div style="height: 52px;">Nonexistant.jpg</div>
6456                         <div class="gallerytext">
6457 <p>caption
6458 </p>
6459                         </div>
6460                 </div></td>
6461                 <td><div class="gallerybox" style="width: 95px;">
6462                         <div style="height: 52px;">Nonexistant.jpg</div>
6463                         <div class="gallerytext">
6464                         </div>
6465                 </div></td>
6466         </tr>
6467         <tr>
6468                 <td><div class="gallerybox" style="width: 95px;">
6469                         <div class="thumb" style="padding: 19px 0; width: 90px;"><div style="margin-left: auto; margin-right: auto; width: 60px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/3/3a/Foobar.jpg" width="60" height="7" /></a></div></div>
6470                         <div class="gallerytext">
6471 <p>some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
6472 </p>
6473                         </div>
6474                 </div></td>
6475                 <td><div class="gallerybox" style="width: 95px;">
6476                         <div class="thumb" style="padding: 19px 0; width: 90px;"><div style="margin-left: auto; margin-right: auto; width: 60px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="60" height="7" /></a></div></div>
6477                         <div class="gallerytext">
6478                         </div>
6479                 </div></td>
6480         </tr>
6481 </table>
6483 !! end
6485 !! test
6486 gallery (with showfilename option)
6487 !! input
6488 <gallery showfilename>
6489 File:Nonexistant.jpg|caption
6490 File:Nonexistant.jpg
6491 image:foobar.jpg|some '''caption''' [[Main Page]]
6492 File:Foobar.jpg
6493 </gallery>
6494 !! result
6495 <table class="gallery" cellspacing="0" cellpadding="0">
6496         <tr>
6497                 <td><div class="gallerybox" style="width: 155px;">
6498                         <div style="height: 152px;">Nonexistant.jpg</div>
6499                         <div class="gallerytext">
6500 <p><a href="/wiki/File:Nonexistant.jpg" title="File:Nonexistant.jpg">Nonexistant.jpg</a><br />
6501 caption
6502 </p>
6503                         </div>
6504                 </div></td>
6505                 <td><div class="gallerybox" style="width: 155px;">
6506                         <div style="height: 152px;">Nonexistant.jpg</div>
6507                         <div class="gallerytext">
6508 <p><a href="/wiki/File:Nonexistant.jpg" title="File:Nonexistant.jpg">Nonexistant.jpg</a><br />
6509 </p>
6510                         </div>
6511                 </div></td>
6512                 <td><div class="gallerybox" style="width: 155px;">
6513                         <div class="thumb" style="padding: 66px 0; width: 150px;"><div style="margin-left: auto; margin-right: auto; width: 120px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/3/3a/Foobar.jpg" width="120" height="14" /></a></div></div>
6514                         <div class="gallerytext">
6515 <p><a href="/wiki/File:Foobar.jpg" title="File:Foobar.jpg">Foobar.jpg</a><br />
6516 some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
6517 </p>
6518                         </div>
6519                 </div></td>
6520                 <td><div class="gallerybox" style="width: 155px;">
6521                         <div class="thumb" style="padding: 66px 0; width: 150px;"><div style="margin-left: auto; margin-right: auto; width: 120px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="120" height="14" /></a></div></div>
6522                         <div class="gallerytext">
6523 <p><a href="/wiki/File:Foobar.jpg" title="File:Foobar.jpg">Foobar.jpg</a><br />
6524 </p>
6525                         </div>
6526                 </div></td>
6527         </tr>
6528 </table>
6530 !! end
6532 !! test
6533 HTML Hex character encoding (spells the word "JavaScript")
6534 !! input
6535 &#x4A;&#x061;&#x0076;&#x00061;&#x000053;&#x0000063;&#114;&#x0000069;&#00000112;&#x0000000074;
6536 !! result
6537 <p>&#x4a;&#x61;&#x76;&#x61;&#x53;&#x63;&#114;&#x69;&#112;&#x74;
6538 </p>
6539 !! end
6541 !! test
6542 __FORCETOC__ override
6543 !! input 
6544 __NEWSECTIONLINK__
6545 __FORCETOC__
6546 !! result
6547 <p><br />
6548 </p>
6549 !! end
6551 !! test
6552 ISBN code coverage
6553 !! input
6554 ISBN  978-0-1234-56&#x20;789
6555 !! result
6556 <p><a href="/wiki/Special:BookSources/9780123456" class="internal mw-magiclink-isbn">ISBN 978-0-1234-56</a>&#x20;789
6557 </p>
6558 !! end
6560 !! test
6561 ISBN followed by 5 spaces
6562 !! input
6563 ISBN    
6564 !! result
6565 <p>ISBN    
6566 </p>
6567 !! end
6569 !! test
6570 Double ISBN
6571 !! input
6572 ISBN ISBN 1234567890
6573 !! result
6574 <p>ISBN <a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
6575 </p>
6576 !! end
6578 !! test
6579 Bug 22905: <abbr> followed by ISBN followed by </a>
6580 !! input
6581 <abbr>(fr)</abbr> ISBN 2753300917 [http://www.example.com example.com]
6582 !! result
6583 <p><abbr>(fr)</abbr> <a href="/wiki/Special:BookSources/2753300917" class="internal mw-magiclink-isbn">ISBN 2753300917</a> <a href="http://www.example.com" class="external text" rel="nofollow">example.com</a>
6584 </p>
6585 !! end
6587 !! test
6588 Double RFC
6589 !! input
6590 RFC RFC 1234
6591 !! result
6592 <p>RFC <a href="http://tools.ietf.org/html/rfc1234" class="external mw-magiclink-rfc">RFC 1234</a>
6593 </p>
6594 !! end
6596 !! test
6597 Double RFC with a wiki link 
6598 !! input
6599 RFC [[RFC 1234]]
6600 !! result
6601 <p>RFC <a href="/index.php?title=RFC_1234&amp;action=edit&amp;redlink=1" class="new" title="RFC 1234 (page does not exist)">RFC 1234</a>
6602 </p>
6603 !! end
6605 !! test
6606 RFC code coverage
6607 !! input
6608 RFC   983&#x20;987
6609 !! result
6610 <p><a href="http://tools.ietf.org/html/rfc983" class="external mw-magiclink-rfc">RFC 983</a>&#x20;987
6611 </p>
6612 !! end
6614 !! test
6615 Centre-aligned image
6616 !! input
6617 [[Image:foobar.jpg|centre]]
6618 !! result
6619 <div class="center"><div class="floatnone"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a></div></div>
6621 !!end
6623 !! test
6624 None-aligned image
6625 !! input
6626 [[Image:foobar.jpg|none]]
6627 !! result
6628 <div class="floatnone"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a></div>
6630 !!end
6632 !! test
6633 Width + Height sized image (using px) (height is ignored)
6634 !! input
6635 [[Image:foobar.jpg|640x480px]]
6636 !! result
6637 <p><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="640" height="73" /></a>
6638 </p>
6639 !!end
6641 !! test
6642 Width-sized image (using px, no following whitespace)
6643 !! input
6644 [[Image:foobar.jpg|640px]]
6645 !! result
6646 <p><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="640" height="73" /></a>
6647 </p>
6648 !!end
6650 !! test
6651 Width-sized image (using px, with following whitespace - test regression from r39467)
6652 !! input
6653 [[Image:foobar.jpg|640px ]]
6654 !! result
6655 <p><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="640" height="73" /></a>
6656 </p>
6657 !!end
6659 !! test
6660 Width-sized image (using px, with preceding whitespace - test regression from r39467)
6661 !! input
6662 [[Image:foobar.jpg| 640px]]
6663 !! result
6664 <p><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="640" height="73" /></a>
6665 </p>
6666 !!end
6668 !! test
6669 Another italics / bold test
6670 !! input
6671  ''' ''x'
6672 !! result
6673 <pre>'<i> </i>x'
6674 </pre>
6675 !!end
6677 # Note the results may be incorrect, as parserTest output included this:
6678 # XML error: Mismatched tag at byte 6120:
6679 # ...<dd> </dt></dl> </dd...
6680 !! test
6681 dt/dd/dl test
6682 !! options
6683 disabled
6684 !! input
6685 :;;;::
6686 !! result
6687 <dl><dd><dl><dt><dl><dt><dl><dt><dl><dd><dl><dd>
6688 </dd></dl>
6689 </dd></dl>
6690 </dt></dl>
6691 </dt></dl>
6692 </dt></dl>
6693 </dd></dl>
6695 !!end
6698 # Images with the "|" character in external URLs in comment tags; Eats half the comment, leaves unmatched "</a>" tag.
6699 !! test
6700 Images with the "|" character in the comment
6701 !! input
6702 [[image:Foobar.jpg|thumb|An [http://test/?param1=|left|&param2=|x external] URL]]
6703 !! result
6704 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/3/3a/Foobar.jpg" width="180" height="20" class="thumbimage" /></a>  <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>An <a href="http://test/?param1=%7Cleft%7C&amp;param2=%7Cx" class="external text" rel="nofollow">external</a> URL</div></div></div>
6706 !!end
6708 !! test
6709 [Before] HTML without raw HTML enabled ($wgRawHtml==false)
6710 !! input
6711 <html><script>alert(1);</script></html>
6712 !! result
6713 <p>&lt;html&gt;&lt;script&gt;alert(1);&lt;/script&gt;&lt;/html&gt;
6714 </p>
6715 !! end
6717 !! test
6718 HTML with raw HTML ($wgRawHtml==true)
6719 !! options
6720 rawhtml
6721 !! input
6722 <html><script>alert(1);</script></html>
6723 !! result
6724 <p><script>alert(1);</script>
6725 </p>
6726 !! end
6728 !! test
6729 Parents of subpages, one level up
6730 !! options
6731 subpage title=[[Subpage test/L1/L2/L3]]
6732 !! input
6733 [[../|L2]]
6734 !! result
6735 <p><a href="/index.php?title=Subpage_test/L1/L2&amp;action=edit&amp;redlink=1" class="new" title="Subpage test/L1/L2 (page does not exist)">L2</a>
6736 </p>
6737 !! end
6740 !! test
6741 Parents of subpages, one level up, not named
6742 !! options
6743 subpage title=[[Subpage test/L1/L2/L3]]
6744 !! input
6745 [[../]]
6746 !! result
6747 <p><a href="/index.php?title=Subpage_test/L1/L2&amp;action=edit&amp;redlink=1" class="new" title="Subpage test/L1/L2 (page does not exist)">Subpage test/L1/L2</a>
6748 </p>
6749 !! end
6753 !! test
6754 Parents of subpages, two levels up
6755 !! options
6756 subpage title=[[Subpage test/L1/L2/L3]]
6757 !! input
6758 [[../../|L1]]2
6760 [[../../|L1]]l
6761 !! result
6762 <p><a href="/index.php?title=Subpage_test/L1&amp;action=edit&amp;redlink=1" class="new" title="Subpage test/L1 (page does not exist)">L1</a>2
6763 </p><p><a href="/index.php?title=Subpage_test/L1&amp;action=edit&amp;redlink=1" class="new" title="Subpage test/L1 (page does not exist)">L1l</a>
6764 </p>
6765 !! end
6767 !! test
6768 Parents of subpages, two levels up, without trailing slash or name.
6769 !! options
6770 subpage title=[[Subpage test/L1/L2/L3]]
6771 !! input
6772 [[../..]]
6773 !! result
6774 <p>[[../..]]
6775 </p>
6776 !! end
6778 !! test
6779 Parents of subpages, two levels up, with lots of extra trailing slashes.
6780 !! options
6781 subpage title=[[Subpage test/L1/L2/L3]]
6782 !! input
6783 [[../../////]]
6784 !! result
6785 <p><a href="/index.php?title=Subpage_test/L1////&amp;action=edit&amp;redlink=1" class="new" title="Subpage test/L1//// (page does not exist)">///</a>
6786 </p>
6787 !! end
6789 !! test
6790 Definition list code coverage
6791 !! input
6792 ; title   : def
6793 ; title : def
6794 ;title: def
6795 !! result
6796 <dl><dt> title  &#160;</dt><dd> def
6797 </dd><dt> title&#160;</dt><dd> def
6798 </dd><dt>title</dt><dd> def
6799 </dd></dl>
6801 !! end
6803 !! test
6804 Don't fall for the self-closing div
6805 !! input
6806 <div>hello world</div/>
6807 !! result
6808 <div>hello world</div>
6810 !! end
6812 !! test
6813 MSGNW magic word
6814 !! input
6815 {{MSGNW:msg}}
6816 !! result
6817 <p>&#91;&#91;:Template:Msg&#93;&#93;
6818 </p>
6819 !! end
6821 !! test
6822 RAW magic word
6823 !! input
6824 {{RAW:QUERTY}}
6825 !! result
6826 <p><a href="/index.php?title=Template:QUERTY&amp;action=edit&amp;redlink=1" class="new" title="Template:QUERTY (page does not exist)">Template:QUERTY</a>
6827 </p>
6828 !! end
6830 # This isn't needed for XHTML conformance, but would be handy as a fallback security measure
6831 !! test
6832 Always escape literal '>' in output, not just after '<'
6833 !! input
6835 !! result
6836 <p>&gt;&lt;&gt;
6837 </p>
6838 !! end
6840 !! test
6841 Template caching
6842 !! input
6843 {{Test}}
6844 {{Test}}
6845 !! result
6846 <p>This is a test template
6847 This is a test template
6848 </p>
6849 !! end
6852 !! article
6853 MediaWiki:Fake
6854 !! text
6855 ==header==
6856 !! endarticle
6858 !! test
6859 Inclusion of !userCanEdit() content
6860 !! input
6861 {{MediaWiki:Fake}}
6862 !! result
6863 <h2><span class="editsection">[<a href="/index.php?title=MediaWiki:Fake&amp;action=edit&amp;section=T-1" title="MediaWiki:Fake">edit</a>]</span> <span class="mw-headline" id="header">header</span></h2>
6865 !! end
6868 !! test
6869 Out-of-order TOC heading levels
6870 !! input
6871 ==2==
6872 ======6======
6873 ===3===
6875 =====5=====
6876 ==2==
6877 !! result
6878 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
6879 <ul>
6880 <li class="toclevel-1 tocsection-1"><a href="#2"><span class="tocnumber">1</span> <span class="toctext">2</span></a>
6881 <ul>
6882 <li class="toclevel-2 tocsection-2"><a href="#6"><span class="tocnumber">1.1</span> <span class="toctext">6</span></a></li>
6883 <li class="toclevel-2 tocsection-3"><a href="#3"><span class="tocnumber">1.2</span> <span class="toctext">3</span></a></li>
6884 </ul>
6885 </li>
6886 <li class="toclevel-1 tocsection-4"><a href="#1"><span class="tocnumber">2</span> <span class="toctext">1</span></a>
6887 <ul>
6888 <li class="toclevel-2 tocsection-5"><a href="#5"><span class="tocnumber">2.1</span> <span class="toctext">5</span></a></li>
6889 <li class="toclevel-2 tocsection-6"><a href="#2_2"><span class="tocnumber">2.2</span> <span class="toctext">2</span></a></li>
6890 </ul>
6891 </li>
6892 </ul>
6893 </td></tr></table><script>if (window.showTocToggle) { var tocShowText = "show"; var tocHideText = "hide"; showTocToggle(); } </script>
6894 <h2><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: 2">edit</a>]</span> <span class="mw-headline" id="2">2</span></h2>
6895 <h6><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: 6">edit</a>]</span> <span class="mw-headline" id="6">6</span></h6>
6896 <h3><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=3" title="Edit section: 3">edit</a>]</span> <span class="mw-headline" id="3">3</span></h3>
6897 <h1><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=4" title="Edit section: 1">edit</a>]</span> <span class="mw-headline" id="1">1</span></h1>
6898 <h5><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=5" title="Edit section: 5">edit</a>]</span> <span class="mw-headline" id="5">5</span></h5>
6899 <h2><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=6" title="Edit section: 2">edit</a>]</span> <span class="mw-headline" id="2_2">2</span></h2>
6901 !! end
6904 !! test
6905 ISBN with a dummy number
6906 !! input
6907 ISBN ---
6908 !! result
6909 <p>ISBN ---
6910 </p>
6911 !! end
6914 !! test
6915 ISBN with space-delimited number
6916 !! input
6917 ISBN 92 9017 032 8
6918 !! result
6919 <p><a href="/wiki/Special:BookSources/9290170328" class="internal mw-magiclink-isbn">ISBN 92 9017 032 8</a>
6920 </p>
6921 !! end
6924 !! test
6925 ISBN with multiple spaces, no number
6926 !! input
6927 ISBN  foo
6928 !! result
6929 <p>ISBN  foo
6930 </p>
6931 !! end
6934 !! test
6935 ISBN length
6936 !! input
6937 ISBN 123456789
6939 ISBN 1234567890
6941 ISBN 12345678901
6942 !! result
6943 <p>ISBN 123456789
6944 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
6945 </p><p>ISBN 12345678901
6946 </p>
6947 !! end
6950 !! test
6951 ISBN with trailing year (bug 8110)
6952 !! input
6953 ISBN 1-234-56789-0 - 2006
6955 ISBN 1 234 56789 0 - 2006
6956 !! result
6957 <p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1-234-56789-0</a> - 2006
6958 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1 234 56789 0</a> - 2006
6959 </p>
6960 !! end
6963 !! test
6964 anchorencode
6965 !! input
6966 {{anchorencode:foo bar©#%n}}
6967 !! result
6968 <p>foo_bar.C2.A9.23.25n
6969 </p>
6970 !! end
6972 !! test
6973 anchorencode trims spaces
6974 !! input
6975 {{anchorencode: __pretty__please__}}
6976 !! result
6977 <p>pretty_please
6978 </p>
6979 !! end
6981 !! test
6982 anchorencode deals with links
6983 !! input
6984 {{anchorencode: [[hello|world]] [[hi]]}}
6985 !! result
6986 <p>world_hi
6987 </p>
6988 !! end
6990 !! test
6991 anchorencode deals with templates
6992 !! input
6993 {{anchorencode: {{Foo}} }}
6994 !! result
6995 <p>FOO
6996 </p>
6997 !! end
6999 !! test
7000 anchorencode encodes like the TOC generator: (bug 18431)
7001 !! input
7002 === _ +:.3A%3A&&amp;]] ===
7003 {{anchorencode: _ +:.3A%3A&&amp;]] }}
7004 __NOEDITSECTION__
7005 !! result
7006 <h3> <span class="mw-headline" id=".2B:.3A.253A.26.26.5D.5D"> _ +:.3A%3A&amp;&amp;]] </span></h3>
7007 <p>.2B:.3A.253A.26.26.5D.5D
7008 </p>
7009 !! end
7011 !! test
7012 Bug 8293: Use of center tag ruins paragraph formatting
7013 !! input
7014 <center>
7016 </center>
7020  baz
7021 !! result
7022 <center>
7023 <p>foo
7024 </p>
7025 </center>
7026 <p>bar
7027 </p>
7028 <pre>baz
7029 </pre>
7030 !! end
7034 ### Language variants related tests
7036 !! test
7037 Self-link in language variants
7038 !! options
7039 title=[[Dunav]] language=sr
7040 !! input
7041 Both [[Dunav]] and [[Дунав]] are names for this river.
7042 !! result
7043 <p>Both <strong class="selflink">Dunav</strong> and <strong class="selflink">Дунав</strong> are names for this river.
7044 </p>
7045 !!end
7048 !! test
7049 Link to pages in language variants
7050 !! options
7051 language=sr
7052 !! input
7053 Main Page can be written as [[Маин Паге]]
7054 !! result
7055 <p>Main Page can be written as <a href="/wiki/Main_Page" title="Main Page">Маин Паге</a>
7056 </p>
7057 !!end
7060 !! test
7061 Multiple links to pages in language variants
7062 !! options
7063 language=sr
7064 !! input
7065 [[Main Page]] can be written as [[Маин Паге]] same as [[Маин Паге]].
7066 !! result
7067 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a> can be written as <a href="/wiki/Main_Page" title="Main Page">Маин Паге</a> same as <a href="/wiki/Main_Page" title="Main Page">Маин Паге</a>.
7068 </p>
7069 !!end
7072 !! test
7073 Simple template in language variants
7074 !! options
7075 language=sr
7076 !! input
7077 {{тест}}
7078 !! result
7079 <p>This is a test template
7080 </p>
7081 !! end
7084 !! test
7085 Template with explicit namespace in language variants
7086 !! options
7087 language=sr
7088 !! input
7089 {{Template:тест}}
7090 !! result
7091 <p>This is a test template
7092 </p>
7093 !! end
7096 !! test
7097 Basic test for template parameter in language variants
7098 !! options
7099 language=sr
7100 !! input
7101 {{парамтест|param=foo}}
7102 !! result
7103 <p>This is a test template with parameter foo
7104 </p>
7105 !! end
7108 !! test
7109 Simple category in language variants
7110 !! options
7111 language=sr cat
7112 !! input
7113 [[Category:МедиаWики Усер'с Гуиде]]
7114 !! result
7115 <a href="/wiki/%D0%9A%D0%B0%D1%82%D0%B5%D0%B3%D0%BE%D1%80%D0%B8%D1%98%D0%B0:MediaWiki_User%27s_Guide" title="Категорија:MediaWiki User's Guide">MediaWiki User's Guide</a>
7116 !! end
7119 !! test
7120 Stripping -{}- tags (language variants)
7121 !! options
7122 language=sr
7123 !! input
7124 Latin proverb: -{Ne nuntium necare}-
7125 !! result
7126 <p>Latin proverb: Ne nuntium necare
7127 </p>
7128 !! end
7131 !! test
7132 Prevent conversion with -{}- tags (language variants)
7133 !! options
7134 language=sr variant=sr-ec
7135 !! input
7136 Latinski: -{Ne nuntium necare}-
7137 !! result
7138 <p>Латински: Ne nuntium necare
7139 </p>
7140 !! end
7143 !! test
7144 Prevent conversion of text with -{}- tags (language variants)
7145 !! options
7146 language=sr variant=sr-ec
7147 !! input
7148 Latinski: -{Ne nuntium necare}-
7149 !! result
7150 <p>Латински: Ne nuntium necare
7151 </p>
7152 !! end
7155 !! test
7156 Prevent conversion of links with -{}- tags (language variants)
7157 !! options
7158 language=sr variant=sr-ec
7159 !! input
7160 -{[[Main Page]]}-
7161 !! result
7162 <p><a href="/index.php?title=Main_Page&amp;variant=sr-ec" title="Main Page">Main Page</a>
7163 </p>
7164 !! end
7167 !! test
7168 -{}- tags within headlines (within html for parserConvert())
7169 !! options
7170 language=sr variant=sr-ec
7171 !! input
7172 == -{Naslov}- ==
7173 !! result
7174 <h2><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Уреди део: Naslov">уреди</a>]</span> <span class="mw-headline" id="-.7BNaslov.7D-"> Naslov </span></h2>
7176 !! end
7179 !! test
7180 Explicit definition of language variant alternatives
7181 !! options
7182 language=zh variant=zh-tw
7183 !! input
7184 -{zh:China;zh-tw:Taiwan}-, not China
7185 !! result
7186 <p>Taiwan, not China
7187 </p>
7188 !! end
7191 !! test
7192 Explicit session-wise language variant mapping (A flag and - flag)
7193 !! options
7194 language=zh variant=zh-tw
7195 !! input
7196 Taiwan is not China.
7197 But -{A|zh:China;zh-tw:Taiwan}- is China,
7198 (This-{-|zh:China;zh-tw:Taiwan}- should be stripped!)
7199 and -{China}- is China.
7200 !! result
7201 <p>Taiwan is not China.
7202 But Taiwan is Taiwan,
7203 (This should be stripped!)
7204 and China is China.
7205 </p>
7206 !! end
7208 !! test
7209 Explicit session-wise language variant mapping (H flag for hide)
7210 !! options
7211 language=zh variant=zh-tw
7212 !! input
7213 (This-{H|zh:China;zh-tw:Taiwan}- should be stripped!)
7214 Taiwan is China.
7215 !! result
7216 <p>(This should be stripped!)
7217 Taiwan is Taiwan.
7218 </p>
7219 !! end
7221 !! test
7222 Adding explicit conversion rule for title (T flag)
7223 !! options
7224 language=zh variant=zh-tw showtitle
7225 !! input
7226 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
7227 !! result
7228 Taiwan
7229 <p>Should be stripped!
7230 </p>
7231 !! end
7233 !! test
7234 Testing that changing the language variant here in the tests actually works
7235 !! options
7236 language=zh variant=zh showtitle
7237 !! input
7238 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
7239 !! result
7240 China
7241 <p>Should be stripped!
7242 </p>
7243 !! end
7245 !! test
7246 Raw output of variant escape tags (R flag)
7247 !! options
7248 language=zh variant=zh-tw
7249 !! input
7250 Raw: -{R|zh:China;zh-tw:Taiwan}-
7251 !! result
7252 <p>Raw: zh:China;zh-tw:Taiwan
7253 </p>
7254 !! end
7256 !! test
7257 Nested using of manual convert syntax
7258 !! options
7259 language=zh variant=zh-hk
7260 !! input
7261 Nested: -{zh-hans:Hi -{zh-cn:China;zh-sg:Singapore;}-;zh-hant:Hello -{zh-tw:Taiwan;zh-hk:H-{ong}- K-{}-ong;}-;}-!
7262 !! result
7263 <p>Nested: Hello Hong Kong!
7264 </p>
7265 !! end
7267 !! test
7268 Do not convert roman numbers to language variants
7269 !! options
7270 language=sr variant=sr-ec
7271 !! input
7272 Fridrih IV je car.
7273 !! result
7274 <p>Фридрих IV је цар.
7275 </p>
7276 !! end
7278 !! test
7279 Unclosed language converter markup "-{"
7280 !! options 
7281 language=sr
7282 !! input
7283 -{T|hello
7284 !! result
7285 <p>-{T|hello
7286 </p>
7287 !! end
7289 !! test
7290 Don't convert raw rule "-{R|=&gt;}-" to "=>"
7291 !! options
7292 language=sr
7293 !! input
7294 -{R|=&gt;}-
7295 !! result 
7296 <p>=&gt;
7297 </p>
7298 !!end
7300 !!article 
7301 Template:Bullet
7302 !!text
7303 * Bar
7304 !!endarticle
7306 !! test
7307 Bug 529: Uncovered bullet
7308 !! input
7309 * Foo {{bullet}}
7310 !! result
7311 <ul><li> Foo 
7312 </li><li> Bar
7313 </li></ul>
7315 !! end
7317 !! test
7318 Bug 529: Uncovered table already at line-start
7319 !! input
7322 {{table}}
7324 !! result
7325 <p>x
7326 </p>
7327 <table>
7328 <tr>
7329 <td> 1 </td><td> 2
7330 </td></tr>
7331 <tr>
7332 <td> 3 </td><td> 4
7333 </td></tr></table>
7334 <p>y
7335 </p>
7336 !! end
7338 !! test
7339 Bug 529: Uncovered bullet in parser function result
7340 !! input
7341 * Foo {{lc:{{bullet}} }}
7342 !! result
7343 <ul><li> Foo 
7344 </li><li> bar
7345 </li></ul>
7347 !! end
7349 !! test
7350 Bug 5678: Double-parsed template argument
7351 !! input
7352 {{lc:{{{1}}}|hello}}
7353 !! result
7354 <p>{{{1}}}
7355 </p>
7356 !! end
7358 !! test
7359 Bug 5678: Double-parsed template invocation
7360 !! input
7361 {{lc:{{paramtest {{!}} param = hello }} }}
7362 !! result
7363 <p>{{paramtest | param = hello }}
7364 </p>
7365 !! end
7367 !! test
7368 Case insensitivity of parser functions for non-ASCII characters (bug 8143)
7369 !! options
7370 language=cs
7371 title=[[Main Page]]
7372 !! input
7373 {{PRVNÍVELKÉ:ěščř}}
7374 {{prvnívelké:ěščř}}
7375 {{PRVNÍMALÉ:ěščř}}
7376 {{prvnímalé:ěščř}}
7377 {{MALÁ:ěščř}}
7378 {{malá:ěščř}}
7379 {{VELKÁ:ěščř}}
7380 {{velká:ěščř}}
7381 !! result
7382 <p>Ěščř
7383 Ěščř
7384 ěščř
7385 ěščř
7386 ěščř
7387 ěščř
7388 ĚŠČŘ
7389 ĚŠČŘ
7390 </p>
7391 !! end
7393 !! test
7394 Morwen/13: Unclosed link followed by heading
7395 !! input
7396 [[link
7397 ==heading==
7398 !! result
7399 <p>[[link
7400 </p>
7401 <h2><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: heading">edit</a>]</span> <span class="mw-headline" id="heading">heading</span></h2>
7403 !! end
7405 !! test
7406 HHP2.1: Heuristics for headings in preprocessor parenthetical structures
7407 !! input
7408 {{foo|
7409 =heading=
7410 !! result
7411 <p>{{foo|
7412 </p>
7413 <h1> <span class="mw-headline" id="heading">heading</span></h1>
7415 !! end
7417 !! test
7418 HHP2.2: Heuristics for headings in preprocessor parenthetical structures
7419 !! input
7420 {{foo|
7421 ==heading==
7422 !! result
7423 <p>{{foo|
7424 </p>
7425 <h2><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: heading">edit</a>]</span> <span class="mw-headline" id="heading">heading</span></h2>
7427 !! end
7429 !! test
7430 Tildes in comments
7431 !! options
7433 !! input
7434 <!-- ~~~~ -->
7435 !! result
7436 <!-- ~~~~ -->
7437 !! end
7439 !! test
7440 Paragraphs inside divs (no extra line breaks)
7441 !! input
7442 <div>Line one
7444 Line two</div>
7445 !! result
7446 <div>Line one
7447 Line two</div>
7449 !! end
7451 !! test
7452 Paragraphs inside divs (extra line break on open)
7453 !! input
7454 <div>
7455 Line one
7457 Line two</div>
7458 !! result
7459 <div>
7460 <p>Line one
7461 </p>
7462 Line two</div>
7464 !! end
7466 !! test
7467 Paragraphs inside divs (extra line break on close)
7468 !! input
7469 <div>Line one
7471 Line two
7472 </div>
7473 !! result
7474 <div>Line one
7475 <p>Line two
7476 </p>
7477 </div>
7479 !! end
7481 !! test
7482 Paragraphs inside divs (extra line break on open and close)
7483 !! input
7484 <div>
7485 Line one
7487 Line two
7488 </div>
7489 !! result
7490 <div>
7491 <p>Line one
7492 </p><p>Line two
7493 </p>
7494 </div>
7496 !! end
7498 !! test
7499 Nesting tags, paragraphs on lines which begin with <div>
7500 !! options
7501 disabled
7502 !! input
7503 <div></div><strong>A
7504 B</strong>
7505 !! result
7506 <div></div>
7507 <p><strong>A
7508 B</strong>
7509 </p>
7510 !! end
7512 # Bug 6200: <blockquote> should behave like <div> with respect to line breaks
7513 !! test
7514 Bug 6200: paragraphs inside blockquotes (no extra line breaks)
7515 !! options
7516 disabled
7517 !! input
7518 <blockquote>Line one
7520 Line two</blockquote>
7521 !! result
7522 <blockquote>Line one
7523 Line two</blockquote>
7525 !! end
7527 !! test
7528 Bug 6200: paragraphs inside blockquotes (extra line break on open)
7529 !! options
7530 disabled
7531 !! input
7532 <blockquote>
7533 Line one
7535 Line two</blockquote>
7536 !! result
7537 <blockquote>
7538 <p>Line one
7539 </p>
7540 Line two</blockquote>
7542 !! end
7544 !! test
7545 Bug 6200: paragraphs inside blockquotes (extra line break on close)
7546 !! options
7547 disabled
7548 !! input
7549 <blockquote>Line one
7551 Line two
7552 </blockquote>
7553 !! result
7554 <blockquote>Line one
7555 <p>Line two
7556 </p>
7557 </blockquote>
7559 !! end
7561 !! test
7562 Bug 6200: paragraphs inside blockquotes (extra line break on open and close)
7563 !! options
7564 disabled
7565 !! input
7566 <blockquote>
7567 Line one
7569 Line two
7570 </blockquote>
7571 !! result
7572 <blockquote>
7573 <p>Line one
7574 </p><p>Line two
7575 </p>
7576 </blockquote>
7578 !! end
7580 !! test
7581 Paragraphs inside blockquotes/divs (no extra line breaks)
7582 !! input
7583 <blockquote><div>Line one
7585 Line two</div></blockquote>
7586 !! result
7587 <blockquote><div>Line one
7588 Line two</div></blockquote>
7590 !! end
7592 !! test
7593 Paragraphs inside blockquotes/divs (extra line break on open)
7594 !! input
7595 <blockquote><div>
7596 Line one
7598 Line two</div></blockquote>
7599 !! result
7600 <blockquote><div>
7601 <p>Line one
7602 </p>
7603 Line two</div></blockquote>
7605 !! end
7607 !! test
7608 Paragraphs inside blockquotes/divs (extra line break on close)
7609 !! input
7610 <blockquote><div>Line one
7612 Line two
7613 </div></blockquote>
7614 !! result
7615 <blockquote><div>Line one
7616 <p>Line two
7617 </p>
7618 </div></blockquote>
7620 !! end
7622 !! test
7623 Paragraphs inside blockquotes/divs (extra line break on open and close)
7624 !! input
7625 <blockquote><div>
7626 Line one
7628 Line two
7629 </div></blockquote>
7630 !! result
7631 <blockquote><div>
7632 <p>Line one
7633 </p><p>Line two
7634 </p>
7635 </div></blockquote>
7637 !! end
7639 !! test
7640 Interwiki links trounced by replaceExternalLinks after early LinkHolderArray expansion
7641 !! options
7642 wgLinkHolderBatchSize=0
7643 !! input
7644 [[meatball:1]]
7645 [[meatball:2]]
7646 [[meatball:3]]
7647 !! result
7648 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?1" class="extiw" title="meatball:1">meatball:1</a>
7649 <a href="http://www.usemod.com/cgi-bin/mb.pl?2" class="extiw" title="meatball:2">meatball:2</a>
7650 <a href="http://www.usemod.com/cgi-bin/mb.pl?3" class="extiw" title="meatball:3">meatball:3</a>
7651 </p>
7652 !! end
7654 !! test
7655 Free external link invading image caption
7656 !! input
7657 [[Image:Foobar.jpg|thumb|http://x|hello]]
7658 !! result
7659 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/3/3a/Foobar.jpg" width="180" height="20" class="thumbimage" /></a>  <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>hello</div></div></div>
7661 !! end
7663 !! test
7664 Bug 15196: localised external link numbers
7665 !! options
7666 language=fa
7667 !! input
7668 [http://en.wikipedia.org/]
7669 !! result
7670 <p><a href="http://en.wikipedia.org/" class="external autonumber" rel="nofollow">[۱]</a>
7671 </p>
7672 !! end
7674 !! test
7675 Multibyte character in padleft
7676 !! input
7677 {{padleft:-Hello|7|Æ}}
7678 !! result
7679 <p>Æ-Hello
7680 </p>
7681 !! end
7683 !! test
7684 Multibyte character in padright
7685 !! input
7686 {{padright:Hello-|7|Æ}}
7687 !! result
7688 <p>Hello-Æ
7689 </p>
7690 !! end
7692 !! test
7693 Formatted date
7694 !! config
7695 wgUseDynamicDates=1
7696 !! input
7697 [[2009-03-24]]
7698 !! result
7699 <p><span class="mw-formatted-date" title="2009-03-24"><a href="/index.php?title=2009&amp;action=edit&amp;redlink=1" class="new" title="2009 (page does not exist)">2009</a>-<a href="/index.php?title=March_24&amp;action=edit&amp;redlink=1" class="new" title="March 24 (page does not exist)">03-24</a></span>
7700 </p>
7701 !!end
7703 !!test
7704 formatdate parser function
7705 !!input
7706 {{#formatdate:2009-03-24}}
7707 !! result
7708 <p><span class="mw-formatted-date" title="2009-03-24">2009-03-24</span>
7709 </p>
7710 !! end
7712 !!test
7713 formatdate parser function, with default format
7714 !!input
7715 {{#formatdate:2009-03-24|mdy}}
7716 !! result
7717 <p><span class="mw-formatted-date" title="2009-03-24">March 24, 2009</span>
7718 </p>
7719 !! end
7721 !! test
7722 Linked date with autoformatting disabled
7723 !! config
7724 wgUseDynamicDates=false
7725 !! input
7726 [[2009-03-24]]
7727 !! result
7728 <p><a href="/index.php?title=2009-03-24&amp;action=edit&amp;redlink=1" class="new" title="2009-03-24 (page does not exist)">2009-03-24</a>
7729 </p>
7730 !! end
7732 !! test
7733 Spacing of numbers in formatted dates
7734 !! input
7735 {{#formatdate:January 15}}
7736 !! result
7737 <p><span class="mw-formatted-date" title="01-15">January 15</span>
7738 </p>
7739 !! end
7741 !! test
7742 Spacing of numbers in formatted dates (linked)
7743 !! config
7744 wgUseDynamicDates=true
7745 !! input
7746 [[January 15]]
7747 !! result
7748 <p><span class="mw-formatted-date" title="01-15"><a href="/index.php?title=January_15&amp;action=edit&amp;redlink=1" class="new" title="January 15 (page does not exist)">January 15</a></span>
7749 </p>
7750 !! end
7757 # Edit comments
7760 !! test
7761 Edit comment with link
7762 !! options
7763 comment
7764 !! input
7765 I like the [[Main Page]] a lot
7766 !! result
7767 I like the <a href="/wiki/Main_Page" title="Main Page">Main Page</a> a lot
7768 !!end
7770 !! test
7771 Edit comment with link and link text
7772 !! options
7773 comment
7774 !! input
7775 I like the [[Main Page|best pages]] a lot
7776 !! result
7777 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
7778 !!end
7780 !! test
7781 Edit comment with link and link text with suffix
7782 !! options
7783 comment
7784 !! input
7785 I like the [[Main Page|best page]]s a lot
7786 !! result
7787 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
7788 !!end
7790 !! test
7791 Edit comment with section link (non-local, eg in history list)
7792 !! options
7793 comment title=[[Main Page]]
7794 !! input
7795 /* External links */ removed bogus entries
7796 !! result
7797 <span class="autocomment"><a href="/wiki/Main_Page#External_links" title="Main Page">→</a>External links: </span> removed bogus entries
7798 !!end
7800 !! test
7801 Edit comment with section link (local, eg in diff view)
7802 !! options
7803 comment local title=[[Main Page]]
7804 !! input
7805 /* External links */ removed bogus entries
7806 !! result
7807 <span class="autocomment"><a href="#External_links">→</a>External links: </span> removed bogus entries
7808 !!end
7810 !! test
7811 Edit comment with subpage link (bug 14080)
7812 !! options
7813 comment
7814 subpage
7815 title=[[Subpage test]]
7816 !! input
7817 Poked at a [[/subpage]] here...
7818 !! result
7819 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a> here...
7820 !!end
7822 !! test
7823 Edit comment with subpage link and link text (bug 14080)
7824 !! options
7825 comment
7826 subpage
7827 title=[[Subpage test]]
7828 !! input
7829 Poked at a [[/subpage|neat little page]] here...
7830 !! result
7831 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">neat little page</a> here...
7832 !!end
7834 !! test
7835 Edit comment with bogus subpage link in non-subpage NS (bug 14080)
7836 !! options
7837 comment
7838 title=[[Subpage test]]
7839 !! input
7840 Poked at a [[/subpage]] here...
7841 !! result
7842 Poked at a <a href="/index.php?title=/subpage&amp;action=edit&amp;redlink=1" class="new" title="/subpage (page does not exist)">/subpage</a> here...
7843 !!end
7845 !! test
7846 Edit comment with bare anchor link (local, as on diff)
7847 !! options
7848 comment
7849 local
7850 title=[[Main Page]]
7851 !!input
7852 [[#section]]
7853 !! result
7854 <a href="#section">#section</a>
7855 !! end
7857 !! test
7858 Edit comment with bare anchor link (non-local, as on history)
7859 !! options
7860 comment
7861 title=[[Main Page]]
7862 !!input
7863 [[#section]]
7864 !! result
7865 <a href="/wiki/Main_Page#section" title="Main Page">#section</a>
7866 !! end
7868 !! test
7869 Space normalisation on autocomment (bug 22784)
7870 !! options
7871 comment
7872 title=[[Main Page]]
7873 !!input
7874 /* __hello__world__ */
7875 !! result
7876 <span class="autocomment"><a href="/wiki/Main_Page#hello_world" title="Main Page">→</a>__hello__world__</span>
7877 !! end
7879 !!article
7880 MediaWiki:bad image list
7881 !!text
7882 * [[File:Bad.jpg]] except [[Nasty page]]
7883 !!endarticle
7885 !! test
7886 Bad images - basic functionality
7887 !! input
7888 [[File:Bad.jpg]]
7889 !! result
7890 !! end
7892 !! test
7893 Bad images - bug 16039: text after bad image disappears
7894 !! input
7895 Foo bar
7896 [[File:Bad.jpg]]
7897 Bar foo
7898 !! result
7899 <p>Foo bar
7900 </p><p>Bar foo
7901 </p>
7902 !! end
7904 !! test
7905 Verify that displaytitle works (bug #22501) no displaytitle
7906 !! options
7907 showtitle
7908 !! config
7909 wgAllowDisplayTitle=true
7910 wgRestrictDisplayTitle=false
7911 !! input
7912 this is not the the title
7913 !! result
7914 Parser test
7915 <p>this is not the the title
7916 </p>
7917 !! end
7919 !! test
7920 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=false
7921 !! options
7922 showtitle
7923 title=[[Screen]]
7924 !! config
7925 wgAllowDisplayTitle=true
7926 wgRestrictDisplayTitle=false
7927 !! input
7928 this is not the the title
7929 {{DISPLAYTITLE:whatever}}
7930 !! result
7931 whatever
7932 <p>this is not the the title
7933 </p>
7934 !! end
7936 !! test
7937 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true mismatch
7938 !! options
7939 showtitle
7940 title=[[Screen]]
7941 !! config
7942 wgAllowDisplayTitle=true
7943 wgRestrictDisplayTitle=true
7944 !! input
7945 this is not the the title
7946 {{DISPLAYTITLE:whatever}}
7947 !! result
7948 Screen
7949 <p>this is not the the title
7950 </p>
7951 !! end
7953 !! test
7954 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true matching
7955 !! options
7956 showtitle
7957 title=[[Screen]]
7958 !! config
7959 wgAllowDisplayTitle=true
7960 wgRestrictDisplayTitle=true
7961 !! input
7962 this is not the the title
7963 {{DISPLAYTITLE:screen}}
7964 !! result
7965 screen
7966 <p>this is not the the title
7967 </p>
7968 !! end
7970 !! test
7971 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false
7972 !! options
7973 showtitle
7974 title=[[Screen]]
7975 !! config
7976 wgAllowDisplayTitle=false
7977 !! input
7978 this is not the the title
7979 {{DISPLAYTITLE:screen}}
7980 !! result
7981 Screen
7982 <p>this is not the the title
7983 <a href="/index.php?title=Template:DISPLAYTITLE:screen&amp;action=edit&amp;redlink=1" class="new" title="Template:DISPLAYTITLE:screen (page does not exist)">Template:DISPLAYTITLE:screen</a>
7984 </p>
7985 !! end
7987 !! test
7988 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false no DISPLAYTITLE
7989 !! options
7990 showtitle
7991 title=[[Screen]]
7992 !! config
7993 wgAllowDisplayTitle=false
7994 !! input
7995 this is not the the title
7996 !! result
7997 Screen
7998 <p>this is not the the title
7999 </p>
8000 !! end
8002 !! test
8003 preload: check <noinclude> and <includeonly>
8004 !! options
8005 preload
8006 !! input
8007 Hello <noinclude>cruel</noinclude><includeonly>kind</includeonly> world.
8008 !! result
8009 Hello kind world.
8010 !! end
8012 !! test
8013 preload: check <onlyinclude>
8014 !! options
8015 preload
8016 !! input
8017 Goodbye <onlyinclude>Hello world</onlyinclude>
8018 !! result
8019 Hello world
8020 !! end
8022 !! test
8023 preload: can pass tags through if we want to
8024 !! options
8025 preload
8026 !! input
8027 <includeonly><</includeonly>includeonly>Hello world<includeonly><</includeonly>/includeonly>
8028 !! result
8029 <includeonly>Hello world</includeonly>
8030 !! end
8032 !! test
8033 preload: check that it doesn't try to do tricks
8034 !! options
8035 preload
8036 !! input
8037 * <!-- Hello --> ''{{world}}'' {{<includeonly>subst:</includeonly>How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
8038 !! result
8039 * <!-- Hello --> ''{{world}}'' {{subst:How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
8040 !! end
8042 !! test
8043 Play a bit with r67090 and bug 3158 
8044 !! options
8045 disabled
8046 !! input
8047 <div style="width:50% !important">&nbsp;</div>
8048 <div style="width:50%&nbsp;!important">&nbsp;</div>
8049 <div style="width:50%&#160;!important">&nbsp;</div>
8050 <div style="border : solid;">&nbsp;</div>
8051 !! result
8052 <div style="width:50% !important">&nbsp;</div>
8053 <div style="width:50% !important">&nbsp;</div>
8054 <div style="width:50% !important">&nbsp;</div>
8055 <div style="border&#160;: solid;">&nbsp;</div>
8057 !! end
8060 TODO:
8061 more images
8062 more tables
8063 math
8064 character entities
8065 and much more
8066 Try for 100% code coverage