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