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