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