rv r96424, Roan had his fun
[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: trim trailing empty lines
4029 !! options
4030 pst
4031 !! input
4032 Empty lines are trimmed
4033
4034
4035
4036
4037 !! result
4038 Empty lines are trimmed
4039 !! end
4040
4041 !! test
4042 pre-save transform: Signature expansion
4043 !! options
4044 pst
4045 !! input
4046 * ~~~
4047 * <noinclude>~~~</noinclude>
4048 * <includeonly>~~~</includeonly>
4049 * <onlyinclude>~~~</onlyinclude>
4050 !! result
4051 * [[Special:Contributions/127.0.0.1|127.0.0.1]]
4052 * <noinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</noinclude>
4053 * <includeonly>[[Special:Contributions/127.0.0.1|127.0.0.1]]</includeonly>
4054 * <onlyinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</onlyinclude>
4055 !! end
4056
4057
4058 !! test
4059 pre-save transform: Signature expansion in nowiki tags (bug 93)
4060 !! options
4061 pst disabled
4062 !! input
4063 Shall not expand:
4064
4065 <nowiki>~~~~</nowiki>
4066
4067 <includeonly><nowiki>~~~~</nowiki></includeonly>
4068
4069 <noinclude><nowiki>~~~~</nowiki></noinclude>
4070
4071 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
4072
4073 {{subst:Foo}} shall be converted to FOO
4074
4075 As well as inside noinclude/onlyinclude
4076 <noinclude>{{subst:Foo}}</noinclude>
4077 <onlyinclude>{{subst:Foo}}</onlyinclude>
4078
4079 But not inside includeonly
4080 <includeonly>{{subst:Foo}}</includeonly>
4081 !! result
4082 Shall not expand:
4083
4084 <nowiki>~~~~</nowiki>
4085
4086 <includeonly><nowiki>~~~~</nowiki></includeonly>
4087
4088 <noinclude><nowiki>~~~~</nowiki></noinclude>
4089
4090 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
4091
4092 FOO shall be converted to FOO
4093
4094 As well as inside noinclude/onlyinclude
4095 <noinclude>FOO</noinclude>
4096 <onlyinclude>FOO</onlyinclude>
4097
4098 But not inside includeonly
4099 <includeonly>{{subst:Foo}}</includeonly>
4100 !! end
4101
4102 ###
4103 ### Message transform tests
4104 ###
4105 !! test
4106 message transform: magic variables
4107 !! options
4108 msg
4109 !! input
4110 {{SITENAME}}
4111 !! result
4112 MediaWiki
4113 !! end
4114
4115 !! test
4116 message transform: should not transform wiki markup
4117 !! options
4118 msg
4119 !! input
4120 ''test''
4121 !! result
4122 ''test''
4123 !! end
4124
4125 !! test
4126 message transform: <noinclude> in transcluded template (bug 4926)
4127 !! options
4128 msg
4129 !! input
4130 {{Includes}}
4131 !! result
4132 Foobar
4133 !! end
4134
4135 !! test
4136 message transform: <onlyinclude> in transcluded template (bug 4926)
4137 !! options
4138 msg
4139 !! input
4140 {{Includes2}}
4141 !! result
4142 Foo
4143 !! end
4144
4145 !! test
4146 {{#special:}} page name, known
4147 !! options
4148 msg
4149 !! input
4150 {{#special:Recentchanges}}
4151 !! result
4152 Special:RecentChanges
4153 !! end
4154
4155 !! test
4156 {{#special:}} page name with subpage, known
4157 !! options
4158 msg
4159 !! input
4160 {{#special:Recentchanges/param}}
4161 !! result
4162 Special:RecentChanges/param
4163 !! end
4164
4165 !! test
4166 {{#special:}} page name, unknown
4167 !! options
4168 msg
4169 !! input
4170 {{#special:foobarnonexistent}}
4171 !! result
4172 No such special page
4173 !! end
4174
4175 ###
4176 ### Images
4177 ###
4178 !! test
4179 Simple image
4180 !! input
4181 [[Image:foobar.jpg]]
4182 !! result
4183 <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>
4184 </p>
4185 !! end
4186
4187 !! test
4188 Right-aligned image
4189 !! input
4190 [[Image:foobar.jpg|right]]
4191 !! result
4192 <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>
4193
4194 !! end
4195
4196 !! test
4197 Simple image (using File: namespace, now canonical)
4198 !! input
4199 [[File:foobar.jpg]]
4200 !! result
4201 <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>
4202 </p>
4203 !! end
4204
4205 !! test
4206 Image with caption
4207 !! input
4208 [[Image:foobar.jpg|right|Caption text]]
4209 !! result
4210 <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>
4211
4212 !! end
4213
4214 !! test
4215 Image with link parameter, wiki target
4216 !! input
4217 [[Image:foobar.jpg|link=Target page]]
4218 !! result
4219 <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>
4220 </p>
4221 !! end
4222
4223 !! test
4224 Image with link parameter, URL target
4225 !! input
4226 [[Image:foobar.jpg|link=http://example.com/]]
4227 !! result
4228 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
4229 </p>
4230 !! end
4231
4232 !! test
4233 Image with link parameter, wgExternalLinkTarget
4234 !! input
4235 [[Image:foobar.jpg|link=http://example.com/]]
4236 !! config
4237 wgExternalLinkTarget='foobar'
4238 !! result
4239 <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>
4240 </p>
4241 !! end
4242
4243 !! test
4244 Image with link parameter, wgExternalLinkTarget, unnamed parameter
4245 !! input
4246 [[Image:foobar.jpg|link=http://example.com/|Title]]
4247 !! config
4248 wgExternalLinkTarget='foobar'
4249 !! result
4250 <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>
4251 </p>
4252 !! end
4253
4254 !! test
4255 Image with empty link parameter
4256 !! input
4257 [[Image:foobar.jpg|link=]]
4258 !! result
4259 <p><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" />
4260 </p>
4261 !! end
4262
4263 !! test
4264 Image with link parameter (wiki target) and unnamed parameter
4265 !! input
4266 [[Image:foobar.jpg|link=Target page|Title]]
4267 !! result
4268 <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>
4269 </p>
4270 !! end
4271
4272 !! test
4273 Image with link parameter (URL target) and unnamed parameter
4274 !! input
4275 [[Image:foobar.jpg|link=http://example.com/|Title]]
4276 !! result
4277 <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>
4278 </p>
4279 !! end
4280
4281 !! test
4282 Thumbnail image with link parameter
4283 !! input
4284 [[Image:foobar.jpg|thumb|link=http://example.com/|Title]]
4285 !! result
4286 <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>
4287
4288 !! end
4289
4290 !! test
4291 Image with frame and link
4292 !! input
4293 [[Image:Foobar.jpg|frame|left|This is a test image [[Main Page]]]]
4294 !! result
4295 <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>
4296
4297 !! end
4298
4299 !! test
4300 Image with frame and link and explicit alt
4301 !! input
4302 [[Image:Foobar.jpg|frame|left|This is a test image [[Main Page]]|alt=Altitude]]
4303 !! result
4304 <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>
4305
4306 !! end
4307
4308 !! test
4309 Image with wiki markup in implicit alt
4310 !! input
4311 [[Image:Foobar.jpg|testing '''bold''' in alt]]
4312 !! result
4313 <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>
4314 </p>
4315 !! end
4316
4317 !! test
4318 Image with wiki markup in explicit alt
4319 !! input
4320 [[Image:Foobar.jpg|alt=testing '''bold''' in alt]]
4321 !! result
4322 <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>
4323 </p>
4324 !! end
4325
4326 !! test
4327 Link to image page- image page normally doesn't exists, hence edit link
4328 Add test with existing image page
4329 #<p><a href="/wiki/File:Test" title="Image:Test">Image:test</a>
4330 !! input
4331 [[:Image:test]]
4332 !! result
4333 <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>
4334 </p>
4335 !! end
4336
4337 !! test
4338 bug 18784 Link to non-existent image page with caption should use caption as link text
4339 !! input
4340 [[:Image:test|caption]]
4341 !! result
4342 <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>
4343 </p>
4344 !! end
4345
4346 !! test
4347 Frameless image caption with a free URL
4348 !! input
4349 [[Image:foobar.jpg|http://example.com]]
4350 !! result
4351 <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>
4352 </p>
4353 !! end
4354
4355 !! test
4356 Thumbnail image caption with a free URL
4357 !! input
4358 [[Image:foobar.jpg|thumb|http://example.com]]
4359 !! result
4360 <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>
4361
4362 !! end
4363
4364 !! test
4365 Thumbnail image caption with a free URL and explicit alt
4366 !! input
4367 [[Image:foobar.jpg|thumb|http://example.com|alt=Alteration]]
4368 !! result
4369 <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>
4370
4371 !! end
4372
4373 !! test
4374 BUG 1887: A ISBN with a thumbnail
4375 !! input
4376 [[Image:foobar.jpg|thumb|ISBN 1235467890]]
4377 !! result
4378 <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>
4379
4380 !! end
4381
4382 !! test
4383 BUG 1887: A RFC with a thumbnail
4384 !! input
4385 [[Image:foobar.jpg|thumb|This is RFC 12354]]
4386 !! result
4387 <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>
4388
4389 !! end
4390
4391 !! test
4392 BUG 1887: A mailto link with a thumbnail
4393 !! input
4394 [[Image:foobar.jpg|thumb|Please mailto:nobody@example.com]]
4395 !! result
4396 <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>
4397
4398 !! end
4399
4400 # Pending resolution to bug 368
4401 !! test
4402 BUG 648: Frameless image caption with a link
4403 !! input
4404 [[Image:foobar.jpg|text with a [[link]] in it]]
4405 !! result
4406 <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>
4407 </p>
4408 !! end
4409
4410 !! test
4411 BUG 648: Frameless image caption with a link (suffix)
4412 !! input
4413 [[Image:foobar.jpg|text with a [[link]]foo in it]]
4414 !! result
4415 <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>
4416 </p>
4417 !! end
4418
4419 !! test
4420 BUG 648: Frameless image caption with an interwiki link
4421 !! input
4422 [[Image:foobar.jpg|text with a [[MeatBall:Link]] in it]]
4423 !! result
4424 <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>
4425 </p>
4426 !! end
4427
4428 !! test
4429 BUG 648: Frameless image caption with a piped interwiki link
4430 !! input
4431 [[Image:foobar.jpg|text with a [[MeatBall:Link|link]] in it]]
4432 !! result
4433 <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>
4434 </p>
4435 !! end
4436
4437 !! test
4438 Escape HTML special chars in image alt text
4439 !! input
4440 [[Image:foobar.jpg|& < > "]]
4441 !! result
4442 <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>
4443 </p>
4444 !! end
4445
4446 !! test
4447 BUG 499: Alt text should have &#1234;, not &amp;1234;
4448 !! input
4449 [[Image:foobar.jpg|&#9792;]]
4450 !! result
4451 <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>
4452 </p>
4453 !! end
4454
4455 !! test
4456 Broken image caption with link
4457 !! input
4458 [[Image:Foobar.jpg|thumb|This is a broken caption. But [[Main Page|this]] is just an ordinary link.
4459 !! result
4460 <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.
4461 </p>
4462 !! end
4463
4464 !! test
4465 Image caption containing another image
4466 !! input
4467 [[Image:Foobar.jpg|thumb|This is a caption with another [[Image:icon.png|image]] inside it!]]
4468 !! result
4469 <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>
4470
4471 !! end
4472
4473 !! test
4474 Image caption containing a newline
4475 !! input
4476 [[Image:Foobar.jpg|This
4477 *is some text]]
4478 !! result
4479 <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>
4480 </p>
4481 !!end
4482
4483
4484 !! test
4485 Bug 3090: External links other than http: in image captions
4486 !! input
4487 [[Image:Foobar.jpg|thumb|200px|This caption has [irc://example.net irc] and [https://example.com Secure] ext links in it.]]
4488 !! result
4489 <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>
4490
4491 !! end
4492
4493 !! article
4494 File:Barfoo.jpg
4495 !! text
4496 #REDIRECT [[File:Barfoo.jpg]]
4497 !! endarticle
4498
4499 !! test
4500 Redirected image
4501 !! input
4502 [[Image:Barfoo.jpg]]
4503 !! result
4504 <p><a href="/wiki/File:Barfoo.jpg" title="File:Barfoo.jpg">File:Barfoo.jpg</a>
4505 </p>
4506 !! end
4507
4508 !! test
4509 Missing image with uploads disabled
4510 !! options
4511 wgEnableUploads=0
4512 !! input
4513 [[Image:Foobaz.jpg]]
4514 !! result
4515 <p><a href="/wiki/File:Foobaz.jpg" title="File:Foobaz.jpg">File:Foobaz.jpg</a>
4516 </p>
4517 !! end
4518
4519
4520 ###
4521 ### Subpages
4522 ###
4523 !! article
4524 Subpage test/subpage
4525 !! text
4526 foo
4527 !! endarticle
4528
4529 !! test
4530 Subpage link
4531 !! options
4532 subpage title=[[Subpage test]]
4533 !! input
4534 [[/subpage]]
4535 !! result
4536 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a>
4537 </p>
4538 !! end
4539
4540 !! test
4541 Subpage noslash link
4542 !! options
4543 subpage title=[[Subpage test]]
4544 !!input
4545 [[/subpage/]]
4546 !! result
4547 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">subpage</a>
4548 </p>
4549 !! end
4550
4551 !! test
4552 Disabled subpages
4553 !! input
4554 [[/subpage]]
4555 !! result
4556 <p><a href="/index.php?title=/subpage&amp;action=edit&amp;redlink=1" class="new" title="/subpage (page does not exist)">/subpage</a>
4557 </p>
4558 !! end
4559
4560 !! test
4561 BUG 561: {{/Subpage}}
4562 !! options
4563 subpage title=[[Page]]
4564 !! input
4565 {{/Subpage}}
4566 !! result
4567 <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>
4568 </p>
4569 !! end
4570
4571 ###
4572 ### Categories
4573 ###
4574 !! article
4575 Category:MediaWiki User's Guide
4576 !! text
4577 blah
4578 !! endarticle
4579
4580 !! test
4581 Link to category
4582 !! input
4583 [[:Category:MediaWiki User's Guide]]
4584 !! result
4585 <p><a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">Category:MediaWiki User's Guide</a>
4586 </p>
4587 !! end
4588
4589 !! test
4590 Simple category
4591 !! options
4592 cat
4593 !! input
4594 [[Category:MediaWiki User's Guide]]
4595 !! result
4596 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
4597 !! end
4598
4599 !! test
4600 PAGESINCATEGORY invalid title fatal (r33546 fix)
4601 !! input
4602 {{PAGESINCATEGORY:<bogus>}}
4603 !! result
4604 <p>0
4605 </p>
4606 !! end
4607
4608 ###
4609 ### Inter-language links
4610 ###
4611 !! test
4612 Inter-language links
4613 !! options
4614 ill
4615 !! input
4616 [[es:Alimento]]
4617 [[fr:Nourriture]]
4618 [[zh:&#39135;&#21697;]]
4619 !! result
4620 es:Alimento fr:Nourriture zh:食品
4621 !! end
4622
4623 ###
4624 ### Sections
4625 ###
4626 !! test
4627 Basic section headings
4628 !! input
4629 == Headline 1 ==
4630 Some text
4631
4632 ==Headline 2==
4633 More
4634 ===Smaller headline===
4635 Blah blah
4636 !! result
4637 <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>
4638 <p>Some text
4639 </p>
4640 <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>
4641 <p>More
4642 </p>
4643 <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>
4644 <p>Blah blah
4645 </p>
4646 !! end
4647
4648 !! test
4649 Section headings with TOC
4650 !! input
4651 == Headline 1 ==
4652 === Subheadline 1 ===
4653 ===== Skipping a level =====
4654 ====== Skipping a level ======
4655
4656 == Headline 2 ==
4657 Some text
4658 ===Another headline===
4659 !! result
4660 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
4661 <ul>
4662 <li class="toclevel-1 tocsection-1"><a href="#Headline_1"><span class="tocnumber">1</span> <span class="toctext">Headline 1</span></a>
4663 <ul>
4664 <li class="toclevel-2 tocsection-2"><a href="#Subheadline_1"><span class="tocnumber">1.1</span> <span class="toctext">Subheadline 1</span></a>
4665 <ul>
4666 <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>
4667 <ul>
4668 <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>
4669 </ul>
4670 </li>
4671 </ul>
4672 </li>
4673 </ul>
4674 </li>
4675 <li class="toclevel-1 tocsection-5"><a href="#Headline_2"><span class="tocnumber">2</span> <span class="toctext">Headline 2</span></a>
4676 <ul>
4677 <li class="toclevel-2 tocsection-6"><a href="#Another_headline"><span class="tocnumber">2.1</span> <span class="toctext">Another headline</span></a></li>
4678 </ul>
4679 </li>
4680 </ul>
4681 </td></tr></table>
4682 <h2><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: Headline 1">edit</a>]</span> <span class="mw-headline" id="Headline_1"> Headline 1 </span></h2>
4683 <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>
4684 <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>
4685 <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>
4686 <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>
4687 <p>Some text
4688 </p>
4689 <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>
4690
4691 !! end
4692
4693 # perl -e 'print "="x$_," Level $_ heading","="x$_,"\n" for 1..10'
4694 !! test
4695 Handling of sections up to level 6 and beyond
4696 !! input
4697 = Level 1 Heading=
4698 == Level 2 Heading==
4699 === Level 3 Heading===
4700 ==== Level 4 Heading====
4701 ===== Level 5 Heading=====
4702 ====== Level 6 Heading======
4703 ======= Level 7 Heading=======
4704 ======== Level 8 Heading========
4705 ========= Level 9 Heading=========
4706 ========== Level 10 Heading==========
4707 !! result
4708 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
4709 <ul>
4710 <li class="toclevel-1 tocsection-1"><a href="#Level_1_Heading"><span class="tocnumber">1</span> <span class="toctext">Level 1 Heading</span></a>
4711 <ul>
4712 <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>
4713 <ul>
4714 <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>
4715 <ul>
4716 <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>
4717 <ul>
4718 <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>
4719 <ul>
4720 <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>
4721 <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>
4722 <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>
4723 <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>
4724 <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>
4725 </ul>
4726 </li>
4727 </ul>
4728 </li>
4729 </ul>
4730 </li>
4731 </ul>
4732 </li>
4733 </ul>
4734 </li>
4735 </ul>
4736 </td></tr></table>
4737 <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>
4738 <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>
4739 <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>
4740 <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>
4741 <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>
4742 <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>
4743 <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>
4744 <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>
4745 <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>
4746 <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>
4747
4748 !! end
4749
4750 !! test
4751 TOC regression (bug 9764)
4752 !! input
4753 == title 1 ==
4754 === title 1.1 ===
4755 ==== title 1.1.1 ====
4756 === title 1.2 ===
4757 == title 2 ==
4758 === title 2.1 ===
4759 !! result
4760 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
4761 <ul>
4762 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
4763 <ul>
4764 <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>
4765 <ul>
4766 <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>
4767 </ul>
4768 </li>
4769 <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>
4770 </ul>
4771 </li>
4772 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
4773 <ul>
4774 <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>
4775 </ul>
4776 </li>
4777 </ul>
4778 </td></tr></table>
4779 <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>
4780 <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>
4781 <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>
4782 <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>
4783 <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>
4784 <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>
4785
4786 !! end
4787
4788 !! test
4789 TOC with wgMaxTocLevel=3 (bug 6204)
4790 !! options
4791 wgMaxTocLevel=3
4792 !! input
4793 == title 1 ==
4794 === title 1.1 ===
4795 ==== title 1.1.1 ====
4796 === title 1.2 ===
4797 == title 2 ==
4798 === title 2.1 ===
4799 !! result
4800 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
4801 <ul>
4802 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
4803 <ul>
4804 <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>
4805 <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>
4806 </ul>
4807 </li>
4808 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
4809 <ul>
4810 <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>
4811 </ul>
4812 </li>
4813 </ul>
4814 </td></tr></table>
4815 <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>
4816 <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>
4817 <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>
4818 <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>
4819 <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>
4820 <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>
4821
4822 !! end
4823
4824 !! test
4825 TOC with wgMaxTocLevel=3 and two level four headings (bug 6204)
4826 !! options
4827 wgMaxTocLevel=3
4828 !! input
4829 ==Section 1==
4830 ===Section 1.1===
4831 ====Section 1.1.1====
4832 ====Section 1.1.1.1====
4833 ==Section 2==
4834 !! result
4835 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
4836 <ul>
4837 <li class="toclevel-1 tocsection-1"><a href="#Section_1"><span class="tocnumber">1</span> <span class="toctext">Section 1</span></a>
4838 <ul>
4839 <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>
4840 </ul>
4841 </li>
4842 <li class="toclevel-1 tocsection-5"><a href="#Section_2"><span class="tocnumber">2</span> <span class="toctext">Section 2</span></a></li>
4843 </ul>
4844 </td></tr></table>
4845 <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>
4846 <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>
4847 <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>
4848 <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>
4849 <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>
4850
4851 !! end
4852
4853
4854 !! test
4855 Resolving duplicate section names
4856 !! input
4857 == Foo bar ==
4858 == Foo bar ==
4859 !! result
4860 <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>
4861 <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>
4862
4863 !! end
4864
4865 !! test
4866 Resolving duplicate section names with differing case (bug 10721)
4867 !! input
4868 == Foo bar ==
4869 == Foo Bar ==
4870 !! result
4871 <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>
4872 <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>
4873
4874 !! end
4875
4876 !! article
4877 Template:sections
4878 !! text
4879 ===Section 1===
4880 ==Section 2==
4881 !! endarticle
4882
4883 !! test
4884 Template with sections, __NOTOC__
4885 !! input
4886 __NOTOC__
4887 ==Section 0==
4888 {{sections}}
4889 ==Section 4==
4890 !! result
4891 <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>
4892 <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>
4893 <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>
4894 <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>
4895
4896 !! end
4897
4898 !! test
4899 __NOEDITSECTION__ keyword
4900 !! input
4901 __NOEDITSECTION__
4902 ==Section 1==
4903 ==Section 2==
4904 !! result
4905 <h2> <span class="mw-headline" id="Section_1">Section 1</span></h2>
4906 <h2> <span class="mw-headline" id="Section_2">Section 2</span></h2>
4907
4908 !! end
4909
4910 !! test
4911 Link inside a section heading
4912 !! input
4913 ==Section with a [[Main Page|link]] in it==
4914 !! result
4915 <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>
4916
4917 !! end
4918
4919 !! test
4920 TOC regression (bug 12077)
4921 !! input
4922 __TOC__
4923 == title 1 ==
4924 === title 1.1 ===
4925 == title 2 ==
4926 !! result
4927 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
4928 <ul>
4929 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
4930 <ul>
4931 <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>
4932 </ul>
4933 </li>
4934 <li class="toclevel-1 tocsection-3"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a></li>
4935 </ul>
4936 </td></tr></table>
4937 <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>
4938 <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>
4939 <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>
4940
4941 !! end
4942
4943 !! test
4944 BUG 1219 URL next to image (good)
4945 !! input
4946 http://example.com [[Image:foobar.jpg]]
4947 !! result
4948 <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>
4949 </p>
4950 !!end
4951
4952 !! test
4953 Short headings with trailing space should match behaviour of Parser::doHeadings (bug 19910)
4954 !! input
4955 ===
4956 The line above must have a trailing space!
4957 === <!--
4958 --> <!-- -->
4959 But just in case it doesn't...
4960 !! result
4961 <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>
4962 <p>The line above must have a trailing space!
4963 </p>
4964 <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>
4965 <p>But just in case it doesn't...
4966 </p>
4967 !! end
4968
4969 !! test
4970 Header with special characters (bug 25462)
4971 !! input
4972 The tooltips shall not show entities to the user (ie. be double escaped)
4973
4974 == text > text ==
4975 section 1
4976
4977 == text < text ==
4978 section 2
4979
4980 == text & text ==
4981 section 3
4982
4983 == text ' text ==
4984 section 4
4985
4986 == text " text ==
4987 section 5
4988 !! result
4989 <p>The tooltips shall not show entities to the user (ie. be double escaped)
4990 </p>
4991 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
4992 <ul>
4993 <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>
4994 <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>
4995 <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>
4996 <li class="toclevel-1 tocsection-4"><a href="#text_.27_text"><span class="tocnumber">4</span> <span class="toctext">text ' text</span></a></li>
4997 <li class="toclevel-1 tocsection-5"><a href="#text_.22_text"><span class="tocnumber">5</span> <span class="toctext">text " text</span></a></li>
4998 </ul>
4999 </td></tr></table>
5000 <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>
5001 <p>section 1
5002 </p>
5003 <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>
5004 <p>section 2
5005 </p>
5006 <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>
5007 <p>section 3
5008 </p>
5009 <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>
5010 <p>section 4
5011 </p>
5012 <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>
5013 <p>section 5
5014 </p>
5015 !! end
5016
5017 !! test
5018 BUG 1219 URL next to image (broken)
5019 !! input
5020 http://example.com[[Image:foobar.jpg]]
5021 !! result
5022 <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>
5023 </p>
5024 !!end
5025
5026 !! test
5027 Bug 1186 news: in the middle of text
5028 !! input
5029 http://en.wikinews.org/wiki/Wikinews:Workplace
5030 !! result
5031 <p><a rel="nofollow" class="external free" href="http://en.wikinews.org/wiki/Wikinews:Workplace">http://en.wikinews.org/wiki/Wikinews:Workplace</a>
5032 </p>
5033 !!end
5034
5035
5036 !! test
5037 Namespaced link must have a title
5038 !! input
5039 [[Project:]]
5040 !! result
5041 <p>[[Project:]]
5042 </p>
5043 !!end
5044
5045 !! test
5046 Namespaced link must have a title (bad fragment version)
5047 !! input
5048 [[Project:#fragment]]
5049 !! result
5050 <p>[[Project:#fragment]]
5051 </p>
5052 !!end
5053
5054
5055 !! test
5056 div with no attributes
5057 !! input
5058 <div>HTML rocks</div>
5059 !! result
5060 <div>HTML rocks</div>
5061
5062 !! end
5063
5064 !! test
5065 div with double-quoted attribute
5066 !! input
5067 <div id="rock">HTML rocks</div>
5068 !! result
5069 <div id="rock">HTML rocks</div>
5070
5071 !! end
5072
5073 !! test
5074 div with single-quoted attribute
5075 !! input
5076 <div id='rock'>HTML rocks</div>
5077 !! result
5078 <div id="rock">HTML rocks</div>
5079
5080 !! end
5081
5082 !! test
5083 div with unquoted attribute
5084 !! input
5085 <div id=rock>HTML rocks</div>
5086 !! result
5087 <div id="rock">HTML rocks</div>
5088
5089 !! end
5090
5091 !! test
5092 div with illegal double attributes
5093 !! input
5094 <div align="center" align="right">HTML rocks</div>
5095 !! result
5096 <div align="right">HTML rocks</div>
5097
5098 !!end
5099
5100 !! test
5101 HTML multiple attributes correction
5102 !! input
5103 <p class="error" class="awesome">Awesome!</p>
5104 !! result
5105 <p class="awesome">Awesome!</p>
5106
5107 !!end
5108
5109 !! test
5110 Table multiple attributes correction
5111 !! input
5112 {|
5113 !+ class="error" class="awesome"| status
5114 |}
5115 !! result
5116 <table>
5117 <tr>
5118 <th class="awesome">status
5119 </th>
5120 </tr>
5121 </table>
5122
5123 !!end
5124
5125 !! test
5126 DIV IN UPPERCASE
5127 !! input
5128 <DIV ALIGN="center">HTML ROCKS</DIV>
5129 !! result
5130 <div align="center">HTML ROCKS</div>
5131
5132 !!end
5133
5134
5135 !! test
5136 text with amp in the middle of nowhere
5137 !! input
5138 Remember AT&T?
5139 !!result
5140 <p>Remember AT&amp;T?
5141 </p>
5142 !! end
5143
5144 !! test
5145 text with character entity: eacute
5146 !! input
5147 I always thought &eacute; was a cute letter.
5148 !! result
5149 <p>I always thought &#233; was a cute letter.
5150 </p>
5151 !! end
5152
5153 !! test
5154 text with undefined character entity: xacute
5155 !! input
5156 I always thought &xacute; was a cute letter.
5157 !! result
5158 <p>I always thought &amp;xacute; was a cute letter.
5159 </p>
5160 !! end
5161
5162
5163 ###
5164 ### Media links
5165 ###
5166
5167 !! test
5168 Media link
5169 !! input
5170 [[Media:Foobar.jpg]]
5171 !! result
5172 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Media:Foobar.jpg</a>
5173 </p>
5174 !! end
5175
5176 !! test
5177 Media link with text
5178 !! input
5179 [[Media:Foobar.jpg|A neat file to look at]]
5180 !! result
5181 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">A neat file to look at</a>
5182 </p>
5183 !! end
5184
5185 # FIXME: this is still bad HTML tag nesting
5186 !! test
5187 Media link with nasty text
5188 fixme: doBlockLevels won't wrap this in a paragraph because it contains a div
5189 !! input
5190 [[Media:Foobar.jpg|Safe Link<div style=display:none>" onmouseover="alert(document.cookie)" onfoo="</div>]]
5191 !! result
5192 <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>
5193
5194 !! end
5195
5196 !! test
5197 Media link to nonexistent file (bug 1702)
5198 !! input
5199 [[Media:No such.jpg]]
5200 !! result
5201 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=No_such.jpg" class="new" title="No such.jpg">Media:No such.jpg</a>
5202 </p>
5203 !! end
5204
5205 !! test
5206 Image link to nonexistent file (bug 1850 - good)
5207 !! input
5208 [[Image:No such.jpg]]
5209 !! result
5210 <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>
5211 </p>
5212 !! end
5213
5214 !! test
5215 :Image link to nonexistent file (bug 1850 - bad)
5216 !! input
5217 [[:Image:No such.jpg]]
5218 !! result
5219 <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>
5220 </p>
5221 !! end
5222
5223
5224
5225 !! test
5226 Character reference normalization in link text (bug 1938)
5227 !! input
5228 [[Main Page|this&that]]
5229 !! result
5230 <p><a href="/wiki/Main_Page" title="Main Page">this&amp;that</a>
5231 </p>
5232 !!end
5233
5234 !! article
5235 אַ
5236 !! text
5237 Test for unicode normalization
5238
5239 The page's name is U+05d0 U+05b7, with non-canonical form U+FB2E
5240 !! endarticle
5241
5242 !! test
5243 (bug 19451) Links should refer to the normalized form.
5244 !! input
5245 [[&#xFB2E;]]
5246 [[&#x5d0;&#x5b7;]]
5247 [[&#x5d0;ַ]]
5248 [[א&#x5b7;]]
5249 [[אַ]]
5250 !! result
5251 <p><a href="/wiki/%D7%90%D6%B7" title="אַ">&#xfb2e;</a>
5252 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;&#x5b7;</a>
5253 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;ַ</a>
5254 <a href="/wiki/%D7%90%D6%B7" title="אַ">א&#x5b7;</a>
5255 <a href="/wiki/%D7%90%D6%B7" title="אַ">אַ</a>
5256 </p>
5257 !! end
5258
5259 !! test
5260 Empty attribute crash test (bug 2067)
5261 !! input
5262 <font color="">foo</font>
5263 !! result
5264 <p><font color="">foo</font>
5265 </p>
5266 !! end
5267
5268 !! test
5269 Empty attribute crash test single-quotes (bug 2067)
5270 !! input
5271 <font color=''>foo</font>
5272 !! result
5273 <p><font color="">foo</font>
5274 </p>
5275 !! end
5276
5277 !! test
5278 Attribute test: equals, then nothing
5279 !! input
5280 <font color=>foo</font>
5281 !! result
5282 <p><font>foo</font>
5283 </p>
5284 !! end
5285
5286 !! test
5287 Attribute test: unquoted value
5288 !! input
5289 <font color=x>foo</font>
5290 !! result
5291 <p><font color="x">foo</font>
5292 </p>
5293 !! end
5294
5295 !! test
5296 Attribute test: unquoted but illegal value (hash)
5297 !! input
5298 <font color=#x>foo</font>
5299 !! result
5300 <p><font color="#x">foo</font>
5301 </p>
5302 !! end
5303
5304 !! test
5305 Attribute test: no value
5306 !! input
5307 <font color>foo</font>
5308 !! result
5309 <p><font color="color">foo</font>
5310 </p>
5311 !! end
5312
5313 !! test
5314 Bug 2095: link with three closing brackets
5315 !! input
5316 [[Main Page]]]
5317 !! result
5318 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>]
5319 </p>
5320 !! end
5321
5322 !! test
5323 Bug 2095: link with pipe and three closing brackets
5324 !! input
5325 [[Main Page|link]]]
5326 !! result
5327 <p><a href="/wiki/Main_Page" title="Main Page">link</a>]
5328 </p>
5329 !! end
5330
5331 !! test
5332 Bug 2095: link with pipe and three closing brackets, version 2
5333 !! input
5334 [[Main Page|[http://example.com/]]]
5335 !! result
5336 <p><a href="/wiki/Main_Page" title="Main Page">[http://example.com/]</a>
5337 </p>
5338 !! end
5339
5340
5341 ###
5342 ### Safety
5343 ###
5344
5345 !! article
5346 Template:Dangerous attribute
5347 !! text
5348 " onmouseover="alert(document.cookie)
5349 !! endarticle
5350
5351 !! article
5352 Template:Dangerous style attribute
5353 !! text
5354 border-size: expression(alert(document.cookie))
5355 !! endarticle
5356
5357 !! article
5358 Template:Div style
5359 !! text
5360 <div style="float: right; {{{1}}}">Magic div</div>
5361 !! endarticle
5362
5363 !! test
5364 Bug 2304: HTML attribute safety (safe template; regression bug 2309)
5365 !! input
5366 <div title="{{test}}"></div>
5367 !! result
5368 <div title="This is a test template"></div>
5369
5370 !! end
5371
5372 !! test
5373 Bug 2304: HTML attribute safety (dangerous template; 2309)
5374 !! input
5375 <div title="{{dangerous attribute}}"></div>
5376 !! result
5377 <div title=""></div>
5378
5379 !! end
5380
5381 !! test
5382 Bug 2304: HTML attribute safety (dangerous style template; 2309)
5383 !! input
5384 <div style="{{dangerous style attribute}}"></div>
5385 !! result
5386 <div style="/* insecure input */"></div>
5387
5388 !! end
5389
5390 !! test
5391 Bug 2304: HTML attribute safety (safe parameter; 2309)
5392 !! input
5393 {{div style|width: 200px}}
5394 !! result
5395 <div style="float: right; width: 200px">Magic div</div>
5396
5397 !! end
5398
5399 !! test
5400 Bug 2304: HTML attribute safety (unsafe parameter; 2309)
5401 !! input
5402 {{div style|width: expression(alert(document.cookie))}}
5403 !! result
5404 <div style="/* insecure input */">Magic div</div>
5405
5406 !! end
5407
5408 !! test
5409 Bug 2304: HTML attribute safety (unsafe breakout parameter; 2309)
5410 !! input
5411 {{div style|"><script>alert(document.cookie)</script>}}
5412 !! result
5413 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
5414
5415 !! end
5416
5417 !! test
5418 Bug 2304: HTML attribute safety (unsafe breakout parameter 2; 2309)
5419 !! input
5420 {{div style|" ><script>alert(document.cookie)</script>}}
5421 !! result
5422 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
5423
5424 !! end
5425
5426 !! test
5427 Bug 2304: HTML attribute safety (link)
5428 !! input
5429 <div title="[[Main Page]]"></div>
5430 !! result
5431 <div title="&#91;&#91;Main Page]]"></div>
5432
5433 !! end
5434
5435 !! test
5436 Bug 2304: HTML attribute safety (italics)
5437 !! input
5438 <div title="''foobar''"></div>
5439 !! result
5440 <div title="&#39;&#39;foobar&#39;&#39;"></div>
5441
5442 !! end
5443
5444 !! test
5445 Bug 2304: HTML attribute safety (bold)
5446 !! input
5447 <div title="'''foobar'''"></div>
5448 !! result
5449 <div title="&#39;&#39;&#39;foobar&#39;&#39;&#39;"></div>
5450
5451 !! end
5452
5453
5454 !! test
5455 Bug 2304: HTML attribute safety (ISBN)
5456 !! input
5457 <div title="ISBN 1234567890"></div>
5458 !! result
5459 <div title="&#73;SBN 1234567890"></div>
5460
5461 !! end
5462
5463 !! test
5464 Bug 2304: HTML attribute safety (RFC)
5465 !! input
5466 <div title="RFC 1234"></div>
5467 !! result
5468 <div title="&#82;FC 1234"></div>
5469
5470 !! end
5471
5472 !! test
5473 Bug 2304: HTML attribute safety (PMID)
5474 !! input
5475 <div title="PMID 1234567890"></div>
5476 !! result
5477 <div title="&#80;MID 1234567890"></div>
5478
5479 !! end
5480
5481 !! test
5482 Bug 2304: HTML attribute safety (web link)
5483 !! input
5484 <div title="http://example.com/"></div>
5485 !! result
5486 <div title="http&#58;//example.com/"></div>
5487
5488 !! end
5489
5490 !! test
5491 Bug 2304: HTML attribute safety (named web link)
5492 !! input
5493 <div title="[http://example.com/ link]"></div>
5494 !! result
5495 <div title="&#91;http&#58;//example.com/ link]"></div>
5496
5497 !! end
5498
5499 !! test
5500 Bug 3244: HTML attribute safety (extension; safe)
5501 !! input
5502 <div style="<nowiki>background:blue</nowiki>"></div>
5503 !! result
5504 <div style="background:blue"></div>
5505
5506 !! end
5507
5508 !! test
5509 Bug 3244: HTML attribute safety (extension; unsafe)
5510 !! input
5511 <div style="<nowiki>border-left:expression(alert(document.cookie))</nowiki>"></div>
5512 !! result
5513 <div style="/* insecure input */"></div>
5514
5515 !! end
5516
5517 # More MSIE fun discovered by Tom Gilder
5518
5519 !! test
5520 MSIE CSS safety test: spurious slash
5521 !! input
5522 <div style="background-image:u\rl(javascript:alert('boo'))">evil</div>
5523 !! result
5524 <div style="/* insecure input */">evil</div>
5525
5526 !! end
5527
5528 !! test
5529 MSIE CSS safety test: hex code
5530 !! input
5531 <div style="background-image:u\72l(javascript:alert('boo'))">evil</div>
5532 !! result
5533 <div style="/* insecure input */">evil</div>
5534
5535 !! end
5536
5537 !! test
5538 MSIE CSS safety test: comment in url
5539 !! input
5540 <div style="background-image:u/**/rl(javascript:alert('boo'))">evil</div>
5541 !! result
5542 <div style="background-image:u rl(javascript:alert(&#39;boo&#39;))">evil</div>
5543
5544 !! end
5545
5546 !! test
5547 MSIE CSS safety test: comment in expression
5548 !! input
5549 <div style="background-image:expres/**/sion(alert('boo4'))">evil4</div>
5550 !! result
5551 <div style="background-image:expres sion(alert(&#39;boo4&#39;))">evil4</div>
5552
5553 !! end
5554
5555
5556 !! test
5557 Table attribute legitimate extension
5558 !! input
5559 {|
5560 !+ style="<nowiki>color:blue</nowiki>"| status
5561 |}
5562 !! result
5563 <table>
5564 <tr>
5565 <th style="color:blue">status
5566 </th>
5567 </tr>
5568 </table>
5569
5570 !!end
5571
5572 !! test
5573 Table attribute safety
5574 !! input
5575 {|
5576 !+ style="<nowiki>border-width:expression(0+alert(document.cookie))</nowiki>"| status
5577 |}
5578 !! result
5579 <table>
5580 <tr>
5581 <th style="/* insecure input */">status
5582 </th>
5583 </tr>
5584 </table>
5585
5586 !! end
5587
5588 !! test
5589 CSS line continuation 1
5590 !! input
5591 <div style="background-image: u\&#10;rl(test.jpg);"></div>
5592 !! result
5593 <div style="/* insecure input */"></div>
5594
5595 !! end
5596
5597 !! test
5598 CSS line continuation 2
5599 !! input
5600 <div style="background-image: u\&#13;rl(test.jpg); "></div>
5601 !! result
5602 <div style="/* insecure input */"></div>
5603
5604 !! end
5605
5606 !! article
5607 Template:Identity
5608 !! text
5609 {{{1}}}
5610 !! endarticle
5611
5612 !! test
5613 Expansion of multi-line templates in attribute values (bug 6255)
5614 !! input
5615 <div style="background: {{identity|#00FF00}}">-</div>
5616 !! result
5617 <div style="background: #00FF00">-</div>
5618
5619 !! end
5620
5621
5622 !! test
5623 Expansion of multi-line templates in attribute values (bug 6255 sanity check)
5624 !! input
5625 <div style="background:
5626 #00FF00">-</div>
5627 !! result
5628 <div style="background: #00FF00">-</div>
5629
5630 !! end
5631
5632 !! test
5633 Expansion of multi-line templates in attribute values (bug 6255 sanity check 2)
5634 !! input
5635 <div style="background: &#10;#00FF00">-</div>
5636 !! result
5637 <div style="background: &#10;#00FF00">-</div>
5638
5639 !! end
5640
5641 ###
5642 ### Parser hooks (see maintenance/parserTestsParserHook.php for the <tag> extension)
5643 ###
5644 !! test
5645 Parser hook: empty input
5646 !! input
5647 <tag></tag>
5648 !! result
5649 <pre>
5650 string(0) ""
5651 array(0) {
5652 }
5653 </pre>
5654
5655 !! end
5656
5657 !! test
5658 Parser hook: empty input using terminated empty elements
5659 !! input
5660 <tag/>
5661 !! result
5662 <pre>
5663 NULL
5664 array(0) {
5665 }
5666 </pre>
5667
5668 !! end
5669
5670 !! test
5671 Parser hook: empty input using terminated empty elements (space before)
5672 !! input
5673 <tag />
5674 !! result
5675 <pre>
5676 NULL
5677 array(0) {
5678 }
5679 </pre>
5680
5681 !! end
5682
5683 !! test
5684 Parser hook: basic input
5685 !! input
5686 <tag>input</tag>
5687 !! result
5688 <pre>
5689 string(5) "input"
5690 array(0) {
5691 }
5692 </pre>
5693
5694 !! end
5695
5696
5697 !! test
5698 Parser hook: case insensitive
5699 !! input
5700 <TAG>input</TAG>
5701 !! result
5702 <pre>
5703 string(5) "input"
5704 array(0) {
5705 }
5706 </pre>
5707
5708 !! end
5709
5710
5711 !! test
5712 Parser hook: case insensitive, redux
5713 !! input
5714 <TaG>input</TAg>
5715 !! result
5716 <pre>
5717 string(5) "input"
5718 array(0) {
5719 }
5720 </pre>
5721
5722 !! end
5723
5724 !! test
5725 Parser hook: nested tags
5726 !! options
5727 noxml
5728 !! input
5729 <tag><tag></tag></tag>
5730 !! result
5731 <pre>
5732 string(5) "<tag>"
5733 array(0) {
5734 }
5735 </pre>&lt;/tag&gt;
5736
5737 !! end
5738
5739 !! test
5740 Parser hook: basic arguments
5741 !! input
5742 <tag width=200 height = "100" depth = '50' square></tag>
5743 !! result
5744 <pre>
5745 string(0) ""
5746 array(4) {
5747 ["width"]=>
5748 string(3) "200"
5749 ["height"]=>
5750 string(3) "100"
5751 ["depth"]=>
5752 string(2) "50"
5753 ["square"]=>
5754 string(6) "square"
5755 }
5756 </pre>
5757
5758 !! end
5759
5760 !! test
5761 Parser hook: argument containing a forward slash (bug 5344)
5762 !! input
5763 <tag filename='/tmp/bla'></tag>
5764 !! result
5765 <pre>
5766 string(0) ""
5767 array(1) {
5768 ["filename"]=>
5769 string(8) "/tmp/bla"
5770 }
5771 </pre>
5772
5773 !! end
5774
5775 !! test
5776 Parser hook: empty input using terminated empty elements (bug 2374)
5777 !! input
5778 <tag foo=bar/>text
5779 !! result
5780 <pre>
5781 NULL
5782 array(1) {
5783 ["foo"]=>
5784 string(3) "bar"
5785 }
5786 </pre>text
5787
5788 !! end
5789
5790 # </tag> should be output literally since there is no matching tag that begins it
5791 !! test
5792 Parser hook: basic arguments using terminated empty elements (bug 2374)
5793 !! input
5794 <tag width=200 height = "100" depth = '50' square/>
5795 other stuff
5796 </tag>
5797 !! result
5798 <pre>
5799 NULL
5800 array(4) {
5801 ["width"]=>
5802 string(3) "200"
5803 ["height"]=>
5804 string(3) "100"
5805 ["depth"]=>
5806 string(2) "50"
5807 ["square"]=>
5808 string(6) "square"
5809 }
5810 </pre>
5811 <p>other stuff
5812 &lt;/tag&gt;
5813 </p>
5814 !! end
5815
5816 ###
5817 ### (see maintenance/parserTestsStaticParserHook.php for the <statictag> extension)
5818 ###
5819
5820 !! test
5821 Parser hook: static parser hook not inside a comment
5822 !! input
5823 <statictag>hello, world</statictag>
5824 <statictag action=flush/>
5825 !! result
5826 <p>hello, world
5827 </p>
5828 !! end
5829
5830
5831 !! test
5832 Parser hook: static parser hook inside a comment
5833 !! input
5834 <!-- <statictag>hello, world</statictag> -->
5835 <statictag action=flush/>
5836 !! result
5837 <p><br />
5838 </p>
5839 !! end
5840
5841 # Nested template calls; this case was broken by Parser.php rev 1.506,
5842 # since reverted.
5843
5844 !! article
5845 Template:One-parameter
5846 !! text
5847 (My parameter is: {{{1}}})
5848 !! endarticle
5849
5850 !! article
5851 Template:Map-one-parameter
5852 !! text
5853 {{{{{1}}}|{{{2}}}}}
5854 !! endarticle
5855
5856 !! test
5857 Nested template calls
5858 !! input
5859 {{Map-one-parameter|One-parameter|param}}
5860 !! result
5861 <p>(My parameter is: param)
5862 </p>
5863 !! end
5864
5865
5866 ###
5867 ### Sanitizer
5868 ###
5869 !! test
5870 Sanitizer: Closing of open tags
5871 !! input
5872 <s></s><table></table>
5873 !! result
5874 <s></s><table></table>
5875
5876 !! end
5877
5878 !! test
5879 Sanitizer: Closing of open but not closed tags
5880 !! input
5881 <s>foo
5882 !! result
5883 <p><s>foo</s>
5884 </p>
5885 !! end
5886
5887 !! test
5888 Sanitizer: Closing of closed but not open tags
5889 !! input
5890 </s>
5891 !! result
5892 <p>&lt;/s&gt;
5893 </p>
5894 !! end
5895
5896 !! test
5897 Sanitizer: Closing of closed but not open table tags
5898 !! input
5899 Table not started</td></tr></table>
5900 !! result
5901 <p>Table not started&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
5902 </p>
5903 !! end
5904
5905 !! test
5906 Sanitizer: Escaping of spaces, multibyte characters, colons & other stuff in id=""
5907 !! input
5908 <span id="æ: v">byte</span>[[#æ: v|backlink]]
5909 !! result
5910 <p><span id=".C3.A6:_v">byte</span><a href="#.C3.A6:_v">backlink</a>
5911 </p>
5912 !! end
5913
5914 !! test
5915 Sanitizer: Validating the contents of the id attribute (bug 4515)
5916 !! options
5917 disabled
5918 !! input
5919 <br id=9 />
5920 !! result
5921 Something, but definitely not <br id="9" />...
5922 !! end
5923
5924 !! test
5925 Sanitizer: Validating id attribute uniqueness (bug 4515, bug 6301)
5926 !! options
5927 disabled
5928 !! input
5929 <br id="foo" /><br id="foo" />
5930 !! result
5931 Something need to be done. foo-2 ?
5932 !! end
5933
5934 !! test
5935 Language converter: output gets cut off unexpectedly (bug 5757)
5936 !! options
5937 language=zh
5938 !! input
5939 this bit is safe: }-
5940
5941 but if we add a conversion instance: -{zh-cn:xxx;zh-tw:yyy}-
5942
5943 then we get cut off here: }-
5944
5945 all additional text is vanished
5946 !! result
5947 <p>this bit is safe: }-
5948 </p><p>but if we add a conversion instance: xxx
5949 </p><p>then we get cut off here: }-
5950 </p><p>all additional text is vanished
5951 </p>
5952 !! end
5953
5954 !! test
5955 Self closed html pairs (bug 5487)
5956 !! options
5957 !! input
5958 <center><font id="bug" />Centered text</center>
5959 <div><font id="bug2" />In div text</div>
5960 !! result
5961 <center>&lt;font id="bug" /&gt;Centered text</center>
5962 <div>&lt;font id="bug2" /&gt;In div text</div>
5963
5964 !! end
5965
5966 #
5967 #
5968 #
5969
5970 !! test
5971 Punctuation: nbsp before exclamation
5972 !! input
5973 C'est grave !
5974 !! result
5975 <p>C'est grave&#160;!
5976 </p>
5977 !! end
5978
5979 !! test
5980 Punctuation: CSS !important (bug 11874)
5981 !! input
5982 <div style="width:50% !important">important</div>
5983 !! result
5984 <div style="width:50% !important">important</div>
5985
5986 !!end
5987
5988 !! test
5989 Punctuation: CSS ! important (bug 11874; with space after)
5990 !! input
5991 <div style="width:50% ! important">important</div>
5992 !! result
5993 <div style="width:50% ! important">important</div>
5994
5995 !!end
5996
5997
5998 !! test
5999 HTML bullet list, closed tags (bug 5497)
6000 !! input
6001 <ul>
6002 <li>One</li>
6003 <li>Two</li>
6004 </ul>
6005 !! result
6006 <ul>
6007 <li>One</li>
6008 <li>Two</li>
6009 </ul>
6010
6011 !! end
6012
6013 !! test
6014 HTML bullet list, unclosed tags (bug 5497)
6015 !! options
6016 disabled
6017 !! input
6018 <ul>
6019 <li>One
6020 <li>Two
6021 </ul>
6022 !! result
6023 <ul>
6024 <li>One
6025 </li><li>Two
6026 </li></ul>
6027
6028 !! end
6029
6030 !! test
6031 HTML ordered list, closed tags (bug 5497)
6032 !! input
6033 <ol>
6034 <li>One</li>
6035 <li>Two</li>
6036 </ol>
6037 !! result
6038 <ol>
6039 <li>One</li>
6040 <li>Two</li>
6041 </ol>
6042
6043 !! end
6044
6045 !! test
6046 HTML ordered list, unclosed tags (bug 5497)
6047 !! options
6048 disabled
6049 !! input
6050 <ol>
6051 <li>One
6052 <li>Two
6053 </ol>
6054 !! result
6055 <ol>
6056 <li>One
6057 </li><li>Two
6058 </li></ol>
6059
6060 !! end
6061
6062 !! test
6063 HTML nested bullet list, closed tags (bug 5497)
6064 !! input
6065 <ul>
6066 <li>One</li>
6067 <li>Two:
6068 <ul>
6069 <li>Sub-one</li>
6070 <li>Sub-two</li>
6071 </ul>
6072 </li>
6073 </ul>
6074 !! result
6075 <ul>
6076 <li>One</li>
6077 <li>Two:
6078 <ul>
6079 <li>Sub-one</li>
6080 <li>Sub-two</li>
6081 </ul>
6082 </li>
6083 </ul>
6084
6085 !! end
6086
6087 !! test
6088 HTML nested bullet list, open tags (bug 5497)
6089 !! options
6090 disabled
6091 !! input
6092 <ul>
6093 <li>One
6094 <li>Two:
6095 <ul>
6096 <li>Sub-one
6097 <li>Sub-two
6098 </ul>
6099 </ul>
6100 !! result
6101 <ul>
6102 <li>One
6103 </li><li>Two:
6104 <ul>
6105 <li>Sub-one
6106 </li><li>Sub-two
6107 </li></ul>
6108 </li></ul>
6109
6110 !! end
6111
6112 !! test
6113 HTML nested ordered list, closed tags (bug 5497)
6114 !! input
6115 <ol>
6116 <li>One</li>
6117 <li>Two:
6118 <ol>
6119 <li>Sub-one</li>
6120 <li>Sub-two</li>
6121 </ol>
6122 </li>
6123 </ol>
6124 !! result
6125 <ol>
6126 <li>One</li>
6127 <li>Two:
6128 <ol>
6129 <li>Sub-one</li>
6130 <li>Sub-two</li>
6131 </ol>
6132 </li>
6133 </ol>
6134
6135 !! end
6136
6137 !! test
6138 HTML nested ordered list, open tags (bug 5497)
6139 !! options
6140 disabled
6141 !! input
6142 <ol>
6143 <li>One
6144 <li>Two:
6145 <ol>
6146 <li>Sub-one
6147 <li>Sub-two
6148 </ol>
6149 </ol>
6150 !! result
6151 <ol>
6152 <li>One
6153 </li><li>Two:
6154 <ol>
6155 <li>Sub-one
6156 </li><li>Sub-two
6157 </li></ol>
6158 </li></ol>
6159
6160 !! end
6161
6162 !! test
6163 HTML ordered list item with parameters oddity
6164 !! input
6165 <ol><li id="fragment">One</li></ol>
6166 !! result
6167 <ol><li id="fragment">One</li></ol>
6168
6169 !! end
6170
6171 !!test
6172 bug 5918: autonumbering
6173 !! input
6174 [http://first/] [http://second] [ftp://ftp]
6175
6176 ftp://inlineftp
6177
6178 [mailto:enclosed@mail.tld With target]
6179
6180 [mailto:enclosed@mail.tld]
6181
6182 mailto:inline@mail.tld
6183 !! result
6184 <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>
6185 </p><p><a rel="nofollow" class="external free" href="ftp://inlineftp">ftp://inlineftp</a>
6186 </p><p><a rel="nofollow" class="external text" href="mailto:enclosed@mail.tld">With target</a>
6187 </p><p><a rel="nofollow" class="external autonumber" href="mailto:enclosed@mail.tld">[4]</a>
6188 </p><p><a rel="nofollow" class="external free" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a>
6189 </p>
6190 !! end
6191
6192
6193 #
6194 # Security and HTML correctness
6195 # From Nick Jenkins' fuzz testing
6196 #
6197
6198 !! test
6199 Fuzz testing: Parser13
6200 !! input
6201 {|
6202 | http://a|
6203 !! result
6204 <table>
6205 <tr>
6206 <td></td>
6207 </tr>
6208 </table>
6209
6210 !! end
6211
6212 !! test
6213 Fuzz testing: Parser14
6214 !! input
6215 == onmouseover= ==
6216 http://__TOC__
6217 !! result
6218 <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>
6219 http://<table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
6220 <ul>
6221 <li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
6222 </ul>
6223 </td></tr></table>
6224
6225 !! end
6226
6227 !! test
6228 Fuzz testing: Parser14-table
6229 !! input
6230 ==a==
6231 {| STYLE=__TOC__
6232 |foo
6233 !! result
6234 <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>
6235 <table style="&#95;_TOC&#95;_">
6236 <tr>
6237 <td>foo
6238 </td>
6239 </tr>
6240 </table>
6241
6242 !! end
6243
6244 # Known to produce bogus xml (extra </td>)
6245 !! test
6246 Fuzz testing: Parser16
6247 !! options
6248 noxml
6249 !! input
6250 {|
6251 !https://||||||
6252 !! result
6253 <table>
6254 <tr>
6255 <th>https://
6256 </th>
6257 <th></th>
6258 <th></th>
6259 <th></th>
6260 </tr>
6261 </table>
6262
6263 !! end
6264
6265 !! test
6266 Fuzz testing: Parser21
6267 !! input
6268 {|
6269 ! irc://{{ftp://a" onmouseover="alert('hello world');"
6270 |
6271 !! result
6272 <table>
6273 <tr>
6274 <th><a rel="nofollow" class="external free" href="irc://{{ftp://a">irc://{{ftp://a</a>" onmouseover="alert('hello world');"
6275 </th>
6276 <td></td>
6277 </tr>
6278 </table>
6279
6280 !! end
6281
6282 !! test
6283 Fuzz testing: Parser22
6284 !! input
6285 http://===r:::https://b
6286
6287 {|
6288
6289 !!result
6290 <p><a rel="nofollow" class="external free" href="http://===r:::https://b">http://===r:::https://b</a>
6291 </p><p><br />
6292 </p>
6293 !! end
6294
6295 # Known to produce bad XML for now
6296
6297 # Note: the current result listed for this is not what the original one was,
6298 # but the original bug was JavaScript injection, which is fixed in any case.
6299 # It's not clear that the original result listed was any more correct than the
6300 # current one. Original result:
6301 # <table>
6302 # {{{|
6303 # <u class="&#124;">}}}} &gt;
6304 # <br style="onmouseover=&#39;alert(document.cookie);&#39;" />
6305 #
6306 # MOVE YOUR MOUSE CURSOR OVER THIS TEXT
6307 # <tr>
6308 # <td></u>
6309 # </td>
6310 # </tr>
6311 # </table>
6312 # Known to produce bad XML for now
6313 !! test
6314 Fuzz testing: Parser24
6315 !! options
6316 noxml
6317 !! input
6318 {|
6319 {{{|
6320 <u CLASS=
6321 | {{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx--><noinclude>}}}} >
6322 <br style="onmouseover='alert(document.cookie);' " />
6323
6324 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
6325 |
6326 !! result
6327 <p>{{{|
6328 <u class="&#124;">}}}} &gt;
6329 <br style="onmouseover=&#39;alert(document.cookie);&#39;" />
6330 </p><p>MOVE YOUR MOUSE CURSOR OVER THIS TEXT
6331 </p>
6332 <table>
6333 <tr>
6334 <td></u>
6335 </td>
6336 </tr>
6337 </table>
6338
6339 !! end
6340
6341 # Note: the current result listed for this is not what the original one was,
6342 # but the original bug was JavaScript injection, which is fixed in any case.
6343 # It's not clear that the original result listed was any more correct than the
6344 # current one. Original result:
6345 # <p>{{{|
6346 # </p>
6347 # <li class="&#124;&#124;">
6348 # }}}blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
6349 !!test
6350 Fuzz testing: Parser25 (bug 6055)
6351 !! input
6352 {{{
6353 |
6354 <LI CLASS=||
6355 >
6356 }}}blah" onmouseover="alert('hello world');" align="left"'''MOVE MOUSE CURSOR OVER HERE
6357 !! result
6358 <p>&lt;LI CLASS=blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
6359 </p>
6360 !! end
6361
6362 !!test
6363 Fuzz testing: URL adjacent extension (with space, clean)
6364 !! options
6365 !! input
6366 http://example.com <nowiki>junk</nowiki>
6367 !! result
6368 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a> junk
6369 </p>
6370 !!end
6371
6372 !!test
6373 Fuzz testing: URL adjacent extension (no space, dirty; nowiki)
6374 !! options
6375 !! input
6376 http://example.com<nowiki>junk</nowiki>
6377 !! result
6378 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>junk
6379 </p>
6380 !!end
6381
6382 !!test
6383 Fuzz testing: URL adjacent extension (no space, dirty; pre)
6384 !! options
6385 !! input
6386 http://example.com<pre>junk</pre>
6387 !! result
6388 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a><pre>junk</pre>
6389
6390 !!end
6391
6392 !!test
6393 Fuzz testing: image with bogus manual thumbnail
6394 !!input
6395 [[Image:foobar.jpg|thumbnail= ]]
6396 !!result
6397 <div class="thumb tright"><div class="thumbinner" style="width:1943px;">Error creating thumbnail: <div class="thumbcaption"></div></div></div>
6398
6399 !!end
6400
6401 !! test
6402 Fuzz testing: encoded newline in generated HTML replacements (bug 6577)
6403 !! input
6404 <pre dir="&#10;"></pre>
6405 !! result
6406 <pre dir="&#10;"></pre>
6407
6408 !! end
6409
6410 !! test
6411 Parsing optional HTML elements (Bug 6171)
6412 !! options
6413 !! input
6414 <table>
6415 <tr>
6416 <td> Some tabular data</td>
6417 <td> More tabular data ...
6418 <td> And yet som tabular data</td>
6419 </tr>
6420 </table>
6421 !! result
6422 <table>
6423 <tr>
6424 <td> Some tabular data</td>
6425 <td> More tabular data ...
6426 </td><td> And yet som tabular data</td>
6427 </tr>
6428 </table>
6429
6430 !! end
6431
6432 !! test
6433 Correct handling of <td>, <tr> (Bug 6171)
6434 !! options
6435 !! input
6436 <table>
6437 <tr>
6438 <td> Some tabular data</td>
6439 <td> More tabular data ...</td>
6440 <td> And yet som tabular data</td>
6441 </tr>
6442 </table>
6443 !! result
6444 <table>
6445 <tr>
6446 <td> Some tabular data</td>
6447 <td> More tabular data ...</td>
6448 <td> And yet som tabular data</td>
6449 </tr>
6450 </table>
6451
6452 !! end
6453
6454
6455 !! test
6456 Parsing crashing regression (fr:JavaScript)
6457 !! input
6458 </body></x>
6459 !! result
6460 <p>&lt;/body&gt;&lt;/x&gt;
6461 </p>
6462 !! end
6463
6464 !! test
6465 Inline wiki vs wiki block nesting
6466 !! input
6467 '''Bold paragraph
6468
6469 New wiki paragraph
6470 !! result
6471 <p><b>Bold paragraph</b>
6472 </p><p>New wiki paragraph
6473 </p>
6474 !! end
6475
6476 !! test
6477 Inline HTML vs wiki block nesting
6478 !! options
6479 disabled
6480 !! input
6481 <b>Bold paragraph
6482
6483 New wiki paragraph
6484 !! result
6485 <p><b>Bold paragraph</b>
6486 </p><p>New wiki paragraph
6487 </p>
6488 !! end
6489
6490 # Original result was this:
6491 # <p><b>bold</b><b>bold<i>bolditalics</i></b>
6492 # </p>
6493 # While that might be marginally more intuitive, maybe, the six-apostrophe
6494 # construct is clearly pathological and the result stated here (which is what
6495 # the parser actually does) is about as reasonable as anything.
6496 !!test
6497 Mixing markup for italics and bold
6498 !! options
6499 !! input
6500 '''bold''''''bold''bolditalics'''''
6501 !! result
6502 <p>'<i>bold'</i><b>bold<i>bolditalics</i></b>
6503 </p>
6504 !! end
6505
6506
6507 !! article
6508 Xyzzyx
6509 !! text
6510 Article for special page transclusion test
6511 !! endarticle
6512
6513 !! test
6514 Special page transclusion
6515 !! options
6516 !! input
6517 {{Special:Prefixindex/Xyzzyx}}
6518 !! result
6519 <p><br />
6520 </p>
6521 <table border="0" id="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
6522
6523 !! end
6524
6525 !! test
6526 Special page transclusion twice (bug 5021)
6527 !! options
6528 !! input
6529 {{Special:Prefixindex/Xyzzyx}}
6530 {{Special:Prefixindex/Xyzzyx}}
6531 !! result
6532 <p><br />
6533 </p>
6534 <table border="0" id="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
6535 <p><br />
6536 </p>
6537 <table border="0" id="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
6538
6539 !! end
6540
6541 !! test
6542 Transclusion of default MediaWiki message
6543 !! input
6544 {{MediaWiki:Mainpage}}
6545 !!result
6546 <p>Main Page
6547 </p>
6548 !! end
6549
6550 !! test
6551 Transclusion of nonexistent MediaWiki message
6552 !! input
6553 {{MediaWiki:Mainpagexxx}}
6554 !!result
6555 <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>
6556 </p>
6557 !! end
6558
6559 !! test
6560 Transclusion of MediaWiki message with underscore
6561 !! input
6562 {{MediaWiki:history_short}}
6563 !! result
6564 <p>History
6565 </p>
6566 !! end
6567
6568 !! test
6569 Transclusion of MediaWiki message with space
6570 !! input
6571 {{MediaWiki:history short}}
6572 !! result
6573 <p>History
6574 </p>
6575 !! end
6576
6577 !! test
6578 Invalid header with following text
6579 !! input
6580 = x = y
6581 !! result
6582 <p>= x = y
6583 </p>
6584 !! end
6585
6586
6587 !! test
6588 Section extraction test (section 0)
6589 !! options
6590 section=0
6591 !! input
6592 start
6593 ==a==
6594 ===aa===
6595 ====aaa====
6596 ==b==
6597 ===ba===
6598 ===bb===
6599 ====bba====
6600 ===bc===
6601 ==c==
6602 ===ca===
6603 !! result
6604 start
6605 !! end
6606
6607 !! test
6608 Section extraction test (section 1)
6609 !! options
6610 section=1
6611 !! input
6612 start
6613 ==a==
6614 ===aa===
6615 ====aaa====
6616 ==b==
6617 ===ba===
6618 ===bb===
6619 ====bba====
6620 ===bc===
6621 ==c==
6622 ===ca===
6623 !! result
6624 ==a==
6625 ===aa===
6626 ====aaa====
6627 !! end
6628
6629 !! test
6630 Section extraction test (section 2)
6631 !! options
6632 section=2
6633 !! input
6634 start
6635 ==a==
6636 ===aa===
6637 ====aaa====
6638 ==b==
6639 ===ba===
6640 ===bb===
6641 ====bba====
6642 ===bc===
6643 ==c==
6644 ===ca===
6645 !! result
6646 ===aa===
6647 ====aaa====
6648 !! end
6649
6650 !! test
6651 Section extraction test (section 3)
6652 !! options
6653 section=3
6654 !! input
6655 start
6656 ==a==
6657 ===aa===
6658 ====aaa====
6659 ==b==
6660 ===ba===
6661 ===bb===
6662 ====bba====
6663 ===bc===
6664 ==c==
6665 ===ca===
6666 !! result
6667 ====aaa====
6668 !! end
6669
6670 !! test
6671 Section extraction test (section 4)
6672 !! options
6673 section=4
6674 !! input
6675 start
6676 ==a==
6677 ===aa===
6678 ====aaa====
6679 ==b==
6680 ===ba===
6681 ===bb===
6682 ====bba====
6683 ===bc===
6684 ==c==
6685 ===ca===
6686 !! result
6687 ==b==
6688 ===ba===
6689 ===bb===
6690 ====bba====
6691 ===bc===
6692 !! end
6693
6694 !! test
6695 Section extraction test (section 5)
6696 !! options
6697 section=5
6698 !! input
6699 start
6700 ==a==
6701 ===aa===
6702 ====aaa====
6703 ==b==
6704 ===ba===
6705 ===bb===
6706 ====bba====
6707 ===bc===
6708 ==c==
6709 ===ca===
6710 !! result
6711 ===ba===
6712 !! end
6713
6714 !! test
6715 Section extraction test (section 6)
6716 !! options
6717 section=6
6718 !! input
6719 start
6720 ==a==
6721 ===aa===
6722 ====aaa====
6723 ==b==
6724 ===ba===
6725 ===bb===
6726 ====bba====
6727 ===bc===
6728 ==c==
6729 ===ca===
6730 !! result
6731 ===bb===
6732 ====bba====
6733 !! end
6734
6735 !! test
6736 Section extraction test (section 7)
6737 !! options
6738 section=7
6739 !! input
6740 start
6741 ==a==
6742 ===aa===
6743 ====aaa====
6744 ==b==
6745 ===ba===
6746 ===bb===
6747 ====bba====
6748 ===bc===
6749 ==c==
6750 ===ca===
6751 !! result
6752 ====bba====
6753 !! end
6754
6755 !! test
6756 Section extraction test (section 8)
6757 !! options
6758 section=8
6759 !! input
6760 start
6761 ==a==
6762 ===aa===
6763 ====aaa====
6764 ==b==
6765 ===ba===
6766 ===bb===
6767 ====bba====
6768 ===bc===
6769 ==c==
6770 ===ca===
6771 !! result
6772 ===bc===
6773 !! end
6774
6775 !! test
6776 Section extraction test (section 9)
6777 !! options
6778 section=9
6779 !! input
6780 start
6781 ==a==
6782 ===aa===
6783 ====aaa====
6784 ==b==
6785 ===ba===
6786 ===bb===
6787 ====bba====
6788 ===bc===
6789 ==c==
6790 ===ca===
6791 !! result
6792 ==c==
6793 ===ca===
6794 !! end
6795
6796 !! test
6797 Section extraction test (section 10)
6798 !! options
6799 section=10
6800 !! input
6801 start
6802 ==a==
6803 ===aa===
6804 ====aaa====
6805 ==b==
6806 ===ba===
6807 ===bb===
6808 ====bba====
6809 ===bc===
6810 ==c==
6811 ===ca===
6812 !! result
6813 ===ca===
6814 !! end
6815
6816 !! test
6817 Section extraction test (nonexistent section 11)
6818 !! options
6819 section=11
6820 !! input
6821 start
6822 ==a==
6823 ===aa===
6824 ====aaa====
6825 ==b==
6826 ===ba===
6827 ===bb===
6828 ====bba====
6829 ===bc===
6830 ==c==
6831 ===ca===
6832 !! result
6833 !! end
6834
6835 !! test
6836 Section extraction test with bogus heading (section 1)
6837 !! options
6838 section=1
6839 !! input
6840 ==a==
6841 ==bogus== not a legal section
6842 ==b==
6843 !! result
6844 ==a==
6845 ==bogus== not a legal section
6846 !! end
6847
6848 !! test
6849 Section extraction test with bogus heading (section 2)
6850 !! options
6851 section=2
6852 !! input
6853 ==a==
6854 ==bogus== not a legal section
6855 ==b==
6856 !! result
6857 ==b==
6858 !! end
6859
6860 !! test
6861 Section extraction test with comment after heading (section 1)
6862 !! options
6863 section=1
6864 !! input
6865 ==a==
6866 ==b== <!-- -->
6867 ==c==
6868 !! result
6869 ==a==
6870 !! end
6871
6872 !! test
6873 Section extraction test with comment after heading (section 2)
6874 !! options
6875 section=2
6876 !! input
6877 ==a==
6878 ==b== <!-- -->
6879 ==c==
6880 !! result
6881 ==b== <!-- -->
6882 !! end
6883
6884 !! test
6885 Section extraction test with bogus <nowiki> heading (section 1)
6886 !! options
6887 section=1
6888 !! input
6889 ==a==
6890 ==bogus== <nowiki>not a legal section</nowiki>
6891 ==b==
6892 !! result
6893 ==a==
6894 ==bogus== <nowiki>not a legal section</nowiki>
6895 !! end
6896
6897 !! test
6898 Section extraction test with bogus <nowiki> heading (section 2)
6899 !! options
6900 section=2
6901 !! input
6902 ==a==
6903 ==bogus== <nowiki>not a legal section</nowiki>
6904 ==b==
6905 !! result
6906 ==b==
6907 !! end
6908
6909
6910 # Formerly testing for bug 2587, now resolved by the use of unmarked sections
6911 # instead of respecting commented sections
6912 !! test
6913 Section extraction prefixed by comment (section 1)
6914 !! options
6915 section=1
6916 !! input
6917 <!-- -->==sec1==
6918 ==sec2==
6919 !!result
6920 ==sec2==
6921 !!end
6922
6923 !! test
6924 Section extraction prefixed by comment (section 2)
6925 !! options
6926 section=2
6927 !! input
6928 <!-- -->==sec1==
6929 ==sec2==
6930 !!result
6931
6932 !!end
6933
6934
6935 # Formerly testing for bug 2607, now resolved by the use of unmarked sections
6936 # instead of respecting HTML-style headings
6937 !! test
6938 Section extraction, mixed wiki and html (section 1)
6939 !! options
6940 section=1
6941 !! input
6942 <h2>unmarked</h2>
6943 unmarked
6944 ==1==
6945 one
6946 ==2==
6947 two
6948 !! result
6949 ==1==
6950 one
6951 !! end
6952
6953 !! test
6954 Section extraction, mixed wiki and html (section 2)
6955 !! options
6956 section=2
6957 !! input
6958 <h2>unmarked</h2>
6959 unmarked
6960 ==1==
6961 one
6962 ==2==
6963 two
6964 !! result
6965 ==2==
6966 two
6967 !! end
6968
6969
6970 # Formerly testing for bug 3342
6971 !! test
6972 Section extraction, heading surrounded by <noinclude>
6973 !! options
6974 section=1
6975 !! input
6976 <noinclude>==unmarked==</noinclude>
6977 ==marked==
6978 !! result
6979 ==marked==
6980 !!end
6981
6982 # Test behaviour of bug 19910
6983 !! test
6984 Sectiion with all-equals
6985 !! options
6986 section=2
6987 !! input
6988 ===
6989 The line above must have a trailing space
6990 === <!--
6991 --> <!-- -->
6992 But just in case it doesn't...
6993 !! result
6994 === <!--
6995 --> <!-- -->
6996 But just in case it doesn't...
6997 !! end
6998
6999 !! test
7000 Section replacement test (section 0)
7001 !! options
7002 replace=0,"xxx"
7003 !! input
7004 start
7005 ==a==
7006 ===aa===
7007 ====aaa====
7008 ==b==
7009 ===ba===
7010 ===bb===
7011 ====bba====
7012 ===bc===
7013 ==c==
7014 ===ca===
7015 !! result
7016 xxx
7017
7018 ==a==
7019 ===aa===
7020 ====aaa====
7021 ==b==
7022 ===ba===
7023 ===bb===
7024 ====bba====
7025 ===bc===
7026 ==c==
7027 ===ca===
7028 !! end
7029
7030 !! test
7031 Section replacement test (section 1)
7032 !! options
7033 replace=1,"xxx"
7034 !! input
7035 start
7036 ==a==
7037 ===aa===
7038 ====aaa====
7039 ==b==
7040 ===ba===
7041 ===bb===
7042 ====bba====
7043 ===bc===
7044 ==c==
7045 ===ca===
7046 !! result
7047 start
7048 xxx
7049
7050 ==b==
7051 ===ba===
7052 ===bb===
7053 ====bba====
7054 ===bc===
7055 ==c==
7056 ===ca===
7057 !! end
7058
7059 !! test
7060 Section replacement test (section 2)
7061 !! options
7062 replace=2,"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 start
7077 ==a==
7078 xxx
7079
7080 ==b==
7081 ===ba===
7082 ===bb===
7083 ====bba====
7084 ===bc===
7085 ==c==
7086 ===ca===
7087 !! end
7088
7089 !! test
7090 Section replacement test (section 3)
7091 !! options
7092 replace=3,"xxx"
7093 !! input
7094 start
7095 ==a==
7096 ===aa===
7097 ====aaa====
7098 ==b==
7099 ===ba===
7100 ===bb===
7101 ====bba====
7102 ===bc===
7103 ==c==
7104 ===ca===
7105 !! result
7106 start
7107 ==a==
7108 ===aa===
7109 xxx
7110
7111 ==b==
7112 ===ba===
7113 ===bb===
7114 ====bba====
7115 ===bc===
7116 ==c==
7117 ===ca===
7118 !! end
7119
7120 !! test
7121 Section replacement test (section 4)
7122 !! options
7123 replace=4,"xxx"
7124 !! input
7125 start
7126 ==a==
7127 ===aa===
7128 ====aaa====
7129 ==b==
7130 ===ba===
7131 ===bb===
7132 ====bba====
7133 ===bc===
7134 ==c==
7135 ===ca===
7136 !! result
7137 start
7138 ==a==
7139 ===aa===
7140 ====aaa====
7141 xxx
7142
7143 ==c==
7144 ===ca===
7145 !! end
7146
7147 !! test
7148 Section replacement test (section 5)
7149 !! options
7150 replace=5,"xxx"
7151 !! input
7152 start
7153 ==a==
7154 ===aa===
7155 ====aaa====
7156 ==b==
7157 ===ba===
7158 ===bb===
7159 ====bba====
7160 ===bc===
7161 ==c==
7162 ===ca===
7163 !! result
7164 start
7165 ==a==
7166 ===aa===
7167 ====aaa====
7168 ==b==
7169 xxx
7170
7171 ===bb===
7172 ====bba====
7173 ===bc===
7174 ==c==
7175 ===ca===
7176 !! end
7177
7178 !! test
7179 Section replacement test (section 6)
7180 !! options
7181 replace=6,"xxx"
7182 !! input
7183 start
7184 ==a==
7185 ===aa===
7186 ====aaa====
7187 ==b==
7188 ===ba===
7189 ===bb===
7190 ====bba====
7191 ===bc===
7192 ==c==
7193 ===ca===
7194 !! result
7195 start
7196 ==a==
7197 ===aa===
7198 ====aaa====
7199 ==b==
7200 ===ba===
7201 xxx
7202
7203 ===bc===
7204 ==c==
7205 ===ca===
7206 !! end
7207
7208 !! test
7209 Section replacement test (section 7)
7210 !! options
7211 replace=7,"xxx"
7212 !! input
7213 start
7214 ==a==
7215 ===aa===
7216 ====aaa====
7217 ==b==
7218 ===ba===
7219 ===bb===
7220 ====bba====
7221 ===bc===
7222 ==c==
7223 ===ca===
7224 !! result
7225 start
7226 ==a==
7227 ===aa===
7228 ====aaa====
7229 ==b==
7230 ===ba===
7231 ===bb===
7232 xxx
7233
7234 ===bc===
7235 ==c==
7236 ===ca===
7237 !! end
7238
7239 !! test
7240 Section replacement test (section 8)
7241 !! options
7242 replace=8,"xxx"
7243 !! input
7244 start
7245 ==a==
7246 ===aa===
7247 ====aaa====
7248 ==b==
7249 ===ba===
7250 ===bb===
7251 ====bba====
7252 ===bc===
7253 ==c==
7254 ===ca===
7255 !! result
7256 start
7257 ==a==
7258 ===aa===
7259 ====aaa====
7260 ==b==
7261 ===ba===
7262 ===bb===
7263 ====bba====
7264 xxx
7265
7266 ==c==
7267 ===ca===
7268 !!end
7269
7270 !! test
7271 Section replacement test (section 9)
7272 !! options
7273 replace=9,"xxx"
7274 !! input
7275 start
7276 ==a==
7277 ===aa===
7278 ====aaa====
7279 ==b==
7280 ===ba===
7281 ===bb===
7282 ====bba====
7283 ===bc===
7284 ==c==
7285 ===ca===
7286 !! result
7287 start
7288 ==a==
7289 ===aa===
7290 ====aaa====
7291 ==b==
7292 ===ba===
7293 ===bb===
7294 ====bba====
7295 ===bc===
7296 xxx
7297 !! end
7298
7299 !! test
7300 Section replacement test (section 10)
7301 !! options
7302 replace=10,"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 ===bc===
7325 ==c==
7326 xxx
7327 !! end
7328
7329 !! test
7330 Section replacement test with initial whitespace (bug 13728)
7331 !! options
7332 replace=2,"xxx"
7333 !! input
7334 Preformatted initial line
7335 ==a==
7336 ===a===
7337 !! result
7338 Preformatted initial line
7339 ==a==
7340 xxx
7341 !! end
7342
7343
7344 !! test
7345 Section extraction, heading followed by pre with 20 spaces (bug 6398)
7346 !! options
7347 section=1
7348 !! input
7349 ==a==
7350 a
7351 !! result
7352 ==a==
7353 a
7354 !! end
7355
7356 !! test
7357 Section extraction, heading followed by pre with 19 spaces (bug 6398 sanity check)
7358 !! options
7359 section=1
7360 !! input
7361 ==a==
7362 a
7363 !! result
7364 ==a==
7365 a
7366 !! end
7367
7368
7369 !! test
7370 Section extraction, <pre> around bogus header (bug 10309)
7371 !! options
7372 noxml section=2
7373 !! input
7374 == Section One ==
7375 <pre>
7376 =======
7377 </pre>
7378
7379 == Section Two ==
7380 stuff
7381 !! result
7382 == Section Two ==
7383 stuff
7384 !! end
7385
7386 !! test
7387 Section replacement, <pre> around bogus header (bug 10309)
7388 !! options
7389 noxml replace=2,"xxx"
7390 !! input
7391 == Section One ==
7392 <pre>
7393 =======
7394 </pre>
7395
7396 == Section Two ==
7397 stuff
7398 !! result
7399 == Section One ==
7400 <pre>
7401 =======
7402 </pre>
7403
7404 xxx
7405 !! end
7406
7407
7408
7409 !! test
7410 Handling of &#x0A; in URLs
7411 !! input
7412 **irc://&#x0A;a
7413 !! result
7414 <ul><li><ul><li><a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a>
7415 </li></ul>
7416 </li></ul>
7417
7418 !!end
7419
7420 !! test
7421 5 quotes, code coverage +1 line
7422 !! input
7423 '''''
7424 !! result
7425 !! end
7426
7427 !! test
7428 Special:Search page linking.
7429 !! input
7430 {{Special:search}}
7431 !! result
7432 <p><a href="/wiki/Special:Search" title="Special:Search">Special:Search</a>
7433 </p>
7434 !! end
7435
7436 !! test
7437 Say the magic word
7438 !! input
7439 * {{PAGENAME}}
7440 * {{BASEPAGENAME}}
7441 * {{SUBPAGENAME}}
7442 * {{SUBPAGENAMEE}}
7443 * {{BASEPAGENAME}}
7444 * {{BASEPAGENAMEE}}
7445 * {{TALKPAGENAME}}
7446 * {{TALKPAGENAMEE}}
7447 * {{SUBJECTPAGENAME}}
7448 * {{SUBJECTPAGENAMEE}}
7449 * {{NAMESPACEE}}
7450 * {{NAMESPACE}}
7451 * {{TALKSPACE}}
7452 * {{TALKSPACEE}}
7453 * {{SUBJECTSPACE}}
7454 * {{SUBJECTSPACEE}}
7455 * {{Dynamic|{{NUMBEROFUSERS}}|{{NUMBEROFPAGES}}|{{CURRENTVERSION}}|{{CONTENTLANGUAGE}}|{{DIRECTIONMARK}}|{{CURRENTTIMESTAMP}}|{{NUMBEROFARTICLES}}}}
7456 !! result
7457 <ul><li> Parser test
7458 </li><li> Parser test
7459 </li><li> Parser test
7460 </li><li> Parser_test
7461 </li><li> Parser test
7462 </li><li> Parser_test
7463 </li><li> Talk:Parser test
7464 </li><li> Talk:Parser_test
7465 </li><li> Parser test
7466 </li><li> Parser_test
7467 </li><li>
7468 </li><li>
7469 </li><li> Talk
7470 </li><li> Talk
7471 </li><li>
7472 </li><li>
7473 </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>
7474 </li></ul>
7475
7476 !! end
7477 ### Note: Above tests excludes the "{{NUMBEROFADMINS}}" magic word because it generates a MySQL error when included.
7478
7479 !! test
7480 Gallery
7481 !! input
7482 <gallery>
7483 image1.png |
7484 image2.gif|||||
7485
7486 image3|
7487 image4 |300px| centre
7488 image5.svg| http://///////
7489 [[x|xx]]]]
7490 * image6
7491 </gallery>
7492 !! result
7493 <ul class="gallery">
7494 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
7495 <div style="height: 150px;">Image1.png</div>
7496 <div class="gallerytext">
7497 </div>
7498 </div></li>
7499 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
7500 <div style="height: 150px;">Image2.gif</div>
7501 <div class="gallerytext">
7502 <p>||||
7503 </p>
7504 </div>
7505 </div></li>
7506 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
7507 <div style="height: 150px;">Image3</div>
7508 <div class="gallerytext">
7509 </div>
7510 </div></li>
7511 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
7512 <div style="height: 150px;">Image4</div>
7513 <div class="gallerytext">
7514 <p>300px| centre
7515 </p>
7516 </div>
7517 </div></li>
7518 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
7519 <div style="height: 150px;">Image5.svg</div>
7520 <div class="gallerytext">
7521 <p><a rel="nofollow" class="external free" href="http://///////">http://///////</a>
7522 </p>
7523 </div>
7524 </div></li>
7525 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
7526 <div style="height: 150px;">* image6</div>
7527 <div class="gallerytext">
7528 </div>
7529 </div></li>
7530 </ul>
7531
7532 !! end
7533
7534 !! test
7535 Gallery (with options)
7536 !! input
7537 <gallery widths='70px' heights='40px' perrow='2' caption='Foo [[Main Page]]' >
7538 File:Nonexistant.jpg|caption
7539 File:Nonexistant.jpg
7540 image:foobar.jpg|some '''caption''' [[Main Page]]
7541 image:foobar.jpg
7542 image:foobar.jpg|Blabla|alt=This is a foo-bar.|blabla.
7543 </gallery>
7544 !! result
7545 <ul class="gallery" style="max-width: 226px;_width: 226px;">
7546 <li class='gallerycaption'>Foo <a href="/wiki/Main_Page" title="Main Page">Main Page</a></li>
7547 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
7548 <div style="height: 70px;">Nonexistant.jpg</div>
7549 <div class="gallerytext">
7550 <p>caption
7551 </p>
7552 </div>
7553 </div></li>
7554 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
7555 <div style="height: 70px;">Nonexistant.jpg</div>
7556 <div class="gallerytext">
7557 </div>
7558 </div></li>
7559 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
7560 <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>
7561 <div class="gallerytext">
7562 <p>some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
7563 </p>
7564 </div>
7565 </div></li>
7566 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
7567 <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>
7568 <div class="gallerytext">
7569 </div>
7570 </div></li>
7571 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
7572 <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>
7573 <div class="gallerytext">
7574 <p>Blabla|blabla.
7575 </p>
7576 </div>
7577 </div></li>
7578 </ul>
7579
7580 !! end
7581
7582 !! test
7583 Gallery with wikitext inside caption
7584 !! input
7585 <gallery>
7586 File:foobar.jpg|[[File:foobar.jpg|20px|desc|alt=inneralt]]|alt=galleryalt
7587 File:foobar.jpg|{{Test|unamedParam|alt=param}}|alt=galleryalt
7588 </gallery>
7589 !! result
7590 <ul class="gallery">
7591 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
7592 <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>
7593 <div class="gallerytext">
7594 <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>
7595 </p>
7596 </div>
7597 </div></li>
7598 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
7599 <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>
7600 <div class="gallerytext">
7601 <p>This is a test template
7602 </p>
7603 </div>
7604 </div></li>
7605 </ul>
7606
7607 !! end
7608
7609 !! test
7610 gallery (with showfilename option)
7611 !! input
7612 <gallery showfilename>
7613 File:Nonexistant.jpg|caption
7614 File:Nonexistant.jpg
7615 image:foobar.jpg|some '''caption''' [[Main Page]]
7616 File:Foobar.jpg
7617 </gallery>
7618 !! result
7619 <ul class="gallery">
7620 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
7621 <div style="height: 150px;">Nonexistant.jpg</div>
7622 <div class="gallerytext">
7623 <p><a href="/wiki/File:Nonexistant.jpg" title="File:Nonexistant.jpg">Nonexistant.jpg</a><br />
7624 caption
7625 </p>
7626 </div>
7627 </div></li>
7628 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
7629 <div style="height: 150px;">Nonexistant.jpg</div>
7630 <div class="gallerytext">
7631 <p><a href="/wiki/File:Nonexistant.jpg" title="File:Nonexistant.jpg">Nonexistant.jpg</a><br />
7632 </p>
7633 </div>
7634 </div></li>
7635 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
7636 <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>
7637 <div class="gallerytext">
7638 <p><a href="/wiki/File:Foobar.jpg" title="File:Foobar.jpg">Foobar.jpg</a><br />
7639 some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
7640 </p>
7641 </div>
7642 </div></li>
7643 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
7644 <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>
7645 <div class="gallerytext">
7646 <p><a href="/wiki/File:Foobar.jpg" title="File:Foobar.jpg">Foobar.jpg</a><br />
7647 </p>
7648 </div>
7649 </div></li>
7650 </ul>
7651
7652 !! end
7653
7654 !! test
7655 Gallery (with namespace-less filenames)
7656 !! input
7657 <gallery>
7658 File:Nonexistant.jpg
7659 Nonexistant.jpg
7660 image:foobar.jpg
7661 foobar.jpg
7662 </gallery>
7663 !! result
7664 <ul class="gallery">
7665 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
7666 <div style="height: 150px;">Nonexistant.jpg</div>
7667 <div class="gallerytext">
7668 </div>
7669 </div></li>
7670 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
7671 <div style="height: 150px;">Nonexistant.jpg</div>
7672 <div class="gallerytext">
7673 </div>
7674 </div></li>
7675 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
7676 <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>
7677 <div class="gallerytext">
7678 </div>
7679 </div></li>
7680 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
7681 <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>
7682 <div class="gallerytext">
7683 </div>
7684 </div></li>
7685 </ul>
7686
7687 !! end
7688
7689 !! test
7690 HTML Hex character encoding (spells the word "JavaScript")
7691 !! input
7692 &#x4A;&#x061;&#x0076;&#x00061;&#x000053;&#x0000063;&#114;&#x0000069;&#00000112;&#x0000000074;
7693 !! result
7694 <p>&#x4a;&#x61;&#x76;&#x61;&#x53;&#x63;&#114;&#x69;&#112;&#x74;
7695 </p>
7696 !! end
7697
7698 !! test
7699 HTML Hex character encoding bogus encoding (bug 26437 regression check)
7700 !! input
7701 &#xsee;&#XSEE;
7702 !! result
7703 <p>&amp;#xsee;&amp;#XSEE;
7704 </p>
7705 !! end
7706
7707 !! test
7708 HTML Hex character encoding mixed case
7709 !! input
7710 &#xEE;&#Xee;
7711 !! result
7712 <p>&#xee;&#xee;
7713 </p>
7714 !! end
7715
7716 !! test
7717 __FORCETOC__ override
7718 !! input
7719 __NEWSECTIONLINK__
7720 __FORCETOC__
7721 !! result
7722 <p><br />
7723 </p>
7724 !! end
7725
7726 !! test
7727 ISBN code coverage
7728 !! input
7729 ISBN 978-0-1234-56&#x20;789
7730 !! result
7731 <p><a href="/wiki/Special:BookSources/9780123456" class="internal mw-magiclink-isbn">ISBN 978-0-1234-56</a>&#x20;789
7732 </p>
7733 !! end
7734
7735 !! test
7736 ISBN followed by 5 spaces
7737 !! input
7738 ISBN
7739 !! result
7740 <p>ISBN
7741 </p>
7742 !! end
7743
7744 !! test
7745 Double ISBN
7746 !! input
7747 ISBN ISBN 1234567890
7748 !! result
7749 <p>ISBN <a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
7750 </p>
7751 !! end
7752
7753 !! test
7754 Bug 22905: <abbr> followed by ISBN followed by </a>
7755 !! input
7756 <abbr>(fr)</abbr> ISBN 2753300917 [http://www.example.com example.com]
7757 !! result
7758 <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>
7759 </p>
7760 !! end
7761
7762 !! test
7763 Double RFC
7764 !! input
7765 RFC RFC 1234
7766 !! result
7767 <p>RFC <a class="external mw-magiclink-rfc" href="http://tools.ietf.org/html/rfc1234">RFC 1234</a>
7768 </p>
7769 !! end
7770
7771 !! test
7772 Double RFC with a wiki link
7773 !! input
7774 RFC [[RFC 1234]]
7775 !! result
7776 <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>
7777 </p>
7778 !! end
7779
7780 !! test
7781 RFC code coverage
7782 !! input
7783 RFC 983&#x20;987
7784 !! result
7785 <p><a class="external mw-magiclink-rfc" href="http://tools.ietf.org/html/rfc983">RFC 983</a>&#x20;987
7786 </p>
7787 !! end
7788
7789 !! test
7790 Centre-aligned image
7791 !! input
7792 [[Image:foobar.jpg|centre]]
7793 !! result
7794 <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>
7795
7796 !!end
7797
7798 !! test
7799 None-aligned image
7800 !! input
7801 [[Image:foobar.jpg|none]]
7802 !! result
7803 <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>
7804
7805 !!end
7806
7807 !! test
7808 Width + Height sized image (using px) (height is ignored)
7809 !! input
7810 [[Image:foobar.jpg|640x480px]]
7811 !! result
7812 <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>
7813 </p>
7814 !!end
7815
7816 !! test
7817 Width-sized image (using px, no following whitespace)
7818 !! input
7819 [[Image:foobar.jpg|640px]]
7820 !! result
7821 <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>
7822 </p>
7823 !!end
7824
7825 !! test
7826 Width-sized image (using px, with following whitespace - test regression from r39467)
7827 !! input
7828 [[Image:foobar.jpg|640px ]]
7829 !! result
7830 <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>
7831 </p>
7832 !!end
7833
7834 !! test
7835 Width-sized image (using px, with preceding whitespace - test regression from r39467)
7836 !! input
7837 [[Image:foobar.jpg| 640px]]
7838 !! result
7839 <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>
7840 </p>
7841 !!end
7842
7843 !! test
7844 Another italics / bold test
7845 !! input
7846 ''' ''x'
7847 !! result
7848 <pre>'<i> </i>x'
7849 </pre>
7850 !!end
7851
7852 # Note the results may be incorrect, as parserTest output included this:
7853 # XML error: Mismatched tag at byte 6120:
7854 # ...<dd> </dt></dl> </dd...
7855 !! test
7856 dt/dd/dl test
7857 !! options
7858 disabled
7859 !! input
7860 :;;;::
7861 !! result
7862 <dl><dd><dl><dt><dl><dt><dl><dt><dl><dd><dl><dd>
7863 </dd></dl>
7864 </dd></dl>
7865 </dt></dl>
7866 </dt></dl>
7867 </dt></dl>
7868 </dd></dl>
7869
7870 !!end
7871
7872
7873 # Images with the "|" character in external URLs in comment tags; Eats half the comment, leaves unmatched "</a>" tag.
7874 !! test
7875 Images with the "|" character in the comment
7876 !! input
7877 [[image:Foobar.jpg|thumb|An [http://test/?param1=|left|&param2=|x external] URL]]
7878 !! result
7879 <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>
7880
7881 !!end
7882
7883 !! test
7884 [Before] HTML without raw HTML enabled ($wgRawHtml==false)
7885 !! input
7886 <html><script>alert(1);</script></html>
7887 !! result
7888 <p>&lt;html&gt;&lt;script&gt;alert(1);&lt;/script&gt;&lt;/html&gt;
7889 </p>
7890 !! end
7891
7892 !! test
7893 HTML with raw HTML ($wgRawHtml==true)
7894 !! options
7895 rawhtml
7896 !! input
7897 <html><script>alert(1);</script></html>
7898 !! result
7899 <p><script>alert(1);</script>
7900 </p>
7901 !! end
7902
7903 !! test
7904 Parents of subpages, one level up
7905 !! options
7906 subpage title=[[Subpage test/L1/L2/L3]]
7907 !! input
7908 [[../|L2]]
7909 !! result
7910 <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>
7911 </p>
7912 !! end
7913
7914
7915 !! test
7916 Parents of subpages, one level up, not named
7917 !! options
7918 subpage title=[[Subpage test/L1/L2/L3]]
7919 !! input
7920 [[../]]
7921 !! result
7922 <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>
7923 </p>
7924 !! end
7925
7926
7927
7928 !! test
7929 Parents of subpages, two levels up
7930 !! options
7931 subpage title=[[Subpage test/L1/L2/L3]]
7932 !! input
7933 [[../../|L1]]2
7934
7935 [[../../|L1]]l
7936 !! result
7937 <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
7938 </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>
7939 </p>
7940 !! end
7941
7942 !! test
7943 Parents of subpages, two levels up, without trailing slash or name.
7944 !! options
7945 subpage title=[[Subpage test/L1/L2/L3]]
7946 !! input
7947 [[../..]]
7948 !! result
7949 <p>[[../..]]
7950 </p>
7951 !! end
7952
7953 !! test
7954 Parents of subpages, two levels up, with lots of extra trailing slashes.
7955 !! options
7956 subpage title=[[Subpage test/L1/L2/L3]]
7957 !! input
7958 [[../../////]]
7959 !! result
7960 <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>
7961 </p>
7962 !! end
7963
7964 !! test
7965 Definition list code coverage
7966 !! input
7967 ; title : def
7968 ; title : def
7969 ;title: def
7970 !! result
7971 <dl><dt> title &#160;</dt><dd> def
7972 </dd><dt> title&#160;</dt><dd> def
7973 </dd><dt>title</dt><dd> def
7974 </dd></dl>
7975
7976 !! end
7977
7978 !! test
7979 Don't fall for the self-closing div
7980 !! input
7981 <div>hello world</div/>
7982 !! result
7983 <div>hello world</div>
7984
7985 !! end
7986
7987 !! test
7988 MSGNW magic word
7989 !! input
7990 {{MSGNW:msg}}
7991 !! result
7992 <p>&#91;&#91;:Template:Msg&#93;&#93;
7993 </p>
7994 !! end
7995
7996 !! test
7997 RAW magic word
7998 !! input
7999 {{RAW:QUERTY}}
8000 !! result
8001 <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>
8002 </p>
8003 !! end
8004
8005 # This isn't needed for XHTML conformance, but would be handy as a fallback security measure
8006 !! test
8007 Always escape literal '>' in output, not just after '<'
8008 !! input
8009 ><>
8010 !! result
8011 <p>&gt;&lt;&gt;
8012 </p>
8013 !! end
8014
8015 !! test
8016 Template caching
8017 !! input
8018 {{Test}}
8019 {{Test}}
8020 !! result
8021 <p>This is a test template
8022 This is a test template
8023 </p>
8024 !! end
8025
8026
8027 !! article
8028 MediaWiki:Fake
8029 !! text
8030 ==header==
8031 !! endarticle
8032
8033 !! test
8034 Inclusion of !userCanEdit() content
8035 !! input
8036 {{MediaWiki:Fake}}
8037 !! result
8038 <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>
8039
8040 !! end
8041
8042
8043 !! test
8044 Out-of-order TOC heading levels
8045 !! input
8046 ==2==
8047 ======6======
8048 ===3===
8049 =1=
8050 =====5=====
8051 ==2==
8052 !! result
8053 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
8054 <ul>
8055 <li class="toclevel-1 tocsection-1"><a href="#2"><span class="tocnumber">1</span> <span class="toctext">2</span></a>
8056 <ul>
8057 <li class="toclevel-2 tocsection-2"><a href="#6"><span class="tocnumber">1.1</span> <span class="toctext">6</span></a></li>
8058 <li class="toclevel-2 tocsection-3"><a href="#3"><span class="tocnumber">1.2</span> <span class="toctext">3</span></a></li>
8059 </ul>
8060 </li>
8061 <li class="toclevel-1 tocsection-4"><a href="#1"><span class="tocnumber">2</span> <span class="toctext">1</span></a>
8062 <ul>
8063 <li class="toclevel-2 tocsection-5"><a href="#5"><span class="tocnumber">2.1</span> <span class="toctext">5</span></a></li>
8064 <li class="toclevel-2 tocsection-6"><a href="#2_2"><span class="tocnumber">2.2</span> <span class="toctext">2</span></a></li>
8065 </ul>
8066 </li>
8067 </ul>
8068 </td></tr></table>
8069 <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>
8070 <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>
8071 <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>
8072 <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>
8073 <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>
8074 <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>
8075
8076 !! end
8077
8078
8079 !! test
8080 ISBN with a dummy number
8081 !! input
8082 ISBN ---
8083 !! result
8084 <p>ISBN ---
8085 </p>
8086 !! end
8087
8088
8089 !! test
8090 ISBN with space-delimited number
8091 !! input
8092 ISBN 92 9017 032 8
8093 !! result
8094 <p><a href="/wiki/Special:BookSources/9290170328" class="internal mw-magiclink-isbn">ISBN 92 9017 032 8</a>
8095 </p>
8096 !! end
8097
8098
8099 !! test
8100 ISBN with multiple spaces, no number
8101 !! input
8102 ISBN foo
8103 !! result
8104 <p>ISBN foo
8105 </p>
8106 !! end
8107
8108
8109 !! test
8110 ISBN length
8111 !! input
8112 ISBN 123456789
8113
8114 ISBN 1234567890
8115
8116 ISBN 12345678901
8117 !! result
8118 <p>ISBN 123456789
8119 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
8120 </p><p>ISBN 12345678901
8121 </p>
8122 !! end
8123
8124
8125 !! test
8126 ISBN with trailing year (bug 8110)
8127 !! input
8128 ISBN 1-234-56789-0 - 2006
8129
8130 ISBN 1 234 56789 0 - 2006
8131 !! result
8132 <p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1-234-56789-0</a> - 2006
8133 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1 234 56789 0</a> - 2006
8134 </p>
8135 !! end
8136
8137
8138 !! test
8139 anchorencode
8140 !! input
8141 {{anchorencode:foo bar©#%n}}
8142 !! result
8143 <p>foo_bar.C2.A9.23.25n
8144 </p>
8145 !! end
8146
8147 !! test
8148 anchorencode trims spaces
8149 !! input
8150 {{anchorencode: __pretty__please__}}
8151 !! result
8152 <p>pretty_please
8153 </p>
8154 !! end
8155
8156 !! test
8157 anchorencode deals with links
8158 !! input
8159 {{anchorencode: [[hello|world]] [[hi]]}}
8160 !! result
8161 <p>world_hi
8162 </p>
8163 !! end
8164
8165 !! test
8166 anchorencode deals with templates
8167 !! input
8168 {{anchorencode: {{Foo}} }}
8169 !! result
8170 <p>FOO
8171 </p>
8172 !! end
8173
8174 !! test
8175 anchorencode encodes like the TOC generator: (bug 18431)
8176 !! input
8177 === _ +:.3A%3A&&amp;]] ===
8178 {{anchorencode: _ +:.3A%3A&&amp;]] }}
8179 __NOEDITSECTION__
8180 !! result
8181 <h3> <span class="mw-headline" id=".2B:.3A.253A.26.26.5D.5D"> _ +:.3A%3A&amp;&amp;]] </span></h3>
8182 <p>.2B:.3A.253A.26.26.5D.5D
8183 </p>
8184 !! end
8185
8186 # Expected output in the following test is not necessarily expected (there
8187 # should probably be <p> tags inside the <blockquote> in the output) -- it's
8188 # only testing for well-formedness.
8189 !! test
8190 Bug 6200: blockquotes and paragraph formatting
8191 !! input
8192 <blockquote>
8193 foo
8194 </blockquote>
8195
8196 bar
8197
8198 baz
8199 !! result
8200 <blockquote>
8201 foo
8202 </blockquote>
8203 <p>bar
8204 </p>
8205 <pre>baz
8206 </pre>
8207 !! end
8208
8209 !! test
8210 Bug 8293: Use of center tag ruins paragraph formatting
8211 !! input
8212 <center>
8213 foo
8214 </center>
8215
8216 bar
8217
8218 baz
8219 !! result
8220 <center>
8221 <p>foo
8222 </p>
8223 </center>
8224 <p>bar
8225 </p>
8226 <pre>baz
8227 </pre>
8228 !! end
8229
8230
8231 ###
8232 ### Language variants related tests
8233 ###
8234 !! test
8235 Self-link in language variants
8236 !! options
8237 title=[[Dunav]] language=sr
8238 !! input
8239 Both [[Dunav]] and [[Дунав]] are names for this river.
8240 !! result
8241 <p>Both <strong class="selflink">Dunav</strong> and <strong class="selflink">Дунав</strong> are names for this river.
8242 </p>
8243 !!end
8244
8245
8246 !! test
8247 Link to pages in language variants
8248 !! options
8249 language=sr
8250 !! input
8251 Main Page can be written as [[Маин Паге]]
8252 !! result
8253 <p>Main Page can be written as <a href="/wiki/Main_Page" title="Main Page">Маин Паге</a>
8254 </p>
8255 !!end
8256
8257
8258 !! test
8259 Multiple links to pages in language variants
8260 !! options
8261 language=sr
8262 !! input
8263 [[Main Page]] can be written as [[Маин Паге]] same as [[Маин Паге]].
8264 !! result
8265 <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>.
8266 </p>
8267 !!end
8268
8269
8270 !! test
8271 Simple template in language variants
8272 !! options
8273 language=sr
8274 !! input
8275 {{тест}}
8276 !! result
8277 <p>This is a test template
8278 </p>
8279 !! end
8280
8281
8282 !! test
8283 Template with explicit namespace in language variants
8284 !! options
8285 language=sr
8286 !! input
8287 {{Template:тест}}
8288 !! result
8289 <p>This is a test template
8290 </p>
8291 !! end
8292
8293
8294 !! test
8295 Basic test for template parameter in language variants
8296 !! options
8297 language=sr
8298 !! input
8299 {{парамтест|param=foo}}
8300 !! result
8301 <p>This is a test template with parameter foo
8302 </p>
8303 !! end
8304
8305
8306 !! test
8307 Simple category in language variants
8308 !! options
8309 language=sr cat
8310 !! input
8311 [[Category:МедиаWики Усер'с Гуиде]]
8312 !! result
8313 <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>
8314 !! end
8315
8316
8317 !! test
8318 Stripping -{}- tags (language variants)
8319 !! options
8320 language=sr
8321 !! input
8322 Latin proverb: -{Ne nuntium necare}-
8323 !! result
8324 <p>Latin proverb: Ne nuntium necare
8325 </p>
8326 !! end
8327
8328
8329 !! test
8330 Prevent conversion with -{}- tags (language variants)
8331 !! options
8332 language=sr variant=sr-ec
8333 !! input
8334 Latinski: -{Ne nuntium necare}-
8335 !! result
8336 <p>Латински: Ne nuntium necare
8337 </p>
8338 !! end
8339
8340
8341 !! test
8342 Prevent conversion of text with -{}- tags (language variants)
8343 !! options
8344 language=sr variant=sr-ec
8345 !! input
8346 Latinski: -{Ne nuntium necare}-
8347 !! result
8348 <p>Латински: Ne nuntium necare
8349 </p>
8350 !! end
8351
8352
8353 !! test
8354 Prevent conversion of links with -{}- tags (language variants)
8355 !! options
8356 language=sr variant=sr-ec
8357 !! input
8358 -{[[Main Page]]}-
8359 !! result
8360 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
8361 </p>
8362 !! end
8363
8364
8365 !! test
8366 -{}- tags within headlines (within html for parserConvert())
8367 !! options
8368 language=sr variant=sr-ec
8369 !! input
8370 == -{Naslov}- ==
8371 !! result
8372 <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>
8373
8374 !! end
8375
8376
8377 !! test
8378 Explicit definition of language variant alternatives
8379 !! options
8380 language=zh variant=zh-tw
8381 !! input
8382 -{zh:China;zh-tw:Taiwan}-, not China
8383 !! result
8384 <p>Taiwan, not China
8385 </p>
8386 !! end
8387
8388
8389 !! test
8390 Explicit session-wise language variant mapping (A flag and - flag)
8391 !! options
8392 language=zh variant=zh-tw
8393 !! input
8394 Taiwan is not China.
8395 But -{A|zh:China;zh-tw:Taiwan}- is China,
8396 (This-{-|zh:China;zh-tw:Taiwan}- should be stripped!)
8397 and -{China}- is China.
8398 !! result
8399 <p>Taiwan is not China.
8400 But Taiwan is Taiwan,
8401 (This should be stripped!)
8402 and China is China.
8403 </p>
8404 !! end
8405
8406 !! test
8407 Explicit session-wise language variant mapping (H flag for hide)
8408 !! options
8409 language=zh variant=zh-tw
8410 !! input
8411 (This-{H|zh:China;zh-tw:Taiwan}- should be stripped!)
8412 Taiwan is China.
8413 !! result
8414 <p>(This should be stripped!)
8415 Taiwan is Taiwan.
8416 </p>
8417 !! end
8418
8419 !! test
8420 Adding explicit conversion rule for title (T flag)
8421 !! options
8422 language=zh variant=zh-tw showtitle
8423 !! input
8424 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
8425 !! result
8426 Taiwan
8427 <p>Should be stripped!
8428 </p>
8429 !! end
8430
8431 !! test
8432 Testing that changing the language variant here in the tests actually works
8433 !! options
8434 language=zh variant=zh showtitle
8435 !! input
8436 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
8437 !! result
8438 China
8439 <p>Should be stripped!
8440 </p>
8441 !! end
8442
8443 !! test
8444 Bug 24072: more test on conversion rule for title
8445 !! options
8446 language=zh variant=zh-tw showtitle
8447 !! input
8448 This should be stripped-{T|zh:China;zh-tw:Taiwan}-!
8449 This won't take interferes with the title rule-{H|zh:Beijing;zh-tw:Taipei}-.
8450 !! result
8451 Taiwan
8452 <p>This should be stripped!
8453 This won't take interferes with the title rule.
8454 </p>
8455 !! end
8456
8457 !! test
8458 Raw output of variant escape tags (R flag)
8459 !! options
8460 language=zh variant=zh-tw
8461 !! input
8462 Raw: -{R|zh:China;zh-tw:Taiwan}-
8463 !! result
8464 <p>Raw: zh:China;zh-tw:Taiwan
8465 </p>
8466 !! end
8467
8468 !! test
8469 Nested using of manual convert syntax
8470 !! options
8471 language=zh variant=zh-hk
8472 !! input
8473 Nested: -{zh-hans:Hi -{zh-cn:China;zh-sg:Singapore;}-;zh-hant:Hello -{zh-tw:Taiwan;zh-hk:H-{ong}- K-{}-ong;}-;}-!
8474 !! result
8475 <p>Nested: Hello Hong Kong!
8476 </p>
8477 !! end
8478
8479 !! test
8480 Do not convert roman numbers to language variants
8481 !! options
8482 language=sr variant=sr-ec
8483 !! input
8484 Fridrih IV je car.
8485 !! result
8486 <p>Фридрих IV је цар.
8487 </p>
8488 !! end
8489
8490 !! test
8491 Unclosed language converter markup "-{"
8492 !! options
8493 language=sr
8494 !! input
8495 -{T|hello
8496 !! result
8497 <p>-{T|hello
8498 </p>
8499 !! end
8500
8501 !! test
8502 Don't convert raw rule "-{R|=&gt;}-" to "=>"
8503 !! options
8504 language=sr
8505 !! input
8506 -{R|=&gt;}-
8507 !! result
8508 <p>=&gt;
8509 </p>
8510 !!end
8511
8512 !!article
8513 Template:Bullet
8514 !!text
8515 * Bar
8516 !!endarticle
8517
8518 !! test
8519 Bug 529: Uncovered bullet
8520 !! input
8521 * Foo {{bullet}}
8522 !! result
8523 <ul><li> Foo
8524 </li><li> Bar
8525 </li></ul>
8526
8527 !! end
8528
8529 !! test
8530 Bug 529: Uncovered table already at line-start
8531 !! input
8532 x
8533
8534 {{table}}
8535 y
8536 !! result
8537 <p>x
8538 </p>
8539 <table>
8540 <tr>
8541 <td>1
8542 </td>
8543 <td>2
8544 </td>
8545 </tr>
8546 <tr>
8547 <td>3
8548 </td>
8549 <td>4
8550 </td>
8551 </tr>
8552 </table>
8553 <p>y
8554 </p>
8555 !! end
8556
8557 !! test
8558 Bug 529: Uncovered bullet in parser function result
8559 !! input
8560 * Foo {{lc:{{bullet}} }}
8561 !! result
8562 <ul><li> Foo
8563 </li><li> bar
8564 </li></ul>
8565
8566 !! end
8567
8568 !! test
8569 Bug 5678: Double-parsed template argument
8570 !! input
8571 {{lc:{{{1}}}|hello}}
8572 !! result
8573 <p>{{{1}}}
8574 </p>
8575 !! end
8576
8577 !! test
8578 Bug 5678: Double-parsed template invocation
8579 !! input
8580 {{lc:{{paramtest {{!}} param = hello }} }}
8581 !! result
8582 <p>{{paramtest | param = hello }}
8583 </p>
8584 !! end
8585
8586 !! test
8587 Case insensitivity of parser functions for non-ASCII characters (bug 8143)
8588 !! options
8589 language=cs
8590 title=[[Main Page]]
8591 !! input
8592 {{PRVNÍVELKÉ:ěščř}}
8593 {{prvnívelké:ěščř}}
8594 {{PRVNÍMALÉ:ěščř}}
8595 {{prvnímalé:ěščř}}
8596 {{MALÁ:ěščř}}
8597 {{malá:ěščř}}
8598 {{VELKÁ:ěščř}}
8599 {{velká:ěščř}}
8600 !! result
8601 <p>Ěščř
8602 Ěščř
8603 ěščř
8604 ěščř
8605 ěščř
8606 ěščř
8607 ĚŠČŘ
8608 ĚŠČŘ
8609 </p>
8610 !! end
8611
8612 !! test
8613 Morwen/13: Unclosed link followed by heading
8614 !! input
8615 [[link
8616 ==heading==
8617 !! result
8618 <p>[[link
8619 </p>
8620 <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>
8621
8622 !! end
8623
8624 !! test
8625 HHP2.1: Heuristics for headings in preprocessor parenthetical structures
8626 !! input
8627 {{foo|
8628 =heading=
8629 !! result
8630 <p>{{foo|
8631 </p>
8632 <h1> <span class="mw-headline" id="heading">heading</span></h1>
8633
8634 !! end
8635
8636 !! test
8637 HHP2.2: Heuristics for headings in preprocessor parenthetical structures
8638 !! input
8639 {{foo|
8640 ==heading==
8641 !! result
8642 <p>{{foo|
8643 </p>
8644 <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>
8645
8646 !! end
8647
8648 !! test
8649 Tildes in comments
8650 !! options
8651 pst
8652 !! input
8653 <!-- ~~~~ -->
8654 !! result
8655 <!-- ~~~~ -->
8656 !! end
8657
8658 !! test
8659 Paragraphs inside divs (no extra line breaks)
8660 !! input
8661 <div>Line one
8662
8663 Line two</div>
8664 !! result
8665 <div>Line one
8666 Line two</div>
8667
8668 !! end
8669
8670 !! test
8671 Paragraphs inside divs (extra line break on open)
8672 !! input
8673 <div>
8674 Line one
8675
8676 Line two</div>
8677 !! result
8678 <div>
8679 <p>Line one
8680 </p>
8681 Line two</div>
8682
8683 !! end
8684
8685 !! test
8686 Paragraphs inside divs (extra line break on close)
8687 !! input
8688 <div>Line one
8689
8690 Line two
8691 </div>
8692 !! result
8693 <div>Line one
8694 <p>Line two
8695 </p>
8696 </div>
8697
8698 !! end
8699
8700 !! test
8701 Paragraphs inside divs (extra line break on open and close)
8702 !! input
8703 <div>
8704 Line one
8705
8706 Line two
8707 </div>
8708 !! result
8709 <div>
8710 <p>Line one
8711 </p><p>Line two
8712 </p>
8713 </div>
8714
8715 !! end
8716
8717 !! test
8718 Nesting tags, paragraphs on lines which begin with <div>
8719 !! options
8720 disabled
8721 !! input
8722 <div></div><strong>A
8723 B</strong>
8724 !! result
8725 <div></div>
8726 <p><strong>A
8727 B</strong>
8728 </p>
8729 !! end
8730
8731 # Bug 6200: <blockquote> should behave like <div> with respect to line breaks
8732 !! test
8733 Bug 6200: paragraphs inside blockquotes (no extra line breaks)
8734 !! options
8735 disabled
8736 !! input
8737 <blockquote>Line one
8738
8739 Line two</blockquote>
8740 !! result
8741 <blockquote>Line one
8742 Line two</blockquote>
8743
8744 !! end
8745
8746 !! test
8747 Bug 6200: paragraphs inside blockquotes (extra line break on open)
8748 !! options
8749 disabled
8750 !! input
8751 <blockquote>
8752 Line one
8753
8754 Line two</blockquote>
8755 !! result
8756 <blockquote>
8757 <p>Line one
8758 </p>
8759 Line two</blockquote>
8760
8761 !! end
8762
8763 !! test
8764 Bug 6200: paragraphs inside blockquotes (extra line break on close)
8765 !! options
8766 disabled
8767 !! input
8768 <blockquote>Line one
8769
8770 Line two
8771 </blockquote>
8772 !! result
8773 <blockquote>Line one
8774 <p>Line two
8775 </p>
8776 </blockquote>
8777
8778 !! end
8779
8780 !! test
8781 Bug 6200: paragraphs inside blockquotes (extra line break on open and close)
8782 !! options
8783 disabled
8784 !! input
8785 <blockquote>
8786 Line one
8787
8788 Line two
8789 </blockquote>
8790 !! result
8791 <blockquote>
8792 <p>Line one
8793 </p><p>Line two
8794 </p>
8795 </blockquote>
8796
8797 !! end
8798
8799 !! test
8800 Paragraphs inside blockquotes/divs (no extra line breaks)
8801 !! input
8802 <blockquote><div>Line one
8803
8804 Line two</div></blockquote>
8805 !! result
8806 <blockquote><div>Line one
8807 Line two</div></blockquote>
8808
8809 !! end
8810
8811 !! test
8812 Paragraphs inside blockquotes/divs (extra line break on open)
8813 !! input
8814 <blockquote><div>
8815 Line one
8816
8817 Line two</div></blockquote>
8818 !! result
8819 <blockquote><div>
8820 <p>Line one
8821 </p>
8822 Line two</div></blockquote>
8823
8824 !! end
8825
8826 !! test
8827 Paragraphs inside blockquotes/divs (extra line break on close)
8828 !! input
8829 <blockquote><div>Line one
8830
8831 Line two
8832 </div></blockquote>
8833 !! result
8834 <blockquote><div>Line one
8835 <p>Line two
8836 </p>
8837 </div></blockquote>
8838
8839 !! end
8840
8841 !! test
8842 Paragraphs inside blockquotes/divs (extra line break on open and close)
8843 !! input
8844 <blockquote><div>
8845 Line one
8846
8847 Line two
8848 </div></blockquote>
8849 !! result
8850 <blockquote><div>
8851 <p>Line one
8852 </p><p>Line two
8853 </p>
8854 </div></blockquote>
8855
8856 !! end
8857
8858 !! test
8859 Interwiki links trounced by replaceExternalLinks after early LinkHolderArray expansion
8860 !! options
8861 wgLinkHolderBatchSize=0
8862 !! input
8863 [[meatball:1]]
8864 [[meatball:2]]
8865 [[meatball:3]]
8866 !! result
8867 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?1" class="extiw" title="meatball:1">meatball:1</a>
8868 <a href="http://www.usemod.com/cgi-bin/mb.pl?2" class="extiw" title="meatball:2">meatball:2</a>
8869 <a href="http://www.usemod.com/cgi-bin/mb.pl?3" class="extiw" title="meatball:3">meatball:3</a>
8870 </p>
8871 !! end
8872
8873 !! test
8874 Free external link invading image caption
8875 !! input
8876 [[Image:Foobar.jpg|thumb|http://x|hello]]
8877 !! result
8878 <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>
8879
8880 !! end
8881
8882 !! test
8883 Bug 15196: localised external link numbers
8884 !! options
8885 language=fa
8886 !! input
8887 [http://en.wikipedia.org/]
8888 !! result
8889 <p><a rel="nofollow" class="external autonumber" href="http://en.wikipedia.org/">[۱]</a>
8890 </p>
8891 !! end
8892
8893 !! test
8894 Multibyte character in padleft
8895 !! input
8896 {{padleft:-Hello|7|Æ}}
8897 !! result
8898 <p>Æ-Hello
8899 </p>
8900 !! end
8901
8902 !! test
8903 Multibyte character in padright
8904 !! input
8905 {{padright:Hello-|7|Æ}}
8906 !! result
8907 <p>Hello-Æ
8908 </p>
8909 !! end
8910
8911 !! test
8912 Formatted date
8913 !! config
8914 wgUseDynamicDates=1
8915 !! input
8916 [[2009-03-24]]
8917 !! result
8918 <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>
8919 </p>
8920 !!end
8921
8922 !!test
8923 formatdate parser function
8924 !!input
8925 {{#formatdate:2009-03-24}}
8926 !! result
8927 <p><span class="mw-formatted-date" title="2009-03-24">2009-03-24</span>
8928 </p>
8929 !! end
8930
8931 !!test
8932 formatdate parser function, with default format
8933 !!input
8934 {{#formatdate:2009-03-24|mdy}}
8935 !! result
8936 <p><span class="mw-formatted-date" title="2009-03-24">March 24, 2009</span>
8937 </p>
8938 !! end
8939
8940 !! test
8941 Linked date with autoformatting disabled
8942 !! config
8943 wgUseDynamicDates=false
8944 !! input
8945 [[2009-03-24]]
8946 !! result
8947 <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>
8948 </p>
8949 !! end
8950
8951 !! test
8952 Spacing of numbers in formatted dates
8953 !! input
8954 {{#formatdate:January 15}}
8955 !! result
8956 <p><span class="mw-formatted-date" title="01-15">January 15</span>
8957 </p>
8958 !! end
8959
8960 !! test
8961 Spacing of numbers in formatted dates (linked)
8962 !! config
8963 wgUseDynamicDates=true
8964 !! input
8965 [[January 15]]
8966 !! result
8967 <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>
8968 </p>
8969 !! end
8970
8971 #
8972 #
8973 #
8974
8975 #
8976 # Edit comments
8977 #
8978
8979 !! test
8980 Edit comment with link
8981 !! options
8982 comment
8983 !! input
8984 I like the [[Main Page]] a lot
8985 !! result
8986 I like the <a href="/wiki/Main_Page" title="Main Page">Main Page</a> a lot
8987 !!end
8988
8989 !! test
8990 Edit comment with link and link text
8991 !! options
8992 comment
8993 !! input
8994 I like the [[Main Page|best pages]] a lot
8995 !! result
8996 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
8997 !!end
8998
8999 !! test
9000 Edit comment with link and link text with suffix
9001 !! options
9002 comment
9003 !! input
9004 I like the [[Main Page|best page]]s a lot
9005 !! result
9006 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
9007 !!end
9008
9009 !! test
9010 Edit comment with section link (non-local, eg in history list)
9011 !! options
9012 comment title=[[Main Page]]
9013 !! input
9014 /* External links */ removed bogus entries
9015 !! result
9016 <span class="autocomment"><a href="/wiki/Main_Page#External_links" title="Main Page">→</a>External links: </span> removed bogus entries
9017 !!end
9018
9019 !! test
9020 Edit comment with section link (local, eg in diff view)
9021 !! options
9022 comment local title=[[Main Page]]
9023 !! input
9024 /* External links */ removed bogus entries
9025 !! result
9026 <span class="autocomment"><a href="#External_links">→</a>External links: </span> removed bogus entries
9027 !!end
9028
9029 !! test
9030 Edit comment with subpage link (bug 14080)
9031 !! options
9032 comment
9033 subpage
9034 title=[[Subpage test]]
9035 !! input
9036 Poked at a [[/subpage]] here...
9037 !! result
9038 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a> here...
9039 !!end
9040
9041 !! test
9042 Edit comment with subpage link and link text (bug 14080)
9043 !! options
9044 comment
9045 subpage
9046 title=[[Subpage test]]
9047 !! input
9048 Poked at a [[/subpage|neat little page]] here...
9049 !! result
9050 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">neat little page</a> here...
9051 !!end
9052
9053 !! test
9054 Edit comment with bogus subpage link in non-subpage NS (bug 14080)
9055 !! options
9056 comment
9057 title=[[Subpage test]]
9058 !! input
9059 Poked at a [[/subpage]] here...
9060 !! result
9061 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...
9062 !!end
9063
9064 !! test
9065 Edit comment with bare anchor link (local, as on diff)
9066 !! options
9067 comment
9068 local
9069 title=[[Main Page]]
9070 !!input
9071 [[#section]]
9072 !! result
9073 <a href="#section">#section</a>
9074 !! end
9075
9076 !! test
9077 Edit comment with bare anchor link (non-local, as on history)
9078 !! options
9079 comment
9080 title=[[Main Page]]
9081 !!input
9082 [[#section]]
9083 !! result
9084 <a href="/wiki/Main_Page#section" title="Main Page">#section</a>
9085 !! end
9086
9087 !! test
9088 Anchor starting with underscore
9089 !!input
9090 [[#_ref|One]]
9091 !! result
9092 <p><a href="#_ref">One</a>
9093 </p>
9094 !! end
9095
9096 !! test
9097 Id starting with underscore
9098 !!input
9099 <div id="_ref"></div>
9100 !! result
9101 <div id="_ref"></div>
9102
9103 !! end
9104
9105 !! test
9106 Space normalisation on autocomment (bug 22784)
9107 !! options
9108 comment
9109 title=[[Main Page]]
9110 !!input
9111 /* __hello__world__ */
9112 !! result
9113 <span class="autocomment"><a href="/wiki/Main_Page#hello_world" title="Main Page">→</a>__hello__world__</span>
9114 !! end
9115
9116 !! test
9117 percent-encoding and + signs in comments (Bug 26410)
9118 !! options
9119 comment
9120 !!input
9121 [[ABC%33D% ++]] [[ABC%33D% ++|+%20]]
9122 !! result
9123 <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>
9124 !! end
9125
9126 !! test
9127 Bad images - basic functionality
9128 !! input
9129 [[File:Bad.jpg]]
9130 !! result
9131 !! end
9132
9133 !! test
9134 Bad images - bug 16039: text after bad image disappears
9135 !! input
9136 Foo bar
9137 [[File:Bad.jpg]]
9138 Bar foo
9139 !! result
9140 <p>Foo bar
9141 </p><p>Bar foo
9142 </p>
9143 !! end
9144
9145 !! test
9146 Verify that displaytitle works (bug #22501) no displaytitle
9147 !! options
9148 showtitle
9149 !! config
9150 wgAllowDisplayTitle=true
9151 wgRestrictDisplayTitle=false
9152 !! input
9153 this is not the the title
9154 !! result
9155 Parser test
9156 <p>this is not the the title
9157 </p>
9158 !! end
9159
9160 !! test
9161 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=false
9162 !! options
9163 showtitle
9164 title=[[Screen]]
9165 !! config
9166 wgAllowDisplayTitle=true
9167 wgRestrictDisplayTitle=false
9168 !! input
9169 this is not the the title
9170 {{DISPLAYTITLE:whatever}}
9171 !! result
9172 whatever
9173 <p>this is not the the title
9174 </p>
9175 !! end
9176
9177 !! test
9178 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true mismatch
9179 !! options
9180 showtitle
9181 title=[[Screen]]
9182 !! config
9183 wgAllowDisplayTitle=true
9184 wgRestrictDisplayTitle=true
9185 !! input
9186 this is not the the title
9187 {{DISPLAYTITLE:whatever}}
9188 !! result
9189 Screen
9190 <p>this is not the the title
9191 </p>
9192 !! end
9193
9194 !! test
9195 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true matching
9196 !! options
9197 showtitle
9198 title=[[Screen]]
9199 !! config
9200 wgAllowDisplayTitle=true
9201 wgRestrictDisplayTitle=true
9202 !! input
9203 this is not the the title
9204 {{DISPLAYTITLE:screen}}
9205 !! result
9206 screen
9207 <p>this is not the the title
9208 </p>
9209 !! end
9210
9211 !! test
9212 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false
9213 !! options
9214 showtitle
9215 title=[[Screen]]
9216 !! config
9217 wgAllowDisplayTitle=false
9218 !! input
9219 this is not the the title
9220 {{DISPLAYTITLE:screen}}
9221 !! result
9222 Screen
9223 <p>this is not the the title
9224 <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>
9225 </p>
9226 !! end
9227
9228 !! test
9229 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false no DISPLAYTITLE
9230 !! options
9231 showtitle
9232 title=[[Screen]]
9233 !! config
9234 wgAllowDisplayTitle=false
9235 !! input
9236 this is not the the title
9237 !! result
9238 Screen
9239 <p>this is not the the title
9240 </p>
9241 !! end
9242
9243 !! test
9244 preload: check <noinclude> and <includeonly>
9245 !! options
9246 preload
9247 !! input
9248 Hello <noinclude>cruel</noinclude><includeonly>kind</includeonly> world.
9249 !! result
9250 Hello kind world.
9251 !! end
9252
9253 !! test
9254 preload: check <onlyinclude>
9255 !! options
9256 preload
9257 !! input
9258 Goodbye <onlyinclude>Hello world</onlyinclude>
9259 !! result
9260 Hello world
9261 !! end
9262
9263 !! test
9264 preload: can pass tags through if we want to
9265 !! options
9266 preload
9267 !! input
9268 <includeonly><</includeonly>includeonly>Hello world<includeonly><</includeonly>/includeonly>
9269 !! result
9270 <includeonly>Hello world</includeonly>
9271 !! end
9272
9273 !! test
9274 preload: check that it doesn't try to do tricks
9275 !! options
9276 preload
9277 !! input
9278 * <!-- Hello --> ''{{world}}'' {{<includeonly>subst:</includeonly>How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
9279 !! result
9280 * <!-- Hello --> ''{{world}}'' {{subst:How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
9281 !! end
9282
9283 !! test
9284 Play a bit with r67090 and bug 3158
9285 !! options
9286 disabled
9287 !! input
9288 <div style="width:50% !important">&nbsp;</div>
9289 <div style="width:50%&nbsp;!important">&nbsp;</div>
9290 <div style="width:50%&#160;!important">&nbsp;</div>
9291 <div style="border : solid;">&nbsp;</div>
9292 !! result
9293 <div style="width:50% !important">&nbsp;</div>
9294 <div style="width:50% !important">&nbsp;</div>
9295 <div style="width:50% !important">&nbsp;</div>
9296 <div style="border&#160;: solid;">&nbsp;</div>
9297
9298 !! end
9299
9300 !! test
9301 HTML5 data attributes
9302 !! input
9303 <span data-foo="bar">Baz</span>
9304 <p data-abc-def_hij="">Quuz</p>
9305 !! result
9306 <p><span data-foo="bar">Baz</span>
9307 </p>
9308 <p data-abc-def_hij="">Quuz</p>
9309
9310 !! end
9311
9312 !! test
9313 percent-encoding and + signs in internal links (Bug 26410)
9314 !! input
9315 [[User:+%]] [[Page+title%]]
9316 [[%+]] [[%+|%20]] [[%+ ]] [[%+r]]
9317 [[%]] [[+]] [[image:%+abc%39|foo|[[bar]]]]
9318 [[%33%45]] [[%33%45+]]
9319 !! result
9320 <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>
9321 <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>
9322 <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>
9323 <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>
9324 </p>
9325 !! end
9326
9327 !! test
9328 Special characters in embedded file links (bug 27679)
9329 !! input
9330 [[File:Contains & ampersand.jpg]]
9331 [[File:Does not exist.jpg|Title with & ampersand]]
9332 !! result
9333 <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>
9334 <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>
9335 </p>
9336 !! end
9337
9338
9339 !! test
9340 Confirm that 'apos' named character reference doesn't make it to output (not legal in HTML 4)
9341 !! input
9342 Text&apos;s been normalized?
9343 !! result
9344 <p>Text&#39;s been normalized?
9345 </p>
9346 !! end
9347
9348 !! test
9349 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate free external links
9350 !! input
9351 http://www.example.org/ <-- U+3000 (vim: ^Vu3000)
9352 !! result
9353 <p><a rel="nofollow" class="external free" href="http://www.example.org/">http://www.example.org/</a> &lt;-- U+3000 (vim: ^Vu3000)
9354 </p>
9355 !! end
9356
9357 !! test
9358 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate bracketed external links
9359 !! input
9360 [http://www.example.org/ ideograms]
9361 !! result
9362 <p><a rel="nofollow" class="external text" href="http://www.example.org/">ideograms</a>
9363 </p>
9364 !! end
9365
9366 !! test
9367 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate external images links
9368 !! input
9369 http://www.example.org/pic.png <-- U+3000 (vim: ^Vu3000)
9370 !! result
9371 <p><img src="http://www.example.org/pic.png" alt="pic.png" /> &lt;-- U+3000 (vim: ^Vu3000)
9372 </p>
9373 !! end
9374
9375 TODO:
9376 more images
9377 more tables
9378 math
9379 character entities
9380 and much more
9381 Try for 100% code coverage