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