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