Remove $wgServerName. Its only usage was for {{servername}}, and needed to be kept...
[lhc/web/wiklou.git] / maintenance / tests / parser / parserTests.txt
1 # MediaWiki Parser test cases
2 # Some taken from http://meta.wikimedia.org/wiki/Parser_testing
3 # All (C) their respective authors and released under the GPL
4 #
5 # The syntax should be fairly self-explanatory.
6 #
7 # Currently supported test options:
8 # One of the following three:
9 #
10 # (default) generate HTML output
11 # pst apply pre-save transform
12 # msg apply message transform
13 #
14 # Plus any combination of these:
15 #
16 # cat add category links
17 # ill add inter-language links
18 # subpage enable subpages (disabled by default)
19 # noxml don't check for XML well formdness
20 # title=[[XXX]] run test using article title XXX
21 # language=XXX set content language to XXX for this test
22 # variant=XXX set the variant of language for this test (eg zh-tw)
23 # disabled do not run test
24 # showtitle make the first line the title
25 # comment run through Linker::formatComment() instead of main parser
26 # local format section links in edit comment text as local links
27 #
28 # For testing purposes, temporary articles can created:
29 # !!article / NAMESPACE:TITLE / !!text / ARTICLE TEXT / !!endarticle
30 # where '/' denotes a newline.
31
32 # This is the standard article assumed to exist.
33 !! article
34 Main Page
35 !! text
36 blah blah
37 !! endarticle
38
39 !!article
40 Template:Foo
41 !!text
42 FOO
43 !!endarticle
44
45 !! article
46 Template:Blank
47 !! text
48 !! endarticle
49
50 !! article
51 Template:!
52 !! text
53 |
54 !! endarticle
55
56 !!article
57 MediaWiki:bad image list
58 !!text
59 * [[File:Bad.jpg]] except [[Nasty page]]
60 !!endarticle
61
62 ###
63 ### Basic tests
64 ###
65 !! test
66 Blank input
67 !! input
68 !! result
69 !! end
70
71
72 !! test
73 Simple paragraph
74 !! input
75 This is a simple paragraph.
76 !! result
77 <p>This is a simple paragraph.
78 </p>
79 !! end
80
81 !! test
82 Simple list
83 !! input
84 * Item 1
85 * Item 2
86 !! result
87 <ul><li> Item 1
88 </li><li> Item 2
89 </li></ul>
90
91 !! end
92
93 !! test
94 Italics and bold
95 !! input
96 * plain
97 * plain''italic''plain
98 * plain''italic''plain''italic''plain
99 * plain'''bold'''plain
100 * plain'''bold'''plain'''bold'''plain
101 * plain''italic''plain'''bold'''plain
102 * plain'''bold'''plain''italic''plain
103 * plain''italic'''bold-italic'''italic''plain
104 * plain'''bold''bold-italic''bold'''plain
105 * plain'''''bold-italic'''italic''plain
106 * plain'''''bold-italic''bold'''plain
107 * plain''italic'''bold-italic'''''plain
108 * plain'''bold''bold-italic'''''plain
109 * plain l'''italic''plain
110 * plain l''''bold''' plain
111 !! result
112 <ul><li> plain
113 </li><li> plain<i>italic</i>plain
114 </li><li> plain<i>italic</i>plain<i>italic</i>plain
115 </li><li> plain<b>bold</b>plain
116 </li><li> plain<b>bold</b>plain<b>bold</b>plain
117 </li><li> plain<i>italic</i>plain<b>bold</b>plain
118 </li><li> plain<b>bold</b>plain<i>italic</i>plain
119 </li><li> plain<i>italic<b>bold-italic</b>italic</i>plain
120 </li><li> plain<b>bold<i>bold-italic</i>bold</b>plain
121 </li><li> plain<i><b>bold-italic</b>italic</i>plain
122 </li><li> plain<b><i>bold-italic</i>bold</b>plain
123 </li><li> plain<i>italic<b>bold-italic</b></i>plain
124 </li><li> plain<b>bold<i>bold-italic</i></b>plain
125 </li><li> plain l'<i>italic</i>plain
126 </li><li> plain l'<b>bold</b> plain
127 </li></ul>
128
129 !! end
130
131 ###
132 ### <nowiki> test cases
133 ###
134
135 !! test
136 <nowiki> unordered list
137 !! input
138 <nowiki>* This is not an unordered list item.</nowiki>
139 !! result
140 <p>* This is not an unordered list item.
141 </p>
142 !! end
143
144 !! test
145 <nowiki> spacing
146 !! input
147 <nowiki>Lorem ipsum dolor
148
149 sed abit.
150 sed nullum.
151
152 :and a colon
153 </nowiki>
154 !! result
155 <p>Lorem ipsum dolor
156
157 sed abit.
158 sed nullum.
159
160 :and a colon
161
162 </p>
163 !! end
164
165 !! test
166 nowiki 3
167 !! input
168 :There is not nowiki.
169 :There is <nowiki>nowiki</nowiki>.
170
171 #There is not nowiki.
172 #There is <nowiki>nowiki</nowiki>.
173
174 *There is not nowiki.
175 *There is <nowiki>nowiki</nowiki>.
176 !! result
177 <dl><dd>There is not nowiki.
178 </dd><dd>There is nowiki.
179 </dd></dl>
180 <ol><li>There is not nowiki.
181 </li><li>There is nowiki.
182 </li></ol>
183 <ul><li>There is not nowiki.
184 </li><li>There is nowiki.
185 </li></ul>
186
187 !! end
188
189
190 ###
191 ### Comments
192 ###
193 !! test
194 Comment test 1
195 !! input
196 <!-- comment 1 --> asdf
197 <!-- comment 2 -->
198 !! result
199 <pre>asdf
200 </pre>
201
202 !! end
203
204 !! test
205 Comment test 2
206 !! input
207 asdf
208 <!-- comment 1 -->
209 jkl
210 !! result
211 <p>asdf
212 jkl
213 </p>
214 !! end
215
216 !! test
217 Comment test 3
218 !! input
219 asdf
220 <!-- comment 1 -->
221 <!-- comment 2 -->
222 jkl
223 !! result
224 <p>asdf
225 jkl
226 </p>
227 !! end
228
229 !! test
230 Comment test 4
231 !! input
232 asdf<!-- comment 1 -->jkl
233 !! result
234 <p>asdfjkl
235 </p>
236 !! end
237
238 !! test
239 Comment spacing
240 !! input
241 a
242 <!-- foo --> b <!-- bar -->
243 c
244 !! result
245 <p>a
246 </p>
247 <pre> b
248 </pre>
249 <p>c
250 </p>
251 !! end
252
253 !! test
254 Comment whitespace
255 !! input
256 <!-- returns a single newline, not nothing, since the newline after > is not stripped -->
257 !! result
258
259 !! end
260
261 !! test
262 Comment semantics and delimiters
263 !! input
264 <!-- --><!----><!-----><!------>
265 !! result
266
267 !! end
268
269 !! test
270 Comment semantics and delimiters, redux
271 !! input
272 <!-- In SGML every "foo" here would actually show up in the text -- foo -- bar
273 -- foo -- funky huh? ... -->
274 !! result
275
276 !! end
277
278 !! test
279 Comment semantics and delimiters: directors cut
280 !! input
281 <!-- ... However we like to keep things simple and somewhat XML-ish so we eat
282 everything starting with < followed by !-- until the first -- and > we see,
283 that wouldn't be valid XML however, since in XML -- has to terminate a comment
284 -->-->
285 !! result
286 <p>--&gt;
287 </p>
288 !! end
289
290 !! test
291 Comment semantics: nesting
292 !! input
293 <!--<!-- no, we're not going to do anything fancy here -->-->
294 !! result
295 <p>--&gt;
296 </p>
297 !! end
298
299 !! test
300 Comment semantics: unclosed comment at end
301 !! input
302 <!--This comment will run out to the end of the document
303 !! result
304
305 !! end
306
307 !! test
308 Comment in template title
309 !! input
310 {{f<!---->oo}}
311 !! result
312 <p>FOO
313 </p>
314 !! end
315
316 !! test
317 Comment on its own line post-expand
318 !! input
319 a
320 {{blank}}<!---->
321 b
322 !! result
323 <p>a
324 </p><p>b
325 </p>
326 !! end
327
328 ###
329 ### Preformatted text
330 ###
331 !! test
332 Preformatted text
333 !! input
334 This is some
335 Preformatted text
336 With ''italic''
337 And '''bold'''
338 And a [[Main Page|link]]
339 !! result
340 <pre>This is some
341 Preformatted text
342 With <i>italic</i>
343 And <b>bold</b>
344 And a <a href="/wiki/Main_Page" title="Main Page">link</a>
345 </pre>
346 !! end
347
348 !! test
349 <pre> with <nowiki> inside (compatibility with 1.6 and earlier)
350 !! input
351 <pre><nowiki>
352 <b>
353 <cite>
354 <em>
355 </nowiki></pre>
356 !! result
357 <pre>
358 &lt;b&gt;
359 &lt;cite&gt;
360 &lt;em&gt;
361 </pre>
362
363 !! end
364
365 !! test
366 Regression with preformatted in <center>
367 !! input
368 <center>
369 Blah
370 </center>
371 !! result
372 <center>
373 <pre>Blah
374 </pre>
375 </center>
376
377 !! end
378
379 # Expected output in the following test is not really expected (there should be
380 # <pre> in the output) -- it's only testing for well-formedness.
381 !! test
382 Bug 6200: Preformatted in <blockquote>
383 !! input
384 <blockquote>
385 Blah
386 </blockquote>
387 !! result
388 <blockquote>
389 Blah
390 </blockquote>
391
392 !! end
393
394 !! test
395 <pre> with attributes (bug 3202)
396 !! input
397 <pre style="background: blue; color:white">Bluescreen of WikiDeath</pre>
398 !! result
399 <pre style="background: blue; color:white">Bluescreen of WikiDeath</pre>
400
401 !! end
402
403 !! test
404 <pre> with width attribute (bug 3202)
405 !! input
406 <pre width="8">Narrow screen goodies</pre>
407 !! result
408 <pre width="8">Narrow screen goodies</pre>
409
410 !! end
411
412 !! test
413 <pre> with forbidden attribute (bug 3202)
414 !! input
415 <pre width="8" onmouseover="alert(document.cookie)">Narrow screen goodies</pre>
416 !! result
417 <pre width="8">Narrow screen goodies</pre>
418
419 !! end
420
421 !! test
422 <pre> with forbidden attribute values (bug 3202)
423 !! input
424 <pre width="8" style="border-width: expression(alert(document.cookie))">Narrow screen goodies</pre>
425 !! result
426 <pre width="8" style="/* insecure input */">Narrow screen goodies</pre>
427
428 !! end
429
430 ###
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://Britney-Spears" class="external free" rel="nofollow">http://Britney-Spears</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 !! article
3572 File:Barfoo.jpg
3573 !! text
3574 #REDIRECT [[File:Barfoo.jpg]]
3575 !! endarticle
3576
3577 !! test
3578 Redirected image
3579 !! input
3580 [[Image:Barfoo.jpg]]
3581 !! result
3582 <p><a href="/wiki/File:Barfoo.jpg" title="File:Barfoo.jpg">File:Barfoo.jpg</a>
3583 </p>
3584 !! end
3585
3586 !! test
3587 Missing image with uploads disabled
3588 !! options
3589 wgEnableUploads=0
3590 !! input
3591 [[Image:Foobaz.jpg]]
3592 !! result
3593 <p><a href="/wiki/File:Foobaz.jpg" title="File:Foobaz.jpg">File:Foobaz.jpg</a>
3594 </p>
3595 !! end
3596
3597
3598 ###
3599 ### Subpages
3600 ###
3601 !! article
3602 Subpage test/subpage
3603 !! text
3604 foo
3605 !! endarticle
3606
3607 !! test
3608 Subpage link
3609 !! options
3610 subpage title=[[Subpage test]]
3611 !! input
3612 [[/subpage]]
3613 !! result
3614 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a>
3615 </p>
3616 !! end
3617
3618 !! test
3619 Subpage noslash link
3620 !! options
3621 subpage title=[[Subpage test]]
3622 !!input
3623 [[/subpage/]]
3624 !! result
3625 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">subpage</a>
3626 </p>
3627 !! end
3628
3629 !! test
3630 Disabled subpages
3631 !! input
3632 [[/subpage]]
3633 !! result
3634 <p><a href="/index.php?title=/subpage&amp;action=edit&amp;redlink=1" class="new" title="/subpage (page does not exist)">/subpage</a>
3635 </p>
3636 !! end
3637
3638 !! test
3639 BUG 561: {{/Subpage}}
3640 !! options
3641 subpage title=[[Page]]
3642 !! input
3643 {{/Subpage}}
3644 !! result
3645 <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>
3646 </p>
3647 !! end
3648
3649 ###
3650 ### Categories
3651 ###
3652 !! article
3653 Category:MediaWiki User's Guide
3654 !! text
3655 blah
3656 !! endarticle
3657
3658 !! test
3659 Link to category
3660 !! input
3661 [[:Category:MediaWiki User's Guide]]
3662 !! result
3663 <p><a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">Category:MediaWiki User's Guide</a>
3664 </p>
3665 !! end
3666
3667 !! test
3668 Simple category
3669 !! options
3670 cat
3671 !! input
3672 [[Category:MediaWiki User's Guide]]
3673 !! result
3674 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
3675 !! end
3676
3677 !! test
3678 PAGESINCATEGORY invalid title fatal (r33546 fix)
3679 !! input
3680 {{PAGESINCATEGORY:<bogus>}}
3681 !! result
3682 <p>0
3683 </p>
3684 !! end
3685
3686 ###
3687 ### Inter-language links
3688 ###
3689 !! test
3690 Inter-language links
3691 !! options
3692 ill
3693 !! input
3694 [[es:Alimento]]
3695 [[fr:Nourriture]]
3696 [[zh:&#39135;&#21697;]]
3697 !! result
3698 es:Alimento fr:Nourriture zh:食品
3699 !! end
3700
3701 ###
3702 ### Sections
3703 ###
3704 !! test
3705 Basic section headings
3706 !! input
3707 == Headline 1 ==
3708 Some text
3709
3710 ==Headline 2==
3711 More
3712 ===Smaller headline===
3713 Blah blah
3714 !! result
3715 <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>
3716 <p>Some text
3717 </p>
3718 <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>
3719 <p>More
3720 </p>
3721 <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>
3722 <p>Blah blah
3723 </p>
3724 !! end
3725
3726 !! test
3727 Section headings with TOC
3728 !! input
3729 == Headline 1 ==
3730 === Subheadline 1 ===
3731 ===== Skipping a level =====
3732 ====== Skipping a level ======
3733
3734 == Headline 2 ==
3735 Some text
3736 ===Another headline===
3737 !! result
3738 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
3739 <ul>
3740 <li class="toclevel-1 tocsection-1"><a href="#Headline_1"><span class="tocnumber">1</span> <span class="toctext">Headline 1</span></a>
3741 <ul>
3742 <li class="toclevel-2 tocsection-2"><a href="#Subheadline_1"><span class="tocnumber">1.1</span> <span class="toctext">Subheadline 1</span></a>
3743 <ul>
3744 <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>
3745 <ul>
3746 <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>
3747 </ul>
3748 </li>
3749 </ul>
3750 </li>
3751 </ul>
3752 </li>
3753 <li class="toclevel-1 tocsection-5"><a href="#Headline_2"><span class="tocnumber">2</span> <span class="toctext">Headline 2</span></a>
3754 <ul>
3755 <li class="toclevel-2 tocsection-6"><a href="#Another_headline"><span class="tocnumber">2.1</span> <span class="toctext">Another headline</span></a></li>
3756 </ul>
3757 </li>
3758 </ul>
3759 </td></tr></table>
3760 <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>
3761 <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>
3762 <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>
3763 <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>
3764 <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>
3765 <p>Some text
3766 </p>
3767 <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>
3768
3769 !! end
3770
3771 # perl -e 'print "="x$_," Level $_ heading","="x$_,"\n" for 1..10'
3772 !! test
3773 Handling of sections up to level 6 and beyond
3774 !! input
3775 = Level 1 Heading=
3776 == Level 2 Heading==
3777 === Level 3 Heading===
3778 ==== Level 4 Heading====
3779 ===== Level 5 Heading=====
3780 ====== Level 6 Heading======
3781 ======= Level 7 Heading=======
3782 ======== Level 8 Heading========
3783 ========= Level 9 Heading=========
3784 ========== Level 10 Heading==========
3785 !! result
3786 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
3787 <ul>
3788 <li class="toclevel-1 tocsection-1"><a href="#Level_1_Heading"><span class="tocnumber">1</span> <span class="toctext">Level 1 Heading</span></a>
3789 <ul>
3790 <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>
3791 <ul>
3792 <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>
3793 <ul>
3794 <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>
3795 <ul>
3796 <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>
3797 <ul>
3798 <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>
3799 <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>
3800 <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>
3801 <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>
3802 <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>
3803 </ul>
3804 </li>
3805 </ul>
3806 </li>
3807 </ul>
3808 </li>
3809 </ul>
3810 </li>
3811 </ul>
3812 </li>
3813 </ul>
3814 </td></tr></table>
3815 <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>
3816 <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>
3817 <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>
3818 <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>
3819 <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>
3820 <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>
3821 <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>
3822 <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>
3823 <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>
3824 <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>
3825
3826 !! end
3827
3828 !! test
3829 TOC regression (bug 9764)
3830 !! input
3831 == title 1 ==
3832 === title 1.1 ===
3833 ==== title 1.1.1 ====
3834 === title 1.2 ===
3835 == title 2 ==
3836 === title 2.1 ===
3837 !! result
3838 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
3839 <ul>
3840 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
3841 <ul>
3842 <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>
3843 <ul>
3844 <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>
3845 </ul>
3846 </li>
3847 <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>
3848 </ul>
3849 </li>
3850 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
3851 <ul>
3852 <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>
3853 </ul>
3854 </li>
3855 </ul>
3856 </td></tr></table>
3857 <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>
3858 <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>
3859 <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>
3860 <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>
3861 <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>
3862 <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>
3863
3864 !! end
3865
3866 !! test
3867 TOC with wgMaxTocLevel=3 (bug 6204)
3868 !! options
3869 wgMaxTocLevel=3
3870 !! input
3871 == title 1 ==
3872 === title 1.1 ===
3873 ==== title 1.1.1 ====
3874 === title 1.2 ===
3875 == title 2 ==
3876 === title 2.1 ===
3877 !! result
3878 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
3879 <ul>
3880 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
3881 <ul>
3882 <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>
3883 <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>
3884 </ul>
3885 </li>
3886 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
3887 <ul>
3888 <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>
3889 </ul>
3890 </li>
3891 </ul>
3892 </td></tr></table>
3893 <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>
3894 <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>
3895 <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>
3896 <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>
3897 <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>
3898 <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>
3899
3900 !! end
3901
3902 !! test
3903 TOC with wgMaxTocLevel=3 and two level four headings (bug 6204)
3904 !! options
3905 wgMaxTocLevel=3
3906 !! input
3907 ==Section 1==
3908 ===Section 1.1===
3909 ====Section 1.1.1====
3910 ====Section 1.1.1.1====
3911 ==Section 2==
3912 !! result
3913 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
3914 <ul>
3915 <li class="toclevel-1 tocsection-1"><a href="#Section_1"><span class="tocnumber">1</span> <span class="toctext">Section 1</span></a>
3916 <ul>
3917 <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>
3918 </ul>
3919 </li>
3920 <li class="toclevel-1 tocsection-5"><a href="#Section_2"><span class="tocnumber">2</span> <span class="toctext">Section 2</span></a></li>
3921 </ul>
3922 </td></tr></table>
3923 <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>
3924 <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>
3925 <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>
3926 <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>
3927 <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>
3928
3929 !! end
3930
3931
3932 !! test
3933 Resolving duplicate section names
3934 !! input
3935 == Foo bar ==
3936 == Foo bar ==
3937 !! result
3938 <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>
3939 <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>
3940
3941 !! end
3942
3943 !! test
3944 Resolving duplicate section names with differing case (bug 10721)
3945 !! input
3946 == Foo bar ==
3947 == Foo Bar ==
3948 !! result
3949 <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>
3950 <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>
3951
3952 !! end
3953
3954 !! article
3955 Template:sections
3956 !! text
3957 ===Section 1===
3958 ==Section 2==
3959 !! endarticle
3960
3961 !! test
3962 Template with sections, __NOTOC__
3963 !! input
3964 __NOTOC__
3965 ==Section 0==
3966 {{sections}}
3967 ==Section 4==
3968 !! result
3969 <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>
3970 <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>
3971 <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>
3972 <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>
3973
3974 !! end
3975
3976 !! test
3977 __NOEDITSECTION__ keyword
3978 !! input
3979 __NOEDITSECTION__
3980 ==Section 1==
3981 ==Section 2==
3982 !! result
3983 <h2> <span class="mw-headline" id="Section_1">Section 1</span></h2>
3984 <h2> <span class="mw-headline" id="Section_2">Section 2</span></h2>
3985
3986 !! end
3987
3988 !! test
3989 Link inside a section heading
3990 !! input
3991 ==Section with a [[Main Page|link]] in it==
3992 !! result
3993 <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>
3994
3995 !! end
3996
3997 !! test
3998 TOC regression (bug 12077)
3999 !! input
4000 __TOC__
4001 == title 1 ==
4002 === title 1.1 ===
4003 == title 2 ==
4004 !! result
4005 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
4006 <ul>
4007 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
4008 <ul>
4009 <li class="toclevel-2 tocsection-2"><a href="#title_1.1"><span class="tocnumber">1.1</span> <span class="toctext">title 1.1</span></a></li>
4010 </ul>
4011 </li>
4012 <li class="toclevel-1 tocsection-3"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a></li>
4013 </ul>
4014 </td></tr></table>
4015 <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>
4016 <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>
4017 <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>
4018
4019 !! end
4020
4021 !! test
4022 BUG 1219 URL next to image (good)
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 Short headings with trailing space should match behaviour of Parser::doHeadings (bug 19910)
4032 !! input
4033 ===
4034 The line above must have a trailing space!
4035 === <!--
4036 --> <!-- -->
4037 But just in case it doesn't...
4038 !! result
4039 <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>
4040 <p>The line above must have a trailing space!
4041 </p>
4042 <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>
4043 <p>But just in case it doesn't...
4044 </p>
4045 !! end
4046
4047 !! test
4048 BUG 1219 URL next to image (broken)
4049 !! input
4050 http://example.com[[Image:foobar.jpg]]
4051 !! result
4052 <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>
4053 </p>
4054 !!end
4055
4056 !! test
4057 Bug 1186 news: in the middle of text
4058 !! input
4059 http://en.wikinews.org/wiki/Wikinews:Workplace
4060 !! result
4061 <p><a href="http://en.wikinews.org/wiki/Wikinews:Workplace" class="external free" rel="nofollow">http://en.wikinews.org/wiki/Wikinews:Workplace</a>
4062 </p>
4063 !!end
4064
4065
4066 !! test
4067 Namespaced link must have a title
4068 !! input
4069 [[Project:]]
4070 !! result
4071 <p>[[Project:]]
4072 </p>
4073 !!end
4074
4075 !! test
4076 Namespaced link must have a title (bad fragment version)
4077 !! input
4078 [[Project:#fragment]]
4079 !! result
4080 <p>[[Project:#fragment]]
4081 </p>
4082 !!end
4083
4084
4085 !! test
4086 div with no attributes
4087 !! input
4088 <div>HTML rocks</div>
4089 !! result
4090 <div>HTML rocks</div>
4091
4092 !! end
4093
4094 !! test
4095 div with double-quoted attribute
4096 !! input
4097 <div id="rock">HTML rocks</div>
4098 !! result
4099 <div id="rock">HTML rocks</div>
4100
4101 !! end
4102
4103 !! test
4104 div with single-quoted attribute
4105 !! input
4106 <div id='rock'>HTML rocks</div>
4107 !! result
4108 <div id="rock">HTML rocks</div>
4109
4110 !! end
4111
4112 !! test
4113 div with unquoted attribute
4114 !! input
4115 <div id=rock>HTML rocks</div>
4116 !! result
4117 <div id="rock">HTML rocks</div>
4118
4119 !! end
4120
4121 !! test
4122 div with illegal double attributes
4123 !! input
4124 <div align="center" align="right">HTML rocks</div>
4125 !! result
4126 <div align="right">HTML rocks</div>
4127
4128 !!end
4129
4130 !! test
4131 HTML multiple attributes correction
4132 !! input
4133 <p class="error" class="awesome">Awesome!</p>
4134 !! result
4135 <p class="awesome">Awesome!</p>
4136
4137 !!end
4138
4139 !! test
4140 Table multiple attributes correction
4141 !! input
4142 {|
4143 !+ class="error" class="awesome"| status
4144 |}
4145 !! result
4146 <table>
4147 <tr>
4148 <th class="awesome"> status
4149 </th></tr></table>
4150
4151 !!end
4152
4153 !! test
4154 DIV IN UPPERCASE
4155 !! input
4156 <DIV ALIGN="center">HTML ROCKS</DIV>
4157 !! result
4158 <div align="center">HTML ROCKS</div>
4159
4160 !!end
4161
4162
4163 !! test
4164 text with amp in the middle of nowhere
4165 !! input
4166 Remember AT&T?
4167 !!result
4168 <p>Remember AT&amp;T?
4169 </p>
4170 !! end
4171
4172 !! test
4173 text with character entity: eacute
4174 !! input
4175 I always thought &eacute; was a cute letter.
4176 !! result
4177 <p>I always thought &eacute; was a cute letter.
4178 </p>
4179 !! end
4180
4181 !! test
4182 text with undefined character entity: xacute
4183 !! input
4184 I always thought &xacute; was a cute letter.
4185 !! result
4186 <p>I always thought &amp;xacute; was a cute letter.
4187 </p>
4188 !! end
4189
4190
4191 ###
4192 ### Media links
4193 ###
4194
4195 !! test
4196 Media link
4197 !! input
4198 [[Media:Foobar.jpg]]
4199 !! result
4200 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Media:Foobar.jpg</a>
4201 </p>
4202 !! end
4203
4204 !! test
4205 Media link with text
4206 !! input
4207 [[Media:Foobar.jpg|A neat file to look at]]
4208 !! result
4209 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">A neat file to look at</a>
4210 </p>
4211 !! end
4212
4213 # FIXME: this is still bad HTML tag nesting
4214 !! test
4215 Media link with nasty text
4216 fixme: doBlockLevels won't wrap this in a paragraph because it contains a div
4217 !! input
4218 [[Media:Foobar.jpg|Safe Link<div style=display:none>" onmouseover="alert(document.cookie)" onfoo="</div>]]
4219 !! result
4220 <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>
4221
4222 !! end
4223
4224 !! test
4225 Media link to nonexistent file (bug 1702)
4226 !! input
4227 [[Media:No such.jpg]]
4228 !! result
4229 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=No_such.jpg" class="new" title="No such.jpg">Media:No such.jpg</a>
4230 </p>
4231 !! end
4232
4233 !! test
4234 Image link to nonexistent file (bug 1850 - good)
4235 !! input
4236 [[Image:No such.jpg]]
4237 !! result
4238 <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>
4239 </p>
4240 !! end
4241
4242 !! test
4243 :Image link to nonexistent file (bug 1850 - bad)
4244 !! input
4245 [[:Image:No such.jpg]]
4246 !! result
4247 <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>
4248 </p>
4249 !! end
4250
4251
4252
4253 !! test
4254 Character reference normalization in link text (bug 1938)
4255 !! input
4256 [[Main Page|this&that]]
4257 !! result
4258 <p><a href="/wiki/Main_Page" title="Main Page">this&amp;that</a>
4259 </p>
4260 !!end
4261
4262 !! article
4263 אַ
4264 !! text
4265 Test for unicode normalization
4266
4267 The page's name is U+05d0 U+05b7, with non-canonical form U+FB2E
4268 !! endarticle
4269
4270 !! test
4271 (bug 19451) Links should refer to the normalized form.
4272 !! input
4273 [[&#xFB2E;]]
4274 [[&#x5d0;&#x5b7;]]
4275 [[&#x5d0;ַ]]
4276 [[א&#x5b7;]]
4277 [[אַ]]
4278 !! result
4279 <p><a href="/wiki/%D7%90%D6%B7" title="אַ">&#xfb2e;</a>
4280 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;&#x5b7;</a>
4281 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;ַ</a>
4282 <a href="/wiki/%D7%90%D6%B7" title="אַ">א&#x5b7;</a>
4283 <a href="/wiki/%D7%90%D6%B7" title="אַ">אַ</a>
4284 </p>
4285 !! end
4286
4287 !! test
4288 Empty attribute crash test (bug 2067)
4289 !! input
4290 <font color="">foo</font>
4291 !! result
4292 <p><font color="">foo</font>
4293 </p>
4294 !! end
4295
4296 !! test
4297 Empty attribute crash test single-quotes (bug 2067)
4298 !! input
4299 <font color=''>foo</font>
4300 !! result
4301 <p><font color="">foo</font>
4302 </p>
4303 !! end
4304
4305 !! test
4306 Attribute test: equals, then nothing
4307 !! input
4308 <font color=>foo</font>
4309 !! result
4310 <p><font>foo</font>
4311 </p>
4312 !! end
4313
4314 !! test
4315 Attribute test: unquoted value
4316 !! input
4317 <font color=x>foo</font>
4318 !! result
4319 <p><font color="x">foo</font>
4320 </p>
4321 !! end
4322
4323 !! test
4324 Attribute test: unquoted but illegal value (hash)
4325 !! input
4326 <font color=#x>foo</font>
4327 !! result
4328 <p><font color="#x">foo</font>
4329 </p>
4330 !! end
4331
4332 !! test
4333 Attribute test: no value
4334 !! input
4335 <font color>foo</font>
4336 !! result
4337 <p><font color="color">foo</font>
4338 </p>
4339 !! end
4340
4341 !! test
4342 Bug 2095: link with three closing brackets
4343 !! input
4344 [[Main Page]]]
4345 !! result
4346 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>]
4347 </p>
4348 !! end
4349
4350 !! test
4351 Bug 2095: link with pipe and three closing brackets
4352 !! input
4353 [[Main Page|link]]]
4354 !! result
4355 <p><a href="/wiki/Main_Page" title="Main Page">link</a>]
4356 </p>
4357 !! end
4358
4359 !! test
4360 Bug 2095: link with pipe and three closing brackets, version 2
4361 !! input
4362 [[Main Page|[http://example.com/]]]
4363 !! result
4364 <p><a href="/wiki/Main_Page" title="Main Page">[http://example.com/]</a>
4365 </p>
4366 !! end
4367
4368
4369 ###
4370 ### Safety
4371 ###
4372
4373 !! article
4374 Template:Dangerous attribute
4375 !! text
4376 " onmouseover="alert(document.cookie)
4377 !! endarticle
4378
4379 !! article
4380 Template:Dangerous style attribute
4381 !! text
4382 border-size: expression(alert(document.cookie))
4383 !! endarticle
4384
4385 !! article
4386 Template:Div style
4387 !! text
4388 <div style="float: right; {{{1}}}">Magic div</div>
4389 !! endarticle
4390
4391 !! test
4392 Bug 2304: HTML attribute safety (safe template; regression bug 2309)
4393 !! input
4394 <div title="{{test}}"></div>
4395 !! result
4396 <div title="This is a test template"></div>
4397
4398 !! end
4399
4400 !! test
4401 Bug 2304: HTML attribute safety (dangerous template; 2309)
4402 !! input
4403 <div title="{{dangerous attribute}}"></div>
4404 !! result
4405 <div title=""></div>
4406
4407 !! end
4408
4409 !! test
4410 Bug 2304: HTML attribute safety (dangerous style template; 2309)
4411 !! input
4412 <div style="{{dangerous style attribute}}"></div>
4413 !! result
4414 <div style="/* insecure input */"></div>
4415
4416 !! end
4417
4418 !! test
4419 Bug 2304: HTML attribute safety (safe parameter; 2309)
4420 !! input
4421 {{div style|width: 200px}}
4422 !! result
4423 <div style="float: right; width: 200px">Magic div</div>
4424
4425 !! end
4426
4427 !! test
4428 Bug 2304: HTML attribute safety (unsafe parameter; 2309)
4429 !! input
4430 {{div style|width: expression(alert(document.cookie))}}
4431 !! result
4432 <div style="/* insecure input */">Magic div</div>
4433
4434 !! end
4435
4436 !! test
4437 Bug 2304: HTML attribute safety (unsafe breakout parameter; 2309)
4438 !! input
4439 {{div style|"><script>alert(document.cookie)</script>}}
4440 !! result
4441 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
4442
4443 !! end
4444
4445 !! test
4446 Bug 2304: HTML attribute safety (unsafe breakout parameter 2; 2309)
4447 !! input
4448 {{div style|" ><script>alert(document.cookie)</script>}}
4449 !! result
4450 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
4451
4452 !! end
4453
4454 !! test
4455 Bug 2304: HTML attribute safety (link)
4456 !! input
4457 <div title="[[Main Page]]"></div>
4458 !! result
4459 <div title="&#91;&#91;Main Page]]"></div>
4460
4461 !! end
4462
4463 !! test
4464 Bug 2304: HTML attribute safety (italics)
4465 !! input
4466 <div title="''foobar''"></div>
4467 !! result
4468 <div title="&#39;&#39;foobar&#39;&#39;"></div>
4469
4470 !! end
4471
4472 !! test
4473 Bug 2304: HTML attribute safety (bold)
4474 !! input
4475 <div title="'''foobar'''"></div>
4476 !! result
4477 <div title="&#39;&#39;&#39;foobar&#39;&#39;&#39;"></div>
4478
4479 !! end
4480
4481
4482 !! test
4483 Bug 2304: HTML attribute safety (ISBN)
4484 !! input
4485 <div title="ISBN 1234567890"></div>
4486 !! result
4487 <div title="&#73;SBN 1234567890"></div>
4488
4489 !! end
4490
4491 !! test
4492 Bug 2304: HTML attribute safety (RFC)
4493 !! input
4494 <div title="RFC 1234"></div>
4495 !! result
4496 <div title="&#82;FC 1234"></div>
4497
4498 !! end
4499
4500 !! test
4501 Bug 2304: HTML attribute safety (PMID)
4502 !! input
4503 <div title="PMID 1234567890"></div>
4504 !! result
4505 <div title="&#80;MID 1234567890"></div>
4506
4507 !! end
4508
4509 !! test
4510 Bug 2304: HTML attribute safety (web link)
4511 !! input
4512 <div title="http://example.com/"></div>
4513 !! result
4514 <div title="http&#58;//example.com/"></div>
4515
4516 !! end
4517
4518 !! test
4519 Bug 2304: HTML attribute safety (named web link)
4520 !! input
4521 <div title="[http://example.com/ link]"></div>
4522 !! result
4523 <div title="&#91;http&#58;//example.com/ link]"></div>
4524
4525 !! end
4526
4527 !! test
4528 Bug 3244: HTML attribute safety (extension; safe)
4529 !! input
4530 <div style="<nowiki>background:blue</nowiki>"></div>
4531 !! result
4532 <div style="background:blue"></div>
4533
4534 !! end
4535
4536 !! test
4537 Bug 3244: HTML attribute safety (extension; unsafe)
4538 !! input
4539 <div style="<nowiki>border-left:expression(alert(document.cookie))</nowiki>"></div>
4540 !! result
4541 <div style="/* insecure input */"></div>
4542
4543 !! end
4544
4545 !! test
4546 Math section safety when disabled
4547 !! input
4548 <math><script>alert(document.cookies);</script></math>
4549 !! result
4550 <p>&lt;math&gt;&lt;script&gt;alert(document.cookies);&lt;/script&gt;&lt;/math&gt;
4551 </p>
4552 !! end
4553
4554 # More MSIE fun discovered by Tom Gilder
4555
4556 !! test
4557 MSIE CSS safety test: spurious slash
4558 !! input
4559 <div style="background-image:u\rl(javascript:alert('boo'))">evil</div>
4560 !! result
4561 <div style="/* insecure input */">evil</div>
4562
4563 !! end
4564
4565 !! test
4566 MSIE CSS safety test: hex code
4567 !! input
4568 <div style="background-image:u\72l(javascript:alert('boo'))">evil</div>
4569 !! result
4570 <div style="/* insecure input */">evil</div>
4571
4572 !! end
4573
4574 !! test
4575 MSIE CSS safety test: comment in url
4576 !! input
4577 <div style="background-image:u/**/rl(javascript:alert('boo'))">evil</div>
4578 !! result
4579 <div style="background-image:u rl(javascript:alert(&#39;boo&#39;))">evil</div>
4580
4581 !! end
4582
4583 !! test
4584 MSIE CSS safety test: comment in expression
4585 !! input
4586 <div style="background-image:expres/**/sion(alert('boo4'))">evil4</div>
4587 !! result
4588 <div style="background-image:expres sion(alert(&#39;boo4&#39;))">evil4</div>
4589
4590 !! end
4591
4592
4593 !! test
4594 Table attribute legitimate extension
4595 !! input
4596 {|
4597 !+ style="<nowiki>color:blue</nowiki>"| status
4598 |}
4599 !! result
4600 <table>
4601 <tr>
4602 <th style="color:blue"> status
4603 </th></tr></table>
4604
4605 !!end
4606
4607 !! test
4608 Table attribute safety
4609 !! input
4610 {|
4611 !+ style="<nowiki>border-width:expression(0+alert(document.cookie))</nowiki>"| status
4612 |}
4613 !! result
4614 <table>
4615 <tr>
4616 <th style="/* insecure input */"> status
4617 </th></tr></table>
4618
4619 !! end
4620
4621 !! test
4622 CSS line continuation 1
4623 !! input
4624 <div style="background-image: u\&#10;rl(test.jpg);"></div>
4625 !! result
4626 <div style="/* insecure input */"></div>
4627
4628 !! end
4629
4630 !! test
4631 CSS line continuation 2
4632 !! input
4633 <div style="background-image: u\&#13;rl(test.jpg); "></div>
4634 !! result
4635 <div style="/* insecure input */"></div>
4636
4637 !! end
4638
4639 !! article
4640 Template:Identity
4641 !! text
4642 {{{1}}}
4643 !! endarticle
4644
4645 !! test
4646 Expansion of multi-line templates in attribute values (bug 6255)
4647 !! input
4648 <div style="background: {{identity|#00FF00}}">-</div>
4649 !! result
4650 <div style="background: #00FF00">-</div>
4651
4652 !! end
4653
4654
4655 !! test
4656 Expansion of multi-line templates in attribute values (bug 6255 sanity check)
4657 !! input
4658 <div style="background:
4659 #00FF00">-</div>
4660 !! result
4661 <div style="background: #00FF00">-</div>
4662
4663 !! end
4664
4665 !! test
4666 Expansion of multi-line templates in attribute values (bug 6255 sanity check 2)
4667 !! input
4668 <div style="background: &#10;#00FF00">-</div>
4669 !! result
4670 <div style="background: &#10;#00FF00">-</div>
4671
4672 !! end
4673
4674 ###
4675 ### Parser hooks (see maintenance/parserTestsParserHook.php for the <tag> extension)
4676 ###
4677 !! test
4678 Parser hook: empty input
4679 !! input
4680 <tag></tag>
4681 !! result
4682 <pre>
4683 string(0) ""
4684 array(0) {
4685 }
4686 </pre>
4687
4688 !! end
4689
4690 !! test
4691 Parser hook: empty input using terminated empty elements
4692 !! input
4693 <tag/>
4694 !! result
4695 <pre>
4696 NULL
4697 array(0) {
4698 }
4699 </pre>
4700
4701 !! end
4702
4703 !! test
4704 Parser hook: empty input using terminated empty elements (space before)
4705 !! input
4706 <tag />
4707 !! result
4708 <pre>
4709 NULL
4710 array(0) {
4711 }
4712 </pre>
4713
4714 !! end
4715
4716 !! test
4717 Parser hook: basic input
4718 !! input
4719 <tag>input</tag>
4720 !! result
4721 <pre>
4722 string(5) "input"
4723 array(0) {
4724 }
4725 </pre>
4726
4727 !! end
4728
4729
4730 !! test
4731 Parser hook: case insensitive
4732 !! input
4733 <TAG>input</TAG>
4734 !! result
4735 <pre>
4736 string(5) "input"
4737 array(0) {
4738 }
4739 </pre>
4740
4741 !! end
4742
4743
4744 !! test
4745 Parser hook: case insensitive, redux
4746 !! input
4747 <TaG>input</TAg>
4748 !! result
4749 <pre>
4750 string(5) "input"
4751 array(0) {
4752 }
4753 </pre>
4754
4755 !! end
4756
4757 !! test
4758 Parser hook: nested tags
4759 !! options
4760 noxml
4761 !! input
4762 <tag><tag></tag></tag>
4763 !! result
4764 <pre>
4765 string(5) "<tag>"
4766 array(0) {
4767 }
4768 </pre>&lt;/tag&gt;
4769
4770 !! end
4771
4772 !! test
4773 Parser hook: basic arguments
4774 !! input
4775 <tag width=200 height = "100" depth = '50' square></tag>
4776 !! result
4777 <pre>
4778 string(0) ""
4779 array(4) {
4780 ["width"]=>
4781 string(3) "200"
4782 ["height"]=>
4783 string(3) "100"
4784 ["depth"]=>
4785 string(2) "50"
4786 ["square"]=>
4787 string(6) "square"
4788 }
4789 </pre>
4790
4791 !! end
4792
4793 !! test
4794 Parser hook: argument containing a forward slash (bug 5344)
4795 !! input
4796 <tag filename='/tmp/bla'></tag>
4797 !! result
4798 <pre>
4799 string(0) ""
4800 array(1) {
4801 ["filename"]=>
4802 string(8) "/tmp/bla"
4803 }
4804 </pre>
4805
4806 !! end
4807
4808 !! test
4809 Parser hook: empty input using terminated empty elements (bug 2374)
4810 !! input
4811 <tag foo=bar/>text
4812 !! result
4813 <pre>
4814 NULL
4815 array(1) {
4816 ["foo"]=>
4817 string(3) "bar"
4818 }
4819 </pre>text
4820
4821 !! end
4822
4823 # </tag> should be output literally since there is no matching tag that begins it
4824 !! test
4825 Parser hook: basic arguments using terminated empty elements (bug 2374)
4826 !! input
4827 <tag width=200 height = "100" depth = '50' square/>
4828 other stuff
4829 </tag>
4830 !! result
4831 <pre>
4832 NULL
4833 array(4) {
4834 ["width"]=>
4835 string(3) "200"
4836 ["height"]=>
4837 string(3) "100"
4838 ["depth"]=>
4839 string(2) "50"
4840 ["square"]=>
4841 string(6) "square"
4842 }
4843 </pre>
4844 <p>other stuff
4845 &lt;/tag&gt;
4846 </p>
4847 !! end
4848
4849 ###
4850 ### (see maintenance/parserTestsStaticParserHook.php for the <statictag> extension)
4851 ###
4852
4853 !! test
4854 Parser hook: static parser hook not inside a comment
4855 !! input
4856 <statictag>hello, world</statictag>
4857 <statictag action=flush/>
4858 !! result
4859 <p>hello, world
4860 </p>
4861 !! end
4862
4863
4864 !! test
4865 Parser hook: static parser hook inside a comment
4866 !! input
4867 <!-- <statictag>hello, world</statictag> -->
4868 <statictag action=flush/>
4869 !! result
4870 <p><br />
4871 </p>
4872 !! end
4873
4874 # Nested template calls; this case was broken by Parser.php rev 1.506,
4875 # since reverted.
4876
4877 !! article
4878 Template:One-parameter
4879 !! text
4880 (My parameter is: {{{1}}})
4881 !! endarticle
4882
4883 !! article
4884 Template:Map-one-parameter
4885 !! text
4886 {{{{{1}}}|{{{2}}}}}
4887 !! endarticle
4888
4889 !! test
4890 Nested template calls
4891 !! input
4892 {{Map-one-parameter|One-parameter|param}}
4893 !! result
4894 <p>(My parameter is: param)
4895 </p>
4896 !! end
4897
4898
4899 ###
4900 ### Sanitizer
4901 ###
4902 !! test
4903 Sanitizer: Closing of open tags
4904 !! input
4905 <s></s><table></table>
4906 !! result
4907 <s></s><table></table>
4908
4909 !! end
4910
4911 !! test
4912 Sanitizer: Closing of open but not closed tags
4913 !! input
4914 <s>foo
4915 !! result
4916 <p><s>foo</s>
4917 </p>
4918 !! end
4919
4920 !! test
4921 Sanitizer: Closing of closed but not open tags
4922 !! input
4923 </s>
4924 !! result
4925 <p>&lt;/s&gt;
4926 </p>
4927 !! end
4928
4929 !! test
4930 Sanitizer: Closing of closed but not open table tags
4931 !! input
4932 Table not started</td></tr></table>
4933 !! result
4934 <p>Table not started&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
4935 </p>
4936 !! end
4937
4938 !! test
4939 Sanitizer: Escaping of spaces, multibyte characters, colons & other stuff in id=""
4940 !! input
4941 <span id="æ: v">byte</span>[[#æ: v|backlink]]
4942 !! result
4943 <p><span id=".C3.A6:_v">byte</span><a href="#.C3.A6:_v">backlink</a>
4944 </p>
4945 !! end
4946
4947 !! test
4948 Sanitizer: Validating the contents of the id attribute (bug 4515)
4949 !! options
4950 disabled
4951 !! input
4952 <br id=9 />
4953 !! result
4954 Something, but definitely not <br id="9" />...
4955 !! end
4956
4957 !! test
4958 Sanitizer: Validating id attribute uniqueness (bug 4515, bug 6301)
4959 !! options
4960 disabled
4961 !! input
4962 <br id="foo" /><br id="foo" />
4963 !! result
4964 Something need to be done. foo-2 ?
4965 !! end
4966
4967 !! test
4968 Language converter: output gets cut off unexpectedly (bug 5757)
4969 !! options
4970 language=zh
4971 !! input
4972 this bit is safe: }-
4973
4974 but if we add a conversion instance: -{zh-cn:xxx;zh-tw:yyy}-
4975
4976 then we get cut off here: }-
4977
4978 all additional text is vanished
4979 !! result
4980 <p>this bit is safe: }-
4981 </p><p>but if we add a conversion instance: xxx
4982 </p><p>then we get cut off here: }-
4983 </p><p>all additional text is vanished
4984 </p>
4985 !! end
4986
4987 !! test
4988 Self closed html pairs (bug 5487)
4989 !! options
4990 !! input
4991 <center><font id="bug" />Centered text</center>
4992 <div><font id="bug2" />In div text</div>
4993 !! result
4994 <center>&lt;font id="bug" /&gt;Centered text</center>
4995 <div>&lt;font id="bug2" /&gt;In div text</div>
4996
4997 !! end
4998
4999 #
5000 #
5001 #
5002
5003 !! test
5004 Punctuation: nbsp before exclamation
5005 !! input
5006 C'est grave !
5007 !! result
5008 <p>C'est grave&#160;!
5009 </p>
5010 !! end
5011
5012 !! test
5013 Punctuation: CSS !important (bug 11874)
5014 !! input
5015 <div style="width:50% !important">important</div>
5016 !! result
5017 <div style="width:50% !important">important</div>
5018
5019 !!end
5020
5021 !! test
5022 Punctuation: CSS ! important (bug 11874; with space after)
5023 !! input
5024 <div style="width:50% ! important">important</div>
5025 !! result
5026 <div style="width:50% ! important">important</div>
5027
5028 !!end
5029
5030
5031 !! test
5032 HTML bullet list, closed tags (bug 5497)
5033 !! input
5034 <ul>
5035 <li>One</li>
5036 <li>Two</li>
5037 </ul>
5038 !! result
5039 <ul>
5040 <li>One</li>
5041 <li>Two</li>
5042 </ul>
5043
5044 !! end
5045
5046 !! test
5047 HTML bullet list, unclosed tags (bug 5497)
5048 !! options
5049 disabled
5050 !! input
5051 <ul>
5052 <li>One
5053 <li>Two
5054 </ul>
5055 !! result
5056 <ul>
5057 <li>One
5058 </li><li>Two
5059 </li></ul>
5060
5061 !! end
5062
5063 !! test
5064 HTML ordered list, closed tags (bug 5497)
5065 !! input
5066 <ol>
5067 <li>One</li>
5068 <li>Two</li>
5069 </ol>
5070 !! result
5071 <ol>
5072 <li>One</li>
5073 <li>Two</li>
5074 </ol>
5075
5076 !! end
5077
5078 !! test
5079 HTML ordered list, unclosed tags (bug 5497)
5080 !! options
5081 disabled
5082 !! input
5083 <ol>
5084 <li>One
5085 <li>Two
5086 </ol>
5087 !! result
5088 <ol>
5089 <li>One
5090 </li><li>Two
5091 </li></ol>
5092
5093 !! end
5094
5095 !! test
5096 HTML nested bullet list, closed tags (bug 5497)
5097 !! input
5098 <ul>
5099 <li>One</li>
5100 <li>Two:
5101 <ul>
5102 <li>Sub-one</li>
5103 <li>Sub-two</li>
5104 </ul>
5105 </li>
5106 </ul>
5107 !! result
5108 <ul>
5109 <li>One</li>
5110 <li>Two:
5111 <ul>
5112 <li>Sub-one</li>
5113 <li>Sub-two</li>
5114 </ul>
5115 </li>
5116 </ul>
5117
5118 !! end
5119
5120 !! test
5121 HTML nested bullet list, open tags (bug 5497)
5122 !! options
5123 disabled
5124 !! input
5125 <ul>
5126 <li>One
5127 <li>Two:
5128 <ul>
5129 <li>Sub-one
5130 <li>Sub-two
5131 </ul>
5132 </ul>
5133 !! result
5134 <ul>
5135 <li>One
5136 </li><li>Two:
5137 <ul>
5138 <li>Sub-one
5139 </li><li>Sub-two
5140 </li></ul>
5141 </li></ul>
5142
5143 !! end
5144
5145 !! test
5146 HTML nested ordered list, closed tags (bug 5497)
5147 !! input
5148 <ol>
5149 <li>One</li>
5150 <li>Two:
5151 <ol>
5152 <li>Sub-one</li>
5153 <li>Sub-two</li>
5154 </ol>
5155 </li>
5156 </ol>
5157 !! result
5158 <ol>
5159 <li>One</li>
5160 <li>Two:
5161 <ol>
5162 <li>Sub-one</li>
5163 <li>Sub-two</li>
5164 </ol>
5165 </li>
5166 </ol>
5167
5168 !! end
5169
5170 !! test
5171 HTML nested ordered list, open tags (bug 5497)
5172 !! options
5173 disabled
5174 !! input
5175 <ol>
5176 <li>One
5177 <li>Two:
5178 <ol>
5179 <li>Sub-one
5180 <li>Sub-two
5181 </ol>
5182 </ol>
5183 !! result
5184 <ol>
5185 <li>One
5186 </li><li>Two:
5187 <ol>
5188 <li>Sub-one
5189 </li><li>Sub-two
5190 </li></ol>
5191 </li></ol>
5192
5193 !! end
5194
5195 !! test
5196 HTML ordered list item with parameters oddity
5197 !! input
5198 <ol><li id="fragment">One</li></ol>
5199 !! result
5200 <ol><li id="fragment">One</li></ol>
5201
5202 !! end
5203
5204 !!test
5205 bug 5918: autonumbering
5206 !! input
5207 [http://first/] [http://second] [ftp://ftp]
5208
5209 ftp://inlineftp
5210
5211 [mailto:enclosed@mail.tld With target]
5212
5213 [mailto:enclosed@mail.tld]
5214
5215 mailto:inline@mail.tld
5216 !! result
5217 <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>
5218 </p><p><a href="ftp://inlineftp" class="external free" rel="nofollow">ftp://inlineftp</a>
5219 </p><p><a href="mailto:enclosed@mail.tld" class="external text" rel="nofollow">With target</a>
5220 </p><p><a href="mailto:enclosed@mail.tld" class="external autonumber" rel="nofollow">[4]</a>
5221 </p><p><a href="mailto:inline@mail.tld" class="external free" rel="nofollow">mailto:inline@mail.tld</a>
5222 </p>
5223 !! end
5224
5225
5226 #
5227 # Security and HTML correctness
5228 # From Nick Jenkins' fuzz testing
5229 #
5230
5231 !! test
5232 Fuzz testing: Parser13
5233 !! input
5234 {|
5235 | http://a|
5236 !! result
5237 <table>
5238 <tr>
5239 <td>
5240 </td>
5241 </tr>
5242 </table>
5243
5244 !! end
5245
5246 !! test
5247 Fuzz testing: Parser14
5248 !! input
5249 == onmouseover= ==
5250 http://__TOC__
5251 !! result
5252 <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>
5253 http://<table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
5254 <ul>
5255 <li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
5256 </ul>
5257 </td></tr></table>
5258
5259 !! end
5260
5261 !! test
5262 Fuzz testing: Parser14-table
5263 !! input
5264 ==a==
5265 {| STYLE=__TOC__
5266 !! result
5267 <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>
5268 <table style="&#95;_TOC&#95;_">
5269 <tr><td></td></tr>
5270 </table>
5271
5272 !! end
5273
5274 # Known to produce bogus xml (extra </td>)
5275 !! test
5276 Fuzz testing: Parser16
5277 !! options
5278 noxml
5279 !! input
5280 {|
5281 !https://||||||
5282 !! result
5283 <table>
5284 <tr>
5285 <th>https://</th>
5286 <th></th>
5287 <th></th>
5288 <th>
5289 </td>
5290 </tr>
5291 </table>
5292
5293 !! end
5294
5295 !! test
5296 Fuzz testing: Parser21
5297 !! input
5298 {|
5299 ! irc://{{ftp://a" onmouseover="alert('hello world');"
5300 |
5301 !! result
5302 <table>
5303 <tr>
5304 <th> <a href="irc://{{ftp://a" class="external free" rel="nofollow">irc://{{ftp://a</a>" onmouseover="alert('hello world');"
5305 </th>
5306 <td>
5307 </td>
5308 </tr>
5309 </table>
5310
5311 !! end
5312
5313 !! test
5314 Fuzz testing: Parser22
5315 !! input
5316 http://===r:::https://b
5317
5318 {|
5319 !!result
5320 <p><a href="http://===r:::https://b" class="external free" rel="nofollow">http://===r:::https://b</a>
5321 </p>
5322 <table>
5323 <tr><td></td></tr>
5324 </table>
5325
5326 !! end
5327
5328 # Known to produce bad XML for now
5329 !! test
5330 Fuzz testing: Parser24
5331 !! options
5332 noxml
5333 !! input
5334 {|
5335 {{{|
5336 <u CLASS=
5337 | {{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx--><noinclude>}}}} >
5338 <br style="onmouseover='alert(document.cookie);' " />
5339
5340 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
5341 |
5342 !! result
5343 <table>
5344 {{{|
5345 <u class="&#124;">}}}} &gt;
5346 <br style="onmouseover=&#39;alert(document.cookie);&#39;" />
5347
5348 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
5349 <tr>
5350 <td></u>
5351 </td>
5352 </tr>
5353 </table>
5354
5355 !! end
5356
5357 # Note: the current result listed for this is not what the original one was,
5358 # but the original bug was JavaScript injection, which is fixed in any case.
5359 # It's not clear that the original result listed was any more correct than the
5360 # current one. Original result:
5361 # <p>{{{|
5362 # </p>
5363 # <li class="&#124;&#124;">
5364 # }}}blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
5365 !!test
5366 Fuzz testing: Parser25 (bug 6055)
5367 !! input
5368 {{{
5369 |
5370 <LI CLASS=||
5371 >
5372 }}}blah" onmouseover="alert('hello world');" align="left"'''MOVE MOUSE CURSOR OVER HERE
5373 !! result
5374 <p>&lt;LI CLASS=blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
5375 </p>
5376 !! end
5377
5378 !!test
5379 Fuzz testing: URL adjacent extension (with space, clean)
5380 !! options
5381 !! input
5382 http://example.com <nowiki>junk</nowiki>
5383 !! result
5384 <p><a href="http://example.com" class="external free" rel="nofollow">http://example.com</a> junk
5385 </p>
5386 !!end
5387
5388 !!test
5389 Fuzz testing: URL adjacent extension (no space, dirty; nowiki)
5390 !! options
5391 !! input
5392 http://example.com<nowiki>junk</nowiki>
5393 !! result
5394 <p><a href="http://example.com" class="external free" rel="nofollow">http://example.com</a>junk
5395 </p>
5396 !!end
5397
5398 !!test
5399 Fuzz testing: URL adjacent extension (no space, dirty; pre)
5400 !! options
5401 !! input
5402 http://example.com<pre>junk</pre>
5403 !! result
5404 <a href="http://example.com" class="external free" rel="nofollow">http://example.com</a><pre>junk</pre>
5405
5406 !!end
5407
5408 !!test
5409 Fuzz testing: image with bogus manual thumbnail
5410 !!input
5411 [[Image:foobar.jpg|thumbnail= ]]
5412 !!result
5413 <div class="thumb tright"><div class="thumbinner" style="width:1943px;">Error creating thumbnail: <div class="thumbcaption"></div></div></div>
5414
5415 !!end
5416
5417 !! test
5418 Fuzz testing: encoded newline in generated HTML replacements (bug 6577)
5419 !! input
5420 <pre dir="&#10;"></pre>
5421 !! result
5422 <pre dir="&#10;"></pre>
5423
5424 !! end
5425
5426 !! test
5427 Parsing optional HTML elements (Bug 6171)
5428 !! options
5429 !! input
5430 <table>
5431 <tr>
5432 <td> Some tabular data</td>
5433 <td> More tabular data ...
5434 <td> And yet som tabular data</td>
5435 </tr>
5436 </table>
5437 !! result
5438 <table>
5439 <tr>
5440 <td> Some tabular data</td>
5441 <td> More tabular data ...
5442 </td><td> And yet som tabular data</td>
5443 </tr>
5444 </table>
5445
5446 !! end
5447
5448 !! test
5449 Correct handling of <td>, <tr> (Bug 6171)
5450 !! options
5451 !! input
5452 <table>
5453 <tr>
5454 <td> Some tabular data</td>
5455 <td> More tabular data ...</td>
5456 <td> And yet som tabular data</td>
5457 </tr>
5458 </table>
5459 !! result
5460 <table>
5461 <tr>
5462 <td> Some tabular data</td>
5463 <td> More tabular data ...</td>
5464 <td> And yet som tabular data</td>
5465 </tr>
5466 </table>
5467
5468 !! end
5469
5470
5471 !! test
5472 Parsing crashing regression (fr:JavaScript)
5473 !! input
5474 </body></x>
5475 !! result
5476 <p>&lt;/body&gt;&lt;/x&gt;
5477 </p>
5478 !! end
5479
5480 !! test
5481 Inline wiki vs wiki block nesting
5482 !! input
5483 '''Bold paragraph
5484
5485 New wiki paragraph
5486 !! result
5487 <p><b>Bold paragraph</b>
5488 </p><p>New wiki paragraph
5489 </p>
5490 !! end
5491
5492 !! test
5493 Inline HTML vs wiki block nesting
5494 !! options
5495 disabled
5496 !! input
5497 <b>Bold paragraph
5498
5499 New wiki paragraph
5500 !! result
5501 <p><b>Bold paragraph</b>
5502 </p><p>New wiki paragraph
5503 </p>
5504 !! end
5505
5506 # Original result was this:
5507 # <p><b>bold</b><b>bold<i>bolditalics</i></b>
5508 # </p>
5509 # While that might be marginally more intuitive, maybe, the six-apostrophe
5510 # construct is clearly pathological and the result stated here (which is what
5511 # the parser actually does) is about as reasonable as anything.
5512 !!test
5513 Mixing markup for italics and bold
5514 !! options
5515 !! input
5516 '''bold''''''bold''bolditalics'''''
5517 !! result
5518 <p>'<i>bold'</i><b>bold<i>bolditalics</i></b>
5519 </p>
5520 !! end
5521
5522
5523 !! article
5524 Xyzzyx
5525 !! text
5526 Article for special page transclusion test
5527 !! endarticle
5528
5529 !! test
5530 Special page transclusion
5531 !! options
5532 !! input
5533 {{Special:Prefixindex/Xyzzyx}}
5534 !! result
5535 <p><br />
5536 </p>
5537 <table border="0" id="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
5538
5539 !! end
5540
5541 !! test
5542 Special page transclusion twice (bug 5021)
5543 !! options
5544 !! input
5545 {{Special:Prefixindex/Xyzzyx}}
5546 {{Special:Prefixindex/Xyzzyx}}
5547 !! result
5548 <p><br />
5549 </p>
5550 <table border="0" id="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
5551 <p><br />
5552 </p>
5553 <table border="0" id="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
5554
5555 !! end
5556
5557 !! test
5558 Transclusion of default MediaWiki message
5559 !! input
5560 {{MediaWiki:Mainpage}}
5561 !!result
5562 <p>Main Page
5563 </p>
5564 !! end
5565
5566 !! test
5567 Transclusion of nonexistent MediaWiki message
5568 !! input
5569 {{MediaWiki:Mainpagexxx}}
5570 !!result
5571 <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>
5572 </p>
5573 !! end
5574
5575 !! test
5576 Transclusion of MediaWiki message with underscore
5577 !! input
5578 {{MediaWiki:history_short}}
5579 !! result
5580 <p>History
5581 </p>
5582 !! end
5583
5584 !! test
5585 Transclusion of MediaWiki message with space
5586 !! input
5587 {{MediaWiki:history short}}
5588 !! result
5589 <p>History
5590 </p>
5591 !! end
5592
5593 !! test
5594 Invalid header with following text
5595 !! input
5596 = x = y
5597 !! result
5598 <p>= x = y
5599 </p>
5600 !! end
5601
5602
5603 !! test
5604 Section extraction test (section 0)
5605 !! options
5606 section=0
5607 !! input
5608 start
5609 ==a==
5610 ===aa===
5611 ====aaa====
5612 ==b==
5613 ===ba===
5614 ===bb===
5615 ====bba====
5616 ===bc===
5617 ==c==
5618 ===ca===
5619 !! result
5620 start
5621 !! end
5622
5623 !! test
5624 Section extraction test (section 1)
5625 !! options
5626 section=1
5627 !! input
5628 start
5629 ==a==
5630 ===aa===
5631 ====aaa====
5632 ==b==
5633 ===ba===
5634 ===bb===
5635 ====bba====
5636 ===bc===
5637 ==c==
5638 ===ca===
5639 !! result
5640 ==a==
5641 ===aa===
5642 ====aaa====
5643 !! end
5644
5645 !! test
5646 Section extraction test (section 2)
5647 !! options
5648 section=2
5649 !! input
5650 start
5651 ==a==
5652 ===aa===
5653 ====aaa====
5654 ==b==
5655 ===ba===
5656 ===bb===
5657 ====bba====
5658 ===bc===
5659 ==c==
5660 ===ca===
5661 !! result
5662 ===aa===
5663 ====aaa====
5664 !! end
5665
5666 !! test
5667 Section extraction test (section 3)
5668 !! options
5669 section=3
5670 !! input
5671 start
5672 ==a==
5673 ===aa===
5674 ====aaa====
5675 ==b==
5676 ===ba===
5677 ===bb===
5678 ====bba====
5679 ===bc===
5680 ==c==
5681 ===ca===
5682 !! result
5683 ====aaa====
5684 !! end
5685
5686 !! test
5687 Section extraction test (section 4)
5688 !! options
5689 section=4
5690 !! input
5691 start
5692 ==a==
5693 ===aa===
5694 ====aaa====
5695 ==b==
5696 ===ba===
5697 ===bb===
5698 ====bba====
5699 ===bc===
5700 ==c==
5701 ===ca===
5702 !! result
5703 ==b==
5704 ===ba===
5705 ===bb===
5706 ====bba====
5707 ===bc===
5708 !! end
5709
5710 !! test
5711 Section extraction test (section 5)
5712 !! options
5713 section=5
5714 !! input
5715 start
5716 ==a==
5717 ===aa===
5718 ====aaa====
5719 ==b==
5720 ===ba===
5721 ===bb===
5722 ====bba====
5723 ===bc===
5724 ==c==
5725 ===ca===
5726 !! result
5727 ===ba===
5728 !! end
5729
5730 !! test
5731 Section extraction test (section 6)
5732 !! options
5733 section=6
5734 !! input
5735 start
5736 ==a==
5737 ===aa===
5738 ====aaa====
5739 ==b==
5740 ===ba===
5741 ===bb===
5742 ====bba====
5743 ===bc===
5744 ==c==
5745 ===ca===
5746 !! result
5747 ===bb===
5748 ====bba====
5749 !! end
5750
5751 !! test
5752 Section extraction test (section 7)
5753 !! options
5754 section=7
5755 !! input
5756 start
5757 ==a==
5758 ===aa===
5759 ====aaa====
5760 ==b==
5761 ===ba===
5762 ===bb===
5763 ====bba====
5764 ===bc===
5765 ==c==
5766 ===ca===
5767 !! result
5768 ====bba====
5769 !! end
5770
5771 !! test
5772 Section extraction test (section 8)
5773 !! options
5774 section=8
5775 !! input
5776 start
5777 ==a==
5778 ===aa===
5779 ====aaa====
5780 ==b==
5781 ===ba===
5782 ===bb===
5783 ====bba====
5784 ===bc===
5785 ==c==
5786 ===ca===
5787 !! result
5788 ===bc===
5789 !! end
5790
5791 !! test
5792 Section extraction test (section 9)
5793 !! options
5794 section=9
5795 !! input
5796 start
5797 ==a==
5798 ===aa===
5799 ====aaa====
5800 ==b==
5801 ===ba===
5802 ===bb===
5803 ====bba====
5804 ===bc===
5805 ==c==
5806 ===ca===
5807 !! result
5808 ==c==
5809 ===ca===
5810 !! end
5811
5812 !! test
5813 Section extraction test (section 10)
5814 !! options
5815 section=10
5816 !! input
5817 start
5818 ==a==
5819 ===aa===
5820 ====aaa====
5821 ==b==
5822 ===ba===
5823 ===bb===
5824 ====bba====
5825 ===bc===
5826 ==c==
5827 ===ca===
5828 !! result
5829 ===ca===
5830 !! end
5831
5832 !! test
5833 Section extraction test (nonexistent section 11)
5834 !! options
5835 section=11
5836 !! input
5837 start
5838 ==a==
5839 ===aa===
5840 ====aaa====
5841 ==b==
5842 ===ba===
5843 ===bb===
5844 ====bba====
5845 ===bc===
5846 ==c==
5847 ===ca===
5848 !! result
5849 !! end
5850
5851 !! test
5852 Section extraction test with bogus heading (section 1)
5853 !! options
5854 section=1
5855 !! input
5856 ==a==
5857 ==bogus== not a legal section
5858 ==b==
5859 !! result
5860 ==a==
5861 ==bogus== not a legal section
5862 !! end
5863
5864 !! test
5865 Section extraction test with bogus heading (section 2)
5866 !! options
5867 section=2
5868 !! input
5869 ==a==
5870 ==bogus== not a legal section
5871 ==b==
5872 !! result
5873 ==b==
5874 !! end
5875
5876 !! test
5877 Section extraction test with comment after heading (section 1)
5878 !! options
5879 section=1
5880 !! input
5881 ==a==
5882 ==b== <!-- -->
5883 ==c==
5884 !! result
5885 ==a==
5886 !! end
5887
5888 !! test
5889 Section extraction test with comment after heading (section 2)
5890 !! options
5891 section=2
5892 !! input
5893 ==a==
5894 ==b== <!-- -->
5895 ==c==
5896 !! result
5897 ==b== <!-- -->
5898 !! end
5899
5900 !! test
5901 Section extraction test with bogus <nowiki> heading (section 1)
5902 !! options
5903 section=1
5904 !! input
5905 ==a==
5906 ==bogus== <nowiki>not a legal section</nowiki>
5907 ==b==
5908 !! result
5909 ==a==
5910 ==bogus== <nowiki>not a legal section</nowiki>
5911 !! end
5912
5913 !! test
5914 Section extraction test with bogus <nowiki> heading (section 2)
5915 !! options
5916 section=2
5917 !! input
5918 ==a==
5919 ==bogus== <nowiki>not a legal section</nowiki>
5920 ==b==
5921 !! result
5922 ==b==
5923 !! end
5924
5925
5926 # Formerly testing for bug 2587, now resolved by the use of unmarked sections
5927 # instead of respecting commented sections
5928 !! test
5929 Section extraction prefixed by comment (section 1)
5930 !! options
5931 section=1
5932 !! input
5933 <!-- -->==sec1==
5934 ==sec2==
5935 !!result
5936 ==sec2==
5937 !!end
5938
5939 !! test
5940 Section extraction prefixed by comment (section 2)
5941 !! options
5942 section=2
5943 !! input
5944 <!-- -->==sec1==
5945 ==sec2==
5946 !!result
5947
5948 !!end
5949
5950
5951 # Formerly testing for bug 2607, now resolved by the use of unmarked sections
5952 # instead of respecting HTML-style headings
5953 !! test
5954 Section extraction, mixed wiki and html (section 1)
5955 !! options
5956 section=1
5957 !! input
5958 <h2>unmarked</h2>
5959 unmarked
5960 ==1==
5961 one
5962 ==2==
5963 two
5964 !! result
5965 ==1==
5966 one
5967 !! end
5968
5969 !! test
5970 Section extraction, mixed wiki and html (section 2)
5971 !! options
5972 section=2
5973 !! input
5974 <h2>unmarked</h2>
5975 unmarked
5976 ==1==
5977 one
5978 ==2==
5979 two
5980 !! result
5981 ==2==
5982 two
5983 !! end
5984
5985
5986 # Formerly testing for bug 3342
5987 !! test
5988 Section extraction, heading surrounded by <noinclude>
5989 !! options
5990 section=1
5991 !! input
5992 <noinclude>==unmarked==</noinclude>
5993 ==marked==
5994 !! result
5995 ==marked==
5996 !!end
5997
5998 # Test behaviour of bug 19910
5999 !! test
6000 Sectiion with all-equals
6001 !! options
6002 section=2
6003 !! input
6004 ===
6005 The line above must have a trailing space
6006 === <!--
6007 --> <!-- -->
6008 But just in case it doesn't...
6009 !! result
6010 === <!--
6011 --> <!-- -->
6012 But just in case it doesn't...
6013 !! end
6014
6015 !! test
6016 Section replacement test (section 0)
6017 !! options
6018 replace=0,"xxx"
6019 !! input
6020 start
6021 ==a==
6022 ===aa===
6023 ====aaa====
6024 ==b==
6025 ===ba===
6026 ===bb===
6027 ====bba====
6028 ===bc===
6029 ==c==
6030 ===ca===
6031 !! result
6032 xxx
6033
6034 ==a==
6035 ===aa===
6036 ====aaa====
6037 ==b==
6038 ===ba===
6039 ===bb===
6040 ====bba====
6041 ===bc===
6042 ==c==
6043 ===ca===
6044 !! end
6045
6046 !! test
6047 Section replacement test (section 1)
6048 !! options
6049 replace=1,"xxx"
6050 !! input
6051 start
6052 ==a==
6053 ===aa===
6054 ====aaa====
6055 ==b==
6056 ===ba===
6057 ===bb===
6058 ====bba====
6059 ===bc===
6060 ==c==
6061 ===ca===
6062 !! result
6063 start
6064 xxx
6065
6066 ==b==
6067 ===ba===
6068 ===bb===
6069 ====bba====
6070 ===bc===
6071 ==c==
6072 ===ca===
6073 !! end
6074
6075 !! test
6076 Section replacement test (section 2)
6077 !! options
6078 replace=2,"xxx"
6079 !! input
6080 start
6081 ==a==
6082 ===aa===
6083 ====aaa====
6084 ==b==
6085 ===ba===
6086 ===bb===
6087 ====bba====
6088 ===bc===
6089 ==c==
6090 ===ca===
6091 !! result
6092 start
6093 ==a==
6094 xxx
6095
6096 ==b==
6097 ===ba===
6098 ===bb===
6099 ====bba====
6100 ===bc===
6101 ==c==
6102 ===ca===
6103 !! end
6104
6105 !! test
6106 Section replacement test (section 3)
6107 !! options
6108 replace=3,"xxx"
6109 !! input
6110 start
6111 ==a==
6112 ===aa===
6113 ====aaa====
6114 ==b==
6115 ===ba===
6116 ===bb===
6117 ====bba====
6118 ===bc===
6119 ==c==
6120 ===ca===
6121 !! result
6122 start
6123 ==a==
6124 ===aa===
6125 xxx
6126
6127 ==b==
6128 ===ba===
6129 ===bb===
6130 ====bba====
6131 ===bc===
6132 ==c==
6133 ===ca===
6134 !! end
6135
6136 !! test
6137 Section replacement test (section 4)
6138 !! options
6139 replace=4,"xxx"
6140 !! input
6141 start
6142 ==a==
6143 ===aa===
6144 ====aaa====
6145 ==b==
6146 ===ba===
6147 ===bb===
6148 ====bba====
6149 ===bc===
6150 ==c==
6151 ===ca===
6152 !! result
6153 start
6154 ==a==
6155 ===aa===
6156 ====aaa====
6157 xxx
6158
6159 ==c==
6160 ===ca===
6161 !! end
6162
6163 !! test
6164 Section replacement test (section 5)
6165 !! options
6166 replace=5,"xxx"
6167 !! input
6168 start
6169 ==a==
6170 ===aa===
6171 ====aaa====
6172 ==b==
6173 ===ba===
6174 ===bb===
6175 ====bba====
6176 ===bc===
6177 ==c==
6178 ===ca===
6179 !! result
6180 start
6181 ==a==
6182 ===aa===
6183 ====aaa====
6184 ==b==
6185 xxx
6186
6187 ===bb===
6188 ====bba====
6189 ===bc===
6190 ==c==
6191 ===ca===
6192 !! end
6193
6194 !! test
6195 Section replacement test (section 6)
6196 !! options
6197 replace=6,"xxx"
6198 !! input
6199 start
6200 ==a==
6201 ===aa===
6202 ====aaa====
6203 ==b==
6204 ===ba===
6205 ===bb===
6206 ====bba====
6207 ===bc===
6208 ==c==
6209 ===ca===
6210 !! result
6211 start
6212 ==a==
6213 ===aa===
6214 ====aaa====
6215 ==b==
6216 ===ba===
6217 xxx
6218
6219 ===bc===
6220 ==c==
6221 ===ca===
6222 !! end
6223
6224 !! test
6225 Section replacement test (section 7)
6226 !! options
6227 replace=7,"xxx"
6228 !! input
6229 start
6230 ==a==
6231 ===aa===
6232 ====aaa====
6233 ==b==
6234 ===ba===
6235 ===bb===
6236 ====bba====
6237 ===bc===
6238 ==c==
6239 ===ca===
6240 !! result
6241 start
6242 ==a==
6243 ===aa===
6244 ====aaa====
6245 ==b==
6246 ===ba===
6247 ===bb===
6248 xxx
6249
6250 ===bc===
6251 ==c==
6252 ===ca===
6253 !! end
6254
6255 !! test
6256 Section replacement test (section 8)
6257 !! options
6258 replace=8,"xxx"
6259 !! input
6260 start
6261 ==a==
6262 ===aa===
6263 ====aaa====
6264 ==b==
6265 ===ba===
6266 ===bb===
6267 ====bba====
6268 ===bc===
6269 ==c==
6270 ===ca===
6271 !! result
6272 start
6273 ==a==
6274 ===aa===
6275 ====aaa====
6276 ==b==
6277 ===ba===
6278 ===bb===
6279 ====bba====
6280 xxx
6281
6282 ==c==
6283 ===ca===
6284 !!end
6285
6286 !! test
6287 Section replacement test (section 9)
6288 !! options
6289 replace=9,"xxx"
6290 !! input
6291 start
6292 ==a==
6293 ===aa===
6294 ====aaa====
6295 ==b==
6296 ===ba===
6297 ===bb===
6298 ====bba====
6299 ===bc===
6300 ==c==
6301 ===ca===
6302 !! result
6303 start
6304 ==a==
6305 ===aa===
6306 ====aaa====
6307 ==b==
6308 ===ba===
6309 ===bb===
6310 ====bba====
6311 ===bc===
6312 xxx
6313 !! end
6314
6315 !! test
6316 Section replacement test (section 10)
6317 !! options
6318 replace=10,"xxx"
6319 !! input
6320 start
6321 ==a==
6322 ===aa===
6323 ====aaa====
6324 ==b==
6325 ===ba===
6326 ===bb===
6327 ====bba====
6328 ===bc===
6329 ==c==
6330 ===ca===
6331 !! result
6332 start
6333 ==a==
6334 ===aa===
6335 ====aaa====
6336 ==b==
6337 ===ba===
6338 ===bb===
6339 ====bba====
6340 ===bc===
6341 ==c==
6342 xxx
6343 !! end
6344
6345 !! test
6346 Section replacement test with initial whitespace (bug 13728)
6347 !! options
6348 replace=2,"xxx"
6349 !! input
6350 Preformatted initial line
6351 ==a==
6352 ===a===
6353 !! result
6354 Preformatted initial line
6355 ==a==
6356 xxx
6357 !! end
6358
6359
6360 !! test
6361 Section extraction, heading followed by pre with 20 spaces (bug 6398)
6362 !! options
6363 section=1
6364 !! input
6365 ==a==
6366 a
6367 !! result
6368 ==a==
6369 a
6370 !! end
6371
6372 !! test
6373 Section extraction, heading followed by pre with 19 spaces (bug 6398 sanity check)
6374 !! options
6375 section=1
6376 !! input
6377 ==a==
6378 a
6379 !! result
6380 ==a==
6381 a
6382 !! end
6383
6384
6385 !! test
6386 Section extraction, <pre> around bogus header (bug 10309)
6387 !! options
6388 noxml section=2
6389 !! input
6390 == Section One ==
6391 <pre>
6392 =======
6393 </pre>
6394
6395 == Section Two ==
6396 stuff
6397 !! result
6398 == Section Two ==
6399 stuff
6400 !! end
6401
6402 !! test
6403 Section replacement, <pre> around bogus header (bug 10309)
6404 !! options
6405 noxml replace=2,"xxx"
6406 !! input
6407 == Section One ==
6408 <pre>
6409 =======
6410 </pre>
6411
6412 == Section Two ==
6413 stuff
6414 !! result
6415 == Section One ==
6416 <pre>
6417 =======
6418 </pre>
6419
6420 xxx
6421 !! end
6422
6423
6424
6425 !! test
6426 Handling of &#x0A; in URLs
6427 !! input
6428 **irc://&#x0A;a
6429 !! result
6430 <ul><li><ul><li><a href="irc://%0Aa" class="external free" rel="nofollow">irc://%0Aa</a>
6431 </li></ul>
6432 </li></ul>
6433
6434 !!end
6435
6436 !! test
6437 5 quotes, code coverage +1 line
6438 !! input
6439 '''''
6440 !! result
6441 !! end
6442
6443 !! test
6444 Special:Search page linking.
6445 !! input
6446 {{Special:search}}
6447 !! result
6448 <p><a href="/wiki/Special:Search" title="Special:Search">Special:Search</a>
6449 </p>
6450 !! end
6451
6452 !! test
6453 Say the magic word
6454 !! input
6455 * {{PAGENAME}}
6456 * {{BASEPAGENAME}}
6457 * {{SUBPAGENAME}}
6458 * {{SUBPAGENAMEE}}
6459 * {{BASEPAGENAME}}
6460 * {{BASEPAGENAMEE}}
6461 * {{TALKPAGENAME}}
6462 * {{TALKPAGENAMEE}}
6463 * {{SUBJECTPAGENAME}}
6464 * {{SUBJECTPAGENAMEE}}
6465 * {{NAMESPACEE}}
6466 * {{NAMESPACE}}
6467 * {{TALKSPACE}}
6468 * {{TALKSPACEE}}
6469 * {{SUBJECTSPACE}}
6470 * {{SUBJECTSPACEE}}
6471 * {{Dynamic|{{NUMBEROFUSERS}}|{{NUMBEROFPAGES}}|{{CURRENTVERSION}}|{{CONTENTLANGUAGE}}|{{DIRECTIONMARK}}|{{CURRENTTIMESTAMP}}|{{NUMBEROFARTICLES}}}}
6472 !! result
6473 <ul><li> Parser test
6474 </li><li> Parser test
6475 </li><li> Parser test
6476 </li><li> Parser_test
6477 </li><li> Parser test
6478 </li><li> Parser_test
6479 </li><li> Talk:Parser test
6480 </li><li> Talk:Parser_test
6481 </li><li> Parser test
6482 </li><li> Parser_test
6483 </li><li>
6484 </li><li>
6485 </li><li> Talk
6486 </li><li> Talk
6487 </li><li>
6488 </li><li>
6489 </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>
6490 </li></ul>
6491
6492 !! end
6493 ### Note: Above tests excludes the "{{NUMBEROFADMINS}}" magic word because it generates a MySQL error when included.
6494
6495 !! test
6496 Gallery
6497 !! input
6498 <gallery>
6499 image1.png |
6500 image2.gif|||||
6501
6502 image3|
6503 image4 |300px| centre
6504 image5.svg| http://///////
6505 [[x|xx]]]]
6506 * image6
6507 </gallery>
6508 !! result
6509 <table class="gallery" cellspacing="0" cellpadding="0">
6510 <tr>
6511 <td><div class="gallerybox" style="width: 155px;">
6512 <div style="height: 152px;">Image1.png</div>
6513 <div class="gallerytext">
6514 </div>
6515 </div></td>
6516 <td><div class="gallerybox" style="width: 155px;">
6517 <div style="height: 152px;">Image2.gif</div>
6518 <div class="gallerytext">
6519 <p>||||
6520 </p>
6521 </div>
6522 </div></td>
6523 <td><div class="gallerybox" style="width: 155px;">
6524 <div style="height: 152px;">Image3</div>
6525 <div class="gallerytext">
6526 </div>
6527 </div></td>
6528 <td><div class="gallerybox" style="width: 155px;">
6529 <div style="height: 152px;">Image4</div>
6530 <div class="gallerytext">
6531 <p>300px| centre
6532 </p>
6533 </div>
6534 </div></td>
6535 </tr>
6536 <tr>
6537 <td><div class="gallerybox" style="width: 155px;">
6538 <div style="height: 152px;">Image5.svg</div>
6539 <div class="gallerytext">
6540 <p><a href="http://///////" class="external free" rel="nofollow">http://///////</a>
6541 </p>
6542 </div>
6543 </div></td>
6544 <td><div class="gallerybox" style="width: 155px;">
6545 <div style="height: 152px;">* image6</div>
6546 <div class="gallerytext">
6547 </div>
6548 </div></td>
6549 </tr>
6550 </table>
6551
6552 !! end
6553
6554 !! test
6555 Gallery (with options)
6556 !! input
6557 <gallery widths='60px' heights='40px' perrow='2' caption='Foo [[Main Page]]' >
6558 File:Nonexistant.jpg|caption
6559 File:Nonexistant.jpg
6560 image:foobar.jpg|some '''caption''' [[Main Page]]
6561 image:foobar.jpg
6562 </gallery>
6563 !! result
6564 <table class="gallery" cellspacing="0" cellpadding="0">
6565 <caption>Foo <a href="/wiki/Main_Page" title="Main Page">Main Page</a></caption>
6566 <tr>
6567 <td><div class="gallerybox" style="width: 95px;">
6568 <div style="height: 52px;">Nonexistant.jpg</div>
6569 <div class="gallerytext">
6570 <p>caption
6571 </p>
6572 </div>
6573 </div></td>
6574 <td><div class="gallerybox" style="width: 95px;">
6575 <div style="height: 52px;">Nonexistant.jpg</div>
6576 <div class="gallerytext">
6577 </div>
6578 </div></td>
6579 </tr>
6580 <tr>
6581 <td><div class="gallerybox" style="width: 95px;">
6582 <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>
6583 <div class="gallerytext">
6584 <p>some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
6585 </p>
6586 </div>
6587 </div></td>
6588 <td><div class="gallerybox" style="width: 95px;">
6589 <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>
6590 <div class="gallerytext">
6591 </div>
6592 </div></td>
6593 </tr>
6594 </table>
6595
6596 !! end
6597
6598 !! test
6599 gallery (with showfilename option)
6600 !! input
6601 <gallery showfilename>
6602 File:Nonexistant.jpg|caption
6603 File:Nonexistant.jpg
6604 image:foobar.jpg|some '''caption''' [[Main Page]]
6605 File:Foobar.jpg
6606 </gallery>
6607 !! result
6608 <table class="gallery" cellspacing="0" cellpadding="0">
6609 <tr>
6610 <td><div class="gallerybox" style="width: 155px;">
6611 <div style="height: 152px;">Nonexistant.jpg</div>
6612 <div class="gallerytext">
6613 <p><a href="/wiki/File:Nonexistant.jpg" title="File:Nonexistant.jpg">Nonexistant.jpg</a><br />
6614 caption
6615 </p>
6616 </div>
6617 </div></td>
6618 <td><div class="gallerybox" style="width: 155px;">
6619 <div style="height: 152px;">Nonexistant.jpg</div>
6620 <div class="gallerytext">
6621 <p><a href="/wiki/File:Nonexistant.jpg" title="File:Nonexistant.jpg">Nonexistant.jpg</a><br />
6622 </p>
6623 </div>
6624 </div></td>
6625 <td><div class="gallerybox" style="width: 155px;">
6626 <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>
6627 <div class="gallerytext">
6628 <p><a href="/wiki/File:Foobar.jpg" title="File:Foobar.jpg">Foobar.jpg</a><br />
6629 some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
6630 </p>
6631 </div>
6632 </div></td>
6633 <td><div class="gallerybox" style="width: 155px;">
6634 <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>
6635 <div class="gallerytext">
6636 <p><a href="/wiki/File:Foobar.jpg" title="File:Foobar.jpg">Foobar.jpg</a><br />
6637 </p>
6638 </div>
6639 </div></td>
6640 </tr>
6641 </table>
6642
6643 !! end
6644
6645 !! test
6646 HTML Hex character encoding (spells the word "JavaScript")
6647 !! input
6648 &#x4A;&#x061;&#x0076;&#x00061;&#x000053;&#x0000063;&#114;&#x0000069;&#00000112;&#x0000000074;
6649 !! result
6650 <p>&#x4a;&#x61;&#x76;&#x61;&#x53;&#x63;&#114;&#x69;&#112;&#x74;
6651 </p>
6652 !! end
6653
6654 !! test
6655 __FORCETOC__ override
6656 !! input
6657 __NEWSECTIONLINK__
6658 __FORCETOC__
6659 !! result
6660 <p><br />
6661 </p>
6662 !! end
6663
6664 !! test
6665 ISBN code coverage
6666 !! input
6667 ISBN 978-0-1234-56&#x20;789
6668 !! result
6669 <p><a href="/wiki/Special:BookSources/9780123456" class="internal mw-magiclink-isbn">ISBN 978-0-1234-56</a>&#x20;789
6670 </p>
6671 !! end
6672
6673 !! test
6674 ISBN followed by 5 spaces
6675 !! input
6676 ISBN
6677 !! result
6678 <p>ISBN
6679 </p>
6680 !! end
6681
6682 !! test
6683 Double ISBN
6684 !! input
6685 ISBN ISBN 1234567890
6686 !! result
6687 <p>ISBN <a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
6688 </p>
6689 !! end
6690
6691 !! test
6692 Bug 22905: <abbr> followed by ISBN followed by </a>
6693 !! input
6694 <abbr>(fr)</abbr> ISBN 2753300917 [http://www.example.com example.com]
6695 !! result
6696 <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>
6697 </p>
6698 !! end
6699
6700 !! test
6701 Double RFC
6702 !! input
6703 RFC RFC 1234
6704 !! result
6705 <p>RFC <a href="http://tools.ietf.org/html/rfc1234" class="external mw-magiclink-rfc">RFC 1234</a>
6706 </p>
6707 !! end
6708
6709 !! test
6710 Double RFC with a wiki link
6711 !! input
6712 RFC [[RFC 1234]]
6713 !! result
6714 <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>
6715 </p>
6716 !! end
6717
6718 !! test
6719 RFC code coverage
6720 !! input
6721 RFC 983&#x20;987
6722 !! result
6723 <p><a href="http://tools.ietf.org/html/rfc983" class="external mw-magiclink-rfc">RFC 983</a>&#x20;987
6724 </p>
6725 !! end
6726
6727 !! test
6728 Centre-aligned image
6729 !! input
6730 [[Image:foobar.jpg|centre]]
6731 !! result
6732 <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>
6733
6734 !!end
6735
6736 !! test
6737 None-aligned image
6738 !! input
6739 [[Image:foobar.jpg|none]]
6740 !! result
6741 <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>
6742
6743 !!end
6744
6745 !! test
6746 Width + Height sized image (using px) (height is ignored)
6747 !! input
6748 [[Image:foobar.jpg|640x480px]]
6749 !! result
6750 <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>
6751 </p>
6752 !!end
6753
6754 !! test
6755 Width-sized image (using px, no following whitespace)
6756 !! input
6757 [[Image:foobar.jpg|640px]]
6758 !! result
6759 <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>
6760 </p>
6761 !!end
6762
6763 !! test
6764 Width-sized image (using px, with following whitespace - test regression from r39467)
6765 !! input
6766 [[Image:foobar.jpg|640px ]]
6767 !! result
6768 <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>
6769 </p>
6770 !!end
6771
6772 !! test
6773 Width-sized image (using px, with preceding whitespace - test regression from r39467)
6774 !! input
6775 [[Image:foobar.jpg| 640px]]
6776 !! result
6777 <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>
6778 </p>
6779 !!end
6780
6781 !! test
6782 Another italics / bold test
6783 !! input
6784 ''' ''x'
6785 !! result
6786 <pre>'<i> </i>x'
6787 </pre>
6788 !!end
6789
6790 # Note the results may be incorrect, as parserTest output included this:
6791 # XML error: Mismatched tag at byte 6120:
6792 # ...<dd> </dt></dl> </dd...
6793 !! test
6794 dt/dd/dl test
6795 !! options
6796 disabled
6797 !! input
6798 :;;;::
6799 !! result
6800 <dl><dd><dl><dt><dl><dt><dl><dt><dl><dd><dl><dd>
6801 </dd></dl>
6802 </dd></dl>
6803 </dt></dl>
6804 </dt></dl>
6805 </dt></dl>
6806 </dd></dl>
6807
6808 !!end
6809
6810
6811 # Images with the "|" character in external URLs in comment tags; Eats half the comment, leaves unmatched "</a>" tag.
6812 !! test
6813 Images with the "|" character in the comment
6814 !! input
6815 [[image:Foobar.jpg|thumb|An [http://test/?param1=|left|&param2=|x external] URL]]
6816 !! result
6817 <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>
6818
6819 !!end
6820
6821 !! test
6822 [Before] HTML without raw HTML enabled ($wgRawHtml==false)
6823 !! input
6824 <html><script>alert(1);</script></html>
6825 !! result
6826 <p>&lt;html&gt;&lt;script&gt;alert(1);&lt;/script&gt;&lt;/html&gt;
6827 </p>
6828 !! end
6829
6830 !! test
6831 HTML with raw HTML ($wgRawHtml==true)
6832 !! options
6833 rawhtml
6834 !! input
6835 <html><script>alert(1);</script></html>
6836 !! result
6837 <p><script>alert(1);</script>
6838 </p>
6839 !! end
6840
6841 !! test
6842 Parents of subpages, one level up
6843 !! options
6844 subpage title=[[Subpage test/L1/L2/L3]]
6845 !! input
6846 [[../|L2]]
6847 !! result
6848 <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>
6849 </p>
6850 !! end
6851
6852
6853 !! test
6854 Parents of subpages, one level up, not named
6855 !! options
6856 subpage title=[[Subpage test/L1/L2/L3]]
6857 !! input
6858 [[../]]
6859 !! result
6860 <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>
6861 </p>
6862 !! end
6863
6864
6865
6866 !! test
6867 Parents of subpages, two levels up
6868 !! options
6869 subpage title=[[Subpage test/L1/L2/L3]]
6870 !! input
6871 [[../../|L1]]2
6872
6873 [[../../|L1]]l
6874 !! result
6875 <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
6876 </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>
6877 </p>
6878 !! end
6879
6880 !! test
6881 Parents of subpages, two levels up, without trailing slash or name.
6882 !! options
6883 subpage title=[[Subpage test/L1/L2/L3]]
6884 !! input
6885 [[../..]]
6886 !! result
6887 <p>[[../..]]
6888 </p>
6889 !! end
6890
6891 !! test
6892 Parents of subpages, two levels up, with lots of extra trailing slashes.
6893 !! options
6894 subpage title=[[Subpage test/L1/L2/L3]]
6895 !! input
6896 [[../../////]]
6897 !! result
6898 <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>
6899 </p>
6900 !! end
6901
6902 !! test
6903 Definition list code coverage
6904 !! input
6905 ; title : def
6906 ; title : def
6907 ;title: def
6908 !! result
6909 <dl><dt> title &#160;</dt><dd> def
6910 </dd><dt> title&#160;</dt><dd> def
6911 </dd><dt>title</dt><dd> def
6912 </dd></dl>
6913
6914 !! end
6915
6916 !! test
6917 Don't fall for the self-closing div
6918 !! input
6919 <div>hello world</div/>
6920 !! result
6921 <div>hello world</div>
6922
6923 !! end
6924
6925 !! test
6926 MSGNW magic word
6927 !! input
6928 {{MSGNW:msg}}
6929 !! result
6930 <p>&#91;&#91;:Template:Msg&#93;&#93;
6931 </p>
6932 !! end
6933
6934 !! test
6935 RAW magic word
6936 !! input
6937 {{RAW:QUERTY}}
6938 !! result
6939 <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>
6940 </p>
6941 !! end
6942
6943 # This isn't needed for XHTML conformance, but would be handy as a fallback security measure
6944 !! test
6945 Always escape literal '>' in output, not just after '<'
6946 !! input
6947 ><>
6948 !! result
6949 <p>&gt;&lt;&gt;
6950 </p>
6951 !! end
6952
6953 !! test
6954 Template caching
6955 !! input
6956 {{Test}}
6957 {{Test}}
6958 !! result
6959 <p>This is a test template
6960 This is a test template
6961 </p>
6962 !! end
6963
6964
6965 !! article
6966 MediaWiki:Fake
6967 !! text
6968 ==header==
6969 !! endarticle
6970
6971 !! test
6972 Inclusion of !userCanEdit() content
6973 !! input
6974 {{MediaWiki:Fake}}
6975 !! result
6976 <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>
6977
6978 !! end
6979
6980
6981 !! test
6982 Out-of-order TOC heading levels
6983 !! input
6984 ==2==
6985 ======6======
6986 ===3===
6987 =1=
6988 =====5=====
6989 ==2==
6990 !! result
6991 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
6992 <ul>
6993 <li class="toclevel-1 tocsection-1"><a href="#2"><span class="tocnumber">1</span> <span class="toctext">2</span></a>
6994 <ul>
6995 <li class="toclevel-2 tocsection-2"><a href="#6"><span class="tocnumber">1.1</span> <span class="toctext">6</span></a></li>
6996 <li class="toclevel-2 tocsection-3"><a href="#3"><span class="tocnumber">1.2</span> <span class="toctext">3</span></a></li>
6997 </ul>
6998 </li>
6999 <li class="toclevel-1 tocsection-4"><a href="#1"><span class="tocnumber">2</span> <span class="toctext">1</span></a>
7000 <ul>
7001 <li class="toclevel-2 tocsection-5"><a href="#5"><span class="tocnumber">2.1</span> <span class="toctext">5</span></a></li>
7002 <li class="toclevel-2 tocsection-6"><a href="#2_2"><span class="tocnumber">2.2</span> <span class="toctext">2</span></a></li>
7003 </ul>
7004 </li>
7005 </ul>
7006 </td></tr></table>
7007 <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>
7008 <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>
7009 <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>
7010 <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>
7011 <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>
7012 <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>
7013
7014 !! end
7015
7016
7017 !! test
7018 ISBN with a dummy number
7019 !! input
7020 ISBN ---
7021 !! result
7022 <p>ISBN ---
7023 </p>
7024 !! end
7025
7026
7027 !! test
7028 ISBN with space-delimited number
7029 !! input
7030 ISBN 92 9017 032 8
7031 !! result
7032 <p><a href="/wiki/Special:BookSources/9290170328" class="internal mw-magiclink-isbn">ISBN 92 9017 032 8</a>
7033 </p>
7034 !! end
7035
7036
7037 !! test
7038 ISBN with multiple spaces, no number
7039 !! input
7040 ISBN foo
7041 !! result
7042 <p>ISBN foo
7043 </p>
7044 !! end
7045
7046
7047 !! test
7048 ISBN length
7049 !! input
7050 ISBN 123456789
7051
7052 ISBN 1234567890
7053
7054 ISBN 12345678901
7055 !! result
7056 <p>ISBN 123456789
7057 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
7058 </p><p>ISBN 12345678901
7059 </p>
7060 !! end
7061
7062
7063 !! test
7064 ISBN with trailing year (bug 8110)
7065 !! input
7066 ISBN 1-234-56789-0 - 2006
7067
7068 ISBN 1 234 56789 0 - 2006
7069 !! result
7070 <p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1-234-56789-0</a> - 2006
7071 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1 234 56789 0</a> - 2006
7072 </p>
7073 !! end
7074
7075
7076 !! test
7077 anchorencode
7078 !! input
7079 {{anchorencode:foo bar©#%n}}
7080 !! result
7081 <p>foo_bar.C2.A9.23.25n
7082 </p>
7083 !! end
7084
7085 !! test
7086 anchorencode trims spaces
7087 !! input
7088 {{anchorencode: __pretty__please__}}
7089 !! result
7090 <p>pretty_please
7091 </p>
7092 !! end
7093
7094 !! test
7095 anchorencode deals with links
7096 !! input
7097 {{anchorencode: [[hello|world]] [[hi]]}}
7098 !! result
7099 <p>world_hi
7100 </p>
7101 !! end
7102
7103 !! test
7104 anchorencode deals with templates
7105 !! input
7106 {{anchorencode: {{Foo}} }}
7107 !! result
7108 <p>FOO
7109 </p>
7110 !! end
7111
7112 !! test
7113 anchorencode encodes like the TOC generator: (bug 18431)
7114 !! input
7115 === _ +:.3A%3A&&amp;]] ===
7116 {{anchorencode: _ +:.3A%3A&&amp;]] }}
7117 __NOEDITSECTION__
7118 !! result
7119 <h3> <span class="mw-headline" id=".2B:.3A.253A.26.26.5D.5D"> _ +:.3A%3A&amp;&amp;]] </span></h3>
7120 <p>.2B:.3A.253A.26.26.5D.5D
7121 </p>
7122 !! end
7123
7124 # Expected output in the following test is not necessarily expected (there
7125 # should probably be <p> tags inside the <blockquote> in the output) -- it's
7126 # only testing for well-formedness.
7127 !! test
7128 Bug 6200: blockquotes and paragraph formatting
7129 !! input
7130 <blockquote>
7131 foo
7132 </blockquote>
7133
7134 bar
7135
7136 baz
7137 !! result
7138 <blockquote>
7139 foo
7140 </blockquote>
7141 <p>bar
7142 </p>
7143 <pre>baz
7144 </pre>
7145 !! end
7146
7147 !! test
7148 Bug 8293: Use of center tag ruins paragraph formatting
7149 !! input
7150 <center>
7151 foo
7152 </center>
7153
7154 bar
7155
7156 baz
7157 !! result
7158 <center>
7159 <p>foo
7160 </p>
7161 </center>
7162 <p>bar
7163 </p>
7164 <pre>baz
7165 </pre>
7166 !! end
7167
7168
7169 ###
7170 ### Language variants related tests
7171 ###
7172 !! test
7173 Self-link in language variants
7174 !! options
7175 title=[[Dunav]] language=sr
7176 !! input
7177 Both [[Dunav]] and [[Дунав]] are names for this river.
7178 !! result
7179 <p>Both <strong class="selflink">Dunav</strong> and <strong class="selflink">Дунав</strong> are names for this river.
7180 </p>
7181 !!end
7182
7183
7184 !! test
7185 Link to pages in language variants
7186 !! options
7187 language=sr
7188 !! input
7189 Main Page can be written as [[Маин Паге]]
7190 !! result
7191 <p>Main Page can be written as <a href="/wiki/Main_Page" title="Main Page">Маин Паге</a>
7192 </p>
7193 !!end
7194
7195
7196 !! test
7197 Multiple links to pages in language variants
7198 !! options
7199 language=sr
7200 !! input
7201 [[Main Page]] can be written as [[Маин Паге]] same as [[Маин Паге]].
7202 !! result
7203 <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>.
7204 </p>
7205 !!end
7206
7207
7208 !! test
7209 Simple template in language variants
7210 !! options
7211 language=sr
7212 !! input
7213 {{тест}}
7214 !! result
7215 <p>This is a test template
7216 </p>
7217 !! end
7218
7219
7220 !! test
7221 Template with explicit namespace in language variants
7222 !! options
7223 language=sr
7224 !! input
7225 {{Template:тест}}
7226 !! result
7227 <p>This is a test template
7228 </p>
7229 !! end
7230
7231
7232 !! test
7233 Basic test for template parameter in language variants
7234 !! options
7235 language=sr
7236 !! input
7237 {{парамтест|param=foo}}
7238 !! result
7239 <p>This is a test template with parameter foo
7240 </p>
7241 !! end
7242
7243
7244 !! test
7245 Simple category in language variants
7246 !! options
7247 language=sr cat
7248 !! input
7249 [[Category:МедиаWики Усер'с Гуиде]]
7250 !! result
7251 <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>
7252 !! end
7253
7254
7255 !! test
7256 Stripping -{}- tags (language variants)
7257 !! options
7258 language=sr
7259 !! input
7260 Latin proverb: -{Ne nuntium necare}-
7261 !! result
7262 <p>Latin proverb: Ne nuntium necare
7263 </p>
7264 !! end
7265
7266
7267 !! test
7268 Prevent conversion with -{}- tags (language variants)
7269 !! options
7270 language=sr variant=sr-ec
7271 !! input
7272 Latinski: -{Ne nuntium necare}-
7273 !! result
7274 <p>Латински: Ne nuntium necare
7275 </p>
7276 !! end
7277
7278
7279 !! test
7280 Prevent conversion of text with -{}- tags (language variants)
7281 !! options
7282 language=sr variant=sr-ec
7283 !! input
7284 Latinski: -{Ne nuntium necare}-
7285 !! result
7286 <p>Латински: Ne nuntium necare
7287 </p>
7288 !! end
7289
7290
7291 !! test
7292 Prevent conversion of links with -{}- tags (language variants)
7293 !! options
7294 language=sr variant=sr-ec
7295 !! input
7296 -{[[Main Page]]}-
7297 !! result
7298 <p><a href="/index.php?title=Main_Page&amp;variant=sr-ec" title="Main Page">Main Page</a>
7299 </p>
7300 !! end
7301
7302
7303 !! test
7304 -{}- tags within headlines (within html for parserConvert())
7305 !! options
7306 language=sr variant=sr-ec
7307 !! input
7308 == -{Naslov}- ==
7309 !! result
7310 <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>
7311
7312 !! end
7313
7314
7315 !! test
7316 Explicit definition of language variant alternatives
7317 !! options
7318 language=zh variant=zh-tw
7319 !! input
7320 -{zh:China;zh-tw:Taiwan}-, not China
7321 !! result
7322 <p>Taiwan, not China
7323 </p>
7324 !! end
7325
7326
7327 !! test
7328 Explicit session-wise language variant mapping (A flag and - flag)
7329 !! options
7330 language=zh variant=zh-tw
7331 !! input
7332 Taiwan is not China.
7333 But -{A|zh:China;zh-tw:Taiwan}- is China,
7334 (This-{-|zh:China;zh-tw:Taiwan}- should be stripped!)
7335 and -{China}- is China.
7336 !! result
7337 <p>Taiwan is not China.
7338 But Taiwan is Taiwan,
7339 (This should be stripped!)
7340 and China is China.
7341 </p>
7342 !! end
7343
7344 !! test
7345 Explicit session-wise language variant mapping (H flag for hide)
7346 !! options
7347 language=zh variant=zh-tw
7348 !! input
7349 (This-{H|zh:China;zh-tw:Taiwan}- should be stripped!)
7350 Taiwan is China.
7351 !! result
7352 <p>(This should be stripped!)
7353 Taiwan is Taiwan.
7354 </p>
7355 !! end
7356
7357 !! test
7358 Adding explicit conversion rule for title (T flag)
7359 !! options
7360 language=zh variant=zh-tw showtitle
7361 !! input
7362 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
7363 !! result
7364 Taiwan
7365 <p>Should be stripped!
7366 </p>
7367 !! end
7368
7369 !! test
7370 Testing that changing the language variant here in the tests actually works
7371 !! options
7372 language=zh variant=zh showtitle
7373 !! input
7374 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
7375 !! result
7376 China
7377 <p>Should be stripped!
7378 </p>
7379 !! end
7380
7381 !! test
7382 Bug 24072: more test on conversion rule for title
7383 !! options
7384 language=zh variant=zh-tw showtitle
7385 !! input
7386 This should be stripped-{T|zh:China;zh-tw:Taiwan}-!
7387 This won't take interferes with the title rule-{H|zh:Beijing;zh-tw:Taipei}-.
7388 !! result
7389 Taiwan
7390 <p>This should be stripped!
7391 This won't take interferes with the title rule.
7392 </p>
7393 !! end
7394
7395 !! test
7396 Raw output of variant escape tags (R flag)
7397 !! options
7398 language=zh variant=zh-tw
7399 !! input
7400 Raw: -{R|zh:China;zh-tw:Taiwan}-
7401 !! result
7402 <p>Raw: zh:China;zh-tw:Taiwan
7403 </p>
7404 !! end
7405
7406 !! test
7407 Nested using of manual convert syntax
7408 !! options
7409 language=zh variant=zh-hk
7410 !! input
7411 Nested: -{zh-hans:Hi -{zh-cn:China;zh-sg:Singapore;}-;zh-hant:Hello -{zh-tw:Taiwan;zh-hk:H-{ong}- K-{}-ong;}-;}-!
7412 !! result
7413 <p>Nested: Hello Hong Kong!
7414 </p>
7415 !! end
7416
7417 !! test
7418 Do not convert roman numbers to language variants
7419 !! options
7420 language=sr variant=sr-ec
7421 !! input
7422 Fridrih IV je car.
7423 !! result
7424 <p>Фридрих IV је цар.
7425 </p>
7426 !! end
7427
7428 !! test
7429 Unclosed language converter markup "-{"
7430 !! options
7431 language=sr
7432 !! input
7433 -{T|hello
7434 !! result
7435 <p>-{T|hello
7436 </p>
7437 !! end
7438
7439 !! test
7440 Don't convert raw rule "-{R|=&gt;}-" to "=>"
7441 !! options
7442 language=sr
7443 !! input
7444 -{R|=&gt;}-
7445 !! result
7446 <p>=&gt;
7447 </p>
7448 !!end
7449
7450 !!article
7451 Template:Bullet
7452 !!text
7453 * Bar
7454 !!endarticle
7455
7456 !! test
7457 Bug 529: Uncovered bullet
7458 !! input
7459 * Foo {{bullet}}
7460 !! result
7461 <ul><li> Foo
7462 </li><li> Bar
7463 </li></ul>
7464
7465 !! end
7466
7467 !! test
7468 Bug 529: Uncovered table already at line-start
7469 !! input
7470 x
7471
7472 {{table}}
7473 y
7474 !! result
7475 <p>x
7476 </p>
7477 <table>
7478 <tr>
7479 <td> 1 </td>
7480 <td> 2
7481 </td></tr>
7482 <tr>
7483 <td> 3 </td>
7484 <td> 4
7485 </td></tr></table>
7486 <p>y
7487 </p>
7488 !! end
7489
7490 !! test
7491 Bug 529: Uncovered bullet in parser function result
7492 !! input
7493 * Foo {{lc:{{bullet}} }}
7494 !! result
7495 <ul><li> Foo
7496 </li><li> bar
7497 </li></ul>
7498
7499 !! end
7500
7501 !! test
7502 Bug 5678: Double-parsed template argument
7503 !! input
7504 {{lc:{{{1}}}|hello}}
7505 !! result
7506 <p>{{{1}}}
7507 </p>
7508 !! end
7509
7510 !! test
7511 Bug 5678: Double-parsed template invocation
7512 !! input
7513 {{lc:{{paramtest {{!}} param = hello }} }}
7514 !! result
7515 <p>{{paramtest | param = hello }}
7516 </p>
7517 !! end
7518
7519 !! test
7520 Case insensitivity of parser functions for non-ASCII characters (bug 8143)
7521 !! options
7522 language=cs
7523 title=[[Main Page]]
7524 !! input
7525 {{PRVNÍVELKÉ:ěščř}}
7526 {{prvnívelké:ěščř}}
7527 {{PRVNÍMALÉ:ěščř}}
7528 {{prvnímalé:ěščř}}
7529 {{MALÁ:ěščř}}
7530 {{malá:ěščř}}
7531 {{VELKÁ:ěščř}}
7532 {{velká:ěščř}}
7533 !! result
7534 <p>Ěščř
7535 Ěščř
7536 ěščř
7537 ěščř
7538 ěščř
7539 ěščř
7540 ĚŠČŘ
7541 ĚŠČŘ
7542 </p>
7543 !! end
7544
7545 !! test
7546 Morwen/13: Unclosed link followed by heading
7547 !! input
7548 [[link
7549 ==heading==
7550 !! result
7551 <p>[[link
7552 </p>
7553 <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>
7554
7555 !! end
7556
7557 !! test
7558 HHP2.1: Heuristics for headings in preprocessor parenthetical structures
7559 !! input
7560 {{foo|
7561 =heading=
7562 !! result
7563 <p>{{foo|
7564 </p>
7565 <h1> <span class="mw-headline" id="heading">heading</span></h1>
7566
7567 !! end
7568
7569 !! test
7570 HHP2.2: Heuristics for headings in preprocessor parenthetical structures
7571 !! input
7572 {{foo|
7573 ==heading==
7574 !! result
7575 <p>{{foo|
7576 </p>
7577 <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>
7578
7579 !! end
7580
7581 !! test
7582 Tildes in comments
7583 !! options
7584 pst
7585 !! input
7586 <!-- ~~~~ -->
7587 !! result
7588 <!-- ~~~~ -->
7589 !! end
7590
7591 !! test
7592 Paragraphs inside divs (no extra line breaks)
7593 !! input
7594 <div>Line one
7595
7596 Line two</div>
7597 !! result
7598 <div>Line one
7599 Line two</div>
7600
7601 !! end
7602
7603 !! test
7604 Paragraphs inside divs (extra line break on open)
7605 !! input
7606 <div>
7607 Line one
7608
7609 Line two</div>
7610 !! result
7611 <div>
7612 <p>Line one
7613 </p>
7614 Line two</div>
7615
7616 !! end
7617
7618 !! test
7619 Paragraphs inside divs (extra line break on close)
7620 !! input
7621 <div>Line one
7622
7623 Line two
7624 </div>
7625 !! result
7626 <div>Line one
7627 <p>Line two
7628 </p>
7629 </div>
7630
7631 !! end
7632
7633 !! test
7634 Paragraphs inside divs (extra line break on open and close)
7635 !! input
7636 <div>
7637 Line one
7638
7639 Line two
7640 </div>
7641 !! result
7642 <div>
7643 <p>Line one
7644 </p><p>Line two
7645 </p>
7646 </div>
7647
7648 !! end
7649
7650 !! test
7651 Nesting tags, paragraphs on lines which begin with <div>
7652 !! options
7653 disabled
7654 !! input
7655 <div></div><strong>A
7656 B</strong>
7657 !! result
7658 <div></div>
7659 <p><strong>A
7660 B</strong>
7661 </p>
7662 !! end
7663
7664 # Bug 6200: <blockquote> should behave like <div> with respect to line breaks
7665 !! test
7666 Bug 6200: paragraphs inside blockquotes (no extra line breaks)
7667 !! options
7668 disabled
7669 !! input
7670 <blockquote>Line one
7671
7672 Line two</blockquote>
7673 !! result
7674 <blockquote>Line one
7675 Line two</blockquote>
7676
7677 !! end
7678
7679 !! test
7680 Bug 6200: paragraphs inside blockquotes (extra line break on open)
7681 !! options
7682 disabled
7683 !! input
7684 <blockquote>
7685 Line one
7686
7687 Line two</blockquote>
7688 !! result
7689 <blockquote>
7690 <p>Line one
7691 </p>
7692 Line two</blockquote>
7693
7694 !! end
7695
7696 !! test
7697 Bug 6200: paragraphs inside blockquotes (extra line break on close)
7698 !! options
7699 disabled
7700 !! input
7701 <blockquote>Line one
7702
7703 Line two
7704 </blockquote>
7705 !! result
7706 <blockquote>Line one
7707 <p>Line two
7708 </p>
7709 </blockquote>
7710
7711 !! end
7712
7713 !! test
7714 Bug 6200: paragraphs inside blockquotes (extra line break on open and close)
7715 !! options
7716 disabled
7717 !! input
7718 <blockquote>
7719 Line one
7720
7721 Line two
7722 </blockquote>
7723 !! result
7724 <blockquote>
7725 <p>Line one
7726 </p><p>Line two
7727 </p>
7728 </blockquote>
7729
7730 !! end
7731
7732 !! test
7733 Paragraphs inside blockquotes/divs (no extra line breaks)
7734 !! input
7735 <blockquote><div>Line one
7736
7737 Line two</div></blockquote>
7738 !! result
7739 <blockquote><div>Line one
7740 Line two</div></blockquote>
7741
7742 !! end
7743
7744 !! test
7745 Paragraphs inside blockquotes/divs (extra line break on open)
7746 !! input
7747 <blockquote><div>
7748 Line one
7749
7750 Line two</div></blockquote>
7751 !! result
7752 <blockquote><div>
7753 <p>Line one
7754 </p>
7755 Line two</div></blockquote>
7756
7757 !! end
7758
7759 !! test
7760 Paragraphs inside blockquotes/divs (extra line break on close)
7761 !! input
7762 <blockquote><div>Line one
7763
7764 Line two
7765 </div></blockquote>
7766 !! result
7767 <blockquote><div>Line one
7768 <p>Line two
7769 </p>
7770 </div></blockquote>
7771
7772 !! end
7773
7774 !! test
7775 Paragraphs inside blockquotes/divs (extra line break on open and close)
7776 !! input
7777 <blockquote><div>
7778 Line one
7779
7780 Line two
7781 </div></blockquote>
7782 !! result
7783 <blockquote><div>
7784 <p>Line one
7785 </p><p>Line two
7786 </p>
7787 </div></blockquote>
7788
7789 !! end
7790
7791 !! test
7792 Interwiki links trounced by replaceExternalLinks after early LinkHolderArray expansion
7793 !! options
7794 wgLinkHolderBatchSize=0
7795 !! input
7796 [[meatball:1]]
7797 [[meatball:2]]
7798 [[meatball:3]]
7799 !! result
7800 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?1" class="extiw" title="meatball:1">meatball:1</a>
7801 <a href="http://www.usemod.com/cgi-bin/mb.pl?2" class="extiw" title="meatball:2">meatball:2</a>
7802 <a href="http://www.usemod.com/cgi-bin/mb.pl?3" class="extiw" title="meatball:3">meatball:3</a>
7803 </p>
7804 !! end
7805
7806 !! test
7807 Free external link invading image caption
7808 !! input
7809 [[Image:Foobar.jpg|thumb|http://x|hello]]
7810 !! result
7811 <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>
7812
7813 !! end
7814
7815 !! test
7816 Bug 15196: localised external link numbers
7817 !! options
7818 language=fa
7819 !! input
7820 [http://en.wikipedia.org/]
7821 !! result
7822 <p><a href="http://en.wikipedia.org/" class="external autonumber" rel="nofollow">[۱]</a>
7823 </p>
7824 !! end
7825
7826 !! test
7827 Multibyte character in padleft
7828 !! input
7829 {{padleft:-Hello|7|Æ}}
7830 !! result
7831 <p>Æ-Hello
7832 </p>
7833 !! end
7834
7835 !! test
7836 Multibyte character in padright
7837 !! input
7838 {{padright:Hello-|7|Æ}}
7839 !! result
7840 <p>Hello-Æ
7841 </p>
7842 !! end
7843
7844 !! test
7845 Formatted date
7846 !! config
7847 wgUseDynamicDates=1
7848 !! input
7849 [[2009-03-24]]
7850 !! result
7851 <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>
7852 </p>
7853 !!end
7854
7855 !!test
7856 formatdate parser function
7857 !!input
7858 {{#formatdate:2009-03-24}}
7859 !! result
7860 <p><span class="mw-formatted-date" title="2009-03-24">2009-03-24</span>
7861 </p>
7862 !! end
7863
7864 !!test
7865 formatdate parser function, with default format
7866 !!input
7867 {{#formatdate:2009-03-24|mdy}}
7868 !! result
7869 <p><span class="mw-formatted-date" title="2009-03-24">March 24, 2009</span>
7870 </p>
7871 !! end
7872
7873 !! test
7874 Linked date with autoformatting disabled
7875 !! config
7876 wgUseDynamicDates=false
7877 !! input
7878 [[2009-03-24]]
7879 !! result
7880 <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>
7881 </p>
7882 !! end
7883
7884 !! test
7885 Spacing of numbers in formatted dates
7886 !! input
7887 {{#formatdate:January 15}}
7888 !! result
7889 <p><span class="mw-formatted-date" title="01-15">January 15</span>
7890 </p>
7891 !! end
7892
7893 !! test
7894 Spacing of numbers in formatted dates (linked)
7895 !! config
7896 wgUseDynamicDates=true
7897 !! input
7898 [[January 15]]
7899 !! result
7900 <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>
7901 </p>
7902 !! end
7903
7904 #
7905 #
7906 #
7907
7908 #
7909 # Edit comments
7910 #
7911
7912 !! test
7913 Edit comment with link
7914 !! options
7915 comment
7916 !! input
7917 I like the [[Main Page]] a lot
7918 !! result
7919 I like the <a href="/wiki/Main_Page" title="Main Page">Main Page</a> a lot
7920 !!end
7921
7922 !! test
7923 Edit comment with link and link text
7924 !! options
7925 comment
7926 !! input
7927 I like the [[Main Page|best pages]] a lot
7928 !! result
7929 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
7930 !!end
7931
7932 !! test
7933 Edit comment with link and link text with suffix
7934 !! options
7935 comment
7936 !! input
7937 I like the [[Main Page|best page]]s a lot
7938 !! result
7939 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
7940 !!end
7941
7942 !! test
7943 Edit comment with section link (non-local, eg in history list)
7944 !! options
7945 comment title=[[Main Page]]
7946 !! input
7947 /* External links */ removed bogus entries
7948 !! result
7949 <span class="autocomment"><a href="/wiki/Main_Page#External_links" title="Main Page">→</a>External links: </span> removed bogus entries
7950 !!end
7951
7952 !! test
7953 Edit comment with section link (local, eg in diff view)
7954 !! options
7955 comment local title=[[Main Page]]
7956 !! input
7957 /* External links */ removed bogus entries
7958 !! result
7959 <span class="autocomment"><a href="#External_links">→</a>External links: </span> removed bogus entries
7960 !!end
7961
7962 !! test
7963 Edit comment with subpage link (bug 14080)
7964 !! options
7965 comment
7966 subpage
7967 title=[[Subpage test]]
7968 !! input
7969 Poked at a [[/subpage]] here...
7970 !! result
7971 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a> here...
7972 !!end
7973
7974 !! test
7975 Edit comment with subpage link and link text (bug 14080)
7976 !! options
7977 comment
7978 subpage
7979 title=[[Subpage test]]
7980 !! input
7981 Poked at a [[/subpage|neat little page]] here...
7982 !! result
7983 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">neat little page</a> here...
7984 !!end
7985
7986 !! test
7987 Edit comment with bogus subpage link in non-subpage NS (bug 14080)
7988 !! options
7989 comment
7990 title=[[Subpage test]]
7991 !! input
7992 Poked at a [[/subpage]] here...
7993 !! result
7994 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...
7995 !!end
7996
7997 !! test
7998 Edit comment with bare anchor link (local, as on diff)
7999 !! options
8000 comment
8001 local
8002 title=[[Main Page]]
8003 !!input
8004 [[#section]]
8005 !! result
8006 <a href="#section">#section</a>
8007 !! end
8008
8009 !! test
8010 Edit comment with bare anchor link (non-local, as on history)
8011 !! options
8012 comment
8013 title=[[Main Page]]
8014 !!input
8015 [[#section]]
8016 !! result
8017 <a href="/wiki/Main_Page#section" title="Main Page">#section</a>
8018 !! end
8019
8020 !! test
8021 Space normalisation on autocomment (bug 22784)
8022 !! options
8023 comment
8024 title=[[Main Page]]
8025 !!input
8026 /* __hello__world__ */
8027 !! result
8028 <span class="autocomment"><a href="/wiki/Main_Page#hello_world" title="Main Page">→</a>__hello__world__</span>
8029 !! end
8030
8031 !! test
8032 Bad images - basic functionality
8033 !! input
8034 [[File:Bad.jpg]]
8035 !! result
8036 !! end
8037
8038 !! test
8039 Bad images - bug 16039: text after bad image disappears
8040 !! input
8041 Foo bar
8042 [[File:Bad.jpg]]
8043 Bar foo
8044 !! result
8045 <p>Foo bar
8046 </p><p>Bar foo
8047 </p>
8048 !! end
8049
8050 !! test
8051 Verify that displaytitle works (bug #22501) no displaytitle
8052 !! options
8053 showtitle
8054 !! config
8055 wgAllowDisplayTitle=true
8056 wgRestrictDisplayTitle=false
8057 !! input
8058 this is not the the title
8059 !! result
8060 Parser test
8061 <p>this is not the the title
8062 </p>
8063 !! end
8064
8065 !! test
8066 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=false
8067 !! options
8068 showtitle
8069 title=[[Screen]]
8070 !! config
8071 wgAllowDisplayTitle=true
8072 wgRestrictDisplayTitle=false
8073 !! input
8074 this is not the the title
8075 {{DISPLAYTITLE:whatever}}
8076 !! result
8077 whatever
8078 <p>this is not the the title
8079 </p>
8080 !! end
8081
8082 !! test
8083 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true mismatch
8084 !! options
8085 showtitle
8086 title=[[Screen]]
8087 !! config
8088 wgAllowDisplayTitle=true
8089 wgRestrictDisplayTitle=true
8090 !! input
8091 this is not the the title
8092 {{DISPLAYTITLE:whatever}}
8093 !! result
8094 Screen
8095 <p>this is not the the title
8096 </p>
8097 !! end
8098
8099 !! test
8100 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true matching
8101 !! options
8102 showtitle
8103 title=[[Screen]]
8104 !! config
8105 wgAllowDisplayTitle=true
8106 wgRestrictDisplayTitle=true
8107 !! input
8108 this is not the the title
8109 {{DISPLAYTITLE:screen}}
8110 !! result
8111 screen
8112 <p>this is not the the title
8113 </p>
8114 !! end
8115
8116 !! test
8117 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false
8118 !! options
8119 showtitle
8120 title=[[Screen]]
8121 !! config
8122 wgAllowDisplayTitle=false
8123 !! input
8124 this is not the the title
8125 {{DISPLAYTITLE:screen}}
8126 !! result
8127 Screen
8128 <p>this is not the the title
8129 <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>
8130 </p>
8131 !! end
8132
8133 !! test
8134 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false no DISPLAYTITLE
8135 !! options
8136 showtitle
8137 title=[[Screen]]
8138 !! config
8139 wgAllowDisplayTitle=false
8140 !! input
8141 this is not the the title
8142 !! result
8143 Screen
8144 <p>this is not the the title
8145 </p>
8146 !! end
8147
8148 !! test
8149 preload: check <noinclude> and <includeonly>
8150 !! options
8151 preload
8152 !! input
8153 Hello <noinclude>cruel</noinclude><includeonly>kind</includeonly> world.
8154 !! result
8155 Hello kind world.
8156 !! end
8157
8158 !! test
8159 preload: check <onlyinclude>
8160 !! options
8161 preload
8162 !! input
8163 Goodbye <onlyinclude>Hello world</onlyinclude>
8164 !! result
8165 Hello world
8166 !! end
8167
8168 !! test
8169 preload: can pass tags through if we want to
8170 !! options
8171 preload
8172 !! input
8173 <includeonly><</includeonly>includeonly>Hello world<includeonly><</includeonly>/includeonly>
8174 !! result
8175 <includeonly>Hello world</includeonly>
8176 !! end
8177
8178 !! test
8179 preload: check that it doesn't try to do tricks
8180 !! options
8181 preload
8182 !! input
8183 * <!-- Hello --> ''{{world}}'' {{<includeonly>subst:</includeonly>How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
8184 !! result
8185 * <!-- Hello --> ''{{world}}'' {{subst:How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
8186 !! end
8187
8188 !! test
8189 Play a bit with r67090 and bug 3158
8190 !! options
8191 disabled
8192 !! input
8193 <div style="width:50% !important">&nbsp;</div>
8194 <div style="width:50%&nbsp;!important">&nbsp;</div>
8195 <div style="width:50%&#160;!important">&nbsp;</div>
8196 <div style="border : solid;">&nbsp;</div>
8197 !! result
8198 <div style="width:50% !important">&nbsp;</div>
8199 <div style="width:50% !important">&nbsp;</div>
8200 <div style="width:50% !important">&nbsp;</div>
8201 <div style="border&#160;: solid;">&nbsp;</div>
8202
8203 !! end
8204
8205 !! test
8206 HTML5 data attributes
8207 !! input
8208 <span data-foo="bar">Baz</span>
8209 <p data-abc-def_hij="">Quuz</p>
8210 !! result
8211 <p><span data-foo="bar">Baz</span>
8212 </p>
8213 <p data-abc-def_hij="">Quuz</p>
8214
8215 !! end
8216
8217
8218 TODO:
8219 more images
8220 more tables
8221 math
8222 character entities
8223 and much more
8224 Try for 100% code coverage