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