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