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