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