Merge "Add MediaWikiTestCase::checkHasDiff3 and use it"
[mediawiki.git] / tests / parser / parserTests.txt
blob03a184b12436d7fe2c2a7c617574dc08362ecc88
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
5 # The syntax should be fairly self-explanatory.
7 # Currently supported test options:
8 # One of the following three:
10 #  (default)  generate HTML output
11 #  pst        apply pre-save transform
12 #  msg        apply message transform
14 # Plus any combination of these:
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
28 # For testing purposes, temporary articles can created:
29 # !!article / NAMESPACE:TITLE / !!text / ARTICLE TEXT / !!endarticle
30 # where '/' denotes a newline.
32 # This is the standard article assumed to exist.
33 !! article
34 Main Page
35 !! text
36 blah blah
37 !! endarticle
39 !!article
40 Template:Foo
41 !!text
42 FOO
43 !!endarticle
45 !! article
46 Template:Blank
47 !! text
48 !! endarticle
50 !! article
51 Template:pipe
52 !! text
54 !! endarticle
56 !!article
57 MediaWiki:bad image list
58 !!text
59 * [[File:Bad.jpg]] except [[Nasty page]]
60 !!endarticle
62 !! article
63 Template:inner list
64 !! text
65 * item 1
66 !! endarticle
68 !! article
69 Template:!
70 !! text
72 !! endarticle
74 !! article
75 Template:echo
76 !! text
77 {{{1}}}
78 !! endarticle
80 !! article
81 Template:echo_with_span
82 !! text
83 <span>{{{1}}}</span>
84 !! endarticle
86 !! article
87 Template:echo_with_div
88 !! text
89 <div>{{{1}}}</div>
90 !! endarticle
92 !! article
93 Template:attr_str
94 !! text
95 {{{1}}}="{{{2}}}"
96 !! endarticle
98 !! article
99 Template:table_attribs
100 !! text
101 <noinclude>
102 |</noinclude>style="color: red"| Foo
103 !! endarticle
105 !! article
107 !! text
108 Weirdo titles!
109 !! endarticle
112 ### Basic tests
114 !! test
115 Blank input
116 !! input
117 !! result
118 !! end
121 !! test
122 Simple paragraph
123 !! input
124 This is a simple paragraph.
125 !! result
126 <p>This is a simple paragraph.
127 </p>
128 !! end
130 !! test
131 Paragraphs with extra newline spacing
132 !! input
142 booz
143 !! result
144 <p>foo
145 </p><p>bar
146 </p><p><br />
148 </p><p><br />
149 </p><p>booz
150 </p>
151 !! end
153 !! test
154 Simple list
155 !! input
156 * Item 1
157 * Item 2
158 !! result
159 <ul><li> Item 1
160 </li><li> Item 2
161 </li></ul>
163 !! end
165 !! test
166 Italics and bold
167 !! input
168 * plain
169 * plain''italic''plain
170 * plain''italic''plain''italic''plain
171 * plain'''bold'''plain
172 * plain'''bold'''plain'''bold'''plain
173 * plain''italic''plain'''bold'''plain
174 * plain'''bold'''plain''italic''plain
175 * plain''italic'''bold-italic'''italic''plain
176 * plain'''bold''bold-italic''bold'''plain
177 * plain'''''bold-italic'''italic''plain
178 * plain'''''bold-italic''bold'''plain
179 * plain''italic'''bold-italic'''''plain
180 * plain'''bold''bold-italic'''''plain
181 * plain l'''italic''plain
182 * plain l''''bold''' plain
183 !! result
184 <ul><li> plain
185 </li><li> plain<i>italic</i>plain
186 </li><li> plain<i>italic</i>plain<i>italic</i>plain
187 </li><li> plain<b>bold</b>plain
188 </li><li> plain<b>bold</b>plain<b>bold</b>plain
189 </li><li> plain<i>italic</i>plain<b>bold</b>plain
190 </li><li> plain<b>bold</b>plain<i>italic</i>plain
191 </li><li> plain<i>italic<b>bold-italic</b>italic</i>plain
192 </li><li> plain<b>bold<i>bold-italic</i>bold</b>plain
193 </li><li> plain<i><b>bold-italic</b>italic</i>plain
194 </li><li> plain<b><i>bold-italic</i>bold</b>plain
195 </li><li> plain<i>italic<b>bold-italic</b></i>plain
196 </li><li> plain<b>bold<i>bold-italic</i></b>plain
197 </li><li> plain l'<i>italic</i>plain
198 </li><li> plain l'<b>bold</b> plain
199 </li></ul>
201 !! end
204 ### 2-quote opening sequence tests
206 !! test
207 Italics and bold: 2-quote opening sequence: (2,2)
208 !! input
209 ''foo''
210 !! result
211 <p><i>foo</i>
212 </p>
213 !!end
216 !! test
217 Italics and bold: 2-quote opening sequence: (2,3)
218 !! input
219 ''foo'''
220 !! result
221 <p><i>foo'</i>
222 </p>
223 !!end
226 !! test
227 Italics and bold: 2-quote opening sequence: (2,4)
228 !! input
229 ''foo''''
230 !! result
231 <p><i>foo''</i>
232 </p>
233 !!end
236 !! test
237 Italics and bold: 2-quote opening sequence: (2,5)
238 !! input
239 ''foo'''''
240 !! result
241 <p><i>foo</i>
242 </p>
243 !!end
247 ### 3-quote opening sequence tests
250 !! test
251 Italics and bold: 3-quote opening sequence: (3,2)
252 !! input
253 '''foo''
254 !! result
255 <p>'<i>foo</i>
256 </p>
257 !!end
260 !! test
261 Italics and bold: 3-quote opening sequence: (3,3)
262 !! input
263 '''foo'''
264 !! result
265 <p><b>foo</b>
266 </p>
267 !!end
270 !! test
271 Italics and bold: 3-quote opening sequence: (3,4)
272 !! input
273 '''foo''''
274 !! result
275 <p><b>foo'</b>
276 </p>
277 !!end
280 !! test
281 Italics and bold: 3-quote opening sequence: (3,5)
282 !! input
283 '''foo'''''
284 !! result
285 <p><b>foo</b>
286 </p>
287 !!end
291 ### 4-quote opening sequence tests
294 !! test
295 Italics and bold: 4-quote opening sequence: (4,2)
296 !! input
297 ''''foo''
298 !! result
299 <p>''<i>foo</i>
300 </p>
301 !!end
304 !! test
305 Italics and bold: 4-quote opening sequence: (4,3)
306 !! input
307 ''''foo'''
308 !! result
309 <p>'<b>foo</b>
310 </p>
311 !!end
314 !! test
315 Italics and bold: 4-quote opening sequence: (4,4)
316 !! input
317 ''''foo''''
318 !! result
319 <p>'<b>foo'</b>
320 </p>
321 !!end
324 !! test
325 Italics and bold: 4-quote opening sequence: (4,5)
326 !! input
327 ''''foo'''''
328 !! result
329 <p>'<b>foo</b>
330 </p>
331 !!end
335 ### 5-quote opening sequence tests
338 !! test
339 Italics and bold: 5-quote opening sequence: (5,2)
340 !! input
341 '''''foo''
342 !! result
343 <p><b><i>foo</i></b>
344 </p>
345 !!end
348 !! test
349 Italics and bold: 5-quote opening sequence: (5,3)
350 !! input
351 '''''foo'''
352 !! result
353 <p><i><b>foo</b></i>
354 </p>
355 !!end
358 !! test
359 Italics and bold: 5-quote opening sequence: (5,4)
360 !! input
361 '''''foo''''
362 !! result
363 <p><i><b>foo'</b></i>
364 </p>
365 !!end
368 !! test
369 Italics and bold: 5-quote opening sequence: (5,5)
370 !! input
371 '''''foo'''''
372 !! result
373 <p><i><b>foo</b></i>
374 </p>
375 !!end
378 ### multiple quote sequences in a line
380 !! test
381 Italics and bold: multiple quote sequences: (2,4,2)
382 !! input
383 ''foo''''bar''
384 !! result
385 <p><i>foo'<b>bar</b></i>
386 </p>
387 !!end
390 !! test
391 Italics and bold: multiple quote sequences: (2,4,3)
392 !! input
393 ''foo''''bar'''
394 !! result
395 <p><i>foo'<b>bar</b></i>
396 </p>
397 !!end
400 !! test
401 Italics and bold: multiple quote sequences: (2,4,4)
402 !! input
403 ''foo''''bar''''
404 !! result
405 <p><i>foo'<b>bar'</b></i>
406 </p>
407 !!end
410 !! test
411 Italics and bold: multiple quote sequences: (3,4,2)
412 !! input
413 '''foo''''bar''
414 !! result
415 <p><b>foo'</b>bar
416 </p>
417 !!end
420 !! test
421 Italics and bold: multiple quote sequences: (3,4,3)
422 !! input
423 '''foo''''bar'''
424 !! result
425 <p><b>foo'</b>bar
426 </p>
427 !!end
430 ### other quote tests
432 !! test
433 Italics and bold: other quote tests: (2,3,5)
434 !! input
435 ''this is about '''foo's family'''''
436 !! result
437 <p><i>this is about <b>foo's family</b></i>
438 </p>
439 !!end
442 !! test
443 Italics and bold: other quote tests: (2,(3,3),2)
444 !! input
445 ''this is about '''foo's''' family''
446 !! result
447 <p><i>this is about <b>foo's</b> family</i>
448 </p>
449 !!end
452 !! test
453 Italics and bold: other quote tests: (3,2,3,2)
454 !! input
455 '''this is about ''foo'''s family''
456 !! result
457 <p><b>this is about <i>foo</i></b><i>s family</i>
458 </p>
459 !!end
462 !! test
463 Italics and bold: other quote tests: (3,2,3,3)
464 !! input
465 '''this is about ''foo'''s family'''
466 !! result
467 <p>'<i>this is about </i>foo<b>s family</b>
468 </p>
469 !!end
473 !! test
474 Italics and bold: other quote tests: (3,(2,2),3)
475 !! input
476 '''this is about ''foo's'' family'''
477 !! result
478 <p><b>this is about <i>foo's</i> family</b>
479 </p>
480 !!end
483 ### <nowiki> test cases
486 !! test
487 <nowiki> unordered list
488 !! input
489 <nowiki>* This is not an unordered list item.</nowiki>
490 !! result
491 <p>* This is not an unordered list item.
492 </p>
493 !! end
495 !! test
496 <nowiki> spacing
497 !! input
498 <nowiki>Lorem ipsum dolor
500 sed abit.
501   sed nullum.
503 :and a colon
504 </nowiki>
505 !! result
506 <p>Lorem ipsum dolor
508 sed abit.
509   sed nullum.
511 :and a colon
513 </p>
514 !! end
516 !! test
517 nowiki 3
518 !! input
519 :There is not nowiki.
520 :There is <nowiki>nowiki</nowiki>.
522 #There is not nowiki.
523 #There is <nowiki>nowiki</nowiki>.
525 *There is not nowiki.
526 *There is <nowiki>nowiki</nowiki>.
527 !! result
528 <dl><dd>There is not nowiki.
529 </dd><dd>There is nowiki.
530 </dd></dl>
531 <ol><li>There is not nowiki.
532 </li><li>There is nowiki.
533 </li></ol>
534 <ul><li>There is not nowiki.
535 </li><li>There is nowiki.
536 </li></ul>
538 !! end
542 ### Comments
544 !! test
545 Comments and Pre
546 !! input
547 <!-- comment 1 --> asdf
549 <!-- comment 1 --> asdf
550 <!-- comment 2 -->
552 <!-- comment 1 --> asdf
553 <!-- comment 2 -->xyz
555 <!-- comment 1 --> asdf
556 <!-- comment 2 --> xyz
557 !! result
558 <pre>asdf
559 </pre>
560 <pre>asdf
561 </pre>
562 <pre>asdf
563 </pre>
564 <p>xyz
565 </p>
566 <pre>asdf
568 </pre>
569 !! end
571 !! test
572 Comment test 2a
573 !! input
574 asdf
575 <!-- comment 1 -->
577 !! result
578 <p>asdf
580 </p>
581 !! end
583 !! test
584 Comment test 2b
585 !! input
586 asdf
587 <!-- comment 1 -->
590 !! result
591 <p>asdf
592 </p><p>jkl
593 </p>
594 !! end
596 !! test
597 Comment test 3
598 !! input
599 asdf
600 <!-- comment 1 -->
601 <!-- comment 2 -->
603 !! result
604 <p>asdf
606 </p>
607 !! end
609 !! test
610 Comment test 4
611 !! input
612 asdf<!-- comment 1 -->jkl
613 !! result
614 <p>asdfjkl
615 </p>
616 !! end
618 !! test
619 Comment spacing
620 !! input
622  <!-- foo --> b <!-- bar -->
624 !! result
625 <p>a
626 </p>
627 <pre> b 
628 </pre>
629 <p>c
630 </p>
631 !! end
633 !! test
634 Comment whitespace
635 !! input
636 <!-- returns a single newline, not nothing, since the newline after > is not stripped -->
637 !! result
639 !! end
641 !! test
642 Comment semantics and delimiters
643 !! input
644 <!-- --><!----><!-----><!------>
645 !! result
647 !! end
649 !! test
650 Comment semantics and delimiters, redux
651 !! input
652 <!-- In SGML every "foo" here would actually show up in the text -- foo -- bar
653 -- foo -- funky huh? ... -->
654 !! result
656 !! end
658 !! test
659 Comment semantics and delimiters: directors cut
660 !! input
661 <!-- ... However we like to keep things simple and somewhat XML-ish so we eat
662 everything starting with < followed by !-- until the first -- and > we see,
663 that wouldn't be valid XML however, since in XML -- has to terminate a comment
664 -->-->
665 !! result
666 <p>--&gt;
667 </p>
668 !! end
670 !! test
671 Comment semantics: nesting
672 !! input
673 <!--<!-- no, we're not going to do anything fancy here -->-->
674 !! result
675 <p>--&gt;
676 </p>
677 !! end
679 !! test
680 Comment semantics: unclosed comment at end
681 !! input
682 <!--This comment will run out to the end of the document
683 !! result
685 !! end
687 !! test
688 Comment in template title
689 !! input
690 {{f<!---->oo}}
691 !! result
692 <p>FOO
693 </p>
694 !! end
696 !! test
697 Comment on its own line post-expand
698 !! input
700 {{blank}}<!---->
702 !! result
703 <p>a
704 </p><p>b
705 </p>
706 !! end
708 !! test
709 Comment on its own line post-expand with non-significant whitespace
710 !! input
712  {{blank}} <!----> 
714 !! result
715 <p>a
716 </p><p>b
717 </p>
718 !! end
721 ### paragraph wraping tests
723 !! test
724 No block tags
725 !! input
729 !! result
730 <p>a
731 </p><p>b
732 </p>
733 !! end
734 !! test
735 Block tag on one line
736 !! input
737 a <div>foo</div>
740 !! result
741 a <div>foo</div>
742 <p>b
743 </p>
744 !! end
746 !! test
747 Block tag on both lines
748 !! input
749 a <div>foo</div>
751 b <div>foo</div>
752 !! result
753 a <div>foo</div>
754 b <div>foo</div>
756 !! end
758 !! test
759 Multiple lines without block tags
760 !! input
761 <div>foo</div> a
764 d<!--foo--> e
765 x <div>foo</div> z
766 !! result
767 <div>foo</div> a
768 <p>b
770 d e
771 </p>
772 x <div>foo</div> z
774 !! end
777 ### Preformatted text
779 !! test
780 Preformatted text
781 !! input
782  This is some
783  Preformatted text
784  With ''italic''
785  And '''bold'''
786  And a [[Main Page|link]]
787 !! result
788 <pre>This is some
789 Preformatted text
790 With <i>italic</i>
791 And <b>bold</b>
792 And a <a href="/wiki/Main_Page" title="Main Page">link</a>
793 </pre>
794 !! end
796 !! test
797 Ident preformatting with inline content
798 !! input
800  ''b''
801 !! result
802 <pre>a
803 <i>b</i>
804 </pre>
805 !! end
807 !! test
808 <pre> with <nowiki> inside (compatibility with 1.6 and earlier)
809 !! input
810 <pre><nowiki>
812 <cite>
813 <em>
814 </nowiki></pre>
815 !! result
816 <pre>
817 &lt;b&gt;
818 &lt;cite&gt;
819 &lt;em&gt;
820 </pre>
822 !! end
824 !! test
825 Regression with preformatted in <center>
826 !! input
827 <center>
828  Blah
829 </center>
830 !! result
831 <center>
832 <pre>Blah
833 </pre>
834 </center>
836 !! end
838 # Expected output in the following test is not really expected (there should be
839 # <pre> in the output) -- it's only testing for well-formedness.
840 !! test
841 Bug 6200: Preformatted in <blockquote>
842 !! input
843 <blockquote>
844  Blah
845 </blockquote>
846 !! result
847 <blockquote>
848  Blah
849 </blockquote>
851 !! end
853 !! test
854 <pre> with attributes (bug 3202)
855 !! input
856 <pre style="background: blue; color:white">Bluescreen of WikiDeath</pre>
857 !! result
858 <pre style="background: blue; color:white">Bluescreen of WikiDeath</pre>
860 !! end
862 !! test
863 <pre> with width attribute (bug 3202)
864 !! input
865 <pre width="8">Narrow screen goodies</pre>
866 !! result
867 <pre width="8">Narrow screen goodies</pre>
869 !! end
871 !! test
872 <pre> with forbidden attribute (bug 3202)
873 !! input
874 <pre width="8" onmouseover="alert(document.cookie)">Narrow screen goodies</pre>
875 !! result
876 <pre width="8">Narrow screen goodies</pre>
878 !! end
880 !! test
881 <pre> with forbidden attribute values (bug 3202)
882 !! input
883 <pre width="8" style="border-width: expression(alert(document.cookie))">Narrow screen goodies</pre>
884 !! result
885 <pre width="8" style="/* insecure input */">Narrow screen goodies</pre>
887 !! end
889 !! test
890 <nowiki> inside <pre> (bug 13238)
891 !! input
892 <pre>
893 <nowiki>
894 </pre>
895 <pre>
896 <nowiki></nowiki>
897 </pre>
898 <pre><nowiki><nowiki></nowiki>Foo<nowiki></nowiki></nowiki></pre>
899 !! result
900 <pre>
901 &lt;nowiki&gt;
902 </pre>
903 <pre>
905 </pre>
906 <pre>&lt;nowiki&gt;Foo&lt;/nowiki&gt;</pre>
908 !! end
910 !! test
911 <nowiki> and <pre> preference (first one wins)
912 !! input
913 <pre>
914 <nowiki>
915 </pre>
916 </nowiki>
917 </pre>
919 <nowiki>
920 <pre>
921 <nowiki>
922 </pre>
923 </nowiki>
924 </pre>
926 !! result
927 <pre>
928 &lt;nowiki&gt;
929 </pre>
930 <p>&lt;/nowiki&gt;
931 &lt;/pre&gt;
932 </p><p>
933 &lt;pre&gt;
934 &lt;nowiki&gt;
935 &lt;/pre&gt;
937 &lt;/pre&gt;
938 </p>
939 !! end
941 !! test
942 </pre> inside nowiki
943 !! input
944 <nowiki></pre></nowiki>
945 !! result
946 <p>&lt;/pre&gt;
947 </p>
948 !! end
950 !!test
951 Templates: Pre: 1a. Templates that break a line should suppress <pre>
952 !!input
953  {{echo|}}
954 !!result
956 !!end
958 !!test
959 Templates: Pre: 1b. Templates that break a line should suppress <pre>
960 !!input
961  {{echo|
962 foo}}
963 !!result
964 <p>foo
965 </p>
966 !!end
968 !! test
969 Templates: Pre: 1c: Wrapping should be based on expanded content
970 !! input
971  {{echo|a
973 !!result
974 <pre>a
975 </pre>
976 <p>b
977 </p>
978 !!end
980 !! test
981 Templates: Pre: 1d: Wrapping should be based on expanded content
982 !! input
983  {{echo|a
989 !!result
990 <pre>a
991 </pre>
992 <p>b
994 </p>
995 <pre>d
996 </pre>
997 <p>e
998 </p>
999 !!end
1001 !!test
1002 Templates: Pre: 1e. Wrapping should be based on expanded content
1003 !!input
1004 {{echo| foo}}
1006 {{echo| foo}}{{echo| bar}}
1008 {{echo| foo}}
1009 {{echo| bar}}
1011 {{echo|<!--cmt--> foo}}
1013 <!--cmt-->{{echo| foo}}
1015 {{echo|{{echo| }}bar}}
1016 !!result
1017 <pre>foo
1018 </pre>
1019 <pre>foo bar
1020 </pre>
1021 <pre>foo
1023 </pre>
1024 <pre>foo
1025 </pre>
1026 <pre>foo
1027 </pre>
1028 <pre>bar
1029 </pre>
1030 !!end
1032 !! test
1033 Templates: Pre: 1f: Wrapping should be based on expanded content
1034 !! input
1035 {{echo| }}a
1037 {{echo|
1038  }}a
1040 {{echo|
1041  b}}
1043 {{echo|a
1044  }}b
1046 {{echo|a
1047 }} b
1048 !!result
1049 <pre>a
1050 </pre>
1051 <p><br />
1052 </p>
1053 <pre>a
1054 </pre>
1055 <p><br />
1056 </p>
1057 <pre>b
1058 </pre>
1059 <p>a
1060 </p>
1061 <pre>b
1062 </pre>
1063 <p>a
1064 </p>
1065 <pre>b
1066 </pre>
1067 !!end
1069 !! test
1070 Templates: Single-line variant of parameter whitespace stripping test
1071 !! input
1072 {{echo| a}}
1074 {{echo|1= a}}
1076 {{echo|{{echo| a}}}}
1078 {{echo|1={{echo| a}}}}
1079 !! result
1080 <pre>a
1081 </pre>
1082 <p>a
1083 </p>
1084 <pre>a
1085 </pre>
1086 <p>a
1087 </p>
1088 !! end
1090 !! test
1091 Templates: Strip whitespace from named parameters, but not positional ones
1092 !! input
1093 {{echo|
1094  foo}}
1096 {{echo|
1097 * foo}}
1099 {{echo| 1 =
1100  foo}}
1102 {{echo| 1 =
1103 * foo}}
1104 !! result
1105 <pre>foo
1106 </pre>
1107 <p><br />
1108 </p>
1109 <ul><li> foo
1110 </li></ul>
1111 <p>foo
1112 </p>
1113 <ul><li> foo
1114 </li></ul>
1116 !! end
1119 ### Parsoid-centric tests for testing RT edge cases for pre
1122 !!test
1123 1a. Pre and Comments
1124 !!input
1126 <!--a-->
1128 !!result
1129 <pre>a
1130 </pre>
1131 <p>c
1132 </p>
1133 !!end
1135 !!test
1136 1b. Pre and Comments
1137 !!input
1139  <!--a-->
1141 !!result
1142 <pre>a
1143 </pre>
1144 <p>c
1145 </p>
1146 !!end
1148 !!test
1149 1c. Pre and Comments
1150 !!input
1151 <!--a-->  a
1153  <!--a--> a
1154 !!result
1155 <pre> a
1156 </pre>
1157 <pre> a
1158 </pre>
1159 !!end
1161 !!test
1162 2a. Pre and tables
1163 !!input
1164  {|
1165  |-
1166  !h1!!h2
1167  |foo||bar
1168  |}
1169 !!result
1170 <table>
1172 <tr>
1173 <th>h1</th>
1174 <th>h2
1175 </th>
1176 <td>foo</td>
1177 <td>bar
1178 </td></tr></table>
1180 !!end
1182 !!test
1183 2b. Pre and tables
1184 !!input
1185   {|
1186  |-
1187 |foo
1189 !!result
1190 <table>
1192 <tr>
1193 <td>foo
1194 </td></tr></table>
1196 !!end
1198 !!test
1199 3a. Pre and block tags (single-line html)
1200 !!input
1201  <p> foo </p>
1202  <div> foo </div>
1203  <span> foo </span>
1204 !!result
1205  <p> foo </p>
1206  <div> foo </div>
1207 <pre><span> foo </span>
1208 </pre>
1209 !!end
1211 !!test
1212 3b. Pre and block tags (pre-content on separate line)
1213 !!input
1215  foo
1216 </p>
1218 <div>
1219  foo
1220 </div>
1222 <center>
1223  foo
1224 </center>
1226 <blockquote>
1227  foo
1228 </blockquote>
1230 <table><tr><td>
1231  foo
1232 </td></tr></table>
1234 <ul><li>
1235   foo
1236 </li></ul>
1238 !!result
1240  foo
1241 </p>
1242 <div>
1243 <pre>foo
1244 </pre>
1245 </div>
1246 <center>
1247 <pre>foo
1248 </pre>
1249 </center>
1250 <blockquote>
1251  foo
1252 </blockquote>
1253 <table><tr><td>
1254 <pre>foo
1255 </pre>
1256 </td></tr></table>
1257 <ul><li>
1258   foo
1259 </li></ul>
1261 !!end
1263 !!test
1264 4. Multiple spaces at start-of-line
1265 !!input
1266     <p> foo </p>
1267     foo
1268         {|
1269 |foo
1271 !!result
1272     <p> foo </p>
1273 <pre>   foo
1274 </pre>
1275 <table>
1276 <tr>
1277 <td>foo
1278 </td></tr></table>
1280 !!end
1283 ### Definition lists
1285 !! test
1286 Simple definition
1287 !! input
1288 ; name : Definition
1289 !! result
1290 <dl><dt> name&#160;</dt><dd> Definition
1291 </dd></dl>
1293 !! end
1295 !! test
1296 Definition list for indentation only
1297 !! input
1298 : Indented text
1299 !! result
1300 <dl><dd> Indented text
1301 </dd></dl>
1303 !! end
1305 !! test
1306 Definition list with no space
1307 !! input
1308 ;name:Definition
1309 !! result
1310 <dl><dt>name</dt><dd>Definition
1311 </dd></dl>
1313 !!end
1315 !! test
1316 Definition list with URL link
1317 !! input
1318 ; http://example.com/ : definition
1319 !! result
1320 <dl><dt> <a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&#160;</dt><dd> definition
1321 </dd></dl>
1323 !! end
1325 !! test
1326 Definition list with bracketed URL link
1327 !! input
1328 ;[http://www.example.com/ Example]:Something about it
1329 !! result
1330 <dl><dt><a rel="nofollow" class="external text" href="http://www.example.com/">Example</a></dt><dd>Something about it
1331 </dd></dl>
1333 !! end
1335 !! test
1336 Definition list with wikilink containing colon
1337 !! input
1338 ; [[Help:FAQ]]: The least-read page on Wikipedia
1339 !! result
1340 <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
1341 </dd></dl>
1343 !! end
1345 # At Brion's and JeLuF's insistence... :)
1346 !! test
1347 Definition list with news link containing colon
1348 !! input
1349 ;  news:alt.wikipedia.rox: This isn't even a real newsgroup!
1350 !! result
1351 <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!
1352 </dd></dl>
1354 !! end
1356 !! test
1357 Malformed definition list with colon
1358 !! input
1359 ;  news:alt.wikipedia.rox -- don't crash or enter an infinite loop
1360 !! result
1361 <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
1362 </dt></dl>
1364 !! end
1366 !! test
1367 Definition lists: colon in external link text
1368 !! input
1369 ; [http://www.wikipedia2.org/ Wikipedia : The Next Generation]: OK, I made that up
1370 !! result
1371 <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
1372 </dd></dl>
1374 !! end
1376 !! test
1377 Definition lists: colon in HTML attribute
1378 !! input
1379 ;<b style="display: inline">bold</b>
1380 !! result
1381 <dl><dt><b style="display: inline">bold</b>
1382 </dt></dl>
1384 !! end
1386 !! test
1387 Definition lists: self-closed tag
1388 !! input
1389 ;one<br/>two : two-line fun
1390 !! result
1391 <dl><dt>one<br />two&#160;</dt><dd> two-line fun
1392 </dd></dl>
1394 !! end
1396 !! test
1397 Bug 11748: Literal closing tags
1398 !! input
1399 <dl>
1400 <dt>test 1</dt>
1401 <dd>test test test test test</dd>
1402 <dt>test 2</dt>
1403 <dd>test test test test test</dd>
1404 </dl>
1405 !! result
1406 <dl>
1407 <dt>test 1</dt>
1408 <dd>test test test test test</dd>
1409 <dt>test 2</dt>
1410 <dd>test test test test test</dd>
1411 </dl>
1413 !! end
1415 !! test
1416 Definition and unordered list using wiki syntax nested in unordered list using html tags.
1417 !! input
1418 <ul><li>
1419 ; term : description
1420 * unordered
1421 </li>
1422 </ul>
1423 !! result
1424 <ul><li>
1425 <dl><dt> term&#160;</dt><dd> description
1426 </dd></dl>
1427 <ul><li> unordered
1428 </li></ul>
1429 </li>
1430 </ul>
1432 !! end
1434 !! test
1436 Definition list with empty definition and following paragraph
1437 !! input
1438 ; term:
1439 Paragraph text
1440 !! result
1441 <dl><dt> term</dt><dd>
1442 </dd></dl>
1443 <p>Paragraph text
1444 </p>
1445 !! end
1447 !! test
1448 Nested definition lists using html syntax
1449 !! input
1450 <dl><dd>
1451 <dl>
1452 <dd>Foo</dd>
1453 </dl>
1454 </dd></dl>
1455 !! result
1456 <dl><dd>
1457 <dl>
1458 <dd>Foo</dd>
1459 </dl>
1460 </dd></dl>
1462 !! end
1464 !! test
1465 Definition Lists: No nesting: Multiple dd's
1466 !! input
1470 !! result
1471 <dl><dt>x
1472 </dt><dd>a
1473 </dd><dd>b
1474 </dd></dl>
1476 !! end
1478 !! test
1479 Definition Lists: Indentation: Regular
1480 !! input
1482 ::i2
1483 :::i3
1484 !! result
1485 <dl><dd>i1
1486 <dl><dd>i2
1487 <dl><dd>i3
1488 </dd></dl>
1489 </dd></dl>
1490 </dd></dl>
1492 !! end
1494 !! test
1495 Definition Lists: Indentation: Missing 1st level
1496 !! input
1497 ::i2
1498 :::i3
1499 !! result
1500 <dl><dd><dl><dd>i2
1501 <dl><dd>i3
1502 </dd></dl>
1503 </dd></dl>
1504 </dd></dl>
1506 !! end
1508 !! test
1509 Definition Lists: Indentation: Multi-level indent
1510 !! input
1511 :::i3
1512 !! result
1513 <dl><dd><dl><dd><dl><dd>i3
1514 </dd></dl>
1515 </dd></dl>
1516 </dd></dl>
1518 !! end
1520 !! test
1521 Definition Lists: Hacky use to indent tables
1522 !! input
1523 ::{|
1524 |foo
1525 |bar
1527 this text
1528 should be left alone
1529 !! result
1530 <dl><dd><dl><dd><table>
1531 <tr>
1532 <td>foo
1533 </td>
1534 <td>bar
1535 </td></tr></table></dd></dl></dd></dl>
1536 <p>this text
1537 should be left alone
1538 </p>
1539 !! end
1540 ## The PHP parser treats : items (dd) without a corresponding ; item (dt)
1541 ## as an empty dt item.  It also ignores all but the last ";" when followed
1542 ## by ":" later on.  So, ";" are not ignored in ";;;t3" but are ignored  in
1543 ## ";;;t3 :d1".  So, PHP parser behavior is a little inconsistent wrt multiple
1544 ## ";"s.
1546 ## Ex: ";;t2 ::d2" is transformed into:
1548 ## <dl>
1549 ##   <dt>t2 </dt>
1550 ##   <dd>
1551 ##     <dl>
1552 ##       <dt></dt>
1553 ##       <dd>d2</dd>
1554 ##     </dl>
1555 ##   </dd>
1556 ## </dl>
1558 ## But, Parsoid treats "; :" as a tight atomic unit and excess ":" as plain text
1559 ## So, the same wikitext above (;;t2 ::d2) is transformed into:
1561 ## <dl>
1562 ##   <dt>
1563 ##     <dl>
1564 ##       <dt>t2 </dt>
1565 ##       <dd>:d2</dd>
1566 ##     </dl>
1567 ##    </dt>
1568 ## </dl>
1570 ## All Parsoid only definition list tests have this difference.
1572 ## See also: https://bugzilla.wikimedia.org/show_bug.cgi?id=6569
1573 ## and http://lists.wikimedia.org/pipermail/wikitext-l/2011-November/000483.html
1575 !! test
1576 Definition Lists: Nesting: Multi-level (Parsoid only)
1577 !! options
1578 disabled
1579 !! input
1580 ;t1 :d1
1581 ;;t2 ::d2
1582 ;;;t3 :::d3
1583 !! result
1584 <dl>
1585   <dt>t1 </dt>
1586   <dd>d1</dd>
1587   <dt>
1588     <dl>
1589       <dt>t2 </dt>
1590       <dd>:d2</dd>
1591       <dt>
1592         <dl>
1593           <dt>t3 </dt>
1594           <dd>::d3</dd>
1595         </dl>
1596       </dt>
1597     </dl>
1598   </dt>
1599 </dl>
1602 !! end
1605 !! test
1606 Definition Lists: Nesting: Test 2 (Parsoid only)
1607 !! options
1608 disabled
1609 !! input
1611 ::d2
1612 !! result
1613 <dl>
1614   <dt>t1</dt>
1615   <dd>
1616     <dl>
1617       <dd>d2</dd>
1618     </dl>
1619   </dd>
1620 </dl>
1622 !! end
1625 !! test
1626 Definition Lists: Nesting: Test 3 (Parsoid only)
1627 !! options
1628 disabled
1629 !! input
1630 :;t1
1631 ::::d2
1632 !! result
1633 <dl>
1634   <dd>
1635     <dl>
1636       <dt>t1</dt>
1637       <dd>
1638         <dl>
1639           <dd>
1640             <dl>
1641               <dd>d2</dd>
1642             </dl>
1643           </dd>
1644         </dl>
1645       </dd>
1646     </dl>
1647   </dd>
1648 </dl>
1650 !! end
1653 !! test
1654 Definition Lists: Nesting: Test 4
1655 !! input
1656 ::;t3
1657 :::d3
1658 !! result
1659 <dl><dd><dl><dd><dl><dt>t3
1660 </dt><dd>d3
1661 </dd></dl>
1662 </dd></dl>
1663 </dd></dl>
1665 !! end
1668 !! test
1669 Definition Lists: Mixed Lists: Test 1
1670 !! input
1671 :;* foo
1672 ::* bar
1673 :; baz
1674 !! result
1675 <dl><dd><dl><dt><ul><li> foo
1676 </li><li> bar
1677 </li></ul>
1678 </dt></dl>
1679 <dl><dt> baz
1680 </dt></dl>
1681 </dd></dl>
1683 !! end
1686 !! test
1687 Definition Lists: Mixed Lists: Test 2
1688 !! input
1689 *: d1
1690 *: d2
1691 !! result
1692 <ul><li><dl><dd> d1
1693 </dd><dd> d2
1694 </dd></dl>
1695 </li></ul>
1697 !! end
1700 !! test
1701 Definition Lists: Mixed Lists: Test 3
1702 !! input
1703 *::: d1
1704 *::: d2
1705 !! result
1706 <ul><li><dl><dd><dl><dd><dl><dd> d1
1707 </dd><dd> d2
1708 </dd></dl>
1709 </dd></dl>
1710 </dd></dl>
1711 </li></ul>
1713 !! end
1716 !! test
1717 Definition Lists: Mixed Lists: Test 4
1718 !! input
1719 *;d1 :d2
1720 *;d3 :d4
1721 !! result
1722 <ul><li><dl><dt>d1&#160;</dt><dd>d2
1723 </dd><dt>d3&#160;</dt><dd>d4
1724 </dd></dl>
1725 </li></ul>
1727 !! end
1730 !! test
1731 Definition Lists: Mixed Lists: Test 5
1732 !! input
1733 *:d1
1734 *:: d2
1735 !! result
1736 <ul><li><dl><dd>d1
1737 <dl><dd> d2
1738 </dd></dl>
1739 </dd></dl>
1740 </li></ul>
1742 !! end
1745 !! test
1746 Definition Lists: Mixed Lists: Test 6
1747 !! input
1748 #*:d1
1749 #*::: d3
1750 !! result
1751 <ol><li><ul><li><dl><dd>d1
1752 <dl><dd><dl><dd> d3
1753 </dd></dl>
1754 </dd></dl>
1755 </dd></dl>
1756 </li></ul>
1757 </li></ol>
1759 !! end
1762 !! test
1763 Definition Lists: Mixed Lists: Test 7
1764 !! input
1765 :* d1
1766 :* d2
1767 !! result
1768 <dl><dd><ul><li> d1
1769 </li><li> d2
1770 </li></ul>
1771 </dd></dl>
1773 !! end
1776 !! test
1777 Definition Lists: Mixed Lists: Test 8
1778 !! input
1779 :* d1
1780 ::* d2
1781 !! result
1782 <dl><dd><ul><li> d1
1783 </li></ul>
1784 <dl><dd><ul><li> d2
1785 </li></ul>
1786 </dd></dl>
1787 </dd></dl>
1789 !! end
1792 !! test
1793 Definition Lists: Mixed Lists: Test 9
1794 !! input
1795 *;foo :bar
1796 !! result
1797 <ul><li><dl><dt>foo&#160;</dt><dd>bar
1798 </dd></dl>
1799 </li></ul>
1801 !! end
1804 !! test
1805 Definition Lists: Mixed Lists: Test 10
1806 !! input
1807 *#;foo :bar
1808 !! result
1809 <ul><li><ol><li><dl><dt>foo&#160;</dt><dd>bar
1810 </dd></dl>
1811 </li></ol>
1812 </li></ul>
1814 !! end
1817 !! test
1818 Definition Lists: Mixed Lists: Test 11
1819 !! input
1820 *#*#;*;;foo :bar
1821 *#*#;boo :baz
1822 !! result
1823 <ul><li><ol><li><ul><li><ol><li><dl><dt>foo&#160;</dt><dd><ul><li><dl><dt><dl><dt>bar
1824 </dt></dl>
1825 </dd></dl>
1826 </li></ul>
1827 </dd></dl>
1828 <dl><dt>boo&#160;</dt><dd>baz
1829 </dd></dl>
1830 </li></ol>
1831 </li></ul>
1832 </li></ol>
1833 </li></ul>
1835 !! end
1838 !! test
1839 Definition Lists: Weird Ones: Test 1
1840 !! input
1841 *#;*::;; foo : bar (who uses this?)
1842 !! result
1843 <ul><li><ol><li><dl><dt> foo&#160;</dt><dd><ul><li><dl><dd><dl><dd><dl><dt><dl><dt> bar (who uses this?)
1844 </dt></dl>
1845 </dd></dl>
1846 </dd></dl>
1847 </dd></dl>
1848 </li></ul>
1849 </dd></dl>
1850 </li></ol>
1851 </li></ul>
1853 !! end
1856 ### External links
1858 !! test
1859 External links: non-bracketed
1860 !! input
1861 Non-bracketed: http://example.com
1862 !! result
1863 <p>Non-bracketed: <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
1864 </p>
1865 !! end
1867 !! test
1868 External links: numbered
1869 !! input
1870 Numbered: [http://example.com]
1871 Numbered: [http://example.net]
1872 Numbered: [http://example.com]
1873 !! result
1874 <p>Numbered: <a rel="nofollow" class="external autonumber" href="http://example.com">[1]</a>
1875 Numbered: <a rel="nofollow" class="external autonumber" href="http://example.net">[2]</a>
1876 Numbered: <a rel="nofollow" class="external autonumber" href="http://example.com">[3]</a>
1877 </p>
1878 !!end
1880 !! test
1881 External links: specified text
1882 !! input
1883 Specified text: [http://example.com link]
1884 !! result
1885 <p>Specified text: <a rel="nofollow" class="external text" href="http://example.com">link</a>
1886 </p>
1887 !!end
1889 !! test
1890 External links: trail
1891 !! input
1892 Linktrails should not work for external links: [http://example.com link]s
1893 !! result
1894 <p>Linktrails should not work for external links: <a rel="nofollow" class="external text" href="http://example.com">link</a>s
1895 </p>
1896 !! end
1898 !! test
1899 External links: dollar sign in URL
1900 !! input
1901 http://example.com/1$2345
1902 !! result
1903 <p><a rel="nofollow" class="external free" href="http://example.com/1$2345">http://example.com/1$2345</a>
1904 </p>
1905 !! end
1907 !! test
1908 External links: dollar sign in URL (named)
1909 !! input
1910 [http://example.com/1$2345]
1911 !! result
1912 <p><a rel="nofollow" class="external autonumber" href="http://example.com/1$2345">[1]</a>
1913 </p>
1914 !!end
1916 !! test
1917 External links: open square bracket forbidden in URL (bug 4377)
1918 !! input
1919 http://example.com/1[2345
1920 !! result
1921 <p><a rel="nofollow" class="external free" href="http://example.com/1">http://example.com/1</a>[2345
1922 </p>
1923 !! end
1925 !! test
1926 External links: open square bracket forbidden in URL (named) (bug 4377)
1927 !! input
1928 [http://example.com/1[2345]
1929 !! result
1930 <p><a rel="nofollow" class="external text" href="http://example.com/1">[2345</a>
1931 </p>
1932 !!end
1934 !! test
1935 External links: nowiki in URL link text (bug 6230)
1936 !!input
1937 [http://example.com/ <nowiki>''example site''</nowiki>]
1938 !! result
1939 <p><a rel="nofollow" class="external text" href="http://example.com/">''example site''</a>
1940 </p>
1941 !! end
1943 !! test
1944 External links: newline forbidden in text (bug 6230 regression check)
1945 !! input
1946 [http://example.com/ first
1947 second]
1948 !! result
1949 <p>[<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a> first
1950 second]
1951 </p>
1952 !!end
1954 !! test
1955 External links: Pipe char between url and text
1956 !! input
1957 [http://example.com | link]
1958 !! result
1959 <p><a rel="nofollow" class="external text" href="http://example.com">| link</a>
1960 </p>
1961 !!end
1963 !! test
1964 External links: protocol-relative URL in brackets
1965 !! input
1966 [//example.com/ Test]
1967 !! result
1968 <p><a rel="nofollow" class="external text" href="//example.com/">Test</a>
1969 </p>
1970 !! end
1972 !! test
1973 External links: protocol-relative URL in brackets without text
1974 !! input
1975 [//example.com]
1976 !! result
1977 <p><a rel="nofollow" class="external autonumber" href="//example.com">[1]</a>
1978 </p>
1979 !! end
1981 !! test
1982 External links: protocol-relative URL in free text is left alone
1983 !! input
1984 //example.com/Foo
1985 !! result
1986 <p>//example.com/Foo
1987 </p>
1988 !!end
1990 !! test
1991 External links: protocol-relative URL in the middle of a word is left alone (bug 30269)
1992 !! input
1993 foo//example.com/Foo
1994 !! result
1995 <p>foo//example.com/Foo
1996 </p>
1997 !! end
1999 !! test
2000 External image
2001 !! input
2002 External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
2003 !! result
2004 <p>External image: <img src="http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" />
2005 </p>
2006 !! end
2008 !! test
2009 External image from https
2010 !! input
2011 External image from https: https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
2012 !! result
2013 <p>External image from https: <img src="https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" />
2014 </p>
2015 !! end
2017 !! test
2018 Link to non-http image, no img tag
2019 !! input
2020 Link to non-http image, no img tag: ftp://example.com/test.jpg
2021 !! result
2022 <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>
2023 </p>
2024 !! end
2026 !! test
2027 External links: terminating separator
2028 !! input
2029 Terminating separator: http://example.com/thing,
2030 !! result
2031 <p>Terminating separator: <a rel="nofollow" class="external free" href="http://example.com/thing">http://example.com/thing</a>,
2032 </p>
2033 !! end
2035 !! test
2036 External links: intervening separator
2037 !! input
2038 Intervening separator: http://example.com/1,2,3
2039 !! result
2040 <p>Intervening separator: <a rel="nofollow" class="external free" href="http://example.com/1,2,3">http://example.com/1,2,3</a>
2041 </p>
2042 !! end
2044 !! test
2045 External links: old bug with URL in query
2046 !! input
2047 Old bug with URL in query: [http://example.com/thing?url=http://example.com link]
2048 !! result
2049 <p>Old bug with URL in query: <a rel="nofollow" class="external text" href="http://example.com/thing?url=http://example.com">link</a>
2050 </p>
2051 !! end
2053 !! test
2054 External links: old URL-in-URL bug, mixed protocols
2055 !! input
2056 And again with mixed protocols: [ftp://example.com?url=http://example.com link]
2057 !! result
2058 <p>And again with mixed protocols: <a rel="nofollow" class="external text" href="ftp://example.com?url=http://example.com">link</a>
2059 </p>
2060 !!end
2062 !! test
2063 External links: URL in text
2064 !! input
2065 URL in text: [http://example.com http://example.com]
2066 !! result
2067 <p>URL in text: <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
2068 </p>
2069 !! end
2071 !! test
2072 External links: Clickable images
2073 !! input
2074 ja-style clickable images: [http://example.com http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png]
2075 !! result
2076 <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>
2077 </p>
2078 !!end
2080 !! test
2081 External links: raw ampersand
2082 !! input
2083 Old &amp; use: http://x&y
2084 !! result
2085 <p>Old &amp; use: <a rel="nofollow" class="external free" href="http://x&amp;y">http://x&amp;y</a>
2086 </p>
2087 !! end
2089 !! test
2090 External links: encoded ampersand
2091 !! input
2092 Old &amp; use: http://x&amp;y
2093 !! result
2094 <p>Old &amp; use: <a rel="nofollow" class="external free" href="http://x&amp;y">http://x&amp;y</a>
2095 </p>
2096 !! end
2098 !! test
2099 External links: encoded equals (bug 6102)
2100 !! input
2101 http://example.com/?foo&#61;bar
2102 !! result
2103 <p><a rel="nofollow" class="external free" href="http://example.com/?foo=bar">http://example.com/?foo=bar</a>
2104 </p>
2105 !! end
2107 !! test
2108 External links: [raw ampersand]
2109 !! input
2110 Old &amp; use: [http://x&y]
2111 !! result
2112 <p>Old &amp; use: <a rel="nofollow" class="external autonumber" href="http://x&amp;y">[1]</a>
2113 </p>
2114 !! end
2116 !! test
2117 External links: [encoded ampersand]
2118 !! input
2119 Old &amp; use: [http://x&amp;y]
2120 !! result
2121 <p>Old &amp; use: <a rel="nofollow" class="external autonumber" href="http://x&amp;y">[1]</a>
2122 </p>
2123 !! end
2125 !! test
2126 External links: [encoded equals] (bug 6102)
2127 !! input
2128 [http://example.com/?foo&#61;bar]
2129 !! result
2130 <p><a rel="nofollow" class="external autonumber" href="http://example.com/?foo=bar">[1]</a>
2131 </p>
2132 !! end
2134 !! test
2135 External links: [IDN ignored character reference in hostname; strip it right off]
2136 !! input
2137 [http://e&zwnj;xample.com/]
2138 !! result
2139 <p><a rel="nofollow" class="external autonumber" href="http://example.com/">[1]</a>
2140 </p>
2141 !! end
2143 # FIXME: This test (the IDN characters in the text of a link) is an inconsistency.
2144 # Where an external link could easily circumvent the sanitization of the text of
2145 # a link like this (where an IDN-ignore character is in the URL somewhere), this
2146 # test demands a higher standard. That's a bit strange.
2148 # Example:
2150 # http://e‌xample.com -> [http://example.com|http://example.com]
2151 # [http://example.com|http://e‌xample.com] -> [http://example.com|http://e‌xample.com]
2153 # The first example is sanitized, but the second is not. Any security benefits
2154 # from this production are trivial to circumvent. Either remove this test and
2155 # let the parser(s) do their thing unaccosted, or fix the inconsistency and change
2156 # the test accordingly.
2158 # All our love,
2159 # The Parsoid team.
2160 !! test
2161 External links: IDN ignored character reference in hostname; strip it right off
2162 !! input
2163 http://e&zwnj;xample.com/
2164 !! result
2165 <p><a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>
2166 </p>
2167 !! end
2169 !! test
2170 External links: www.jpeg.org (bug 554)
2171 !! input
2172 http://www.jpeg.org
2173 !!result
2174 <p><a rel="nofollow" class="external free" href="http://www.jpeg.org">http://www.jpeg.org</a>
2175 </p>
2176 !! end
2178 !! test
2179 External links: URL within URL (original bug 2)
2180 !! input
2181 [http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp]
2182 !! result
2183 <p><a rel="nofollow" class="external autonumber" href="http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp">[1]</a>
2184 </p>
2185 !! end
2187 !! test
2188 BUG 361: URL inside bracketed URL
2189 !! input
2190 [http://www.example.com/foo http://www.example.com/bar]
2191 !! result
2192 <p><a rel="nofollow" class="external text" href="http://www.example.com/foo">http://www.example.com/bar</a>
2193 </p>
2194 !! end
2196 !! test
2197 BUG 361: URL within URL, not bracketed
2198 !! input
2199 http://www.example.com/foo?=http://www.example.com/bar
2200 !! result
2201 <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>
2202 </p>
2203 !! end
2205 !! test
2206 BUG 289: ">"-token in URL-tail
2207 !! input
2208 http://www.example.com/<hello>
2209 !! result
2210 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a>&lt;hello&gt;
2211 </p>
2212 !!end
2214 !! test
2215 BUG 289: literal ">"-token in URL-tail
2216 !! input
2217 http://www.example.com/<b>html</b>
2218 !! result
2219 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a><b>html</b>
2220 </p>
2221 !!end
2223 !! test
2224 BUG 289: ">"-token in bracketed URL
2225 !! input
2226 [http://www.example.com/<hello> stuff]
2227 !! result
2228 <p><a rel="nofollow" class="external text" href="http://www.example.com/">&lt;hello&gt; stuff</a>
2229 </p>
2230 !!end
2232 !! test
2233 BUG 289: literal ">"-token in bracketed URL
2234 !! input
2235 [http://www.example.com/<b>html</b> stuff]
2236 !! result
2237 <p><a rel="nofollow" class="external text" href="http://www.example.com/"><b>html</b> stuff</a>
2238 </p>
2239 !!end
2241 !! test
2242 BUG 289: literal double quote at end of URL
2243 !! input
2244 http://www.example.com/"hello"
2245 !! result
2246 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a>"hello"
2247 </p>
2248 !!end
2250 !! test
2251 BUG 289: literal double quote in bracketed URL
2252 !! input
2253 [http://www.example.com/"hello" stuff]
2254 !! result
2255 <p><a rel="nofollow" class="external text" href="http://www.example.com/">"hello" stuff</a>
2256 </p>
2257 !!end
2259 !! test
2260 External links: multiple legal whitespace is fine, Magnus. Don't break it please. (bug 5081)
2261 !! input
2262 [http://www.example.com  test]
2263 !! result
2264 <p><a rel="nofollow" class="external text" href="http://www.example.com">test</a>
2265 </p>
2266 !! end
2268 !! test
2269 External links: wiki links within external link (Bug 3695)
2270 !! input
2271 [http://example.com [[wikilink]] embedded in ext link]
2272 !! result
2273 <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>
2274 </p>
2275 !! end
2277 !! test
2278 BUG 787: Links with one slash after the url protocol are invalid
2279 !! input
2280 http:/example.com
2282 [http:/example.com title]
2283 !! result
2284 <p>http:/example.com
2285 </p><p>[http:/example.com title]
2286 </p>
2287 !! end
2289 !! test
2290 Bracketed external links with template-generated invalid target
2291 !! input
2292 [{{echo|http:/example.com}} title]
2293 !! result
2294 <p>[http:/example.com title]
2295 </p>
2296 !! end
2298 !! test
2299 Bug 2702: Mismatched <i>, <b> and <a> tags are invalid
2300 !! input
2301 ''[http://example.com text'']
2302 [http://example.com '''text]'''
2303 ''Something [http://example.com in italic'']
2304 ''Something [http://example.com mixed''''', even bold]'''
2305 '''''Now [http://example.com both''''']
2306 !! result
2307 <p><a rel="nofollow" class="external text" href="http://example.com"><i>text</i></a>
2308 <a rel="nofollow" class="external text" href="http://example.com"><b>text</b></a>
2309 <i>Something </i><a rel="nofollow" class="external text" href="http://example.com"><i>in italic</i></a>
2310 <i>Something </i><a rel="nofollow" class="external text" href="http://example.com"><i>mixed</i><b>, even bold</b></a>
2311 <i><b>Now </b></i><a rel="nofollow" class="external text" href="http://example.com"><i><b>both</b></i></a>
2312 </p>
2313 !! end
2316 !! test
2317 Bug 4781: %26 in URL
2318 !! input
2319 http://www.example.com/?title=AT%26T
2320 !! result
2321 <p><a rel="nofollow" class="external free" href="http://www.example.com/?title=AT%26T">http://www.example.com/?title=AT%26T</a>
2322 </p>
2323 !! end
2325 # According to http://dev.w3.org/html5/spec/Overview.html#parsing-urls a plain
2326 # % is actually legal in HTML5. Any change in output would need testing though.
2327 !! test
2328 Bug 4781, 5267: %25 in URL
2329 !! input
2330 http://www.example.com/?title=100%25_Bran
2331 !! result
2332 <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>
2333 </p>
2334 !! end
2336 !! test
2337 Bug 4781, 5267: %28, %29 in URL
2338 !! input
2339 http://www.example.com/?title=Ben-Hur_%281959_film%29
2340 !! result
2341 <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>
2342 </p>
2343 !! end
2346 !! test
2347 Bug 4781: %26 in autonumber URL
2348 !! input
2349 [http://www.example.com/?title=AT%26T]
2350 !! result
2351 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=AT%26T">[1]</a>
2352 </p>
2353 !! end
2355 !! test
2356 Bug 4781, 5267: %26 in autonumber URL
2357 !! input
2358 [http://www.example.com/?title=100%25_Bran]
2359 !! result
2360 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=100%25_Bran">[1]</a>
2361 </p>
2362 !! end
2364 !! test
2365 Bug 4781, 5267: %28, %29 in autonumber URL
2366 !! input
2367 [http://www.example.com/?title=Ben-Hur_%281959_film%29]
2368 !! result
2369 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">[1]</a>
2370 </p>
2371 !! end
2374 !! test
2375 Bug 4781: %26 in bracketed URL
2376 !! input
2377 [http://www.example.com/?title=AT%26T link]
2378 !! result
2379 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=AT%26T">link</a>
2380 </p>
2381 !! end
2383 !! test
2384 Bug 4781, 5267: %26 in bracketed URL
2385 !! input
2386 [http://www.example.com/?title=100%25_Bran link]
2387 !! result
2388 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=100%25_Bran">link</a>
2389 </p>
2390 !! end
2392 !! test
2393 Bug 4781, 5267: %28, %29 in bracketed URL
2394 !! input
2395 [http://www.example.com/?title=Ben-Hur_%281959_film%29 link]
2396 !! result
2397 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">link</a>
2398 </p>
2399 !! end
2401 !! test
2402 External link containing double-single-quotes in text '' (bug 4598 sanity check)
2403 !! input
2404 Some [http://example.com/ pretty ''italics'' and stuff]!
2405 !! result
2406 <p>Some <a rel="nofollow" class="external text" href="http://example.com/">pretty <i>italics</i> and stuff</a>!
2407 </p>
2408 !! end
2410 !! test
2411 External link containing double-single-quotes in text embedded in italics (bug 4598 sanity check)
2412 !! input
2413 ''Some [http://example.com/ pretty ''italics'' and stuff]!''
2414 !! result
2415 <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>
2416 </p>
2417 !! end
2419 !! test
2420 External link containing double-single-quotes with no space separating the url from text in italics
2421 !! input
2422 [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]].]
2423 !! result
2424 <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>
2425 </p>
2426 !! end
2428 !! test
2429 URL-encoding in URL functions (single parameter)
2430 !! input
2431 {{localurl:Some page|amp=&}}
2432 !! result
2433 <p>/index.php?title=Some_page&amp;amp=&amp;
2434 </p>
2435 !! end
2437 !! test
2438 URL-encoding in URL functions (multiple parameters)
2439 !! input
2440 {{localurl:Some page|q=?&amp=&}}
2441 !! result
2442 <p>/index.php?title=Some_page&amp;q=?&amp;amp=&amp;
2443 </p>
2444 !! end
2446 !! test
2447 Brackets in urls
2448 !! input
2449 http://example.com/index.php?foozoid%5B%5D=bar
2451 http://example.com/index.php?foozoid&#x5B;&#x5D;=bar
2452 !! result
2453 <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>
2454 </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>
2455 </p>
2456 !! end
2458 !! test
2459 IPv6 urls (bug 21261)
2460 !! options
2461 disabled
2462 !! input
2463 http://[2404:130:0:1000::187:2]/index.php
2464 !! result
2465 <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>
2466 </p>
2467 !! end
2469 !! test
2470 Non-extlinks in brackets
2471 !! input
2472 [foo]
2473 [foo bar]
2474 [foo ''bar'']
2475 [fool's] errand
2476 [fool's errand]
2477 [{{echo|foo}}]
2478 [{{echo|foo}} bar]
2479 [{{echo|foo}} ''bar'']
2480 [{{echo|foo}}l's] errand
2481 [{{echo|foo}}l's errand]
2482 !! result
2483 <p>[foo]
2484 [foo bar]
2485 [foo <i>bar</i>]
2486 [fool's] errand
2487 [fool's errand]
2488 [foo]
2489 [foo bar]
2490 [foo <i>bar</i>]
2491 [fool's] errand
2492 [fool's errand]
2493 </p>
2494 !! end
2497 ### Quotes
2500 !! test
2501 Quotes
2502 !! input
2503 Normal text. '''Bold text.''' Normal text. ''Italic text.''
2505 Normal text. '''''Bold italic text.''''' Normal text.
2506 !!result
2507 <p>Normal text. <b>Bold text.</b> Normal text. <i>Italic text.</i>
2508 </p><p>Normal text. <i><b>Bold italic text.</b></i> Normal text.
2509 </p>
2510 !! end
2513 !! test
2514 Unclosed and unmatched quotes
2515 !! input
2516 '''''Bold italic text '''with bold deactivated''' in between.'''''
2518 '''''Bold italic text ''with italic deactivated'' in between.'''''
2520 '''Bold text..
2522 ..spanning two paragraphs (should not work).'''
2524 '''Bold tag left open
2526 ''Italic tag left open
2528 Normal text.
2530 <!-- Unmatching number of opening, closing tags: -->
2531 '''This year''''s election ''should'' beat '''last year''''s.
2533 ''Tom'''s car is bigger than ''Susan'''s.
2535 Plain ''italic'''s plain
2536 !! result
2537 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
2538 </p><p><b><i>Bold italic text </i>with italic deactivated<i> in between.</i></b>
2539 </p><p><b>Bold text..</b>
2540 </p><p>..spanning two paragraphs (should not work).
2541 </p><p><b>Bold tag left open</b>
2542 </p><p><i>Italic tag left open</i>
2543 </p><p>Normal text.
2544 </p><p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
2545 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
2546 </p><p>Plain <i>italic'</i>s plain
2547 </p>
2548 !! end
2551 ### Tables
2553 ### some content taken from http://meta.wikimedia.org/wiki/MediaWiki_User%27s_Guide:_Using_tables
2556 # This should not produce <table></table> as <table><tr><td></td></tr></table>
2557 # is the bare minimun required by the spec, see:
2558 # http://www.w3.org/TR/xhtml-modularization/dtd_module_defs.html#a_module_Basic_Tables
2559 !! test
2560 A table with no data.
2561 !! input
2562 {||}
2563 !! result
2564 !! end
2566 # A table with nothing but a caption is invalid XHTML, we might want to render
2567 # this as <p>caption</p>
2568 !! test
2569 A table with nothing but a caption
2570 !! input
2572 |+ caption
2574 !! result
2575 <table>
2576 <caption> caption
2577 </caption><tr><td></td></tr></table>
2579 !! end
2581 !! test
2582 Table td-cell syntax variations
2583 !! input
2585 | foo bar foo | baz
2586 | foo bar foo || baz
2587 | style='color:red;' | baz
2588 | style='color:red;' || baz
2590 !! result
2591 <table>
2592 <tr>
2593 <td> baz
2594 </td>
2595 <td> foo bar foo </td>
2596 <td> baz
2597 </td>
2598 <td style="color:red;"> baz
2599 </td>
2600 <td> style='color:red;' </td>
2601 <td> baz
2602 </td></tr></table>
2604 !! end
2606 !! test
2607 Simple table
2608 !! input
2610 | 1 || 2
2612 | 3 || 4
2614 !! result
2615 <table>
2616 <tr>
2617 <td> 1 </td>
2618 <td> 2
2619 </td></tr>
2620 <tr>
2621 <td> 3 </td>
2622 <td> 4
2623 </td></tr></table>
2625 !! end
2627 !! test
2628 Simple table but with multiple dashes for row wikitext
2629 !! input
2631 | foo
2632 |-----
2633 | bar
2635 !! result
2636 <table>
2637 <tr>
2638 <td> foo
2639 </td></tr>
2640 <tr>
2641 <td> bar
2642 </td></tr></table>
2644 !! end
2645 !! test
2646 Multiplication table
2647 !! input
2648 {| border="1" cellpadding="2"
2649 |+Multiplication table
2651 ! &times; !! 1 !! 2 !! 3
2653 ! 1
2654 | 1 || 2 || 3
2656 ! 2
2657 | 2 || 4 || 6
2659 ! 3
2660 | 3 || 6 || 9
2662 ! 4
2663 | 4 || 8 || 12
2665 ! 5
2666 | 5 || 10 || 15
2668 !! result
2669 <table border="1" cellpadding="2">
2670 <caption>Multiplication table
2671 </caption>
2672 <tr>
2673 <th> &#215; </th>
2674 <th> 1 </th>
2675 <th> 2 </th>
2676 <th> 3
2677 </th></tr>
2678 <tr>
2679 <th> 1
2680 </th>
2681 <td> 1 </td>
2682 <td> 2 </td>
2683 <td> 3
2684 </td></tr>
2685 <tr>
2686 <th> 2
2687 </th>
2688 <td> 2 </td>
2689 <td> 4 </td>
2690 <td> 6
2691 </td></tr>
2692 <tr>
2693 <th> 3
2694 </th>
2695 <td> 3 </td>
2696 <td> 6 </td>
2697 <td> 9
2698 </td></tr>
2699 <tr>
2700 <th> 4
2701 </th>
2702 <td> 4 </td>
2703 <td> 8 </td>
2704 <td> 12
2705 </td></tr>
2706 <tr>
2707 <th> 5
2708 </th>
2709 <td> 5 </td>
2710 <td> 10 </td>
2711 <td> 15
2712 </td></tr></table>
2714 !! end
2716 !!test
2717 Allow +/- in 2nd and later cells in a row
2718 !!input
2720 | 1 || 2 || 3
2722 | 1 || +2 || -3
2724 !!result
2725 <table>
2726 <tr>
2727 <td> 1 </td>
2728 <td> 2 </td>
2729 <td> 3
2730 </td></tr>
2731 <tr>
2732 <td> 1 </td>
2733 <td> +2 </td>
2734 <td> -3
2735 </td></tr></table>
2737 !!end
2739 !! test
2740 Table rowspan
2741 !! input
2742 {| border=1
2743 | Cell 1, row 1
2744 |rowspan=2| Cell 2, row 1 (and 2)
2745 | Cell 3, row 1
2747 | Cell 1, row 2
2748 | Cell 3, row 2
2750 !! result
2751 <table border="1">
2752 <tr>
2753 <td> Cell 1, row 1
2754 </td>
2755 <td rowspan="2"> Cell 2, row 1 (and 2)
2756 </td>
2757 <td> Cell 3, row 1
2758 </td></tr>
2759 <tr>
2760 <td> Cell 1, row 2
2761 </td>
2762 <td> Cell 3, row 2
2763 </td></tr></table>
2765 !! end
2767 !! test
2768 Nested table
2769 !! input
2770 {| border=1
2771 | &alpha;
2773 {| bgcolor=#ABCDEF border=2
2774 |nested
2776 |table
2778 |the original table again
2780 !! result
2781 <table border="1">
2782 <tr>
2783 <td> &#945;
2784 </td>
2785 <td>
2786 <table bgcolor="#ABCDEF" border="2">
2787 <tr>
2788 <td>nested
2789 </td></tr>
2790 <tr>
2791 <td>table
2792 </td></tr></table>
2793 </td>
2794 <td>the original table again
2795 </td></tr></table>
2797 !! end
2799 !! test
2800 Invalid attributes in table cell (bug 1830)
2801 !! input
2803 |Cell:|broken
2805 !! result
2806 <table>
2807 <tr>
2808 <td>broken
2809 </td></tr></table>
2811 !! end
2814 !! test
2815 Table security: embedded pipes (http://lists.wikimedia.org/mailman/htdig/wikitech-l/2006-April/022293.html)
2816 !! input
2818 | |[ftp://|x||]" onmouseover="alert(document.cookie)">test
2819 !! result
2820 <table>
2821 <tr>
2822 <td>[<a rel="nofollow" class="external free" href="ftp://%7Cx">ftp://%7Cx</a></td>
2823 <td>]" onmouseover="alert(document.cookie)"&gt;test
2824 </td>
2825 </tr>
2826 </table>
2828 !! end
2831 !! test
2832 Indented table markup mixed with indented pre content (proposed in bug 6200)
2833 !! input
2834  <table>
2835  <tr>
2836  <td>
2837  Text that should be rendered preformatted
2838  </td>
2839  </tr>
2840  </table>
2841 !! result
2842  <table>
2843  <tr>
2844  <td>
2845 <pre>Text that should be rendered preformatted
2846 </pre>
2847  </td>
2848  </tr>
2849  </table>
2851 !! end
2853 !! test
2854 Template-generated table cell attributes and cell content
2855 !! input
2857 |{{table_attribs}}
2859 !! result
2860 <table>
2861 <tr>
2862 <td style="color: red"> Foo
2863 </td></tr></table>
2865 !! end
2867 !! test
2868 Table with row followed by newlines and table heading
2869 !! input
2873 ! foo
2875 !! result
2876 <table>
2879 <tr>
2880 <th> foo
2881 </th></tr></table>
2883 !! end
2885 # FIXME: Preserve the attribute properly (with an empty string as value) in
2886 # the PHP parser. Parsoid implements the behavior below.
2887 !! test
2888 Table attributes with empty value
2889 !! options
2890 disabled
2891 !! input
2893 | style=| hello
2895 !! result
2896 <table>
2897 <tr>
2898 <td style=""> hello
2899 </td></tr></table>
2901 !! end
2904 ### Internal links
2906 !! test
2907 Plain link, capitalized
2908 !! input
2909 [[Main Page]]
2910 !! result
2911 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
2912 </p>
2913 !! end
2915 !! test
2916 Plain link, uncapitalized
2917 !! input
2918 [[main Page]]
2919 !! result
2920 <p><a href="/wiki/Main_Page" title="Main Page">main Page</a>
2921 </p>
2922 !! end
2924 !! test
2925 Piped link
2926 !! input
2927 [[Main Page|The Main Page]]
2928 !! result
2929 <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
2930 </p>
2931 !! end
2933 !! test
2934 Broken link
2935 !! input
2936 [[Zigzagzogzagzig]]
2937 !! result
2938 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig</a>
2939 </p>
2940 !! end
2942 !! test
2943 Broken link with fragment
2944 !! input
2945 [[Zigzagzogzagzig#zug]]
2946 !! result
2947 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig#zug</a>
2948 </p>
2949 !! end
2951 !! test
2952 Special page link with fragment
2953 !! input
2954 [[Special:Version#anchor]]
2955 !! result
2956 <p><a href="/wiki/Special:Version#anchor" title="Special:Version">Special:Version#anchor</a>
2957 </p>
2958 !! end
2960 !! test
2961 Nonexistent special page link with fragment
2962 !! input
2963 [[Special:ThisNameWillHopefullyNeverBeUsed#anchor]]
2964 !! result
2965 <p><a href="/wiki/Special:ThisNameWillHopefullyNeverBeUsed" class="new" title="Special:ThisNameWillHopefullyNeverBeUsed (page does not exist)">Special:ThisNameWillHopefullyNeverBeUsed#anchor</a>
2966 </p>
2967 !! end
2969 !! test
2970 Link with prefix
2971 !! input
2972 xxx[[main Page]], xxx[[Main Page]], Xxx[[main Page]] XXX[[main Page]], XXX[[Main Page]]
2973 !! result
2974 <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>
2975 </p>
2976 !! end
2978 !! test
2979 Link with suffix
2980 !! input
2981 [[Main Page]]xxx, [[Main Page]]XXX, [[Main Page]]!!!
2982 !! result
2983 <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>!!!
2984 </p>
2985 !! end
2987 !! test
2988 Link with 3 brackets
2989 !! input
2990 [[[main page]]]
2991 !! result
2992 <p>[[[main page]]]
2993 </p>
2994 !! end
2996 !! test
2997 Piped link with 3 brackets
2998 !! input
2999 [[[main page|the main page]]]
3000 !! result
3001 <p>[[[main page|the main page]]]
3002 </p>
3003 !! end
3005 !! test
3006 Link with multiple pipes
3007 !! input
3008 [[Main Page|The|Main|Page]]
3009 !! result
3010 <p><a href="/wiki/Main_Page" title="Main Page">The|Main|Page</a>
3011 </p>
3012 !! end
3014 !! test
3015 Link to namespaces
3016 !! input
3017 [[Talk:Parser testing]], [[Meta:Disclaimers]]
3018 !! result
3019 <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>
3020 </p>
3021 !! end
3023 !! test
3024 Piped link to namespace
3025 !! input
3026 [[Meta:Disclaimers|The disclaimers]]
3027 !! result
3028 <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>
3029 </p>
3030 !! end
3032 !! test
3033 Link containing }
3034 !! input
3035 [[Usually caused by a typo (oops}]]
3036 !! result
3037 <p>[[Usually caused by a typo (oops}]]
3038 </p>
3039 !! end
3041 !! test
3042 Link containing % (not as a hex sequence)
3043 !! input
3044 [[7% Solution]]
3045 !! result
3046 <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>
3047 </p>
3048 !! end
3050 !! test
3051 Link containing % as a single hex sequence interpreted to char
3052 !! input
3053 [[7%25 Solution]]
3054 !! result
3055 <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>
3056 </p>
3057 !!end
3059 !! test
3060 Link containing % as a double hex sequence interpreted to hex sequence
3061 !! input
3062 [[7%2525 Solution]]
3063 !! result
3064 <p>[[7%2525 Solution]]
3065 </p>
3066 !!end
3068 !! test
3069 Link containing "#<" and "#>" % as a hex sequences- these are valid section anchors
3070 Example for such a section: == < ==
3071 !! input
3072 [[%23%3c]][[%23%3e]]
3073 !! result
3074 <p><a href="#.3C">#&lt;</a><a href="#.3E">#&gt;</a>
3075 </p>
3076 !! end
3078 !! test
3079 Link containing "<#" and ">#" as a hex sequences
3080 !! input
3081 [[%3c%23]][[%3e%23]]
3082 !! result
3083 <p>[[%3c%23]][[%3e%23]]
3084 </p>
3085 !! end
3087 !! test
3088 Link containing double-single-quotes '' (bug 4598)
3089 !! input
3090 [[Lista d''e paise d''o munno]]
3091 !! result
3092 <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>
3093 </p>
3094 !! end
3096 !! test
3097 Link containing double-single-quotes '' in text (bug 4598 sanity check)
3098 !! input
3099 Some [[Link|pretty ''italics'' and stuff]]!
3100 !! result
3101 <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>!
3102 </p>
3103 !! end
3105 !! test
3106 Link containing double-single-quotes '' in text embedded in italics (bug 4598 sanity check)
3107 !! input
3108 ''Some [[Link|pretty ''italics'' and stuff]]!
3109 !! result
3110 <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>
3111 </p>
3112 !! end
3114 !! test
3115 Link with double quotes in title part (literal) and alternate part (interpreted)
3116 !! input
3117 [[File:Denys Savchenko ''Pentecoste''.jpg]]
3119 [[''Pentecoste'']]
3121 [[''Pentecoste''|Pentecoste]]
3123 [[''Pentecoste''|''Pentecoste'']]
3124 !! result
3125 <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>
3126 </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>
3127 </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>
3128 </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>
3129 </p>
3130 !! end
3132 !! test
3133 Broken image links with HTML captions (bug 39700)
3134 !! input
3135 [[File:Nonexistent|<script></script>]]
3136 [[File:Nonexistent|100px|<script></script>]]
3137 [[File:Nonexistent|&lt;]]
3138 [[File:Nonexistent|a<i>b</i>c]]
3139 !! result
3140 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script&gt;&lt;/script&gt;</a>
3141 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script&gt;&lt;/script&gt;</a>
3142 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;</a>
3143 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">abc</a>
3144 </p>
3145 !! end
3147 !! test
3148 Plain link to URL
3149 !! input
3150 [[http://www.example.com]]
3151 !! result
3152 <p>[<a rel="nofollow" class="external autonumber" href="http://www.example.com">[1]</a>]
3153 </p>
3154 !! end
3156 !! test
3157 Plain link to URL with link text
3158 !! input
3159 [[http://www.example.com Link text]]
3160 !! result
3161 <p>[<a rel="nofollow" class="external text" href="http://www.example.com">Link text</a>]
3162 </p>
3163 !! end
3165 !! test
3166 Plain link to protocol-relative URL
3167 !! input
3168 [[//www.example.com]]
3169 !! result
3170 <p>[<a rel="nofollow" class="external autonumber" href="//www.example.com">[1]</a>]
3171 </p>
3172 !! end
3174 !! test
3175 Plain link to protocol-relative URL with link text
3176 !! input
3177 [[//www.example.com Link text]]
3178 !! result
3179 <p>[<a rel="nofollow" class="external text" href="//www.example.com">Link text</a>]
3180 </p>
3181 !! end
3183 !! test
3184 Plain link to page with question mark in title
3185 !! input
3186 [[A?b]]
3188 [[A?b|Baz]]
3189 !! result
3190 <p><a href="/wiki/A%3Fb" title="A?b">A?b</a>
3191 </p><p><a href="/wiki/A%3Fb" title="A?b">Baz</a>
3192 </p>
3193 !! end
3196 # I'm fairly sure the expected result here is wrong.
3197 # We want these to be URL links, not pseudo-pages with URLs for titles....
3198 # However the current output is also pretty screwy.
3200 # ----
3201 # I'm changing it to match the current output--it arguably makes more
3202 # sense in the light of the test above. Old expected result was:
3203 #<p>Piped link to URL: <a href="/index.php?title=Http://www.example.com&amp;action=edit" class="new">an example URL</a>
3204 #</p>
3205 # But I think this test is bordering on "garbage in, garbage out" anyway.
3206 # -- wtm
3207 !! test
3208 Piped link to URL
3209 !! input
3210 Piped link to URL: [[http://www.example.com|an example URL]]
3211 !! result
3212 <p>Piped link to URL: [<a rel="nofollow" class="external text" href="http://www.example.com%7Can">example URL</a>]
3213 </p>
3214 !! end
3216 !! test
3217 BUG 2: [[page|http://url/]] should link to page, not http://url/
3218 !! input
3219 [[Main Page|http://url/]]
3220 !! result
3221 <p><a href="/wiki/Main_Page" title="Main Page">http://url/</a>
3222 </p>
3223 !! end
3225 !! test
3226 BUG 337: Escaped self-links should be bold
3227 !! options
3228 title=[[Bug462]]
3229 !! input
3230 [[Bu&#103;462]] [[Bug462]]
3231 !! result
3232 <p><strong class="selflink">Bu&#103;462</strong> <strong class="selflink">Bug462</strong>
3233 </p>
3234 !! end
3236 !! test
3237 Self-link to section should not be bold
3238 !! options
3239 title=[[Main Page]]
3240 !! input
3241 [[Main Page#section]]
3242 !! result
3243 <p><a href="/wiki/Main_Page#section" title="Main Page">Main Page#section</a>
3244 </p>
3245 !! end
3247 !! article
3249 !! text
3250 This is 00.
3251 !! endarticle
3253 !!test
3254 Self-link to numeric title
3255 !!options
3256 title=[[0]]
3257 !!input
3258 [[0]]
3259 !!result
3260 <p><strong class="selflink">0</strong>
3261 </p>
3262 !!end
3264 !!test
3265 Link to numeric-equivalent title
3266 !!options
3267 title=[[0]]
3268 !!input
3269 [[00]]
3270 !!result
3271 <p><a href="/wiki/00" title="00">00</a>
3272 </p>
3273 !!end
3275 !! test
3276 <nowiki> inside a link
3277 !! input
3278 [[Main<nowiki> Page</nowiki>]] [[Main Page|the main page <nowiki>[it's not very good]</nowiki>]]
3279 !! result
3280 <p>[[Main Page]] <a href="/wiki/Main_Page" title="Main Page">the main page [it's not very good]</a>
3281 </p>
3282 !! end
3284 !! test
3285 Non-breaking spaces in title
3286 !! input
3287 [[&nbsp; Main &nbsp; Page &nbsp;]]
3288 !! result
3289 <p><a href="/wiki/Main_Page" title="Main Page">&#160; Main &#160; Page &#160;</a>
3290 </p>
3291 !!end
3293 !! test
3294 Internal link with ca linktrail, surrounded by bold apostrophes (bug 27473 primary issue)
3295 !! options
3296 language=ca
3297 !! input
3298 '''[[Main Page]]'''
3299 !! result
3300 <p><b><a href="/wiki/Main_Page" title="Main Page">Main Page</a></b>
3301 </p>
3302 !! end
3304 !! test
3305 Internal link with ca linktrail, surrounded by italic apostrophes (bug 27473 primary issue)
3306 !! options
3307 language=ca
3308 !! input
3309 ''[[Main Page]]''
3310 !! result
3311 <p><i><a href="/wiki/Main_Page" title="Main Page">Main Page</a></i>
3312 </p>
3313 !! end
3315 !! test
3316 Internal link with en linktrail: no apostrophes (bug 27473)
3317 !! options
3318 language=en
3319 !! input
3320 [[Something]]'nice
3321 !! result
3322 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (page does not exist)">Something</a>'nice
3323 </p>
3324 !! end
3326 !! test
3327 Internal link with ca linktrail with apostrophes (bug 27473)
3328 !! options
3329 language=ca
3330 !! input
3331 [[Something]]'nice
3332 !! result
3333 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (encara no existeix)">Something'nice</a>
3334 </p>
3335 !! end
3337 !! test
3338 Internal link with kaa linktrail with apostrophes (bug 27473)
3339 !! options
3340 language=kaa
3341 !! input
3342 [[Something]]'nice
3343 !! result
3344 <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>
3345 </p>
3346 !! end
3349 ### Interwiki links (see maintenance/interwiki.sql)
3352 !! test
3353 Inline interwiki link
3354 !! input
3355 [[MeatBall:SoftSecurity]]
3356 !! result
3357 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity</a>
3358 </p>
3359 !! end
3361 !! test
3362 Inline interwiki link with empty title (bug 2372)
3363 !! input
3364 [[MeatBall:]]
3365 !! result
3366 <p><a href="http://www.usemod.com/cgi-bin/mb.pl" class="extiw" title="meatball:">MeatBall:</a>
3367 </p>
3368 !! end
3370 !! test
3371 Interwiki link encoding conversion (bug 1636)
3372 !! input
3373 *[[Wikipedia:ro:Olteni&#0355;a]]
3374 *[[Wikipedia:ro:Olteni&#355;a]]
3375 !! result
3376 <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>
3377 </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>
3378 </li></ul>
3380 !! end
3382 !! test
3383 Interwiki link with fragment (bug 2130)
3384 !! input
3385 [[MeatBall:SoftSecurity#foo]]
3386 !! result
3387 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity#foo" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity#foo</a>
3388 </p>
3389 !! end
3391 !! test
3392 Interlanguage link
3393 !! input
3394 Blah blah blah
3395 [[zh:Chinese]]
3396 !!result
3397 <p>Blah blah blah
3398 </p>
3399 !! end
3401 !! test
3402 Double interlanguage link
3403 !! input
3404 Blah blah blah
3405 [[es:Spanish]]
3406 [[zh:Chinese]]
3407 !!result
3408 <p>Blah blah blah
3409 </p>
3410 !! end
3412 !! test
3413 Interlanguage link, with prefix links
3414 !! options
3415 language=ln
3416 !! input
3417 Blah blah blah
3418 [[zh:Chinese]]
3419 !!result
3420 <p>Blah blah blah
3421 </p>
3422 !! end
3424 !! test
3425 Double interlanguage link, with prefix links (bug 8897)
3426 !! options
3427 language=ln
3428 !! input
3429 Blah blah blah
3430 [[es:Spanish]]
3431 [[zh:Chinese]]
3432 !!result
3433 <p>Blah blah blah
3434 </p>
3435 !! end
3437 !! test
3438 Parsoid-specific test: Wikilinks with &nbsp; should RT properly
3439 !! options
3440 language=ln
3441 !! input
3442 [[WW&nbsp;II]]
3443 !!result
3444 <p><a href="/index.php?title=WW_II&amp;action=edit&amp;redlink=1" class="new" title="WW II (lonkásá  ezalí tɛ̂)">WW&#160;II</a>
3445 </p>
3446 !! end
3449 ## XHTML tidiness
3452 !! test
3453 <br> to <br />
3454 !! input
3455 1<br>2<br />3
3456 !! result
3457 <p>1<br />2<br />3
3458 </p>
3459 !! end
3461 !! test
3462 Broken br tag sanitization
3463 !! input
3464 </br>
3465 !! result
3466 <p>&lt;/br&gt;
3467 </p>
3468 !! end
3470 !! test
3471 Incorrecly removing closing slashes from correctly formed XHTML
3472 !! input
3473 <br style="clear:both;" />
3474 !! result
3475 <p><br style="clear:both;" />
3476 </p>
3477 !! end
3479 !! test
3480 Failing to transform badly formed HTML into correct XHTML
3481 !! input
3482 <br style="clear: left;">
3483 <br style="clear: right;">
3484 <br style="clear: both;">
3485 !! result
3486 <p><br style="clear: left;" />
3487 <br style="clear: right;" />
3488 <br style="clear: both;" />
3489 </p>
3490 !!end
3492 !! test
3493 Handling html with a div self-closing tag
3494 !! input
3495 <div title />
3496 <div title/>
3497 <div title/ >
3498 <div title=bar />
3499 <div title=bar/>
3500 <div title=bar/ >
3501 !! result
3502 <p>&lt;div title /&gt;
3503 &lt;div title/&gt;
3504 </p>
3505 <div>
3506 <p>&lt;div title=bar /&gt;
3507 &lt;div title=bar/&gt;
3508 </p>
3509 <div title="bar/"></div>
3510 </div>
3512 !! end
3514 !! test
3515 Handling html with a br self-closing tag
3516 !! input
3517 <br title />
3518 <br title/>
3519 <br title/ >
3520 <br title=bar />
3521 <br title=bar/>
3522 <br title=bar/ >
3523 !! result
3524 <p><br title="title" />
3525 <br title="title" />
3526 <br />
3527 <br title="bar" />
3528 <br title="bar" />
3529 <br title="bar/" />
3530 </p>
3531 !! end
3533 !! test
3534 Horizontal ruler (should it add that extra space?)
3535 !! input
3536 <hr>
3537 <hr >
3538 foo <hr
3539 > bar
3540 !! result
3541 <hr />
3542 <hr />
3543 foo <hr /> bar
3545 !! end
3547 !! test
3548 Horizontal ruler -- 4+ dashes render hr
3549 !! input
3550 ----
3551 !! result
3552 <hr />
3554 !! end
3556 !! test
3557 Horizontal ruler -- eats additional dashes on the same line
3558 !! input
3559 ---------
3560 !! result
3561 <hr />
3563 !! end
3565 !! test
3566 Horizontal ruler -- does not collaps dashes on consecutive lines
3567 !! input
3568 ----
3569 ----
3570 !! result
3571 <hr />
3572 <hr />
3574 !! end
3576 !! test
3577 Horizontal ruler -- <4 dashes render as plain text
3578 !! input
3580 !! result
3581 <p>---
3582 </p>
3583 !! end
3585 !! test
3586 Horizontal ruler -- Supports content following dashes on same line
3587 !! input
3588 ---- Foo
3589 !! result
3590 <hr /> Foo
3592 !! end
3595 ### Block-level elements
3597 !! test
3598 Common list
3599 !! input
3600 *Common list
3601 * item 2
3602 *item 3
3603 !! result
3604 <ul><li>Common list
3605 </li><li> item 2
3606 </li><li>item 3
3607 </li></ul>
3609 !! end
3611 !! test
3612 Numbered list
3613 !! input
3614 #Numbered list
3615 #item 2
3616 # item 3
3617 !! result
3618 <ol><li>Numbered list
3619 </li><li>item 2
3620 </li><li> item 3
3621 </li></ol>
3623 !! end
3625 !! test
3626 Mixed list
3627 !! input
3628 *Mixed list
3629 *# with numbers
3630 ** and bullets
3631 *# and numbers
3632 *bullets again
3633 **bullet level 2
3634 ***bullet level 3
3635 ***#Number on level 4
3636 **bullet level 2
3637 **#Number on level 3
3638 **#Number on level 3
3639 *#number level 2
3640 *Level 1
3641 *** Level 3
3642 #** Level 3, but ordered
3643 !! result
3644 <ul><li>Mixed list
3645 <ol><li> with numbers
3646 </li></ol>
3647 <ul><li> and bullets
3648 </li></ul>
3649 <ol><li> and numbers
3650 </li></ol>
3651 </li><li>bullets again
3652 <ul><li>bullet level 2
3653 <ul><li>bullet level 3
3654 <ol><li>Number on level 4
3655 </li></ol>
3656 </li></ul>
3657 </li><li>bullet level 2
3658 <ol><li>Number on level 3
3659 </li><li>Number on level 3
3660 </li></ol>
3661 </li></ul>
3662 <ol><li>number level 2
3663 </li></ol>
3664 </li><li>Level 1
3665 <ul><li><ul><li> Level 3
3666 </li></ul>
3667 </li></ul>
3668 </li></ul>
3669 <ol><li><ul><li><ul><li> Level 3, but ordered
3670 </li></ul>
3671 </li></ul>
3672 </li></ol>
3674 !! end
3676 !! test
3677 Nested lists 1
3678 !! input
3679 *foo
3680 **bar
3681 !! result
3682 <ul><li>foo
3683 <ul><li>bar
3684 </li></ul>
3685 </li></ul>
3687 !! end
3689 !! test
3690 Nested lists 2
3691 !! input
3692 **foo
3693 *bar
3694 !! result
3695 <ul><li><ul><li>foo
3696 </li></ul>
3697 </li><li>bar
3698 </li></ul>
3700 !! end
3702 !! test
3703 Nested lists 3 (first element empty)
3704 !! input
3706 **bar
3707 !! result
3708 <ul><li>
3709 <ul><li>bar
3710 </li></ul>
3711 </li></ul>
3713 !! end
3715 !! test
3716 Nested lists 4 (first element empty)
3717 !! input
3719 *bar
3720 !! result
3721 <ul><li><ul><li>
3722 </li></ul>
3723 </li><li>bar
3724 </li></ul>
3726 !! end
3728 !! test
3729 Nested lists 5 (both elements empty)
3730 !! input
3733 !! result
3734 <ul><li><ul><li>
3735 </li></ul>
3736 </li><li>
3737 </li></ul>
3739 !! end
3741 !! test
3742 Nested lists 6 (both elements empty)
3743 !! input
3746 !! result
3747 <ul><li>
3748 <ul><li>
3749 </li></ul>
3750 </li></ul>
3752 !! end
3754 !! test
3755 Nested lists 7 (skip initial nesting levels)
3756 !! input
3757 *** foo
3758 !! result
3759 <ul><li><ul><li><ul><li> foo
3760 </li></ul>
3761 </li></ul>
3762 </li></ul>
3764 !! end
3766 !! test
3767 Nested lists 8 (multiple nesting transitions)
3768 !! input
3769 * foo
3770 *** bar
3771 ** baz
3772 * boo
3773 !! result
3774 <ul><li> foo
3775 <ul><li><ul><li> bar
3776 </li></ul>
3777 </li><li> baz
3778 </li></ul>
3779 </li><li> boo
3780 </li></ul>
3782 !! end
3784 !! test
3785 1. Lists with start-of-line-transparent tokens before bullets: Comments
3786 !! input
3787 *foo
3788 *<!--cmt-->bar
3789 <!--cmt-->*baz
3790 !! result
3791 <ul><li>foo
3792 </li><li>bar
3793 </li><li>baz
3794 </li></ul>
3796 !! end
3798 !! test
3799 2. Lists with start-of-line-transparent tokens before bullets: Template close
3800 !! input
3801 *foo {{echo|bar
3802 }}*baz
3803 !! result
3804 <ul><li>foo bar
3805 </li><li>baz
3806 </li></ul>
3808 !! end
3810 !! test
3811 List items are not parsed correctly following a <pre> block (bug 785)
3812 !! input
3813 * <pre>foo</pre>
3814 * <pre>bar</pre>
3815 * zar
3816 !! result
3817 <ul><li> <pre>foo</pre>
3818 </li><li> <pre>bar</pre>
3819 </li><li> zar
3820 </li></ul>
3822 !! end
3824 !! test
3825 List items from template
3826 !! input
3828 {{inner list}}
3829 * item 2
3831 * item 0
3832 {{inner list}}
3833 * item 2
3835 * item 0
3836 * notSOL{{inner list}}
3837 * item 2
3838 !! result
3839 <ul><li> item 1
3840 </li><li> item 2
3841 </li></ul>
3842 <ul><li> item 0
3843 </li><li> item 1
3844 </li><li> item 2
3845 </li></ul>
3846 <ul><li> item 0
3847 </li><li> notSOL
3848 </li><li> item 1
3849 </li><li> item 2
3850 </li></ul>
3852 !! end
3854 !! test
3855 List interrupted by empty line or heading
3856 !! input
3857 * foo
3859 ** bar
3860 == A heading ==
3861 * Another list item
3862 !! result
3863 <ul><li> foo
3864 </li></ul>
3865 <ul><li><ul><li> bar
3866 </li></ul>
3867 </li></ul>
3868 <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>
3869 <ul><li> Another list item
3870 </li></ul>
3872 !!end
3876 ### Magic Words
3879 !! test
3880 Magic Word: {{CURRENTDAY}}
3881 !! input
3882 {{CURRENTDAY}}
3883 !! result
3884 <p>1
3885 </p>
3886 !! end
3888 !! test
3889 Magic Word: {{CURRENTDAY2}}
3890 !! input
3891 {{CURRENTDAY2}}
3892 !! result
3893 <p>01
3894 </p>
3895 !! end
3897 !! test
3898 Magic Word: {{CURRENTDAYNAME}}
3899 !! input
3900 {{CURRENTDAYNAME}}
3901 !! result
3902 <p>Thursday
3903 </p>
3904 !! end
3906 !! test
3907 Magic Word: {{CURRENTDOW}}
3908 !! input
3909 {{CURRENTDOW}}
3910 !! result
3911 <p>4
3912 </p>
3913 !! end
3915 !! test
3916 Magic Word: {{CURRENTMONTH}}
3917 !! input
3918 {{CURRENTMONTH}}
3919 !! result
3920 <p>01
3921 </p>
3922 !! end
3924 !! test
3925 Magic Word: {{CURRENTMONTHABBREV}}
3926 !! input
3927 {{CURRENTMONTHABBREV}}
3928 !! result
3929 <p>Jan
3930 </p>
3931 !! end
3933 !! test
3934 Magic Word: {{CURRENTMONTHNAME}}
3935 !! input
3936 {{CURRENTMONTHNAME}}
3937 !! result
3938 <p>January
3939 </p>
3940 !! end
3942 !! test
3943 Magic Word: {{CURRENTMONTHNAMEGEN}}
3944 !! input
3945 {{CURRENTMONTHNAMEGEN}}
3946 !! result
3947 <p>January
3948 </p>
3949 !! end
3951 !! test
3952 Magic Word: {{CURRENTTIME}}
3953 !! input
3954 {{CURRENTTIME}}
3955 !! result
3956 <p>00:02
3957 </p>
3958 !! end
3960 !! test
3961 Magic Word: {{CURRENTWEEK}} (@bug 4594)
3962 !! input
3963 {{CURRENTWEEK}}
3964 !! result
3965 <p>1
3966 </p>
3967 !! end
3969 !! test
3970 Magic Word: {{CURRENTYEAR}}
3971 !! input
3972 {{CURRENTYEAR}}
3973 !! result
3974 <p>1970
3975 </p>
3976 !! end
3978 !! test
3979 Magic Word: {{FULLPAGENAME}}
3980 !! options
3981 title=[[User:Ævar Arnfjörð Bjarmason]]
3982 !! input
3983 {{FULLPAGENAME}}
3984 !! result
3985 <p>User:Ævar Arnfjörð Bjarmason
3986 </p>
3987 !! end
3989 !! test
3990 Magic Word: {{FULLPAGENAMEE}}
3991 !! options
3992 title=[[User:Ævar Arnfjörð Bjarmason]]
3993 !! input
3994 {{FULLPAGENAMEE}}
3995 !! result
3996 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
3997 </p>
3998 !! end
4000 !! test
4001 Magic Word: {{NAMESPACE}}
4002 !! options
4003 title=[[User:Ævar Arnfjörð Bjarmason]]
4004 !! input
4005 {{NAMESPACE}}
4006 !! result
4007 <p>User
4008 </p>
4009 !! end
4011 !! test
4012 Magic Word: {{NAMESPACEE}}
4013 !! options
4014 title=[[User:Ævar Arnfjörð Bjarmason]]
4015 !! input
4016 {{NAMESPACEE}}
4017 !! result
4018 <p>User
4019 </p>
4020 !! end
4022 !! test
4023 Magic Word: {{NAMESPACENUMBER}}
4024 !! options
4025 title=[[User:Ævar Arnfjörð Bjarmason]]
4026 !! input
4027 {{NAMESPACENUMBER}}
4028 !! result
4029 <p>2
4030 </p>
4031 !! end
4033 !! test
4034 Magic Word: {{NUMBEROFFILES}}
4035 !! input
4036 {{NUMBEROFFILES}}
4037 !! result
4038 <p>2
4039 </p>
4040 !! end
4042 !! test
4043 Magic Word: {{PAGENAME}}
4044 !! options
4045 title=[[User:Ævar Arnfjörð Bjarmason]]
4046 !! input
4047 {{PAGENAME}}
4048 !! result
4049 <p>Ævar Arnfjörð Bjarmason
4050 </p>
4051 !! end
4053 !! test
4054 Magic Word: {{PAGENAME}} with metacharacters
4055 !! options
4056 title=[['foo & bar = baz']]
4057 !! input
4058 ''{{PAGENAME}}''
4059 !! result
4060 <p><i>&#39;foo &#38; bar &#61; baz&#39;</i>
4061 </p>
4062 !! end
4064 !! test
4065 Magic Word: {{PAGENAME}} with metacharacters (bug 26781)
4066 !! options
4067 title=[[*RFC 1234 http://example.com/]]
4068 !! input
4069 {{PAGENAME}}
4070 !! result
4071 <p>&#42;RFC&#32;1234 http&#58;//example.com/
4072 </p>
4073 !! end
4075 !! test
4076 Magic Word: {{PAGENAMEE}}
4077 !! options
4078 title=[[User:Ævar Arnfjörð Bjarmason]]
4079 !! input
4080 {{PAGENAMEE}}
4081 !! result
4082 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
4083 </p>
4084 !! end
4086 !! test
4087 Magic Word: {{PAGENAMEE}} with metacharacters (bug 26781)
4088 !! options
4089 title=[[*RFC 1234 http://example.com/]]
4090 !! input
4091 {{PAGENAMEE}}
4092 !! result
4093 <p>&#42;RFC_1234_http&#58;//example.com/
4094 </p>
4095 !! end
4097 !! test
4098 Magic Word: {{REVISIONID}}
4099 !! input
4100 {{REVISIONID}}
4101 !! result
4102 <p>1337
4103 </p>
4104 !! end
4106 !! test
4107 Magic Word: {{SCRIPTPATH}}
4108 !! input
4109 {{SCRIPTPATH}}
4110 !! result
4111 <p>/
4112 </p>
4113 !! end
4115 !! test
4116 Magic Word: {{SERVER}}
4117 !! input
4118 {{SERVER}}
4119 !! result
4120 <p><a rel="nofollow" class="external free" href="http://Britney-Spears">http://Britney-Spears</a>
4121 </p>
4122 !! end
4124 !! test
4125 Magic Word: {{SERVERNAME}}
4126 !! input
4127 {{SERVERNAME}}
4128 !! result
4129 <p>Britney-Spears
4130 </p>
4131 !! end
4133 !! test
4134 Magic Word: {{SITENAME}}
4135 !! input
4136 {{SITENAME}}
4137 !! result
4138 <p>MediaWiki
4139 </p>
4140 !! end
4142 !! test
4143 Namespace 1 {{ns:1}}
4144 !! input
4145 {{ns:1}}
4146 !! result
4147 <p>Talk
4148 </p>
4149 !! end
4151 !! test
4152 Namespace 1 {{ns:01}}
4153 !! input
4154 {{ns:01}}
4155 !! result
4156 <p>Talk
4157 </p>
4158 !! end
4160 !! test
4161 Namespace 0 {{ns:0}} (bug 4783)
4162 !! input
4163 {{ns:0}}
4164 !! result
4166 !! end
4168 !! test
4169 Namespace 0 {{ns:00}} (bug 4783)
4170 !! input
4171 {{ns:00}}
4172 !! result
4174 !! end
4176 !! test
4177 Namespace -1 {{ns:-1}}
4178 !! input
4179 {{ns:-1}}
4180 !! result
4181 <p>Special
4182 </p>
4183 !! end
4185 !! test
4186 Namespace User {{ns:User}}
4187 !! input
4188 {{ns:User}}
4189 !! result
4190 <p>User
4191 </p>
4192 !! end
4194 !! test
4195 Namespace User talk {{ns:User_talk}}
4196 !! input
4197 {{ns:User_talk}}
4198 !! result
4199 <p>User talk
4200 </p>
4201 !! end
4203 !! test
4204 Namespace User talk {{ns:uSeR tAlK}}
4205 !! input
4206 {{ns:uSeR tAlK}}
4207 !! result
4208 <p>User talk
4209 </p>
4210 !! end
4212 !! test
4213 Namespace File {{ns:File}}
4214 !! input
4215 {{ns:File}}
4216 !! result
4217 <p>File
4218 </p>
4219 !! end
4221 !! test
4222 Namespace File {{ns:Image}}
4223 !! input
4224 {{ns:Image}}
4225 !! result
4226 <p>File
4227 </p>
4228 !! end
4230 !! test
4231 Namespace (lang=de) Benutzer {{ns:User}}
4232 !! options
4233 language=de
4234 !! input
4235 {{ns:User}}
4236 !! result
4237 <p>Benutzer
4238 </p>
4239 !! end
4241 !! test
4242 Namespace (lang=de) Benutzer Diskussion {{ns:3}}
4243 !! options
4244 language=de
4245 !! input
4246 {{ns:3}}
4247 !! result
4248 <p>Benutzer Diskussion
4249 </p>
4250 !! end
4253 !! test
4254 Urlencode
4255 !! input
4256 {{urlencode:hi world?!}}
4257 {{urlencode:hi world?!|WIKI}}
4258 {{urlencode:hi world?!|PATH}}
4259 {{urlencode:hi world?!|QUERY}}
4260 !! result
4261 <p>hi+world%3F%21
4262 hi_world%3F!
4263 hi%20world%3F%21
4264 hi+world%3F%21
4265 </p>
4266 !! end
4269 ### Magic links
4271 !! test
4272 Magic links: internal link to RFC (bug 479)
4273 !! input
4274 [[RFC 123]]
4275 !! result
4276 <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>
4277 </p>
4278 !! end
4280 !! test
4281 Magic links: RFC (bug 479)
4282 !! input
4283 RFC 822
4284 !! result
4285 <p><a class="external mw-magiclink-rfc" href="//tools.ietf.org/html/rfc822">RFC 822</a>
4286 </p>
4287 !! end
4289 !! test
4290 Magic links: ISBN (bug 1937)
4291 !! input
4292 ISBN 0-306-40615-2
4293 !! result
4294 <p><a href="/wiki/Special:BookSources/0306406152" class="internal mw-magiclink-isbn">ISBN 0-306-40615-2</a>
4295 </p>
4296 !! end
4298 !! test
4299 Magic links: PMID incorrectly converts space to underscore
4300 !! input
4301 PMID 1234
4302 !! result
4303 <p><a class="external mw-magiclink-pmid" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a>
4304 </p>
4305 !! end
4308 ### Templates
4309 ####
4311 !! test
4312 Nonexistent template
4313 !! input
4314 {{thistemplatedoesnotexist}}
4315 !! result
4316 <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>
4317 </p>
4318 !! end
4320 !! article
4321 Template:test
4322 !! text
4323 This is a test template
4324 !! endarticle
4326 !! test
4327 Simple template
4328 !! input
4329 {{test}}
4330 !! result
4331 <p>This is a test template
4332 </p>
4333 !! end
4335 !! test
4336 Template with explicit namespace
4337 !! input
4338 {{Template:test}}
4339 !! result
4340 <p>This is a test template
4341 </p>
4342 !! end
4345 !! article
4346 Template:paramtest
4347 !! text
4348 This is a test template with parameter {{{param}}}
4349 !! endarticle
4351 !! test
4352 Template parameter
4353 !! input
4354 {{paramtest|param=foo}}
4355 !! result
4356 <p>This is a test template with parameter foo
4357 </p>
4358 !! end
4360 !! article
4361 Template:paramtestnum
4362 !! text
4363 [[{{{1}}}|{{{2}}}]]
4364 !! endarticle
4366 !! test
4367 Template unnamed parameter
4368 !! input
4369 {{paramtestnum|Main Page|the main page}}
4370 !! result
4371 <p><a href="/wiki/Main_Page" title="Main Page">the main page</a>
4372 </p>
4373 !! end
4375 !! article
4376 Template:templatesimple
4377 !! text
4378 (test)
4379 !! endarticle
4381 !! article
4382 Template:templateredirect
4383 !! text
4384 #redirect [[Template:templatesimple]]
4385 !! endarticle
4387 !! article
4388 Template:templateasargtestnum
4389 !! text
4390 {{{{{1}}}}}
4391 !! endarticle
4393 !! article
4394 Template:templateasargtest
4395 !! text
4396 {{template{{{templ}}}}}
4397 !! endarticle
4399 !! article
4400 Template:templateasargtest2
4401 !! text
4402 {{{{{templ}}}}}
4403 !! endarticle
4405 !! test
4406 Template with template name as unnamed argument
4407 !! input
4408 {{templateasargtestnum|templatesimple}}
4409 !! result
4410 <p>(test)
4411 </p>
4412 !! end
4414 !! test
4415 Template with template name as argument
4416 !! input
4417 {{templateasargtest|templ=simple}}
4418 !! result
4419 <p>(test)
4420 </p>
4421 !! end
4423 !! test
4424 Template with template name as argument (2)
4425 !! input
4426 {{templateasargtest2|templ=templatesimple}}
4427 !! result
4428 <p>(test)
4429 </p>
4430 !! end
4432 !! article
4433 Template:templateasargtestdefault
4434 !! text
4435 {{{{{templ|templatesimple}}}}}
4436 !! endarticle
4438 !! article
4439 Template:templa
4440 !! text
4441 '''templ'''
4442 !! endarticle
4444 !! test
4445 Template with default value
4446 !! input
4447 {{templateasargtestdefault}}
4448 !! result
4449 <p>(test)
4450 </p>
4451 !! end
4453 !! test
4454 Template with default value (value set)
4455 !! input
4456 {{templateasargtestdefault|templ=templa}}
4457 !! result
4458 <p><b>templ</b>
4459 </p>
4460 !! end
4462 !! test
4463 Template redirect
4464 !! input
4465 {{templateredirect}}
4466 !! result
4467 <p>(test)
4468 </p>
4469 !! end
4471 !! test
4472 Template with argument in separate line
4473 !! input
4474 {{ templateasargtest  |
4475  templ = simple }}
4476 !! result
4477 <p>(test)
4478 </p>
4479 !! end
4481 !! test
4482 Template with complex template as argument
4483 !! input
4484 {{paramtest|
4485   param ={{ templateasargtest  |
4486  templ = simple }}}}
4487 !! result
4488 <p>This is a test template with parameter (test)
4489 </p>
4490 !! end
4492 !! test
4493 Template with thumb image (with link in description)
4494 !! input
4495 {{paramtest|
4496   param =[[Image:noimage.png|thumb|[[no link|link]] [[no link|caption]]]]}}
4497 !! result
4498 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>
4500 !! end
4502 !! article
4503 Template:complextemplate
4504 !! text
4505 {{{1}}} {{paramtest|
4506   param ={{{param}}}}}
4507 !! endarticle
4509 !! test
4510 Template with complex arguments
4511 !! input
4512 {{complextemplate|
4513   param ={{ templateasargtest  |
4514  templ = simple }}|[[Template:complextemplate|link]]}}
4515 !! result
4516 <p><a href="/wiki/Template:Complextemplate" title="Template:Complextemplate">link</a> This is a test template with parameter (test)
4517 </p>
4518 !! end
4520 !! test
4521 BUG 553: link with two variables in a piped link
4522 !! input
4524 |[[{{{1}}}|{{{2}}}]]
4526 !! result
4527 <table>
4528 <tr>
4529 <td>[[{{{1}}}|{{{2}}}]]
4530 </td></tr></table>
4532 !! end
4534 !! test
4535 Magic variable as template parameter
4536 !! input
4537 {{paramtest|param={{SITENAME}}}}
4538 !! result
4539 <p>This is a test template with parameter MediaWiki
4540 </p>
4541 !! end
4543 !! article
4544 Template:linktest
4545 !! text
4546 [[{{{param}}}|link]]
4547 !! endarticle
4549 !! test
4550 Template parameter as link source
4551 !! input
4552 {{linktest|param=Main Page}}
4553 !! result
4554 <p><a href="/wiki/Main_Page" title="Main Page">link</a>
4555 </p>
4556 !! end
4558 !!test
4559 Template-generated attribute string (k='v')
4560 !!input
4561 <span {{attr_str|id|v1}}>bar</span>
4562 !!result
4563 <p><span id="v1">bar</span>
4564 </p>
4565 !!end
4567 !!article
4568 Template:paramtest2
4569 !! text
4570 including another template, {{paramtest|param={{{arg}}}}}
4571 !! endarticle
4573 !! test
4574 Template passing argument to another template
4575 !! input
4576 {{paramtest2|arg='hmm'}}
4577 !! result
4578 <p>including another template, This is a test template with parameter 'hmm'
4579 </p>
4580 !! end
4582 !! article
4583 Template:Linktest2
4584 !! text
4585 Main Page
4586 !! endarticle
4588 !! test
4589 Template as link source
4590 !! input
4591 [[{{linktest2}}]]
4592 !! result
4593 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
4594 </p>
4595 !! end
4598 !! article
4599 Template:loop1
4600 !! text
4601 {{loop2}}
4602 !! endarticle
4604 !! article
4605 Template:loop2
4606 !! text
4607 {{loop1}}
4608 !! endarticle
4610 !! test
4611 Template infinite loop
4612 !! input
4613 {{loop1}}
4614 !! result
4615 <p><span class="error">Template loop detected: <a href="/wiki/Template:Loop1" title="Template:Loop1">Template:Loop1</a></span>
4616 </p>
4617 !! end
4619 !! test
4620 Template from main namespace
4621 !! input
4622 {{:Main Page}}
4623 !! result
4624 <p>blah blah
4625 </p>
4626 !! end
4628 !! article
4629 Template:table
4630 !! text
4632 | 1 || 2
4634 | 3 || 4
4636 !! endarticle
4638 !! test
4639 BUG 529: Template with table, not included at beginning of line
4640 !! input
4641 foo {{table}}
4642 !! result
4643 <p>foo 
4644 </p>
4645 <table>
4646 <tr>
4647 <td> 1 </td>
4648 <td> 2
4649 </td></tr>
4650 <tr>
4651 <td> 3 </td>
4652 <td> 4
4653 </td></tr></table>
4655 !! end
4657 !! test
4658 BUG 523: Template shouldn't eat newline (or add an extra one before table)
4659 !! input
4661 {{table}}
4662 !! result
4663 <p>foo
4664 </p>
4665 <table>
4666 <tr>
4667 <td> 1 </td>
4668 <td> 2
4669 </td></tr>
4670 <tr>
4671 <td> 3 </td>
4672 <td> 4
4673 </td></tr></table>
4675 !! end
4677 !! test
4678 BUG 41: Template parameters shown as broken links
4679 !! input
4680 {{{parameter}}}
4681 !! result
4682 <p>{{{parameter}}}
4683 </p>
4684 !! end
4686 !! test
4687 Template with targets containing wikilinks
4688 !! input
4689 {{[[foo]]}}
4691 {{[[{{echo|foo}}]]}}
4693 {{{{echo|[[foo}}]]}}
4694 !! result
4695 <p>{{<a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">foo</a>}}
4696 </p><p>{{<a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">foo</a>}}
4697 </p><p>{{[[foo}}]]
4698 </p>
4699 !! end
4701 !! article
4702 Template:MSGNW test
4703 !! text
4704 ''None'' of '''this''' should be 
4705 * interpreted
4706  but rather passed unmodified
4707 {{test}}
4708 !! endarticle
4710 # hmm, fix this or just deprecate msgnw and document its behavior?
4711 !! test
4712 msgnw keyword
4713 !! options
4714 disabled
4715 !! input
4716 {{msgnw:MSGNW test}}
4717 !! result
4718 <p>''None'' of '''this''' should be 
4719 * interpreted
4720  but rather passed unmodified
4721 {{test}}
4722 </p>
4723 !! end
4725 !! test
4726 int keyword
4727 !! input
4728 {{int:youhavenewmessages|lots of money|not!}}
4729 !! result
4730 <p>You have lots of money (not!).
4731 </p>
4732 !! end
4734 !! article
4735 Template:Includes
4736 !! text
4737 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
4738 !! endarticle
4740 !! test
4741 <includeonly> and <noinclude> being included
4742 !! input
4743 {{Includes}}
4744 !! result
4745 <p>Foobar
4746 </p>
4747 !! end
4749 !! article
4750 Template:Includes2
4751 !! text
4752 <onlyinclude>Foo</onlyinclude>bar
4753 !! endarticle
4755 !! test
4756 <onlyinclude> being included
4757 !! input
4758 {{Includes2}}
4759 !! result
4760 <p>Foo
4761 </p>
4762 !! end
4765 !! article
4766 Template:Includes3
4767 !! text
4768 <onlyinclude>Foo</onlyinclude>bar<includeonly>zar</includeonly>
4769 !! endarticle
4771 !! test
4772 <onlyinclude> and <includeonly> being included
4773 !! input
4774 {{Includes3}}
4775 !! result
4776 <p>Foo
4777 </p>
4778 !! end
4780 !! test
4781 <includeonly> and <noinclude> on a page
4782 !! input
4783 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
4784 !! result
4785 <p>Foozar
4786 </p>
4787 !! end
4789 !! test
4790 Un-closed <noinclude>
4791 !! input
4792 <noinclude>
4793 !! result
4794 !! end
4796 !! test
4797 <onlyinclude> on a page
4798 !! input
4799 <onlyinclude>Foo</onlyinclude>bar
4800 !! result
4801 <p>Foobar
4802 </p>
4803 !! end
4805 !! test
4806 Un-closed <onlyinclude>
4807 !! input
4808 <onlyinclude>
4809 !! result
4810 !! end
4812 !! article
4813 Template:Includeonly section
4814 !! text
4815 <includeonly>
4816 ==Includeonly section==
4817 </includeonly>
4818 ==Section T-1==
4819 !!endarticle
4821 !! test
4822 Bug 6563: Edit link generation for section shown by <includeonly>
4823 !! input
4824 {{includeonly section}}
4825 !! result
4826 <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>
4827 <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>
4829 !! end
4831 # Uses same input as the contents of [[Template:Includeonly section]]
4832 !! test
4833 Bug 6563: Section extraction for section shown by <includeonly>
4834 !! options
4835 section=T-2
4836 !! input
4837 <includeonly>
4838 ==Includeonly section==
4839 </includeonly>
4840 ==Section T-2==
4841 !! result
4842 ==Section T-2==
4843 !! end
4845 !! test
4846 Bug 6563: Edit link generation for section suppressed by <includeonly>
4847 !! input
4848 <includeonly>
4849 ==Includeonly section==
4850 </includeonly>
4851 ==Section 1==
4852 !! result
4853 <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>
4855 !! end
4857 !! test
4858 Bug 6563: Section extraction for section suppressed by <includeonly>
4859 !! options
4860 section=1
4861 !! input
4862 <includeonly>
4863 ==Includeonly section==
4864 </includeonly>
4865 ==Section 1==
4866 !! result
4867 ==Section 1==
4868 !! end
4870 !! test
4871 Un-closed <includeonly>
4872 !! input
4873 <includeonly>
4874 !! result
4875 !! end
4878 ### <includeonly> and <noinclude> in attributes
4880 !!test
4881 0. includeonly around the entire attribute
4882 !!input
4883 <span <includeonly>id="v1"</includeonly><noinclude>id="v2"</noinclude>>bar</span>
4884 !!result
4885 <p><span id="v2">bar</span>
4886 </p>
4887 !!end
4889 !!test
4890 1. includeonly in html attr key
4891 !!input
4892 <span <noinclude>id</noinclude><includeonly>about</includeonly>="foo">bar</span>
4893 !!result
4894 <p><span id="foo">bar</span>
4895 </p>
4896 !!end
4898 !!test
4899 2. includeonly in html attr value
4900 !!input
4901 <span id="<noinclude>v1</noinclude><includeonly>v2</includeonly>">bar</span>
4902 <span id=<noinclude>"v1"</noinclude><includeonly>"v2"</includeonly>>bar</span>
4903 !!result
4904 <p><span id="v1">bar</span>
4905 <span id="v1">bar</span>
4906 </p>
4907 !!end
4909 !!test
4910 3. includeonly in part of an attr value
4911 !!input
4912 <span style="color:<noinclude>red</noinclude><includeonly>blue</includeonly>;">bar</span>
4913 !!result
4914 <p><span style="color:red;">bar</span>
4915 </p>
4916 !!end
4919 ### Testing parsing of templates where a template arg
4920 ### has the same name as the template itself.
4923 !! article
4924 Template:quote
4925 !! text
4926 {{{quote|{{{1}}}}}}
4927 !! endarticle
4929 !!test
4930 Templates: Template Name/Arg clash: 1. Use of positional param
4931 !!input
4932 {{quote|foo}}
4933 !!result
4934 <p>foo
4935 </p>
4936 !!end
4938 !!test
4939 Templates: Template Name/Arg clash: 2. Use of named param
4940 !!input
4941 {{quote|quote=foo}}
4942 !!result
4943 <p>foo
4944 </p>
4945 !!end
4947 !!test
4948 Templates: Template Name/Arg clash: 3. Use of named param with empty input
4949 !!input
4950 {{quote|quote}}
4951 !!result
4952 <p>quote
4953 </p>
4954 !!end
4957 ### Parsoid-centric tests to stress Parsoid's ability to RT them unchanged
4960 !!test
4961 Templates: 1. Simple use
4962 !!input
4963 {{echo|Foo}}
4964 !!result
4965 <p>Foo
4966 </p>
4967 !!end
4969 !!test
4970 Templates: 2. Inside a block tag
4971 !!input
4972 <div>{{echo|Foo}}</div>
4973 !!result
4974 <div>Foo</div>
4976 !!end
4978 !!test
4979 Templates: P-wrapping: 1a. Templates on consecutive lines
4980 !!input
4981 {{echo|Foo}}
4982 {{echo|bar}}
4983 !!result
4984 <p>Foo
4986 </p>
4987 !!end
4989 !!test
4990 Templates: P-wrapping: 1b. Templates on consecutive lines
4991 !!input
4994 {{echo|bar}}
4995 {{echo|baz}}
4996 !!result
4997 <p>Foo
4998 </p><p>bar
5000 </p>
5001 !!end
5003 !!test
5004 Templates: P-wrapping: 1c. Templates on consecutive lines
5005 !!input
5006 {{echo|Foo}}
5007 {{echo|bar}} <div>baz</div>
5008 !!result
5009 <p>Foo
5010 </p>
5011 bar <div>baz</div>
5013 !!end
5015 !!test
5016 Templates: Inline Text: 1. Multiple tmeplate uses
5017 !!input
5018 {{echo|Foo}}bar{{echo|baz}}
5019 !!result
5020 <p>Foobarbaz
5021 </p>
5022 !!end
5024 !!test
5025 Templates: Inline Text: 2. Back-to-back template uses
5026 !!input
5027 {{echo|Foo}}{{echo|bar}}
5028 !!result
5029 <p>Foobar
5030 </p>
5031 !!end
5033 !!test
5034 Templates: Block Tags: 1. Multiple template uses
5035 !!input
5036 {{echo|<div>Foo</div>}}<div>bar</div>{{echo|<div>baz</div>}}
5037 !!result
5038 <div>Foo</div><div>bar</div><div>baz</div>
5040 !!end
5042 !!test
5043 Templates: Block Tags: 2. Back-to-back template uses
5044 !!input
5045 {{echo|<div>Foo</div>}}{{echo|<div>bar</div>}}
5046 !!result
5047 <div>Foo</div><div>bar</div>
5049 !!end
5051 !!test
5052 Templates: Links: 1. Simple example
5053 !!input
5054 {{echo|[[Foo|bar]]}}
5055 !!result
5056 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
5057 </p>
5058 !!end
5060 !!test
5061 Templates: Links: 2. Generation of link href
5062 !!input
5063 [[{{echo|Foo}}|bar]]
5064 !!result
5065 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
5066 </p>
5067 !!end
5069 !!test
5070 Templates: Links: 3. Generation of part of a link href
5071 !!input
5072 [[Fo{{echo|o}}|bar]]
5073 !!result
5074 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
5075 </p>
5076 !!end
5078 !!test
5079 Templates: Links: 4. Multiple templates generating link href
5080 !!input
5081 [[{{echo|F}}{{echo|o}}ob{{echo|ar}}]]
5082 !!result
5083 <p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
5084 </p>
5085 !!end
5087 !!test
5088 Templates: Links: 5. Generation of link text
5089 !!input
5090 [[Foo|{{echo|bar}}]]
5091 !!result
5092 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
5093 </p>
5094 !!end
5096 !!test
5097 Templates: Links: 5. Nested templates (only outermost template should be marked)
5098 !!input
5099 {{echo|[[{{echo|Foo}}|bar]]}}
5100 !!result
5101 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
5102 </p>
5103 !!end
5105 !!test
5106 Templates: HTML Tag: 1. Generation of HTML attr. key
5107 !!input
5108 <div {{echo|style}}="color:red;">foo</div>
5109 !!result
5110 <div style="color:red;">foo</div>
5112 !!end
5114 !!test
5115 Templates: HTML Tag: 2. Generation of HTML attr. value
5116 !!input
5117 <div style={{echo|'color:red;'}}>foo</div>
5118 !!result
5119 <div style="color:red;">foo</div>
5121 !!end
5123 !!test
5124 Templates: HTML Tag: 3. Generation of HTML attr key and value
5125 !!input
5126 <div {{echo|style}}={{echo|'color:red;'}}>foo</div>
5127 !!result
5128 <div style="color:red;">foo</div>
5130 !!end
5132 !!test
5133 Templates: HTML Tag: 4. Generation of starting piece of HTML attr value
5134 !!input
5135 <div title="{{echo|This is a long title}} with just one piece templated">foo</div>
5136 !!result
5137 <div title="This is a long title with just one piece templated">foo</div>
5139 !!end
5141 !!test
5142 Templates: HTML Tag: 5. Generation of middle piece of HTML attr value
5143 !!input
5144 <div title="This is a long title with just {{echo|one piece}} templated">foo</div>
5145 !!result
5146 <div title="This is a long title with just one piece templated">foo</div>
5148 !!end
5150 !!test
5151 Templates: HTML Tag: 6. Generation of end piece of HTML attr value
5152 !!input
5153 <div title="This is a long title with just one piece {{echo|templated}}">foo</div>
5154 !!result
5155 <div title="This is a long title with just one piece templated">foo</div>
5157 !!end
5159 !!test
5160 Templates: HTML Tables: 1. Generating start of a HTML table
5161 !!input
5162 {{echo|<table><tr><td>foo</td>}}</tr></table>
5163 !!result
5164 <table><tr><td>foo</td></tr></table>
5166 !!end
5168 !!test
5169 Templates: HTML Tables: 2a. Generating middle of a HTML table
5170 !!input
5171 <table><tr>{{echo|<td>foo</td>}}</tr></table>
5172 !!result
5173 <table><tr><td>foo</td></tr></table>
5175 !!end
5177 !!test
5178 Templates: HTML Tables: 2b. Generating middle of a HTML table
5179 !!input
5180 <table>{{echo|<tr><td>foo</td></tr>}}</table>
5181 !!result
5182 <table><tr><td>foo</td></tr></table>
5184 !!end
5186 !!test
5187 Templates: HTML Tables: 3. Generating end of a HTML table
5188 !!input
5189 <table><tr>{{echo|<td>foo</td></tr></table>}}
5190 !!result
5191 <table><tr><td>foo</td></tr></table>
5193 !!end
5195 !!test
5196 Templates: HTML Tables: 4a. Generating a single tag of a HTML table
5197 !!input
5198 {{echo|<table>}}<tr><td>foo</td></tr></table>
5199 !!result
5200 <table><tr><td>foo</td></tr></table>
5202 !!end
5204 !!test
5205 Templates: HTML Tables: 4b. Generating a single tag of a HTML table
5206 !!input
5207 <table>{{echo|<tr>}}<td>foo</td></tr></table>
5208 !!result
5209 <table><tr><td>foo</td></tr></table>
5211 !!end
5213 !!test
5214 Templates: HTML Tables: 4c. Generating a single tag of a HTML table
5215 !!input
5216 <table><tr>{{echo|<td>}}foo</td></tr></table>
5217 !!result
5218 <table><tr><td>foo</td></tr></table>
5220 !!end
5222 !!test
5223 Templates: HTML Tables: 4d. Generating a single tag of a HTML table
5224 !!input
5225 <table><tr><td>foo{{echo|</td>}}</tr></table>
5226 !!result
5227 <table><tr><td>foo</td></tr></table>
5229 !!end
5231 !!test
5232 Templates: HTML Tables: 4e. Generating a single tag of a HTML table
5233 !!input
5234 <table><tr><td>foo</td>{{echo|</tr>}}</table>
5235 !!result
5236 <table><tr><td>foo</td></tr></table>
5238 !!end
5240 !!test
5241 Templates: HTML Tables: 4f. Generating a single tag of a HTML table
5242 !!input
5243 <table><tr><td>foo</td></tr>{{echo|</table>}}
5244 !!result
5245 <table><tr><td>foo</td></tr></table>
5247 !!end
5249 !!test
5250 Templates: Wiki Tables: 1. Fostering of entire template content
5251 !!input
5253 {{echo|a}}
5255 !!result
5256 <table>
5258 <tr><td></td></tr></table>
5260 !!end
5262 !!test
5263 Templates: Wiki Tables: 2. Fostering of partial template content
5264 !!input
5266 {{echo|a
5267 <div>b</div>}}
5269 !!result
5270 <table>
5272 <div>b</div>
5273 <tr><td></td></tr></table>
5275 !!end
5277 !!test
5278 Templates: Wiki Tables: 3. td-content via multiple templates
5279 !!input
5281 {{echo|{{pipe}}a}}{{echo|b}}
5283 !!result
5284 <table>
5285 <tr>
5286 <td>ab
5287 </td></tr></table>
5289 !!end
5291 !!test
5292 Templates: Lists: Multi-line list-items via templates
5293 !!input
5294 *{{echo|a {{nonexistent|
5295 unused}}}}
5296 *{{echo|b {{nonexistent|
5297 unused}}}}
5298 !!result
5299 <ul><li>a <a href="/index.php?title=Template:Nonexistent&amp;action=edit&amp;redlink=1" class="new" title="Template:Nonexistent (page does not exist)">Template:Nonexistent</a>
5300 </li><li>b <a href="/index.php?title=Template:Nonexistent&amp;action=edit&amp;redlink=1" class="new" title="Template:Nonexistent (page does not exist)">Template:Nonexistent</a>
5301 </li></ul>
5303 !!end
5305 !!test
5306 Templates: Ugly nesting: 1. Quotes opened/closed across templates (echo)
5307 !!input
5308 {{echo|''a}}{{echo|b''c''d}}{{echo|''e}}
5309 !!result
5310 <p><i>ab</i>c<i>d</i>e
5311 </p>
5312 !!end
5314 !!test
5315 Templates: Ugly nesting: 2. Quotes opened/closed across templates (echo_with_span)
5316 (PHP parser generates misnested html)
5317 !! options
5318 disabled
5319 !!input
5320 {{echo_with_span|''a}}{{echo_with_span|b''c''d}}{{echo_with_span|''e}}
5321 !!result
5322 <p><span><i>a</i></span><i><span>b</span></i><span>c</span><i>d</i><span>e</span></p>
5323 !!end
5325 !!test
5326 Templates: Ugly nesting: 3. Quotes opened/closed across templates (echo_with_div)
5327 (PHP parser generates misnested html)
5328 !! options
5329 disabled
5330 !!input
5331 {{echo_with_div|''a}}{{echo_with_div|b''c''d}}{{echo_with_div|''e}}
5332 !!result
5333 <div><i>a</i></div>
5334 <div><i>b</i>c<i>d</i></div>
5335 <div>e</div>
5336 !!end
5338 !!test
5339 Templates: Ugly nesting: 4. Divs opened/closed across templates
5340 !!input
5341 a<div>b{{echo|c</div>d}}e
5342 !!result
5343 a<div>bc</div>de
5345 !!end
5347 !!test
5348 Templates: Ugly templates: 1. Navbox template parses badly leading to table misnesting
5349 (Parsoid-centric)
5350 !! options
5351 disabled
5352 !!input
5354 |{{echo|foo</table>}}
5355 |bar
5357 !!result
5358 <table data-parsoid="{&quot;src&quot;:&quot;{|\n|{{echo|foo&lt;/table&gt;}}\n|bar\n|}&quot;}" about="#mwt1" typeof="mw:Object/Template ">
5359 <tbody><tr><td>foo</td></tr></tbody></table><span about="#mwt1">
5360 bar</span><span about="#mwt1">
5361 </span>
5362 !!end
5364 !!test
5365 Templates: Ugly templates: 2. Navbox template parses badly leading to table misnesting
5366 (Parsoid-centric)
5367 !! options
5368 disabled
5369 !!input
5370 <table>
5371   <tr>
5372     <td>
5373     <table>
5374       <tr>
5375         <td>1. {{echo|foo </table>}}</td>
5376         <td> bar </td>
5377         <td>2. {{echo|baz </table>}}</td>
5378       </tr>
5379       <tr>
5380         <td>abc</td>
5381       </tr>
5382     </table>
5383     </td>
5384   </tr>
5385   <tr>
5386     <td>xyz</td>
5387   </tr>
5388 </table>
5389 !!result
5390 <table data-parsoid="{&quot;src&quot;:&quot;&lt;table&gt;\n  &lt;tr&gt;\n    &lt;td&gt;\n    &lt;table&gt;\n      &lt;tr&gt;\n        &lt;td&gt;1. {{echo|foo &lt;/table&gt;}}&lt;/td&gt;\n        &lt;td&gt; bar &lt;/td&gt;\n        &lt;td&gt;2. {{echo|baz &lt;/table&gt;}}&lt;/td&gt;\n      &lt;/tr&gt;\n      &lt;tr&gt;\n        &lt;td&gt;abc&lt;/td&gt;\n      &lt;/tr&gt;\n    &lt;/table&gt;\n    &lt;/td&gt;\n  &lt;/tr&gt;\n  &lt;tr&gt;\n    &lt;td&gt;xyz&lt;/td&gt;\n  &lt;/tr&gt;\n&lt;/table&gt;&quot;}" about="#mwt1" typeof="mw:Object/Template">
5391   <tbody><tr data-parsoid="{&quot;stx&quot;:&quot;html&quot;}">
5392     <td data-parsoid="{&quot;stx&quot;:&quot;html&quot;}">
5393     <table data-parsoid="{&quot;stx&quot;:&quot;html&quot;}">
5394       <tbody><tr data-parsoid="{&quot;stx&quot;:&quot;html&quot;}">
5395         <td data-parsoid="{&quot;stx&quot;:&quot;html&quot;}">1. foo </td></tr></tbody></table></td>
5396         <td data-parsoid="{&quot;stx&quot;:&quot;html&quot;}"> bar </td>
5397         <td data-parsoid="{&quot;stx&quot;:&quot;html&quot;}">2. baz </td></tr></tbody></table><span about="#mwt1">
5398       </span><span about="#mwt1">
5399       
5400         abc</span><span about="#mwt1">
5401       </span><span about="#mwt1">
5402     </span><span about="#mwt1">
5403     </span><span about="#mwt1">
5404   </span><span about="#mwt1">
5405   
5406     xyz</span><span about="#mwt1">
5407   </span><span about="#mwt1">
5408 </span>
5409 !!end
5411 !!test
5412 Parser Functions: 1. Simple example
5413 !!input
5414 {{uc:foo}}
5415 !!result
5416 <p>FOO
5417 </p>
5418 !!end
5420 !!test
5421 Parser Functions: 2. Nested use (only outermost should be marked up)
5422 !!input
5423 {{uc:{{lc:FOO}}}}
5424 !!result
5425 <p>FOO
5426 </p>
5427 !!end
5430 ### Pre-save transform tests
5432 !! test
5433 pre-save transform: subst:
5434 !! options
5436 !! input
5437 {{subst:test}}
5438 !! result
5439 This is a test template
5440 !! end
5442 !! test
5443 pre-save transform: normal template
5444 !! options
5446 !! input
5447 {{test}}
5448 !! result
5449 {{test}}
5450 !! end
5452 !! test
5453 pre-save transform: nonexistent template
5454 !! options
5456 !! input
5457 {{thistemplatedoesnotexist}}
5458 !! result
5459 {{thistemplatedoesnotexist}}
5460 !! end
5463 !! test
5464 pre-save transform: subst magic variables
5465 !! options
5467 !! input
5468 {{subst:SITENAME}}
5469 !! result
5470 MediaWiki
5471 !! end
5473 # This is bug 89, which I fixed. -- wtm
5474 !! test
5475 pre-save transform: subst: templates with parameters
5476 !! options
5478 !! input
5479 {{subst:paramtest|param="something else"}}
5480 !! result
5481 This is a test template with parameter "something else"
5482 !! end
5484 !! article
5485 Template:nowikitest
5486 !! text
5487 <nowiki>'''not wiki'''</nowiki>
5488 !! endarticle
5490 !! test
5491 pre-save transform: nowiki in subst (bug 1188)
5492 !! options
5494 !! input
5495 {{subst:nowikitest}}
5496 !! result
5497 <nowiki>'''not wiki'''</nowiki>
5498 !! end
5501 !! article
5502 Template:commenttest
5503 !! text
5504 This template has <!-- a comment --> in it.
5505 !! endarticle
5507 !! test
5508 pre-save transform: comment in subst (bug 1936)
5509 !! options
5511 !! input
5512 {{subst:commenttest}}
5513 !! result
5514 This template has <!-- a comment --> in it.
5515 !! end
5517 !! test
5518 pre-save transform: unclosed tag
5519 !! options
5520 pst noxml
5521 !! input
5522 <nowiki>'''not wiki'''
5523 !! result
5524 <nowiki>'''not wiki'''
5525 !! end
5527 !! test
5528 pre-save transform: mixed tag case
5529 !! options
5530 pst noxml
5531 !! input
5532 <NOwiki>'''not wiki'''</noWIKI>
5533 !! result
5534 <NOwiki>'''not wiki'''</noWIKI>
5535 !! end
5537 !! test
5538 pre-save transform: unclosed comment in <nowiki>
5539 !! options
5540 pst noxml
5541 !! input
5542 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
5543 !! result
5544 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
5545 !!end
5547 !! article
5548 Template:dangerous
5549 !!text
5550 <span onmouseover="alert('crap')">Oh no</span>
5551 !!endarticle
5553 !!test
5554 (confirming safety of fix for subst bug 1936)
5555 !! input
5556 {{Template:dangerous}}
5557 !! result
5558 <p><span>Oh no</span>
5559 </p>
5560 !! end
5562 !! test
5563 pre-save transform: comment containing gallery (bug 5024)
5564 !! options
5566 !! input
5567 <!-- <gallery>data</gallery> -->
5568 !!result
5569 <!-- <gallery>data</gallery> -->
5570 !!end
5572 !! test
5573 pre-save transform: comment containing extension
5574 !! options
5576 !! input
5577 <!-- <tag>data</tag> -->
5578 !!result
5579 <!-- <tag>data</tag> -->
5580 !!end
5582 !! test
5583 pre-save transform: comment containing nowiki
5584 !! options
5586 !! input
5587 <!-- <nowiki>data</nowiki> -->
5588 !!result
5589 <!-- <nowiki>data</nowiki> -->
5590 !!end
5592 !! test
5593 pre-save transform: <noinclude> in subst (bug 3298)
5594 !! options
5596 !! input
5597 {{subst:Includes}}
5598 !! result
5599 Foobar
5600 !! end
5602 !! test
5603 pre-save transform: <onlyinclude> in subst (bug 3298)
5604 !! options
5606 !! input
5607 {{subst:Includes2}}
5608 !! result
5610 !! end
5612 !! article
5613 Template:SubstTest
5614 !!text
5615 {{<includeonly>subst:</includeonly>Includes}}
5616 !! endarticle
5618 !! article
5619 Template:SafeSubstTest
5620 !! text
5621 {{<includeonly>safesubst:</includeonly>Includes}}
5622 !! endarticle
5624 !! test
5625 bug 22297: safesubst: works during PST
5626 !! options
5628 !! input
5629 {{subst:SafeSubstTest}}{{safesubst:SubstTest}}
5630 !! result
5631 FoobarFoobar
5632 !! end
5634 !! test
5635 bug 22297: safesubst: works during normal parse
5636 !! input
5637 {{SafeSubstTest}}
5638 !! result
5639 <p>Foobar
5640 </p>
5641 !! end
5643 !! test:
5644 subst: does not work during normal parse
5645 !! input
5646 {{SubstTest}}
5647 !! result
5648 <p>{{subst:Includes}}
5649 </p>
5650 !! end
5652 !! test
5653 pre-save transform: context links ("pipe trick")
5654 !! options
5656 !! input
5657 [[Article (context)|]]
5658 [[Bar:Article|]]
5659 [[:Bar:Article|]]
5660 [[Bar:Article (context)|]]
5661 [[:Bar:Article (context)|]]
5662 [[|Article]]
5663 [[|Article (context)]]
5664 [[Bar:X (Y) Z|]]
5665 [[:Bar:X (Y) Z|]]
5666 !! result
5667 [[Article (context)|Article]]
5668 [[Bar:Article|Article]]
5669 [[:Bar:Article|Article]]
5670 [[Bar:Article (context)|Article]]
5671 [[:Bar:Article (context)|Article]]
5672 [[Article]]
5673 [[Article (context)]]
5674 [[Bar:X (Y) Z|X (Y) Z]]
5675 [[:Bar:X (Y) Z|X (Y) Z]]
5676 !! end
5678 !! test
5679 pre-save transform: context links ("pipe trick") with interwiki prefix
5680 !! options
5682 !! input
5683 [[interwiki:Article|]]
5684 [[:interwiki:Article|]]
5685 [[interwiki:Bar:Article|]]
5686 [[:interwiki:Bar:Article|]]
5687 !! result
5688 [[interwiki:Article|Article]]
5689 [[:interwiki:Article|Article]]
5690 [[interwiki:Bar:Article|Bar:Article]]
5691 [[:interwiki:Bar:Article|Bar:Article]]
5692 !! end
5694 !! test
5695 pre-save transform: context links ("pipe trick") with parens in title
5696 !! options
5697 pst title=[[Somearticle (context)]]
5698 !! input
5699 [[|Article]]
5700 !! result
5701 [[Article (context)|Article]]
5702 !! end
5704 !! test
5705 pre-save transform: context links ("pipe trick") with comma in title
5706 !! options
5707 pst title=[[Someplace, Somewhere]]
5708 !! input
5709 [[|Otherplace]]
5710 [[Otherplace, Elsewhere|]]
5711 [[Otherplace, Elsewhere, Anywhere|]]
5712 !! result
5713 [[Otherplace, Somewhere|Otherplace]]
5714 [[Otherplace, Elsewhere|Otherplace]]
5715 [[Otherplace, Elsewhere, Anywhere|Otherplace]]
5716 !! end
5718 !! test
5719 pre-save transform: context links ("pipe trick") with parens and comma
5720 !! options
5721 pst title=[[Someplace (IGNORED), Somewhere]]
5722 !! input
5723 [[|Otherplace]]
5724 [[Otherplace (place), Elsewhere|]]
5725 !! result
5726 [[Otherplace, Somewhere|Otherplace]]
5727 [[Otherplace (place), Elsewhere|Otherplace]]
5728 !! end
5730 !! test
5731 pre-save transform: context links ("pipe trick") with comma and parens
5732 !! options
5733 pst title=[[Who, me? (context)]]
5734 !! input
5735 [[|Yes, you.]]
5736 [[Me, Myself, and I (1937 song)|]]
5737 !! result
5738 [[Yes, you. (context)|Yes, you.]]
5739 [[Me, Myself, and I (1937 song)|Me, Myself, and I]]
5740 !! end
5742 !! test
5743 pre-save transform: context links ("pipe trick") with namespace
5744 !! options
5745 pst title=[[Ns:Somearticle]]
5746 !! input
5747 [[|Article]]
5748 !! result
5749 [[Ns:Article|Article]]
5750 !! end
5752 !! test
5753 pre-save transform: context links ("pipe trick") with namespace and parens
5754 !! options
5755 pst title=[[Ns:Somearticle (context)]]
5756 !! input
5757 [[|Article]]
5758 !! result
5759 [[Ns:Article (context)|Article]]
5760 !! end
5762 !! test
5763 pre-save transform: context links ("pipe trick") with namespace and comma
5764 !! options
5765 pst title=[[Ns:Somearticle, Context, Whatever]]
5766 !! input
5767 [[|Article]]
5768 !! result
5769 [[Ns:Article, Context, Whatever|Article]]
5770 !! end
5772 !! test
5773 pre-save transform: context links ("pipe trick") with namespace, comma and parens
5774 !! options
5775 pst title=[[Ns:Somearticle, Context (context)]]
5776 !! input
5777 [[|Article]]
5778 !! result
5779 [[Ns:Article (context)|Article]]
5780 !! end
5782 !! test
5783 pre-save transform: context links ("pipe trick") with namespace, parens and comma
5784 !! options
5785 pst title=[[Ns:Somearticle (IGNORED), Context]]
5786 !! input
5787 [[|Article]]
5788 !! result
5789 [[Ns:Article, Context|Article]]
5790 !! end
5792 !! test
5793 pre-save transform: context links ("pipe trick") with full-width parens and no space (Japanese and Chinese style, bug 30149)
5794 !! options
5796 !! input
5797 [[Article(context)|]]
5798 [[Bar:Article(context)|]]
5799 [[:Bar:Article(context)|]]
5800 [[|Article(context)]]
5801 [[Bar:X(Y)Z|]]
5802 [[:Bar:X(Y)Z|]]
5803 !! result
5804 [[Article(context)|Article]]
5805 [[Bar:Article(context)|Article]]
5806 [[:Bar:Article(context)|Article]]
5807 [[Article(context)]]
5808 [[Bar:X(Y)Z|X(Y)Z]]
5809 [[:Bar:X(Y)Z|X(Y)Z]]
5810 !! end
5812 !! test
5813 pre-save transform: context links ("pipe trick") with full-width parens and space (Japanese and Chinese style, bug 30149)
5814 !! options
5816 !! input
5817 [[Article (context)|]]
5818 [[Bar:Article (context)|]]
5819 [[:Bar:Article (context)|]]
5820 [[|Article (context)]]
5821 [[Bar:X (Y) Z|]]
5822 [[:Bar:X (Y) Z|]]
5823 !! result
5824 [[Article (context)|Article]]
5825 [[Bar:Article (context)|Article]]
5826 [[:Bar:Article (context)|Article]]
5827 [[Article (context)]]
5828 [[Bar:X (Y) Z|X (Y) Z]]
5829 [[:Bar:X (Y) Z|X (Y) Z]]
5830 !! end
5832 !! test
5833 pre-save transform: context links ("pipe trick") with parens and no space (Korean style, bug 30149)
5834 !! options
5836 !! input
5837 [[Article(context)|]]
5838 [[Bar:Article(context)|]]
5839 [[:Bar:Article(context)|]]
5840 [[|Article(context)]]
5841 [[Bar:X(Y)Z|]]
5842 [[:Bar:X(Y)Z|]]
5843 !! result
5844 [[Article(context)|Article]]
5845 [[Bar:Article(context)|Article]]
5846 [[:Bar:Article(context)|Article]]
5847 [[Article(context)]]
5848 [[Bar:X(Y)Z|X(Y)Z]]
5849 [[:Bar:X(Y)Z|X(Y)Z]]
5850 !! end
5852 !! test
5853 pre-save transform: context links ("pipe trick") with commas (bug 21660)
5854 !! options
5856 !! input
5857 [[Article (context), context|]]
5858 [[Article (context),context|]]
5859 [[Bar:Article (context), context|]]
5860 [[Bar:Article (context),context|]]
5861 [[:Bar:Article (context), context|]]
5862 [[:Bar:Article (context),context|]]
5863 !! result
5864 [[Article (context), context|Article]]
5865 [[Article (context),context|Article]]
5866 [[Bar:Article (context), context|Article]]
5867 [[Bar:Article (context),context|Article]]
5868 [[:Bar:Article (context), context|Article]]
5869 [[:Bar:Article (context),context|Article]]
5870 !! end
5872 !! test
5873 pre-save transform: trim trailing empty lines
5874 !! options
5876 !! input
5877 Empty lines are trimmed
5882 !! result
5883 Empty lines are trimmed
5884 !! end
5886 !! test
5887 pre-save transform: Signature expansion
5888 !! options
5890 !! input
5891 * ~~~
5892 * <noinclude>~~~</noinclude>
5893 * <includeonly>~~~</includeonly>
5894 * <onlyinclude>~~~</onlyinclude>
5895 !! result
5896 * [[Special:Contributions/127.0.0.1|127.0.0.1]]
5897 * <noinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</noinclude>
5898 * <includeonly>[[Special:Contributions/127.0.0.1|127.0.0.1]]</includeonly>
5899 * <onlyinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</onlyinclude>
5900 !! end
5903 !! test
5904 pre-save transform: Signature expansion in nowiki tags (bug 93)
5905 !! options
5906 pst disabled
5907 !! input
5908 Shall not expand:
5910 <nowiki>~~~~</nowiki>
5912 <includeonly><nowiki>~~~~</nowiki></includeonly>
5914 <noinclude><nowiki>~~~~</nowiki></noinclude>
5916 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
5918 {{subst:Foo}} shall be converted to FOO
5920 As well as inside noinclude/onlyinclude
5921 <noinclude>{{subst:Foo}}</noinclude>
5922 <onlyinclude>{{subst:Foo}}</onlyinclude>
5924 But not inside includeonly
5925 <includeonly>{{subst:Foo}}</includeonly>
5926 !! result
5927 Shall not expand:
5929 <nowiki>~~~~</nowiki>
5931 <includeonly><nowiki>~~~~</nowiki></includeonly>
5933 <noinclude><nowiki>~~~~</nowiki></noinclude>
5935 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
5937 FOO shall be converted to FOO
5939 As well as inside noinclude/onlyinclude
5940 <noinclude>FOO</noinclude>
5941 <onlyinclude>FOO</onlyinclude>
5943 But not inside includeonly
5944 <includeonly>{{subst:Foo}}</includeonly>
5945 !! end
5948 ### Message transform tests
5950 !! test
5951 message transform: magic variables
5952 !! options
5954 !! input
5955 {{SITENAME}}
5956 !! result
5957 MediaWiki
5958 !! end
5960 !! test
5961 message transform: should not transform wiki markup
5962 !! options
5964 !! input
5965 ''test''
5966 !! result
5967 ''test''
5968 !! end
5970 !! test
5971 message transform: <noinclude> in transcluded template (bug 4926)
5972 !! options
5974 !! input
5975 {{Includes}}
5976 !! result
5977 Foobar
5978 !! end
5980 !! test
5981 message transform: <onlyinclude> in transcluded template (bug 4926)
5982 !! options
5984 !! input
5985 {{Includes2}}
5986 !! result
5988 !! end
5990 !! test
5991 {{#special:}} page name, known
5992 !! options
5994 !! input
5995 {{#special:Recentchanges}}
5996 !! result
5997 Special:RecentChanges
5998 !! end
6000 !! test
6001 {{#special:}} page name with subpage, known
6002 !! options
6004 !! input
6005 {{#special:Recentchanges/param}}
6006 !! result
6007 Special:RecentChanges/param
6008 !! end
6010 !! test
6011 {{#special:}} page name, unknown
6012 !! options
6014 !! input
6015 {{#special:foobarnonexistent}}
6016 !! result
6017 No such special page
6018 !! end
6020 !! test
6021 {{#speciale:}} page name, known
6022 !! options
6024 !! input
6025 {{#speciale:Recentchanges}}
6026 !! result
6027 Special:RecentChanges
6028 !! end
6030 !! test
6031 {{#speciale:}} page name with subpage, known
6032 !! options
6034 !! input
6035 {{#speciale:Recentchanges/param}}
6036 !! result
6037 Special:RecentChanges/param
6038 !! end
6040 !! test
6041 {{#speciale:}} page name, unknown
6042 !! options
6044 !! input
6045 {{#speciale:foobarnonexistent}}
6046 !! result
6047 No_such_special_page
6048 !! end
6051 ### Images
6053 !! test
6054 Simple image
6055 !! input
6056 [[Image:foobar.jpg]]
6057 !! result
6058 <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>
6059 </p>
6060 !! end
6062 !! test
6063 Right-aligned image
6064 !! input
6065 [[Image:foobar.jpg|right]]
6066 !! result
6067 <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>
6069 !! end
6071 !! test
6072 Simple image (using File: namespace, now canonical)
6073 !! input
6074 [[File:foobar.jpg]]
6075 !! result
6076 <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>
6077 </p>
6078 !! end
6080 !! test
6081 Image with caption
6082 !! input
6083 [[Image:foobar.jpg|right|Caption text]]
6084 !! result
6085 <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>
6087 !! end
6089 !! test
6090 Image with empty attribute
6091 !! input
6092 [[Image:foobar.jpg|right||Caption text]]
6093 !! result
6094 <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>
6096 !! end
6098 !! test
6099 Image with link tails
6100 !! input
6101 123[[Image:foobar.jpg]]456
6102 123[[Image:foobar.jpg|right]]456
6103 123[[Image:foobar.jpg|thumb]]456
6104 !! result
6105 <p>123<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>456
6106 </p>
6107 123<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>456
6108 123<div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></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></div></div></div>456
6110 !! end
6112 !! test
6113 Image with multiple captions -- only last one is accepted
6114 !! input
6115 [[Image:foobar.jpg|right|Caption1 - ignored|[[Caption2]] - ignored|Caption3 - accepted]]
6116 !! result
6117 <div class="floatright"><a href="/wiki/File:Foobar.jpg" class="image" title="Caption3 - accepted"><img alt="Caption3 - accepted" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a></div>
6119 !! end
6121 !! test
6122 Image with width attribute at different positions
6123 !! input
6124 [[Image:foobar.jpg|200px|right|Caption]]
6125 [[Image:foobar.jpg|right|200px|Caption]]
6126 [[Image:foobar.jpg|right|Caption|200px]]
6127 !! result
6128 <div class="floatright"><a href="/wiki/File:Foobar.jpg" class="image" title="Caption"><img alt="Caption" src="http://example.com/images/thumb/3/3a/Foobar.jpg/200px-Foobar.jpg" width="200" height="23" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/300px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/400px-Foobar.jpg 2x" /></a></div>
6129 <div class="floatright"><a href="/wiki/File:Foobar.jpg" class="image" title="Caption"><img alt="Caption" src="http://example.com/images/thumb/3/3a/Foobar.jpg/200px-Foobar.jpg" width="200" height="23" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/300px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/400px-Foobar.jpg 2x" /></a></div>
6130 <div class="floatright"><a href="/wiki/File:Foobar.jpg" class="image" title="Caption"><img alt="Caption" src="http://example.com/images/thumb/3/3a/Foobar.jpg/200px-Foobar.jpg" width="200" height="23" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/300px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/400px-Foobar.jpg 2x" /></a></div>
6132 !! end
6134 !! test
6135 Image with link parameter, wiki target
6136 !! input
6137 [[Image:foobar.jpg|link=Target page]]
6138 !! result
6139 <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>
6140 </p>
6141 !! end
6143 !! test
6144 Image with link parameter, URL target
6145 !! input
6146 [[Image:foobar.jpg|link=http://example.com/]]
6147 !! result
6148 <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>
6149 </p>
6150 !! end
6152 !! test
6153 Image with link parameter, wgExternalLinkTarget
6154 !! input
6155 [[Image:foobar.jpg|link=http://example.com/]]
6156 !! config
6157 wgExternalLinkTarget='foobar'
6158 !! result
6159 <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>
6160 </p>
6161 !! end
6163 !! test
6164 Image with link parameter, wgNoFollowLinks set to false
6165 !! input
6166 [[Image:foobar.jpg|link=http://example.com/]]
6167 !! config
6168 wgNoFollowLinks=false
6169 !! result
6170 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
6171 </p>
6172 !! end
6174 !! test
6175 Image with link parameter, wgNoFollowDomainExceptions
6176 !! input
6177 [[Image:foobar.jpg|link=http://example.com/]]
6178 !! config
6179 wgNoFollowDomainExceptions='example.com'
6180 !! result
6181 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
6182 </p>
6183 !! end
6185 !! test
6186 Image with link parameter, wgExternalLinkTarget, unnamed parameter
6187 !! input
6188 [[Image:foobar.jpg|link=http://example.com/|Title]]
6189 !! config
6190 wgExternalLinkTarget='foobar'
6191 !! result
6192 <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>
6193 </p>
6194 !! end
6196 !! test
6197 Image with empty link parameter
6198 !! input
6199 [[Image:foobar.jpg|link=]]
6200 !! result
6201 <p><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" />
6202 </p>
6203 !! end
6205 !! test
6206 Image with link parameter (wiki target) and unnamed parameter
6207 !! input
6208 [[Image:foobar.jpg|link=Target page|Title]]
6209 !! result
6210 <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>
6211 </p>
6212 !! end
6214 !! test
6215 Image with link parameter (URL target) and unnamed parameter
6216 !! input
6217 [[Image:foobar.jpg|link=http://example.com/|Title]]
6218 !! result
6219 <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>
6220 </p>
6221 !! end
6223 !! test
6224 Thumbnail image with link parameter
6225 !! input
6226 [[Image:foobar.jpg|thumb|link=http://example.com/|Title]]
6227 !! result
6228 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="http://example.com/"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></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>
6230 !! end
6232 !! test
6233 Image with frame and link
6234 !! input
6235 [[Image:Foobar.jpg|frame|left|This is a test image [[Main Page]]]]
6236 !! result
6237 <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>
6239 !! end
6241 !! test
6242 Image with frame and link and explicit alt
6243 !! input
6244 [[Image:Foobar.jpg|frame|left|This is a test image [[Main Page]]|alt=Altitude]]
6245 !! result
6246 <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>
6248 !! end
6250 !! test
6251 Image with wiki markup in implicit alt
6252 !! input
6253 [[Image:Foobar.jpg|testing '''bold''' in alt]]
6254 !! result
6255 <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>
6256 </p>
6257 !! end
6259 !! test
6260 Image with wiki markup in explicit alt
6261 !! input
6262 [[Image:Foobar.jpg|alt=testing '''bold''' in alt]]
6263 !! result
6264 <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>
6265 </p>
6266 !! end
6268 !! test
6269 Link to image page- image page normally doesn't exists, hence edit link
6270 Add test with existing image page
6271 #<p><a href="/wiki/File:Test" title="Image:Test">Image:test</a>
6272 !! input
6273 [[:Image:test]]
6274 !! result
6275 <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>
6276 </p>
6277 !! end
6279 !! test
6280 bug 18784  Link to non-existent image page with caption should use caption as link text
6281 !! input
6282 [[:Image:test|caption]]
6283 !! result
6284 <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>
6285 </p>
6286 !! end
6288 !! test
6289 Frameless image caption with a free URL
6290 !! input
6291 [[Image:foobar.jpg|http://example.com]]
6292 !! result
6293 <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>
6294 </p>
6295 !! end
6297 !! test
6298 Thumbnail image caption with a free URL
6299 !! input
6300 [[Image:foobar.jpg|thumb|http://example.com]]
6301 !! result
6302 <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/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></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>
6304 !! end
6306 !! test
6307 Thumbnail image caption with a free URL and explicit alt
6308 !! input
6309 [[Image:foobar.jpg|thumb|http://example.com|alt=Alteration]]
6310 !! result
6311 <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/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></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>
6313 !! end
6315 !! test
6316 BUG 1887: A ISBN with a thumbnail
6317 !! input
6318 [[Image:foobar.jpg|thumb|ISBN 1235467890]]
6319 !! result
6320 <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/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></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>
6322 !! end
6324 !! test
6325 BUG 1887: A RFC with a thumbnail
6326 !! input
6327 [[Image:foobar.jpg|thumb|This is RFC 12354]]
6328 !! result
6329 <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/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></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>
6331 !! end
6333 !! test
6334 BUG 1887: A mailto link with a thumbnail
6335 !! input
6336 [[Image:foobar.jpg|thumb|Please mailto:nobody@example.com]]
6337 !! result
6338 <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/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></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>
6340 !! end
6342 # Pending resolution to bug 368
6343 !! test
6344 BUG 648: Frameless image caption with a link
6345 !! input
6346 [[Image:foobar.jpg|text with a [[link]] in it]]
6347 !! result
6348 <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>
6349 </p>
6350 !! end
6352 !! test
6353 BUG 648: Frameless image caption with a link (suffix)
6354 !! input
6355 [[Image:foobar.jpg|text with a [[link]]foo in it]]
6356 !! result
6357 <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>
6358 </p>
6359 !! end
6361 !! test
6362 BUG 648: Frameless image caption with an interwiki link
6363 !! input
6364 [[Image:foobar.jpg|text with a [[MeatBall:Link]] in it]]
6365 !! result
6366 <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>
6367 </p>
6368 !! end
6370 !! test
6371 BUG 648: Frameless image caption with a piped interwiki link
6372 !! input
6373 [[Image:foobar.jpg|text with a [[MeatBall:Link|link]] in it]]
6374 !! result
6375 <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>
6376 </p>
6377 !! end
6379 !! test
6380 Escape HTML special chars in image alt text
6381 !! input
6382 [[Image:foobar.jpg|& < > "]]
6383 !! result
6384 <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>
6385 </p>
6386 !! end
6388 !! test
6389 BUG 499: Alt text should have &#1234;, not &amp;1234;
6390 !! input
6391 [[Image:foobar.jpg|&#9792;]]
6392 !! result
6393 <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>
6394 </p>
6395 !! end
6397 !! test
6398 Broken image caption with link
6399 !! input
6400 [[Image:Foobar.jpg|thumb|This is a broken caption. But [[Main Page|this]] is just an ordinary link.
6401 !! result
6402 <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.
6403 </p>
6404 !! end
6406 !! test
6407 Image caption containing another image
6408 !! input
6409 [[Image:Foobar.jpg|thumb|This is a caption with another [[Image:icon.png|image]] inside it!]]
6410 !! result
6411 <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/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></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>
6413 !! end
6415 !! test
6416 Image caption containing a newline
6417 !! input
6418 [[Image:Foobar.jpg|This
6419 *is some text]]
6420 !! result
6421 <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>
6422 </p>
6423 !!end
6426 !! test
6427 Bug 3090: External links other than http: in image captions
6428 !! input
6429 [[Image:Foobar.jpg|thumb|200px|This caption has [irc://example.net irc] and [https://example.com Secure] ext links in it.]]
6430 !! result
6431 <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/thumb/3/3a/Foobar.jpg/200px-Foobar.jpg" width="200" height="23" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/300px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/400px-Foobar.jpg 2x" /></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>
6433 !! end
6435 !! test
6436 Custom class
6437 !! input
6438 [[Image:foobar.jpg|a|class=b]]
6439 !! result
6440 <p><a href="/wiki/File:Foobar.jpg" class="image" title="a"><img alt="a" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" class="b" /></a>
6441 </p>
6442 !! end
6444 !! article
6445 File:Barfoo.jpg
6446 !! text
6447 #REDIRECT [[File:Barfoo.jpg]]
6448 !! endarticle
6450 !! test
6451 Redirected image
6452 !! input
6453 [[Image:Barfoo.jpg]]
6454 !! result
6455 <p><a href="/wiki/File:Barfoo.jpg" title="File:Barfoo.jpg">File:Barfoo.jpg</a>
6456 </p>
6457 !! end
6459 !! test
6460 Missing image with uploads disabled
6461 !! options
6462 wgEnableUploads=0
6463 !! input
6464 [[Image:Foobaz.jpg]]
6465 !! result
6466 <p><a href="/wiki/File:Foobaz.jpg" title="File:Foobaz.jpg">File:Foobaz.jpg</a>
6467 </p>
6468 !! end
6472 ### Subpages
6474 !! article
6475 Subpage test/subpage
6476 !! text
6478 !! endarticle
6480 !! test
6481 Subpage link
6482 !! options
6483 subpage title=[[Subpage test]]
6484 !! input
6485 [[/subpage]]
6486 !! result
6487 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a>
6488 </p>
6489 !! end
6491 !! test
6492 Subpage noslash link
6493 !! options
6494 subpage title=[[Subpage test]]
6495 !!input
6496 [[/subpage/]]
6497 !! result
6498 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">subpage</a>
6499 </p>
6500 !! end
6502 !! test
6503 Disabled subpages
6504 !! input
6505 [[/subpage]]
6506 !! result
6507 <p><a href="/index.php?title=/subpage&amp;action=edit&amp;redlink=1" class="new" title="/subpage (page does not exist)">/subpage</a>
6508 </p>
6509 !! end
6511 !! test
6512 BUG 561: {{/Subpage}}
6513 !! options
6514 subpage title=[[Page]]
6515 !! input
6516 {{/Subpage}}
6517 !! result
6518 <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>
6519 </p>
6520 !! end
6523 ### Categories
6525 !! article
6526 Category:MediaWiki User's Guide
6527 !! text
6528 blah
6529 !! endarticle
6531 !! test
6532 Link to category
6533 !! input
6534 [[:Category:MediaWiki User's Guide]]
6535 !! result
6536 <p><a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">Category:MediaWiki User's Guide</a>
6537 </p>
6538 !! end
6540 !! test
6541 Simple category
6542 !! options
6544 !! input
6545 [[Category:MediaWiki User's Guide]]
6546 !! result
6547 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
6548 !! end
6550 !! test
6551 PAGESINCATEGORY invalid title fatal (r33546 fix)
6552 !! input
6553 {{PAGESINCATEGORY:<bogus>}}
6554 !! result
6555 <p>0
6556 </p>
6557 !! end
6559 !! test
6560 Category with different sort key
6561 !! options
6563 !! input
6564 [[Category:MediaWiki User's Guide|Foo]]
6565 !! result
6566 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
6567 !! end
6569 !! test
6570 Category with identical sort key
6571 !! options
6573 !! input
6574 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
6575 !! result
6576 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
6577 !! end
6579 !! test
6580 Category with empty sort key
6581 !! options
6584 !! input
6585 [[Category:MediaWiki User's Guide|]]
6586 !! result
6587 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
6588 !! end
6590 !! test
6591 Category with empty sort key and parentheses
6592 !! options
6595 !! input
6596 [[Category:Foo (bar)|]]
6597 !! result
6598 [[Category:Foo (bar)|Foo]]
6599 !! end
6601 !! test
6602 Category with link tail
6603 !! options
6606 !! input
6607 123[[Category:Foo]]456
6608 !! result
6609 123[[Category:Foo]]456
6610 !! end
6612 !! test
6613 Category with template
6614 !! options
6617 !! input
6618 [[Category:{{echo|Foo}}]]
6619 !! result
6620 [[Category:{{echo|Foo}}]]
6621 !! end
6623 !! test
6624 Category with template in sort key
6625 !! options
6628 !! input
6629 [[Category:Foo|{{echo|Bar}}]]
6630 !! result
6631 [[Category:Foo|{{echo|Bar}}]]
6632 !! end
6634 !! test
6635 Category with template in sort key and title
6636 !! options
6639 !! input
6640 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
6641 !! result
6642 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
6643 !! end
6645 !! test
6646 Category / paragraph interactions
6647 !! input
6648 Foo [[Category:Baz]] Bar
6650 Foo [[Category:Baz]]
6654 [[Category:Baz]]
6658 [[Category:Baz]] Bar
6661 [[Category:Baz]]
6662  [[Category:Baz]]
6663 [[Category:Baz]]
6666 [[Category:Baz]]
6667  [[Category:Baz]]
6668 [[Category:Baz]]
6670 [[Category:Baz]]
6671  {{echo|[[Category:Baz]]}}
6672 [[Category:Baz]]
6673 !! result
6674 <p>Foo Bar
6675 </p><p>Foo
6677 </p><p>Foo
6679 </p><p>Foo Bar
6680 </p><p>Foo
6682 </p>
6683 !! end
6686 ### Inter-language links
6688 !! test
6689 Inter-language links
6690 !! options
6692 !! input
6693 [[es:Alimento]]
6694 [[fr:Nourriture]]
6695 [[zh:&#39135;&#21697;]]
6696 !! result
6697 es:Alimento fr:Nourriture zh:食品
6698 !! end
6700 !! test
6701 Duplicate interlanguage links (bug 24502)
6702 !! options
6704 !! input
6705 [[es:1]]
6706 [[es:2]]
6707 [[fr:1]]
6708 [[fr:2]]
6709 !! result
6710 es:1 fr:1
6711 !! end
6714 ### Sections
6716 !! test
6717 Basic section headings
6718 !! input
6719 == Headline 1 ==
6720 Some text
6722 ==Headline 2==
6723 More
6724 ===Smaller headline===
6725 Blah blah
6726 !! result
6727 <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>
6728 <p>Some text
6729 </p>
6730 <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>
6731 <p>More
6732 </p>
6733 <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>
6734 <p>Blah blah
6735 </p>
6736 !! end
6738 !! test
6739 Section headings with TOC
6740 !! input
6741 == Headline 1 ==
6742 === Subheadline 1 ===
6743 ===== Skipping a level =====
6744 ====== Skipping a level ======
6746 == Headline 2 ==
6747 Some text
6748 ===Another headline===
6749 !! result
6750 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
6751 <ul>
6752 <li class="toclevel-1 tocsection-1"><a href="#Headline_1"><span class="tocnumber">1</span> <span class="toctext">Headline 1</span></a>
6753 <ul>
6754 <li class="toclevel-2 tocsection-2"><a href="#Subheadline_1"><span class="tocnumber">1.1</span> <span class="toctext">Subheadline 1</span></a>
6755 <ul>
6756 <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>
6757 <ul>
6758 <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>
6759 </ul>
6760 </li>
6761 </ul>
6762 </li>
6763 </ul>
6764 </li>
6765 <li class="toclevel-1 tocsection-5"><a href="#Headline_2"><span class="tocnumber">2</span> <span class="toctext">Headline 2</span></a>
6766 <ul>
6767 <li class="toclevel-2 tocsection-6"><a href="#Another_headline"><span class="tocnumber">2.1</span> <span class="toctext">Another headline</span></a></li>
6768 </ul>
6769 </li>
6770 </ul>
6771 </td></tr></table>
6772 <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>
6773 <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>
6774 <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>
6775 <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>
6776 <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>
6777 <p>Some text
6778 </p>
6779 <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>
6781 !! end
6783 # perl -e 'print "="x$_," Level $_ heading","="x$_,"\n" for 1..10'
6784 !! test
6785 Handling of sections up to level 6 and beyond
6786 !! input
6787 = Level 1 Heading=
6788 == Level 2 Heading==
6789 === Level 3 Heading===
6790 ==== Level 4 Heading====
6791 ===== Level 5 Heading=====
6792 ====== Level 6 Heading======
6793 ======= Level 7 Heading=======
6794 ======== Level 8 Heading========
6795 ========= Level 9 Heading=========
6796 ========== Level 10 Heading==========
6797 !! result
6798 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
6799 <ul>
6800 <li class="toclevel-1 tocsection-1"><a href="#Level_1_Heading"><span class="tocnumber">1</span> <span class="toctext">Level 1 Heading</span></a>
6801 <ul>
6802 <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>
6803 <ul>
6804 <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>
6805 <ul>
6806 <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>
6807 <ul>
6808 <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>
6809 <ul>
6810 <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>
6811 <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>
6812 <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>
6813 <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>
6814 <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>
6815 </ul>
6816 </li>
6817 </ul>
6818 </li>
6819 </ul>
6820 </li>
6821 </ul>
6822 </li>
6823 </ul>
6824 </li>
6825 </ul>
6826 </td></tr></table>
6827 <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>
6828 <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>
6829 <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>
6830 <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>
6831 <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>
6832 <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>
6833 <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>
6834 <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>
6835 <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>
6836 <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>
6838 !! end
6840 !! test
6841 TOC regression (bug 9764)
6842 !! input
6843 == title 1 ==
6844 === title 1.1 ===
6845 ==== title 1.1.1 ====
6846 === title 1.2 ===
6847 == title 2 ==
6848 === title 2.1 ===
6849 !! result
6850 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
6851 <ul>
6852 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
6853 <ul>
6854 <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>
6855 <ul>
6856 <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>
6857 </ul>
6858 </li>
6859 <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>
6860 </ul>
6861 </li>
6862 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
6863 <ul>
6864 <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>
6865 </ul>
6866 </li>
6867 </ul>
6868 </td></tr></table>
6869 <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>
6870 <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>
6871 <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>
6872 <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>
6873 <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>
6874 <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>
6876 !! end
6878 !! test
6879 TOC with wgMaxTocLevel=3 (bug 6204)
6880 !! options
6881 wgMaxTocLevel=3
6882 !! input
6883 == title 1 ==
6884 === title 1.1 ===
6885 ==== title 1.1.1 ====
6886 === title 1.2 ===
6887 == title 2 ==
6888 === title 2.1 ===
6889 !! result
6890 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
6891 <ul>
6892 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
6893 <ul>
6894 <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>
6895 <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>
6896 </ul>
6897 </li>
6898 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
6899 <ul>
6900 <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>
6901 </ul>
6902 </li>
6903 </ul>
6904 </td></tr></table>
6905 <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>
6906 <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>
6907 <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>
6908 <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>
6909 <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>
6910 <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>
6912 !! end
6914 !! test
6915 TOC with wgMaxTocLevel=3 and two level four headings (bug 6204)
6916 !! options
6917 wgMaxTocLevel=3
6918 !! input
6919 ==Section 1==
6920 ===Section 1.1===
6921 ====Section 1.1.1====
6922 ====Section 1.1.1.1====
6923 ==Section 2==
6924 !! result
6925 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
6926 <ul>
6927 <li class="toclevel-1 tocsection-1"><a href="#Section_1"><span class="tocnumber">1</span> <span class="toctext">Section 1</span></a>
6928 <ul>
6929 <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>
6930 </ul>
6931 </li>
6932 <li class="toclevel-1 tocsection-5"><a href="#Section_2"><span class="tocnumber">2</span> <span class="toctext">Section 2</span></a></li>
6933 </ul>
6934 </td></tr></table>
6935 <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>
6936 <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>
6937 <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>
6938 <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>
6939 <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>
6941 !! end
6944 !! test
6945 Resolving duplicate section names
6946 !! input
6947 == Foo bar ==
6948 == Foo bar ==
6949 !! result
6950 <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>
6951 <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>
6953 !! end
6955 !! test
6956 Resolving duplicate section names with differing case (bug 10721)
6957 !! input
6958 == Foo bar ==
6959 == Foo Bar ==
6960 !! result
6961 <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>
6962 <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>
6964 !! end
6966 !! article
6967 Template:sections
6968 !! text
6969 ===Section 1===
6970 ==Section 2==
6971 !! endarticle
6973 !! test
6974 Template with sections, __NOTOC__
6975 !! input
6976 __NOTOC__
6977 ==Section 0==
6978 {{sections}}
6979 ==Section 4==
6980 !! result
6981 <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>
6982 <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>
6983 <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>
6984 <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>
6986 !! end
6988 !! test
6989 __NOEDITSECTION__ keyword
6990 !! input
6991 __NOEDITSECTION__
6992 ==Section 1==
6993 ==Section 2==
6994 !! result
6995 <h2> <span class="mw-headline" id="Section_1">Section 1</span></h2>
6996 <h2> <span class="mw-headline" id="Section_2">Section 2</span></h2>
6998 !! end
7000 !! test
7001 Link inside a section heading
7002 !! input
7003 ==Section with a [[Main Page|link]] in it==
7004 !! result
7005 <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>
7007 !! end
7009 !! test
7010 TOC regression (bug 12077)
7011 !! input
7012 __TOC__
7013 == title 1 ==
7014 === title 1.1 ===
7015 == title 2 ==
7016 !! result
7017 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
7018 <ul>
7019 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
7020 <ul>
7021 <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>
7022 </ul>
7023 </li>
7024 <li class="toclevel-1 tocsection-3"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a></li>
7025 </ul>
7026 </td></tr></table>
7027 <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>
7028 <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>
7029 <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>
7031 !! end
7033 !! test
7034 BUG 1219 URL next to image (good)
7035 !! input
7036 http://example.com [[Image:foobar.jpg]]
7037 !! result
7038 <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>
7039 </p>
7040 !!end
7042 !! test
7043 Short headings with trailing space should match behaviour of Parser::doHeadings (bug 19910)
7044 !! input
7045 === 
7046 The line above must have a trailing space!
7047 === <!--
7048 --> <!-- -->
7049 But just in case it doesn't...
7050 !! result
7051 <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>
7052 <p>The line above must have a trailing space!
7053 </p>
7054 <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>
7055 <p>But just in case it doesn't...
7056 </p>
7057 !! end
7059 !! test
7060 Header with special characters (bug 25462)
7061 !! input
7062 The tooltips shall not show entities to the user (ie. be double escaped)
7064 == text > text ==
7065 section 1
7067 == text < text ==
7068 section 2
7070 == text & text ==
7071 section 3
7073 == text ' text ==
7074 section 4
7076 == text " text ==
7077 section 5
7078 !! result
7079 <p>The tooltips shall not show entities to the user (ie. be double escaped)
7080 </p>
7081 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
7082 <ul>
7083 <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>
7084 <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>
7085 <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>
7086 <li class="toclevel-1 tocsection-4"><a href="#text_.27_text"><span class="tocnumber">4</span> <span class="toctext">text ' text</span></a></li>
7087 <li class="toclevel-1 tocsection-5"><a href="#text_.22_text"><span class="tocnumber">5</span> <span class="toctext">text " text</span></a></li>
7088 </ul>
7089 </td></tr></table>
7090 <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>
7091 <p>section 1
7092 </p>
7093 <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>
7094 <p>section 2
7095 </p>
7096 <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>
7097 <p>section 3
7098 </p>
7099 <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>
7100 <p>section 4
7101 </p>
7102 <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>
7103 <p>section 5
7104 </p>
7105 !! end
7107 !! test
7108 Headers with excess '=' characters
7109 (Are similar tests necessary beyond the 1st level?)
7110 !! input
7111 =foo==
7112 ==foo=
7113 =''italic'' heading==
7114 ==''italic'' heading=
7115 !! result
7116 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
7117 <ul>
7118 <li class="toclevel-1 tocsection-1"><a href="#foo.3D"><span class="tocnumber">1</span> <span class="toctext">foo=</span></a></li>
7119 <li class="toclevel-1 tocsection-2"><a href="#.3Dfoo"><span class="tocnumber">2</span> <span class="toctext">=foo</span></a></li>
7120 <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>
7121 <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>
7122 </ul>
7123 </td></tr></table>
7124 <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>
7125 <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>
7126 <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>
7127 <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>
7129 !! end
7131 !! test
7132 BUG 1219 URL next to image (broken)
7133 !! input
7134 http://example.com[[Image:foobar.jpg]]
7135 !! result
7136 <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>
7137 </p>
7138 !!end
7140 !! test
7141 Bug 1186 news: in the middle of text
7142 !! input
7143 http://en.wikinews.org/wiki/Wikinews:Workplace
7144 !! result
7145 <p><a rel="nofollow" class="external free" href="http://en.wikinews.org/wiki/Wikinews:Workplace">http://en.wikinews.org/wiki/Wikinews:Workplace</a>
7146 </p>
7147 !!end
7150 !! test
7151 Namespaced link must have a title
7152 !! input
7153 [[Project:]]
7154 !! result
7155 <p>[[Project:]]
7156 </p>
7157 !!end
7159 !! test
7160 Namespaced link must have a title (bad fragment version)
7161 !! input
7162 [[Project:#fragment]]
7163 !! result
7164 <p>[[Project:#fragment]]
7165 </p>
7166 !!end
7169 !! test
7170 div with no attributes
7171 !! input
7172 <div>HTML rocks</div>
7173 !! result
7174 <div>HTML rocks</div>
7176 !! end
7178 !! test
7179 div with double-quoted attribute
7180 !! input
7181 <div id="rock">HTML rocks</div>
7182 !! result
7183 <div id="rock">HTML rocks</div>
7185 !! end
7187 !! test
7188 div with single-quoted attribute
7189 !! input
7190 <div id='rock'>HTML rocks</div>
7191 !! result
7192 <div id="rock">HTML rocks</div>
7194 !! end
7196 !! test
7197 div with unquoted attribute
7198 !! input
7199 <div id=rock>HTML rocks</div>
7200 !! result
7201 <div id="rock">HTML rocks</div>
7203 !! end
7205 !! test
7206 div with illegal double attributes
7207 !! input
7208 <div id="a" id="b">HTML rocks</div>
7209 !! result
7210 <div id="b">HTML rocks</div>
7212 !!end
7214 # FIXME: produce empty string instead of "class" in the PHP parser, following
7215 # the HTML5 spec.
7216 !! test
7217 div with empty attribute value, space before equals
7218 !! options
7219 disabled
7220 !! input
7221 <div class =>HTML rocks</div>
7222 !! result
7223 <div class="">HTML rocks</div>
7225 !! end
7227 # This it very inconsistent in the PHP parser: it returns 
7228 # class="class" if there is a space between the name and the equal sign (see
7229 # 'div with empty attribute value, space before equals'), but strips the
7230 # attribute completely if the space is missing. We hope that not much content
7231 # depends on this, so are implementing the behavior below in Parsoid for
7232 # consistencies' sake. Disabled for the PHP parser. 
7233 # FIXME: fix this behavior in the PHP parser?
7234 !! test
7235 div with empty attribute value, no space before equals
7236 !! options
7237 disabled
7238 !! input
7239 <div class=>HTML rocks</div>
7240 !! result
7241 <div class="">HTML rocks</div>
7243 !! end
7245 !! test
7246 HTML multiple attributes correction
7247 !! input
7248 <p class="error" class="awesome">Awesome!</p>
7249 !! result
7250 <p class="awesome">Awesome!</p>
7252 !!end
7254 !! test
7255 Table multiple attributes correction
7256 !! input
7258 !+ class="error" class="awesome"| status
7260 !! result
7261 <table>
7262 <tr>
7263 <th class="awesome"> status
7264 </th></tr></table>
7266 !!end
7268 !! test
7269 DIV IN UPPERCASE
7270 !! input
7271 <DIV ID="x">HTML ROCKS</DIV>
7272 !! result
7273 <div id="x">HTML ROCKS</div>
7275 !!end
7277 !! test
7278 Non-ASCII pseudo-tags are rendered as text
7279 !! input
7280 <khyô>
7281 !! result
7282 <p>&lt;khyô&gt;
7283 </p>
7284 !! end
7286 !! test
7287 Pseudo-tag with URL 'name' renders as url link
7288 !! input
7289 <http://example.com/>
7290 !! result
7291 <p>&lt;<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&gt;
7292 </p>
7293 !! end
7295 !! test
7296 text with amp in the middle of nowhere
7297 !! input
7298 Remember AT&T?
7299 !!result
7300 <p>Remember AT&amp;T?
7301 </p>
7302 !! end
7304 !! test
7305 text with character entity: eacute
7306 !! input
7307 I always thought &eacute; was a cute letter.
7308 !! result
7309 <p>I always thought &#233; was a cute letter.
7310 </p>
7311 !! end
7313 !! test
7314 text with undefined character entity: xacute
7315 !! input
7316 I always thought &xacute; was a cute letter.
7317 !! result
7318 <p>I always thought &amp;xacute; was a cute letter.
7319 </p>
7320 !! end
7324 ### Media links
7327 !! test
7328 Media link
7329 !! input
7330 [[Media:Foobar.jpg]]
7331 !! result
7332 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Media:Foobar.jpg</a>
7333 </p>
7334 !! end
7336 !! test
7337 Media link with text
7338 !! input
7339 [[Media:Foobar.jpg|A neat file to look at]]
7340 !! result
7341 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">A neat file to look at</a>
7342 </p>
7343 !! end
7345 # FIXME: this is still bad HTML tag nesting
7346 !! test
7347 Media link with nasty text
7348 fixme: doBlockLevels won't wrap this in a paragraph because it contains a div
7349 !! input
7350 [[Media:Foobar.jpg|Safe Link<div style=display:none>" onmouseover="alert(document.cookie)" onfoo="</div>]]
7351 !! result
7352 <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>
7354 !! end
7356 !! test
7357 Media link to nonexistent file (bug 1702)
7358 !! input
7359 [[Media:No such.jpg]]
7360 !! result
7361 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=No_such.jpg" class="new" title="No such.jpg">Media:No such.jpg</a>
7362 </p>
7363 !! end
7365 !! test
7366 Image link to nonexistent file (bug 1850 - good)
7367 !! input
7368 [[Image:No such.jpg]]
7369 !! result
7370 <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>
7371 </p>
7372 !! end
7374 !! test
7375 :Image link to nonexistent file (bug 1850 - bad)
7376 !! input
7377 [[:Image:No such.jpg]]
7378 !! result
7379 <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>
7380 </p>
7381 !! end
7385 !! test
7386 Character reference normalization in link text (bug 1938)
7387 !! input
7388 [[Main Page|this&that]]
7389 !! result
7390 <p><a href="/wiki/Main_Page" title="Main Page">this&amp;that</a>
7391 </p>
7392 !!end
7394 !! article
7395 אַ
7396 !! text
7397 Test for unicode normalization
7399 The page's name is U+05d0 U+05b7, with non-canonical form U+FB2E
7400 !! endarticle
7402 !! test
7403 (bug 19451) Links should refer to the normalized form.
7404 !! input
7405 [[&#xFB2E;]]
7406 [[&#x5d0;&#x5b7;]]
7407 [[&#x5d0;ַ]]
7408 [[א&#x5b7;]]
7409 [[אַ]]
7410 !! result
7411 <p><a href="/wiki/%D7%90%D6%B7" title="אַ">&#xfb2e;</a>
7412 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;&#x5b7;</a>
7413 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;ַ</a>
7414 <a href="/wiki/%D7%90%D6%B7" title="אַ">א&#x5b7;</a>
7415 <a href="/wiki/%D7%90%D6%B7" title="אַ">אַ</a>
7416 </p>
7417 !! end
7419 !! test
7420 Empty attribute crash test (bug 2067)
7421 !! input
7422 <font color="">foo</font>
7423 !! result
7424 <p><font color="">foo</font>
7425 </p>
7426 !! end
7428 !! test
7429 Empty attribute crash test single-quotes (bug 2067)
7430 !! input
7431 <font color=''>foo</font>
7432 !! result
7433 <p><font color="">foo</font>
7434 </p>
7435 !! end
7437 !! test
7438 Attribute test: equals, then nothing
7439 !! input
7440 <font color=>foo</font>
7441 !! result
7442 <p><font>foo</font>
7443 </p>
7444 !! end
7446 !! test
7447 Attribute test: unquoted value
7448 !! input
7449 <font color=x>foo</font>
7450 !! result
7451 <p><font color="x">foo</font>
7452 </p>
7453 !! end
7455 !! test
7456 Attribute test: unquoted but illegal value (hash)
7457 !! input
7458 <font color=#x>foo</font>
7459 !! result
7460 <p><font color="#x">foo</font>
7461 </p>
7462 !! end
7464 !! test
7465 Attribute test: no value
7466 !! input
7467 <font color>foo</font>
7468 !! result
7469 <p><font color="color">foo</font>
7470 </p>
7471 !! end
7473 !! test
7474 Bug 2095: link with three closing brackets
7475 !! input
7476 [[Main Page]]]
7477 !! result
7478 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>]
7479 </p>
7480 !! end
7482 !! test
7483 Bug 2095: link with pipe and three closing brackets
7484 !! input
7485 [[Main Page|link]]]
7486 !! result
7487 <p><a href="/wiki/Main_Page" title="Main Page">link</a>]
7488 </p>
7489 !! end
7491 !! test
7492 Bug 2095: link with pipe and three closing brackets, version 2
7493 !! input
7494 [[Main Page|[http://example.com/]]]
7495 !! result
7496 <p><a href="/wiki/Main_Page" title="Main Page">[http://example.com/]</a>
7497 </p>
7498 !! end
7502 ### Safety
7505 !! article
7506 Template:Dangerous attribute
7507 !! text
7508 " onmouseover="alert(document.cookie)
7509 !! endarticle
7511 !! article
7512 Template:Dangerous style attribute
7513 !! text
7514 border-size: expression(alert(document.cookie))
7515 !! endarticle
7517 !! article
7518 Template:Div style
7519 !! text
7520 <div style="float: right; {{{1}}}">Magic div</div>
7521 !! endarticle
7523 !! test
7524 Bug 2304: HTML attribute safety (safe template; regression bug 2309)
7525 !! input
7526 <div title="{{test}}"></div>
7527 !! result
7528 <div title="This is a test template"></div>
7530 !! end
7532 !! test
7533 Bug 2304: HTML attribute safety (dangerous template; 2309)
7534 !! input
7535 <div title="{{dangerous attribute}}"></div>
7536 !! result
7537 <div title=""></div>
7539 !! end
7541 !! test
7542 Bug 2304: HTML attribute safety (dangerous style template; 2309)
7543 !! input
7544 <div style="{{dangerous style attribute}}"></div>
7545 !! result
7546 <div style="/* insecure input */"></div>
7548 !! end
7550 !! test
7551 Bug 2304: HTML attribute safety (safe parameter; 2309)
7552 !! input
7553 {{div style|width: 200px}}
7554 !! result
7555 <div style="float: right; width: 200px">Magic div</div>
7557 !! end
7559 !! test
7560 Bug 2304: HTML attribute safety (unsafe parameter; 2309)
7561 !! input
7562 {{div style|width: expression(alert(document.cookie))}}
7563 !! result
7564 <div style="/* insecure input */">Magic div</div>
7566 !! end
7568 !! test
7569 Bug 2304: HTML attribute safety (unsafe breakout parameter; 2309)
7570 !! input
7571 {{div style|"><script>alert(document.cookie)</script>}}
7572 !! result
7573 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
7575 !! end
7577 !! test
7578 Bug 2304: HTML attribute safety (unsafe breakout parameter 2; 2309)
7579 !! input
7580 {{div style|" ><script>alert(document.cookie)</script>}}
7581 !! result
7582 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
7584 !! end
7586 !! test
7587 Bug 2304: HTML attribute safety (link)
7588 !! input
7589 <div title="[[Main Page]]"></div>
7590 !! result
7591 <div title="&#91;&#91;Main Page]]"></div>
7593 !! end
7595 !! test
7596 Bug 2304: HTML attribute safety (italics)
7597 !! input
7598 <div title="''foobar''"></div>
7599 !! result
7600 <div title="&#39;&#39;foobar&#39;&#39;"></div>
7602 !! end
7604 !! test
7605 Bug 2304: HTML attribute safety (bold)
7606 !! input
7607 <div title="'''foobar'''"></div>
7608 !! result
7609 <div title="&#39;&#39;&#39;foobar&#39;&#39;&#39;"></div>
7611 !! end
7614 !! test
7615 Bug 2304: HTML attribute safety (ISBN)
7616 !! input
7617 <div title="ISBN 1234567890"></div>
7618 !! result
7619 <div title="&#73;SBN 1234567890"></div>
7621 !! end
7623 !! test
7624 Bug 2304: HTML attribute safety (RFC)
7625 !! input
7626 <div title="RFC 1234"></div>
7627 !! result
7628 <div title="&#82;FC 1234"></div>
7630 !! end
7632 !! test
7633 Bug 2304: HTML attribute safety (PMID)
7634 !! input
7635 <div title="PMID 1234567890"></div>
7636 !! result
7637 <div title="&#80;MID 1234567890"></div>
7639 !! end
7641 !! test
7642 Bug 2304: HTML attribute safety (web link)
7643 !! input
7644 <div title="http://example.com/"></div>
7645 !! result
7646 <div title="http&#58;//example.com/"></div>
7648 !! end
7650 !! test
7651 Bug 2304: HTML attribute safety (named web link)
7652 !! input
7653 <div title="[http://example.com/ link]"></div>
7654 !! result
7655 <div title="&#91;http&#58;//example.com/ link]"></div>
7657 !! end
7659 !! test
7660 Bug 3244: HTML attribute safety (extension; safe)
7661 !! input
7662 <div style="<nowiki>background:blue</nowiki>"></div>
7663 !! result
7664 <div style="background:blue"></div>
7666 !! end
7668 !! test
7669 Bug 3244: HTML attribute safety (extension; unsafe)
7670 !! input
7671 <div style="<nowiki>border-left:expression(alert(document.cookie))</nowiki>"></div>
7672 !! result
7673 <div style="/* insecure input */"></div>
7675 !! end
7677 # More MSIE fun discovered by Tom Gilder
7679 !! test
7680 MSIE CSS safety test: spurious slash
7681 !! input
7682 <div style="background-image:u\rl(javascript:alert('boo'))">evil</div>
7683 !! result
7684 <div style="/* insecure input */">evil</div>
7686 !! end
7688 !! test
7689 MSIE CSS safety test: hex code
7690 !! input
7691 <div style="background-image:u\72l(javascript:alert('boo'))">evil</div>
7692 !! result
7693 <div style="/* insecure input */">evil</div>
7695 !! end
7697 !! test
7698 MSIE CSS safety test: comment in url
7699 !! input
7700 <div style="background-image:u/**/rl(javascript:alert('boo'))">evil</div>
7701 !! result
7702 <div style="background-image:u rl(javascript:alert(&#39;boo&#39;))">evil</div>
7704 !! end
7706 !! test
7707 MSIE CSS safety test: comment in expression
7708 !! input
7709 <div style="background-image:expres/**/sion(alert('boo4'))">evil4</div>
7710 !! result
7711 <div style="background-image:expres sion(alert(&#39;boo4&#39;))">evil4</div>
7713 !! end
7716 !! test
7717 Table attribute legitimate extension
7718 !! input
7720 !+ style="<nowiki>color:blue</nowiki>"| status
7722 !! result
7723 <table>
7724 <tr>
7725 <th style="color:blue"> status
7726 </th></tr></table>
7728 !!end
7730 !! test
7731 Table attribute safety
7732 !! input
7734 !+ style="<nowiki>border-width:expression(0+alert(document.cookie))</nowiki>"| status
7736 !! result
7737 <table>
7738 <tr>
7739 <th style="/* insecure input */"> status
7740 </th></tr></table>
7742 !! end
7744 !! test
7745 CSS line continuation 1
7746 !! input
7747 <div style="background-image: u\&#10;rl(test.jpg);"></div>
7748 !! result
7749 <div style="/* insecure input */"></div>
7751 !! end
7753 !! test
7754 CSS line continuation 2
7755 !! input
7756 <div style="background-image: u\&#13;rl(test.jpg); "></div>
7757 !! result
7758 <div style="/* insecure input */"></div>
7760 !! end
7762 !! article
7763 Template:Identity
7764 !! text
7765 {{{1}}}
7766 !! endarticle
7768 !! test
7769 Expansion of multi-line templates in attribute values (bug 6255)
7770 !! input
7771 <div style="background: {{identity|#00FF00}}">-</div>
7772 !! result
7773 <div style="background: #00FF00">-</div>
7775 !! end
7778 !! test
7779 Expansion of multi-line templates in attribute values (bug 6255 sanity check)
7780 !! input
7781 <div style="background: 
7782 #00FF00">-</div>
7783 !! result
7784 <div style="background: #00FF00">-</div>
7786 !! end
7788 !! test
7789 Expansion of multi-line templates in attribute values (bug 6255 sanity check 2)
7790 !! input
7791 <div style="background: &#10;#00FF00">-</div>
7792 !! result
7793 <div style="background: &#10;#00FF00">-</div>
7795 !! end
7798 ### Parser hooks (see maintenance/parserTestsParserHook.php for the <tag> extension)
7800 !! test
7801 Parser hook: empty input
7802 !! input
7803 <tag></tag>
7804 !! result
7805 <pre>
7807 array (
7809 </pre>
7811 !! end
7813 !! test
7814 Parser hook: empty input using terminated empty elements
7815 !! input
7816 <tag/>
7817 !! result
7818 <pre>
7819 NULL
7820 array (
7822 </pre>
7824 !! end
7826 !! test
7827 Parser hook: empty input using terminated empty elements (space before)
7828 !! input
7829 <tag />
7830 !! result
7831 <pre>
7832 NULL
7833 array (
7835 </pre>
7837 !! end
7839 !! test
7840 Parser hook: basic input
7841 !! input
7842 <tag>input</tag>
7843 !! result
7844 <pre>
7845 'input'
7846 array (
7848 </pre>
7850 !! end
7853 !! test
7854 Parser hook: case insensitive
7855 !! input
7856 <TAG>input</TAG>
7857 !! result
7858 <pre>
7859 'input'
7860 array (
7862 </pre>
7864 !! end
7867 !! test
7868 Parser hook: case insensitive, redux
7869 !! input
7870 <TaG>input</TAg>
7871 !! result
7872 <pre>
7873 'input'
7874 array (
7876 </pre>
7878 !! end
7880 !! test
7881 Parser hook: nested tags
7882 !! options
7883 noxml
7884 !! input
7885 <tag><tag></tag></tag>
7886 !! result
7887 <pre>
7888 '<tag>'
7889 array (
7891 </pre>&lt;/tag&gt;
7893 !! end
7895 !! test
7896 Parser hook: basic arguments
7897 !! input
7898 <tag width=200 height = "100" depth = '50' square></tag>
7899 !! result
7900 <pre>
7902 array (
7903   'width' => '200',
7904   'height' => '100',
7905   'depth' => '50',
7906   'square' => 'square',
7908 </pre>
7910 !! end
7912 !! test
7913 Parser hook: argument containing a forward slash (bug 5344)
7914 !! input
7915 <tag filename='/tmp/bla'></tag>
7916 !! result
7917 <pre>
7919 array (
7920   'filename' => '/tmp/bla',
7922 </pre>
7924 !! end
7926 !! test
7927 Parser hook: empty input using terminated empty elements (bug 2374)
7928 !! input
7929 <tag foo=bar/>text
7930 !! result
7931 <pre>
7932 NULL
7933 array (
7934   'foo' => 'bar',
7936 </pre>text
7938 !! end
7940 # </tag> should be output literally since there is no matching tag that begins it
7941 !! test
7942 Parser hook: basic arguments using terminated empty elements (bug 2374)
7943 !! input
7944 <tag width=200 height = "100" depth = '50' square/>
7945 other stuff
7946 </tag>
7947 !! result
7948 <pre>
7949 NULL
7950 array (
7951   'width' => '200',
7952   'height' => '100',
7953   'depth' => '50',
7954   'square' => 'square',
7956 </pre>
7957 <p>other stuff
7958 &lt;/tag&gt;
7959 </p>
7960 !! end
7963 ### (see maintenance/parserTestsStaticParserHook.php for the <statictag> extension)
7966 !! test
7967 Parser hook: static parser hook not inside a comment
7968 !! input
7969 <statictag>hello, world</statictag>
7970 <statictag action=flush/>
7971 !! result
7972 <p>hello, world
7973 </p>
7974 !! end
7977 !! test
7978 Parser hook: static parser hook inside a comment
7979 !! input
7980 <!-- <statictag>hello, world</statictag> -->
7981 <statictag action=flush/>
7982 !! result
7983 <p><br />
7984 </p>
7985 !! end
7987 # Nested template calls; this case was broken by Parser.php rev 1.506,
7988 # since reverted.
7990 !! article
7991 Template:One-parameter
7992 !! text
7993 (My parameter is: {{{1}}})
7994 !! endarticle
7996 !! article
7997 Template:Map-one-parameter
7998 !! text
7999 {{{{{1}}}|{{{2}}}}}
8000 !! endarticle
8002 !! test
8003 Nested template calls
8004 !! input
8005 {{Map-one-parameter|One-parameter|param}}
8006 !! result
8007 <p>(My parameter is: param)
8008 </p>
8009 !! end
8013 ### Sanitizer
8015 !! test
8016 Sanitizer: Closing of open tags
8017 !! input
8018 <s></s><table></table>
8019 !! result
8020 <s></s><table></table>
8022 !! end
8024 !! test
8025 Sanitizer: Closing of open but not closed tags
8026 !! input
8027 <s>foo
8028 !! result
8029 <p><s>foo</s>
8030 </p>
8031 !! end
8033 !! test
8034 Sanitizer: Closing of closed but not open tags
8035 !! input
8036 </s>
8037 !! result
8038 <p>&lt;/s&gt;
8039 </p>
8040 !! end
8042 !! test
8043 Sanitizer: Closing of closed but not open table tags
8044 !! input
8045 Table not started</td></tr></table>
8046 !! result
8047 <p>Table not started&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
8048 </p>
8049 !! end
8051 !! test
8052 Sanitizer: Escaping of spaces, multibyte characters, colons & other stuff in id=""
8053 !! input
8054 <span id="æ: v">byte</span>[[#æ: v|backlink]]
8055 !! result
8056 <p><span id=".C3.A6:_v">byte</span><a href="#.C3.A6:_v">backlink</a>
8057 </p>
8058 !! end
8060 !! test
8061 Sanitizer: Validating the contents of the id attribute (bug 4515)
8062 !! options
8063 disabled
8064 !! input
8065 <br id=9 />
8066 !! result
8067 Something, but definitely not <br id="9" />...
8068 !! end
8070 !! test
8071 Sanitizer: Validating id attribute uniqueness (bug 4515, bug 6301)
8072 !! options
8073 disabled
8074 !! input
8075 <br id="foo" /><br id="foo" />
8076 !! result
8077 Something need to be done. foo-2 ? 
8078 !! end
8080 !! test
8081 Sanitizer: Validating that <meta> and <link> work, but only for Microdata
8082 !! input
8083 <div itemscope>
8084         <meta itemprop="hello" content="world">
8085         <meta http-equiv="refresh" content="5">
8086         <meta itemprop="hello" http-equiv="refresh" content="5">
8087         <link itemprop="hello" href="{{SERVER}}">
8088         <link rel="stylesheet" href="{{SERVER}}">
8089         <link rel="stylesheet" itemprop="hello" href="{{SERVER}}">
8090 </div>
8091 !! result
8092 <div itemscope="itemscope">
8093 <p>     <meta itemprop="hello" content="world" />
8094         &lt;meta http-equiv="refresh" content="5"&gt;
8095         <meta itemprop="hello" content="5" />
8096 </p>
8097         <link itemprop="hello" href="http&#58;//Britney-Spears" />
8098         &lt;link rel="stylesheet" href="<a rel="nofollow" class="external free" href="http://Britney-Spears">http://Britney-Spears</a>"&gt;
8099         <link itemprop="hello" href="http&#58;//Britney-Spears" />
8100 </div>
8102 !! end
8104 !! test
8105 Language converter: output gets cut off unexpectedly (bug 5757)
8106 !! options
8107 language=zh
8108 !! input
8109 this bit is safe: }-
8111 but if we add a conversion instance: -{zh-cn:xxx;zh-tw:yyy}-
8113 then we get cut off here: }-
8115 all additional text is vanished
8116 !! result
8117 <p>this bit is safe: }-
8118 </p><p>but if we add a conversion instance: xxx
8119 </p><p>then we get cut off here: }-
8120 </p><p>all additional text is vanished
8121 </p>
8122 !! end
8124 !! test
8125 Self closed html pairs (bug 5487)
8126 !! options
8127 !! input
8128 <center><font id="bug" />Centered text</center>
8129 <div><font id="bug2" />In div text</div>
8130 !! result
8131 <center>&lt;font id="bug" /&gt;Centered text</center>
8132 <div>&lt;font id="bug2" /&gt;In div text</div>
8134 !! end
8140 !! test
8141 Punctuation: nbsp before exclamation
8142 !! input
8143 C'est grave !
8144 !! result
8145 <p>C'est grave&#160;!
8146 </p>
8147 !! end
8149 !! test
8150 Punctuation: CSS !important (bug 11874)
8151 !! input
8152 <div style="width:50% !important">important</div>
8153 !! result
8154 <div style="width:50% !important">important</div>
8156 !!end
8158 !! test
8159 Punctuation: CSS ! important (bug 11874; with space after)
8160 !! input
8161 <div style="width:50% ! important">important</div>
8162 !! result
8163 <div style="width:50% ! important">important</div>
8165 !!end
8168 !! test
8169 HTML bullet list, closed tags (bug 5497)
8170 !! input
8171 <ul>
8172 <li>One</li>
8173 <li>Two</li>
8174 </ul>
8175 !! result
8176 <ul>
8177 <li>One</li>
8178 <li>Two</li>
8179 </ul>
8181 !! end
8183 !! test
8184 HTML bullet list, unclosed tags (bug 5497)
8185 !! options
8186 disabled
8187 !! input
8188 <ul>
8189 <li>One
8190 <li>Two
8191 </ul>
8192 !! result
8193 <ul>
8194 <li>One
8195 </li><li>Two
8196 </li></ul>
8198 !! end
8200 !! test
8201 HTML ordered list, closed tags (bug 5497)
8202 !! input
8203 <ol>
8204 <li>One</li>
8205 <li>Two</li>
8206 </ol>
8207 !! result
8208 <ol>
8209 <li>One</li>
8210 <li>Two</li>
8211 </ol>
8213 !! end
8215 !! test
8216 HTML ordered list, unclosed tags (bug 5497)
8217 !! options
8218 disabled
8219 !! input
8220 <ol>
8221 <li>One
8222 <li>Two
8223 </ol>
8224 !! result
8225 <ol>
8226 <li>One
8227 </li><li>Two
8228 </li></ol>
8230 !! end
8232 !! test
8233 HTML nested bullet list, closed tags (bug 5497)
8234 !! input
8235 <ul>
8236 <li>One</li>
8237 <li>Two:
8238 <ul>
8239 <li>Sub-one</li>
8240 <li>Sub-two</li>
8241 </ul>
8242 </li>
8243 </ul>
8244 !! result
8245 <ul>
8246 <li>One</li>
8247 <li>Two:
8248 <ul>
8249 <li>Sub-one</li>
8250 <li>Sub-two</li>
8251 </ul>
8252 </li>
8253 </ul>
8255 !! end
8257 !! test
8258 HTML nested bullet list, open tags (bug 5497)
8259 !! options
8260 disabled
8261 !! input
8262 <ul>
8263 <li>One
8264 <li>Two:
8265 <ul>
8266 <li>Sub-one
8267 <li>Sub-two
8268 </ul>
8269 </ul>
8270 !! result
8271 <ul>
8272 <li>One
8273 </li><li>Two:
8274 <ul>
8275 <li>Sub-one
8276 </li><li>Sub-two
8277 </li></ul>
8278 </li></ul>
8280 !! end
8282 !! test
8283 HTML nested ordered list, closed tags (bug 5497)
8284 !! input
8285 <ol>
8286 <li>One</li>
8287 <li>Two:
8288 <ol>
8289 <li>Sub-one</li>
8290 <li>Sub-two</li>
8291 </ol>
8292 </li>
8293 </ol>
8294 !! result
8295 <ol>
8296 <li>One</li>
8297 <li>Two:
8298 <ol>
8299 <li>Sub-one</li>
8300 <li>Sub-two</li>
8301 </ol>
8302 </li>
8303 </ol>
8305 !! end
8307 !! test
8308 HTML nested ordered list, open tags (bug 5497)
8309 !! options
8310 disabled
8311 !! input
8312 <ol>
8313 <li>One
8314 <li>Two:
8315 <ol>
8316 <li>Sub-one
8317 <li>Sub-two
8318 </ol>
8319 </ol>
8320 !! result
8321 <ol>
8322 <li>One
8323 </li><li>Two:
8324 <ol>
8325 <li>Sub-one
8326 </li><li>Sub-two
8327 </li></ol>
8328 </li></ol>
8330 !! end
8332 !! test
8333 HTML ordered list item with parameters oddity
8334 !! input
8335 <ol><li id="fragment">One</li></ol>
8336 !! result
8337 <ol><li id="fragment">One</li></ol>
8339 !! end
8341 !!test
8342 bug 5918: autonumbering
8343 !! input
8344 [http://first/] [http://second] [ftp://ftp]
8346 ftp://inlineftp
8348 [mailto:enclosed@mail.tld With target]
8350 [mailto:enclosed@mail.tld]
8352 mailto:inline@mail.tld
8353 !! result
8354 <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>
8355 </p><p><a rel="nofollow" class="external free" href="ftp://inlineftp">ftp://inlineftp</a>
8356 </p><p><a rel="nofollow" class="external text" href="mailto:enclosed@mail.tld">With target</a>
8357 </p><p><a rel="nofollow" class="external autonumber" href="mailto:enclosed@mail.tld">[4]</a>
8358 </p><p><a rel="nofollow" class="external free" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a>
8359 </p>
8360 !! end
8364 # Security and HTML correctness
8365 # From Nick Jenkins' fuzz testing
8368 !! test
8369 Fuzz testing: Parser13
8370 !! input
8371 {| 
8372 | http://a|
8373 !! result
8374 <table>
8375 <tr>
8376 <td>
8377 </td>
8378 </tr>
8379 </table>
8381 !! end
8383 !! test
8384 Fuzz testing: Parser14
8385 !! input
8386 == onmouseover= ==
8387 http://__TOC__
8388 !! result
8389 <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>
8390 http://<table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
8391 <ul>
8392 <li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
8393 </ul>
8394 </td></tr></table>
8396 !! end
8398 !! test
8399 Fuzz testing: Parser14-table
8400 !! input
8401 ==a==
8402 {| STYLE=__TOC__
8403 !! result
8404 <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>
8405 <table style="&#95;_TOC&#95;_">
8406 <tr><td></td></tr>
8407 </table>
8409 !! end
8411 # Known to produce bogus xml (extra </td>)
8412 !! test
8413 Fuzz testing: Parser16
8414 !! options
8415 noxml
8416 !! input
8418 !https://||||||
8419 !! result
8420 <table>
8421 <tr>
8422 <th>https://</th>
8423 <th></th>
8424 <th></th>
8425 <th>
8426 </td>
8427 </tr>
8428 </table>
8430 !! end
8432 !! test
8433 Fuzz testing: Parser21
8434 !! input
8436 ! irc://{{ftp://a" onmouseover="alert('hello world');"
8438 !! result
8439 <table>
8440 <tr>
8441 <th> <a rel="nofollow" class="external free" href="irc://{{ftp://a">irc://{{ftp://a</a>" onmouseover="alert('hello world');"
8442 </th>
8443 <td>
8444 </td>
8445 </tr>
8446 </table>
8448 !! end
8450 !! test
8451 Fuzz testing: Parser22
8452 !! input
8453 http://===r:::https://b
8456 !!result
8457 <p><a rel="nofollow" class="external free" href="http://===r:::https://b">http://===r:::https://b</a>
8458 </p>
8459 <table>
8460 <tr><td></td></tr>
8461 </table>
8463 !! end
8465 # Known to produce bad XML for now
8466 !! test
8467 Fuzz testing: Parser24
8468 !! options
8469 noxml
8470 !! input
8472 {{{|
8473 <u CLASS=
8474 | {{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx--><noinclude>}}}} >
8475 <br style="onmouseover='alert(document.cookie);' " />
8477 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
8479 !! result
8480 <table>
8481 {{{|
8482 <u class="&#124;">}}}} &gt;
8483 <br style="onmouseover=&#39;alert(document.cookie);&#39;" />
8485 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
8486 <tr>
8487 <td></u>
8488 </td>
8489 </tr>
8490 </table>
8492 !! end
8494 # Note: the current result listed for this is not what the original one was,
8495 # but the original bug was JavaScript injection, which is fixed in any case.
8496 # It's not clear that the original result listed was any more correct than the
8497 # current one.  Original result:
8498 # <p>{{{| 
8499 # </p>
8500 # <li class="&#124;&#124;">
8501 # }}}blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
8502 !!test
8503 Fuzz testing: Parser25 (bug 6055)
8504 !! input
8507 <LI CLASS=||
8509 }}}blah" onmouseover="alert('hello world');" align="left"'''MOVE MOUSE CURSOR OVER HERE
8510 !! result
8511 <p>&lt;LI CLASS=blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
8512 </p>
8513 !! end
8515 !!test
8516 Fuzz testing: URL adjacent extension (with space, clean)
8517 !! options
8518 !! input
8519 http://example.com <nowiki>junk</nowiki>
8520 !! result
8521 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a> junk
8522 </p>
8523 !!end
8525 !!test
8526 Fuzz testing: URL adjacent extension (no space, dirty; nowiki)
8527 !! options
8528 !! input
8529 http://example.com<nowiki>junk</nowiki>
8530 !! result
8531 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>junk
8532 </p>
8533 !!end
8535 !!test
8536 Fuzz testing: URL adjacent extension (no space, dirty; pre)
8537 !! options
8538 !! input
8539 http://example.com<pre>junk</pre>
8540 !! result
8541 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a><pre>junk</pre>
8543 !!end
8545 !!test
8546 Fuzz testing: image with bogus manual thumbnail
8547 !!input
8548 [[Image:foobar.jpg|thumbnail= ]]
8549 !!result
8550 <div class="thumb tright"><div class="thumbinner" style="width:1943px;">Error creating thumbnail:   <div class="thumbcaption"></div></div></div>
8552 !!end
8554 !! test
8555 Fuzz testing: encoded newline in generated HTML replacements (bug 6577)
8556 !! input
8557 <pre dir="&#10;"></pre>
8558 !! result
8559 <pre dir="&#10;"></pre>
8561 !! end
8563 !! test
8564 Parsing optional HTML elements (Bug 6171)
8565 !! options
8566 !! input
8567 <table>
8568   <tr>
8569     <td> Some tabular data</td>
8570     <td> More tabular data ...
8571     <td> And yet som tabular data</td>
8572   </tr>
8573 </table>
8574 !! result
8575 <table>
8576   <tr>
8577     <td> Some tabular data</td>
8578     <td> More tabular data ...
8579     </td><td> And yet som tabular data</td>
8580   </tr>
8581 </table>
8583 !! end
8585 !! test
8586 Correct handling of <td>, <tr> (Bug 6171)
8587 !! options
8588 !! input
8589 <table>
8590   <tr>
8591     <td> Some tabular data</td>
8592     <td> More tabular data ...</td>
8593     <td> And yet som tabular data</td>
8594   </tr>
8595 </table>
8596 !! result
8597 <table>
8598   <tr>
8599     <td> Some tabular data</td>
8600     <td> More tabular data ...</td>
8601     <td> And yet som tabular data</td>
8602   </tr>
8603 </table>
8605 !! end
8608 !! test
8609 Parsing crashing regression (fr:JavaScript)
8610 !! input
8611 </body></x>
8612 !! result
8613 <p>&lt;/body&gt;&lt;/x&gt;
8614 </p>
8615 !! end
8617 !! test
8618 Inline wiki vs wiki block nesting
8619 !! input
8620 '''Bold paragraph
8622 New wiki paragraph
8623 !! result
8624 <p><b>Bold paragraph</b>
8625 </p><p>New wiki paragraph
8626 </p>
8627 !! end
8629 !! test
8630 Inline HTML vs wiki block nesting
8631 !! options
8632 disabled
8633 !! input
8634 <b>Bold paragraph
8636 New wiki paragraph
8637 !! result
8638 <p><b>Bold paragraph</b>
8639 </p><p>New wiki paragraph
8640 </p>
8641 !! end
8643 # Original result was this:
8644 # <p><b>bold</b><b>bold<i>bolditalics</i></b>
8645 # </p>
8646 # While that might be marginally more intuitive, maybe, the six-apostrophe
8647 # construct is clearly pathological and the result stated here (which is what
8648 # the parser actually does) is about as reasonable as anything.
8649 !!test
8650 Mixing markup for italics and bold
8651 !! options
8652 !! input
8653 '''bold''''''bold''bolditalics'''''
8654 !! result
8655 <p>'<i>bold'</i><b>bold<i>bolditalics</i></b>
8656 </p>
8657 !! end
8660 !! article
8661 Xyzzyx
8662 !! text
8663 Article for special page transclusion test
8664 !! endarticle
8666 !! test
8667 Special page transclusion
8668 !! options
8669 !! input
8670 {{Special:Prefixindex/Xyzzyx}}
8671 !! result
8672 <table id="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
8674 !! end
8676 !! test
8677 Special page transclusion twice (bug 5021)
8678 !! options
8679 !! input
8680 {{Special:Prefixindex/Xyzzyx}}
8681 {{Special:Prefixindex/Xyzzyx}}
8682 !! result
8683 <table id="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
8684 <table id="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
8686 !! end
8688 !! test
8689 Transclusion of default MediaWiki message
8690 !! input
8691 {{MediaWiki:Mainpage}}
8692 !!result
8693 <p>Main Page
8694 </p>
8695 !! end
8697 !! test
8698 Transclusion of nonexistent MediaWiki message
8699 !! input
8700 {{MediaWiki:Mainpagexxx}}
8701 !!result
8702 <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>
8703 </p>
8704 !! end
8706 !! test
8707 Transclusion of MediaWiki message with underscore
8708 !! input
8709 {{MediaWiki:history_short}}
8710 !! result
8711 <p>History
8712 </p>
8713 !! end
8715 !! test
8716 Transclusion of MediaWiki message with space
8717 !! input
8718 {{MediaWiki:history short}}
8719 !! result
8720 <p>History
8721 </p>
8722 !! end
8724 !! test
8725 Invalid header with following text
8726 !! input
8727 = x = y
8728 !! result
8729 <p>= x = y
8730 </p>
8731 !! end
8734 !! test
8735 Section extraction test (section 0)
8736 !! options
8737 section=0
8738 !! input
8739 start
8740 ==a==
8741 ===aa===
8742 ====aaa====
8743 ==b==
8744 ===ba===
8745 ===bb===
8746 ====bba====
8747 ===bc===
8748 ==c==
8749 ===ca===
8750 !! result
8751 start
8752 !! end
8754 !! test
8755 Section extraction test (section 1)
8756 !! options
8757 section=1
8758 !! input
8759 start
8760 ==a==
8761 ===aa===
8762 ====aaa====
8763 ==b==
8764 ===ba===
8765 ===bb===
8766 ====bba====
8767 ===bc===
8768 ==c==
8769 ===ca===
8770 !! result
8771 ==a==
8772 ===aa===
8773 ====aaa====
8774 !! end
8776 !! test
8777 Section extraction test (section 2)
8778 !! options
8779 section=2
8780 !! input
8781 start
8782 ==a==
8783 ===aa===
8784 ====aaa====
8785 ==b==
8786 ===ba===
8787 ===bb===
8788 ====bba====
8789 ===bc===
8790 ==c==
8791 ===ca===
8792 !! result
8793 ===aa===
8794 ====aaa====
8795 !! end
8797 !! test
8798 Section extraction test (section 3)
8799 !! options
8800 section=3
8801 !! input
8802 start
8803 ==a==
8804 ===aa===
8805 ====aaa====
8806 ==b==
8807 ===ba===
8808 ===bb===
8809 ====bba====
8810 ===bc===
8811 ==c==
8812 ===ca===
8813 !! result
8814 ====aaa====
8815 !! end
8817 !! test
8818 Section extraction test (section 4)
8819 !! options
8820 section=4
8821 !! input
8822 start
8823 ==a==
8824 ===aa===
8825 ====aaa====
8826 ==b==
8827 ===ba===
8828 ===bb===
8829 ====bba====
8830 ===bc===
8831 ==c==
8832 ===ca===
8833 !! result
8834 ==b==
8835 ===ba===
8836 ===bb===
8837 ====bba====
8838 ===bc===
8839 !! end
8841 !! test
8842 Section extraction test (section 5)
8843 !! options
8844 section=5
8845 !! input
8846 start
8847 ==a==
8848 ===aa===
8849 ====aaa====
8850 ==b==
8851 ===ba===
8852 ===bb===
8853 ====bba====
8854 ===bc===
8855 ==c==
8856 ===ca===
8857 !! result
8858 ===ba===
8859 !! end
8861 !! test
8862 Section extraction test (section 6)
8863 !! options
8864 section=6
8865 !! input
8866 start
8867 ==a==
8868 ===aa===
8869 ====aaa====
8870 ==b==
8871 ===ba===
8872 ===bb===
8873 ====bba====
8874 ===bc===
8875 ==c==
8876 ===ca===
8877 !! result
8878 ===bb===
8879 ====bba====
8880 !! end
8882 !! test
8883 Section extraction test (section 7)
8884 !! options
8885 section=7
8886 !! input
8887 start
8888 ==a==
8889 ===aa===
8890 ====aaa====
8891 ==b==
8892 ===ba===
8893 ===bb===
8894 ====bba====
8895 ===bc===
8896 ==c==
8897 ===ca===
8898 !! result
8899 ====bba====
8900 !! end
8902 !! test
8903 Section extraction test (section 8)
8904 !! options
8905 section=8
8906 !! input
8907 start
8908 ==a==
8909 ===aa===
8910 ====aaa====
8911 ==b==
8912 ===ba===
8913 ===bb===
8914 ====bba====
8915 ===bc===
8916 ==c==
8917 ===ca===
8918 !! result
8919 ===bc===
8920 !! end
8922 !! test
8923 Section extraction test (section 9)
8924 !! options
8925 section=9
8926 !! input
8927 start
8928 ==a==
8929 ===aa===
8930 ====aaa====
8931 ==b==
8932 ===ba===
8933 ===bb===
8934 ====bba====
8935 ===bc===
8936 ==c==
8937 ===ca===
8938 !! result
8939 ==c==
8940 ===ca===
8941 !! end
8943 !! test
8944 Section extraction test (section 10)
8945 !! options
8946 section=10
8947 !! input
8948 start
8949 ==a==
8950 ===aa===
8951 ====aaa====
8952 ==b==
8953 ===ba===
8954 ===bb===
8955 ====bba====
8956 ===bc===
8957 ==c==
8958 ===ca===
8959 !! result
8960 ===ca===
8961 !! end
8963 !! test
8964 Section extraction test (nonexistent section 11)
8965 !! options
8966 section=11
8967 !! input
8968 start
8969 ==a==
8970 ===aa===
8971 ====aaa====
8972 ==b==
8973 ===ba===
8974 ===bb===
8975 ====bba====
8976 ===bc===
8977 ==c==
8978 ===ca===
8979 !! result
8980 !! end
8982 !! test
8983 Section extraction test with bogus heading (section 1)
8984 !! options
8985 section=1
8986 !! input
8987 ==a==
8988 ==bogus== not a legal section
8989 ==b==
8990 !! result
8991 ==a==
8992 ==bogus== not a legal section
8993 !! end
8995 !! test
8996 Section extraction test with bogus heading (section 2)
8997 !! options
8998 section=2
8999 !! input
9000 ==a==
9001 ==bogus== not a legal section
9002 ==b==
9003 !! result
9004 ==b==
9005 !! end
9007 !! test
9008 Section extraction test with comment after heading (section 1)
9009 !! options
9010 section=1
9011 !! input
9012 ==a==
9013 ==b== <!-- -->
9014 ==c==
9015 !! result
9016 ==a==
9017 !! end
9019 !! test
9020 Section extraction test with comment after heading (section 2)
9021 !! options
9022 section=2
9023 !! input
9024 ==a==
9025 ==b== <!-- -->
9026 ==c==
9027 !! result
9028 ==b== <!-- -->
9029 !! end
9031 !! test
9032 Section extraction test with bogus <nowiki> heading (section 1)
9033 !! options
9034 section=1
9035 !! input
9036 ==a==
9037 ==bogus== <nowiki>not a legal section</nowiki>
9038 ==b==
9039 !! result
9040 ==a==
9041 ==bogus== <nowiki>not a legal section</nowiki>
9042 !! end
9044 !! test
9045 Section extraction test with bogus <nowiki> heading (section 2)
9046 !! options
9047 section=2
9048 !! input
9049 ==a==
9050 ==bogus== <nowiki>not a legal section</nowiki>
9051 ==b==
9052 !! result
9053 ==b==
9054 !! end
9057 # Formerly testing for bug 2587, now resolved by the use of unmarked sections
9058 # instead of respecting commented sections
9059 !! test
9060 Section extraction prefixed by comment (section 1)
9061 !! options
9062 section=1
9063 !! input
9064 <!-- -->==sec1==
9065 ==sec2==
9066 !!result
9067 ==sec2==
9068 !!end
9070 !! test
9071 Section extraction prefixed by comment (section 2)
9072 !! options
9073 section=2
9074 !! input
9075 <!-- -->==sec1==
9076 ==sec2==
9077 !!result
9079 !!end
9082 # Formerly testing for bug 2607, now resolved by the use of unmarked sections
9083 # instead of respecting HTML-style headings
9084 !! test
9085 Section extraction, mixed wiki and html (section 1)
9086 !! options
9087 section=1
9088 !! input
9089 <h2>unmarked</h2>
9090 unmarked
9091 ==1==
9093 ==2==
9095 !! result
9096 ==1==
9098 !! end
9100 !! test
9101 Section extraction, mixed wiki and html (section 2)
9102 !! options
9103 section=2
9104 !! input
9105 <h2>unmarked</h2>
9106 unmarked
9107 ==1==
9109 ==2==
9111 !! result
9112 ==2==
9114 !! end
9117 # Formerly testing for bug 3342
9118 !! test
9119 Section extraction, heading surrounded by <noinclude>
9120 !! options
9121 section=1
9122 !! input
9123 <noinclude>==unmarked==</noinclude>
9124 ==marked==
9125 !! result
9126 ==marked==
9127 !!end
9129 # Test behaviour of bug 19910
9130 !! test
9131 Sectiion with all-equals
9132 !! options
9133 section=2
9134 !! input
9135 === 
9136 The line above must have a trailing space
9137 === <!--
9138 --> <!-- -->
9139 But just in case it doesn't...
9140 !! result
9141 === <!--
9142 --> <!-- -->
9143 But just in case it doesn't...
9144 !! end
9146 !! test
9147 Section replacement test (section 0)
9148 !! options
9149 replace=0,"xxx"
9150 !! input
9151 start
9152 ==a==
9153 ===aa===
9154 ====aaa====
9155 ==b==
9156 ===ba===
9157 ===bb===
9158 ====bba====
9159 ===bc===
9160 ==c==
9161 ===ca===
9162 !! result
9165 ==a==
9166 ===aa===
9167 ====aaa====
9168 ==b==
9169 ===ba===
9170 ===bb===
9171 ====bba====
9172 ===bc===
9173 ==c==
9174 ===ca===
9175 !! end
9177 !! test
9178 Section replacement test (section 1)
9179 !! options
9180 replace=1,"xxx"
9181 !! input
9182 start
9183 ==a==
9184 ===aa===
9185 ====aaa====
9186 ==b==
9187 ===ba===
9188 ===bb===
9189 ====bba====
9190 ===bc===
9191 ==c==
9192 ===ca===
9193 !! result
9194 start
9197 ==b==
9198 ===ba===
9199 ===bb===
9200 ====bba====
9201 ===bc===
9202 ==c==
9203 ===ca===
9204 !! end
9206 !! test
9207 Section replacement test (section 2)
9208 !! options
9209 replace=2,"xxx"
9210 !! input
9211 start
9212 ==a==
9213 ===aa===
9214 ====aaa====
9215 ==b==
9216 ===ba===
9217 ===bb===
9218 ====bba====
9219 ===bc===
9220 ==c==
9221 ===ca===
9222 !! result
9223 start
9224 ==a==
9227 ==b==
9228 ===ba===
9229 ===bb===
9230 ====bba====
9231 ===bc===
9232 ==c==
9233 ===ca===
9234 !! end
9236 !! test
9237 Section replacement test (section 3)
9238 !! options
9239 replace=3,"xxx"
9240 !! input
9241 start
9242 ==a==
9243 ===aa===
9244 ====aaa====
9245 ==b==
9246 ===ba===
9247 ===bb===
9248 ====bba====
9249 ===bc===
9250 ==c==
9251 ===ca===
9252 !! result
9253 start
9254 ==a==
9255 ===aa===
9258 ==b==
9259 ===ba===
9260 ===bb===
9261 ====bba====
9262 ===bc===
9263 ==c==
9264 ===ca===
9265 !! end
9267 !! test
9268 Section replacement test (section 4)
9269 !! options
9270 replace=4,"xxx"
9271 !! input
9272 start
9273 ==a==
9274 ===aa===
9275 ====aaa====
9276 ==b==
9277 ===ba===
9278 ===bb===
9279 ====bba====
9280 ===bc===
9281 ==c==
9282 ===ca===
9283 !! result
9284 start
9285 ==a==
9286 ===aa===
9287 ====aaa====
9290 ==c==
9291 ===ca===
9292 !! end
9294 !! test
9295 Section replacement test (section 5)
9296 !! options
9297 replace=5,"xxx"
9298 !! input
9299 start
9300 ==a==
9301 ===aa===
9302 ====aaa====
9303 ==b==
9304 ===ba===
9305 ===bb===
9306 ====bba====
9307 ===bc===
9308 ==c==
9309 ===ca===
9310 !! result
9311 start
9312 ==a==
9313 ===aa===
9314 ====aaa====
9315 ==b==
9318 ===bb===
9319 ====bba====
9320 ===bc===
9321 ==c==
9322 ===ca===
9323 !! end
9325 !! test
9326 Section replacement test (section 6)
9327 !! options
9328 replace=6,"xxx"
9329 !! input
9330 start
9331 ==a==
9332 ===aa===
9333 ====aaa====
9334 ==b==
9335 ===ba===
9336 ===bb===
9337 ====bba====
9338 ===bc===
9339 ==c==
9340 ===ca===
9341 !! result
9342 start
9343 ==a==
9344 ===aa===
9345 ====aaa====
9346 ==b==
9347 ===ba===
9350 ===bc===
9351 ==c==
9352 ===ca===
9353 !! end
9355 !! test
9356 Section replacement test (section 7)
9357 !! options
9358 replace=7,"xxx"
9359 !! input
9360 start
9361 ==a==
9362 ===aa===
9363 ====aaa====
9364 ==b==
9365 ===ba===
9366 ===bb===
9367 ====bba====
9368 ===bc===
9369 ==c==
9370 ===ca===
9371 !! result
9372 start
9373 ==a==
9374 ===aa===
9375 ====aaa====
9376 ==b==
9377 ===ba===
9378 ===bb===
9381 ===bc===
9382 ==c==
9383 ===ca===
9384 !! end
9386 !! test
9387 Section replacement test (section 8)
9388 !! options
9389 replace=8,"xxx"
9390 !! input
9391 start
9392 ==a==
9393 ===aa===
9394 ====aaa====
9395 ==b==
9396 ===ba===
9397 ===bb===
9398 ====bba====
9399 ===bc===
9400 ==c==
9401 ===ca===
9402 !! result
9403 start
9404 ==a==
9405 ===aa===
9406 ====aaa====
9407 ==b==
9408 ===ba===
9409 ===bb===
9410 ====bba====
9413 ==c==
9414 ===ca===
9415 !!end
9417 !! test
9418 Section replacement test (section 9)
9419 !! options
9420 replace=9,"xxx"
9421 !! input
9422 start
9423 ==a==
9424 ===aa===
9425 ====aaa====
9426 ==b==
9427 ===ba===
9428 ===bb===
9429 ====bba====
9430 ===bc===
9431 ==c==
9432 ===ca===
9433 !! result
9434 start
9435 ==a==
9436 ===aa===
9437 ====aaa====
9438 ==b==
9439 ===ba===
9440 ===bb===
9441 ====bba====
9442 ===bc===
9444 !! end
9446 !! test
9447 Section replacement test (section 10)
9448 !! options
9449 replace=10,"xxx"
9450 !! input
9451 start
9452 ==a==
9453 ===aa===
9454 ====aaa====
9455 ==b==
9456 ===ba===
9457 ===bb===
9458 ====bba====
9459 ===bc===
9460 ==c==
9461 ===ca===
9462 !! result
9463 start
9464 ==a==
9465 ===aa===
9466 ====aaa====
9467 ==b==
9468 ===ba===
9469 ===bb===
9470 ====bba====
9471 ===bc===
9472 ==c==
9474 !! end
9476 !! test
9477 Section replacement test with initial whitespace (bug 13728)
9478 !! options
9479 replace=2,"xxx"
9480 !! input
9481  Preformatted initial line
9482 ==a==
9483 ===a===
9484 !! result
9485  Preformatted initial line
9486 ==a==
9488 !! end
9491 !! test
9492 Section extraction, heading followed by pre with 20 spaces (bug 6398)
9493 !! options
9494 section=1
9495 !! input
9496 ==a==
9497                     a
9498 !! result
9499 ==a==
9500                     a
9501 !! end
9503 !! test
9504 Section extraction, heading followed by pre with 19 spaces (bug 6398 sanity check)
9505 !! options
9506 section=1
9507 !! input
9508 ==a==
9509                    a
9510 !! result
9511 ==a==
9512                    a
9513 !! end
9516 !! test
9517 Section extraction, <pre> around bogus header (bug 10309)
9518 !! options
9519 noxml section=2
9520 !! input
9521 == Section One ==
9522 <pre>
9523 =======
9524 </pre>
9526 == Section Two ==
9527 stuff
9528 !! result
9529 == Section Two ==
9530 stuff
9531 !! end
9533 !! test
9534 Section replacement, <pre> around bogus header (bug 10309)
9535 !! options
9536 noxml replace=2,"xxx"
9537 !! input
9538 == Section One ==
9539 <pre>
9540 =======
9541 </pre>
9543 == Section Two ==
9544 stuff
9545 !! result
9546 == Section One ==
9547 <pre>
9548 =======
9549 </pre>
9552 !! end
9556 !! test
9557 Handling of &#x0A; in URLs
9558 !! input
9559 **irc://&#x0A;a
9560 !! result
9561 <ul><li><ul><li><a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a>
9562 </li></ul>
9563 </li></ul>
9565 !!end
9567 !! test
9568 5 quotes, code coverage +1 line
9569 !! input
9570 '''''
9571 !! result
9572 !! end
9574 !! test
9575 Special:Search page linking.
9576 !! input
9577 {{Special:search}}
9578 !! result
9579 <p><a href="/wiki/Special:Search" title="Special:Search">Special:Search</a>
9580 </p>
9581 !! end
9583 !! test
9584 Say the magic word
9585 !! input
9586 * {{PAGENAME}}
9587 * {{BASEPAGENAME}}
9588 * {{SUBPAGENAME}}
9589 * {{SUBPAGENAMEE}}
9590 * {{BASEPAGENAME}}
9591 * {{BASEPAGENAMEE}}
9592 * {{TALKPAGENAME}}
9593 * {{TALKPAGENAMEE}}
9594 * {{SUBJECTPAGENAME}}
9595 * {{SUBJECTPAGENAMEE}}
9596 * {{NAMESPACEE}}
9597 * {{NAMESPACE}}
9598 * {{TALKSPACE}}
9599 * {{TALKSPACEE}}
9600 * {{SUBJECTSPACE}}
9601 * {{SUBJECTSPACEE}}
9602 * {{Dynamic|{{NUMBEROFUSERS}}|{{NUMBEROFPAGES}}|{{CURRENTVERSION}}|{{CONTENTLANGUAGE}}|{{DIRECTIONMARK}}|{{CURRENTTIMESTAMP}}|{{NUMBEROFARTICLES}}}}
9603 !! result
9604 <ul><li> Parser test
9605 </li><li> Parser test
9606 </li><li> Parser test
9607 </li><li> Parser_test
9608 </li><li> Parser test
9609 </li><li> Parser_test
9610 </li><li> Talk:Parser test
9611 </li><li> Talk:Parser_test
9612 </li><li> Parser test
9613 </li><li> Parser_test
9614 </li><li> 
9615 </li><li> 
9616 </li><li> Talk
9617 </li><li> Talk
9618 </li><li> 
9619 </li><li> 
9620 </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>
9621 </li></ul>
9623 !! end
9624 ### Note: Above tests excludes the "{{NUMBEROFADMINS}}" magic word because it generates a MySQL error when included.
9626 !! test
9627 Gallery
9628 !! input
9629 <gallery>
9630 image1.png |
9631 image2.gif|||||
9633 image3|
9634 image4    |300px| centre
9635  image5.svg| http://///////
9636 [[x|xx]]]]
9637 * image6
9638 </gallery>
9639 !! result
9640 <ul class="gallery">
9641                 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
9642                         <div style="height: 150px;">Image1.png</div>
9643                         <div class="gallerytext">
9644                         </div>
9645                 </div></li>
9646                 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
9647                         <div style="height: 150px;">Image2.gif</div>
9648                         <div class="gallerytext">
9649 <p>||||
9650 </p>
9651                         </div>
9652                 </div></li>
9653                 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
9654                         <div style="height: 150px;">Image3</div>
9655                         <div class="gallerytext">
9656                         </div>
9657                 </div></li>
9658                 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
9659                         <div style="height: 150px;">Image4</div>
9660                         <div class="gallerytext">
9661 <p>300px| centre
9662 </p>
9663                         </div>
9664                 </div></li>
9665                 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
9666                         <div style="height: 150px;">Image5.svg</div>
9667                         <div class="gallerytext">
9668 <p><a rel="nofollow" class="external free" href="http://///////">http://///////</a>
9669 </p>
9670                         </div>
9671                 </div></li>
9672                 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
9673                         <div style="height: 150px;">* image6</div>
9674                         <div class="gallerytext">
9675                         </div>
9676                 </div></li>
9677 </ul>
9679 !! end
9681 !! test
9682 Gallery (with options)
9683 !! input
9684 <gallery widths='70px' heights='40px' perrow='2' caption='Foo [[Main Page]]' >
9685 File:Nonexistant.jpg|caption
9686 File:Nonexistant.jpg
9687 image:foobar.jpg|some '''caption''' [[Main Page]]
9688 image:foobar.jpg
9689 image:foobar.jpg|Blabla|alt=This is a foo-bar.|blabla.
9690 </gallery>
9691 !! result
9692 <ul class="gallery" style="max-width: 226px;_width: 226px;">
9693         <li class='gallerycaption'>Foo <a href="/wiki/Main_Page" title="Main Page">Main Page</a></li>
9694                 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
9695                         <div style="height: 70px;">Nonexistant.jpg</div>
9696                         <div class="gallerytext">
9697 <p>caption
9698 </p>
9699                         </div>
9700                 </div></li>
9701                 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
9702                         <div style="height: 70px;">Nonexistant.jpg</div>
9703                         <div class="gallerytext">
9704                         </div>
9705                 </div></li>
9706                 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
9707                         <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/thumb/3/3a/Foobar.jpg/70px-Foobar.jpg" width="70" height="8" /></a></div></div>
9708                         <div class="gallerytext">
9709 <p>some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
9710 </p>
9711                         </div>
9712                 </div></li>
9713                 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
9714                         <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/thumb/3/3a/Foobar.jpg/70px-Foobar.jpg" width="70" height="8" /></a></div></div>
9715                         <div class="gallerytext">
9716                         </div>
9717                 </div></li>
9718                 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
9719                         <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/thumb/3/3a/Foobar.jpg/70px-Foobar.jpg" width="70" height="8" /></a></div></div>
9720                         <div class="gallerytext">
9721 <p>Blabla|blabla.
9722 </p>
9723                         </div>
9724                 </div></li>
9725 </ul>
9727 !! end
9729 !! test
9730 Gallery with wikitext inside caption
9731 !! input
9732 <gallery>
9733 File:foobar.jpg|[[File:foobar.jpg|20px|desc|alt=inneralt]]|alt=galleryalt
9734 File:foobar.jpg|{{Test|unamedParam|alt=param}}|alt=galleryalt
9735 </gallery>
9736 !! result
9737 <ul class="gallery">
9738                 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
9739                         <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/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" width="120" height="14" /></a></div></div>
9740                         <div class="gallerytext">
9741 <p><a href="/wiki/File:Foobar.jpg" class="image" title="desc"><img alt="inneralt" src="http://example.com/images/thumb/3/3a/Foobar.jpg/20px-Foobar.jpg" width="20" height="2" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/30px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/40px-Foobar.jpg 2x" /></a>
9742 </p>
9743                         </div>
9744                 </div></li>
9745                 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
9746                         <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/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" width="120" height="14" /></a></div></div>
9747                         <div class="gallerytext">
9748 <p>This is a test template
9749 </p>
9750                         </div>
9751                 </div></li>
9752 </ul>
9754 !! end
9756 !! test
9757 gallery (with showfilename option)
9758 !! input
9759 <gallery showfilename>
9760 File:Nonexistant.jpg|caption
9761 File:Nonexistant.jpg
9762 image:foobar.jpg|some '''caption''' [[Main Page]]
9763 File:Foobar.jpg
9764 </gallery>
9765 !! result
9766 <ul class="gallery">
9767                 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
9768                         <div style="height: 150px;">Nonexistant.jpg</div>
9769                         <div class="gallerytext">
9770 <p><a href="/wiki/File:Nonexistant.jpg" title="File:Nonexistant.jpg">Nonexistant.jpg</a><br />
9771 caption
9772 </p>
9773                         </div>
9774                 </div></li>
9775                 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
9776                         <div style="height: 150px;">Nonexistant.jpg</div>
9777                         <div class="gallerytext">
9778 <p><a href="/wiki/File:Nonexistant.jpg" title="File:Nonexistant.jpg">Nonexistant.jpg</a><br />
9779 </p>
9780                         </div>
9781                 </div></li>
9782                 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
9783                         <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/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" width="120" height="14" /></a></div></div>
9784                         <div class="gallerytext">
9785 <p><a href="/wiki/File:Foobar.jpg" title="File:Foobar.jpg">Foobar.jpg</a><br />
9786 some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
9787 </p>
9788                         </div>
9789                 </div></li>
9790                 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
9791                         <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/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" width="120" height="14" /></a></div></div>
9792                         <div class="gallerytext">
9793 <p><a href="/wiki/File:Foobar.jpg" title="File:Foobar.jpg">Foobar.jpg</a><br />
9794 </p>
9795                         </div>
9796                 </div></li>
9797 </ul>
9799 !! end
9801 !! test
9802 Gallery (with namespace-less filenames)
9803 !! input
9804 <gallery>
9805 File:Nonexistant.jpg
9806 Nonexistant.jpg
9807 image:foobar.jpg
9808 foobar.jpg
9809 </gallery>
9810 !! result
9811 <ul class="gallery">
9812                 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
9813                         <div style="height: 150px;">Nonexistant.jpg</div>
9814                         <div class="gallerytext">
9815                         </div>
9816                 </div></li>
9817                 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
9818                         <div style="height: 150px;">Nonexistant.jpg</div>
9819                         <div class="gallerytext">
9820                         </div>
9821                 </div></li>
9822                 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
9823                         <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/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" width="120" height="14" /></a></div></div>
9824                         <div class="gallerytext">
9825                         </div>
9826                 </div></li>
9827                 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
9828                         <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/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" width="120" height="14" /></a></div></div>
9829                         <div class="gallerytext">
9830                         </div>
9831                 </div></li>
9832 </ul>
9834 !! end
9836 !! test
9837 HTML Hex character encoding (spells the word "JavaScript")
9838 !! input
9839 &#x4A;&#x061;&#x0076;&#x00061;&#x000053;&#x0000063;&#114;&#x0000069;&#00000112;&#x0000000074;
9840 !! result
9841 <p>&#x4a;&#x61;&#x76;&#x61;&#x53;&#x63;&#114;&#x69;&#112;&#x74;
9842 </p>
9843 !! end
9845 !! test
9846 HTML Hex character encoding bogus encoding (bug 26437 regression check)
9847 !! input
9848 &#xsee;&#XSEE;
9849 !! result
9850 <p>&amp;#xsee;&amp;#XSEE;
9851 </p>
9852 !! end
9854 !! test
9855 HTML Hex character encoding mixed case
9856 !! input
9857 &#xEE;&#Xee;
9858 !! result
9859 <p>&#xee;&#xee;
9860 </p>
9861 !! end
9863 !! test
9864 __FORCETOC__ override
9865 !! input
9866 __NEWSECTIONLINK__
9867 __FORCETOC__
9868 !! result
9869 <p><br />
9870 </p>
9871 !! end
9873 !! test
9874 ISBN code coverage
9875 !! input
9876 ISBN  978-0-1234-56&#x20;789
9877 !! result
9878 <p><a href="/wiki/Special:BookSources/9780123456" class="internal mw-magiclink-isbn">ISBN 978-0-1234-56</a>&#x20;789
9879 </p>
9880 !! end
9882 !! test
9883 ISBN followed by 5 spaces
9884 !! input
9885 ISBN    
9886 !! result
9887 <p>ISBN    
9888 </p>
9889 !! end
9891 !! test
9892 Double ISBN
9893 !! input
9894 ISBN ISBN 1234567890
9895 !! result
9896 <p>ISBN <a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
9897 </p>
9898 !! end
9900 !! test
9901 Bug 22905: <abbr> followed by ISBN followed by </a>
9902 !! input
9903 <abbr>(fr)</abbr> ISBN 2753300917 [http://www.example.com example.com]
9904 !! result
9905 <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>
9906 </p>
9907 !! end
9909 !! test
9910 Double RFC
9911 !! input
9912 RFC RFC 1234
9913 !! result
9914 <p>RFC <a class="external mw-magiclink-rfc" href="//tools.ietf.org/html/rfc1234">RFC 1234</a>
9915 </p>
9916 !! end
9918 !! test
9919 Double RFC with a wiki link
9920 !! input
9921 RFC [[RFC 1234]]
9922 !! result
9923 <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>
9924 </p>
9925 !! end
9927 !! test
9928 RFC code coverage
9929 !! input
9930 RFC   983&#x20;987
9931 !! result
9932 <p><a class="external mw-magiclink-rfc" href="//tools.ietf.org/html/rfc983">RFC 983</a>&#x20;987
9933 </p>
9934 !! end
9936 !! test
9937 Centre-aligned image
9938 !! input
9939 [[Image:foobar.jpg|centre]]
9940 !! result
9941 <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>
9943 !!end
9945 !! test
9946 None-aligned image
9947 !! input
9948 [[Image:foobar.jpg|none]]
9949 !! result
9950 <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>
9952 !!end
9954 !! test
9955 Width + Height sized image (using px) (height is ignored)
9956 !! input
9957 [[Image:foobar.jpg|640x480px]]
9958 !! result
9959 <p><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/640px-Foobar.jpg" width="640" height="73" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/960px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/1280px-Foobar.jpg 2x" /></a>
9960 </p>
9961 !!end
9963 !! test
9964 Width-sized image (using px, no following whitespace)
9965 !! input
9966 [[Image:foobar.jpg|640px]]
9967 !! result
9968 <p><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/640px-Foobar.jpg" width="640" height="73" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/960px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/1280px-Foobar.jpg 2x" /></a>
9969 </p>
9970 !!end
9972 !! test
9973 Width-sized image (using px, with following whitespace - test regression from r39467)
9974 !! input
9975 [[Image:foobar.jpg|640px ]]
9976 !! result
9977 <p><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/640px-Foobar.jpg" width="640" height="73" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/960px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/1280px-Foobar.jpg 2x" /></a>
9978 </p>
9979 !!end
9981 !! test
9982 Width-sized image (using px, with preceding whitespace - test regression from r39467)
9983 !! input
9984 [[Image:foobar.jpg| 640px]]
9985 !! result
9986 <p><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/640px-Foobar.jpg" width="640" height="73" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/960px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/1280px-Foobar.jpg 2x" /></a>
9987 </p>
9988 !!end
9990 !! test
9991 Another italics / bold test
9992 !! input
9993  ''' ''x'
9994 !! result
9995 <pre>'<i> </i>x'
9996 </pre>
9997 !!end
9999 # Note the results may be incorrect, as parserTest output included this:
10000 # XML error: Mismatched tag at byte 6120:
10001 # ...<dd> </dt></dl> </dd...
10002 !! test
10003 dt/dd/dl test
10004 !! options
10005 disabled
10006 !! input
10007 :;;;::
10008 !! result
10009 <dl><dd><dl><dt><dl><dt><dl><dt><dl><dd><dl><dd>
10010 </dd></dl>
10011 </dd></dl>
10012 </dt></dl>
10013 </dt></dl>
10014 </dt></dl>
10015 </dd></dl>
10017 !!end
10020 # Images with the "|" character in external URLs in comment tags; Eats half the comment, leaves unmatched "</a>" tag.
10021 !! test
10022 Images with the "|" character in the comment
10023 !! input
10024 [[image:Foobar.jpg|thumb|An [http://test/?param1=|left|&param2=|x external] URL]]
10025 !! result
10026 <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/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></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>
10028 !!end
10030 !! test
10031 [Before] HTML without raw HTML enabled ($wgRawHtml==false)
10032 !! input
10033 <html><script>alert(1);</script></html>
10034 !! result
10035 <p>&lt;html&gt;&lt;script&gt;alert(1);&lt;/script&gt;&lt;/html&gt;
10036 </p>
10037 !! end
10039 !! test
10040 HTML with raw HTML ($wgRawHtml==true)
10041 !! options
10042 rawhtml
10043 !! input
10044 <html><script>alert(1);</script></html>
10045 !! result
10046 <p><script>alert(1);</script>
10047 </p>
10048 !! end
10050 !! test
10051 Parents of subpages, one level up
10052 !! options
10053 subpage title=[[Subpage test/L1/L2/L3]]
10054 !! input
10055 [[../|L2]]
10056 !! result
10057 <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>
10058 </p>
10059 !! end
10062 !! test
10063 Parents of subpages, one level up, not named
10064 !! options
10065 subpage title=[[Subpage test/L1/L2/L3]]
10066 !! input
10067 [[../]]
10068 !! result
10069 <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>
10070 </p>
10071 !! end
10075 !! test
10076 Parents of subpages, two levels up
10077 !! options
10078 subpage title=[[Subpage test/L1/L2/L3]]
10079 !! input
10080 [[../../|L1]]2
10082 [[../../|L1]]l
10083 !! result
10084 <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
10085 </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>
10086 </p>
10087 !! end
10089 !! test
10090 Parents of subpages, two levels up, without trailing slash or name.
10091 !! options
10092 subpage title=[[Subpage test/L1/L2/L3]]
10093 !! input
10094 [[../..]]
10095 !! result
10096 <p>[[../..]]
10097 </p>
10098 !! end
10100 !! test
10101 Parents of subpages, two levels up, with lots of extra trailing slashes.
10102 !! options
10103 subpage title=[[Subpage test/L1/L2/L3]]
10104 !! input
10105 [[../../////]]
10106 !! result
10107 <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>
10108 </p>
10109 !! end
10111 !! test
10112 Definition list code coverage
10113 !! input
10114 ; title   : def
10115 ; title : def
10116 ;title: def
10117 !! result
10118 <dl><dt> title  &#160;</dt><dd> def
10119 </dd><dt> title&#160;</dt><dd> def
10120 </dd><dt>title</dt><dd> def
10121 </dd></dl>
10123 !! end
10125 !! test
10126 Don't fall for the self-closing div
10127 !! input
10128 <div>hello world</div/>
10129 !! result
10130 <div>hello world</div>
10132 !! end
10134 !! test
10135 MSGNW magic word
10136 !! input
10137 {{MSGNW:msg}}
10138 !! result
10139 <p>&#91;&#91;:Template:Msg&#93;&#93;
10140 </p>
10141 !! end
10143 !! test
10144 RAW magic word
10145 !! input
10146 {{RAW:QUERTY}}
10147 !! result
10148 <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>
10149 </p>
10150 !! end
10152 # This isn't needed for XHTML conformance, but would be handy as a fallback security measure
10153 !! test
10154 Always escape literal '>' in output, not just after '<'
10155 !! input
10157 !! result
10158 <p>&gt;&lt;&gt;
10159 </p>
10160 !! end
10162 !! test
10163 Template caching
10164 !! input
10165 {{Test}}
10166 {{Test}}
10167 !! result
10168 <p>This is a test template
10169 This is a test template
10170 </p>
10171 !! end
10174 !! article
10175 MediaWiki:Fake
10176 !! text
10177 ==header==
10178 !! endarticle
10180 !! test
10181 Inclusion of !userCanEdit() content
10182 !! input
10183 {{MediaWiki:Fake}}
10184 !! result
10185 <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>
10187 !! end
10190 !! test
10191 Out-of-order TOC heading levels
10192 !! input
10193 ==2==
10194 ======6======
10195 ===3===
10197 =====5=====
10198 ==2==
10199 !! result
10200 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
10201 <ul>
10202 <li class="toclevel-1 tocsection-1"><a href="#2"><span class="tocnumber">1</span> <span class="toctext">2</span></a>
10203 <ul>
10204 <li class="toclevel-2 tocsection-2"><a href="#6"><span class="tocnumber">1.1</span> <span class="toctext">6</span></a></li>
10205 <li class="toclevel-2 tocsection-3"><a href="#3"><span class="tocnumber">1.2</span> <span class="toctext">3</span></a></li>
10206 </ul>
10207 </li>
10208 <li class="toclevel-1 tocsection-4"><a href="#1"><span class="tocnumber">2</span> <span class="toctext">1</span></a>
10209 <ul>
10210 <li class="toclevel-2 tocsection-5"><a href="#5"><span class="tocnumber">2.1</span> <span class="toctext">5</span></a></li>
10211 <li class="toclevel-2 tocsection-6"><a href="#2_2"><span class="tocnumber">2.2</span> <span class="toctext">2</span></a></li>
10212 </ul>
10213 </li>
10214 </ul>
10215 </td></tr></table>
10216 <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>
10217 <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>
10218 <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>
10219 <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>
10220 <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>
10221 <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>
10223 !! end
10226 !! test
10227 ISBN with a dummy number
10228 !! input
10229 ISBN ---
10230 !! result
10231 <p>ISBN ---
10232 </p>
10233 !! end
10236 !! test
10237 ISBN with space-delimited number
10238 !! input
10239 ISBN 92 9017 032 8
10240 !! result
10241 <p><a href="/wiki/Special:BookSources/9290170328" class="internal mw-magiclink-isbn">ISBN 92 9017 032 8</a>
10242 </p>
10243 !! end
10246 !! test
10247 ISBN with multiple spaces, no number
10248 !! input
10249 ISBN  foo
10250 !! result
10251 <p>ISBN  foo
10252 </p>
10253 !! end
10256 !! test
10257 ISBN length
10258 !! input
10259 ISBN 123456789
10261 ISBN 1234567890
10263 ISBN 12345678901
10264 !! result
10265 <p>ISBN 123456789
10266 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
10267 </p><p>ISBN 12345678901
10268 </p>
10269 !! end
10272 !! test
10273 ISBN with trailing year (bug 8110)
10274 !! input
10275 ISBN 1-234-56789-0 - 2006
10277 ISBN 1 234 56789 0 - 2006
10278 !! result
10279 <p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1-234-56789-0</a> - 2006
10280 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1 234 56789 0</a> - 2006
10281 </p>
10282 !! end
10285 !! test
10286 anchorencode
10287 !! input
10288 {{anchorencode:foo bar©#%n}}
10289 !! result
10290 <p>foo_bar.C2.A9.23.25n
10291 </p>
10292 !! end
10294 !! test
10295 anchorencode trims spaces
10296 !! input
10297 {{anchorencode: __pretty__please__}}
10298 !! result
10299 <p>pretty_please
10300 </p>
10301 !! end
10303 !! test
10304 anchorencode deals with links
10305 !! input
10306 {{anchorencode: [[hello|world]] [[hi]]}}
10307 !! result
10308 <p>world_hi
10309 </p>
10310 !! end
10312 !! test
10313 anchorencode deals with templates
10314 !! input
10315 {{anchorencode: {{Foo}} }}
10316 !! result
10317 <p>FOO
10318 </p>
10319 !! end
10321 !! test
10322 anchorencode encodes like the TOC generator: (bug 18431)
10323 !! input
10324 === _ +:.3A%3A&&amp;]] ===
10325 {{anchorencode: _ +:.3A%3A&&amp;]] }}
10326 __NOEDITSECTION__
10327 !! result
10328 <h3> <span class="mw-headline" id=".2B:.3A.253A.26.26.5D.5D"> _ +:.3A%3A&amp;&amp;]] </span></h3>
10329 <p>.2B:.3A.253A.26.26.5D.5D
10330 </p>
10331 !! end
10333 # Expected output in the following test is not necessarily expected (there
10334 # should probably be <p> tags inside the <blockquote> in the output) -- it's
10335 # only testing for well-formedness.
10336 !! test
10337 Bug 6200: blockquotes and paragraph formatting
10338 !! input
10339 <blockquote>
10341 </blockquote>
10345  baz
10346 !! result
10347 <blockquote>
10349 </blockquote>
10350 <p>bar
10351 </p>
10352 <pre>baz
10353 </pre>
10354 !! end
10356 !! test
10357 Bug 8293: Use of center tag ruins paragraph formatting
10358 !! input
10359 <center>
10361 </center>
10365  baz
10366 !! result
10367 <center>
10368 <p>foo
10369 </p>
10370 </center>
10371 <p>bar
10372 </p>
10373 <pre>baz
10374 </pre>
10375 !! end
10379 ### Language variants related tests
10381 !! test
10382 Self-link in language variants
10383 !! options
10384 title=[[Dunav]] language=sr
10385 !! input
10386 Both [[Dunav]] and [[Дунав]] are names for this river.
10387 !! result
10388 <p>Both <strong class="selflink">Dunav</strong> and <strong class="selflink">Дунав</strong> are names for this river.
10389 </p>
10390 !!end
10393 !! test
10394 Link to pages in language variants
10395 !! options
10396 language=sr
10397 !! input
10398 Main Page can be written as [[Маин Паге]]
10399 !! result
10400 <p>Main Page can be written as <a href="/wiki/Main_Page" title="Main Page">Маин Паге</a>
10401 </p>
10402 !!end
10405 !! test
10406 Multiple links to pages in language variants
10407 !! options
10408 language=sr
10409 !! input
10410 [[Main Page]] can be written as [[Маин Паге]] same as [[Маин Паге]].
10411 !! result
10412 <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>.
10413 </p>
10414 !!end
10417 !! test
10418 Simple template in language variants
10419 !! options
10420 language=sr
10421 !! input
10422 {{тест}}
10423 !! result
10424 <p>This is a test template
10425 </p>
10426 !! end
10429 !! test
10430 Template with explicit namespace in language variants
10431 !! options
10432 language=sr
10433 !! input
10434 {{Template:тест}}
10435 !! result
10436 <p>This is a test template
10437 </p>
10438 !! end
10441 !! test
10442 Basic test for template parameter in language variants
10443 !! options
10444 language=sr
10445 !! input
10446 {{парамтест|param=foo}}
10447 !! result
10448 <p>This is a test template with parameter foo
10449 </p>
10450 !! end
10453 !! test
10454 Simple category in language variants
10455 !! options
10456 language=sr cat
10457 !! input
10458 [[Category:МедиаWики Усер'с Гуиде]]
10459 !! result
10460 <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>
10461 !! end
10464 !! test
10465 Stripping -{}- tags (language variants)
10466 !! options
10467 language=sr
10468 !! input
10469 Latin proverb: -{Ne nuntium necare}-
10470 !! result
10471 <p>Latin proverb: Ne nuntium necare
10472 </p>
10473 !! end
10476 !! test
10477 Prevent conversion with -{}- tags (language variants)
10478 !! options
10479 language=sr variant=sr-ec
10480 !! input
10481 Latinski: -{Ne nuntium necare}-
10482 !! result
10483 <p>Латински: Ne nuntium necare
10484 </p>
10485 !! end
10488 !! test
10489 Prevent conversion of text with -{}- tags (language variants)
10490 !! options
10491 language=sr variant=sr-ec
10492 !! input
10493 Latinski: -{Ne nuntium necare}-
10494 !! result
10495 <p>Латински: Ne nuntium necare
10496 </p>
10497 !! end
10500 !! test
10501 Prevent conversion of links with -{}- tags (language variants)
10502 !! options
10503 language=sr variant=sr-ec
10504 !! input
10505 -{[[Main Page]]}-
10506 !! result
10507 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
10508 </p>
10509 !! end
10512 !! test
10513 -{}- tags within headlines (within html for parserConvert())
10514 !! options
10515 language=sr variant=sr-ec
10516 !! input
10517 == -{Naslov}- ==
10518 !! result
10519 <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>
10521 !! end
10524 !! test
10525 Explicit definition of language variant alternatives
10526 !! options
10527 language=zh variant=zh-tw
10528 !! input
10529 -{zh:China;zh-tw:Taiwan}-, not China
10530 !! result
10531 <p>Taiwan, not China
10532 </p>
10533 !! end
10536 !! test
10537 Explicit session-wise language variant mapping (A flag and - flag)
10538 !! options
10539 language=zh variant=zh-tw
10540 !! input
10541 Taiwan is not China.
10542 But -{A|zh:China;zh-tw:Taiwan}- is China,
10543 (This-{-|zh:China;zh-tw:Taiwan}- should be stripped!)
10544 and -{China}- is China.
10545 !! result
10546 <p>Taiwan is not China.
10547 But Taiwan is Taiwan,
10548 (This should be stripped!)
10549 and China is China.
10550 </p>
10551 !! end
10553 !! test
10554 Explicit session-wise language variant mapping (H flag for hide)
10555 !! options
10556 language=zh variant=zh-tw
10557 !! input
10558 (This-{H|zh:China;zh-tw:Taiwan}- should be stripped!)
10559 Taiwan is China.
10560 !! result
10561 <p>(This should be stripped!)
10562 Taiwan is Taiwan.
10563 </p>
10564 !! end
10566 !! test
10567 Adding explicit conversion rule for title (T flag)
10568 !! options
10569 language=zh variant=zh-tw showtitle
10570 !! input
10571 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
10572 !! result
10573 Taiwan
10574 <p>Should be stripped!
10575 </p>
10576 !! end
10578 !! test
10579 Testing that changing the language variant here in the tests actually works
10580 !! options
10581 language=zh variant=zh showtitle
10582 !! input
10583 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
10584 !! result
10585 China
10586 <p>Should be stripped!
10587 </p>
10588 !! end
10590 !! test
10591 Bug 24072: more test on conversion rule for title
10592 !! options
10593 language=zh variant=zh-tw showtitle
10594 !! input
10595 This should be stripped-{T|zh:China;zh-tw:Taiwan}-!
10596 This won't take interferes with the title rule-{H|zh:Beijing;zh-tw:Taipei}-.
10597 !! result
10598 Taiwan
10599 <p>This should be stripped!
10600 This won't take interferes with the title rule.
10601 </p>
10602 !! end
10604 !! test
10605 Raw output of variant escape tags (R flag)
10606 !! options
10607 language=zh variant=zh-tw
10608 !! input
10609 Raw: -{R|zh:China;zh-tw:Taiwan}-
10610 !! result
10611 <p>Raw: zh:China;zh-tw:Taiwan
10612 </p>
10613 !! end
10615 !! test
10616 Nested using of manual convert syntax
10617 !! options
10618 language=zh variant=zh-hk
10619 !! input
10620 Nested: -{zh-hans:Hi -{zh-cn:China;zh-sg:Singapore;}-;zh-hant:Hello -{zh-tw:Taiwan;zh-hk:H-{ong}- K-{}-ong;}-;}-!
10621 !! result
10622 <p>Nested: Hello Hong Kong!
10623 </p>
10624 !! end
10626 !! test
10627 Do not convert roman numbers to language variants
10628 !! options
10629 language=sr variant=sr-ec
10630 !! input
10631 Fridrih IV je car.
10632 !! result
10633 <p>Фридрих IV је цар.
10634 </p>
10635 !! end
10637 !! test
10638 Unclosed language converter markup "-{"
10639 !! options
10640 language=sr
10641 !! input
10642 -{T|hello
10643 !! result
10644 <p>-{T|hello
10645 </p>
10646 !! end
10648 !! test
10649 Don't convert raw rule "-{R|=&gt;}-" to "=>"
10650 !! options
10651 language=sr
10652 !! input
10653 -{R|=&gt;}-
10654 !! result
10655 <p>=&gt;
10656 </p>
10657 !!end
10659 !!article
10660 Template:Bullet
10661 !!text
10662 * Bar
10663 !!endarticle
10665 !! test
10666 Bug 529: Uncovered bullet
10667 !! input
10668 * Foo {{bullet}}
10669 !! result
10670 <ul><li> Foo 
10671 </li><li> Bar
10672 </li></ul>
10674 !! end
10676 # Plain MediaWiki does not remove empty lists, but tidy actually does.
10677 # Templates in Wikipedia rely on this behavior, as tidy has always been
10678 # enabled there. These tests are normally run *without* tidy, so specify the
10679 # full output here. 
10680 # To test realistic parsing behavior, apply a tidy-like transformation to both
10681 # the expected output and your parser's output.
10682 !! test
10683 Bug 529: Uncovered bullet leaving empty list, normally removed by tidy
10684 !! input
10685 ******* Foo {{bullet}}
10686 !! result
10687 <ul><li><ul><li><ul><li><ul><li><ul><li><ul><li><ul><li> Foo 
10688 </li></ul>
10689 </li></ul>
10690 </li></ul>
10691 </li></ul>
10692 </li></ul>
10693 </li></ul>
10694 </li><li> Bar
10695 </li></ul>
10697 !! end
10699 !! test
10700 Bug 529: Uncovered table already at line-start
10701 !! input
10704 {{table}}
10706 !! result
10707 <p>x
10708 </p>
10709 <table>
10710 <tr>
10711 <td> 1 </td>
10712 <td> 2
10713 </td></tr>
10714 <tr>
10715 <td> 3 </td>
10716 <td> 4
10717 </td></tr></table>
10718 <p>y
10719 </p>
10720 !! end
10722 !! test
10723 Bug 529: Uncovered bullet in parser function result
10724 !! input
10725 * Foo {{lc:{{bullet}} }}
10726 !! result
10727 <ul><li> Foo 
10728 </li><li> bar
10729 </li></ul>
10731 !! end
10733 !! test
10734 Bug 5678: Double-parsed template argument
10735 !! input
10736 {{lc:{{{1}}}|hello}}
10737 !! result
10738 <p>{{{1}}}
10739 </p>
10740 !! end
10742 !! test
10743 Bug 5678: Double-parsed template invocation
10744 !! input
10745 {{lc:{{paramtest {{!}} param = hello }} }}
10746 !! result
10747 <p>{{paramtest | param = hello }}
10748 </p>
10749 !! end
10751 !! test
10752 Case insensitivity of parser functions for non-ASCII characters (bug 8143)
10753 !! options
10754 language=cs
10755 title=[[Main Page]]
10756 !! input
10757 {{PRVNÍVELKÉ:ěščř}}
10758 {{prvnívelké:ěščř}}
10759 {{PRVNÍMALÉ:ěščř}}
10760 {{prvnímalé:ěščř}}
10761 {{MALÁ:ěščř}}
10762 {{malá:ěščř}}
10763 {{VELKÁ:ěščř}}
10764 {{velká:ěščř}}
10765 !! result
10766 <p>Ěščř
10767 Ěščř
10768 ěščř
10769 ěščř
10770 ěščř
10771 ěščř
10772 ĚŠČŘ
10773 ĚŠČŘ
10774 </p>
10775 !! end
10777 !! test
10778 Morwen/13: Unclosed link followed by heading
10779 !! input
10780 [[link
10781 ==heading==
10782 !! result
10783 <p>[[link
10784 </p>
10785 <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>
10787 !! end
10789 !! test
10790 HHP2.1: Heuristics for headings in preprocessor parenthetical structures
10791 !! input
10792 {{foo|
10793 =heading=
10794 !! result
10795 <p>{{foo|
10796 </p>
10797 <h1> <span class="mw-headline" id="heading">heading</span></h1>
10799 !! end
10801 !! test
10802 HHP2.2: Heuristics for headings in preprocessor parenthetical structures
10803 !! input
10804 {{foo|
10805 ==heading==
10806 !! result
10807 <p>{{foo|
10808 </p>
10809 <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>
10811 !! end
10813 !! test
10814 Tildes in comments
10815 !! options
10817 !! input
10818 <!-- ~~~~ -->
10819 !! result
10820 <!-- ~~~~ -->
10821 !! end
10823 !! test
10824 Paragraphs inside divs (no extra line breaks)
10825 !! input
10826 <div>Line one
10828 Line two</div>
10829 !! result
10830 <div>Line one
10831 Line two</div>
10833 !! end
10835 !! test
10836 Paragraphs inside divs (extra line break on open)
10837 !! input
10838 <div>
10839 Line one
10841 Line two</div>
10842 !! result
10843 <div>
10844 <p>Line one
10845 </p>
10846 Line two</div>
10848 !! end
10850 !! test
10851 Paragraphs inside divs (extra line break on close)
10852 !! input
10853 <div>Line one
10855 Line two
10856 </div>
10857 !! result
10858 <div>Line one
10859 <p>Line two
10860 </p>
10861 </div>
10863 !! end
10865 !! test
10866 Paragraphs inside divs (extra line break on open and close)
10867 !! input
10868 <div>
10869 Line one
10871 Line two
10872 </div>
10873 !! result
10874 <div>
10875 <p>Line one
10876 </p><p>Line two
10877 </p>
10878 </div>
10880 !! end
10882 !! test
10883 Nesting tags, paragraphs on lines which begin with <div>
10884 !! options
10885 disabled
10886 !! input
10887 <div></div><strong>A
10888 B</strong>
10889 !! result
10890 <div></div>
10891 <p><strong>A
10892 B</strong>
10893 </p>
10894 !! end
10896 # Bug 6200: <blockquote> should behave like <div> with respect to line breaks
10897 !! test
10898 Bug 6200: paragraphs inside blockquotes (no extra line breaks)
10899 !! options
10900 disabled
10901 !! input
10902 <blockquote>Line one
10904 Line two</blockquote>
10905 !! result
10906 <blockquote>Line one
10907 Line two</blockquote>
10909 !! end
10911 !! test
10912 Bug 6200: paragraphs inside blockquotes (extra line break on open)
10913 !! options
10914 disabled
10915 !! input
10916 <blockquote>
10917 Line one
10919 Line two</blockquote>
10920 !! result
10921 <blockquote>
10922 <p>Line one
10923 </p>
10924 Line two</blockquote>
10926 !! end
10928 !! test
10929 Bug 6200: paragraphs inside blockquotes (extra line break on close)
10930 !! options
10931 disabled
10932 !! input
10933 <blockquote>Line one
10935 Line two
10936 </blockquote>
10937 !! result
10938 <blockquote>Line one
10939 <p>Line two
10940 </p>
10941 </blockquote>
10943 !! end
10945 !! test
10946 Bug 6200: paragraphs inside blockquotes (extra line break on open and close)
10947 !! options
10948 disabled
10949 !! input
10950 <blockquote>
10951 Line one
10953 Line two
10954 </blockquote>
10955 !! result
10956 <blockquote>
10957 <p>Line one
10958 </p><p>Line two
10959 </p>
10960 </blockquote>
10962 !! end
10964 !! test
10965 Paragraphs inside blockquotes/divs (no extra line breaks)
10966 !! input
10967 <blockquote><div>Line one
10969 Line two</div></blockquote>
10970 !! result
10971 <blockquote><div>Line one
10972 Line two</div></blockquote>
10974 !! end
10976 !! test
10977 Paragraphs inside blockquotes/divs (extra line break on open)
10978 !! input
10979 <blockquote><div>
10980 Line one
10982 Line two</div></blockquote>
10983 !! result
10984 <blockquote><div>
10985 <p>Line one
10986 </p>
10987 Line two</div></blockquote>
10989 !! end
10991 !! test
10992 Paragraphs inside blockquotes/divs (extra line break on close)
10993 !! input
10994 <blockquote><div>Line one
10996 Line two
10997 </div></blockquote>
10998 !! result
10999 <blockquote><div>Line one
11000 <p>Line two
11001 </p>
11002 </div></blockquote>
11004 !! end
11006 !! test
11007 Paragraphs inside blockquotes/divs (extra line break on open and close)
11008 !! input
11009 <blockquote><div>
11010 Line one
11012 Line two
11013 </div></blockquote>
11014 !! result
11015 <blockquote><div>
11016 <p>Line one
11017 </p><p>Line two
11018 </p>
11019 </div></blockquote>
11021 !! end
11023 !! test
11024 Interwiki links trounced by replaceExternalLinks after early LinkHolderArray expansion
11025 !! options
11026 wgLinkHolderBatchSize=0
11027 !! input
11028 [[meatball:1]]
11029 [[meatball:2]]
11030 [[meatball:3]]
11031 !! result
11032 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?1" class="extiw" title="meatball:1">meatball:1</a>
11033 <a href="http://www.usemod.com/cgi-bin/mb.pl?2" class="extiw" title="meatball:2">meatball:2</a>
11034 <a href="http://www.usemod.com/cgi-bin/mb.pl?3" class="extiw" title="meatball:3">meatball:3</a>
11035 </p>
11036 !! end
11038 !! test
11039 Free external link invading image caption
11040 !! input
11041 [[Image:Foobar.jpg|thumb|http://x|hello]]
11042 !! result
11043 <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/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></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>
11045 !! end
11047 !! test
11048 Bug 15196: localised external link numbers
11049 !! options
11050 language=fa
11051 !! input
11052 [http://en.wikipedia.org/]
11053 !! result
11054 <p><a rel="nofollow" class="external autonumber" href="http://en.wikipedia.org/">[۱]</a>
11055 </p>
11056 !! end
11058 !! test
11059 Multibyte character in padleft
11060 !! input
11061 {{padleft:-Hello|7|Æ}}
11062 !! result
11063 <p>Æ-Hello
11064 </p>
11065 !! end
11067 !! test
11068 Multibyte character in padright
11069 !! input
11070 {{padright:Hello-|7|Æ}}
11071 !! result
11072 <p>Hello-Æ
11073 </p>
11074 !! end
11076 !! test
11077 Formatted date
11078 !! config
11079 wgUseDynamicDates=1
11080 !! input
11081 [[2009-03-24]]
11082 !! result
11083 <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>
11084 </p>
11085 !!end
11087 !!test
11088 formatdate parser function
11089 !!input
11090 {{#formatdate:2009-03-24}}
11091 !! result
11092 <p><span class="mw-formatted-date" title="2009-03-24">2009-03-24</span>
11093 </p>
11094 !! end
11096 !!test
11097 formatdate parser function, with default format
11098 !!input
11099 {{#formatdate:2009-03-24|mdy}}
11100 !! result
11101 <p><span class="mw-formatted-date" title="2009-03-24">March 24, 2009</span>
11102 </p>
11103 !! end
11105 !! test
11106 Linked date with autoformatting disabled
11107 !! config
11108 wgUseDynamicDates=false
11109 !! input
11110 [[2009-03-24]]
11111 !! result
11112 <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>
11113 </p>
11114 !! end
11116 !! test
11117 Spacing of numbers in formatted dates
11118 !! input
11119 {{#formatdate:January 15}}
11120 !! result
11121 <p><span class="mw-formatted-date" title="01-15">January 15</span>
11122 </p>
11123 !! end
11125 !! test
11126 Spacing of numbers in formatted dates (linked)
11127 !! config
11128 wgUseDynamicDates=true
11129 !! input
11130 [[January 15]]
11131 !! result
11132 <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>
11133 </p>
11134 !! end
11136 !! test
11137 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
11138 !! options
11139 language=nl title=[[MediaWiki:Common.css]]
11140 !! input
11141 {{#formatdate:2009-03-24|dmy}}
11142 !! result
11143 <p><span class="mw-formatted-date" title="2009-03-24">24 March 2009</span>
11144 </p>
11145 !! end
11152 # Edit comments
11155 !! test
11156 Edit comment with link
11157 !! options
11158 comment
11159 !! input
11160 I like the [[Main Page]] a lot
11161 !! result
11162 I like the <a href="/wiki/Main_Page" title="Main Page">Main Page</a> a lot
11163 !!end
11165 !! test
11166 Edit comment with link and link text
11167 !! options
11168 comment
11169 !! input
11170 I like the [[Main Page|best pages]] a lot
11171 !! result
11172 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
11173 !!end
11175 !! test
11176 Edit comment with link and link text with suffix
11177 !! options
11178 comment
11179 !! input
11180 I like the [[Main Page|best page]]s a lot
11181 !! result
11182 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
11183 !!end
11185 !! test
11186 Edit comment with section link (non-local, eg in history list)
11187 !! options
11188 comment title=[[Main Page]]
11189 !! input
11190 /* External links */ removed bogus entries
11191 !! result
11192 <a href="/wiki/Main_Page#External_links" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
11193 !!end
11195 !! test
11196 Edit comment with section link and text before it (non-local, eg in history list)
11197 !! options
11198 comment title=[[Main Page]]
11199 !! input
11200 pre-comment text /* External links */ removed bogus entries
11201 !! result
11202 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>
11203 !!end
11205 !! test
11206 Edit comment with section link (local, eg in diff view)
11207 !! options
11208 comment local title=[[Main Page]]
11209 !! input
11210 /* External links */ removed bogus entries
11211 !! result
11212 <a href="#External_links">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
11213 !!end
11215 !! test
11216 Edit comment with subpage link (bug 14080)
11217 !! options
11218 comment
11219 subpage
11220 title=[[Subpage test]]
11221 !! input
11222 Poked at a [[/subpage]] here...
11223 !! result
11224 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a> here...
11225 !!end
11227 !! test
11228 Edit comment with subpage link and link text (bug 14080)
11229 !! options
11230 comment
11231 subpage
11232 title=[[Subpage test]]
11233 !! input
11234 Poked at a [[/subpage|neat little page]] here...
11235 !! result
11236 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">neat little page</a> here...
11237 !!end
11239 !! test
11240 Edit comment with bogus subpage link in non-subpage NS (bug 14080)
11241 !! options
11242 comment
11243 title=[[Subpage test]]
11244 !! input
11245 Poked at a [[/subpage]] here...
11246 !! result
11247 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...
11248 !!end
11250 !! test
11251 Edit comment with bare anchor link (local, as on diff)
11252 !! options
11253 comment
11254 local
11255 title=[[Main Page]]
11256 !!input
11257 [[#section]]
11258 !! result
11259 <a href="#section">#section</a>
11260 !! end
11262 !! test
11263 Edit comment with bare anchor link (non-local, as on history)
11264 !! options
11265 comment
11266 title=[[Main Page]]
11267 !!input
11268 [[#section]]
11269 !! result
11270 <a href="/wiki/Main_Page#section" title="Main Page">#section</a>
11271 !! end
11273 !! test
11274 Anchor starting with underscore
11275 !!input
11276 [[#_ref|One]]
11277 !! result
11278 <p><a href="#_ref">One</a>
11279 </p>
11280 !! end
11282 !! test
11283 Id starting with underscore
11284 !!input
11285 <div id="_ref"></div>
11286 !! result
11287 <div id="_ref"></div>
11289 !! end
11291 !! test
11292 Space normalisation on autocomment (bug 22784)
11293 !! options
11294 comment
11295 title=[[Main Page]]
11296 !!input
11297 /* __hello__world__ */
11298 !! result
11299 <a href="/wiki/Main_Page#hello_world" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">__hello__world__</span></span>
11300 !! end
11302 !! test
11303 percent-encoding and + signs in comments (Bug 26410)
11304 !! options
11305 comment
11306 !!input
11307 [[ABC%33D% ++]] [[ABC%33D% ++|+%20]]
11308 !! result
11309 <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>
11310 !! end
11312 !! test
11313 Bad images - basic functionality
11314 !! options
11315 disabled
11316 !! input
11317 [[File:Bad.jpg]]
11318 !! result
11319 !! end
11321 !! test
11322 Bad images - bug 16039: text after bad image disappears
11323 !! options
11324 disabled
11325 !! input
11326 Foo bar
11327 [[File:Bad.jpg]]
11328 Bar foo
11329 !! result
11330 <p>Foo bar
11331 </p><p>Bar foo
11332 </p>
11333 !! end
11335 !! test
11336 Verify that displaytitle works (bug #22501) no displaytitle
11337 !! options
11338 showtitle
11339 !! config
11340 wgAllowDisplayTitle=true
11341 wgRestrictDisplayTitle=false
11342 !! input
11343 this is not the the title
11344 !! result
11345 Parser test
11346 <p>this is not the the title
11347 </p>
11348 !! end
11350 !! test
11351 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=false
11352 !! options
11353 showtitle
11354 title=[[Screen]]
11355 !! config
11356 wgAllowDisplayTitle=true
11357 wgRestrictDisplayTitle=false
11358 !! input
11359 this is not the the title
11360 {{DISPLAYTITLE:whatever}}
11361 !! result
11362 whatever
11363 <p>this is not the the title
11364 </p>
11365 !! end
11367 !! test
11368 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true mismatch
11369 !! options
11370 showtitle
11371 title=[[Screen]]
11372 !! config
11373 wgAllowDisplayTitle=true
11374 wgRestrictDisplayTitle=true
11375 !! input
11376 this is not the the title
11377 {{DISPLAYTITLE:whatever}}
11378 !! result
11379 Screen
11380 <p>this is not the the title
11381 </p>
11382 !! end
11384 !! test
11385 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true matching
11386 !! options
11387 showtitle
11388 title=[[Screen]]
11389 !! config
11390 wgAllowDisplayTitle=true
11391 wgRestrictDisplayTitle=true
11392 !! input
11393 this is not the the title
11394 {{DISPLAYTITLE:screen}}
11395 !! result
11396 screen
11397 <p>this is not the the title
11398 </p>
11399 !! end
11401 !! test
11402 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false
11403 !! options
11404 showtitle
11405 title=[[Screen]]
11406 !! config
11407 wgAllowDisplayTitle=false
11408 !! input
11409 this is not the the title
11410 {{DISPLAYTITLE:screen}}
11411 !! result
11412 Screen
11413 <p>this is not the the title
11414 <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>
11415 </p>
11416 !! end
11418 !! test
11419 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false no DISPLAYTITLE
11420 !! options
11421 showtitle
11422 title=[[Screen]]
11423 !! config
11424 wgAllowDisplayTitle=false
11425 !! input
11426 this is not the the title
11427 !! result
11428 Screen
11429 <p>this is not the the title
11430 </p>
11431 !! end
11433 !! test
11434 preload: check <noinclude> and <includeonly>
11435 !! options
11436 preload
11437 !! input
11438 Hello <noinclude>cruel</noinclude><includeonly>kind</includeonly> world.
11439 !! result
11440 Hello kind world.
11441 !! end
11443 !! test
11444 preload: check <onlyinclude>
11445 !! options
11446 preload
11447 !! input
11448 Goodbye <onlyinclude>Hello world</onlyinclude>
11449 !! result
11450 Hello world
11451 !! end
11453 !! test
11454 preload: can pass tags through if we want to
11455 !! options
11456 preload
11457 !! input
11458 <includeonly><</includeonly>includeonly>Hello world<includeonly><</includeonly>/includeonly>
11459 !! result
11460 <includeonly>Hello world</includeonly>
11461 !! end
11463 !! test
11464 preload: check that it doesn't try to do tricks
11465 !! options
11466 preload
11467 !! input
11468 * <!-- Hello --> ''{{world}}'' {{<includeonly>subst:</includeonly>How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
11469 !! result
11470 * <!-- Hello --> ''{{world}}'' {{subst:How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
11471 !! end
11473 !! test
11474 Play a bit with r67090 and bug 3158
11475 !! options
11476 disabled
11477 !! input
11478 <div style="width:50% !important">&nbsp;</div>
11479 <div style="width:50%&nbsp;!important">&nbsp;</div>
11480 <div style="width:50%&#160;!important">&nbsp;</div>
11481 <div style="border : solid;">&nbsp;</div>
11482 !! result
11483 <div style="width:50% !important">&nbsp;</div>
11484 <div style="width:50% !important">&nbsp;</div>
11485 <div style="width:50% !important">&nbsp;</div>
11486 <div style="border&#160;: solid;">&nbsp;</div>
11488 !! end
11490 !! test
11491 HTML5 data attributes
11492 !! input
11493 <span data-foo="bar">Baz</span>
11494 <p data-abc-def_hij="">Quuz</p>
11495 !! result
11496 <p><span data-foo="bar">Baz</span>
11497 </p>
11498 <p data-abc-def_hij="">Quuz</p>
11500 !! end
11502 !! test
11503 percent-encoding and + signs in internal links (Bug 26410)
11504 !! input
11505 [[User:+%]] [[Page+title%]]
11506 [[%+]] [[%+|%20]] [[%+ ]] [[%+r]]
11507 [[%]] [[+]] [[image:%+abc%39|foo|[[bar]]]]
11508 [[%33%45]] [[%33%45+]]
11509 !! result
11510 <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>
11511 <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>
11512 <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>
11513 <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>
11514 </p>
11515 !! end
11517 !! test
11518 Special characters in embedded file links (bug 27679)
11519 !! input
11520 [[File:Contains & ampersand.jpg]]
11521 [[File:Does not exist.jpg|Title with & ampersand]]
11522 !! result
11523 <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>
11524 <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>
11525 </p>
11526 !! end
11529 !! test
11530 Confirm that 'apos' named character reference doesn't make it to output (not legal in HTML 4)
11531 !! input
11532 Text&apos;s been normalized?
11533 !! result
11534 <p>Text&#39;s been normalized?
11535 </p>
11536 !! end
11538 !! test
11539 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate free external links
11540 !! input
11541 http://www.example.org/ <-- U+3000 (vim: ^Vu3000)
11542 !! result
11543 <p><a rel="nofollow" class="external free" href="http://www.example.org/">http://www.example.org/</a> &lt;-- U+3000 (vim: ^Vu3000)
11544 </p>
11545 !! end
11547 !! test
11548 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate bracketed external links
11549 !! input
11550 [http://www.example.org/ ideograms]
11551 !! result
11552 <p><a rel="nofollow" class="external text" href="http://www.example.org/">ideograms</a>
11553 </p>
11554 !! end
11556 !! test
11557 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate external images links
11558 !! input
11559 http://www.example.org/pic.png <-- U+3000 (vim: ^Vu3000)
11560 !! result
11561 <p><img src="http://www.example.org/pic.png" alt="pic.png" /> &lt;-- U+3000 (vim: ^Vu3000)
11562 </p>
11563 !! end
11565 !! article
11566 Mediawiki:loop1
11567 !! text
11568 {{Identical|A}}
11569 !! endarticle
11571 !! article
11572 Mediawiki:loop2
11573 !! text
11574 {{Identical|B}}
11575 !! endarticle
11577 !! article
11578 Template:Identical
11579 !! text
11580 {{int:loop1}}
11581 {{int:loop2}}
11582 !! endarticle
11584 !! test
11585 Bug 31098 Template which includes system messages which includes the template
11586 !! input
11587 {{Identical}}
11588 !! result
11589 <p><span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
11590 <span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
11591 </p>
11592 !! end
11594 !! test
11595 Bug31490 Turkish: ucfirst 'blah'
11596 !! options
11597 language=tr
11598 !! input
11599 {{ucfirst:blah}}
11600 !! result
11601 <p>Blah
11602 </p>
11603 !! end
11605 !! test
11606 Bug31490 Turkish: ucfirst 'ix'
11607 !! options
11608 language=tr
11609 !! input
11610 {{ucfirst:ix}}
11611 !! result
11612 <p>İx
11613 </p>
11614 !! end
11616 !! test
11617 Bug31490 Turkish: lcfirst 'BLAH'
11618 !! options
11619 language=tr
11620 !! input
11621 {{lcfirst:BLAH}}
11622 !! result
11623 <p>bLAH
11624 </p>
11625 !! end
11627 !! test
11628 Bug31490 Turkish: ucfırst (with a dotless i)
11629 !! options
11630 language=tr
11631 !! input
11632 {{ucfırst:blah}}
11633 !! result
11634 <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>
11635 </p>
11636 !! end
11638 !! test
11639 Bug31490 ucfırst (with a dotless i) with English language
11640 !! options
11641 language=en
11642 !! input
11643 {{ucfırst:blah}}
11644 !! result
11645 <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>
11646 </p>
11647 !! end
11649 !! test
11650 Bug 26375: TOC with italics
11651 !! options
11652 title=[[Main Page]]
11653 !! input
11654 __TOC__
11655 == ''Lost'' episodes ==
11656 !! result
11657 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
11658 <ul>
11659 <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>
11660 </ul>
11661 </td></tr></table>
11662 <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>
11664 !! end
11666 !! test
11667 Bug 26375: TOC with bold
11668 !! options
11669 title=[[Main Page]]
11670 !! input
11671 __TOC__
11672 == '''should be bold''' then normal text ==
11673 !! result
11674 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
11675 <ul>
11676 <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>
11677 </ul>
11678 </td></tr></table>
11679 <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>
11681 !! end
11683 !! test
11684 Bug 33845: Headings become cursive in TOC when they contain an image
11685 !! options
11686 title=[[Main Page]]
11687 !! input
11688 __TOC__
11689 == Image [[Image:foobar.jpg]] ==
11690 !! result
11691 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
11692 <ul>
11693 <li class="toclevel-1 tocsection-1"><a href="#Image"><span class="tocnumber">1</span> <span class="toctext">Image</span></a></li>
11694 </ul>
11695 </td></tr></table>
11696 <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>
11698 !! end
11700 !! test
11701 Bug 33845 (2): Headings become bold in TOC when they contain a blockquote
11702 !! options
11703 title=[[Main Page]]
11704 !! input
11705 __TOC__
11706 == <blockquote>Quote</blockquote> ==
11707 !! result
11708 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
11709 <ul>
11710 <li class="toclevel-1 tocsection-1"><a href="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
11711 </ul>
11712 </td></tr></table>
11713 <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>
11715 !! end
11717 !! test
11718 Unclosed tags in TOC
11719 !! options
11720 title=[[Main Page]]
11721 !! input
11722 __TOC__
11723 == Proof: 2 < 3 ==
11724 <small>Hanc marginis exiguitas non caperet.</small>
11726 !! result
11727 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
11728 <ul>
11729 <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>
11730 </ul>
11731 </td></tr></table>
11732 <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>
11733 <p><small>Hanc marginis exiguitas non caperet.</small>
11735 </p>
11736 !! end
11738 !! test
11739 Multiple tags in TOC
11740 !! input
11741 __TOC__
11742 == <i>Foo</i> <b>Bar</b> ==
11744 == <i>Foo</i> <blockquote>Bar</blockquote> ==
11745 !! result
11746 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
11747 <ul>
11748 <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>
11749 <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>
11750 </ul>
11751 </td></tr></table>
11752 <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>
11753 <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>
11755 !! end
11757 !! test
11758 Tags with parameters in TOC
11759 !! input
11760 __TOC__
11761 == <sup class="in-h2">Hello</sup> ==
11763 == <sup class="a > b">Evilbye</sup> ==
11764 !! result
11765 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
11766 <ul>
11767 <li class="toclevel-1 tocsection-1"><a href="#Hello"><span class="tocnumber">1</span> <span class="toctext"><sup>Hello</sup></span></a></li>
11768 <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>
11769 </ul>
11770 </td></tr></table>
11771 <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>
11772 <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>
11774 !! end
11776 !! test
11777 span tags with directionality in TOC
11778 !! input
11779 __TOC__
11780 == <span dir="ltr">C++</span> ==
11782 == <span dir="rtl">זבנג!</span> ==
11784 == <span style="font-style: italic">The attributes on these span tags must be deleted from the TOC</span> ==
11786 == <span style="font-style: italic" dir="ltr">All attributes on these span tags must be deleted from the TOC</span> ==
11788 == <span dir="ltr" style="font-style: italic">Attributes after dir on these span tags must be deleted from the TOC</span> ==
11789 !! result
11790 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
11791 <ul>
11792 <li class="toclevel-1 tocsection-1"><a href="#C.2B.2B"><span class="tocnumber">1</span> <span class="toctext"><span dir="ltr">C++</span></span></a></li>
11793 <li class="toclevel-1 tocsection-2"><a href="#.D7.96.D7.91.D7.A0.D7.92.21"><span class="tocnumber">2</span> <span class="toctext"><span dir="rtl">זבנג!</span></span></a></li>
11794 <li class="toclevel-1 tocsection-3"><a href="#The_attributes_on_these_span_tags_must_be_deleted_from_the_TOC"><span class="tocnumber">3</span> <span class="toctext"><span>The attributes on these span tags must be deleted from the TOC</span></span></a></li>
11795 <li class="toclevel-1 tocsection-4"><a href="#All_attributes_on_these_span_tags_must_be_deleted_from_the_TOC"><span class="tocnumber">4</span> <span class="toctext"><span>All attributes on these span tags must be deleted from the TOC</span></span></a></li>
11796 <li class="toclevel-1 tocsection-5"><a href="#Attributes_after_dir_on_these_span_tags_must_be_deleted_from_the_TOC"><span class="tocnumber">5</span> <span class="toctext"><span dir="ltr">Attributes after dir on these span tags must be deleted from the TOC</span></span></a></li>
11797 </ul>
11798 </td></tr></table>
11799 <h2><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: C++">edit</a>]</span> <span class="mw-headline" id="C.2B.2B"> <span dir="ltr">C++</span> </span></h2>
11800 <h2><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=".D7.96.D7.91.D7.A0.D7.92.21"> <span dir="rtl">זבנג!</span> </span></h2>
11801 <h2><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=3" title="Edit section: The attributes on these span tags must be deleted from the TOC">edit</a>]</span> <span class="mw-headline" id="The_attributes_on_these_span_tags_must_be_deleted_from_the_TOC"> <span style="font-style: italic">The attributes on these span tags must be deleted from the TOC</span> </span></h2>
11802 <h2><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=4" title="Edit section: All attributes on these span tags must be deleted from the TOC">edit</a>]</span> <span class="mw-headline" id="All_attributes_on_these_span_tags_must_be_deleted_from_the_TOC"> <span style="font-style: italic" dir="ltr">All attributes on these span tags must be deleted from the TOC</span> </span></h2>
11803 <h2><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=5" title="Edit section: Attributes after dir on these span tags must be deleted from the TOC">edit</a>]</span> <span class="mw-headline" id="Attributes_after_dir_on_these_span_tags_must_be_deleted_from_the_TOC"> <span dir="ltr" style="font-style: italic">Attributes after dir on these span tags must be deleted from the TOC</span> </span></h2>
11805 !! end
11807 !! article
11808 MediaWiki:Bug32057
11809 !! text
11810 == {{int:headline_sample}} ==
11811 !! endarticle
11813 !! test
11814 Bug 32057: Title needed when expanding <h> nodes.
11815 !! options
11816 title=[[Main Page]]
11817 !! input
11818 {{int:Bug32057}}
11819 !! result
11820 <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>
11822 !! end
11824 !! test
11825 Strip marker in urlencode
11826 !! input
11827 {{urlencode:x<nowiki/>y}}
11828 {{urlencode:x<nowiki/>y|wiki}}
11829 {{urlencode:x<nowiki/>y|path}}
11830 !! result
11831 <p>xy
11834 </p>
11835 !! end
11837 !! test
11838 Strip marker in lc
11839 !! input
11840 {{lc:x<nowiki/>y}}
11841 !! result
11842 <p>xy
11843 </p>
11844 !! end
11846 !! test
11847 Strip marker in uc
11848 !! input
11849 {{uc:x<nowiki/>y}}
11850 !! result
11851 <p>XY
11852 </p>
11853 !! end
11855 !! test
11856 Strip marker in formatNum
11857 !! input
11858 {{formatnum:1<nowiki/>2}}
11859 {{formatnum:1<nowiki/>2|R}}
11860 !! result
11861 <p>12
11863 </p>
11864 !! end
11866 !! test
11867 Strip marker in grammar
11868 !! options
11869 language=fi
11870 !! input
11871 {{grammar:elative|foo<nowiki/>bar}}
11872 !! result
11873 <p>foobarista
11874 </p>
11875 !! end
11877 !! test
11878 Strip marker in padleft
11879 !! input
11880 {{padleft:|2|x<nowiki/>y}}
11881 !! result
11882 <p>xy
11883 </p>
11884 !! end
11886 !! test
11887 Strip marker in padright
11888 !! input
11889 {{padright:|2|x<nowiki/>y}}
11890 !! result
11891 <p>xy
11892 </p>
11893 !! end
11895 !! test
11896 Strip marker in anchorencode
11897 !! input
11898 {{anchorencode:x<nowiki/>y}}
11899 !! result
11900 <p>xy
11901 </p>
11902 !! end
11904 !! test
11905 nowiki inside link inside heading (bug 18295)
11906 !! input
11907 ==[[foo|x<nowiki>y</nowiki>z]]==
11908 !! result
11909 <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>
11911 !! end
11913 !! test
11914 new support for bdi element (bug 31817)
11915 !! input
11916 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
11917 !! result
11918 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
11920 !!end
11922 !! test
11923 Ignore pipe between table row attributes
11924 !! input
11926 | quux
11927 |- id=foo | style='color: red'
11928 | bar
11930 !! result
11931 <table>
11932 <tr>
11933 <td> quux
11934 </td></tr>
11935 <tr id="foo" style="color: red">
11936 <td> bar
11937 </td></tr></table>
11939 !! end
11941 !!test
11942 Gallery override link with WikiLink (bug 34852)
11943 !! input
11944 <gallery>
11945 File:foobar.jpg|caption|alt=galleryalt|link=InterWikiLink
11946 </gallery>
11947 !! result
11948 <ul class="gallery">
11949                 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
11950                         <div class="thumb" style="width: 150px;"><div style="margin:68px auto;"><a href="/wiki/InterWikiLink"><img alt="galleryalt" src="http://example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" width="120" height="14" /></a></div></div>
11951                         <div class="gallerytext">
11952 <p>caption
11953 </p>
11954                         </div>
11955                 </div></li>
11956 </ul>
11958 !! end
11960 !!test
11961 Gallery override link with absolute external link (bug 34852)
11962 !! input
11963 <gallery>
11964 File:foobar.jpg|caption|alt=galleryalt|link=http://www.example.org
11965 </gallery>
11966 !! result
11967 <ul class="gallery">
11968                 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
11969                         <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/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" width="120" height="14" /></a></div></div>
11970                         <div class="gallerytext">
11971 <p>caption
11972 </p>
11973                         </div>
11974                 </div></li>
11975 </ul>
11977 !! end
11979 !!test
11980 Gallery override link with malicious javascript (bug 34852)
11981 !! input
11982 <gallery>
11983 File:foobar.jpg|caption|alt=galleryalt|link=" onclick="alert('malicious javascript code!');
11984 </gallery>
11985 !! result
11986 <ul class="gallery">
11987                 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
11988                         <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/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" width="120" height="14" /></a></div></div>
11989                         <div class="gallerytext">
11990 <p>caption
11991 </p>
11992                         </div>
11993                 </div></li>
11994 </ul>
11996 !! end
11998 !!test
11999 Language parser function
12000 !! input
12001 {{#language:ar}}
12002 !! result
12003 <p>العربية
12004 </p>
12005 !! end
12007 !!test
12008 Padleft and padright as substr
12009 !! input
12010 {{padleft:|3|abcde}}
12011 {{padright:|3|abcde}}
12012 !! result
12013 <p>abc
12015 </p>
12016 !! end
12018 !!test
12019 Bug 34939 - Case insensitive link parsing ([HttP://])
12020 !! input
12021 [HttP://MediaWiki.Org/]
12022 !! result
12023 <p><a rel="nofollow" class="external autonumber" href="HttP://MediaWiki.Org/">[1]</a>
12024 </p>
12025 !! end
12027 !!test
12028 Bug 34939 - Case insensitive link parsing ([HttP:// title])
12029 !! input
12030 [HttP://MediaWiki.Org/ MediaWiki]
12031 !! result
12032 <p><a rel="nofollow" class="external text" href="HttP://MediaWiki.Org/">MediaWiki</a>
12033 </p>
12034 !! end
12036 !!test
12037 Bug 34939 - Case insensitive link parsing (HttP://)
12038 !! input
12039 HttP://MediaWiki.Org/
12040 !! result
12041 <p><a rel="nofollow" class="external free" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a>
12042 </p>
12043 !! end
12046 ### Parsoids-specific tests
12047 ### Parsoid-PHP parser incompatibilities
12049 !!test
12050 1. SOL-sensitive wikitext tokens as template-args
12051 !!options
12052 disabled
12053 !!input
12054 {{echo|*a}}
12055 {{echo|#a}}
12056 {{echo|:a}}
12057 !!result
12058 <p>*a
12061 </p>
12062 !!end
12064 #### The following section of tests are primarily to test
12065 #### wikitext escaping capabilities of Parsoid.
12066 #### A lot of the tests are disabled for the PHP parser either
12067 #### because of minor newline diffs or other reasons.
12068 #### As Parsoid serializer can handle newlines and other HTML
12069 #### more robustly, some of these tests might get reenabled
12070 #### for the PHP parser.
12072 #### --------------- Headings ---------------
12073 #### 0. Unnested
12074 #### 1. Nested inside html <h1>=foo=</h1>
12075 #### 2. Outside heading nest on a single line <h1>foo</h1>*bar
12076 #### 3. Nested inside html with wikitext split by html tags
12077 #### 4. No escape needed
12078 #### 5. Empty headings <h1></h1>
12079 #### 6. Heading chars in SOL context
12080 #### ----------------------------------------
12081 !! test
12082 Headings: 0. Unnested
12083 !! input
12084 <nowiki>=foo=</nowiki>
12086 <nowiki>=foo</nowiki>''a''=
12087 !! result
12088 <p>=foo=
12089 </p><p>=foo<i>a</i>=
12090 </p>
12091 !!end
12093 !! test
12094 Headings: 1. Nested inside html
12095 !! options
12096 disabled
12097 !! input
12098 =<nowiki>=foo=</nowiki>=
12099 ==<nowiki>=foo=</nowiki>==
12100 ===<nowiki>=foo=</nowiki>===
12101 ====<nowiki>=foo=</nowiki>====
12102 =====<nowiki>=foo=</nowiki>=====
12103 ======<nowiki>=foo=</nowiki>======
12104 !! result
12105 <h1>=foo=</h1>
12106 <h2>=foo=</h2>
12107 <h3>=foo=</h3>
12108 <h4>=foo=</h4>
12109 <h5>=foo=</h5>
12110 <h6>=foo=</h6>
12111 !!end
12113 !! test
12114 Headings: 2. Outside heading nest on a single line <h1>foo</h1>*bar
12115 !! options
12116 disabled
12117 !! input
12118 =foo=
12119 <nowiki>*bar</nowiki>
12120 =foo=
12121 =bar
12122 =foo=
12123 <nowiki>=bar=</nowiki>
12124 !! result
12125 <h1>foo</h1>*bar
12126 <h1>foo</h1>=bar
12127 <h1>foo</h1>=bar=
12128 !!end
12130 !! test
12131 Headings: 3. Nested inside html with wikitext split by html tags
12132 !! options
12133 disabled
12134 !! input
12135 =<nowiki>=</nowiki>'''bold'''foo==
12136 !! result
12137 <h1>=<b>bold</b>foo=</h1>
12138 !!end
12140 !! test
12141 Headings: 4. No escaping needed (testing just h1 and h2)
12142 !! options
12143 disabled
12144 !! input
12145 ==foo=
12146 =foo==
12147 ===foo==
12148 ==foo===
12149 =''=''foo==
12151 !! result
12152 <h1>=foo</h1>
12153 <h1>foo=</h1>
12154 <h2>=foo</h2>
12155 <h2>foo=</h2>
12156 <h1><i>=</i>foo=</h1>
12157 <h1>=</h1>
12158 !!end
12160 !! test
12161 Headings: 5. Empty headings
12162 !! options
12163 disabled
12164 !! input
12165 =<nowiki></nowiki>=
12166 ==<nowiki></nowiki>==
12167 ===<nowiki></nowiki>===
12168 ====<nowiki></nowiki>====
12169 =====<nowiki></nowiki>=====
12170 ======<nowiki></nowiki>======
12171 !! result
12172 <h1></h1>
12173 <h2></h2>
12174 <h3></h3>
12175 <h4></h4>
12176 <h5></h5>
12177 <h6></h6>
12178 !!end
12180 !! test
12181 Headings: 6. Heading chars in SOL context
12182 !! options
12183 disabled
12184 !! input
12185 <!--cmt--><nowiki>=h1=</nowiki>
12186 !! result
12187 <p><!--cmt-->=h1=
12188 </p>
12189 !!end
12191 #### --------------- Lists ---------------
12192 #### 0. Outside nests (*foo, etc.)
12193 #### 1. Nested inside html <ul><li>*foo</li></ul>
12194 #### 2. Inside definition lists
12195 #### 3. Only bullets at start should be escaped
12196 #### 4. No escapes needed
12197 #### 5. No unnecessary escapes
12198 #### 6. Escape bullets in SOL position
12199 #### 7. Escape bullets in a multi-line context
12200 #### ----------------------------------------
12202 !! test
12203 Lists: 0. Outside nests
12204 !! input
12205 <nowiki>*foo</nowiki>
12207 <nowiki>#foo</nowiki>
12208 !! result
12209 <p>*foo
12210 </p><p>#foo
12211 </p>
12212 !!end
12214 !! test
12215 Lists: 1. Nested inside html
12216 !! input
12217 *<nowiki>*foo</nowiki>
12219 *<nowiki>#foo</nowiki>
12221 *<nowiki>:foo</nowiki>
12223 *<nowiki>;foo</nowiki>
12225 #<nowiki>*foo</nowiki>
12227 #<nowiki>#foo</nowiki>
12229 #<nowiki>:foo</nowiki>
12231 #<nowiki>;foo</nowiki>
12232 !! result
12233 <ul><li>*foo
12234 </li></ul>
12235 <ul><li>#foo
12236 </li></ul>
12237 <ul><li>:foo
12238 </li></ul>
12239 <ul><li>;foo
12240 </li></ul>
12241 <ol><li>*foo
12242 </li></ol>
12243 <ol><li>#foo
12244 </li></ol>
12245 <ol><li>:foo
12246 </li></ol>
12247 <ol><li>;foo
12248 </li></ol>
12250 !!end
12252 !! test
12253 Lists: 2. Inside definition lists
12254 !! input
12255 ;<nowiki>;foo</nowiki>
12257 ;<nowiki>:foo</nowiki>
12259 ;<nowiki>:foo</nowiki>
12260 :bar
12262 :<nowiki>:foo</nowiki>
12263 !! result
12264 <dl><dt>;foo
12265 </dt></dl>
12266 <dl><dt>:foo
12267 </dt></dl>
12268 <dl><dt>:foo
12269 </dt><dd>bar
12270 </dd></dl>
12271 <dl><dd>:foo
12272 </dd></dl>
12274 !!end
12276 !! test
12277 Lists: 3. Only bullets at start of text should be escaped
12278 !! input
12279 *<nowiki>*foo*bar</nowiki>
12281 *<nowiki>*foo</nowiki>''it''*bar
12282 !! result
12283 <ul><li>*foo*bar
12284 </li></ul>
12285 <ul><li>*foo<i>it</i>*bar
12286 </li></ul>
12288 !!end
12290 !! test
12291 Lists: 4. No escapes needed
12292 !! options
12293 disabled
12294 !! input
12295 *foo*bar
12297 *''foo''*bar
12299 *[[Foo]]: bar
12300 !! result
12301 <ul><li>foo*bar
12302 </li></ul>
12303 <ul><li><i>foo</i>*bar
12304 </li></ul>
12305 <ul><li><a href="Foo" rel="mw:WikiLink">Foo</a>: bar
12306 </li></ul>
12307 !!end
12309 !! test
12310 Lists: 5. No unnecessary escapes
12311 !! input
12312 * bar <span><nowiki>[[foo]]</nowiki></span>
12314 *=bar <span><nowiki>[[foo]]</nowiki></span>
12316 *[[bar <span><nowiki>[[foo]]</nowiki></span>
12318 *<nowiki>]]bar </nowiki><span><nowiki>[[foo]]</nowiki></span>
12320 *=bar <span>foo]]</span>=
12321 !! result
12322 <ul><li> bar <span>[[foo]]</span>
12323 </li></ul>
12324 <ul><li>=bar <span>[[foo]]</span>
12325 </li></ul>
12326 <ul><li>[[bar <span>[[foo]]</span>
12327 </li></ul>
12328 <ul><li>]]bar <span>[[foo]]</span>
12329 </li></ul>
12330 <ul><li>=bar <span>foo]]</span>=
12331 </li></ul>
12333 !!end
12335 !! test
12336 Lists: 6. Escape bullets in SOL position
12337 !! options
12338 disabled
12339 !! input
12340 <!--cmt--><nowiki>*foo</nowiki>
12341 !! result
12342 <p><!--cmt-->*foo
12343 </p>
12344 !!end
12346 !! test
12347 Lists: 7. Escape bullets in a multi-line context
12348 !! input
12349 <nowiki>a
12350 *b</nowiki>
12351 !! result
12352 <p>a
12354 </p>
12355 !!end
12357 #### --------------- HRs ---------------
12358 #### 1. Single line
12359 #### -----------------------------------
12361 !! test
12362 HRs: 1. Single line
12363 !! options
12364 disabled
12365 !! input
12366 ----
12367 <nowiki>----</nowiki>
12368 ----
12369 <nowiki>=foo=</nowiki>
12370 ----
12371 <nowiki>*foo</nowiki>
12372 !! result
12373 <hr/>----
12374 <hr/>=foo=
12375 <hr/>*foo
12376 !! end
12378 #### --------------- Tables ---------------
12379 #### 1a. Simple example
12380 #### 1b. No escaping needed (!foo)
12381 #### 1c. No escaping needed (|foo)
12382 #### 1d. No escaping needed (|}foo)
12383 ####
12384 #### 2a. Nested in td (<td>foo|bar</td>)
12385 #### 2b. Nested in td (<td>foo||bar</td>)
12386 #### 2c. Nested in td -- no escaping needed(<td>foo!!bar</td>)
12387 ####
12388 #### 3a. Nested in th (<th>foo!bar</th>)
12389 #### 3b. Nested in th (<th>foo!!bar</th>)
12390 #### 3c. Nested in th -- no escaping needed(<th>foo||bar</th>)
12391 ####
12392 #### 4a. Escape -
12393 #### 4b. Escape +
12394 #### 4c. No escaping needed
12395 #### --------------------------------------
12397 !! test
12398 Tables: 1a. Simple example
12399 !! input
12400 <nowiki>{|
12401 |}</nowiki>
12402 !! result
12403 <p>{|
12405 </p>
12406 !! end
12408 !! test
12409 Tables: 1b. No escaping needed
12410 !! input
12411 !foo
12412 !! result
12413 <p>!foo
12414 </p>
12415 !! end
12417 !! test
12418 Tables: 1c. No escaping needed
12419 !! input
12420 |foo
12421 !! result
12422 <p>|foo
12423 </p>
12424 !! end
12426 !! test
12427 Tables: 1d. No escaping needed
12428 !! input
12429 |}foo
12430 !! result
12431 <p>|}foo
12432 </p>
12433 !! end
12435 !! test
12436 Tables: 2a. Nested in td
12437 !! options
12438 disabled
12439 !! input
12441 |<nowiki>foo|bar</nowiki>
12443 !! result
12444 <table>
12445 <tr><td>foo|bar
12446 </td></tr></table>
12448 !! end
12450 !! test
12451 Tables: 2b. Nested in td
12452 !! options
12453 disabled
12454 !! input
12456 |<nowiki>foo||bar</nowiki>
12457 |''it''<nowiki>foo||bar</nowiki>
12459 !! result
12460 <table>
12461 <tr><td>foo||bar
12462 </td><td><i>it</i>foo||bar
12463 </td></tr></table>
12465 !! end
12467 !! test
12468 Tables: 2c. Nested in td -- no escaping needed
12469 !! options
12470 disabled
12471 !! input
12473 |foo!!bar
12475 !! result
12476 <table>
12477 <tr><td>foo!!bar
12478 </td></tr></table>
12480 !! end
12482 !! test
12483 Tables: 3a. Nested in th
12484 !! options
12485 disabled
12486 !! input
12488 !foo!bar
12490 !! result
12491 <table>
12492 <tr><th>foo!bar
12493 </th></tr></table>
12495 !! end
12497 !! test
12498 Tables: 3b. Nested in th
12499 !! options
12500 disabled
12501 !! input
12503 !<nowiki>foo!!bar</nowiki>
12505 !! result
12506 <table>
12507 <tr><th>foo!!bar
12508 </th></tr></table>
12510 !! end
12512 !! test
12513 Tables: 3c. Nested in th -- no escaping needed
12514 !! options
12515 disabled
12516 !! input
12518 !foo||bar
12520 !! result
12521 <table>
12522 <tr><th>foo||bar
12523 </th></tr></table>
12525 !! end
12527 !! test
12528 Tables: 4a. Escape -
12529 !! options
12530 disabled
12531 !! input
12534 !-bar
12536 |<nowiki>-bar</nowiki>
12538 !! result
12539 <table><tbody>
12540 <tr><th>-bar</th></tr>
12541 <tr><td>-bar</td></tr>
12542 </tbody></table>
12543 !! end
12545 !! test
12546 Tables: 4b. Escape +
12547 !! options
12548 disabled
12549 !! input
12552 !+bar
12554 |<nowiki>+bar</nowiki>
12556 !! result
12557 <table><tbody>
12558 <tr><th>+bar</th></tr>
12559 <tr><td>+bar</td></tr>
12560 </tbody></table>
12561 !! end
12563 !! test
12564 Tables: 4c. No escaping needed
12565 !! options
12566 disabled
12567 !! input
12570 |foo-bar
12571 |foo+bar
12573 |''foo''-bar
12574 |''foo''+bar
12576 !! result
12577 <table><tbody>
12578 <tr><td>foo-bar</td><td>foo+bar</td></tr>
12579 <tr><td><i>foo</i>-bar</td><td><i>foo</i>+bar</td></tr>
12580 </tbody></table>
12581 !! end
12583 #### --------------- Links ---------------
12584 #### 1. Quote marks in link text
12585 #### 2. Wikilinks: Escapes needed
12586 #### 3. Wikilinks: No escapes needed
12587 #### 4. Extlinks: Escapes needed
12588 #### 5. Extlinks: No escapes needed
12589 #### --------------------------------------
12590 !! test
12591 Links 1. Quote marks in link text
12592 !! options
12593 disabled
12594 !! input
12595 [[Foo|<nowiki>Foo''boo''</nowiki>]]
12596 !! result
12597 <a rel="mw:WikiLink" href="Foo" data-parsoid="{&quot;tsr&quot;:[0,7],&quot;contentPos&quot;:[5,5],&quot;src&quot;:&quot;[[Foo]]&quot;,&quot;bsp&quot;:[0,7],&quot;stx&quot;:&quot;simple&quot;}">Foo''boo''</a>
12598 !! end
12600 !! test
12601 Links 2. WikiLinks: Escapes needed
12602 !! options
12603 disabled
12604 !! input
12605 [[Foo|<nowiki>[Foobar]</nowiki>]]
12606 [[Foo|<nowiki>Foobar]</nowiki>]]
12607 [[Foo|<nowiki>x [Foobar] x</nowiki>]]
12608 [[Foo|<nowiki>x [http://google.com g] x</nowiki>]]
12609 [[Foo|<nowiki>[[Bar]]</nowiki>]]
12610 [[Foo|<nowiki>x [[Bar]] x</nowiki>]]
12611 [[Foo|<nowiki>|Bar</nowiki>]]
12612 !! result
12613 <a href="Foo" rel="mw:WikiLink">[Foobar]</a>
12614 <a href="Foo" rel="mw:WikiLink">Foobar]</a>
12615 <a href="Foo" rel="mw:WikiLink">x [Foobar] x</a>
12616 <a href="Foo" rel="mw:WikiLink">x [http://google.com g] x</a>
12617 <a href="Foo" rel="mw:WikiLink">[[Bar]]</a>
12618 <a href="Foo" rel="mw:WikiLink">x [[Bar]] x</a>
12619 <a href="Foo" rel="mw:WikiLink">|Bar</a>
12620 !! end
12622 !! test
12623 Links 3. WikiLinks: No escapes needed
12624 !! options
12625 disabled
12626 !! input
12627 [[Foo|[Foobar]]
12628 [[Foo|foo|bar]]
12629 !! result
12630 <a href="Foo" rel="mw:WikiLink">[Foobar</a>
12631 <a href="Foo" rel="mw:WikiLink">foo|bar</a>
12632 !! end
12634 !! test
12635 Links 4. ExtLinks: Escapes needed
12636 !! options
12637 disabled
12638 !! input
12639 [http://google.com <nowiki>[google]</nowiki>]
12640 [http://google.com <nowiki>google]</nowiki>]
12641 !! result
12642 <a href="http://google.com" rel="mw:ExtLink">[google]</a>
12643 <a href="http://google.com" rel="mw:ExtLink">google]</a>
12644 !! end
12646 !! test
12647 Links 5. ExtLinks: No escapes needed
12648 !! options
12649 disabled
12650 !! input
12651 [http://google.com [google]
12652 !! result
12653 <a href="http://google.com" rel="mw:ExtLink">[google</a>
12654 !! end
12656 #### --------------- Quotes ---------------
12657 #### 1. Quotes inside <b> and <i>
12658 #### 2. Link fragments separated by <i> and <b> tags
12659 #### 3. Link fragments inside <i> and <b>
12660 #### --------------------------------------
12661 !! test
12662 1. Quotes inside <b> and <i>
12663 !! input
12664 ''<nowiki>'foo'</nowiki>''
12665 ''<nowiki>''foo''</nowiki>''
12666 ''<nowiki>'''foo'''</nowiki>''
12667 '''<nowiki>'foo'</nowiki>'''
12668 '''<nowiki>''foo''</nowiki>'''
12669 '''<nowiki>'''foo'''</nowiki>'''
12670 '''<nowiki>foo'</nowiki>''<nowiki>bar'</nowiki>''baz'''
12671 !! result
12672 <p><i>'foo'</i>
12673 <i>''foo''</i>
12674 <i>'''foo'''</i>
12675 <b>'foo'</b>
12676 <b>''foo''</b>
12677 <b>'''foo'''</b>
12678 <b>foo'<i>bar'</i>baz</b>
12679 </p>
12680 !! end
12682 !! test
12683 2. Link fragments separated by <i> and <b> tags
12684 !! input
12685 [[''foo''<nowiki>hello]]</nowiki>
12687 [['''foo'''<nowiki>hello]]</nowiki>
12688 !! result
12689 <p>[[<i>foo</i>hello]]
12690 </p><p>[[<b>foo</b>hello]]
12691 </p>
12692 !! end
12694 !! test
12695 2. Link fragments inside <i> and <b>
12696 (FIXME: Escaping one or both of [[ and ]] is also acceptable --
12697  this is one of the shortcomings of this format)
12698 !! input
12699 ''[[foo''<nowiki>]]</nowiki>
12701 '''[[foo'''<nowiki>]]</nowiki>
12702 !! result
12703 <p><i>[[foo</i>]]
12704 </p><p><b>[[foo</b>]]
12705 </p>
12706 !! end
12708 #### --------------- Paragraphs ---------------
12709 #### 1. No unnecessary escapes
12710 #### --------------------------------------
12712 !! test
12713 1. No unnecessary escapes
12714 !! input
12715 bar <span><nowiki>[[foo]]</nowiki></span>
12717 =bar <span><nowiki>[[foo]]</nowiki></span>
12719 [[bar <span><nowiki>[[foo]]</nowiki></span>
12721 <nowiki>]]bar </nowiki><span><nowiki>[[foo]]</nowiki></span>
12723 <nowiki>=bar </nowiki><span>foo]]</span>=
12724 !! result
12725 <p>bar <span>[[foo]]</span>
12726 </p><p>=bar <span>[[foo]]</span>
12727 </p><p>[[bar <span>[[foo]]</span>
12728 </p><p>]]bar <span>[[foo]]</span>
12729 </p><p>=bar <span>foo]]</span>=
12730 </p>
12731 !!end
12733 #### --------------- PRE ------------------
12734 #### 1. Leading space in SOL context should be escaped
12735 #### --------------------------------------
12736 !! test
12737 1. Leading space in SOL context should be escaped
12738 !! options
12739 disabled
12740 !! input
12741 <nowiki> foo</nowiki>
12742 <!--cmt--><nowiki> foo</nowiki>
12743 !! result
12744 <p> foo
12745 <!--cmt--> foo
12746 </p>
12747 !! end
12749 #### --------------- HTML tags ---------------
12750 #### 1. a tags
12751 #### 2. other tags
12752 #### 3. multi-line html tag
12753 #### --------------------------------------
12754 !! test
12755 1. a tags
12756 !! options
12757 disabled
12758 !! input
12759 <a href="http://google.com">google</a>
12760 !! result
12761 &lt;a href=&quot;http://google.com&quot;&gt;google&lt;/a&gt;
12762 !! end
12764 !! test
12765 2. other tags
12766 !! input
12767 <nowiki><div>foo</div>
12768 <div style="color:red">foo</div></nowiki>
12769 !! result
12770 <p>&lt;div&gt;foo&lt;/div&gt;
12771 &lt;div style=&quot;color:red&quot;&gt;foo&lt;/div&gt;
12772 </p>
12773 !! end
12775 !! test
12776 3. multi-line html tag
12777 !! input
12778 <nowiki><div
12779 >foo</div
12780 ></nowiki>
12781 !! result
12782 <p>&lt;div
12783 &gt;foo&lt;/div
12784 &gt;
12785 </p>
12786 !! end
12788 #### --------------- Others ---------------
12789 !! test
12790 Escaping nowikis
12791 !! input
12792 &lt;nowiki&gt;foo&lt;/nowiki&gt;
12793 !! result
12794 <p>&lt;nowiki&gt;foo&lt;/nowiki&gt;
12795 </p>
12796 !! end
12798 !! test
12799 Tag-like HTML structures are passed through as text
12800 !! input
12801 <x y>
12803 <x.y>
12805 <x-y>
12813 1<d e>f
12814 !! result
12815 <p>&lt;x y&gt;
12816 </p><p>&lt;x.y&gt;
12817 </p><p>&lt;x-y&gt;
12818 </p><p>1&gt;2
12819 </p><p>x&lt;y
12820 </p><p>a&gt;b
12821 </p><p>1&lt;d e&gt;f
12822 </p>
12823 !! end
12826 # This fails in the PHP parser (see bug 40670,
12827 # https://bugzilla.wikimedia.org/show_bug.cgi?id=40670), so disabled for it.
12828 !! test
12829 Tag names followed by punctuation should not be recognized as tags
12830 !! options
12831 disabled
12832 !! input
12833 <s.ome> text
12834 !! result
12835 <p>&lt;s.ome&gt text
12836 </p>
12837 !! end
12840 TODO:
12841 more images
12842 more tables
12843 character entities
12844 and much more
12845 Try for 100% code coverage