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