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