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