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