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