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