Localisation updates for core messages from Betawiki (2008-10-07 23:07 CEST)
[mediawiki.git] / maintenance / parserTests.txt
blob9854cff0de177b932f216369c5ab4dec5fafe1f2
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
25 # For testing purposes, temporary articles can created:
26 # !!article / NAMESPACE:TITLE / !!text / ARTICLE TEXT / !!endarticle
27 # where '/' denotes a newline.
29 # This is the standard article assumed to exist.
30 !! article
31 Main Page
32 !! text
33 blah blah
34 !! endarticle
36 !!article 
37 Template:Foo
38 !!text
39 FOO
40 !!endarticle
42 !! article 
43 Template:Blank
44 !! text
45 !! endarticle
47 !! article
48 Template:!
49 !! text
51 !! endarticle
53 ###
54 ### Basic tests
55 ###
56 !! test
57 Blank input
58 !! input
59 !! result
60 !! end
63 !! test
64 Simple paragraph
65 !! input
66 This is a simple paragraph.
67 !! result
68 <p>This is a simple paragraph.
69 </p>
70 !! end
72 !! test
73 Simple list
74 !! input
75 * Item 1
76 * Item 2
77 !! result
78 <ul><li> Item 1
79 </li><li> Item 2
80 </li></ul>
82 !! end
84 !! test
85 Italics and bold
86 !! input
87 * plain
88 * plain''italic''plain
89 * plain''italic''plain''italic''plain
90 * plain'''bold'''plain
91 * plain'''bold'''plain'''bold'''plain
92 * plain''italic''plain'''bold'''plain
93 * plain'''bold'''plain''italic''plain
94 * plain''italic'''bold-italic'''italic''plain
95 * plain'''bold''bold-italic''bold'''plain
96 * plain'''''bold-italic'''italic''plain
97 * plain'''''bold-italic''bold'''plain
98 * plain''italic'''bold-italic'''''plain
99 * plain'''bold''bold-italic'''''plain
100 * plain l'''italic''plain
101 * plain l''''bold''' plain
102 !! result
103 <ul><li> plain
104 </li><li> plain<i>italic</i>plain
105 </li><li> plain<i>italic</i>plain<i>italic</i>plain
106 </li><li> plain<b>bold</b>plain
107 </li><li> plain<b>bold</b>plain<b>bold</b>plain
108 </li><li> plain<i>italic</i>plain<b>bold</b>plain
109 </li><li> plain<b>bold</b>plain<i>italic</i>plain
110 </li><li> plain<i>italic<b>bold-italic</b>italic</i>plain
111 </li><li> plain<b>bold<i>bold-italic</i>bold</b>plain
112 </li><li> plain<i><b>bold-italic</b>italic</i>plain
113 </li><li> plain<b><i>bold-italic</i>bold</b>plain
114 </li><li> plain<i>italic<b>bold-italic</b></i>plain
115 </li><li> plain<b>bold<i>bold-italic</i></b>plain
116 </li><li> plain l'<i>italic</i>plain
117 </li><li> plain l'<b>bold</b> plain
118 </li></ul>
120 !! end
123 ### <nowiki> test cases
126 !! test
127 <nowiki> unordered list
128 !! input
129 <nowiki>* This is not an unordered list item.</nowiki>
130 !! result
131 <p>* This is not an unordered list item.
132 </p>
133 !! end
135 !! test
136 <nowiki> spacing
137 !! input
138 <nowiki>Lorem ipsum dolor
140 sed abit.
141   sed nullum.
143 :and a colon
144 </nowiki>
145 !! result
146 <p>Lorem ipsum dolor
148 sed abit.
149   sed nullum.
151 :and a colon
153 </p>
154 !! end
156 !! test
157 nowiki 3
158 !! input
159 :There is not nowiki.
160 :There is <nowiki>nowiki</nowiki>.
162 #There is not nowiki.
163 #There is <nowiki>nowiki</nowiki>.
165 *There is not nowiki.
166 *There is <nowiki>nowiki</nowiki>.
167 !! result
168 <dl><dd>There is not nowiki.
169 </dd><dd>There is nowiki.
170 </dd></dl>
171 <ol><li>There is not nowiki.
172 </li><li>There is nowiki.
173 </li></ol>
174 <ul><li>There is not nowiki.
175 </li><li>There is nowiki.
176 </li></ul>
178 !! end
182 ### Comments
184 !! test
185 Comment test 1
186 !! input
187 <!-- comment 1 --> asdf
188 <!-- comment 2 -->
189 !! result
190 <pre>asdf
191 </pre>
193 !! end
195 !! test
196 Comment test 2
197 !! input
198 asdf
199 <!-- comment 1 -->
201 !! result
202 <p>asdf
204 </p>
205 !! end
207 !! test
208 Comment test 3
209 !! input
210 asdf
211 <!-- comment 1 -->
212 <!-- comment 2 -->
214 !! result
215 <p>asdf
217 </p>
218 !! end
220 !! test
221 Comment test 4
222 !! input
223 asdf<!-- comment 1 -->jkl
224 !! result
225 <p>asdfjkl
226 </p>
227 !! end
229 !! test
230 Comment spacing
231 !! input
233  <!-- foo --> b <!-- bar -->
235 !! result
236 <p>a
237 </p>
238 <pre> b 
239 </pre>
240 <p>c
241 </p>
242 !! end
244 !! test
245 Comment whitespace
246 !! input
247 <!-- returns a single newline, not nothing, since the newline after > is not stripped -->
248 !! result
250 !! end
252 !! test
253 Comment semantics and delimiters
254 !! input
255 <!-- --><!----><!-----><!------>
256 !! result
258 !! end
260 !! test
261 Comment semantics and delimiters, redux
262 !! input
263 <!-- In SGML every "foo" here would actually show up in the text -- foo -- bar
264 -- foo -- funky huh? ... -->
265 !! result
267 !! end
269 !! test
270 Comment semantics and delimiters: directors cut
271 !! input
272 <!-- ... However we like to keep things simple and somewhat XML-ish so we eat
273 everything starting with < followed by !-- until the first -- and > we see,
274 that wouldn't be valid XML however, since in XML -- has to terminate a comment
275 -->-->
276 !! result
277 <p>--&gt;
278 </p>
279 !! end
281 !! test
282 Comment semantics: nesting
283 !! input
284 <!--<!-- no, we're not going to do anything fancy here -->-->
285 !! result
286 <p>--&gt;
287 </p>
288 !! end
290 !! test
291 Comment semantics: unclosed comment at end
292 !! input
293 <!--This comment will run out to the end of the document
294 !! result
296 !! end
298 !! test
299 Comment in template title
300 !! input
301 {{f<!---->oo}}
302 !! result
303 <p>FOO
304 </p>
305 !! end
307 !! test
308 Comment on its own line post-expand
309 !! input
311 {{blank}}<!---->
313 !! result
314 <p>a
315 </p><p>b
316 </p>
317 !! end
320 ### Preformatted text
322 !! test
323 Preformatted text
324 !! input
325  This is some
326  Preformatted text
327  With ''italic''
328  And '''bold'''
329  And a [[Main Page|link]]
330 !! result
331 <pre>This is some
332 Preformatted text
333 With <i>italic</i>
334 And <b>bold</b>
335 And a <a href="/wiki/Main_Page" title="Main Page">link</a>
336 </pre>
337 !! end
339 !! test
340 <pre> with <nowiki> inside (compatibility with 1.6 and earlier)
341 !! input
342 <pre><nowiki>
344 <cite>
345 <em>
346 </nowiki></pre>
347 !! result
348 <pre>
349 &lt;b&gt;
350 &lt;cite&gt;
351 &lt;em&gt;
352 </pre>
354 !! end
356 !! test
357 Regression with preformatted in <center>
358 !! input
359 <center>
360  Blah
361 </center>
362 !! result
363 <center>
364 <pre>Blah
365 </pre>
366 </center>
368 !! end
370 !! test
371 <pre> with attributes (bug 3202)
372 !! input
373 <pre style="background: blue; color:white">Bluescreen of WikiDeath</pre>
374 !! result
375 <pre style="background: blue; color:white">Bluescreen of WikiDeath</pre>
377 !! end
379 !! test
380 <pre> with width attribute (bug 3202)
381 !! input
382 <pre width="8">Narrow screen goodies</pre>
383 !! result
384 <pre width="8">Narrow screen goodies</pre>
386 !! end
388 !! test
389 <pre> with forbidden attribute (bug 3202)
390 !! input
391 <pre width="8" onmouseover="alert(document.cookie)">Narrow screen goodies</pre>
392 !! result
393 <pre width="8">Narrow screen goodies</pre>
395 !! end
397 !! test
398 <pre> with forbidden attribute values (bug 3202)
399 !! input
400 <pre width="8" style="border-width: expression(alert(document.cookie))">Narrow screen goodies</pre>
401 !! result
402 <pre width="8">Narrow screen goodies</pre>
404 !! end
407 ### Definition lists
409 !! test
410 Simple definition
411 !! input
412 ; name : Definition
413 !! result
414 <dl><dt> name&nbsp;</dt><dd> Definition
415 </dd></dl>
417 !! end
419 !! test
420 Definition list for indentation only
421 !! input
422 : Indented text
423 !! result
424 <dl><dd> Indented text
425 </dd></dl>
427 !! end
429 !! test
430 Definition list with no space
431 !! input
432 ;name:Definition
433 !! result
434 <dl><dt>name</dt><dd>Definition
435 </dd></dl>
437 !!end
439 !! test
440 Definition list with URL link
441 !! input
442 ; http://example.com/ : definition
443 !! result
444 <dl><dt> <a href="http://example.com/" class="external free" title="http://example.com/" rel="nofollow">http://example.com/</a>&nbsp;</dt><dd> definition
445 </dd></dl>
447 !! end
449 !! test
450 Definition list with bracketed URL link
451 !! input
452 ;[http://www.example.com/ Example]:Something about it
453 !! result
454 <dl><dt><a href="http://www.example.com/" class="external text" title="http://www.example.com/" rel="nofollow">Example</a></dt><dd>Something about it
455 </dd></dl>
457 !! end
459 !! test
460 Definition list with wikilink containing colon
461 !! input
462 ; [[Help:FAQ]]: The least-read page on Wikipedia
463 !! result
464 <dl><dt> <a href="/index.php?title=Help:FAQ&amp;action=edit&amp;redlink=1" class="new" title="Help:FAQ (not yet written)">Help:FAQ</a></dt><dd> The least-read page on Wikipedia
465 </dd></dl>
467 !! end
469 # At Brion's and JeLuF's insistence... :)
470 !! test
471 Definition list with news link containing colon
472 !! input
473 ;  news:alt.wikipedia.rox: This isn't even a real newsgroup!
474 !! result
475 <dl><dt>  <a href="news:alt.wikipedia.rox" class="external free" title="news:alt.wikipedia.rox" rel="nofollow">news:alt.wikipedia.rox</a></dt><dd> This isn't even a real newsgroup!
476 </dd></dl>
478 !! end
480 !! test
481 Malformed definition list with colon
482 !! input
483 ;  news:alt.wikipedia.rox -- don't crash or enter an infinite loop
484 !! result
485 <dl><dt>  <a href="news:alt.wikipedia.rox" class="external free" title="news:alt.wikipedia.rox" rel="nofollow">news:alt.wikipedia.rox</a> -- don't crash or enter an infinite loop
486 </dt></dl>
488 !! end
490 !! test
491 Definition lists: colon in external link text
492 !! input
493 ; [http://www.wikipedia2.org/ Wikipedia : The Next Generation]: OK, I made that up
494 !! result
495 <dl><dt> <a href="http://www.wikipedia2.org/" class="external text" title="http://www.wikipedia2.org/" rel="nofollow">Wikipedia&nbsp;: The Next Generation</a></dt><dd> OK, I made that up
496 </dd></dl>
498 !! end
500 !! test
501 Definition lists: colon in HTML attribute
502 !! input
503 ;<b style="display: inline">bold</b>
504 !! result
505 <dl><dt><b style="display: inline">bold</b>
506 </dt></dl>
508 !! end
511 !! test
512 Definition lists: self-closed tag
513 !! input
514 ;one<br/>two : two-line fun
515 !! result
516 <dl><dt>one<br />two&nbsp;</dt><dd> two-line fun
517 </dd></dl>
519 !! end
523 ### External links
525 !! test
526 External links: non-bracketed
527 !! input
528 Non-bracketed: http://example.com
529 !! result
530 <p>Non-bracketed: <a href="http://example.com" class="external free" title="http://example.com" rel="nofollow">http://example.com</a>
531 </p>
532 !! end
534 !! test
535 External links: numbered
536 !! input
537 Numbered: [http://example.com]
538 Numbered: [http://example.net]
539 Numbered: [http://example.com]
540 !! result
541 <p>Numbered: <a href="http://example.com" class="external autonumber" title="http://example.com" rel="nofollow">[1]</a>
542 Numbered: <a href="http://example.net" class="external autonumber" title="http://example.net" rel="nofollow">[2]</a>
543 Numbered: <a href="http://example.com" class="external autonumber" title="http://example.com" rel="nofollow">[3]</a>
544 </p>
545 !!end
547 !! test
548 External links: specified text
549 !! input
550 Specified text: [http://example.com link]
551 !! result
552 <p>Specified text: <a href="http://example.com" class="external text" title="http://example.com" rel="nofollow">link</a>
553 </p>
554 !!end
556 !! test
557 External links: trail
558 !! input
559 Linktrails should not work for external links: [http://example.com link]s
560 !! result
561 <p>Linktrails should not work for external links: <a href="http://example.com" class="external text" title="http://example.com" rel="nofollow">link</a>s
562 </p>
563 !! end
565 !! test
566 External links: dollar sign in URL
567 !! input
568 http://example.com/1$2345
569 !! result
570 <p><a href="http://example.com/1$2345" class="external free" title="http://example.com/1$2345" rel="nofollow">http://example.com/1$2345</a>
571 </p>
572 !! end
574 !! test
575 External links: dollar sign in URL (named)
576 !! input
577 [http://example.com/1$2345]
578 !! result
579 <p><a href="http://example.com/1$2345" class="external autonumber" title="http://example.com/1$2345" rel="nofollow">[1]</a>
580 </p>
581 !!end
583 !! test
584 External links: open square bracket forbidden in URL (bug 4377)
585 !! input
586 http://example.com/1[2345
587 !! result
588 <p><a href="http://example.com/1" class="external free" title="http://example.com/1" rel="nofollow">http://example.com/1</a>[2345
589 </p>
590 !! end
592 !! test
593 External links: open square bracket forbidden in URL (named) (bug 4377)
594 !! input
595 [http://example.com/1[2345]
596 !! result
597 <p><a href="http://example.com/1" class="external text" title="http://example.com/1" rel="nofollow">[2345</a>
598 </p>
599 !!end
601 !! test
602 External links: nowiki in URL link text (bug 6230)
603 !!input
604 [http://example.com/ <nowiki>''example site''</nowiki>]
605 !! result
606 <p><a href="http://example.com/" class="external text" title="http://example.com/" rel="nofollow">''example site''</a>
607 </p>
608 !! end
610 !! test
611 External links: newline forbidden in text (bug 6230 regression check)
612 !! input
613 [http://example.com/ first
614 second]
615 !! result
616 <p>[<a href="http://example.com/" class="external free" title="http://example.com/" rel="nofollow">http://example.com/</a> first
617 second]
618 </p>
619 !!end
621 !! test
622 External image
623 !! input
624 External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
625 !! result
626 <p>External image: <img src="http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" />
627 </p>
628 !! end
630 !! test
631 External image from https
632 !! input
633 External image from https: https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
634 !! result
635 <p>External image from https: <img src="https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" />
636 </p>
637 !! end
639 !! test
640 Link to non-http image, no img tag
641 !! input
642 Link to non-http image, no img tag: ftp://example.com/test.jpg
643 !! result
644 <p>Link to non-http image, no img tag: <a href="ftp://example.com/test.jpg" class="external free" title="ftp://example.com/test.jpg" rel="nofollow">ftp://example.com/test.jpg</a>
645 </p>
646 !! end
648 !! test
649 External links: terminating separator
650 !! input
651 Terminating separator: http://example.com/thing,
652 !! result
653 <p>Terminating separator: <a href="http://example.com/thing" class="external free" title="http://example.com/thing" rel="nofollow">http://example.com/thing</a>,
654 </p>
655 !! end
657 !! test
658 External links: intervening separator
659 !! input
660 Intervening separator: http://example.com/1,2,3
661 !! result
662 <p>Intervening separator: <a href="http://example.com/1,2,3" class="external free" title="http://example.com/1,2,3" rel="nofollow">http://example.com/1,2,3</a>
663 </p>
664 !! end
666 !! test
667 External links: old bug with URL in query
668 !! input
669 Old bug with URL in query: [http://example.com/thing?url=http://example.com link]
670 !! result
671 <p>Old bug with URL in query: <a href="http://example.com/thing?url=http://example.com" class="external text" title="http://example.com/thing?url=http://example.com" rel="nofollow">link</a>
672 </p>
673 !! end
675 !! test
676 External links: old URL-in-URL bug, mixed protocols
677 !! input
678 And again with mixed protocols: [ftp://example.com?url=http://example.com link]
679 !! result
680 <p>And again with mixed protocols: <a href="ftp://example.com?url=http://example.com" class="external text" title="ftp://example.com?url=http://example.com" rel="nofollow">link</a>
681 </p>
682 !!end
684 !! test
685 External links: URL in text
686 !! input
687 URL in text: [http://example.com http://example.com]
688 !! result
689 <p>URL in text: <a href="http://example.com" class="external free" title="http://example.com" rel="nofollow">http://example.com</a>
690 </p>
691 !! end
693 !! test
694 External links: Clickable images
695 !! input
696 ja-style clickable images: [http://example.com http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png]
697 !! result
698 <p>ja-style clickable images: <a href="http://example.com" class="external text" title="http://example.com" rel="nofollow"><img src="http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" /></a>
699 </p>
700 !!end
702 !! test
703 External links: raw ampersand
704 !! input
705 Old &amp; use: http://x&y
706 !! result
707 <p>Old &amp; use: <a href="http://x&amp;y" class="external free" title="http://x&amp;y" rel="nofollow">http://x&amp;y</a>
708 </p>
709 !! end
711 !! test
712 External links: encoded ampersand
713 !! input
714 Old &amp; use: http://x&amp;y
715 !! result
716 <p>Old &amp; use: <a href="http://x&amp;y" class="external free" title="http://x&amp;y" rel="nofollow">http://x&amp;y</a>
717 </p>
718 !! end
720 !! test
721 External links: encoded equals (bug 6102)
722 !! input
723 http://example.com/?foo&#61;bar
724 !! result
725 <p><a href="http://example.com/?foo=bar" class="external free" title="http://example.com/?foo=bar" rel="nofollow">http://example.com/?foo=bar</a>
726 </p>
727 !! end
729 !! test
730 External links: [raw ampersand]
731 !! input
732 Old &amp; use: [http://x&y]
733 !! result
734 <p>Old &amp; use: <a href="http://x&amp;y" class="external autonumber" title="http://x&amp;y" rel="nofollow">[1]</a>
735 </p>
736 !! end
738 !! test
739 External links: [encoded ampersand]
740 !! input
741 Old &amp; use: [http://x&amp;y]
742 !! result
743 <p>Old &amp; use: <a href="http://x&amp;y" class="external autonumber" title="http://x&amp;y" rel="nofollow">[1]</a>
744 </p>
745 !! end
747 !! test
748 External links: [encoded equals] (bug 6102)
749 !! input
750 [http://example.com/?foo&#61;bar]
751 !! result
752 <p><a href="http://example.com/?foo=bar" class="external autonumber" title="http://example.com/?foo=bar" rel="nofollow">[1]</a>
753 </p>
754 !! end
756 !! test
757 External links: [IDN ignored character reference in hostname; strip it right off]
758 !! input
759 [http://e&zwnj;xample.com/]
760 !! result
761 <p><a href="http://example.com/" class="external autonumber" title="http://example.com/" rel="nofollow">[1]</a>
762 </p>
763 !! end
765 !! test
766 External links: IDN ignored character reference in hostname; strip it right off
767 !! input
768 http://e&zwnj;xample.com/
769 !! result
770 <p><a href="http://example.com/" class="external free" title="http://example.com/" rel="nofollow">http://example.com/</a>
771 </p>
772 !! end
774 !! test
775 External links: www.jpeg.org (bug 554)
776 !! input
777 http://www.jpeg.org
778 !!result
779 <p><a href="http://www.jpeg.org" class="external free" title="http://www.jpeg.org" rel="nofollow">http://www.jpeg.org</a>
780 </p>
781 !! end
783 !! test
784 External links: URL within URL (original bug 2)
785 !! input
786 [http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp]
787 !! result
788 <p><a href="http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp" class="external autonumber" title="http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp" rel="nofollow">[1]</a>
789 </p>
790 !! end
792 !! test
793 BUG 361: URL inside bracketed URL
794 !! input
795 [http://www.example.com/foo http://www.example.com/bar]
796 !! result
797 <p><a href="http://www.example.com/foo" class="external text" title="http://www.example.com/foo" rel="nofollow">http://www.example.com/bar</a>
798 </p>
799 !! end
801 !! test
802 BUG 361: URL within URL, not bracketed
803 !! input
804 http://www.example.com/foo?=http://www.example.com/bar
805 !! result
806 <p><a href="http://www.example.com/foo?=http://www.example.com/bar" class="external free" title="http://www.example.com/foo?=http://www.example.com/bar" rel="nofollow">http://www.example.com/foo?=http://www.example.com/bar</a>
807 </p>
808 !! end
810 !! test
811 BUG 289: ">"-token in URL-tail
812 !! input
813 http://www.example.com/<hello>
814 !! result
815 <p><a href="http://www.example.com/" class="external free" title="http://www.example.com/" rel="nofollow">http://www.example.com/</a>&lt;hello&gt;
816 </p>
817 !!end
819 !! test
820 BUG 289: literal ">"-token in URL-tail
821 !! input
822 http://www.example.com/<b>html</b>
823 !! result
824 <p><a href="http://www.example.com/" class="external free" title="http://www.example.com/" rel="nofollow">http://www.example.com/</a><b>html</b>
825 </p>
826 !!end
828 !! test
829 BUG 289: ">"-token in bracketed URL
830 !! input
831 [http://www.example.com/<hello> stuff]
832 !! result
833 <p><a href="http://www.example.com/" class="external text" title="http://www.example.com/" rel="nofollow">&lt;hello&gt; stuff</a>
834 </p>
835 !!end
837 !! test
838 BUG 289: literal ">"-token in bracketed URL
839 !! input
840 [http://www.example.com/<b>html</b> stuff]
841 !! result
842 <p><a href="http://www.example.com/" class="external text" title="http://www.example.com/" rel="nofollow"><b>html</b> stuff</a>
843 </p>
844 !!end
846 !! test
847 BUG 289: literal double quote at end of URL
848 !! input
849 http://www.example.com/"hello"
850 !! result
851 <p><a href="http://www.example.com/" class="external free" title="http://www.example.com/" rel="nofollow">http://www.example.com/</a>"hello"
852 </p>
853 !!end
855 !! test
856 BUG 289: literal double quote in bracketed URL
857 !! input
858 [http://www.example.com/"hello" stuff]
859 !! result
860 <p><a href="http://www.example.com/" class="external text" title="http://www.example.com/" rel="nofollow">"hello" stuff</a>
861 </p>
862 !!end
864 !! test
865 External links: invalid character
866 Fixme: the missing char seems to have gone missing
867 !! options
868 disabled
869 !! input
870 [http://www.example.com  test]
871 !! result
872 <p>[<a href="http://www.example.com" class="external free" title="http://www.example.com" rel="nofollow">http://www.example.com</a>  test]
873 </p>
874 !! end
876 !! test
877 External links: multiple legal whitespace is fine, Magnus. Don't break it please. (bug 5081)
878 !! input
879 [http://www.example.com  test]
880 !! result
881 <p><a href="http://www.example.com" class="external text" title="http://www.example.com" rel="nofollow">test</a>
882 </p>
883 !! end
885 !! test
886 External links: wiki links within external link (Bug 3695)
887 !! input
888 [http://example.com [[wikilink]] embedded in ext link]
889 !! result
890 <p><a href="http://example.com" class="external text" title="http://example.com" rel="nofollow"></a><a href="/index.php?title=Wikilink&amp;action=edit&amp;redlink=1" class="new" title="Wikilink (not yet written)">wikilink</a><a href="http://example.com" class="external text" title="http://example.com" rel="nofollow"> embedded in ext link</a>
891 </p>
892 !! end
894 !! test
895 BUG 787: Links with one slash after the url protocol are invalid
896 !! input
897 http:/example.com
899 [http:/example.com title]
900 !! result
901 <p>http:/example.com
902 </p><p>[http:/example.com title]
903 </p>
904 !! end
906 !! test
907 Bug 2702: Mismatched <i>, <b> and <a> tags are invalid
908 !! input
909 ''[http://example.com text'']
910 [http://example.com '''text]'''
911 ''Something [http://example.com in italic'']
912 ''Something [http://example.com mixed''''', even bold]'''
913 '''''Now [http://example.com both''''']
914 !! result
915 <p><a href="http://example.com" class="external text" title="http://example.com" rel="nofollow"><i>text</i></a>
916 <a href="http://example.com" class="external text" title="http://example.com" rel="nofollow"><b>text</b></a>
917 <i>Something </i><a href="http://example.com" class="external text" title="http://example.com" rel="nofollow"><i>in italic</i></a>
918 <i>Something </i><a href="http://example.com" class="external text" title="http://example.com" rel="nofollow"><i>mixed</i><b>, even bold</b></a>
919 <i><b>Now </b></i><a href="http://example.com" class="external text" title="http://example.com" rel="nofollow"><i><b>both</b></i></a>
920 </p>
921 !! end
924 !! test
925 Bug 4781: %26 in URL
926 !! input
927 http://www.example.com/?title=AT%26T
928 !! result
929 <p><a href="http://www.example.com/?title=AT%26T" class="external free" title="http://www.example.com/?title=AT%26T" rel="nofollow">http://www.example.com/?title=AT%26T</a>
930 </p>
931 !! end
933 !! test
934 Bug 4781, 5267: %26 in URL
935 !! input
936 http://www.example.com/?title=100%25_Bran
937 !! result
938 <p><a href="http://www.example.com/?title=100%25_Bran" class="external free" title="http://www.example.com/?title=100%25_Bran" rel="nofollow">http://www.example.com/?title=100%25_Bran</a>
939 </p>
940 !! end
942 !! test
943 Bug 4781, 5267: %28, %29 in URL
944 !! input
945 http://www.example.com/?title=Ben-Hur_%281959_film%29
946 !! result
947 <p><a href="http://www.example.com/?title=Ben-Hur_%281959_film%29" class="external free" title="http://www.example.com/?title=Ben-Hur_%281959_film%29" rel="nofollow">http://www.example.com/?title=Ben-Hur_%281959_film%29</a>
948 </p>
949 !! end
952 !! test
953 Bug 4781: %26 in autonumber URL
954 !! input
955 [http://www.example.com/?title=AT%26T]
956 !! result
957 <p><a href="http://www.example.com/?title=AT%26T" class="external autonumber" title="http://www.example.com/?title=AT%26T" rel="nofollow">[1]</a>
958 </p>
959 !! end
961 !! test
962 Bug 4781, 5267: %26 in autonumber URL
963 !! input
964 [http://www.example.com/?title=100%25_Bran]
965 !! result
966 <p><a href="http://www.example.com/?title=100%25_Bran" class="external autonumber" title="http://www.example.com/?title=100%25_Bran" rel="nofollow">[1]</a>
967 </p>
968 !! end
970 !! test
971 Bug 4781, 5267: %28, %29 in autonumber URL
972 !! input
973 [http://www.example.com/?title=Ben-Hur_%281959_film%29]
974 !! result
975 <p><a href="http://www.example.com/?title=Ben-Hur_%281959_film%29" class="external autonumber" title="http://www.example.com/?title=Ben-Hur_%281959_film%29" rel="nofollow">[1]</a>
976 </p>
977 !! end
980 !! test
981 Bug 4781: %26 in bracketed URL
982 !! input
983 [http://www.example.com/?title=AT%26T link]
984 !! result
985 <p><a href="http://www.example.com/?title=AT%26T" class="external text" title="http://www.example.com/?title=AT%26T" rel="nofollow">link</a>
986 </p>
987 !! end
989 !! test
990 Bug 4781, 5267: %26 in bracketed URL
991 !! input
992 [http://www.example.com/?title=100%25_Bran link]
993 !! result
994 <p><a href="http://www.example.com/?title=100%25_Bran" class="external text" title="http://www.example.com/?title=100%25_Bran" rel="nofollow">link</a>
995 </p>
996 !! end
998 !! test
999 Bug 4781, 5267: %28, %29 in bracketed URL
1000 !! input
1001 [http://www.example.com/?title=Ben-Hur_%281959_film%29 link]
1002 !! result
1003 <p><a href="http://www.example.com/?title=Ben-Hur_%281959_film%29" class="external text" title="http://www.example.com/?title=Ben-Hur_%281959_film%29" rel="nofollow">link</a>
1004 </p>
1005 !! end
1007 !! test
1008 External link containing double-single-quotes in text '' (bug 4598 sanity check)
1009 !! input
1010 Some [http://example.com/ pretty ''italics'' and stuff]!
1011 !! result
1012 <p>Some <a href="http://example.com/" class="external text" title="http://example.com/" rel="nofollow">pretty <i>italics</i> and stuff</a>!
1013 </p>
1014 !! end
1016 !! test
1017 External link containing double-single-quotes in text embedded in italics (bug 4598 sanity check)
1018 !! input
1019 ''Some [http://example.com/ pretty ''italics'' and stuff]!''
1020 !! result
1021 <p><i>Some </i><a href="http://example.com/" class="external text" title="http://example.com/" rel="nofollow"><i>pretty </i>italics<i> and stuff</i></a><i>!</i>
1022 </p>
1023 !! end
1025 !! test
1026 URL-encoding in URL functions (single parameter)
1027 !! input
1028 {{localurl:Some page|amp=&}}
1029 !! result
1030 <p>/index.php?title=Some_page&amp;amp=&amp;
1031 </p>
1032 !! end
1034 !! test
1035 URL-encoding in URL functions (multiple parameters)
1036 !! input
1037 {{localurl:Some page|q=?&amp=&}}
1038 !! result
1039 <p>/index.php?title=Some_page&amp;q=?&amp;amp=&amp;
1040 </p>
1041 !! end
1044 ### Quotes
1047 !! test
1048 Quotes
1049 !! input
1050 Normal text. '''Bold text.''' Normal text. ''Italic text.''
1052 Normal text. '''''Bold italic text.''''' Normal text.
1053 !!result
1054 <p>Normal text. <b>Bold text.</b> Normal text. <i>Italic text.</i>
1055 </p><p>Normal text. <i><b>Bold italic text.</b></i> Normal text.
1056 </p>
1057 !! end
1060 !! test
1061 Unclosed and unmatched quotes
1062 !! input
1063 '''''Bold italic text '''with bold deactivated''' in between.'''''
1065 '''''Bold italic text ''with italic deactivated'' in between.'''''
1067 '''Bold text..
1069 ..spanning two paragraphs (should not work).'''
1071 '''Bold tag left open
1073 ''Italic tag left open
1075 Normal text.
1077 <!-- Unmatching number of opening, closing tags: -->
1078 '''This year''''s election ''should'' beat '''last year''''s.
1080 ''Tom'''s car is bigger than ''Susan'''s.
1081 !! result
1082 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
1083 </p><p><b><i>Bold italic text </i>with italic deactivated<i> in between.</i></b>
1084 </p><p><b>Bold text..</b>
1085 </p><p>..spanning two paragraphs (should not work).
1086 </p><p><b>Bold tag left open</b>
1087 </p><p><i>Italic tag left open</i>
1088 </p><p>Normal text.
1089 </p><p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
1090 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
1091 </p>
1092 !! end
1095 ### Tables
1097 ### some content taken from http://meta.wikimedia.org/wiki/MediaWiki_User%27s_Guide:_Using_tables
1100 # This should not produce <table></table> as <table><tr><td></td></tr></table>
1101 # is the bare minimun required by the spec, see:
1102 # http://www.w3.org/TR/xhtml-modularization/dtd_module_defs.html#a_module_Basic_Tables
1103 !! test
1104 A table with no data.
1105 !! input
1106 {||}
1107 !! result
1108 !! end
1110 # A table with nothing but a caption is invalid XHTML, we might want to render
1111 # this as <p>caption</p>
1112 !! test
1113 A table with nothing but a caption
1114 !! input 
1116 |+ caption
1118 !! result
1119 <table>
1120 <caption> caption
1121 </caption><tr><td></td></tr></table>
1123 !! end
1125 !! test
1126 Simple table
1127 !! input
1128 {| 
1129 | 1 || 2
1130 |- 
1131 | 3 || 4
1133 !! result
1134 <table>
1135 <tr>
1136 <td> 1 </td><td> 2
1137 </td></tr>
1138 <tr>
1139 <td> 3 </td><td> 4
1140 </td></tr></table>
1142 !! end
1144 !! test
1145 Multiplication table
1146 !! input
1147 {| border="1" cellpadding="2"
1148 |+Multiplication table
1150 ! &times; !! 1 !! 2 !! 3
1152 ! 1
1153 | 1 || 2 || 3
1155 ! 2
1156 | 2 || 4 || 6
1158 ! 3
1159 | 3 || 6 || 9
1161 ! 4
1162 | 4 || 8 || 12
1164 ! 5
1165 | 5 || 10 || 15
1167 !! result
1168 <table border="1" cellpadding="2">
1169 <caption>Multiplication table
1170 </caption>
1171 <tr>
1172 <th> &times; </th><th> 1 </th><th> 2 </th><th> 3
1173 </th></tr>
1174 <tr>
1175 <th> 1
1176 </th><td> 1 </td><td> 2 </td><td> 3
1177 </td></tr>
1178 <tr>
1179 <th> 2
1180 </th><td> 2 </td><td> 4 </td><td> 6
1181 </td></tr>
1182 <tr>
1183 <th> 3
1184 </th><td> 3 </td><td> 6 </td><td> 9
1185 </td></tr>
1186 <tr>
1187 <th> 4
1188 </th><td> 4 </td><td> 8 </td><td> 12
1189 </td></tr>
1190 <tr>
1191 <th> 5
1192 </th><td> 5 </td><td> 10 </td><td> 15
1193 </td></tr></table>
1195 !! end
1197 !! test
1198 Table rowspan
1199 !! input
1200 {| align=right border=1
1201 | Cell 1, row 1 
1202 |rowspan=2| Cell 2, row 1 (and 2) 
1203 | Cell 3, row 1 
1204 |- 
1205 | Cell 1, row 2 
1206 | Cell 3, row 2 
1208 !! result
1209 <table align="right" border="1">
1210 <tr>
1211 <td> Cell 1, row 1
1212 </td><td rowspan="2"> Cell 2, row 1 (and 2)
1213 </td><td> Cell 3, row 1
1214 </td></tr>
1215 <tr>
1216 <td> Cell 1, row 2
1217 </td><td> Cell 3, row 2
1218 </td></tr></table>
1220 !! end
1222 !! test
1223 Nested table
1224 !! input
1225 {| border=1
1226 | &alpha;
1228 {| bgcolor=#ABCDEF border=2
1229 |nested
1231 |table
1233 |the original table again
1235 !! result
1236 <table border="1">
1237 <tr>
1238 <td> &alpha;
1239 </td><td>
1240 <table bgcolor="#ABCDEF" border="2">
1241 <tr>
1242 <td>nested
1243 </td></tr>
1244 <tr>
1245 <td>table
1246 </td></tr></table>
1247 </td><td>the original table again
1248 </td></tr></table>
1250 !! end
1252 !! test
1253 Invalid attributes in table cell (bug 1830)
1254 !! input
1256 |Cell:|broken
1258 !! result
1259 <table>
1260 <tr>
1261 <td>broken
1262 </td></tr></table>
1264 !! end
1267 # FIXME: It's not clear at all that this is the result we want, but the actual
1268 # output right now is invalid XML, so clearly something is wrong.  The result
1269 # specified here is now valid XML, which is an improvement . . .
1270 !! test
1271 Table security: embedded pipes (http://lists.wikimedia.org/mailman/htdig/wikitech-l/2006-April/022293.html)
1272 !! input
1274 | |[ftp://|x||]" onmouseover="alert(document.cookie)">test
1275 !! result
1276 <table>
1277 <tr>
1278 <td><a href="ftp://|x||" class="external autonumber" title="ftp://|x||" rel="nofollow">[1]</a></td><td>" onmouseover="alert(document.cookie)"&gt;test
1279 </td>
1280 </tr>
1281 </table>
1283 !! end
1287 ### Internal links
1289 !! test
1290 Plain link, capitalized
1291 !! input
1292 [[Main Page]]
1293 !! result
1294 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
1295 </p>
1296 !! end
1298 !! test
1299 Plain link, uncapitalized
1300 !! input
1301 [[main Page]]
1302 !! result
1303 <p><a href="/wiki/Main_Page" title="Main Page">main Page</a>
1304 </p>
1305 !! end
1307 !! test
1308 Piped link
1309 !! input
1310 [[Main Page|The Main Page]]
1311 !! result
1312 <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
1313 </p>
1314 !! end
1316 !! test
1317 Broken link
1318 !! input
1319 [[Zigzagzogzagzig]]
1320 !! result
1321 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (not yet written)">Zigzagzogzagzig</a>
1322 </p>
1323 !! end
1325 !! test
1326 Broken link with fragment
1327 !! input
1328 [[Zigzagzogzagzig#zug]]
1329 !! result
1330 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (not yet written)">Zigzagzogzagzig#zug</a>
1331 </p>
1332 !! end
1334 !! test
1335 Special page link with fragment
1336 !! input
1337 [[Special:Version#anchor]]
1338 !! result
1339 <p><a href="/wiki/Special:Version#anchor" title="Special:Version">Special:Version#anchor</a>
1340 </p>
1341 !! end
1343 !! test
1344 Nonexistent special page link with fragment
1345 !! input
1346 [[Special:ThisNameWillHopefullyNeverBeUsed#anchor]]
1347 !! result
1348 <p><a href="/wiki/Special:ThisNameWillHopefullyNeverBeUsed" class="new" title="Special:ThisNameWillHopefullyNeverBeUsed (not yet written)">Special:ThisNameWillHopefullyNeverBeUsed#anchor</a>
1349 </p>
1350 !! end
1352 !! test
1353 Link with prefix
1354 !! input
1355 xxx[[main Page]], xxx[[Main Page]], Xxx[[main Page]] XXX[[main Page]], XXX[[Main Page]]
1356 !! result
1357 <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>
1358 </p>
1359 !! end
1361 !! test
1362 Link with suffix
1363 !! input
1364 [[Main Page]]xxx, [[Main Page]]XXX, [[Main Page]]!!!
1365 !! result
1366 <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>!!!
1367 </p>
1368 !! end
1370 !! test
1371 Link with 3 brackets
1372 !! input
1373 [[[main page]]]
1374 !! result
1375 <p>[[[main page]]]
1376 </p>
1377 !! end
1379 !! test
1380 Piped link with 3 brackets
1381 !! input
1382 [[[main page|the main page]]]
1383 !! result
1384 <p>[[[main page|the main page]]]
1385 </p>
1386 !! end
1388 !! test
1389 Link with multiple pipes
1390 !! input
1391 [[Main Page|The|Main|Page]]
1392 !! result
1393 <p><a href="/wiki/Main_Page" title="Main Page">The|Main|Page</a>
1394 </p>
1395 !! end
1397 !! test
1398 Link to namespaces
1399 !! input
1400 [[Talk:Parser testing]], [[Meta:Disclaimers]]
1401 !! result
1402 <p><a href="/index.php?title=Talk:Parser_testing&amp;action=edit&amp;redlink=1" class="new" title="Talk:Parser testing (not yet written)">Talk:Parser testing</a>, <a href="/index.php?title=Meta:Disclaimers&amp;action=edit&amp;redlink=1" class="new" title="Meta:Disclaimers (not yet written)">Meta:Disclaimers</a>
1403 </p>
1404 !! end
1406 !! test
1407 Piped link to namespace
1408 !! input
1409 [[Meta:Disclaimers|The disclaimers]]
1410 !! result
1411 <p><a href="/index.php?title=Meta:Disclaimers&amp;action=edit&amp;redlink=1" class="new" title="Meta:Disclaimers (not yet written)">The disclaimers</a>
1412 </p>
1413 !! end
1415 !! test
1416 Link containing }
1417 !! input
1418 [[Usually caused by a typo (oops}]]
1419 !! result
1420 <p>[[Usually caused by a typo (oops}]]
1421 </p>
1422 !! end
1424 !! test
1425 Link containing % (not as a hex sequence)
1426 !! input
1427 [[7% Solution]]
1428 !! result
1429 <p><a href="/index.php?title=7%25_Solution&amp;action=edit&amp;redlink=1" class="new" title="7% Solution (not yet written)">7% Solution</a>
1430 </p>
1431 !! end
1433 !! test
1434 Link containing % as a single hex sequence interpreted to char
1435 !! input
1436 [[7%25 Solution]]
1437 !! result
1438 <p><a href="/index.php?title=7%25_Solution&amp;action=edit&amp;redlink=1" class="new" title="7% Solution (not yet written)">7% Solution</a>
1439 </p>
1440 !!end
1442 !! test
1443 Link containing % as a double hex sequence interpreted to hex sequence
1444 !! input
1445 [[7%2525 Solution]]
1446 !! result
1447 <p>[[7%2525 Solution]]
1448 </p>
1449 !!end
1451 !! test
1452 Link containing "#<" and "#>" % as a hex sequences- these are valid section anchors
1453 Example for such a section: == < ==
1454 !! input
1455 [[%23%3c]][[%23%3e]]
1456 !! result
1457 <p><a href="#.3C" title="">#&lt;</a><a href="#.3E" title="">#&gt;</a>
1458 </p>
1459 !! end
1461 !! test
1462 Link containing "<#" and ">#" as a hex sequences
1463 !! input
1464 [[%3c%23]][[%3e%23]]
1465 !! result
1466 <p>[[%3c%23]][[%3e%23]]
1467 </p>
1468 !! end
1470 !! test
1471 Link containing double-single-quotes '' (bug 4598)
1472 !! input
1473 [[Lista d''e paise d''o munno]]
1474 !! result
1475 <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>
1476 </p>
1477 !! end
1479 !! test
1480 Link containing double-single-quotes '' in text (bug 4598 sanity check)
1481 !! input
1482 Some [[Link|pretty ''italics'' and stuff]]!
1483 !! result
1484 <p>Some <a href="/index.php?title=Link&amp;action=edit&amp;redlink=1" class="new" title="Link (not yet written)">pretty <i>italics</i> and stuff</a>!
1485 </p>
1486 !! end
1488 !! test
1489 Link containing double-single-quotes '' in text embedded in italics (bug 4598 sanity check)
1490 !! input
1491 ''Some [[Link|pretty ''italics'' and stuff]]!
1492 !! result
1493 <p><i>Some </i><a href="/index.php?title=Link&amp;action=edit&amp;redlink=1" class="new" title="Link (not yet written)"><i>pretty </i>italics<i> and stuff</i></a><i>!</i>
1494 </p>
1495 !! end
1497 !! test
1498 Plain link to URL
1499 !! input
1500 [[http://www.example.com]]
1501 !! result
1502 <p>[<a href="http://www.example.com" class="external autonumber" title="http://www.example.com" rel="nofollow">[1]</a>]
1503 </p>
1504 !! end
1506 # I'm fairly sure the expected result here is wrong.
1507 # We want these to be URL links, not pseudo-pages with URLs for titles....
1508 # However the current output is also pretty screwy.
1510 # ----
1511 # I'm changing it to match the current output--it arguably makes more
1512 # sense in the light of the test above. Old expected result was:
1513 #<p>Piped link to URL: <a href="/index.php?title=Http://www.example.com&amp;action=edit" class="new" title="Http://www.example.com">an example URL</a>
1514 #</p>
1515 # But I think this test is bordering on "garbage in, garbage out" anyway.
1516 # -- wtm
1517 !! test
1518 Piped link to URL
1519 !! input
1520 Piped link to URL: [[http://www.example.com|an example URL]]
1521 !! result
1522 <p>Piped link to URL: [<a href="http://www.example.com|an" class="external text" title="http://www.example.com|an" rel="nofollow">example URL</a>]
1523 </p>
1524 !! end
1526 !! test
1527 BUG 2: [[page|http://url/]] should link to page, not http://url/
1528 !! input
1529 [[Main Page|http://url/]]
1530 !! result
1531 <p><a href="/wiki/Main_Page" title="Main Page">http://url/</a>
1532 </p>
1533 !! end
1535 !! test
1536 BUG 337: Escaped self-links should be bold
1537 !! options
1538 title=[[Bug462]]
1539 !! input
1540 [[Bu&#103;462]] [[Bug462]]
1541 !! result
1542 <p><strong class="selflink">Bu&#103;462</strong> <strong class="selflink">Bug462</strong>
1543 </p>
1544 !! end
1546 !! test
1547 Self-link to section should not be bold
1548 !! options
1549 title=[[Main Page]]
1550 !! input
1551 [[Main Page#section]]
1552 !! result
1553 <p><a href="/wiki/Main_Page#section" title="Main Page">Main Page#section</a>
1554 </p>
1555 !! end
1557 !! article
1559 !! text
1560 This is 00.
1561 !! endarticle
1563 !!test
1564 Self-link to numeric title
1565 !!options
1566 title=[[0]]
1567 !!input
1568 [[0]]
1569 !!result
1570 <p><strong class="selflink">0</strong>
1571 </p>
1572 !!end
1574 !!test
1575 Link to numeric-equivalent title
1576 !!options
1577 title=[[0]]
1578 !!input
1579 [[00]]
1580 !!result
1581 <p><a href="/wiki/00" title="00">00</a>
1582 </p>
1583 !!end
1585 !! test
1586 <nowiki> inside a link
1587 !! input
1588 [[Main<nowiki> Page</nowiki>]] [[Main Page|the main page <nowiki>[it's not very good]</nowiki>]]
1589 !! result
1590 <p>[[Main Page]] <a href="/wiki/Main_Page" title="Main Page">the main page [it's not very good]</a>
1591 </p>
1592 !! end
1595 ### Interwiki links (see maintenance/interwiki.sql)
1598 !! test
1599 Inline interwiki link
1600 !! input
1601 [[MeatBall:SoftSecurity]]
1602 !! result
1603 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity</a>
1604 </p>
1605 !! end
1607 !! test
1608 Inline interwiki link with empty title (bug 2372)
1609 !! input
1610 [[MeatBall:]]
1611 !! result
1612 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?" class="extiw" title="meatball:">MeatBall:</a>
1613 </p>
1614 !! end
1616 !! test
1617 Interwiki link encoding conversion (bug 1636)
1618 !! input
1619 *[[Wikipedia:ro:Olteni&#0355;a]]
1620 *[[Wikipedia:ro:Olteni&#355;a]]
1621 !! result
1622 <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>
1623 </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>
1624 </li></ul>
1626 !! end
1628 !! test
1629 Interwiki link with fragment (bug 2130)
1630 !! input
1631 [[MeatBall:SoftSecurity#foo]]
1632 !! result
1633 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity#foo" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity#foo</a>
1634 </p>
1635 !! end
1637 !! test
1638 Interlanguage link
1639 !! input
1640 Blah blah blah
1641 [[zh:Chinese]]
1642 !!result
1643 <p>Blah blah blah
1644 </p>
1645 !! end
1647 !! test
1648 Double interlanguage link
1649 !! input
1650 Blah blah blah
1651 [[es:Spanish]]
1652 [[zh:Chinese]]
1653 !!result
1654 <p>Blah blah blah
1655 </p>
1656 !! end
1658 !! test
1659 Interlanguage link, with prefix links
1660 !! options
1661 language=ln
1662 !! input
1663 Blah blah blah
1664 [[zh:Chinese]]
1665 !!result
1666 <p>Blah blah blah
1667 </p>
1668 !! end
1670 !! test
1671 Double interlanguage link, with prefix links (bug 8897)
1672 !! options
1673 language=ln
1674 !! input
1675 Blah blah blah
1676 [[es:Spanish]]
1677 [[zh:Chinese]]
1678 !!result
1679 <p>Blah blah blah
1680 </p>
1681 !! end
1685 ## XHTML tidiness
1688 !! test
1689 <br> to <br />
1690 !! input
1691 1<br>2<br />3
1692 !! result
1693 <p>1<br />2<br />3
1694 </p>
1695 !! end
1697 !! test
1698 Incorrecly removing closing slashes from correctly formed XHTML
1699 !! input
1700 <br style="clear:both;" />
1701 !! result
1702 <p><br style="clear:both;" />
1703 </p>
1704 !! end
1706 !! test 
1707 Failing to transform badly formed HTML into correct XHTML
1708 !! input
1709 <br clear=left>
1710 <br clear=right>
1711 <br clear=all>
1712 !! result
1713 <p><br clear="left" />
1714 <br clear="right" />
1715 <br clear="all" />
1716 </p>
1717 !!end
1719 !! test 
1720 Horizontal ruler (should it add that extra space?)
1721 !! input 
1722 <hr>
1723 <hr >
1724 foo <hr
1725 > bar
1726 !! result 
1727 <hr />
1728 <hr />
1729 foo <hr /> bar
1731 !! end
1734 ### Block-level elements
1736 !! test
1737 Common list
1738 !! input
1739 *Common list
1740 * item 2
1741 *item 3
1742 !! result
1743 <ul><li>Common list
1744 </li><li> item 2
1745 </li><li>item 3
1746 </li></ul>
1748 !! end
1750 !! test
1751 Numbered list
1752 !! input
1753 #Numbered list
1754 #item 2
1755 # item 3
1756 !! result
1757 <ol><li>Numbered list
1758 </li><li>item 2
1759 </li><li> item 3
1760 </li></ol>
1762 !! end
1764 !! test
1765 Mixed list
1766 !! input
1767 *Mixed list
1768 *# with numbers
1769 ** and bullets
1770 *# and numbers
1771 *bullets again
1772 **bullet level 2
1773 ***bullet level 3
1774 ***#Number on level 4
1775 **bullet level 2
1776 **#Number on level 3
1777 **#Number on level 3
1778 *#number level 2
1779 *Level 1
1780 !! result
1781 <ul><li>Mixed list
1782 <ol><li> with numbers
1783 </li></ol>
1784 <ul><li> and bullets
1785 </li></ul>
1786 <ol><li> and numbers
1787 </li></ol>
1788 </li><li>bullets again
1789 <ul><li>bullet level 2
1790 <ul><li>bullet level 3
1791 <ol><li>Number on level 4
1792 </li></ol>
1793 </li></ul>
1794 </li><li>bullet level 2
1795 <ol><li>Number on level 3
1796 </li><li>Number on level 3
1797 </li></ol>
1798 </li></ul>
1799 <ol><li>number level 2
1800 </li></ol>
1801 </li><li>Level 1
1802 </li></ul>
1804 !! end
1806 !! test
1807 List items are not parsed correctly following a <pre> block (bug 785)
1808 !! input
1809 * <pre>foo</pre>
1810 * <pre>bar</pre>
1811 * zar
1812 !! result
1813 <ul><li> <pre>foo</pre>
1814 </li><li> <pre>bar</pre>
1815 </li><li> zar
1816 </li></ul>
1818 !! end
1821 ### Magic Words
1824 !! test
1825 Magic Word: {{CURRENTDAY}}
1826 !! input
1827 {{CURRENTDAY}}
1828 !! result
1829 <p>1
1830 </p>
1831 !! end
1833 !! test
1834 Magic Word: {{CURRENTDAY2}}
1835 !! input
1836 {{CURRENTDAY2}}
1837 !! result
1838 <p>01
1839 </p>
1840 !! end
1842 !! test
1843 Magic Word: {{CURRENTDAYNAME}}
1844 !! input
1845 {{CURRENTDAYNAME}}
1846 !! result
1847 <p>Thursday
1848 </p>
1849 !! end
1851 !! test
1852 Magic Word: {{CURRENTDOW}}
1853 !! input
1854 {{CURRENTDOW}}
1855 !! result
1856 <p>4
1857 </p>
1858 !! end
1860 !! test
1861 Magic Word: {{CURRENTMONTH}}
1862 !! input
1863 {{CURRENTMONTH}}
1864 !! result
1865 <p>01
1866 </p>
1867 !! end
1869 !! test
1870 Magic Word: {{CURRENTMONTHABBREV}}
1871 !! input
1872 {{CURRENTMONTHABBREV}}
1873 !! result
1874 <p>Jan
1875 </p>
1876 !! end
1878 !! test
1879 Magic Word: {{CURRENTMONTHNAME}}
1880 !! input
1881 {{CURRENTMONTHNAME}}
1882 !! result
1883 <p>January
1884 </p>
1885 !! end
1887 !! test
1888 Magic Word: {{CURRENTMONTHNAMEGEN}}
1889 !! input
1890 {{CURRENTMONTHNAMEGEN}}
1891 !! result
1892 <p>January
1893 </p>
1894 !! end
1896 !! test
1897 Magic Word: {{CURRENTTIME}}
1898 !! input
1899 {{CURRENTTIME}}
1900 !! result
1901 <p>00:02
1902 </p>
1903 !! end
1905 !! test
1906 Magic Word: {{CURRENTWEEK}} (@bug 4594)
1907 !! input
1908 {{CURRENTWEEK}}
1909 !! result
1910 <p>1
1911 </p>
1912 !! end
1914 !! test
1915 Magic Word: {{CURRENTYEAR}}
1916 !! input
1917 {{CURRENTYEAR}}
1918 !! result
1919 <p>1970
1920 </p>
1921 !! end
1923 !! test
1924 Magic Word: {{FULLPAGENAME}}
1925 !! options
1926 title=[[User:Ævar Arnfjörð Bjarmason]]
1927 !! input
1928 {{FULLPAGENAME}}
1929 !! result
1930 <p>User:Ævar Arnfjörð Bjarmason
1931 </p>
1932 !! end
1934 !! test
1935 Magic Word: {{FULLPAGENAMEE}}
1936 !! options
1937 title=[[User:Ævar Arnfjörð Bjarmason]]
1938 !! input
1939 {{FULLPAGENAMEE}}
1940 !! result
1941 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
1942 </p>
1943 !! end
1945 !! test
1946 Magic Word: {{NAMESPACE}}
1947 !! options
1948 title=[[User:Ævar Arnfjörð Bjarmason]]
1949 disabled # FIXME
1950 !! input
1951 {{NAMESPACE}}
1952 !! result
1953 <p>User
1954 </p>
1955 !! end
1957 !! test
1958 Magic Word: {{NAMESPACEE}}
1959 !! options
1960 title=[[User:Ævar Arnfjörð Bjarmason]]
1961 disabled # FIXME
1962 !! input
1963 {{NAMESPACEE}}
1964 !! result
1965 <p>User
1966 </p>
1967 !! end
1969 !! test
1970 Magic Word: {{NUMBEROFARTICLES}}
1971 !! input
1972 {{NUMBEROFARTICLES}}
1973 !! result
1974 <p>2
1975 </p>
1976 !! end
1978 !! test
1979 Magic Word: {{NUMBEROFFILES}}
1980 !! input
1981 {{NUMBEROFFILES}}
1982 !! result
1983 <p>1
1984 </p>
1985 !! end
1987 !! test
1988 Magic Word: {{PAGENAME}}
1989 !! options
1990 title=[[User:Ævar Arnfjörð Bjarmason]]
1991 disabled # FIXME
1992 !! input
1993 {{PAGENAME}}
1994 !! result
1995 <p>Ævar Arnfjörð Bjarmason
1996 </p>
1997 !! end
1999 !! test
2000 Magic Word: {{PAGENAMEE}}
2001 !! options
2002 title=[[User:Ævar Arnfjörð Bjarmason]]
2003 !! input
2004 {{PAGENAMEE}}
2005 !! result
2006 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
2007 </p>
2008 !! end
2010 !! test
2011 Magic Word: {{REVISIONID}}
2012 !! input
2013 {{REVISIONID}}
2014 !! result
2015 <p>1337
2016 </p>
2017 !! end
2019 !! test
2020 Magic Word: {{SCRIPTPATH}}
2021 !! input
2022 {{SCRIPTPATH}}
2023 !! result
2024 <p>/
2025 </p>
2026 !! end
2028 !! test
2029 Magic Word: {{SERVER}}
2030 !! input
2031 {{SERVER}}
2032 !! result
2033 <p><a href="http://localhost" class="external free" title="http://localhost" rel="nofollow">http://localhost</a>
2034 </p>
2035 !! end
2037 !! test
2038 Magic Word: {{SERVERNAME}}
2039 !! input
2040 {{SERVERNAME}}
2041 !! result
2042 <p>Britney Spears
2043 </p>
2044 !! end
2046 !! test
2047 Magic Word: {{SITENAME}}
2048 !! input
2049 {{SITENAME}}
2050 !! result
2051 <p>MediaWiki
2052 </p>
2053 !! end
2055 !! test
2056 Namespace 1 {{ns:1}}
2057 !! input
2058 {{ns:1}}
2059 !! result
2060 <p>Talk
2061 </p>
2062 !! end
2064 !! test
2065 Namespace 1 {{ns:01}}
2066 !! input
2067 {{ns:01}}
2068 !! result
2069 <p>Talk
2070 </p>
2071 !! end
2073 !! test
2074 Namespace 0 {{ns:0}} (bug 4783)
2075 !! input
2076 {{ns:0}}
2077 !! result
2079 !! end
2081 !! test
2082 Namespace 0 {{ns:00}} (bug 4783)
2083 !! input
2084 {{ns:00}}
2085 !! result
2087 !! end
2089 !! test
2090 Namespace -1 {{ns:-1}}
2091 !! input
2092 {{ns:-1}}
2093 !! result
2094 <p>Special
2095 </p>
2096 !! end
2098 !! test
2099 Namespace Project {{ns:User}}
2100 !! input
2101 {{ns:User}}
2102 !! result
2103 <p>User
2104 </p>
2105 !! end
2109 ### Magic links
2111 !! test
2112 Magic links: internal link to RFC (bug 479)
2113 !! input
2114 [[RFC 123]]
2115 !! result
2116 <p><a href="/index.php?title=RFC_123&amp;action=edit&amp;redlink=1" class="new" title="RFC 123 (not yet written)">RFC 123</a>
2117 </p>
2118 !! end
2120 !! test
2121 Magic links: RFC (bug 479)
2122 !! input
2123 RFC 822
2124 !! result
2125 <p><a href="http://tools.ietf.org/html/rfc822" class="external" title="http://tools.ietf.org/html/rfc822">RFC 822</a>
2126 </p>
2127 !! end
2129 !! test
2130 Magic links: ISBN (bug 1937)
2131 !! input
2132 ISBN 0-306-40615-2
2133 !! result
2134 <p><a href="/wiki/Special:BookSources/0306406152" class="internal">ISBN 0-306-40615-2</a>
2135 </p>
2136 !! end
2138 !! test
2139 Magic links: PMID incorrectly converts space to underscore
2140 !! input
2141 PMID 1234
2142 !! result
2143 <p><a href="http://www.ncbi.nlm.nih.gov/entrez/query.fcgi?cmd=Retrieve&amp;db=pubmed&amp;dopt=Abstract&amp;list_uids=1234" class="external" title="http://www.ncbi.nlm.nih.gov/entrez/query.fcgi?cmd=Retrieve&amp;db=pubmed&amp;dopt=Abstract&amp;list_uids=1234">PMID 1234</a>
2144 </p>
2145 !! end
2148 ### Templates
2149 ####
2151 !! test
2152 Nonexistant template
2153 !! input
2154 {{thistemplatedoesnotexist}}
2155 !! result
2156 <p><a href="/index.php?title=Template:Thistemplatedoesnotexist&amp;action=edit&amp;redlink=1" class="new" title="Template:Thistemplatedoesnotexist (not yet written)">Template:Thistemplatedoesnotexist</a>
2157 </p>
2158 !! end
2160 !! article
2161 Template:test
2162 !! text
2163 This is a test template
2164 !! endarticle
2166 !! test
2167 Simple template
2168 !! input
2169 {{test}}
2170 !! result
2171 <p>This is a test template
2172 </p>
2173 !! end
2175 !! test
2176 Template with explicit namespace
2177 !! input
2178 {{Template:test}}
2179 !! result
2180 <p>This is a test template
2181 </p>
2182 !! end
2185 !! article
2186 Template:paramtest
2187 !! text
2188 This is a test template with parameter {{{param}}}
2189 !! endarticle
2191 !! test
2192 Template parameter
2193 !! input
2194 {{paramtest|param=foo}}
2195 !! result
2196 <p>This is a test template with parameter foo
2197 </p>
2198 !! end
2200 !! article
2201 Template:paramtestnum
2202 !! text
2203 [[{{{1}}}|{{{2}}}]]
2204 !! endarticle
2206 !! test
2207 Template unnamed parameter
2208 !! input
2209 {{paramtestnum|Main Page|the main page}}
2210 !! result
2211 <p><a href="/wiki/Main_Page" title="Main Page">the main page</a>
2212 </p>
2213 !! end
2215 !! article
2216 Template:templatesimple
2217 !! text
2218 (test)
2219 !! endarticle
2221 !! article
2222 Template:templateredirect
2223 !! text
2224 #redirect [[Template:templatesimple]]
2225 !! endarticle
2227 !! article
2228 Template:templateasargtestnum
2229 !! text
2230 {{{{{1}}}}}
2231 !! endarticle
2233 !! article
2234 Template:templateasargtest
2235 !! text
2236 {{template{{{templ}}}}}
2237 !! endarticle
2239 !! article
2240 Template:templateasargtest2
2241 !! text
2242 {{{{{templ}}}}}
2243 !! endarticle
2245 !! test
2246 Template with template name as unnamed argument
2247 !! input
2248 {{templateasargtestnum|templatesimple}}
2249 !! result
2250 <p>(test)
2251 </p>
2252 !! end
2254 !! test
2255 Template with template name as argument
2256 !! input
2257 {{templateasargtest|templ=simple}}
2258 !! result
2259 <p>(test)
2260 </p>
2261 !! end
2263 !! test
2264 Template with template name as argument (2)
2265 !! input
2266 {{templateasargtest2|templ=templatesimple}}
2267 !! result
2268 <p>(test)
2269 </p>
2270 !! end
2272 !! article
2273 Template:templateasargtestdefault
2274 !! text
2275 {{{{{templ|templatesimple}}}}}
2276 !! endarticle
2278 !! article
2279 Template:templa
2280 !! text
2281 '''templ'''
2282 !! endarticle
2284 !! test
2285 Template with default value
2286 !! input
2287 {{templateasargtestdefault}}
2288 !! result
2289 <p>(test)
2290 </p>
2291 !! end
2293 !! test
2294 Template with default value (value set)
2295 !! input
2296 {{templateasargtestdefault|templ=templa}}
2297 !! result
2298 <p><b>templ</b>
2299 </p>
2300 !! end
2302 !! test
2303 Template redirect
2304 !! input
2305 {{templateredirect}}
2306 !! result
2307 <p>(test)
2308 </p>
2309 !! end
2311 !! test
2312 Template with argument in separate line
2313 !! input
2314 {{ templateasargtest  |
2315  templ = simple }}
2316 !! result
2317 <p>(test)
2318 </p>
2319 !! end
2321 !! test
2322 Template with complex template as argument
2323 !! input
2324 {{paramtest|
2325   param ={{ templateasargtest  |
2326  templ = simple }}}}
2327 !! result
2328 <p>This is a test template with parameter (test)
2329 </p>
2330 !! end
2332 !! test
2333 Template with thumb image (with link in description)
2334 !! input
2335 {{paramtest|
2336   param =[[Image:noimage.png|thumb|[[no link|link]] [[no link|caption]]]]}}
2337 !! result
2338 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="Image:Noimage.png">Image:Noimage.png</a>  <div class="thumbcaption"><a href="/index.php?title=No_link&amp;action=edit&amp;redlink=1" class="new" title="No link (not yet written)">link</a> <a href="/index.php?title=No_link&amp;action=edit&amp;redlink=1" class="new" title="No link (not yet written)">caption</a></div></div></div>
2340 !! end
2342 !! article
2343 Template:complextemplate
2344 !! text
2345 {{{1}}} {{paramtest|
2346   param ={{{param}}}}}
2347 !! endarticle
2349 !! test
2350 Template with complex arguments
2351 !! input
2352 {{complextemplate|
2353   param ={{ templateasargtest  |
2354  templ = simple }}|[[Template:complextemplate|link]]}}
2355 !! result
2356 <p><a href="/wiki/Template:Complextemplate" title="Template:Complextemplate">link</a> This is a test template with parameter (test)
2357 </p>
2358 !! end
2360 !! test
2361 BUG 553: link with two variables in a piped link
2362 !! input
2363 {| 
2364 |[[{{{1}}}|{{{2}}}]]
2366 !! result
2367 <table>
2368 <tr>
2369 <td>[[{{{1}}}|{{{2}}}]]
2370 </td></tr></table>
2372 !! end
2374 !! test
2375 Magic variable as template parameter
2376 !! input
2377 {{paramtest|param={{SITENAME}}}}
2378 !! result
2379 <p>This is a test template with parameter MediaWiki
2380 </p>
2381 !! end
2383 !! article
2384 Template:linktest
2385 !! text
2386 [[{{{param}}}|link]]
2387 !! endarticle
2389 !! test
2390 Template parameter as link source
2391 !! input
2392 {{linktest|param=Main Page}}
2393 !! result
2394 <p><a href="/wiki/Main_Page" title="Main Page">link</a>
2395 </p>
2396 !! end
2399 !!article
2400 Template:paramtest2
2401 !! text
2402 including another template, {{paramtest|param={{{arg}}}}}
2403 !! endarticle
2405 !! test
2406 Template passing argument to another template
2407 !! input
2408 {{paramtest2|arg='hmm'}}
2409 !! result
2410 <p>including another template, This is a test template with parameter 'hmm'
2411 </p>
2412 !! end
2414 !! article
2415 Template:Linktest2
2416 !! text
2417 Main Page
2418 !! endarticle
2420 !! test
2421 Template as link source
2422 !! input
2423 [[{{linktest2}}]]
2424 !! result
2425 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
2426 </p>
2427 !! end
2430 !! article
2431 Template:loop1
2432 !! text
2433 {{loop2}}
2434 !! endarticle
2436 !! article
2437 Template:loop2
2438 !! text
2439 {{loop1}}
2440 !! endarticle
2442 !! test
2443 Template infinite loop
2444 !! input
2445 {{loop1}}
2446 !! result
2447 <p><span class="error">Template loop detected: <a href="/wiki/Template:Loop1" title="Template:Loop1">Template:Loop1</a></span>
2448 </p>
2449 !! end
2451 !! test
2452 Template from main namespace
2453 !! input
2454 {{:Main Page}}
2455 !! result
2456 <p>blah blah
2457 </p>
2458 !! end
2460 !! article
2461 Template:table
2462 !! text
2463 {| 
2464 | 1 || 2
2465 |- 
2466 | 3 || 4
2468 !! endarticle
2470 !! test
2471 BUG 529: Template with table, not included at beginning of line
2472 !! input
2473 foo {{table}}
2474 !! result
2475 <p>foo 
2476 </p>
2477 <table>
2478 <tr>
2479 <td> 1 </td><td> 2
2480 </td></tr>
2481 <tr>
2482 <td> 3 </td><td> 4
2483 </td></tr></table>
2485 !! end
2487 !! test
2488 BUG 523: Template shouldn't eat newline (or add an extra one before table)
2489 !! input
2491 {{table}}
2492 !! result
2493 <p>foo
2494 </p>
2495 <table>
2496 <tr>
2497 <td> 1 </td><td> 2
2498 </td></tr>
2499 <tr>
2500 <td> 3 </td><td> 4
2501 </td></tr></table>
2503 !! end
2505 !! test
2506 BUG 41: Template parameters shown as broken links
2507 !! input
2508 {{{parameter}}}
2509 !! result
2510 <p>{{{parameter}}}
2511 </p>
2512 !! end
2515 !! article
2516 Template:MSGNW test
2517 !! text
2518 ''None'' of '''this''' should be 
2519 * interepreted
2520  but rather passed unmodified
2521 {{test}}
2522 !! endarticle
2524 # hmm, fix this or just deprecate msgnw and document its behavior?
2525 !! test
2526 msgnw keyword
2527 !! options
2528 disabled
2529 !! input
2530 {{msgnw:MSGNW test}}
2531 !! result
2532 <p>''None'' of '''this''' should be 
2533 * interepreted
2534  but rather passed unmodified
2535 {{test}}
2536 </p>
2537 !! end
2539 !! test
2540 int keyword
2541 !! input
2542 {{int:youhavenewmessages|lots of money|not!}}
2543 !! result
2544 <p>You have lots of money (not!).
2545 </p>
2546 !! end
2548 !! article
2549 Template:Includes
2550 !! text
2551 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
2552 !! endarticle
2554 !! test
2555 <includeonly> and <noinclude> being included
2556 !! input
2557 {{Includes}}
2558 !! result
2559 <p>Foobar
2560 </p>
2561 !! end
2563 !! article
2564 Template:Includes2
2565 !! text
2566 <onlyinclude>Foo</onlyinclude>bar
2567 !! endarticle
2569 !! test
2570 <onlyinclude> being included
2571 !! input
2572 {{Includes2}}
2573 !! result
2574 <p>Foo
2575 </p>
2576 !! end
2579 !! article
2580 Template:Includes3
2581 !! text
2582 <onlyinclude>Foo</onlyinclude>bar<includeonly>zar</includeonly>
2583 !! endarticle
2585 !! test
2586 <onlyinclude> and <includeonly> being included
2587 !! input
2588 {{Includes3}}
2589 !! result
2590 <p>Foo
2591 </p>
2592 !! end
2594 !! test
2595 <includeonly> and <noinclude> on a page
2596 !! input
2597 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
2598 !! result
2599 <p>Foozar
2600 </p>
2601 !! end
2603 !! test
2604 <onlyinclude> on a page
2605 !! input
2606 <onlyinclude>Foo</onlyinclude>bar
2607 !! result
2608 <p>Foobar
2609 </p>
2610 !! end
2612 !! article
2613 Template:Includeonly section
2614 !! text
2615 <includeonly>
2616 ==Includeonly section==
2617 </includeonly>
2618 ==Section T-1==
2619 !!endarticle
2621 !! test
2622 Bug 6563: Edit link generation for section shown by <includeonly>
2623 !! input
2624 {{includeonly section}}
2625 !! result
2626 <a name="Includeonly_section"></a><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">Includeonly section</span></h2>
2627 <a name="Section_T-1"></a><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">Section T-1</span></h2>
2629 !! end
2631 # Uses same input as the contents of [[Template:Includeonly section]]
2632 !! test
2633 Bug 6563: Section extraction for section shown by <includeonly>
2634 !! options
2635 section=T-2
2636 !! input
2637 <includeonly>
2638 ==Includeonly section==
2639 </includeonly>
2640 ==Section T-2==
2641 !! result
2642 ==Section T-2==
2643 !! end
2645 !! test
2646 Bug 6563: Edit link generation for section suppressed by <includeonly>
2647 !! input
2648 <includeonly>
2649 ==Includeonly section==
2650 </includeonly>
2651 ==Section 1==
2652 !! result
2653 <a name="Section_1"></a><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">Section 1</span></h2>
2655 !! end
2657 !! test
2658 Bug 6563: Section extraction for section suppressed by <includeonly>
2659 !! options
2660 section=1
2661 !! input
2662 <includeonly>
2663 ==Includeonly section==
2664 </includeonly>
2665 ==Section 1==
2666 !! result
2667 ==Section 1==
2668 !! end
2671 ### Pre-save transform tests
2673 !! test
2674 pre-save transform: subst:
2675 !! options
2677 !! input
2678 {{subst:test}}
2679 !! result
2680 This is a test template
2681 !! end
2683 !! test
2684 pre-save transform: normal template
2685 !! options
2687 !! input
2688 {{test}}
2689 !! result
2690 {{test}}
2691 !! end
2693 !! test
2694 pre-save transform: nonexistant template
2695 !! options
2697 !! input
2698 {{thistemplatedoesnotexist}}
2699 !! result
2700 {{thistemplatedoesnotexist}}
2701 !! end
2704 !! test
2705 pre-save transform: subst magic variables
2706 !! options
2708 !! input
2709 {{subst:SITENAME}}
2710 !! result
2711 MediaWiki
2712 !! end
2714 # This is bug 89, which I fixed. -- wtm
2715 !! test
2716 pre-save transform: subst: templates with parameters
2717 !! options
2719 !! input
2720 {{subst:paramtest|param="something else"}}
2721 !! result
2722 This is a test template with parameter "something else"
2723 !! end
2725 !! article
2726 Template:nowikitest
2727 !! text
2728 <nowiki>'''not wiki'''</nowiki>
2729 !! endarticle
2731 !! test
2732 pre-save transform: nowiki in subst (bug 1188)
2733 !! options
2735 !! input
2736 {{subst:nowikitest}}
2737 !! result
2738 <nowiki>'''not wiki'''</nowiki>
2739 !! end
2742 !! article
2743 Template:commenttest
2744 !! text
2745 This template has <!-- a comment --> in it.
2746 !! endarticle
2748 !! test
2749 pre-save transform: comment in subst (bug 1936)
2750 !! options
2752 !! input
2753 {{subst:commenttest}}
2754 !! result
2755 This template has <!-- a comment --> in it.
2756 !! end
2758 !! test
2759 pre-save transform: unclosed tag
2760 !! options
2761 pst noxml
2762 !! input
2763 <nowiki>'''not wiki'''
2764 !! result
2765 <nowiki>'''not wiki'''
2766 !! end
2768 !! test
2769 pre-save transform: mixed tag case
2770 !! options
2771 pst noxml
2772 !! input
2773 <NOwiki>'''not wiki'''</noWIKI>
2774 !! result
2775 <NOwiki>'''not wiki'''</noWIKI>
2776 !! end
2778 !! test
2779 pre-save transform: unclosed comment in <nowiki>
2780 !! options
2781 pst noxml
2782 !! input
2783 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
2784 !! result
2785 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
2786 !!end
2788 !! article
2789 Template:dangerous
2790 !!text
2791 <span onmouseover="alert('crap')">Oh no</span>
2792 !!endarticle
2794 !!test
2795 (confirming safety of fix for subst bug 1936)
2796 !! input
2797 {{Template:dangerous}}
2798 !! result
2799 <p><span>Oh no</span>
2800 </p>
2801 !! end
2803 !! test
2804 pre-save transform: comment containing gallery (bug 5024)
2805 !! options
2807 !! input
2808 <!-- <gallery>data</gallery> -->
2809 !!result
2810 <!-- <gallery>data</gallery> -->
2811 !!end
2813 !! test
2814 pre-save transform: comment containing extension
2815 !! options
2817 !! input
2818 <!-- <tag>data</tag> -->
2819 !!result
2820 <!-- <tag>data</tag> -->
2821 !!end
2823 !! test
2824 pre-save transform: comment containing nowiki
2825 !! options
2827 !! input
2828 <!-- <nowiki>data</nowiki> -->
2829 !!result
2830 <!-- <nowiki>data</nowiki> -->
2831 !!end
2833 !! test
2834 pre-save transform: comment containing math
2835 !! options
2837 !! input
2838 <!-- <math>data</math> -->
2839 !!result
2840 <!-- <math>data</math> -->
2841 !!end
2843 !! test
2844 pre-save transform: <noinclude> in subst (bug 3298)
2845 !! options
2847 !! input
2848 {{subst:Includes}}
2849 !! result
2850 Foobar
2851 !! end
2853 !! test
2854 pre-save transform: <onlyinclude> in subst (bug 3298)
2855 !! options
2857 !! input
2858 {{subst:Includes2}}
2859 !! result
2861 !! end
2863 !! test
2864 pre-save transform: context links ("pipe trick")
2865 !! options
2867 !! input
2868 [[Article (context)|]]
2869 [[Bar:Article|]]
2870 [[:Bar:Article|]]
2871 [[Bar:Article (context)|]]
2872 [[:Bar:Article (context)|]]
2873 [[|Article]]
2874 [[|Article (context)]]
2875 [[Bar:X (Y) Z|]]
2876 [[:Bar:X (Y) Z|]]
2877 !! result
2878 [[Article (context)|Article]]
2879 [[Bar:Article|Article]]
2880 [[:Bar:Article|Article]]
2881 [[Bar:Article (context)|Article]]
2882 [[:Bar:Article (context)|Article]]
2883 [[Article]]
2884 [[Article (context)]]
2885 [[Bar:X (Y) Z|X (Y) Z]]
2886 [[:Bar:X (Y) Z|X (Y) Z]]
2887 !! end
2889 !! test
2890 pre-save transform: context links ("pipe trick") with interwiki prefix
2891 !! options
2893 !! input
2894 [[interwiki:Article|]]
2895 [[:interwiki:Article|]]
2896 [[interwiki:Bar:Article|]]
2897 [[:interwiki:Bar:Article|]]
2898 !! result
2899 [[interwiki:Article|Article]]
2900 [[:interwiki:Article|Article]]
2901 [[interwiki:Bar:Article|Bar:Article]]
2902 [[:interwiki:Bar:Article|Bar:Article]]
2903 !! end
2905 !! test
2906 pre-save transform: context links ("pipe trick") with parens in title
2907 !! options
2908 pst title=[[Somearticle (context)]]
2909 !! input
2910 [[|Article]]
2911 !! result
2912 [[Article (context)|Article]]
2913 !! end
2915 !! test
2916 pre-save transform: context links ("pipe trick") with comma in title
2917 !! options
2918 pst title=[[Someplace, Somewhere]]
2919 !! input
2920 [[|Otherplace]]
2921 [[Otherplace, Elsewhere|]]
2922 [[Otherplace, Elsewhere, Anywhere|]]
2923 !! result
2924 [[Otherplace, Somewhere|Otherplace]]
2925 [[Otherplace, Elsewhere|Otherplace]]
2926 [[Otherplace, Elsewhere, Anywhere|Otherplace]]
2927 !! end
2929 !! test
2930 pre-save transform: context links ("pipe trick") with parens and comma
2931 !! options
2932 pst title=[[Someplace (IGNORED), Somewhere]]
2933 !! input
2934 [[|Otherplace]]
2935 [[Otherplace (place), Elsewhere|]]
2936 !! result
2937 [[Otherplace, Somewhere|Otherplace]]
2938 [[Otherplace (place), Elsewhere|Otherplace]]
2939 !! end
2941 !! test
2942 pre-save transform: context links ("pipe trick") with comma and parens
2943 !! options
2944 pst title=[[Who, me? (context)]]
2945 !! input
2946 [[|Yes, you.]]
2947 [[Me, Myself, and I (1937 song)|]]
2948 !! result
2949 [[Yes, you. (context)|Yes, you.]]
2950 [[Me, Myself, and I (1937 song)|Me, Myself, and I]]
2951 !! end
2953 !! test
2954 pre-save transform: context links ("pipe trick") with namespace
2955 !! options
2956 pst title=[[Ns:Somearticle]]
2957 !! input
2958 [[|Article]]
2959 !! result
2960 [[Ns:Article|Article]]
2961 !! end
2963 !! test
2964 pre-save transform: context links ("pipe trick") with namespace and parens
2965 !! options
2966 pst title=[[Ns:Somearticle (context)]]
2967 !! input
2968 [[|Article]]
2969 !! result
2970 [[Ns:Article (context)|Article]]
2971 !! end
2973 !! test
2974 pre-save transform: context links ("pipe trick") with namespace and comma
2975 !! options
2976 pst title=[[Ns:Somearticle, Context, Whatever]]
2977 !! input
2978 [[|Article]]
2979 !! result
2980 [[Ns:Article, Context, Whatever|Article]]
2981 !! end
2983 !! test
2984 pre-save transform: context links ("pipe trick") with namespace, comma and parens
2985 !! options
2986 pst title=[[Ns:Somearticle, Context (context)]]
2987 !! input
2988 [[|Article]]
2989 !! result
2990 [[Ns:Article (context)|Article]]
2991 !! end
2993 !! test
2994 pre-save transform: context links ("pipe trick") with namespace, parens and comma
2995 !! options
2996 pst title=[[Ns:Somearticle (IGNORED), Context]]
2997 !! input
2998 [[|Article]]
2999 !! result
3000 [[Ns:Article, Context|Article]]
3001 !! end
3005 ### Message transform tests
3007 !! test
3008 message transform: magic variables
3009 !! options
3011 !! input
3012 {{SITENAME}}
3013 !! result
3014 MediaWiki
3015 !! end
3017 !! test
3018 message transform: should not transform wiki markup
3019 !! options
3021 !! input
3022 ''test''
3023 !! result
3024 ''test''
3025 !! end
3027 !! test
3028 message transform: <noinclude> in transcluded template (bug 4926)
3029 !! options
3031 !! input
3032 {{Includes}}
3033 !! result
3034 Foobar
3035 !! end
3037 !! test
3038 message transform: <onlyinclude> in transcluded template (bug 4926)
3039 !! options
3041 !! input
3042 {{Includes2}}
3043 !! result
3045 !! end
3047 !! test
3048 {{#special:}} page name, known
3049 !! options
3051 !! input
3052 {{#special:Recentchanges}}
3053 !! result
3054 Special:RecentChanges
3055 !! end
3057 !! test
3058 {{#special:}} page name, unknown
3059 !! options
3061 !! input
3062 {{#special:foobarnonexistent}}
3063 !! result
3064 No such special page
3065 !! end
3068 ### Images
3070 !! test
3071 Simple image
3072 !! input
3073 [[Image:foobar.jpg]]
3074 !! result
3075 <p><a href="/wiki/Image:Foobar.jpg" class="image" title="Image:foobar.jpg"><img alt="Image:foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" border="0" /></a>
3076 </p>
3077 !! end
3079 !! test
3080 Right-aligned image
3081 !! input
3082 [[Image:foobar.jpg|right]]
3083 !! result
3084 <div class="floatright"><a href="/wiki/Image:Foobar.jpg" class="image" title="Foobar.jpg"><img alt="" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" border="0" /></a></div>
3086 !! end
3088 !! test
3089 Image with caption
3090 !! input
3091 [[Image:foobar.jpg|right|Caption text]]
3092 !! result
3093 <div class="floatright"><a href="/wiki/Image:Foobar.jpg" class="image" title="Caption text"><img alt="Caption text" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" border="0" /></a></div>
3095 !! end
3097 !! test
3098 Image with link parameter, wiki target
3099 !! input
3100 [[Image:foobar.jpg|link=Target page]]
3101 !! result
3102 <p><a href="/wiki/Target_page" title="Target page"><img alt="" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" border="0" /></a>
3103 </p>
3104 !! end
3106 !! test
3107 Image with link parameter, URL target
3108 !! input
3109 [[Image:foobar.jpg|link=http://example.com/]]
3110 !! result
3111 <p><a href="http://example.com/"><img alt="" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" border="0" /></a>
3112 </p>
3113 !! end
3115 !! test
3116 Image with empty link parameter
3117 !! input
3118 [[Image:foobar.jpg|link=]]
3119 !! result
3120 <p><img alt="" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" border="0" />
3121 </p>
3122 !! end
3126 !! test
3127 Image with frame and link
3128 !! input
3129 [[Image:Foobar.jpg|frame|left|This is a test image [[Main Page]]]]
3130 !! result
3131 <div class="thumb tleft"><div class="thumbinner" style="width:1943px;"><a href="/wiki/Image:Foobar.jpg" class="image" title="This is a test image Main Page"><img alt="This is a test image Main Page" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" border="0" 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>
3133 !! end
3135 !! test
3136 Link to image page- image page normally doesn't exists, hence edit link
3137 Add test with existing image page
3138 #<p><a href="/wiki/Image:Test" title="Image:Test">Image:test</a>
3139 !! input
3140 [[:Image:test]]
3141 !! result
3142 <p><a href="/index.php?title=Image:Test&amp;action=edit&amp;redlink=1" class="new" title="Image:Test (not yet written)">Image:test</a>
3143 </p>
3144 !! end
3146 !! test
3147 Frameless image caption with a free URL
3148 !! input
3149 [[Image:foobar.jpg|http://example.com]]
3150 !! result
3151 <p><a href="/wiki/Image: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" border="0" /></a>
3152 </p>
3153 !! end
3155 !! test
3156 Thumbnail image caption with a free URL
3157 !! input
3158 [[Image:foobar.jpg|thumb|http://example.com]]
3159 !! result
3160 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/Image:Foobar.jpg" class="image" title="http://example.com"><img alt="http://example.com" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" border="0" class="thumbimage" /></a>  <div class="thumbcaption"><div class="magnify"><a href="/wiki/Image: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" title="http://example.com" rel="nofollow">http://example.com</a></div></div></div>
3162 !! end
3164 !! test
3165 BUG 1887: A ISBN with a thumbnail
3166 !! input
3167 [[Image:foobar.jpg|thumb|ISBN 1235467890]]
3168 !! result
3169 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/Image:Foobar.jpg" class="image" title="ISBN 1235467890"><img alt="ISBN 1235467890" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" border="0" class="thumbimage" /></a>  <div class="thumbcaption"><div class="magnify"><a href="/wiki/Image: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">ISBN 1235467890</a></div></div></div>
3171 !! end
3173 !! test
3174 BUG 1887: A RFC with a thumbnail
3175 !! input
3176 [[Image:foobar.jpg|thumb|This is RFC 12354]]
3177 !! result
3178 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/Image:Foobar.jpg" class="image" title="This is RFC 12354"><img alt="This is RFC 12354" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" border="0" class="thumbimage" /></a>  <div class="thumbcaption"><div class="magnify"><a href="/wiki/Image: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" title="http://tools.ietf.org/html/rfc12354">RFC 12354</a></div></div></div>
3180 !! end
3182 !! test
3183 BUG 1887: A mailto link with a thumbnail
3184 !! input
3185 [[Image:foobar.jpg|thumb|Please mailto:nobody@example.com]]
3186 !! result
3187 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/Image:Foobar.jpg" class="image" title="Please mailto:nobody@example.com"><img alt="Please mailto:nobody@example.com" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" border="0" class="thumbimage" /></a>  <div class="thumbcaption"><div class="magnify"><a href="/wiki/Image: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" title="mailto:nobody@example.com" rel="nofollow">mailto:nobody@example.com</a></div></div></div>
3189 !! end
3191 !! test
3192 BUG 1887: A <math> with a thumbnail- we don't render math in the parsertests by default,
3193 so math is not stripped and turns up as escaped &lt;math&gt; tags.
3194 !! input
3195 [[Image:foobar.jpg|thumb|<math>2+2</math>]]
3196 !! result
3197 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/Image:Foobar.jpg" class="image" title="&lt;math&gt;2+2&lt;/math&gt;"><img alt="&lt;math&gt;2+2&lt;/math&gt;" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" border="0" class="thumbimage" /></a>  <div class="thumbcaption"><div class="magnify"><a href="/wiki/Image: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>
3199 !! end
3201 !! test
3202 BUG 1887, part 2: A <math> with a thumbnail- math enabled
3203 !! options
3204 math
3205 !! input
3206 [[Image:foobar.jpg|thumb|<math>2+2</math>]]
3207 !! result
3208 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/Image:Foobar.jpg" class="image" title="2 + 2"><img alt="2 + 2" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" border="0" class="thumbimage" /></a>  <div class="thumbcaption"><div class="magnify"><a href="/wiki/Image: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>
3210 !! end
3212 # Pending resolution to bug 368
3213 !! test
3214 BUG 648: Frameless image caption with a link
3215 !! input
3216 [[Image:foobar.jpg|text with a [[link]] in it]]
3217 !! result
3218 <p><a href="/wiki/Image: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" border="0" /></a>
3219 </p>
3220 !! end
3222 !! test
3223 BUG 648: Frameless image caption with a link (suffix)
3224 !! input
3225 [[Image:foobar.jpg|text with a [[link]]foo in it]]
3226 !! result
3227 <p><a href="/wiki/Image: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" border="0" /></a>
3228 </p>
3229 !! end
3231 !! test
3232 BUG 648: Frameless image caption with an interwiki link
3233 !! input
3234 [[Image:foobar.jpg|text with a [[MeatBall:Link]] in it]]
3235 !! result
3236 <p><a href="/wiki/Image: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" border="0" /></a>
3237 </p>
3238 !! end
3240 !! test
3241 BUG 648: Frameless image caption with a piped interwiki link
3242 !! input
3243 [[Image:foobar.jpg|text with a [[MeatBall:Link|link]] in it]]
3244 !! result
3245 <p><a href="/wiki/Image: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" border="0" /></a>
3246 </p>
3247 !! end
3249 !! test
3250 Escape HTML special chars in image alt text
3251 !! input
3252 [[Image:foobar.jpg|& < > "]]
3253 !! result
3254 <p><a href="/wiki/Image: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" border="0" /></a>
3255 </p>
3256 !! end
3258 !! test
3259 BUG 499: Alt text should have &#1234;, not &amp;1234;
3260 !! input
3261 [[Image:foobar.jpg|&#9792;]]
3262 !! result
3263 <p><a href="/wiki/Image:Foobar.jpg" class="image" title="♀"><img alt="♀" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" border="0" /></a>
3264 </p>
3265 !! end
3267 !! test
3268 Broken image caption with link
3269 !! input
3270 [[Image:Foobar.jpg|thumb|This is a broken caption. But [[Main Page|this]] is just an ordinary link.
3271 !! result
3272 <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.
3273 </p>
3274 !! end
3276 !! test
3277 Image caption containing another image
3278 !! input
3279 [[Image:Foobar.jpg|thumb|This is a caption with another [[Image:icon.png|image]] inside it!]]
3280 !! result
3281 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/Image:Foobar.jpg" class="image" title="This is a caption with another Image:Icon.png inside it!"><img alt="This is a caption with another Image:Icon.png inside it!" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" border="0" class="thumbimage" /></a>  <div class="thumbcaption"><div class="magnify"><a href="/wiki/Image: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="Image:Icon.png">Image:Icon.png</a> inside it!</div></div></div>
3283 !! end
3285 !! test
3286 Image caption containing a newline
3287 !! input
3288 [[Image:Foobar.jpg|This
3289 *is some text]]
3290 !! result
3291 <p><a href="/wiki/Image: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" border="0" /></a>
3292 </p>
3293 !!end
3296 !! test
3297 Bug 3090: External links other than http: in image captions
3298 !! input
3299 [[Image:Foobar.jpg|thumb|200px|This caption has [irc://example.net irc] and [https://example.com Secure] ext links in it.]]
3300 !! result
3301 <div class="thumb tright"><div class="thumbinner" style="width:202px;"><a href="/wiki/Image:Foobar.jpg" class="image" title="This caption has irc and Secure ext links in it."><img alt="This caption has irc and Secure ext links in it." src="http://example.com/images/thumb/3/3a/Foobar.jpg/200px-Foobar.jpg" width="200" height="23" border="0" class="thumbimage" /></a>  <div class="thumbcaption"><div class="magnify"><a href="/wiki/Image: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" title="irc://example.net" rel="nofollow">irc</a> and <a href="https://example.com" class="external text" title="https://example.com" rel="nofollow">Secure</a> ext links in it.</div></div></div>
3303 !! end
3307 ### Subpages
3309 !! article
3310 Subpage test/subpage
3311 !! text
3313 !! endarticle
3315 !! test
3316 Subpage link
3317 !! options
3318 subpage title=[[Subpage test]]
3319 !! input
3320 [[/subpage]]
3321 !! result
3322 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a>
3323 </p>
3324 !! end
3326 !! test
3327 Subpage noslash link
3328 !! options
3329 subpage title=[[Subpage test]]
3330 !!input
3331 [[/subpage/]]
3332 !! result
3333 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">subpage</a>
3334 </p>
3335 !! end
3337 !! test
3338 Disabled subpages
3339 !! input
3340 [[/subpage]]
3341 !! result
3342 <p><a href="/index.php?title=/subpage&amp;action=edit&amp;redlink=1" class="new" title="/subpage (not yet written)">/subpage</a>
3343 </p>
3344 !! end
3346 !! test
3347 BUG 561: {{/Subpage}}
3348 !! options
3349 subpage title=[[Page]]
3350 !! input
3351 {{/Subpage}}
3352 !! result
3353 <p><a href="/index.php?title=Page/Subpage&amp;action=edit&amp;redlink=1" class="new" title="Page/Subpage (not yet written)">Page/Subpage</a>
3354 </p>
3355 !! end
3358 ### Categories
3360 !! article
3361 Category:MediaWiki User's Guide
3362 !! text
3363 blah
3364 !! endarticle
3366 !! test
3367 Link to category
3368 !! input
3369 [[:Category:MediaWiki User's Guide]]
3370 !! result
3371 <p><a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User&#39;s Guide">Category:MediaWiki User's Guide</a>
3372 </p>
3373 !! end
3375 !! test
3376 Simple category
3377 !! options
3379 !! input
3380 [[Category:MediaWiki User's Guide]]
3381 !! result
3382 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User&#039;s Guide">MediaWiki User's Guide</a>
3383 !! end
3385 !! test
3386 PAGESINCATEGORY invalid title fatal (r33546 fix)
3387 !! input
3388 {{PAGESINCATEGORY:<bogus>}}
3389 !! result
3390 <p>0
3391 </p>
3392 !! end
3395 ### Inter-language links
3397 !! test
3398 Inter-language links
3399 !! options
3401 !! input
3402 [[es:Alimento]]
3403 [[fr:Nourriture]]
3404 [[zh:&#39135;&#21697;]]
3405 !! result
3406 es:Alimento fr:Nourriture zh:食品
3407 !! end
3410 ### Sections
3412 !! test
3413 Basic section headings
3414 !! input
3415 == Headline 1 ==
3416 Some text
3418 ==Headline 2==
3419 More
3420 ===Smaller headline===
3421 Blah blah
3422 !! result
3423 <a name="Headline_1"></a><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"> Headline 1 </span></h2>
3424 <p>Some text
3425 </p>
3426 <a name="Headline_2"></a><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">Headline 2</span></h2>
3427 <p>More
3428 </p>
3429 <a name="Smaller_headline"></a><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">Smaller headline</span></h3>
3430 <p>Blah blah
3431 </p>
3432 !! end
3434 !! test
3435 Section headings with TOC
3436 !! input
3437 == Headline 1 ==
3438 === Subheadline 1 ===
3439 ===== Skipping a level =====
3440 ====== Skipping a level ======
3442 == Headline 2 ==
3443 Some text
3444 ===Another headline===
3445 !! result
3446 <table id="toc" class="toc" summary="Contents"><tr><td><div id="toctitle"><h2>Contents</h2></div>
3447 <ul>
3448 <li class="toclevel-1"><a href="#Headline_1"><span class="tocnumber">1</span> <span class="toctext">Headline 1</span></a>
3449 <ul>
3450 <li class="toclevel-2"><a href="#Subheadline_1"><span class="tocnumber">1.1</span> <span class="toctext">Subheadline 1</span></a>
3451 <ul>
3452 <li class="toclevel-3"><a href="#Skipping_a_level"><span class="tocnumber">1.1.1</span> <span class="toctext">Skipping a level</span></a>
3453 <ul>
3454 <li class="toclevel-4"><a href="#Skipping_a_level_2"><span class="tocnumber">1.1.1.1</span> <span class="toctext">Skipping a level</span></a></li>
3455 </ul>
3456 </li>
3457 </ul>
3458 </li>
3459 </ul>
3460 </li>
3461 <li class="toclevel-1"><a href="#Headline_2"><span class="tocnumber">2</span> <span class="toctext">Headline 2</span></a>
3462 <ul>
3463 <li class="toclevel-2"><a href="#Another_headline"><span class="tocnumber">2.1</span> <span class="toctext">Another headline</span></a></li>
3464 </ul>
3465 </li>
3466 </ul>
3467 </td></tr></table><script type="text/javascript"> if (window.showTocToggle) { var tocShowText = "show"; var tocHideText = "hide"; showTocToggle(); } </script>
3468 <a name="Headline_1"></a><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"> Headline 1 </span></h2>
3469 <a name="Subheadline_1"></a><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"> Subheadline 1 </span></h3>
3470 <a name="Skipping_a_level"></a><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"> Skipping a level </span></h5>
3471 <a name="Skipping_a_level_2"></a><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"> Skipping a level </span></h6>
3472 <a name="Headline_2"></a><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"> Headline 2 </span></h2>
3473 <p>Some text
3474 </p>
3475 <a name="Another_headline"></a><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">Another headline</span></h3>
3477 !! end
3479 # perl -e 'print "="x$_," Level $_ heading","="x$_,"\n" for 1..10'
3480 !! test
3481 Handling of sections up to level 6 and beyond
3482 !! input 
3483 = Level 1 Heading=
3484 == Level 2 Heading==
3485 === Level 3 Heading===
3486 ==== Level 4 Heading====
3487 ===== Level 5 Heading=====
3488 ====== Level 6 Heading======
3489 ======= Level 7 Heading=======
3490 ======== Level 8 Heading========
3491 ========= Level 9 Heading=========
3492 ========== Level 10 Heading==========
3493 !! result
3494 <table id="toc" class="toc" summary="Contents"><tr><td><div id="toctitle"><h2>Contents</h2></div>
3495 <ul>
3496 <li class="toclevel-1"><a href="#Level_1_Heading"><span class="tocnumber">1</span> <span class="toctext">Level 1 Heading</span></a>
3497 <ul>
3498 <li class="toclevel-2"><a href="#Level_2_Heading"><span class="tocnumber">1.1</span> <span class="toctext">Level 2 Heading</span></a>
3499 <ul>
3500 <li class="toclevel-3"><a href="#Level_3_Heading"><span class="tocnumber">1.1.1</span> <span class="toctext">Level 3 Heading</span></a>
3501 <ul>
3502 <li class="toclevel-4"><a href="#Level_4_Heading"><span class="tocnumber">1.1.1.1</span> <span class="toctext">Level 4 Heading</span></a>
3503 <ul>
3504 <li class="toclevel-5"><a href="#Level_5_Heading"><span class="tocnumber">1.1.1.1.1</span> <span class="toctext">Level 5 Heading</span></a>
3505 <ul>
3506 <li class="toclevel-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>
3507 <li class="toclevel-6"><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>
3508 <li class="toclevel-6"><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>
3509 <li class="toclevel-6"><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>
3510 <li class="toclevel-6"><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>
3511 </ul>
3512 </li>
3513 </ul>
3514 </li>
3515 </ul>
3516 </li>
3517 </ul>
3518 </li>
3519 </ul>
3520 </li>
3521 </ul>
3522 </td></tr></table><script type="text/javascript"> if (window.showTocToggle) { var tocShowText = "show"; var tocHideText = "hide"; showTocToggle(); } </script>
3523 <a name="Level_1_Heading"></a><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"> Level 1 Heading</span></h1>
3524 <a name="Level_2_Heading"></a><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"> Level 2 Heading</span></h2>
3525 <a name="Level_3_Heading"></a><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"> Level 3 Heading</span></h3>
3526 <a name="Level_4_Heading"></a><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"> Level 4 Heading</span></h4>
3527 <a name="Level_5_Heading"></a><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"> Level 5 Heading</span></h5>
3528 <a name="Level_6_Heading"></a><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"> Level 6 Heading</span></h6>
3529 <a name=".3D_Level_7_Heading.3D"></a><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">= Level 7 Heading=</span></h6>
3530 <a name=".3D.3D_Level_8_Heading.3D.3D"></a><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">== Level 8 Heading==</span></h6>
3531 <a name=".3D.3D.3D_Level_9_Heading.3D.3D.3D"></a><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">=== Level 9 Heading===</span></h6>
3532 <a name=".3D.3D.3D.3D_Level_10_Heading.3D.3D.3D.3D"></a><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">==== Level 10 Heading====</span></h6>
3534 !! end
3536 !! test
3537 TOC regression (bug 9764)
3538 !! input
3539 == title 1 ==
3540 === title 1.1 ===
3541 ==== title 1.1.1 ====
3542 === title 1.2 ===
3543 == title 2 ==
3544 === title 2.1 ===
3545 !! result
3546 <table id="toc" class="toc" summary="Contents"><tr><td><div id="toctitle"><h2>Contents</h2></div>
3547 <ul>
3548 <li class="toclevel-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
3549 <ul>
3550 <li class="toclevel-2"><a href="#title_1.1"><span class="tocnumber">1.1</span> <span class="toctext">title 1.1</span></a>
3551 <ul>
3552 <li class="toclevel-3"><a href="#title_1.1.1"><span class="tocnumber">1.1.1</span> <span class="toctext">title 1.1.1</span></a></li>
3553 </ul>
3554 </li>
3555 <li class="toclevel-2"><a href="#title_1.2"><span class="tocnumber">1.2</span> <span class="toctext">title 1.2</span></a></li>
3556 </ul>
3557 </li>
3558 <li class="toclevel-1"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
3559 <ul>
3560 <li class="toclevel-2"><a href="#title_2.1"><span class="tocnumber">2.1</span> <span class="toctext">title 2.1</span></a></li>
3561 </ul>
3562 </li>
3563 </ul>
3564 </td></tr></table><script type="text/javascript"> if (window.showTocToggle) { var tocShowText = "show"; var tocHideText = "hide"; showTocToggle(); } </script>
3565 <a name="title_1"></a><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"> title 1 </span></h2>
3566 <a name="title_1.1"></a><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"> title 1.1 </span></h3>
3567 <a name="title_1.1.1"></a><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"> title 1.1.1 </span></h4>
3568 <a name="title_1.2"></a><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"> title 1.2 </span></h3>
3569 <a name="title_2"></a><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"> title 2 </span></h2>
3570 <a name="title_2.1"></a><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"> title 2.1 </span></h3>
3572 !! end
3574 !! test
3575 TOC with wgMaxTocLevel=3 (bug 6204)
3576 !! options
3577 wgMaxTocLevel=3
3578 !! input
3579 == title 1 ==
3580 === title 1.1 ===
3581 ==== title 1.1.1 ====
3582 === title 1.2 ===
3583 == title 2 ==
3584 === title 2.1 ===
3585 !! result
3586 <table id="toc" class="toc" summary="Contents"><tr><td><div id="toctitle"><h2>Contents</h2></div>
3587 <ul>
3588 <li class="toclevel-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
3589 <ul>
3590 <li class="toclevel-2"><a href="#title_1.1"><span class="tocnumber">1.1</span> <span class="toctext">title 1.1</span></a></li>
3591 <li class="toclevel-2"><a href="#title_1.2"><span class="tocnumber">1.2</span> <span class="toctext">title 1.2</span></a></li>
3592 </ul>
3593 </li>
3594 <li class="toclevel-1"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
3595 <ul>
3596 <li class="toclevel-2"><a href="#title_2.1"><span class="tocnumber">2.1</span> <span class="toctext">title 2.1</span></a></li>
3597 </ul>
3598 </li>
3599 </ul>
3600 </td></tr></table><script type="text/javascript"> if (window.showTocToggle) { var tocShowText = "show"; var tocHideText = "hide"; showTocToggle(); } </script>
3601 <a name="title_1"></a><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"> title 1 </span></h2>
3602 <a name="title_1.1"></a><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"> title 1.1 </span></h3>
3603 <a name="title_1.1.1"></a><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"> title 1.1.1 </span></h4>
3604 <a name="title_1.2"></a><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"> title 1.2 </span></h3>
3605 <a name="title_2"></a><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"> title 2 </span></h2>
3606 <a name="title_2.1"></a><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"> title 2.1 </span></h3>
3608 !! end
3610 !! test
3611 Resolving duplicate section names
3612 !! input
3613 == Foo bar ==
3614 == Foo bar ==
3615 !! result
3616 <a name="Foo_bar"></a><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"> Foo bar </span></h2>
3617 <a name="Foo_bar_2"></a><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"> Foo bar </span></h2>
3619 !! end
3621 !! test
3622 Resolving duplicate section names with differing case (bug 10721)
3623 !! input
3624 == Foo bar ==
3625 == Foo Bar ==
3626 !! result
3627 <a name="Foo_bar"></a><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"> Foo bar </span></h2>
3628 <a name="Foo_Bar_2"></a><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"> Foo Bar </span></h2>
3630 !! end
3632 !! article
3633 Template:sections
3634 !! text
3635 ===Section 1===
3636 ==Section 2==
3637 !! endarticle
3639 !! test
3640 Template with sections, __NOTOC__
3641 !! input
3642 __NOTOC__
3643 ==Section 0==
3644 {{sections}}
3645 ==Section 4==
3646 !! result
3647 <a name="Section_0"></a><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">Section 0</span></h2>
3648 <a name="Section_1"></a><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">Section 1</span></h3>
3649 <a name="Section_2"></a><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">Section 2</span></h2>
3650 <a name="Section_4"></a><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">Section 4</span></h2>
3652 !! end
3654 !! test
3655 __NOEDITSECTION__ keyword
3656 !! input
3657 __NOEDITSECTION__
3658 ==Section 1==
3659 ==Section 2==
3660 !! result
3661 <a name="Section_1"></a><h2> <span class="mw-headline">Section 1</span></h2>
3662 <a name="Section_2"></a><h2> <span class="mw-headline">Section 2</span></h2>
3664 !! end
3666 !! test
3667 Link inside a section heading
3668 !! input
3669 ==Section with a [[Main Page|link]] in it==
3670 !! result
3671 <a name="Section_with_a_link_in_it"></a><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">Section with a <a href="/wiki/Main_Page" title="Main Page">link</a> in it</span></h2>
3673 !! end
3675 !! test
3676 TOC regression (bug 12077)
3677 !! input
3678 __TOC__
3679 == title 1 ==
3680 === title 1.1 ===
3681 == title 2 ==
3682 !! result
3683 <table id="toc" class="toc" summary="Contents"><tr><td><div id="toctitle"><h2>Contents</h2></div>
3684 <ul>
3685 <li class="toclevel-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
3686 <ul>
3687 <li class="toclevel-2"><a href="#title_1.1"><span class="tocnumber">1.1</span> <span class="toctext">title 1.1</span></a></li>
3688 </ul>
3689 </li>
3690 <li class="toclevel-1"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a></li>
3691 </ul>
3692 </td></tr></table><script type="text/javascript"> if (window.showTocToggle) { var tocShowText = "show"; var tocHideText = "hide"; showTocToggle(); } </script>
3693 <a name="title_1"></a><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"> title 1 </span></h2>
3694 <a name="title_1.1"></a><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"> title 1.1 </span></h3>
3695 <a name="title_2"></a><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"> title 2 </span></h2>
3697 !! end
3699 !! test
3700 BUG 1219 URL next to image (good)
3701 !! input
3702 http://example.com [[Image:foobar.jpg]]
3703 !! result
3704 <p><a href="http://example.com" class="external free" title="http://example.com" rel="nofollow">http://example.com</a> <a href="/wiki/Image:Foobar.jpg" class="image" title="Image:foobar.jpg"><img alt="Image:foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" border="0" /></a>
3705 </p>
3706 !!end
3708 !! test
3709 BUG 1219 URL next to image (broken)
3710 !! input
3711 http://example.com[[Image:foobar.jpg]]
3712 !! result
3713 <p><a href="http://example.com" class="external free" title="http://example.com" rel="nofollow">http://example.com</a><a href="/wiki/Image:Foobar.jpg" class="image" title="Image:foobar.jpg"><img alt="Image:foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" border="0" /></a>
3714 </p>
3715 !!end
3717 !! test
3718 Bug 1186 news: in the middle of text
3719 !! input
3720 http://en.wikinews.org/wiki/Wikinews:Workplace
3721 !! result
3722 <p><a href="http://en.wikinews.org/wiki/Wikinews:Workplace" class="external free" title="http://en.wikinews.org/wiki/Wikinews:Workplace" rel="nofollow">http://en.wikinews.org/wiki/Wikinews:Workplace</a>
3723 </p>
3724 !!end
3727 !! test
3728 Namespaced link must have a title
3729 !! input
3730 [[Project:]]
3731 !! result
3732 <p>[[Project:]]
3733 </p>
3734 !!end
3736 !! test
3737 Namespaced link must have a title (bad fragment version)
3738 !! input
3739 [[Project:#fragment]]
3740 !! result
3741 <p>[[Project:#fragment]]
3742 </p>
3743 !!end
3746 !! test
3747 div with no attributes
3748 !! input
3749 <div>HTML rocks</div>
3750 !! result
3751 <div>HTML rocks</div>
3753 !! end
3755 !! test
3756 div with double-quoted attribute
3757 !! input
3758 <div id="rock">HTML rocks</div>
3759 !! result
3760 <div id="rock">HTML rocks</div>
3762 !! end
3764 !! test
3765 div with single-quoted attribute
3766 !! input
3767 <div id='rock'>HTML rocks</div>
3768 !! result
3769 <div id="rock">HTML rocks</div>
3771 !! end
3773 !! test
3774 div with unquoted attribute
3775 !! input
3776 <div id=rock>HTML rocks</div>
3777 !! result
3778 <div id="rock">HTML rocks</div>
3780 !! end
3782 !! test
3783 div with illegal double attributes
3784 !! input
3785 <div align="center" align="right">HTML rocks</div>
3786 !! result
3787 <div align="right">HTML rocks</div>
3789 !!end
3791 !! test
3792 HTML multiple attributes correction
3793 !! input
3794 <p class="error" class="awesome">Awesome!</p>
3795 !! result
3796 <p class="awesome">Awesome!</p>
3798 !!end
3800 !! test
3801 Table multiple attributes correction
3802 !! input
3804 !+ class="error" class="awesome"| status
3806 !! result
3807 <table>
3808 <tr>
3809 <th class="awesome"> status
3810 </th></tr></table>
3812 !!end
3814 !! test
3815 DIV IN UPPERCASE
3816 !! input
3817 <DIV ALIGN="center">HTML ROCKS</DIV>
3818 !! result
3819 <div align="center">HTML ROCKS</div>
3821 !!end
3824 !! test
3825 text with amp in the middle of nowhere
3826 !! input
3827 Remember AT&T?
3828 !!result
3829 <p>Remember AT&amp;T?
3830 </p>
3831 !! end
3833 !! test
3834 text with character entity: eacute
3835 !! input
3836 I always thought &eacute; was a cute letter.
3837 !! result
3838 <p>I always thought &eacute; was a cute letter.
3839 </p>
3840 !! end
3842 !! test
3843 text with undefined character entity: xacute
3844 !! input
3845 I always thought &xacute; was a cute letter.
3846 !! result
3847 <p>I always thought &amp;xacute; was a cute letter.
3848 </p>
3849 !! end
3853 ### Media links
3856 !! test
3857 Media link
3858 !! input
3859 [[Media:Foobar.jpg]]
3860 !! result
3861 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Media:Foobar.jpg</a>
3862 </p>
3863 !! end
3865 !! test
3866 Media link with text
3867 !! input
3868 [[Media:Foobar.jpg|A neat file to look at]]
3869 !! result
3870 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">A neat file to look at</a>
3871 </p>
3872 !! end
3874 # FIXME: this is still bad HTML tag nesting
3875 !! test
3876 Media link with nasty text
3877 fixme: doBlockLevels won't wrap this in a paragraph because it contains a div
3878 !! input
3879 [[Media:Foobar.jpg|Safe Link<div style=display:none>" onmouseover="alert(document.cookie)" onfoo="</div>]]
3880 !! result
3881 <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>
3883 !! end
3885 !! test
3886 Media link to nonexistent file (bug 1702)
3887 !! input
3888 [[Media:No such.jpg]]
3889 !! result
3890 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=No_such.jpg" class="new" title="No such.jpg">Media:No such.jpg</a>
3891 </p>
3892 !! end
3894 !! test
3895 Image link to nonexistent file (bug 1850 - good)
3896 !! input
3897 [[Image:No such.jpg]]
3898 !! result
3899 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=No_such.jpg" class="new" title="Image:No such.jpg">Image:No such.jpg</a>
3900 </p>
3901 !! end
3903 !! test
3904 :Image link to nonexistent file (bug 1850 - bad)
3905 !! input
3906 [[:Image:No such.jpg]]
3907 !! result
3908 <p><a href="/index.php?title=Image:No_such.jpg&amp;action=edit&amp;redlink=1" class="new" title="Image:No such.jpg (not yet written)">Image:No such.jpg</a>
3909 </p>
3910 !! end
3914 !! test
3915 Character reference normalization in link text (bug 1938)
3916 !! input
3917 [[Main Page|this&that]]
3918 !! result
3919 <p><a href="/wiki/Main_Page" title="Main Page">this&amp;that</a>
3920 </p>
3921 !!end
3923 !! test
3924 Empty attribute crash test (bug 2067)
3925 !! input
3926 <font color="">foo</font>
3927 !! result
3928 <p><font color="">foo</font>
3929 </p>
3930 !! end
3932 !! test
3933 Empty attribute crash test single-quotes (bug 2067)
3934 !! input
3935 <font color=''>foo</font>
3936 !! result
3937 <p><font color="">foo</font>
3938 </p>
3939 !! end
3941 !! test
3942 Attribute test: equals, then nothing
3943 !! input
3944 <font color=>foo</font>
3945 !! result
3946 <p><font>foo</font>
3947 </p>
3948 !! end
3950 !! test
3951 Attribute test: unquoted value
3952 !! input
3953 <font color=x>foo</font>
3954 !! result
3955 <p><font color="x">foo</font>
3956 </p>
3957 !! end
3959 !! test
3960 Attribute test: unquoted but illegal value (hash)
3961 !! input
3962 <font color=#x>foo</font>
3963 !! result
3964 <p><font color="#x">foo</font>
3965 </p>
3966 !! end
3968 !! test
3969 Attribute test: no value
3970 !! input
3971 <font color>foo</font>
3972 !! result
3973 <p><font color="color">foo</font>
3974 </p>
3975 !! end
3977 !! test
3978 Bug 2095: link with three closing brackets
3979 !! input
3980 [[Main Page]]]
3981 !! result
3982 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>]
3983 </p>
3984 !! end
3986 !! test
3987 Bug 2095: link with pipe and three closing brackets
3988 !! input
3989 [[Main Page|link]]]
3990 !! result
3991 <p><a href="/wiki/Main_Page" title="Main Page">link</a>]
3992 </p>
3993 !! end
3995 !! test
3996 Bug 2095: link with pipe and three closing brackets, version 2
3997 !! input
3998 [[Main Page|[http://example.com/]]]
3999 !! result
4000 <p><a href="/wiki/Main_Page" title="Main Page">[http://example.com/]</a>
4001 </p>
4002 !! end
4006 ### Safety
4009 !! article
4010 Template:Dangerous attribute
4011 !! text
4012 " onmouseover="alert(document.cookie)
4013 !! endarticle
4015 !! article
4016 Template:Dangerous style attribute
4017 !! text
4018 border-size: expression(alert(document.cookie))
4019 !! endarticle
4021 !! article
4022 Template:Div style
4023 !! text
4024 <div style="float: right; {{{1}}}">Magic div</div>
4025 !! endarticle
4027 !! test
4028 Bug 2304: HTML attribute safety (safe template; regression bug 2309)
4029 !! input
4030 <div title="{{test}}"></div>
4031 !! result
4032 <div title="This is a test template"></div>
4034 !! end
4036 !! test
4037 Bug 2304: HTML attribute safety (dangerous template; 2309)
4038 !! input
4039 <div title="{{dangerous attribute}}"></div>
4040 !! result
4041 <div title=""></div>
4043 !! end
4045 !! test
4046 Bug 2304: HTML attribute safety (dangerous style template; 2309)
4047 !! input
4048 <div style="{{dangerous style attribute}}"></div>
4049 !! result
4050 <div></div>
4052 !! end
4054 !! test
4055 Bug 2304: HTML attribute safety (safe parameter; 2309)
4056 !! input
4057 {{div style|width: 200px}}
4058 !! result
4059 <div style="float: right; width: 200px">Magic div</div>
4061 !! end
4063 !! test
4064 Bug 2304: HTML attribute safety (unsafe parameter; 2309)
4065 !! input
4066 {{div style|width: expression(alert(document.cookie))}}
4067 !! result
4068 <div>Magic div</div>
4070 !! end
4072 !! test
4073 Bug 2304: HTML attribute safety (unsafe breakout parameter; 2309)
4074 !! input
4075 {{div style|"><script>alert(document.cookie)</script>}}
4076 !! result
4077 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
4079 !! end
4081 !! test
4082 Bug 2304: HTML attribute safety (unsafe breakout parameter 2; 2309)
4083 !! input
4084 {{div style|" ><script>alert(document.cookie)</script>}}
4085 !! result
4086 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
4088 !! end
4090 !! test
4091 Bug 2304: HTML attribute safety (link)
4092 !! input
4093 <div title="[[Main Page]]"></div>
4094 !! result
4095 <div title="&#91;&#91;Main Page]]"></div>
4097 !! end
4099 !! test
4100 Bug 2304: HTML attribute safety (italics)
4101 !! input
4102 <div title="''foobar''"></div>
4103 !! result
4104 <div title="&#39;&#39;foobar&#39;&#39;"></div>
4106 !! end
4108 !! test
4109 Bug 2304: HTML attribute safety (bold)
4110 !! input
4111 <div title="'''foobar'''"></div>
4112 !! result
4113 <div title="&#39;&#39;&#39;foobar&#39;&#39;&#39;"></div>
4115 !! end
4118 !! test
4119 Bug 2304: HTML attribute safety (ISBN)
4120 !! input
4121 <div title="ISBN 1234567890"></div>
4122 !! result
4123 <div title="&#73;SBN 1234567890"></div>
4125 !! end
4127 !! test
4128 Bug 2304: HTML attribute safety (RFC)
4129 !! input
4130 <div title="RFC 1234"></div>
4131 !! result
4132 <div title="&#82;FC 1234"></div>
4134 !! end
4136 !! test
4137 Bug 2304: HTML attribute safety (PMID)
4138 !! input
4139 <div title="PMID 1234567890"></div>
4140 !! result
4141 <div title="&#80;MID 1234567890"></div>
4143 !! end
4145 !! test
4146 Bug 2304: HTML attribute safety (web link)
4147 !! input
4148 <div title="http://example.com/"></div>
4149 !! result
4150 <div title="http&#58;//example.com/"></div>
4152 !! end
4154 !! test
4155 Bug 2304: HTML attribute safety (named web link)
4156 !! input
4157 <div title="[http://example.com/ link]"></div>
4158 !! result
4159 <div title="&#91;http&#58;//example.com/ link]"></div>
4161 !! end
4163 !! test
4164 Bug 3244: HTML attribute safety (extension; safe)
4165 !! input
4166 <div style="<nowiki>background:blue</nowiki>"></div>
4167 !! result
4168 <div style="background:blue"></div>
4170 !! end
4172 !! test
4173 Bug 3244: HTML attribute safety (extension; unsafe)
4174 !! input
4175 <div style="<nowiki>border-left:expression(alert(document.cookie))</nowiki>"></div>
4176 !! result
4177 <div></div>
4179 !! end
4181 !! test
4182 Math section safety when disabled
4183 !! input
4184 <math><script>alert(document.cookies);</script></math>
4185 !! result
4186 <p>&lt;math&gt;&lt;script&gt;alert(document.cookies);&lt;/script&gt;&lt;/math&gt;
4187 </p>
4188 !! end
4190 # More MSIE fun discovered by Tom Gilder
4192 !! test
4193 MSIE CSS safety test: spurious slash
4194 !! input
4195 <div style="background-image:u\rl(javascript:alert('boo'))">evil</div>
4196 !! result
4197 <div>evil</div>
4199 !! end
4201 !! test
4202 MSIE CSS safety test: hex code
4203 !! input
4204 <div style="background-image:u\72l(javascript:alert('boo'))">evil</div>
4205 !! result
4206 <div>evil</div>
4208 !! end
4210 !! test
4211 MSIE CSS safety test: comment in url
4212 !! input
4213 <div style="background-image:u/**/rl(javascript:alert('boo'))">evil</div>
4214 !! result
4215 <div style="background-image:u rl(javascript:alert(&#39;boo&#39;))">evil</div>
4217 !! end
4219 !! test
4220 MSIE CSS safety test: comment in expression
4221 !! input
4222 <div style="background-image:expres/**/sion(alert('boo4'))">evil4</div>
4223 !! result
4224 <div style="background-image:expres sion(alert(&#39;boo4&#39;))">evil4</div>
4226 !! end
4229 !! test
4230 Table attribute legitimate extension
4231 !! input
4233 !+ style="<nowiki>color:blue</nowiki>"| status
4235 !! result
4236 <table>
4237 <tr>
4238 <th style="color:blue"> status
4239 </th></tr></table>
4241 !!end
4243 !! test
4244 Table attribute safety
4245 !! input
4247 !+ style="<nowiki>border-width:expression(0+alert(document.cookie))</nowiki>"| status
4249 !! result
4250 <table>
4251 <tr>
4252 <th> status
4253 </th></tr></table>
4255 !! end
4258 !! article
4259 Template:Identity
4260 !! text
4261 {{{1}}}
4262 !! endarticle
4264 !! test
4265 Expansion of multi-line templates in attribute values (bug 6255)
4266 !! input
4267 <div style="background: {{identity|#00FF00}}">-</div>
4268 !! result
4269 <div style="background: #00FF00">-</div>
4271 !! end
4274 !! test
4275 Expansion of multi-line templates in attribute values (bug 6255 sanity check)
4276 !! input
4277 <div style="background: 
4278 #00FF00">-</div>
4279 !! result
4280 <div style="background: #00FF00">-</div>
4282 !! end
4284 !! test
4285 Expansion of multi-line templates in attribute values (bug 6255 sanity check 2)
4286 !! input
4287 <div style="background: &#10;#00FF00">-</div>
4288 !! result
4289 <div style="background: &#10;#00FF00">-</div>
4291 !! end
4294 ### Parser hooks (see maintenance/parserTestsParserHook.php for the <tag> extension)
4296 !! test
4297 Parser hook: empty input
4298 !! input
4299 <tag></tag>
4300 !! result
4301 <pre>
4302 string(0) ""
4303 array(0) {
4305 </pre>
4307 !! end
4309 !! test
4310 Parser hook: empty input using terminated empty elements
4311 !! input
4312 <tag/>
4313 !! result
4314 <pre>
4315 NULL
4316 array(0) {
4318 </pre>
4320 !! end
4322 !! test
4323 Parser hook: empty input using terminated empty elements (space before)
4324 !! input
4325 <tag />
4326 !! result
4327 <pre>
4328 NULL
4329 array(0) {
4331 </pre>
4333 !! end
4335 !! test
4336 Parser hook: basic input
4337 !! input
4338 <tag>input</tag>
4339 !! result
4340 <pre>
4341 string(5) "input"
4342 array(0) {
4344 </pre>
4346 !! end
4349 !! test
4350 Parser hook: case insensitive
4351 !! input
4352 <TAG>input</TAG>
4353 !! result
4354 <pre>
4355 string(5) "input"
4356 array(0) {
4358 </pre>
4360 !! end
4363 !! test
4364 Parser hook: case insensitive, redux
4365 !! input
4366 <TaG>input</TAg>
4367 !! result
4368 <pre>
4369 string(5) "input"
4370 array(0) {
4372 </pre>
4374 !! end
4376 !! test
4377 Parser hook: nested tags
4378 !! options
4379 noxml
4380 !! input
4381 <tag><tag></tag></tag>
4382 !! result
4383 <pre>
4384 string(5) "<tag>"
4385 array(0) {
4387 </pre>&lt;/tag&gt;
4389 !! end
4391 !! test
4392 Parser hook: basic arguments
4393 !! input
4394 <tag width=200 height = "100" depth = '50' square></tag>
4395 !! result
4396 <pre>
4397 string(0) ""
4398 array(4) {
4399   ["width"]=>
4400   string(3) "200"
4401   ["height"]=>
4402   string(3) "100"
4403   ["depth"]=>
4404   string(2) "50"
4405   ["square"]=>
4406   string(6) "square"
4408 </pre>
4410 !! end
4412 !! test
4413 Parser hook: argument containing a forward slash (bug 5344)
4414 !! input
4415 <tag filename='/tmp/bla'></tag>
4416 !! result
4417 <pre>
4418 string(0) ""
4419 array(1) {
4420   ["filename"]=>
4421   string(8) "/tmp/bla"
4423 </pre>
4425 !! end
4427 !! test
4428 Parser hook: empty input using terminated empty elements (bug 2374)
4429 !! input
4430 <tag foo=bar/>text
4431 !! result
4432 <pre>
4433 NULL
4434 array(1) {
4435   ["foo"]=>
4436   string(3) "bar"
4438 </pre>text
4440 !! end
4442 # </tag> should be output literally since there is no matching tag that begins it
4443 !! test
4444 Parser hook: basic arguments using terminated empty elements (bug 2374)
4445 !! input
4446 <tag width=200 height = "100" depth = '50' square/>
4447 other stuff
4448 </tag>
4449 !! result
4450 <pre>
4451 NULL
4452 array(4) {
4453   ["width"]=>
4454   string(3) "200"
4455   ["height"]=>
4456   string(3) "100"
4457   ["depth"]=>
4458   string(2) "50"
4459   ["square"]=>
4460   string(6) "square"
4462 </pre>
4463 <p>other stuff
4464 &lt;/tag&gt;
4465 </p>
4466 !! end
4469 ### (see maintenance/parserTestsStaticParserHook.php for the <statictag> extension)
4472 !! test
4473 Parser hook: static parser hook not inside a comment
4474 !! input
4475 <statictag>hello, world</statictag>
4476 <statictag action=flush/>
4477 !! result
4478 <p>hello, world
4479 </p>
4480 !! end
4483 !! test
4484 Parser hook: static parser hook inside a comment
4485 !! input
4486 <!-- <statictag>hello, world</statictag> -->
4487 <statictag action=flush/>
4488 !! result
4489 <p><br />
4490 </p>
4491 !! end
4493 # Nested template calls; this case was broken by Parser.php rev 1.506,
4494 # since reverted.
4496 !! article
4497 Template:One-parameter
4498 !! text
4499 (My parameter is: {{{1}}})
4500 !! endarticle
4502 !! article
4503 Template:Map-one-parameter
4504 !! text
4505 {{{{{1}}}|{{{2}}}}}
4506 !! endarticle
4508 !! test
4509 Nested template calls
4510 !! input
4511 {{Map-one-parameter|One-parameter|param}}
4512 !! result
4513 <p>(My parameter is: param)
4514 </p>
4515 !! end
4519 ### Sanitizer
4521 !! test
4522 Sanitizer: Closing of open tags
4523 !! input
4524 <s></s><table></table>
4525 !! result
4526 <s></s><table></table>
4528 !! end
4530 !! test
4531 Sanitizer: Closing of open but not closed tags
4532 !! input
4533 <s>foo
4534 !! result
4535 <p><s>foo</s>
4536 </p>
4537 !! end
4539 !! test
4540 Sanitizer: Closing of closed but not open tags
4541 !! input
4542 </s>
4543 !! result
4544 <p>&lt;/s&gt;
4545 </p>
4546 !! end
4548 !! test
4549 Sanitizer: Closing of closed but not open table tags
4550 !! input
4551 Table not started</td></tr></table>
4552 !! result
4553 <p>Table not started&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
4554 </p>
4555 !! end
4557 !! test
4558 Sanitizer: Escaping of spaces, multibyte characters, colons & other stuff in id=""
4559 !! input
4560 <span id="æ: v">byte</span>[[#æ: v|backlink]]
4561 !! result
4562 <p><span id=".C3.A6:_v">byte</span><a href="#.C3.A6:_v" title="">backlink</a>
4563 </p>
4564 !! end
4566 !! test
4567 Sanitizer: Validating the contents of the id attribute (bug 4515)
4568 !! options
4569 disabled
4570 !! input
4571 <br id=9 />
4572 !! result
4573 Something, but defenetly not <br id="9" />...
4574 !! end
4576 !! test
4577 Sanitizer: Validating id attribute uniqueness (bug 4515, bug 6301)
4578 !! options
4579 disabled
4580 !! input
4581 <br id="foo" /><br id="foo" />
4582 !! result
4583 Something need to be done. foo-2 ? 
4584 !! end
4586 !! test
4587 Language converter: output gets cut off unexpectedly (bug 5757)
4588 !! options
4589 language=zh
4590 !! input
4591 this bit is safe: }-
4593 but if we add a conversion instance: -{zh-cn:xxx;zh-tw:yyy}-
4595 then we get cut off here: }-
4597 all additional text is vanished
4598 !! result
4599 <p>this bit is safe: }-
4600 </p><p>but if we add a conversion instance: xxx
4601 </p><p>then we get cut off here: }-
4602 </p><p>all additional text is vanished
4603 </p>
4604 !! end
4606 !! test
4607 Self closed html pairs (bug 5487)
4608 !! options
4609 !! input
4610 <center><font id="bug" />Centered text</center>
4611 <div><font id="bug2" />In div text</div>
4612 !! result
4613 <center>&lt;font id="bug" /&gt;Centered text</center>
4614 <div>&lt;font id="bug2" /&gt;In div text</div>
4616 !! end
4622 !! test
4623 Punctuation: nbsp before exclamation
4624 !! input
4625 C'est grave !
4626 !! result
4627 <p>C'est grave&nbsp;!
4628 </p>
4629 !! end
4631 !! test
4632 Punctuation: CSS !important (bug 11874)
4633 !! input
4634 <div style="width:50% !important">important</div>
4635 !! result
4636 <div style="width:50% !important">important</div>
4638 !!end
4640 !! test
4641 Punctuation: CSS ! important (bug 11874; with space after)
4642 !! input
4643 <div style="width:50% ! important">important</div>
4644 !! result
4645 <div style="width:50% ! important">important</div>
4647 !!end
4650 !! test
4651 HTML bullet list, closed tags (bug 5497)
4652 !! input
4653 <ul>
4654 <li>One</li>
4655 <li>Two</li>
4656 </ul>
4657 !! result
4658 <ul>
4659 <li>One</li>
4660 <li>Two</li>
4661 </ul>
4663 !! end
4665 !! test
4666 HTML bullet list, unclosed tags (bug 5497)
4667 !! input
4668 <ul>
4669 <li>One
4670 <li>Two
4671 </ul>
4672 !! result
4673 <ul>
4674 <li>One
4675 </li><li>Two
4676 </li></ul>
4678 !! end
4680 !! test
4681 HTML ordered list, closed tags (bug 5497)
4682 !! input
4683 <ol>
4684 <li>One</li>
4685 <li>Two</li>
4686 </ol>
4687 !! result
4688 <ol>
4689 <li>One</li>
4690 <li>Two</li>
4691 </ol>
4693 !! end
4695 !! test
4696 HTML ordered list, unclosed tags (bug 5497)
4697 !! input
4698 <ol>
4699 <li>One
4700 <li>Two
4701 </ol>
4702 !! result
4703 <ol>
4704 <li>One
4705 </li><li>Two
4706 </li></ol>
4708 !! end
4710 !! test
4711 HTML nested bullet list, closed tags (bug 5497)
4712 !! input
4713 <ul>
4714 <li>One</li>
4715 <li>Two:
4716 <ul>
4717 <li>Sub-one</li>
4718 <li>Sub-two</li>
4719 </ul>
4720 </li>
4721 </ul>
4722 !! result
4723 <ul>
4724 <li>One</li>
4725 <li>Two:
4726 <ul>
4727 <li>Sub-one</li>
4728 <li>Sub-two</li>
4729 </ul>
4730 </li>
4731 </ul>
4733 !! end
4735 !! test
4736 HTML nested bullet list, open tags (bug 5497)
4737 !! input
4738 <ul>
4739 <li>One
4740 <li>Two:
4741 <ul>
4742 <li>Sub-one
4743 <li>Sub-two
4744 </ul>
4745 </ul>
4746 !! result
4747 <ul>
4748 <li>One
4749 </li><li>Two:
4750 <ul>
4751 <li>Sub-one
4752 </li><li>Sub-two
4753 </li></ul>
4754 </li></ul>
4756 !! end
4758 !! test
4759 HTML nested ordered list, closed tags (bug 5497)
4760 !! input
4761 <ol>
4762 <li>One</li>
4763 <li>Two:
4764 <ol>
4765 <li>Sub-one</li>
4766 <li>Sub-two</li>
4767 </ol>
4768 </li>
4769 </ol>
4770 !! result
4771 <ol>
4772 <li>One</li>
4773 <li>Two:
4774 <ol>
4775 <li>Sub-one</li>
4776 <li>Sub-two</li>
4777 </ol>
4778 </li>
4779 </ol>
4781 !! end
4783 !! test
4784 HTML nested ordered list, open tags (bug 5497)
4785 !! input
4786 <ol>
4787 <li>One
4788 <li>Two:
4789 <ol>
4790 <li>Sub-one
4791 <li>Sub-two
4792 </ol>
4793 </ol>
4794 !! result
4795 <ol>
4796 <li>One
4797 </li><li>Two:
4798 <ol>
4799 <li>Sub-one
4800 </li><li>Sub-two
4801 </li></ol>
4802 </li></ol>
4804 !! end
4806 !! test
4807 HTML ordered list item with parameters oddity
4808 !! input
4809 <ol><li id="fragment">One</li></ol>
4810 !! result
4811 <ol><li id="fragment">One</li></ol>
4813 !! end
4815 !!test
4816 bug 5918: autonumbering
4817 !! input
4818 [http://first/] [http://second] [ftp://ftp]
4820 ftp://inlineftp
4822 [mailto:enclosed@mail.tld With target]
4824 [mailto:enclosed@mail.tld]
4826 mailto:inline@mail.tld
4827 !! result
4828 <p><a href="http://first/" class="external autonumber" title="http://first/" rel="nofollow">[1]</a> <a href="http://second" class="external autonumber" title="http://second" rel="nofollow">[2]</a> <a href="ftp://ftp" class="external autonumber" title="ftp://ftp" rel="nofollow">[3]</a>
4829 </p><p><a href="ftp://inlineftp" class="external free" title="ftp://inlineftp" rel="nofollow">ftp://inlineftp</a>
4830 </p><p><a href="mailto:enclosed@mail.tld" class="external text" title="mailto:enclosed@mail.tld" rel="nofollow">With target</a>
4831 </p><p><a href="mailto:enclosed@mail.tld" class="external autonumber" title="mailto:enclosed@mail.tld" rel="nofollow">[4]</a>
4832 </p><p><a href="mailto:inline@mail.tld" class="external free" title="mailto:inline@mail.tld" rel="nofollow">mailto:inline@mail.tld</a>
4833 </p>
4834 !! end
4838 # Security and HTML correctness
4839 # From Nick Jenkins' fuzz testing
4842 !! test
4843 Fuzz testing: Parser13
4844 !! input
4845 {| 
4846 | http://a|
4847 !! result
4848 <table>
4849 <tr>
4850 <td>
4851 </td>
4852 </tr>
4853 </table>
4855 !! end
4857 !! test
4858 Fuzz testing: Parser14
4859 !! input
4860 == onmouseover= ==
4861 http://__TOC__
4862 !! result
4863 <a name="onmouseover.3D"></a><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"> onmouseover= </span></h2>
4864 http://<table id="toc" class="toc" summary="Contents"><tr><td><div id="toctitle"><h2>Contents</h2></div>
4865 <ul>
4866 <li class="toclevel-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
4867 </ul>
4868 </td></tr></table><script type="text/javascript"> if (window.showTocToggle) { var tocShowText = "show"; var tocHideText = "hide"; showTocToggle(); } </script>
4870 !! end
4872 !! test
4873 Fuzz testing: Parser14-table
4874 !! input
4875 ==a==
4876 {| STYLE=__TOC__
4877 !! result
4878 <a name="a"></a><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">a</span></h2>
4879 <table style="&#95;_TOC&#95;_">
4880 <tr><td></td></tr>
4881 </table>
4883 !! end
4885 # Known to produce bogus xml (extra </td>)
4886 !! test
4887 Fuzz testing: Parser16
4888 !! options
4889 noxml
4890 !! input
4892 !https://||||||
4893 !! result
4894 <table>
4895 <tr>
4896 <th>https://</th><th></th><th></th><th>
4897 </td>
4898 </tr>
4899 </table>
4901 !! end
4903 !! test
4904 Fuzz testing: Parser21
4905 !! input
4907 ! irc://{{ftp://a" onmouseover="alert('hello world');"
4909 !! result
4910 <table>
4911 <tr>
4912 <th> <a href="irc://{{ftp://a" class="external free" title="irc://{{ftp://a" rel="nofollow">irc://{{ftp://a</a>" onmouseover="alert('hello world');"
4913 </th><td>
4914 </td>
4915 </tr>
4916 </table>
4918 !! end
4920 !! test
4921 Fuzz testing: Parser22
4922 !! input
4923 http://===r:::https://b
4926 !!result
4927 <p><a href="http://===r:::https://b" class="external free" title="http://===r:::https://b" rel="nofollow">http://===r:::https://b</a>
4928 </p>
4929 <table>
4930 <tr><td></td></tr>
4931 </table>
4933 !! end
4935 # Known to produce bad XML for now
4936 !! test
4937 Fuzz testing: Parser24
4938 !! options
4939 noxml
4940 !! input
4942 {{{|
4943 <u CLASS=
4944 | {{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx--><noinclude>}}}} >
4945 <br style="onmouseover='alert(document.cookie);' " />
4947 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
4949 !! result
4950 <table>
4951 {{{|
4952 <u class="&#124;">}}}} &gt;
4953 <br style="onmouseover=&#39;alert(document.cookie);&#39;" />
4955 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
4956 <tr>
4957 <td></u>
4958 </td>
4959 </tr>
4960 </table>
4962 !! end
4964 # Note: the current result listed for this is not what the original one was,
4965 # but the original bug was JavaScript injection, which is fixed in any case.
4966 # It's not clear that the original result listed was any more correct than the
4967 # current one.  Original result:
4968 # <p>{{{| 
4969 # </p>
4970 # <li class="&#124;&#124;">
4971 # }}}blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
4972 !!test
4973 Fuzz testing: Parser25 (bug 6055)
4974 !! input
4977 <LI CLASS=||
4979 }}}blah" onmouseover="alert('hello world');" align="left"'''MOVE MOUSE CURSOR OVER HERE
4980 !! result
4981 <p>&lt;LI CLASS=blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
4982 </p>
4983 !! end
4985 !!test
4986 Fuzz testing: URL adjacent extension (with space, clean)
4987 !! options
4988 !! input
4989 http://example.com <nowiki>junk</nowiki>
4990 !! result
4991 <p><a href="http://example.com" class="external free" title="http://example.com" rel="nofollow">http://example.com</a> junk
4992 </p>
4993 !!end
4995 !!test
4996 Fuzz testing: URL adjacent extension (no space, dirty; nowiki)
4997 !! options
4998 !! input
4999 http://example.com<nowiki>junk</nowiki>
5000 !! result
5001 <p><a href="http://example.com" class="external free" title="http://example.com" rel="nofollow">http://example.com</a>junk
5002 </p>
5003 !!end
5005 !!test
5006 Fuzz testing: URL adjacent extension (no space, dirty; pre)
5007 !! options
5008 !! input
5009 http://example.com<pre>junk</pre>
5010 !! result
5011 <a href="http://example.com" class="external free" title="http://example.com" rel="nofollow">http://example.com</a><pre>junk</pre>
5013 !!end
5015 !!test
5016 Fuzz testing: image with bogus manual thumbnail
5017 !!input
5018 [[Image:foobar.jpg|thumbnail= ]]
5019 !!result
5020 <div class="thumb tright"><div class="thumbinner" style="width:1943px;">Error creating thumbnail:   <div class="thumbcaption"></div></div></div>
5022 !!end
5024 !! test
5025 Fuzz testing: encoded newline in generated HTML replacements (bug 6577)
5026 !! input
5027 <pre dir="&#10;"></pre>
5028 !! result
5029 <pre dir="&#10;"></pre>
5031 !! end
5033 !! test
5034 Parsing optional HTML elements (Bug 6171)
5035 !! options
5036 !! input
5037 <table>
5038   <tr>
5039     <td> Some tabular data</td>
5040     <td> More tabular data ...
5041     <td> And yet som tabular data</td>
5042   </tr>
5043 </table>
5044 !! result
5045 <table>
5046   <tr>
5047     <td> Some tabular data</td>
5048     <td> More tabular data ...
5049     </td><td> And yet som tabular data</td>
5050   </tr>
5051 </table>
5053 !! end
5055 !! test
5056 Correct handling of <td>, <tr> (Bug 6171)
5057 !! options
5058 !! input
5059 <table>
5060   <tr>
5061     <td> Some tabular data</td>
5062     <td> More tabular data ...</td>
5063     <td> And yet som tabular data</td>
5064   </tr>
5065 </table>
5066 !! result
5067 <table>
5068   <tr>
5069     <td> Some tabular data</td>
5070     <td> More tabular data ...</td>
5071     <td> And yet som tabular data</td>
5072   </tr>
5073 </table>
5075 !! end
5078 !! test
5079 Parsing crashing regression (fr:JavaScript)
5080 !! input
5081 </body></x>
5082 !! result
5083 <p>&lt;/body&gt;&lt;/x&gt;
5084 </p>
5085 !! end
5087 !! test
5088 Inline wiki vs wiki block nesting
5089 !! input
5090 '''Bold paragraph
5092 New wiki paragraph
5093 !! result
5094 <p><b>Bold paragraph</b>
5095 </p><p>New wiki paragraph
5096 </p>
5097 !! end
5099 !! test
5100 Inline HTML vs wiki block nesting
5101 !! input
5102 <b>Bold paragraph
5104 New wiki paragraph
5105 !! result
5106 <p><b>Bold paragraph</b>
5107 </p><p>New wiki paragraph
5108 </p>
5109 !! end
5111 # Original result was this:
5112 # <p><b>bold</b><b>bold<i>bolditalics</i></b>
5113 # </p>
5114 # While that might be marginally more intuitive, maybe, the six-apostrophe
5115 # construct is clearly pathological and the result stated here (which is what
5116 # the parser actually does) is about as reasonable as anything.
5117 !!test
5118 Mixing markup for italics and bold
5119 !! options
5120 !! input
5121 '''bold''''''bold''bolditalics'''''
5122 !! result
5123 <p>'<i>bold'</i><b>bold<i>bolditalics</i></b>
5124 </p>
5125 !! end
5128 !! article
5129 Xyzzyx
5130 !! text
5131 Article for special page transclusion test
5132 !! endarticle
5134 !! test
5135 Special page transclusion
5136 !! options
5137 !! input
5138 {{Special:Prefixindex/Xyzzyx}}
5139 !! result
5140 <p><br />
5141 </p>
5142 <table style="background: inherit;" border="0" width="100%"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
5144 !! end
5146 !! test
5147 Special page transclusion twice (bug 5021)
5148 !! options
5149 !! input
5150 {{Special:Prefixindex/Xyzzyx}}
5151 {{Special:Prefixindex/Xyzzyx}}
5152 !! result
5153 <p><br />
5154 </p>
5155 <table style="background: inherit;" border="0" width="100%"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
5156 <p><br />
5157 </p>
5158 <table style="background: inherit;" border="0" width="100%"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
5160 !! end
5162 !! test
5163 Transclusion of default MediaWiki message
5164 !! input
5165 {{MediaWiki:Mainpage}}
5166 !!result
5167 <p>Main Page
5168 </p>
5169 !! end
5171 !! test
5172 Transclusion of nonexistent MediaWiki message
5173 !! input
5174 {{MediaWiki:Mainpagexxx}}
5175 !!result
5176 <p><a href="/index.php?title=MediaWiki:Mainpagexxx&amp;action=edit&amp;redlink=1" class="new" title="MediaWiki:Mainpagexxx (not yet written)">MediaWiki:Mainpagexxx</a>
5177 </p>
5178 !! end
5180 !! test
5181 Transclusion of MediaWiki message with underscore
5182 !! input
5183 {{MediaWiki:history_short}}
5184 !! result
5185 <p>History
5186 </p>
5187 !! end
5189 !! test
5190 Transclusion of MediaWiki message with space
5191 !! input
5192 {{MediaWiki:history short}}
5193 !! result
5194 <p>History
5195 </p>
5196 !! end
5198 !! test
5199 Invalid header with following text
5200 !! input
5201 = x = y
5202 !! result
5203 <p>= x = y
5204 </p>
5205 !! end
5208 !! test
5209 Section extraction test (section 0)
5210 !! options
5211 section=0
5212 !! input
5213 start
5214 ==a==
5215 ===aa===
5216 ====aaa====
5217 ==b==
5218 ===ba===
5219 ===bb===
5220 ====bba====
5221 ===bc===
5222 ==c==
5223 ===ca===
5224 !! result
5225 start
5226 !! end
5228 !! test
5229 Section extraction test (section 1)
5230 !! options
5231 section=1
5232 !! input
5233 start
5234 ==a==
5235 ===aa===
5236 ====aaa====
5237 ==b==
5238 ===ba===
5239 ===bb===
5240 ====bba====
5241 ===bc===
5242 ==c==
5243 ===ca===
5244 !! result
5245 ==a==
5246 ===aa===
5247 ====aaa====
5248 !! end
5250 !! test
5251 Section extraction test (section 2)
5252 !! options
5253 section=2
5254 !! input
5255 start
5256 ==a==
5257 ===aa===
5258 ====aaa====
5259 ==b==
5260 ===ba===
5261 ===bb===
5262 ====bba====
5263 ===bc===
5264 ==c==
5265 ===ca===
5266 !! result
5267 ===aa===
5268 ====aaa====
5269 !! end
5271 !! test
5272 Section extraction test (section 3)
5273 !! options
5274 section=3
5275 !! input
5276 start
5277 ==a==
5278 ===aa===
5279 ====aaa====
5280 ==b==
5281 ===ba===
5282 ===bb===
5283 ====bba====
5284 ===bc===
5285 ==c==
5286 ===ca===
5287 !! result
5288 ====aaa====
5289 !! end
5291 !! test
5292 Section extraction test (section 4)
5293 !! options
5294 section=4
5295 !! input
5296 start
5297 ==a==
5298 ===aa===
5299 ====aaa====
5300 ==b==
5301 ===ba===
5302 ===bb===
5303 ====bba====
5304 ===bc===
5305 ==c==
5306 ===ca===
5307 !! result
5308 ==b==
5309 ===ba===
5310 ===bb===
5311 ====bba====
5312 ===bc===
5313 !! end
5315 !! test
5316 Section extraction test (section 5)
5317 !! options
5318 section=5
5319 !! input
5320 start
5321 ==a==
5322 ===aa===
5323 ====aaa====
5324 ==b==
5325 ===ba===
5326 ===bb===
5327 ====bba====
5328 ===bc===
5329 ==c==
5330 ===ca===
5331 !! result
5332 ===ba===
5333 !! end
5335 !! test
5336 Section extraction test (section 6)
5337 !! options
5338 section=6
5339 !! input
5340 start
5341 ==a==
5342 ===aa===
5343 ====aaa====
5344 ==b==
5345 ===ba===
5346 ===bb===
5347 ====bba====
5348 ===bc===
5349 ==c==
5350 ===ca===
5351 !! result
5352 ===bb===
5353 ====bba====
5354 !! end
5356 !! test
5357 Section extraction test (section 7)
5358 !! options
5359 section=7
5360 !! input
5361 start
5362 ==a==
5363 ===aa===
5364 ====aaa====
5365 ==b==
5366 ===ba===
5367 ===bb===
5368 ====bba====
5369 ===bc===
5370 ==c==
5371 ===ca===
5372 !! result
5373 ====bba====
5374 !! end
5376 !! test
5377 Section extraction test (section 8)
5378 !! options
5379 section=8
5380 !! input
5381 start
5382 ==a==
5383 ===aa===
5384 ====aaa====
5385 ==b==
5386 ===ba===
5387 ===bb===
5388 ====bba====
5389 ===bc===
5390 ==c==
5391 ===ca===
5392 !! result
5393 ===bc===
5394 !! end
5396 !! test
5397 Section extraction test (section 9)
5398 !! options
5399 section=9
5400 !! input
5401 start
5402 ==a==
5403 ===aa===
5404 ====aaa====
5405 ==b==
5406 ===ba===
5407 ===bb===
5408 ====bba====
5409 ===bc===
5410 ==c==
5411 ===ca===
5412 !! result
5413 ==c==
5414 ===ca===
5415 !! end
5417 !! test
5418 Section extraction test (section 10)
5419 !! options
5420 section=10
5421 !! input
5422 start
5423 ==a==
5424 ===aa===
5425 ====aaa====
5426 ==b==
5427 ===ba===
5428 ===bb===
5429 ====bba====
5430 ===bc===
5431 ==c==
5432 ===ca===
5433 !! result
5434 ===ca===
5435 !! end
5437 !! test
5438 Section extraction test (nonexistent section 11)
5439 !! options
5440 section=11
5441 !! input
5442 start
5443 ==a==
5444 ===aa===
5445 ====aaa====
5446 ==b==
5447 ===ba===
5448 ===bb===
5449 ====bba====
5450 ===bc===
5451 ==c==
5452 ===ca===
5453 !! result
5454 !! end
5456 !! test
5457 Section extraction test with bogus heading (section 1)
5458 !! options
5459 section=1
5460 !! input
5461 ==a==
5462 ==bogus== not a legal section
5463 ==b==
5464 !! result
5465 ==a==
5466 ==bogus== not a legal section
5467 !! end
5469 !! test
5470 Section extraction test with bogus heading (section 2)
5471 !! options
5472 section=2
5473 !! input
5474 ==a==
5475 ==bogus== not a legal section
5476 ==b==
5477 !! result
5478 ==b==
5479 !! end
5481 !! test
5482 Section extraction test with comment after heading (section 1)
5483 !! options
5484 section=1
5485 !! input
5486 ==a==
5487 ==b== <!-- -->
5488 ==c==
5489 !! result
5490 ==a==
5491 !! end
5493 !! test
5494 Section extraction test with comment after heading (section 2)
5495 !! options
5496 section=2
5497 !! input
5498 ==a==
5499 ==b== <!-- -->
5500 ==c==
5501 !! result
5502 ==b== <!-- -->
5503 !! end
5505 !! test
5506 Section extraction test with bogus <nowiki> heading (section 1)
5507 !! options
5508 section=1
5509 !! input
5510 ==a==
5511 ==bogus== <nowiki>not a legal section</nowiki>
5512 ==b==
5513 !! result
5514 ==a==
5515 ==bogus== <nowiki>not a legal section</nowiki>
5516 !! end
5518 !! test
5519 Section extraction test with bogus <nowiki> heading (section 2)
5520 !! options
5521 section=2
5522 !! input
5523 ==a==
5524 ==bogus== <nowiki>not a legal section</nowiki>
5525 ==b==
5526 !! result
5527 ==b==
5528 !! end
5531 # Formerly testing for bug 2587, now resolved by the use of unmarked sections 
5532 # instead of respecting commented sections
5533 !! test
5534 Section extraction prefixed by comment (section 1)
5535 !! options
5536 section=1
5537 !! input
5538 <!-- -->==sec1==
5539 ==sec2==
5540 !!result
5541 ==sec2==
5542 !!end
5544 !! test
5545 Section extraction prefixed by comment (section 2)
5546 !! options
5547 section=2
5548 !! input
5549 <!-- -->==sec1==
5550 ==sec2==
5551 !!result
5553 !!end
5556 # Formerly testing for bug 2607, now resolved by the use of unmarked sections 
5557 # instead of respecting HTML-style headings
5558 !! test
5559 Section extraction, mixed wiki and html (section 1)
5560 !! options
5561 section=1
5562 !! input
5563 <h2>unmarked</h2>
5564 unmarked
5565 ==1==
5567 ==2==
5569 !! result
5570 ==1==
5572 !! end
5574 !! test
5575 Section extraction, mixed wiki and html (section 2)
5576 !! options
5577 section=2
5578 !! input
5579 <h2>unmarked</h2>
5580 unmarked
5581 ==1==
5583 ==2==
5585 !! result
5586 ==2==
5588 !! end
5591 # Formerly testing for bug 3342
5592 !! test
5593 Section extraction, heading surrounded by <noinclude>
5594 !! options
5595 section=1
5596 !! input
5597 <noinclude>==unmarked==</noinclude>
5598 ==marked==
5599 !! result
5600 ==marked==
5601 !!end
5604 !! test
5605 Section replacement test (section 0)
5606 !! options
5607 replace=0,"xxx"
5608 !! input
5609 start
5610 ==a==
5611 ===aa===
5612 ====aaa====
5613 ==b==
5614 ===ba===
5615 ===bb===
5616 ====bba====
5617 ===bc===
5618 ==c==
5619 ===ca===
5620 !! result
5623 ==a==
5624 ===aa===
5625 ====aaa====
5626 ==b==
5627 ===ba===
5628 ===bb===
5629 ====bba====
5630 ===bc===
5631 ==c==
5632 ===ca===
5633 !! end
5635 !! test
5636 Section replacement test (section 1)
5637 !! options
5638 replace=1,"xxx"
5639 !! input
5640 start
5641 ==a==
5642 ===aa===
5643 ====aaa====
5644 ==b==
5645 ===ba===
5646 ===bb===
5647 ====bba====
5648 ===bc===
5649 ==c==
5650 ===ca===
5651 !! result
5652 start
5655 ==b==
5656 ===ba===
5657 ===bb===
5658 ====bba====
5659 ===bc===
5660 ==c==
5661 ===ca===
5662 !! end
5664 !! test
5665 Section replacement test (section 2)
5666 !! options
5667 replace=2,"xxx"
5668 !! input
5669 start
5670 ==a==
5671 ===aa===
5672 ====aaa====
5673 ==b==
5674 ===ba===
5675 ===bb===
5676 ====bba====
5677 ===bc===
5678 ==c==
5679 ===ca===
5680 !! result
5681 start
5682 ==a==
5685 ==b==
5686 ===ba===
5687 ===bb===
5688 ====bba====
5689 ===bc===
5690 ==c==
5691 ===ca===
5692 !! end
5694 !! test
5695 Section replacement test (section 3)
5696 !! options
5697 replace=3,"xxx"
5698 !! input
5699 start
5700 ==a==
5701 ===aa===
5702 ====aaa====
5703 ==b==
5704 ===ba===
5705 ===bb===
5706 ====bba====
5707 ===bc===
5708 ==c==
5709 ===ca===
5710 !! result
5711 start
5712 ==a==
5713 ===aa===
5716 ==b==
5717 ===ba===
5718 ===bb===
5719 ====bba====
5720 ===bc===
5721 ==c==
5722 ===ca===
5723 !! end
5725 !! test
5726 Section replacement test (section 4)
5727 !! options
5728 replace=4,"xxx"
5729 !! input
5730 start
5731 ==a==
5732 ===aa===
5733 ====aaa====
5734 ==b==
5735 ===ba===
5736 ===bb===
5737 ====bba====
5738 ===bc===
5739 ==c==
5740 ===ca===
5741 !! result
5742 start
5743 ==a==
5744 ===aa===
5745 ====aaa====
5748 ==c==
5749 ===ca===
5750 !! end
5752 !! test
5753 Section replacement test (section 5)
5754 !! options
5755 replace=5,"xxx"
5756 !! input
5757 start
5758 ==a==
5759 ===aa===
5760 ====aaa====
5761 ==b==
5762 ===ba===
5763 ===bb===
5764 ====bba====
5765 ===bc===
5766 ==c==
5767 ===ca===
5768 !! result
5769 start
5770 ==a==
5771 ===aa===
5772 ====aaa====
5773 ==b==
5776 ===bb===
5777 ====bba====
5778 ===bc===
5779 ==c==
5780 ===ca===
5781 !! end
5783 !! test
5784 Section replacement test (section 6)
5785 !! options
5786 replace=6,"xxx"
5787 !! input
5788 start
5789 ==a==
5790 ===aa===
5791 ====aaa====
5792 ==b==
5793 ===ba===
5794 ===bb===
5795 ====bba====
5796 ===bc===
5797 ==c==
5798 ===ca===
5799 !! result
5800 start
5801 ==a==
5802 ===aa===
5803 ====aaa====
5804 ==b==
5805 ===ba===
5808 ===bc===
5809 ==c==
5810 ===ca===
5811 !! end
5813 !! test
5814 Section replacement test (section 7)
5815 !! options
5816 replace=7,"xxx"
5817 !! input
5818 start
5819 ==a==
5820 ===aa===
5821 ====aaa====
5822 ==b==
5823 ===ba===
5824 ===bb===
5825 ====bba====
5826 ===bc===
5827 ==c==
5828 ===ca===
5829 !! result
5830 start
5831 ==a==
5832 ===aa===
5833 ====aaa====
5834 ==b==
5835 ===ba===
5836 ===bb===
5839 ===bc===
5840 ==c==
5841 ===ca===
5842 !! end
5844 !! test
5845 Section replacement test (section 8)
5846 !! options
5847 replace=8,"xxx"
5848 !! input
5849 start
5850 ==a==
5851 ===aa===
5852 ====aaa====
5853 ==b==
5854 ===ba===
5855 ===bb===
5856 ====bba====
5857 ===bc===
5858 ==c==
5859 ===ca===
5860 !! result
5861 start
5862 ==a==
5863 ===aa===
5864 ====aaa====
5865 ==b==
5866 ===ba===
5867 ===bb===
5868 ====bba====
5871 ==c==
5872 ===ca===
5873 !!end
5875 !! test
5876 Section replacement test (section 9)
5877 !! options
5878 replace=9,"xxx"
5879 !! input
5880 start
5881 ==a==
5882 ===aa===
5883 ====aaa====
5884 ==b==
5885 ===ba===
5886 ===bb===
5887 ====bba====
5888 ===bc===
5889 ==c==
5890 ===ca===
5891 !! result
5892 start
5893 ==a==
5894 ===aa===
5895 ====aaa====
5896 ==b==
5897 ===ba===
5898 ===bb===
5899 ====bba====
5900 ===bc===
5902 !! end
5904 !! test
5905 Section replacement test (section 10)
5906 !! options
5907 replace=10,"xxx"
5908 !! input
5909 start
5910 ==a==
5911 ===aa===
5912 ====aaa====
5913 ==b==
5914 ===ba===
5915 ===bb===
5916 ====bba====
5917 ===bc===
5918 ==c==
5919 ===ca===
5920 !! result
5921 start
5922 ==a==
5923 ===aa===
5924 ====aaa====
5925 ==b==
5926 ===ba===
5927 ===bb===
5928 ====bba====
5929 ===bc===
5930 ==c==
5932 !! end
5934 !! test
5935 Section replacement test with initial whitespace (bug 13728)
5936 !! options
5937 replace=2,"xxx"
5938 !! input
5939  Preformatted initial line
5940 ==a==
5941 ===a===
5942 !! result
5943  Preformatted initial line
5944 ==a==
5946 !! end
5949 !! test
5950 Section extraction, heading followed by pre with 20 spaces (bug 6398)
5951 !! options
5952 section=1
5953 !! input
5954 ==a==
5955                     a
5956 !! result
5957 ==a==
5958                     a
5959 !! end
5961 !! test
5962 Section extraction, heading followed by pre with 19 spaces (bug 6398 sanity check)
5963 !! options
5964 section=1
5965 !! input
5966 ==a==
5967                    a
5968 !! result
5969 ==a==
5970                    a
5971 !! end
5974 !! test
5975 Section extraction, <pre> around bogus header (bug 10309)
5976 !! options
5977 noxml section=2
5978 !! input
5979 == Section One ==
5980 <pre>
5981 =======
5982 </pre>
5984 == Section Two ==
5985 stuff
5986 !! result
5987 == Section Two ==
5988 stuff
5989 !! end
5991 !! test
5992 Section replacement, <pre> around bogus header (bug 10309)
5993 !! options
5994 noxml replace=2,"xxx"
5995 !! input
5996 == Section One ==
5997 <pre>
5998 =======
5999 </pre>
6001 == Section Two ==
6002 stuff
6003 !! result
6004 == Section One ==
6005 <pre>
6006 =======
6007 </pre>
6010 !! end
6014 !! test
6015 Handling of &#x0A; in URLs
6016 !! input
6017 **irc://&#x0A;a
6018 !! result
6019 <ul><li><ul><li><a href="irc://%0Aa" class="external free" title="irc://%0Aa" rel="nofollow">irc://%0Aa</a>
6020 </li></ul>
6021 </li></ul>
6023 !!end
6025 !! test
6026 5 quotes, code coverage +1 line
6027 !! input
6028 '''''
6029 !! result
6030 !! end
6032 !! test
6033 Special:Search page linking.
6034 !! input
6035 {{Special:search}}
6036 !! result
6037 <p><a href="/wiki/Special:Search" title="Special:Search">Special:Search</a>
6038 </p>
6039 !! end
6041 !! test
6042 Say the magic word
6043 !! input
6044 * {{PAGENAME}}
6045 * {{BASEPAGENAME}}
6046 * {{SUBPAGENAME}}
6047 * {{SUBPAGENAMEE}}
6048 * {{BASEPAGENAME}}
6049 * {{BASEPAGENAMEE}}
6050 * {{TALKPAGENAME}}
6051 * {{TALKPAGENAMEE}}
6052 * {{SUBJECTPAGENAME}}
6053 * {{SUBJECTPAGENAMEE}}
6054 * {{NAMESPACEE}}
6055 * {{NAMESPACE}}
6056 * {{TALKSPACE}}
6057 * {{TALKSPACEE}}
6058 * {{SUBJECTSPACE}}
6059 * {{SUBJECTSPACEE}}
6060 * {{Dynamic|{{NUMBEROFUSERS}}|{{NUMBEROFPAGES}}|{{CURRENTVERSION}}|{{CONTENTLANGUAGE}}|{{DIRECTIONMARK}}|{{CURRENTTIMESTAMP}}|{{NUMBEROFARTICLES}}}}
6061 !! result
6062 <ul><li> Parser test
6063 </li><li> Parser test
6064 </li><li> Parser test
6065 </li><li> Parser_test
6066 </li><li> Parser test
6067 </li><li> Parser_test
6068 </li><li> Talk:Parser test
6069 </li><li> Talk:Parser_test
6070 </li><li> Parser test
6071 </li><li> Parser_test
6072 </li><li> 
6073 </li><li> 
6074 </li><li> Talk
6075 </li><li> Talk
6076 </li><li> 
6077 </li><li> 
6078 </li><li> <a href="/index.php?title=Template:Dynamic&amp;action=edit&amp;redlink=1" class="new" title="Template:Dynamic (not yet written)">Template:Dynamic</a>
6079 </li></ul>
6081 !! end
6082 ### Note: Above tests excludes the "{{NUMBEROFADMINS}}" magic word because it generates a MySQL error when included.
6084 !! test
6085 Gallery
6086 !! input
6087 <gallery>
6088 image1.png |
6089 image2.gif|||||
6091 image3|
6092 image4    |300px| centre
6093  image5.svg| http://///////
6094 [[x|xx]]]]
6095 * image6
6096 </gallery>
6097 !! result
6098 <table class="gallery" cellspacing="0" cellpadding="0">
6099         <tr>
6100                 <td><div class="gallerybox" style="width: 155px;">
6101                         <div style="height: 152px;">Image1.png</div>
6102                         <div class="gallerytext">
6103                         </div>
6104                 </div></td>
6105                 <td><div class="gallerybox" style="width: 155px;">
6106                         <div style="height: 152px;">Image2.gif</div>
6107                         <div class="gallerytext">
6108 <p>||||
6109 </p>
6110                         </div>
6111                 </div></td>
6112                 <td><div class="gallerybox" style="width: 155px;">
6113                         <div style="height: 152px;">Image3</div>
6114                         <div class="gallerytext">
6115                         </div>
6116                 </div></td>
6117                 <td><div class="gallerybox" style="width: 155px;">
6118                         <div style="height: 152px;">Image4</div>
6119                         <div class="gallerytext">
6120 <p>300px| centre
6121 </p>
6122                         </div>
6123                 </div></td>
6124         </tr>
6125         <tr>
6126                 <td><div class="gallerybox" style="width: 155px;">
6127                         <div style="height: 152px;">Image5.svg</div>
6128                         <div class="gallerytext">
6129 <p><a href="http://///////" class="external free" title="http://///////" rel="nofollow">http://///////</a>
6130 </p>
6131                         </div>
6132                 </div></td>
6133                 <td><div class="gallerybox" style="width: 155px;">
6134                         <div style="height: 152px;">* image6</div>
6135                         <div class="gallerytext">
6136                         </div>
6137                 </div></td>
6138         </tr>
6139 </table>
6141 !! end
6143 !! test
6144 HTML Hex character encoding (spells the word "JavaScript")
6145 !! input
6146 &#x4A;&#x061;&#x0076;&#x00061;&#x000053;&#x0000063;&#114;&#x0000069;&#00000112;&#x0000000074;
6147 !! result
6148 <p>&#x4a;&#x61;&#x76;&#x61;&#x53;&#x63;&#114;&#x69;&#112;&#x74;
6149 </p>
6150 !! end
6152 !! test
6153 __FORCETOC__ override
6154 !! input 
6155 __NEWSECTIONLINK__
6156 __FORCETOC__
6157 !! result
6158 <p><br />
6159 </p>
6160 !! end
6162 !! test
6163 ISBN code coverage
6164 !! input
6165 ISBN  978-0-1234-56&#x20;789
6166 !! result
6167 <p><a href="/wiki/Special:BookSources/9780123456" class="internal">ISBN 978-0-1234-56</a>&#x20;789
6168 </p>
6169 !! end
6171 !! test
6172 ISBN followed by 5 spaces
6173 !! input
6174 ISBN    
6175 !! result
6176 <p>ISBN    
6177 </p>
6178 !! end
6180 !! test
6181 Double ISBN
6182 !! input
6183 ISBN ISBN 1234567890
6184 !! result
6185 <p>ISBN <a href="/wiki/Special:BookSources/1234567890" class="internal">ISBN 1234567890</a>
6186 </p>
6187 !! end
6189 !! test
6190 Double RFC
6191 !! input
6192 RFC RFC 1234
6193 !! result
6194 <p>RFC <a href="http://tools.ietf.org/html/rfc1234" class="external" title="http://tools.ietf.org/html/rfc1234">RFC 1234</a>
6195 </p>
6196 !! end
6198 !! test
6199 Double RFC with a wiki link 
6200 !! input
6201 RFC [[RFC 1234]]
6202 !! result
6203 <p>RFC <a href="/index.php?title=RFC_1234&amp;action=edit&amp;redlink=1" class="new" title="RFC 1234 (not yet written)">RFC 1234</a>
6204 </p>
6205 !! end
6207 !! test
6208 RFC code coverage
6209 !! input
6210 RFC   983&#x20;987
6211 !! result
6212 <p><a href="http://tools.ietf.org/html/rfc983" class="external" title="http://tools.ietf.org/html/rfc983">RFC 983</a>&#x20;987
6213 </p>
6214 !! end
6216 !! test
6217 Centre-aligned image
6218 !! input
6219 [[Image:foobar.jpg|centre]]
6220 !! result
6221 <div class="center"><div class="floatnone"><a href="/wiki/Image:Foobar.jpg" class="image" title="Foobar.jpg"><img alt="" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" border="0" /></a></div></div>
6223 !!end
6225 !! test
6226 None-aligned image
6227 !! input
6228 [[Image:foobar.jpg|none]]
6229 !! result
6230 <div class="floatnone"><a href="/wiki/Image:Foobar.jpg" class="image" title="Foobar.jpg"><img alt="" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" border="0" /></a></div>
6232 !!end
6234 !! test
6235 Width + Height sized image (using px) (height is ignored)
6236 !! input
6237 [[Image:foobar.jpg|640x480px]]
6238 !! result
6239 <p><a href="/wiki/Image:Foobar.jpg" class="image" title="Foobar.jpg"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/640px-Foobar.jpg" width="640" height="73" border="0" /></a>
6240 </p>
6241 !!end
6243 !! test
6244 Width-sized image (using px, no following whitespace)
6245 !! input
6246 [[Image:foobar.jpg|640px]]
6247 !! result
6248 <p><a href="/wiki/Image:Foobar.jpg" class="image" title="Foobar.jpg"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/640px-Foobar.jpg" width="640" height="73" border="0" /></a>
6249 </p>
6250 !!end
6252 !! test
6253 Width-sized image (using px, with following whitespace - test regression from r39467)
6254 !! input
6255 [[Image:foobar.jpg|640px ]]
6256 !! result
6257 <p><a href="/wiki/Image:Foobar.jpg" class="image" title="Foobar.jpg"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/640px-Foobar.jpg" width="640" height="73" border="0" /></a>
6258 </p>
6259 !!end
6261 !! test
6262 Width-sized image (using px, with preceding whitespace - test regression from r39467)
6263 !! input
6264 [[Image:foobar.jpg| 640px]]
6265 !! result
6266 <p><a href="/wiki/Image:Foobar.jpg" class="image" title="Foobar.jpg"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/640px-Foobar.jpg" width="640" height="73" border="0" /></a>
6267 </p>
6268 !!end
6270 !! test
6271 Another italics / bold test
6272 !! input
6273  ''' ''x'
6274 !! result
6275 <pre>'<i> </i>x'
6276 </pre>
6277 !!end
6279 # Note the results may be incorrect, as parserTest output included this:
6280 # XML error: Mismatched tag at byte 6120:
6281 # ...<dd> </dt></dl> </dd...
6282 !! test
6283 dt/dd/dl test
6284 !! input
6285 :;;;::
6286 !! result
6287 <dl><dd><dl><dt><dl><dt><dl><dt><dl><dd><dl><dd>
6288 </dd></dl>
6289 </dd></dl>
6290 </dt></dl>
6291 </dt></dl>
6292 </dt></dl>
6293 </dd></dl>
6295 !!end
6298 # Images with the "|" character in external URLs in comment tags; Eats half the comment, leaves unmatched "</a>" tag.
6299 !! test
6300 Images with the "|" character in the comment
6301 !! input
6302 [[image:Foobar.jpg|thumb|An [http://test/?param1=|left|&param2=|x external] URL]]
6303 !! result
6304 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/Image:Foobar.jpg" class="image" title="An external URL"><img alt="An external URL" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" border="0" class="thumbimage" /></a>  <div class="thumbcaption"><div class="magnify"><a href="/wiki/Image: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" title="http://test/?param1=|left|&amp;param2=|x" rel="nofollow">external</a> URL</div></div></div>
6306 !!end
6308 !! test
6309 [Before] HTML without raw HTML enabled ($wgRawHtml==false)
6310 !! input
6311 <html><script>alert(1);</script></html>
6312 !! result
6313 <p>&lt;html&gt;&lt;script&gt;alert(1);&lt;/script&gt;&lt;/html&gt;
6314 </p>
6315 !! end
6317 !! test
6318 HTML with raw HTML ($wgRawHtml==true)
6319 !! options
6320 rawhtml
6321 !! input
6322 <html><script>alert(1);</script></html>
6323 !! result
6324 <p><script>alert(1);</script>
6325 </p>
6326 !! end
6328 !! test
6329 Parents of subpages, one level up
6330 !! options
6331 subpage title=[[Subpage test/L1/L2/L3]]
6332 !! input
6333 [[../|L2]]
6334 !! result
6335 <p><a href="/index.php?title=Subpage_test/L1/L2&amp;action=edit&amp;redlink=1" class="new" title="Subpage test/L1/L2 (not yet written)">L2</a>
6336 </p>
6337 !! end
6340 !! test
6341 Parents of subpages, one level up, not named
6342 !! options
6343 subpage title=[[Subpage test/L1/L2/L3]]
6344 !! input
6345 [[../]]
6346 !! result
6347 <p><a href="/index.php?title=Subpage_test/L1/L2&amp;action=edit&amp;redlink=1" class="new" title="Subpage test/L1/L2 (not yet written)">Subpage test/L1/L2</a>
6348 </p>
6349 !! end
6353 !! test
6354 Parents of subpages, two levels up
6355 !! options
6356 disabled
6357 subpage title=[[Subpage test/L1/L2/L3]]
6358 !! input
6359 [[../../|L1]]2
6360 !! result
6361 <p><a href="/index.php?title=Subpage_test/L1&amp;action=edit&amp;redlink=1" class="new" title="Subpage test/L1 (not yet written)">L1</a>
6362 </p>
6363 !! end
6365 !! test
6366 Parents of subpages, two levels up, without trailing slash or name.
6367 !! options
6368 subpage title=[[Subpage test/L1/L2/L3]]
6369 !! input
6370 [[../..]]
6371 !! result
6372 <p>[[../..]]
6373 </p>
6374 !! end
6376 !! test
6377 Parents of subpages, two levels up, with lots of extra trailing slashes.
6378 !! options
6379 subpage title=[[Subpage test/L1/L2/L3]]
6380 !! input
6381 [[../../////]]
6382 !! result
6383 <p><a href="/index.php?title=Subpage_test/L1////&amp;action=edit&amp;redlink=1" class="new" title="Subpage test/L1//// (not yet written)">///</a>
6384 </p>
6385 !! end
6387 !! test
6388 Definition list code coverage
6389 !! input
6390 ; title   : def
6391 ; title : def
6392 ;title: def
6393 !! result
6394 <dl><dt> title  &nbsp;</dt><dd> def
6395 </dd><dt> title&nbsp;</dt><dd> def
6396 </dd><dt>title</dt><dd> def
6397 </dd></dl>
6399 !! end
6401 !! test
6402 Don't fall for the self-closing div
6403 !! input
6404 <div>hello world</div/>
6405 !! result
6406 <div>hello world</div>
6408 !! end
6410 !! test
6411 MSGNW magic word
6412 !! input
6413 {{MSGNW:msg}}
6414 !! result
6415 <p>&#91;&#91;:Template:Msg&#93;&#93;
6416 </p>
6417 !! end
6419 !! test
6420 RAW magic word
6421 !! input
6422 {{RAW:QUERTY}}
6423 !! result
6424 <p><a href="/index.php?title=Template:QUERTY&amp;action=edit&amp;redlink=1" class="new" title="Template:QUERTY (not yet written)">Template:QUERTY</a>
6425 </p>
6426 !! end
6428 # This isn't needed for XHTML conformance, but would be handy as a fallback security measure
6429 !! test
6430 Always escape literal '>' in output, not just after '<'
6431 !! input
6433 !! result
6434 <p>&gt;&lt;&gt;
6435 </p>
6436 !! end
6438 !! test
6439 Template caching
6440 !! input
6441 {{Test}}
6442 {{Test}}
6443 !! result
6444 <p>This is a test template
6445 This is a test template
6446 </p>
6447 !! end
6450 !! article
6451 MediaWiki:Fake
6452 !! text
6453 ==header==
6454 !! endarticle
6456 !! test
6457 Inclusion of !userCanEdit() content
6458 !! input
6459 {{MediaWiki:Fake}}
6460 !! result
6461 <a name="header"></a><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">header</span></h2>
6463 !! end
6466 !! test
6467 Out-of-order TOC heading levels
6468 !! input
6469 ==2==
6470 ======6======
6471 ===3===
6473 =====5=====
6474 ==2==
6475 !! result
6476 <table id="toc" class="toc" summary="Contents"><tr><td><div id="toctitle"><h2>Contents</h2></div>
6477 <ul>
6478 <li class="toclevel-1"><a href="#2"><span class="tocnumber">1</span> <span class="toctext">2</span></a>
6479 <ul>
6480 <li class="toclevel-2"><a href="#6"><span class="tocnumber">1.1</span> <span class="toctext">6</span></a></li>
6481 <li class="toclevel-2"><a href="#3"><span class="tocnumber">1.2</span> <span class="toctext">3</span></a></li>
6482 </ul>
6483 </li>
6484 <li class="toclevel-1"><a href="#1"><span class="tocnumber">2</span> <span class="toctext">1</span></a>
6485 <ul>
6486 <li class="toclevel-2"><a href="#5"><span class="tocnumber">2.1</span> <span class="toctext">5</span></a></li>
6487 <li class="toclevel-2"><a href="#2_2"><span class="tocnumber">2.2</span> <span class="toctext">2</span></a></li>
6488 </ul>
6489 </li>
6490 </ul>
6491 </td></tr></table><script type="text/javascript"> if (window.showTocToggle) { var tocShowText = "show"; var tocHideText = "hide"; showTocToggle(); } </script>
6492 <a name="2"></a><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">2</span></h2>
6493 <a name="6"></a><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">6</span></h6>
6494 <a name="3"></a><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">3</span></h3>
6495 <a name="1"></a><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">1</span></h1>
6496 <a name="5"></a><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">5</span></h5>
6497 <a name="2_2"></a><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">2</span></h2>
6499 !! end
6502 !! test
6503 ISBN with a dummy number
6504 !! input
6505 ISBN ---
6506 !! result
6507 <p>ISBN ---
6508 </p>
6509 !! end
6512 !! test
6513 ISBN with space-delimited number
6514 !! input
6515 ISBN 92 9017 032 8
6516 !! result
6517 <p><a href="/wiki/Special:BookSources/9290170328" class="internal">ISBN 92 9017 032 8</a>
6518 </p>
6519 !! end
6522 !! test
6523 ISBN with multiple spaces, no number
6524 !! input
6525 ISBN  foo
6526 !! result
6527 <p>ISBN  foo
6528 </p>
6529 !! end
6532 !! test
6533 ISBN length
6534 !! input
6535 ISBN 123456789
6537 ISBN 1234567890
6539 ISBN 12345678901
6540 !! result
6541 <p>ISBN 123456789
6542 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal">ISBN 1234567890</a>
6543 </p><p>ISBN 12345678901
6544 </p>
6545 !! end
6548 !! test
6549 ISBN with trailing year (bug 8110)
6550 !! input
6551 ISBN 1-234-56789-0 - 2006
6553 ISBN 1 234 56789 0 - 2006
6554 !! result
6555 <p><a href="/wiki/Special:BookSources/1234567890" class="internal">ISBN 1-234-56789-0</a> - 2006
6556 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal">ISBN 1 234 56789 0</a> - 2006
6557 </p>
6558 !! end
6561 !! test
6562 Pages in namespace (Magic word disabled currently)
6563 !! input
6564 {{PAGESINNAMESPACE:}}
6565 !! result
6567 !! end
6570 !! test
6571 anchorencode
6572 !! input
6573 {{anchorencode:foo bar©#%n}}
6574 !! result
6575 <p>foo_bar.C2.A9.23.25n
6576 </p>
6577 !! end
6580 !! test
6581 Bug 8293: Use of center tag ruins paragraph formatting
6582 !! input
6583 <center>
6585 </center>
6589  baz
6590 !! result
6591 <center>
6592 <p>foo
6593 </p>
6594 </center>
6595 <p>bar
6596 </p>
6597 <pre>baz
6598 </pre>
6599 !! end
6603 ### Language variants related tests
6605 !! test
6606 Self-link in language variants
6607 !! options
6608 title=[[Dunav]] language=sr
6609 !! input
6610 Both [[Dunav]] and [[Дунав]] are names for this river.
6611 !! result
6612 <p>Both <strong class="selflink">Dunav</strong> and <strong class="selflink">Дунав</strong> are names for this river.
6613 </p>
6614 !!end
6617 !! test
6618 Link to pages in language variants
6619 !! options
6620 language=sr
6621 !! input
6622 Main Page can be written as [[Маин Паге]]
6623 !! result
6624 <p>Main Page can be written as <a href="/wiki/Main_Page" title="Main Page">Маин Паге</a>
6625 </p>
6626 !!end
6629 !! test
6630 Multiple links to pages in language variants
6631 !! options
6632 language=sr
6633 !! input
6634 [[Main Page]] can be written as [[Маин Паге]] same as [[Маин Паге]].
6635 !! result
6636 <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>.
6637 </p>
6638 !!end
6641 !! test
6642 Simple template in language variants
6643 !! options
6644 language=sr
6645 !! input
6646 {{тест}}
6647 !! result
6648 <p>This is a test template
6649 </p>
6650 !! end
6653 !! test
6654 Template with explicit namespace in language variants
6655 !! options
6656 language=sr
6657 !! input
6658 {{Template:тест}}
6659 !! result
6660 <p>This is a test template
6661 </p>
6662 !! end
6665 !! test
6666 Basic test for template parameter in language variants
6667 !! options
6668 language=sr
6669 !! input
6670 {{парамтест|param=foo}}
6671 !! result
6672 <p>This is a test template with parameter foo
6673 </p>
6674 !! end
6677 !! test
6678 Simple category in language variants
6679 !! options
6680 language=sr cat
6681 !! input
6682 [[:Category:МедиаWики Усер'с Гуиде]]
6683 !! result
6684 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User&#039;s Guide">MediaWiki User's Guide</a>
6685 !! end
6688 !! test
6689 Stripping -{}- tags (language variants)
6690 !! options
6691 language=sr
6692 !! input
6693 Latin proverb: -{Ne nuntium necare}-
6694 !! result
6695 <p>Latin proverb: Ne nuntium necare
6696 </p>
6697 !! end
6700 !! test
6701 Prevent conversion with -{}- tags (language variants)
6702 !! options
6703 language=sr variant=sr-ec
6704 !! input
6705 Latinski: -{Ne nuntium necare}-
6706 !! result
6707 <p>Латински: Ne nuntium necare
6708 </p>
6709 !! end
6712 !! test
6713 Prevent conversion of text with -{}- tags (language variants)
6714 !! options
6715 language=sr variant=sr-ec
6716 !! input
6717 Latinski: -{Ne nuntium necare}-
6718 !! result
6719 <p>Латински: Ne nuntium necare
6720 </p>
6721 !! end
6724 !! test
6725 Prevent conversion of links with -{}- tags (language variants)
6726 !! options
6727 language=sr variant=sr-ec
6728 !! input
6729 -{[[Main Page]]}-
6730 !! result
6731 <p><a href="/index.php?title=Main_Page&amp;variant=sr-ec" title="Main Page">Main Page</a>
6732 </p>
6733 !! end
6736 !! test
6737 -{}- tags within headlines (within html for parserConvert())
6738 !! options
6739 language=sr variant=sr-ec
6740 !! input
6741 == -{Naslov}- ==
6742 !! result
6743 <a name="-.7BNaslov.7D-"></a><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"> Naslov </span></h2>
6745 !! end
6748 !! test
6749 Explicit definition of language variant alternatives
6750 !! options
6751 language=zh variant=zh-tw
6752 !! input
6753 -{zh:China;zh-tw:Taiwan}-, not China
6754 !! result
6755 <p>Taiwan, not China
6756 </p>
6757 !! end
6760 !! test
6761 Adding explicit session-wise language variant mapping (A flag)
6762 !! options
6763 language=zh variant=zh-tw
6764 !! input
6765 -{A|zh:China;zh-tw:Taiwan}- is China
6766 !! result
6767 <p>Taiwan is Taiwan
6768 </p>
6769 !! end
6772 !! test
6773 Adding explicit conversion rule for title (T flag)
6774 !! options
6775 language=zh variant=zh-tw
6776 !! input
6777 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
6778 !! result
6779 <p>Should be stripped!
6780 </p>
6781 !! end
6784 !! test
6785 Raw output of variant escape tags (R flag)
6786 !! options
6787 language=zh variant=zh-tw
6788 !! input
6789 Raw: -{R|zh:China;zh-tw:Taiwan}-
6790 !! result
6791 <p>Raw: zh:China;zh-tw:Taiwan
6792 </p>
6793 !! end
6796 !! test
6797 Do not convert roman numbers to language variants
6798 !! options
6799 language=sr variant=sr-ec
6800 !! input
6801 Fridrih IV je car.
6802 !! result
6803 <p>Фридрих IV је цар.
6804 </p>
6805 !! end
6807 !!article 
6808 Template:Bullet
6809 !!text
6810 * Bar
6811 !!endarticle
6813 !! test
6814 Bug 529: Uncovered bullet
6815 !! input
6816 * Foo {{bullet}}
6817 !! result
6818 <ul><li> Foo 
6819 </li><li> Bar
6820 </li></ul>
6822 !! end
6824 !! test
6825 Bug 529: Uncovered table already at line-start
6826 !! input
6829 {{table}}
6831 !! result
6832 <p>x
6833 </p>
6834 <table>
6835 <tr>
6836 <td> 1 </td><td> 2
6837 </td></tr>
6838 <tr>
6839 <td> 3 </td><td> 4
6840 </td></tr></table>
6841 <p>y
6842 </p>
6843 !! end
6845 !! test
6846 Bug 529: Uncovered bullet in parser function result
6847 !! input
6848 * Foo {{lc:{{bullet}} }}
6849 !! result
6850 <ul><li> Foo 
6851 </li><li> bar
6852 </li></ul>
6854 !! end
6856 !! test
6857 Bug 5678: Double-parsed template argument
6858 !! input
6859 {{lc:{{{1}}}|hello}}
6860 !! result
6861 <p>{{{1}}}
6862 </p>
6863 !! end
6865 !! test
6866 Bug 5678: Double-parsed template invocation
6867 !! input
6868 {{lc:{{paramtest {{!}} param = hello }} }}
6869 !! result
6870 <p>{{paramtest | param = hello }}
6871 </p>
6872 !! end
6874 !! test
6875 Morwen/13: Unclosed link followed by heading
6876 !! input
6877 [[link
6878 ==heading==
6879 !! result
6880 <p>[[link
6881 </p>
6882 <a name="heading"></a><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">heading</span></h2>
6884 !! end
6886 !! test
6887 HHP2.1: Heuristics for headings in preprocessor parenthetical structures
6888 !! input
6889 {{foo|
6890 =heading=
6891 !! result
6892 <p>{{foo|
6893 </p>
6894 <a name="heading"></a><h1> <span class="mw-headline">heading</span></h1>
6896 !! end
6898 !! test
6899 HHP2.2: Heuristics for headings in preprocessor parenthetical structures
6900 !! input
6901 {{foo|
6902 ==heading==
6903 !! result
6904 <p>{{foo|
6905 </p>
6906 <a name="heading"></a><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">heading</span></h2>
6908 !! end
6910 !! test
6911 Tildes in comments
6912 !! options
6914 !! input
6915 <!-- ~~~~ -->
6916 !! result
6917 <!-- ~~~~ -->
6918 !! end
6920 !! test
6921 Paragraphs inside divs (no extra line breaks)
6922 !! input
6923 <div>Line one
6925 Line two</div>
6926 !! result
6927 <div>Line one
6928 Line two</div>
6930 !! end
6932 !! test
6933 Paragraphs inside divs (extra line break on open)
6934 !! input
6935 <div>
6936 Line one
6938 Line two</div>
6939 !! result
6940 <div>
6941 <p>Line one
6942 </p>
6943 Line two</div>
6945 !! end
6947 !! test
6948 Paragraphs inside divs (extra line break on close)
6949 !! input
6950 <div>Line one
6952 Line two
6953 </div>
6954 !! result
6955 <div>Line one
6956 <p>Line two
6957 </p>
6958 </div>
6960 !! end
6962 !! test
6963 Paragraphs inside divs (extra line break on open and close)
6964 !! input
6965 <div>
6966 Line one
6968 Line two
6969 </div>
6970 !! result
6971 <div>
6972 <p>Line one
6973 </p><p>Line two
6974 </p>
6975 </div>
6977 !! end
6979 # Bug 6200: <blockquote> should behave like <div> with respect to line breaks
6980 !! test
6981 Bug 6200: paragraphs inside blockquotes (no extra line breaks)
6982 !! input
6983 <blockquote>Line one
6985 Line two</blockquote>
6986 !! result
6987 <blockquote>Line one
6988 Line two</blockquote>
6990 !! end
6992 !! test
6993 Bug 6200: paragraphs inside blockquotes (extra line break on open)
6994 !! input
6995 <blockquote>
6996 Line one
6998 Line two</blockquote>
6999 !! result
7000 <blockquote>
7001 <p>Line one
7002 </p>
7003 Line two</blockquote>
7005 !! end
7007 !! test
7008 Bug 6200: paragraphs inside blockquotes (extra line break on close)
7009 !! input
7010 <blockquote>Line one
7012 Line two
7013 </blockquote>
7014 !! result
7015 <blockquote>Line one
7016 <p>Line two
7017 </p>
7018 </blockquote>
7020 !! end
7022 !! test
7023 Bug 6200: paragraphs inside blockquotes (extra line break on open and close)
7024 !! input
7025 <blockquote>
7026 Line one
7028 Line two
7029 </blockquote>
7030 !! result
7031 <blockquote>
7032 <p>Line one
7033 </p><p>Line two
7034 </p>
7035 </blockquote>
7037 !! end
7039 !! test
7040 Paragraphs inside blockquotes/divs (no extra line breaks)
7041 !! input
7042 <blockquote><div>Line one
7044 Line two</div></blockquote>
7045 !! result
7046 <blockquote><div>Line one
7047 Line two</div></blockquote>
7049 !! end
7051 !! test
7052 Paragraphs inside blockquotes/divs (extra line break on open)
7053 !! input
7054 <blockquote><div>
7055 Line one
7057 Line two</div></blockquote>
7058 !! result
7059 <blockquote><div>
7060 <p>Line one
7061 </p>
7062 Line two</div></blockquote>
7064 !! end
7066 !! test
7067 Paragraphs inside blockquotes/divs (extra line break on close)
7068 !! input
7069 <blockquote><div>Line one
7071 Line two
7072 </div></blockquote>
7073 !! result
7074 <blockquote><div>Line one
7075 <p>Line two
7076 </p>
7077 </div></blockquote>
7079 !! end
7081 !! test
7082 Paragraphs inside blockquotes/divs (extra line break on open and close)
7083 !! input
7084 <blockquote><div>
7085 Line one
7087 Line two
7088 </div></blockquote>
7089 !! result
7090 <blockquote><div>
7091 <p>Line one
7092 </p><p>Line two
7093 </p>
7094 </div></blockquote>
7096 !! end
7098 !! test
7099 Interwiki links trounced by replaceExternalLinks after early LinkHolderArray expansion
7100 !! options
7101 wgLinkHolderBatchSize=0
7102 !! input
7103 [[meatball:1]]
7104 [[meatball:2]]
7105 [[meatball:3]]
7106 !! result
7107 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?1" class="extiw" title="meatball:1">meatball:1</a>
7108 <a href="http://www.usemod.com/cgi-bin/mb.pl?2" class="extiw" title="meatball:2">meatball:2</a>
7109 <a href="http://www.usemod.com/cgi-bin/mb.pl?3" class="extiw" title="meatball:3">meatball:3</a>
7110 </p>
7111 !! end
7113 !! test
7114 Free external link invading image caption
7115 !! input
7116 [[Image:Foobar.jpg|thumb|http://x|hello]]
7117 !! result
7118 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/Image:Foobar.jpg" class="image" title="hello"><img alt="hello" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" border="0" class="thumbimage" /></a>  <div class="thumbcaption"><div class="magnify"><a href="/wiki/Image: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>
7120 !! end
7126 TODO:
7127 more images
7128 more tables
7129 math
7130 character entities
7131 and much more
7132 Try for 100% code coverage