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