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