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