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