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