Fix for r92740: removed debugging code
[mediawiki.git] / tests / parser / parserTests.txt
blobc59e4db102de9913ab44878cb7199479c7dd2bad
1 # MediaWiki Parser test cases
2 # Some taken from http://meta.wikimedia.org/wiki/Parser_testing
3 # All (C) their respective authors and released under the GPL
5 # The syntax should be fairly self-explanatory.
7 # Currently supported test options:
8 # One of the following three:
10 #  (default)  generate HTML output
11 #  pst        apply pre-save transform
12 #  msg        apply message transform
14 # Plus any combination of these:
16 # cat           add category links
17 # ill           add inter-language links
18 # subpage       enable subpages (disabled by default)
19 # noxml         don't check for XML well formdness
20 # title=[[XXX]] run test using article title XXX
21 # language=XXX  set content language to XXX for this test
22 # variant=XXX   set the variant of language for this test (eg zh-tw)
23 # disabled      do not run test
24 # showtitle     make the first line the title
25 # comment       run through Linker::formatComment() instead of main parser
26 # local         format section links in edit comment text as local links
28 # For testing purposes, temporary articles can created:
29 # !!article / NAMESPACE:TITLE / !!text / ARTICLE TEXT / !!endarticle
30 # where '/' denotes a newline.
32 # This is the standard article assumed to exist.
33 !! article
34 Main Page
35 !! text
36 blah blah
37 !! endarticle
39 !!article 
40 Template:Foo
41 !!text
42 FOO
43 !!endarticle
45 !! article 
46 Template:Blank
47 !! text
48 !! endarticle
50 !! article
51 Template:!
52 !! text
54 !! endarticle
56 !!article
57 MediaWiki:bad image list
58 !!text
59 * [[File:Bad.jpg]] except [[Nasty page]]
60 !!endarticle
62 ###
63 ### Basic tests
64 ###
65 !! test
66 Blank input
67 !! input
68 !! result
69 !! end
72 !! test
73 Simple paragraph
74 !! input
75 This is a simple paragraph.
76 !! result
77 <p>This is a simple paragraph.
78 </p>
79 !! end
81 !! test
82 Simple list
83 !! input
84 * Item 1
85 * Item 2
86 !! result
87 <ul><li> Item 1
88 </li><li> Item 2
89 </li></ul>
91 !! end
93 !! test
94 Italics and bold
95 !! input
96 * plain
97 * plain''italic''plain
98 * plain''italic''plain''italic''plain
99 * plain'''bold'''plain
100 * plain'''bold'''plain'''bold'''plain
101 * plain''italic''plain'''bold'''plain
102 * plain'''bold'''plain''italic''plain
103 * plain''italic'''bold-italic'''italic''plain
104 * plain'''bold''bold-italic''bold'''plain
105 * plain'''''bold-italic'''italic''plain
106 * plain'''''bold-italic''bold'''plain
107 * plain''italic'''bold-italic'''''plain
108 * plain'''bold''bold-italic'''''plain
109 * plain l'''italic''plain
110 * plain l''''bold''' plain
111 !! result
112 <ul><li> plain
113 </li><li> plain<i>italic</i>plain
114 </li><li> plain<i>italic</i>plain<i>italic</i>plain
115 </li><li> plain<b>bold</b>plain
116 </li><li> plain<b>bold</b>plain<b>bold</b>plain
117 </li><li> plain<i>italic</i>plain<b>bold</b>plain
118 </li><li> plain<b>bold</b>plain<i>italic</i>plain
119 </li><li> plain<i>italic<b>bold-italic</b>italic</i>plain
120 </li><li> plain<b>bold<i>bold-italic</i>bold</b>plain
121 </li><li> plain<i><b>bold-italic</b>italic</i>plain
122 </li><li> plain<b><i>bold-italic</i>bold</b>plain
123 </li><li> plain<i>italic<b>bold-italic</b></i>plain
124 </li><li> plain<b>bold<i>bold-italic</i></b>plain
125 </li><li> plain l'<i>italic</i>plain
126 </li><li> plain l'<b>bold</b> plain
127 </li></ul>
129 !! end
132 ### <nowiki> test cases
135 !! test
136 <nowiki> unordered list
137 !! input
138 <nowiki>* This is not an unordered list item.</nowiki>
139 !! result
140 <p>* This is not an unordered list item.
141 </p>
142 !! end
144 !! test
145 <nowiki> spacing
146 !! input
147 <nowiki>Lorem ipsum dolor
149 sed abit.
150   sed nullum.
152 :and a colon
153 </nowiki>
154 !! result
155 <p>Lorem ipsum dolor
157 sed abit.
158   sed nullum.
160 :and a colon
162 </p>
163 !! end
165 !! test
166 nowiki 3
167 !! input
168 :There is not nowiki.
169 :There is <nowiki>nowiki</nowiki>.
171 #There is not nowiki.
172 #There is <nowiki>nowiki</nowiki>.
174 *There is not nowiki.
175 *There is <nowiki>nowiki</nowiki>.
176 !! result
177 <dl><dd>There is not nowiki.
178 </dd><dd>There is nowiki.
179 </dd></dl>
180 <ol><li>There is not nowiki.
181 </li><li>There is nowiki.
182 </li></ol>
183 <ul><li>There is not nowiki.
184 </li><li>There is nowiki.
185 </li></ul>
187 !! end
191 ### Comments
193 !! test
194 Comment test 1
195 !! input
196 <!-- comment 1 --> asdf
197 <!-- comment 2 -->
198 !! result
199 <pre>asdf
200 </pre>
202 !! end
204 !! test
205 Comment test 2
206 !! input
207 asdf
208 <!-- comment 1 -->
210 !! result
211 <p>asdf
213 </p>
214 !! end
216 !! test
217 Comment test 3
218 !! input
219 asdf
220 <!-- comment 1 -->
221 <!-- comment 2 -->
223 !! result
224 <p>asdf
226 </p>
227 !! end
229 !! test
230 Comment test 4
231 !! input
232 asdf<!-- comment 1 -->jkl
233 !! result
234 <p>asdfjkl
235 </p>
236 !! end
238 !! test
239 Comment spacing
240 !! input
242  <!-- foo --> b <!-- bar -->
244 !! result
245 <p>a
246 </p>
247 <pre> b 
248 </pre>
249 <p>c
250 </p>
251 !! end
253 !! test
254 Comment whitespace
255 !! input
256 <!-- returns a single newline, not nothing, since the newline after > is not stripped -->
257 !! result
259 !! end
261 !! test
262 Comment semantics and delimiters
263 !! input
264 <!-- --><!----><!-----><!------>
265 !! result
267 !! end
269 !! test
270 Comment semantics and delimiters, redux
271 !! input
272 <!-- In SGML every "foo" here would actually show up in the text -- foo -- bar
273 -- foo -- funky huh? ... -->
274 !! result
276 !! end
278 !! test
279 Comment semantics and delimiters: directors cut
280 !! input
281 <!-- ... However we like to keep things simple and somewhat XML-ish so we eat
282 everything starting with < followed by !-- until the first -- and > we see,
283 that wouldn't be valid XML however, since in XML -- has to terminate a comment
284 -->-->
285 !! result
286 <p>--&gt;
287 </p>
288 !! end
290 !! test
291 Comment semantics: nesting
292 !! input
293 <!--<!-- no, we're not going to do anything fancy here -->-->
294 !! result
295 <p>--&gt;
296 </p>
297 !! end
299 !! test
300 Comment semantics: unclosed comment at end
301 !! input
302 <!--This comment will run out to the end of the document
303 !! result
305 !! end
307 !! test
308 Comment in template title
309 !! input
310 {{f<!---->oo}}
311 !! result
312 <p>FOO
313 </p>
314 !! end
316 !! test
317 Comment on its own line post-expand
318 !! input
320 {{blank}}<!---->
322 !! result
323 <p>a
324 </p><p>b
325 </p>
326 !! end
329 ### Preformatted text
331 !! test
332 Preformatted text
333 !! input
334  This is some
335  Preformatted text
336  With ''italic''
337  And '''bold'''
338  And a [[Main Page|link]]
339 !! result
340 <pre>This is some
341 Preformatted text
342 With <i>italic</i>
343 And <b>bold</b>
344 And a <a href="/wiki/Main_Page" title="Main Page">link</a>
345 </pre>
346 !! end
348 !! test
349 <pre> with <nowiki> inside (compatibility with 1.6 and earlier)
350 !! input
351 <pre><nowiki>
353 <cite>
354 <em>
355 </nowiki></pre>
356 !! result
357 <pre>
358 &lt;b&gt;
359 &lt;cite&gt;
360 &lt;em&gt;
361 </pre>
363 !! end
365 !! test
366 Regression with preformatted in <center>
367 !! input
368 <center>
369  Blah
370 </center>
371 !! result
372 <center>
373 <pre>Blah
374 </pre>
375 </center>
377 !! end
379 # Expected output in the following test is not really expected (there should be
380 # <pre> in the output) -- it's only testing for well-formedness.
381 !! test
382 Bug 6200: Preformatted in <blockquote>
383 !! input
384 <blockquote>
385  Blah
386 </blockquote>
387 !! result
388 <blockquote>
389  Blah
390 </blockquote>
392 !! end
394 !! test
395 <pre> with attributes (bug 3202)
396 !! input
397 <pre style="background: blue; color:white">Bluescreen of WikiDeath</pre>
398 !! result
399 <pre style="background: blue; color:white">Bluescreen of WikiDeath</pre>
401 !! end
403 !! test
404 <pre> with width attribute (bug 3202)
405 !! input
406 <pre width="8">Narrow screen goodies</pre>
407 !! result
408 <pre width="8">Narrow screen goodies</pre>
410 !! end
412 !! test
413 <pre> with forbidden attribute (bug 3202)
414 !! input
415 <pre width="8" onmouseover="alert(document.cookie)">Narrow screen goodies</pre>
416 !! result
417 <pre width="8">Narrow screen goodies</pre>
419 !! end
421 !! test
422 <pre> with forbidden attribute values (bug 3202)
423 !! input
424 <pre width="8" style="border-width: expression(alert(document.cookie))">Narrow screen goodies</pre>
425 !! result
426 <pre width="8" style="/* insecure input */">Narrow screen goodies</pre>
428 !! end
430 !! test
431 <nowiki> inside <pre> (bug 13238)
432 !! input
433 <pre>
434 <nowiki>
435 </pre>
436 <pre>
437 <nowiki></nowiki>
438 </pre>
439 <pre><nowiki><nowiki></nowiki>Foo<nowiki></nowiki></nowiki></pre>
440 !! result
441 <pre>
442 &lt;nowiki&gt;
443 </pre>
444 <pre>
446 </pre>
447 <pre>&lt;nowiki&gt;Foo&lt;/nowiki&gt;</pre>
449 !! end
451 !! test
452 <nowiki> and <pre> preference (first one wins)
453 !! input
454 <pre>
455 <nowiki>
456 </pre>
457 </nowiki>
458 </pre>
460 <nowiki>
461 <pre>
462 <nowiki>
463 </pre>
464 </nowiki>
465 </pre>
467 !! result
468 <pre>
469 &lt;nowiki&gt;
470 </pre>
471 <p>&lt;/nowiki&gt;
472 &lt;/pre&gt;
473 </p><p>
474 &lt;pre&gt;
475 &lt;nowiki&gt;
476 &lt;/pre&gt;
478 &lt;/pre&gt;
479 </p>
480 !! end
484 ### Definition lists
486 !! test
487 Simple definition
488 !! input
489 ; name : Definition
490 !! result
491 <dl><dt> name&#160;</dt><dd> Definition
492 </dd></dl>
494 !! end
496 !! test
497 Definition list for indentation only
498 !! input
499 : Indented text
500 !! result
501 <dl><dd> Indented text
502 </dd></dl>
504 !! end
506 !! test
507 Definition list with no space
508 !! input
509 ;name:Definition
510 !! result
511 <dl><dt>name</dt><dd>Definition
512 </dd></dl>
514 !!end
516 !! test
517 Definition list with URL link
518 !! input
519 ; http://example.com/ : definition
520 !! result
521 <dl><dt> <a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&#160;</dt><dd> definition
522 </dd></dl>
524 !! end
526 !! test
527 Definition list with bracketed URL link
528 !! input
529 ;[http://www.example.com/ Example]:Something about it
530 !! result
531 <dl><dt><a rel="nofollow" class="external text" href="http://www.example.com/">Example</a></dt><dd>Something about it
532 </dd></dl>
534 !! end
536 !! test
537 Definition list with wikilink containing colon
538 !! input
539 ; [[Help:FAQ]]: The least-read page on Wikipedia
540 !! result
541 <dl><dt> <a href="/index.php?title=Help:FAQ&amp;action=edit&amp;redlink=1" class="new" title="Help:FAQ (page does not exist)">Help:FAQ</a></dt><dd> The least-read page on Wikipedia
542 </dd></dl>
544 !! end
546 # At Brion's and JeLuF's insistence... :)
547 !! test
548 Definition list with news link containing colon
549 !! input
550 ;  news:alt.wikipedia.rox: This isn't even a real newsgroup!
551 !! result
552 <dl><dt>  <a rel="nofollow" class="external free" href="news:alt.wikipedia.rox">news:alt.wikipedia.rox</a></dt><dd> This isn't even a real newsgroup!
553 </dd></dl>
555 !! end
557 !! test
558 Malformed definition list with colon
559 !! input
560 ;  news:alt.wikipedia.rox -- don't crash or enter an infinite loop
561 !! result
562 <dl><dt>  <a rel="nofollow" class="external free" href="news:alt.wikipedia.rox">news:alt.wikipedia.rox</a> -- don't crash or enter an infinite loop
563 </dt></dl>
565 !! end
567 !! test
568 Definition lists: colon in external link text
569 !! input
570 ; [http://www.wikipedia2.org/ Wikipedia : The Next Generation]: OK, I made that up
571 !! result
572 <dl><dt> <a rel="nofollow" class="external text" href="http://www.wikipedia2.org/">Wikipedia&#160;: The Next Generation</a></dt><dd> OK, I made that up
573 </dd></dl>
575 !! end
577 !! test
578 Definition lists: colon in HTML attribute
579 !! input
580 ;<b style="display: inline">bold</b>
581 !! result
582 <dl><dt><b style="display: inline">bold</b>
583 </dt></dl>
585 !! end
588 !! test
589 Definition lists: self-closed tag
590 !! input
591 ;one<br/>two : two-line fun
592 !! result
593 <dl><dt>one<br />two&#160;</dt><dd> two-line fun
594 </dd></dl>
596 !! end
598 !! test
599 Bug 11748: Literal closing tags
600 !! options
601 disabled
602 !! input
603 <dl>
604 <dt>test 1</dt>
605 <dd>test test test test test</dd>
606 <dt>test 2</dt>
607 <dd>test test test test test</dd>
608 </dl>
609 !! result
610 <dl>
611 <dt>test 1</dt>
612 <dd>test test test test test</dd>
613 <dt>test 2</dt>
614 <dd>test test test test test</dd>
615 </dl>
616 !! end
619 ### External links
621 !! test
622 External links: non-bracketed
623 !! input
624 Non-bracketed: http://example.com
625 !! result
626 <p>Non-bracketed: <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
627 </p>
628 !! end
630 !! test
631 External links: numbered
632 !! input
633 Numbered: [http://example.com]
634 Numbered: [http://example.net]
635 Numbered: [http://example.com]
636 !! result
637 <p>Numbered: <a rel="nofollow" class="external autonumber" href="http://example.com">[1]</a>
638 Numbered: <a rel="nofollow" class="external autonumber" href="http://example.net">[2]</a>
639 Numbered: <a rel="nofollow" class="external autonumber" href="http://example.com">[3]</a>
640 </p>
641 !!end
643 !! test
644 External links: specified text
645 !! input
646 Specified text: [http://example.com link]
647 !! result
648 <p>Specified text: <a rel="nofollow" class="external text" href="http://example.com">link</a>
649 </p>
650 !!end
652 !! test
653 External links: trail
654 !! input
655 Linktrails should not work for external links: [http://example.com link]s
656 !! result
657 <p>Linktrails should not work for external links: <a rel="nofollow" class="external text" href="http://example.com">link</a>s
658 </p>
659 !! end
661 !! test
662 External links: dollar sign in URL
663 !! input
664 http://example.com/1$2345
665 !! result
666 <p><a rel="nofollow" class="external free" href="http://example.com/1$2345">http://example.com/1$2345</a>
667 </p>
668 !! end
670 !! test
671 External links: dollar sign in URL (named)
672 !! input
673 [http://example.com/1$2345]
674 !! result
675 <p><a rel="nofollow" class="external autonumber" href="http://example.com/1$2345">[1]</a>
676 </p>
677 !!end
679 !! test
680 External links: open square bracket forbidden in URL (bug 4377)
681 !! input
682 http://example.com/1[2345
683 !! result
684 <p><a rel="nofollow" class="external free" href="http://example.com/1">http://example.com/1</a>[2345
685 </p>
686 !! end
688 !! test
689 External links: open square bracket forbidden in URL (named) (bug 4377)
690 !! input
691 [http://example.com/1[2345]
692 !! result
693 <p><a rel="nofollow" class="external text" href="http://example.com/1">[2345</a>
694 </p>
695 !!end
697 !! test
698 External links: nowiki in URL link text (bug 6230)
699 !!input
700 [http://example.com/ <nowiki>''example site''</nowiki>]
701 !! result
702 <p><a rel="nofollow" class="external text" href="http://example.com/">''example site''</a>
703 </p>
704 !! end
706 !! test
707 External links: newline forbidden in text (bug 6230 regression check)
708 !! input
709 [http://example.com/ first
710 second]
711 !! result
712 <p>[<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a> first
713 second]
714 </p>
715 !!end
717 !! test
718 External links: protocol-relative URL in brackets
719 !! input
720 [//example.com/ Test]
721 !! result
722 <p><a rel="nofollow" class="external text" href="//example.com/">Test</a>
723 </p>
724 !! end
726 !! test
727 External links: protocol-relative URL in brackets without text
728 !! input
729 [//example.com]
730 !! result
731 <p><a rel="nofollow" class="external autonumber" href="//example.com">[1]</a>
732 </p>
733 !! end
735 !! test
736 External links: protocol-relative URL in free text is left alone
737 !! input
738 //example.com/Foo
739 !! result
740 <p>//example.com/Foo
741 </p>
742 !!end
744 !! test
745 External image
746 !! input
747 External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
748 !! result
749 <p>External image: <img src="http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" />
750 </p>
751 !! end
753 !! test
754 External image from https
755 !! input
756 External image from https: https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
757 !! result
758 <p>External image from https: <img src="https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" />
759 </p>
760 !! end
762 !! test
763 Link to non-http image, no img tag
764 !! input
765 Link to non-http image, no img tag: ftp://example.com/test.jpg
766 !! result
767 <p>Link to non-http image, no img tag: <a rel="nofollow" class="external free" href="ftp://example.com/test.jpg">ftp://example.com/test.jpg</a>
768 </p>
769 !! end
771 !! test
772 External links: terminating separator
773 !! input
774 Terminating separator: http://example.com/thing,
775 !! result
776 <p>Terminating separator: <a rel="nofollow" class="external free" href="http://example.com/thing">http://example.com/thing</a>,
777 </p>
778 !! end
780 !! test
781 External links: intervening separator
782 !! input
783 Intervening separator: http://example.com/1,2,3
784 !! result
785 <p>Intervening separator: <a rel="nofollow" class="external free" href="http://example.com/1,2,3">http://example.com/1,2,3</a>
786 </p>
787 !! end
789 !! test
790 External links: old bug with URL in query
791 !! input
792 Old bug with URL in query: [http://example.com/thing?url=http://example.com link]
793 !! result
794 <p>Old bug with URL in query: <a rel="nofollow" class="external text" href="http://example.com/thing?url=http://example.com">link</a>
795 </p>
796 !! end
798 !! test
799 External links: old URL-in-URL bug, mixed protocols
800 !! input
801 And again with mixed protocols: [ftp://example.com?url=http://example.com link]
802 !! result
803 <p>And again with mixed protocols: <a rel="nofollow" class="external text" href="ftp://example.com?url=http://example.com">link</a>
804 </p>
805 !!end
807 !! test
808 External links: URL in text
809 !! input
810 URL in text: [http://example.com http://example.com]
811 !! result
812 <p>URL in text: <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
813 </p>
814 !! end
816 !! test
817 External links: Clickable images
818 !! input
819 ja-style clickable images: [http://example.com http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png]
820 !! result
821 <p>ja-style clickable images: <a rel="nofollow" class="external text" href="http://example.com"><img src="http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" /></a>
822 </p>
823 !!end
825 !! test
826 External links: raw ampersand
827 !! input
828 Old &amp; use: http://x&y
829 !! result
830 <p>Old &amp; use: <a rel="nofollow" class="external free" href="http://x&amp;y">http://x&amp;y</a>
831 </p>
832 !! end
834 !! test
835 External links: encoded ampersand
836 !! input
837 Old &amp; use: http://x&amp;y
838 !! result
839 <p>Old &amp; use: <a rel="nofollow" class="external free" href="http://x&amp;y">http://x&amp;y</a>
840 </p>
841 !! end
843 !! test
844 External links: encoded equals (bug 6102)
845 !! input
846 http://example.com/?foo&#61;bar
847 !! result
848 <p><a rel="nofollow" class="external free" href="http://example.com/?foo=bar">http://example.com/?foo=bar</a>
849 </p>
850 !! end
852 !! test
853 External links: [raw ampersand]
854 !! input
855 Old &amp; use: [http://x&y]
856 !! result
857 <p>Old &amp; use: <a rel="nofollow" class="external autonumber" href="http://x&amp;y">[1]</a>
858 </p>
859 !! end
861 !! test
862 External links: [encoded ampersand]
863 !! input
864 Old &amp; use: [http://x&amp;y]
865 !! result
866 <p>Old &amp; use: <a rel="nofollow" class="external autonumber" href="http://x&amp;y">[1]</a>
867 </p>
868 !! end
870 !! test
871 External links: [encoded equals] (bug 6102)
872 !! input
873 [http://example.com/?foo&#61;bar]
874 !! result
875 <p><a rel="nofollow" class="external autonumber" href="http://example.com/?foo=bar">[1]</a>
876 </p>
877 !! end
879 !! test
880 External links: [IDN ignored character reference in hostname; strip it right off]
881 !! input
882 [http://e&zwnj;xample.com/]
883 !! result
884 <p><a rel="nofollow" class="external autonumber" href="http://example.com/">[1]</a>
885 </p>
886 !! end
888 !! test
889 External links: IDN ignored character reference in hostname; strip it right off
890 !! input
891 http://e&zwnj;xample.com/
892 !! result
893 <p><a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>
894 </p>
895 !! end
897 !! test
898 External links: www.jpeg.org (bug 554)
899 !! input
900 http://www.jpeg.org
901 !!result
902 <p><a rel="nofollow" class="external free" href="http://www.jpeg.org">http://www.jpeg.org</a>
903 </p>
904 !! end
906 !! test
907 External links: URL within URL (original bug 2)
908 !! input
909 [http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp]
910 !! result
911 <p><a rel="nofollow" class="external autonumber" href="http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp">[1]</a>
912 </p>
913 !! end
915 !! test
916 BUG 361: URL inside bracketed URL
917 !! input
918 [http://www.example.com/foo http://www.example.com/bar]
919 !! result
920 <p><a rel="nofollow" class="external text" href="http://www.example.com/foo">http://www.example.com/bar</a>
921 </p>
922 !! end
924 !! test
925 BUG 361: URL within URL, not bracketed
926 !! input
927 http://www.example.com/foo?=http://www.example.com/bar
928 !! result
929 <p><a rel="nofollow" class="external free" href="http://www.example.com/foo?=http://www.example.com/bar">http://www.example.com/foo?=http://www.example.com/bar</a>
930 </p>
931 !! end
933 !! test
934 BUG 289: ">"-token in URL-tail
935 !! input
936 http://www.example.com/<hello>
937 !! result
938 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a>&lt;hello&gt;
939 </p>
940 !!end
942 !! test
943 BUG 289: literal ">"-token in URL-tail
944 !! input
945 http://www.example.com/<b>html</b>
946 !! result
947 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a><b>html</b>
948 </p>
949 !!end
951 !! test
952 BUG 289: ">"-token in bracketed URL
953 !! input
954 [http://www.example.com/<hello> stuff]
955 !! result
956 <p><a rel="nofollow" class="external text" href="http://www.example.com/">&lt;hello&gt; stuff</a>
957 </p>
958 !!end
960 !! test
961 BUG 289: literal ">"-token in bracketed URL
962 !! input
963 [http://www.example.com/<b>html</b> stuff]
964 !! result
965 <p><a rel="nofollow" class="external text" href="http://www.example.com/"><b>html</b> stuff</a>
966 </p>
967 !!end
969 !! test
970 BUG 289: literal double quote at end of URL
971 !! input
972 http://www.example.com/"hello"
973 !! result
974 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a>"hello"
975 </p>
976 !!end
978 !! test
979 BUG 289: literal double quote in bracketed URL
980 !! input
981 [http://www.example.com/"hello" stuff]
982 !! result
983 <p><a rel="nofollow" class="external text" href="http://www.example.com/">"hello" stuff</a>
984 </p>
985 !!end
987 !! test
988 External links: multiple legal whitespace is fine, Magnus. Don't break it please. (bug 5081)
989 !! input
990 [http://www.example.com  test]
991 !! result
992 <p><a rel="nofollow" class="external text" href="http://www.example.com">test</a>
993 </p>
994 !! end
996 !! test
997 External links: wiki links within external link (Bug 3695)
998 !! input
999 [http://example.com [[wikilink]] embedded in ext link]
1000 !! result
1001 <p><a rel="nofollow" class="external text" href="http://example.com"></a><a href="/index.php?title=Wikilink&amp;action=edit&amp;redlink=1" class="new" title="Wikilink (page does not exist)">wikilink</a><a rel="nofollow" class="external text" href="http://example.com"> embedded in ext link</a>
1002 </p>
1003 !! end
1005 !! test
1006 BUG 787: Links with one slash after the url protocol are invalid
1007 !! input
1008 http:/example.com
1010 [http:/example.com title]
1011 !! result
1012 <p>http:/example.com
1013 </p><p>[http:/example.com title]
1014 </p>
1015 !! end
1017 !! test
1018 Bug 2702: Mismatched <i>, <b> and <a> tags are invalid
1019 !! input
1020 ''[http://example.com text'']
1021 [http://example.com '''text]'''
1022 ''Something [http://example.com in italic'']
1023 ''Something [http://example.com mixed''''', even bold]'''
1024 '''''Now [http://example.com both''''']
1025 !! result
1026 <p><a rel="nofollow" class="external text" href="http://example.com"><i>text</i></a>
1027 <a rel="nofollow" class="external text" href="http://example.com"><b>text</b></a>
1028 <i>Something </i><a rel="nofollow" class="external text" href="http://example.com"><i>in italic</i></a>
1029 <i>Something </i><a rel="nofollow" class="external text" href="http://example.com"><i>mixed</i><b>, even bold</b></a>
1030 <i><b>Now </b></i><a rel="nofollow" class="external text" href="http://example.com"><i><b>both</b></i></a>
1031 </p>
1032 !! end
1035 !! test
1036 Bug 4781: %26 in URL
1037 !! input
1038 http://www.example.com/?title=AT%26T
1039 !! result
1040 <p><a rel="nofollow" class="external free" href="http://www.example.com/?title=AT%26T">http://www.example.com/?title=AT%26T</a>
1041 </p>
1042 !! end
1044 !! test
1045 Bug 4781, 5267: %26 in URL
1046 !! input
1047 http://www.example.com/?title=100%25_Bran
1048 !! result
1049 <p><a rel="nofollow" class="external free" href="http://www.example.com/?title=100%25_Bran">http://www.example.com/?title=100%25_Bran</a>
1050 </p>
1051 !! end
1053 !! test
1054 Bug 4781, 5267: %28, %29 in URL
1055 !! input
1056 http://www.example.com/?title=Ben-Hur_%281959_film%29
1057 !! result
1058 <p><a rel="nofollow" class="external free" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">http://www.example.com/?title=Ben-Hur_%281959_film%29</a>
1059 </p>
1060 !! end
1063 !! test
1064 Bug 4781: %26 in autonumber URL
1065 !! input
1066 [http://www.example.com/?title=AT%26T]
1067 !! result
1068 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=AT%26T">[1]</a>
1069 </p>
1070 !! end
1072 !! test
1073 Bug 4781, 5267: %26 in autonumber URL
1074 !! input
1075 [http://www.example.com/?title=100%25_Bran]
1076 !! result
1077 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=100%25_Bran">[1]</a>
1078 </p>
1079 !! end
1081 !! test
1082 Bug 4781, 5267: %28, %29 in autonumber URL
1083 !! input
1084 [http://www.example.com/?title=Ben-Hur_%281959_film%29]
1085 !! result
1086 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">[1]</a>
1087 </p>
1088 !! end
1091 !! test
1092 Bug 4781: %26 in bracketed URL
1093 !! input
1094 [http://www.example.com/?title=AT%26T link]
1095 !! result
1096 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=AT%26T">link</a>
1097 </p>
1098 !! end
1100 !! test
1101 Bug 4781, 5267: %26 in bracketed URL
1102 !! input
1103 [http://www.example.com/?title=100%25_Bran link]
1104 !! result
1105 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=100%25_Bran">link</a>
1106 </p>
1107 !! end
1109 !! test
1110 Bug 4781, 5267: %28, %29 in bracketed URL
1111 !! input
1112 [http://www.example.com/?title=Ben-Hur_%281959_film%29 link]
1113 !! result
1114 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">link</a>
1115 </p>
1116 !! end
1118 !! test
1119 External link containing double-single-quotes in text '' (bug 4598 sanity check)
1120 !! input
1121 Some [http://example.com/ pretty ''italics'' and stuff]!
1122 !! result
1123 <p>Some <a rel="nofollow" class="external text" href="http://example.com/">pretty <i>italics</i> and stuff</a>!
1124 </p>
1125 !! end
1127 !! test
1128 External link containing double-single-quotes in text embedded in italics (bug 4598 sanity check)
1129 !! input
1130 ''Some [http://example.com/ pretty ''italics'' and stuff]!''
1131 !! result
1132 <p><i>Some </i><a rel="nofollow" class="external text" href="http://example.com/"><i>pretty </i>italics<i> and stuff</i></a><i>!</i>
1133 </p>
1134 !! end
1136 !! test
1137 External link containing double-single-quotes with no space separating the url from text in italics
1138 !! input
1139 [http://www.musee-picasso.fr/pages/page_id18528_u1l2.htm''La muerte de Casagemas'' (1901) en el sitio de [[Museo Picasso (París)|Museo Picasso]].]
1140 !! result
1141 <p><a rel="nofollow" class="external text" href="http://www.musee-picasso.fr/pages/page_id18528_u1l2.htm"><i>La muerte de Casagemas</i> (1901) en el sitio de <a href="/index.php?title=Museo_Picasso_(Par%C3%ADs)&amp;action=edit&amp;redlink=1" class="new" title="Museo Picasso (París) (page does not exist)">Museo Picasso</a>.</a>
1142 </p>
1143 !! end
1145 !! test
1146 URL-encoding in URL functions (single parameter)
1147 !! input
1148 {{localurl:Some page|amp=&}}
1149 !! result
1150 <p>/index.php?title=Some_page&amp;amp=&amp;
1151 </p>
1152 !! end
1154 !! test
1155 URL-encoding in URL functions (multiple parameters)
1156 !! input
1157 {{localurl:Some page|q=?&amp=&}}
1158 !! result
1159 <p>/index.php?title=Some_page&amp;q=?&amp;amp=&amp;
1160 </p>
1161 !! end
1164 ### Quotes
1167 !! test
1168 Quotes
1169 !! input
1170 Normal text. '''Bold text.''' Normal text. ''Italic text.''
1172 Normal text. '''''Bold italic text.''''' Normal text.
1173 !!result
1174 <p>Normal text. <b>Bold text.</b> Normal text. <i>Italic text.</i>
1175 </p><p>Normal text. <i><b>Bold italic text.</b></i> Normal text.
1176 </p>
1177 !! end
1180 !! test
1181 Unclosed and unmatched quotes
1182 !! input
1183 '''''Bold italic text '''with bold deactivated''' in between.'''''
1185 '''''Bold italic text ''with italic deactivated'' in between.'''''
1187 '''Bold text..
1189 ..spanning two paragraphs (should not work).'''
1191 '''Bold tag left open
1193 ''Italic tag left open
1195 Normal text.
1197 <!-- Unmatching number of opening, closing tags: -->
1198 '''This year''''s election ''should'' beat '''last year''''s.
1200 ''Tom'''s car is bigger than ''Susan'''s.
1201 !! result
1202 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
1203 </p><p><b><i>Bold italic text </i>with italic deactivated<i> in between.</i></b>
1204 </p><p><b>Bold text..</b>
1205 </p><p>..spanning two paragraphs (should not work).
1206 </p><p><b>Bold tag left open</b>
1207 </p><p><i>Italic tag left open</i>
1208 </p><p>Normal text.
1209 </p><p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
1210 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
1211 </p>
1212 !! end
1215 ### Tables
1217 ### some content taken from http://meta.wikimedia.org/wiki/MediaWiki_User%27s_Guide:_Using_tables
1220 # This should not produce <table></table> as <table><tr><td></td></tr></table>
1221 # is the bare minimun required by the spec, see:
1222 # http://www.w3.org/TR/xhtml-modularization/dtd_module_defs.html#a_module_Basic_Tables
1223 !! test
1224 A table with no data.
1225 !! input
1226 {||}
1227 !! result
1228 !! end
1230 # A table with nothing but a caption is invalid XHTML, we might want to render
1231 # this as <p>caption</p>
1232 !! test
1233 A table with nothing but a caption
1234 !! input 
1236 |+ caption
1238 !! result
1239 <table>
1240 <caption>caption
1241 </caption>
1242 <tr><td></td></tr>
1243 </table>
1245 !! end
1247 !! test
1248 Simple table
1249 !! input
1250 {| 
1251 | 1 || 2
1252 |- 
1253 | 3 || 4
1255 !! result
1256 <table>
1257 <tr>
1258 <td>1
1259 </td>
1260 <td>2
1261 </td>
1262 </tr>
1263 <tr>
1264 <td>3
1265 </td>
1266 <td>4
1267 </td>
1268 </tr>
1269 </table>
1271 !! end
1273 !! test
1274 Table inside unclosed table w/o cells
1275 !! input
1277 {| 
1278 | foo bar
1281 !! result
1282 <table>
1283 <tr>
1284 <td>
1285 <table>
1286 <tr>
1287 <td>foo bar
1288 </td>
1289 </tr>
1290 </table>
1291 <p><br />
1292 </p>
1293 </td>
1294 </tr>
1295 </table>
1297 !! end
1299 !! test
1300 Table with thead
1301 !! input
1302 {| 
1303 ! Number !! Another number
1305 | 1 || 2
1306 |- 
1307 | 3 || 4
1309 !! result
1310 <table>
1311 <thead>
1312 <tr>
1313 <th>Number
1314 </th>
1315 <th>Another number
1316 </th>
1317 </tr></thead>
1318 <tbody>
1319 <tr>
1320 <td>1
1321 </td>
1322 <td>2
1323 </td>
1324 </tr>
1325 <tr>
1326 <td>3
1327 </td>
1328 <td>4
1329 </td>
1330 </tr></tbody>
1331 </table>
1333 !! end
1335 !! test
1336 Table with multiple captions: Only keep first
1337 !! input
1339 |+ caption 1
1340 |+ caption 2
1342 !! result
1343 <table>
1344 <caption>caption 1
1345 </caption>
1346 <tr><td></td></tr>
1347 </table>
1349 !! end
1351 !! test
1352 Table with multiline caption
1353 !! input
1355 |+ caption 1
1356 further caption
1358 !! result
1359 <table>
1360 <caption>caption 1
1361 further caption
1362 </caption>
1363 <tr><td></td></tr>
1364 </table>
1366 !! end
1367 !! test
1368 Table with multiple thead
1369 !! input
1370 {| 
1371 ! Number !! Another number
1373 | 1 || 2
1374 |- 
1375 ! Some other number !! Another number
1377 | 3 || 4
1379 !! result
1380 <table>
1381 <thead>
1382 <tr>
1383 <th>Number
1384 </th>
1385 <th>Another number
1386 </th>
1387 </tr></thead>
1388 <tbody>
1389 <tr>
1390 <td>1
1391 </td>
1392 <td>2
1393 </td>
1394 </tr></tbody>
1395 <thead>
1396 <tr>
1397 <th>Some other number
1398 </th>
1399 <th>Another number
1400 </th>
1401 </tr></thead>
1402 <tbody>
1403 <tr>
1404 <td>3
1405 </td>
1406 <td>4
1407 </td>
1408 </tr></tbody>
1409 </table>
1411 !! end
1412 !! test
1413 Table with thead & tfoot
1414 !! input
1415 {| 
1416 ! Number !! Another number
1418 | 1 || 2
1419 |- 
1420 ! Some other number !! Another number
1422 | 3 || 4
1424 ! Total: 4 !! Total: 6
1426 !! result
1427 <table>
1428 <thead>
1429 <tr>
1430 <th>Number
1431 </th>
1432 <th>Another number
1433 </th>
1434 </tr></thead>
1435 <tbody>
1436 <tr>
1437 <td>1
1438 </td>
1439 <td>2
1440 </td>
1441 </tr></tbody>
1442 <thead>
1443 <tr>
1444 <th>Some other number
1445 </th>
1446 <th>Another number
1447 </th>
1448 </tr></thead>
1449 <tbody>
1450 <tr>
1451 <td>3
1452 </td>
1453 <td>4
1454 </td>
1455 </tr></tbody>
1456 <tfoot>
1457 <tr>
1458 <th>Total: 4
1459 </th>
1460 <th>Total: 6
1461 </th>
1462 </tr></tfoot>
1463 </table>
1465 !! end
1467 !! test
1468 Table have th inside tfoot
1469 !! input
1470 {| 
1471 | cell1 || cell2
1473 ! Footer1 !! Footer2
1475 !! result
1476 <table>
1477 <tbody>
1478 <tr>
1479 <td>cell1
1480 </td>
1481 <td>cell2
1482 </td>
1483 </tr></tbody>
1484 <tfoot>
1485 <tr>
1486 <th>Footer1
1487 </th>
1488 <th>Footer2
1489 </th>
1490 </tr></tfoot>
1491 </table>
1493 !! end
1495 !! test
1496 Table have th inside thead
1497 !! input
1498 {| 
1499 ! Header1 !! Header2
1501 | cell1 || cell2
1503 !! result
1504 <table>
1505 <thead>
1506 <tr>
1507 <th>Header1
1508 </th>
1509 <th>Header2
1510 </th>
1511 </tr></thead>
1512 <tbody>
1513 <tr>
1514 <td>cell1
1515 </td>
1516 <td>cell2
1517 </td>
1518 </tr></tbody>
1519 </table>
1521 !! end
1523 !! test
1524 Table with list inside
1525 !! input
1527 |style="width: 5em; text-align: center"| gives
1528 |style="border: 1px dashed #2F6FAB; padding: 0.5em; margin: 0.5em"|
1529 # Some
1530 # list
1531 # Lorem
1532 # ipsum
1533 # dolor
1535 !! result
1536 <table>
1537 <tr>
1538 <td style="width: 5em; text-align: center">gives
1539 </td>
1540 <td style="border: 1px dashed #2F6FAB; padding: 0.5em; margin: 0.5em">
1541 <ol><li> Some
1542 </li><li> list
1543 </li><li> Lorem
1544 </li><li> ipsum
1545 </li><li> dolor
1546 </li></ol>
1547 </td>
1548 </tr>
1549 </table>
1551 !! end
1552 !! test
1553 Table with broken up list inside
1554 !! input
1556 |style="width: 5em; text-align: center"| gives
1557 |style="border: 1px dashed #2F6FAB; padding: 0.5em; margin: 0.5em"|
1558 # Some
1559 # list
1560 # Lorem
1562 # ipsum
1563 # dolor
1565 !! result
1566 <table>
1567 <tr>
1568 <td style="width: 5em; text-align: center">gives
1569 </td>
1570 <td style="border: 1px dashed #2F6FAB; padding: 0.5em; margin: 0.5em">
1571 <ol><li> Some
1572 </li><li> list
1573 </li><li> Lorem
1574 </li></ol>
1575 <ol><li> ipsum
1576 </li><li> dolor
1577 </li></ol>
1578 </td>
1579 </tr>
1580 </table>
1582 !! end
1584 !! test
1585 Indented table wrapped in html tags (Related to Bug 26362)
1586 !! input
1587 <div>
1590 | test
1591 |}</div>
1593 !! result
1594 <div>
1595 <dl><dd><table>
1596 <tr>
1597 <td>test
1598 </td>
1599 </tr>
1600 </table></dd></dl></div>
1602 !! end
1604 !! test
1605 Table with multiline contents
1606 !! input
1608 | Alice
1610 dfdfg
1613 !! result
1614 <table>
1615 <tr>
1616 <td>Alice
1617 <p>Bob
1618 dfdfg
1620 </p>
1621 </td>
1622 </tr>
1623 </table>
1625 !! end
1627 !! test
1628 Multiplication table
1629 !! input
1630 {| border="1" cellpadding="2"
1631 |+Multiplication table
1633 ! &times; !! 1 !! 2 !! 3
1635 ! 1
1636 | 1 || 2 || 3
1638 ! 2
1639 | 2 || 4 || 6
1641 ! 3
1642 | 3 || 6 || 9
1644 ! 4
1645 | 4 || 8 || 12
1647 ! 5
1648 | 5 || 10 || 15
1650 !! result
1651 <table border="1" cellpadding="2">
1652 <caption>Multiplication table
1653 </caption>
1654 <thead>
1655 <tr>
1656 <th>&#215;
1657 </th>
1658 <th>1
1659 </th>
1660 <th>2
1661 </th>
1662 <th>3
1663 </th>
1664 </tr></thead>
1665 <tbody>
1666 <tr>
1667 <th>1
1668 </th>
1669 <td>1
1670 </td>
1671 <td>2
1672 </td>
1673 <td>3
1674 </td>
1675 </tr>
1676 <tr>
1677 <th>2
1678 </th>
1679 <td>2
1680 </td>
1681 <td>4
1682 </td>
1683 <td>6
1684 </td>
1685 </tr>
1686 <tr>
1687 <th>3
1688 </th>
1689 <td>3
1690 </td>
1691 <td>6
1692 </td>
1693 <td>9
1694 </td>
1695 </tr>
1696 <tr>
1697 <th>4
1698 </th>
1699 <td>4
1700 </td>
1701 <td>8
1702 </td>
1703 <td>12
1704 </td>
1705 </tr>
1706 <tr>
1707 <th>5
1708 </th>
1709 <td>5
1710 </td>
1711 <td>10
1712 </td>
1713 <td>15
1714 </td>
1715 </tr></tbody>
1716 </table>
1718 !! end
1720 !! test
1721 Table rowspan
1722 !! input
1723 {| align=right border=1
1724 | Cell 1, row 1 
1725 |rowspan=2| Cell 2, row 1 (and 2) 
1726 | Cell 3, row 1 
1727 |- 
1728 | Cell 1, row 2 
1729 | Cell 3, row 2 
1731 !! result
1732 <table align="right" border="1">
1733 <tr>
1734 <td>Cell 1, row 1
1735 </td>
1736 <td rowspan="2">Cell 2, row 1 (and 2)
1737 </td>
1738 <td>Cell 3, row 1
1739 </td>
1740 </tr>
1741 <tr>
1742 <td>Cell 1, row 2
1743 </td>
1744 <td>Cell 3, row 2
1745 </td>
1746 </tr>
1747 </table>
1749 !! end
1751 !! test
1752 Nested table
1753 !! input
1754 {| border=1
1755 | &alpha;
1757 {| bgcolor=#ABCDEF border=2
1758 |nested
1760 |table
1762 |the original table again
1764 !! result
1765 <table border="1">
1766 <tr>
1767 <td>&#945;
1768 </td>
1769 <td>
1770 <table bgcolor="#ABCDEF" border="2">
1771 <tr>
1772 <td>nested
1773 </td>
1774 </tr>
1775 <tr>
1776 <td>table
1777 </td>
1778 </tr>
1779 </table>
1780 </td>
1781 <td>the original table again
1782 </td>
1783 </tr>
1784 </table>
1786 !! end
1788 !! test
1789 Invalid attributes in table cell (bug 1830)
1790 !! input
1792 |Cell:|broken
1794 !! result
1795 <table>
1796 <tr>
1797 <td>broken
1798 </td>
1799 </tr>
1800 </table>
1802 !! end
1804 !! test
1805 Heading inside table (affected by r85922)
1806 !! input
1808 |- valign="top"
1810 === Heading ===
1812 !! result
1813 <table>
1814 <tr valign="top">
1815 <td>
1816 <h3><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: Heading">edit</a>]</span> <span class="mw-headline" id="Heading"> Heading </span></h3>
1817 </td>
1818 </tr>
1819 </table>
1821 !! end
1823 !! test
1824 A table with a caption with unclosed italic
1825 !! input 
1827 |+ ''caption
1828 |  Cell
1830 !! result
1831 <table>
1832 <caption><i>caption</i>
1833 </caption>
1834 <tr>
1835 <td>Cell
1836 </td>
1837 </tr>
1838 </table>
1840 !! end
1842 !! test
1843 A table with unclosed italic in a cell
1844 !! input 
1846 | ''Cell
1848 !! result
1849 <table>
1850 <tr>
1851 <td><i>Cell</i>
1852 </td>
1853 </tr>
1854 </table>
1856 !! end
1858 !! test
1859 A table with unclosed italic in a th
1860 !! input
1863 ! ''Cell
1864 || Value
1866 !! result
1867 <table>
1868 <tr>
1869 <th><i>Cell</i>
1870 </th>
1871 <td>Value
1872 </td>
1873 </tr>
1874 </table>
1876 !! end
1878 !! test
1879 Table security: embedded pipes (http://lists.wikimedia.org/mailman/htdig/wikitech-l/2006-April/022293.html)
1880 !! input
1882 | |[ftp://|x||]" onmouseover="alert(document.cookie)">test
1883 !! result
1884 <table>
1885 <tr>
1886 <td>[<a rel="nofollow" class="external free" href="ftp://%7Cx">ftp://%7Cx</a>
1887 </td>
1888 <td>]" onmouseover="alert(document.cookie)"&gt;test
1889 </td>
1890 </tr>
1891 </table>
1893 !! end
1895 !! test
1896 Indented Tables, bug 20078
1897 !! input
1898 : {| 
1899 | 1 || 2
1900 |- 
1901 | 3 || 4
1903 !! result
1904 <dl><dd><table>
1905 <tr>
1906 <td>1
1907 </td>
1908 <td>2
1909 </td>
1910 </tr>
1911 <tr>
1912 <td>3
1913 </td>
1914 <td>4
1915 </td>
1916 </tr>
1917 </table></dd></dl>
1919 !! end
1921 !! test
1922 Arbitrary whitespace should not be prepended
1923 !! input
1924 {| 
1925 | 1 || 2
1927 |- 
1930 | 3 || 4
1933 | 6 || 8
1935 !! result
1936 <table>
1937 <tr>
1938 <td>1
1939 </td>
1940 <td>2
1941 <p><br />
1942 </p>
1943 </td>
1944 </tr>
1945 <tr>
1946 <td>3
1947 </td>
1948 <td>4
1949 </td>
1950 </tr>
1951 <tr>
1952 <td>6
1953 </td>
1954 <td>8
1955 </td>
1956 </tr>
1957 </table>
1959 !! end
1963 ### Internal links
1965 !! test
1966 Plain link, capitalized
1967 !! input
1968 [[Main Page]]
1969 !! result
1970 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
1971 </p>
1972 !! end
1974 !! test
1975 Plain link, uncapitalized
1976 !! input
1977 [[main Page]]
1978 !! result
1979 <p><a href="/wiki/Main_Page" title="Main Page">main Page</a>
1980 </p>
1981 !! end
1983 !! test
1984 Piped link
1985 !! input
1986 [[Main Page|The Main Page]]
1987 !! result
1988 <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
1989 </p>
1990 !! end
1992 !! test
1993 Broken link
1994 !! input
1995 [[Zigzagzogzagzig]]
1996 !! result
1997 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig</a>
1998 </p>
1999 !! end
2001 !! test
2002 Broken link with fragment
2003 !! input
2004 [[Zigzagzogzagzig#zug]]
2005 !! result
2006 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig#zug</a>
2007 </p>
2008 !! end
2010 !! test
2011 Special page link with fragment
2012 !! input
2013 [[Special:Version#anchor]]
2014 !! result
2015 <p><a href="/wiki/Special:Version#anchor" title="Special:Version">Special:Version#anchor</a>
2016 </p>
2017 !! end
2019 !! test
2020 Nonexistent special page link with fragment
2021 !! input
2022 [[Special:ThisNameWillHopefullyNeverBeUsed#anchor]]
2023 !! result
2024 <p><a href="/wiki/Special:ThisNameWillHopefullyNeverBeUsed" class="new" title="Special:ThisNameWillHopefullyNeverBeUsed (page does not exist)">Special:ThisNameWillHopefullyNeverBeUsed#anchor</a>
2025 </p>
2026 !! end
2028 !! test
2029 Link with prefix
2030 !! input
2031 xxx[[main Page]], xxx[[Main Page]], Xxx[[main Page]] XXX[[main Page]], XXX[[Main Page]]
2032 !! result
2033 <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>
2034 </p>
2035 !! end
2037 !! test
2038 Link with suffix
2039 !! input
2040 [[Main Page]]xxx, [[Main Page]]XXX, [[Main Page]]!!!
2041 !! result
2042 <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>!!!
2043 </p>
2044 !! end
2046 !! test
2047 Link with 3 brackets
2048 !! input
2049 [[[main page]]]
2050 !! result
2051 <p>[[[main page]]]
2052 </p>
2053 !! end
2055 !! test
2056 Piped link with 3 brackets
2057 !! input
2058 [[[main page|the main page]]]
2059 !! result
2060 <p>[[[main page|the main page]]]
2061 </p>
2062 !! end
2064 !! test
2065 Link with multiple pipes
2066 !! input
2067 [[Main Page|The|Main|Page]]
2068 !! result
2069 <p><a href="/wiki/Main_Page" title="Main Page">The|Main|Page</a>
2070 </p>
2071 !! end
2073 !! test
2074 Link to namespaces
2075 !! input
2076 [[Talk:Parser testing]], [[Meta:Disclaimers]]
2077 !! result
2078 <p><a href="/index.php?title=Talk:Parser_testing&amp;action=edit&amp;redlink=1" class="new" title="Talk:Parser testing (page does not exist)">Talk:Parser testing</a>, <a href="/index.php?title=Meta:Disclaimers&amp;action=edit&amp;redlink=1" class="new" title="Meta:Disclaimers (page does not exist)">Meta:Disclaimers</a>
2079 </p>
2080 !! end
2082 !! test
2083 Piped link to namespace
2084 !! input
2085 [[Meta:Disclaimers|The disclaimers]]
2086 !! result
2087 <p><a href="/index.php?title=Meta:Disclaimers&amp;action=edit&amp;redlink=1" class="new" title="Meta:Disclaimers (page does not exist)">The disclaimers</a>
2088 </p>
2089 !! end
2091 !! test
2092 Link containing }
2093 !! input
2094 [[Usually caused by a typo (oops}]]
2095 !! result
2096 <p>[[Usually caused by a typo (oops}]]
2097 </p>
2098 !! end
2100 !! test
2101 Link containing % (not as a hex sequence)
2102 !! input
2103 [[7% Solution]]
2104 !! result
2105 <p><a href="/index.php?title=7%25_Solution&amp;action=edit&amp;redlink=1" class="new" title="7% Solution (page does not exist)">7% Solution</a>
2106 </p>
2107 !! end
2109 !! test
2110 Link containing % as a single hex sequence interpreted to char
2111 !! input
2112 [[7%25 Solution]]
2113 !! result
2114 <p><a href="/index.php?title=7%25_Solution&amp;action=edit&amp;redlink=1" class="new" title="7% Solution (page does not exist)">7% Solution</a>
2115 </p>
2116 !!end
2118 !! test
2119 Link containing % as a double hex sequence interpreted to hex sequence
2120 !! input
2121 [[7%2525 Solution]]
2122 !! result
2123 <p>[[7%2525 Solution]]
2124 </p>
2125 !!end
2127 !! test
2128 Link containing "#<" and "#>" % as a hex sequences- these are valid section anchors
2129 Example for such a section: == < ==
2130 !! input
2131 [[%23%3c]][[%23%3e]]
2132 !! result
2133 <p><a href="#.3C">#&lt;</a><a href="#.3E">#&gt;</a>
2134 </p>
2135 !! end
2137 !! test
2138 Link containing "<#" and ">#" as a hex sequences
2139 !! input
2140 [[%3c%23]][[%3e%23]]
2141 !! result
2142 <p>[[%3c%23]][[%3e%23]]
2143 </p>
2144 !! end
2146 !! test
2147 Link containing double-single-quotes '' (bug 4598)
2148 !! input
2149 [[Lista d''e paise d''o munno]]
2150 !! result
2151 <p><a href="/index.php?title=Lista_d%27%27e_paise_d%27%27o_munno&amp;action=edit&amp;redlink=1" class="new" title="Lista d''e paise d''o munno (page does not exist)">Lista d''e paise d''o munno</a>
2152 </p>
2153 !! end
2155 !! test
2156 Link containing double-single-quotes '' in text (bug 4598 sanity check)
2157 !! input
2158 Some [[Link|pretty ''italics'' and stuff]]!
2159 !! result
2160 <p>Some <a href="/index.php?title=Link&amp;action=edit&amp;redlink=1" class="new" title="Link (page does not exist)">pretty <i>italics</i> and stuff</a>!
2161 </p>
2162 !! end
2164 !! test
2165 Link containing double-single-quotes '' in text embedded in italics (bug 4598 sanity check)
2166 !! input
2167 ''Some [[Link|pretty ''italics'' and stuff]]!
2168 !! result
2169 <p><i>Some <a href="/index.php?title=Link&amp;action=edit&amp;redlink=1" class="new" title="Link (page does not exist)">pretty <i>italics</i> and stuff</a>!</i>
2170 </p>
2171 !! end
2173 !! test
2174 Link with double quotes in title part (literal) and alternate part (interpreted)
2175 !! input
2176 [[File:Denys Savchenko ''Pentecoste''.jpg]]
2178 [[''Pentecoste'']]
2180 [[''Pentecoste''|Pentecoste]]
2182 [[''Pentecoste''|''Pentecoste'']]
2183 !! result
2184 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=Denys_Savchenko_%27%27Pentecoste%27%27.jpg" class="new" title="File:Denys Savchenko &#39;&#39;Pentecoste&#39;&#39;.jpg">File:Denys Savchenko <i>Pentecoste</i>.jpg</a>
2185 </p><p><a href="/index.php?title=%27%27Pentecoste%27%27&amp;action=edit&amp;redlink=1" class="new" title="''Pentecoste'' (page does not exist)">''Pentecoste''</a>
2186 </p><p><a href="/index.php?title=%27%27Pentecoste%27%27&amp;action=edit&amp;redlink=1" class="new" title="''Pentecoste'' (page does not exist)">Pentecoste</a>
2187 </p><p><a href="/index.php?title=%27%27Pentecoste%27%27&amp;action=edit&amp;redlink=1" class="new" title="''Pentecoste'' (page does not exist)"><i>Pentecoste</i></a>
2188 </p>
2189 !! end
2191 !! test
2192 Plain link to URL
2193 !! input
2194 [[http://www.example.com]]
2195 !! result
2196 <p>[<a rel="nofollow" class="external autonumber" href="http://www.example.com">[1]</a>]
2197 </p>
2198 !! end
2200 # I'm fairly sure the expected result here is wrong.
2201 # We want these to be URL links, not pseudo-pages with URLs for titles....
2202 # However the current output is also pretty screwy.
2204 # ----
2205 # I'm changing it to match the current output--it arguably makes more
2206 # sense in the light of the test above. Old expected result was:
2207 #<p>Piped link to URL: <a href="/index.php?title=Http://www.example.com&amp;action=edit" class="new">an example URL</a>
2208 #</p>
2209 # But I think this test is bordering on "garbage in, garbage out" anyway.
2210 # -- wtm
2211 !! test
2212 Piped link to URL
2213 !! input
2214 Piped link to URL: [[http://www.example.com|an example URL]]
2215 !! result
2216 <p>Piped link to URL: [<a rel="nofollow" class="external text" href="http://www.example.com%7Can">example URL</a>]
2217 </p>
2218 !! end
2220 !! test
2221 BUG 2: [[page|http://url/]] should link to page, not http://url/
2222 !! input
2223 [[Main Page|http://url/]]
2224 !! result
2225 <p><a href="/wiki/Main_Page" title="Main Page">http://url/</a>
2226 </p>
2227 !! end
2229 !! test
2230 BUG 337: Escaped self-links should be bold
2231 !! options
2232 title=[[Bug462]]
2233 !! input
2234 [[Bu&#103;462]] [[Bug462]]
2235 !! result
2236 <p><strong class="selflink">Bu&#103;462</strong> <strong class="selflink">Bug462</strong>
2237 </p>
2238 !! end
2240 !! test
2241 Self-link to section should not be bold
2242 !! options
2243 title=[[Main Page]]
2244 !! input
2245 [[Main Page#section]]
2246 !! result
2247 <p><a href="/wiki/Main_Page#section" title="Main Page">Main Page#section</a>
2248 </p>
2249 !! end
2251 !! article
2253 !! text
2254 This is 00.
2255 !! endarticle
2257 !!test
2258 Self-link to numeric title
2259 !!options
2260 title=[[0]]
2261 !!input
2262 [[0]]
2263 !!result
2264 <p><strong class="selflink">0</strong>
2265 </p>
2266 !!end
2268 !!test
2269 Link to numeric-equivalent title
2270 !!options
2271 title=[[0]]
2272 !!input
2273 [[00]]
2274 !!result
2275 <p><a href="/wiki/00" title="00">00</a>
2276 </p>
2277 !!end
2279 !! test
2280 <nowiki> inside a link
2281 !! input
2282 [[Main<nowiki> Page</nowiki>]] [[Main Page|the main page <nowiki>[it's not very good]</nowiki>]]
2283 !! result
2284 <p>[[Main Page]] <a href="/wiki/Main_Page" title="Main Page">the main page [it's not very good]</a>
2285 </p>
2286 !! end
2288 !! test
2289 Non-breaking spaces in title
2290 !! input
2291 [[&nbsp; Main &nbsp; Page &nbsp;]]
2292 !! result
2293 <p><a href="/wiki/Main_Page" title="Main Page">&#160; Main &#160; Page &#160;</a>
2294 </p>
2295 !!end
2297 !! test
2298 Internal link with ca linktrail, surrounded by bold apostrophes (bug 27473 primary issue)
2299 !! options
2300 language=ca
2301 !! input
2302 '''[[Main Page]]'''
2303 !! result
2304 <p><b><a href="/wiki/Main_Page" title="Main Page">Main Page</a></b>
2305 </p>
2306 !! end
2308 !! test
2309 Internal link with ca linktrail, surrounded by italic apostrophes (bug 27473 primary issue)
2310 !! options
2311 language=ca
2312 !! input
2313 ''[[Main Page]]''
2314 !! result
2315 <p><i><a href="/wiki/Main_Page" title="Main Page">Main Page</a></i>
2316 </p>
2317 !! end
2319 !! test
2320 Internal link with en linktrail: no apostrophes (bug 27473)
2321 !! options
2322 language=en
2323 !! input
2324 [[Something]]'nice
2325 !! result
2326 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (page does not exist)">Something</a>'nice
2327 </p>
2328 !! end
2330 !! test
2331 Internal link with ca linktrail with apostrophes (bug 27473)
2332 !! options
2333 language=ca
2334 !! input
2335 [[Something]]'nice
2336 !! result
2337 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (encara no existeix)">Something'nice</a>
2338 </p>
2339 !! end
2341 !! test
2342 Internal link with kaa linktrail with apostrophes (bug 27473)
2343 !! options
2344 language=kaa
2345 !! input
2346 [[Something]]'nice
2347 !! result
2348 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (bet ele jaratılmag'an)">Something'nice</a>
2349 </p>
2350 !! end
2353 ### Interwiki links (see maintenance/interwiki.sql)
2356 !! test
2357 Inline interwiki link
2358 !! input
2359 [[MeatBall:SoftSecurity]]
2360 !! result
2361 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity</a>
2362 </p>
2363 !! end
2365 !! test
2366 Inline interwiki link with empty title (bug 2372)
2367 !! input
2368 [[MeatBall:]]
2369 !! result
2370 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?" class="extiw" title="meatball:">MeatBall:</a>
2371 </p>
2372 !! end
2374 !! test
2375 Interwiki link encoding conversion (bug 1636)
2376 !! input
2377 *[[Wikipedia:ro:Olteni&#0355;a]]
2378 *[[Wikipedia:ro:Olteni&#355;a]]
2379 !! result
2380 <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>
2381 </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>
2382 </li></ul>
2384 !! end
2386 !! test
2387 Interwiki link with fragment (bug 2130)
2388 !! input
2389 [[MeatBall:SoftSecurity#foo]]
2390 !! result
2391 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity#foo" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity#foo</a>
2392 </p>
2393 !! end
2395 !! test
2396 Interlanguage link
2397 !! input
2398 Blah blah blah
2399 [[zh:Chinese]]
2400 !!result
2401 <p>Blah blah blah
2402 </p>
2403 !! end
2405 !! test
2406 Double interlanguage link
2407 !! input
2408 Blah blah blah
2409 [[es:Spanish]]
2410 [[zh:Chinese]]
2411 !!result
2412 <p>Blah blah blah
2413 </p>
2414 !! end
2416 !! test
2417 Interlanguage link, with prefix links
2418 !! options
2419 language=ln
2420 !! input
2421 Blah blah blah
2422 [[zh:Chinese]]
2423 !!result
2424 <p>Blah blah blah
2425 </p>
2426 !! end
2428 !! test
2429 Double interlanguage link, with prefix links (bug 8897)
2430 !! options
2431 language=ln
2432 !! input
2433 Blah blah blah
2434 [[es:Spanish]]
2435 [[zh:Chinese]]
2436 !!result
2437 <p>Blah blah blah
2438 </p>
2439 !! end
2443 ## XHTML tidiness
2446 !! test
2447 <br> to <br />
2448 !! input
2449 1<br>2<br />3
2450 !! result
2451 <p>1<br />2<br />3
2452 </p>
2453 !! end
2455 !! test
2456 Incorrecly removing closing slashes from correctly formed XHTML
2457 !! input
2458 <br style="clear:both;" />
2459 !! result
2460 <p><br style="clear:both;" />
2461 </p>
2462 !! end
2464 !! test 
2465 Failing to transform badly formed HTML into correct XHTML
2466 !! input
2467 <br clear=left>
2468 <br clear=right>
2469 <br clear=all>
2470 !! result
2471 <p><br clear="left" />
2472 <br clear="right" />
2473 <br clear="all" />
2474 </p>
2475 !!end
2477 !! test 
2478 Horizontal ruler (should it add that extra space?)
2479 !! input 
2480 <hr>
2481 <hr >
2482 foo <hr
2483 > bar
2484 !! result 
2485 <hr />
2486 <hr />
2487 foo <hr /> bar
2489 !! end
2492 ### Block-level elements
2494 !! test
2495 Common list
2496 !! input
2497 *Common list
2498 * item 2
2499 *item 3
2500 !! result
2501 <ul><li>Common list
2502 </li><li> item 2
2503 </li><li>item 3
2504 </li></ul>
2506 !! end
2508 !! test
2509 Numbered list
2510 !! input
2511 #Numbered list
2512 #item 2
2513 # item 3
2514 !! result
2515 <ol><li>Numbered list
2516 </li><li>item 2
2517 </li><li> item 3
2518 </li></ol>
2520 !! end
2522 !! test
2523 Mixed list
2524 !! input
2525 *Mixed list
2526 *# with numbers
2527 ** and bullets
2528 *# and numbers
2529 *bullets again
2530 **bullet level 2
2531 ***bullet level 3
2532 ***#Number on level 4
2533 **bullet level 2
2534 **#Number on level 3
2535 **#Number on level 3
2536 *#number level 2
2537 *Level 1
2538 !! result
2539 <ul><li>Mixed list
2540 <ol><li> with numbers
2541 </li></ol>
2542 <ul><li> and bullets
2543 </li></ul>
2544 <ol><li> and numbers
2545 </li></ol>
2546 </li><li>bullets again
2547 <ul><li>bullet level 2
2548 <ul><li>bullet level 3
2549 <ol><li>Number on level 4
2550 </li></ol>
2551 </li></ul>
2552 </li><li>bullet level 2
2553 <ol><li>Number on level 3
2554 </li><li>Number on level 3
2555 </li></ol>
2556 </li></ul>
2557 <ol><li>number level 2
2558 </li></ol>
2559 </li><li>Level 1
2560 </li></ul>
2562 !! end
2564 !! test
2565 List items are not parsed correctly following a <pre> block (bug 785)
2566 !! input
2567 * <pre>foo</pre>
2568 * <pre>bar</pre>
2569 * zar
2570 !! result
2571 <ul><li> <pre>foo</pre>
2572 </li><li> <pre>bar</pre>
2573 </li><li> zar
2574 </li></ul>
2576 !! end
2579 ### Magic Words
2582 !! test
2583 Magic Word: {{CURRENTDAY}}
2584 !! input
2585 {{CURRENTDAY}}
2586 !! result
2587 <p>1
2588 </p>
2589 !! end
2591 !! test
2592 Magic Word: {{CURRENTDAY2}}
2593 !! input
2594 {{CURRENTDAY2}}
2595 !! result
2596 <p>01
2597 </p>
2598 !! end
2600 !! test
2601 Magic Word: {{CURRENTDAYNAME}}
2602 !! input
2603 {{CURRENTDAYNAME}}
2604 !! result
2605 <p>Thursday
2606 </p>
2607 !! end
2609 !! test
2610 Magic Word: {{CURRENTDOW}}
2611 !! input
2612 {{CURRENTDOW}}
2613 !! result
2614 <p>4
2615 </p>
2616 !! end
2618 !! test
2619 Magic Word: {{CURRENTMONTH}}
2620 !! input
2621 {{CURRENTMONTH}}
2622 !! result
2623 <p>01
2624 </p>
2625 !! end
2627 !! test
2628 Magic Word: {{CURRENTMONTHABBREV}}
2629 !! input
2630 {{CURRENTMONTHABBREV}}
2631 !! result
2632 <p>Jan
2633 </p>
2634 !! end
2636 !! test
2637 Magic Word: {{CURRENTMONTHNAME}}
2638 !! input
2639 {{CURRENTMONTHNAME}}
2640 !! result
2641 <p>January
2642 </p>
2643 !! end
2645 !! test
2646 Magic Word: {{CURRENTMONTHNAMEGEN}}
2647 !! input
2648 {{CURRENTMONTHNAMEGEN}}
2649 !! result
2650 <p>January
2651 </p>
2652 !! end
2654 !! test
2655 Magic Word: {{CURRENTTIME}}
2656 !! input
2657 {{CURRENTTIME}}
2658 !! result
2659 <p>00:02
2660 </p>
2661 !! end
2663 !! test
2664 Magic Word: {{CURRENTWEEK}} (@bug 4594)
2665 !! input
2666 {{CURRENTWEEK}}
2667 !! result
2668 <p>1
2669 </p>
2670 !! end
2672 !! test
2673 Magic Word: {{CURRENTYEAR}}
2674 !! input
2675 {{CURRENTYEAR}}
2676 !! result
2677 <p>1970
2678 </p>
2679 !! end
2681 !! test
2682 Magic Word: {{FULLPAGENAME}}
2683 !! options
2684 title=[[User:Ævar Arnfjörð Bjarmason]]
2685 !! input
2686 {{FULLPAGENAME}}
2687 !! result
2688 <p>User:Ævar Arnfjörð Bjarmason
2689 </p>
2690 !! end
2692 !! test
2693 Magic Word: {{FULLPAGENAMEE}}
2694 !! options
2695 title=[[User:Ævar Arnfjörð Bjarmason]]
2696 !! input
2697 {{FULLPAGENAMEE}}
2698 !! result
2699 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
2700 </p>
2701 !! end
2703 !! test
2704 Magic Word: {{NAMESPACE}}
2705 !! options
2706 title=[[User:Ævar Arnfjörð Bjarmason]]
2707 !! input
2708 {{NAMESPACE}}
2709 !! result
2710 <p>User
2711 </p>
2712 !! end
2714 !! test
2715 Magic Word: {{NAMESPACEE}}
2716 !! options
2717 title=[[User:Ævar Arnfjörð Bjarmason]]
2718 !! input
2719 {{NAMESPACEE}}
2720 !! result
2721 <p>User
2722 </p>
2723 !! end
2725 !! test
2726 Magic Word: {{NUMBEROFFILES}}
2727 !! input
2728 {{NUMBEROFFILES}}
2729 !! result
2730 <p>2
2731 </p>
2732 !! end
2734 !! test
2735 Magic Word: {{PAGENAME}}
2736 !! options
2737 title=[[User:Ævar Arnfjörð Bjarmason]]
2738 !! input
2739 {{PAGENAME}}
2740 !! result
2741 <p>Ævar Arnfjörð Bjarmason
2742 </p>
2743 !! end
2745 !! test
2746 Magic Word: {{PAGENAME}} with metacharacters
2747 !! options
2748 title=[['foo & bar = baz']]
2749 !! input
2750 ''{{PAGENAME}}''
2751 !! result
2752 <p><i>&#39;foo &#38; bar &#61; baz&#39;</i>
2753 </p>
2754 !! end
2756 !! test
2757 Magic Word: {{PAGENAME}} with metacharacters (bug 26781)
2758 !! options
2759 title=[[*RFC 1234 http://example.com/]]
2760 !! input
2761 {{PAGENAME}}
2762 !! result
2763 <p>&#42;RFC&#32;1234 http&#58;//example.com/
2764 </p>
2765 !! end
2767 !! test
2768 Magic Word: {{PAGENAMEE}}
2769 !! options
2770 title=[[User:Ævar Arnfjörð Bjarmason]]
2771 !! input
2772 {{PAGENAMEE}}
2773 !! result
2774 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
2775 </p>
2776 !! end
2778 !! test
2779 Magic Word: {{PAGENAMEE}} with metacharacters (bug 26781)
2780 !! options
2781 title=[[*RFC 1234 http://example.com/]]
2782 !! input
2783 {{PAGENAMEE}}
2784 !! result
2785 <p>&#42;RFC_1234_http&#58;//example.com/
2786 </p>
2787 !! end
2789 !! test
2790 Magic Word: {{REVISIONID}}
2791 !! input
2792 {{REVISIONID}}
2793 !! result
2794 <p>1337
2795 </p>
2796 !! end
2798 !! test
2799 Magic Word: {{SCRIPTPATH}}
2800 !! input
2801 {{SCRIPTPATH}}
2802 !! result
2803 <p>/
2804 </p>
2805 !! end
2807 !! test
2808 Magic Word: {{SERVER}}
2809 !! input
2810 {{SERVER}}
2811 !! result
2812 <p><a rel="nofollow" class="external free" href="http://Britney-Spears">http://Britney-Spears</a>
2813 </p>
2814 !! end
2816 !! test
2817 Magic Word: {{SERVERNAME}}
2818 !! input
2819 {{SERVERNAME}}
2820 !! result
2821 <p>Britney-Spears
2822 </p>
2823 !! end
2825 !! test
2826 Magic Word: {{SITENAME}}
2827 !! input
2828 {{SITENAME}}
2829 !! result
2830 <p>MediaWiki
2831 </p>
2832 !! end
2834 !! test
2835 Namespace 1 {{ns:1}}
2836 !! input
2837 {{ns:1}}
2838 !! result
2839 <p>Talk
2840 </p>
2841 !! end
2843 !! test
2844 Namespace 1 {{ns:01}}
2845 !! input
2846 {{ns:01}}
2847 !! result
2848 <p>Talk
2849 </p>
2850 !! end
2852 !! test
2853 Namespace 0 {{ns:0}} (bug 4783)
2854 !! input
2855 {{ns:0}}
2856 !! result
2858 !! end
2860 !! test
2861 Namespace 0 {{ns:00}} (bug 4783)
2862 !! input
2863 {{ns:00}}
2864 !! result
2866 !! end
2868 !! test
2869 Namespace -1 {{ns:-1}}
2870 !! input
2871 {{ns:-1}}
2872 !! result
2873 <p>Special
2874 </p>
2875 !! end
2877 !! test
2878 Namespace User {{ns:User}}
2879 !! input
2880 {{ns:User}}
2881 !! result
2882 <p>User
2883 </p>
2884 !! end
2886 !! test
2887 Namespace User talk {{ns:User_talk}}
2888 !! input
2889 {{ns:User_talk}}
2890 !! result
2891 <p>User talk
2892 </p>
2893 !! end
2895 !! test
2896 Namespace User talk {{ns:uSeR tAlK}}
2897 !! input
2898 {{ns:uSeR tAlK}}
2899 !! result
2900 <p>User talk
2901 </p>
2902 !! end
2904 !! test
2905 Namespace File {{ns:File}}
2906 !! input
2907 {{ns:File}}
2908 !! result
2909 <p>File
2910 </p>
2911 !! end
2913 !! test
2914 Namespace File {{ns:Image}}
2915 !! input
2916 {{ns:Image}}
2917 !! result
2918 <p>File
2919 </p>
2920 !! end
2922 !! test
2923 Namespace (lang=de) Benutzer {{ns:User}}
2924 !! options
2925 language=de
2926 !! input
2927 {{ns:User}}
2928 !! result
2929 <p>Benutzer
2930 </p>
2931 !! end
2933 !! test
2934 Namespace (lang=de) Benutzer Diskussion {{ns:3}}
2935 !! options
2936 language=de
2937 !! input
2938 {{ns:3}}
2939 !! result
2940 <p>Benutzer Diskussion
2941 </p>
2942 !! end
2945 !! test
2946 Urlencode
2947 !! input
2948 {{urlencode:hi world?!}}
2949 {{urlencode:hi world?!|WIKI}}
2950 {{urlencode:hi world?!|PATH}}
2951 {{urlencode:hi world?!|QUERY}}
2952 !! result
2953 <p>hi+world%3F%21
2954 hi_world%3F!
2955 hi%20world%3F%21
2956 hi+world%3F%21
2957 </p>
2958 !! end
2961 ### Magic links
2963 !! test
2964 Magic links: internal link to RFC (bug 479)
2965 !! input
2966 [[RFC 123]]
2967 !! result
2968 <p><a href="/index.php?title=RFC_123&amp;action=edit&amp;redlink=1" class="new" title="RFC 123 (page does not exist)">RFC 123</a>
2969 </p>
2970 !! end
2972 !! test
2973 Magic links: RFC (bug 479)
2974 !! input
2975 RFC 822
2976 !! result
2977 <p><a class="external mw-magiclink-rfc" href="http://tools.ietf.org/html/rfc822">RFC 822</a>
2978 </p>
2979 !! end
2981 !! test
2982 Magic links: ISBN (bug 1937)
2983 !! input
2984 ISBN 0-306-40615-2
2985 !! result
2986 <p><a href="/wiki/Special:BookSources/0306406152" class="internal mw-magiclink-isbn">ISBN 0-306-40615-2</a>
2987 </p>
2988 !! end
2990 !! test
2991 Magic links: PMID incorrectly converts space to underscore
2992 !! input
2993 PMID 1234
2994 !! result
2995 <p><a class="external mw-magiclink-pmid" href="http://www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a>
2996 </p>
2997 !! end
3000 ### Templates
3001 ####
3003 !! test
3004 Nonexistent template
3005 !! input
3006 {{thistemplatedoesnotexist}}
3007 !! result
3008 <p><a href="/index.php?title=Template:Thistemplatedoesnotexist&amp;action=edit&amp;redlink=1" class="new" title="Template:Thistemplatedoesnotexist (page does not exist)">Template:Thistemplatedoesnotexist</a>
3009 </p>
3010 !! end
3012 !! article
3013 Template:test
3014 !! text
3015 This is a test template
3016 !! endarticle
3018 !! test
3019 Simple template
3020 !! input
3021 {{test}}
3022 !! result
3023 <p>This is a test template
3024 </p>
3025 !! end
3027 !! test
3028 Template with explicit namespace
3029 !! input
3030 {{Template:test}}
3031 !! result
3032 <p>This is a test template
3033 </p>
3034 !! end
3037 !! article
3038 Template:paramtest
3039 !! text
3040 This is a test template with parameter {{{param}}}
3041 !! endarticle
3043 !! test
3044 Template parameter
3045 !! input
3046 {{paramtest|param=foo}}
3047 !! result
3048 <p>This is a test template with parameter foo
3049 </p>
3050 !! end
3052 !! article
3053 Template:paramtestnum
3054 !! text
3055 [[{{{1}}}|{{{2}}}]]
3056 !! endarticle
3058 !! test
3059 Template unnamed parameter
3060 !! input
3061 {{paramtestnum|Main Page|the main page}}
3062 !! result
3063 <p><a href="/wiki/Main_Page" title="Main Page">the main page</a>
3064 </p>
3065 !! end
3067 !! article
3068 Template:templatesimple
3069 !! text
3070 (test)
3071 !! endarticle
3073 !! article
3074 Template:templateredirect
3075 !! text
3076 #redirect [[Template:templatesimple]]
3077 !! endarticle
3079 !! article
3080 Template:templateasargtestnum
3081 !! text
3082 {{{{{1}}}}}
3083 !! endarticle
3085 !! article
3086 Template:templateasargtest
3087 !! text
3088 {{template{{{templ}}}}}
3089 !! endarticle
3091 !! article
3092 Template:templateasargtest2
3093 !! text
3094 {{{{{templ}}}}}
3095 !! endarticle
3097 !! test
3098 Template with template name as unnamed argument
3099 !! input
3100 {{templateasargtestnum|templatesimple}}
3101 !! result
3102 <p>(test)
3103 </p>
3104 !! end
3106 !! test
3107 Template with template name as argument
3108 !! input
3109 {{templateasargtest|templ=simple}}
3110 !! result
3111 <p>(test)
3112 </p>
3113 !! end
3115 !! test
3116 Template with template name as argument (2)
3117 !! input
3118 {{templateasargtest2|templ=templatesimple}}
3119 !! result
3120 <p>(test)
3121 </p>
3122 !! end
3124 !! article
3125 Template:templateasargtestdefault
3126 !! text
3127 {{{{{templ|templatesimple}}}}}
3128 !! endarticle
3130 !! article
3131 Template:templa
3132 !! text
3133 '''templ'''
3134 !! endarticle
3136 !! test
3137 Template with default value
3138 !! input
3139 {{templateasargtestdefault}}
3140 !! result
3141 <p>(test)
3142 </p>
3143 !! end
3145 !! test
3146 Template with default value (value set)
3147 !! input
3148 {{templateasargtestdefault|templ=templa}}
3149 !! result
3150 <p><b>templ</b>
3151 </p>
3152 !! end
3154 !! test
3155 Template redirect
3156 !! input
3157 {{templateredirect}}
3158 !! result
3159 <p>(test)
3160 </p>
3161 !! end
3163 !! test
3164 Template with argument in separate line
3165 !! input
3166 {{ templateasargtest  |
3167  templ = simple }}
3168 !! result
3169 <p>(test)
3170 </p>
3171 !! end
3173 !! test
3174 Template with complex template as argument
3175 !! input
3176 {{paramtest|
3177   param ={{ templateasargtest  |
3178  templ = simple }}}}
3179 !! result
3180 <p>This is a test template with parameter (test)
3181 </p>
3182 !! end
3184 !! test
3185 Template with thumb image (with link in description)
3186 !! input
3187 {{paramtest|
3188   param =[[Image:noimage.png|thumb|[[no link|link]] [[no link|caption]]]]}}
3189 !! result
3190 This is a test template with parameter <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/index.php?title=Special:Upload&amp;wpDestFile=Noimage.png" class="new" title="File:Noimage.png">File:Noimage.png</a>  <div class="thumbcaption"><a href="/index.php?title=No_link&amp;action=edit&amp;redlink=1" class="new" title="No link (page does not exist)">link</a> <a href="/index.php?title=No_link&amp;action=edit&amp;redlink=1" class="new" title="No link (page does not exist)">caption</a></div></div></div>
3192 !! end
3194 !! article
3195 Template:complextemplate
3196 !! text
3197 {{{1}}} {{paramtest|
3198   param ={{{param}}}}}
3199 !! endarticle
3201 !! test
3202 Template with complex arguments
3203 !! input
3204 {{complextemplate|
3205   param ={{ templateasargtest  |
3206  templ = simple }}|[[Template:complextemplate|link]]}}
3207 !! result
3208 <p><a href="/wiki/Template:Complextemplate" title="Template:Complextemplate">link</a> This is a test template with parameter (test)
3209 </p>
3210 !! end
3212 !! test
3213 BUG 553: link with two variables in a piped link
3214 !! input
3215 {| 
3216 |[[{{{1}}}|{{{2}}}]]
3218 !! result
3219 <table>
3220 <tr>
3221 <td>[[{{{1}}}|{{{2}}}]]
3222 </td>
3223 </tr>
3224 </table>
3226 !! end
3228 !! test
3229 Magic variable as template parameter
3230 !! input
3231 {{paramtest|param={{SITENAME}}}}
3232 !! result
3233 <p>This is a test template with parameter MediaWiki
3234 </p>
3235 !! end
3237 !! article
3238 Template:linktest
3239 !! text
3240 [[{{{param}}}|link]]
3241 !! endarticle
3243 !! test
3244 Template parameter as link source
3245 !! input
3246 {{linktest|param=Main Page}}
3247 !! result
3248 <p><a href="/wiki/Main_Page" title="Main Page">link</a>
3249 </p>
3250 !! end
3253 !!article
3254 Template:paramtest2
3255 !! text
3256 including another template, {{paramtest|param={{{arg}}}}}
3257 !! endarticle
3259 !! test
3260 Template passing argument to another template
3261 !! input
3262 {{paramtest2|arg='hmm'}}
3263 !! result
3264 <p>including another template, This is a test template with parameter 'hmm'
3265 </p>
3266 !! end
3268 !! article
3269 Template:Linktest2
3270 !! text
3271 Main Page
3272 !! endarticle
3274 !! test
3275 Template as link source
3276 !! input
3277 [[{{linktest2}}]]
3278 !! result
3279 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
3280 </p>
3281 !! end
3284 !! article
3285 Template:loop1
3286 !! text
3287 {{loop2}}
3288 !! endarticle
3290 !! article
3291 Template:loop2
3292 !! text
3293 {{loop1}}
3294 !! endarticle
3296 !! test
3297 Template infinite loop
3298 !! input
3299 {{loop1}}
3300 !! result
3301 <p><span class="error">Template loop detected: <a href="/wiki/Template:Loop1" title="Template:Loop1">Template:Loop1</a></span>
3302 </p>
3303 !! end
3305 !! test
3306 Template from main namespace
3307 !! input
3308 {{:Main Page}}
3309 !! result
3310 <p>blah blah
3311 </p>
3312 !! end
3314 !! article
3315 Template:table
3316 !! text
3317 {| 
3318 | 1 || 2
3319 |- 
3320 | 3 || 4
3322 !! endarticle
3324 !! test
3325 BUG 529: Template with table, not included at beginning of line
3326 !! input
3327 foo {{table}}
3328 !! result
3329 <p>foo 
3330 </p>
3331 <table>
3332 <tr>
3333 <td>1
3334 </td>
3335 <td>2
3336 </td>
3337 </tr>
3338 <tr>
3339 <td>3
3340 </td>
3341 <td>4
3342 </td>
3343 </tr>
3344 </table>
3346 !! end
3348 !! test
3349 BUG 523: Template shouldn't eat newline (or add an extra one before table)
3350 !! input
3352 {{table}}
3353 !! result
3354 <p>foo
3355 </p>
3356 <table>
3357 <tr>
3358 <td>1
3359 </td>
3360 <td>2
3361 </td>
3362 </tr>
3363 <tr>
3364 <td>3
3365 </td>
3366 <td>4
3367 </td>
3368 </tr>
3369 </table>
3371 !! end
3373 !! test
3374 BUG 41: Template parameters shown as broken links
3375 !! input
3376 {{{parameter}}}
3377 !! result
3378 <p>{{{parameter}}}
3379 </p>
3380 !! end
3383 !! article
3384 Template:MSGNW test
3385 !! text
3386 ''None'' of '''this''' should be 
3387 * interpreted
3388  but rather passed unmodified
3389 {{test}}
3390 !! endarticle
3392 # hmm, fix this or just deprecate msgnw and document its behavior?
3393 !! test
3394 msgnw keyword
3395 !! options
3396 disabled
3397 !! input
3398 {{msgnw:MSGNW test}}
3399 !! result
3400 <p>''None'' of '''this''' should be 
3401 * interpreted
3402  but rather passed unmodified
3403 {{test}}
3404 </p>
3405 !! end
3407 !! test
3408 int keyword
3409 !! input
3410 {{int:youhavenewmessages|lots of money|not!}}
3411 !! result
3412 <p>You have lots of money (not!).
3413 </p>
3414 !! end
3416 !! article
3417 Template:Includes
3418 !! text
3419 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
3420 !! endarticle
3422 !! test
3423 <includeonly> and <noinclude> being included
3424 !! input
3425 {{Includes}}
3426 !! result
3427 <p>Foobar
3428 </p>
3429 !! end
3431 !! article
3432 Template:Includes2
3433 !! text
3434 <onlyinclude>Foo</onlyinclude>bar
3435 !! endarticle
3437 !! test
3438 <onlyinclude> being included
3439 !! input
3440 {{Includes2}}
3441 !! result
3442 <p>Foo
3443 </p>
3444 !! end
3447 !! article
3448 Template:Includes3
3449 !! text
3450 <onlyinclude>Foo</onlyinclude>bar<includeonly>zar</includeonly>
3451 !! endarticle
3453 !! test
3454 <onlyinclude> and <includeonly> being included
3455 !! input
3456 {{Includes3}}
3457 !! result
3458 <p>Foo
3459 </p>
3460 !! end
3462 !! test
3463 <includeonly> and <noinclude> on a page
3464 !! input
3465 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
3466 !! result
3467 <p>Foozar
3468 </p>
3469 !! end
3471 !! test
3472 <onlyinclude> on a page
3473 !! input
3474 <onlyinclude>Foo</onlyinclude>bar
3475 !! result
3476 <p>Foobar
3477 </p>
3478 !! end
3480 !! article
3481 Template:Includeonly section
3482 !! text
3483 <includeonly>
3484 ==Includeonly section==
3485 </includeonly>
3486 ==Section T-1==
3487 !!endarticle
3489 !! test
3490 Bug 6563: Edit link generation for section shown by <includeonly>
3491 !! input
3492 {{includeonly section}}
3493 !! result
3494 <h2><span class="editsection">[<a href="/index.php?title=Template:Includeonly_section&amp;action=edit&amp;section=T-1" title="Template:Includeonly section">edit</a>]</span> <span class="mw-headline" id="Includeonly_section">Includeonly section</span></h2>
3495 <h2><span class="editsection">[<a href="/index.php?title=Template:Includeonly_section&amp;action=edit&amp;section=T-2" title="Template:Includeonly section">edit</a>]</span> <span class="mw-headline" id="Section_T-1">Section T-1</span></h2>
3497 !! end
3499 # Uses same input as the contents of [[Template:Includeonly section]]
3500 !! test
3501 Bug 6563: Section extraction for section shown by <includeonly>
3502 !! options
3503 section=T-2
3504 !! input
3505 <includeonly>
3506 ==Includeonly section==
3507 </includeonly>
3508 ==Section T-2==
3509 !! result
3510 ==Section T-2==
3511 !! end
3513 !! test
3514 Bug 6563: Edit link generation for section suppressed by <includeonly>
3515 !! input
3516 <includeonly>
3517 ==Includeonly section==
3518 </includeonly>
3519 ==Section 1==
3520 !! result
3521 <h2><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: Section 1">edit</a>]</span> <span class="mw-headline" id="Section_1">Section 1</span></h2>
3523 !! end
3525 !! test
3526 Bug 6563: Section extraction for section suppressed by <includeonly>
3527 !! options
3528 section=1
3529 !! input
3530 <includeonly>
3531 ==Includeonly section==
3532 </includeonly>
3533 ==Section 1==
3534 !! result
3535 ==Section 1==
3536 !! end
3537 !! article
3538 Template:Top-level template
3539 !! text
3540 {{Nested template}}
3541 !! endarticle
3543 !! article
3544 Template:Nested template
3545 !! text
3546 *Item 1
3547 *Item 2
3548 !! endarticle
3550 !! test
3551 Line-start flag in a nested template call
3552 !! input
3553 *Item A
3554 *Item B
3556 {{Top-level template}}
3557 !! result
3558 <ul><li>Item A
3559 </li><li>Item B
3560 </li></ul>
3561 <ul><li>Item 1
3562 </li><li>Item 2
3563 </li></ul>
3565 !! end
3568 ### Pre-save transform tests
3570 !! test
3571 pre-save transform: subst:
3572 !! options
3574 !! input
3575 {{subst:test}}
3576 !! result
3577 This is a test template
3578 !! end
3580 !! test
3581 pre-save transform: normal template
3582 !! options
3584 !! input
3585 {{test}}
3586 !! result
3587 {{test}}
3588 !! end
3590 !! test
3591 pre-save transform: nonexistent template
3592 !! options
3594 !! input
3595 {{thistemplatedoesnotexist}}
3596 !! result
3597 {{thistemplatedoesnotexist}}
3598 !! end
3601 !! test
3602 pre-save transform: subst magic variables
3603 !! options
3605 !! input
3606 {{subst:SITENAME}}
3607 !! result
3608 MediaWiki
3609 !! end
3611 # This is bug 89, which I fixed. -- wtm
3612 !! test
3613 pre-save transform: subst: templates with parameters
3614 !! options
3616 !! input
3617 {{subst:paramtest|param="something else"}}
3618 !! result
3619 This is a test template with parameter "something else"
3620 !! end
3622 !! article
3623 Template:nowikitest
3624 !! text
3625 <nowiki>'''not wiki'''</nowiki>
3626 !! endarticle
3628 !! test
3629 pre-save transform: nowiki in subst (bug 1188)
3630 !! options
3632 !! input
3633 {{subst:nowikitest}}
3634 !! result
3635 <nowiki>'''not wiki'''</nowiki>
3636 !! end
3639 !! article
3640 Template:commenttest
3641 !! text
3642 This template has <!-- a comment --> in it.
3643 !! endarticle
3645 !! test
3646 pre-save transform: comment in subst (bug 1936)
3647 !! options
3649 !! input
3650 {{subst:commenttest}}
3651 !! result
3652 This template has <!-- a comment --> in it.
3653 !! end
3655 !! test
3656 pre-save transform: unclosed tag
3657 !! options
3658 pst noxml
3659 !! input
3660 <nowiki>'''not wiki'''
3661 !! result
3662 <nowiki>'''not wiki'''
3663 !! end
3665 !! test
3666 pre-save transform: mixed tag case
3667 !! options
3668 pst noxml
3669 !! input
3670 <NOwiki>'''not wiki'''</noWIKI>
3671 !! result
3672 <NOwiki>'''not wiki'''</noWIKI>
3673 !! end
3675 !! test
3676 pre-save transform: unclosed comment in <nowiki>
3677 !! options
3678 pst noxml
3679 !! input
3680 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
3681 !! result
3682 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
3683 !!end
3685 !! article
3686 Template:dangerous
3687 !!text
3688 <span onmouseover="alert('crap')">Oh no</span>
3689 !!endarticle
3691 !!test
3692 (confirming safety of fix for subst bug 1936)
3693 !! input
3694 {{Template:dangerous}}
3695 !! result
3696 <p><span>Oh no</span>
3697 </p>
3698 !! end
3700 !! test
3701 pre-save transform: comment containing gallery (bug 5024)
3702 !! options
3704 !! input
3705 <!-- <gallery>data</gallery> -->
3706 !!result
3707 <!-- <gallery>data</gallery> -->
3708 !!end
3710 !! test
3711 pre-save transform: comment containing extension
3712 !! options
3714 !! input
3715 <!-- <tag>data</tag> -->
3716 !!result
3717 <!-- <tag>data</tag> -->
3718 !!end
3720 !! test
3721 pre-save transform: comment containing nowiki
3722 !! options
3724 !! input
3725 <!-- <nowiki>data</nowiki> -->
3726 !!result
3727 <!-- <nowiki>data</nowiki> -->
3728 !!end
3730 !! test
3731 pre-save transform: <noinclude> in subst (bug 3298)
3732 !! options
3734 !! input
3735 {{subst:Includes}}
3736 !! result
3737 Foobar
3738 !! end
3740 !! test
3741 pre-save transform: <onlyinclude> in subst (bug 3298)
3742 !! options
3744 !! input
3745 {{subst:Includes2}}
3746 !! result
3748 !! end
3750 !! article
3751 Template:SubstTest
3752 !!text
3753 {{<includeonly>subst:</includeonly>Includes}}
3754 !! endarticle
3756 !! article
3757 Template:SafeSubstTest
3758 !! text
3759 {{<includeonly>safesubst:</includeonly>Includes}}
3760 !! endarticle
3762 !! test
3763 bug 22297: safesubst: works during PST
3764 !! options
3766 !! input
3767 {{subst:SafeSubstTest}}{{safesubst:SubstTest}}
3768 !! result
3769 FoobarFoobar
3770 !! end
3772 !! test
3773 bug 22297: safesubst: works during normal parse
3774 !! input
3775 {{SafeSubstTest}}
3776 !! result
3777 <p>Foobar
3778 </p>
3779 !! end
3781 !! test:
3782 subst: does not work during normal parse
3783 !! input
3784 {{SubstTest}}
3785 !! result
3786 <p>{{subst:Includes}}
3787 </p>
3788 !! end
3790 !! test
3791 pre-save transform: context links ("pipe trick")
3792 !! options
3794 !! input
3795 [[Article (context)|]]
3796 [[Bar:Article|]]
3797 [[:Bar:Article|]]
3798 [[Bar:Article (context)|]]
3799 [[:Bar:Article (context)|]]
3800 [[|Article]]
3801 [[|Article (context)]]
3802 [[Bar:X (Y) Z|]]
3803 [[:Bar:X (Y) Z|]]
3804 !! result
3805 [[Article (context)|Article]]
3806 [[Bar:Article|Article]]
3807 [[:Bar:Article|Article]]
3808 [[Bar:Article (context)|Article]]
3809 [[:Bar:Article (context)|Article]]
3810 [[Article]]
3811 [[Article (context)]]
3812 [[Bar:X (Y) Z|X (Y) Z]]
3813 [[:Bar:X (Y) Z|X (Y) Z]]
3814 !! end
3816 !! test
3817 pre-save transform: context links ("pipe trick") with interwiki prefix
3818 !! options
3820 !! input
3821 [[interwiki:Article|]]
3822 [[:interwiki:Article|]]
3823 [[interwiki:Bar:Article|]]
3824 [[:interwiki:Bar:Article|]]
3825 !! result
3826 [[interwiki:Article|Article]]
3827 [[:interwiki:Article|Article]]
3828 [[interwiki:Bar:Article|Bar:Article]]
3829 [[:interwiki:Bar:Article|Bar:Article]]
3830 !! end
3832 !! test
3833 pre-save transform: context links ("pipe trick") with parens in title
3834 !! options
3835 pst title=[[Somearticle (context)]]
3836 !! input
3837 [[|Article]]
3838 !! result
3839 [[Article (context)|Article]]
3840 !! end
3842 !! test
3843 pre-save transform: context links ("pipe trick") with comma in title
3844 !! options
3845 pst title=[[Someplace, Somewhere]]
3846 !! input
3847 [[|Otherplace]]
3848 [[Otherplace, Elsewhere|]]
3849 [[Otherplace, Elsewhere, Anywhere|]]
3850 !! result
3851 [[Otherplace, Somewhere|Otherplace]]
3852 [[Otherplace, Elsewhere|Otherplace]]
3853 [[Otherplace, Elsewhere, Anywhere|Otherplace]]
3854 !! end
3856 !! test
3857 pre-save transform: context links ("pipe trick") with parens and comma
3858 !! options
3859 pst title=[[Someplace (IGNORED), Somewhere]]
3860 !! input
3861 [[|Otherplace]]
3862 [[Otherplace (place), Elsewhere|]]
3863 !! result
3864 [[Otherplace, Somewhere|Otherplace]]
3865 [[Otherplace (place), Elsewhere|Otherplace]]
3866 !! end
3868 !! test
3869 pre-save transform: context links ("pipe trick") with comma and parens
3870 !! options
3871 pst title=[[Who, me? (context)]]
3872 !! input
3873 [[|Yes, you.]]
3874 [[Me, Myself, and I (1937 song)|]]
3875 !! result
3876 [[Yes, you. (context)|Yes, you.]]
3877 [[Me, Myself, and I (1937 song)|Me, Myself, and I]]
3878 !! end
3880 !! test
3881 pre-save transform: context links ("pipe trick") with namespace
3882 !! options
3883 pst title=[[Ns:Somearticle]]
3884 !! input
3885 [[|Article]]
3886 !! result
3887 [[Ns:Article|Article]]
3888 !! end
3890 !! test
3891 pre-save transform: context links ("pipe trick") with namespace and parens
3892 !! options
3893 pst title=[[Ns:Somearticle (context)]]
3894 !! input
3895 [[|Article]]
3896 !! result
3897 [[Ns:Article (context)|Article]]
3898 !! end
3900 !! test
3901 pre-save transform: context links ("pipe trick") with namespace and comma
3902 !! options
3903 pst title=[[Ns:Somearticle, Context, Whatever]]
3904 !! input
3905 [[|Article]]
3906 !! result
3907 [[Ns:Article, Context, Whatever|Article]]
3908 !! end
3910 !! test
3911 pre-save transform: context links ("pipe trick") with namespace, comma and parens
3912 !! options
3913 pst title=[[Ns:Somearticle, Context (context)]]
3914 !! input
3915 [[|Article]]
3916 !! result
3917 [[Ns:Article (context)|Article]]
3918 !! end
3920 !! test
3921 pre-save transform: context links ("pipe trick") with namespace, parens and comma
3922 !! options
3923 pst title=[[Ns:Somearticle (IGNORED), Context]]
3924 !! input
3925 [[|Article]]
3926 !! result
3927 [[Ns:Article, Context|Article]]
3928 !! end
3930 !! test
3931 pre-save transform: trim trailing empty lines
3932 !! options
3934 !! input
3935 Empty lines are trimmed
3940 !! result
3941 Empty lines are trimmed
3942 !! end
3944 !! test
3945 pre-save transform: Signature expansion
3946 !! options
3948 !! input
3949 * ~~~
3950 * <noinclude>~~~</noinclude>
3951 * <includeonly>~~~</includeonly>
3952 * <onlyinclude>~~~</onlyinclude>
3953 !! result
3954 * [[Special:Contributions/127.0.0.1|127.0.0.1]]
3955 * <noinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</noinclude>
3956 * <includeonly>[[Special:Contributions/127.0.0.1|127.0.0.1]]</includeonly>
3957 * <onlyinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</onlyinclude>
3958 !! end
3961 !! test
3962 pre-save transform: Signature expansion in nowiki tags (bug 93)
3963 !! options
3964 pst disabled
3965 !! input
3966 Shall not expand:
3968 <nowiki>~~~~</nowiki>
3970 <includeonly><nowiki>~~~~</nowiki></includeonly>
3972 <noinclude><nowiki>~~~~</nowiki></noinclude>
3974 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
3976 {{subst:Foo}} shall be converted to FOO
3978 As well as inside noinclude/onlyinclude
3979 <noinclude>{{subst:Foo}}</noinclude>
3980 <onlyinclude>{{subst:Foo}}</onlyinclude>
3982 But not inside includeonly
3983 <includeonly>{{subst:Foo}}</includeonly>
3984 !! result
3985 Shall not expand:
3987 <nowiki>~~~~</nowiki>
3989 <includeonly><nowiki>~~~~</nowiki></includeonly>
3991 <noinclude><nowiki>~~~~</nowiki></noinclude>
3993 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
3995 FOO shall be converted to FOO
3997 As well as inside noinclude/onlyinclude
3998 <noinclude>FOO</noinclude>
3999 <onlyinclude>FOO</onlyinclude>
4001 But not inside includeonly
4002 <includeonly>{{subst:Foo}}</includeonly>
4003 !! end
4006 ### Message transform tests
4008 !! test
4009 message transform: magic variables
4010 !! options
4012 !! input
4013 {{SITENAME}}
4014 !! result
4015 MediaWiki
4016 !! end
4018 !! test
4019 message transform: should not transform wiki markup
4020 !! options
4022 !! input
4023 ''test''
4024 !! result
4025 ''test''
4026 !! end
4028 !! test
4029 message transform: <noinclude> in transcluded template (bug 4926)
4030 !! options
4032 !! input
4033 {{Includes}}
4034 !! result
4035 Foobar
4036 !! end
4038 !! test
4039 message transform: <onlyinclude> in transcluded template (bug 4926)
4040 !! options
4042 !! input
4043 {{Includes2}}
4044 !! result
4046 !! end
4048 !! test
4049 {{#special:}} page name, known
4050 !! options
4052 !! input
4053 {{#special:Recentchanges}}
4054 !! result
4055 Special:RecentChanges
4056 !! end
4058 !! test
4059 {{#special:}} page name with subpage, known
4060 !! options
4062 !! input
4063 {{#special:Recentchanges/param}}
4064 !! result
4065 Special:RecentChanges/param
4066 !! end
4068 !! test
4069 {{#special:}} page name, unknown
4070 !! options
4072 !! input
4073 {{#special:foobarnonexistent}}
4074 !! result
4075 No such special page
4076 !! end
4079 ### Images
4081 !! test
4082 Simple image
4083 !! input
4084 [[Image:foobar.jpg]]
4085 !! result
4086 <p><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
4087 </p>
4088 !! end
4090 !! test
4091 Right-aligned image
4092 !! input
4093 [[Image:foobar.jpg|right]]
4094 !! result
4095 <div class="floatright"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a></div>
4097 !! end
4099 !! test
4100 Simple image (using File: namespace, now canonical)
4101 !! input
4102 [[File:foobar.jpg]]
4103 !! result
4104 <p><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
4105 </p>
4106 !! end
4108 !! test
4109 Image with caption
4110 !! input
4111 [[Image:foobar.jpg|right|Caption text]]
4112 !! result
4113 <div class="floatright"><a href="/wiki/File:Foobar.jpg" class="image" title="Caption text"><img alt="Caption text" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a></div>
4115 !! end
4117 !! test
4118 Image with link parameter, wiki target
4119 !! input
4120 [[Image:foobar.jpg|link=Target page]]
4121 !! result
4122 <p><a href="/wiki/Target_page" title="Target page"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
4123 </p>
4124 !! end
4126 !! test
4127 Image with link parameter, URL target
4128 !! input
4129 [[Image:foobar.jpg|link=http://example.com/]]
4130 !! result
4131 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
4132 </p>
4133 !! end
4135 !! test
4136 Image with link parameter, wgExternalLinkTarget
4137 !! input
4138 [[Image:foobar.jpg|link=http://example.com/]]
4139 !! config
4140 wgExternalLinkTarget='foobar'
4141 !! result
4142 <p><a href="http://example.com/" target="foobar"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
4143 </p>
4144 !! end
4146 !! test
4147 Image with link parameter, wgExternalLinkTarget, unnamed parameter
4148 !! input
4149 [[Image:foobar.jpg|link=http://example.com/|Title]]
4150 !! config
4151 wgExternalLinkTarget='foobar'
4152 !! result
4153 <p><a href="http://example.com/" title="Title" target="foobar"><img alt="Title" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
4154 </p>
4155 !! end
4157 !! test
4158 Image with empty link parameter
4159 !! input
4160 [[Image:foobar.jpg|link=]]
4161 !! result
4162 <p><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" />
4163 </p>
4164 !! end
4166 !! test
4167 Image with link parameter (wiki target) and unnamed parameter
4168 !! input
4169 [[Image:foobar.jpg|link=Target page|Title]]
4170 !! result
4171 <p><a href="/wiki/Target_page" title="Title"><img alt="Title" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
4172 </p>
4173 !! end
4175 !! test
4176 Image with link parameter (URL target) and unnamed parameter
4177 !! input
4178 [[Image:foobar.jpg|link=http://example.com/|Title]]
4179 !! result
4180 <p><a href="http://example.com/" title="Title"><img alt="Title" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
4181 </p>
4182 !! end
4184 !! test
4185 Thumbnail image with link parameter
4186 !! input
4187 [[Image:foobar.jpg|thumb|link=http://example.com/|Title]]
4188 !! result
4189 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="http://example.com/"><img alt="" src="http://example.com/images/3/3a/Foobar.jpg" width="180" height="20" class="thumbimage" /></a>  <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>Title</div></div></div>
4191 !! end
4193 !! test
4194 Image with frame and link
4195 !! input
4196 [[Image:Foobar.jpg|frame|left|This is a test image [[Main Page]]]]
4197 !! result
4198 <div class="thumb tleft"><div class="thumbinner" style="width:1943px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" class="thumbimage" /></a>  <div class="thumbcaption">This is a test image <a href="/wiki/Main_Page" title="Main Page">Main Page</a></div></div></div>
4200 !! end
4202 !! test
4203 Image with frame and link and explicit alt
4204 !! input
4205 [[Image:Foobar.jpg|frame|left|This is a test image [[Main Page]]|alt=Altitude]]
4206 !! result
4207 <div class="thumb tleft"><div class="thumbinner" style="width:1943px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Altitude" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" class="thumbimage" /></a>  <div class="thumbcaption">This is a test image <a href="/wiki/Main_Page" title="Main Page">Main Page</a></div></div></div>
4209 !! end
4211 !! test
4212 Image with wiki markup in implicit alt
4213 !! input
4214 [[Image:Foobar.jpg|testing '''bold''' in alt]]
4215 !! result
4216 <p><a href="/wiki/File:Foobar.jpg" class="image" title="testing bold in alt"><img alt="testing bold in alt" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
4217 </p>
4218 !! end
4220 !! test
4221 Image with wiki markup in explicit alt
4222 !! input
4223 [[Image:Foobar.jpg|alt=testing '''bold''' in alt]]
4224 !! result
4225 <p><a href="/wiki/File:Foobar.jpg" class="image"><img alt="testing bold in alt" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
4226 </p>
4227 !! end
4229 !! test
4230 Link to image page- image page normally doesn't exists, hence edit link
4231 Add test with existing image page
4232 #<p><a href="/wiki/File:Test" title="Image:Test">Image:test</a>
4233 !! input
4234 [[:Image:test]]
4235 !! result
4236 <p><a href="/index.php?title=File:Test&amp;action=edit&amp;redlink=1" class="new" title="File:Test (page does not exist)">Image:test</a>
4237 </p>
4238 !! end
4240 !! test
4241 bug 18784  Link to non-existent image page with caption should use caption as link text
4242 !! input
4243 [[:Image:test|caption]]
4244 !! result
4245 <p><a href="/index.php?title=File:Test&amp;action=edit&amp;redlink=1" class="new" title="File:Test (page does not exist)">caption</a>
4246 </p>
4247 !! end
4249 !! test
4250 Frameless image caption with a free URL
4251 !! input
4252 [[Image:foobar.jpg|http://example.com]]
4253 !! result
4254 <p><a href="/wiki/File:Foobar.jpg" class="image" title="http://example.com"><img alt="http://example.com" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
4255 </p>
4256 !! end
4258 !! test
4259 Thumbnail image caption with a free URL
4260 !! input
4261 [[Image:foobar.jpg|thumb|http://example.com]]
4262 !! result
4263 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/3/3a/Foobar.jpg" width="180" height="20" class="thumbimage" /></a>  <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a></div></div></div>
4265 !! end
4267 !! test
4268 Thumbnail image caption with a free URL and explicit alt
4269 !! input
4270 [[Image:foobar.jpg|thumb|http://example.com|alt=Alteration]]
4271 !! result
4272 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Alteration" src="http://example.com/images/3/3a/Foobar.jpg" width="180" height="20" class="thumbimage" /></a>  <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a></div></div></div>
4274 !! end
4276 !! test
4277 BUG 1887: A ISBN with a thumbnail
4278 !! input
4279 [[Image:foobar.jpg|thumb|ISBN 1235467890]]
4280 !! result
4281 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/3/3a/Foobar.jpg" width="180" height="20" class="thumbimage" /></a>  <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div><a href="/wiki/Special:BookSources/1235467890" class="internal mw-magiclink-isbn">ISBN 1235467890</a></div></div></div>
4283 !! end
4285 !! test
4286 BUG 1887: A RFC with a thumbnail
4287 !! input
4288 [[Image:foobar.jpg|thumb|This is RFC 12354]]
4289 !! result
4290 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/3/3a/Foobar.jpg" width="180" height="20" class="thumbimage" /></a>  <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>This is <a class="external mw-magiclink-rfc" href="http://tools.ietf.org/html/rfc12354">RFC 12354</a></div></div></div>
4292 !! end
4294 !! test
4295 BUG 1887: A mailto link with a thumbnail
4296 !! input
4297 [[Image:foobar.jpg|thumb|Please mailto:nobody@example.com]]
4298 !! result
4299 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/3/3a/Foobar.jpg" width="180" height="20" class="thumbimage" /></a>  <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>Please <a rel="nofollow" class="external free" href="mailto:nobody@example.com">mailto:nobody@example.com</a></div></div></div>
4301 !! end
4303 # Pending resolution to bug 368
4304 !! test
4305 BUG 648: Frameless image caption with a link
4306 !! input
4307 [[Image:foobar.jpg|text with a [[link]] in it]]
4308 !! result
4309 <p><a href="/wiki/File:Foobar.jpg" class="image" title="text with a link in it"><img alt="text with a link in it" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
4310 </p>
4311 !! end
4313 !! test
4314 BUG 648: Frameless image caption with a link (suffix)
4315 !! input
4316 [[Image:foobar.jpg|text with a [[link]]foo in it]]
4317 !! result
4318 <p><a href="/wiki/File:Foobar.jpg" class="image" title="text with a linkfoo in it"><img alt="text with a linkfoo in it" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
4319 </p>
4320 !! end
4322 !! test
4323 BUG 648: Frameless image caption with an interwiki link
4324 !! input
4325 [[Image:foobar.jpg|text with a [[MeatBall:Link]] in it]]
4326 !! result
4327 <p><a href="/wiki/File:Foobar.jpg" class="image" title="text with a MeatBall:Link in it"><img alt="text with a MeatBall:Link in it" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
4328 </p>
4329 !! end
4331 !! test
4332 BUG 648: Frameless image caption with a piped interwiki link
4333 !! input
4334 [[Image:foobar.jpg|text with a [[MeatBall:Link|link]] in it]]
4335 !! result
4336 <p><a href="/wiki/File:Foobar.jpg" class="image" title="text with a link in it"><img alt="text with a link in it" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
4337 </p>
4338 !! end
4340 !! test
4341 Escape HTML special chars in image alt text
4342 !! input
4343 [[Image:foobar.jpg|& < > "]]
4344 !! result
4345 <p><a href="/wiki/File:Foobar.jpg" class="image" title="&amp; &lt; &gt; &quot;"><img alt="&amp; &lt; &gt; &quot;" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
4346 </p>
4347 !! end
4349 !! test
4350 BUG 499: Alt text should have &#1234;, not &amp;1234;
4351 !! input
4352 [[Image:foobar.jpg|&#9792;]]
4353 !! result
4354 <p><a href="/wiki/File:Foobar.jpg" class="image" title="♀"><img alt="♀" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
4355 </p>
4356 !! end
4358 !! test
4359 Broken image caption with link
4360 !! input
4361 [[Image:Foobar.jpg|thumb|This is a broken caption. But [[Main Page|this]] is just an ordinary link.
4362 !! result
4363 <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.
4364 </p>
4365 !! end
4367 !! test
4368 Image caption containing another image
4369 !! input
4370 [[Image:Foobar.jpg|thumb|This is a caption with another [[Image:icon.png|image]] inside it!]]
4371 !! result
4372 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/3/3a/Foobar.jpg" width="180" height="20" class="thumbimage" /></a>  <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>This is a caption with another <a href="/index.php?title=Special:Upload&amp;wpDestFile=Icon.png" class="new" title="File:Icon.png">image</a> inside it!</div></div></div>
4374 !! end
4376 !! test
4377 Image caption containing a newline
4378 !! input
4379 [[Image:Foobar.jpg|This
4380 *is some text]]
4381 !! result
4382 <p><a href="/wiki/File:Foobar.jpg" class="image" title="This *is some text"><img alt="This *is some text" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
4383 </p>
4384 !!end
4387 !! test
4388 Bug 3090: External links other than http: in image captions
4389 !! input
4390 [[Image:Foobar.jpg|thumb|200px|This caption has [irc://example.net irc] and [https://example.com Secure] ext links in it.]]
4391 !! result
4392 <div class="thumb tright"><div class="thumbinner" style="width:202px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/3/3a/Foobar.jpg" width="200" height="23" class="thumbimage" /></a>  <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>This caption has <a rel="nofollow" class="external text" href="irc://example.net">irc</a> and <a rel="nofollow" class="external text" href="https://example.com">Secure</a> ext links in it.</div></div></div>
4394 !! end
4396 !! article 
4397 File:Barfoo.jpg
4398 !! text
4399 #REDIRECT [[File:Barfoo.jpg]]
4400 !! endarticle
4402 !! test
4403 Redirected image
4404 !! input
4405 [[Image:Barfoo.jpg]]
4406 !! result
4407 <p><a href="/wiki/File:Barfoo.jpg" title="File:Barfoo.jpg">File:Barfoo.jpg</a>
4408 </p>
4409 !! end
4411 !! test
4412 Missing image with uploads disabled
4413 !! options
4414 wgEnableUploads=0
4415 !! input
4416 [[Image:Foobaz.jpg]]
4417 !! result
4418 <p><a href="/wiki/File:Foobaz.jpg" title="File:Foobaz.jpg">File:Foobaz.jpg</a>
4419 </p>
4420 !! end
4424 ### Subpages
4426 !! article
4427 Subpage test/subpage
4428 !! text
4430 !! endarticle
4432 !! test
4433 Subpage link
4434 !! options
4435 subpage title=[[Subpage test]]
4436 !! input
4437 [[/subpage]]
4438 !! result
4439 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a>
4440 </p>
4441 !! end
4443 !! test
4444 Subpage noslash link
4445 !! options
4446 subpage title=[[Subpage test]]
4447 !!input
4448 [[/subpage/]]
4449 !! result
4450 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">subpage</a>
4451 </p>
4452 !! end
4454 !! test
4455 Disabled subpages
4456 !! input
4457 [[/subpage]]
4458 !! result
4459 <p><a href="/index.php?title=/subpage&amp;action=edit&amp;redlink=1" class="new" title="/subpage (page does not exist)">/subpage</a>
4460 </p>
4461 !! end
4463 !! test
4464 BUG 561: {{/Subpage}}
4465 !! options
4466 subpage title=[[Page]]
4467 !! input
4468 {{/Subpage}}
4469 !! result
4470 <p><a href="/index.php?title=Page/Subpage&amp;action=edit&amp;redlink=1" class="new" title="Page/Subpage (page does not exist)">Page/Subpage</a>
4471 </p>
4472 !! end
4475 ### Categories
4477 !! article
4478 Category:MediaWiki User's Guide
4479 !! text
4480 blah
4481 !! endarticle
4483 !! test
4484 Link to category
4485 !! input
4486 [[:Category:MediaWiki User's Guide]]
4487 !! result
4488 <p><a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">Category:MediaWiki User's Guide</a>
4489 </p>
4490 !! end
4492 !! test
4493 Simple category
4494 !! options
4496 !! input
4497 [[Category:MediaWiki User's Guide]]
4498 !! result
4499 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
4500 !! end
4502 !! test
4503 PAGESINCATEGORY invalid title fatal (r33546 fix)
4504 !! input
4505 {{PAGESINCATEGORY:<bogus>}}
4506 !! result
4507 <p>0
4508 </p>
4509 !! end
4512 ### Inter-language links
4514 !! test
4515 Inter-language links
4516 !! options
4518 !! input
4519 [[es:Alimento]]
4520 [[fr:Nourriture]]
4521 [[zh:&#39135;&#21697;]]
4522 !! result
4523 es:Alimento fr:Nourriture zh:食品
4524 !! end
4527 ### Sections
4529 !! test
4530 Basic section headings
4531 !! input
4532 == Headline 1 ==
4533 Some text
4535 ==Headline 2==
4536 More
4537 ===Smaller headline===
4538 Blah blah
4539 !! result
4540 <h2><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: Headline 1">edit</a>]</span> <span class="mw-headline" id="Headline_1"> Headline 1 </span></h2>
4541 <p>Some text
4542 </p>
4543 <h2><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: Headline 2">edit</a>]</span> <span class="mw-headline" id="Headline_2">Headline 2</span></h2>
4544 <p>More
4545 </p>
4546 <h3><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=3" title="Edit section: Smaller headline">edit</a>]</span> <span class="mw-headline" id="Smaller_headline">Smaller headline</span></h3>
4547 <p>Blah blah
4548 </p>
4549 !! end
4551 !! test
4552 Section headings with TOC
4553 !! input
4554 == Headline 1 ==
4555 === Subheadline 1 ===
4556 ===== Skipping a level =====
4557 ====== Skipping a level ======
4559 == Headline 2 ==
4560 Some text
4561 ===Another headline===
4562 !! result
4563 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
4564 <ul>
4565 <li class="toclevel-1 tocsection-1"><a href="#Headline_1"><span class="tocnumber">1</span> <span class="toctext">Headline 1</span></a>
4566 <ul>
4567 <li class="toclevel-2 tocsection-2"><a href="#Subheadline_1"><span class="tocnumber">1.1</span> <span class="toctext">Subheadline 1</span></a>
4568 <ul>
4569 <li class="toclevel-3 tocsection-3"><a href="#Skipping_a_level"><span class="tocnumber">1.1.1</span> <span class="toctext">Skipping a level</span></a>
4570 <ul>
4571 <li class="toclevel-4 tocsection-4"><a href="#Skipping_a_level_2"><span class="tocnumber">1.1.1.1</span> <span class="toctext">Skipping a level</span></a></li>
4572 </ul>
4573 </li>
4574 </ul>
4575 </li>
4576 </ul>
4577 </li>
4578 <li class="toclevel-1 tocsection-5"><a href="#Headline_2"><span class="tocnumber">2</span> <span class="toctext">Headline 2</span></a>
4579 <ul>
4580 <li class="toclevel-2 tocsection-6"><a href="#Another_headline"><span class="tocnumber">2.1</span> <span class="toctext">Another headline</span></a></li>
4581 </ul>
4582 </li>
4583 </ul>
4584 </td></tr></table>
4585 <h2><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: Headline 1">edit</a>]</span> <span class="mw-headline" id="Headline_1"> Headline 1 </span></h2>
4586 <h3><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: Subheadline 1">edit</a>]</span> <span class="mw-headline" id="Subheadline_1"> Subheadline 1 </span></h3>
4587 <h5><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=3" title="Edit section: Skipping a level">edit</a>]</span> <span class="mw-headline" id="Skipping_a_level"> Skipping a level </span></h5>
4588 <h6><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=4" title="Edit section: Skipping a level">edit</a>]</span> <span class="mw-headline" id="Skipping_a_level_2"> Skipping a level </span></h6>
4589 <h2><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=5" title="Edit section: Headline 2">edit</a>]</span> <span class="mw-headline" id="Headline_2"> Headline 2 </span></h2>
4590 <p>Some text
4591 </p>
4592 <h3><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=6" title="Edit section: Another headline">edit</a>]</span> <span class="mw-headline" id="Another_headline">Another headline</span></h3>
4594 !! end
4596 # perl -e 'print "="x$_," Level $_ heading","="x$_,"\n" for 1..10'
4597 !! test
4598 Handling of sections up to level 6 and beyond
4599 !! input 
4600 = Level 1 Heading=
4601 == Level 2 Heading==
4602 === Level 3 Heading===
4603 ==== Level 4 Heading====
4604 ===== Level 5 Heading=====
4605 ====== Level 6 Heading======
4606 ======= Level 7 Heading=======
4607 ======== Level 8 Heading========
4608 ========= Level 9 Heading=========
4609 ========== Level 10 Heading==========
4610 !! result
4611 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
4612 <ul>
4613 <li class="toclevel-1 tocsection-1"><a href="#Level_1_Heading"><span class="tocnumber">1</span> <span class="toctext">Level 1 Heading</span></a>
4614 <ul>
4615 <li class="toclevel-2 tocsection-2"><a href="#Level_2_Heading"><span class="tocnumber">1.1</span> <span class="toctext">Level 2 Heading</span></a>
4616 <ul>
4617 <li class="toclevel-3 tocsection-3"><a href="#Level_3_Heading"><span class="tocnumber">1.1.1</span> <span class="toctext">Level 3 Heading</span></a>
4618 <ul>
4619 <li class="toclevel-4 tocsection-4"><a href="#Level_4_Heading"><span class="tocnumber">1.1.1.1</span> <span class="toctext">Level 4 Heading</span></a>
4620 <ul>
4621 <li class="toclevel-5 tocsection-5"><a href="#Level_5_Heading"><span class="tocnumber">1.1.1.1.1</span> <span class="toctext">Level 5 Heading</span></a>
4622 <ul>
4623 <li class="toclevel-6 tocsection-6"><a href="#Level_6_Heading"><span class="tocnumber">1.1.1.1.1.1</span> <span class="toctext">Level 6 Heading</span></a></li>
4624 <li class="toclevel-6 tocsection-7"><a href="#.3D_Level_7_Heading.3D"><span class="tocnumber">1.1.1.1.1.2</span> <span class="toctext">= Level 7 Heading=</span></a></li>
4625 <li class="toclevel-6 tocsection-8"><a href="#.3D.3D_Level_8_Heading.3D.3D"><span class="tocnumber">1.1.1.1.1.3</span> <span class="toctext">== Level 8 Heading==</span></a></li>
4626 <li class="toclevel-6 tocsection-9"><a href="#.3D.3D.3D_Level_9_Heading.3D.3D.3D"><span class="tocnumber">1.1.1.1.1.4</span> <span class="toctext">=== Level 9 Heading===</span></a></li>
4627 <li class="toclevel-6 tocsection-10"><a href="#.3D.3D.3D.3D_Level_10_Heading.3D.3D.3D.3D"><span class="tocnumber">1.1.1.1.1.5</span> <span class="toctext">==== Level 10 Heading====</span></a></li>
4628 </ul>
4629 </li>
4630 </ul>
4631 </li>
4632 </ul>
4633 </li>
4634 </ul>
4635 </li>
4636 </ul>
4637 </li>
4638 </ul>
4639 </td></tr></table>
4640 <h1><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: Level 1 Heading">edit</a>]</span> <span class="mw-headline" id="Level_1_Heading"> Level 1 Heading</span></h1>
4641 <h2><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: Level 2 Heading">edit</a>]</span> <span class="mw-headline" id="Level_2_Heading"> Level 2 Heading</span></h2>
4642 <h3><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=3" title="Edit section: Level 3 Heading">edit</a>]</span> <span class="mw-headline" id="Level_3_Heading"> Level 3 Heading</span></h3>
4643 <h4><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=4" title="Edit section: Level 4 Heading">edit</a>]</span> <span class="mw-headline" id="Level_4_Heading"> Level 4 Heading</span></h4>
4644 <h5><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=5" title="Edit section: Level 5 Heading">edit</a>]</span> <span class="mw-headline" id="Level_5_Heading"> Level 5 Heading</span></h5>
4645 <h6><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=6" title="Edit section: Level 6 Heading">edit</a>]</span> <span class="mw-headline" id="Level_6_Heading"> Level 6 Heading</span></h6>
4646 <h6><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=7" title="Edit section: = Level 7 Heading=">edit</a>]</span> <span class="mw-headline" id=".3D_Level_7_Heading.3D">= Level 7 Heading=</span></h6>
4647 <h6><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=8" title="Edit section: == Level 8 Heading==">edit</a>]</span> <span class="mw-headline" id=".3D.3D_Level_8_Heading.3D.3D">== Level 8 Heading==</span></h6>
4648 <h6><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=9" title="Edit section: === Level 9 Heading===">edit</a>]</span> <span class="mw-headline" id=".3D.3D.3D_Level_9_Heading.3D.3D.3D">=== Level 9 Heading===</span></h6>
4649 <h6><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=10" title="Edit section: ==== Level 10 Heading====">edit</a>]</span> <span class="mw-headline" id=".3D.3D.3D.3D_Level_10_Heading.3D.3D.3D.3D">==== Level 10 Heading====</span></h6>
4651 !! end
4653 !! test
4654 TOC regression (bug 9764)
4655 !! input
4656 == title 1 ==
4657 === title 1.1 ===
4658 ==== title 1.1.1 ====
4659 === title 1.2 ===
4660 == title 2 ==
4661 === title 2.1 ===
4662 !! result
4663 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
4664 <ul>
4665 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
4666 <ul>
4667 <li class="toclevel-2 tocsection-2"><a href="#title_1.1"><span class="tocnumber">1.1</span> <span class="toctext">title 1.1</span></a>
4668 <ul>
4669 <li class="toclevel-3 tocsection-3"><a href="#title_1.1.1"><span class="tocnumber">1.1.1</span> <span class="toctext">title 1.1.1</span></a></li>
4670 </ul>
4671 </li>
4672 <li class="toclevel-2 tocsection-4"><a href="#title_1.2"><span class="tocnumber">1.2</span> <span class="toctext">title 1.2</span></a></li>
4673 </ul>
4674 </li>
4675 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
4676 <ul>
4677 <li class="toclevel-2 tocsection-6"><a href="#title_2.1"><span class="tocnumber">2.1</span> <span class="toctext">title 2.1</span></a></li>
4678 </ul>
4679 </li>
4680 </ul>
4681 </td></tr></table>
4682 <h2><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: title 1">edit</a>]</span> <span class="mw-headline" id="title_1"> title 1 </span></h2>
4683 <h3><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: title 1.1">edit</a>]</span> <span class="mw-headline" id="title_1.1"> title 1.1 </span></h3>
4684 <h4><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=3" title="Edit section: title 1.1.1">edit</a>]</span> <span class="mw-headline" id="title_1.1.1"> title 1.1.1 </span></h4>
4685 <h3><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=4" title="Edit section: title 1.2">edit</a>]</span> <span class="mw-headline" id="title_1.2"> title 1.2 </span></h3>
4686 <h2><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=5" title="Edit section: title 2">edit</a>]</span> <span class="mw-headline" id="title_2"> title 2 </span></h2>
4687 <h3><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=6" title="Edit section: title 2.1">edit</a>]</span> <span class="mw-headline" id="title_2.1"> title 2.1 </span></h3>
4689 !! end
4691 !! test
4692 TOC with wgMaxTocLevel=3 (bug 6204)
4693 !! options
4694 wgMaxTocLevel=3
4695 !! input
4696 == title 1 ==
4697 === title 1.1 ===
4698 ==== title 1.1.1 ====
4699 === title 1.2 ===
4700 == title 2 ==
4701 === title 2.1 ===
4702 !! result
4703 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
4704 <ul>
4705 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
4706 <ul>
4707 <li class="toclevel-2 tocsection-2"><a href="#title_1.1"><span class="tocnumber">1.1</span> <span class="toctext">title 1.1</span></a></li>
4708 <li class="toclevel-2 tocsection-4"><a href="#title_1.2"><span class="tocnumber">1.2</span> <span class="toctext">title 1.2</span></a></li>
4709 </ul>
4710 </li>
4711 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
4712 <ul>
4713 <li class="toclevel-2 tocsection-6"><a href="#title_2.1"><span class="tocnumber">2.1</span> <span class="toctext">title 2.1</span></a></li>
4714 </ul>
4715 </li>
4716 </ul>
4717 </td></tr></table>
4718 <h2><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: title 1">edit</a>]</span> <span class="mw-headline" id="title_1"> title 1 </span></h2>
4719 <h3><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: title 1.1">edit</a>]</span> <span class="mw-headline" id="title_1.1"> title 1.1 </span></h3>
4720 <h4><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=3" title="Edit section: title 1.1.1">edit</a>]</span> <span class="mw-headline" id="title_1.1.1"> title 1.1.1 </span></h4>
4721 <h3><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=4" title="Edit section: title 1.2">edit</a>]</span> <span class="mw-headline" id="title_1.2"> title 1.2 </span></h3>
4722 <h2><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=5" title="Edit section: title 2">edit</a>]</span> <span class="mw-headline" id="title_2"> title 2 </span></h2>
4723 <h3><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=6" title="Edit section: title 2.1">edit</a>]</span> <span class="mw-headline" id="title_2.1"> title 2.1 </span></h3>
4725 !! end
4727 !! test
4728 TOC with wgMaxTocLevel=3 and two level four headings (bug 6204)
4729 !! options
4730 wgMaxTocLevel=3
4731 !! input
4732 ==Section 1==
4733 ===Section 1.1===
4734 ====Section 1.1.1====
4735 ====Section 1.1.1.1====
4736 ==Section 2==
4737 !! result
4738 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
4739 <ul>
4740 <li class="toclevel-1 tocsection-1"><a href="#Section_1"><span class="tocnumber">1</span> <span class="toctext">Section 1</span></a>
4741 <ul>
4742 <li class="toclevel-2 tocsection-2"><a href="#Section_1.1"><span class="tocnumber">1.1</span> <span class="toctext">Section 1.1</span></a></li>
4743 </ul>
4744 </li>
4745 <li class="toclevel-1 tocsection-5"><a href="#Section_2"><span class="tocnumber">2</span> <span class="toctext">Section 2</span></a></li>
4746 </ul>
4747 </td></tr></table>
4748 <h2><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: Section 1">edit</a>]</span> <span class="mw-headline" id="Section_1">Section 1</span></h2>
4749 <h3><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: Section 1.1">edit</a>]</span> <span class="mw-headline" id="Section_1.1">Section 1.1</span></h3>
4750 <h4><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=3" title="Edit section: Section 1.1.1">edit</a>]</span> <span class="mw-headline" id="Section_1.1.1">Section 1.1.1</span></h4>
4751 <h4><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=4" title="Edit section: Section 1.1.1.1">edit</a>]</span> <span class="mw-headline" id="Section_1.1.1.1">Section 1.1.1.1</span></h4>
4752 <h2><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=5" title="Edit section: Section 2">edit</a>]</span> <span class="mw-headline" id="Section_2">Section 2</span></h2>
4754 !! end
4757 !! test
4758 Resolving duplicate section names
4759 !! input
4760 == Foo bar ==
4761 == Foo bar ==
4762 !! result
4763 <h2><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: Foo bar">edit</a>]</span> <span class="mw-headline" id="Foo_bar"> Foo bar </span></h2>
4764 <h2><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: Foo bar">edit</a>]</span> <span class="mw-headline" id="Foo_bar_2"> Foo bar </span></h2>
4766 !! end
4768 !! test
4769 Resolving duplicate section names with differing case (bug 10721)
4770 !! input
4771 == Foo bar ==
4772 == Foo Bar ==
4773 !! result
4774 <h2><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: Foo bar">edit</a>]</span> <span class="mw-headline" id="Foo_bar"> Foo bar </span></h2>
4775 <h2><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: Foo Bar">edit</a>]</span> <span class="mw-headline" id="Foo_Bar_2"> Foo Bar </span></h2>
4777 !! end
4779 !! article
4780 Template:sections
4781 !! text
4782 ===Section 1===
4783 ==Section 2==
4784 !! endarticle
4786 !! test
4787 Template with sections, __NOTOC__
4788 !! input
4789 __NOTOC__
4790 ==Section 0==
4791 {{sections}}
4792 ==Section 4==
4793 !! result
4794 <h2><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: Section 0">edit</a>]</span> <span class="mw-headline" id="Section_0">Section 0</span></h2>
4795 <h3><span class="editsection">[<a href="/index.php?title=Template:Sections&amp;action=edit&amp;section=T-1" title="Template:Sections">edit</a>]</span> <span class="mw-headline" id="Section_1">Section 1</span></h3>
4796 <h2><span class="editsection">[<a href="/index.php?title=Template:Sections&amp;action=edit&amp;section=T-2" title="Template:Sections">edit</a>]</span> <span class="mw-headline" id="Section_2">Section 2</span></h2>
4797 <h2><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: Section 4">edit</a>]</span> <span class="mw-headline" id="Section_4">Section 4</span></h2>
4799 !! end
4801 !! test
4802 __NOEDITSECTION__ keyword
4803 !! input
4804 __NOEDITSECTION__
4805 ==Section 1==
4806 ==Section 2==
4807 !! result
4808 <h2> <span class="mw-headline" id="Section_1">Section 1</span></h2>
4809 <h2> <span class="mw-headline" id="Section_2">Section 2</span></h2>
4811 !! end
4813 !! test
4814 Link inside a section heading
4815 !! input
4816 ==Section with a [[Main Page|link]] in it==
4817 !! result
4818 <h2><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: Section with a link in it">edit</a>]</span> <span class="mw-headline" id="Section_with_a_link_in_it">Section with a <a href="/wiki/Main_Page" title="Main Page">link</a> in it</span></h2>
4820 !! end
4822 !! test
4823 TOC regression (bug 12077)
4824 !! input
4825 __TOC__
4826 == title 1 ==
4827 === title 1.1 ===
4828 == title 2 ==
4829 !! result
4830 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
4831 <ul>
4832 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
4833 <ul>
4834 <li class="toclevel-2 tocsection-2"><a href="#title_1.1"><span class="tocnumber">1.1</span> <span class="toctext">title 1.1</span></a></li>
4835 </ul>
4836 </li>
4837 <li class="toclevel-1 tocsection-3"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a></li>
4838 </ul>
4839 </td></tr></table>
4840 <h2><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: title 1">edit</a>]</span> <span class="mw-headline" id="title_1"> title 1 </span></h2>
4841 <h3><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: title 1.1">edit</a>]</span> <span class="mw-headline" id="title_1.1"> title 1.1 </span></h3>
4842 <h2><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=3" title="Edit section: title 2">edit</a>]</span> <span class="mw-headline" id="title_2"> title 2 </span></h2>
4844 !! end
4846 !! test
4847 BUG 1219 URL next to image (good)
4848 !! input
4849 http://example.com [[Image:foobar.jpg]]
4850 !! result
4851 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a> <a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
4852 </p>
4853 !!end
4855 !! test
4856 Short headings with trailing space should match behaviour of Parser::doHeadings (bug 19910)
4857 !! input
4858 === 
4859 The line above must have a trailing space!
4860 === <!--
4861 --> <!-- -->
4862 But just in case it doesn't...
4863 !! result
4864 <h1><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: =">edit</a>]</span> <span class="mw-headline" id=".3D">=</span></h1>
4865 <p>The line above must have a trailing space!
4866 </p>
4867 <h1><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: =">edit</a>]</span> <span class="mw-headline" id=".3D_2">=</span></h1>
4868 <p>But just in case it doesn't...
4869 </p>
4870 !! end
4872 !! test
4873 Header with special characters (bug 25462)
4874 !! input
4875 The tooltips shall not show entities to the user (ie. be double escaped)
4877 == text > text ==
4878 section 1
4880 == text < text ==
4881 section 2
4883 == text & text ==
4884 section 3
4886 == text ' text ==
4887 section 4
4889 == text " text ==
4890 section 5
4891 !! result
4892 <p>The tooltips shall not show entities to the user (ie. be double escaped)
4893 </p>
4894 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
4895 <ul>
4896 <li class="toclevel-1 tocsection-1"><a href="#text_.3E_text"><span class="tocnumber">1</span> <span class="toctext">text &gt; text</span></a></li>
4897 <li class="toclevel-1 tocsection-2"><a href="#text_.3C_text"><span class="tocnumber">2</span> <span class="toctext">text &lt; text</span></a></li>
4898 <li class="toclevel-1 tocsection-3"><a href="#text_.26_text"><span class="tocnumber">3</span> <span class="toctext">text &amp; text</span></a></li>
4899 <li class="toclevel-1 tocsection-4"><a href="#text_.27_text"><span class="tocnumber">4</span> <span class="toctext">text ' text</span></a></li>
4900 <li class="toclevel-1 tocsection-5"><a href="#text_.22_text"><span class="tocnumber">5</span> <span class="toctext">text " text</span></a></li>
4901 </ul>
4902 </td></tr></table>
4903 <h2><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: text > text">edit</a>]</span> <span class="mw-headline" id="text_.3E_text"> text &gt; text </span></h2>
4904 <p>section 1
4905 </p>
4906 <h2><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: text &lt; text">edit</a>]</span> <span class="mw-headline" id="text_.3C_text"> text &lt; text </span></h2>
4907 <p>section 2
4908 </p>
4909 <h2><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=3" title="Edit section: text &amp; text">edit</a>]</span> <span class="mw-headline" id="text_.26_text"> text &amp; text </span></h2>
4910 <p>section 3
4911 </p>
4912 <h2><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=4" title="Edit section: text ' text">edit</a>]</span> <span class="mw-headline" id="text_.27_text"> text ' text </span></h2>
4913 <p>section 4
4914 </p>
4915 <h2><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=5" title="Edit section: text &quot; text">edit</a>]</span> <span class="mw-headline" id="text_.22_text"> text " text </span></h2>
4916 <p>section 5
4917 </p>
4918 !! end
4920 !! test
4921 BUG 1219 URL next to image (broken)
4922 !! input
4923 http://example.com[[Image:foobar.jpg]]
4924 !! result
4925 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
4926 </p>
4927 !!end
4929 !! test
4930 Bug 1186 news: in the middle of text
4931 !! input
4932 http://en.wikinews.org/wiki/Wikinews:Workplace
4933 !! result
4934 <p><a rel="nofollow" class="external free" href="http://en.wikinews.org/wiki/Wikinews:Workplace">http://en.wikinews.org/wiki/Wikinews:Workplace</a>
4935 </p>
4936 !!end
4939 !! test
4940 Namespaced link must have a title
4941 !! input
4942 [[Project:]]
4943 !! result
4944 <p>[[Project:]]
4945 </p>
4946 !!end
4948 !! test
4949 Namespaced link must have a title (bad fragment version)
4950 !! input
4951 [[Project:#fragment]]
4952 !! result
4953 <p>[[Project:#fragment]]
4954 </p>
4955 !!end
4958 !! test
4959 div with no attributes
4960 !! input
4961 <div>HTML rocks</div>
4962 !! result
4963 <div>HTML rocks</div>
4965 !! end
4967 !! test
4968 div with double-quoted attribute
4969 !! input
4970 <div id="rock">HTML rocks</div>
4971 !! result
4972 <div id="rock">HTML rocks</div>
4974 !! end
4976 !! test
4977 div with single-quoted attribute
4978 !! input
4979 <div id='rock'>HTML rocks</div>
4980 !! result
4981 <div id="rock">HTML rocks</div>
4983 !! end
4985 !! test
4986 div with unquoted attribute
4987 !! input
4988 <div id=rock>HTML rocks</div>
4989 !! result
4990 <div id="rock">HTML rocks</div>
4992 !! end
4994 !! test
4995 div with illegal double attributes
4996 !! input
4997 <div align="center" align="right">HTML rocks</div>
4998 !! result
4999 <div align="right">HTML rocks</div>
5001 !!end
5003 !! test
5004 HTML multiple attributes correction
5005 !! input
5006 <p class="error" class="awesome">Awesome!</p>
5007 !! result
5008 <p class="awesome">Awesome!</p>
5010 !!end
5012 !! test
5013 Table multiple attributes correction
5014 !! input
5016 !+ class="error" class="awesome"| status
5018 !! result
5019 <table>
5020 <tr>
5021 <th class="awesome">status
5022 </th>
5023 </tr>
5024 </table>
5026 !!end
5028 !! test
5029 DIV IN UPPERCASE
5030 !! input
5031 <DIV ALIGN="center">HTML ROCKS</DIV>
5032 !! result
5033 <div align="center">HTML ROCKS</div>
5035 !!end
5038 !! test
5039 text with amp in the middle of nowhere
5040 !! input
5041 Remember AT&T?
5042 !!result
5043 <p>Remember AT&amp;T?
5044 </p>
5045 !! end
5047 !! test
5048 text with character entity: eacute
5049 !! input
5050 I always thought &eacute; was a cute letter.
5051 !! result
5052 <p>I always thought &#233; was a cute letter.
5053 </p>
5054 !! end
5056 !! test
5057 text with undefined character entity: xacute
5058 !! input
5059 I always thought &xacute; was a cute letter.
5060 !! result
5061 <p>I always thought &amp;xacute; was a cute letter.
5062 </p>
5063 !! end
5067 ### Media links
5070 !! test
5071 Media link
5072 !! input
5073 [[Media:Foobar.jpg]]
5074 !! result
5075 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Media:Foobar.jpg</a>
5076 </p>
5077 !! end
5079 !! test
5080 Media link with text
5081 !! input
5082 [[Media:Foobar.jpg|A neat file to look at]]
5083 !! result
5084 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">A neat file to look at</a>
5085 </p>
5086 !! end
5088 # FIXME: this is still bad HTML tag nesting
5089 !! test
5090 Media link with nasty text
5091 fixme: doBlockLevels won't wrap this in a paragraph because it contains a div
5092 !! input
5093 [[Media:Foobar.jpg|Safe Link<div style=display:none>" onmouseover="alert(document.cookie)" onfoo="</div>]]
5094 !! result
5095 <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>
5097 !! end
5099 !! test
5100 Media link to nonexistent file (bug 1702)
5101 !! input
5102 [[Media:No such.jpg]]
5103 !! result
5104 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=No_such.jpg" class="new" title="No such.jpg">Media:No such.jpg</a>
5105 </p>
5106 !! end
5108 !! test
5109 Image link to nonexistent file (bug 1850 - good)
5110 !! input
5111 [[Image:No such.jpg]]
5112 !! result
5113 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=No_such.jpg" class="new" title="File:No such.jpg">File:No such.jpg</a>
5114 </p>
5115 !! end
5117 !! test
5118 :Image link to nonexistent file (bug 1850 - bad)
5119 !! input
5120 [[:Image:No such.jpg]]
5121 !! result
5122 <p><a href="/index.php?title=File:No_such.jpg&amp;action=edit&amp;redlink=1" class="new" title="File:No such.jpg (page does not exist)">Image:No such.jpg</a>
5123 </p>
5124 !! end
5128 !! test
5129 Character reference normalization in link text (bug 1938)
5130 !! input
5131 [[Main Page|this&that]]
5132 !! result
5133 <p><a href="/wiki/Main_Page" title="Main Page">this&amp;that</a>
5134 </p>
5135 !!end
5137 !! article
5138 אַ
5139 !! text
5140 Test for unicode normalization
5142 The page's name is U+05d0 U+05b7, with non-canonical form U+FB2E
5143 !! endarticle
5145 !! test
5146 (bug 19451) Links should refer to the normalized form.
5147 !! input
5148 [[&#xFB2E;]]
5149 [[&#x5d0;&#x5b7;]]
5150 [[&#x5d0;ַ]]
5151 [[א&#x5b7;]]
5152 [[אַ]]
5153 !! result
5154 <p><a href="/wiki/%D7%90%D6%B7" title="אַ">&#xfb2e;</a>
5155 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;&#x5b7;</a>
5156 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;ַ</a>
5157 <a href="/wiki/%D7%90%D6%B7" title="אַ">א&#x5b7;</a>
5158 <a href="/wiki/%D7%90%D6%B7" title="אַ">אַ</a>
5159 </p>
5160 !! end
5162 !! test
5163 Empty attribute crash test (bug 2067)
5164 !! input
5165 <font color="">foo</font>
5166 !! result
5167 <p><font color="">foo</font>
5168 </p>
5169 !! end
5171 !! test
5172 Empty attribute crash test single-quotes (bug 2067)
5173 !! input
5174 <font color=''>foo</font>
5175 !! result
5176 <p><font color="">foo</font>
5177 </p>
5178 !! end
5180 !! test
5181 Attribute test: equals, then nothing
5182 !! input
5183 <font color=>foo</font>
5184 !! result
5185 <p><font>foo</font>
5186 </p>
5187 !! end
5189 !! test
5190 Attribute test: unquoted value
5191 !! input
5192 <font color=x>foo</font>
5193 !! result
5194 <p><font color="x">foo</font>
5195 </p>
5196 !! end
5198 !! test
5199 Attribute test: unquoted but illegal value (hash)
5200 !! input
5201 <font color=#x>foo</font>
5202 !! result
5203 <p><font color="#x">foo</font>
5204 </p>
5205 !! end
5207 !! test
5208 Attribute test: no value
5209 !! input
5210 <font color>foo</font>
5211 !! result
5212 <p><font color="color">foo</font>
5213 </p>
5214 !! end
5216 !! test
5217 Bug 2095: link with three closing brackets
5218 !! input
5219 [[Main Page]]]
5220 !! result
5221 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>]
5222 </p>
5223 !! end
5225 !! test
5226 Bug 2095: link with pipe and three closing brackets
5227 !! input
5228 [[Main Page|link]]]
5229 !! result
5230 <p><a href="/wiki/Main_Page" title="Main Page">link</a>]
5231 </p>
5232 !! end
5234 !! test
5235 Bug 2095: link with pipe and three closing brackets, version 2
5236 !! input
5237 [[Main Page|[http://example.com/]]]
5238 !! result
5239 <p><a href="/wiki/Main_Page" title="Main Page">[http://example.com/]</a>
5240 </p>
5241 !! end
5245 ### Safety
5248 !! article
5249 Template:Dangerous attribute
5250 !! text
5251 " onmouseover="alert(document.cookie)
5252 !! endarticle
5254 !! article
5255 Template:Dangerous style attribute
5256 !! text
5257 border-size: expression(alert(document.cookie))
5258 !! endarticle
5260 !! article
5261 Template:Div style
5262 !! text
5263 <div style="float: right; {{{1}}}">Magic div</div>
5264 !! endarticle
5266 !! test
5267 Bug 2304: HTML attribute safety (safe template; regression bug 2309)
5268 !! input
5269 <div title="{{test}}"></div>
5270 !! result
5271 <div title="This is a test template"></div>
5273 !! end
5275 !! test
5276 Bug 2304: HTML attribute safety (dangerous template; 2309)
5277 !! input
5278 <div title="{{dangerous attribute}}"></div>
5279 !! result
5280 <div title=""></div>
5282 !! end
5284 !! test
5285 Bug 2304: HTML attribute safety (dangerous style template; 2309)
5286 !! input
5287 <div style="{{dangerous style attribute}}"></div>
5288 !! result
5289 <div style="/* insecure input */"></div>
5291 !! end
5293 !! test
5294 Bug 2304: HTML attribute safety (safe parameter; 2309)
5295 !! input
5296 {{div style|width: 200px}}
5297 !! result
5298 <div style="float: right; width: 200px">Magic div</div>
5300 !! end
5302 !! test
5303 Bug 2304: HTML attribute safety (unsafe parameter; 2309)
5304 !! input
5305 {{div style|width: expression(alert(document.cookie))}}
5306 !! result
5307 <div style="/* insecure input */">Magic div</div>
5309 !! end
5311 !! test
5312 Bug 2304: HTML attribute safety (unsafe breakout parameter; 2309)
5313 !! input
5314 {{div style|"><script>alert(document.cookie)</script>}}
5315 !! result
5316 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
5318 !! end
5320 !! test
5321 Bug 2304: HTML attribute safety (unsafe breakout parameter 2; 2309)
5322 !! input
5323 {{div style|" ><script>alert(document.cookie)</script>}}
5324 !! result
5325 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
5327 !! end
5329 !! test
5330 Bug 2304: HTML attribute safety (link)
5331 !! input
5332 <div title="[[Main Page]]"></div>
5333 !! result
5334 <div title="&#91;&#91;Main Page]]"></div>
5336 !! end
5338 !! test
5339 Bug 2304: HTML attribute safety (italics)
5340 !! input
5341 <div title="''foobar''"></div>
5342 !! result
5343 <div title="&#39;&#39;foobar&#39;&#39;"></div>
5345 !! end
5347 !! test
5348 Bug 2304: HTML attribute safety (bold)
5349 !! input
5350 <div title="'''foobar'''"></div>
5351 !! result
5352 <div title="&#39;&#39;&#39;foobar&#39;&#39;&#39;"></div>
5354 !! end
5357 !! test
5358 Bug 2304: HTML attribute safety (ISBN)
5359 !! input
5360 <div title="ISBN 1234567890"></div>
5361 !! result
5362 <div title="&#73;SBN 1234567890"></div>
5364 !! end
5366 !! test
5367 Bug 2304: HTML attribute safety (RFC)
5368 !! input
5369 <div title="RFC 1234"></div>
5370 !! result
5371 <div title="&#82;FC 1234"></div>
5373 !! end
5375 !! test
5376 Bug 2304: HTML attribute safety (PMID)
5377 !! input
5378 <div title="PMID 1234567890"></div>
5379 !! result
5380 <div title="&#80;MID 1234567890"></div>
5382 !! end
5384 !! test
5385 Bug 2304: HTML attribute safety (web link)
5386 !! input
5387 <div title="http://example.com/"></div>
5388 !! result
5389 <div title="http&#58;//example.com/"></div>
5391 !! end
5393 !! test
5394 Bug 2304: HTML attribute safety (named web link)
5395 !! input
5396 <div title="[http://example.com/ link]"></div>
5397 !! result
5398 <div title="&#91;http&#58;//example.com/ link]"></div>
5400 !! end
5402 !! test
5403 Bug 3244: HTML attribute safety (extension; safe)
5404 !! input
5405 <div style="<nowiki>background:blue</nowiki>"></div>
5406 !! result
5407 <div style="background:blue"></div>
5409 !! end
5411 !! test
5412 Bug 3244: HTML attribute safety (extension; unsafe)
5413 !! input
5414 <div style="<nowiki>border-left:expression(alert(document.cookie))</nowiki>"></div>
5415 !! result
5416 <div style="/* insecure input */"></div>
5418 !! end
5420 # More MSIE fun discovered by Tom Gilder
5422 !! test
5423 MSIE CSS safety test: spurious slash
5424 !! input
5425 <div style="background-image:u\rl(javascript:alert('boo'))">evil</div>
5426 !! result
5427 <div style="/* insecure input */">evil</div>
5429 !! end
5431 !! test
5432 MSIE CSS safety test: hex code
5433 !! input
5434 <div style="background-image:u\72l(javascript:alert('boo'))">evil</div>
5435 !! result
5436 <div style="/* insecure input */">evil</div>
5438 !! end
5440 !! test
5441 MSIE CSS safety test: comment in url
5442 !! input
5443 <div style="background-image:u/**/rl(javascript:alert('boo'))">evil</div>
5444 !! result
5445 <div style="background-image:u rl(javascript:alert(&#39;boo&#39;))">evil</div>
5447 !! end
5449 !! test
5450 MSIE CSS safety test: comment in expression
5451 !! input
5452 <div style="background-image:expres/**/sion(alert('boo4'))">evil4</div>
5453 !! result
5454 <div style="background-image:expres sion(alert(&#39;boo4&#39;))">evil4</div>
5456 !! end
5459 !! test
5460 Table attribute legitimate extension
5461 !! input
5463 !+ style="<nowiki>color:blue</nowiki>"| status
5465 !! result
5466 <table>
5467 <tr>
5468 <th style="color:blue">status
5469 </th>
5470 </tr>
5471 </table>
5473 !!end
5475 !! test
5476 Table attribute safety
5477 !! input
5479 !+ style="<nowiki>border-width:expression(0+alert(document.cookie))</nowiki>"| status
5481 !! result
5482 <table>
5483 <tr>
5484 <th style="/* insecure input */">status
5485 </th>
5486 </tr>
5487 </table>
5489 !! end
5491 !! test
5492 CSS line continuation 1
5493 !! input
5494 <div style="background-image: u\&#10;rl(test.jpg);"></div>
5495 !! result
5496 <div style="/* insecure input */"></div>
5498 !! end
5500 !! test
5501 CSS line continuation 2
5502 !! input
5503 <div style="background-image: u\&#13;rl(test.jpg); "></div>
5504 !! result
5505 <div style="/* insecure input */"></div>
5507 !! end
5509 !! article
5510 Template:Identity
5511 !! text
5512 {{{1}}}
5513 !! endarticle
5515 !! test
5516 Expansion of multi-line templates in attribute values (bug 6255)
5517 !! input
5518 <div style="background: {{identity|#00FF00}}">-</div>
5519 !! result
5520 <div style="background: #00FF00">-</div>
5522 !! end
5525 !! test
5526 Expansion of multi-line templates in attribute values (bug 6255 sanity check)
5527 !! input
5528 <div style="background: 
5529 #00FF00">-</div>
5530 !! result
5531 <div style="background: #00FF00">-</div>
5533 !! end
5535 !! test
5536 Expansion of multi-line templates in attribute values (bug 6255 sanity check 2)
5537 !! input
5538 <div style="background: &#10;#00FF00">-</div>
5539 !! result
5540 <div style="background: &#10;#00FF00">-</div>
5542 !! end
5545 ### Parser hooks (see maintenance/parserTestsParserHook.php for the <tag> extension)
5547 !! test
5548 Parser hook: empty input
5549 !! input
5550 <tag></tag>
5551 !! result
5552 <pre>
5553 string(0) ""
5554 array(0) {
5556 </pre>
5558 !! end
5560 !! test
5561 Parser hook: empty input using terminated empty elements
5562 !! input
5563 <tag/>
5564 !! result
5565 <pre>
5566 NULL
5567 array(0) {
5569 </pre>
5571 !! end
5573 !! test
5574 Parser hook: empty input using terminated empty elements (space before)
5575 !! input
5576 <tag />
5577 !! result
5578 <pre>
5579 NULL
5580 array(0) {
5582 </pre>
5584 !! end
5586 !! test
5587 Parser hook: basic input
5588 !! input
5589 <tag>input</tag>
5590 !! result
5591 <pre>
5592 string(5) "input"
5593 array(0) {
5595 </pre>
5597 !! end
5600 !! test
5601 Parser hook: case insensitive
5602 !! input
5603 <TAG>input</TAG>
5604 !! result
5605 <pre>
5606 string(5) "input"
5607 array(0) {
5609 </pre>
5611 !! end
5614 !! test
5615 Parser hook: case insensitive, redux
5616 !! input
5617 <TaG>input</TAg>
5618 !! result
5619 <pre>
5620 string(5) "input"
5621 array(0) {
5623 </pre>
5625 !! end
5627 !! test
5628 Parser hook: nested tags
5629 !! options
5630 noxml
5631 !! input
5632 <tag><tag></tag></tag>
5633 !! result
5634 <pre>
5635 string(5) "<tag>"
5636 array(0) {
5638 </pre>&lt;/tag&gt;
5640 !! end
5642 !! test
5643 Parser hook: basic arguments
5644 !! input
5645 <tag width=200 height = "100" depth = '50' square></tag>
5646 !! result
5647 <pre>
5648 string(0) ""
5649 array(4) {
5650   ["width"]=>
5651   string(3) "200"
5652   ["height"]=>
5653   string(3) "100"
5654   ["depth"]=>
5655   string(2) "50"
5656   ["square"]=>
5657   string(6) "square"
5659 </pre>
5661 !! end
5663 !! test
5664 Parser hook: argument containing a forward slash (bug 5344)
5665 !! input
5666 <tag filename='/tmp/bla'></tag>
5667 !! result
5668 <pre>
5669 string(0) ""
5670 array(1) {
5671   ["filename"]=>
5672   string(8) "/tmp/bla"
5674 </pre>
5676 !! end
5678 !! test
5679 Parser hook: empty input using terminated empty elements (bug 2374)
5680 !! input
5681 <tag foo=bar/>text
5682 !! result
5683 <pre>
5684 NULL
5685 array(1) {
5686   ["foo"]=>
5687   string(3) "bar"
5689 </pre>text
5691 !! end
5693 # </tag> should be output literally since there is no matching tag that begins it
5694 !! test
5695 Parser hook: basic arguments using terminated empty elements (bug 2374)
5696 !! input
5697 <tag width=200 height = "100" depth = '50' square/>
5698 other stuff
5699 </tag>
5700 !! result
5701 <pre>
5702 NULL
5703 array(4) {
5704   ["width"]=>
5705   string(3) "200"
5706   ["height"]=>
5707   string(3) "100"
5708   ["depth"]=>
5709   string(2) "50"
5710   ["square"]=>
5711   string(6) "square"
5713 </pre>
5714 <p>other stuff
5715 &lt;/tag&gt;
5716 </p>
5717 !! end
5720 ### (see maintenance/parserTestsStaticParserHook.php for the <statictag> extension)
5723 !! test
5724 Parser hook: static parser hook not inside a comment
5725 !! input
5726 <statictag>hello, world</statictag>
5727 <statictag action=flush/>
5728 !! result
5729 <p>hello, world
5730 </p>
5731 !! end
5734 !! test
5735 Parser hook: static parser hook inside a comment
5736 !! input
5737 <!-- <statictag>hello, world</statictag> -->
5738 <statictag action=flush/>
5739 !! result
5740 <p><br />
5741 </p>
5742 !! end
5744 # Nested template calls; this case was broken by Parser.php rev 1.506,
5745 # since reverted.
5747 !! article
5748 Template:One-parameter
5749 !! text
5750 (My parameter is: {{{1}}})
5751 !! endarticle
5753 !! article
5754 Template:Map-one-parameter
5755 !! text
5756 {{{{{1}}}|{{{2}}}}}
5757 !! endarticle
5759 !! test
5760 Nested template calls
5761 !! input
5762 {{Map-one-parameter|One-parameter|param}}
5763 !! result
5764 <p>(My parameter is: param)
5765 </p>
5766 !! end
5770 ### Sanitizer
5772 !! test
5773 Sanitizer: Closing of open tags
5774 !! input
5775 <s></s><table></table>
5776 !! result
5777 <s></s><table></table>
5779 !! end
5781 !! test
5782 Sanitizer: Closing of open but not closed tags
5783 !! input
5784 <s>foo
5785 !! result
5786 <p><s>foo</s>
5787 </p>
5788 !! end
5790 !! test
5791 Sanitizer: Closing of closed but not open tags
5792 !! input
5793 </s>
5794 !! result
5795 <p>&lt;/s&gt;
5796 </p>
5797 !! end
5799 !! test
5800 Sanitizer: Closing of closed but not open table tags
5801 !! input
5802 Table not started</td></tr></table>
5803 !! result
5804 <p>Table not started&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
5805 </p>
5806 !! end
5808 !! test
5809 Sanitizer: Escaping of spaces, multibyte characters, colons & other stuff in id=""
5810 !! input
5811 <span id="æ: v">byte</span>[[#æ: v|backlink]]
5812 !! result
5813 <p><span id=".C3.A6:_v">byte</span><a href="#.C3.A6:_v">backlink</a>
5814 </p>
5815 !! end
5817 !! test
5818 Sanitizer: Validating the contents of the id attribute (bug 4515)
5819 !! options
5820 disabled
5821 !! input
5822 <br id=9 />
5823 !! result
5824 Something, but definitely not <br id="9" />...
5825 !! end
5827 !! test
5828 Sanitizer: Validating id attribute uniqueness (bug 4515, bug 6301)
5829 !! options
5830 disabled
5831 !! input
5832 <br id="foo" /><br id="foo" />
5833 !! result
5834 Something need to be done. foo-2 ? 
5835 !! end
5837 !! test
5838 Language converter: output gets cut off unexpectedly (bug 5757)
5839 !! options
5840 language=zh
5841 !! input
5842 this bit is safe: }-
5844 but if we add a conversion instance: -{zh-cn:xxx;zh-tw:yyy}-
5846 then we get cut off here: }-
5848 all additional text is vanished
5849 !! result
5850 <p>this bit is safe: }-
5851 </p><p>but if we add a conversion instance: xxx
5852 </p><p>then we get cut off here: }-
5853 </p><p>all additional text is vanished
5854 </p>
5855 !! end
5857 !! test
5858 Self closed html pairs (bug 5487)
5859 !! options
5860 !! input
5861 <center><font id="bug" />Centered text</center>
5862 <div><font id="bug2" />In div text</div>
5863 !! result
5864 <center>&lt;font id="bug" /&gt;Centered text</center>
5865 <div>&lt;font id="bug2" /&gt;In div text</div>
5867 !! end
5873 !! test
5874 Punctuation: nbsp before exclamation
5875 !! input
5876 C'est grave !
5877 !! result
5878 <p>C'est grave&#160;!
5879 </p>
5880 !! end
5882 !! test
5883 Punctuation: CSS !important (bug 11874)
5884 !! input
5885 <div style="width:50% !important">important</div>
5886 !! result
5887 <div style="width:50% !important">important</div>
5889 !!end
5891 !! test
5892 Punctuation: CSS ! important (bug 11874; with space after)
5893 !! input
5894 <div style="width:50% ! important">important</div>
5895 !! result
5896 <div style="width:50% ! important">important</div>
5898 !!end
5901 !! test
5902 HTML bullet list, closed tags (bug 5497)
5903 !! input
5904 <ul>
5905 <li>One</li>
5906 <li>Two</li>
5907 </ul>
5908 !! result
5909 <ul>
5910 <li>One</li>
5911 <li>Two</li>
5912 </ul>
5914 !! end
5916 !! test
5917 HTML bullet list, unclosed tags (bug 5497)
5918 !! options
5919 disabled
5920 !! input
5921 <ul>
5922 <li>One
5923 <li>Two
5924 </ul>
5925 !! result
5926 <ul>
5927 <li>One
5928 </li><li>Two
5929 </li></ul>
5931 !! end
5933 !! test
5934 HTML ordered list, closed tags (bug 5497)
5935 !! input
5936 <ol>
5937 <li>One</li>
5938 <li>Two</li>
5939 </ol>
5940 !! result
5941 <ol>
5942 <li>One</li>
5943 <li>Two</li>
5944 </ol>
5946 !! end
5948 !! test
5949 HTML ordered list, unclosed tags (bug 5497)
5950 !! options
5951 disabled
5952 !! input
5953 <ol>
5954 <li>One
5955 <li>Two
5956 </ol>
5957 !! result
5958 <ol>
5959 <li>One
5960 </li><li>Two
5961 </li></ol>
5963 !! end
5965 !! test
5966 HTML nested bullet list, closed tags (bug 5497)
5967 !! input
5968 <ul>
5969 <li>One</li>
5970 <li>Two:
5971 <ul>
5972 <li>Sub-one</li>
5973 <li>Sub-two</li>
5974 </ul>
5975 </li>
5976 </ul>
5977 !! result
5978 <ul>
5979 <li>One</li>
5980 <li>Two:
5981 <ul>
5982 <li>Sub-one</li>
5983 <li>Sub-two</li>
5984 </ul>
5985 </li>
5986 </ul>
5988 !! end
5990 !! test
5991 HTML nested bullet list, open tags (bug 5497)
5992 !! options
5993 disabled
5994 !! input
5995 <ul>
5996 <li>One
5997 <li>Two:
5998 <ul>
5999 <li>Sub-one
6000 <li>Sub-two
6001 </ul>
6002 </ul>
6003 !! result
6004 <ul>
6005 <li>One
6006 </li><li>Two:
6007 <ul>
6008 <li>Sub-one
6009 </li><li>Sub-two
6010 </li></ul>
6011 </li></ul>
6013 !! end
6015 !! test
6016 HTML nested ordered list, closed tags (bug 5497)
6017 !! input
6018 <ol>
6019 <li>One</li>
6020 <li>Two:
6021 <ol>
6022 <li>Sub-one</li>
6023 <li>Sub-two</li>
6024 </ol>
6025 </li>
6026 </ol>
6027 !! result
6028 <ol>
6029 <li>One</li>
6030 <li>Two:
6031 <ol>
6032 <li>Sub-one</li>
6033 <li>Sub-two</li>
6034 </ol>
6035 </li>
6036 </ol>
6038 !! end
6040 !! test
6041 HTML nested ordered list, open tags (bug 5497)
6042 !! options
6043 disabled
6044 !! input
6045 <ol>
6046 <li>One
6047 <li>Two:
6048 <ol>
6049 <li>Sub-one
6050 <li>Sub-two
6051 </ol>
6052 </ol>
6053 !! result
6054 <ol>
6055 <li>One
6056 </li><li>Two:
6057 <ol>
6058 <li>Sub-one
6059 </li><li>Sub-two
6060 </li></ol>
6061 </li></ol>
6063 !! end
6065 !! test
6066 HTML ordered list item with parameters oddity
6067 !! input
6068 <ol><li id="fragment">One</li></ol>
6069 !! result
6070 <ol><li id="fragment">One</li></ol>
6072 !! end
6074 !!test
6075 bug 5918: autonumbering
6076 !! input
6077 [http://first/] [http://second] [ftp://ftp]
6079 ftp://inlineftp
6081 [mailto:enclosed@mail.tld With target]
6083 [mailto:enclosed@mail.tld]
6085 mailto:inline@mail.tld
6086 !! result
6087 <p><a rel="nofollow" class="external autonumber" href="http://first/">[1]</a> <a rel="nofollow" class="external autonumber" href="http://second">[2]</a> <a rel="nofollow" class="external autonumber" href="ftp://ftp">[3]</a>
6088 </p><p><a rel="nofollow" class="external free" href="ftp://inlineftp">ftp://inlineftp</a>
6089 </p><p><a rel="nofollow" class="external text" href="mailto:enclosed@mail.tld">With target</a>
6090 </p><p><a rel="nofollow" class="external autonumber" href="mailto:enclosed@mail.tld">[4]</a>
6091 </p><p><a rel="nofollow" class="external free" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a>
6092 </p>
6093 !! end
6097 # Security and HTML correctness
6098 # From Nick Jenkins' fuzz testing
6101 !! test
6102 Fuzz testing: Parser13
6103 !! input
6104 {| 
6105 | http://a|
6106 !! result
6107 <table>
6108 <tr>
6109 <td></td>
6110 </tr>
6111 </table>
6113 !! end
6115 !! test
6116 Fuzz testing: Parser14
6117 !! input
6118 == onmouseover= ==
6119 http://__TOC__
6120 !! result
6121 <h2><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: onmouseover=">edit</a>]</span> <span class="mw-headline" id="onmouseover.3D"> onmouseover= </span></h2>
6122 http://<table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
6123 <ul>
6124 <li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
6125 </ul>
6126 </td></tr></table>
6128 !! end
6130 !! test
6131 Fuzz testing: Parser14-table
6132 !! input
6133 ==a==
6134 {| STYLE=__TOC__
6135 |foo
6136 !! result
6137 <h2><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: a">edit</a>]</span> <span class="mw-headline" id="a">a</span></h2>
6138 <table style="&#95;_TOC&#95;_">
6139 <tr>
6140 <td>foo
6141 </td>
6142 </tr>
6143 </table>
6145 !! end
6147 # Known to produce bogus xml (extra </td>)
6148 !! test
6149 Fuzz testing: Parser16
6150 !! options
6151 noxml
6152 !! input
6154 !https://||||||
6155 !! result
6156 <table>
6157 <tr>
6158 <th>https://
6159 </th>
6160 <th></th>
6161 <th></th>
6162 <th></th>
6163 </tr>
6164 </table>
6166 !! end
6168 !! test
6169 Fuzz testing: Parser21
6170 !! input
6172 ! irc://{{ftp://a" onmouseover="alert('hello world');"
6174 !! result
6175 <table>
6176 <tr>
6177 <th><a rel="nofollow" class="external free" href="irc://{{ftp://a">irc://{{ftp://a</a>" onmouseover="alert('hello world');"
6178 </th>
6179 <td></td>
6180 </tr>
6181 </table>
6183 !! end
6185 !! test
6186 Fuzz testing: Parser22
6187 !! input
6188 http://===r:::https://b
6192 !!result
6193 <p><a rel="nofollow" class="external free" href="http://===r:::https://b">http://===r:::https://b</a>
6194 </p><p><br />
6195 </p>
6196 !! end
6198 # Known to produce bad XML for now
6200 # Note: the current result listed for this is not what the original one was,
6201 # but the original bug was JavaScript injection, which is fixed in any case.
6202 # It's not clear that the original result listed was any more correct than the
6203 # current one.  Original result:
6204 # <table>
6205 # {{{|
6206 # <u class="&#124;">}}}} &gt;
6207 # <br style="onmouseover=&#39;alert(document.cookie);&#39;" />
6209 # MOVE YOUR MOUSE CURSOR OVER THIS TEXT
6210 # <tr>
6211 # <td></u>
6212 # </td>
6213 # </tr>
6214 # </table>
6215 # Known to produce bad XML for now
6216 !! test
6217 Fuzz testing: Parser24
6218 !! options
6219 noxml
6220 !! input
6222 {{{|
6223 <u CLASS=
6224 | {{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx--><noinclude>}}}} >
6225 <br style="onmouseover='alert(document.cookie);' " />
6227 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
6229 !! result
6230 <p>{{{|
6231 <u class="&#124;">}}}} &gt;
6232 <br style="onmouseover=&#39;alert(document.cookie);&#39;" />
6233 </p><p>MOVE YOUR MOUSE CURSOR OVER THIS TEXT
6234 </p>
6235 <table>
6236 <tr>
6237 <td></u>
6238 </td>
6239 </tr>
6240 </table>
6242 !! end
6244 # Note: the current result listed for this is not what the original one was,
6245 # but the original bug was JavaScript injection, which is fixed in any case.
6246 # It's not clear that the original result listed was any more correct than the
6247 # current one.  Original result:
6248 # <p>{{{| 
6249 # </p>
6250 # <li class="&#124;&#124;">
6251 # }}}blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
6252 !!test
6253 Fuzz testing: Parser25 (bug 6055)
6254 !! input
6257 <LI CLASS=||
6259 }}}blah" onmouseover="alert('hello world');" align="left"'''MOVE MOUSE CURSOR OVER HERE
6260 !! result
6261 <p>&lt;LI CLASS=blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
6262 </p>
6263 !! end
6265 !!test
6266 Fuzz testing: URL adjacent extension (with space, clean)
6267 !! options
6268 !! input
6269 http://example.com <nowiki>junk</nowiki>
6270 !! result
6271 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a> junk
6272 </p>
6273 !!end
6275 !!test
6276 Fuzz testing: URL adjacent extension (no space, dirty; nowiki)
6277 !! options
6278 !! input
6279 http://example.com<nowiki>junk</nowiki>
6280 !! result
6281 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>junk
6282 </p>
6283 !!end
6285 !!test
6286 Fuzz testing: URL adjacent extension (no space, dirty; pre)
6287 !! options
6288 !! input
6289 http://example.com<pre>junk</pre>
6290 !! result
6291 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a><pre>junk</pre>
6293 !!end
6295 !!test
6296 Fuzz testing: image with bogus manual thumbnail
6297 !!input
6298 [[Image:foobar.jpg|thumbnail= ]]
6299 !!result
6300 <div class="thumb tright"><div class="thumbinner" style="width:1943px;">Error creating thumbnail:   <div class="thumbcaption"></div></div></div>
6302 !!end
6304 !! test
6305 Fuzz testing: encoded newline in generated HTML replacements (bug 6577)
6306 !! input
6307 <pre dir="&#10;"></pre>
6308 !! result
6309 <pre dir="&#10;"></pre>
6311 !! end
6313 !! test
6314 Parsing optional HTML elements (Bug 6171)
6315 !! options
6316 !! input
6317 <table>
6318   <tr>
6319     <td> Some tabular data</td>
6320     <td> More tabular data ...
6321     <td> And yet som tabular data</td>
6322   </tr>
6323 </table>
6324 !! result
6325 <table>
6326   <tr>
6327     <td> Some tabular data</td>
6328     <td> More tabular data ...
6329     </td><td> And yet som tabular data</td>
6330   </tr>
6331 </table>
6333 !! end
6335 !! test
6336 Correct handling of <td>, <tr> (Bug 6171)
6337 !! options
6338 !! input
6339 <table>
6340   <tr>
6341     <td> Some tabular data</td>
6342     <td> More tabular data ...</td>
6343     <td> And yet som tabular data</td>
6344   </tr>
6345 </table>
6346 !! result
6347 <table>
6348   <tr>
6349     <td> Some tabular data</td>
6350     <td> More tabular data ...</td>
6351     <td> And yet som tabular data</td>
6352   </tr>
6353 </table>
6355 !! end
6358 !! test
6359 Parsing crashing regression (fr:JavaScript)
6360 !! input
6361 </body></x>
6362 !! result
6363 <p>&lt;/body&gt;&lt;/x&gt;
6364 </p>
6365 !! end
6367 !! test
6368 Inline wiki vs wiki block nesting
6369 !! input
6370 '''Bold paragraph
6372 New wiki paragraph
6373 !! result
6374 <p><b>Bold paragraph</b>
6375 </p><p>New wiki paragraph
6376 </p>
6377 !! end
6379 !! test
6380 Inline HTML vs wiki block nesting
6381 !! options
6382 disabled
6383 !! input
6384 <b>Bold paragraph
6386 New wiki paragraph
6387 !! result
6388 <p><b>Bold paragraph</b>
6389 </p><p>New wiki paragraph
6390 </p>
6391 !! end
6393 # Original result was this:
6394 # <p><b>bold</b><b>bold<i>bolditalics</i></b>
6395 # </p>
6396 # While that might be marginally more intuitive, maybe, the six-apostrophe
6397 # construct is clearly pathological and the result stated here (which is what
6398 # the parser actually does) is about as reasonable as anything.
6399 !!test
6400 Mixing markup for italics and bold
6401 !! options
6402 !! input
6403 '''bold''''''bold''bolditalics'''''
6404 !! result
6405 <p>'<i>bold'</i><b>bold<i>bolditalics</i></b>
6406 </p>
6407 !! end
6410 !! article
6411 Xyzzyx
6412 !! text
6413 Article for special page transclusion test
6414 !! endarticle
6416 !! test
6417 Special page transclusion
6418 !! options
6419 !! input
6420 {{Special:Prefixindex/Xyzzyx}}
6421 !! result
6422 <p><br />
6423 </p>
6424 <table border="0" id="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
6426 !! end
6428 !! test
6429 Special page transclusion twice (bug 5021)
6430 !! options
6431 !! input
6432 {{Special:Prefixindex/Xyzzyx}}
6433 {{Special:Prefixindex/Xyzzyx}}
6434 !! result
6435 <p><br />
6436 </p>
6437 <table border="0" id="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
6438 <p><br />
6439 </p>
6440 <table border="0" id="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
6442 !! end
6444 !! test
6445 Transclusion of default MediaWiki message
6446 !! input
6447 {{MediaWiki:Mainpage}}
6448 !!result
6449 <p>Main Page
6450 </p>
6451 !! end
6453 !! test
6454 Transclusion of nonexistent MediaWiki message
6455 !! input
6456 {{MediaWiki:Mainpagexxx}}
6457 !!result
6458 <p><a href="/index.php?title=MediaWiki:Mainpagexxx&amp;action=edit&amp;redlink=1" class="new" title="MediaWiki:Mainpagexxx (page does not exist)">MediaWiki:Mainpagexxx</a>
6459 </p>
6460 !! end
6462 !! test
6463 Transclusion of MediaWiki message with underscore
6464 !! input
6465 {{MediaWiki:history_short}}
6466 !! result
6467 <p>History
6468 </p>
6469 !! end
6471 !! test
6472 Transclusion of MediaWiki message with space
6473 !! input
6474 {{MediaWiki:history short}}
6475 !! result
6476 <p>History
6477 </p>
6478 !! end
6480 !! test
6481 Invalid header with following text
6482 !! input
6483 = x = y
6484 !! result
6485 <p>= x = y
6486 </p>
6487 !! end
6490 !! test
6491 Section extraction test (section 0)
6492 !! options
6493 section=0
6494 !! input
6495 start
6496 ==a==
6497 ===aa===
6498 ====aaa====
6499 ==b==
6500 ===ba===
6501 ===bb===
6502 ====bba====
6503 ===bc===
6504 ==c==
6505 ===ca===
6506 !! result
6507 start
6508 !! end
6510 !! test
6511 Section extraction test (section 1)
6512 !! options
6513 section=1
6514 !! input
6515 start
6516 ==a==
6517 ===aa===
6518 ====aaa====
6519 ==b==
6520 ===ba===
6521 ===bb===
6522 ====bba====
6523 ===bc===
6524 ==c==
6525 ===ca===
6526 !! result
6527 ==a==
6528 ===aa===
6529 ====aaa====
6530 !! end
6532 !! test
6533 Section extraction test (section 2)
6534 !! options
6535 section=2
6536 !! input
6537 start
6538 ==a==
6539 ===aa===
6540 ====aaa====
6541 ==b==
6542 ===ba===
6543 ===bb===
6544 ====bba====
6545 ===bc===
6546 ==c==
6547 ===ca===
6548 !! result
6549 ===aa===
6550 ====aaa====
6551 !! end
6553 !! test
6554 Section extraction test (section 3)
6555 !! options
6556 section=3
6557 !! input
6558 start
6559 ==a==
6560 ===aa===
6561 ====aaa====
6562 ==b==
6563 ===ba===
6564 ===bb===
6565 ====bba====
6566 ===bc===
6567 ==c==
6568 ===ca===
6569 !! result
6570 ====aaa====
6571 !! end
6573 !! test
6574 Section extraction test (section 4)
6575 !! options
6576 section=4
6577 !! input
6578 start
6579 ==a==
6580 ===aa===
6581 ====aaa====
6582 ==b==
6583 ===ba===
6584 ===bb===
6585 ====bba====
6586 ===bc===
6587 ==c==
6588 ===ca===
6589 !! result
6590 ==b==
6591 ===ba===
6592 ===bb===
6593 ====bba====
6594 ===bc===
6595 !! end
6597 !! test
6598 Section extraction test (section 5)
6599 !! options
6600 section=5
6601 !! input
6602 start
6603 ==a==
6604 ===aa===
6605 ====aaa====
6606 ==b==
6607 ===ba===
6608 ===bb===
6609 ====bba====
6610 ===bc===
6611 ==c==
6612 ===ca===
6613 !! result
6614 ===ba===
6615 !! end
6617 !! test
6618 Section extraction test (section 6)
6619 !! options
6620 section=6
6621 !! input
6622 start
6623 ==a==
6624 ===aa===
6625 ====aaa====
6626 ==b==
6627 ===ba===
6628 ===bb===
6629 ====bba====
6630 ===bc===
6631 ==c==
6632 ===ca===
6633 !! result
6634 ===bb===
6635 ====bba====
6636 !! end
6638 !! test
6639 Section extraction test (section 7)
6640 !! options
6641 section=7
6642 !! input
6643 start
6644 ==a==
6645 ===aa===
6646 ====aaa====
6647 ==b==
6648 ===ba===
6649 ===bb===
6650 ====bba====
6651 ===bc===
6652 ==c==
6653 ===ca===
6654 !! result
6655 ====bba====
6656 !! end
6658 !! test
6659 Section extraction test (section 8)
6660 !! options
6661 section=8
6662 !! input
6663 start
6664 ==a==
6665 ===aa===
6666 ====aaa====
6667 ==b==
6668 ===ba===
6669 ===bb===
6670 ====bba====
6671 ===bc===
6672 ==c==
6673 ===ca===
6674 !! result
6675 ===bc===
6676 !! end
6678 !! test
6679 Section extraction test (section 9)
6680 !! options
6681 section=9
6682 !! input
6683 start
6684 ==a==
6685 ===aa===
6686 ====aaa====
6687 ==b==
6688 ===ba===
6689 ===bb===
6690 ====bba====
6691 ===bc===
6692 ==c==
6693 ===ca===
6694 !! result
6695 ==c==
6696 ===ca===
6697 !! end
6699 !! test
6700 Section extraction test (section 10)
6701 !! options
6702 section=10
6703 !! input
6704 start
6705 ==a==
6706 ===aa===
6707 ====aaa====
6708 ==b==
6709 ===ba===
6710 ===bb===
6711 ====bba====
6712 ===bc===
6713 ==c==
6714 ===ca===
6715 !! result
6716 ===ca===
6717 !! end
6719 !! test
6720 Section extraction test (nonexistent section 11)
6721 !! options
6722 section=11
6723 !! input
6724 start
6725 ==a==
6726 ===aa===
6727 ====aaa====
6728 ==b==
6729 ===ba===
6730 ===bb===
6731 ====bba====
6732 ===bc===
6733 ==c==
6734 ===ca===
6735 !! result
6736 !! end
6738 !! test
6739 Section extraction test with bogus heading (section 1)
6740 !! options
6741 section=1
6742 !! input
6743 ==a==
6744 ==bogus== not a legal section
6745 ==b==
6746 !! result
6747 ==a==
6748 ==bogus== not a legal section
6749 !! end
6751 !! test
6752 Section extraction test with bogus heading (section 2)
6753 !! options
6754 section=2
6755 !! input
6756 ==a==
6757 ==bogus== not a legal section
6758 ==b==
6759 !! result
6760 ==b==
6761 !! end
6763 !! test
6764 Section extraction test with comment after heading (section 1)
6765 !! options
6766 section=1
6767 !! input
6768 ==a==
6769 ==b== <!-- -->
6770 ==c==
6771 !! result
6772 ==a==
6773 !! end
6775 !! test
6776 Section extraction test with comment after heading (section 2)
6777 !! options
6778 section=2
6779 !! input
6780 ==a==
6781 ==b== <!-- -->
6782 ==c==
6783 !! result
6784 ==b== <!-- -->
6785 !! end
6787 !! test
6788 Section extraction test with bogus <nowiki> heading (section 1)
6789 !! options
6790 section=1
6791 !! input
6792 ==a==
6793 ==bogus== <nowiki>not a legal section</nowiki>
6794 ==b==
6795 !! result
6796 ==a==
6797 ==bogus== <nowiki>not a legal section</nowiki>
6798 !! end
6800 !! test
6801 Section extraction test with bogus <nowiki> heading (section 2)
6802 !! options
6803 section=2
6804 !! input
6805 ==a==
6806 ==bogus== <nowiki>not a legal section</nowiki>
6807 ==b==
6808 !! result
6809 ==b==
6810 !! end
6813 # Formerly testing for bug 2587, now resolved by the use of unmarked sections 
6814 # instead of respecting commented sections
6815 !! test
6816 Section extraction prefixed by comment (section 1)
6817 !! options
6818 section=1
6819 !! input
6820 <!-- -->==sec1==
6821 ==sec2==
6822 !!result
6823 ==sec2==
6824 !!end
6826 !! test
6827 Section extraction prefixed by comment (section 2)
6828 !! options
6829 section=2
6830 !! input
6831 <!-- -->==sec1==
6832 ==sec2==
6833 !!result
6835 !!end
6838 # Formerly testing for bug 2607, now resolved by the use of unmarked sections 
6839 # instead of respecting HTML-style headings
6840 !! test
6841 Section extraction, mixed wiki and html (section 1)
6842 !! options
6843 section=1
6844 !! input
6845 <h2>unmarked</h2>
6846 unmarked
6847 ==1==
6849 ==2==
6851 !! result
6852 ==1==
6854 !! end
6856 !! test
6857 Section extraction, mixed wiki and html (section 2)
6858 !! options
6859 section=2
6860 !! input
6861 <h2>unmarked</h2>
6862 unmarked
6863 ==1==
6865 ==2==
6867 !! result
6868 ==2==
6870 !! end
6873 # Formerly testing for bug 3342
6874 !! test
6875 Section extraction, heading surrounded by <noinclude>
6876 !! options
6877 section=1
6878 !! input
6879 <noinclude>==unmarked==</noinclude>
6880 ==marked==
6881 !! result
6882 ==marked==
6883 !!end
6885 # Test behaviour of bug 19910
6886 !! test
6887 Sectiion with all-equals
6888 !! options
6889 section=2
6890 !! input
6891 === 
6892 The line above must have a trailing space
6893 === <!--
6894 --> <!-- -->
6895 But just in case it doesn't...
6896 !! result
6897 === <!--
6898 --> <!-- -->
6899 But just in case it doesn't...
6900 !! end
6902 !! test
6903 Section replacement test (section 0)
6904 !! options
6905 replace=0,"xxx"
6906 !! input
6907 start
6908 ==a==
6909 ===aa===
6910 ====aaa====
6911 ==b==
6912 ===ba===
6913 ===bb===
6914 ====bba====
6915 ===bc===
6916 ==c==
6917 ===ca===
6918 !! result
6921 ==a==
6922 ===aa===
6923 ====aaa====
6924 ==b==
6925 ===ba===
6926 ===bb===
6927 ====bba====
6928 ===bc===
6929 ==c==
6930 ===ca===
6931 !! end
6933 !! test
6934 Section replacement test (section 1)
6935 !! options
6936 replace=1,"xxx"
6937 !! input
6938 start
6939 ==a==
6940 ===aa===
6941 ====aaa====
6942 ==b==
6943 ===ba===
6944 ===bb===
6945 ====bba====
6946 ===bc===
6947 ==c==
6948 ===ca===
6949 !! result
6950 start
6953 ==b==
6954 ===ba===
6955 ===bb===
6956 ====bba====
6957 ===bc===
6958 ==c==
6959 ===ca===
6960 !! end
6962 !! test
6963 Section replacement test (section 2)
6964 !! options
6965 replace=2,"xxx"
6966 !! input
6967 start
6968 ==a==
6969 ===aa===
6970 ====aaa====
6971 ==b==
6972 ===ba===
6973 ===bb===
6974 ====bba====
6975 ===bc===
6976 ==c==
6977 ===ca===
6978 !! result
6979 start
6980 ==a==
6983 ==b==
6984 ===ba===
6985 ===bb===
6986 ====bba====
6987 ===bc===
6988 ==c==
6989 ===ca===
6990 !! end
6992 !! test
6993 Section replacement test (section 3)
6994 !! options
6995 replace=3,"xxx"
6996 !! input
6997 start
6998 ==a==
6999 ===aa===
7000 ====aaa====
7001 ==b==
7002 ===ba===
7003 ===bb===
7004 ====bba====
7005 ===bc===
7006 ==c==
7007 ===ca===
7008 !! result
7009 start
7010 ==a==
7011 ===aa===
7014 ==b==
7015 ===ba===
7016 ===bb===
7017 ====bba====
7018 ===bc===
7019 ==c==
7020 ===ca===
7021 !! end
7023 !! test
7024 Section replacement test (section 4)
7025 !! options
7026 replace=4,"xxx"
7027 !! input
7028 start
7029 ==a==
7030 ===aa===
7031 ====aaa====
7032 ==b==
7033 ===ba===
7034 ===bb===
7035 ====bba====
7036 ===bc===
7037 ==c==
7038 ===ca===
7039 !! result
7040 start
7041 ==a==
7042 ===aa===
7043 ====aaa====
7046 ==c==
7047 ===ca===
7048 !! end
7050 !! test
7051 Section replacement test (section 5)
7052 !! options
7053 replace=5,"xxx"
7054 !! input
7055 start
7056 ==a==
7057 ===aa===
7058 ====aaa====
7059 ==b==
7060 ===ba===
7061 ===bb===
7062 ====bba====
7063 ===bc===
7064 ==c==
7065 ===ca===
7066 !! result
7067 start
7068 ==a==
7069 ===aa===
7070 ====aaa====
7071 ==b==
7074 ===bb===
7075 ====bba====
7076 ===bc===
7077 ==c==
7078 ===ca===
7079 !! end
7081 !! test
7082 Section replacement test (section 6)
7083 !! options
7084 replace=6,"xxx"
7085 !! input
7086 start
7087 ==a==
7088 ===aa===
7089 ====aaa====
7090 ==b==
7091 ===ba===
7092 ===bb===
7093 ====bba====
7094 ===bc===
7095 ==c==
7096 ===ca===
7097 !! result
7098 start
7099 ==a==
7100 ===aa===
7101 ====aaa====
7102 ==b==
7103 ===ba===
7106 ===bc===
7107 ==c==
7108 ===ca===
7109 !! end
7111 !! test
7112 Section replacement test (section 7)
7113 !! options
7114 replace=7,"xxx"
7115 !! input
7116 start
7117 ==a==
7118 ===aa===
7119 ====aaa====
7120 ==b==
7121 ===ba===
7122 ===bb===
7123 ====bba====
7124 ===bc===
7125 ==c==
7126 ===ca===
7127 !! result
7128 start
7129 ==a==
7130 ===aa===
7131 ====aaa====
7132 ==b==
7133 ===ba===
7134 ===bb===
7137 ===bc===
7138 ==c==
7139 ===ca===
7140 !! end
7142 !! test
7143 Section replacement test (section 8)
7144 !! options
7145 replace=8,"xxx"
7146 !! input
7147 start
7148 ==a==
7149 ===aa===
7150 ====aaa====
7151 ==b==
7152 ===ba===
7153 ===bb===
7154 ====bba====
7155 ===bc===
7156 ==c==
7157 ===ca===
7158 !! result
7159 start
7160 ==a==
7161 ===aa===
7162 ====aaa====
7163 ==b==
7164 ===ba===
7165 ===bb===
7166 ====bba====
7169 ==c==
7170 ===ca===
7171 !!end
7173 !! test
7174 Section replacement test (section 9)
7175 !! options
7176 replace=9,"xxx"
7177 !! input
7178 start
7179 ==a==
7180 ===aa===
7181 ====aaa====
7182 ==b==
7183 ===ba===
7184 ===bb===
7185 ====bba====
7186 ===bc===
7187 ==c==
7188 ===ca===
7189 !! result
7190 start
7191 ==a==
7192 ===aa===
7193 ====aaa====
7194 ==b==
7195 ===ba===
7196 ===bb===
7197 ====bba====
7198 ===bc===
7200 !! end
7202 !! test
7203 Section replacement test (section 10)
7204 !! options
7205 replace=10,"xxx"
7206 !! input
7207 start
7208 ==a==
7209 ===aa===
7210 ====aaa====
7211 ==b==
7212 ===ba===
7213 ===bb===
7214 ====bba====
7215 ===bc===
7216 ==c==
7217 ===ca===
7218 !! result
7219 start
7220 ==a==
7221 ===aa===
7222 ====aaa====
7223 ==b==
7224 ===ba===
7225 ===bb===
7226 ====bba====
7227 ===bc===
7228 ==c==
7230 !! end
7232 !! test
7233 Section replacement test with initial whitespace (bug 13728)
7234 !! options
7235 replace=2,"xxx"
7236 !! input
7237  Preformatted initial line
7238 ==a==
7239 ===a===
7240 !! result
7241  Preformatted initial line
7242 ==a==
7244 !! end
7247 !! test
7248 Section extraction, heading followed by pre with 20 spaces (bug 6398)
7249 !! options
7250 section=1
7251 !! input
7252 ==a==
7253                     a
7254 !! result
7255 ==a==
7256                     a
7257 !! end
7259 !! test
7260 Section extraction, heading followed by pre with 19 spaces (bug 6398 sanity check)
7261 !! options
7262 section=1
7263 !! input
7264 ==a==
7265                    a
7266 !! result
7267 ==a==
7268                    a
7269 !! end
7272 !! test
7273 Section extraction, <pre> around bogus header (bug 10309)
7274 !! options
7275 noxml section=2
7276 !! input
7277 == Section One ==
7278 <pre>
7279 =======
7280 </pre>
7282 == Section Two ==
7283 stuff
7284 !! result
7285 == Section Two ==
7286 stuff
7287 !! end
7289 !! test
7290 Section replacement, <pre> around bogus header (bug 10309)
7291 !! options
7292 noxml replace=2,"xxx"
7293 !! input
7294 == Section One ==
7295 <pre>
7296 =======
7297 </pre>
7299 == Section Two ==
7300 stuff
7301 !! result
7302 == Section One ==
7303 <pre>
7304 =======
7305 </pre>
7308 !! end
7312 !! test
7313 Handling of &#x0A; in URLs
7314 !! input
7315 **irc://&#x0A;a
7316 !! result
7317 <ul><li><ul><li><a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a>
7318 </li></ul>
7319 </li></ul>
7321 !!end
7323 !! test
7324 5 quotes, code coverage +1 line
7325 !! input
7326 '''''
7327 !! result
7328 !! end
7330 !! test
7331 Special:Search page linking.
7332 !! input
7333 {{Special:search}}
7334 !! result
7335 <p><a href="/wiki/Special:Search" title="Special:Search">Special:Search</a>
7336 </p>
7337 !! end
7339 !! test
7340 Say the magic word
7341 !! input
7342 * {{PAGENAME}}
7343 * {{BASEPAGENAME}}
7344 * {{SUBPAGENAME}}
7345 * {{SUBPAGENAMEE}}
7346 * {{BASEPAGENAME}}
7347 * {{BASEPAGENAMEE}}
7348 * {{TALKPAGENAME}}
7349 * {{TALKPAGENAMEE}}
7350 * {{SUBJECTPAGENAME}}
7351 * {{SUBJECTPAGENAMEE}}
7352 * {{NAMESPACEE}}
7353 * {{NAMESPACE}}
7354 * {{TALKSPACE}}
7355 * {{TALKSPACEE}}
7356 * {{SUBJECTSPACE}}
7357 * {{SUBJECTSPACEE}}
7358 * {{Dynamic|{{NUMBEROFUSERS}}|{{NUMBEROFPAGES}}|{{CURRENTVERSION}}|{{CONTENTLANGUAGE}}|{{DIRECTIONMARK}}|{{CURRENTTIMESTAMP}}|{{NUMBEROFARTICLES}}}}
7359 !! result
7360 <ul><li> Parser test
7361 </li><li> Parser test
7362 </li><li> Parser test
7363 </li><li> Parser_test
7364 </li><li> Parser test
7365 </li><li> Parser_test
7366 </li><li> Talk:Parser test
7367 </li><li> Talk:Parser_test
7368 </li><li> Parser test
7369 </li><li> Parser_test
7370 </li><li> 
7371 </li><li> 
7372 </li><li> Talk
7373 </li><li> Talk
7374 </li><li> 
7375 </li><li> 
7376 </li><li> <a href="/index.php?title=Template:Dynamic&amp;action=edit&amp;redlink=1" class="new" title="Template:Dynamic (page does not exist)">Template:Dynamic</a>
7377 </li></ul>
7379 !! end
7380 ### Note: Above tests excludes the "{{NUMBEROFADMINS}}" magic word because it generates a MySQL error when included.
7382 !! test
7383 Gallery
7384 !! input
7385 <gallery>
7386 image1.png |
7387 image2.gif|||||
7389 image3|
7390 image4    |300px| centre
7391  image5.svg| http://///////
7392 [[x|xx]]]]
7393 * image6
7394 </gallery>
7395 !! result
7396 <ul class="gallery">
7397                 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
7398                         <div style="height: 150px;">Image1.png</div>
7399                         <div class="gallerytext">
7400                         </div>
7401                 </div></li>
7402                 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
7403                         <div style="height: 150px;">Image2.gif</div>
7404                         <div class="gallerytext">
7405 <p>||||
7406 </p>
7407                         </div>
7408                 </div></li>
7409                 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
7410                         <div style="height: 150px;">Image3</div>
7411                         <div class="gallerytext">
7412                         </div>
7413                 </div></li>
7414                 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
7415                         <div style="height: 150px;">Image4</div>
7416                         <div class="gallerytext">
7417 <p>300px| centre
7418 </p>
7419                         </div>
7420                 </div></li>
7421                 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
7422                         <div style="height: 150px;">Image5.svg</div>
7423                         <div class="gallerytext">
7424 <p><a rel="nofollow" class="external free" href="http://///////">http://///////</a>
7425 </p>
7426                         </div>
7427                 </div></li>
7428                 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
7429                         <div style="height: 150px;">* image6</div>
7430                         <div class="gallerytext">
7431                         </div>
7432                 </div></li>
7433 </ul>
7435 !! end
7437 !! test
7438 Gallery (with options)
7439 !! input
7440 <gallery widths='70px' heights='40px' perrow='2' caption='Foo [[Main Page]]' >
7441 File:Nonexistant.jpg|caption
7442 File:Nonexistant.jpg
7443 image:foobar.jpg|some '''caption''' [[Main Page]]
7444 image:foobar.jpg
7445 image:foobar.jpg|Blabla|alt=This is a foo-bar.|blabla.
7446 </gallery>
7447 !! result
7448 <ul class="gallery" style="max-width: 226px;_width: 226px;">
7449         <li class='gallerycaption'>Foo <a href="/wiki/Main_Page" title="Main Page">Main Page</a></li>
7450                 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
7451                         <div style="height: 70px;">Nonexistant.jpg</div>
7452                         <div class="gallerytext">
7453 <p>caption
7454 </p>
7455                         </div>
7456                 </div></li>
7457                 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
7458                         <div style="height: 70px;">Nonexistant.jpg</div>
7459                         <div class="gallerytext">
7460                         </div>
7461                 </div></li>
7462                 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
7463                         <div class="thumb" style="width: 100px;"><div style="margin:31px auto;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/3/3a/Foobar.jpg" width="70" height="8" /></a></div></div>
7464                         <div class="gallerytext">
7465 <p>some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
7466 </p>
7467                         </div>
7468                 </div></li>
7469                 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
7470                         <div class="thumb" style="width: 100px;"><div style="margin:31px auto;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="70" height="8" /></a></div></div>
7471                         <div class="gallerytext">
7472                         </div>
7473                 </div></li>
7474                 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
7475                         <div class="thumb" style="width: 100px;"><div style="margin:31px auto;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="This is a foo-bar." src="http://example.com/images/3/3a/Foobar.jpg" width="70" height="8" /></a></div></div>
7476                         <div class="gallerytext">
7477 <p>Blabla|blabla.
7478 </p>
7479                         </div>
7480                 </div></li>
7481 </ul>
7483 !! end
7485 !! test
7486 Gallery with wikitext inside caption
7487 !! input
7488 <gallery>
7489 File:foobar.jpg|[[File:foobar.jpg|20px|desc|alt=inneralt]]|alt=galleryalt
7490 File:foobar.jpg|{{Test|unamedParam|alt=param}}|alt=galleryalt
7491 </gallery>
7492 !! result
7493 <ul class="gallery">
7494                 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
7495                         <div class="thumb" style="width: 150px;"><div style="margin:68px auto;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="galleryalt" src="http://example.com/images/3/3a/Foobar.jpg" width="120" height="14" /></a></div></div>
7496                         <div class="gallerytext">
7497 <p><a href="/wiki/File:Foobar.jpg" class="image" title="desc"><img alt="inneralt" src="http://example.com/images/3/3a/Foobar.jpg" width="20" height="2" /></a>
7498 </p>
7499                         </div>
7500                 </div></li>
7501                 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
7502                         <div class="thumb" style="width: 150px;"><div style="margin:68px auto;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="galleryalt" src="http://example.com/images/3/3a/Foobar.jpg" width="120" height="14" /></a></div></div>
7503                         <div class="gallerytext">
7504 <p>This is a test template
7505 </p>
7506                         </div>
7507                 </div></li>
7508 </ul>
7510 !! end
7512 !! test
7513 gallery (with showfilename option)
7514 !! input
7515 <gallery showfilename>
7516 File:Nonexistant.jpg|caption
7517 File:Nonexistant.jpg
7518 image:foobar.jpg|some '''caption''' [[Main Page]]
7519 File:Foobar.jpg
7520 </gallery>
7521 !! result
7522 <ul class="gallery">
7523                 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
7524                         <div style="height: 150px;">Nonexistant.jpg</div>
7525                         <div class="gallerytext">
7526 <p><a href="/wiki/File:Nonexistant.jpg" title="File:Nonexistant.jpg">Nonexistant.jpg</a><br />
7527 caption
7528 </p>
7529                         </div>
7530                 </div></li>
7531                 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
7532                         <div style="height: 150px;">Nonexistant.jpg</div>
7533                         <div class="gallerytext">
7534 <p><a href="/wiki/File:Nonexistant.jpg" title="File:Nonexistant.jpg">Nonexistant.jpg</a><br />
7535 </p>
7536                         </div>
7537                 </div></li>
7538                 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
7539                         <div class="thumb" style="width: 150px;"><div style="margin:68px auto;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/3/3a/Foobar.jpg" width="120" height="14" /></a></div></div>
7540                         <div class="gallerytext">
7541 <p><a href="/wiki/File:Foobar.jpg" title="File:Foobar.jpg">Foobar.jpg</a><br />
7542 some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
7543 </p>
7544                         </div>
7545                 </div></li>
7546                 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
7547                         <div class="thumb" style="width: 150px;"><div style="margin:68px auto;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="120" height="14" /></a></div></div>
7548                         <div class="gallerytext">
7549 <p><a href="/wiki/File:Foobar.jpg" title="File:Foobar.jpg">Foobar.jpg</a><br />
7550 </p>
7551                         </div>
7552                 </div></li>
7553 </ul>
7555 !! end
7557 !! test
7558 Gallery (with namespace-less filenames)
7559 !! input
7560 <gallery>
7561 File:Nonexistant.jpg
7562 Nonexistant.jpg
7563 image:foobar.jpg
7564 foobar.jpg
7565 </gallery>
7566 !! result
7567 <ul class="gallery">
7568                 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
7569                         <div style="height: 150px;">Nonexistant.jpg</div>
7570                         <div class="gallerytext">
7571                         </div>
7572                 </div></li>
7573                 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
7574                         <div style="height: 150px;">Nonexistant.jpg</div>
7575                         <div class="gallerytext">
7576                         </div>
7577                 </div></li>
7578                 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
7579                         <div class="thumb" style="width: 150px;"><div style="margin:68px auto;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="120" height="14" /></a></div></div>
7580                         <div class="gallerytext">
7581                         </div>
7582                 </div></li>
7583                 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
7584                         <div class="thumb" style="width: 150px;"><div style="margin:68px auto;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="120" height="14" /></a></div></div>
7585                         <div class="gallerytext">
7586                         </div>
7587                 </div></li>
7588 </ul>
7590 !! end
7592 !! test
7593 HTML Hex character encoding (spells the word "JavaScript")
7594 !! input
7595 &#x4A;&#x061;&#x0076;&#x00061;&#x000053;&#x0000063;&#114;&#x0000069;&#00000112;&#x0000000074;
7596 !! result
7597 <p>&#x4a;&#x61;&#x76;&#x61;&#x53;&#x63;&#114;&#x69;&#112;&#x74;
7598 </p>
7599 !! end
7601 !! test
7602 HTML Hex character encoding bogus encoding (bug 26437 regression check)
7603 !! input
7604 &#xsee;&#XSEE;
7605 !! result
7606 <p>&amp;#xsee;&amp;#XSEE;
7607 </p>
7608 !! end
7610 !! test
7611 HTML Hex character encoding mixed case
7612 !! input
7613 &#xEE;&#Xee;
7614 !! result
7615 <p>&#xee;&#xee;
7616 </p>
7617 !! end
7619 !! test
7620 __FORCETOC__ override
7621 !! input 
7622 __NEWSECTIONLINK__
7623 __FORCETOC__
7624 !! result
7625 <p><br />
7626 </p>
7627 !! end
7629 !! test
7630 ISBN code coverage
7631 !! input
7632 ISBN  978-0-1234-56&#x20;789
7633 !! result
7634 <p><a href="/wiki/Special:BookSources/9780123456" class="internal mw-magiclink-isbn">ISBN 978-0-1234-56</a>&#x20;789
7635 </p>
7636 !! end
7638 !! test
7639 ISBN followed by 5 spaces
7640 !! input
7641 ISBN    
7642 !! result
7643 <p>ISBN    
7644 </p>
7645 !! end
7647 !! test
7648 Double ISBN
7649 !! input
7650 ISBN ISBN 1234567890
7651 !! result
7652 <p>ISBN <a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
7653 </p>
7654 !! end
7656 !! test
7657 Bug 22905: <abbr> followed by ISBN followed by </a>
7658 !! input
7659 <abbr>(fr)</abbr> ISBN 2753300917 [http://www.example.com example.com]
7660 !! result
7661 <p><abbr>(fr)</abbr> <a href="/wiki/Special:BookSources/2753300917" class="internal mw-magiclink-isbn">ISBN 2753300917</a> <a rel="nofollow" class="external text" href="http://www.example.com">example.com</a>
7662 </p>
7663 !! end
7665 !! test
7666 Double RFC
7667 !! input
7668 RFC RFC 1234
7669 !! result
7670 <p>RFC <a class="external mw-magiclink-rfc" href="http://tools.ietf.org/html/rfc1234">RFC 1234</a>
7671 </p>
7672 !! end
7674 !! test
7675 Double RFC with a wiki link 
7676 !! input
7677 RFC [[RFC 1234]]
7678 !! result
7679 <p>RFC <a href="/index.php?title=RFC_1234&amp;action=edit&amp;redlink=1" class="new" title="RFC 1234 (page does not exist)">RFC 1234</a>
7680 </p>
7681 !! end
7683 !! test
7684 RFC code coverage
7685 !! input
7686 RFC   983&#x20;987
7687 !! result
7688 <p><a class="external mw-magiclink-rfc" href="http://tools.ietf.org/html/rfc983">RFC 983</a>&#x20;987
7689 </p>
7690 !! end
7692 !! test
7693 Centre-aligned image
7694 !! input
7695 [[Image:foobar.jpg|centre]]
7696 !! result
7697 <div class="center"><div class="floatnone"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a></div></div>
7699 !!end
7701 !! test
7702 None-aligned image
7703 !! input
7704 [[Image:foobar.jpg|none]]
7705 !! result
7706 <div class="floatnone"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a></div>
7708 !!end
7710 !! test
7711 Width + Height sized image (using px) (height is ignored)
7712 !! input
7713 [[Image:foobar.jpg|640x480px]]
7714 !! result
7715 <p><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="640" height="73" /></a>
7716 </p>
7717 !!end
7719 !! test
7720 Width-sized image (using px, no following whitespace)
7721 !! input
7722 [[Image:foobar.jpg|640px]]
7723 !! result
7724 <p><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="640" height="73" /></a>
7725 </p>
7726 !!end
7728 !! test
7729 Width-sized image (using px, with following whitespace - test regression from r39467)
7730 !! input
7731 [[Image:foobar.jpg|640px ]]
7732 !! result
7733 <p><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="640" height="73" /></a>
7734 </p>
7735 !!end
7737 !! test
7738 Width-sized image (using px, with preceding whitespace - test regression from r39467)
7739 !! input
7740 [[Image:foobar.jpg| 640px]]
7741 !! result
7742 <p><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="640" height="73" /></a>
7743 </p>
7744 !!end
7746 !! test
7747 Another italics / bold test
7748 !! input
7749  ''' ''x'
7750 !! result
7751 <pre>'<i> </i>x'
7752 </pre>
7753 !!end
7755 # Note the results may be incorrect, as parserTest output included this:
7756 # XML error: Mismatched tag at byte 6120:
7757 # ...<dd> </dt></dl> </dd...
7758 !! test
7759 dt/dd/dl test
7760 !! options
7761 disabled
7762 !! input
7763 :;;;::
7764 !! result
7765 <dl><dd><dl><dt><dl><dt><dl><dt><dl><dd><dl><dd>
7766 </dd></dl>
7767 </dd></dl>
7768 </dt></dl>
7769 </dt></dl>
7770 </dt></dl>
7771 </dd></dl>
7773 !!end
7776 # Images with the "|" character in external URLs in comment tags; Eats half the comment, leaves unmatched "</a>" tag.
7777 !! test
7778 Images with the "|" character in the comment
7779 !! input
7780 [[image:Foobar.jpg|thumb|An [http://test/?param1=|left|&param2=|x external] URL]]
7781 !! result
7782 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/3/3a/Foobar.jpg" width="180" height="20" class="thumbimage" /></a>  <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>An <a rel="nofollow" class="external text" href="http://test/?param1=%7Cleft%7C&amp;param2=%7Cx">external</a> URL</div></div></div>
7784 !!end
7786 !! test
7787 [Before] HTML without raw HTML enabled ($wgRawHtml==false)
7788 !! input
7789 <html><script>alert(1);</script></html>
7790 !! result
7791 <p>&lt;html&gt;&lt;script&gt;alert(1);&lt;/script&gt;&lt;/html&gt;
7792 </p>
7793 !! end
7795 !! test
7796 HTML with raw HTML ($wgRawHtml==true)
7797 !! options
7798 rawhtml
7799 !! input
7800 <html><script>alert(1);</script></html>
7801 !! result
7802 <p><script>alert(1);</script>
7803 </p>
7804 !! end
7806 !! test
7807 Parents of subpages, one level up
7808 !! options
7809 subpage title=[[Subpage test/L1/L2/L3]]
7810 !! input
7811 [[../|L2]]
7812 !! result
7813 <p><a href="/index.php?title=Subpage_test/L1/L2&amp;action=edit&amp;redlink=1" class="new" title="Subpage test/L1/L2 (page does not exist)">L2</a>
7814 </p>
7815 !! end
7818 !! test
7819 Parents of subpages, one level up, not named
7820 !! options
7821 subpage title=[[Subpage test/L1/L2/L3]]
7822 !! input
7823 [[../]]
7824 !! result
7825 <p><a href="/index.php?title=Subpage_test/L1/L2&amp;action=edit&amp;redlink=1" class="new" title="Subpage test/L1/L2 (page does not exist)">Subpage test/L1/L2</a>
7826 </p>
7827 !! end
7831 !! test
7832 Parents of subpages, two levels up
7833 !! options
7834 subpage title=[[Subpage test/L1/L2/L3]]
7835 !! input
7836 [[../../|L1]]2
7838 [[../../|L1]]l
7839 !! result
7840 <p><a href="/index.php?title=Subpage_test/L1&amp;action=edit&amp;redlink=1" class="new" title="Subpage test/L1 (page does not exist)">L1</a>2
7841 </p><p><a href="/index.php?title=Subpage_test/L1&amp;action=edit&amp;redlink=1" class="new" title="Subpage test/L1 (page does not exist)">L1l</a>
7842 </p>
7843 !! end
7845 !! test
7846 Parents of subpages, two levels up, without trailing slash or name.
7847 !! options
7848 subpage title=[[Subpage test/L1/L2/L3]]
7849 !! input
7850 [[../..]]
7851 !! result
7852 <p>[[../..]]
7853 </p>
7854 !! end
7856 !! test
7857 Parents of subpages, two levels up, with lots of extra trailing slashes.
7858 !! options
7859 subpage title=[[Subpage test/L1/L2/L3]]
7860 !! input
7861 [[../../////]]
7862 !! result
7863 <p><a href="/index.php?title=Subpage_test/L1////&amp;action=edit&amp;redlink=1" class="new" title="Subpage test/L1//// (page does not exist)">///</a>
7864 </p>
7865 !! end
7867 !! test
7868 Definition list code coverage
7869 !! input
7870 ; title   : def
7871 ; title : def
7872 ;title: def
7873 !! result
7874 <dl><dt> title  &#160;</dt><dd> def
7875 </dd><dt> title&#160;</dt><dd> def
7876 </dd><dt>title</dt><dd> def
7877 </dd></dl>
7879 !! end
7881 !! test
7882 Don't fall for the self-closing div
7883 !! input
7884 <div>hello world</div/>
7885 !! result
7886 <div>hello world</div>
7888 !! end
7890 !! test
7891 MSGNW magic word
7892 !! input
7893 {{MSGNW:msg}}
7894 !! result
7895 <p>&#91;&#91;:Template:Msg&#93;&#93;
7896 </p>
7897 !! end
7899 !! test
7900 RAW magic word
7901 !! input
7902 {{RAW:QUERTY}}
7903 !! result
7904 <p><a href="/index.php?title=Template:QUERTY&amp;action=edit&amp;redlink=1" class="new" title="Template:QUERTY (page does not exist)">Template:QUERTY</a>
7905 </p>
7906 !! end
7908 # This isn't needed for XHTML conformance, but would be handy as a fallback security measure
7909 !! test
7910 Always escape literal '>' in output, not just after '<'
7911 !! input
7913 !! result
7914 <p>&gt;&lt;&gt;
7915 </p>
7916 !! end
7918 !! test
7919 Template caching
7920 !! input
7921 {{Test}}
7922 {{Test}}
7923 !! result
7924 <p>This is a test template
7925 This is a test template
7926 </p>
7927 !! end
7930 !! article
7931 MediaWiki:Fake
7932 !! text
7933 ==header==
7934 !! endarticle
7936 !! test
7937 Inclusion of !userCanEdit() content
7938 !! input
7939 {{MediaWiki:Fake}}
7940 !! result
7941 <h2><span class="editsection">[<a href="/index.php?title=MediaWiki:Fake&amp;action=edit&amp;section=T-1" title="MediaWiki:Fake">edit</a>]</span> <span class="mw-headline" id="header">header</span></h2>
7943 !! end
7946 !! test
7947 Out-of-order TOC heading levels
7948 !! input
7949 ==2==
7950 ======6======
7951 ===3===
7953 =====5=====
7954 ==2==
7955 !! result
7956 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
7957 <ul>
7958 <li class="toclevel-1 tocsection-1"><a href="#2"><span class="tocnumber">1</span> <span class="toctext">2</span></a>
7959 <ul>
7960 <li class="toclevel-2 tocsection-2"><a href="#6"><span class="tocnumber">1.1</span> <span class="toctext">6</span></a></li>
7961 <li class="toclevel-2 tocsection-3"><a href="#3"><span class="tocnumber">1.2</span> <span class="toctext">3</span></a></li>
7962 </ul>
7963 </li>
7964 <li class="toclevel-1 tocsection-4"><a href="#1"><span class="tocnumber">2</span> <span class="toctext">1</span></a>
7965 <ul>
7966 <li class="toclevel-2 tocsection-5"><a href="#5"><span class="tocnumber">2.1</span> <span class="toctext">5</span></a></li>
7967 <li class="toclevel-2 tocsection-6"><a href="#2_2"><span class="tocnumber">2.2</span> <span class="toctext">2</span></a></li>
7968 </ul>
7969 </li>
7970 </ul>
7971 </td></tr></table>
7972 <h2><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: 2">edit</a>]</span> <span class="mw-headline" id="2">2</span></h2>
7973 <h6><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: 6">edit</a>]</span> <span class="mw-headline" id="6">6</span></h6>
7974 <h3><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=3" title="Edit section: 3">edit</a>]</span> <span class="mw-headline" id="3">3</span></h3>
7975 <h1><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=4" title="Edit section: 1">edit</a>]</span> <span class="mw-headline" id="1">1</span></h1>
7976 <h5><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=5" title="Edit section: 5">edit</a>]</span> <span class="mw-headline" id="5">5</span></h5>
7977 <h2><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=6" title="Edit section: 2">edit</a>]</span> <span class="mw-headline" id="2_2">2</span></h2>
7979 !! end
7982 !! test
7983 ISBN with a dummy number
7984 !! input
7985 ISBN ---
7986 !! result
7987 <p>ISBN ---
7988 </p>
7989 !! end
7992 !! test
7993 ISBN with space-delimited number
7994 !! input
7995 ISBN 92 9017 032 8
7996 !! result
7997 <p><a href="/wiki/Special:BookSources/9290170328" class="internal mw-magiclink-isbn">ISBN 92 9017 032 8</a>
7998 </p>
7999 !! end
8002 !! test
8003 ISBN with multiple spaces, no number
8004 !! input
8005 ISBN  foo
8006 !! result
8007 <p>ISBN  foo
8008 </p>
8009 !! end
8012 !! test
8013 ISBN length
8014 !! input
8015 ISBN 123456789
8017 ISBN 1234567890
8019 ISBN 12345678901
8020 !! result
8021 <p>ISBN 123456789
8022 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
8023 </p><p>ISBN 12345678901
8024 </p>
8025 !! end
8028 !! test
8029 ISBN with trailing year (bug 8110)
8030 !! input
8031 ISBN 1-234-56789-0 - 2006
8033 ISBN 1 234 56789 0 - 2006
8034 !! result
8035 <p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1-234-56789-0</a> - 2006
8036 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1 234 56789 0</a> - 2006
8037 </p>
8038 !! end
8041 !! test
8042 anchorencode
8043 !! input
8044 {{anchorencode:foo bar©#%n}}
8045 !! result
8046 <p>foo_bar.C2.A9.23.25n
8047 </p>
8048 !! end
8050 !! test
8051 anchorencode trims spaces
8052 !! input
8053 {{anchorencode: __pretty__please__}}
8054 !! result
8055 <p>pretty_please
8056 </p>
8057 !! end
8059 !! test
8060 anchorencode deals with links
8061 !! input
8062 {{anchorencode: [[hello|world]] [[hi]]}}
8063 !! result
8064 <p>world_hi
8065 </p>
8066 !! end
8068 !! test
8069 anchorencode deals with templates
8070 !! input
8071 {{anchorencode: {{Foo}} }}
8072 !! result
8073 <p>FOO
8074 </p>
8075 !! end
8077 !! test
8078 anchorencode encodes like the TOC generator: (bug 18431)
8079 !! input
8080 === _ +:.3A%3A&&amp;]] ===
8081 {{anchorencode: _ +:.3A%3A&&amp;]] }}
8082 __NOEDITSECTION__
8083 !! result
8084 <h3> <span class="mw-headline" id=".2B:.3A.253A.26.26.5D.5D"> _ +:.3A%3A&amp;&amp;]] </span></h3>
8085 <p>.2B:.3A.253A.26.26.5D.5D
8086 </p>
8087 !! end
8089 # Expected output in the following test is not necessarily expected (there
8090 # should probably be <p> tags inside the <blockquote> in the output) -- it's
8091 # only testing for well-formedness.
8092 !! test
8093 Bug 6200: blockquotes and paragraph formatting
8094 !! input
8095 <blockquote>
8097 </blockquote>
8101  baz
8102 !! result
8103 <blockquote>
8105 </blockquote>
8106 <p>bar
8107 </p>
8108 <pre>baz
8109 </pre>
8110 !! end
8112 !! test
8113 Bug 8293: Use of center tag ruins paragraph formatting
8114 !! input
8115 <center>
8117 </center>
8121  baz
8122 !! result
8123 <center>
8124 <p>foo
8125 </p>
8126 </center>
8127 <p>bar
8128 </p>
8129 <pre>baz
8130 </pre>
8131 !! end
8135 ### Language variants related tests
8137 !! test
8138 Self-link in language variants
8139 !! options
8140 title=[[Dunav]] language=sr
8141 !! input
8142 Both [[Dunav]] and [[Дунав]] are names for this river.
8143 !! result
8144 <p>Both <strong class="selflink">Dunav</strong> and <strong class="selflink">Дунав</strong> are names for this river.
8145 </p>
8146 !!end
8149 !! test
8150 Link to pages in language variants
8151 !! options
8152 language=sr
8153 !! input
8154 Main Page can be written as [[Маин Паге]]
8155 !! result
8156 <p>Main Page can be written as <a href="/wiki/Main_Page" title="Main Page">Маин Паге</a>
8157 </p>
8158 !!end
8161 !! test
8162 Multiple links to pages in language variants
8163 !! options
8164 language=sr
8165 !! input
8166 [[Main Page]] can be written as [[Маин Паге]] same as [[Маин Паге]].
8167 !! result
8168 <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>.
8169 </p>
8170 !!end
8173 !! test
8174 Simple template in language variants
8175 !! options
8176 language=sr
8177 !! input
8178 {{тест}}
8179 !! result
8180 <p>This is a test template
8181 </p>
8182 !! end
8185 !! test
8186 Template with explicit namespace in language variants
8187 !! options
8188 language=sr
8189 !! input
8190 {{Template:тест}}
8191 !! result
8192 <p>This is a test template
8193 </p>
8194 !! end
8197 !! test
8198 Basic test for template parameter in language variants
8199 !! options
8200 language=sr
8201 !! input
8202 {{парамтест|param=foo}}
8203 !! result
8204 <p>This is a test template with parameter foo
8205 </p>
8206 !! end
8209 !! test
8210 Simple category in language variants
8211 !! options
8212 language=sr cat
8213 !! input
8214 [[Category:МедиаWики Усер'с Гуиде]]
8215 !! result
8216 <a href="/wiki/%D0%9A%D0%B0%D1%82%D0%B5%D0%B3%D0%BE%D1%80%D0%B8%D1%98%D0%B0:MediaWiki_User%27s_Guide" title="Категорија:MediaWiki User's Guide">MediaWiki User's Guide</a>
8217 !! end
8220 !! test
8221 Stripping -{}- tags (language variants)
8222 !! options
8223 language=sr
8224 !! input
8225 Latin proverb: -{Ne nuntium necare}-
8226 !! result
8227 <p>Latin proverb: Ne nuntium necare
8228 </p>
8229 !! end
8232 !! test
8233 Prevent conversion with -{}- tags (language variants)
8234 !! options
8235 language=sr variant=sr-ec
8236 !! input
8237 Latinski: -{Ne nuntium necare}-
8238 !! result
8239 <p>Латински: Ne nuntium necare
8240 </p>
8241 !! end
8244 !! test
8245 Prevent conversion of text with -{}- tags (language variants)
8246 !! options
8247 language=sr variant=sr-ec
8248 !! input
8249 Latinski: -{Ne nuntium necare}-
8250 !! result
8251 <p>Латински: Ne nuntium necare
8252 </p>
8253 !! end
8256 !! test
8257 Prevent conversion of links with -{}- tags (language variants)
8258 !! options
8259 language=sr variant=sr-ec
8260 !! input
8261 -{[[Main Page]]}-
8262 !! result
8263 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
8264 </p>
8265 !! end
8268 !! test
8269 -{}- tags within headlines (within html for parserConvert())
8270 !! options
8271 language=sr variant=sr-ec
8272 !! input
8273 == -{Naslov}- ==
8274 !! result
8275 <h2><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Уредите одељак „Naslov“">уреди</a>]</span> <span class="mw-headline" id="-.7BNaslov.7D-"> Naslov </span></h2>
8277 !! end
8280 !! test
8281 Explicit definition of language variant alternatives
8282 !! options
8283 language=zh variant=zh-tw
8284 !! input
8285 -{zh:China;zh-tw:Taiwan}-, not China
8286 !! result
8287 <p>Taiwan, not China
8288 </p>
8289 !! end
8292 !! test
8293 Explicit session-wise language variant mapping (A flag and - flag)
8294 !! options
8295 language=zh variant=zh-tw
8296 !! input
8297 Taiwan is not China.
8298 But -{A|zh:China;zh-tw:Taiwan}- is China,
8299 (This-{-|zh:China;zh-tw:Taiwan}- should be stripped!)
8300 and -{China}- is China.
8301 !! result
8302 <p>Taiwan is not China.
8303 But Taiwan is Taiwan,
8304 (This should be stripped!)
8305 and China is China.
8306 </p>
8307 !! end
8309 !! test
8310 Explicit session-wise language variant mapping (H flag for hide)
8311 !! options
8312 language=zh variant=zh-tw
8313 !! input
8314 (This-{H|zh:China;zh-tw:Taiwan}- should be stripped!)
8315 Taiwan is China.
8316 !! result
8317 <p>(This should be stripped!)
8318 Taiwan is Taiwan.
8319 </p>
8320 !! end
8322 !! test
8323 Adding explicit conversion rule for title (T flag)
8324 !! options
8325 language=zh variant=zh-tw showtitle
8326 !! input
8327 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
8328 !! result
8329 Taiwan
8330 <p>Should be stripped!
8331 </p>
8332 !! end
8334 !! test
8335 Testing that changing the language variant here in the tests actually works
8336 !! options
8337 language=zh variant=zh showtitle
8338 !! input
8339 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
8340 !! result
8341 China
8342 <p>Should be stripped!
8343 </p>
8344 !! end
8346 !! test
8347 Bug 24072: more test on conversion rule for title
8348 !! options
8349 language=zh variant=zh-tw showtitle
8350 !! input
8351 This should be stripped-{T|zh:China;zh-tw:Taiwan}-!
8352 This won't take interferes with the title rule-{H|zh:Beijing;zh-tw:Taipei}-.
8353 !! result
8354 Taiwan
8355 <p>This should be stripped!
8356 This won't take interferes with the title rule.
8357 </p>
8358 !! end
8360 !! test
8361 Raw output of variant escape tags (R flag)
8362 !! options
8363 language=zh variant=zh-tw
8364 !! input
8365 Raw: -{R|zh:China;zh-tw:Taiwan}-
8366 !! result
8367 <p>Raw: zh:China;zh-tw:Taiwan
8368 </p>
8369 !! end
8371 !! test
8372 Nested using of manual convert syntax
8373 !! options
8374 language=zh variant=zh-hk
8375 !! input
8376 Nested: -{zh-hans:Hi -{zh-cn:China;zh-sg:Singapore;}-;zh-hant:Hello -{zh-tw:Taiwan;zh-hk:H-{ong}- K-{}-ong;}-;}-!
8377 !! result
8378 <p>Nested: Hello Hong Kong!
8379 </p>
8380 !! end
8382 !! test
8383 Do not convert roman numbers to language variants
8384 !! options
8385 language=sr variant=sr-ec
8386 !! input
8387 Fridrih IV je car.
8388 !! result
8389 <p>Фридрих IV је цар.
8390 </p>
8391 !! end
8393 !! test
8394 Unclosed language converter markup "-{"
8395 !! options 
8396 language=sr
8397 !! input
8398 -{T|hello
8399 !! result
8400 <p>-{T|hello
8401 </p>
8402 !! end
8404 !! test
8405 Don't convert raw rule "-{R|=&gt;}-" to "=>"
8406 !! options
8407 language=sr
8408 !! input
8409 -{R|=&gt;}-
8410 !! result 
8411 <p>=&gt;
8412 </p>
8413 !!end
8415 !!article 
8416 Template:Bullet
8417 !!text
8418 * Bar
8419 !!endarticle
8421 !! test
8422 Bug 529: Uncovered bullet
8423 !! input
8424 * Foo {{bullet}}
8425 !! result
8426 <ul><li> Foo 
8427 </li><li> Bar
8428 </li></ul>
8430 !! end
8432 !! test
8433 Bug 529: Uncovered table already at line-start
8434 !! input
8437 {{table}}
8439 !! result
8440 <p>x
8441 </p>
8442 <table>
8443 <tr>
8444 <td>1
8445 </td>
8446 <td>2
8447 </td>
8448 </tr>
8449 <tr>
8450 <td>3
8451 </td>
8452 <td>4
8453 </td>
8454 </tr>
8455 </table>
8456 <p>y
8457 </p>
8458 !! end
8460 !! test
8461 Bug 529: Uncovered bullet in parser function result
8462 !! input
8463 * Foo {{lc:{{bullet}} }}
8464 !! result
8465 <ul><li> Foo 
8466 </li><li> bar
8467 </li></ul>
8469 !! end
8471 !! test
8472 Bug 5678: Double-parsed template argument
8473 !! input
8474 {{lc:{{{1}}}|hello}}
8475 !! result
8476 <p>{{{1}}}
8477 </p>
8478 !! end
8480 !! test
8481 Bug 5678: Double-parsed template invocation
8482 !! input
8483 {{lc:{{paramtest {{!}} param = hello }} }}
8484 !! result
8485 <p>{{paramtest | param = hello }}
8486 </p>
8487 !! end
8489 !! test
8490 Case insensitivity of parser functions for non-ASCII characters (bug 8143)
8491 !! options
8492 language=cs
8493 title=[[Main Page]]
8494 !! input
8495 {{PRVNÍVELKÉ:ěščř}}
8496 {{prvnívelké:ěščř}}
8497 {{PRVNÍMALÉ:ěščř}}
8498 {{prvnímalé:ěščř}}
8499 {{MALÁ:ěščř}}
8500 {{malá:ěščř}}
8501 {{VELKÁ:ěščř}}
8502 {{velká:ěščř}}
8503 !! result
8504 <p>Ěščř
8505 Ěščř
8506 ěščř
8507 ěščř
8508 ěščř
8509 ěščř
8510 ĚŠČŘ
8511 ĚŠČŘ
8512 </p>
8513 !! end
8515 !! test
8516 Morwen/13: Unclosed link followed by heading
8517 !! input
8518 [[link
8519 ==heading==
8520 !! result
8521 <p>[[link
8522 </p>
8523 <h2><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: heading">edit</a>]</span> <span class="mw-headline" id="heading">heading</span></h2>
8525 !! end
8527 !! test
8528 HHP2.1: Heuristics for headings in preprocessor parenthetical structures
8529 !! input
8530 {{foo|
8531 =heading=
8532 !! result
8533 <p>{{foo|
8534 </p>
8535 <h1> <span class="mw-headline" id="heading">heading</span></h1>
8537 !! end
8539 !! test
8540 HHP2.2: Heuristics for headings in preprocessor parenthetical structures
8541 !! input
8542 {{foo|
8543 ==heading==
8544 !! result
8545 <p>{{foo|
8546 </p>
8547 <h2><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: heading">edit</a>]</span> <span class="mw-headline" id="heading">heading</span></h2>
8549 !! end
8551 !! test
8552 Tildes in comments
8553 !! options
8555 !! input
8556 <!-- ~~~~ -->
8557 !! result
8558 <!-- ~~~~ -->
8559 !! end
8561 !! test
8562 Paragraphs inside divs (no extra line breaks)
8563 !! input
8564 <div>Line one
8566 Line two</div>
8567 !! result
8568 <div>Line one
8569 Line two</div>
8571 !! end
8573 !! test
8574 Paragraphs inside divs (extra line break on open)
8575 !! input
8576 <div>
8577 Line one
8579 Line two</div>
8580 !! result
8581 <div>
8582 <p>Line one
8583 </p>
8584 Line two</div>
8586 !! end
8588 !! test
8589 Paragraphs inside divs (extra line break on close)
8590 !! input
8591 <div>Line one
8593 Line two
8594 </div>
8595 !! result
8596 <div>Line one
8597 <p>Line two
8598 </p>
8599 </div>
8601 !! end
8603 !! test
8604 Paragraphs inside divs (extra line break on open and close)
8605 !! input
8606 <div>
8607 Line one
8609 Line two
8610 </div>
8611 !! result
8612 <div>
8613 <p>Line one
8614 </p><p>Line two
8615 </p>
8616 </div>
8618 !! end
8620 !! test
8621 Nesting tags, paragraphs on lines which begin with <div>
8622 !! options
8623 disabled
8624 !! input
8625 <div></div><strong>A
8626 B</strong>
8627 !! result
8628 <div></div>
8629 <p><strong>A
8630 B</strong>
8631 </p>
8632 !! end
8634 # Bug 6200: <blockquote> should behave like <div> with respect to line breaks
8635 !! test
8636 Bug 6200: paragraphs inside blockquotes (no extra line breaks)
8637 !! options
8638 disabled
8639 !! input
8640 <blockquote>Line one
8642 Line two</blockquote>
8643 !! result
8644 <blockquote>Line one
8645 Line two</blockquote>
8647 !! end
8649 !! test
8650 Bug 6200: paragraphs inside blockquotes (extra line break on open)
8651 !! options
8652 disabled
8653 !! input
8654 <blockquote>
8655 Line one
8657 Line two</blockquote>
8658 !! result
8659 <blockquote>
8660 <p>Line one
8661 </p>
8662 Line two</blockquote>
8664 !! end
8666 !! test
8667 Bug 6200: paragraphs inside blockquotes (extra line break on close)
8668 !! options
8669 disabled
8670 !! input
8671 <blockquote>Line one
8673 Line two
8674 </blockquote>
8675 !! result
8676 <blockquote>Line one
8677 <p>Line two
8678 </p>
8679 </blockquote>
8681 !! end
8683 !! test
8684 Bug 6200: paragraphs inside blockquotes (extra line break on open and close)
8685 !! options
8686 disabled
8687 !! input
8688 <blockquote>
8689 Line one
8691 Line two
8692 </blockquote>
8693 !! result
8694 <blockquote>
8695 <p>Line one
8696 </p><p>Line two
8697 </p>
8698 </blockquote>
8700 !! end
8702 !! test
8703 Paragraphs inside blockquotes/divs (no extra line breaks)
8704 !! input
8705 <blockquote><div>Line one
8707 Line two</div></blockquote>
8708 !! result
8709 <blockquote><div>Line one
8710 Line two</div></blockquote>
8712 !! end
8714 !! test
8715 Paragraphs inside blockquotes/divs (extra line break on open)
8716 !! input
8717 <blockquote><div>
8718 Line one
8720 Line two</div></blockquote>
8721 !! result
8722 <blockquote><div>
8723 <p>Line one
8724 </p>
8725 Line two</div></blockquote>
8727 !! end
8729 !! test
8730 Paragraphs inside blockquotes/divs (extra line break on close)
8731 !! input
8732 <blockquote><div>Line one
8734 Line two
8735 </div></blockquote>
8736 !! result
8737 <blockquote><div>Line one
8738 <p>Line two
8739 </p>
8740 </div></blockquote>
8742 !! end
8744 !! test
8745 Paragraphs inside blockquotes/divs (extra line break on open and close)
8746 !! input
8747 <blockquote><div>
8748 Line one
8750 Line two
8751 </div></blockquote>
8752 !! result
8753 <blockquote><div>
8754 <p>Line one
8755 </p><p>Line two
8756 </p>
8757 </div></blockquote>
8759 !! end
8761 !! test
8762 Interwiki links trounced by replaceExternalLinks after early LinkHolderArray expansion
8763 !! options
8764 wgLinkHolderBatchSize=0
8765 !! input
8766 [[meatball:1]]
8767 [[meatball:2]]
8768 [[meatball:3]]
8769 !! result
8770 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?1" class="extiw" title="meatball:1">meatball:1</a>
8771 <a href="http://www.usemod.com/cgi-bin/mb.pl?2" class="extiw" title="meatball:2">meatball:2</a>
8772 <a href="http://www.usemod.com/cgi-bin/mb.pl?3" class="extiw" title="meatball:3">meatball:3</a>
8773 </p>
8774 !! end
8776 !! test
8777 Free external link invading image caption
8778 !! input
8779 [[Image:Foobar.jpg|thumb|http://x|hello]]
8780 !! result
8781 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/3/3a/Foobar.jpg" width="180" height="20" class="thumbimage" /></a>  <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>hello</div></div></div>
8783 !! end
8785 !! test
8786 Bug 15196: localised external link numbers
8787 !! options
8788 language=fa
8789 !! input
8790 [http://en.wikipedia.org/]
8791 !! result
8792 <p><a rel="nofollow" class="external autonumber" href="http://en.wikipedia.org/">[۱]</a>
8793 </p>
8794 !! end
8796 !! test
8797 Multibyte character in padleft
8798 !! input
8799 {{padleft:-Hello|7|Æ}}
8800 !! result
8801 <p>Æ-Hello
8802 </p>
8803 !! end
8805 !! test
8806 Multibyte character in padright
8807 !! input
8808 {{padright:Hello-|7|Æ}}
8809 !! result
8810 <p>Hello-Æ
8811 </p>
8812 !! end
8814 !! test
8815 Formatted date
8816 !! config
8817 wgUseDynamicDates=1
8818 !! input
8819 [[2009-03-24]]
8820 !! result
8821 <p><span class="mw-formatted-date" title="2009-03-24"><a href="/index.php?title=2009&amp;action=edit&amp;redlink=1" class="new" title="2009 (page does not exist)">2009</a>-<a href="/index.php?title=March_24&amp;action=edit&amp;redlink=1" class="new" title="March 24 (page does not exist)">03-24</a></span>
8822 </p>
8823 !!end
8825 !!test
8826 formatdate parser function
8827 !!input
8828 {{#formatdate:2009-03-24}}
8829 !! result
8830 <p><span class="mw-formatted-date" title="2009-03-24">2009-03-24</span>
8831 </p>
8832 !! end
8834 !!test
8835 formatdate parser function, with default format
8836 !!input
8837 {{#formatdate:2009-03-24|mdy}}
8838 !! result
8839 <p><span class="mw-formatted-date" title="2009-03-24">March 24, 2009</span>
8840 </p>
8841 !! end
8843 !! test
8844 Linked date with autoformatting disabled
8845 !! config
8846 wgUseDynamicDates=false
8847 !! input
8848 [[2009-03-24]]
8849 !! result
8850 <p><a href="/index.php?title=2009-03-24&amp;action=edit&amp;redlink=1" class="new" title="2009-03-24 (page does not exist)">2009-03-24</a>
8851 </p>
8852 !! end
8854 !! test
8855 Spacing of numbers in formatted dates
8856 !! input
8857 {{#formatdate:January 15}}
8858 !! result
8859 <p><span class="mw-formatted-date" title="01-15">January 15</span>
8860 </p>
8861 !! end
8863 !! test
8864 Spacing of numbers in formatted dates (linked)
8865 !! config
8866 wgUseDynamicDates=true
8867 !! input
8868 [[January 15]]
8869 !! result
8870 <p><span class="mw-formatted-date" title="01-15"><a href="/index.php?title=January_15&amp;action=edit&amp;redlink=1" class="new" title="January 15 (page does not exist)">January 15</a></span>
8871 </p>
8872 !! end
8879 # Edit comments
8882 !! test
8883 Edit comment with link
8884 !! options
8885 comment
8886 !! input
8887 I like the [[Main Page]] a lot
8888 !! result
8889 I like the <a href="/wiki/Main_Page" title="Main Page">Main Page</a> a lot
8890 !!end
8892 !! test
8893 Edit comment with link and link text
8894 !! options
8895 comment
8896 !! input
8897 I like the [[Main Page|best pages]] a lot
8898 !! result
8899 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
8900 !!end
8902 !! test
8903 Edit comment with link and link text with suffix
8904 !! options
8905 comment
8906 !! input
8907 I like the [[Main Page|best page]]s a lot
8908 !! result
8909 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
8910 !!end
8912 !! test
8913 Edit comment with section link (non-local, eg in history list)
8914 !! options
8915 comment title=[[Main Page]]
8916 !! input
8917 /* External links */ removed bogus entries
8918 !! result
8919 <span class="autocomment"><a href="/wiki/Main_Page#External_links" title="Main Page">→</a>External links: </span> removed bogus entries
8920 !!end
8922 !! test
8923 Edit comment with section link (local, eg in diff view)
8924 !! options
8925 comment local title=[[Main Page]]
8926 !! input
8927 /* External links */ removed bogus entries
8928 !! result
8929 <span class="autocomment"><a href="#External_links">→</a>External links: </span> removed bogus entries
8930 !!end
8932 !! test
8933 Edit comment with subpage link (bug 14080)
8934 !! options
8935 comment
8936 subpage
8937 title=[[Subpage test]]
8938 !! input
8939 Poked at a [[/subpage]] here...
8940 !! result
8941 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a> here...
8942 !!end
8944 !! test
8945 Edit comment with subpage link and link text (bug 14080)
8946 !! options
8947 comment
8948 subpage
8949 title=[[Subpage test]]
8950 !! input
8951 Poked at a [[/subpage|neat little page]] here...
8952 !! result
8953 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">neat little page</a> here...
8954 !!end
8956 !! test
8957 Edit comment with bogus subpage link in non-subpage NS (bug 14080)
8958 !! options
8959 comment
8960 title=[[Subpage test]]
8961 !! input
8962 Poked at a [[/subpage]] here...
8963 !! result
8964 Poked at a <a href="/index.php?title=/subpage&amp;action=edit&amp;redlink=1" class="new" title="/subpage (page does not exist)">/subpage</a> here...
8965 !!end
8967 !! test
8968 Edit comment with bare anchor link (local, as on diff)
8969 !! options
8970 comment
8971 local
8972 title=[[Main Page]]
8973 !!input
8974 [[#section]]
8975 !! result
8976 <a href="#section">#section</a>
8977 !! end
8979 !! test
8980 Edit comment with bare anchor link (non-local, as on history)
8981 !! options
8982 comment
8983 title=[[Main Page]]
8984 !!input
8985 [[#section]]
8986 !! result
8987 <a href="/wiki/Main_Page#section" title="Main Page">#section</a>
8988 !! end
8990 !! test
8991 Anchor starting with underscore
8992 !!input
8993 [[#_ref|One]]
8994 !! result
8995 <p><a href="#_ref">One</a>
8996 </p>
8997 !! end
8999 !! test
9000 Id starting with underscore
9001 !!input
9002 <div id="_ref"></div>
9003 !! result
9004 <div id="_ref"></div>
9006 !! end
9008 !! test
9009 Space normalisation on autocomment (bug 22784)
9010 !! options
9011 comment
9012 title=[[Main Page]]
9013 !!input
9014 /* __hello__world__ */
9015 !! result
9016 <span class="autocomment"><a href="/wiki/Main_Page#hello_world" title="Main Page">→</a>__hello__world__</span>
9017 !! end
9019 !! test
9020 percent-encoding and + signs in comments (Bug 26410)
9021 !! options
9022 comment
9023 !!input
9024 [[ABC%33D% ++]] [[ABC%33D% ++|+%20]]
9025 !! result
9026 <a href="/index.php?title=ABC3D%25_%2B%2B&amp;action=edit&amp;redlink=1" class="new" title="ABC3D% ++ (page does not exist)">ABC3D% ++</a> <a href="/index.php?title=ABC3D%25_%2B%2B&amp;action=edit&amp;redlink=1" class="new" title="ABC3D% ++ (page does not exist)">+%20</a>
9027 !! end
9029 !! test
9030 Bad images - basic functionality
9031 !! input
9032 [[File:Bad.jpg]]
9033 !! result
9034 !! end
9036 !! test
9037 Bad images - bug 16039: text after bad image disappears
9038 !! input
9039 Foo bar
9040 [[File:Bad.jpg]]
9041 Bar foo
9042 !! result
9043 <p>Foo bar
9044 </p><p>Bar foo
9045 </p>
9046 !! end
9048 !! test
9049 Verify that displaytitle works (bug #22501) no displaytitle
9050 !! options
9051 showtitle
9052 !! config
9053 wgAllowDisplayTitle=true
9054 wgRestrictDisplayTitle=false
9055 !! input
9056 this is not the the title
9057 !! result
9058 Parser test
9059 <p>this is not the the title
9060 </p>
9061 !! end
9063 !! test
9064 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=false
9065 !! options
9066 showtitle
9067 title=[[Screen]]
9068 !! config
9069 wgAllowDisplayTitle=true
9070 wgRestrictDisplayTitle=false
9071 !! input
9072 this is not the the title
9073 {{DISPLAYTITLE:whatever}}
9074 !! result
9075 whatever
9076 <p>this is not the the title
9077 </p>
9078 !! end
9080 !! test
9081 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true mismatch
9082 !! options
9083 showtitle
9084 title=[[Screen]]
9085 !! config
9086 wgAllowDisplayTitle=true
9087 wgRestrictDisplayTitle=true
9088 !! input
9089 this is not the the title
9090 {{DISPLAYTITLE:whatever}}
9091 !! result
9092 Screen
9093 <p>this is not the the title
9094 </p>
9095 !! end
9097 !! test
9098 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true matching
9099 !! options
9100 showtitle
9101 title=[[Screen]]
9102 !! config
9103 wgAllowDisplayTitle=true
9104 wgRestrictDisplayTitle=true
9105 !! input
9106 this is not the the title
9107 {{DISPLAYTITLE:screen}}
9108 !! result
9109 screen
9110 <p>this is not the the title
9111 </p>
9112 !! end
9114 !! test
9115 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false
9116 !! options
9117 showtitle
9118 title=[[Screen]]
9119 !! config
9120 wgAllowDisplayTitle=false
9121 !! input
9122 this is not the the title
9123 {{DISPLAYTITLE:screen}}
9124 !! result
9125 Screen
9126 <p>this is not the the title
9127 <a href="/index.php?title=Template:DISPLAYTITLE:screen&amp;action=edit&amp;redlink=1" class="new" title="Template:DISPLAYTITLE:screen (page does not exist)">Template:DISPLAYTITLE:screen</a>
9128 </p>
9129 !! end
9131 !! test
9132 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false no DISPLAYTITLE
9133 !! options
9134 showtitle
9135 title=[[Screen]]
9136 !! config
9137 wgAllowDisplayTitle=false
9138 !! input
9139 this is not the the title
9140 !! result
9141 Screen
9142 <p>this is not the the title
9143 </p>
9144 !! end
9146 !! test
9147 preload: check <noinclude> and <includeonly>
9148 !! options
9149 preload
9150 !! input
9151 Hello <noinclude>cruel</noinclude><includeonly>kind</includeonly> world.
9152 !! result
9153 Hello kind world.
9154 !! end
9156 !! test
9157 preload: check <onlyinclude>
9158 !! options
9159 preload
9160 !! input
9161 Goodbye <onlyinclude>Hello world</onlyinclude>
9162 !! result
9163 Hello world
9164 !! end
9166 !! test
9167 preload: can pass tags through if we want to
9168 !! options
9169 preload
9170 !! input
9171 <includeonly><</includeonly>includeonly>Hello world<includeonly><</includeonly>/includeonly>
9172 !! result
9173 <includeonly>Hello world</includeonly>
9174 !! end
9176 !! test
9177 preload: check that it doesn't try to do tricks
9178 !! options
9179 preload
9180 !! input
9181 * <!-- Hello --> ''{{world}}'' {{<includeonly>subst:</includeonly>How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
9182 !! result
9183 * <!-- Hello --> ''{{world}}'' {{subst:How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
9184 !! end
9186 !! test
9187 Play a bit with r67090 and bug 3158 
9188 !! options
9189 disabled
9190 !! input
9191 <div style="width:50% !important">&nbsp;</div>
9192 <div style="width:50%&nbsp;!important">&nbsp;</div>
9193 <div style="width:50%&#160;!important">&nbsp;</div>
9194 <div style="border : solid;">&nbsp;</div>
9195 !! result
9196 <div style="width:50% !important">&nbsp;</div>
9197 <div style="width:50% !important">&nbsp;</div>
9198 <div style="width:50% !important">&nbsp;</div>
9199 <div style="border&#160;: solid;">&nbsp;</div>
9201 !! end
9203 !! test
9204 HTML5 data attributes
9205 !! input
9206 <span data-foo="bar">Baz</span>
9207 <p data-abc-def_hij="">Quuz</p>
9208 !! result
9209 <p><span data-foo="bar">Baz</span>
9210 </p>
9211 <p data-abc-def_hij="">Quuz</p>
9213 !! end
9215 !! test
9216 percent-encoding and + signs in internal links (Bug 26410)
9217 !! input
9218 [[User:+%]] [[Page+title%]]
9219 [[%+]] [[%+|%20]] [[%+ ]] [[%+r]]
9220 [[%]] [[+]] [[image:%+abc%39|foo|[[bar]]]]
9221 [[%33%45]] [[%33%45+]]
9222 !! result
9223 <p><a href="/index.php?title=User:%2B%25&amp;action=edit&amp;redlink=1" class="new" title="User:+% (page does not exist)">User:+%</a> <a href="/index.php?title=Page%2Btitle%25&amp;action=edit&amp;redlink=1" class="new" title="Page+title% (page does not exist)">Page+title%</a>
9224 <a href="/index.php?title=%25%2B&amp;action=edit&amp;redlink=1" class="new" title="%+ (page does not exist)">%+</a> <a href="/index.php?title=%25%2B&amp;action=edit&amp;redlink=1" class="new" title="%+ (page does not exist)">%20</a> <a href="/index.php?title=%25%2B&amp;action=edit&amp;redlink=1" class="new" title="%+ (page does not exist)">%+ </a> <a href="/index.php?title=%25%2Br&amp;action=edit&amp;redlink=1" class="new" title="%+r (page does not exist)">%+r</a>
9225 <a href="/index.php?title=%25&amp;action=edit&amp;redlink=1" class="new" title="% (page does not exist)">%</a> <a href="/index.php?title=%2B&amp;action=edit&amp;redlink=1" class="new" title="+ (page does not exist)">+</a> <a href="/index.php?title=Special:Upload&amp;wpDestFile=%25%2Babc9" class="new" title="File:%+abc9">bar</a>
9226 <a href="/index.php?title=3E&amp;action=edit&amp;redlink=1" class="new" title="3E (page does not exist)">3E</a> <a href="/index.php?title=3E%2B&amp;action=edit&amp;redlink=1" class="new" title="3E+ (page does not exist)">3E+</a>
9227 </p>
9228 !! end
9230 !! test
9231 Special characters in embedded file links (bug 27679)
9232 !! input
9233 [[File:Contains & ampersand.jpg]]
9234 [[File:Does not exist.jpg|Title with & ampersand]]
9235 !! result
9236 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=Contains_%26_ampersand.jpg" class="new" title="File:Contains &amp; ampersand.jpg">File:Contains &amp; ampersand.jpg</a>
9237 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Does_not_exist.jpg" class="new" title="File:Does not exist.jpg">Title with &amp; ampersand</a>
9238 </p>
9239 !! end
9242 !! test
9243 Confirm that 'apos' named character reference doesn't make it to output (not legal in HTML 4)
9244 !! input
9245 Text&apos;s been normalized?
9246 !! result
9247 <p>Text&#39;s been normalized?
9248 </p>
9249 !! end
9252 TODO:
9253 more images
9254 more tables
9255 math
9256 character entities
9257 and much more
9258 Try for 100% code coverage