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