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