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