* (bug 22925) "sp-contributions-blocked-notice-anon" message now displayed when viewi...
[mediawiki.git] / maintenance / parserTests.txt
blobe34d12699f455a27c0ce8b46c7eb0f431d363e9e
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">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&nbsp;</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>&nbsp;</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&nbsp;: 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&nbsp;</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: invalid character
869 Fixme: the missing char seems to have gone missing
870 !! options
871 disabled
872 !! input
873 [http://www.example.com  test]
874 !! result
875 <p>[<a href="http://www.example.com" class="external free" rel="nofollow">http://www.example.com</a>  test]
876 </p>
877 !! end
879 !! test
880 External links: multiple legal whitespace is fine, Magnus. Don't break it please. (bug 5081)
881 !! input
882 [http://www.example.com  test]
883 !! result
884 <p><a href="http://www.example.com" class="external text" rel="nofollow">test</a>
885 </p>
886 !! end
888 !! test
889 External links: wiki links within external link (Bug 3695)
890 !! input
891 [http://example.com [[wikilink]] embedded in ext link]
892 !! result
893 <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>
894 </p>
895 !! end
897 !! test
898 BUG 787: Links with one slash after the url protocol are invalid
899 !! input
900 http:/example.com
902 [http:/example.com title]
903 !! result
904 <p>http:/example.com
905 </p><p>[http:/example.com title]
906 </p>
907 !! end
909 !! test
910 Bug 2702: Mismatched <i>, <b> and <a> tags are invalid
911 !! input
912 ''[http://example.com text'']
913 [http://example.com '''text]'''
914 ''Something [http://example.com in italic'']
915 ''Something [http://example.com mixed''''', even bold]'''
916 '''''Now [http://example.com both''''']
917 !! result
918 <p><a href="http://example.com" class="external text" rel="nofollow"><i>text</i></a>
919 <a href="http://example.com" class="external text" rel="nofollow"><b>text</b></a>
920 <i>Something </i><a href="http://example.com" class="external text" rel="nofollow"><i>in italic</i></a>
921 <i>Something </i><a href="http://example.com" class="external text" rel="nofollow"><i>mixed</i><b>, even bold</b></a>
922 <i><b>Now </b></i><a href="http://example.com" class="external text" rel="nofollow"><i><b>both</b></i></a>
923 </p>
924 !! end
927 !! test
928 Bug 4781: %26 in URL
929 !! input
930 http://www.example.com/?title=AT%26T
931 !! result
932 <p><a href="http://www.example.com/?title=AT%26T" class="external free" rel="nofollow">http://www.example.com/?title=AT%26T</a>
933 </p>
934 !! end
936 !! test
937 Bug 4781, 5267: %26 in URL
938 !! input
939 http://www.example.com/?title=100%25_Bran
940 !! result
941 <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>
942 </p>
943 !! end
945 !! test
946 Bug 4781, 5267: %28, %29 in URL
947 !! input
948 http://www.example.com/?title=Ben-Hur_%281959_film%29
949 !! result
950 <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>
951 </p>
952 !! end
955 !! test
956 Bug 4781: %26 in autonumber URL
957 !! input
958 [http://www.example.com/?title=AT%26T]
959 !! result
960 <p><a href="http://www.example.com/?title=AT%26T" class="external autonumber" rel="nofollow">[1]</a>
961 </p>
962 !! end
964 !! test
965 Bug 4781, 5267: %26 in autonumber URL
966 !! input
967 [http://www.example.com/?title=100%25_Bran]
968 !! result
969 <p><a href="http://www.example.com/?title=100%25_Bran" class="external autonumber" rel="nofollow">[1]</a>
970 </p>
971 !! end
973 !! test
974 Bug 4781, 5267: %28, %29 in autonumber URL
975 !! input
976 [http://www.example.com/?title=Ben-Hur_%281959_film%29]
977 !! result
978 <p><a href="http://www.example.com/?title=Ben-Hur_%281959_film%29" class="external autonumber" rel="nofollow">[1]</a>
979 </p>
980 !! end
983 !! test
984 Bug 4781: %26 in bracketed URL
985 !! input
986 [http://www.example.com/?title=AT%26T link]
987 !! result
988 <p><a href="http://www.example.com/?title=AT%26T" class="external text" rel="nofollow">link</a>
989 </p>
990 !! end
992 !! test
993 Bug 4781, 5267: %26 in bracketed URL
994 !! input
995 [http://www.example.com/?title=100%25_Bran link]
996 !! result
997 <p><a href="http://www.example.com/?title=100%25_Bran" class="external text" rel="nofollow">link</a>
998 </p>
999 !! end
1001 !! test
1002 Bug 4781, 5267: %28, %29 in bracketed URL
1003 !! input
1004 [http://www.example.com/?title=Ben-Hur_%281959_film%29 link]
1005 !! result
1006 <p><a href="http://www.example.com/?title=Ben-Hur_%281959_film%29" class="external text" rel="nofollow">link</a>
1007 </p>
1008 !! end
1010 !! test
1011 External link containing double-single-quotes in text '' (bug 4598 sanity check)
1012 !! input
1013 Some [http://example.com/ pretty ''italics'' and stuff]!
1014 !! result
1015 <p>Some <a href="http://example.com/" class="external text" rel="nofollow">pretty <i>italics</i> and stuff</a>!
1016 </p>
1017 !! end
1019 !! test
1020 External link containing double-single-quotes in text embedded in italics (bug 4598 sanity check)
1021 !! input
1022 ''Some [http://example.com/ pretty ''italics'' and stuff]!''
1023 !! result
1024 <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>
1025 </p>
1026 !! end
1028 !! test
1029 URL-encoding in URL functions (single parameter)
1030 !! input
1031 {{localurl:Some page|amp=&}}
1032 !! result
1033 <p>/index.php?title=Some_page&amp;amp=&amp;
1034 </p>
1035 !! end
1037 !! test
1038 URL-encoding in URL functions (multiple parameters)
1039 !! input
1040 {{localurl:Some page|q=?&amp=&}}
1041 !! result
1042 <p>/index.php?title=Some_page&amp;q=?&amp;amp=&amp;
1043 </p>
1044 !! end
1047 ### Quotes
1050 !! test
1051 Quotes
1052 !! input
1053 Normal text. '''Bold text.''' Normal text. ''Italic text.''
1055 Normal text. '''''Bold italic text.''''' Normal text.
1056 !!result
1057 <p>Normal text. <b>Bold text.</b> Normal text. <i>Italic text.</i>
1058 </p><p>Normal text. <i><b>Bold italic text.</b></i> Normal text.
1059 </p>
1060 !! end
1063 !! test
1064 Unclosed and unmatched quotes
1065 !! input
1066 '''''Bold italic text '''with bold deactivated''' in between.'''''
1068 '''''Bold italic text ''with italic deactivated'' in between.'''''
1070 '''Bold text..
1072 ..spanning two paragraphs (should not work).'''
1074 '''Bold tag left open
1076 ''Italic tag left open
1078 Normal text.
1080 <!-- Unmatching number of opening, closing tags: -->
1081 '''This year''''s election ''should'' beat '''last year''''s.
1083 ''Tom'''s car is bigger than ''Susan'''s.
1084 !! result
1085 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
1086 </p><p><b><i>Bold italic text </i>with italic deactivated<i> in between.</i></b>
1087 </p><p><b>Bold text..</b>
1088 </p><p>..spanning two paragraphs (should not work).
1089 </p><p><b>Bold tag left open</b>
1090 </p><p><i>Italic tag left open</i>
1091 </p><p>Normal text.
1092 </p><p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
1093 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
1094 </p>
1095 !! end
1098 ### Tables
1100 ### some content taken from http://meta.wikimedia.org/wiki/MediaWiki_User%27s_Guide:_Using_tables
1103 # This should not produce <table></table> as <table><tr><td></td></tr></table>
1104 # is the bare minimun required by the spec, see:
1105 # http://www.w3.org/TR/xhtml-modularization/dtd_module_defs.html#a_module_Basic_Tables
1106 !! test
1107 A table with no data.
1108 !! input
1109 {||}
1110 !! result
1111 !! end
1113 # A table with nothing but a caption is invalid XHTML, we might want to render
1114 # this as <p>caption</p>
1115 !! test
1116 A table with nothing but a caption
1117 !! input 
1119 |+ caption
1121 !! result
1122 <table>
1123 <caption> caption
1124 </caption><tr><td></td></tr></table>
1126 !! end
1128 !! test
1129 Simple table
1130 !! input
1131 {| 
1132 | 1 || 2
1133 |- 
1134 | 3 || 4
1136 !! result
1137 <table>
1138 <tr>
1139 <td> 1 </td><td> 2
1140 </td></tr>
1141 <tr>
1142 <td> 3 </td><td> 4
1143 </td></tr></table>
1145 !! end
1147 !! test
1148 Multiplication table
1149 !! input
1150 {| border="1" cellpadding="2"
1151 |+Multiplication table
1153 ! &times; !! 1 !! 2 !! 3
1155 ! 1
1156 | 1 || 2 || 3
1158 ! 2
1159 | 2 || 4 || 6
1161 ! 3
1162 | 3 || 6 || 9
1164 ! 4
1165 | 4 || 8 || 12
1167 ! 5
1168 | 5 || 10 || 15
1170 !! result
1171 <table border="1" cellpadding="2">
1172 <caption>Multiplication table
1173 </caption>
1174 <tr>
1175 <th> &times; </th><th> 1 </th><th> 2 </th><th> 3
1176 </th></tr>
1177 <tr>
1178 <th> 1
1179 </th><td> 1 </td><td> 2 </td><td> 3
1180 </td></tr>
1181 <tr>
1182 <th> 2
1183 </th><td> 2 </td><td> 4 </td><td> 6
1184 </td></tr>
1185 <tr>
1186 <th> 3
1187 </th><td> 3 </td><td> 6 </td><td> 9
1188 </td></tr>
1189 <tr>
1190 <th> 4
1191 </th><td> 4 </td><td> 8 </td><td> 12
1192 </td></tr>
1193 <tr>
1194 <th> 5
1195 </th><td> 5 </td><td> 10 </td><td> 15
1196 </td></tr></table>
1198 !! end
1200 !! test
1201 Table rowspan
1202 !! input
1203 {| align=right border=1
1204 | Cell 1, row 1 
1205 |rowspan=2| Cell 2, row 1 (and 2) 
1206 | Cell 3, row 1 
1207 |- 
1208 | Cell 1, row 2 
1209 | Cell 3, row 2 
1211 !! result
1212 <table align="right" border="1">
1213 <tr>
1214 <td> Cell 1, row 1
1215 </td><td rowspan="2"> Cell 2, row 1 (and 2)
1216 </td><td> Cell 3, row 1
1217 </td></tr>
1218 <tr>
1219 <td> Cell 1, row 2
1220 </td><td> Cell 3, row 2
1221 </td></tr></table>
1223 !! end
1225 !! test
1226 Nested table
1227 !! input
1228 {| border=1
1229 | &alpha;
1231 {| bgcolor=#ABCDEF border=2
1232 |nested
1234 |table
1236 |the original table again
1238 !! result
1239 <table border="1">
1240 <tr>
1241 <td> &alpha;
1242 </td><td>
1243 <table bgcolor="#ABCDEF" border="2">
1244 <tr>
1245 <td>nested
1246 </td></tr>
1247 <tr>
1248 <td>table
1249 </td></tr></table>
1250 </td><td>the original table again
1251 </td></tr></table>
1253 !! end
1255 !! test
1256 Invalid attributes in table cell (bug 1830)
1257 !! input
1259 |Cell:|broken
1261 !! result
1262 <table>
1263 <tr>
1264 <td>broken
1265 </td></tr></table>
1267 !! end
1270 # FIXME: It's not clear at all that this is the result we want, but the actual
1271 # output right now is invalid XML, so clearly something is wrong.  The result
1272 # specified here is now valid XML, which is an improvement . . .
1273 !! test
1274 Table security: embedded pipes (http://lists.wikimedia.org/mailman/htdig/wikitech-l/2006-April/022293.html)
1275 !! options
1276 disabled
1277 !! input
1279 | |[ftp://|x||]" onmouseover="alert(document.cookie)">test
1280 !! result
1281 <table>
1282 <tr>
1283 <td><a href="ftp://|x||" class="external autonumber" title="ftp://|x||" rel="nofollow">[1]</a></td><td>" onmouseover="alert(document.cookie)"&gt;test
1284 </td>
1285 </tr>
1286 </table>
1288 !! end
1292 ### Internal links
1294 !! test
1295 Plain link, capitalized
1296 !! input
1297 [[Main Page]]
1298 !! result
1299 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
1300 </p>
1301 !! end
1303 !! test
1304 Plain link, uncapitalized
1305 !! input
1306 [[main Page]]
1307 !! result
1308 <p><a href="/wiki/Main_Page" title="Main Page">main Page</a>
1309 </p>
1310 !! end
1312 !! test
1313 Piped link
1314 !! input
1315 [[Main Page|The Main Page]]
1316 !! result
1317 <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
1318 </p>
1319 !! end
1321 !! test
1322 Broken link
1323 !! input
1324 [[Zigzagzogzagzig]]
1325 !! result
1326 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig</a>
1327 </p>
1328 !! end
1330 !! test
1331 Broken link with fragment
1332 !! input
1333 [[Zigzagzogzagzig#zug]]
1334 !! result
1335 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig#zug</a>
1336 </p>
1337 !! end
1339 !! test
1340 Special page link with fragment
1341 !! input
1342 [[Special:Version#anchor]]
1343 !! result
1344 <p><a href="/wiki/Special:Version#anchor" title="Special:Version">Special:Version#anchor</a>
1345 </p>
1346 !! end
1348 !! test
1349 Nonexistent special page link with fragment
1350 !! input
1351 [[Special:ThisNameWillHopefullyNeverBeUsed#anchor]]
1352 !! result
1353 <p><a href="/wiki/Special:ThisNameWillHopefullyNeverBeUsed" class="new" title="Special:ThisNameWillHopefullyNeverBeUsed (page does not exist)">Special:ThisNameWillHopefullyNeverBeUsed#anchor</a>
1354 </p>
1355 !! end
1357 !! test
1358 Link with prefix
1359 !! input
1360 xxx[[main Page]], xxx[[Main Page]], Xxx[[main Page]] XXX[[main Page]], XXX[[Main Page]]
1361 !! result
1362 <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>
1363 </p>
1364 !! end
1366 !! test
1367 Link with suffix
1368 !! input
1369 [[Main Page]]xxx, [[Main Page]]XXX, [[Main Page]]!!!
1370 !! result
1371 <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>!!!
1372 </p>
1373 !! end
1375 !! test
1376 Link with 3 brackets
1377 !! input
1378 [[[main page]]]
1379 !! result
1380 <p>[[[main page]]]
1381 </p>
1382 !! end
1384 !! test
1385 Piped link with 3 brackets
1386 !! input
1387 [[[main page|the main page]]]
1388 !! result
1389 <p>[[[main page|the main page]]]
1390 </p>
1391 !! end
1393 !! test
1394 Link with multiple pipes
1395 !! input
1396 [[Main Page|The|Main|Page]]
1397 !! result
1398 <p><a href="/wiki/Main_Page" title="Main Page">The|Main|Page</a>
1399 </p>
1400 !! end
1402 !! test
1403 Link to namespaces
1404 !! input
1405 [[Talk:Parser testing]], [[Meta:Disclaimers]]
1406 !! result
1407 <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>
1408 </p>
1409 !! end
1411 !! test
1412 Piped link to namespace
1413 !! input
1414 [[Meta:Disclaimers|The disclaimers]]
1415 !! result
1416 <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>
1417 </p>
1418 !! end
1420 !! test
1421 Link containing }
1422 !! input
1423 [[Usually caused by a typo (oops}]]
1424 !! result
1425 <p>[[Usually caused by a typo (oops}]]
1426 </p>
1427 !! end
1429 !! test
1430 Link containing % (not as a hex sequence)
1431 !! input
1432 [[7% Solution]]
1433 !! result
1434 <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>
1435 </p>
1436 !! end
1438 !! test
1439 Link containing % as a single hex sequence interpreted to char
1440 !! input
1441 [[7%25 Solution]]
1442 !! result
1443 <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>
1444 </p>
1445 !!end
1447 !! test
1448 Link containing % as a double hex sequence interpreted to hex sequence
1449 !! input
1450 [[7%2525 Solution]]
1451 !! result
1452 <p>[[7%2525 Solution]]
1453 </p>
1454 !!end
1456 !! test
1457 Link containing "#<" and "#>" % as a hex sequences- these are valid section anchors
1458 Example for such a section: == < ==
1459 !! input
1460 [[%23%3c]][[%23%3e]]
1461 !! result
1462 <p><a href="#.3C">#&lt;</a><a href="#.3E">#&gt;</a>
1463 </p>
1464 !! end
1466 !! test
1467 Link containing "<#" and ">#" as a hex sequences
1468 !! input
1469 [[%3c%23]][[%3e%23]]
1470 !! result
1471 <p>[[%3c%23]][[%3e%23]]
1472 </p>
1473 !! end
1475 !! test
1476 Link containing double-single-quotes '' (bug 4598)
1477 !! options
1478 disabled
1479 !! input
1480 [[Lista d''e paise d''o munno]]
1481 !! result
1482 <p><a href="/index.php?title=Lista_d%27%27e_paise_d%27%27o_munno&amp;action=edit" class="new" title="Lista d''e paise d''o munno">Lista d''e paise d''o munno</a>
1483 </p>
1484 !! end
1486 !! test
1487 Link containing double-single-quotes '' in text (bug 4598 sanity check)
1488 !! input
1489 Some [[Link|pretty ''italics'' and stuff]]!
1490 !! result
1491 <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>!
1492 </p>
1493 !! end
1495 !! test
1496 Link containing double-single-quotes '' in text embedded in italics (bug 4598 sanity check)
1497 !! input
1498 ''Some [[Link|pretty ''italics'' and stuff]]!
1499 !! result
1500 <p><i>Some </i><a href="/index.php?title=Link&amp;action=edit&amp;redlink=1" class="new" title="Link (page does not exist)"><i>pretty </i>italics<i> and stuff</i></a><i>!</i>
1501 </p>
1502 !! end
1504 !! test
1505 Plain link to URL
1506 !! input
1507 [[http://www.example.com]]
1508 !! result
1509 <p>[<a href="http://www.example.com" class="external autonumber" rel="nofollow">[1]</a>]
1510 </p>
1511 !! end
1513 # I'm fairly sure the expected result here is wrong.
1514 # We want these to be URL links, not pseudo-pages with URLs for titles....
1515 # However the current output is also pretty screwy.
1517 # ----
1518 # I'm changing it to match the current output--it arguably makes more
1519 # sense in the light of the test above. Old expected result was:
1520 #<p>Piped link to URL: <a href="/index.php?title=Http://www.example.com&amp;action=edit" class="new">an example URL</a>
1521 #</p>
1522 # But I think this test is bordering on "garbage in, garbage out" anyway.
1523 # -- wtm
1524 !! test
1525 Piped link to URL
1526 !! input
1527 Piped link to URL: [[http://www.example.com|an example URL]]
1528 !! result
1529 <p>Piped link to URL: [<a href="http://www.example.com|an" class="external text" rel="nofollow">example URL</a>]
1530 </p>
1531 !! end
1533 !! test
1534 BUG 2: [[page|http://url/]] should link to page, not http://url/
1535 !! input
1536 [[Main Page|http://url/]]
1537 !! result
1538 <p><a href="/wiki/Main_Page" title="Main Page">http://url/</a>
1539 </p>
1540 !! end
1542 !! test
1543 BUG 337: Escaped self-links should be bold
1544 !! options
1545 title=[[Bug462]]
1546 !! input
1547 [[Bu&#103;462]] [[Bug462]]
1548 !! result
1549 <p><strong class="selflink">Bu&#103;462</strong> <strong class="selflink">Bug462</strong>
1550 </p>
1551 !! end
1553 !! test
1554 Self-link to section should not be bold
1555 !! options
1556 title=[[Main Page]]
1557 !! input
1558 [[Main Page#section]]
1559 !! result
1560 <p><a href="/wiki/Main_Page#section" title="Main Page">Main Page#section</a>
1561 </p>
1562 !! end
1564 !! article
1566 !! text
1567 This is 00.
1568 !! endarticle
1570 !!test
1571 Self-link to numeric title
1572 !!options
1573 title=[[0]]
1574 !!input
1575 [[0]]
1576 !!result
1577 <p><strong class="selflink">0</strong>
1578 </p>
1579 !!end
1581 !!test
1582 Link to numeric-equivalent title
1583 !!options
1584 title=[[0]]
1585 !!input
1586 [[00]]
1587 !!result
1588 <p><a href="/wiki/00" title="00">00</a>
1589 </p>
1590 !!end
1592 !! test
1593 <nowiki> inside a link
1594 !! input
1595 [[Main<nowiki> Page</nowiki>]] [[Main Page|the main page <nowiki>[it's not very good]</nowiki>]]
1596 !! result
1597 <p>[[Main Page]] <a href="/wiki/Main_Page" title="Main Page">the main page [it's not very good]</a>
1598 </p>
1599 !! end
1601 !! test
1602 Non-breaking spaces in title
1603 !! input
1604 [[&nbsp; Main &nbsp; Page &nbsp;]]
1605 !! result
1606 <p><a href="/wiki/Main_Page" title="Main Page">&nbsp; Main &nbsp; Page &nbsp;</a>
1607 </p>
1608 !!end
1612 ### Interwiki links (see maintenance/interwiki.sql)
1615 !! test
1616 Inline interwiki link
1617 !! input
1618 [[MeatBall:SoftSecurity]]
1619 !! result
1620 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity</a>
1621 </p>
1622 !! end
1624 !! test
1625 Inline interwiki link with empty title (bug 2372)
1626 !! input
1627 [[MeatBall:]]
1628 !! result
1629 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?" class="extiw" title="meatball:">MeatBall:</a>
1630 </p>
1631 !! end
1633 !! test
1634 Interwiki link encoding conversion (bug 1636)
1635 !! input
1636 *[[Wikipedia:ro:Olteni&#0355;a]]
1637 *[[Wikipedia:ro:Olteni&#355;a]]
1638 !! result
1639 <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>
1640 </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>
1641 </li></ul>
1643 !! end
1645 !! test
1646 Interwiki link with fragment (bug 2130)
1647 !! input
1648 [[MeatBall:SoftSecurity#foo]]
1649 !! result
1650 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity#foo" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity#foo</a>
1651 </p>
1652 !! end
1654 !! test
1655 Interlanguage link
1656 !! input
1657 Blah blah blah
1658 [[zh:Chinese]]
1659 !!result
1660 <p>Blah blah blah
1661 </p>
1662 !! end
1664 !! test
1665 Double interlanguage link
1666 !! input
1667 Blah blah blah
1668 [[es:Spanish]]
1669 [[zh:Chinese]]
1670 !!result
1671 <p>Blah blah blah
1672 </p>
1673 !! end
1675 !! test
1676 Interlanguage link, with prefix links
1677 !! options
1678 language=ln
1679 !! input
1680 Blah blah blah
1681 [[zh:Chinese]]
1682 !!result
1683 <p>Blah blah blah
1684 </p>
1685 !! end
1687 !! test
1688 Double interlanguage link, with prefix links (bug 8897)
1689 !! options
1690 language=ln
1691 !! input
1692 Blah blah blah
1693 [[es:Spanish]]
1694 [[zh:Chinese]]
1695 !!result
1696 <p>Blah blah blah
1697 </p>
1698 !! end
1702 ## XHTML tidiness
1705 !! test
1706 <br> to <br />
1707 !! input
1708 1<br>2<br />3
1709 !! result
1710 <p>1<br />2<br />3
1711 </p>
1712 !! end
1714 !! test
1715 Incorrecly removing closing slashes from correctly formed XHTML
1716 !! input
1717 <br style="clear:both;" />
1718 !! result
1719 <p><br style="clear:both;" />
1720 </p>
1721 !! end
1723 !! test 
1724 Failing to transform badly formed HTML into correct XHTML
1725 !! input
1726 <br clear=left>
1727 <br clear=right>
1728 <br clear=all>
1729 !! result
1730 <p><br clear="left" />
1731 <br clear="right" />
1732 <br clear="all" />
1733 </p>
1734 !!end
1736 !! test 
1737 Horizontal ruler (should it add that extra space?)
1738 !! input 
1739 <hr>
1740 <hr >
1741 foo <hr
1742 > bar
1743 !! result 
1744 <hr />
1745 <hr />
1746 foo <hr /> bar
1748 !! end
1751 ### Block-level elements
1753 !! test
1754 Common list
1755 !! input
1756 *Common list
1757 * item 2
1758 *item 3
1759 !! result
1760 <ul><li>Common list
1761 </li><li> item 2
1762 </li><li>item 3
1763 </li></ul>
1765 !! end
1767 !! test
1768 Numbered list
1769 !! input
1770 #Numbered list
1771 #item 2
1772 # item 3
1773 !! result
1774 <ol><li>Numbered list
1775 </li><li>item 2
1776 </li><li> item 3
1777 </li></ol>
1779 !! end
1781 !! test
1782 Mixed list
1783 !! input
1784 *Mixed list
1785 *# with numbers
1786 ** and bullets
1787 *# and numbers
1788 *bullets again
1789 **bullet level 2
1790 ***bullet level 3
1791 ***#Number on level 4
1792 **bullet level 2
1793 **#Number on level 3
1794 **#Number on level 3
1795 *#number level 2
1796 *Level 1
1797 !! result
1798 <ul><li>Mixed list
1799 <ol><li> with numbers
1800 </li></ol>
1801 <ul><li> and bullets
1802 </li></ul>
1803 <ol><li> and numbers
1804 </li></ol>
1805 </li><li>bullets again
1806 <ul><li>bullet level 2
1807 <ul><li>bullet level 3
1808 <ol><li>Number on level 4
1809 </li></ol>
1810 </li></ul>
1811 </li><li>bullet level 2
1812 <ol><li>Number on level 3
1813 </li><li>Number on level 3
1814 </li></ol>
1815 </li></ul>
1816 <ol><li>number level 2
1817 </li></ol>
1818 </li><li>Level 1
1819 </li></ul>
1821 !! end
1823 !! test
1824 List items are not parsed correctly following a <pre> block (bug 785)
1825 !! input
1826 * <pre>foo</pre>
1827 * <pre>bar</pre>
1828 * zar
1829 !! result
1830 <ul><li> <pre>foo</pre>
1831 </li><li> <pre>bar</pre>
1832 </li><li> zar
1833 </li></ul>
1835 !! end
1838 ### Magic Words
1841 !! test
1842 Magic Word: {{CURRENTDAY}}
1843 !! input
1844 {{CURRENTDAY}}
1845 !! result
1846 <p>1
1847 </p>
1848 !! end
1850 !! test
1851 Magic Word: {{CURRENTDAY2}}
1852 !! input
1853 {{CURRENTDAY2}}
1854 !! result
1855 <p>01
1856 </p>
1857 !! end
1859 !! test
1860 Magic Word: {{CURRENTDAYNAME}}
1861 !! input
1862 {{CURRENTDAYNAME}}
1863 !! result
1864 <p>Thursday
1865 </p>
1866 !! end
1868 !! test
1869 Magic Word: {{CURRENTDOW}}
1870 !! input
1871 {{CURRENTDOW}}
1872 !! result
1873 <p>4
1874 </p>
1875 !! end
1877 !! test
1878 Magic Word: {{CURRENTMONTH}}
1879 !! input
1880 {{CURRENTMONTH}}
1881 !! result
1882 <p>01
1883 </p>
1884 !! end
1886 !! test
1887 Magic Word: {{CURRENTMONTHABBREV}}
1888 !! input
1889 {{CURRENTMONTHABBREV}}
1890 !! result
1891 <p>Jan
1892 </p>
1893 !! end
1895 !! test
1896 Magic Word: {{CURRENTMONTHNAME}}
1897 !! input
1898 {{CURRENTMONTHNAME}}
1899 !! result
1900 <p>January
1901 </p>
1902 !! end
1904 !! test
1905 Magic Word: {{CURRENTMONTHNAMEGEN}}
1906 !! input
1907 {{CURRENTMONTHNAMEGEN}}
1908 !! result
1909 <p>January
1910 </p>
1911 !! end
1913 !! test
1914 Magic Word: {{CURRENTTIME}}
1915 !! input
1916 {{CURRENTTIME}}
1917 !! result
1918 <p>00:02
1919 </p>
1920 !! end
1922 !! test
1923 Magic Word: {{CURRENTWEEK}} (@bug 4594)
1924 !! input
1925 {{CURRENTWEEK}}
1926 !! result
1927 <p>1
1928 </p>
1929 !! end
1931 !! test
1932 Magic Word: {{CURRENTYEAR}}
1933 !! input
1934 {{CURRENTYEAR}}
1935 !! result
1936 <p>1970
1937 </p>
1938 !! end
1940 !! test
1941 Magic Word: {{FULLPAGENAME}}
1942 !! options
1943 title=[[User:Ævar Arnfjörð Bjarmason]]
1944 !! input
1945 {{FULLPAGENAME}}
1946 !! result
1947 <p>User:Ævar Arnfjörð Bjarmason
1948 </p>
1949 !! end
1951 !! test
1952 Magic Word: {{FULLPAGENAMEE}}
1953 !! options
1954 title=[[User:Ævar Arnfjörð Bjarmason]]
1955 !! input
1956 {{FULLPAGENAMEE}}
1957 !! result
1958 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
1959 </p>
1960 !! end
1962 !! test
1963 Magic Word: {{NAMESPACE}}
1964 !! options
1965 title=[[User:Ævar Arnfjörð Bjarmason]]
1966 !! input
1967 {{NAMESPACE}}
1968 !! result
1969 <p>User
1970 </p>
1971 !! end
1973 !! test
1974 Magic Word: {{NAMESPACEE}}
1975 !! options
1976 title=[[User:Ævar Arnfjörð Bjarmason]]
1977 !! input
1978 {{NAMESPACEE}}
1979 !! result
1980 <p>User
1981 </p>
1982 !! end
1984 !! test
1985 Magic Word: {{NUMBEROFARTICLES}}
1986 !! input
1987 {{NUMBEROFARTICLES}}
1988 !! result
1989 <p>2
1990 </p>
1991 !! end
1993 !! test
1994 Magic Word: {{NUMBEROFFILES}}
1995 !! input
1996 {{NUMBEROFFILES}}
1997 !! result
1998 <p>2
1999 </p>
2000 !! end
2002 !! test
2003 Magic Word: {{PAGENAME}}
2004 !! options
2005 title=[[User:Ævar Arnfjörð Bjarmason]]
2006 !! input
2007 {{PAGENAME}}
2008 !! result
2009 <p>Ævar Arnfjörð Bjarmason
2010 </p>
2011 !! end
2013 !! test
2014 Magic Word: {{PAGENAMEE}}
2015 !! options
2016 title=[[User:Ævar Arnfjörð Bjarmason]]
2017 !! input
2018 {{PAGENAMEE}}
2019 !! result
2020 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
2021 </p>
2022 !! end
2024 !! test
2025 Magic Word: {{REVISIONID}}
2026 !! input
2027 {{REVISIONID}}
2028 !! result
2029 <p>1337
2030 </p>
2031 !! end
2033 !! test
2034 Magic Word: {{SCRIPTPATH}}
2035 !! input
2036 {{SCRIPTPATH}}
2037 !! result
2038 <p>/
2039 </p>
2040 !! end
2042 !! test
2043 Magic Word: {{SERVER}}
2044 !! input
2045 {{SERVER}}
2046 !! result
2047 <p><a href="http://localhost" class="external free" rel="nofollow">http://localhost</a>
2048 </p>
2049 !! end
2051 !! test
2052 Magic Word: {{SERVERNAME}}
2053 !! input
2054 {{SERVERNAME}}
2055 !! result
2056 <p>Britney-Spears
2057 </p>
2058 !! end
2060 !! test
2061 Magic Word: {{SITENAME}}
2062 !! input
2063 {{SITENAME}}
2064 !! result
2065 <p>MediaWiki
2066 </p>
2067 !! end
2069 !! test
2070 Namespace 1 {{ns:1}}
2071 !! input
2072 {{ns:1}}
2073 !! result
2074 <p>Talk
2075 </p>
2076 !! end
2078 !! test
2079 Namespace 1 {{ns:01}}
2080 !! input
2081 {{ns:01}}
2082 !! result
2083 <p>Talk
2084 </p>
2085 !! end
2087 !! test
2088 Namespace 0 {{ns:0}} (bug 4783)
2089 !! input
2090 {{ns:0}}
2091 !! result
2093 !! end
2095 !! test
2096 Namespace 0 {{ns:00}} (bug 4783)
2097 !! input
2098 {{ns:00}}
2099 !! result
2101 !! end
2103 !! test
2104 Namespace -1 {{ns:-1}}
2105 !! input
2106 {{ns:-1}}
2107 !! result
2108 <p>Special
2109 </p>
2110 !! end
2112 !! test
2113 Namespace User {{ns:User}}
2114 !! input
2115 {{ns:User}}
2116 !! result
2117 <p>User
2118 </p>
2119 !! end
2121 !! test
2122 Namespace User talk {{ns:User_talk}}
2123 !! input
2124 {{ns:User_talk}}
2125 !! result
2126 <p>User talk
2127 </p>
2128 !! end
2130 !! test
2131 Namespace User talk {{ns:uSeR tAlK}}
2132 !! input
2133 {{ns:uSeR tAlK}}
2134 !! result
2135 <p>User talk
2136 </p>
2137 !! end
2139 !! test
2140 Namespace File {{ns:File}}
2141 !! input
2142 {{ns:File}}
2143 !! result
2144 <p>File
2145 </p>
2146 !! end
2148 !! test
2149 Namespace File {{ns:Image}}
2150 !! input
2151 {{ns:Image}}
2152 !! result
2153 <p>File
2154 </p>
2155 !! end
2157 !! test
2158 Namespace (lang=de) Benutzer {{ns:User}}
2159 !! options
2160 language=de
2161 !! input
2162 {{ns:User}}
2163 !! result
2164 <p>Benutzer
2165 </p>
2166 !! end
2168 !! test
2169 Namespace (lang=de) Benutzer Diskussion {{ns:3}}
2170 !! options
2171 language=de
2172 !! input
2173 {{ns:3}}
2174 !! result
2175 <p>Benutzer Diskussion
2176 </p>
2177 !! end
2181 ### Magic links
2183 !! test
2184 Magic links: internal link to RFC (bug 479)
2185 !! input
2186 [[RFC 123]]
2187 !! result
2188 <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>
2189 </p>
2190 !! end
2192 !! test
2193 Magic links: RFC (bug 479)
2194 !! input
2195 RFC 822
2196 !! result
2197 <p><a href="http://tools.ietf.org/html/rfc822" class="external mw-magiclink-rfc">RFC 822</a>
2198 </p>
2199 !! end
2201 !! test
2202 Magic links: ISBN (bug 1937)
2203 !! input
2204 ISBN 0-306-40615-2
2205 !! result
2206 <p><a href="/wiki/Special:BookSources/0306406152" class="internal mw-magiclink-isbn">ISBN 0-306-40615-2</a>
2207 </p>
2208 !! end
2210 !! test
2211 Magic links: PMID incorrectly converts space to underscore
2212 !! input
2213 PMID 1234
2214 !! result
2215 <p><a href="http://www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract" class="external mw-magiclink-pmid">PMID 1234</a>
2216 </p>
2217 !! end
2220 ### Templates
2221 ####
2223 !! test
2224 Nonexistent template
2225 !! input
2226 {{thistemplatedoesnotexist}}
2227 !! result
2228 <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>
2229 </p>
2230 !! end
2232 !! article
2233 Template:test
2234 !! text
2235 This is a test template
2236 !! endarticle
2238 !! test
2239 Simple template
2240 !! input
2241 {{test}}
2242 !! result
2243 <p>This is a test template
2244 </p>
2245 !! end
2247 !! test
2248 Template with explicit namespace
2249 !! input
2250 {{Template:test}}
2251 !! result
2252 <p>This is a test template
2253 </p>
2254 !! end
2257 !! article
2258 Template:paramtest
2259 !! text
2260 This is a test template with parameter {{{param}}}
2261 !! endarticle
2263 !! test
2264 Template parameter
2265 !! input
2266 {{paramtest|param=foo}}
2267 !! result
2268 <p>This is a test template with parameter foo
2269 </p>
2270 !! end
2272 !! article
2273 Template:paramtestnum
2274 !! text
2275 [[{{{1}}}|{{{2}}}]]
2276 !! endarticle
2278 !! test
2279 Template unnamed parameter
2280 !! input
2281 {{paramtestnum|Main Page|the main page}}
2282 !! result
2283 <p><a href="/wiki/Main_Page" title="Main Page">the main page</a>
2284 </p>
2285 !! end
2287 !! article
2288 Template:templatesimple
2289 !! text
2290 (test)
2291 !! endarticle
2293 !! article
2294 Template:templateredirect
2295 !! text
2296 #redirect [[Template:templatesimple]]
2297 !! endarticle
2299 !! article
2300 Template:templateasargtestnum
2301 !! text
2302 {{{{{1}}}}}
2303 !! endarticle
2305 !! article
2306 Template:templateasargtest
2307 !! text
2308 {{template{{{templ}}}}}
2309 !! endarticle
2311 !! article
2312 Template:templateasargtest2
2313 !! text
2314 {{{{{templ}}}}}
2315 !! endarticle
2317 !! test
2318 Template with template name as unnamed argument
2319 !! input
2320 {{templateasargtestnum|templatesimple}}
2321 !! result
2322 <p>(test)
2323 </p>
2324 !! end
2326 !! test
2327 Template with template name as argument
2328 !! input
2329 {{templateasargtest|templ=simple}}
2330 !! result
2331 <p>(test)
2332 </p>
2333 !! end
2335 !! test
2336 Template with template name as argument (2)
2337 !! input
2338 {{templateasargtest2|templ=templatesimple}}
2339 !! result
2340 <p>(test)
2341 </p>
2342 !! end
2344 !! article
2345 Template:templateasargtestdefault
2346 !! text
2347 {{{{{templ|templatesimple}}}}}
2348 !! endarticle
2350 !! article
2351 Template:templa
2352 !! text
2353 '''templ'''
2354 !! endarticle
2356 !! test
2357 Template with default value
2358 !! input
2359 {{templateasargtestdefault}}
2360 !! result
2361 <p>(test)
2362 </p>
2363 !! end
2365 !! test
2366 Template with default value (value set)
2367 !! input
2368 {{templateasargtestdefault|templ=templa}}
2369 !! result
2370 <p><b>templ</b>
2371 </p>
2372 !! end
2374 !! test
2375 Template redirect
2376 !! input
2377 {{templateredirect}}
2378 !! result
2379 <p>(test)
2380 </p>
2381 !! end
2383 !! test
2384 Template with argument in separate line
2385 !! input
2386 {{ templateasargtest  |
2387  templ = simple }}
2388 !! result
2389 <p>(test)
2390 </p>
2391 !! end
2393 !! test
2394 Template with complex template as argument
2395 !! input
2396 {{paramtest|
2397   param ={{ templateasargtest  |
2398  templ = simple }}}}
2399 !! result
2400 <p>This is a test template with parameter (test)
2401 </p>
2402 !! end
2404 !! test
2405 Template with thumb image (with link in description)
2406 !! input
2407 {{paramtest|
2408   param =[[Image:noimage.png|thumb|[[no link|link]] [[no link|caption]]]]}}
2409 !! result
2410 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>
2412 !! end
2414 !! article
2415 Template:complextemplate
2416 !! text
2417 {{{1}}} {{paramtest|
2418   param ={{{param}}}}}
2419 !! endarticle
2421 !! test
2422 Template with complex arguments
2423 !! input
2424 {{complextemplate|
2425   param ={{ templateasargtest  |
2426  templ = simple }}|[[Template:complextemplate|link]]}}
2427 !! result
2428 <p><a href="/wiki/Template:Complextemplate" title="Template:Complextemplate">link</a> This is a test template with parameter (test)
2429 </p>
2430 !! end
2432 !! test
2433 BUG 553: link with two variables in a piped link
2434 !! input
2435 {| 
2436 |[[{{{1}}}|{{{2}}}]]
2438 !! result
2439 <table>
2440 <tr>
2441 <td>[[{{{1}}}|{{{2}}}]]
2442 </td></tr></table>
2444 !! end
2446 !! test
2447 Magic variable as template parameter
2448 !! input
2449 {{paramtest|param={{SITENAME}}}}
2450 !! result
2451 <p>This is a test template with parameter MediaWiki
2452 </p>
2453 !! end
2455 !! article
2456 Template:linktest
2457 !! text
2458 [[{{{param}}}|link]]
2459 !! endarticle
2461 !! test
2462 Template parameter as link source
2463 !! input
2464 {{linktest|param=Main Page}}
2465 !! result
2466 <p><a href="/wiki/Main_Page" title="Main Page">link</a>
2467 </p>
2468 !! end
2471 !!article
2472 Template:paramtest2
2473 !! text
2474 including another template, {{paramtest|param={{{arg}}}}}
2475 !! endarticle
2477 !! test
2478 Template passing argument to another template
2479 !! input
2480 {{paramtest2|arg='hmm'}}
2481 !! result
2482 <p>including another template, This is a test template with parameter 'hmm'
2483 </p>
2484 !! end
2486 !! article
2487 Template:Linktest2
2488 !! text
2489 Main Page
2490 !! endarticle
2492 !! test
2493 Template as link source
2494 !! input
2495 [[{{linktest2}}]]
2496 !! result
2497 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
2498 </p>
2499 !! end
2502 !! article
2503 Template:loop1
2504 !! text
2505 {{loop2}}
2506 !! endarticle
2508 !! article
2509 Template:loop2
2510 !! text
2511 {{loop1}}
2512 !! endarticle
2514 !! test
2515 Template infinite loop
2516 !! input
2517 {{loop1}}
2518 !! result
2519 <p><span class="error">Template loop detected: <a href="/wiki/Template:Loop1" title="Template:Loop1">Template:Loop1</a></span>
2520 </p>
2521 !! end
2523 !! test
2524 Template from main namespace
2525 !! input
2526 {{:Main Page}}
2527 !! result
2528 <p>blah blah
2529 </p>
2530 !! end
2532 !! article
2533 Template:table
2534 !! text
2535 {| 
2536 | 1 || 2
2537 |- 
2538 | 3 || 4
2540 !! endarticle
2542 !! test
2543 BUG 529: Template with table, not included at beginning of line
2544 !! input
2545 foo {{table}}
2546 !! result
2547 <p>foo 
2548 </p>
2549 <table>
2550 <tr>
2551 <td> 1 </td><td> 2
2552 </td></tr>
2553 <tr>
2554 <td> 3 </td><td> 4
2555 </td></tr></table>
2557 !! end
2559 !! test
2560 BUG 523: Template shouldn't eat newline (or add an extra one before table)
2561 !! input
2563 {{table}}
2564 !! result
2565 <p>foo
2566 </p>
2567 <table>
2568 <tr>
2569 <td> 1 </td><td> 2
2570 </td></tr>
2571 <tr>
2572 <td> 3 </td><td> 4
2573 </td></tr></table>
2575 !! end
2577 !! test
2578 BUG 41: Template parameters shown as broken links
2579 !! input
2580 {{{parameter}}}
2581 !! result
2582 <p>{{{parameter}}}
2583 </p>
2584 !! end
2587 !! article
2588 Template:MSGNW test
2589 !! text
2590 ''None'' of '''this''' should be 
2591 * interepreted
2592  but rather passed unmodified
2593 {{test}}
2594 !! endarticle
2596 # hmm, fix this or just deprecate msgnw and document its behavior?
2597 !! test
2598 msgnw keyword
2599 !! options
2600 disabled
2601 !! input
2602 {{msgnw:MSGNW test}}
2603 !! result
2604 <p>''None'' of '''this''' should be 
2605 * interepreted
2606  but rather passed unmodified
2607 {{test}}
2608 </p>
2609 !! end
2611 !! test
2612 int keyword
2613 !! input
2614 {{int:youhavenewmessages|lots of money|not!}}
2615 !! result
2616 <p>You have lots of money (not!).
2617 </p>
2618 !! end
2620 !! article
2621 Template:Includes
2622 !! text
2623 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
2624 !! endarticle
2626 !! test
2627 <includeonly> and <noinclude> being included
2628 !! input
2629 {{Includes}}
2630 !! result
2631 <p>Foobar
2632 </p>
2633 !! end
2635 !! article
2636 Template:Includes2
2637 !! text
2638 <onlyinclude>Foo</onlyinclude>bar
2639 !! endarticle
2641 !! test
2642 <onlyinclude> being included
2643 !! input
2644 {{Includes2}}
2645 !! result
2646 <p>Foo
2647 </p>
2648 !! end
2651 !! article
2652 Template:Includes3
2653 !! text
2654 <onlyinclude>Foo</onlyinclude>bar<includeonly>zar</includeonly>
2655 !! endarticle
2657 !! test
2658 <onlyinclude> and <includeonly> being included
2659 !! input
2660 {{Includes3}}
2661 !! result
2662 <p>Foo
2663 </p>
2664 !! end
2666 !! test
2667 <includeonly> and <noinclude> on a page
2668 !! input
2669 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
2670 !! result
2671 <p>Foozar
2672 </p>
2673 !! end
2675 !! test
2676 <onlyinclude> on a page
2677 !! input
2678 <onlyinclude>Foo</onlyinclude>bar
2679 !! result
2680 <p>Foobar
2681 </p>
2682 !! end
2684 !! article
2685 Template:Includeonly section
2686 !! text
2687 <includeonly>
2688 ==Includeonly section==
2689 </includeonly>
2690 ==Section T-1==
2691 !!endarticle
2693 !! test
2694 Bug 6563: Edit link generation for section shown by <includeonly>
2695 !! input
2696 {{includeonly section}}
2697 !! result
2698 <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>
2699 <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>
2701 !! end
2703 # Uses same input as the contents of [[Template:Includeonly section]]
2704 !! test
2705 Bug 6563: Section extraction for section shown by <includeonly>
2706 !! options
2707 section=T-2
2708 !! input
2709 <includeonly>
2710 ==Includeonly section==
2711 </includeonly>
2712 ==Section T-2==
2713 !! result
2714 ==Section T-2==
2715 !! end
2717 !! test
2718 Bug 6563: Edit link generation for section suppressed by <includeonly>
2719 !! input
2720 <includeonly>
2721 ==Includeonly section==
2722 </includeonly>
2723 ==Section 1==
2724 !! result
2725 <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>
2727 !! end
2729 !! test
2730 Bug 6563: Section extraction for section suppressed by <includeonly>
2731 !! options
2732 section=1
2733 !! input
2734 <includeonly>
2735 ==Includeonly section==
2736 </includeonly>
2737 ==Section 1==
2738 !! result
2739 ==Section 1==
2740 !! end
2743 ### Pre-save transform tests
2745 !! test
2746 pre-save transform: subst:
2747 !! options
2749 !! input
2750 {{subst:test}}
2751 !! result
2752 This is a test template
2753 !! end
2755 !! test
2756 pre-save transform: normal template
2757 !! options
2759 !! input
2760 {{test}}
2761 !! result
2762 {{test}}
2763 !! end
2765 !! test
2766 pre-save transform: nonexistent template
2767 !! options
2769 !! input
2770 {{thistemplatedoesnotexist}}
2771 !! result
2772 {{thistemplatedoesnotexist}}
2773 !! end
2776 !! test
2777 pre-save transform: subst magic variables
2778 !! options
2780 !! input
2781 {{subst:SITENAME}}
2782 !! result
2783 MediaWiki
2784 !! end
2786 # This is bug 89, which I fixed. -- wtm
2787 !! test
2788 pre-save transform: subst: templates with parameters
2789 !! options
2791 !! input
2792 {{subst:paramtest|param="something else"}}
2793 !! result
2794 This is a test template with parameter "something else"
2795 !! end
2797 !! article
2798 Template:nowikitest
2799 !! text
2800 <nowiki>'''not wiki'''</nowiki>
2801 !! endarticle
2803 !! test
2804 pre-save transform: nowiki in subst (bug 1188)
2805 !! options
2807 !! input
2808 {{subst:nowikitest}}
2809 !! result
2810 <nowiki>'''not wiki'''</nowiki>
2811 !! end
2814 !! article
2815 Template:commenttest
2816 !! text
2817 This template has <!-- a comment --> in it.
2818 !! endarticle
2820 !! test
2821 pre-save transform: comment in subst (bug 1936)
2822 !! options
2824 !! input
2825 {{subst:commenttest}}
2826 !! result
2827 This template has <!-- a comment --> in it.
2828 !! end
2830 !! test
2831 pre-save transform: unclosed tag
2832 !! options
2833 pst noxml
2834 !! input
2835 <nowiki>'''not wiki'''
2836 !! result
2837 <nowiki>'''not wiki'''
2838 !! end
2840 !! test
2841 pre-save transform: mixed tag case
2842 !! options
2843 pst noxml
2844 !! input
2845 <NOwiki>'''not wiki'''</noWIKI>
2846 !! result
2847 <NOwiki>'''not wiki'''</noWIKI>
2848 !! end
2850 !! test
2851 pre-save transform: unclosed comment in <nowiki>
2852 !! options
2853 pst noxml
2854 !! input
2855 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
2856 !! result
2857 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
2858 !!end
2860 !! article
2861 Template:dangerous
2862 !!text
2863 <span onmouseover="alert('crap')">Oh no</span>
2864 !!endarticle
2866 !!test
2867 (confirming safety of fix for subst bug 1936)
2868 !! input
2869 {{Template:dangerous}}
2870 !! result
2871 <p><span>Oh no</span>
2872 </p>
2873 !! end
2875 !! test
2876 pre-save transform: comment containing gallery (bug 5024)
2877 !! options
2879 !! input
2880 <!-- <gallery>data</gallery> -->
2881 !!result
2882 <!-- <gallery>data</gallery> -->
2883 !!end
2885 !! test
2886 pre-save transform: comment containing extension
2887 !! options
2889 !! input
2890 <!-- <tag>data</tag> -->
2891 !!result
2892 <!-- <tag>data</tag> -->
2893 !!end
2895 !! test
2896 pre-save transform: comment containing nowiki
2897 !! options
2899 !! input
2900 <!-- <nowiki>data</nowiki> -->
2901 !!result
2902 <!-- <nowiki>data</nowiki> -->
2903 !!end
2905 !! test
2906 pre-save transform: comment containing math
2907 !! options
2909 !! input
2910 <!-- <math>data</math> -->
2911 !!result
2912 <!-- <math>data</math> -->
2913 !!end
2915 !! test
2916 pre-save transform: <noinclude> in subst (bug 3298)
2917 !! options
2919 !! input
2920 {{subst:Includes}}
2921 !! result
2922 Foobar
2923 !! end
2925 !! test
2926 pre-save transform: <onlyinclude> in subst (bug 3298)
2927 !! options
2929 !! input
2930 {{subst:Includes2}}
2931 !! result
2933 !! end
2935 !! article
2936 Template:SubstTest
2937 !!text
2938 {{<includeonly>subst:</includeonly>Includes}}
2939 !! endarticle
2941 !! article
2942 Template:SafeSubstTest
2943 !! text
2944 {{<includeonly>safesubst:</includeonly>Includes}}
2945 !! endarticle
2947 !! test
2948 bug 22297: safesubst: works during PST
2949 !! options
2951 !! input
2952 {{subst:SafeSubstTest}}{{safesubst:SubstTest}}
2953 !! result
2954 FoobarFoobar
2955 !! end
2957 !! test
2958 bug 22297: safesubst: works during normal parse
2959 !! input
2960 {{SafeSubstTest}}
2961 !! result
2962 <p>Foobar
2963 </p>
2964 !! end
2966 !! test:
2967 subst: does not work during normal parse
2968 !! input
2969 {{SubstTest}}
2970 !! result
2971 <p>{{subst:Includes}}
2972 </p>
2973 !! end
2975 !! test
2976 pre-save transform: context links ("pipe trick")
2977 !! options
2979 !! input
2980 [[Article (context)|]]
2981 [[Bar:Article|]]
2982 [[:Bar:Article|]]
2983 [[Bar:Article (context)|]]
2984 [[:Bar:Article (context)|]]
2985 [[|Article]]
2986 [[|Article (context)]]
2987 [[Bar:X (Y) Z|]]
2988 [[:Bar:X (Y) Z|]]
2989 !! result
2990 [[Article (context)|Article]]
2991 [[Bar:Article|Article]]
2992 [[:Bar:Article|Article]]
2993 [[Bar:Article (context)|Article]]
2994 [[:Bar:Article (context)|Article]]
2995 [[Article]]
2996 [[Article (context)]]
2997 [[Bar:X (Y) Z|X (Y) Z]]
2998 [[:Bar:X (Y) Z|X (Y) Z]]
2999 !! end
3001 !! test
3002 pre-save transform: context links ("pipe trick") with interwiki prefix
3003 !! options
3005 !! input
3006 [[interwiki:Article|]]
3007 [[:interwiki:Article|]]
3008 [[interwiki:Bar:Article|]]
3009 [[:interwiki:Bar:Article|]]
3010 !! result
3011 [[interwiki:Article|Article]]
3012 [[:interwiki:Article|Article]]
3013 [[interwiki:Bar:Article|Bar:Article]]
3014 [[:interwiki:Bar:Article|Bar:Article]]
3015 !! end
3017 !! test
3018 pre-save transform: context links ("pipe trick") with parens in title
3019 !! options
3020 pst title=[[Somearticle (context)]]
3021 !! input
3022 [[|Article]]
3023 !! result
3024 [[Article (context)|Article]]
3025 !! end
3027 !! test
3028 pre-save transform: context links ("pipe trick") with comma in title
3029 !! options
3030 pst title=[[Someplace, Somewhere]]
3031 !! input
3032 [[|Otherplace]]
3033 [[Otherplace, Elsewhere|]]
3034 [[Otherplace, Elsewhere, Anywhere|]]
3035 !! result
3036 [[Otherplace, Somewhere|Otherplace]]
3037 [[Otherplace, Elsewhere|Otherplace]]
3038 [[Otherplace, Elsewhere, Anywhere|Otherplace]]
3039 !! end
3041 !! test
3042 pre-save transform: context links ("pipe trick") with parens and comma
3043 !! options
3044 pst title=[[Someplace (IGNORED), Somewhere]]
3045 !! input
3046 [[|Otherplace]]
3047 [[Otherplace (place), Elsewhere|]]
3048 !! result
3049 [[Otherplace, Somewhere|Otherplace]]
3050 [[Otherplace (place), Elsewhere|Otherplace]]
3051 !! end
3053 !! test
3054 pre-save transform: context links ("pipe trick") with comma and parens
3055 !! options
3056 pst title=[[Who, me? (context)]]
3057 !! input
3058 [[|Yes, you.]]
3059 [[Me, Myself, and I (1937 song)|]]
3060 !! result
3061 [[Yes, you. (context)|Yes, you.]]
3062 [[Me, Myself, and I (1937 song)|Me, Myself, and I]]
3063 !! end
3065 !! test
3066 pre-save transform: context links ("pipe trick") with namespace
3067 !! options
3068 pst title=[[Ns:Somearticle]]
3069 !! input
3070 [[|Article]]
3071 !! result
3072 [[Ns:Article|Article]]
3073 !! end
3075 !! test
3076 pre-save transform: context links ("pipe trick") with namespace and parens
3077 !! options
3078 pst title=[[Ns:Somearticle (context)]]
3079 !! input
3080 [[|Article]]
3081 !! result
3082 [[Ns:Article (context)|Article]]
3083 !! end
3085 !! test
3086 pre-save transform: context links ("pipe trick") with namespace and comma
3087 !! options
3088 pst title=[[Ns:Somearticle, Context, Whatever]]
3089 !! input
3090 [[|Article]]
3091 !! result
3092 [[Ns:Article, Context, Whatever|Article]]
3093 !! end
3095 !! test
3096 pre-save transform: context links ("pipe trick") with namespace, comma and parens
3097 !! options
3098 pst title=[[Ns:Somearticle, Context (context)]]
3099 !! input
3100 [[|Article]]
3101 !! result
3102 [[Ns:Article (context)|Article]]
3103 !! end
3105 !! test
3106 pre-save transform: context links ("pipe trick") with namespace, parens and comma
3107 !! options
3108 pst title=[[Ns:Somearticle (IGNORED), Context]]
3109 !! input
3110 [[|Article]]
3111 !! result
3112 [[Ns:Article, Context|Article]]
3113 !! end
3117 ### Message transform tests
3119 !! test
3120 message transform: magic variables
3121 !! options
3123 !! input
3124 {{SITENAME}}
3125 !! result
3126 MediaWiki
3127 !! end
3129 !! test
3130 message transform: should not transform wiki markup
3131 !! options
3133 !! input
3134 ''test''
3135 !! result
3136 ''test''
3137 !! end
3139 !! test
3140 message transform: <noinclude> in transcluded template (bug 4926)
3141 !! options
3143 !! input
3144 {{Includes}}
3145 !! result
3146 Foobar
3147 !! end
3149 !! test
3150 message transform: <onlyinclude> in transcluded template (bug 4926)
3151 !! options
3153 !! input
3154 {{Includes2}}
3155 !! result
3157 !! end
3159 !! test
3160 {{#special:}} page name, known
3161 !! options
3163 !! input
3164 {{#special:Recentchanges}}
3165 !! result
3166 Special:RecentChanges
3167 !! end
3169 !! test
3170 {{#special:}} page name with subpage, known
3171 !! options
3173 !! input
3174 {{#special:Recentchanges/param}}
3175 !! result
3176 Special:RecentChanges/param
3177 !! end
3179 !! test
3180 {{#special:}} page name, unknown
3181 !! options
3183 !! input
3184 {{#special:foobarnonexistent}}
3185 !! result
3186 No such special page
3187 !! end
3190 ### Images
3192 !! test
3193 Simple image
3194 !! input
3195 [[Image:foobar.jpg]]
3196 !! result
3197 <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>
3198 </p>
3199 !! end
3201 !! test
3202 Right-aligned image
3203 !! input
3204 [[Image:foobar.jpg|right]]
3205 !! result
3206 <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>
3208 !! end
3210 !! test
3211 Simple image (using File: namespace, now canonical)
3212 !! input
3213 [[File:foobar.jpg]]
3214 !! result
3215 <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>
3216 </p>
3217 !! end
3219 !! test
3220 Image with caption
3221 !! input
3222 [[Image:foobar.jpg|right|Caption text]]
3223 !! result
3224 <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>
3226 !! end
3228 !! test
3229 Image with link parameter, wiki target
3230 !! input
3231 [[Image:foobar.jpg|link=Target page]]
3232 !! result
3233 <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>
3234 </p>
3235 !! end
3237 !! test
3238 Image with link parameter, URL target
3239 !! input
3240 [[Image:foobar.jpg|link=http://example.com/]]
3241 !! result
3242 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
3243 </p>
3244 !! end
3246 !! test
3247 Image with empty link parameter
3248 !! input
3249 [[Image:foobar.jpg|link=]]
3250 !! result
3251 <p><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" />
3252 </p>
3253 !! end
3255 !! test
3256 Image with link parameter (wiki target) and unnamed parameter
3257 !! input
3258 [[Image:foobar.jpg|link=Target page|Title]]
3259 !! result
3260 <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>
3261 </p>
3262 !! end
3264 !! test
3265 Image with link parameter (URL target) and unnamed parameter
3266 !! input
3267 [[Image:foobar.jpg|link=http://example.com/|Title]]
3268 !! result
3269 <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>
3270 </p>
3271 !! end
3275 !! test
3276 Image with frame and link
3277 !! input
3278 [[Image:Foobar.jpg|frame|left|This is a test image [[Main Page]]]]
3279 !! result
3280 <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>
3282 !! end
3284 !! test
3285 Image with frame and link and explicit alt
3286 !! input
3287 [[Image:Foobar.jpg|frame|left|This is a test image [[Main Page]]|alt=Altitude]]
3288 !! result
3289 <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>
3291 !! end
3293 !! test
3294 Image with wiki markup in implicit alt
3295 !! input
3296 [[Image:Foobar.jpg|testing '''bold''' in alt]]
3297 !! result
3298 <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>
3299 </p>
3300 !! end
3302 !! test
3303 Image with wiki markup in explicit alt
3304 !! input
3305 [[Image:Foobar.jpg|alt=testing '''bold''' in alt]]
3306 !! result
3307 <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>
3308 </p>
3309 !! end
3311 !! test
3312 Link to image page- image page normally doesn't exists, hence edit link
3313 Add test with existing image page
3314 #<p><a href="/wiki/File:Test" title="Image:Test">Image:test</a>
3315 !! input
3316 [[:Image:test]]
3317 !! result
3318 <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>
3319 </p>
3320 !! end
3322 !! test
3323 bug 18784  Link to non-existent image page with caption should use caption as link text
3324 !! input
3325 [[:Image:test|caption]]
3326 !! result
3327 <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>
3328 </p>
3329 !! end
3331 !! test
3332 Frameless image caption with a free URL
3333 !! input
3334 [[Image:foobar.jpg|http://example.com]]
3335 !! result
3336 <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>
3337 </p>
3338 !! end
3340 !! test
3341 Thumbnail image caption with a free URL
3342 !! input
3343 [[Image:foobar.jpg|thumb|http://example.com]]
3344 !! result
3345 <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>
3347 !! end
3349 !! test
3350 Thumbnail image caption with a free URL and explicit alt
3351 !! input
3352 [[Image:foobar.jpg|thumb|http://example.com|alt=Alteration]]
3353 !! result
3354 <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>
3356 !! end
3358 !! test
3359 BUG 1887: A ISBN with a thumbnail
3360 !! input
3361 [[Image:foobar.jpg|thumb|ISBN 1235467890]]
3362 !! result
3363 <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>
3365 !! end
3367 !! test
3368 BUG 1887: A RFC with a thumbnail
3369 !! input
3370 [[Image:foobar.jpg|thumb|This is RFC 12354]]
3371 !! result
3372 <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>
3374 !! end
3376 !! test
3377 BUG 1887: A mailto link with a thumbnail
3378 !! input
3379 [[Image:foobar.jpg|thumb|Please mailto:nobody@example.com]]
3380 !! result
3381 <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>
3383 !! end
3385 !! test
3386 BUG 1887: A <math> with a thumbnail- we don't render math in the parsertests by default,
3387 so math is not stripped and turns up as escaped &lt;math&gt; tags.
3388 !! input
3389 [[Image:foobar.jpg|thumb|<math>2+2</math>]]
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>&lt;math&gt;2+2&lt;/math&gt;</div></div></div>
3393 !! end
3395 !! test
3396 BUG 1887, part 2: A <math> with a thumbnail- math enabled
3397 !! options
3398 math
3399 !! input
3400 [[Image:foobar.jpg|thumb|<math>2+2</math>]]
3401 !! result
3402 <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>
3404 !! end
3406 # Pending resolution to bug 368
3407 !! test
3408 BUG 648: Frameless image caption with a link
3409 !! input
3410 [[Image:foobar.jpg|text with a [[link]] in it]]
3411 !! result
3412 <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>
3413 </p>
3414 !! end
3416 !! test
3417 BUG 648: Frameless image caption with a link (suffix)
3418 !! input
3419 [[Image:foobar.jpg|text with a [[link]]foo in it]]
3420 !! result
3421 <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>
3422 </p>
3423 !! end
3425 !! test
3426 BUG 648: Frameless image caption with an interwiki link
3427 !! input
3428 [[Image:foobar.jpg|text with a [[MeatBall:Link]] in it]]
3429 !! result
3430 <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>
3431 </p>
3432 !! end
3434 !! test
3435 BUG 648: Frameless image caption with a piped interwiki link
3436 !! input
3437 [[Image:foobar.jpg|text with a [[MeatBall:Link|link]] in it]]
3438 !! result
3439 <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>
3440 </p>
3441 !! end
3443 !! test
3444 Escape HTML special chars in image alt text
3445 !! input
3446 [[Image:foobar.jpg|& < > "]]
3447 !! result
3448 <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>
3449 </p>
3450 !! end
3452 !! test
3453 BUG 499: Alt text should have &#1234;, not &amp;1234;
3454 !! input
3455 [[Image:foobar.jpg|&#9792;]]
3456 !! result
3457 <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>
3458 </p>
3459 !! end
3461 !! test
3462 Broken image caption with link
3463 !! input
3464 [[Image:Foobar.jpg|thumb|This is a broken caption. But [[Main Page|this]] is just an ordinary link.
3465 !! result
3466 <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.
3467 </p>
3468 !! end
3470 !! test
3471 Image caption containing another image
3472 !! input
3473 [[Image:Foobar.jpg|thumb|This is a caption with another [[Image:icon.png|image]] inside it!]]
3474 !! result
3475 <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>
3477 !! end
3479 !! test
3480 Image caption containing a newline
3481 !! input
3482 [[Image:Foobar.jpg|This
3483 *is some text]]
3484 !! result
3485 <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>
3486 </p>
3487 !!end
3490 !! test
3491 Bug 3090: External links other than http: in image captions
3492 !! input
3493 [[Image:Foobar.jpg|thumb|200px|This caption has [irc://example.net irc] and [https://example.com Secure] ext links in it.]]
3494 !! result
3495 <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>
3497 !! end
3501 ### Subpages
3503 !! article
3504 Subpage test/subpage
3505 !! text
3507 !! endarticle
3509 !! test
3510 Subpage link
3511 !! options
3512 subpage title=[[Subpage test]]
3513 !! input
3514 [[/subpage]]
3515 !! result
3516 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a>
3517 </p>
3518 !! end
3520 !! test
3521 Subpage noslash link
3522 !! options
3523 subpage title=[[Subpage test]]
3524 !!input
3525 [[/subpage/]]
3526 !! result
3527 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">subpage</a>
3528 </p>
3529 !! end
3531 !! test
3532 Disabled subpages
3533 !! input
3534 [[/subpage]]
3535 !! result
3536 <p><a href="/index.php?title=/subpage&amp;action=edit&amp;redlink=1" class="new" title="/subpage (page does not exist)">/subpage</a>
3537 </p>
3538 !! end
3540 !! test
3541 BUG 561: {{/Subpage}}
3542 !! options
3543 subpage title=[[Page]]
3544 !! input
3545 {{/Subpage}}
3546 !! result
3547 <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>
3548 </p>
3549 !! end
3552 ### Categories
3554 !! article
3555 Category:MediaWiki User's Guide
3556 !! text
3557 blah
3558 !! endarticle
3560 !! test
3561 Link to category
3562 !! input
3563 [[:Category:MediaWiki User's Guide]]
3564 !! result
3565 <p><a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">Category:MediaWiki User's Guide</a>
3566 </p>
3567 !! end
3569 !! test
3570 Simple category
3571 !! options
3573 !! input
3574 [[Category:MediaWiki User's Guide]]
3575 !! result
3576 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
3577 !! end
3579 !! test
3580 PAGESINCATEGORY invalid title fatal (r33546 fix)
3581 !! input
3582 {{PAGESINCATEGORY:<bogus>}}
3583 !! result
3584 <p>0
3585 </p>
3586 !! end
3589 ### Inter-language links
3591 !! test
3592 Inter-language links
3593 !! options
3595 !! input
3596 [[es:Alimento]]
3597 [[fr:Nourriture]]
3598 [[zh:&#39135;&#21697;]]
3599 !! result
3600 es:Alimento fr:Nourriture zh:食品
3601 !! end
3604 ### Sections
3606 !! test
3607 Basic section headings
3608 !! input
3609 == Headline 1 ==
3610 Some text
3612 ==Headline 2==
3613 More
3614 ===Smaller headline===
3615 Blah blah
3616 !! result
3617 <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>
3618 <p>Some text
3619 </p>
3620 <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>
3621 <p>More
3622 </p>
3623 <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>
3624 <p>Blah blah
3625 </p>
3626 !! end
3628 !! test
3629 Section headings with TOC
3630 !! input
3631 == Headline 1 ==
3632 === Subheadline 1 ===
3633 ===== Skipping a level =====
3634 ====== Skipping a level ======
3636 == Headline 2 ==
3637 Some text
3638 ===Another headline===
3639 !! result
3640 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
3641 <ul>
3642 <li class="toclevel-1 tocsection-1"><a href="#Headline_1"><span class="tocnumber">1</span> <span class="toctext">Headline 1</span></a>
3643 <ul>
3644 <li class="toclevel-2 tocsection-2"><a href="#Subheadline_1"><span class="tocnumber">1.1</span> <span class="toctext">Subheadline 1</span></a>
3645 <ul>
3646 <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>
3647 <ul>
3648 <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>
3649 </ul>
3650 </li>
3651 </ul>
3652 </li>
3653 </ul>
3654 </li>
3655 <li class="toclevel-1 tocsection-5"><a href="#Headline_2"><span class="tocnumber">2</span> <span class="toctext">Headline 2</span></a>
3656 <ul>
3657 <li class="toclevel-2 tocsection-6"><a href="#Another_headline"><span class="tocnumber">2.1</span> <span class="toctext">Another headline</span></a></li>
3658 </ul>
3659 </li>
3660 </ul>
3661 </td></tr></table><script>if (window.showTocToggle) { var tocShowText = "show"; var tocHideText = "hide"; showTocToggle(); } </script>
3662 <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>
3663 <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>
3664 <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>
3665 <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>
3666 <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>
3667 <p>Some text
3668 </p>
3669 <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>
3671 !! end
3673 # perl -e 'print "="x$_," Level $_ heading","="x$_,"\n" for 1..10'
3674 !! test
3675 Handling of sections up to level 6 and beyond
3676 !! input 
3677 = Level 1 Heading=
3678 == Level 2 Heading==
3679 === Level 3 Heading===
3680 ==== Level 4 Heading====
3681 ===== Level 5 Heading=====
3682 ====== Level 6 Heading======
3683 ======= Level 7 Heading=======
3684 ======== Level 8 Heading========
3685 ========= Level 9 Heading=========
3686 ========== Level 10 Heading==========
3687 !! result
3688 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
3689 <ul>
3690 <li class="toclevel-1 tocsection-1"><a href="#Level_1_Heading"><span class="tocnumber">1</span> <span class="toctext">Level 1 Heading</span></a>
3691 <ul>
3692 <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>
3693 <ul>
3694 <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>
3695 <ul>
3696 <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>
3697 <ul>
3698 <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>
3699 <ul>
3700 <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>
3701 <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>
3702 <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>
3703 <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>
3704 <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>
3705 </ul>
3706 </li>
3707 </ul>
3708 </li>
3709 </ul>
3710 </li>
3711 </ul>
3712 </li>
3713 </ul>
3714 </li>
3715 </ul>
3716 </td></tr></table><script>if (window.showTocToggle) { var tocShowText = "show"; var tocHideText = "hide"; showTocToggle(); } </script>
3717 <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>
3718 <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>
3719 <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>
3720 <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>
3721 <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>
3722 <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>
3723 <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>
3724 <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>
3725 <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>
3726 <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>
3728 !! end
3730 !! test
3731 TOC regression (bug 9764)
3732 !! input
3733 == title 1 ==
3734 === title 1.1 ===
3735 ==== title 1.1.1 ====
3736 === title 1.2 ===
3737 == title 2 ==
3738 === title 2.1 ===
3739 !! result
3740 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
3741 <ul>
3742 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
3743 <ul>
3744 <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>
3745 <ul>
3746 <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>
3747 </ul>
3748 </li>
3749 <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>
3750 </ul>
3751 </li>
3752 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
3753 <ul>
3754 <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>
3755 </ul>
3756 </li>
3757 </ul>
3758 </td></tr></table><script>if (window.showTocToggle) { var tocShowText = "show"; var tocHideText = "hide"; showTocToggle(); } </script>
3759 <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>
3760 <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>
3761 <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>
3762 <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>
3763 <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>
3764 <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>
3766 !! end
3768 !! test
3769 TOC with wgMaxTocLevel=3 (bug 6204)
3770 !! options
3771 wgMaxTocLevel=3
3772 !! input
3773 == title 1 ==
3774 === title 1.1 ===
3775 ==== title 1.1.1 ====
3776 === title 1.2 ===
3777 == title 2 ==
3778 === title 2.1 ===
3779 !! result
3780 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
3781 <ul>
3782 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
3783 <ul>
3784 <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>
3785 <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>
3786 </ul>
3787 </li>
3788 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
3789 <ul>
3790 <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>
3791 </ul>
3792 </li>
3793 </ul>
3794 </td></tr></table><script>if (window.showTocToggle) { var tocShowText = "show"; var tocHideText = "hide"; showTocToggle(); } </script>
3795 <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>
3796 <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>
3797 <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>
3798 <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>
3799 <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>
3800 <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>
3802 !! end
3804 !! test
3805 Resolving duplicate section names
3806 !! input
3807 == Foo bar ==
3808 == Foo bar ==
3809 !! result
3810 <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>
3811 <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>
3813 !! end
3815 !! test
3816 Resolving duplicate section names with differing case (bug 10721)
3817 !! input
3818 == Foo bar ==
3819 == Foo Bar ==
3820 !! result
3821 <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>
3822 <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>
3824 !! end
3826 !! article
3827 Template:sections
3828 !! text
3829 ===Section 1===
3830 ==Section 2==
3831 !! endarticle
3833 !! test
3834 Template with sections, __NOTOC__
3835 !! input
3836 __NOTOC__
3837 ==Section 0==
3838 {{sections}}
3839 ==Section 4==
3840 !! result
3841 <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>
3842 <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>
3843 <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>
3844 <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>
3846 !! end
3848 !! test
3849 __NOEDITSECTION__ keyword
3850 !! input
3851 __NOEDITSECTION__
3852 ==Section 1==
3853 ==Section 2==
3854 !! result
3855 <h2> <span class="mw-headline" id="Section_1">Section 1</span></h2>
3856 <h2> <span class="mw-headline" id="Section_2">Section 2</span></h2>
3858 !! end
3860 !! test
3861 Link inside a section heading
3862 !! input
3863 ==Section with a [[Main Page|link]] in it==
3864 !! result
3865 <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>
3867 !! end
3869 !! test
3870 TOC regression (bug 12077)
3871 !! input
3872 __TOC__
3873 == title 1 ==
3874 === title 1.1 ===
3875 == title 2 ==
3876 !! result
3877 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
3878 <ul>
3879 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
3880 <ul>
3881 <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>
3882 </ul>
3883 </li>
3884 <li class="toclevel-1 tocsection-3"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a></li>
3885 </ul>
3886 </td></tr></table><script>if (window.showTocToggle) { var tocShowText = "show"; var tocHideText = "hide"; showTocToggle(); } </script>
3887 <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>
3888 <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>
3889 <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>
3891 !! end
3893 !! test
3894 BUG 1219 URL next to image (good)
3895 !! input
3896 http://example.com [[Image:foobar.jpg]]
3897 !! result
3898 <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>
3899 </p>
3900 !!end
3902 !! test
3903 BUG 1219 URL next to image (broken)
3904 !! input
3905 http://example.com[[Image:foobar.jpg]]
3906 !! result
3907 <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>
3908 </p>
3909 !!end
3911 !! test
3912 Bug 1186 news: in the middle of text
3913 !! input
3914 http://en.wikinews.org/wiki/Wikinews:Workplace
3915 !! result
3916 <p><a href="http://en.wikinews.org/wiki/Wikinews:Workplace" class="external free" rel="nofollow">http://en.wikinews.org/wiki/Wikinews:Workplace</a>
3917 </p>
3918 !!end
3921 !! test
3922 Namespaced link must have a title
3923 !! input
3924 [[Project:]]
3925 !! result
3926 <p>[[Project:]]
3927 </p>
3928 !!end
3930 !! test
3931 Namespaced link must have a title (bad fragment version)
3932 !! input
3933 [[Project:#fragment]]
3934 !! result
3935 <p>[[Project:#fragment]]
3936 </p>
3937 !!end
3940 !! test
3941 div with no attributes
3942 !! input
3943 <div>HTML rocks</div>
3944 !! result
3945 <div>HTML rocks</div>
3947 !! end
3949 !! test
3950 div with double-quoted attribute
3951 !! input
3952 <div id="rock">HTML rocks</div>
3953 !! result
3954 <div id="rock">HTML rocks</div>
3956 !! end
3958 !! test
3959 div with single-quoted attribute
3960 !! input
3961 <div id='rock'>HTML rocks</div>
3962 !! result
3963 <div id="rock">HTML rocks</div>
3965 !! end
3967 !! test
3968 div with unquoted attribute
3969 !! input
3970 <div id=rock>HTML rocks</div>
3971 !! result
3972 <div id="rock">HTML rocks</div>
3974 !! end
3976 !! test
3977 div with illegal double attributes
3978 !! input
3979 <div align="center" align="right">HTML rocks</div>
3980 !! result
3981 <div align="right">HTML rocks</div>
3983 !!end
3985 !! test
3986 HTML multiple attributes correction
3987 !! input
3988 <p class="error" class="awesome">Awesome!</p>
3989 !! result
3990 <p class="awesome">Awesome!</p>
3992 !!end
3994 !! test
3995 Table multiple attributes correction
3996 !! input
3998 !+ class="error" class="awesome"| status
4000 !! result
4001 <table>
4002 <tr>
4003 <th class="awesome"> status
4004 </th></tr></table>
4006 !!end
4008 !! test
4009 DIV IN UPPERCASE
4010 !! input
4011 <DIV ALIGN="center">HTML ROCKS</DIV>
4012 !! result
4013 <div align="center">HTML ROCKS</div>
4015 !!end
4018 !! test
4019 text with amp in the middle of nowhere
4020 !! input
4021 Remember AT&T?
4022 !!result
4023 <p>Remember AT&amp;T?
4024 </p>
4025 !! end
4027 !! test
4028 text with character entity: eacute
4029 !! input
4030 I always thought &eacute; was a cute letter.
4031 !! result
4032 <p>I always thought &eacute; was a cute letter.
4033 </p>
4034 !! end
4036 !! test
4037 text with undefined character entity: xacute
4038 !! input
4039 I always thought &xacute; was a cute letter.
4040 !! result
4041 <p>I always thought &amp;xacute; was a cute letter.
4042 </p>
4043 !! end
4047 ### Media links
4050 !! test
4051 Media link
4052 !! input
4053 [[Media:Foobar.jpg]]
4054 !! result
4055 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Media:Foobar.jpg</a>
4056 </p>
4057 !! end
4059 !! test
4060 Media link with text
4061 !! input
4062 [[Media:Foobar.jpg|A neat file to look at]]
4063 !! result
4064 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">A neat file to look at</a>
4065 </p>
4066 !! end
4068 # FIXME: this is still bad HTML tag nesting
4069 !! test
4070 Media link with nasty text
4071 fixme: doBlockLevels won't wrap this in a paragraph because it contains a div
4072 !! input
4073 [[Media:Foobar.jpg|Safe Link<div style=display:none>" onmouseover="alert(document.cookie)" onfoo="</div>]]
4074 !! result
4075 <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>
4077 !! end
4079 !! test
4080 Media link to nonexistent file (bug 1702)
4081 !! input
4082 [[Media:No such.jpg]]
4083 !! result
4084 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=No_such.jpg" class="new" title="No such.jpg">Media:No such.jpg</a>
4085 </p>
4086 !! end
4088 !! test
4089 Image link to nonexistent file (bug 1850 - good)
4090 !! input
4091 [[Image:No such.jpg]]
4092 !! result
4093 <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>
4094 </p>
4095 !! end
4097 !! test
4098 :Image link to nonexistent file (bug 1850 - bad)
4099 !! input
4100 [[:Image:No such.jpg]]
4101 !! result
4102 <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>
4103 </p>
4104 !! end
4108 !! test
4109 Character reference normalization in link text (bug 1938)
4110 !! input
4111 [[Main Page|this&that]]
4112 !! result
4113 <p><a href="/wiki/Main_Page" title="Main Page">this&amp;that</a>
4114 </p>
4115 !!end
4117 !! article
4118 אַ
4119 !! text
4120 Test for unicode normalization
4122 The page's name is U+05d0 U+05b7, with non-canonical form U+FB2E
4123 !! endarticle
4125 !! test
4126 (bug 19451) Links should refer to the normalized form.
4127 !! input
4128 [[&#xFB2E;]]
4129 [[&#x5d0;&#x5b7;]]
4130 [[&#x5d0;ַ]]
4131 [[א&#x5b7;]]
4132 [[אַ]]
4133 !! result
4134 <p><a href="/wiki/%D7%90%D6%B7" title="אַ">&#xfb2e;</a>
4135 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;&#x5b7;</a>
4136 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;ַ</a>
4137 <a href="/wiki/%D7%90%D6%B7" title="אַ">א&#x5b7;</a>
4138 <a href="/wiki/%D7%90%D6%B7" title="אַ">אַ</a>
4139 </p>
4140 !! end
4142 !! test
4143 Empty attribute crash test (bug 2067)
4144 !! input
4145 <font color="">foo</font>
4146 !! result
4147 <p><font color="">foo</font>
4148 </p>
4149 !! end
4151 !! test
4152 Empty attribute crash test single-quotes (bug 2067)
4153 !! input
4154 <font color=''>foo</font>
4155 !! result
4156 <p><font color="">foo</font>
4157 </p>
4158 !! end
4160 !! test
4161 Attribute test: equals, then nothing
4162 !! input
4163 <font color=>foo</font>
4164 !! result
4165 <p><font>foo</font>
4166 </p>
4167 !! end
4169 !! test
4170 Attribute test: unquoted value
4171 !! input
4172 <font color=x>foo</font>
4173 !! result
4174 <p><font color="x">foo</font>
4175 </p>
4176 !! end
4178 !! test
4179 Attribute test: unquoted but illegal value (hash)
4180 !! input
4181 <font color=#x>foo</font>
4182 !! result
4183 <p><font color="#x">foo</font>
4184 </p>
4185 !! end
4187 !! test
4188 Attribute test: no value
4189 !! input
4190 <font color>foo</font>
4191 !! result
4192 <p><font color="color">foo</font>
4193 </p>
4194 !! end
4196 !! test
4197 Bug 2095: link with three closing brackets
4198 !! input
4199 [[Main Page]]]
4200 !! result
4201 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>]
4202 </p>
4203 !! end
4205 !! test
4206 Bug 2095: link with pipe and three closing brackets
4207 !! input
4208 [[Main Page|link]]]
4209 !! result
4210 <p><a href="/wiki/Main_Page" title="Main Page">link</a>]
4211 </p>
4212 !! end
4214 !! test
4215 Bug 2095: link with pipe and three closing brackets, version 2
4216 !! input
4217 [[Main Page|[http://example.com/]]]
4218 !! result
4219 <p><a href="/wiki/Main_Page" title="Main Page">[http://example.com/]</a>
4220 </p>
4221 !! end
4225 ### Safety
4228 !! article
4229 Template:Dangerous attribute
4230 !! text
4231 " onmouseover="alert(document.cookie)
4232 !! endarticle
4234 !! article
4235 Template:Dangerous style attribute
4236 !! text
4237 border-size: expression(alert(document.cookie))
4238 !! endarticle
4240 !! article
4241 Template:Div style
4242 !! text
4243 <div style="float: right; {{{1}}}">Magic div</div>
4244 !! endarticle
4246 !! test
4247 Bug 2304: HTML attribute safety (safe template; regression bug 2309)
4248 !! input
4249 <div title="{{test}}"></div>
4250 !! result
4251 <div title="This is a test template"></div>
4253 !! end
4255 !! test
4256 Bug 2304: HTML attribute safety (dangerous template; 2309)
4257 !! input
4258 <div title="{{dangerous attribute}}"></div>
4259 !! result
4260 <div title=""></div>
4262 !! end
4264 !! test
4265 Bug 2304: HTML attribute safety (dangerous style template; 2309)
4266 !! input
4267 <div style="{{dangerous style attribute}}"></div>
4268 !! result
4269 <div></div>
4271 !! end
4273 !! test
4274 Bug 2304: HTML attribute safety (safe parameter; 2309)
4275 !! input
4276 {{div style|width: 200px}}
4277 !! result
4278 <div style="float: right; width: 200px">Magic div</div>
4280 !! end
4282 !! test
4283 Bug 2304: HTML attribute safety (unsafe parameter; 2309)
4284 !! input
4285 {{div style|width: expression(alert(document.cookie))}}
4286 !! result
4287 <div>Magic div</div>
4289 !! end
4291 !! test
4292 Bug 2304: HTML attribute safety (unsafe breakout parameter; 2309)
4293 !! input
4294 {{div style|"><script>alert(document.cookie)</script>}}
4295 !! result
4296 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
4298 !! end
4300 !! test
4301 Bug 2304: HTML attribute safety (unsafe breakout parameter 2; 2309)
4302 !! input
4303 {{div style|" ><script>alert(document.cookie)</script>}}
4304 !! result
4305 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
4307 !! end
4309 !! test
4310 Bug 2304: HTML attribute safety (link)
4311 !! input
4312 <div title="[[Main Page]]"></div>
4313 !! result
4314 <div title="&#91;&#91;Main Page]]"></div>
4316 !! end
4318 !! test
4319 Bug 2304: HTML attribute safety (italics)
4320 !! input
4321 <div title="''foobar''"></div>
4322 !! result
4323 <div title="&#39;&#39;foobar&#39;&#39;"></div>
4325 !! end
4327 !! test
4328 Bug 2304: HTML attribute safety (bold)
4329 !! input
4330 <div title="'''foobar'''"></div>
4331 !! result
4332 <div title="&#39;&#39;&#39;foobar&#39;&#39;&#39;"></div>
4334 !! end
4337 !! test
4338 Bug 2304: HTML attribute safety (ISBN)
4339 !! input
4340 <div title="ISBN 1234567890"></div>
4341 !! result
4342 <div title="&#73;SBN 1234567890"></div>
4344 !! end
4346 !! test
4347 Bug 2304: HTML attribute safety (RFC)
4348 !! input
4349 <div title="RFC 1234"></div>
4350 !! result
4351 <div title="&#82;FC 1234"></div>
4353 !! end
4355 !! test
4356 Bug 2304: HTML attribute safety (PMID)
4357 !! input
4358 <div title="PMID 1234567890"></div>
4359 !! result
4360 <div title="&#80;MID 1234567890"></div>
4362 !! end
4364 !! test
4365 Bug 2304: HTML attribute safety (web link)
4366 !! input
4367 <div title="http://example.com/"></div>
4368 !! result
4369 <div title="http&#58;//example.com/"></div>
4371 !! end
4373 !! test
4374 Bug 2304: HTML attribute safety (named web link)
4375 !! input
4376 <div title="[http://example.com/ link]"></div>
4377 !! result
4378 <div title="&#91;http&#58;//example.com/ link]"></div>
4380 !! end
4382 !! test
4383 Bug 3244: HTML attribute safety (extension; safe)
4384 !! input
4385 <div style="<nowiki>background:blue</nowiki>"></div>
4386 !! result
4387 <div style="background:blue"></div>
4389 !! end
4391 !! test
4392 Bug 3244: HTML attribute safety (extension; unsafe)
4393 !! input
4394 <div style="<nowiki>border-left:expression(alert(document.cookie))</nowiki>"></div>
4395 !! result
4396 <div></div>
4398 !! end
4400 !! test
4401 Math section safety when disabled
4402 !! input
4403 <math><script>alert(document.cookies);</script></math>
4404 !! result
4405 <p>&lt;math&gt;&lt;script&gt;alert(document.cookies);&lt;/script&gt;&lt;/math&gt;
4406 </p>
4407 !! end
4409 # More MSIE fun discovered by Tom Gilder
4411 !! test
4412 MSIE CSS safety test: spurious slash
4413 !! input
4414 <div style="background-image:u\rl(javascript:alert('boo'))">evil</div>
4415 !! result
4416 <div>evil</div>
4418 !! end
4420 !! test
4421 MSIE CSS safety test: hex code
4422 !! input
4423 <div style="background-image:u\72l(javascript:alert('boo'))">evil</div>
4424 !! result
4425 <div>evil</div>
4427 !! end
4429 !! test
4430 MSIE CSS safety test: comment in url
4431 !! input
4432 <div style="background-image:u/**/rl(javascript:alert('boo'))">evil</div>
4433 !! result
4434 <div style="background-image:u rl(javascript:alert(&#39;boo&#39;))">evil</div>
4436 !! end
4438 !! test
4439 MSIE CSS safety test: comment in expression
4440 !! input
4441 <div style="background-image:expres/**/sion(alert('boo4'))">evil4</div>
4442 !! result
4443 <div style="background-image:expres sion(alert(&#39;boo4&#39;))">evil4</div>
4445 !! end
4448 !! test
4449 Table attribute legitimate extension
4450 !! input
4452 !+ style="<nowiki>color:blue</nowiki>"| status
4454 !! result
4455 <table>
4456 <tr>
4457 <th style="color:blue"> status
4458 </th></tr></table>
4460 !!end
4462 !! test
4463 Table attribute safety
4464 !! input
4466 !+ style="<nowiki>border-width:expression(0+alert(document.cookie))</nowiki>"| status
4468 !! result
4469 <table>
4470 <tr>
4471 <th> status
4472 </th></tr></table>
4474 !! end
4476 !! test
4477 CSS line continuation 1
4478 !! input
4479 <div style="background-image: u\&#10;rl(test.jpg);"></div>
4480 !! result
4481 <div></div>
4483 !! end
4485 !! test
4486 CSS line continuation 2
4487 !! input
4488 <div style="background-image: u\&#13;rl(test.jpg); "></div>
4489 !! result
4490 <div></div>
4492 !! end
4494 !! article
4495 Template:Identity
4496 !! text
4497 {{{1}}}
4498 !! endarticle
4500 !! test
4501 Expansion of multi-line templates in attribute values (bug 6255)
4502 !! input
4503 <div style="background: {{identity|#00FF00}}">-</div>
4504 !! result
4505 <div style="background: #00FF00">-</div>
4507 !! end
4510 !! test
4511 Expansion of multi-line templates in attribute values (bug 6255 sanity check)
4512 !! input
4513 <div style="background: 
4514 #00FF00">-</div>
4515 !! result
4516 <div style="background: #00FF00">-</div>
4518 !! end
4520 !! test
4521 Expansion of multi-line templates in attribute values (bug 6255 sanity check 2)
4522 !! input
4523 <div style="background: &#10;#00FF00">-</div>
4524 !! result
4525 <div style="background: &#10;#00FF00">-</div>
4527 !! end
4530 ### Parser hooks (see maintenance/parserTestsParserHook.php for the <tag> extension)
4532 !! test
4533 Parser hook: empty input
4534 !! input
4535 <tag></tag>
4536 !! result
4537 <pre>
4538 string(0) ""
4539 array(0) {
4541 </pre>
4543 !! end
4545 !! test
4546 Parser hook: empty input using terminated empty elements
4547 !! input
4548 <tag/>
4549 !! result
4550 <pre>
4551 NULL
4552 array(0) {
4554 </pre>
4556 !! end
4558 !! test
4559 Parser hook: empty input using terminated empty elements (space before)
4560 !! input
4561 <tag />
4562 !! result
4563 <pre>
4564 NULL
4565 array(0) {
4567 </pre>
4569 !! end
4571 !! test
4572 Parser hook: basic input
4573 !! input
4574 <tag>input</tag>
4575 !! result
4576 <pre>
4577 string(5) "input"
4578 array(0) {
4580 </pre>
4582 !! end
4585 !! test
4586 Parser hook: case insensitive
4587 !! input
4588 <TAG>input</TAG>
4589 !! result
4590 <pre>
4591 string(5) "input"
4592 array(0) {
4594 </pre>
4596 !! end
4599 !! test
4600 Parser hook: case insensitive, redux
4601 !! input
4602 <TaG>input</TAg>
4603 !! result
4604 <pre>
4605 string(5) "input"
4606 array(0) {
4608 </pre>
4610 !! end
4612 !! test
4613 Parser hook: nested tags
4614 !! options
4615 noxml
4616 !! input
4617 <tag><tag></tag></tag>
4618 !! result
4619 <pre>
4620 string(5) "<tag>"
4621 array(0) {
4623 </pre>&lt;/tag&gt;
4625 !! end
4627 !! test
4628 Parser hook: basic arguments
4629 !! input
4630 <tag width=200 height = "100" depth = '50' square></tag>
4631 !! result
4632 <pre>
4633 string(0) ""
4634 array(4) {
4635   ["width"]=>
4636   string(3) "200"
4637   ["height"]=>
4638   string(3) "100"
4639   ["depth"]=>
4640   string(2) "50"
4641   ["square"]=>
4642   string(6) "square"
4644 </pre>
4646 !! end
4648 !! test
4649 Parser hook: argument containing a forward slash (bug 5344)
4650 !! input
4651 <tag filename='/tmp/bla'></tag>
4652 !! result
4653 <pre>
4654 string(0) ""
4655 array(1) {
4656   ["filename"]=>
4657   string(8) "/tmp/bla"
4659 </pre>
4661 !! end
4663 !! test
4664 Parser hook: empty input using terminated empty elements (bug 2374)
4665 !! input
4666 <tag foo=bar/>text
4667 !! result
4668 <pre>
4669 NULL
4670 array(1) {
4671   ["foo"]=>
4672   string(3) "bar"
4674 </pre>text
4676 !! end
4678 # </tag> should be output literally since there is no matching tag that begins it
4679 !! test
4680 Parser hook: basic arguments using terminated empty elements (bug 2374)
4681 !! input
4682 <tag width=200 height = "100" depth = '50' square/>
4683 other stuff
4684 </tag>
4685 !! result
4686 <pre>
4687 NULL
4688 array(4) {
4689   ["width"]=>
4690   string(3) "200"
4691   ["height"]=>
4692   string(3) "100"
4693   ["depth"]=>
4694   string(2) "50"
4695   ["square"]=>
4696   string(6) "square"
4698 </pre>
4699 <p>other stuff
4700 &lt;/tag&gt;
4701 </p>
4702 !! end
4705 ### (see maintenance/parserTestsStaticParserHook.php for the <statictag> extension)
4708 !! test
4709 Parser hook: static parser hook not inside a comment
4710 !! input
4711 <statictag>hello, world</statictag>
4712 <statictag action=flush/>
4713 !! result
4714 <p>hello, world
4715 </p>
4716 !! end
4719 !! test
4720 Parser hook: static parser hook inside a comment
4721 !! input
4722 <!-- <statictag>hello, world</statictag> -->
4723 <statictag action=flush/>
4724 !! result
4725 <p><br />
4726 </p>
4727 !! end
4729 # Nested template calls; this case was broken by Parser.php rev 1.506,
4730 # since reverted.
4732 !! article
4733 Template:One-parameter
4734 !! text
4735 (My parameter is: {{{1}}})
4736 !! endarticle
4738 !! article
4739 Template:Map-one-parameter
4740 !! text
4741 {{{{{1}}}|{{{2}}}}}
4742 !! endarticle
4744 !! test
4745 Nested template calls
4746 !! input
4747 {{Map-one-parameter|One-parameter|param}}
4748 !! result
4749 <p>(My parameter is: param)
4750 </p>
4751 !! end
4755 ### Sanitizer
4757 !! test
4758 Sanitizer: Closing of open tags
4759 !! input
4760 <s></s><table></table>
4761 !! result
4762 <s></s><table></table>
4764 !! end
4766 !! test
4767 Sanitizer: Closing of open but not closed tags
4768 !! input
4769 <s>foo
4770 !! result
4771 <p><s>foo</s>
4772 </p>
4773 !! end
4775 !! test
4776 Sanitizer: Closing of closed but not open tags
4777 !! input
4778 </s>
4779 !! result
4780 <p>&lt;/s&gt;
4781 </p>
4782 !! end
4784 !! test
4785 Sanitizer: Closing of closed but not open table tags
4786 !! input
4787 Table not started</td></tr></table>
4788 !! result
4789 <p>Table not started&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
4790 </p>
4791 !! end
4793 !! test
4794 Sanitizer: Escaping of spaces, multibyte characters, colons & other stuff in id=""
4795 !! input
4796 <span id="æ: v">byte</span>[[#æ: v|backlink]]
4797 !! result
4798 <p><span id=".C3.A6:_v">byte</span><a href="#.C3.A6:_v">backlink</a>
4799 </p>
4800 !! end
4802 !! test
4803 Sanitizer: Validating the contents of the id attribute (bug 4515)
4804 !! options
4805 disabled
4806 !! input
4807 <br id=9 />
4808 !! result
4809 Something, but defenetly not <br id="9" />...
4810 !! end
4812 !! test
4813 Sanitizer: Validating id attribute uniqueness (bug 4515, bug 6301)
4814 !! options
4815 disabled
4816 !! input
4817 <br id="foo" /><br id="foo" />
4818 !! result
4819 Something need to be done. foo-2 ? 
4820 !! end
4822 !! test
4823 Language converter: output gets cut off unexpectedly (bug 5757)
4824 !! options
4825 language=zh
4826 !! input
4827 this bit is safe: }-
4829 but if we add a conversion instance: -{zh-cn:xxx;zh-tw:yyy}-
4831 then we get cut off here: }-
4833 all additional text is vanished
4834 !! result
4835 <p>this bit is safe: }-
4836 </p><p>but if we add a conversion instance: xxx
4837 </p><p>then we get cut off here: }-
4838 </p><p>all additional text is vanished
4839 </p>
4840 !! end
4842 !! test
4843 Self closed html pairs (bug 5487)
4844 !! options
4845 !! input
4846 <center><font id="bug" />Centered text</center>
4847 <div><font id="bug2" />In div text</div>
4848 !! result
4849 <center>&lt;font id="bug" /&gt;Centered text</center>
4850 <div>&lt;font id="bug2" /&gt;In div text</div>
4852 !! end
4858 !! test
4859 Punctuation: nbsp before exclamation
4860 !! input
4861 C'est grave !
4862 !! result
4863 <p>C'est grave&nbsp;!
4864 </p>
4865 !! end
4867 !! test
4868 Punctuation: CSS !important (bug 11874)
4869 !! input
4870 <div style="width:50% !important">important</div>
4871 !! result
4872 <div style="width:50% !important">important</div>
4874 !!end
4876 !! test
4877 Punctuation: CSS ! important (bug 11874; with space after)
4878 !! input
4879 <div style="width:50% ! important">important</div>
4880 !! result
4881 <div style="width:50% ! important">important</div>
4883 !!end
4886 !! test
4887 HTML bullet list, closed tags (bug 5497)
4888 !! input
4889 <ul>
4890 <li>One</li>
4891 <li>Two</li>
4892 </ul>
4893 !! result
4894 <ul>
4895 <li>One</li>
4896 <li>Two</li>
4897 </ul>
4899 !! end
4901 !! test
4902 HTML bullet list, unclosed tags (bug 5497)
4903 !! options
4904 disabled
4905 !! input
4906 <ul>
4907 <li>One
4908 <li>Two
4909 </ul>
4910 !! result
4911 <ul>
4912 <li>One
4913 </li><li>Two
4914 </li></ul>
4916 !! end
4918 !! test
4919 HTML ordered list, closed tags (bug 5497)
4920 !! input
4921 <ol>
4922 <li>One</li>
4923 <li>Two</li>
4924 </ol>
4925 !! result
4926 <ol>
4927 <li>One</li>
4928 <li>Two</li>
4929 </ol>
4931 !! end
4933 !! test
4934 HTML ordered list, unclosed tags (bug 5497)
4935 !! options
4936 disabled
4937 !! input
4938 <ol>
4939 <li>One
4940 <li>Two
4941 </ol>
4942 !! result
4943 <ol>
4944 <li>One
4945 </li><li>Two
4946 </li></ol>
4948 !! end
4950 !! test
4951 HTML nested bullet list, closed tags (bug 5497)
4952 !! input
4953 <ul>
4954 <li>One</li>
4955 <li>Two:
4956 <ul>
4957 <li>Sub-one</li>
4958 <li>Sub-two</li>
4959 </ul>
4960 </li>
4961 </ul>
4962 !! result
4963 <ul>
4964 <li>One</li>
4965 <li>Two:
4966 <ul>
4967 <li>Sub-one</li>
4968 <li>Sub-two</li>
4969 </ul>
4970 </li>
4971 </ul>
4973 !! end
4975 !! test
4976 HTML nested bullet list, open tags (bug 5497)
4977 !! options
4978 disabled
4979 !! input
4980 <ul>
4981 <li>One
4982 <li>Two:
4983 <ul>
4984 <li>Sub-one
4985 <li>Sub-two
4986 </ul>
4987 </ul>
4988 !! result
4989 <ul>
4990 <li>One
4991 </li><li>Two:
4992 <ul>
4993 <li>Sub-one
4994 </li><li>Sub-two
4995 </li></ul>
4996 </li></ul>
4998 !! end
5000 !! test
5001 HTML nested ordered list, closed tags (bug 5497)
5002 !! input
5003 <ol>
5004 <li>One</li>
5005 <li>Two:
5006 <ol>
5007 <li>Sub-one</li>
5008 <li>Sub-two</li>
5009 </ol>
5010 </li>
5011 </ol>
5012 !! result
5013 <ol>
5014 <li>One</li>
5015 <li>Two:
5016 <ol>
5017 <li>Sub-one</li>
5018 <li>Sub-two</li>
5019 </ol>
5020 </li>
5021 </ol>
5023 !! end
5025 !! test
5026 HTML nested ordered list, open tags (bug 5497)
5027 !! options
5028 disabled
5029 !! input
5030 <ol>
5031 <li>One
5032 <li>Two:
5033 <ol>
5034 <li>Sub-one
5035 <li>Sub-two
5036 </ol>
5037 </ol>
5038 !! result
5039 <ol>
5040 <li>One
5041 </li><li>Two:
5042 <ol>
5043 <li>Sub-one
5044 </li><li>Sub-two
5045 </li></ol>
5046 </li></ol>
5048 !! end
5050 !! test
5051 HTML ordered list item with parameters oddity
5052 !! input
5053 <ol><li id="fragment">One</li></ol>
5054 !! result
5055 <ol><li id="fragment">One</li></ol>
5057 !! end
5059 !!test
5060 bug 5918: autonumbering
5061 !! input
5062 [http://first/] [http://second] [ftp://ftp]
5064 ftp://inlineftp
5066 [mailto:enclosed@mail.tld With target]
5068 [mailto:enclosed@mail.tld]
5070 mailto:inline@mail.tld
5071 !! result
5072 <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>
5073 </p><p><a href="ftp://inlineftp" class="external free" rel="nofollow">ftp://inlineftp</a>
5074 </p><p><a href="mailto:enclosed@mail.tld" class="external text" rel="nofollow">With target</a>
5075 </p><p><a href="mailto:enclosed@mail.tld" class="external autonumber" rel="nofollow">[4]</a>
5076 </p><p><a href="mailto:inline@mail.tld" class="external free" rel="nofollow">mailto:inline@mail.tld</a>
5077 </p>
5078 !! end
5082 # Security and HTML correctness
5083 # From Nick Jenkins' fuzz testing
5086 !! test
5087 Fuzz testing: Parser13
5088 !! input
5089 {| 
5090 | http://a|
5091 !! result
5092 <table>
5093 <tr>
5094 <td>
5095 </td>
5096 </tr>
5097 </table>
5099 !! end
5101 !! test
5102 Fuzz testing: Parser14
5103 !! input
5104 == onmouseover= ==
5105 http://__TOC__
5106 !! result
5107 <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>
5108 http://<table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
5109 <ul>
5110 <li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
5111 </ul>
5112 </td></tr></table><script>if (window.showTocToggle) { var tocShowText = "show"; var tocHideText = "hide"; showTocToggle(); } </script>
5114 !! end
5116 !! test
5117 Fuzz testing: Parser14-table
5118 !! input
5119 ==a==
5120 {| STYLE=__TOC__
5121 !! result
5122 <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>
5123 <table style="&#95;_TOC&#95;_">
5124 <tr><td></td></tr>
5125 </table>
5127 !! end
5129 # Known to produce bogus xml (extra </td>)
5130 !! test
5131 Fuzz testing: Parser16
5132 !! options
5133 noxml
5134 !! input
5136 !https://||||||
5137 !! result
5138 <table>
5139 <tr>
5140 <th>https://</th><th></th><th></th><th>
5141 </td>
5142 </tr>
5143 </table>
5145 !! end
5147 !! test
5148 Fuzz testing: Parser21
5149 !! input
5151 ! irc://{{ftp://a" onmouseover="alert('hello world');"
5153 !! result
5154 <table>
5155 <tr>
5156 <th> <a href="irc://{{ftp://a" class="external free" rel="nofollow">irc://{{ftp://a</a>" onmouseover="alert('hello world');"
5157 </th><td>
5158 </td>
5159 </tr>
5160 </table>
5162 !! end
5164 !! test
5165 Fuzz testing: Parser22
5166 !! input
5167 http://===r:::https://b
5170 !!result
5171 <p><a href="http://===r:::https://b" class="external free" rel="nofollow">http://===r:::https://b</a>
5172 </p>
5173 <table>
5174 <tr><td></td></tr>
5175 </table>
5177 !! end
5179 # Known to produce bad XML for now
5180 !! test
5181 Fuzz testing: Parser24
5182 !! options
5183 noxml
5184 !! input
5186 {{{|
5187 <u CLASS=
5188 | {{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx--><noinclude>}}}} >
5189 <br style="onmouseover='alert(document.cookie);' " />
5191 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
5193 !! result
5194 <table>
5195 {{{|
5196 <u class="&#124;">}}}} &gt;
5197 <br style="onmouseover=&#39;alert(document.cookie);&#39;" />
5199 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
5200 <tr>
5201 <td></u>
5202 </td>
5203 </tr>
5204 </table>
5206 !! end
5208 # Note: the current result listed for this is not what the original one was,
5209 # but the original bug was JavaScript injection, which is fixed in any case.
5210 # It's not clear that the original result listed was any more correct than the
5211 # current one.  Original result:
5212 # <p>{{{| 
5213 # </p>
5214 # <li class="&#124;&#124;">
5215 # }}}blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
5216 !!test
5217 Fuzz testing: Parser25 (bug 6055)
5218 !! input
5221 <LI CLASS=||
5223 }}}blah" onmouseover="alert('hello world');" align="left"'''MOVE MOUSE CURSOR OVER HERE
5224 !! result
5225 <p>&lt;LI CLASS=blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
5226 </p>
5227 !! end
5229 !!test
5230 Fuzz testing: URL adjacent extension (with space, clean)
5231 !! options
5232 !! input
5233 http://example.com <nowiki>junk</nowiki>
5234 !! result
5235 <p><a href="http://example.com" class="external free" rel="nofollow">http://example.com</a> junk
5236 </p>
5237 !!end
5239 !!test
5240 Fuzz testing: URL adjacent extension (no space, dirty; nowiki)
5241 !! options
5242 !! input
5243 http://example.com<nowiki>junk</nowiki>
5244 !! result
5245 <p><a href="http://example.com" class="external free" rel="nofollow">http://example.com</a>junk
5246 </p>
5247 !!end
5249 !!test
5250 Fuzz testing: URL adjacent extension (no space, dirty; pre)
5251 !! options
5252 !! input
5253 http://example.com<pre>junk</pre>
5254 !! result
5255 <a href="http://example.com" class="external free" rel="nofollow">http://example.com</a><pre>junk</pre>
5257 !!end
5259 !!test
5260 Fuzz testing: image with bogus manual thumbnail
5261 !!input
5262 [[Image:foobar.jpg|thumbnail= ]]
5263 !!result
5264 <div class="thumb tright"><div class="thumbinner" style="width:1943px;">Error creating thumbnail:   <div class="thumbcaption"></div></div></div>
5266 !!end
5268 !! test
5269 Fuzz testing: encoded newline in generated HTML replacements (bug 6577)
5270 !! input
5271 <pre dir="&#10;"></pre>
5272 !! result
5273 <pre dir="&#10;"></pre>
5275 !! end
5277 !! test
5278 Parsing optional HTML elements (Bug 6171)
5279 !! options
5280 !! input
5281 <table>
5282   <tr>
5283     <td> Some tabular data</td>
5284     <td> More tabular data ...
5285     <td> And yet som tabular data</td>
5286   </tr>
5287 </table>
5288 !! result
5289 <table>
5290   <tr>
5291     <td> Some tabular data</td>
5292     <td> More tabular data ...
5293     </td><td> And yet som tabular data</td>
5294   </tr>
5295 </table>
5297 !! end
5299 !! test
5300 Correct handling of <td>, <tr> (Bug 6171)
5301 !! options
5302 !! input
5303 <table>
5304   <tr>
5305     <td> Some tabular data</td>
5306     <td> More tabular data ...</td>
5307     <td> And yet som tabular data</td>
5308   </tr>
5309 </table>
5310 !! result
5311 <table>
5312   <tr>
5313     <td> Some tabular data</td>
5314     <td> More tabular data ...</td>
5315     <td> And yet som tabular data</td>
5316   </tr>
5317 </table>
5319 !! end
5322 !! test
5323 Parsing crashing regression (fr:JavaScript)
5324 !! input
5325 </body></x>
5326 !! result
5327 <p>&lt;/body&gt;&lt;/x&gt;
5328 </p>
5329 !! end
5331 !! test
5332 Inline wiki vs wiki block nesting
5333 !! input
5334 '''Bold paragraph
5336 New wiki paragraph
5337 !! result
5338 <p><b>Bold paragraph</b>
5339 </p><p>New wiki paragraph
5340 </p>
5341 !! end
5343 !! test
5344 Inline HTML vs wiki block nesting
5345 !! options
5346 disabled
5347 !! input
5348 <b>Bold paragraph
5350 New wiki paragraph
5351 !! result
5352 <p><b>Bold paragraph</b>
5353 </p><p>New wiki paragraph
5354 </p>
5355 !! end
5357 # Original result was this:
5358 # <p><b>bold</b><b>bold<i>bolditalics</i></b>
5359 # </p>
5360 # While that might be marginally more intuitive, maybe, the six-apostrophe
5361 # construct is clearly pathological and the result stated here (which is what
5362 # the parser actually does) is about as reasonable as anything.
5363 !!test
5364 Mixing markup for italics and bold
5365 !! options
5366 !! input
5367 '''bold''''''bold''bolditalics'''''
5368 !! result
5369 <p>'<i>bold'</i><b>bold<i>bolditalics</i></b>
5370 </p>
5371 !! end
5374 !! article
5375 Xyzzyx
5376 !! text
5377 Article for special page transclusion test
5378 !! endarticle
5380 !! test
5381 Special page transclusion
5382 !! options
5383 !! input
5384 {{Special:Prefixindex/Xyzzyx}}
5385 !! result
5386 <p><br />
5387 </p>
5388 <table border="0" id="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
5390 !! end
5392 !! test
5393 Special page transclusion twice (bug 5021)
5394 !! options
5395 !! input
5396 {{Special:Prefixindex/Xyzzyx}}
5397 {{Special:Prefixindex/Xyzzyx}}
5398 !! result
5399 <p><br />
5400 </p>
5401 <table border="0" id="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
5402 <p><br />
5403 </p>
5404 <table border="0" id="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
5406 !! end
5408 !! test
5409 Transclusion of default MediaWiki message
5410 !! input
5411 {{MediaWiki:Mainpage}}
5412 !!result
5413 <p>Main Page
5414 </p>
5415 !! end
5417 !! test
5418 Transclusion of nonexistent MediaWiki message
5419 !! input
5420 {{MediaWiki:Mainpagexxx}}
5421 !!result
5422 <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>
5423 </p>
5424 !! end
5426 !! test
5427 Transclusion of MediaWiki message with underscore
5428 !! input
5429 {{MediaWiki:history_short}}
5430 !! result
5431 <p>History
5432 </p>
5433 !! end
5435 !! test
5436 Transclusion of MediaWiki message with space
5437 !! input
5438 {{MediaWiki:history short}}
5439 !! result
5440 <p>History
5441 </p>
5442 !! end
5444 !! test
5445 Invalid header with following text
5446 !! input
5447 = x = y
5448 !! result
5449 <p>= x = y
5450 </p>
5451 !! end
5454 !! test
5455 Section extraction test (section 0)
5456 !! options
5457 section=0
5458 !! input
5459 start
5460 ==a==
5461 ===aa===
5462 ====aaa====
5463 ==b==
5464 ===ba===
5465 ===bb===
5466 ====bba====
5467 ===bc===
5468 ==c==
5469 ===ca===
5470 !! result
5471 start
5472 !! end
5474 !! test
5475 Section extraction test (section 1)
5476 !! options
5477 section=1
5478 !! input
5479 start
5480 ==a==
5481 ===aa===
5482 ====aaa====
5483 ==b==
5484 ===ba===
5485 ===bb===
5486 ====bba====
5487 ===bc===
5488 ==c==
5489 ===ca===
5490 !! result
5491 ==a==
5492 ===aa===
5493 ====aaa====
5494 !! end
5496 !! test
5497 Section extraction test (section 2)
5498 !! options
5499 section=2
5500 !! input
5501 start
5502 ==a==
5503 ===aa===
5504 ====aaa====
5505 ==b==
5506 ===ba===
5507 ===bb===
5508 ====bba====
5509 ===bc===
5510 ==c==
5511 ===ca===
5512 !! result
5513 ===aa===
5514 ====aaa====
5515 !! end
5517 !! test
5518 Section extraction test (section 3)
5519 !! options
5520 section=3
5521 !! input
5522 start
5523 ==a==
5524 ===aa===
5525 ====aaa====
5526 ==b==
5527 ===ba===
5528 ===bb===
5529 ====bba====
5530 ===bc===
5531 ==c==
5532 ===ca===
5533 !! result
5534 ====aaa====
5535 !! end
5537 !! test
5538 Section extraction test (section 4)
5539 !! options
5540 section=4
5541 !! input
5542 start
5543 ==a==
5544 ===aa===
5545 ====aaa====
5546 ==b==
5547 ===ba===
5548 ===bb===
5549 ====bba====
5550 ===bc===
5551 ==c==
5552 ===ca===
5553 !! result
5554 ==b==
5555 ===ba===
5556 ===bb===
5557 ====bba====
5558 ===bc===
5559 !! end
5561 !! test
5562 Section extraction test (section 5)
5563 !! options
5564 section=5
5565 !! input
5566 start
5567 ==a==
5568 ===aa===
5569 ====aaa====
5570 ==b==
5571 ===ba===
5572 ===bb===
5573 ====bba====
5574 ===bc===
5575 ==c==
5576 ===ca===
5577 !! result
5578 ===ba===
5579 !! end
5581 !! test
5582 Section extraction test (section 6)
5583 !! options
5584 section=6
5585 !! input
5586 start
5587 ==a==
5588 ===aa===
5589 ====aaa====
5590 ==b==
5591 ===ba===
5592 ===bb===
5593 ====bba====
5594 ===bc===
5595 ==c==
5596 ===ca===
5597 !! result
5598 ===bb===
5599 ====bba====
5600 !! end
5602 !! test
5603 Section extraction test (section 7)
5604 !! options
5605 section=7
5606 !! input
5607 start
5608 ==a==
5609 ===aa===
5610 ====aaa====
5611 ==b==
5612 ===ba===
5613 ===bb===
5614 ====bba====
5615 ===bc===
5616 ==c==
5617 ===ca===
5618 !! result
5619 ====bba====
5620 !! end
5622 !! test
5623 Section extraction test (section 8)
5624 !! options
5625 section=8
5626 !! input
5627 start
5628 ==a==
5629 ===aa===
5630 ====aaa====
5631 ==b==
5632 ===ba===
5633 ===bb===
5634 ====bba====
5635 ===bc===
5636 ==c==
5637 ===ca===
5638 !! result
5639 ===bc===
5640 !! end
5642 !! test
5643 Section extraction test (section 9)
5644 !! options
5645 section=9
5646 !! input
5647 start
5648 ==a==
5649 ===aa===
5650 ====aaa====
5651 ==b==
5652 ===ba===
5653 ===bb===
5654 ====bba====
5655 ===bc===
5656 ==c==
5657 ===ca===
5658 !! result
5659 ==c==
5660 ===ca===
5661 !! end
5663 !! test
5664 Section extraction test (section 10)
5665 !! options
5666 section=10
5667 !! input
5668 start
5669 ==a==
5670 ===aa===
5671 ====aaa====
5672 ==b==
5673 ===ba===
5674 ===bb===
5675 ====bba====
5676 ===bc===
5677 ==c==
5678 ===ca===
5679 !! result
5680 ===ca===
5681 !! end
5683 !! test
5684 Section extraction test (nonexistent section 11)
5685 !! options
5686 section=11
5687 !! input
5688 start
5689 ==a==
5690 ===aa===
5691 ====aaa====
5692 ==b==
5693 ===ba===
5694 ===bb===
5695 ====bba====
5696 ===bc===
5697 ==c==
5698 ===ca===
5699 !! result
5700 !! end
5702 !! test
5703 Section extraction test with bogus heading (section 1)
5704 !! options
5705 section=1
5706 !! input
5707 ==a==
5708 ==bogus== not a legal section
5709 ==b==
5710 !! result
5711 ==a==
5712 ==bogus== not a legal section
5713 !! end
5715 !! test
5716 Section extraction test with bogus heading (section 2)
5717 !! options
5718 section=2
5719 !! input
5720 ==a==
5721 ==bogus== not a legal section
5722 ==b==
5723 !! result
5724 ==b==
5725 !! end
5727 !! test
5728 Section extraction test with comment after heading (section 1)
5729 !! options
5730 section=1
5731 !! input
5732 ==a==
5733 ==b== <!-- -->
5734 ==c==
5735 !! result
5736 ==a==
5737 !! end
5739 !! test
5740 Section extraction test with comment after heading (section 2)
5741 !! options
5742 section=2
5743 !! input
5744 ==a==
5745 ==b== <!-- -->
5746 ==c==
5747 !! result
5748 ==b== <!-- -->
5749 !! end
5751 !! test
5752 Section extraction test with bogus <nowiki> heading (section 1)
5753 !! options
5754 section=1
5755 !! input
5756 ==a==
5757 ==bogus== <nowiki>not a legal section</nowiki>
5758 ==b==
5759 !! result
5760 ==a==
5761 ==bogus== <nowiki>not a legal section</nowiki>
5762 !! end
5764 !! test
5765 Section extraction test with bogus <nowiki> heading (section 2)
5766 !! options
5767 section=2
5768 !! input
5769 ==a==
5770 ==bogus== <nowiki>not a legal section</nowiki>
5771 ==b==
5772 !! result
5773 ==b==
5774 !! end
5777 # Formerly testing for bug 2587, now resolved by the use of unmarked sections 
5778 # instead of respecting commented sections
5779 !! test
5780 Section extraction prefixed by comment (section 1)
5781 !! options
5782 section=1
5783 !! input
5784 <!-- -->==sec1==
5785 ==sec2==
5786 !!result
5787 ==sec2==
5788 !!end
5790 !! test
5791 Section extraction prefixed by comment (section 2)
5792 !! options
5793 section=2
5794 !! input
5795 <!-- -->==sec1==
5796 ==sec2==
5797 !!result
5799 !!end
5802 # Formerly testing for bug 2607, now resolved by the use of unmarked sections 
5803 # instead of respecting HTML-style headings
5804 !! test
5805 Section extraction, mixed wiki and html (section 1)
5806 !! options
5807 section=1
5808 !! input
5809 <h2>unmarked</h2>
5810 unmarked
5811 ==1==
5813 ==2==
5815 !! result
5816 ==1==
5818 !! end
5820 !! test
5821 Section extraction, mixed wiki and html (section 2)
5822 !! options
5823 section=2
5824 !! input
5825 <h2>unmarked</h2>
5826 unmarked
5827 ==1==
5829 ==2==
5831 !! result
5832 ==2==
5834 !! end
5837 # Formerly testing for bug 3342
5838 !! test
5839 Section extraction, heading surrounded by <noinclude>
5840 !! options
5841 section=1
5842 !! input
5843 <noinclude>==unmarked==</noinclude>
5844 ==marked==
5845 !! result
5846 ==marked==
5847 !!end
5850 !! test
5851 Section replacement test (section 0)
5852 !! options
5853 replace=0,"xxx"
5854 !! input
5855 start
5856 ==a==
5857 ===aa===
5858 ====aaa====
5859 ==b==
5860 ===ba===
5861 ===bb===
5862 ====bba====
5863 ===bc===
5864 ==c==
5865 ===ca===
5866 !! result
5869 ==a==
5870 ===aa===
5871 ====aaa====
5872 ==b==
5873 ===ba===
5874 ===bb===
5875 ====bba====
5876 ===bc===
5877 ==c==
5878 ===ca===
5879 !! end
5881 !! test
5882 Section replacement test (section 1)
5883 !! options
5884 replace=1,"xxx"
5885 !! input
5886 start
5887 ==a==
5888 ===aa===
5889 ====aaa====
5890 ==b==
5891 ===ba===
5892 ===bb===
5893 ====bba====
5894 ===bc===
5895 ==c==
5896 ===ca===
5897 !! result
5898 start
5901 ==b==
5902 ===ba===
5903 ===bb===
5904 ====bba====
5905 ===bc===
5906 ==c==
5907 ===ca===
5908 !! end
5910 !! test
5911 Section replacement test (section 2)
5912 !! options
5913 replace=2,"xxx"
5914 !! input
5915 start
5916 ==a==
5917 ===aa===
5918 ====aaa====
5919 ==b==
5920 ===ba===
5921 ===bb===
5922 ====bba====
5923 ===bc===
5924 ==c==
5925 ===ca===
5926 !! result
5927 start
5928 ==a==
5931 ==b==
5932 ===ba===
5933 ===bb===
5934 ====bba====
5935 ===bc===
5936 ==c==
5937 ===ca===
5938 !! end
5940 !! test
5941 Section replacement test (section 3)
5942 !! options
5943 replace=3,"xxx"
5944 !! input
5945 start
5946 ==a==
5947 ===aa===
5948 ====aaa====
5949 ==b==
5950 ===ba===
5951 ===bb===
5952 ====bba====
5953 ===bc===
5954 ==c==
5955 ===ca===
5956 !! result
5957 start
5958 ==a==
5959 ===aa===
5962 ==b==
5963 ===ba===
5964 ===bb===
5965 ====bba====
5966 ===bc===
5967 ==c==
5968 ===ca===
5969 !! end
5971 !! test
5972 Section replacement test (section 4)
5973 !! options
5974 replace=4,"xxx"
5975 !! input
5976 start
5977 ==a==
5978 ===aa===
5979 ====aaa====
5980 ==b==
5981 ===ba===
5982 ===bb===
5983 ====bba====
5984 ===bc===
5985 ==c==
5986 ===ca===
5987 !! result
5988 start
5989 ==a==
5990 ===aa===
5991 ====aaa====
5994 ==c==
5995 ===ca===
5996 !! end
5998 !! test
5999 Section replacement test (section 5)
6000 !! options
6001 replace=5,"xxx"
6002 !! input
6003 start
6004 ==a==
6005 ===aa===
6006 ====aaa====
6007 ==b==
6008 ===ba===
6009 ===bb===
6010 ====bba====
6011 ===bc===
6012 ==c==
6013 ===ca===
6014 !! result
6015 start
6016 ==a==
6017 ===aa===
6018 ====aaa====
6019 ==b==
6022 ===bb===
6023 ====bba====
6024 ===bc===
6025 ==c==
6026 ===ca===
6027 !! end
6029 !! test
6030 Section replacement test (section 6)
6031 !! options
6032 replace=6,"xxx"
6033 !! input
6034 start
6035 ==a==
6036 ===aa===
6037 ====aaa====
6038 ==b==
6039 ===ba===
6040 ===bb===
6041 ====bba====
6042 ===bc===
6043 ==c==
6044 ===ca===
6045 !! result
6046 start
6047 ==a==
6048 ===aa===
6049 ====aaa====
6050 ==b==
6051 ===ba===
6054 ===bc===
6055 ==c==
6056 ===ca===
6057 !! end
6059 !! test
6060 Section replacement test (section 7)
6061 !! options
6062 replace=7,"xxx"
6063 !! input
6064 start
6065 ==a==
6066 ===aa===
6067 ====aaa====
6068 ==b==
6069 ===ba===
6070 ===bb===
6071 ====bba====
6072 ===bc===
6073 ==c==
6074 ===ca===
6075 !! result
6076 start
6077 ==a==
6078 ===aa===
6079 ====aaa====
6080 ==b==
6081 ===ba===
6082 ===bb===
6085 ===bc===
6086 ==c==
6087 ===ca===
6088 !! end
6090 !! test
6091 Section replacement test (section 8)
6092 !! options
6093 replace=8,"xxx"
6094 !! input
6095 start
6096 ==a==
6097 ===aa===
6098 ====aaa====
6099 ==b==
6100 ===ba===
6101 ===bb===
6102 ====bba====
6103 ===bc===
6104 ==c==
6105 ===ca===
6106 !! result
6107 start
6108 ==a==
6109 ===aa===
6110 ====aaa====
6111 ==b==
6112 ===ba===
6113 ===bb===
6114 ====bba====
6117 ==c==
6118 ===ca===
6119 !!end
6121 !! test
6122 Section replacement test (section 9)
6123 !! options
6124 replace=9,"xxx"
6125 !! input
6126 start
6127 ==a==
6128 ===aa===
6129 ====aaa====
6130 ==b==
6131 ===ba===
6132 ===bb===
6133 ====bba====
6134 ===bc===
6135 ==c==
6136 ===ca===
6137 !! result
6138 start
6139 ==a==
6140 ===aa===
6141 ====aaa====
6142 ==b==
6143 ===ba===
6144 ===bb===
6145 ====bba====
6146 ===bc===
6148 !! end
6150 !! test
6151 Section replacement test (section 10)
6152 !! options
6153 replace=10,"xxx"
6154 !! input
6155 start
6156 ==a==
6157 ===aa===
6158 ====aaa====
6159 ==b==
6160 ===ba===
6161 ===bb===
6162 ====bba====
6163 ===bc===
6164 ==c==
6165 ===ca===
6166 !! result
6167 start
6168 ==a==
6169 ===aa===
6170 ====aaa====
6171 ==b==
6172 ===ba===
6173 ===bb===
6174 ====bba====
6175 ===bc===
6176 ==c==
6178 !! end
6180 !! test
6181 Section replacement test with initial whitespace (bug 13728)
6182 !! options
6183 replace=2,"xxx"
6184 !! input
6185  Preformatted initial line
6186 ==a==
6187 ===a===
6188 !! result
6189  Preformatted initial line
6190 ==a==
6192 !! end
6195 !! test
6196 Section extraction, heading followed by pre with 20 spaces (bug 6398)
6197 !! options
6198 section=1
6199 !! input
6200 ==a==
6201                     a
6202 !! result
6203 ==a==
6204                     a
6205 !! end
6207 !! test
6208 Section extraction, heading followed by pre with 19 spaces (bug 6398 sanity check)
6209 !! options
6210 section=1
6211 !! input
6212 ==a==
6213                    a
6214 !! result
6215 ==a==
6216                    a
6217 !! end
6220 !! test
6221 Section extraction, <pre> around bogus header (bug 10309)
6222 !! options
6223 noxml section=2
6224 !! input
6225 == Section One ==
6226 <pre>
6227 =======
6228 </pre>
6230 == Section Two ==
6231 stuff
6232 !! result
6233 == Section Two ==
6234 stuff
6235 !! end
6237 !! test
6238 Section replacement, <pre> around bogus header (bug 10309)
6239 !! options
6240 noxml replace=2,"xxx"
6241 !! input
6242 == Section One ==
6243 <pre>
6244 =======
6245 </pre>
6247 == Section Two ==
6248 stuff
6249 !! result
6250 == Section One ==
6251 <pre>
6252 =======
6253 </pre>
6256 !! end
6260 !! test
6261 Handling of &#x0A; in URLs
6262 !! input
6263 **irc://&#x0A;a
6264 !! result
6265 <ul><li><ul><li><a href="irc://%0Aa" class="external free" rel="nofollow">irc://%0Aa</a>
6266 </li></ul>
6267 </li></ul>
6269 !!end
6271 !! test
6272 5 quotes, code coverage +1 line
6273 !! input
6274 '''''
6275 !! result
6276 !! end
6278 !! test
6279 Special:Search page linking.
6280 !! input
6281 {{Special:search}}
6282 !! result
6283 <p><a href="/wiki/Special:Search" title="Special:Search">Special:Search</a>
6284 </p>
6285 !! end
6287 !! test
6288 Say the magic word
6289 !! input
6290 * {{PAGENAME}}
6291 * {{BASEPAGENAME}}
6292 * {{SUBPAGENAME}}
6293 * {{SUBPAGENAMEE}}
6294 * {{BASEPAGENAME}}
6295 * {{BASEPAGENAMEE}}
6296 * {{TALKPAGENAME}}
6297 * {{TALKPAGENAMEE}}
6298 * {{SUBJECTPAGENAME}}
6299 * {{SUBJECTPAGENAMEE}}
6300 * {{NAMESPACEE}}
6301 * {{NAMESPACE}}
6302 * {{TALKSPACE}}
6303 * {{TALKSPACEE}}
6304 * {{SUBJECTSPACE}}
6305 * {{SUBJECTSPACEE}}
6306 * {{Dynamic|{{NUMBEROFUSERS}}|{{NUMBEROFPAGES}}|{{CURRENTVERSION}}|{{CONTENTLANGUAGE}}|{{DIRECTIONMARK}}|{{CURRENTTIMESTAMP}}|{{NUMBEROFARTICLES}}}}
6307 !! result
6308 <ul><li> Parser test
6309 </li><li> Parser test
6310 </li><li> Parser test
6311 </li><li> Parser_test
6312 </li><li> Parser test
6313 </li><li> Parser_test
6314 </li><li> Talk:Parser test
6315 </li><li> Talk:Parser_test
6316 </li><li> Parser test
6317 </li><li> Parser_test
6318 </li><li> 
6319 </li><li> 
6320 </li><li> Talk
6321 </li><li> Talk
6322 </li><li> 
6323 </li><li> 
6324 </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>
6325 </li></ul>
6327 !! end
6328 ### Note: Above tests excludes the "{{NUMBEROFADMINS}}" magic word because it generates a MySQL error when included.
6330 !! test
6331 Gallery
6332 !! input
6333 <gallery>
6334 image1.png |
6335 image2.gif|||||
6337 image3|
6338 image4    |300px| centre
6339  image5.svg| http://///////
6340 [[x|xx]]]]
6341 * image6
6342 </gallery>
6343 !! result
6344 <table class="gallery" cellspacing="0" cellpadding="0">
6345         <tr>
6346                 <td><div class="gallerybox" style="width: 155px;">
6347                         <div style="height: 152px;">Image1.png</div>
6348                         <div class="gallerytext">
6349                         </div>
6350                 </div></td>
6351                 <td><div class="gallerybox" style="width: 155px;">
6352                         <div style="height: 152px;">Image2.gif</div>
6353                         <div class="gallerytext">
6354 <p>||||
6355 </p>
6356                         </div>
6357                 </div></td>
6358                 <td><div class="gallerybox" style="width: 155px;">
6359                         <div style="height: 152px;">Image3</div>
6360                         <div class="gallerytext">
6361                         </div>
6362                 </div></td>
6363                 <td><div class="gallerybox" style="width: 155px;">
6364                         <div style="height: 152px;">Image4</div>
6365                         <div class="gallerytext">
6366 <p>300px| centre
6367 </p>
6368                         </div>
6369                 </div></td>
6370         </tr>
6371         <tr>
6372                 <td><div class="gallerybox" style="width: 155px;">
6373                         <div style="height: 152px;">Image5.svg</div>
6374                         <div class="gallerytext">
6375 <p><a href="http://///////" class="external free" rel="nofollow">http://///////</a>
6376 </p>
6377                         </div>
6378                 </div></td>
6379                 <td><div class="gallerybox" style="width: 155px;">
6380                         <div style="height: 152px;">* image6</div>
6381                         <div class="gallerytext">
6382                         </div>
6383                 </div></td>
6384         </tr>
6385 </table>
6387 !! end
6389 !! test
6390 Gallery (with options)
6391 !! input
6392 <gallery widths='60px' heights='40px' perrow='2' caption='Foo [[Main Page]]' >
6393 File:Nonexistant.jpg|caption
6394 File:Nonexistant.jpg
6395 image:foobar.jpg|some '''caption''' [[Main Page]]
6396 image:foobar.jpg
6397 </gallery>
6398 !! result
6399 <table class="gallery" cellspacing="0" cellpadding="0">
6400         <caption>Foo <a href="/wiki/Main_Page" title="Main Page">Main Page</a></caption>
6401         <tr>
6402                 <td><div class="gallerybox" style="width: 95px;">
6403                         <div style="height: 52px;">Nonexistant.jpg</div>
6404                         <div class="gallerytext">
6405 <p>caption
6406 </p>
6407                         </div>
6408                 </div></td>
6409                 <td><div class="gallerybox" style="width: 95px;">
6410                         <div style="height: 52px;">Nonexistant.jpg</div>
6411                         <div class="gallerytext">
6412                         </div>
6413                 </div></td>
6414         </tr>
6415         <tr>
6416                 <td><div class="gallerybox" style="width: 95px;">
6417                         <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>
6418                         <div class="gallerytext">
6419 <p>some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
6420 </p>
6421                         </div>
6422                 </div></td>
6423                 <td><div class="gallerybox" style="width: 95px;">
6424                         <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>
6425                         <div class="gallerytext">
6426                         </div>
6427                 </div></td>
6428         </tr>
6429 </table>
6431 !! end
6433 !! test
6434 gallery (with showfilename option)
6435 !! input
6436 <gallery showfilename>
6437 File:Nonexistant.jpg|caption
6438 File:Nonexistant.jpg
6439 image:foobar.jpg|some '''caption''' [[Main Page]]
6440 File:Foobar.jpg
6441 </gallery>
6442 !! result
6443 <table class="gallery" cellspacing="0" cellpadding="0">
6444         <tr>
6445                 <td><div class="gallerybox" style="width: 155px;">
6446                         <div style="height: 152px;">Nonexistant.jpg</div>
6447                         <div class="gallerytext">
6448 <p><a href="/wiki/File:Nonexistant.jpg" title="File:Nonexistant.jpg">Nonexistant.jpg</a><br />
6449 caption
6450 </p>
6451                         </div>
6452                 </div></td>
6453                 <td><div class="gallerybox" style="width: 155px;">
6454                         <div style="height: 152px;">Nonexistant.jpg</div>
6455                         <div class="gallerytext">
6456 <p><a href="/wiki/File:Nonexistant.jpg" title="File:Nonexistant.jpg">Nonexistant.jpg</a><br />
6457 </p>
6458                         </div>
6459                 </div></td>
6460                 <td><div class="gallerybox" style="width: 155px;">
6461                         <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>
6462                         <div class="gallerytext">
6463 <p><a href="/wiki/File:Foobar.jpg" title="File:Foobar.jpg">Foobar.jpg</a><br />
6464 some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
6465 </p>
6466                         </div>
6467                 </div></td>
6468                 <td><div class="gallerybox" style="width: 155px;">
6469                         <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>
6470                         <div class="gallerytext">
6471 <p><a href="/wiki/File:Foobar.jpg" title="File:Foobar.jpg">Foobar.jpg</a><br />
6472 </p>
6473                         </div>
6474                 </div></td>
6475         </tr>
6476 </table>
6478 !! end
6480 !! test
6481 HTML Hex character encoding (spells the word "JavaScript")
6482 !! input
6483 &#x4A;&#x061;&#x0076;&#x00061;&#x000053;&#x0000063;&#114;&#x0000069;&#00000112;&#x0000000074;
6484 !! result
6485 <p>&#x4a;&#x61;&#x76;&#x61;&#x53;&#x63;&#114;&#x69;&#112;&#x74;
6486 </p>
6487 !! end
6489 !! test
6490 __FORCETOC__ override
6491 !! input 
6492 __NEWSECTIONLINK__
6493 __FORCETOC__
6494 !! result
6495 <p><br />
6496 </p>
6497 !! end
6499 !! test
6500 ISBN code coverage
6501 !! input
6502 ISBN  978-0-1234-56&#x20;789
6503 !! result
6504 <p><a href="/wiki/Special:BookSources/9780123456" class="internal mw-magiclink-isbn">ISBN 978-0-1234-56</a>&#x20;789
6505 </p>
6506 !! end
6508 !! test
6509 ISBN followed by 5 spaces
6510 !! input
6511 ISBN    
6512 !! result
6513 <p>ISBN    
6514 </p>
6515 !! end
6517 !! test
6518 Double ISBN
6519 !! input
6520 ISBN ISBN 1234567890
6521 !! result
6522 <p>ISBN <a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
6523 </p>
6524 !! end
6526 !! test
6527 Bug 22905: <abbr> followed by ISBN followed by </a>
6528 !! input
6529 <abbr>(fr)</abbr> ISBN 2753300917 [http://www.example.com example.com]
6530 !! result
6531 <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>
6532 </p>
6533 !! end
6535 !! test
6536 Double RFC
6537 !! input
6538 RFC RFC 1234
6539 !! result
6540 <p>RFC <a href="http://tools.ietf.org/html/rfc1234" class="external mw-magiclink-rfc">RFC 1234</a>
6541 </p>
6542 !! end
6544 !! test
6545 Double RFC with a wiki link 
6546 !! input
6547 RFC [[RFC 1234]]
6548 !! result
6549 <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>
6550 </p>
6551 !! end
6553 !! test
6554 RFC code coverage
6555 !! input
6556 RFC   983&#x20;987
6557 !! result
6558 <p><a href="http://tools.ietf.org/html/rfc983" class="external mw-magiclink-rfc">RFC 983</a>&#x20;987
6559 </p>
6560 !! end
6562 !! test
6563 Centre-aligned image
6564 !! input
6565 [[Image:foobar.jpg|centre]]
6566 !! result
6567 <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>
6569 !!end
6571 !! test
6572 None-aligned image
6573 !! input
6574 [[Image:foobar.jpg|none]]
6575 !! result
6576 <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>
6578 !!end
6580 !! test
6581 Width + Height sized image (using px) (height is ignored)
6582 !! input
6583 [[Image:foobar.jpg|640x480px]]
6584 !! result
6585 <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>
6586 </p>
6587 !!end
6589 !! test
6590 Width-sized image (using px, no following whitespace)
6591 !! input
6592 [[Image:foobar.jpg|640px]]
6593 !! result
6594 <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>
6595 </p>
6596 !!end
6598 !! test
6599 Width-sized image (using px, with following whitespace - test regression from r39467)
6600 !! input
6601 [[Image:foobar.jpg|640px ]]
6602 !! result
6603 <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>
6604 </p>
6605 !!end
6607 !! test
6608 Width-sized image (using px, with preceding whitespace - test regression from r39467)
6609 !! input
6610 [[Image:foobar.jpg| 640px]]
6611 !! result
6612 <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>
6613 </p>
6614 !!end
6616 !! test
6617 Another italics / bold test
6618 !! input
6619  ''' ''x'
6620 !! result
6621 <pre>'<i> </i>x'
6622 </pre>
6623 !!end
6625 # Note the results may be incorrect, as parserTest output included this:
6626 # XML error: Mismatched tag at byte 6120:
6627 # ...<dd> </dt></dl> </dd...
6628 !! test
6629 dt/dd/dl test
6630 !! options
6631 disabled
6632 !! input
6633 :;;;::
6634 !! result
6635 <dl><dd><dl><dt><dl><dt><dl><dt><dl><dd><dl><dd>
6636 </dd></dl>
6637 </dd></dl>
6638 </dt></dl>
6639 </dt></dl>
6640 </dt></dl>
6641 </dd></dl>
6643 !!end
6646 # Images with the "|" character in external URLs in comment tags; Eats half the comment, leaves unmatched "</a>" tag.
6647 !! test
6648 Images with the "|" character in the comment
6649 !! options
6650 disabled
6651 !! input
6652 [[image:Foobar.jpg|thumb|An [http://test/?param1=|left|&param2=|x external] URL]]
6653 !! result
6654 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="An external URL" 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=|left|&amp;param2=|x" class="external text" rel="nofollow">external</a> URL</div></div></div>
6656 !!end
6658 !! test
6659 [Before] HTML without raw HTML enabled ($wgRawHtml==false)
6660 !! input
6661 <html><script>alert(1);</script></html>
6662 !! result
6663 <p>&lt;html&gt;&lt;script&gt;alert(1);&lt;/script&gt;&lt;/html&gt;
6664 </p>
6665 !! end
6667 !! test
6668 HTML with raw HTML ($wgRawHtml==true)
6669 !! options
6670 rawhtml
6671 !! input
6672 <html><script>alert(1);</script></html>
6673 !! result
6674 <p><script>alert(1);</script>
6675 </p>
6676 !! end
6678 !! test
6679 Parents of subpages, one level up
6680 !! options
6681 subpage title=[[Subpage test/L1/L2/L3]]
6682 !! input
6683 [[../|L2]]
6684 !! result
6685 <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>
6686 </p>
6687 !! end
6690 !! test
6691 Parents of subpages, one level up, not named
6692 !! options
6693 subpage title=[[Subpage test/L1/L2/L3]]
6694 !! input
6695 [[../]]
6696 !! result
6697 <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>
6698 </p>
6699 !! end
6703 !! test
6704 Parents of subpages, two levels up
6705 !! options
6706 disabled
6707 subpage title=[[Subpage test/L1/L2/L3]]
6708 !! input
6709 [[../../|L1]]2
6710 !! result
6711 <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>
6712 </p>
6713 !! end
6715 !! test
6716 Parents of subpages, two levels up, without trailing slash or name.
6717 !! options
6718 subpage title=[[Subpage test/L1/L2/L3]]
6719 !! input
6720 [[../..]]
6721 !! result
6722 <p>[[../..]]
6723 </p>
6724 !! end
6726 !! test
6727 Parents of subpages, two levels up, with lots of extra trailing slashes.
6728 !! options
6729 subpage title=[[Subpage test/L1/L2/L3]]
6730 !! input
6731 [[../../////]]
6732 !! result
6733 <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>
6734 </p>
6735 !! end
6737 !! test
6738 Definition list code coverage
6739 !! input
6740 ; title   : def
6741 ; title : def
6742 ;title: def
6743 !! result
6744 <dl><dt> title  &nbsp;</dt><dd> def
6745 </dd><dt> title&nbsp;</dt><dd> def
6746 </dd><dt>title</dt><dd> def
6747 </dd></dl>
6749 !! end
6751 !! test
6752 Don't fall for the self-closing div
6753 !! input
6754 <div>hello world</div/>
6755 !! result
6756 <div>hello world</div>
6758 !! end
6760 !! test
6761 MSGNW magic word
6762 !! input
6763 {{MSGNW:msg}}
6764 !! result
6765 <p>&#91;&#91;:Template:Msg&#93;&#93;
6766 </p>
6767 !! end
6769 !! test
6770 RAW magic word
6771 !! input
6772 {{RAW:QUERTY}}
6773 !! result
6774 <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>
6775 </p>
6776 !! end
6778 # This isn't needed for XHTML conformance, but would be handy as a fallback security measure
6779 !! test
6780 Always escape literal '>' in output, not just after '<'
6781 !! input
6783 !! result
6784 <p>&gt;&lt;&gt;
6785 </p>
6786 !! end
6788 !! test
6789 Template caching
6790 !! input
6791 {{Test}}
6792 {{Test}}
6793 !! result
6794 <p>This is a test template
6795 This is a test template
6796 </p>
6797 !! end
6800 !! article
6801 MediaWiki:Fake
6802 !! text
6803 ==header==
6804 !! endarticle
6806 !! test
6807 Inclusion of !userCanEdit() content
6808 !! input
6809 {{MediaWiki:Fake}}
6810 !! result
6811 <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>
6813 !! end
6816 !! test
6817 Out-of-order TOC heading levels
6818 !! input
6819 ==2==
6820 ======6======
6821 ===3===
6823 =====5=====
6824 ==2==
6825 !! result
6826 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
6827 <ul>
6828 <li class="toclevel-1 tocsection-1"><a href="#2"><span class="tocnumber">1</span> <span class="toctext">2</span></a>
6829 <ul>
6830 <li class="toclevel-2 tocsection-2"><a href="#6"><span class="tocnumber">1.1</span> <span class="toctext">6</span></a></li>
6831 <li class="toclevel-2 tocsection-3"><a href="#3"><span class="tocnumber">1.2</span> <span class="toctext">3</span></a></li>
6832 </ul>
6833 </li>
6834 <li class="toclevel-1 tocsection-4"><a href="#1"><span class="tocnumber">2</span> <span class="toctext">1</span></a>
6835 <ul>
6836 <li class="toclevel-2 tocsection-5"><a href="#5"><span class="tocnumber">2.1</span> <span class="toctext">5</span></a></li>
6837 <li class="toclevel-2 tocsection-6"><a href="#2_2"><span class="tocnumber">2.2</span> <span class="toctext">2</span></a></li>
6838 </ul>
6839 </li>
6840 </ul>
6841 </td></tr></table><script>if (window.showTocToggle) { var tocShowText = "show"; var tocHideText = "hide"; showTocToggle(); } </script>
6842 <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>
6843 <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>
6844 <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>
6845 <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>
6846 <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>
6847 <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>
6849 !! end
6852 !! test
6853 ISBN with a dummy number
6854 !! input
6855 ISBN ---
6856 !! result
6857 <p>ISBN ---
6858 </p>
6859 !! end
6862 !! test
6863 ISBN with space-delimited number
6864 !! input
6865 ISBN 92 9017 032 8
6866 !! result
6867 <p><a href="/wiki/Special:BookSources/9290170328" class="internal mw-magiclink-isbn">ISBN 92 9017 032 8</a>
6868 </p>
6869 !! end
6872 !! test
6873 ISBN with multiple spaces, no number
6874 !! input
6875 ISBN  foo
6876 !! result
6877 <p>ISBN  foo
6878 </p>
6879 !! end
6882 !! test
6883 ISBN length
6884 !! input
6885 ISBN 123456789
6887 ISBN 1234567890
6889 ISBN 12345678901
6890 !! result
6891 <p>ISBN 123456789
6892 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
6893 </p><p>ISBN 12345678901
6894 </p>
6895 !! end
6898 !! test
6899 ISBN with trailing year (bug 8110)
6900 !! input
6901 ISBN 1-234-56789-0 - 2006
6903 ISBN 1 234 56789 0 - 2006
6904 !! result
6905 <p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1-234-56789-0</a> - 2006
6906 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1 234 56789 0</a> - 2006
6907 </p>
6908 !! end
6911 !! test
6912 anchorencode
6913 !! input
6914 {{anchorencode:foo bar©#%n}}
6915 !! result
6916 <p>foo_bar.C2.A9.23.25n
6917 </p>
6918 !! end
6921 !! test
6922 Bug 8293: Use of center tag ruins paragraph formatting
6923 !! input
6924 <center>
6926 </center>
6930  baz
6931 !! result
6932 <center>
6933 <p>foo
6934 </p>
6935 </center>
6936 <p>bar
6937 </p>
6938 <pre>baz
6939 </pre>
6940 !! end
6944 ### Language variants related tests
6946 !! test
6947 Self-link in language variants
6948 !! options
6949 title=[[Dunav]] language=sr
6950 !! input
6951 Both [[Dunav]] and [[Дунав]] are names for this river.
6952 !! result
6953 <p>Both <strong class="selflink">Dunav</strong> and <strong class="selflink">Дунав</strong> are names for this river.
6954 </p>
6955 !!end
6958 !! test
6959 Link to pages in language variants
6960 !! options
6961 language=sr
6962 !! input
6963 Main Page can be written as [[Маин Паге]]
6964 !! result
6965 <p>Main Page can be written as <a href="/wiki/Main_Page" title="Main Page">Маин Паге</a>
6966 </p>
6967 !!end
6970 !! test
6971 Multiple links to pages in language variants
6972 !! options
6973 language=sr
6974 !! input
6975 [[Main Page]] can be written as [[Маин Паге]] same as [[Маин Паге]].
6976 !! result
6977 <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>.
6978 </p>
6979 !!end
6982 !! test
6983 Simple template in language variants
6984 !! options
6985 language=sr
6986 !! input
6987 {{тест}}
6988 !! result
6989 <p>This is a test template
6990 </p>
6991 !! end
6994 !! test
6995 Template with explicit namespace in language variants
6996 !! options
6997 language=sr
6998 !! input
6999 {{Template:тест}}
7000 !! result
7001 <p>This is a test template
7002 </p>
7003 !! end
7006 !! test
7007 Basic test for template parameter in language variants
7008 !! options
7009 language=sr
7010 !! input
7011 {{парамтест|param=foo}}
7012 !! result
7013 <p>This is a test template with parameter foo
7014 </p>
7015 !! end
7018 !! test
7019 Simple category in language variants
7020 !! options
7021 language=sr cat
7022 !! input
7023 [[Category:МедиаWики Усер'с Гуиде]]
7024 !! result
7025 <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>
7026 !! end
7029 !! test
7030 Stripping -{}- tags (language variants)
7031 !! options
7032 language=sr
7033 !! input
7034 Latin proverb: -{Ne nuntium necare}-
7035 !! result
7036 <p>Latin proverb: Ne nuntium necare
7037 </p>
7038 !! end
7041 !! test
7042 Prevent conversion with -{}- tags (language variants)
7043 !! options
7044 language=sr variant=sr-ec
7045 !! input
7046 Latinski: -{Ne nuntium necare}-
7047 !! result
7048 <p>Латински: Ne nuntium necare
7049 </p>
7050 !! end
7053 !! test
7054 Prevent conversion of text with -{}- tags (language variants)
7055 !! options
7056 language=sr variant=sr-ec
7057 !! input
7058 Latinski: -{Ne nuntium necare}-
7059 !! result
7060 <p>Латински: Ne nuntium necare
7061 </p>
7062 !! end
7065 !! test
7066 Prevent conversion of links with -{}- tags (language variants)
7067 !! options
7068 language=sr variant=sr-ec
7069 !! input
7070 -{[[Main Page]]}-
7071 !! result
7072 <p><a href="/index.php?title=Main_Page&amp;variant=sr-ec" title="Main Page">Main Page</a>
7073 </p>
7074 !! end
7077 !! test
7078 -{}- tags within headlines (within html for parserConvert())
7079 !! options
7080 language=sr variant=sr-ec
7081 !! input
7082 == -{Naslov}- ==
7083 !! result
7084 <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>
7086 !! end
7089 !! test
7090 Explicit definition of language variant alternatives
7091 !! options
7092 language=zh variant=zh-tw
7093 !! input
7094 -{zh:China;zh-tw:Taiwan}-, not China
7095 !! result
7096 <p>Taiwan, not China
7097 </p>
7098 !! end
7101 !! test
7102 Explicit session-wise language variant mapping (A flag and - flag)
7103 !! options
7104 language=zh variant=zh-tw
7105 !! input
7106 Taiwan is not China.
7107 But -{A|zh:China;zh-tw:Taiwan}- is China,
7108 (This-{-|zh:China;zh-tw:Taiwan}- should be stripped!)
7109 and -{China}- is China.
7110 !! result
7111 <p>Taiwan is not China.
7112 But Taiwan is Taiwan,
7113 (This should be stripped!)
7114 and China is China.
7115 </p>
7116 !! end
7118 !! test
7119 Explicit session-wise language variant mapping (H flag for hide)
7120 !! options
7121 language=zh variant=zh-tw
7122 !! input
7123 (This-{H|zh:China;zh-tw:Taiwan}- should be stripped!)
7124 Taiwan is China.
7125 !! result
7126 <p>(This should be stripped!)
7127 Taiwan is Taiwan.
7128 </p>
7129 !! end
7131 !! test
7132 Adding explicit conversion rule for title (T flag)
7133 !! options
7134 language=zh variant=zh-tw showtitle
7135 !! input
7136 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
7137 !! result
7138 Taiwan
7139 <p>Should be stripped!
7140 </p>
7141 !! end
7143 !! test
7144 Testing that changing the language variant here in the tests actually works
7145 !! options
7146 language=zh variant=zh showtitle
7147 !! input
7148 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
7149 !! result
7150 China
7151 <p>Should be stripped!
7152 </p>
7153 !! end
7155 !! test
7156 Raw output of variant escape tags (R flag)
7157 !! options
7158 language=zh variant=zh-tw
7159 !! input
7160 Raw: -{R|zh:China;zh-tw:Taiwan}-
7161 !! result
7162 <p>Raw: zh:China;zh-tw:Taiwan
7163 </p>
7164 !! end
7166 !! test
7167 Nested using of manual convert syntax
7168 !! options
7169 language=zh variant=zh-hk
7170 !! input
7171 Nested: -{zh-hans:Hi -{zh-cn:China;zh-sg:Singapore;}-;zh-hant:Hello -{zh-tw:Taiwan;zh-hk:H-{ong}- K-{}-ong;}-;}-!
7172 !! result
7173 <p>Nested: Hello Hong Kong!
7174 </p>
7175 !! end
7177 !! test
7178 Do not convert roman numbers to language variants
7179 !! options
7180 language=sr variant=sr-ec
7181 !! input
7182 Fridrih IV je car.
7183 !! result
7184 <p>Фридрих IV је цар.
7185 </p>
7186 !! end
7188 !! test
7189 Unclosed language converter markup "-{"
7190 !! options 
7191 language=sr
7192 !! input
7193 -{T|hello
7194 !! result
7195 <p>-{T|hello
7196 </p>
7197 !! end
7199 !! test
7200 Don't convert raw rule "-{R|=&gt;}-" to "=>"
7201 !! options
7202 language=sr
7203 !! input
7204 -{R|=&gt;}-
7205 !! result 
7206 <p>=&gt;
7207 </p>
7208 !!end
7210 !!article 
7211 Template:Bullet
7212 !!text
7213 * Bar
7214 !!endarticle
7216 !! test
7217 Bug 529: Uncovered bullet
7218 !! input
7219 * Foo {{bullet}}
7220 !! result
7221 <ul><li> Foo 
7222 </li><li> Bar
7223 </li></ul>
7225 !! end
7227 !! test
7228 Bug 529: Uncovered table already at line-start
7229 !! input
7232 {{table}}
7234 !! result
7235 <p>x
7236 </p>
7237 <table>
7238 <tr>
7239 <td> 1 </td><td> 2
7240 </td></tr>
7241 <tr>
7242 <td> 3 </td><td> 4
7243 </td></tr></table>
7244 <p>y
7245 </p>
7246 !! end
7248 !! test
7249 Bug 529: Uncovered bullet in parser function result
7250 !! input
7251 * Foo {{lc:{{bullet}} }}
7252 !! result
7253 <ul><li> Foo 
7254 </li><li> bar
7255 </li></ul>
7257 !! end
7259 !! test
7260 Bug 5678: Double-parsed template argument
7261 !! input
7262 {{lc:{{{1}}}|hello}}
7263 !! result
7264 <p>{{{1}}}
7265 </p>
7266 !! end
7268 !! test
7269 Bug 5678: Double-parsed template invocation
7270 !! input
7271 {{lc:{{paramtest {{!}} param = hello }} }}
7272 !! result
7273 <p>{{paramtest | param = hello }}
7274 </p>
7275 !! end
7277 !! test
7278 Case insensitivity of parser functions for non-ASCII characters (bug 8143)
7279 !! options
7280 language=cs
7281 title=[[Main Page]]
7282 !! input
7283 {{PRVNÍVELKÉ:ěščř}}
7284 {{prvnívelké:ěščř}}
7285 {{PRVNÍMALÉ:ěščř}}
7286 {{prvnímalé:ěščř}}
7287 {{MALÁ:ěščř}}
7288 {{malá:ěščř}}
7289 {{VELKÁ:ěščř}}
7290 {{velká:ěščř}}
7291 !! result
7292 <p>Ěščř
7293 Ěščř
7294 ěščř
7295 ěščř
7296 ěščř
7297 ěščř
7298 ĚŠČŘ
7299 ĚŠČŘ
7300 </p>
7301 !! end
7303 !! test
7304 Morwen/13: Unclosed link followed by heading
7305 !! input
7306 [[link
7307 ==heading==
7308 !! result
7309 <p>[[link
7310 </p>
7311 <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>
7313 !! end
7315 !! test
7316 HHP2.1: Heuristics for headings in preprocessor parenthetical structures
7317 !! input
7318 {{foo|
7319 =heading=
7320 !! result
7321 <p>{{foo|
7322 </p>
7323 <h1> <span class="mw-headline" id="heading">heading</span></h1>
7325 !! end
7327 !! test
7328 HHP2.2: Heuristics for headings in preprocessor parenthetical structures
7329 !! input
7330 {{foo|
7331 ==heading==
7332 !! result
7333 <p>{{foo|
7334 </p>
7335 <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>
7337 !! end
7339 !! test
7340 Tildes in comments
7341 !! options
7343 !! input
7344 <!-- ~~~~ -->
7345 !! result
7346 <!-- ~~~~ -->
7347 !! end
7349 !! test
7350 Paragraphs inside divs (no extra line breaks)
7351 !! input
7352 <div>Line one
7354 Line two</div>
7355 !! result
7356 <div>Line one
7357 Line two</div>
7359 !! end
7361 !! test
7362 Paragraphs inside divs (extra line break on open)
7363 !! input
7364 <div>
7365 Line one
7367 Line two</div>
7368 !! result
7369 <div>
7370 <p>Line one
7371 </p>
7372 Line two</div>
7374 !! end
7376 !! test
7377 Paragraphs inside divs (extra line break on close)
7378 !! input
7379 <div>Line one
7381 Line two
7382 </div>
7383 !! result
7384 <div>Line one
7385 <p>Line two
7386 </p>
7387 </div>
7389 !! end
7391 !! test
7392 Paragraphs inside divs (extra line break on open and close)
7393 !! input
7394 <div>
7395 Line one
7397 Line two
7398 </div>
7399 !! result
7400 <div>
7401 <p>Line one
7402 </p><p>Line two
7403 </p>
7404 </div>
7406 !! end
7408 # Bug 6200: <blockquote> should behave like <div> with respect to line breaks
7409 !! test
7410 Bug 6200: paragraphs inside blockquotes (no extra line breaks)
7411 !! options
7412 disabled
7413 !! input
7414 <blockquote>Line one
7416 Line two</blockquote>
7417 !! result
7418 <blockquote>Line one
7419 Line two</blockquote>
7421 !! end
7423 !! test
7424 Bug 6200: paragraphs inside blockquotes (extra line break on open)
7425 !! options
7426 disabled
7427 !! input
7428 <blockquote>
7429 Line one
7431 Line two</blockquote>
7432 !! result
7433 <blockquote>
7434 <p>Line one
7435 </p>
7436 Line two</blockquote>
7438 !! end
7440 !! test
7441 Bug 6200: paragraphs inside blockquotes (extra line break on close)
7442 !! options
7443 disabled
7444 !! input
7445 <blockquote>Line one
7447 Line two
7448 </blockquote>
7449 !! result
7450 <blockquote>Line one
7451 <p>Line two
7452 </p>
7453 </blockquote>
7455 !! end
7457 !! test
7458 Bug 6200: paragraphs inside blockquotes (extra line break on open and close)
7459 !! options
7460 disabled
7461 !! input
7462 <blockquote>
7463 Line one
7465 Line two
7466 </blockquote>
7467 !! result
7468 <blockquote>
7469 <p>Line one
7470 </p><p>Line two
7471 </p>
7472 </blockquote>
7474 !! end
7476 !! test
7477 Paragraphs inside blockquotes/divs (no extra line breaks)
7478 !! input
7479 <blockquote><div>Line one
7481 Line two</div></blockquote>
7482 !! result
7483 <blockquote><div>Line one
7484 Line two</div></blockquote>
7486 !! end
7488 !! test
7489 Paragraphs inside blockquotes/divs (extra line break on open)
7490 !! input
7491 <blockquote><div>
7492 Line one
7494 Line two</div></blockquote>
7495 !! result
7496 <blockquote><div>
7497 <p>Line one
7498 </p>
7499 Line two</div></blockquote>
7501 !! end
7503 !! test
7504 Paragraphs inside blockquotes/divs (extra line break on close)
7505 !! input
7506 <blockquote><div>Line one
7508 Line two
7509 </div></blockquote>
7510 !! result
7511 <blockquote><div>Line one
7512 <p>Line two
7513 </p>
7514 </div></blockquote>
7516 !! end
7518 !! test
7519 Paragraphs inside blockquotes/divs (extra line break on open and close)
7520 !! input
7521 <blockquote><div>
7522 Line one
7524 Line two
7525 </div></blockquote>
7526 !! result
7527 <blockquote><div>
7528 <p>Line one
7529 </p><p>Line two
7530 </p>
7531 </div></blockquote>
7533 !! end
7535 !! test
7536 Interwiki links trounced by replaceExternalLinks after early LinkHolderArray expansion
7537 !! options
7538 wgLinkHolderBatchSize=0
7539 !! input
7540 [[meatball:1]]
7541 [[meatball:2]]
7542 [[meatball:3]]
7543 !! result
7544 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?1" class="extiw" title="meatball:1">meatball:1</a>
7545 <a href="http://www.usemod.com/cgi-bin/mb.pl?2" class="extiw" title="meatball:2">meatball:2</a>
7546 <a href="http://www.usemod.com/cgi-bin/mb.pl?3" class="extiw" title="meatball:3">meatball:3</a>
7547 </p>
7548 !! end
7550 !! test
7551 Free external link invading image caption
7552 !! input
7553 [[Image:Foobar.jpg|thumb|http://x|hello]]
7554 !! result
7555 <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>
7557 !! end
7559 !! test
7560 Bug 15196: localised external link numbers
7561 !! options
7562 language=fa
7563 !! input
7564 [http://en.wikipedia.org/]
7565 !! result
7566 <p><a href="http://en.wikipedia.org/" class="external autonumber" rel="nofollow">[۱]</a>
7567 </p>
7568 !! end
7570 !! test
7571 Multibyte character in padleft
7572 !! input
7573 {{padleft:-Hello|7|Æ}}
7574 !! result
7575 <p>Æ-Hello
7576 </p>
7577 !! end
7579 !! test
7580 Multibyte character in padright
7581 !! input
7582 {{padright:Hello-|7|Æ}}
7583 !! result
7584 <p>Hello-Æ
7585 </p>
7586 !! end
7588 !! test
7589 Formatted date
7590 !! config
7591 wgUseDynamicDates=1
7592 !! input
7593 [[2009-03-24]]
7594 !! result
7595 <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>
7596 </p>
7597 !!end
7599 !!test
7600 formatdate parser function
7601 !!input
7602 {{#formatdate:2009-03-24}}
7603 !! result
7604 <p><span class="mw-formatted-date" title="2009-03-24">2009-03-24</span>
7605 </p>
7606 !! end
7608 !!test
7609 formatdate parser function, with default format
7610 !!input
7611 {{#formatdate:2009-03-24|mdy}}
7612 !! result
7613 <p><span class="mw-formatted-date" title="2009-03-24">March 24, 2009</span>
7614 </p>
7615 !! end
7617 !! test
7618 Linked date with autoformatting disabled
7619 !! config
7620 wgUseDynamicDates=false
7621 !! input
7622 [[2009-03-24]]
7623 !! result
7624 <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>
7625 </p>
7626 !! end
7628 !! test
7629 Spacing of numbers in formatted dates
7630 !! input
7631 {{#formatdate:January 15}}
7632 !! result
7633 <p><span class="mw-formatted-date" title="01-15">January 15</span>
7634 </p>
7635 !! end
7637 !! test
7638 Spacing of numbers in formatted dates (linked)
7639 !! config
7640 wgUseDynamicDates=true
7641 !! input
7642 [[January 15]]
7643 !! result
7644 <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>
7645 </p>
7646 !! end
7653 # Edit comments
7656 !! test
7657 Edit comment with link
7658 !! options
7659 comment
7660 !! input
7661 I like the [[Main Page]] a lot
7662 !! result
7663 I like the <a href="/wiki/Main_Page" title="Main Page">Main Page</a> a lot
7664 !!end
7666 !! test
7667 Edit comment with link and link text
7668 !! options
7669 comment
7670 !! input
7671 I like the [[Main Page|best pages]] a lot
7672 !! result
7673 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
7674 !!end
7676 !! test
7677 Edit comment with link and link text with suffix
7678 !! options
7679 comment
7680 !! input
7681 I like the [[Main Page|best page]]s a lot
7682 !! result
7683 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
7684 !!end
7686 !! test
7687 Edit comment with section link (non-local, eg in history list)
7688 !! options
7689 comment title=[[Main Page]]
7690 !! input
7691 /* External links */ removed bogus entries
7692 !! result
7693 <span class="autocomment"><a href="/wiki/Main_Page#External_links" title="Main Page">→</a>External links: </span> removed bogus entries
7694 !!end
7696 !! test
7697 Edit comment with section link (local, eg in diff view)
7698 !! options
7699 comment local title=[[Main Page]]
7700 !! input
7701 /* External links */ removed bogus entries
7702 !! result
7703 <span class="autocomment"><a href="#External_links">→</a>External links: </span> removed bogus entries
7704 !!end
7706 !! test
7707 Edit comment with subpage link (bug 14080)
7708 !! options
7709 comment
7710 subpage
7711 title=[[Subpage test]]
7712 !! input
7713 Poked at a [[/subpage]] here...
7714 !! result
7715 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a> here...
7716 !!end
7718 !! test
7719 Edit comment with subpage link and link text (bug 14080)
7720 !! options
7721 comment
7722 subpage
7723 title=[[Subpage test]]
7724 !! input
7725 Poked at a [[/subpage|neat little page]] here...
7726 !! result
7727 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">neat little page</a> here...
7728 !!end
7730 !! test
7731 Edit comment with bogus subpage link in non-subpage NS (bug 14080)
7732 !! options
7733 comment
7734 title=[[Subpage test]]
7735 !! input
7736 Poked at a [[/subpage]] here...
7737 !! result
7738 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...
7739 !!end
7741 !! test
7742 Edit comment with bare anchor link (local, as on diff)
7743 !! options
7744 comment
7745 local
7746 title=[[Main Page]]
7747 !!input
7748 [[#section]]
7749 !! result
7750 <a href="#section">#section</a>
7751 !! end
7753 !! test
7754 Edit comment with bare anchor link (non-local, as on history)
7755 !! options
7756 comment
7757 title=[[Main Page]]
7758 !!input
7759 [[#section]]
7760 !! result
7761 <a href="/wiki/Main_Page#section" title="Main Page">#section</a>
7762 !! end
7764 !!article
7765 MediaWiki:bad image list
7766 !!text
7767 * [[File:Bad.jpg]] except [[Nasty page]]
7768 !!endarticle
7770 !! test
7771 Bad images - basic functionality
7772 !! input
7773 [[File:Bad.jpg]]
7774 !! result
7775 !! end
7777 !! test
7778 Bad images - bug 16039: text after bad image disappears
7779 !! input
7780 Foo bar
7781 [[File:Bad.jpg]]
7782 Bar foo
7783 !! result
7784 <p>Foo bar
7785 </p><p>Bar foo
7786 </p>
7787 !! end
7789 !! test
7790 Verify that displaytitle works (bug #22501) no displaytitle
7791 !! options
7792 showtitle
7793 !! config
7794 wgAllowDisplayTitle=true
7795 wgRestrictDisplayTitle=false
7796 !! input
7797 this is not the the title
7798 !! result
7799 Parser test
7800 <p>this is not the the title
7801 </p>
7802 !! end
7804 !! test
7805 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=false
7806 !! options
7807 showtitle
7808 title=[[Screen]]
7809 !! config
7810 wgAllowDisplayTitle=true
7811 wgRestrictDisplayTitle=false
7812 !! input
7813 this is not the the title
7814 {{DISPLAYTITLE:whatever}}
7815 !! result
7816 whatever
7817 <p>this is not the the title
7818 </p>
7819 !! end
7821 !! test
7822 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true mismatch
7823 !! options
7824 showtitle
7825 title=[[Screen]]
7826 !! config
7827 wgAllowDisplayTitle=true
7828 wgRestrictDisplayTitle=true
7829 !! input
7830 this is not the the title
7831 {{DISPLAYTITLE:whatever}}
7832 !! result
7833 Screen
7834 <p>this is not the the title
7835 </p>
7836 !! end
7838 !! test
7839 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true matching
7840 !! options
7841 showtitle
7842 title=[[Screen]]
7843 !! config
7844 wgAllowDisplayTitle=true
7845 wgRestrictDisplayTitle=true
7846 !! input
7847 this is not the the title
7848 {{DISPLAYTITLE:screen}}
7849 !! result
7850 screen
7851 <p>this is not the the title
7852 </p>
7853 !! end
7855 !! test
7856 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false
7857 !! options
7858 showtitle
7859 title=[[Screen]]
7860 !! config
7861 wgAllowDisplayTitle=false
7862 !! input
7863 this is not the the title
7864 {{DISPLAYTITLE:screen}}
7865 !! result
7866 Screen
7867 <p>this is not the the title
7868 <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>
7869 </p>
7870 !! end
7872 !! test
7873 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false no DISPLAYTITLE
7874 !! options
7875 showtitle
7876 title=[[Screen]]
7877 !! config
7878 wgAllowDisplayTitle=false
7879 !! input
7880 this is not the the title
7881 !! result
7882 Screen
7883 <p>this is not the the title
7884 </p>
7885 !! end
7887 !! test
7888 preload: check <noinclude> and <includeonly>
7889 !! options
7890 preload
7891 !! input
7892 Hello <noinclude>cruel</noinclude><includeonly>kind</includeonly> world.
7893 !! result
7894 Hello kind world.
7895 !! end
7897 !! test
7898 preload: check <onlyinclude>
7899 !! options
7900 preload
7901 !! input
7902 Goodbye <onlyinclude>Hello world</onlyinclude>
7903 !! result
7904 Hello world
7905 !! end
7907 !! test
7908 preload: can pass tags through if we want to
7909 !! options
7910 preload
7911 !! input
7912 <includeonly><</includeonly>includeonly>Hello world<includeonly><</includeonly>/includeonly>
7913 !! result
7914 <includeonly>Hello world</includeonly>
7915 !! end
7917 !! test
7918 preload: check that it doesn't try to do tricks
7919 !! options
7920 preload
7921 !! input
7922 * <!-- Hello --> ''{{world}}'' {{<includeonly>subst:</includeonly>How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
7923 !! result
7924 * <!-- Hello --> ''{{world}}'' {{subst:How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
7925 !! end
7927 TODO:
7928 more images
7929 more tables
7930 math
7931 character entities
7932 and much more
7933 Try for 100% code coverage