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