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