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