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