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