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