9a3d98cefd78c0a9c0cf3304bcd828bd797d009a
[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") based on current page
3003 !! options
3004 pst
3005 !! input
3006 [[#section|]]
3007 [[#section (context)|]]
3008 [[/relative|]]
3009 [[../context/relative|]]
3010 [[../context/relative (extra)|]]
3011 !! result
3012 [[#section|section]]
3013 [[#section (context)|section]]
3014 [[/relative|relative]]
3015 [[../context/relative|relative]]
3016 [[../context/relative (extra)|relative]]
3017 !! end
3018
3019 !! test
3020 pre-save transform: context links ("pipe trick") with full-width characters
3021 !! options
3022 pst
3023 !! input
3024 [[title, context|]]
3025 [[title (context)|]]
3026 !! result
3027 [[title, context|title]]
3028 [[title (context)|title]]
3029 !! end
3030
3031 !! test
3032 pre-save transform: context links ("pipe trick") with interwiki prefix
3033 !! options
3034 pst
3035 !! input
3036 [[interwiki:Article|]]
3037 [[:interwiki:Article|]]
3038 [[interwiki:Bar:Article|]]
3039 [[:interwiki:Bar:Article|]]
3040 !! result
3041 [[interwiki:Article|Article]]
3042 [[:interwiki:Article|Article]]
3043 [[interwiki:Bar:Article|Bar:Article]]
3044 [[:interwiki:Bar:Article|Bar:Article]]
3045 !! end
3046
3047 !! test
3048 pre-save transform: context links ("pipe trick") with parens in title
3049 !! options
3050 pst title=[[Somearticle (context)]]
3051 !! input
3052 [[|Article]]
3053 !! result
3054 [[Article (context)|Article]]
3055 !! end
3056
3057 !! test
3058 pre-save transform: context links ("pipe trick") with comma in title
3059 !! options
3060 pst title=[[Someplace, Somewhere]]
3061 !! input
3062 [[|Otherplace]]
3063 [[Otherplace, Elsewhere|]]
3064 [[Otherplace, Elsewhere, Anywhere|]]
3065 !! result
3066 [[Otherplace, Somewhere|Otherplace]]
3067 [[Otherplace, Elsewhere|Otherplace]]
3068 [[Otherplace, Elsewhere, Anywhere|Otherplace]]
3069 !! end
3070
3071 !! test
3072 pre-save transform: context links ("pipe trick") with parens and comma
3073 !! options
3074 pst title=[[Someplace (IGNORED), Somewhere]]
3075 !! input
3076 [[|Otherplace]]
3077 [[Otherplace (place), Elsewhere|]]
3078 !! result
3079 [[Otherplace, Somewhere|Otherplace]]
3080 [[Otherplace (place), Elsewhere|Otherplace]]
3081 !! end
3082
3083 !! test
3084 pre-save transform: context links ("pipe trick") with comma and parens
3085 !! options
3086 pst title=[[Who, me? (context)]]
3087 !! input
3088 [[|Yes, you.]]
3089 [[Me, Myself, and I (1937 song)|]]
3090 !! result
3091 [[Yes, you. (context)|Yes, you.]]
3092 [[Me, Myself, and I (1937 song)|Me, Myself, and I]]
3093 !! end
3094
3095 !! test
3096 pre-save transform: context links ("pipe trick") with namespace
3097 !! options
3098 pst title=[[Ns:Somearticle]]
3099 !! input
3100 [[|Article]]
3101 !! result
3102 [[Ns:Article|Article]]
3103 !! end
3104
3105 !! test
3106 pre-save transform: context links ("pipe trick") with namespace and parens
3107 !! options
3108 pst title=[[Ns:Somearticle (context)]]
3109 !! input
3110 [[|Article]]
3111 !! result
3112 [[Ns:Article (context)|Article]]
3113 !! end
3114
3115 !! test
3116 pre-save transform: context links ("pipe trick") with namespace and comma
3117 !! options
3118 pst title=[[Ns:Somearticle, Context, Whatever]]
3119 !! input
3120 [[|Article]]
3121 !! result
3122 [[Ns:Article, Context, Whatever|Article]]
3123 !! end
3124
3125 !! test
3126 pre-save transform: context links ("pipe trick") with namespace, comma and parens
3127 !! options
3128 pst title=[[Ns:Somearticle, Context (context)]]
3129 !! input
3130 [[|Article]]
3131 !! result
3132 [[Ns:Article (context)|Article]]
3133 !! end
3134
3135 !! test
3136 pre-save transform: context links ("pipe trick") with namespace, parens and comma
3137 !! options
3138 pst title=[[Ns:Somearticle (IGNORED), Context]]
3139 !! input
3140 [[|Article]]
3141 !! result
3142 [[Ns:Article, Context|Article]]
3143 !! end
3144
3145 !! test
3146 pre-save transform: context links ("pipe trick") with url escaped page names
3147 !! options
3148 pst
3149 !! input
3150 [[Hello wo%52ld|]]
3151 [[Hello wo%52ld (again)|]]
3152 !! result
3153 [[Hello wo%52ld|Hello woRld]]
3154 [[Hello wo%52ld (again)|Hello woRld]]
3155 !! end
3156
3157 !! test
3158 pre-save transform: context links ("pipe trick") with variables are not pre-empted
3159 !! options
3160 pst title=[[Test (page)]]
3161 !! input
3162 [[{{{1|}}}|]]
3163 [[|{{{1|}}}]]
3164 [[{{subst:PAGENAME}}|]]
3165 !! result
3166 [[{{{1|}}}|]]
3167 [[|{{{1|}}}]]
3168 [[Test (page)|Test]]
3169 !! end
3170
3171 !! article
3172 Template:pipetest
3173 !! text
3174 [[{{{1}}}|]]
3175 !! endarticle
3176
3177 !! article
3178 Template:testpipe
3179 !! text
3180 [[|{{{1}}}]]
3181 !! endarticle
3182
3183 !! test
3184 ("pipe trick") should work outside PST
3185 !!options
3186 title=[[Help:hello (world)]]
3187 !! input
3188 {{pipetest|hi (world)}}
3189 {{pipetest|hi (world), world}}
3190 {{pipetest|Help:hi (world), world}}
3191 {{pipetest|:Help:hi (world), world}}
3192 {{testpipe|hi}}
3193 [[{{PAGENAME}}|]]
3194 !! result
3195 <p><a href="/index.php?title=Hi_(world)&amp;action=edit&amp;redlink=1" class="new" title="Hi (world) (page does not exist)">hi</a>
3196 <a href="/index.php?title=Hi_(world),_world&amp;action=edit&amp;redlink=1" class="new" title="Hi (world), world (page does not exist)">hi</a>
3197 <a href="/index.php?title=Help:Hi_(world),_world&amp;action=edit&amp;redlink=1" class="new" title="Help:Hi (world), world (page does not exist)">hi</a>
3198 <a href="/index.php?title=Help:Hi_(world),_world&amp;action=edit&amp;redlink=1" class="new" title="Help:Hi (world), world (page does not exist)">hi</a>
3199 <a href="/index.php?title=Hi_(world)&amp;action=edit&amp;redlink=1" class="new" title="Hi (world) (page does not exist)">hi</a>
3200 <a href="/index.php?title=Hello_(world)&amp;action=edit&amp;redlink=1" class="new" title="Hello (world) (page does not exist)">Hello</a>
3201 </p>
3202 !! end
3203
3204
3205 ###
3206 ### Message transform tests
3207 ###
3208 !! test
3209 message transform: magic variables
3210 !! options
3211 msg
3212 !! input
3213 {{SITENAME}}
3214 !! result
3215 MediaWiki
3216 !! end
3217
3218 !! test
3219 message transform: should not transform wiki markup
3220 !! options
3221 msg
3222 !! input
3223 ''test''
3224 !! result
3225 ''test''
3226 !! end
3227
3228 !! test
3229 message transform: <noinclude> in transcluded template (bug 4926)
3230 !! options
3231 msg
3232 !! input
3233 {{Includes}}
3234 !! result
3235 Foobar
3236 !! end
3237
3238 !! test
3239 message transform: <onlyinclude> in transcluded template (bug 4926)
3240 !! options
3241 msg
3242 !! input
3243 {{Includes2}}
3244 !! result
3245 Foo
3246 !! end
3247
3248 !! test
3249 {{#special:}} page name, known
3250 !! options
3251 msg
3252 !! input
3253 {{#special:Recentchanges}}
3254 !! result
3255 Special:RecentChanges
3256 !! end
3257
3258 !! test
3259 {{#special:}} page name, unknown
3260 !! options
3261 msg
3262 !! input
3263 {{#special:foobarnonexistent}}
3264 !! result
3265 No such special page
3266 !! end
3267
3268 ###
3269 ### Images
3270 ###
3271 !! test
3272 Simple image
3273 !! input
3274 [[Image:foobar.jpg]]
3275 !! result
3276 <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>
3277 </p>
3278 !! end
3279
3280 !! test
3281 Right-aligned image
3282 !! input
3283 [[Image:foobar.jpg|right]]
3284 !! result
3285 <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>
3286
3287 !! end
3288
3289 !! test
3290 Simple image (using File: namespace, now canonical)
3291 !! input
3292 [[File:foobar.jpg]]
3293 !! result
3294 <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>
3295 </p>
3296 !! end
3297
3298 !! test
3299 Image with caption
3300 !! input
3301 [[Image:foobar.jpg|right|Caption text]]
3302 !! result
3303 <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>
3304
3305 !! end
3306
3307 !! test
3308 Image with link parameter, wiki target
3309 !! input
3310 [[Image:foobar.jpg|link=Target page]]
3311 !! result
3312 <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>
3313 </p>
3314 !! end
3315
3316 !! test
3317 Image with link parameter, URL target
3318 !! input
3319 [[Image:foobar.jpg|link=http://example.com/]]
3320 !! result
3321 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
3322 </p>
3323 !! end
3324
3325 !! test
3326 Image with empty link parameter
3327 !! input
3328 [[Image:foobar.jpg|link=]]
3329 !! result
3330 <p><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" />
3331 </p>
3332 !! end
3333
3334 !! test
3335 Image with link parameter (wiki target) and unnamed parameter
3336 !! input
3337 [[Image:foobar.jpg|link=Target page|Title]]
3338 !! result
3339 <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>
3340 </p>
3341 !! end
3342
3343 !! test
3344 Image with link parameter (URL target) and unnamed parameter
3345 !! input
3346 [[Image:foobar.jpg|link=http://example.com/|Title]]
3347 !! result
3348 <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>
3349 </p>
3350 !! end
3351
3352
3353
3354 !! test
3355 Image with frame and link
3356 !! input
3357 [[Image:Foobar.jpg|frame|left|This is a test image [[Main Page]]]]
3358 !! result
3359 <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>
3360
3361 !! end
3362
3363 !! test
3364 Image with frame and link and explicit alt
3365 !! input
3366 [[Image:Foobar.jpg|frame|left|This is a test image [[Main Page]]|alt=Altitude]]
3367 !! result
3368 <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>
3369
3370 !! end
3371
3372 !! test
3373 Image with wiki markup in implicit alt
3374 !! input
3375 [[Image:Foobar.jpg|testing '''bold''' in alt]]
3376 !! result
3377 <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>
3378 </p>
3379 !! end
3380
3381 !! test
3382 Image with wiki markup in explicit alt
3383 !! input
3384 [[Image:Foobar.jpg|alt=testing '''bold''' in alt]]
3385 !! result
3386 <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>
3387 </p>
3388 !! end
3389
3390 !! test
3391 Link to image page- image page normally doesn't exists, hence edit link
3392 Add test with existing image page
3393 #<p><a href="/wiki/File:Test" title="Image:Test">Image:test</a>
3394 !! input
3395 [[:Image:test]]
3396 !! result
3397 <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>
3398 </p>
3399 !! end
3400
3401 !! test
3402 bug 18784 Link to non-existent image page with caption should use caption as link text
3403 !! input
3404 [[:Image:test|caption]]
3405 !! result
3406 <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>
3407 </p>
3408 !! end
3409
3410 !! test
3411 Frameless image caption with a free URL
3412 !! input
3413 [[Image:foobar.jpg|http://example.com]]
3414 !! result
3415 <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>
3416 </p>
3417 !! end
3418
3419 !! test
3420 Thumbnail image caption with a free URL
3421 !! input
3422 [[Image:foobar.jpg|thumb|http://example.com]]
3423 !! result
3424 <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>
3425
3426 !! end
3427
3428 !! test
3429 Thumbnail image caption with a free URL and explicit alt
3430 !! input
3431 [[Image:foobar.jpg|thumb|http://example.com|alt=Alteration]]
3432 !! result
3433 <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>
3434
3435 !! end
3436
3437 !! test
3438 BUG 1887: A ISBN with a thumbnail
3439 !! input
3440 [[Image:foobar.jpg|thumb|ISBN 1235467890]]
3441 !! result
3442 <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>
3443
3444 !! end
3445
3446 !! test
3447 BUG 1887: A RFC with a thumbnail
3448 !! input
3449 [[Image:foobar.jpg|thumb|This is RFC 12354]]
3450 !! result
3451 <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>
3452
3453 !! end
3454
3455 !! test
3456 BUG 1887: A mailto link with a thumbnail
3457 !! input
3458 [[Image:foobar.jpg|thumb|Please mailto:nobody@example.com]]
3459 !! result
3460 <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>
3461
3462 !! end
3463
3464 !! test
3465 BUG 1887: A <math> with a thumbnail- we don't render math in the parsertests by default,
3466 so math is not stripped and turns up as escaped &lt;math&gt; tags.
3467 !! input
3468 [[Image:foobar.jpg|thumb|<math>2+2</math>]]
3469 !! result
3470 <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>
3471
3472 !! end
3473
3474 !! test
3475 BUG 1887, part 2: A <math> with a thumbnail- math enabled
3476 !! options
3477 math
3478 !! input
3479 [[Image:foobar.jpg|thumb|<math>2+2</math>]]
3480 !! result
3481 <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>
3482
3483 !! end
3484
3485 # Pending resolution to bug 368
3486 !! test
3487 BUG 648: Frameless image caption with a link
3488 !! input
3489 [[Image:foobar.jpg|text with a [[link]] in it]]
3490 !! result
3491 <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>
3492 </p>
3493 !! end
3494
3495 !! test
3496 BUG 648: Frameless image caption with a link (suffix)
3497 !! input
3498 [[Image:foobar.jpg|text with a [[link]]foo in it]]
3499 !! result
3500 <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>
3501 </p>
3502 !! end
3503
3504 !! test
3505 BUG 648: Frameless image caption with an interwiki link
3506 !! input
3507 [[Image:foobar.jpg|text with a [[MeatBall:Link]] in it]]
3508 !! result
3509 <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>
3510 </p>
3511 !! end
3512
3513 !! test
3514 BUG 648: Frameless image caption with a piped interwiki link
3515 !! input
3516 [[Image:foobar.jpg|text with a [[MeatBall:Link|link]] in it]]
3517 !! result
3518 <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>
3519 </p>
3520 !! end
3521
3522 !! test
3523 Escape HTML special chars in image alt text
3524 !! input
3525 [[Image:foobar.jpg|& < > "]]
3526 !! result
3527 <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>
3528 </p>
3529 !! end
3530
3531 !! test
3532 BUG 499: Alt text should have &#1234;, not &amp;1234;
3533 !! input
3534 [[Image:foobar.jpg|&#9792;]]
3535 !! result
3536 <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>
3537 </p>
3538 !! end
3539
3540 !! test
3541 Broken image caption with link
3542 !! input
3543 [[Image:Foobar.jpg|thumb|This is a broken caption. But [[Main Page|this]] is just an ordinary link.
3544 !! result
3545 <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.
3546 </p>
3547 !! end
3548
3549 !! test
3550 Image caption containing another image
3551 !! input
3552 [[Image:Foobar.jpg|thumb|This is a caption with another [[Image:icon.png|image]] inside it!]]
3553 !! result
3554 <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>
3555
3556 !! end
3557
3558 !! test
3559 Image caption containing a newline
3560 !! input
3561 [[Image:Foobar.jpg|This
3562 *is some text]]
3563 !! result
3564 <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>
3565 </p>
3566 !!end
3567
3568
3569 !! test
3570 Bug 3090: External links other than http: in image captions
3571 !! input
3572 [[Image:Foobar.jpg|thumb|200px|This caption has [irc://example.net irc] and [https://example.com Secure] ext links in it.]]
3573 !! result
3574 <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>
3575
3576 !! end
3577
3578
3579 ###
3580 ### Subpages
3581 ###
3582 !! article
3583 Subpage test/subpage
3584 !! text
3585 foo
3586 !! endarticle
3587
3588 !! test
3589 Subpage link
3590 !! options
3591 subpage title=[[Subpage test]]
3592 !! input
3593 [[/subpage]]
3594 !! result
3595 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a>
3596 </p>
3597 !! end
3598
3599 !! test
3600 Subpage noslash link
3601 !! options
3602 subpage title=[[Subpage test]]
3603 !!input
3604 [[/subpage/]]
3605 !! result
3606 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">subpage</a>
3607 </p>
3608 !! end
3609
3610 !! test
3611 Disabled subpages
3612 !! input
3613 [[/subpage]]
3614 !! result
3615 <p><a href="/index.php?title=/subpage&amp;action=edit&amp;redlink=1" class="new" title="/subpage (page does not exist)">/subpage</a>
3616 </p>
3617 !! end
3618
3619 !! test
3620 BUG 561: {{/Subpage}}
3621 !! options
3622 subpage title=[[Page]]
3623 !! input
3624 {{/Subpage}}
3625 !! result
3626 <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>
3627 </p>
3628 !! end
3629
3630 ###
3631 ### Categories
3632 ###
3633 !! article
3634 Category:MediaWiki User's Guide
3635 !! text
3636 blah
3637 !! endarticle
3638
3639 !! test
3640 Link to category
3641 !! input
3642 [[:Category:MediaWiki User's Guide]]
3643 !! result
3644 <p><a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">Category:MediaWiki User's Guide</a>
3645 </p>
3646 !! end
3647
3648 !! test
3649 Simple category
3650 !! options
3651 cat
3652 !! input
3653 [[Category:MediaWiki User's Guide]]
3654 !! result
3655 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
3656 !! end
3657
3658 !! test
3659 PAGESINCATEGORY invalid title fatal (r33546 fix)
3660 !! input
3661 {{PAGESINCATEGORY:<bogus>}}
3662 !! result
3663 <p>0
3664 </p>
3665 !! end
3666
3667 ###
3668 ### Inter-language links
3669 ###
3670 !! test
3671 Inter-language links
3672 !! options
3673 ill
3674 !! input
3675 [[es:Alimento]]
3676 [[fr:Nourriture]]
3677 [[zh:&#39135;&#21697;]]
3678 !! result
3679 es:Alimento fr:Nourriture zh:食品
3680 !! end
3681
3682 ###
3683 ### Sections
3684 ###
3685 !! test
3686 Basic section headings
3687 !! input
3688 == Headline 1 ==
3689 Some text
3690
3691 ==Headline 2==
3692 More
3693 ===Smaller headline===
3694 Blah blah
3695 !! result
3696 <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>
3697 <p>Some text
3698 </p>
3699 <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>
3700 <p>More
3701 </p>
3702 <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>
3703 <p>Blah blah
3704 </p>
3705 !! end
3706
3707 !! test
3708 Section headings with TOC
3709 !! input
3710 == Headline 1 ==
3711 === Subheadline 1 ===
3712 ===== Skipping a level =====
3713 ====== Skipping a level ======
3714
3715 == Headline 2 ==
3716 Some text
3717 ===Another headline===
3718 !! result
3719 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
3720 <ul>
3721 <li class="toclevel-1 tocsection-1"><a href="#Headline_1"><span class="tocnumber">1</span> <span class="toctext">Headline 1</span></a>
3722 <ul>
3723 <li class="toclevel-2 tocsection-2"><a href="#Subheadline_1"><span class="tocnumber">1.1</span> <span class="toctext">Subheadline 1</span></a>
3724 <ul>
3725 <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>
3726 <ul>
3727 <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>
3728 </ul>
3729 </li>
3730 </ul>
3731 </li>
3732 </ul>
3733 </li>
3734 <li class="toclevel-1 tocsection-5"><a href="#Headline_2"><span class="tocnumber">2</span> <span class="toctext">Headline 2</span></a>
3735 <ul>
3736 <li class="toclevel-2 tocsection-6"><a href="#Another_headline"><span class="tocnumber">2.1</span> <span class="toctext">Another headline</span></a></li>
3737 </ul>
3738 </li>
3739 </ul>
3740 </td></tr></table><script>if (window.showTocToggle) { var tocShowText = "show"; var tocHideText = "hide"; showTocToggle(); } </script>
3741 <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>
3742 <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>
3743 <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>
3744 <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>
3745 <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>
3746 <p>Some text
3747 </p>
3748 <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>
3749
3750 !! end
3751
3752 # perl -e 'print "="x$_," Level $_ heading","="x$_,"\n" for 1..10'
3753 !! test
3754 Handling of sections up to level 6 and beyond
3755 !! input
3756 = Level 1 Heading=
3757 == Level 2 Heading==
3758 === Level 3 Heading===
3759 ==== Level 4 Heading====
3760 ===== Level 5 Heading=====
3761 ====== Level 6 Heading======
3762 ======= Level 7 Heading=======
3763 ======== Level 8 Heading========
3764 ========= Level 9 Heading=========
3765 ========== Level 10 Heading==========
3766 !! result
3767 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
3768 <ul>
3769 <li class="toclevel-1 tocsection-1"><a href="#Level_1_Heading"><span class="tocnumber">1</span> <span class="toctext">Level 1 Heading</span></a>
3770 <ul>
3771 <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>
3772 <ul>
3773 <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>
3774 <ul>
3775 <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>
3776 <ul>
3777 <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>
3778 <ul>
3779 <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>
3780 <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>
3781 <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>
3782 <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>
3783 <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>
3784 </ul>
3785 </li>
3786 </ul>
3787 </li>
3788 </ul>
3789 </li>
3790 </ul>
3791 </li>
3792 </ul>
3793 </li>
3794 </ul>
3795 </td></tr></table><script>if (window.showTocToggle) { var tocShowText = "show"; var tocHideText = "hide"; showTocToggle(); } </script>
3796 <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>
3797 <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>
3798 <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>
3799 <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>
3800 <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>
3801 <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>
3802 <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>
3803 <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>
3804 <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>
3805 <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>
3806
3807 !! end
3808
3809 !! test
3810 TOC regression (bug 9764)
3811 !! input
3812 == title 1 ==
3813 === title 1.1 ===
3814 ==== title 1.1.1 ====
3815 === title 1.2 ===
3816 == title 2 ==
3817 === title 2.1 ===
3818 !! result
3819 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
3820 <ul>
3821 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
3822 <ul>
3823 <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>
3824 <ul>
3825 <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>
3826 </ul>
3827 </li>
3828 <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>
3829 </ul>
3830 </li>
3831 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
3832 <ul>
3833 <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>
3834 </ul>
3835 </li>
3836 </ul>
3837 </td></tr></table><script>if (window.showTocToggle) { var tocShowText = "show"; var tocHideText = "hide"; showTocToggle(); } </script>
3838 <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>
3839 <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>
3840 <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>
3841 <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>
3842 <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>
3843 <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>
3844
3845 !! end
3846
3847 !! test
3848 TOC with wgMaxTocLevel=3 (bug 6204)
3849 !! options
3850 wgMaxTocLevel=3
3851 !! input
3852 == title 1 ==
3853 === title 1.1 ===
3854 ==== title 1.1.1 ====
3855 === title 1.2 ===
3856 == title 2 ==
3857 === title 2.1 ===
3858 !! result
3859 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
3860 <ul>
3861 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
3862 <ul>
3863 <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>
3864 <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>
3865 </ul>
3866 </li>
3867 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
3868 <ul>
3869 <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>
3870 </ul>
3871 </li>
3872 </ul>
3873 </td></tr></table><script>if (window.showTocToggle) { var tocShowText = "show"; var tocHideText = "hide"; showTocToggle(); } </script>
3874 <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>
3875 <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>
3876 <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>
3877 <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>
3878 <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>
3879 <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>
3880
3881 !! end
3882
3883 !! test
3884 Resolving duplicate section names
3885 !! input
3886 == Foo bar ==
3887 == Foo bar ==
3888 !! result
3889 <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>
3890 <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>
3891
3892 !! end
3893
3894 !! test
3895 Resolving duplicate section names with differing case (bug 10721)
3896 !! input
3897 == Foo bar ==
3898 == Foo Bar ==
3899 !! result
3900 <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>
3901 <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>
3902
3903 !! end
3904
3905 !! article
3906 Template:sections
3907 !! text
3908 ===Section 1===
3909 ==Section 2==
3910 !! endarticle
3911
3912 !! test
3913 Template with sections, __NOTOC__
3914 !! input
3915 __NOTOC__
3916 ==Section 0==
3917 {{sections}}
3918 ==Section 4==
3919 !! result
3920 <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>
3921 <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>
3922 <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>
3923 <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>
3924
3925 !! end
3926
3927 !! test
3928 __NOEDITSECTION__ keyword
3929 !! input
3930 __NOEDITSECTION__
3931 ==Section 1==
3932 ==Section 2==
3933 !! result
3934 <h2> <span class="mw-headline" id="Section_1">Section 1</span></h2>
3935 <h2> <span class="mw-headline" id="Section_2">Section 2</span></h2>
3936
3937 !! end
3938
3939 !! test
3940 Link inside a section heading
3941 !! input
3942 ==Section with a [[Main Page|link]] in it==
3943 !! result
3944 <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>
3945
3946 !! end
3947
3948 !! test
3949 TOC regression (bug 12077)
3950 !! input
3951 __TOC__
3952 == title 1 ==
3953 === title 1.1 ===
3954 == title 2 ==
3955 !! result
3956 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
3957 <ul>
3958 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
3959 <ul>
3960 <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>
3961 </ul>
3962 </li>
3963 <li class="toclevel-1 tocsection-3"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a></li>
3964 </ul>
3965 </td></tr></table><script>if (window.showTocToggle) { var tocShowText = "show"; var tocHideText = "hide"; showTocToggle(); } </script>
3966 <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>
3967 <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>
3968 <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>
3969
3970 !! end
3971
3972 !! test
3973 BUG 1219 URL next to image (good)
3974 !! input
3975 http://example.com [[Image:foobar.jpg]]
3976 !! result
3977 <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>
3978 </p>
3979 !!end
3980
3981 !! test
3982 BUG 1219 URL next to image (broken)
3983 !! input
3984 http://example.com[[Image:foobar.jpg]]
3985 !! result
3986 <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>
3987 </p>
3988 !!end
3989
3990 !! test
3991 Bug 1186 news: in the middle of text
3992 !! input
3993 http://en.wikinews.org/wiki/Wikinews:Workplace
3994 !! result
3995 <p><a href="http://en.wikinews.org/wiki/Wikinews:Workplace" class="external free" rel="nofollow">http://en.wikinews.org/wiki/Wikinews:Workplace</a>
3996 </p>
3997 !!end
3998
3999
4000 !! test
4001 Namespaced link must have a title
4002 !! input
4003 [[Project:]]
4004 !! result
4005 <p>[[Project:]]
4006 </p>
4007 !!end
4008
4009 !! test
4010 Namespaced link must have a title (bad fragment version)
4011 !! input
4012 [[Project:#fragment]]
4013 !! result
4014 <p>[[Project:#fragment]]
4015 </p>
4016 !!end
4017
4018
4019 !! test
4020 div with no attributes
4021 !! input
4022 <div>HTML rocks</div>
4023 !! result
4024 <div>HTML rocks</div>
4025
4026 !! end
4027
4028 !! test
4029 div with double-quoted attribute
4030 !! input
4031 <div id="rock">HTML rocks</div>
4032 !! result
4033 <div id="rock">HTML rocks</div>
4034
4035 !! end
4036
4037 !! test
4038 div with single-quoted attribute
4039 !! input
4040 <div id='rock'>HTML rocks</div>
4041 !! result
4042 <div id="rock">HTML rocks</div>
4043
4044 !! end
4045
4046 !! test
4047 div with unquoted attribute
4048 !! input
4049 <div id=rock>HTML rocks</div>
4050 !! result
4051 <div id="rock">HTML rocks</div>
4052
4053 !! end
4054
4055 !! test
4056 div with illegal double attributes
4057 !! input
4058 <div align="center" align="right">HTML rocks</div>
4059 !! result
4060 <div align="right">HTML rocks</div>
4061
4062 !!end
4063
4064 !! test
4065 HTML multiple attributes correction
4066 !! input
4067 <p class="error" class="awesome">Awesome!</p>
4068 !! result
4069 <p class="awesome">Awesome!</p>
4070
4071 !!end
4072
4073 !! test
4074 Table multiple attributes correction
4075 !! input
4076 {|
4077 !+ class="error" class="awesome"| status
4078 |}
4079 !! result
4080 <table>
4081 <tr>
4082 <th class="awesome"> status
4083 </th></tr></table>
4084
4085 !!end
4086
4087 !! test
4088 DIV IN UPPERCASE
4089 !! input
4090 <DIV ALIGN="center">HTML ROCKS</DIV>
4091 !! result
4092 <div align="center">HTML ROCKS</div>
4093
4094 !!end
4095
4096
4097 !! test
4098 text with amp in the middle of nowhere
4099 !! input
4100 Remember AT&T?
4101 !!result
4102 <p>Remember AT&amp;T?
4103 </p>
4104 !! end
4105
4106 !! test
4107 text with character entity: eacute
4108 !! input
4109 I always thought &eacute; was a cute letter.
4110 !! result
4111 <p>I always thought &eacute; was a cute letter.
4112 </p>
4113 !! end
4114
4115 !! test
4116 text with undefined character entity: xacute
4117 !! input
4118 I always thought &xacute; was a cute letter.
4119 !! result
4120 <p>I always thought &amp;xacute; was a cute letter.
4121 </p>
4122 !! end
4123
4124
4125 ###
4126 ### Media links
4127 ###
4128
4129 !! test
4130 Media link
4131 !! input
4132 [[Media:Foobar.jpg]]
4133 !! result
4134 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Media:Foobar.jpg</a>
4135 </p>
4136 !! end
4137
4138 !! test
4139 Media link with text
4140 !! input
4141 [[Media:Foobar.jpg|A neat file to look at]]
4142 !! result
4143 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">A neat file to look at</a>
4144 </p>
4145 !! end
4146
4147 # FIXME: this is still bad HTML tag nesting
4148 !! test
4149 Media link with nasty text
4150 fixme: doBlockLevels won't wrap this in a paragraph because it contains a div
4151 !! input
4152 [[Media:Foobar.jpg|Safe Link<div style=display:none>" onmouseover="alert(document.cookie)" onfoo="</div>]]
4153 !! result
4154 <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>
4155
4156 !! end
4157
4158 !! test
4159 Media link to nonexistent file (bug 1702)
4160 !! input
4161 [[Media:No such.jpg]]
4162 !! result
4163 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=No_such.jpg" class="new" title="No such.jpg">Media:No such.jpg</a>
4164 </p>
4165 !! end
4166
4167 !! test
4168 Image link to nonexistent file (bug 1850 - good)
4169 !! input
4170 [[Image:No such.jpg]]
4171 !! result
4172 <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>
4173 </p>
4174 !! end
4175
4176 !! test
4177 :Image link to nonexistent file (bug 1850 - bad)
4178 !! input
4179 [[:Image:No such.jpg]]
4180 !! result
4181 <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>
4182 </p>
4183 !! end
4184
4185
4186
4187 !! test
4188 Character reference normalization in link text (bug 1938)
4189 !! input
4190 [[Main Page|this&that]]
4191 !! result
4192 <p><a href="/wiki/Main_Page" title="Main Page">this&amp;that</a>
4193 </p>
4194 !!end
4195
4196 !! test
4197 Empty attribute crash test (bug 2067)
4198 !! input
4199 <font color="">foo</font>
4200 !! result
4201 <p><font color="">foo</font>
4202 </p>
4203 !! end
4204
4205 !! test
4206 Empty attribute crash test single-quotes (bug 2067)
4207 !! input
4208 <font color=''>foo</font>
4209 !! result
4210 <p><font color="">foo</font>
4211 </p>
4212 !! end
4213
4214 !! test
4215 Attribute test: equals, then nothing
4216 !! input
4217 <font color=>foo</font>
4218 !! result
4219 <p><font>foo</font>
4220 </p>
4221 !! end
4222
4223 !! test
4224 Attribute test: unquoted value
4225 !! input
4226 <font color=x>foo</font>
4227 !! result
4228 <p><font color="x">foo</font>
4229 </p>
4230 !! end
4231
4232 !! test
4233 Attribute test: unquoted but illegal value (hash)
4234 !! input
4235 <font color=#x>foo</font>
4236 !! result
4237 <p><font color="#x">foo</font>
4238 </p>
4239 !! end
4240
4241 !! test
4242 Attribute test: no value
4243 !! input
4244 <font color>foo</font>
4245 !! result
4246 <p><font color="color">foo</font>
4247 </p>
4248 !! end
4249
4250 !! test
4251 Bug 2095: link with three closing brackets
4252 !! input
4253 [[Main Page]]]
4254 !! result
4255 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>]
4256 </p>
4257 !! end
4258
4259 !! test
4260 Bug 2095: link with pipe and three closing brackets
4261 !! input
4262 [[Main Page|link]]]
4263 !! result
4264 <p><a href="/wiki/Main_Page" title="Main Page">link</a>]
4265 </p>
4266 !! end
4267
4268 !! test
4269 Bug 2095: link with pipe and three closing brackets, version 2
4270 !! input
4271 [[Main Page|[http://example.com/]]]
4272 !! result
4273 <p><a href="/wiki/Main_Page" title="Main Page">[http://example.com/]</a>
4274 </p>
4275 !! end
4276
4277
4278 ###
4279 ### Safety
4280 ###
4281
4282 !! article
4283 Template:Dangerous attribute
4284 !! text
4285 " onmouseover="alert(document.cookie)
4286 !! endarticle
4287
4288 !! article
4289 Template:Dangerous style attribute
4290 !! text
4291 border-size: expression(alert(document.cookie))
4292 !! endarticle
4293
4294 !! article
4295 Template:Div style
4296 !! text
4297 <div style="float: right; {{{1}}}">Magic div</div>
4298 !! endarticle
4299
4300 !! test
4301 Bug 2304: HTML attribute safety (safe template; regression bug 2309)
4302 !! input
4303 <div title="{{test}}"></div>
4304 !! result
4305 <div title="This is a test template"></div>
4306
4307 !! end
4308
4309 !! test
4310 Bug 2304: HTML attribute safety (dangerous template; 2309)
4311 !! input
4312 <div title="{{dangerous attribute}}"></div>
4313 !! result
4314 <div title=""></div>
4315
4316 !! end
4317
4318 !! test
4319 Bug 2304: HTML attribute safety (dangerous style template; 2309)
4320 !! input
4321 <div style="{{dangerous style attribute}}"></div>
4322 !! result
4323 <div></div>
4324
4325 !! end
4326
4327 !! test
4328 Bug 2304: HTML attribute safety (safe parameter; 2309)
4329 !! input
4330 {{div style|width: 200px}}
4331 !! result
4332 <div style="float: right; width: 200px">Magic div</div>
4333
4334 !! end
4335
4336 !! test
4337 Bug 2304: HTML attribute safety (unsafe parameter; 2309)
4338 !! input
4339 {{div style|width: expression(alert(document.cookie))}}
4340 !! result
4341 <div>Magic div</div>
4342
4343 !! end
4344
4345 !! test
4346 Bug 2304: HTML attribute safety (unsafe breakout parameter; 2309)
4347 !! input
4348 {{div style|"><script>alert(document.cookie)</script>}}
4349 !! result
4350 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
4351
4352 !! end
4353
4354 !! test
4355 Bug 2304: HTML attribute safety (unsafe breakout parameter 2; 2309)
4356 !! input
4357 {{div style|" ><script>alert(document.cookie)</script>}}
4358 !! result
4359 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
4360
4361 !! end
4362
4363 !! test
4364 Bug 2304: HTML attribute safety (link)
4365 !! input
4366 <div title="[[Main Page]]"></div>
4367 !! result
4368 <div title="&#91;&#91;Main Page]]"></div>
4369
4370 !! end
4371
4372 !! test
4373 Bug 2304: HTML attribute safety (italics)
4374 !! input
4375 <div title="''foobar''"></div>
4376 !! result
4377 <div title="&#39;&#39;foobar&#39;&#39;"></div>
4378
4379 !! end
4380
4381 !! test
4382 Bug 2304: HTML attribute safety (bold)
4383 !! input
4384 <div title="'''foobar'''"></div>
4385 !! result
4386 <div title="&#39;&#39;&#39;foobar&#39;&#39;&#39;"></div>
4387
4388 !! end
4389
4390
4391 !! test
4392 Bug 2304: HTML attribute safety (ISBN)
4393 !! input
4394 <div title="ISBN 1234567890"></div>
4395 !! result
4396 <div title="&#73;SBN 1234567890"></div>
4397
4398 !! end
4399
4400 !! test
4401 Bug 2304: HTML attribute safety (RFC)
4402 !! input
4403 <div title="RFC 1234"></div>
4404 !! result
4405 <div title="&#82;FC 1234"></div>
4406
4407 !! end
4408
4409 !! test
4410 Bug 2304: HTML attribute safety (PMID)
4411 !! input
4412 <div title="PMID 1234567890"></div>
4413 !! result
4414 <div title="&#80;MID 1234567890"></div>
4415
4416 !! end
4417
4418 !! test
4419 Bug 2304: HTML attribute safety (web link)
4420 !! input
4421 <div title="http://example.com/"></div>
4422 !! result
4423 <div title="http&#58;//example.com/"></div>
4424
4425 !! end
4426
4427 !! test
4428 Bug 2304: HTML attribute safety (named web link)
4429 !! input
4430 <div title="[http://example.com/ link]"></div>
4431 !! result
4432 <div title="&#91;http&#58;//example.com/ link]"></div>
4433
4434 !! end
4435
4436 !! test
4437 Bug 3244: HTML attribute safety (extension; safe)
4438 !! input
4439 <div style="<nowiki>background:blue</nowiki>"></div>
4440 !! result
4441 <div style="background:blue"></div>
4442
4443 !! end
4444
4445 !! test
4446 Bug 3244: HTML attribute safety (extension; unsafe)
4447 !! input
4448 <div style="<nowiki>border-left:expression(alert(document.cookie))</nowiki>"></div>
4449 !! result
4450 <div></div>
4451
4452 !! end
4453
4454 !! test
4455 Math section safety when disabled
4456 !! input
4457 <math><script>alert(document.cookies);</script></math>
4458 !! result
4459 <p>&lt;math&gt;&lt;script&gt;alert(document.cookies);&lt;/script&gt;&lt;/math&gt;
4460 </p>
4461 !! end
4462
4463 # More MSIE fun discovered by Tom Gilder
4464
4465 !! test
4466 MSIE CSS safety test: spurious slash
4467 !! input
4468 <div style="background-image:u\rl(javascript:alert('boo'))">evil</div>
4469 !! result
4470 <div>evil</div>
4471
4472 !! end
4473
4474 !! test
4475 MSIE CSS safety test: hex code
4476 !! input
4477 <div style="background-image:u\72l(javascript:alert('boo'))">evil</div>
4478 !! result
4479 <div>evil</div>
4480
4481 !! end
4482
4483 !! test
4484 MSIE CSS safety test: comment in url
4485 !! input
4486 <div style="background-image:u/**/rl(javascript:alert('boo'))">evil</div>
4487 !! result
4488 <div style="background-image:u rl(javascript:alert(&#39;boo&#39;))">evil</div>
4489
4490 !! end
4491
4492 !! test
4493 MSIE CSS safety test: comment in expression
4494 !! input
4495 <div style="background-image:expres/**/sion(alert('boo4'))">evil4</div>
4496 !! result
4497 <div style="background-image:expres sion(alert(&#39;boo4&#39;))">evil4</div>
4498
4499 !! end
4500
4501
4502 !! test
4503 Table attribute legitimate extension
4504 !! input
4505 {|
4506 !+ style="<nowiki>color:blue</nowiki>"| status
4507 |}
4508 !! result
4509 <table>
4510 <tr>
4511 <th style="color:blue"> status
4512 </th></tr></table>
4513
4514 !!end
4515
4516 !! test
4517 Table attribute safety
4518 !! input
4519 {|
4520 !+ style="<nowiki>border-width:expression(0+alert(document.cookie))</nowiki>"| status
4521 |}
4522 !! result
4523 <table>
4524 <tr>
4525 <th> status
4526 </th></tr></table>
4527
4528 !! end
4529
4530
4531 !! article
4532 Template:Identity
4533 !! text
4534 {{{1}}}
4535 !! endarticle
4536
4537 !! test
4538 Expansion of multi-line templates in attribute values (bug 6255)
4539 !! input
4540 <div style="background: {{identity|#00FF00}}">-</div>
4541 !! result
4542 <div style="background: #00FF00">-</div>
4543
4544 !! end
4545
4546
4547 !! test
4548 Expansion of multi-line templates in attribute values (bug 6255 sanity check)
4549 !! input
4550 <div style="background:
4551 #00FF00">-</div>
4552 !! result
4553 <div style="background: #00FF00">-</div>
4554
4555 !! end
4556
4557 !! test
4558 Expansion of multi-line templates in attribute values (bug 6255 sanity check 2)
4559 !! input
4560 <div style="background: &#10;#00FF00">-</div>
4561 !! result
4562 <div style="background: &#10;#00FF00">-</div>
4563
4564 !! end
4565
4566 ###
4567 ### Parser hooks (see maintenance/parserTestsParserHook.php for the <tag> extension)
4568 ###
4569 !! test
4570 Parser hook: empty input
4571 !! input
4572 <tag></tag>
4573 !! result
4574 <pre>
4575 string(0) ""
4576 array(0) {
4577 }
4578 </pre>
4579
4580 !! end
4581
4582 !! test
4583 Parser hook: empty input using terminated empty elements
4584 !! input
4585 <tag/>
4586 !! result
4587 <pre>
4588 NULL
4589 array(0) {
4590 }
4591 </pre>
4592
4593 !! end
4594
4595 !! test
4596 Parser hook: empty input using terminated empty elements (space before)
4597 !! input
4598 <tag />
4599 !! result
4600 <pre>
4601 NULL
4602 array(0) {
4603 }
4604 </pre>
4605
4606 !! end
4607
4608 !! test
4609 Parser hook: basic input
4610 !! input
4611 <tag>input</tag>
4612 !! result
4613 <pre>
4614 string(5) "input"
4615 array(0) {
4616 }
4617 </pre>
4618
4619 !! end
4620
4621
4622 !! test
4623 Parser hook: case insensitive
4624 !! input
4625 <TAG>input</TAG>
4626 !! result
4627 <pre>
4628 string(5) "input"
4629 array(0) {
4630 }
4631 </pre>
4632
4633 !! end
4634
4635
4636 !! test
4637 Parser hook: case insensitive, redux
4638 !! input
4639 <TaG>input</TAg>
4640 !! result
4641 <pre>
4642 string(5) "input"
4643 array(0) {
4644 }
4645 </pre>
4646
4647 !! end
4648
4649 !! test
4650 Parser hook: nested tags
4651 !! options
4652 noxml
4653 !! input
4654 <tag><tag></tag></tag>
4655 !! result
4656 <pre>
4657 string(5) "<tag>"
4658 array(0) {
4659 }
4660 </pre>&lt;/tag&gt;
4661
4662 !! end
4663
4664 !! test
4665 Parser hook: basic arguments
4666 !! input
4667 <tag width=200 height = "100" depth = '50' square></tag>
4668 !! result
4669 <pre>
4670 string(0) ""
4671 array(4) {
4672 ["width"]=>
4673 string(3) "200"
4674 ["height"]=>
4675 string(3) "100"
4676 ["depth"]=>
4677 string(2) "50"
4678 ["square"]=>
4679 string(6) "square"
4680 }
4681 </pre>
4682
4683 !! end
4684
4685 !! test
4686 Parser hook: argument containing a forward slash (bug 5344)
4687 !! input
4688 <tag filename='/tmp/bla'></tag>
4689 !! result
4690 <pre>
4691 string(0) ""
4692 array(1) {
4693 ["filename"]=>
4694 string(8) "/tmp/bla"
4695 }
4696 </pre>
4697
4698 !! end
4699
4700 !! test
4701 Parser hook: empty input using terminated empty elements (bug 2374)
4702 !! input
4703 <tag foo=bar/>text
4704 !! result
4705 <pre>
4706 NULL
4707 array(1) {
4708 ["foo"]=>
4709 string(3) "bar"
4710 }
4711 </pre>text
4712
4713 !! end
4714
4715 # </tag> should be output literally since there is no matching tag that begins it
4716 !! test
4717 Parser hook: basic arguments using terminated empty elements (bug 2374)
4718 !! input
4719 <tag width=200 height = "100" depth = '50' square/>
4720 other stuff
4721 </tag>
4722 !! result
4723 <pre>
4724 NULL
4725 array(4) {
4726 ["width"]=>
4727 string(3) "200"
4728 ["height"]=>
4729 string(3) "100"
4730 ["depth"]=>
4731 string(2) "50"
4732 ["square"]=>
4733 string(6) "square"
4734 }
4735 </pre>
4736 <p>other stuff
4737 &lt;/tag&gt;
4738 </p>
4739 !! end
4740
4741 ###
4742 ### (see maintenance/parserTestsStaticParserHook.php for the <statictag> extension)
4743 ###
4744
4745 !! test
4746 Parser hook: static parser hook not inside a comment
4747 !! input
4748 <statictag>hello, world</statictag>
4749 <statictag action=flush/>
4750 !! result
4751 <p>hello, world
4752 </p>
4753 !! end
4754
4755
4756 !! test
4757 Parser hook: static parser hook inside a comment
4758 !! input
4759 <!-- <statictag>hello, world</statictag> -->
4760 <statictag action=flush/>
4761 !! result
4762 <p><br />
4763 </p>
4764 !! end
4765
4766 # Nested template calls; this case was broken by Parser.php rev 1.506,
4767 # since reverted.
4768
4769 !! article
4770 Template:One-parameter
4771 !! text
4772 (My parameter is: {{{1}}})
4773 !! endarticle
4774
4775 !! article
4776 Template:Map-one-parameter
4777 !! text
4778 {{{{{1}}}|{{{2}}}}}
4779 !! endarticle
4780
4781 !! test
4782 Nested template calls
4783 !! input
4784 {{Map-one-parameter|One-parameter|param}}
4785 !! result
4786 <p>(My parameter is: param)
4787 </p>
4788 !! end
4789
4790
4791 ###
4792 ### Sanitizer
4793 ###
4794 !! test
4795 Sanitizer: Closing of open tags
4796 !! input
4797 <s></s><table></table>
4798 !! result
4799 <s></s><table></table>
4800
4801 !! end
4802
4803 !! test
4804 Sanitizer: Closing of open but not closed tags
4805 !! input
4806 <s>foo
4807 !! result
4808 <p><s>foo</s>
4809 </p>
4810 !! end
4811
4812 !! test
4813 Sanitizer: Closing of closed but not open tags
4814 !! input
4815 </s>
4816 !! result
4817 <p>&lt;/s&gt;
4818 </p>
4819 !! end
4820
4821 !! test
4822 Sanitizer: Closing of closed but not open table tags
4823 !! input
4824 Table not started</td></tr></table>
4825 !! result
4826 <p>Table not started&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
4827 </p>
4828 !! end
4829
4830 !! test
4831 Sanitizer: Escaping of spaces, multibyte characters, colons & other stuff in id=""
4832 !! input
4833 <span id="æ: v">byte</span>[[#æ: v|backlink]]
4834 !! result
4835 <p><span id=".C3.A6:_v">byte</span><a href="#.C3.A6:_v">backlink</a>
4836 </p>
4837 !! end
4838
4839 !! test
4840 Sanitizer: Validating the contents of the id attribute (bug 4515)
4841 !! options
4842 disabled
4843 !! input
4844 <br id=9 />
4845 !! result
4846 Something, but defenetly not <br id="9" />...
4847 !! end
4848
4849 !! test
4850 Sanitizer: Validating id attribute uniqueness (bug 4515, bug 6301)
4851 !! options
4852 disabled
4853 !! input
4854 <br id="foo" /><br id="foo" />
4855 !! result
4856 Something need to be done. foo-2 ?
4857 !! end
4858
4859 !! test
4860 Language converter: output gets cut off unexpectedly (bug 5757)
4861 !! options
4862 language=zh
4863 !! input
4864 this bit is safe: }-
4865
4866 but if we add a conversion instance: -{zh-cn:xxx;zh-tw:yyy}-
4867
4868 then we get cut off here: }-
4869
4870 all additional text is vanished
4871 !! result
4872 <p>this bit is safe: }-
4873 </p><p>but if we add a conversion instance: xxx
4874 </p><p>then we get cut off here: }-
4875 </p><p>all additional text is vanished
4876 </p>
4877 !! end
4878
4879 !! test
4880 Self closed html pairs (bug 5487)
4881 !! options
4882 !! input
4883 <center><font id="bug" />Centered text</center>
4884 <div><font id="bug2" />In div text</div>
4885 !! result
4886 <center>&lt;font id="bug" /&gt;Centered text</center>
4887 <div>&lt;font id="bug2" /&gt;In div text</div>
4888
4889 !! end
4890
4891 #
4892 #
4893 #
4894
4895 !! test
4896 Punctuation: nbsp before exclamation
4897 !! input
4898 C'est grave !
4899 !! result
4900 <p>C'est grave&nbsp;!
4901 </p>
4902 !! end
4903
4904 !! test
4905 Punctuation: CSS !important (bug 11874)
4906 !! input
4907 <div style="width:50% !important">important</div>
4908 !! result
4909 <div style="width:50% !important">important</div>
4910
4911 !!end
4912
4913 !! test
4914 Punctuation: CSS ! important (bug 11874; with space after)
4915 !! input
4916 <div style="width:50% ! important">important</div>
4917 !! result
4918 <div style="width:50% ! important">important</div>
4919
4920 !!end
4921
4922
4923 !! test
4924 HTML bullet list, closed tags (bug 5497)
4925 !! input
4926 <ul>
4927 <li>One</li>
4928 <li>Two</li>
4929 </ul>
4930 !! result
4931 <ul>
4932 <li>One</li>
4933 <li>Two</li>
4934 </ul>
4935
4936 !! end
4937
4938 !! test
4939 HTML bullet list, unclosed tags (bug 5497)
4940 !! options
4941 disabled
4942 !! input
4943 <ul>
4944 <li>One
4945 <li>Two
4946 </ul>
4947 !! result
4948 <ul>
4949 <li>One
4950 </li><li>Two
4951 </li></ul>
4952
4953 !! end
4954
4955 !! test
4956 HTML ordered list, closed tags (bug 5497)
4957 !! input
4958 <ol>
4959 <li>One</li>
4960 <li>Two</li>
4961 </ol>
4962 !! result
4963 <ol>
4964 <li>One</li>
4965 <li>Two</li>
4966 </ol>
4967
4968 !! end
4969
4970 !! test
4971 HTML ordered list, unclosed tags (bug 5497)
4972 !! options
4973 disabled
4974 !! input
4975 <ol>
4976 <li>One
4977 <li>Two
4978 </ol>
4979 !! result
4980 <ol>
4981 <li>One
4982 </li><li>Two
4983 </li></ol>
4984
4985 !! end
4986
4987 !! test
4988 HTML nested bullet list, closed tags (bug 5497)
4989 !! input
4990 <ul>
4991 <li>One</li>
4992 <li>Two:
4993 <ul>
4994 <li>Sub-one</li>
4995 <li>Sub-two</li>
4996 </ul>
4997 </li>
4998 </ul>
4999 !! result
5000 <ul>
5001 <li>One</li>
5002 <li>Two:
5003 <ul>
5004 <li>Sub-one</li>
5005 <li>Sub-two</li>
5006 </ul>
5007 </li>
5008 </ul>
5009
5010 !! end
5011
5012 !! test
5013 HTML nested bullet list, open tags (bug 5497)
5014 !! options
5015 disabled
5016 !! input
5017 <ul>
5018 <li>One
5019 <li>Two:
5020 <ul>
5021 <li>Sub-one
5022 <li>Sub-two
5023 </ul>
5024 </ul>
5025 !! result
5026 <ul>
5027 <li>One
5028 </li><li>Two:
5029 <ul>
5030 <li>Sub-one
5031 </li><li>Sub-two
5032 </li></ul>
5033 </li></ul>
5034
5035 !! end
5036
5037 !! test
5038 HTML nested ordered list, closed tags (bug 5497)
5039 !! input
5040 <ol>
5041 <li>One</li>
5042 <li>Two:
5043 <ol>
5044 <li>Sub-one</li>
5045 <li>Sub-two</li>
5046 </ol>
5047 </li>
5048 </ol>
5049 !! result
5050 <ol>
5051 <li>One</li>
5052 <li>Two:
5053 <ol>
5054 <li>Sub-one</li>
5055 <li>Sub-two</li>
5056 </ol>
5057 </li>
5058 </ol>
5059
5060 !! end
5061
5062 !! test
5063 HTML nested ordered list, open tags (bug 5497)
5064 !! options
5065 disabled
5066 !! input
5067 <ol>
5068 <li>One
5069 <li>Two:
5070 <ol>
5071 <li>Sub-one
5072 <li>Sub-two
5073 </ol>
5074 </ol>
5075 !! result
5076 <ol>
5077 <li>One
5078 </li><li>Two:
5079 <ol>
5080 <li>Sub-one
5081 </li><li>Sub-two
5082 </li></ol>
5083 </li></ol>
5084
5085 !! end
5086
5087 !! test
5088 HTML ordered list item with parameters oddity
5089 !! input
5090 <ol><li id="fragment">One</li></ol>
5091 !! result
5092 <ol><li id="fragment">One</li></ol>
5093
5094 !! end
5095
5096 !!test
5097 bug 5918: autonumbering
5098 !! input
5099 [http://first/] [http://second] [ftp://ftp]
5100
5101 ftp://inlineftp
5102
5103 [mailto:enclosed@mail.tld With target]
5104
5105 [mailto:enclosed@mail.tld]
5106
5107 mailto:inline@mail.tld
5108 !! result
5109 <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>
5110 </p><p><a href="ftp://inlineftp" class="external free" rel="nofollow">ftp://inlineftp</a>
5111 </p><p><a href="mailto:enclosed@mail.tld" class="external text" rel="nofollow">With target</a>
5112 </p><p><a href="mailto:enclosed@mail.tld" class="external autonumber" rel="nofollow">[4]</a>
5113 </p><p><a href="mailto:inline@mail.tld" class="external free" rel="nofollow">mailto:inline@mail.tld</a>
5114 </p>
5115 !! end
5116
5117
5118 #
5119 # Security and HTML correctness
5120 # From Nick Jenkins' fuzz testing
5121 #
5122
5123 !! test
5124 Fuzz testing: Parser13
5125 !! input
5126 {|
5127 | http://a|
5128 !! result
5129 <table>
5130 <tr>
5131 <td>
5132 </td>
5133 </tr>
5134 </table>
5135
5136 !! end
5137
5138 !! test
5139 Fuzz testing: Parser14
5140 !! input
5141 == onmouseover= ==
5142 http://__TOC__
5143 !! result
5144 <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>
5145 http://<table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
5146 <ul>
5147 <li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
5148 </ul>
5149 </td></tr></table><script>if (window.showTocToggle) { var tocShowText = "show"; var tocHideText = "hide"; showTocToggle(); } </script>
5150
5151 !! end
5152
5153 !! test
5154 Fuzz testing: Parser14-table
5155 !! input
5156 ==a==
5157 {| STYLE=__TOC__
5158 !! result
5159 <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>
5160 <table style="&#95;_TOC&#95;_">
5161 <tr><td></td></tr>
5162 </table>
5163
5164 !! end
5165
5166 # Known to produce bogus xml (extra </td>)
5167 !! test
5168 Fuzz testing: Parser16
5169 !! options
5170 noxml
5171 !! input
5172 {|
5173 !https://||||||
5174 !! result
5175 <table>
5176 <tr>
5177 <th>https://</th><th></th><th></th><th>
5178 </td>
5179 </tr>
5180 </table>
5181
5182 !! end
5183
5184 !! test
5185 Fuzz testing: Parser21
5186 !! input
5187 {|
5188 ! irc://{{ftp://a" onmouseover="alert('hello world');"
5189 |
5190 !! result
5191 <table>
5192 <tr>
5193 <th> <a href="irc://{{ftp://a" class="external free" rel="nofollow">irc://{{ftp://a</a>" onmouseover="alert('hello world');"
5194 </th><td>
5195 </td>
5196 </tr>
5197 </table>
5198
5199 !! end
5200
5201 !! test
5202 Fuzz testing: Parser22
5203 !! input
5204 http://===r:::https://b
5205
5206 {|
5207 !!result
5208 <p><a href="http://===r:::https://b" class="external free" rel="nofollow">http://===r:::https://b</a>
5209 </p>
5210 <table>
5211 <tr><td></td></tr>
5212 </table>
5213
5214 !! end
5215
5216 # Known to produce bad XML for now
5217 !! test
5218 Fuzz testing: Parser24
5219 !! options
5220 noxml
5221 !! input
5222 {|
5223 {{{|
5224 <u CLASS=
5225 | {{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx--><noinclude>}}}} >
5226 <br style="onmouseover='alert(document.cookie);' " />
5227
5228 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
5229 |
5230 !! result
5231 <table>
5232 {{{|
5233 <u class="&#124;">}}}} &gt;
5234 <br style="onmouseover=&#39;alert(document.cookie);&#39;" />
5235
5236 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
5237 <tr>
5238 <td></u>
5239 </td>
5240 </tr>
5241 </table>
5242
5243 !! end
5244
5245 # Note: the current result listed for this is not what the original one was,
5246 # but the original bug was JavaScript injection, which is fixed in any case.
5247 # It's not clear that the original result listed was any more correct than the
5248 # current one. Original result:
5249 # <p>{{{|
5250 # </p>
5251 # <li class="&#124;&#124;">
5252 # }}}blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
5253 !!test
5254 Fuzz testing: Parser25 (bug 6055)
5255 !! input
5256 {{{
5257 |
5258 <LI CLASS=||
5259 >
5260 }}}blah" onmouseover="alert('hello world');" align="left"'''MOVE MOUSE CURSOR OVER HERE
5261 !! result
5262 <p>&lt;LI CLASS=blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
5263 </p>
5264 !! end
5265
5266 !!test
5267 Fuzz testing: URL adjacent extension (with space, clean)
5268 !! options
5269 !! input
5270 http://example.com <nowiki>junk</nowiki>
5271 !! result
5272 <p><a href="http://example.com" class="external free" rel="nofollow">http://example.com</a> junk
5273 </p>
5274 !!end
5275
5276 !!test
5277 Fuzz testing: URL adjacent extension (no space, dirty; nowiki)
5278 !! options
5279 !! input
5280 http://example.com<nowiki>junk</nowiki>
5281 !! result
5282 <p><a href="http://example.com" class="external free" rel="nofollow">http://example.com</a>junk
5283 </p>
5284 !!end
5285
5286 !!test
5287 Fuzz testing: URL adjacent extension (no space, dirty; pre)
5288 !! options
5289 !! input
5290 http://example.com<pre>junk</pre>
5291 !! result
5292 <a href="http://example.com" class="external free" rel="nofollow">http://example.com</a><pre>junk</pre>
5293
5294 !!end
5295
5296 !!test
5297 Fuzz testing: image with bogus manual thumbnail
5298 !!input
5299 [[Image:foobar.jpg|thumbnail= ]]
5300 !!result
5301 <div class="thumb tright"><div class="thumbinner" style="width:1943px;">Error creating thumbnail: <div class="thumbcaption"></div></div></div>
5302
5303 !!end
5304
5305 !! test
5306 Fuzz testing: encoded newline in generated HTML replacements (bug 6577)
5307 !! input
5308 <pre dir="&#10;"></pre>
5309 !! result
5310 <pre dir="&#10;"></pre>
5311
5312 !! end
5313
5314 !! test
5315 Parsing optional HTML elements (Bug 6171)
5316 !! options
5317 !! input
5318 <table>
5319 <tr>
5320 <td> Some tabular data</td>
5321 <td> More tabular data ...
5322 <td> And yet som tabular data</td>
5323 </tr>
5324 </table>
5325 !! result
5326 <table>
5327 <tr>
5328 <td> Some tabular data</td>
5329 <td> More tabular data ...
5330 </td><td> And yet som tabular data</td>
5331 </tr>
5332 </table>
5333
5334 !! end
5335
5336 !! test
5337 Correct handling of <td>, <tr> (Bug 6171)
5338 !! options
5339 !! input
5340 <table>
5341 <tr>
5342 <td> Some tabular data</td>
5343 <td> More tabular data ...</td>
5344 <td> And yet som tabular data</td>
5345 </tr>
5346 </table>
5347 !! result
5348 <table>
5349 <tr>
5350 <td> Some tabular data</td>
5351 <td> More tabular data ...</td>
5352 <td> And yet som tabular data</td>
5353 </tr>
5354 </table>
5355
5356 !! end
5357
5358
5359 !! test
5360 Parsing crashing regression (fr:JavaScript)
5361 !! input
5362 </body></x>
5363 !! result
5364 <p>&lt;/body&gt;&lt;/x&gt;
5365 </p>
5366 !! end
5367
5368 !! test
5369 Inline wiki vs wiki block nesting
5370 !! input
5371 '''Bold paragraph
5372
5373 New wiki paragraph
5374 !! result
5375 <p><b>Bold paragraph</b>
5376 </p><p>New wiki paragraph
5377 </p>
5378 !! end
5379
5380 !! test
5381 Inline HTML vs wiki block nesting
5382 !! options
5383 disabled
5384 !! input
5385 <b>Bold paragraph
5386
5387 New wiki paragraph
5388 !! result
5389 <p><b>Bold paragraph</b>
5390 </p><p>New wiki paragraph
5391 </p>
5392 !! end
5393
5394 # Original result was this:
5395 # <p><b>bold</b><b>bold<i>bolditalics</i></b>
5396 # </p>
5397 # While that might be marginally more intuitive, maybe, the six-apostrophe
5398 # construct is clearly pathological and the result stated here (which is what
5399 # the parser actually does) is about as reasonable as anything.
5400 !!test
5401 Mixing markup for italics and bold
5402 !! options
5403 !! input
5404 '''bold''''''bold''bolditalics'''''
5405 !! result
5406 <p>'<i>bold'</i><b>bold<i>bolditalics</i></b>
5407 </p>
5408 !! end
5409
5410
5411 !! article
5412 Xyzzyx
5413 !! text
5414 Article for special page transclusion test
5415 !! endarticle
5416
5417 !! test
5418 Special page transclusion
5419 !! options
5420 !! input
5421 {{Special:Prefixindex/Xyzzyx}}
5422 !! result
5423 <p><br />
5424 </p>
5425 <table border="0" id="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
5426
5427 !! end
5428
5429 !! test
5430 Special page transclusion twice (bug 5021)
5431 !! options
5432 !! input
5433 {{Special:Prefixindex/Xyzzyx}}
5434 {{Special:Prefixindex/Xyzzyx}}
5435 !! result
5436 <p><br />
5437 </p>
5438 <table border="0" id="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
5439 <p><br />
5440 </p>
5441 <table border="0" id="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
5442
5443 !! end
5444
5445 !! test
5446 Transclusion of default MediaWiki message
5447 !! input
5448 {{MediaWiki:Mainpage}}
5449 !!result
5450 <p>Main Page
5451 </p>
5452 !! end
5453
5454 !! test
5455 Transclusion of nonexistent MediaWiki message
5456 !! input
5457 {{MediaWiki:Mainpagexxx}}
5458 !!result
5459 <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>
5460 </p>
5461 !! end
5462
5463 !! test
5464 Transclusion of MediaWiki message with underscore
5465 !! input
5466 {{MediaWiki:history_short}}
5467 !! result
5468 <p>History
5469 </p>
5470 !! end
5471
5472 !! test
5473 Transclusion of MediaWiki message with space
5474 !! input
5475 {{MediaWiki:history short}}
5476 !! result
5477 <p>History
5478 </p>
5479 !! end
5480
5481 !! test
5482 Invalid header with following text
5483 !! input
5484 = x = y
5485 !! result
5486 <p>= x = y
5487 </p>
5488 !! end
5489
5490
5491 !! test
5492 Section extraction test (section 0)
5493 !! options
5494 section=0
5495 !! input
5496 start
5497 ==a==
5498 ===aa===
5499 ====aaa====
5500 ==b==
5501 ===ba===
5502 ===bb===
5503 ====bba====
5504 ===bc===
5505 ==c==
5506 ===ca===
5507 !! result
5508 start
5509 !! end
5510
5511 !! test
5512 Section extraction test (section 1)
5513 !! options
5514 section=1
5515 !! input
5516 start
5517 ==a==
5518 ===aa===
5519 ====aaa====
5520 ==b==
5521 ===ba===
5522 ===bb===
5523 ====bba====
5524 ===bc===
5525 ==c==
5526 ===ca===
5527 !! result
5528 ==a==
5529 ===aa===
5530 ====aaa====
5531 !! end
5532
5533 !! test
5534 Section extraction test (section 2)
5535 !! options
5536 section=2
5537 !! input
5538 start
5539 ==a==
5540 ===aa===
5541 ====aaa====
5542 ==b==
5543 ===ba===
5544 ===bb===
5545 ====bba====
5546 ===bc===
5547 ==c==
5548 ===ca===
5549 !! result
5550 ===aa===
5551 ====aaa====
5552 !! end
5553
5554 !! test
5555 Section extraction test (section 3)
5556 !! options
5557 section=3
5558 !! input
5559 start
5560 ==a==
5561 ===aa===
5562 ====aaa====
5563 ==b==
5564 ===ba===
5565 ===bb===
5566 ====bba====
5567 ===bc===
5568 ==c==
5569 ===ca===
5570 !! result
5571 ====aaa====
5572 !! end
5573
5574 !! test
5575 Section extraction test (section 4)
5576 !! options
5577 section=4
5578 !! input
5579 start
5580 ==a==
5581 ===aa===
5582 ====aaa====
5583 ==b==
5584 ===ba===
5585 ===bb===
5586 ====bba====
5587 ===bc===
5588 ==c==
5589 ===ca===
5590 !! result
5591 ==b==
5592 ===ba===
5593 ===bb===
5594 ====bba====
5595 ===bc===
5596 !! end
5597
5598 !! test
5599 Section extraction test (section 5)
5600 !! options
5601 section=5
5602 !! input
5603 start
5604 ==a==
5605 ===aa===
5606 ====aaa====
5607 ==b==
5608 ===ba===
5609 ===bb===
5610 ====bba====
5611 ===bc===
5612 ==c==
5613 ===ca===
5614 !! result
5615 ===ba===
5616 !! end
5617
5618 !! test
5619 Section extraction test (section 6)
5620 !! options
5621 section=6
5622 !! input
5623 start
5624 ==a==
5625 ===aa===
5626 ====aaa====
5627 ==b==
5628 ===ba===
5629 ===bb===
5630 ====bba====
5631 ===bc===
5632 ==c==
5633 ===ca===
5634 !! result
5635 ===bb===
5636 ====bba====
5637 !! end
5638
5639 !! test
5640 Section extraction test (section 7)
5641 !! options
5642 section=7
5643 !! input
5644 start
5645 ==a==
5646 ===aa===
5647 ====aaa====
5648 ==b==
5649 ===ba===
5650 ===bb===
5651 ====bba====
5652 ===bc===
5653 ==c==
5654 ===ca===
5655 !! result
5656 ====bba====
5657 !! end
5658
5659 !! test
5660 Section extraction test (section 8)
5661 !! options
5662 section=8
5663 !! input
5664 start
5665 ==a==
5666 ===aa===
5667 ====aaa====
5668 ==b==
5669 ===ba===
5670 ===bb===
5671 ====bba====
5672 ===bc===
5673 ==c==
5674 ===ca===
5675 !! result
5676 ===bc===
5677 !! end
5678
5679 !! test
5680 Section extraction test (section 9)
5681 !! options
5682 section=9
5683 !! input
5684 start
5685 ==a==
5686 ===aa===
5687 ====aaa====
5688 ==b==
5689 ===ba===
5690 ===bb===
5691 ====bba====
5692 ===bc===
5693 ==c==
5694 ===ca===
5695 !! result
5696 ==c==
5697 ===ca===
5698 !! end
5699
5700 !! test
5701 Section extraction test (section 10)
5702 !! options
5703 section=10
5704 !! input
5705 start
5706 ==a==
5707 ===aa===
5708 ====aaa====
5709 ==b==
5710 ===ba===
5711 ===bb===
5712 ====bba====
5713 ===bc===
5714 ==c==
5715 ===ca===
5716 !! result
5717 ===ca===
5718 !! end
5719
5720 !! test
5721 Section extraction test (nonexistent section 11)
5722 !! options
5723 section=11
5724 !! input
5725 start
5726 ==a==
5727 ===aa===
5728 ====aaa====
5729 ==b==
5730 ===ba===
5731 ===bb===
5732 ====bba====
5733 ===bc===
5734 ==c==
5735 ===ca===
5736 !! result
5737 !! end
5738
5739 !! test
5740 Section extraction test with bogus heading (section 1)
5741 !! options
5742 section=1
5743 !! input
5744 ==a==
5745 ==bogus== not a legal section
5746 ==b==
5747 !! result
5748 ==a==
5749 ==bogus== not a legal section
5750 !! end
5751
5752 !! test
5753 Section extraction test with bogus heading (section 2)
5754 !! options
5755 section=2
5756 !! input
5757 ==a==
5758 ==bogus== not a legal section
5759 ==b==
5760 !! result
5761 ==b==
5762 !! end
5763
5764 !! test
5765 Section extraction test with comment after heading (section 1)
5766 !! options
5767 section=1
5768 !! input
5769 ==a==
5770 ==b== <!-- -->
5771 ==c==
5772 !! result
5773 ==a==
5774 !! end
5775
5776 !! test
5777 Section extraction test with comment after heading (section 2)
5778 !! options
5779 section=2
5780 !! input
5781 ==a==
5782 ==b== <!-- -->
5783 ==c==
5784 !! result
5785 ==b== <!-- -->
5786 !! end
5787
5788 !! test
5789 Section extraction test with bogus <nowiki> heading (section 1)
5790 !! options
5791 section=1
5792 !! input
5793 ==a==
5794 ==bogus== <nowiki>not a legal section</nowiki>
5795 ==b==
5796 !! result
5797 ==a==
5798 ==bogus== <nowiki>not a legal section</nowiki>
5799 !! end
5800
5801 !! test
5802 Section extraction test with bogus <nowiki> heading (section 2)
5803 !! options
5804 section=2
5805 !! input
5806 ==a==
5807 ==bogus== <nowiki>not a legal section</nowiki>
5808 ==b==
5809 !! result
5810 ==b==
5811 !! end
5812
5813
5814 # Formerly testing for bug 2587, now resolved by the use of unmarked sections
5815 # instead of respecting commented sections
5816 !! test
5817 Section extraction prefixed by comment (section 1)
5818 !! options
5819 section=1
5820 !! input
5821 <!-- -->==sec1==
5822 ==sec2==
5823 !!result
5824 ==sec2==
5825 !!end
5826
5827 !! test
5828 Section extraction prefixed by comment (section 2)
5829 !! options
5830 section=2
5831 !! input
5832 <!-- -->==sec1==
5833 ==sec2==
5834 !!result
5835
5836 !!end
5837
5838
5839 # Formerly testing for bug 2607, now resolved by the use of unmarked sections
5840 # instead of respecting HTML-style headings
5841 !! test
5842 Section extraction, mixed wiki and html (section 1)
5843 !! options
5844 section=1
5845 !! input
5846 <h2>unmarked</h2>
5847 unmarked
5848 ==1==
5849 one
5850 ==2==
5851 two
5852 !! result
5853 ==1==
5854 one
5855 !! end
5856
5857 !! test
5858 Section extraction, mixed wiki and html (section 2)
5859 !! options
5860 section=2
5861 !! input
5862 <h2>unmarked</h2>
5863 unmarked
5864 ==1==
5865 one
5866 ==2==
5867 two
5868 !! result
5869 ==2==
5870 two
5871 !! end
5872
5873
5874 # Formerly testing for bug 3342
5875 !! test
5876 Section extraction, heading surrounded by <noinclude>
5877 !! options
5878 section=1
5879 !! input
5880 <noinclude>==unmarked==</noinclude>
5881 ==marked==
5882 !! result
5883 ==marked==
5884 !!end
5885
5886
5887 !! test
5888 Section replacement test (section 0)
5889 !! options
5890 replace=0,"xxx"
5891 !! input
5892 start
5893 ==a==
5894 ===aa===
5895 ====aaa====
5896 ==b==
5897 ===ba===
5898 ===bb===
5899 ====bba====
5900 ===bc===
5901 ==c==
5902 ===ca===
5903 !! result
5904 xxx
5905
5906 ==a==
5907 ===aa===
5908 ====aaa====
5909 ==b==
5910 ===ba===
5911 ===bb===
5912 ====bba====
5913 ===bc===
5914 ==c==
5915 ===ca===
5916 !! end
5917
5918 !! test
5919 Section replacement test (section 1)
5920 !! options
5921 replace=1,"xxx"
5922 !! input
5923 start
5924 ==a==
5925 ===aa===
5926 ====aaa====
5927 ==b==
5928 ===ba===
5929 ===bb===
5930 ====bba====
5931 ===bc===
5932 ==c==
5933 ===ca===
5934 !! result
5935 start
5936 xxx
5937
5938 ==b==
5939 ===ba===
5940 ===bb===
5941 ====bba====
5942 ===bc===
5943 ==c==
5944 ===ca===
5945 !! end
5946
5947 !! test
5948 Section replacement test (section 2)
5949 !! options
5950 replace=2,"xxx"
5951 !! input
5952 start
5953 ==a==
5954 ===aa===
5955 ====aaa====
5956 ==b==
5957 ===ba===
5958 ===bb===
5959 ====bba====
5960 ===bc===
5961 ==c==
5962 ===ca===
5963 !! result
5964 start
5965 ==a==
5966 xxx
5967
5968 ==b==
5969 ===ba===
5970 ===bb===
5971 ====bba====
5972 ===bc===
5973 ==c==
5974 ===ca===
5975 !! end
5976
5977 !! test
5978 Section replacement test (section 3)
5979 !! options
5980 replace=3,"xxx"
5981 !! input
5982 start
5983 ==a==
5984 ===aa===
5985 ====aaa====
5986 ==b==
5987 ===ba===
5988 ===bb===
5989 ====bba====
5990 ===bc===
5991 ==c==
5992 ===ca===
5993 !! result
5994 start
5995 ==a==
5996 ===aa===
5997 xxx
5998
5999 ==b==
6000 ===ba===
6001 ===bb===
6002 ====bba====
6003 ===bc===
6004 ==c==
6005 ===ca===
6006 !! end
6007
6008 !! test
6009 Section replacement test (section 4)
6010 !! options
6011 replace=4,"xxx"
6012 !! input
6013 start
6014 ==a==
6015 ===aa===
6016 ====aaa====
6017 ==b==
6018 ===ba===
6019 ===bb===
6020 ====bba====
6021 ===bc===
6022 ==c==
6023 ===ca===
6024 !! result
6025 start
6026 ==a==
6027 ===aa===
6028 ====aaa====
6029 xxx
6030
6031 ==c==
6032 ===ca===
6033 !! end
6034
6035 !! test
6036 Section replacement test (section 5)
6037 !! options
6038 replace=5,"xxx"
6039 !! input
6040 start
6041 ==a==
6042 ===aa===
6043 ====aaa====
6044 ==b==
6045 ===ba===
6046 ===bb===
6047 ====bba====
6048 ===bc===
6049 ==c==
6050 ===ca===
6051 !! result
6052 start
6053 ==a==
6054 ===aa===
6055 ====aaa====
6056 ==b==
6057 xxx
6058
6059 ===bb===
6060 ====bba====
6061 ===bc===
6062 ==c==
6063 ===ca===
6064 !! end
6065
6066 !! test
6067 Section replacement test (section 6)
6068 !! options
6069 replace=6,"xxx"
6070 !! input
6071 start
6072 ==a==
6073 ===aa===
6074 ====aaa====
6075 ==b==
6076 ===ba===
6077 ===bb===
6078 ====bba====
6079 ===bc===
6080 ==c==
6081 ===ca===
6082 !! result
6083 start
6084 ==a==
6085 ===aa===
6086 ====aaa====
6087 ==b==
6088 ===ba===
6089 xxx
6090
6091 ===bc===
6092 ==c==
6093 ===ca===
6094 !! end
6095
6096 !! test
6097 Section replacement test (section 7)
6098 !! options
6099 replace=7,"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 xxx
6121
6122 ===bc===
6123 ==c==
6124 ===ca===
6125 !! end
6126
6127 !! test
6128 Section replacement test (section 8)
6129 !! options
6130 replace=8,"xxx"
6131 !! input
6132 start
6133 ==a==
6134 ===aa===
6135 ====aaa====
6136 ==b==
6137 ===ba===
6138 ===bb===
6139 ====bba====
6140 ===bc===
6141 ==c==
6142 ===ca===
6143 !! result
6144 start
6145 ==a==
6146 ===aa===
6147 ====aaa====
6148 ==b==
6149 ===ba===
6150 ===bb===
6151 ====bba====
6152 xxx
6153
6154 ==c==
6155 ===ca===
6156 !!end
6157
6158 !! test
6159 Section replacement test (section 9)
6160 !! options
6161 replace=9,"xxx"
6162 !! input
6163 start
6164 ==a==
6165 ===aa===
6166 ====aaa====
6167 ==b==
6168 ===ba===
6169 ===bb===
6170 ====bba====
6171 ===bc===
6172 ==c==
6173 ===ca===
6174 !! result
6175 start
6176 ==a==
6177 ===aa===
6178 ====aaa====
6179 ==b==
6180 ===ba===
6181 ===bb===
6182 ====bba====
6183 ===bc===
6184 xxx
6185 !! end
6186
6187 !! test
6188 Section replacement test (section 10)
6189 !! options
6190 replace=10,"xxx"
6191 !! input
6192 start
6193 ==a==
6194 ===aa===
6195 ====aaa====
6196 ==b==
6197 ===ba===
6198 ===bb===
6199 ====bba====
6200 ===bc===
6201 ==c==
6202 ===ca===
6203 !! result
6204 start
6205 ==a==
6206 ===aa===
6207 ====aaa====
6208 ==b==
6209 ===ba===
6210 ===bb===
6211 ====bba====
6212 ===bc===
6213 ==c==
6214 xxx
6215 !! end
6216
6217 !! test
6218 Section replacement test with initial whitespace (bug 13728)
6219 !! options
6220 replace=2,"xxx"
6221 !! input
6222 Preformatted initial line
6223 ==a==
6224 ===a===
6225 !! result
6226 Preformatted initial line
6227 ==a==
6228 xxx
6229 !! end
6230
6231
6232 !! test
6233 Section extraction, heading followed by pre with 20 spaces (bug 6398)
6234 !! options
6235 section=1
6236 !! input
6237 ==a==
6238 a
6239 !! result
6240 ==a==
6241 a
6242 !! end
6243
6244 !! test
6245 Section extraction, heading followed by pre with 19 spaces (bug 6398 sanity check)
6246 !! options
6247 section=1
6248 !! input
6249 ==a==
6250 a
6251 !! result
6252 ==a==
6253 a
6254 !! end
6255
6256
6257 !! test
6258 Section extraction, <pre> around bogus header (bug 10309)
6259 !! options
6260 noxml section=2
6261 !! input
6262 == Section One ==
6263 <pre>
6264 =======
6265 </pre>
6266
6267 == Section Two ==
6268 stuff
6269 !! result
6270 == Section Two ==
6271 stuff
6272 !! end
6273
6274 !! test
6275 Section replacement, <pre> around bogus header (bug 10309)
6276 !! options
6277 noxml replace=2,"xxx"
6278 !! input
6279 == Section One ==
6280 <pre>
6281 =======
6282 </pre>
6283
6284 == Section Two ==
6285 stuff
6286 !! result
6287 == Section One ==
6288 <pre>
6289 =======
6290 </pre>
6291
6292 xxx
6293 !! end
6294
6295
6296
6297 !! test
6298 Handling of &#x0A; in URLs
6299 !! input
6300 **irc://&#x0A;a
6301 !! result
6302 <ul><li><ul><li><a href="irc://%0Aa" class="external free" rel="nofollow">irc://%0Aa</a>
6303 </li></ul>
6304 </li></ul>
6305
6306 !!end
6307
6308 !! test
6309 5 quotes, code coverage +1 line
6310 !! input
6311 '''''
6312 !! result
6313 !! end
6314
6315 !! test
6316 Special:Search page linking.
6317 !! input
6318 {{Special:search}}
6319 !! result
6320 <p><a href="/wiki/Special:Search" title="Special:Search">Special:Search</a>
6321 </p>
6322 !! end
6323
6324 !! test
6325 Say the magic word
6326 !! input
6327 * {{PAGENAME}}
6328 * {{BASEPAGENAME}}
6329 * {{SUBPAGENAME}}
6330 * {{SUBPAGENAMEE}}
6331 * {{BASEPAGENAME}}
6332 * {{BASEPAGENAMEE}}
6333 * {{TALKPAGENAME}}
6334 * {{TALKPAGENAMEE}}
6335 * {{SUBJECTPAGENAME}}
6336 * {{SUBJECTPAGENAMEE}}
6337 * {{NAMESPACEE}}
6338 * {{NAMESPACE}}
6339 * {{TALKSPACE}}
6340 * {{TALKSPACEE}}
6341 * {{SUBJECTSPACE}}
6342 * {{SUBJECTSPACEE}}
6343 * {{Dynamic|{{NUMBEROFUSERS}}|{{NUMBEROFPAGES}}|{{CURRENTVERSION}}|{{CONTENTLANGUAGE}}|{{DIRECTIONMARK}}|{{CURRENTTIMESTAMP}}|{{NUMBEROFARTICLES}}}}
6344 !! result
6345 <ul><li> Parser test
6346 </li><li> Parser test
6347 </li><li> Parser test
6348 </li><li> Parser_test
6349 </li><li> Parser test
6350 </li><li> Parser_test
6351 </li><li> Talk:Parser test
6352 </li><li> Talk:Parser_test
6353 </li><li> Parser test
6354 </li><li> Parser_test
6355 </li><li>
6356 </li><li>
6357 </li><li> Talk
6358 </li><li> Talk
6359 </li><li>
6360 </li><li>
6361 </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>
6362 </li></ul>
6363
6364 !! end
6365 ### Note: Above tests excludes the "{{NUMBEROFADMINS}}" magic word because it generates a MySQL error when included.
6366
6367 !! test
6368 Gallery
6369 !! input
6370 <gallery>
6371 image1.png |
6372 image2.gif|||||
6373
6374 image3|
6375 image4 |300px| centre
6376 image5.svg| http://///////
6377 [[x|xx]]]]
6378 * image6
6379 </gallery>
6380 !! result
6381 <table class="gallery" cellspacing="0" cellpadding="0">
6382 <tr>
6383 <td><div class="gallerybox" style="width: 155px;">
6384 <div style="height: 152px;">Image1.png</div>
6385 <div class="gallerytext">
6386 </div>
6387 </div></td>
6388 <td><div class="gallerybox" style="width: 155px;">
6389 <div style="height: 152px;">Image2.gif</div>
6390 <div class="gallerytext">
6391 <p>||||
6392 </p>
6393 </div>
6394 </div></td>
6395 <td><div class="gallerybox" style="width: 155px;">
6396 <div style="height: 152px;">Image3</div>
6397 <div class="gallerytext">
6398 </div>
6399 </div></td>
6400 <td><div class="gallerybox" style="width: 155px;">
6401 <div style="height: 152px;">Image4</div>
6402 <div class="gallerytext">
6403 <p>300px| centre
6404 </p>
6405 </div>
6406 </div></td>
6407 </tr>
6408 <tr>
6409 <td><div class="gallerybox" style="width: 155px;">
6410 <div style="height: 152px;">Image5.svg</div>
6411 <div class="gallerytext">
6412 <p><a href="http://///////" class="external free" rel="nofollow">http://///////</a>
6413 </p>
6414 </div>
6415 </div></td>
6416 <td><div class="gallerybox" style="width: 155px;">
6417 <div style="height: 152px;">* image6</div>
6418 <div class="gallerytext">
6419 </div>
6420 </div></td>
6421 </tr>
6422 </table>
6423
6424 !! end
6425
6426 !! test
6427 HTML Hex character encoding (spells the word "JavaScript")
6428 !! input
6429 &#x4A;&#x061;&#x0076;&#x00061;&#x000053;&#x0000063;&#114;&#x0000069;&#00000112;&#x0000000074;
6430 !! result
6431 <p>&#x4a;&#x61;&#x76;&#x61;&#x53;&#x63;&#114;&#x69;&#112;&#x74;
6432 </p>
6433 !! end
6434
6435 !! test
6436 __FORCETOC__ override
6437 !! input
6438 __NEWSECTIONLINK__
6439 __FORCETOC__
6440 !! result
6441 <p><br />
6442 </p>
6443 !! end
6444
6445 !! test
6446 ISBN code coverage
6447 !! input
6448 ISBN 978-0-1234-56&#x20;789
6449 !! result
6450 <p><a href="/wiki/Special:BookSources/9780123456" class="internal mw-magiclink-isbn">ISBN 978-0-1234-56</a>&#x20;789
6451 </p>
6452 !! end
6453
6454 !! test
6455 ISBN followed by 5 spaces
6456 !! input
6457 ISBN
6458 !! result
6459 <p>ISBN
6460 </p>
6461 !! end
6462
6463 !! test
6464 Double ISBN
6465 !! input
6466 ISBN ISBN 1234567890
6467 !! result
6468 <p>ISBN <a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
6469 </p>
6470 !! end
6471
6472 !! test
6473 Double RFC
6474 !! input
6475 RFC RFC 1234
6476 !! result
6477 <p>RFC <a href="http://tools.ietf.org/html/rfc1234" class="external mw-magiclink-rfc">RFC 1234</a>
6478 </p>
6479 !! end
6480
6481 !! test
6482 Double RFC with a wiki link
6483 !! input
6484 RFC [[RFC 1234]]
6485 !! result
6486 <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>
6487 </p>
6488 !! end
6489
6490 !! test
6491 RFC code coverage
6492 !! input
6493 RFC 983&#x20;987
6494 !! result
6495 <p><a href="http://tools.ietf.org/html/rfc983" class="external mw-magiclink-rfc">RFC 983</a>&#x20;987
6496 </p>
6497 !! end
6498
6499 !! test
6500 Centre-aligned image
6501 !! input
6502 [[Image:foobar.jpg|centre]]
6503 !! result
6504 <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>
6505
6506 !!end
6507
6508 !! test
6509 None-aligned image
6510 !! input
6511 [[Image:foobar.jpg|none]]
6512 !! result
6513 <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>
6514
6515 !!end
6516
6517 !! test
6518 Width + Height sized image (using px) (height is ignored)
6519 !! input
6520 [[Image:foobar.jpg|640x480px]]
6521 !! result
6522 <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>
6523 </p>
6524 !!end
6525
6526 !! test
6527 Width-sized image (using px, no following whitespace)
6528 !! input
6529 [[Image:foobar.jpg|640px]]
6530 !! result
6531 <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>
6532 </p>
6533 !!end
6534
6535 !! test
6536 Width-sized image (using px, with following whitespace - test regression from r39467)
6537 !! input
6538 [[Image:foobar.jpg|640px ]]
6539 !! result
6540 <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>
6541 </p>
6542 !!end
6543
6544 !! test
6545 Width-sized image (using px, with preceding whitespace - test regression from r39467)
6546 !! input
6547 [[Image:foobar.jpg| 640px]]
6548 !! result
6549 <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>
6550 </p>
6551 !!end
6552
6553 !! test
6554 Another italics / bold test
6555 !! input
6556 ''' ''x'
6557 !! result
6558 <pre>'<i> </i>x'
6559 </pre>
6560 !!end
6561
6562 # Note the results may be incorrect, as parserTest output included this:
6563 # XML error: Mismatched tag at byte 6120:
6564 # ...<dd> </dt></dl> </dd...
6565 !! test
6566 dt/dd/dl test
6567 !! options
6568 disabled
6569 !! input
6570 :;;;::
6571 !! result
6572 <dl><dd><dl><dt><dl><dt><dl><dt><dl><dd><dl><dd>
6573 </dd></dl>
6574 </dd></dl>
6575 </dt></dl>
6576 </dt></dl>
6577 </dt></dl>
6578 </dd></dl>
6579
6580 !!end
6581
6582
6583 # Images with the "|" character in external URLs in comment tags; Eats half the comment, leaves unmatched "</a>" tag.
6584 !! test
6585 Images with the "|" character in the comment
6586 !! options
6587 disabled
6588 !! input
6589 [[image:Foobar.jpg|thumb|An [http://test/?param1=|left|&param2=|x external] URL]]
6590 !! result
6591 <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>
6592
6593 !!end
6594
6595 !! test
6596 [Before] HTML without raw HTML enabled ($wgRawHtml==false)
6597 !! input
6598 <html><script>alert(1);</script></html>
6599 !! result
6600 <p>&lt;html&gt;&lt;script&gt;alert(1);&lt;/script&gt;&lt;/html&gt;
6601 </p>
6602 !! end
6603
6604 !! test
6605 HTML with raw HTML ($wgRawHtml==true)
6606 !! options
6607 rawhtml
6608 !! input
6609 <html><script>alert(1);</script></html>
6610 !! result
6611 <p><script>alert(1);</script>
6612 </p>
6613 !! end
6614
6615 !! test
6616 Parents of subpages, one level up
6617 !! options
6618 subpage title=[[Subpage test/L1/L2/L3]]
6619 !! input
6620 [[../|L2]]
6621 !! result
6622 <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>
6623 </p>
6624 !! end
6625
6626
6627 !! test
6628 Parents of subpages, one level up, not named
6629 !! options
6630 subpage title=[[Subpage test/L1/L2/L3]]
6631 !! input
6632 [[../]]
6633 !! result
6634 <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>
6635 </p>
6636 !! end
6637
6638
6639
6640 !! test
6641 Parents of subpages, two levels up
6642 !! options
6643 disabled
6644 subpage title=[[Subpage test/L1/L2/L3]]
6645 !! input
6646 [[../../|L1]]2
6647 !! result
6648 <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>
6649 </p>
6650 !! end
6651
6652 !! test
6653 Parents of subpages, two levels up, without trailing slash or name.
6654 !! options
6655 subpage title=[[Subpage test/L1/L2/L3]]
6656 !! input
6657 [[../..]]
6658 !! result
6659 <p>[[../..]]
6660 </p>
6661 !! end
6662
6663 !! test
6664 Parents of subpages, two levels up, with lots of extra trailing slashes.
6665 !! options
6666 subpage title=[[Subpage test/L1/L2/L3]]
6667 !! input
6668 [[../../////]]
6669 !! result
6670 <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>
6671 </p>
6672 !! end
6673
6674 !! test
6675 Definition list code coverage
6676 !! input
6677 ; title : def
6678 ; title : def
6679 ;title: def
6680 !! result
6681 <dl><dt> title &nbsp;</dt><dd> def
6682 </dd><dt> title&nbsp;</dt><dd> def
6683 </dd><dt>title</dt><dd> def
6684 </dd></dl>
6685
6686 !! end
6687
6688 !! test
6689 Don't fall for the self-closing div
6690 !! input
6691 <div>hello world</div/>
6692 !! result
6693 <div>hello world</div>
6694
6695 !! end
6696
6697 !! test
6698 MSGNW magic word
6699 !! input
6700 {{MSGNW:msg}}
6701 !! result
6702 <p>&#91;&#91;:Template:Msg&#93;&#93;
6703 </p>
6704 !! end
6705
6706 !! test
6707 RAW magic word
6708 !! input
6709 {{RAW:QUERTY}}
6710 !! result
6711 <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>
6712 </p>
6713 !! end
6714
6715 # This isn't needed for XHTML conformance, but would be handy as a fallback security measure
6716 !! test
6717 Always escape literal '>' in output, not just after '<'
6718 !! input
6719 ><>
6720 !! result
6721 <p>&gt;&lt;&gt;
6722 </p>
6723 !! end
6724
6725 !! test
6726 Template caching
6727 !! input
6728 {{Test}}
6729 {{Test}}
6730 !! result
6731 <p>This is a test template
6732 This is a test template
6733 </p>
6734 !! end
6735
6736
6737 !! article
6738 MediaWiki:Fake
6739 !! text
6740 ==header==
6741 !! endarticle
6742
6743 !! test
6744 Inclusion of !userCanEdit() content
6745 !! input
6746 {{MediaWiki:Fake}}
6747 !! result
6748 <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>
6749
6750 !! end
6751
6752
6753 !! test
6754 Out-of-order TOC heading levels
6755 !! input
6756 ==2==
6757 ======6======
6758 ===3===
6759 =1=
6760 =====5=====
6761 ==2==
6762 !! result
6763 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
6764 <ul>
6765 <li class="toclevel-1 tocsection-1"><a href="#2"><span class="tocnumber">1</span> <span class="toctext">2</span></a>
6766 <ul>
6767 <li class="toclevel-2 tocsection-2"><a href="#6"><span class="tocnumber">1.1</span> <span class="toctext">6</span></a></li>
6768 <li class="toclevel-2 tocsection-3"><a href="#3"><span class="tocnumber">1.2</span> <span class="toctext">3</span></a></li>
6769 </ul>
6770 </li>
6771 <li class="toclevel-1 tocsection-4"><a href="#1"><span class="tocnumber">2</span> <span class="toctext">1</span></a>
6772 <ul>
6773 <li class="toclevel-2 tocsection-5"><a href="#5"><span class="tocnumber">2.1</span> <span class="toctext">5</span></a></li>
6774 <li class="toclevel-2 tocsection-6"><a href="#2_2"><span class="tocnumber">2.2</span> <span class="toctext">2</span></a></li>
6775 </ul>
6776 </li>
6777 </ul>
6778 </td></tr></table><script>if (window.showTocToggle) { var tocShowText = "show"; var tocHideText = "hide"; showTocToggle(); } </script>
6779 <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>
6780 <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>
6781 <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>
6782 <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>
6783 <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>
6784 <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>
6785
6786 !! end
6787
6788
6789 !! test
6790 ISBN with a dummy number
6791 !! input
6792 ISBN ---
6793 !! result
6794 <p>ISBN ---
6795 </p>
6796 !! end
6797
6798
6799 !! test
6800 ISBN with space-delimited number
6801 !! input
6802 ISBN 92 9017 032 8
6803 !! result
6804 <p><a href="/wiki/Special:BookSources/9290170328" class="internal mw-magiclink-isbn">ISBN 92 9017 032 8</a>
6805 </p>
6806 !! end
6807
6808
6809 !! test
6810 ISBN with multiple spaces, no number
6811 !! input
6812 ISBN foo
6813 !! result
6814 <p>ISBN foo
6815 </p>
6816 !! end
6817
6818
6819 !! test
6820 ISBN length
6821 !! input
6822 ISBN 123456789
6823
6824 ISBN 1234567890
6825
6826 ISBN 12345678901
6827 !! result
6828 <p>ISBN 123456789
6829 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
6830 </p><p>ISBN 12345678901
6831 </p>
6832 !! end
6833
6834
6835 !! test
6836 ISBN with trailing year (bug 8110)
6837 !! input
6838 ISBN 1-234-56789-0 - 2006
6839
6840 ISBN 1 234 56789 0 - 2006
6841 !! result
6842 <p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1-234-56789-0</a> - 2006
6843 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1 234 56789 0</a> - 2006
6844 </p>
6845 !! end
6846
6847
6848 !! test
6849 anchorencode
6850 !! input
6851 {{anchorencode:foo bar©#%n}}
6852 !! result
6853 <p>foo_bar.C2.A9.23.25n
6854 </p>
6855 !! end
6856
6857
6858 !! test
6859 Bug 8293: Use of center tag ruins paragraph formatting
6860 !! input
6861 <center>
6862 foo
6863 </center>
6864
6865 bar
6866
6867 baz
6868 !! result
6869 <center>
6870 <p>foo
6871 </p>
6872 </center>
6873 <p>bar
6874 </p>
6875 <pre>baz
6876 </pre>
6877 !! end
6878
6879
6880 ###
6881 ### Language variants related tests
6882 ###
6883 !! test
6884 Self-link in language variants
6885 !! options
6886 title=[[Dunav]] language=sr
6887 !! input
6888 Both [[Dunav]] and [[Дунав]] are names for this river.
6889 !! result
6890 <p>Both <strong class="selflink">Dunav</strong> and <strong class="selflink">Дунав</strong> are names for this river.
6891 </p>
6892 !!end
6893
6894
6895 !! test
6896 Link to pages in language variants
6897 !! options
6898 language=sr
6899 !! input
6900 Main Page can be written as [[Маин Паге]]
6901 !! result
6902 <p>Main Page can be written as <a href="/wiki/Main_Page" title="Main Page">Маин Паге</a>
6903 </p>
6904 !!end
6905
6906
6907 !! test
6908 Multiple links to pages in language variants
6909 !! options
6910 language=sr
6911 !! input
6912 [[Main Page]] can be written as [[Маин Паге]] same as [[Маин Паге]].
6913 !! result
6914 <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>.
6915 </p>
6916 !!end
6917
6918
6919 !! test
6920 Simple template in language variants
6921 !! options
6922 language=sr
6923 !! input
6924 {{тест}}
6925 !! result
6926 <p>This is a test template
6927 </p>
6928 !! end
6929
6930
6931 !! test
6932 Template with explicit namespace in language variants
6933 !! options
6934 language=sr
6935 !! input
6936 {{Template:тест}}
6937 !! result
6938 <p>This is a test template
6939 </p>
6940 !! end
6941
6942
6943 !! test
6944 Basic test for template parameter in language variants
6945 !! options
6946 language=sr
6947 !! input
6948 {{парамтест|param=foo}}
6949 !! result
6950 <p>This is a test template with parameter foo
6951 </p>
6952 !! end
6953
6954
6955 !! test
6956 Simple category in language variants
6957 !! options
6958 language=sr cat
6959 !! input
6960 [[Category:МедиаWики Усер'с Гуиде]]
6961 !! result
6962 <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>
6963 !! end
6964
6965
6966 !! test
6967 Stripping -{}- tags (language variants)
6968 !! options
6969 language=sr
6970 !! input
6971 Latin proverb: -{Ne nuntium necare}-
6972 !! result
6973 <p>Latin proverb: Ne nuntium necare
6974 </p>
6975 !! end
6976
6977
6978 !! test
6979 Prevent conversion with -{}- tags (language variants)
6980 !! options
6981 language=sr variant=sr-ec
6982 !! input
6983 Latinski: -{Ne nuntium necare}-
6984 !! result
6985 <p>Латински: Ne nuntium necare
6986 </p>
6987 !! end
6988
6989
6990 !! test
6991 Prevent conversion of text with -{}- tags (language variants)
6992 !! options
6993 language=sr variant=sr-ec
6994 !! input
6995 Latinski: -{Ne nuntium necare}-
6996 !! result
6997 <p>Латински: Ne nuntium necare
6998 </p>
6999 !! end
7000
7001
7002 !! test
7003 Prevent conversion of links with -{}- tags (language variants)
7004 !! options
7005 language=sr variant=sr-ec
7006 !! input
7007 -{[[Main Page]]}-
7008 !! result
7009 <p><a href="/index.php?title=Main_Page&amp;variant=sr-ec" title="Main Page">Main Page</a>
7010 </p>
7011 !! end
7012
7013
7014 !! test
7015 -{}- tags within headlines (within html for parserConvert())
7016 !! options
7017 language=sr variant=sr-ec
7018 !! input
7019 == -{Naslov}- ==
7020 !! result
7021 <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>
7022
7023 !! end
7024
7025
7026 !! test
7027 Explicit definition of language variant alternatives
7028 !! options
7029 language=zh variant=zh-tw
7030 !! input
7031 -{zh:China;zh-tw:Taiwan}-, not China
7032 !! result
7033 <p>Taiwan, not China
7034 </p>
7035 !! end
7036
7037
7038 !! test
7039 Explicit session-wise language variant mapping (A flag and - flag)
7040 !! options
7041 language=zh variant=zh-tw
7042 !! input
7043 Taiwan is not China.
7044 But -{A|zh:China;zh-tw:Taiwan}- is China,
7045 (This-{-|zh:China;zh-tw:Taiwan}- should be stripped!)
7046 and -{China}- is China.
7047 !! result
7048 <p>Taiwan is not China.
7049 But Taiwan is Taiwan,
7050 (This should be stripped!)
7051 and China is China.
7052 </p>
7053 !! end
7054
7055 !! test
7056 Explicit session-wise language variant mapping (H flag for hide)
7057 !! options
7058 language=zh variant=zh-tw
7059 !! input
7060 (This-{H|zh:China;zh-tw:Taiwan}- should be stripped!)
7061 Taiwan is China.
7062 !! result
7063 <p>(This should be stripped!)
7064 Taiwan is Taiwan.
7065 </p>
7066 !! end
7067
7068 !! test
7069 Adding explicit conversion rule for title (T flag)
7070 !! options
7071 language=zh variant=zh-tw showtitle
7072 !! input
7073 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
7074 !! result
7075 Taiwan
7076 <p>Should be stripped!
7077 </p>
7078 !! end
7079
7080 !! test
7081 Testing that changing the language variant here in the tests actually works
7082 !! options
7083 language=zh variant=zh showtitle
7084 !! input
7085 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
7086 !! result
7087 China
7088 <p>Should be stripped!
7089 </p>
7090 !! end
7091
7092 !! test
7093 Raw output of variant escape tags (R flag)
7094 !! options
7095 language=zh variant=zh-tw
7096 !! input
7097 Raw: -{R|zh:China;zh-tw:Taiwan}-
7098 !! result
7099 <p>Raw: zh:China;zh-tw:Taiwan
7100 </p>
7101 !! end
7102
7103 !! test
7104 Nested using of manual convert syntax
7105 !! options
7106 language=zh variant=zh-hk
7107 !! input
7108 Nested: -{zh-hans:Hi -{zh-cn:China;zh-sg:Singapore;}-;zh-hant:Hello -{zh-tw:Taiwan;zh-hk:H-{ong}- K-{}-ong;}-;}-!
7109 !! result
7110 <p>Nested: Hello Hong Kong!
7111 </p>
7112 !! end
7113
7114 !! test
7115 Do not convert roman numbers to language variants
7116 !! options
7117 language=sr variant=sr-ec
7118 !! input
7119 Fridrih IV je car.
7120 !! result
7121 <p>Фридрих IV је цар.
7122 </p>
7123 !! end
7124
7125 !! test
7126 Unclosed language converter markup "-{"
7127 !! options
7128 language=sr
7129 !! input
7130 -{T|hello
7131 !! result
7132 <p>-{T|hello
7133 </p>
7134 !! end
7135
7136 !! test
7137 Don't convert raw rule "-{R|=&gt;}-" to "=>"
7138 !! options
7139 language=sr
7140 !! input
7141 -{R|=&gt;}-
7142 !! result
7143 <p>=&gt;
7144 </p>
7145 !!end
7146
7147 !!article
7148 Template:Bullet
7149 !!text
7150 * Bar
7151 !!endarticle
7152
7153 !! test
7154 Bug 529: Uncovered bullet
7155 !! input
7156 * Foo {{bullet}}
7157 !! result
7158 <ul><li> Foo
7159 </li><li> Bar
7160 </li></ul>
7161
7162 !! end
7163
7164 !! test
7165 Bug 529: Uncovered table already at line-start
7166 !! input
7167 x
7168
7169 {{table}}
7170 y
7171 !! result
7172 <p>x
7173 </p>
7174 <table>
7175 <tr>
7176 <td> 1 </td><td> 2
7177 </td></tr>
7178 <tr>
7179 <td> 3 </td><td> 4
7180 </td></tr></table>
7181 <p>y
7182 </p>
7183 !! end
7184
7185 !! test
7186 Bug 529: Uncovered bullet in parser function result
7187 !! input
7188 * Foo {{lc:{{bullet}} }}
7189 !! result
7190 <ul><li> Foo
7191 </li><li> bar
7192 </li></ul>
7193
7194 !! end
7195
7196 !! test
7197 Bug 5678: Double-parsed template argument
7198 !! input
7199 {{lc:{{{1}}}|hello}}
7200 !! result
7201 <p>{{{1}}}
7202 </p>
7203 !! end
7204
7205 !! test
7206 Bug 5678: Double-parsed template invocation
7207 !! input
7208 {{lc:{{paramtest {{!}} param = hello }} }}
7209 !! result
7210 <p>{{paramtest | param = hello }}
7211 </p>
7212 !! end
7213
7214 !! test
7215 Case insensitivity of parser functions for non-ASCII characters (bug 8143)
7216 !! options
7217 language=cs
7218 title=[[Main Page]]
7219 !! input
7220 {{PRVNÍVELKÉ:ěščř}}
7221 {{prvnívelké:ěščř}}
7222 {{PRVNÍMALÉ:ěščř}}
7223 {{prvnímalé:ěščř}}
7224 {{MALÁ:ěščř}}
7225 {{malá:ěščř}}
7226 {{VELKÁ:ěščř}}
7227 {{velká:ěščř}}
7228 !! result
7229 <p>Ěščř
7230 Ěščř
7231 ěščř
7232 ěščř
7233 ěščř
7234 ěščř
7235 ĚŠČŘ
7236 ĚŠČŘ
7237 </p>
7238 !! end
7239
7240 !! test
7241 Morwen/13: Unclosed link followed by heading
7242 !! input
7243 [[link
7244 ==heading==
7245 !! result
7246 <p>[[link
7247 </p>
7248 <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>
7249
7250 !! end
7251
7252 !! test
7253 HHP2.1: Heuristics for headings in preprocessor parenthetical structures
7254 !! input
7255 {{foo|
7256 =heading=
7257 !! result
7258 <p>{{foo|
7259 </p>
7260 <h1> <span class="mw-headline" id="heading">heading</span></h1>
7261
7262 !! end
7263
7264 !! test
7265 HHP2.2: Heuristics for headings in preprocessor parenthetical structures
7266 !! input
7267 {{foo|
7268 ==heading==
7269 !! result
7270 <p>{{foo|
7271 </p>
7272 <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>
7273
7274 !! end
7275
7276 !! test
7277 Tildes in comments
7278 !! options
7279 pst
7280 !! input
7281 <!-- ~~~~ -->
7282 !! result
7283 <!-- ~~~~ -->
7284 !! end
7285
7286 !! test
7287 Paragraphs inside divs (no extra line breaks)
7288 !! input
7289 <div>Line one
7290
7291 Line two</div>
7292 !! result
7293 <div>Line one
7294 Line two</div>
7295
7296 !! end
7297
7298 !! test
7299 Paragraphs inside divs (extra line break on open)
7300 !! input
7301 <div>
7302 Line one
7303
7304 Line two</div>
7305 !! result
7306 <div>
7307 <p>Line one
7308 </p>
7309 Line two</div>
7310
7311 !! end
7312
7313 !! test
7314 Paragraphs inside divs (extra line break on close)
7315 !! input
7316 <div>Line one
7317
7318 Line two
7319 </div>
7320 !! result
7321 <div>Line one
7322 <p>Line two
7323 </p>
7324 </div>
7325
7326 !! end
7327
7328 !! test
7329 Paragraphs inside divs (extra line break on open and close)
7330 !! input
7331 <div>
7332 Line one
7333
7334 Line two
7335 </div>
7336 !! result
7337 <div>
7338 <p>Line one
7339 </p><p>Line two
7340 </p>
7341 </div>
7342
7343 !! end
7344
7345 # Bug 6200: <blockquote> should behave like <div> with respect to line breaks
7346 !! test
7347 Bug 6200: paragraphs inside blockquotes (no extra line breaks)
7348 !! options
7349 disabled
7350 !! input
7351 <blockquote>Line one
7352
7353 Line two</blockquote>
7354 !! result
7355 <blockquote>Line one
7356 Line two</blockquote>
7357
7358 !! end
7359
7360 !! test
7361 Bug 6200: paragraphs inside blockquotes (extra line break on open)
7362 !! options
7363 disabled
7364 !! input
7365 <blockquote>
7366 Line one
7367
7368 Line two</blockquote>
7369 !! result
7370 <blockquote>
7371 <p>Line one
7372 </p>
7373 Line two</blockquote>
7374
7375 !! end
7376
7377 !! test
7378 Bug 6200: paragraphs inside blockquotes (extra line break on close)
7379 !! options
7380 disabled
7381 !! input
7382 <blockquote>Line one
7383
7384 Line two
7385 </blockquote>
7386 !! result
7387 <blockquote>Line one
7388 <p>Line two
7389 </p>
7390 </blockquote>
7391
7392 !! end
7393
7394 !! test
7395 Bug 6200: paragraphs inside blockquotes (extra line break on open and close)
7396 !! options
7397 disabled
7398 !! input
7399 <blockquote>
7400 Line one
7401
7402 Line two
7403 </blockquote>
7404 !! result
7405 <blockquote>
7406 <p>Line one
7407 </p><p>Line two
7408 </p>
7409 </blockquote>
7410
7411 !! end
7412
7413 !! test
7414 Paragraphs inside blockquotes/divs (no extra line breaks)
7415 !! input
7416 <blockquote><div>Line one
7417
7418 Line two</div></blockquote>
7419 !! result
7420 <blockquote><div>Line one
7421 Line two</div></blockquote>
7422
7423 !! end
7424
7425 !! test
7426 Paragraphs inside blockquotes/divs (extra line break on open)
7427 !! input
7428 <blockquote><div>
7429 Line one
7430
7431 Line two</div></blockquote>
7432 !! result
7433 <blockquote><div>
7434 <p>Line one
7435 </p>
7436 Line two</div></blockquote>
7437
7438 !! end
7439
7440 !! test
7441 Paragraphs inside blockquotes/divs (extra line break on close)
7442 !! input
7443 <blockquote><div>Line one
7444
7445 Line two
7446 </div></blockquote>
7447 !! result
7448 <blockquote><div>Line one
7449 <p>Line two
7450 </p>
7451 </div></blockquote>
7452
7453 !! end
7454
7455 !! test
7456 Paragraphs inside blockquotes/divs (extra line break on open and close)
7457 !! input
7458 <blockquote><div>
7459 Line one
7460
7461 Line two
7462 </div></blockquote>
7463 !! result
7464 <blockquote><div>
7465 <p>Line one
7466 </p><p>Line two
7467 </p>
7468 </div></blockquote>
7469
7470 !! end
7471
7472 !! test
7473 Interwiki links trounced by replaceExternalLinks after early LinkHolderArray expansion
7474 !! options
7475 wgLinkHolderBatchSize=0
7476 !! input
7477 [[meatball:1]]
7478 [[meatball:2]]
7479 [[meatball:3]]
7480 !! result
7481 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?1" class="extiw" title="meatball:1">meatball:1</a>
7482 <a href="http://www.usemod.com/cgi-bin/mb.pl?2" class="extiw" title="meatball:2">meatball:2</a>
7483 <a href="http://www.usemod.com/cgi-bin/mb.pl?3" class="extiw" title="meatball:3">meatball:3</a>
7484 </p>
7485 !! end
7486
7487 !! test
7488 Free external link invading image caption
7489 !! input
7490 [[Image:Foobar.jpg|thumb|http://x|hello]]
7491 !! result
7492 <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>
7493
7494 !! end
7495
7496 !! test
7497 Bug 15196: localised external link numbers
7498 !! options
7499 language=fa
7500 !! input
7501 [http://en.wikipedia.org/]
7502 !! result
7503 <p><a href="http://en.wikipedia.org/" class="external autonumber" rel="nofollow">[۱]</a>
7504 </p>
7505 !! end
7506
7507 !! test
7508 Multibyte character in padleft
7509 !! input
7510 {{padleft:-Hello|7|Æ}}
7511 !! result
7512 <p>Æ-Hello
7513 </p>
7514 !! end
7515
7516 !! test
7517 Multibyte character in padright
7518 !! input
7519 {{padright:Hello-|7|Æ}}
7520 !! result
7521 <p>Hello-Æ
7522 </p>
7523 !! end
7524
7525 !! test
7526 Formatted date
7527 !! config
7528 wgUseDynamicDates=1
7529 !! input
7530 [[2009-03-24]]
7531 !! result
7532 <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>
7533 </p>
7534 !!end
7535
7536 !!test
7537 formatdate parser function
7538 !!input
7539 {{#formatdate:2009-03-24}}
7540 !! result
7541 <p><span class="mw-formatted-date" title="2009-03-24">2009-03-24</span>
7542 </p>
7543 !! end
7544
7545 !!test
7546 formatdate parser function, with default format
7547 !!input
7548 {{#formatdate:2009-03-24|mdy}}
7549 !! result
7550 <p><span class="mw-formatted-date" title="2009-03-24">March 24, 2009</span>
7551 </p>
7552 !! end
7553
7554 !! test
7555 Linked date with autoformatting disabled
7556 !! config
7557 wgUseDynamicDates=false
7558 !! input
7559 [[2009-03-24]]
7560 !! result
7561 <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>
7562 </p>
7563 !! end
7564
7565 !! test
7566 Spacing of numbers in formatted dates
7567 !! input
7568 {{#formatdate:January 15}}
7569 !! result
7570 <p><span class="mw-formatted-date" title="01-15">January 15</span>
7571 </p>
7572 !! end
7573
7574 !! test
7575 Spacing of numbers in formatted dates (linked)
7576 !! config
7577 wgUseDynamicDates=true
7578 !! input
7579 [[January 15]]
7580 !! result
7581 <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>
7582 </p>
7583 !! end
7584
7585 #
7586 #
7587 #
7588
7589 #
7590 # Edit comments
7591 #
7592
7593 !! test
7594 Edit comment with link
7595 !! options
7596 comment
7597 !! input
7598 I like the [[Main Page]] a lot
7599 !! result
7600 I like the <a href="/wiki/Main_Page" title="Main Page">Main Page</a> a lot
7601 !!end
7602
7603 !! test
7604 Edit comment with link and link text
7605 !! options
7606 comment
7607 !! input
7608 I like the [[Main Page|best pages]] a lot
7609 !! result
7610 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
7611 !!end
7612
7613 !! test
7614 Edit comment with link and link text with suffix
7615 !! options
7616 comment
7617 !! input
7618 I like the [[Main Page|best page]]s a lot
7619 !! result
7620 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
7621 !!end
7622
7623 !! test
7624 Edit comment with section link (non-local, eg in history list)
7625 !! options
7626 comment title=[[Main Page]]
7627 !! input
7628 /* External links */ removed bogus entries
7629 !! result
7630 <span class="autocomment"><a href="/wiki/Main_Page#External_links" title="Main Page">→</a>External links: </span> removed bogus entries
7631 !!end
7632
7633 !! test
7634 Edit comment with section link (local, eg in diff view)
7635 !! options
7636 comment local title=[[Main Page]]
7637 !! input
7638 /* External links */ removed bogus entries
7639 !! result
7640 <span class="autocomment"><a href="#External_links">→</a>External links: </span> removed bogus entries
7641 !!end
7642
7643 !! test
7644 Edit comment with subpage link (bug 14080)
7645 !! options
7646 comment
7647 subpage
7648 title=[[Subpage test]]
7649 !! input
7650 Poked at a [[/subpage]] here...
7651 !! result
7652 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a> here...
7653 !!end
7654
7655 !! test
7656 Edit comment with subpage link and link text (bug 14080)
7657 !! options
7658 comment
7659 subpage
7660 title=[[Subpage test]]
7661 !! input
7662 Poked at a [[/subpage|neat little page]] here...
7663 !! result
7664 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">neat little page</a> here...
7665 !!end
7666
7667 !! test
7668 Edit comment with bogus subpage link in non-subpage NS (bug 14080)
7669 !! options
7670 comment
7671 title=[[Subpage test]]
7672 !! input
7673 Poked at a [[/subpage]] here...
7674 !! result
7675 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...
7676 !!end
7677
7678 !! test
7679 Edit comment with bare anchor link (local, as on diff)
7680 !! options
7681 comment
7682 local
7683 title=[[Main Page]]
7684 !!input
7685 [[#section]]
7686 !! result
7687 <a href="#section">#section</a>
7688 !! end
7689
7690 !! test
7691 Edit comment with bare anchor link (non-local, as on history)
7692 !! options
7693 comment
7694 title=[[Main Page]]
7695 !!input
7696 [[#section]]
7697 !! result
7698 <a href="/wiki/Main_Page#section" title="Main Page">#section</a>
7699 !! end
7700
7701 !!article
7702 MediaWiki:bad image list
7703 !!text
7704 * [[File:Bad.jpg]] except [[Nasty page]]
7705 !!endarticle
7706
7707 !! test
7708 Bad images - basic functionality
7709 !! input
7710 [[File:Bad.jpg]]
7711 !! result
7712 !! end
7713
7714 !! test
7715 Bad images - bug 16039: text after bad image disappears
7716 !! input
7717 Foo bar
7718 [[File:Bad.jpg]]
7719 Bar foo
7720 !! result
7721 <p>Foo bar
7722 </p><p>Bar foo
7723 </p>
7724 !! end
7725
7726
7727 TODO:
7728 more images
7729 more tables
7730 math
7731 character entities
7732 and much more
7733 Try for 100% code coverage