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