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