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