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