809e3d68226457f402969e149b2267cfa151a112
[lhc/web/wiklou.git] / tests / parser / parserTests.txt
1 # MediaWiki Parser test cases
2 # Some taken from http://meta.wikimedia.org/wiki/Parser_testing
3 # All (C) their respective authors and released under the GPL
4 #
5 # The syntax should be fairly self-explanatory.
6 #
7 # Currently supported test options:
8 # One of the following three:
9 #
10 # (default) generate HTML output
11 # pst apply pre-save transform
12 # msg apply message transform
13 #
14 # Plus any combination of these:
15 #
16 # cat add category links
17 # ill add inter-language links
18 # subpage enable subpages (disabled by default)
19 # noxml don't check for XML well formdness
20 # title=[[XXX]] run test using article title XXX
21 # language=XXX set content language to XXX for this test
22 # variant=XXX set the variant of language for this test (eg zh-tw)
23 # disabled do not run test
24 # parsoid parsoid-only test (not run by PHP parser)
25 # php php-only test (not run by the parsoid parser)
26 # showtitle make the first line the title
27 # comment run through Linker::formatComment() instead of main parser
28 # local format section links in edit comment text as local links
29 #
30 # For testing purposes, temporary articles can created:
31 # !!article / NAMESPACE:TITLE / !!text / ARTICLE TEXT / !!endarticle
32 # where '/' denotes a newline.
33
34 # This is the standard article assumed to exist.
35 !! article
36 Main Page
37 !! text
38 blah blah
39 !! endarticle
40
41 !!article
42 Template:Foo
43 !!text
44 FOO
45 !!endarticle
46
47 !! article
48 Template:Blank
49 !! text
50 !! endarticle
51
52 !! article
53 Template:pipe
54 !! text
55 |
56 !! endarticle
57
58 !!article
59 MediaWiki:bad image list
60 !!text
61 * [[File:Bad.jpg]] except [[Nasty page]]
62 !!endarticle
63
64 !! article
65 Template:inner list
66 !! text
67 * item 1
68 !! endarticle
69
70 !! article
71 Template:tbl-start
72 !! text
73 {|
74 !! endarticle
75
76 !! article
77 Template:tbl-end
78 !! text
79 |}
80 !! endarticle
81
82 !! article
83 Template:!
84 !! text
85 |
86 !! endarticle
87
88 !! article
89 Template:echo
90 !! text
91 {{{1}}}
92 !! endarticle
93
94 !! article
95 Template:echo_with_span
96 !! text
97 <span>{{{1}}}</span>
98 !! endarticle
99
100 !! article
101 Template:echo_with_div
102 !! text
103 <div>{{{1}}}</div>
104 !! endarticle
105
106 !! article
107 Template:attr_str
108 !! text
109 {{{1}}}="{{{2}}}"
110 !! endarticle
111
112 !! article
113 Template:table_attribs
114 !! text
115 <noinclude>
116 |</noinclude>style="color: red"| Foo
117 !! endarticle
118
119 !! article
120 A?b
121 !! text
122 Weirdo titles!
123 !! endarticle
124
125 ###
126 ### Basic tests
127 ###
128 !! test
129 Blank input
130 !! input
131 !! result
132 !! end
133
134
135 !! test
136 Simple paragraph
137 !! input
138 This is a simple paragraph.
139 !! result
140 <p>This is a simple paragraph.
141 </p>
142 !! end
143
144 !! test
145 Paragraphs with extra newline spacing
146 !! input
147 foo
148
149 bar
150
151
152 baz
153
154
155
156 booz
157 !! result
158 <p>foo
159 </p><p>bar
160 </p><p><br />
161 baz
162 </p><p><br />
163 </p><p>booz
164 </p>
165 !! end
166
167 !! test
168 Paragraphs with newline spacing with comment lines in between
169 !! input
170 ----
171 a
172 <!--foo-->
173 b
174 ----
175 a
176 <!--foo--><!--More than 1 comment disables stripping of this line!-->
177 b
178 ----
179 a
180 <!--foo-->
181
182 b
183 ----
184 a
185
186 <!--foo-->
187 b
188 ----
189 a
190 <!--foo-->
191
192
193 b
194 ----
195 a
196
197
198 <!--foo-->
199 b
200 ----
201 !! result
202 <hr />
203 <p>a
204 b
205 </p>
206 <hr />
207 <p>a
208 </p><p>b
209 </p>
210 <hr />
211 <p>a
212 </p><p>b
213 </p>
214 <hr />
215 <p>a
216 </p><p>b
217 </p>
218 <hr />
219 <p>a
220 </p><p><br />
221 b
222 </p>
223 <hr />
224 <p>a
225 </p><p><br />
226 b
227 </p>
228 <hr />
229
230 !! end
231
232 !! test
233 Paragraphs with newline spacing with non-empty white-space lines in between
234 !! input
235 ----
236 a
237
238 b
239 ----
240 a
241
242
243 b
244 ----
245 !! result
246 <hr />
247 <p>a
248 </p><p>b
249 </p>
250 <hr />
251 <p>a
252 </p><p><br />
253 b
254 </p>
255 <hr />
256
257 !! end
258
259 !! test
260 Paragraphs with newline spacing with non-empty mixed comment and white-space lines in between
261 !! input
262 ----
263 a
264 <!--foo-->
265 b
266 ----
267 a
268 <!--foo--><!--More than 1 comment disables stripping of this line!-->
269 b
270 ----
271 a
272
273 <!--foo-->
274 <!--bar-->
275 b
276 ----
277 a
278
279 <!--foo-->
280 <!--bar-->
281
282 b
283 ----
284 !! result
285 <hr />
286 <p>a
287 b
288 </p>
289 <hr />
290 <p>a
291 </p><p>b
292 </p>
293 <hr />
294 <p>a
295 </p><p>b
296 </p>
297 <hr />
298 <p>a
299 </p><p><br />
300 b
301 </p>
302 <hr />
303
304 !! end
305
306 !! test
307 Parsing an URL
308 !! input
309 http://fr.wikipedia.org/wiki/🍺
310 <!-- EasterEgg we love beer, better be able be able to link to it -->
311 !! result
312 <p><a rel="nofollow" class="external free" href="http://fr.wikipedia.org/wiki/🍺">http://fr.wikipedia.org/wiki/🍺</a>
313 </p>
314 !! end
315
316 !! test
317 Simple list
318 !! input
319 * Item 1
320 * Item 2
321 !! result
322 <ul><li> Item 1
323 </li><li> Item 2
324 </li></ul>
325
326 !! end
327
328 !! test
329 Italics and bold
330 !! input
331 * plain
332 * plain''italic''plain
333 * plain''italic''plain''italic''plain
334 * plain'''bold'''plain
335 * plain'''bold'''plain'''bold'''plain
336 * plain''italic''plain'''bold'''plain
337 * plain'''bold'''plain''italic''plain
338 * plain''italic'''bold-italic'''italic''plain
339 * plain'''bold''bold-italic''bold'''plain
340 * plain'''''bold-italic'''italic''plain
341 * plain'''''bold-italic''bold'''plain
342 * plain''italic'''bold-italic'''''plain
343 * plain'''bold''bold-italic'''''plain
344 * plain l'''italic''plain
345 * plain l''''bold''' plain
346 !! result
347 <ul><li> plain
348 </li><li> plain<i>italic</i>plain
349 </li><li> plain<i>italic</i>plain<i>italic</i>plain
350 </li><li> plain<b>bold</b>plain
351 </li><li> plain<b>bold</b>plain<b>bold</b>plain
352 </li><li> plain<i>italic</i>plain<b>bold</b>plain
353 </li><li> plain<b>bold</b>plain<i>italic</i>plain
354 </li><li> plain<i>italic<b>bold-italic</b>italic</i>plain
355 </li><li> plain<b>bold<i>bold-italic</i>bold</b>plain
356 </li><li> plain<i><b>bold-italic</b>italic</i>plain
357 </li><li> plain<b><i>bold-italic</i>bold</b>plain
358 </li><li> plain<i>italic<b>bold-italic</b></i>plain
359 </li><li> plain<b>bold<i>bold-italic</i></b>plain
360 </li><li> plain l'<i>italic</i>plain
361 </li><li> plain l'<b>bold</b> plain
362 </li></ul>
363
364 !! end
365
366 ###
367 ### 2-quote opening sequence tests
368 ###
369 !! test
370 Italics and bold: 2-quote opening sequence: (2,2)
371 !! input
372 ''foo''
373 !! result
374 <p><i>foo</i>
375 </p>
376 !!end
377
378
379 !! test
380 Italics and bold: 2-quote opening sequence: (2,3)
381 !! input
382 ''foo'''
383 !! result
384 <p><i>foo'</i>
385 </p>
386 !!end
387
388
389 !! test
390 Italics and bold: 2-quote opening sequence: (2,4)
391 !! input
392 ''foo''''
393 !! result
394 <p><i>foo''</i>
395 </p>
396 !!end
397
398
399 !! test
400 Italics and bold: 2-quote opening sequence: (2,5)
401 !! input
402 ''foo'''''
403 !! result
404 <p><i>foo</i>
405 </p>
406 !!end
407
408
409 ###
410 ### 3-quote opening sequence tests
411 ###
412
413 !! test
414 Italics and bold: 3-quote opening sequence: (3,2)
415 !! input
416 '''foo''
417 !! result
418 <p>'<i>foo</i>
419 </p>
420 !!end
421
422
423 !! test
424 Italics and bold: 3-quote opening sequence: (3,3)
425 !! input
426 '''foo'''
427 !! result
428 <p><b>foo</b>
429 </p>
430 !!end
431
432
433 !! test
434 Italics and bold: 3-quote opening sequence: (3,4)
435 !! input
436 '''foo''''
437 !! result
438 <p><b>foo'</b>
439 </p>
440 !!end
441
442
443 !! test
444 Italics and bold: 3-quote opening sequence: (3,5)
445 !! input
446 '''foo'''''
447 !! result
448 <p><b>foo</b>
449 </p>
450 !!end
451
452
453 ###
454 ### 4-quote opening sequence tests
455 ###
456
457 !! test
458 Italics and bold: 4-quote opening sequence: (4,2)
459 !! input
460 ''''foo''
461 !! result
462 <p>''<i>foo</i>
463 </p>
464 !!end
465
466
467 !! test
468 Italics and bold: 4-quote opening sequence: (4,3)
469 !! input
470 ''''foo'''
471 !! result
472 <p>'<b>foo</b>
473 </p>
474 !!end
475
476
477 !! test
478 Italics and bold: 4-quote opening sequence: (4,4)
479 !! input
480 ''''foo''''
481 !! result
482 <p>'<b>foo'</b>
483 </p>
484 !!end
485
486
487 !! test
488 Italics and bold: 4-quote opening sequence: (4,5)
489 !! input
490 ''''foo'''''
491 !! result
492 <p>'<b>foo</b>
493 </p>
494 !!end
495
496
497 ###
498 ### 5-quote opening sequence tests
499 ###
500
501 !! test
502 Italics and bold: 5-quote opening sequence: (5,2)
503 !! input
504 '''''foo''
505 !! result
506 <p><b><i>foo</i></b>
507 </p>
508 !!end
509
510
511 !! test
512 Italics and bold: 5-quote opening sequence: (5,3)
513 !! input
514 '''''foo'''
515 !! result
516 <p><i><b>foo</b></i>
517 </p>
518 !!end
519
520
521 !! test
522 Italics and bold: 5-quote opening sequence: (5,4)
523 !! input
524 '''''foo''''
525 !! result
526 <p><i><b>foo'</b></i>
527 </p>
528 !!end
529
530
531 !! test
532 Italics and bold: 5-quote opening sequence: (5,5)
533 !! input
534 '''''foo'''''
535 !! result
536 <p><i><b>foo</b></i>
537 </p>
538 !!end
539
540 ###
541 ### multiple quote sequences in a line
542 ###
543 !! test
544 Italics and bold: multiple quote sequences: (2,4,2)
545 !! input
546 ''foo''''bar''
547 !! result
548 <p><i>foo'<b>bar</b></i>
549 </p>
550 !!end
551
552
553 !! test
554 Italics and bold: multiple quote sequences: (2,4,3)
555 !! input
556 ''foo''''bar'''
557 !! result
558 <p><i>foo'<b>bar</b></i>
559 </p>
560 !!end
561
562
563 !! test
564 Italics and bold: multiple quote sequences: (2,4,4)
565 !! input
566 ''foo''''bar''''
567 !! result
568 <p><i>foo'<b>bar'</b></i>
569 </p>
570 !!end
571
572
573 !! test
574 Italics and bold: multiple quote sequences: (3,4,2)
575 !! input
576 '''foo''''bar''
577 !! result
578 <p><b>foo'</b>bar
579 </p>
580 !!end
581
582
583 !! test
584 Italics and bold: multiple quote sequences: (3,4,3)
585 !! input
586 '''foo''''bar'''
587 !! result
588 <p><b>foo'</b>bar
589 </p>
590 !!end
591
592 ###
593 ### other quote tests
594 ###
595 !! test
596 Italics and bold: other quote tests: (2,3,5)
597 !! input
598 ''this is about '''foo's family'''''
599 !! result
600 <p><i>this is about <b>foo's family</b></i>
601 </p>
602 !!end
603
604
605 !! test
606 Italics and bold: other quote tests: (2,(3,3),2)
607 !! input
608 ''this is about '''foo's''' family''
609 !! result
610 <p><i>this is about <b>foo's</b> family</i>
611 </p>
612 !!end
613
614
615 !! test
616 Italics and bold: other quote tests: (3,2,3,2)
617 !! input
618 '''this is about ''foo'''s family''
619 !! result
620 <p><b>this is about <i>foo</i></b><i>s family</i>
621 </p>
622 !!end
623
624
625 !! test
626 Italics and bold: other quote tests: (3,2,3,3)
627 !! input
628 '''this is about ''foo'''s family'''
629 !! result
630 <p>'<i>this is about </i>foo<b>s family</b>
631 </p>
632 !!end
633
634
635 !! test
636 Italics and bold: other quote tests: (3,(2,2),3)
637 !! input
638 '''this is about ''foo's'' family'''
639 !! result
640 <p><b>this is about <i>foo's</i> family</b>
641 </p>
642 !!end
643
644
645 !! test
646 Italicized possessive
647 !! input
648 The ''[[Main Page]]'''s talk page.
649 !! result
650 <p>The <i><a href="/wiki/Main_Page" title="Main Page">Main Page</a>'</i>s talk page.
651 </p>
652 !! end
653
654 ###
655 ### Non-html5 tags
656 ###
657
658 !! test
659 Non-html5 tags should be accepted
660 !! input
661 <center>''foo''</center>
662 <big>''foo''</big>
663 <font>''foo''</font>
664 <strike>''foo''</strike>
665 <tt>''foo''</tt>
666 !! result
667 <center><i>foo</i></center>
668 <p><big><i>foo</i></big>
669 <font><i>foo</i></font>
670 <strike><i>foo</i></strike>
671 <tt><i>foo</i></tt>
672 </p>
673 !! end
674
675 ###
676 ### <nowiki> test cases
677 ###
678
679 !! test
680 <nowiki> unordered list
681 !! input
682 <nowiki>* This is not an unordered list item.</nowiki>
683 !! result
684 <p>* This is not an unordered list item.
685 </p>
686 !! end
687
688 !! test
689 <nowiki> spacing
690 !! input
691 <nowiki>Lorem ipsum dolor
692
693 sed abit.
694 sed nullum.
695
696 :and a colon
697 </nowiki>
698 !! result
699 <p>Lorem ipsum dolor
700
701 sed abit.
702 sed nullum.
703
704 :and a colon
705
706 </p>
707 !! end
708
709 !! test
710 nowiki 3
711 !! input
712 :There is not nowiki.
713 :There is <nowiki>nowiki</nowiki>.
714
715 #There is not nowiki.
716 #There is <nowiki>nowiki</nowiki>.
717
718 *There is not nowiki.
719 *There is <nowiki>nowiki</nowiki>.
720 !! result
721 <dl><dd>There is not nowiki.
722 </dd><dd>There is nowiki.
723 </dd></dl>
724 <ol><li>There is not nowiki.
725 </li><li>There is nowiki.
726 </li></ol>
727 <ul><li>There is not nowiki.
728 </li><li>There is nowiki.
729 </li></ul>
730
731 !! end
732
733 !! test
734 Entities inside <nowiki>
735 !! input
736 <nowiki>&lt;</nowiki>
737 !! result
738 <p>&lt;
739 </p>
740 !! end
741
742
743 ###
744 ### Comments
745 ###
746 !! test
747 Comments and Indent-Pre
748 !! input
749 <!-- comment 1 --> asdf
750
751 <!-- comment 1 --> asdf
752 <!-- comment 2 -->
753
754 <!-- comment 1 --> asdf
755 <!-- comment 2 -->xyz
756
757 <!-- comment 1 --> asdf
758 <!-- comment 2 --> xyz
759 !! result
760 <pre>asdf
761 </pre>
762 <pre>asdf
763 </pre>
764 <pre>asdf
765 </pre>
766 <p>xyz
767 </p>
768 <pre>asdf
769 xyz
770 </pre>
771 !! end
772
773 !! test
774 Comment test 2a
775 !! input
776 asdf
777 <!-- comment 1 -->
778 jkl
779 !! result
780 <p>asdf
781 jkl
782 </p>
783 !! end
784
785 !! test
786 Comment test 2b
787 !! input
788 asdf
789 <!-- comment 1 -->
790
791 jkl
792 !! result
793 <p>asdf
794 </p><p>jkl
795 </p>
796 !! end
797
798 !! test
799 Comment test 3
800 !! input
801 asdf
802 <!-- comment 1 -->
803 <!-- comment 2 -->
804 jkl
805 !! result
806 <p>asdf
807 jkl
808 </p>
809 !! end
810
811 !! test
812 Comment test 4
813 !! input
814 asdf<!-- comment 1 -->jkl
815 !! result
816 <p>asdfjkl
817 </p>
818 !! end
819
820 !! test
821 Comment spacing
822 !! input
823 a
824 <!-- foo --> b <!-- bar -->
825 c
826 !! result
827 <p>a
828 </p>
829 <pre> b
830 </pre>
831 <p>c
832 </p>
833 !! end
834
835 !! test
836 Comment whitespace
837 !! input
838 <!-- returns a single newline, not nothing, since the newline after > is not stripped -->
839 !! result
840
841 !! end
842
843 !! test
844 Comment semantics and delimiters
845 !! input
846 <!-- --><!----><!-----><!------>
847 !! result
848
849 !! end
850
851 !! test
852 Comment semantics and delimiters, redux
853 !! input
854 <!-- In SGML every "foo" here would actually show up in the text -- foo -- bar
855 -- foo -- funky huh? ... -->
856 !! result
857
858 !! end
859
860 !! test
861 Comment semantics and delimiters: directors cut
862 !! input
863 <!-- ... However we like to keep things simple and somewhat XML-ish so we eat
864 everything starting with < followed by !-- until the first -- and > we see,
865 that wouldn't be valid XML however, since in XML -- has to terminate a comment
866 -->-->
867 !! result
868 <p>--&gt;
869 </p>
870 !! end
871
872 !! test
873 Comment semantics: nesting
874 !! input
875 <!--<!-- no, we're not going to do anything fancy here -->-->
876 !! result
877 <p>--&gt;
878 </p>
879 !! end
880
881 !! test
882 Comment semantics: unclosed comment at end
883 !! input
884 <!--This comment will run out to the end of the document
885 !! result
886
887 !! end
888
889 !! test
890 Comment in template title
891 !! input
892 {{f<!---->oo}}
893 !! result
894 <p>FOO
895 </p>
896 !! end
897
898 !! test
899 Comment on its own line post-expand
900 !! input
901 a
902 {{blank}}<!---->
903 b
904 !! result
905 <p>a
906 </p><p>b
907 </p>
908 !! end
909
910 !! test
911 Comment on its own line post-expand with non-significant whitespace
912 !! input
913 a
914 {{blank}} <!---->
915 b
916 !! result
917 <p>a
918 </p><p>b
919 </p>
920 !! end
921
922 ###
923 ### paragraph wraping tests
924 ###
925 !! test
926 No block tags
927 !! input
928 a
929
930 b
931 !! result
932 <p>a
933 </p><p>b
934 </p>
935 !! end
936 !! test
937 Block tag on one line
938 !! input
939 a <div>foo</div>
940
941 b
942 !! result
943 a <div>foo</div>
944 <p>b
945 </p>
946 !! end
947
948 !! test
949 Block tag on both lines
950 !! input
951 a <div>foo</div>
952
953 b <div>foo</div>
954 !! result
955 a <div>foo</div>
956 b <div>foo</div>
957
958 !! end
959
960 !! test
961 Multiple lines without block tags
962 !! input
963 <div>foo</div> a
964 b
965 c
966 d<!--foo--> e
967 x <div>foo</div> z
968 !! result
969 <div>foo</div> a
970 <p>b
971 c
972 d e
973 </p>
974 x <div>foo</div> z
975
976 !! end
977
978 !! test
979 Empty lines between lines with block tags
980 !! input
981 <div></div>
982
983
984 <div></div>a
985
986 b
987 <div>a</div>b
988
989 <div>b</div>d
990
991
992 <div>e</div>
993 !! result
994 <div></div>
995 <p><br />
996 </p>
997 <div></div>a
998 <p>b
999 </p>
1000 <div>a</div>b
1001 <div>b</div>d
1002 <p><br />
1003 </p>
1004 <div>e</div>
1005
1006 !! end
1007
1008 ###
1009 ### Preformatted text
1010 ###
1011 !! test
1012 Preformatted text
1013 !! input
1014 This is some
1015 Preformatted text
1016 With ''italic''
1017 And '''bold'''
1018 And a [[Main Page|link]]
1019 !! result
1020 <pre>This is some
1021 Preformatted text
1022 With <i>italic</i>
1023 And <b>bold</b>
1024 And a <a href="/wiki/Main_Page" title="Main Page">link</a>
1025 </pre>
1026 !! end
1027
1028 !! test
1029 Ident preformatting with inline content
1030 !! input
1031 a
1032 ''b''
1033 !! result
1034 <pre>a
1035 <i>b</i>
1036 </pre>
1037 !! end
1038
1039 !! test
1040 <pre> with <nowiki> inside (compatibility with 1.6 and earlier)
1041 !! input
1042 <pre><nowiki>
1043 <b>
1044 <cite>
1045 <em>
1046 </nowiki></pre>
1047 !! result
1048 <pre>
1049 &lt;b&gt;
1050 &lt;cite&gt;
1051 &lt;em&gt;
1052 </pre>
1053
1054 !! end
1055
1056 !! test
1057 Regression with preformatted in <center>
1058 !! input
1059 <center>
1060 Blah
1061 </center>
1062 !! result
1063 <center>
1064 <pre>Blah
1065 </pre>
1066 </center>
1067
1068 !! end
1069
1070 # Expected output in the following test is not really expected (there should be
1071 # <pre> in the output) -- it's only testing for well-formedness.
1072 !! test
1073 Bug 6200: Preformatted in <blockquote>
1074 !! input
1075 <blockquote>
1076 Blah
1077 </blockquote>
1078 !! result
1079 <blockquote>
1080 Blah
1081 </blockquote>
1082
1083 !! end
1084
1085 !! test
1086 <pre> with attributes (bug 3202)
1087 !! input
1088 <pre style="background: blue; color:white">Bluescreen of WikiDeath</pre>
1089 !! result
1090 <pre style="background: blue; color:white">Bluescreen of WikiDeath</pre>
1091
1092 !! end
1093
1094 !! test
1095 <pre> with width attribute (bug 3202)
1096 !! input
1097 <pre width="8">Narrow screen goodies</pre>
1098 !! result
1099 <pre width="8">Narrow screen goodies</pre>
1100
1101 !! end
1102
1103 !! test
1104 <pre> with forbidden attribute (bug 3202)
1105 !! input
1106 <pre width="8" onmouseover="alert(document.cookie)">Narrow screen goodies</pre>
1107 !! result
1108 <pre width="8">Narrow screen goodies</pre>
1109
1110 !! end
1111
1112 !! test
1113 Entities inside <pre>
1114 !! input
1115 <pre>&lt;</pre>
1116 !! result
1117 <pre>&lt;</pre>
1118
1119 !! end
1120
1121 !! test
1122 <pre> with forbidden attribute values (bug 3202)
1123 !! input
1124 <pre width="8" style="border-width: expression(alert(document.cookie))">Narrow screen goodies</pre>
1125 !! result
1126 <pre width="8" style="/* insecure input */">Narrow screen goodies</pre>
1127
1128 !! end
1129
1130 !! test
1131 <nowiki> inside <pre> (bug 13238)
1132 !! input
1133 <pre>
1134 <nowiki>
1135 </pre>
1136 <pre>
1137 <nowiki></nowiki>
1138 </pre>
1139 <pre><nowiki><nowiki></nowiki>Foo<nowiki></nowiki></nowiki></pre>
1140 !! result
1141 <pre>
1142 &lt;nowiki&gt;
1143 </pre>
1144 <pre>
1145
1146 </pre>
1147 <pre>&lt;nowiki&gt;Foo&lt;/nowiki&gt;</pre>
1148
1149 !! end
1150
1151 !! test
1152 <nowiki> and <pre> preference (first one wins)
1153 !! input
1154 <pre>
1155 <nowiki>
1156 </pre>
1157 </nowiki>
1158 </pre>
1159
1160 <nowiki>
1161 <pre>
1162 <nowiki>
1163 </pre>
1164 </nowiki>
1165 </pre>
1166
1167 !! result
1168 <pre>
1169 &lt;nowiki&gt;
1170 </pre>
1171 <p>&lt;/nowiki&gt;
1172 &lt;/pre&gt;
1173 </p><p>
1174 &lt;pre&gt;
1175 &lt;nowiki&gt;
1176 &lt;/pre&gt;
1177
1178 &lt;/pre&gt;
1179 </p>
1180 !! end
1181
1182 !! test
1183 </pre> inside nowiki
1184 !! input
1185 <nowiki></pre></nowiki>
1186 !! result
1187 <p>&lt;/pre&gt;
1188 </p>
1189 !! end
1190
1191 !!test
1192 Templates: Indent-Pre: 1a. Templates that break a line should suppress <pre>
1193 !!input
1194 {{echo|}}
1195 !!result
1196
1197 !!end
1198
1199 !!test
1200 Templates: Indent-Pre: 1b. Templates that break a line should suppress <pre>
1201 !!input
1202 {{echo|
1203 foo}}
1204 !!result
1205 <p>foo
1206 </p>
1207 !!end
1208
1209 !! test
1210 Templates: Indent-Pre: 1c: Wrapping should be based on expanded content
1211 !! input
1212 {{echo|a
1213 b}}
1214 !!result
1215 <pre>a
1216 </pre>
1217 <p>b
1218 </p>
1219 !!end
1220
1221 !! test
1222 Templates: Indent-Pre: 1d: Wrapping should be based on expanded content
1223 !! input
1224 {{echo|a
1225 b
1226 c
1227 d
1228 e
1229 }}
1230 !!result
1231 <pre>a
1232 </pre>
1233 <p>b
1234 c
1235 </p>
1236 <pre>d
1237 </pre>
1238 <p>e
1239 </p>
1240 !!end
1241
1242 !!test
1243 Templates: Indent-Pre: 1e. Wrapping should be based on expanded content
1244 !!input
1245 {{echo| foo}}
1246
1247 {{echo| foo}}{{echo| bar}}
1248
1249 {{echo| foo}}
1250 {{echo| bar}}
1251
1252 {{echo|<!--cmt--> foo}}
1253
1254 <!--cmt-->{{echo| foo}}
1255
1256 {{echo|{{echo| }}bar}}
1257 !!result
1258 <pre>foo
1259 </pre>
1260 <pre>foo bar
1261 </pre>
1262 <pre>foo
1263 bar
1264 </pre>
1265 <pre>foo
1266 </pre>
1267 <pre>foo
1268 </pre>
1269 <pre>bar
1270 </pre>
1271 !!end
1272
1273 !! test
1274 Templates: Indent-Pre: 1f: Wrapping should be based on expanded content
1275 !! input
1276 {{echo| }}a
1277
1278 {{echo|
1279 }}a
1280
1281 {{echo|
1282 b}}
1283
1284 {{echo|a
1285 }}b
1286
1287 {{echo|a
1288 }} b
1289 !!result
1290 <pre>a
1291 </pre>
1292 <p><br />
1293 </p>
1294 <pre>a
1295 </pre>
1296 <p><br />
1297 </p>
1298 <pre>b
1299 </pre>
1300 <p>a
1301 </p>
1302 <pre>b
1303 </pre>
1304 <p>a
1305 </p>
1306 <pre>b
1307 </pre>
1308 !!end
1309
1310 !! test
1311 Templates: Single-line variant of parameter whitespace stripping test
1312 !! input
1313 {{echo| a}}
1314
1315 {{echo|1= a}}
1316
1317 {{echo|{{echo| a}}}}
1318
1319 {{echo|1={{echo| a}}}}
1320 !! result
1321 <pre>a
1322 </pre>
1323 <p>a
1324 </p>
1325 <pre>a
1326 </pre>
1327 <p>a
1328 </p>
1329 !! end
1330
1331 !! test
1332 Templates: Strip whitespace from named parameters, but not positional ones
1333 !! input
1334 {{echo|
1335 foo}}
1336
1337 {{echo|
1338 * foo}}
1339
1340 {{echo| 1 =
1341 foo}}
1342
1343 {{echo| 1 =
1344 * foo}}
1345 !! result
1346 <pre>foo
1347 </pre>
1348 <p><br />
1349 </p>
1350 <ul><li> foo
1351 </li></ul>
1352 <p>foo
1353 </p>
1354 <ul><li> foo
1355 </li></ul>
1356
1357 !! end
1358
1359 ###
1360 ### Parsoid-centric tests for testing RT edge cases for pre
1361 ###
1362
1363 !!test
1364 1a. Indent-Pre and Comments
1365 !!input
1366 a
1367 <!--a-->
1368 c
1369 !!result
1370 <pre>a
1371 </pre>
1372 <p>c
1373 </p>
1374 !!end
1375
1376 !!test
1377 1b. Indent-Pre and Comments
1378 !!input
1379 a
1380 <!--a-->
1381 c
1382 !!result
1383 <pre>a
1384 </pre>
1385 <p>c
1386 </p>
1387 !!end
1388
1389 !!test
1390 1c. Indent-Pre and Comments
1391 !!input
1392 <!--a--> a
1393
1394 <!--a--> a
1395 !!result
1396 <pre> a
1397 </pre>
1398 <pre> a
1399 </pre>
1400 !!end
1401
1402 !!test
1403 2a. Indent-Pre and tables
1404 !!input
1405 {|
1406 |-
1407 !h1!!h2
1408 |foo||bar
1409 |}
1410 !!result
1411 <table>
1412
1413 <tr>
1414 <th>h1</th>
1415 <th>h2
1416 </th>
1417 <td>foo</td>
1418 <td>bar
1419 </td></tr></table>
1420
1421 !!end
1422
1423 !!test
1424 2b. Indent-Pre and tables
1425 !!input
1426 {|
1427 |-
1428 |foo
1429 |}
1430 !!result
1431 <table>
1432
1433 <tr>
1434 <td>foo
1435 </td></tr></table>
1436
1437 !!end
1438
1439 !!test
1440 2c. Indent-Pre and tables (bug 42252)
1441 !!input
1442 {|
1443 |+ foo
1444 ! | bar
1445 |}
1446 !!result
1447 <table>
1448 <caption> foo
1449 </caption>
1450 <tr>
1451 <th> bar
1452 </th></tr></table>
1453
1454 !!end
1455
1456 !!test
1457 3a. Indent-Pre and block tags (single-line html)
1458 !!input
1459 <p> foo </p>
1460 <div> foo </div>
1461 <span> foo </span>
1462 !!result
1463 <p> foo </p>
1464 <div> foo </div>
1465 <pre><span> foo </span>
1466 </pre>
1467 !!end
1468
1469 !!test
1470 3b. Indent-Pre and block tags (pre-content on separate line)
1471 !!input
1472 <p>
1473 foo
1474 </p>
1475
1476 <div>
1477 foo
1478 </div>
1479
1480 <center>
1481 foo
1482 </center>
1483
1484 <blockquote>
1485 foo
1486 </blockquote>
1487
1488 <table><tr><td>
1489 foo
1490 </td></tr></table>
1491
1492 <ul><li>
1493 foo
1494 </li></ul>
1495
1496 !!result
1497 <p>
1498 foo
1499 </p>
1500 <div>
1501 <pre>foo
1502 </pre>
1503 </div>
1504 <center>
1505 <pre>foo
1506 </pre>
1507 </center>
1508 <blockquote>
1509 foo
1510 </blockquote>
1511 <table><tr><td>
1512 <pre>foo
1513 </pre>
1514 </td></tr></table>
1515 <ul><li>
1516 foo
1517 </li></ul>
1518
1519 !!end
1520
1521 !!test
1522 4. Multiple spaces at start-of-line
1523 !!input
1524 <p> foo </p>
1525 foo
1526 {|
1527 |foo
1528 |}
1529 !!result
1530 <p> foo </p>
1531 <pre> foo
1532 </pre>
1533 <table>
1534 <tr>
1535 <td>foo
1536 </td></tr></table>
1537
1538 !!end
1539
1540 !! test
1541 5. White-space in indent-pre
1542 NOTE: the white-space char on 2nd line is significant
1543 !! input
1544 a<br/>
1545
1546 b
1547 !! result
1548 <pre>a<br />
1549
1550 b
1551 </pre>
1552 !! end
1553
1554 ###
1555 ### HTML-pre (some to spec PHP parser behavior and some Parsoid-RT-centric)
1556 ###
1557
1558 !!test
1559 HTML-pre: 1. embedded newlines
1560 !!input
1561 <pre>foo</pre>
1562
1563 <pre>
1564 foo
1565 </pre>
1566
1567 <pre>
1568
1569 foo
1570 </pre>
1571
1572 <pre>
1573
1574
1575 foo
1576 </pre>
1577 !!result
1578 <pre>foo</pre>
1579 <pre>
1580 foo
1581 </pre>
1582 <pre>
1583
1584 foo
1585 </pre>
1586 <pre>
1587
1588
1589 foo
1590 </pre>
1591
1592 !!end
1593
1594 !!test
1595 HTML-pre: 2: indented text
1596 !!input
1597 <pre>
1598 foo
1599 </pre>
1600 !!result
1601 <pre>
1602 foo
1603 </pre>
1604
1605 !!end
1606
1607 !!test
1608 HTML-pre: 3: other wikitext
1609 !!input
1610 <pre>
1611 * foo
1612 # bar
1613 = no-h =
1614 '' no-italic ''
1615 [[ NoLink ]]
1616 </pre>
1617 !!result
1618 <pre>
1619 * foo
1620 # bar
1621 = no-h =
1622 '' no-italic ''
1623 [[ NoLink ]]
1624 </pre>
1625
1626 !!end
1627
1628 ###
1629 ### Definition lists
1630 ###
1631 !! test
1632 Simple definition
1633 !! input
1634 ; name : Definition
1635 !! result
1636 <dl><dt> name&#160;</dt><dd> Definition
1637 </dd></dl>
1638
1639 !! end
1640
1641 !! test
1642 Definition list for indentation only
1643 !! input
1644 : Indented text
1645 !! result
1646 <dl><dd> Indented text
1647 </dd></dl>
1648
1649 !! end
1650
1651 !! test
1652 Definition list with no space
1653 !! input
1654 ;name:Definition
1655 !! result
1656 <dl><dt>name</dt><dd>Definition
1657 </dd></dl>
1658
1659 !!end
1660
1661 !! test
1662 Definition list with URL link
1663 !! input
1664 ; http://example.com/ : definition
1665 !! result
1666 <dl><dt> <a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&#160;</dt><dd> definition
1667 </dd></dl>
1668
1669 !! end
1670
1671 !! test
1672 Definition list with bracketed URL link
1673 !! input
1674 ;[http://www.example.com/ Example]:Something about it
1675 !! result
1676 <dl><dt><a rel="nofollow" class="external text" href="http://www.example.com/">Example</a></dt><dd>Something about it
1677 </dd></dl>
1678
1679 !! end
1680
1681 !! test
1682 Definition list with wikilink containing colon
1683 !! input
1684 ; [[Help:FAQ]]: The least-read page on Wikipedia
1685 !! result
1686 <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
1687 </dd></dl>
1688
1689 !! end
1690
1691 # At Brion's and JeLuF's insistence... :)
1692 !! test
1693 Definition list with news link containing colon
1694 !! input
1695 ; news:alt.wikipedia.rox: This isn't even a real newsgroup!
1696 !! result
1697 <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!
1698 </dd></dl>
1699
1700 !! end
1701
1702 !! test
1703 Malformed definition list with colon
1704 !! input
1705 ; news:alt.wikipedia.rox -- don't crash or enter an infinite loop
1706 !! result
1707 <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
1708 </dt></dl>
1709
1710 !! end
1711
1712 !! test
1713 Definition lists: colon in external link text
1714 !! input
1715 ; [http://www.wikipedia2.org/ Wikipedia : The Next Generation]: OK, I made that up
1716 !! result
1717 <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
1718 </dd></dl>
1719
1720 !! end
1721
1722 !! test
1723 Definition lists: colon in HTML attribute
1724 !! input
1725 ;<b style="display: inline">bold</b>
1726 !! result
1727 <dl><dt><b style="display: inline">bold</b>
1728 </dt></dl>
1729
1730 !! end
1731
1732 !! test
1733 Definition lists: self-closed tag
1734 !! input
1735 ;one<br/>two : two-line fun
1736 !! result
1737 <dl><dt>one<br />two&#160;</dt><dd> two-line fun
1738 </dd></dl>
1739
1740 !! end
1741
1742 !! test
1743 Bug 11748: Literal closing tags
1744 !! input
1745 <dl>
1746 <dt>test 1</dt>
1747 <dd>test test test test test</dd>
1748 <dt>test 2</dt>
1749 <dd>test test test test test</dd>
1750 </dl>
1751 !! result
1752 <dl>
1753 <dt>test 1</dt>
1754 <dd>test test test test test</dd>
1755 <dt>test 2</dt>
1756 <dd>test test test test test</dd>
1757 </dl>
1758
1759 !! end
1760
1761 !! test
1762 Definition and unordered list using wiki syntax nested in unordered list using html tags.
1763 !! input
1764 <ul><li>
1765 ; term : description
1766 * unordered
1767 </li>
1768 </ul>
1769 !! result
1770 <ul><li>
1771 <dl><dt> term&#160;</dt><dd> description
1772 </dd></dl>
1773 <ul><li> unordered
1774 </li></ul>
1775 </li>
1776 </ul>
1777
1778 !! end
1779
1780 !! test
1781
1782 Definition list with empty definition and following paragraph
1783 !! input
1784 ; term:
1785 Paragraph text
1786 !! result
1787 <dl><dt> term</dt><dd>
1788 </dd></dl>
1789 <p>Paragraph text
1790 </p>
1791 !! end
1792
1793 !! test
1794 Nested definition lists using html syntax
1795 !! input
1796 <dl><dd>
1797 <dl>
1798 <dd>Foo</dd>
1799 </dl>
1800 </dd></dl>
1801 !! result
1802 <dl><dd>
1803 <dl>
1804 <dd>Foo</dd>
1805 </dl>
1806 </dd></dl>
1807
1808 !! end
1809
1810 !! test
1811 Definition Lists: No nesting: Multiple dd's
1812 !! input
1813 ;x
1814 :a
1815 :b
1816 !! result
1817 <dl><dt>x
1818 </dt><dd>a
1819 </dd><dd>b
1820 </dd></dl>
1821
1822 !! end
1823
1824 !! test
1825 Definition Lists: Indentation: Regular
1826 !! input
1827 :i1
1828 ::i2
1829 :::i3
1830 !! result
1831 <dl><dd>i1
1832 <dl><dd>i2
1833 <dl><dd>i3
1834 </dd></dl>
1835 </dd></dl>
1836 </dd></dl>
1837
1838 !! end
1839
1840 !! test
1841 Definition Lists: Indentation: Missing 1st level
1842 !! input
1843 ::i2
1844 :::i3
1845 !! result
1846 <dl><dd><dl><dd>i2
1847 <dl><dd>i3
1848 </dd></dl>
1849 </dd></dl>
1850 </dd></dl>
1851
1852 !! end
1853
1854 !! test
1855 Definition Lists: Indentation: Multi-level indent
1856 !! input
1857 :::i3
1858 !! result
1859 <dl><dd><dl><dd><dl><dd>i3
1860 </dd></dl>
1861 </dd></dl>
1862 </dd></dl>
1863
1864 !! end
1865
1866 !! test
1867 Definition Lists: Hacky use to indent tables
1868 !! input
1869 ::{|
1870 |foo
1871 |bar
1872 |}
1873 this text
1874 should be left alone
1875 !! result
1876 <dl><dd><dl><dd><table>
1877 <tr>
1878 <td>foo
1879 </td>
1880 <td>bar
1881 </td></tr></table></dd></dl></dd></dl>
1882 <p>this text
1883 should be left alone
1884 </p>
1885 !! end
1886 ## The PHP parser treats : items (dd) without a corresponding ; item (dt)
1887 ## as an empty dt item. It also ignores all but the last ";" when followed
1888 ## by ":" later on. So, ";" are not ignored in ";;;t3" but are ignored in
1889 ## ";;;t3 :d1". So, PHP parser behavior is a little inconsistent wrt multiple
1890 ## ";"s.
1891 ##
1892 ## Ex: ";;t2 ::d2" is transformed into:
1893 ##
1894 ## <dl>
1895 ## <dt>t2 </dt>
1896 ## <dd>
1897 ## <dl>
1898 ## <dt></dt>
1899 ## <dd>d2</dd>
1900 ## </dl>
1901 ## </dd>
1902 ## </dl>
1903 ##
1904 ## But, Parsoid treats "; :" as a tight atomic unit and excess ":" as plain text
1905 ## So, the same wikitext above (;;t2 ::d2) is transformed into:
1906 ##
1907 ## <dl>
1908 ## <dt>
1909 ## <dl>
1910 ## <dt>t2 </dt>
1911 ## <dd>:d2</dd>
1912 ## </dl>
1913 ## </dt>
1914 ## </dl>
1915 ##
1916 ## All Parsoid only definition list tests have this difference.
1917 ##
1918 ## See also: https://bugzilla.wikimedia.org/show_bug.cgi?id=6569
1919 ## and http://lists.wikimedia.org/pipermail/wikitext-l/2011-November/000483.html
1920
1921 !! test
1922 Table / list interaction: indented table with lists in table contents
1923 !! input
1924 :{|
1925 |-
1926 | a
1927 * b
1928 |-
1929 | c
1930 * d
1931 |}
1932 !! result
1933 <dl><dd><table>
1934
1935 <tr>
1936 <td> a
1937 <ul><li> b
1938 </li></ul>
1939 </td></tr>
1940 <tr>
1941 <td> c
1942 <ul><li> d
1943 </li></ul>
1944 </td></tr></table></dd></dl>
1945
1946 !! end
1947
1948 !!test
1949 Table / list interaction: lists nested in tables nested in indented lists
1950 !!input
1951 :{|
1952 |
1953 :a
1954 :b
1955 |
1956 *c
1957 *d
1958 |}
1959
1960 *e
1961 *f
1962 !!result
1963 <dl><dd><table>
1964 <tr>
1965 <td>
1966 <dl><dd>a
1967 </dd><dd>b
1968 </dd></dl>
1969 </td>
1970 <td>
1971 <ul><li>c
1972 </li><li>d
1973 </li></ul>
1974 </td></tr></table></dd></dl>
1975 <ul><li>e
1976 </li><li>f
1977 </li></ul>
1978
1979 !!end
1980
1981 !! test
1982 Definition Lists: Nesting: Multi-level (Parsoid only)
1983 !! options
1984 parsoid
1985 !! input
1986 ;t1 :d1
1987 ;;t2 ::d2
1988 ;;;t3 :::d3
1989 !! result
1990 <dl>
1991 <dt>t1 </dt>
1992 <dd>d1</dd>
1993 <dt>
1994 <dl>
1995 <dt>t2 </dt>
1996 <dd>:d2</dd>
1997 <dt>
1998 <dl>
1999 <dt>t3 </dt>
2000 <dd>::d3</dd>
2001 </dl>
2002 </dt>
2003 </dl>
2004 </dt>
2005 </dl>
2006
2007
2008 !! end
2009
2010
2011 !! test
2012 Definition Lists: Nesting: Test 2 (Parsoid only)
2013 !! options
2014 parsoid
2015 !! input
2016 ;t1
2017 ::d2
2018 !! result
2019 <dl>
2020 <dt>t1</dt>
2021 <dd>
2022 <dl>
2023 <dd>d2</dd>
2024 </dl>
2025 </dd>
2026 </dl>
2027
2028 !! end
2029
2030
2031 !! test
2032 Definition Lists: Nesting: Test 3 (Parsoid only)
2033 !! options
2034 parsoid
2035 !! input
2036 :;t1
2037 ::::d2
2038 !! result
2039 <dl>
2040 <dd>
2041 <dl>
2042 <dt>t1</dt>
2043 <dd>
2044 <dl>
2045 <dd>
2046 <dl>
2047 <dd>d2</dd>
2048 </dl>
2049 </dd>
2050 </dl>
2051 </dd>
2052 </dl>
2053 </dd>
2054 </dl>
2055
2056 !! end
2057
2058
2059 !! test
2060 Definition Lists: Nesting: Test 4
2061 !! input
2062 ::;t3
2063 :::d3
2064 !! result
2065 <dl><dd><dl><dd><dl><dt>t3
2066 </dt><dd>d3
2067 </dd></dl>
2068 </dd></dl>
2069 </dd></dl>
2070
2071 !! end
2072
2073
2074 !! test
2075 Definition Lists: Mixed Lists: Test 1
2076 !! input
2077 :;* foo
2078 ::* bar
2079 :; baz
2080 !! result
2081 <dl><dd><dl><dt><ul><li> foo
2082 </li><li> bar
2083 </li></ul>
2084 </dt></dl>
2085 <dl><dt> baz
2086 </dt></dl>
2087 </dd></dl>
2088
2089 !! end
2090
2091
2092 !! test
2093 Definition Lists: Mixed Lists: Test 2
2094 !! input
2095 *: d1
2096 *: d2
2097 !! result
2098 <ul><li><dl><dd> d1
2099 </dd><dd> d2
2100 </dd></dl>
2101 </li></ul>
2102
2103 !! end
2104
2105
2106 !! test
2107 Definition Lists: Mixed Lists: Test 3
2108 !! input
2109 *::: d1
2110 *::: d2
2111 !! result
2112 <ul><li><dl><dd><dl><dd><dl><dd> d1
2113 </dd><dd> d2
2114 </dd></dl>
2115 </dd></dl>
2116 </dd></dl>
2117 </li></ul>
2118
2119 !! end
2120
2121
2122 !! test
2123 Definition Lists: Mixed Lists: Test 4
2124 !! input
2125 *;d1 :d2
2126 *;d3 :d4
2127 !! result
2128 <ul><li><dl><dt>d1&#160;</dt><dd>d2
2129 </dd><dt>d3&#160;</dt><dd>d4
2130 </dd></dl>
2131 </li></ul>
2132
2133 !! end
2134
2135
2136 !! test
2137 Definition Lists: Mixed Lists: Test 5
2138 !! input
2139 *:d1
2140 *:: d2
2141 !! result
2142 <ul><li><dl><dd>d1
2143 <dl><dd> d2
2144 </dd></dl>
2145 </dd></dl>
2146 </li></ul>
2147
2148 !! end
2149
2150
2151 !! test
2152 Definition Lists: Mixed Lists: Test 6
2153 !! input
2154 #*:d1
2155 #*::: d3
2156 !! result
2157 <ol><li><ul><li><dl><dd>d1
2158 <dl><dd><dl><dd> d3
2159 </dd></dl>
2160 </dd></dl>
2161 </dd></dl>
2162 </li></ul>
2163 </li></ol>
2164
2165 !! end
2166
2167
2168 !! test
2169 Definition Lists: Mixed Lists: Test 7
2170 !! input
2171 :* d1
2172 :* d2
2173 !! result
2174 <dl><dd><ul><li> d1
2175 </li><li> d2
2176 </li></ul>
2177 </dd></dl>
2178
2179 !! end
2180
2181
2182 !! test
2183 Definition Lists: Mixed Lists: Test 8
2184 !! input
2185 :* d1
2186 ::* d2
2187 !! result
2188 <dl><dd><ul><li> d1
2189 </li></ul>
2190 <dl><dd><ul><li> d2
2191 </li></ul>
2192 </dd></dl>
2193 </dd></dl>
2194
2195 !! end
2196
2197
2198 !! test
2199 Definition Lists: Mixed Lists: Test 9
2200 !! input
2201 *;foo :bar
2202 !! result
2203 <ul><li><dl><dt>foo&#160;</dt><dd>bar
2204 </dd></dl>
2205 </li></ul>
2206
2207 !! end
2208
2209
2210 !! test
2211 Definition Lists: Mixed Lists: Test 10
2212 !! input
2213 *#;foo :bar
2214 !! result
2215 <ul><li><ol><li><dl><dt>foo&#160;</dt><dd>bar
2216 </dd></dl>
2217 </li></ol>
2218 </li></ul>
2219
2220 !! end
2221
2222
2223 !! test
2224 Definition Lists: Mixed Lists: Test 11
2225 !! input
2226 *#*#;*;;foo :bar
2227 *#*#;boo :baz
2228 !! result
2229 <ul><li><ol><li><ul><li><ol><li><dl><dt>foo&#160;</dt><dd><ul><li><dl><dt><dl><dt>bar
2230 </dt></dl>
2231 </dd></dl>
2232 </li></ul>
2233 </dd></dl>
2234 <dl><dt>boo&#160;</dt><dd>baz
2235 </dd></dl>
2236 </li></ol>
2237 </li></ul>
2238 </li></ol>
2239 </li></ul>
2240
2241 !! end
2242
2243
2244 !! test
2245 Definition Lists: Weird Ones: Test 1
2246 !! input
2247 *#;*::;; foo : bar (who uses this?)
2248 !! result
2249 <ul><li><ol><li><dl><dt> foo&#160;</dt><dd><ul><li><dl><dd><dl><dd><dl><dt><dl><dt> bar (who uses this?)
2250 </dt></dl>
2251 </dd></dl>
2252 </dd></dl>
2253 </dd></dl>
2254 </li></ul>
2255 </dd></dl>
2256 </li></ol>
2257 </li></ul>
2258
2259 !! end
2260
2261 ###
2262 ### External links
2263 ###
2264 !! test
2265 External links: non-bracketed
2266 !! input
2267 Non-bracketed: http://example.com
2268 !! result
2269 <p>Non-bracketed: <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
2270 </p>
2271 !! end
2272
2273 !! test
2274 External links: numbered
2275 !! input
2276 Numbered: [http://example.com]
2277 Numbered: [http://example.net]
2278 Numbered: [http://example.com]
2279 !! result
2280 <p>Numbered: <a rel="nofollow" class="external autonumber" href="http://example.com">[1]</a>
2281 Numbered: <a rel="nofollow" class="external autonumber" href="http://example.net">[2]</a>
2282 Numbered: <a rel="nofollow" class="external autonumber" href="http://example.com">[3]</a>
2283 </p>
2284 !!end
2285
2286 !! test
2287 External links: specified text
2288 !! input
2289 Specified text: [http://example.com link]
2290 !! result
2291 <p>Specified text: <a rel="nofollow" class="external text" href="http://example.com">link</a>
2292 </p>
2293 !!end
2294
2295 !! test
2296 External links: trail
2297 !! input
2298 Linktrails should not work for external links: [http://example.com link]s
2299 !! result
2300 <p>Linktrails should not work for external links: <a rel="nofollow" class="external text" href="http://example.com">link</a>s
2301 </p>
2302 !! end
2303
2304 !! test
2305 External links: dollar sign in URL
2306 !! input
2307 http://example.com/1$2345
2308 !! result
2309 <p><a rel="nofollow" class="external free" href="http://example.com/1$2345">http://example.com/1$2345</a>
2310 </p>
2311 !! end
2312
2313 !! test
2314 External links: dollar sign in URL (named)
2315 !! input
2316 [http://example.com/1$2345]
2317 !! result
2318 <p><a rel="nofollow" class="external autonumber" href="http://example.com/1$2345">[1]</a>
2319 </p>
2320 !!end
2321
2322 !! test
2323 External links: open square bracket forbidden in URL (bug 4377)
2324 !! input
2325 http://example.com/1[2345
2326 !! result
2327 <p><a rel="nofollow" class="external free" href="http://example.com/1">http://example.com/1</a>[2345
2328 </p>
2329 !! end
2330
2331 !! test
2332 External links: open square bracket forbidden in URL (named) (bug 4377)
2333 !! input
2334 [http://example.com/1[2345]
2335 !! result
2336 <p><a rel="nofollow" class="external text" href="http://example.com/1">[2345</a>
2337 </p>
2338 !!end
2339
2340 !! test
2341 External links: nowiki in URL link text (bug 6230)
2342 !!input
2343 [http://example.com/ <nowiki>''example site''</nowiki>]
2344 !! result
2345 <p><a rel="nofollow" class="external text" href="http://example.com/">''example site''</a>
2346 </p>
2347 !! end
2348
2349 !! test
2350 External links: newline forbidden in text (bug 6230 regression check)
2351 !! input
2352 [http://example.com/ first
2353 second]
2354 !! result
2355 <p>[<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a> first
2356 second]
2357 </p>
2358 !!end
2359
2360 !! test
2361 External links: Pipe char between url and text
2362 !! input
2363 [http://example.com | link]
2364 !! result
2365 <p><a rel="nofollow" class="external text" href="http://example.com">| link</a>
2366 </p>
2367 !!end
2368
2369 !! test
2370 External links: protocol-relative URL in brackets
2371 !! input
2372 [//example.com/ Test]
2373 !! result
2374 <p><a rel="nofollow" class="external text" href="//example.com/">Test</a>
2375 </p>
2376 !! end
2377
2378 !! test
2379 External links: protocol-relative URL in brackets without text
2380 !! input
2381 [//example.com]
2382 !! result
2383 <p><a rel="nofollow" class="external autonumber" href="//example.com">[1]</a>
2384 </p>
2385 !! end
2386
2387 !! test
2388 External links: protocol-relative URL in free text is left alone
2389 !! input
2390 //example.com/Foo
2391 !! result
2392 <p>//example.com/Foo
2393 </p>
2394 !!end
2395
2396 !! test
2397 External links: protocol-relative URL in the middle of a word is left alone (bug 30269)
2398 !! input
2399 foo//example.com/Foo
2400 !! result
2401 <p>foo//example.com/Foo
2402 </p>
2403 !! end
2404
2405 !! test
2406 External image
2407 !! input
2408 External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
2409 !! result
2410 <p>External image: <img src="http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" />
2411 </p>
2412 !! end
2413
2414 !! test
2415 External image from https
2416 !! input
2417 External image from https: https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
2418 !! result
2419 <p>External image from https: <img src="https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" />
2420 </p>
2421 !! end
2422
2423 !! test
2424 Link to non-http image, no img tag
2425 !! input
2426 Link to non-http image, no img tag: ftp://example.com/test.jpg
2427 !! result
2428 <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>
2429 </p>
2430 !! end
2431
2432 !! test
2433 External links: terminating separator
2434 !! input
2435 Terminating separator: http://example.com/thing,
2436 !! result
2437 <p>Terminating separator: <a rel="nofollow" class="external free" href="http://example.com/thing">http://example.com/thing</a>,
2438 </p>
2439 !! end
2440
2441 !! test
2442 External links: intervening separator
2443 !! input
2444 Intervening separator: http://example.com/1,2,3
2445 !! result
2446 <p>Intervening separator: <a rel="nofollow" class="external free" href="http://example.com/1,2,3">http://example.com/1,2,3</a>
2447 </p>
2448 !! end
2449
2450 !! test
2451 External links: old bug with URL in query
2452 !! input
2453 Old bug with URL in query: [http://example.com/thing?url=http://example.com link]
2454 !! result
2455 <p>Old bug with URL in query: <a rel="nofollow" class="external text" href="http://example.com/thing?url=http://example.com">link</a>
2456 </p>
2457 !! end
2458
2459 !! test
2460 External links: old URL-in-URL bug, mixed protocols
2461 !! input
2462 And again with mixed protocols: [ftp://example.com?url=http://example.com link]
2463 !! result
2464 <p>And again with mixed protocols: <a rel="nofollow" class="external text" href="ftp://example.com?url=http://example.com">link</a>
2465 </p>
2466 !!end
2467
2468 !! test
2469 External links: URL in text
2470 !! input
2471 URL in text: [http://example.com http://example.com]
2472 !! result
2473 <p>URL in text: <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
2474 </p>
2475 !! end
2476
2477 !! test
2478 External links: Clickable images
2479 !! input
2480 ja-style clickable images: [http://example.com http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png]
2481 !! result
2482 <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>
2483 </p>
2484 !!end
2485
2486 !! test
2487 External links: raw ampersand
2488 !! input
2489 Old &amp; use: http://x&y
2490 !! result
2491 <p>Old &amp; use: <a rel="nofollow" class="external free" href="http://x&amp;y">http://x&amp;y</a>
2492 </p>
2493 !! end
2494
2495 !! test
2496 External links: encoded ampersand
2497 !! input
2498 Old &amp; use: http://x&amp;y
2499 !! result
2500 <p>Old &amp; use: <a rel="nofollow" class="external free" href="http://x&amp;y">http://x&amp;y</a>
2501 </p>
2502 !! end
2503
2504 !! test
2505 External links: encoded equals (bug 6102)
2506 !! input
2507 http://example.com/?foo&#61;bar
2508 !! result
2509 <p><a rel="nofollow" class="external free" href="http://example.com/?foo=bar">http://example.com/?foo=bar</a>
2510 </p>
2511 !! end
2512
2513 !! test
2514 External links: [raw ampersand]
2515 !! input
2516 Old &amp; use: [http://x&y]
2517 !! result
2518 <p>Old &amp; use: <a rel="nofollow" class="external autonumber" href="http://x&amp;y">[1]</a>
2519 </p>
2520 !! end
2521
2522 !! test
2523 External links: [encoded ampersand]
2524 !! input
2525 Old &amp; use: [http://x&amp;y]
2526 !! result
2527 <p>Old &amp; use: <a rel="nofollow" class="external autonumber" href="http://x&amp;y">[1]</a>
2528 </p>
2529 !! end
2530
2531 !! test
2532 External links: [encoded equals] (bug 6102)
2533 !! input
2534 [http://example.com/?foo&#61;bar]
2535 !! result
2536 <p><a rel="nofollow" class="external autonumber" href="http://example.com/?foo=bar">[1]</a>
2537 </p>
2538 !! end
2539
2540 !! test
2541 External links: [IDN ignored character reference in hostname; strip it right off]
2542 !! input
2543 [http://e&zwnj;xample.com/]
2544 !! result
2545 <p><a rel="nofollow" class="external autonumber" href="http://example.com/">[1]</a>
2546 </p>
2547 !! end
2548
2549 # FIXME: This test (the IDN characters in the text of a link) is an inconsistency.
2550 # Where an external link could easily circumvent the sanitization of the text of
2551 # a link like this (where an IDN-ignore character is in the URL somewhere), this
2552 # test demands a higher standard. That's a bit strange.
2553 #
2554 # Example:
2555 #
2556 # http://e‌xample.com -> [http://example.com|http://example.com]
2557 # [http://example.com|http://e‌xample.com] -> [http://example.com|http://e‌xample.com]
2558 #
2559 # The first example is sanitized, but the second is not. Any security benefits
2560 # from this production are trivial to circumvent. Either remove this test and
2561 # let the parser(s) do their thing unaccosted, or fix the inconsistency and change
2562 # the test accordingly.
2563 #
2564 # All our love,
2565 # The Parsoid team.
2566 !! test
2567 External links: IDN ignored character reference in hostname; strip it right off
2568 !! input
2569 http://e&zwnj;xample.com/
2570 !! result
2571 <p><a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>
2572 </p>
2573 !! end
2574
2575 !! test
2576 External links: www.jpeg.org (bug 554)
2577 !! input
2578 http://www.jpeg.org
2579 !!result
2580 <p><a rel="nofollow" class="external free" href="http://www.jpeg.org">http://www.jpeg.org</a>
2581 </p>
2582 !! end
2583
2584 !! test
2585 External links: URL within URL (original bug 2)
2586 !! input
2587 [http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp]
2588 !! result
2589 <p><a rel="nofollow" class="external autonumber" href="http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp">[1]</a>
2590 </p>
2591 !! end
2592
2593 !! test
2594 BUG 361: URL inside bracketed URL
2595 !! input
2596 [http://www.example.com/foo http://www.example.com/bar]
2597 !! result
2598 <p><a rel="nofollow" class="external text" href="http://www.example.com/foo">http://www.example.com/bar</a>
2599 </p>
2600 !! end
2601
2602 !! test
2603 BUG 361: URL within URL, not bracketed
2604 !! input
2605 http://www.example.com/foo?=http://www.example.com/bar
2606 !! result
2607 <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>
2608 </p>
2609 !! end
2610
2611 !! test
2612 BUG 289: ">"-token in URL-tail
2613 !! input
2614 http://www.example.com/<hello>
2615 !! result
2616 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a>&lt;hello&gt;
2617 </p>
2618 !!end
2619
2620 !! test
2621 BUG 289: literal ">"-token in URL-tail
2622 !! input
2623 http://www.example.com/<b>html</b>
2624 !! result
2625 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a><b>html</b>
2626 </p>
2627 !!end
2628
2629 !! test
2630 BUG 289: ">"-token in bracketed URL
2631 !! input
2632 [http://www.example.com/<hello> stuff]
2633 !! result
2634 <p><a rel="nofollow" class="external text" href="http://www.example.com/">&lt;hello&gt; stuff</a>
2635 </p>
2636 !!end
2637
2638 !! test
2639 BUG 289: literal ">"-token in bracketed URL
2640 !! input
2641 [http://www.example.com/<b>html</b> stuff]
2642 !! result
2643 <p><a rel="nofollow" class="external text" href="http://www.example.com/"><b>html</b> stuff</a>
2644 </p>
2645 !!end
2646
2647 !! test
2648 BUG 289: literal double quote at end of URL
2649 !! input
2650 http://www.example.com/"hello"
2651 !! result
2652 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a>"hello"
2653 </p>
2654 !!end
2655
2656 !! test
2657 BUG 289: literal double quote in bracketed URL
2658 !! input
2659 [http://www.example.com/"hello" stuff]
2660 !! result
2661 <p><a rel="nofollow" class="external text" href="http://www.example.com/">"hello" stuff</a>
2662 </p>
2663 !!end
2664
2665 !! test
2666 External links: multiple legal whitespace is fine, Magnus. Don't break it please. (bug 5081)
2667 !! input
2668 [http://www.example.com test]
2669 !! result
2670 <p><a rel="nofollow" class="external text" href="http://www.example.com">test</a>
2671 </p>
2672 !! end
2673
2674 !! test
2675 External links: link text with spaces
2676 !! input
2677 [http://www.example.com a b c]
2678 [http://www.example.com ''a'' ''b'']
2679 !! result
2680 <p><a rel="nofollow" class="external text" href="http://www.example.com">a b c</a>
2681 <a rel="nofollow" class="external text" href="http://www.example.com"><i>a</i> <i>b</i></a>
2682 </p>
2683 !! end
2684
2685 !! test
2686 External links: wiki links within external link (Bug 3695)
2687 !! input
2688 [http://example.com [[wikilink]] embedded in ext link]
2689 !! result
2690 <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>
2691 </p>
2692 !! end
2693
2694 !! test
2695 BUG 787: Links with one slash after the url protocol are invalid
2696 !! input
2697 http:/example.com
2698
2699 [http:/example.com title]
2700 !! result
2701 <p>http:/example.com
2702 </p><p>[http:/example.com title]
2703 </p>
2704 !! end
2705
2706 !! test
2707 Bracketed external links with template-generated invalid target
2708 !! input
2709 [{{echo|http:/example.com}} title]
2710 !! result
2711 <p>[http:/example.com title]
2712 </p>
2713 !! end
2714
2715 !! test
2716 Bug 2702: Mismatched <i>, <b> and <a> tags are invalid
2717 !! input
2718 ''[http://example.com text'']
2719 [http://example.com '''text]'''
2720 ''Something [http://example.com in italic'']
2721 ''Something [http://example.com mixed''''', even bold]'''
2722 '''''Now [http://example.com both''''']
2723 !! result
2724 <p><a rel="nofollow" class="external text" href="http://example.com"><i>text</i></a>
2725 <a rel="nofollow" class="external text" href="http://example.com"><b>text</b></a>
2726 <i>Something </i><a rel="nofollow" class="external text" href="http://example.com"><i>in italic</i></a>
2727 <i>Something </i><a rel="nofollow" class="external text" href="http://example.com"><i>mixed</i><b>, even bold</b></a>
2728 <i><b>Now </b></i><a rel="nofollow" class="external text" href="http://example.com"><i><b>both</b></i></a>
2729 </p>
2730 !! end
2731
2732
2733 !! test
2734 Bug 4781: %26 in URL
2735 !! input
2736 http://www.example.com/?title=AT%26T
2737 !! result
2738 <p><a rel="nofollow" class="external free" href="http://www.example.com/?title=AT%26T">http://www.example.com/?title=AT%26T</a>
2739 </p>
2740 !! end
2741
2742 # According to http://dev.w3.org/html5/spec/Overview.html#parsing-urls a plain
2743 # % is actually legal in HTML5. Any change in output would need testing though.
2744 !! test
2745 Bug 4781, 5267: %25 in URL
2746 !! input
2747 http://www.example.com/?title=100%25_Bran
2748 !! result
2749 <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>
2750 </p>
2751 !! end
2752
2753 !! test
2754 Bug 4781, 5267: %28, %29 in URL
2755 !! input
2756 http://www.example.com/?title=Ben-Hur_%281959_film%29
2757 !! result
2758 <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>
2759 </p>
2760 !! end
2761
2762
2763 !! test
2764 Bug 4781: %26 in autonumber URL
2765 !! input
2766 [http://www.example.com/?title=AT%26T]
2767 !! result
2768 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=AT%26T">[1]</a>
2769 </p>
2770 !! end
2771
2772 !! test
2773 Bug 4781, 5267: %26 in autonumber URL
2774 !! input
2775 [http://www.example.com/?title=100%25_Bran]
2776 !! result
2777 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=100%25_Bran">[1]</a>
2778 </p>
2779 !! end
2780
2781 !! test
2782 Bug 4781, 5267: %28, %29 in autonumber URL
2783 !! input
2784 [http://www.example.com/?title=Ben-Hur_%281959_film%29]
2785 !! result
2786 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">[1]</a>
2787 </p>
2788 !! end
2789
2790
2791 !! test
2792 Bug 4781: %26 in bracketed URL
2793 !! input
2794 [http://www.example.com/?title=AT%26T link]
2795 !! result
2796 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=AT%26T">link</a>
2797 </p>
2798 !! end
2799
2800 !! test
2801 Bug 4781, 5267: %26 in bracketed URL
2802 !! input
2803 [http://www.example.com/?title=100%25_Bran link]
2804 !! result
2805 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=100%25_Bran">link</a>
2806 </p>
2807 !! end
2808
2809 !! test
2810 Bug 4781, 5267: %28, %29 in bracketed URL
2811 !! input
2812 [http://www.example.com/?title=Ben-Hur_%281959_film%29 link]
2813 !! result
2814 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">link</a>
2815 </p>
2816 !! end
2817
2818 !! test
2819 External link containing double-single-quotes in text '' (bug 4598 sanity check)
2820 !! input
2821 Some [http://example.com/ pretty ''italics'' and stuff]!
2822 !! result
2823 <p>Some <a rel="nofollow" class="external text" href="http://example.com/">pretty <i>italics</i> and stuff</a>!
2824 </p>
2825 !! end
2826
2827 !! test
2828 External link containing double-single-quotes in text embedded in italics (bug 4598 sanity check)
2829 !! input
2830 ''Some [http://example.com/ pretty ''italics'' and stuff]!''
2831 !! result
2832 <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>
2833 </p>
2834 !! end
2835
2836 !! test
2837 External link containing double-single-quotes with no space separating the url from text in italics
2838 !! input
2839 [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]].]
2840 !! result
2841 <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>
2842 </p>
2843 !! end
2844
2845 !! test
2846 URL-encoding in URL functions (single parameter)
2847 !! input
2848 {{localurl:Some page|amp=&}}
2849 !! result
2850 <p>/index.php?title=Some_page&amp;amp=&amp;
2851 </p>
2852 !! end
2853
2854 !! test
2855 URL-encoding in URL functions (multiple parameters)
2856 !! input
2857 {{localurl:Some page|q=?&amp=&}}
2858 !! result
2859 <p>/index.php?title=Some_page&amp;q=?&amp;amp=&amp;
2860 </p>
2861 !! end
2862
2863 !! test
2864 Brackets in urls
2865 !! input
2866 http://example.com/index.php?foozoid%5B%5D=bar
2867
2868 http://example.com/index.php?foozoid&#x5B;&#x5D;=bar
2869 !! result
2870 <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>
2871 </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>
2872 </p>
2873 !! end
2874
2875 !! test
2876 IPv6 urls (bug 21261)
2877 !! options
2878 disabled
2879 !! input
2880 http://[2404:130:0:1000::187:2]/index.php
2881 !! result
2882 <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>
2883 </p>
2884 !! end
2885
2886 !! test
2887 Non-extlinks in brackets
2888 !! input
2889 [foo]
2890 [foo bar]
2891 [foo ''bar'']
2892 [fool's] errand
2893 [fool's errand]
2894 [{{echo|foo}}]
2895 [{{echo|foo}} bar]
2896 [{{echo|foo}} ''bar'']
2897 [{{echo|foo}}l's] errand
2898 [{{echo|foo}}l's errand]
2899 [url={{echo|foo}}]
2900 [url=http://example.com]
2901 !! result
2902 <p>[foo]
2903 [foo bar]
2904 [foo <i>bar</i>]
2905 [fool's] errand
2906 [fool's errand]
2907 [foo]
2908 [foo bar]
2909 [foo <i>bar</i>]
2910 [fool's] errand
2911 [fool's errand]
2912 [url=foo]
2913 [url=<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>]
2914 </p>
2915 !! end
2916
2917 ###
2918 ### Quotes
2919 ###
2920
2921 !! test
2922 Quotes
2923 !! input
2924 Normal text. '''Bold text.''' Normal text. ''Italic text.''
2925
2926 Normal text. '''''Bold italic text.''''' Normal text.
2927 !!result
2928 <p>Normal text. <b>Bold text.</b> Normal text. <i>Italic text.</i>
2929 </p><p>Normal text. <i><b>Bold italic text.</b></i> Normal text.
2930 </p>
2931 !! end
2932
2933
2934 !! test
2935 Unclosed and unmatched quotes
2936 !! input
2937 '''''Bold italic text '''with bold deactivated''' in between.'''''
2938
2939 '''''Bold italic text ''with italic deactivated'' in between.'''''
2940
2941 '''Bold text..
2942
2943 ..spanning two paragraphs (should not work).'''
2944
2945 '''Bold tag left open
2946
2947 ''Italic tag left open
2948
2949 Normal text.
2950
2951 <!-- Unmatching number of opening, closing tags: -->
2952 '''This year''''s election ''should'' beat '''last year''''s.
2953
2954 ''Tom'''s car is bigger than ''Susan'''s.
2955
2956 Plain ''italic'''s plain
2957 !! result
2958 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
2959 </p><p><b><i>Bold italic text </i>with italic deactivated<i> in between.</i></b>
2960 </p><p><b>Bold text..</b>
2961 </p><p>..spanning two paragraphs (should not work).
2962 </p><p><b>Bold tag left open</b>
2963 </p><p><i>Italic tag left open</i>
2964 </p><p>Normal text.
2965 </p><p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
2966 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
2967 </p><p>Plain <i>italic'</i>s plain
2968 </p>
2969 !! end
2970
2971 ###
2972 ### Tables
2973 ###
2974 ### some content taken from http://meta.wikimedia.org/wiki/MediaWiki_User%27s_Guide:_Using_tables
2975 ###
2976
2977 # This should not produce <table></table> as <table><tr><td></td></tr></table>
2978 # is the bare minimun required by the spec, see:
2979 # http://www.w3.org/TR/xhtml-modularization/dtd_module_defs.html#a_module_Basic_Tables
2980 !! test
2981 A table with no data.
2982 !! input
2983 {||}
2984 !! result
2985 !! end
2986
2987 # A table with nothing but a caption is invalid XHTML, we might want to render
2988 # this as <p>caption</p>
2989 !! test
2990 A table with nothing but a caption
2991 !! input
2992 {|
2993 |+ caption
2994 |}
2995 !! result
2996 <table>
2997 <caption> caption
2998 </caption><tr><td></td></tr></table>
2999
3000 !! end
3001
3002 !! test
3003 A table with caption with default-spaced attributes and a table row
3004 !! input
3005 {|
3006 |+ style="color: red;" | caption1
3007 |-
3008 | foo
3009 |}
3010 !! result
3011 <table>
3012 <caption style="color: red;"> caption1
3013 </caption>
3014 <tr>
3015 <td> foo
3016 </td></tr></table>
3017
3018 !! end
3019
3020 !! test
3021 A table with captions with non-default spaced attributes and a table row
3022 !! input
3023 {|
3024 |+style="color: red;"|caption2
3025 |+ style="color: red;"| caption3
3026 |-
3027 | foo
3028 |}
3029 !! result
3030 <table>
3031 <caption style="color: red;">caption2
3032 </caption>
3033 <caption style="color: red;"> caption3
3034 </caption>
3035 <tr>
3036 <td> foo
3037 </td></tr></table>
3038
3039 !! end
3040
3041 !! test
3042 Table td-cell syntax variations
3043 !! input
3044 {|
3045 | foo bar foo | baz
3046 | foo bar foo || baz
3047 | style='color:red;' | baz
3048 | style='color:red;' || baz
3049 |}
3050 !! result
3051 <table>
3052 <tr>
3053 <td> baz
3054 </td>
3055 <td> foo bar foo </td>
3056 <td> baz
3057 </td>
3058 <td style="color:red;"> baz
3059 </td>
3060 <td> style='color:red;' </td>
3061 <td> baz
3062 </td></tr></table>
3063
3064 !! end
3065
3066 !! test
3067 Simple table
3068 !! input
3069 {|
3070 | 1 || 2
3071 |-
3072 | 3 || 4
3073 |}
3074 !! result
3075 <table>
3076 <tr>
3077 <td> 1 </td>
3078 <td> 2
3079 </td></tr>
3080 <tr>
3081 <td> 3 </td>
3082 <td> 4
3083 </td></tr></table>
3084
3085 !! end
3086
3087 !! test
3088 Simple table but with multiple dashes for row wikitext
3089 !! input
3090 {|
3091 | foo
3092 |-----
3093 | bar
3094 |}
3095 !! result
3096 <table>
3097 <tr>
3098 <td> foo
3099 </td></tr>
3100 <tr>
3101 <td> bar
3102 </td></tr></table>
3103
3104 !! end
3105 !! test
3106 Multiplication table
3107 !! input
3108 {| border="1" cellpadding="2"
3109 |+Multiplication table
3110 |-
3111 ! &times; !! 1 !! 2 !! 3
3112 |-
3113 ! 1
3114 | 1 || 2 || 3
3115 |-
3116 ! 2
3117 | 2 || 4 || 6
3118 |-
3119 ! 3
3120 | 3 || 6 || 9
3121 |-
3122 ! 4
3123 | 4 || 8 || 12
3124 |-
3125 ! 5
3126 | 5 || 10 || 15
3127 |}
3128 !! result
3129 <table border="1" cellpadding="2">
3130 <caption>Multiplication table
3131 </caption>
3132 <tr>
3133 <th> &#215; </th>
3134 <th> 1 </th>
3135 <th> 2 </th>
3136 <th> 3
3137 </th></tr>
3138 <tr>
3139 <th> 1
3140 </th>
3141 <td> 1 </td>
3142 <td> 2 </td>
3143 <td> 3
3144 </td></tr>
3145 <tr>
3146 <th> 2
3147 </th>
3148 <td> 2 </td>
3149 <td> 4 </td>
3150 <td> 6
3151 </td></tr>
3152 <tr>
3153 <th> 3
3154 </th>
3155 <td> 3 </td>
3156 <td> 6 </td>
3157 <td> 9
3158 </td></tr>
3159 <tr>
3160 <th> 4
3161 </th>
3162 <td> 4 </td>
3163 <td> 8 </td>
3164 <td> 12
3165 </td></tr>
3166 <tr>
3167 <th> 5
3168 </th>
3169 <td> 5 </td>
3170 <td> 10 </td>
3171 <td> 15
3172 </td></tr></table>
3173
3174 !! end
3175
3176 !! test
3177 Accept "||" in table headings
3178 !! input
3179 {|
3180 !h1 || h2
3181 |}
3182 !! result
3183 <table>
3184 <tr>
3185 <th>h1 </th>
3186 <th> h2
3187 </th></tr></table>
3188
3189 !! end
3190
3191 !! test
3192 Accept "||" in indented table headings
3193 !! input
3194 :{|
3195 !h1 || h2
3196 |}
3197 !! result
3198 <dl><dd><table>
3199 <tr>
3200 <th>h1 </th>
3201 <th> h2
3202 </th></tr></table></dd></dl>
3203
3204 !! end
3205
3206 !! test
3207 Accept empty attributes in td/th cells (td/th cells starting with leading ||)
3208 !! input
3209 {|
3210 !| h1
3211 || a
3212 |}
3213 !! result
3214 <table>
3215 <tr>
3216 <th> h1
3217 </th>
3218 <td> a
3219 </td></tr></table>
3220
3221 !! end
3222
3223 !!test
3224 Accept "| !" at start of line in tables (ignore !-attribute)
3225 !!input
3226 {|
3227 |-
3228 | !style="color:red" | bar
3229 |}
3230 !!result
3231 <table>
3232
3233 <tr>
3234 <td> bar
3235 </td></tr></table>
3236
3237 !!end
3238
3239 !!test
3240 Allow +/- in 2nd and later cells in a row, in 1st cell when td-attrs are present, or in 1st cell when there is a space between "|" and +/-
3241 !!input
3242 {|
3243 |-
3244 |style='color:red;'|+1
3245 |style='color:blue;'|-1
3246 |-
3247 | 1 || 2 || 3
3248 | 1 ||+2 ||-3
3249 |-
3250 | +1
3251 | -1
3252 |}
3253 !!result
3254 <table>
3255
3256 <tr>
3257 <td style="color:red;">+1
3258 </td>
3259 <td style="color:blue;">-1
3260 </td></tr>
3261 <tr>
3262 <td> 1 </td>
3263 <td> 2 </td>
3264 <td> 3
3265 </td>
3266 <td> 1 </td>
3267 <td>+2 </td>
3268 <td>-3
3269 </td></tr>
3270 <tr>
3271 <td> +1
3272 </td>
3273 <td> -1
3274 </td></tr></table>
3275
3276 !!end
3277
3278 !! test
3279 Table rowspan
3280 !! input
3281 {| border=1
3282 | Cell 1, row 1
3283 |rowspan=2| Cell 2, row 1 (and 2)
3284 | Cell 3, row 1
3285 |-
3286 | Cell 1, row 2
3287 | Cell 3, row 2
3288 |}
3289 !! result
3290 <table border="1">
3291 <tr>
3292 <td> Cell 1, row 1
3293 </td>
3294 <td rowspan="2"> Cell 2, row 1 (and 2)
3295 </td>
3296 <td> Cell 3, row 1
3297 </td></tr>
3298 <tr>
3299 <td> Cell 1, row 2
3300 </td>
3301 <td> Cell 3, row 2
3302 </td></tr></table>
3303
3304 !! end
3305
3306 !! test
3307 Nested table
3308 !! input
3309 {| border=1
3310 | &alpha;
3311 |
3312 {| bgcolor=#ABCDEF border=2
3313 |nested
3314 |-
3315 |table
3316 |}
3317 |the original table again
3318 |}
3319 !! result
3320 <table border="1">
3321 <tr>
3322 <td> &#945;
3323 </td>
3324 <td>
3325 <table bgcolor="#ABCDEF" border="2">
3326 <tr>
3327 <td>nested
3328 </td></tr>
3329 <tr>
3330 <td>table
3331 </td></tr></table>
3332 </td>
3333 <td>the original table again
3334 </td></tr></table>
3335
3336 !! end
3337
3338 !! test
3339 Invalid attributes in table cell (bug 1830)
3340 !! input
3341 {|
3342 |Cell:|broken
3343 |}
3344 !! result
3345 <table>
3346 <tr>
3347 <td>broken
3348 </td></tr></table>
3349
3350 !! end
3351
3352
3353 !! test
3354 Table security: embedded pipes (http://lists.wikimedia.org/mailman/htdig/wikitech-l/2006-April/022293.html)
3355 !! input
3356 {|
3357 | |[ftp://|x||]" onmouseover="alert(document.cookie)">test
3358 !! result
3359 <table>
3360 <tr>
3361 <td>[<a rel="nofollow" class="external free" href="ftp://%7Cx">ftp://%7Cx</a></td>
3362 <td>]" onmouseover="alert(document.cookie)"&gt;test
3363 </td>
3364 </tr>
3365 </table>
3366
3367 !! end
3368
3369
3370 !! test
3371 Indented table markup mixed with indented pre content (proposed in bug 6200)
3372 !! input
3373 <table>
3374 <tr>
3375 <td>
3376 Text that should be rendered preformatted
3377 </td>
3378 </tr>
3379 </table>
3380 !! result
3381 <table>
3382 <tr>
3383 <td>
3384 <pre>Text that should be rendered preformatted
3385 </pre>
3386 </td>
3387 </tr>
3388 </table>
3389
3390 !! end
3391
3392 !! test
3393 Template-generated table cell attributes and cell content
3394 !! input
3395 {|
3396 |{{table_attribs}}
3397 |}
3398 !! result
3399 <table>
3400 <tr>
3401 <td style="color: red"> Foo
3402 </td></tr></table>
3403
3404 !! end
3405
3406 !! test
3407 Table with row followed by newlines and table heading
3408 !! input
3409 {|
3410 |-
3411
3412 ! foo
3413 |}
3414 !! result
3415 <table>
3416
3417
3418 <tr>
3419 <th> foo
3420 </th></tr></table>
3421
3422 !! end
3423
3424 !! test
3425 Table with empty line following the start tag
3426 !! input
3427 {|
3428
3429 |-
3430 | foo
3431 |}
3432 !! result
3433 <table>
3434
3435
3436 <tr>
3437 <td> foo
3438 </td></tr></table>
3439
3440 !! end
3441
3442 # FIXME: Preserve the attribute properly (with an empty string as value) in
3443 # the PHP parser. Parsoid implements the behavior below.
3444 !! test
3445 Table attributes with empty value
3446 !! options
3447 disabled
3448 !! input
3449 {|
3450 | style=| hello
3451 |}
3452 !! result
3453 <table>
3454 <tr>
3455 <td style=""> hello
3456 </td></tr></table>
3457
3458 !! end
3459
3460 !! test
3461 Wikitext table with a lot of comments
3462 !! input
3463 {|
3464 <!-- c0 -->
3465 | foo
3466 <!-- c1 -->
3467 |- <!-- c2 -->
3468 <!-- c3 -->
3469 |<!-- c4 -->
3470 <!-- c5 -->
3471 |}
3472 !! result
3473 <table>
3474 <tr>
3475 <td> foo
3476 </td></tr>
3477 <tr>
3478 <td>
3479 </td></tr></table>
3480
3481 !! end
3482
3483 !! test
3484 Wikitext table with double-line table cell
3485 !! input
3486 {|
3487 |a
3488 b
3489 |}
3490 !! result
3491 <table>
3492 <tr>
3493 <td>a
3494 <p>b
3495 </p>
3496 </td></tr></table>
3497
3498 !! end
3499
3500 !! test
3501 Table cell with a single comment
3502 !! input
3503 {|
3504 | <!-- c1 -->
3505 | a
3506 |}
3507 !! result
3508 <table>
3509 <tr>
3510 <td>
3511 </td>
3512 <td> a
3513 </td></tr></table>
3514
3515 !! end
3516
3517 # The expected HTML structure in this test is debatable. The PHP parser does
3518 # not parse this kind of table at all. The main focus for Parsoid is on
3519 # round-tripping, so this output is ok for now. TODO: revisit!
3520 !! test
3521 Wikitext table with html-syntax row (Parsoid)
3522 !! options
3523 parsoid
3524 !! input
3525 {|
3526 |-
3527 <td>foo</td>
3528 |}
3529 !! result
3530 <table>
3531 <tbody>
3532 <tr>
3533 <td>foo</td></tr></tbody></table>
3534 !! end
3535
3536 ###
3537 ### Internal links
3538 ###
3539 !! test
3540 Plain link, capitalized
3541 !! input
3542 [[Main Page]]
3543 !! result
3544 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
3545 </p>
3546 !! end
3547
3548 !! test
3549 Plain link, uncapitalized
3550 !! input
3551 [[main Page]]
3552 !! result
3553 <p><a href="/wiki/Main_Page" title="Main Page">main Page</a>
3554 </p>
3555 !! end
3556
3557 !! test
3558 Piped link
3559 !! input
3560 [[Main Page|The Main Page]]
3561 !! result
3562 <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
3563 </p>
3564 !! end
3565
3566 !! test
3567 Broken link
3568 !! input
3569 [[Zigzagzogzagzig]]
3570 !! result
3571 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig</a>
3572 </p>
3573 !! end
3574
3575 !! test
3576 Broken link with fragment
3577 !! input
3578 [[Zigzagzogzagzig#zug]]
3579 !! result
3580 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig#zug</a>
3581 </p>
3582 !! end
3583
3584 !! test
3585 Special page link with fragment
3586 !! input
3587 [[Special:Version#anchor]]
3588 !! result
3589 <p><a href="/wiki/Special:Version#anchor" title="Special:Version">Special:Version#anchor</a>
3590 </p>
3591 !! end
3592
3593 !! test
3594 Nonexistent special page link with fragment
3595 !! input
3596 [[Special:ThisNameWillHopefullyNeverBeUsed#anchor]]
3597 !! result
3598 <p><a href="/wiki/Special:ThisNameWillHopefullyNeverBeUsed" class="new" title="Special:ThisNameWillHopefullyNeverBeUsed (page does not exist)">Special:ThisNameWillHopefullyNeverBeUsed#anchor</a>
3599 </p>
3600 !! end
3601
3602 !! test
3603 Link with prefix
3604 !! input
3605 xxx[[main Page]], xxx[[Main Page]], Xxx[[main Page]] XXX[[main Page]], XXX[[Main Page]]
3606 !! result
3607 <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>
3608 </p>
3609 !! end
3610
3611 !! test
3612 Link with suffix
3613 !! input
3614 [[Main Page]]xxx, [[Main Page]]XXX, [[Main Page]]!!!
3615 !! result
3616 <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>!!!
3617 </p>
3618 !! end
3619
3620 !! article
3621 prefixed article
3622 !! text
3623 Some text
3624 !! endarticle
3625
3626 !! test
3627 Bug 43661: Piped links with identical prefixes
3628 !! input
3629 [[prefixed article|prefixed articles with spaces]]
3630
3631 [[prefixed article|prefixed articlesaoeu]]
3632
3633 [[Main Page|Main Page test]]
3634 !! result
3635 <p><a href="/wiki/Prefixed_article" title="Prefixed article">prefixed articles with spaces</a>
3636 </p><p><a href="/wiki/Prefixed_article" title="Prefixed article">prefixed articlesaoeu</a>
3637 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page test</a>
3638 </p>
3639 !! end
3640
3641
3642 !! test
3643 Link with HTML entity in suffix / tail
3644 !! input
3645 [[Main Page]]&quot;, [[Main Page]]&#97;
3646 !! result
3647 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>&quot;, <a href="/wiki/Main_Page" title="Main Page">Main Page</a>&#97;
3648 </p>
3649 !! end
3650
3651 !! test
3652 Link with 3 brackets
3653 !! input
3654 [[[main page]]]
3655 !! result
3656 <p>[[[main page]]]
3657 </p>
3658 !! end
3659
3660 !! test
3661 Piped link with 3 brackets
3662 !! input
3663 [[[main page|the main page]]]
3664 !! result
3665 <p>[[[main page|the main page]]]
3666 </p>
3667 !! end
3668
3669 !! test
3670 Link with multiple pipes
3671 !! input
3672 [[Main Page|The|Main|Page]]
3673 !! result
3674 <p><a href="/wiki/Main_Page" title="Main Page">The|Main|Page</a>
3675 </p>
3676 !! end
3677
3678 !! test
3679 Link to namespaces
3680 !! input
3681 [[Talk:Parser testing]], [[Meta:Disclaimers]]
3682 !! result
3683 <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>
3684 </p>
3685 !! end
3686
3687 !! test
3688 Piped link to namespace
3689 !! input
3690 [[Meta:Disclaimers|The disclaimers]]
3691 !! result
3692 <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>
3693 </p>
3694 !! end
3695
3696 !! test
3697 Link containing }
3698 !! input
3699 [[Usually caused by a typo (oops}]]
3700 !! result
3701 <p>[[Usually caused by a typo (oops}]]
3702 </p>
3703 !! end
3704
3705 !! test
3706 Link containing % (not as a hex sequence)
3707 !! input
3708 [[7% Solution]]
3709 !! result
3710 <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>
3711 </p>
3712 !! end
3713
3714 !! test
3715 Link containing % as a single hex sequence interpreted to char
3716 !! input
3717 [[7%25 Solution]]
3718 !! result
3719 <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>
3720 </p>
3721 !!end
3722
3723 !! test
3724 Link containing % as a double hex sequence interpreted to hex sequence
3725 !! input
3726 [[7%2525 Solution]]
3727 !! result
3728 <p>[[7%2525 Solution]]
3729 </p>
3730 !!end
3731
3732 !! test
3733 Link containing "#<" and "#>" % as a hex sequences- these are valid section anchors
3734 Example for such a section: == < ==
3735 !! input
3736 [[%23%3c]][[%23%3e]]
3737 !! result
3738 <p><a href="#.3C">#&lt;</a><a href="#.3E">#&gt;</a>
3739 </p>
3740 !! end
3741
3742 !! test
3743 Link containing "<#" and ">#" as a hex sequences
3744 !! input
3745 [[%3c%23]][[%3e%23]]
3746 !! result
3747 <p>[[%3c%23]][[%3e%23]]
3748 </p>
3749 !! end
3750
3751 !! test
3752 Link containing double-single-quotes '' (bug 4598)
3753 !! input
3754 [[Lista d''e paise d''o munno]]
3755 !! result
3756 <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>
3757 </p>
3758 !! end
3759
3760 !! test
3761 Link containing double-single-quotes '' in text (bug 4598 sanity check)
3762 !! input
3763 Some [[Link|pretty ''italics'' and stuff]]!
3764 !! result
3765 <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>!
3766 </p>
3767 !! end
3768
3769 !! test
3770 Link containing double-single-quotes '' in text embedded in italics (bug 4598 sanity check)
3771 !! input
3772 ''Some [[Link|pretty ''italics'' and stuff]]!
3773 !! result
3774 <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>
3775 </p>
3776 !! end
3777
3778 !! test
3779 Link with double quotes in title part (literal) and alternate part (interpreted)
3780 !! input
3781 [[File:Denys Savchenko ''Pentecoste''.jpg]]
3782
3783 [[''Pentecoste'']]
3784
3785 [[''Pentecoste''|Pentecoste]]
3786
3787 [[''Pentecoste''|''Pentecoste'']]
3788 !! result
3789 <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>
3790 </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>
3791 </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>
3792 </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>
3793 </p>
3794 !! end
3795
3796 !! test
3797 Broken image links with HTML captions (bug 39700)
3798 !! input
3799 [[File:Nonexistent|<script></script>]]
3800 [[File:Nonexistent|100px|<script></script>]]
3801 [[File:Nonexistent|&lt;]]
3802 [[File:Nonexistent|a<i>b</i>c]]
3803 !! result
3804 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script&gt;&lt;/script&gt;</a>
3805 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script&gt;&lt;/script&gt;</a>
3806 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;</a>
3807 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">abc</a>
3808 </p>
3809 !! end
3810
3811 !! test
3812 Plain link to URL
3813 !! input
3814 [[http://www.example.com]]
3815 !! result
3816 <p>[<a rel="nofollow" class="external autonumber" href="http://www.example.com">[1]</a>]
3817 </p>
3818 !! end
3819
3820 !! test
3821 Plain link to URL with link text
3822 !! input
3823 [[http://www.example.com Link text]]
3824 !! result
3825 <p>[<a rel="nofollow" class="external text" href="http://www.example.com">Link text</a>]
3826 </p>
3827 !! end
3828
3829 !! test
3830 Plain link to protocol-relative URL
3831 !! input
3832 [[//www.example.com]]
3833 !! result
3834 <p>[<a rel="nofollow" class="external autonumber" href="//www.example.com">[1]</a>]
3835 </p>
3836 !! end
3837
3838 !! test
3839 Plain link to protocol-relative URL with link text
3840 !! input
3841 [[//www.example.com Link text]]
3842 !! result
3843 <p>[<a rel="nofollow" class="external text" href="//www.example.com">Link text</a>]
3844 </p>
3845 !! end
3846
3847 !! test
3848 Plain link to page with question mark in title
3849 !! input
3850 [[A?b]]
3851
3852 [[A?b|Baz]]
3853 !! result
3854 <p><a href="/wiki/A%3Fb" title="A?b">A?b</a>
3855 </p><p><a href="/wiki/A%3Fb" title="A?b">Baz</a>
3856 </p>
3857 !! end
3858
3859
3860 # I'm fairly sure the expected result here is wrong.
3861 # We want these to be URL links, not pseudo-pages with URLs for titles....
3862 # However the current output is also pretty screwy.
3863 #
3864 # ----
3865 # I'm changing it to match the current output--it arguably makes more
3866 # sense in the light of the test above. Old expected result was:
3867 #<p>Piped link to URL: <a href="/index.php?title=Http://www.example.com&amp;action=edit" class="new">an example URL</a>
3868 #</p>
3869 # But I think this test is bordering on "garbage in, garbage out" anyway.
3870 # -- wtm
3871 !! test
3872 Piped link to URL
3873 !! input
3874 Piped link to URL: [[http://www.example.com|an example URL]]
3875 !! result
3876 <p>Piped link to URL: [<a rel="nofollow" class="external text" href="http://www.example.com%7Can">example URL</a>]
3877 </p>
3878 !! end
3879
3880 !! test
3881 BUG 2: [[page|http://url/]] should link to page, not http://url/
3882 !! input
3883 [[Main Page|http://url/]]
3884 !! result
3885 <p><a href="/wiki/Main_Page" title="Main Page">http://url/</a>
3886 </p>
3887 !! end
3888
3889 !! test
3890 BUG 337: Escaped self-links should be bold
3891 !! options
3892 title=[[Bug462]]
3893 !! input
3894 [[Bu&#103;462]] [[Bug462]]
3895 !! result
3896 <p><strong class="selflink">Bu&#103;462</strong> <strong class="selflink">Bug462</strong>
3897 </p>
3898 !! end
3899
3900 !! test
3901 Self-link to section should not be bold
3902 !! options
3903 title=[[Main Page]]
3904 !! input
3905 [[Main Page#section]]
3906 !! result
3907 <p><a href="/wiki/Main_Page#section" title="Main Page">Main Page#section</a>
3908 </p>
3909 !! end
3910
3911 !! article
3912 00
3913 !! text
3914 This is 00.
3915 !! endarticle
3916
3917 !!test
3918 Self-link to numeric title
3919 !!options
3920 title=[[0]]
3921 !!input
3922 [[0]]
3923 !!result
3924 <p><strong class="selflink">0</strong>
3925 </p>
3926 !!end
3927
3928 !!test
3929 Link to numeric-equivalent title
3930 !!options
3931 title=[[0]]
3932 !!input
3933 [[00]]
3934 !!result
3935 <p><a href="/wiki/00" title="00">00</a>
3936 </p>
3937 !!end
3938
3939 !! test
3940 <nowiki> inside a link
3941 !! input
3942 [[Main<nowiki> Page</nowiki>]] [[Main Page|the main page <nowiki>[it's not very good]</nowiki>]]
3943 !! result
3944 <p>[[Main Page]] <a href="/wiki/Main_Page" title="Main Page">the main page [it's not very good]</a>
3945 </p>
3946 !! end
3947
3948 !! test
3949 Non-breaking spaces in title
3950 !! input
3951 [[&nbsp; Main &nbsp; Page &nbsp;]]
3952 !! result
3953 <p><a href="/wiki/Main_Page" title="Main Page">&#160; Main &#160; Page &#160;</a>
3954 </p>
3955 !!end
3956
3957 !! test
3958 Internal link with ca linktrail, surrounded by bold apostrophes (bug 27473 primary issue)
3959 !! options
3960 language=ca
3961 !! input
3962 '''[[Main Page]]'''
3963 !! result
3964 <p><b><a href="/wiki/Main_Page" title="Main Page">Main Page</a></b>
3965 </p>
3966 !! end
3967
3968 !! test
3969 Internal link with ca linktrail, surrounded by italic apostrophes (bug 27473 primary issue)
3970 !! options
3971 language=ca
3972 !! input
3973 ''[[Main Page]]''
3974 !! result
3975 <p><i><a href="/wiki/Main_Page" title="Main Page">Main Page</a></i>
3976 </p>
3977 !! end
3978
3979 !! test
3980 Internal link with en linktrail: no apostrophes (bug 27473)
3981 !! options
3982 language=en
3983 !! input
3984 [[Something]]'nice
3985 !! result
3986 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (page does not exist)">Something</a>'nice
3987 </p>
3988 !! end
3989
3990 !! test
3991 Internal link with ca linktrail with apostrophes (bug 27473)
3992 !! options
3993 language=ca
3994 !! input
3995 [[Something]]'nice
3996 !! result
3997 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (encara no existeix)">Something'nice</a>
3998 </p>
3999 !! end
4000
4001 !! test
4002 Internal link with kaa linktrail with apostrophes (bug 27473)
4003 !! options
4004 language=kaa
4005 !! input
4006 [[Something]]'nice
4007 !! result
4008 <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>
4009 </p>
4010 !! end
4011
4012 !! test
4013 Parsoid-centric test: Whitespace in ext- and wiki-links should be preserved
4014 !! input
4015 [[Foo| bar]]
4016
4017 [[Foo| ''bar'']]
4018
4019 [http://wp.org foo]
4020
4021 [http://wp.org ''foo'']
4022 !! result
4023 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)"> bar</a>
4024 </p><p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)"> <i>bar</i></a>
4025 </p><p><a rel="nofollow" class="external text" href="http://wp.org">foo</a>
4026 </p><p><a rel="nofollow" class="external text" href="http://wp.org"><i>foo</i></a>
4027 </p>
4028 !! end
4029
4030 ###
4031 ### Interwiki links (see maintenance/interwiki.sql)
4032 ###
4033
4034 !! test
4035 Inline interwiki link
4036 !! input
4037 [[MeatBall:SoftSecurity]]
4038 !! result
4039 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity</a>
4040 </p>
4041 !! end
4042
4043 !! test
4044 Inline interwiki link with empty title (bug 2372)
4045 !! input
4046 [[MeatBall:]]
4047 !! result
4048 <p><a href="http://www.usemod.com/cgi-bin/mb.pl" class="extiw" title="meatball:">MeatBall:</a>
4049 </p>
4050 !! end
4051
4052 !! test
4053 Interwiki link encoding conversion (bug 1636)
4054 !! input
4055 *[[Wikipedia:ro:Olteni&#0355;a]]
4056 *[[Wikipedia:ro:Olteni&#355;a]]
4057 !! result
4058 <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>
4059 </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>
4060 </li></ul>
4061
4062 !! end
4063
4064 !! test
4065 Interwiki link with fragment (bug 2130)
4066 !! input
4067 [[MeatBall:SoftSecurity#foo]]
4068 !! result
4069 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity#foo" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity#foo</a>
4070 </p>
4071 !! end
4072
4073 !! test
4074 Interlanguage link
4075 !! input
4076 Blah blah blah
4077 [[zh:Chinese]]
4078 !!result
4079 <p>Blah blah blah
4080 </p>
4081 !! end
4082
4083 !! test
4084 Double interlanguage link
4085 !! input
4086 Blah blah blah
4087 [[es:Spanish]]
4088 [[zh:Chinese]]
4089 !!result
4090 <p>Blah blah blah
4091 </p>
4092 !! end
4093
4094 !! test
4095 Interlanguage link, with prefix links
4096 !! options
4097 language=ln
4098 !! input
4099 Blah blah blah
4100 [[zh:Chinese]]
4101 !!result
4102 <p>Blah blah blah
4103 </p>
4104 !! end
4105
4106 !! test
4107 Double interlanguage link, with prefix links (bug 8897)
4108 !! options
4109 language=ln
4110 !! input
4111 Blah blah blah
4112 [[es:Spanish]]
4113 [[zh:Chinese]]
4114 !!result
4115 <p>Blah blah blah
4116 </p>
4117 !! end
4118
4119 !! test
4120 Parsoid-specific test: Wikilinks with &nbsp; should RT properly
4121 !! options
4122 language=ln
4123 !! input
4124 [[WW&nbsp;II]]
4125 !!result
4126 <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>
4127 </p>
4128 !! end
4129
4130 ##
4131 ## XHTML tidiness
4132 ###
4133
4134 !! test
4135 <br> to <br />
4136 !! input
4137 1<br>2<br />3
4138 !! result
4139 <p>1<br />2<br />3
4140 </p>
4141 !! end
4142
4143 !! test
4144 Broken br tag sanitization
4145 !! input
4146 </br>
4147 !! result
4148 <p>&lt;/br&gt;
4149 </p>
4150 !! end
4151
4152 !! test
4153 Incorrecly removing closing slashes from correctly formed XHTML
4154 !! input
4155 <br style="clear:both;" />
4156 !! result
4157 <p><br style="clear:both;" />
4158 </p>
4159 !! end
4160
4161 !! test
4162 Failing to transform badly formed HTML into correct XHTML
4163 !! input
4164 <br style="clear: left;">
4165 <br style="clear: right;">
4166 <br style="clear: both;">
4167 !! result
4168 <p><br style="clear: left;" />
4169 <br style="clear: right;" />
4170 <br style="clear: both;" />
4171 </p>
4172 !!end
4173
4174 !! test
4175 Handling html with a div self-closing tag
4176 !! input
4177 <div title />
4178 <div title/>
4179 <div title/ >
4180 <div title=bar />
4181 <div title=bar/>
4182 <div title=bar/ >
4183 !! result
4184 <p>&lt;div title /&gt;
4185 &lt;div title/&gt;
4186 </p>
4187 <div>
4188 <p>&lt;div title=bar /&gt;
4189 &lt;div title=bar/&gt;
4190 </p>
4191 <div title="bar/"></div>
4192 </div>
4193
4194 !! end
4195
4196 !! test
4197 Handling html with a br self-closing tag
4198 !! input
4199 <br title />
4200 <br title/>
4201 <br title/ >
4202 <br title=bar />
4203 <br title=bar/>
4204 <br title=bar/ >
4205 !! result
4206 <p><br title="title" />
4207 <br title="title" />
4208 <br />
4209 <br title="bar" />
4210 <br title="bar" />
4211 <br title="bar/" />
4212 </p>
4213 !! end
4214
4215 !! test
4216 Horizontal ruler (should it add that extra space?)
4217 !! input
4218 <hr>
4219 <hr >
4220 foo <hr
4221 > bar
4222 !! result
4223 <hr />
4224 <hr />
4225 foo <hr /> bar
4226
4227 !! end
4228
4229 !! test
4230 Horizontal ruler -- 4+ dashes render hr
4231 !! input
4232 ----
4233 !! result
4234 <hr />
4235
4236 !! end
4237
4238 !! test
4239 Horizontal ruler -- eats additional dashes on the same line
4240 !! input
4241 ---------
4242 !! result
4243 <hr />
4244
4245 !! end
4246
4247 !! test
4248 Horizontal ruler -- does not collapse dashes on consecutive lines
4249 !! input
4250 ----
4251 ----
4252 !! result
4253 <hr />
4254 <hr />
4255
4256 !! end
4257
4258 !! test
4259 Horizontal ruler -- <4 dashes render as plain text
4260 !! input
4261 ---
4262 !! result
4263 <p>---
4264 </p>
4265 !! end
4266
4267 !! test
4268 Horizontal ruler -- Supports content following dashes on same line
4269 !! input
4270 ---- Foo
4271 !! result
4272 <hr /> Foo
4273
4274 !! end
4275
4276 ###
4277 ### Block-level elements
4278 ###
4279 !! test
4280 Common list
4281 !! input
4282 *Common list
4283 * item 2
4284 *item 3
4285 !! result
4286 <ul><li>Common list
4287 </li><li> item 2
4288 </li><li>item 3
4289 </li></ul>
4290
4291 !! end
4292
4293 !! test
4294 Numbered list
4295 !! input
4296 #Numbered list
4297 #item 2
4298 # item 3
4299 !! result
4300 <ol><li>Numbered list
4301 </li><li>item 2
4302 </li><li> item 3
4303 </li></ol>
4304
4305 !! end
4306
4307 !! test
4308 Mixed list
4309 !! input
4310 *Mixed list
4311 *# with numbers
4312 ** and bullets
4313 *# and numbers
4314 *bullets again
4315 **bullet level 2
4316 ***bullet level 3
4317 ***#Number on level 4
4318 **bullet level 2
4319 **#Number on level 3
4320 **#Number on level 3
4321 *#number level 2
4322 *Level 1
4323 *** Level 3
4324 #** Level 3, but ordered
4325 !! result
4326 <ul><li>Mixed list
4327 <ol><li> with numbers
4328 </li></ol>
4329 <ul><li> and bullets
4330 </li></ul>
4331 <ol><li> and numbers
4332 </li></ol>
4333 </li><li>bullets again
4334 <ul><li>bullet level 2
4335 <ul><li>bullet level 3
4336 <ol><li>Number on level 4
4337 </li></ol>
4338 </li></ul>
4339 </li><li>bullet level 2
4340 <ol><li>Number on level 3
4341 </li><li>Number on level 3
4342 </li></ol>
4343 </li></ul>
4344 <ol><li>number level 2
4345 </li></ol>
4346 </li><li>Level 1
4347 <ul><li><ul><li> Level 3
4348 </li></ul>
4349 </li></ul>
4350 </li></ul>
4351 <ol><li><ul><li><ul><li> Level 3, but ordered
4352 </li></ul>
4353 </li></ul>
4354 </li></ol>
4355
4356 !! end
4357
4358 !! test
4359 Nested lists 1
4360 !! input
4361 *foo
4362 **bar
4363 !! result
4364 <ul><li>foo
4365 <ul><li>bar
4366 </li></ul>
4367 </li></ul>
4368
4369 !! end
4370
4371 !! test
4372 Nested lists 2
4373 !! input
4374 **foo
4375 *bar
4376 !! result
4377 <ul><li><ul><li>foo
4378 </li></ul>
4379 </li><li>bar
4380 </li></ul>
4381
4382 !! end
4383
4384 !! test
4385 Nested lists 3 (first element empty)
4386 !! input
4387 *
4388 **bar
4389 !! result
4390 <ul><li>
4391 <ul><li>bar
4392 </li></ul>
4393 </li></ul>
4394
4395 !! end
4396
4397 !! test
4398 Nested lists 4 (first element empty)
4399 !! input
4400 **
4401 *bar
4402 !! result
4403 <ul><li><ul><li>
4404 </li></ul>
4405 </li><li>bar
4406 </li></ul>
4407
4408 !! end
4409
4410 !! test
4411 Nested lists 5 (both elements empty)
4412 !! input
4413 **
4414 *
4415 !! result
4416 <ul><li><ul><li>
4417 </li></ul>
4418 </li><li>
4419 </li></ul>
4420
4421 !! end
4422
4423 !! test
4424 Nested lists 6 (both elements empty)
4425 !! input
4426 *
4427 **
4428 !! result
4429 <ul><li>
4430 <ul><li>
4431 </li></ul>
4432 </li></ul>
4433
4434 !! end
4435
4436 !! test
4437 Nested lists 7 (skip initial nesting levels)
4438 !! input
4439 *** foo
4440 !! result
4441 <ul><li><ul><li><ul><li> foo
4442 </li></ul>
4443 </li></ul>
4444 </li></ul>
4445
4446 !! end
4447
4448 !! test
4449 Nested lists 8 (multiple nesting transitions)
4450 !! input
4451 * foo
4452 *** bar
4453 ** baz
4454 * boo
4455 !! result
4456 <ul><li> foo
4457 <ul><li><ul><li> bar
4458 </li></ul>
4459 </li><li> baz
4460 </li></ul>
4461 </li><li> boo
4462 </li></ul>
4463
4464 !! end
4465
4466 !! test
4467 1. Lists with start-of-line-transparent tokens before bullets: Comments
4468 !! input
4469 *foo
4470 *<!--cmt-->bar
4471 <!--cmt-->*baz
4472 !! result
4473 <ul><li>foo
4474 </li><li>bar
4475 </li><li>baz
4476 </li></ul>
4477
4478 !! end
4479
4480 !! test
4481 2. Lists with start-of-line-transparent tokens before bullets: Template close
4482 !! input
4483 *foo {{echo|bar
4484 }}*baz
4485 !! result
4486 <ul><li>foo bar
4487 </li><li>baz
4488 </li></ul>
4489
4490 !! end
4491
4492 !! test
4493 Unbalanced closing block tags break a list
4494 (Disabled since php parser generates broken html -- relies on Tidy to fix up)
4495 !! options
4496 disabled
4497 !! input
4498 <div>
4499 *a</div><div>
4500 *b</div>
4501 !! result
4502 <div>
4503 <ul><li>a
4504 </li></ul></div><div>
4505 <ul><li>b
4506 </li></ul></div>
4507 !! end
4508
4509 !! test
4510 Unbalanced closing non-block tags don't break a list
4511 (Disabled since php parser generates broken html -- relies on Tidy to fix up)
4512 !! options
4513 disabled
4514 !! input
4515 <span>
4516 *a</span><span>
4517 *b</span>
4518 !! result
4519 <p><span></span>
4520 </p>
4521 <ul><li>a<span></span>
4522 </li><li>b
4523 </li></ul>
4524 !! end
4525
4526 !! test
4527 Unclosed formatting tags that straddle lists are closed and reopened
4528 (Disabled since php parser generates broken html -- relies on Tidy to fix up)
4529 !! options
4530 disabled
4531 !! input
4532 # <s> a
4533 # b </s>
4534 !! result
4535 <ol><li> <s> a </s>
4536 </li><li> <s> b </s>
4537 </li></ol>
4538 !! end
4539
4540 !!test
4541 List embedded in a non-block tag
4542 (Ugly Parsoid output -- worth fixing; Disabled for PHP parser since it relies on Tidy)
4543 !! options
4544 parsoid
4545 !!input
4546 <small>
4547 * foo
4548 </small>
4549 !!result
4550 <p><small></small></p>
4551 <small>
4552 <ul>
4553 <li> foo</li>
4554 </ul>
4555 </small>
4556 <p><small></small></p>
4557 !!end
4558
4559 !! test
4560 List items are not parsed correctly following a <pre> block (bug 785)
4561 !! input
4562 * <pre>foo</pre>
4563 * <pre>bar</pre>
4564 * zar
4565 !! result
4566 <ul><li> <pre>foo</pre>
4567 </li><li> <pre>bar</pre>
4568 </li><li> zar
4569 </li></ul>
4570
4571 !! end
4572
4573 !! test
4574 List items from template
4575 !! input
4576
4577 {{inner list}}
4578 * item 2
4579
4580 * item 0
4581 {{inner list}}
4582 * item 2
4583
4584 * item 0
4585 * notSOL{{inner list}}
4586 * item 2
4587 !! result
4588 <ul><li> item 1
4589 </li><li> item 2
4590 </li></ul>
4591 <ul><li> item 0
4592 </li><li> item 1
4593 </li><li> item 2
4594 </li></ul>
4595 <ul><li> item 0
4596 </li><li> notSOL
4597 </li><li> item 1
4598 </li><li> item 2
4599 </li></ul>
4600
4601 !! end
4602
4603 !! test
4604 List interrupted by empty line or heading
4605 !! input
4606 * foo
4607
4608 ** bar
4609 == A heading ==
4610 * Another list item
4611 !! result
4612 <ul><li> foo
4613 </li></ul>
4614 <ul><li><ul><li> bar
4615 </li></ul>
4616 </li></ul>
4617 <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>
4618 <ul><li> Another list item
4619 </li></ul>
4620
4621 !!end
4622
4623 !!test
4624 Multiple list tags generated by templates
4625 !!input
4626 {{echo|<li>}}a
4627 {{echo|<li>}}b
4628 {{echo|<li>}}c
4629 !!result
4630 <li>a
4631 <li>b
4632 <li>c</li>
4633 </li>
4634 </li>
4635
4636 !!end
4637
4638 !!test
4639 Single-comment whitespace lines dont break lists, but multi-comment whitespace lines do
4640 !!input
4641 *a
4642 <!--This line will NOT split the list-->
4643 *b
4644 <!--This line will NOT split the list either-->
4645 *c
4646 <!--foo--> <!--This line with more than 1 comment will split the list-->
4647 *d
4648 !!result
4649 <ul><li>a
4650 </li><li>b
4651 </li><li>c
4652 </li></ul>
4653 <ul><li>d
4654 </li></ul>
4655
4656 !!end
4657
4658 ###
4659 ### Magic Words
4660 ###
4661
4662 !! test
4663 Magic Word: {{CURRENTDAY}}
4664 !! input
4665 {{CURRENTDAY}}
4666 !! result
4667 <p>1
4668 </p>
4669 !! end
4670
4671 !! test
4672 Magic Word: {{CURRENTDAY2}}
4673 !! input
4674 {{CURRENTDAY2}}
4675 !! result
4676 <p>01
4677 </p>
4678 !! end
4679
4680 !! test
4681 Magic Word: {{CURRENTDAYNAME}}
4682 !! input
4683 {{CURRENTDAYNAME}}
4684 !! result
4685 <p>Thursday
4686 </p>
4687 !! end
4688
4689 !! test
4690 Magic Word: {{CURRENTDOW}}
4691 !! input
4692 {{CURRENTDOW}}
4693 !! result
4694 <p>4
4695 </p>
4696 !! end
4697
4698 !! test
4699 Magic Word: {{CURRENTMONTH}}
4700 !! input
4701 {{CURRENTMONTH}}
4702 !! result
4703 <p>01
4704 </p>
4705 !! end
4706
4707 !! test
4708 Magic Word: {{CURRENTMONTHABBREV}}
4709 !! input
4710 {{CURRENTMONTHABBREV}}
4711 !! result
4712 <p>Jan
4713 </p>
4714 !! end
4715
4716 !! test
4717 Magic Word: {{CURRENTMONTHNAME}}
4718 !! input
4719 {{CURRENTMONTHNAME}}
4720 !! result
4721 <p>January
4722 </p>
4723 !! end
4724
4725 !! test
4726 Magic Word: {{CURRENTMONTHNAMEGEN}}
4727 !! input
4728 {{CURRENTMONTHNAMEGEN}}
4729 !! result
4730 <p>January
4731 </p>
4732 !! end
4733
4734 !! test
4735 Magic Word: {{CURRENTTIME}}
4736 !! input
4737 {{CURRENTTIME}}
4738 !! result
4739 <p>00:02
4740 </p>
4741 !! end
4742
4743 !! test
4744 Magic Word: {{CURRENTWEEK}} (@bug 4594)
4745 !! input
4746 {{CURRENTWEEK}}
4747 !! result
4748 <p>1
4749 </p>
4750 !! end
4751
4752 !! test
4753 Magic Word: {{CURRENTYEAR}}
4754 !! input
4755 {{CURRENTYEAR}}
4756 !! result
4757 <p>1970
4758 </p>
4759 !! end
4760
4761 !! test
4762 Magic Word: {{FULLPAGENAME}}
4763 !! options
4764 title=[[User:Ævar Arnfjörð Bjarmason]]
4765 !! input
4766 {{FULLPAGENAME}}
4767 !! result
4768 <p>User:Ævar Arnfjörð Bjarmason
4769 </p>
4770 !! end
4771
4772 !! test
4773 Magic Word: {{FULLPAGENAMEE}}
4774 !! options
4775 title=[[User:Ævar Arnfjörð Bjarmason]]
4776 !! input
4777 {{FULLPAGENAMEE}}
4778 !! result
4779 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
4780 </p>
4781 !! end
4782
4783 !! test
4784 Magic Word: {{NAMESPACE}}
4785 !! options
4786 title=[[User:Ævar Arnfjörð Bjarmason]]
4787 !! input
4788 {{NAMESPACE}}
4789 !! result
4790 <p>User
4791 </p>
4792 !! end
4793
4794 !! test
4795 Magic Word: {{NAMESPACEE}}
4796 !! options
4797 title=[[User:Ævar Arnfjörð Bjarmason]]
4798 !! input
4799 {{NAMESPACEE}}
4800 !! result
4801 <p>User
4802 </p>
4803 !! end
4804
4805 !! test
4806 Magic Word: {{NAMESPACENUMBER}}
4807 !! options
4808 title=[[User:Ævar Arnfjörð Bjarmason]]
4809 !! input
4810 {{NAMESPACENUMBER}}
4811 !! result
4812 <p>2
4813 </p>
4814 !! end
4815
4816 !! test
4817 Magic Word: {{NUMBEROFFILES}}
4818 !! input
4819 {{NUMBEROFFILES}}
4820 !! result
4821 <p>3
4822 </p>
4823 !! end
4824
4825 !! test
4826 Magic Word: {{PAGENAME}}
4827 !! options
4828 title=[[User:Ævar Arnfjörð Bjarmason]]
4829 !! input
4830 {{PAGENAME}}
4831 !! result
4832 <p>Ævar Arnfjörð Bjarmason
4833 </p>
4834 !! end
4835
4836 !! test
4837 Magic Word: {{PAGENAME}} with metacharacters
4838 !! options
4839 title=[['foo & bar = baz']]
4840 !! input
4841 ''{{PAGENAME}}''
4842 !! result
4843 <p><i>&#39;foo &#38; bar &#61; baz&#39;</i>
4844 </p>
4845 !! end
4846
4847 !! test
4848 Magic Word: {{PAGENAME}} with metacharacters (bug 26781)
4849 !! options
4850 title=[[*RFC 1234 http://example.com/]]
4851 !! input
4852 {{PAGENAME}}
4853 !! result
4854 <p>&#42;RFC&#32;1234 http&#58;//example.com/
4855 </p>
4856 !! end
4857
4858 !! test
4859 Magic Word: {{PAGENAMEE}}
4860 !! options
4861 title=[[User:Ævar Arnfjörð Bjarmason]]
4862 !! input
4863 {{PAGENAMEE}}
4864 !! result
4865 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
4866 </p>
4867 !! end
4868
4869 !! test
4870 Magic Word: {{PAGENAMEE}} with metacharacters (bug 26781)
4871 !! options
4872 title=[[*RFC 1234 http://example.com/]]
4873 !! input
4874 {{PAGENAMEE}}
4875 !! result
4876 <p>&#42;RFC_1234_http&#58;//example.com/
4877 </p>
4878 !! end
4879
4880 !! test
4881 Magic Word: {{REVISIONID}}
4882 !! input
4883 {{REVISIONID}}
4884 !! result
4885 <p>1337
4886 </p>
4887 !! end
4888
4889 !! test
4890 Magic Word: {{SCRIPTPATH}}
4891 !! input
4892 {{SCRIPTPATH}}
4893 !! result
4894 <p>/
4895 </p>
4896 !! end
4897
4898 !! test
4899 Magic Word: {{SERVER}}
4900 !! input
4901 {{SERVER}}
4902 !! result
4903 <p><a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
4904 </p>
4905 !! end
4906
4907 !! test
4908 Magic Word: {{SERVERNAME}}
4909 !! input
4910 {{SERVERNAME}}
4911 !! result
4912 <p>example.org
4913 </p>
4914 !! end
4915
4916 !! test
4917 Magic Word: {{SITENAME}}
4918 !! input
4919 {{SITENAME}}
4920 !! result
4921 <p>MediaWiki
4922 </p>
4923 !! end
4924
4925 !! test
4926 Case-sensitive magic words, when cased differently, should just be template transclusions
4927 !! input
4928 {{CurrentMonth}}
4929 {{currentday}}
4930 {{cURreNTweEK}}
4931 {{currentHour}}
4932 !! result
4933 <p><a href="/index.php?title=Template:CurrentMonth&amp;action=edit&amp;redlink=1" class="new" title="Template:CurrentMonth (page does not exist)">Template:CurrentMonth</a>
4934 <a href="/index.php?title=Template:Currentday&amp;action=edit&amp;redlink=1" class="new" title="Template:Currentday (page does not exist)">Template:Currentday</a>
4935 <a href="/index.php?title=Template:CURreNTweEK&amp;action=edit&amp;redlink=1" class="new" title="Template:CURreNTweEK (page does not exist)">Template:CURreNTweEK</a>
4936 <a href="/index.php?title=Template:CurrentHour&amp;action=edit&amp;redlink=1" class="new" title="Template:CurrentHour (page does not exist)">Template:CurrentHour</a>
4937 </p>
4938 !! end
4939
4940 !! test
4941 Case-insensitive magic words should still work with weird casing.
4942 !! input
4943 {{sErVeRNaMe}}
4944 {{LCFirst:AOEU}}
4945 {{ucFIRST:aoeu}}
4946 {{SERver}}
4947 !! result
4948 <p>example.org
4949 aOEU
4950 Aoeu
4951 <a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
4952 </p>
4953 !! end
4954
4955 !! test
4956 Namespace 1 {{ns:1}}
4957 !! input
4958 {{ns:1}}
4959 !! result
4960 <p>Talk
4961 </p>
4962 !! end
4963
4964 !! test
4965 Namespace 1 {{ns:01}}
4966 !! input
4967 {{ns:01}}
4968 !! result
4969 <p>Talk
4970 </p>
4971 !! end
4972
4973 !! test
4974 Namespace 0 {{ns:0}} (bug 4783)
4975 !! input
4976 {{ns:0}}
4977 !! result
4978
4979 !! end
4980
4981 !! test
4982 Namespace 0 {{ns:00}} (bug 4783)
4983 !! input
4984 {{ns:00}}
4985 !! result
4986
4987 !! end
4988
4989 !! test
4990 Namespace -1 {{ns:-1}}
4991 !! input
4992 {{ns:-1}}
4993 !! result
4994 <p>Special
4995 </p>
4996 !! end
4997
4998 !! test
4999 Namespace User {{ns:User}}
5000 !! input
5001 {{ns:User}}
5002 !! result
5003 <p>User
5004 </p>
5005 !! end
5006
5007 !! test
5008 Namespace User talk {{ns:User_talk}}
5009 !! input
5010 {{ns:User_talk}}
5011 !! result
5012 <p>User talk
5013 </p>
5014 !! end
5015
5016 !! test
5017 Namespace User talk {{ns:uSeR tAlK}}
5018 !! input
5019 {{ns:uSeR tAlK}}
5020 !! result
5021 <p>User talk
5022 </p>
5023 !! end
5024
5025 !! test
5026 Namespace File {{ns:File}}
5027 !! input
5028 {{ns:File}}
5029 !! result
5030 <p>File
5031 </p>
5032 !! end
5033
5034 !! test
5035 Namespace File {{ns:Image}}
5036 !! input
5037 {{ns:Image}}
5038 !! result
5039 <p>File
5040 </p>
5041 !! end
5042
5043 !! test
5044 Namespace (lang=de) Benutzer {{ns:User}}
5045 !! options
5046 language=de
5047 !! input
5048 {{ns:User}}
5049 !! result
5050 <p>Benutzer
5051 </p>
5052 !! end
5053
5054 !! test
5055 Namespace (lang=de) Benutzer Diskussion {{ns:3}}
5056 !! options
5057 language=de
5058 !! input
5059 {{ns:3}}
5060 !! result
5061 <p>Benutzer Diskussion
5062 </p>
5063 !! end
5064
5065
5066 !! test
5067 Urlencode
5068 !! input
5069 {{urlencode:hi world?!}}
5070 {{urlencode:hi world?!|WIKI}}
5071 {{urlencode:hi world?!|PATH}}
5072 {{urlencode:hi world?!|QUERY}}
5073 !! result
5074 <p>hi+world%3F%21
5075 hi_world%3F!
5076 hi%20world%3F%21
5077 hi+world%3F%21
5078 </p>
5079 !! end
5080
5081 ###
5082 ### Magic links
5083 ###
5084 !! test
5085 Magic links: internal link to RFC (bug 479)
5086 !! input
5087 [[RFC 123]]
5088 !! result
5089 <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>
5090 </p>
5091 !! end
5092
5093 !! test
5094 Magic links: RFC (bug 479)
5095 !! input
5096 RFC 822
5097 !! result
5098 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc822">RFC 822</a>
5099 </p>
5100 !! end
5101
5102 !! test
5103 Magic links: ISBN (bug 1937)
5104 !! input
5105 ISBN 0-306-40615-2
5106 !! result
5107 <p><a href="/wiki/Special:BookSources/0306406152" class="internal mw-magiclink-isbn">ISBN 0-306-40615-2</a>
5108 </p>
5109 !! end
5110
5111 !! test
5112 Magic links: PMID incorrectly converts space to underscore
5113 !! input
5114 PMID 1234
5115 !! result
5116 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a>
5117 </p>
5118 !! end
5119
5120 ###
5121 ### Templates
5122 ####
5123
5124 !! test
5125 Nonexistent template
5126 !! input
5127 {{thistemplatedoesnotexist}}
5128 !! result
5129 <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>
5130 </p>
5131 !! end
5132
5133 !! test
5134 Template with invalid target containing tags
5135 !! input
5136 {{a<b>b</b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
5137 !! result
5138 <p>{{a<b>b</b>|foo|a=b|a = b}}
5139 </p>
5140 !! end
5141
5142 !! test
5143 Template with invalid target containing unclosed tag
5144 !! input
5145 {{a<b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
5146 !! result
5147 <p>{{a<b>|foo|a=b|a = b}}</b>
5148 </p>
5149 !! end
5150
5151 !! article
5152 Template:test
5153 !! text
5154 This is a test template
5155 !! endarticle
5156
5157 !! test
5158 Simple template
5159 !! input
5160 {{test}}
5161 !! result
5162 <p>This is a test template
5163 </p>
5164 !! end
5165
5166 !! test
5167 Template with explicit namespace
5168 !! input
5169 {{Template:test}}
5170 !! result
5171 <p>This is a test template
5172 </p>
5173 !! end
5174
5175
5176 !! article
5177 Template:paramtest
5178 !! text
5179 This is a test template with parameter {{{param}}}
5180 !! endarticle
5181
5182 !! test
5183 Template parameter
5184 !! input
5185 {{paramtest|param=foo}}
5186 !! result
5187 <p>This is a test template with parameter foo
5188 </p>
5189 !! end
5190
5191 !! article
5192 Template:paramtestnum
5193 !! text
5194 [[{{{1}}}|{{{2}}}]]
5195 !! endarticle
5196
5197 !! test
5198 Template unnamed parameter
5199 !! input
5200 {{paramtestnum|Main Page|the main page}}
5201 !! result
5202 <p><a href="/wiki/Main_Page" title="Main Page">the main page</a>
5203 </p>
5204 !! end
5205
5206 !! article
5207 Template:templatesimple
5208 !! text
5209 (test)
5210 !! endarticle
5211
5212 !! article
5213 Template:templateredirect
5214 !! text
5215 #redirect [[Template:templatesimple]]
5216 !! endarticle
5217
5218 !! article
5219 Template:templateasargtestnum
5220 !! text
5221 {{{{{1}}}}}
5222 !! endarticle
5223
5224 !! article
5225 Template:templateasargtest
5226 !! text
5227 {{template{{{templ}}}}}
5228 !! endarticle
5229
5230 !! article
5231 Template:templateasargtest2
5232 !! text
5233 {{{{{templ}}}}}
5234 !! endarticle
5235
5236 !! test
5237 Template with template name as unnamed argument
5238 !! input
5239 {{templateasargtestnum|templatesimple}}
5240 !! result
5241 <p>(test)
5242 </p>
5243 !! end
5244
5245 !! test
5246 Template with template name as argument
5247 !! input
5248 {{templateasargtest|templ=simple}}
5249 !! result
5250 <p>(test)
5251 </p>
5252 !! end
5253
5254 !! test
5255 Template with template name as argument (2)
5256 !! input
5257 {{templateasargtest2|templ=templatesimple}}
5258 !! result
5259 <p>(test)
5260 </p>
5261 !! end
5262
5263 !! article
5264 Template:templateasargtestdefault
5265 !! text
5266 {{{{{templ|templatesimple}}}}}
5267 !! endarticle
5268
5269 !! article
5270 Template:templa
5271 !! text
5272 '''templ'''
5273 !! endarticle
5274
5275 !! test
5276 Template with default value
5277 !! input
5278 {{templateasargtestdefault}}
5279 !! result
5280 <p>(test)
5281 </p>
5282 !! end
5283
5284 !! test
5285 Template with default value (value set)
5286 !! input
5287 {{templateasargtestdefault|templ=templa}}
5288 !! result
5289 <p><b>templ</b>
5290 </p>
5291 !! end
5292
5293 !! test
5294 Template redirect
5295 !! input
5296 {{templateredirect}}
5297 !! result
5298 <p>(test)
5299 </p>
5300 !! end
5301
5302 !! test
5303 Template with argument in separate line
5304 !! input
5305 {{ templateasargtest |
5306 templ = simple }}
5307 !! result
5308 <p>(test)
5309 </p>
5310 !! end
5311
5312 !! test
5313 Template with complex template as argument
5314 !! input
5315 {{paramtest|
5316 param ={{ templateasargtest |
5317 templ = simple }}}}
5318 !! result
5319 <p>This is a test template with parameter (test)
5320 </p>
5321 !! end
5322
5323 !! test
5324 Template with thumb image (with link in description)
5325 !! input
5326 {{paramtest|
5327 param =[[Image:noimage.png|thumb|[[no link|link]] [[no link|caption]]]]}}
5328 !! result
5329 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>
5330
5331 !! end
5332
5333 !! article
5334 Template:complextemplate
5335 !! text
5336 {{{1}}} {{paramtest|
5337 param ={{{param}}}}}
5338 !! endarticle
5339
5340 !! test
5341 Template with complex arguments
5342 !! input
5343 {{complextemplate|
5344 param ={{ templateasargtest |
5345 templ = simple }}|[[Template:complextemplate|link]]}}
5346 !! result
5347 <p><a href="/wiki/Template:Complextemplate" title="Template:Complextemplate">link</a> This is a test template with parameter (test)
5348 </p>
5349 !! end
5350
5351 !! test
5352 BUG 553: link with two variables in a piped link
5353 !! input
5354 {|
5355 |[[{{{1}}}|{{{2}}}]]
5356 |}
5357 !! result
5358 <table>
5359 <tr>
5360 <td>[[{{{1}}}|{{{2}}}]]
5361 </td></tr></table>
5362
5363 !! end
5364
5365 !! test
5366 Magic variable as template parameter
5367 !! input
5368 {{paramtest|param={{SITENAME}}}}
5369 !! result
5370 <p>This is a test template with parameter MediaWiki
5371 </p>
5372 !! end
5373
5374 !! article
5375 Template:linktest
5376 !! text
5377 [[{{{param}}}|link]]
5378 !! endarticle
5379
5380 !! test
5381 Template parameter as link source
5382 !! input
5383 {{linktest|param=Main Page}}
5384 !! result
5385 <p><a href="/wiki/Main_Page" title="Main Page">link</a>
5386 </p>
5387 !! end
5388
5389 !!test
5390 Template-generated attribute string (k='v')
5391 !!input
5392 <span {{attr_str|id|v1}}>bar</span>
5393 !!result
5394 <p><span id="v1">bar</span>
5395 </p>
5396 !!end
5397
5398 !!article
5399 Template:paramtest2
5400 !! text
5401 including another template, {{paramtest|param={{{arg}}}}}
5402 !! endarticle
5403
5404 !! test
5405 Template passing argument to another template
5406 !! input
5407 {{paramtest2|arg='hmm'}}
5408 !! result
5409 <p>including another template, This is a test template with parameter 'hmm'
5410 </p>
5411 !! end
5412
5413 !! article
5414 Template:Linktest2
5415 !! text
5416 Main Page
5417 !! endarticle
5418
5419 !! test
5420 Template as link source
5421 !! input
5422 [[{{linktest2}}]]
5423
5424 [[{{linktest2}}|Main Page]]
5425
5426 [[{{linktest2}}]]Page
5427 !! result
5428 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
5429 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
5430 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>Page
5431 </p>
5432 !! end
5433
5434
5435 !! article
5436 Template:loop1
5437 !! text
5438 {{loop2}}
5439 !! endarticle
5440
5441 !! article
5442 Template:loop2
5443 !! text
5444 {{loop1}}
5445 !! endarticle
5446
5447 !! test
5448 Template infinite loop
5449 !! input
5450 {{loop1}}
5451 !! result
5452 <p><span class="error">Template loop detected: <a href="/wiki/Template:Loop1" title="Template:Loop1">Template:Loop1</a></span>
5453 </p>
5454 !! end
5455
5456 !! test
5457 Template from main namespace
5458 !! input
5459 {{:Main Page}}
5460 !! result
5461 <p>blah blah
5462 </p>
5463 !! end
5464
5465 !! article
5466 Template:table
5467 !! text
5468 {|
5469 | 1 || 2
5470 |-
5471 | 3 || 4
5472 |}
5473 !! endarticle
5474
5475 !! test
5476 BUG 529: Template with table, not included at beginning of line
5477 !! input
5478 foo {{table}}
5479 !! result
5480 <p>foo
5481 </p>
5482 <table>
5483 <tr>
5484 <td> 1 </td>
5485 <td> 2
5486 </td></tr>
5487 <tr>
5488 <td> 3 </td>
5489 <td> 4
5490 </td></tr></table>
5491
5492 !! end
5493
5494 !! test
5495 BUG 523: Template shouldn't eat newline (or add an extra one before table)
5496 !! input
5497 foo
5498 {{table}}
5499 !! result
5500 <p>foo
5501 </p>
5502 <table>
5503 <tr>
5504 <td> 1 </td>
5505 <td> 2
5506 </td></tr>
5507 <tr>
5508 <td> 3 </td>
5509 <td> 4
5510 </td></tr></table>
5511
5512 !! end
5513
5514 !! test
5515 BUG 41: Template parameters shown as broken links
5516 !! input
5517 {{{parameter}}}
5518 !! result
5519 <p>{{{parameter}}}
5520 </p>
5521 !! end
5522
5523 !! test
5524 Template with targets containing wikilinks
5525 !! input
5526 {{[[foo]]}}
5527
5528 {{[[{{echo|foo}}]]}}
5529
5530 {{{{echo|[[foo}}]]}}
5531 !! result
5532 <p>{{<a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">foo</a>}}
5533 </p><p>{{<a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">foo</a>}}
5534 </p><p>{{[[foo}}]]
5535 </p>
5536 !! end
5537
5538 !! article
5539 Template:MSGNW test
5540 !! text
5541 ''None'' of '''this''' should be
5542 * interpreted
5543 but rather passed unmodified
5544 {{test}}
5545 !! endarticle
5546
5547 # hmm, fix this or just deprecate msgnw and document its behavior?
5548 !! test
5549 msgnw keyword
5550 !! options
5551 disabled
5552 !! input
5553 {{msgnw:MSGNW test}}
5554 !! result
5555 <p>''None'' of '''this''' should be
5556 * interpreted
5557 but rather passed unmodified
5558 {{test}}
5559 </p>
5560 !! end
5561
5562 !! test
5563 int keyword
5564 !! input
5565 {{int:youhavenewmessages|lots of money|not!}}
5566 !! result
5567 <p>You have lots of money (not!).
5568 </p>
5569 !! end
5570
5571 !! article
5572 Template:Includes
5573 !! text
5574 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
5575 !! endarticle
5576
5577 !! test
5578 <includeonly> and <noinclude> being included
5579 !! input
5580 {{Includes}}
5581 !! result
5582 <p>Foobar
5583 </p>
5584 !! end
5585
5586 !! article
5587 Template:Includes2
5588 !! text
5589 <onlyinclude>Foo</onlyinclude>bar
5590 !! endarticle
5591
5592 !! test
5593 <onlyinclude> being included
5594 !! input
5595 {{Includes2}}
5596 !! result
5597 <p>Foo
5598 </p>
5599 !! end
5600
5601
5602 !! article
5603 Template:Includes3
5604 !! text
5605 <onlyinclude>Foo</onlyinclude>bar<includeonly>zar</includeonly>
5606 !! endarticle
5607
5608 !! test
5609 <onlyinclude> and <includeonly> being included
5610 !! input
5611 {{Includes3}}
5612 !! result
5613 <p>Foo
5614 </p>
5615 !! end
5616
5617 !! test
5618 <includeonly> and <noinclude> on a page
5619 !! input
5620 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
5621 !! result
5622 <p>Foozar
5623 </p>
5624 !! end
5625
5626 !! test
5627 Un-closed <noinclude>
5628 !! input
5629 <noinclude>
5630 !! result
5631 !! end
5632
5633 !! test
5634 <onlyinclude> on a page
5635 !! input
5636 <onlyinclude>Foo</onlyinclude>bar
5637 !! result
5638 <p>Foobar
5639 </p>
5640 !! end
5641
5642 !! test
5643 Un-closed <onlyinclude>
5644 !! input
5645 <onlyinclude>
5646 !! result
5647 !! end
5648
5649 !!test
5650 Self-closed noinclude, includeonly, onlyinclude tags
5651 !!input
5652 <noinclude />
5653 <includeonly />
5654 <onlyinclude />
5655 !!result
5656 <p><br />
5657 </p>
5658 !!end
5659
5660 !!test
5661 Unbalanced includeonly and noinclude tags
5662 !!input
5663 {|
5664 |a</noinclude>
5665 |b</noinclude></noinclude>
5666 |c</noinclude></includeonly>
5667 |d</includeonly></includeonly>
5668 |}
5669 !!result
5670 <table>
5671 <tr>
5672 <td>a
5673 </td>
5674 <td>b
5675 </td>
5676 <td>c&lt;/includeonly&gt;
5677 </td>
5678 <td>d&lt;/includeonly&gt;&lt;/includeonly&gt;
5679 </td></tr></table>
5680
5681 !!end
5682
5683 !! article
5684 Template:Includeonly section
5685 !! text
5686 <includeonly>
5687 ==Includeonly section==
5688 </includeonly>
5689 ==Section T-1==
5690 !!endarticle
5691
5692 !! test
5693 Bug 6563: Edit link generation for section shown by <includeonly>
5694 !! input
5695 {{includeonly section}}
5696 !! result
5697 <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>
5698 <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>
5699
5700 !! end
5701
5702 # Uses same input as the contents of [[Template:Includeonly section]]
5703 !! test
5704 Bug 6563: Section extraction for section shown by <includeonly>
5705 !! options
5706 section=T-2
5707 !! input
5708 <includeonly>
5709 ==Includeonly section==
5710 </includeonly>
5711 ==Section T-2==
5712 !! result
5713 ==Section T-2==
5714 !! end
5715
5716 !! test
5717 Bug 6563: Edit link generation for section suppressed by <includeonly>
5718 !! input
5719 <includeonly>
5720 ==Includeonly section==
5721 </includeonly>
5722 ==Section 1==
5723 !! result
5724 <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>
5725
5726 !! end
5727
5728 !! test
5729 Bug 6563: Section extraction for section suppressed by <includeonly>
5730 !! options
5731 section=1
5732 !! input
5733 <includeonly>
5734 ==Includeonly section==
5735 </includeonly>
5736 ==Section 1==
5737 !! result
5738 ==Section 1==
5739 !! end
5740
5741 !! test
5742 Un-closed <includeonly>
5743 !! input
5744 <includeonly>
5745 !! result
5746 !! end
5747
5748 ###
5749 ### <includeonly> and <noinclude> in attributes
5750 ###
5751 !!test
5752 0. includeonly around the entire attribute
5753 !!input
5754 <span <includeonly>id="v1"</includeonly><noinclude>id="v2"</noinclude>>bar</span>
5755 !!result
5756 <p><span id="v2">bar</span>
5757 </p>
5758 !!end
5759
5760 !!test
5761 1. includeonly in html attr key
5762 !!input
5763 <span <noinclude>id</noinclude><includeonly>about</includeonly>="foo">bar</span>
5764 !!result
5765 <p><span id="foo">bar</span>
5766 </p>
5767 !!end
5768
5769 !!test
5770 2. includeonly in html attr value
5771 !!input
5772 <span id="<noinclude>v1</noinclude><includeonly>v2</includeonly>">bar</span>
5773 <span id=<noinclude>"v1"</noinclude><includeonly>"v2"</includeonly>>bar</span>
5774 !!result
5775 <p><span id="v1">bar</span>
5776 <span id="v1">bar</span>
5777 </p>
5778 !!end
5779
5780 !!test
5781 3. includeonly in part of an attr value
5782 !!input
5783 <span style="color:<noinclude>red</noinclude><includeonly>blue</includeonly>;">bar</span>
5784 !!result
5785 <p><span style="color:red;">bar</span>
5786 </p>
5787 !!end
5788
5789 ###
5790 ### Testing parsing of templates where a template arg
5791 ### has the same name as the template itself.
5792 ###
5793
5794 !! article
5795 Template:quote
5796 !! text
5797 {{{quote|{{{1}}}}}}
5798 !! endarticle
5799
5800 !!test
5801 Templates: Template Name/Arg clash: 1. Use of positional param
5802 !!input
5803 {{quote|foo}}
5804 !!result
5805 <p>foo
5806 </p>
5807 !!end
5808
5809 !!test
5810 Templates: Template Name/Arg clash: 2. Use of named param
5811 !!input
5812 {{quote|quote=foo}}
5813 !!result
5814 <p>foo
5815 </p>
5816 !!end
5817
5818 !!test
5819 Templates: Template Name/Arg clash: 3. Use of named param with empty input
5820 !!input
5821 {{quote|quote}}
5822 !!result
5823 <p>quote
5824 </p>
5825 !!end
5826
5827 ###
5828 ### Parsoid-centric tests to stress Parsoid's ability to RT them unchanged
5829 ###
5830
5831 !!test
5832 Templates: 1. Simple use
5833 !!input
5834 {{echo|Foo}}
5835 !!result
5836 <p>Foo
5837 </p>
5838 !!end
5839
5840 !!test
5841 Templates: 2. Inside a block tag
5842 !!input
5843 <div>{{echo|Foo}}</div>
5844 !!result
5845 <div>Foo</div>
5846
5847 !!end
5848
5849 !!test
5850 Templates: P-wrapping: 1a. Templates on consecutive lines
5851 !!input
5852 {{echo|Foo}}
5853 {{echo|bar}}
5854 !!result
5855 <p>Foo
5856 bar
5857 </p>
5858 !!end
5859
5860 !!test
5861 Templates: P-wrapping: 1b. Templates on consecutive lines
5862 !!input
5863 Foo
5864
5865 {{echo|bar}}
5866 {{echo|baz}}
5867 !!result
5868 <p>Foo
5869 </p><p>bar
5870 baz
5871 </p>
5872 !!end
5873
5874 !!test
5875 Templates: P-wrapping: 1c. Templates on consecutive lines
5876 !!input
5877 {{echo|Foo}}
5878 {{echo|bar}} <div>baz</div>
5879 !!result
5880 <p>Foo
5881 </p>
5882 bar <div>baz</div>
5883
5884 !!end
5885
5886 !!test
5887 Templates: Inline Text: 1. Multiple tmeplate uses
5888 !!input
5889 {{echo|Foo}}bar{{echo|baz}}
5890 !!result
5891 <p>Foobarbaz
5892 </p>
5893 !!end
5894
5895 !!test
5896 Templates: Inline Text: 2. Back-to-back template uses
5897 !!input
5898 {{echo|Foo}}{{echo|bar}}
5899 !!result
5900 <p>Foobar
5901 </p>
5902 !!end
5903
5904 !!test
5905 Templates: Block Tags: 1. Multiple template uses
5906 !!input
5907 {{echo|<div>Foo</div>}}<div>bar</div>{{echo|<div>baz</div>}}
5908 !!result
5909 <div>Foo</div><div>bar</div><div>baz</div>
5910
5911 !!end
5912
5913 !!test
5914 Templates: Block Tags: 2. Back-to-back template uses
5915 !!input
5916 {{echo|<div>Foo</div>}}{{echo|<div>bar</div>}}
5917 !!result
5918 <div>Foo</div><div>bar</div>
5919
5920 !!end
5921
5922 !!test
5923 Templates: Links: 1. Simple example
5924 !!input
5925 {{echo|[[Foo|bar]]}}
5926 !!result
5927 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
5928 </p>
5929 !!end
5930
5931 !!test
5932 Templates: Links: 2. Generation of link href
5933 !!input
5934 [[{{echo|Foo}}|bar]]
5935 !!result
5936 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
5937 </p>
5938 !!end
5939
5940 !!test
5941 Templates: Links: 3. Generation of part of a link href
5942 !!input
5943 [[Fo{{echo|o}}|bar]]
5944
5945 [[Foo{{echo|bar}}]]
5946
5947 [[Foo{{echo|bar}}baz]]
5948
5949 [[Foo{{echo|bar}}|bar]]
5950
5951 [[:Foo{{echo|bar}}]]
5952
5953 [[:Foo{{echo|bar}}|bar]]
5954 !!result
5955 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
5956 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
5957 </p><p><a href="/index.php?title=Foobarbaz&amp;action=edit&amp;redlink=1" class="new" title="Foobarbaz (page does not exist)">Foobarbaz</a>
5958 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
5959 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
5960 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
5961 </p>
5962 !!end
5963
5964 !!test
5965 Templates: Links: 4. Multiple templates generating link href
5966 !!input
5967 [[{{echo|F}}{{echo|o}}ob{{echo|ar}}]]
5968 !!result
5969 <p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
5970 </p>
5971 !!end
5972
5973 !!test
5974 Templates: Links: 5. Generation of link text
5975 !!input
5976 [[Foo|{{echo|bar}}]]
5977 !!result
5978 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
5979 </p>
5980 !!end
5981
5982 !!test
5983 Templates: Links: 5. Nested templates (only outermost template should be marked)
5984 !!input
5985 {{echo|[[{{echo|Foo}}|bar]]}}
5986 !!result
5987 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
5988 </p>
5989 !!end
5990
5991 !!test
5992 Templates: HTML Tag: 1. Generation of HTML attr. key
5993 !!input
5994 <div {{echo|style}}="color:red;">foo</div>
5995 !!result
5996 <div style="color:red;">foo</div>
5997
5998 !!end
5999
6000 !!test
6001 Templates: HTML Tag: 2. Generation of HTML attr. value
6002 !!input
6003 <div style={{echo|'color:red;'}}>foo</div>
6004 !!result
6005 <div style="color:red;">foo</div>
6006
6007 !!end
6008
6009 !!test
6010 Templates: HTML Tag: 3. Generation of HTML attr key and value
6011 !!input
6012 <div {{echo|style}}={{echo|'color:red;'}}>foo</div>
6013 !!result
6014 <div style="color:red;">foo</div>
6015
6016 !!end
6017
6018 !!test
6019 Templates: HTML Tag: 4. Generation of starting piece of HTML attr value
6020 !!input
6021 <div title="{{echo|This is a long title}} with just one piece templated">foo</div>
6022 !!result
6023 <div title="This is a long title with just one piece templated">foo</div>
6024
6025 !!end
6026
6027 !!test
6028 Templates: HTML Tag: 5. Generation of middle piece of HTML attr value
6029 !!input
6030 <div title="This is a long title with just {{echo|one piece}} templated">foo</div>
6031 !!result
6032 <div title="This is a long title with just one piece templated">foo</div>
6033
6034 !!end
6035
6036 !!test
6037 Templates: HTML Tag: 6. Generation of end piece of HTML attr value
6038 !!input
6039 <div title="This is a long title with just one piece {{echo|templated}}">foo</div>
6040 !!result
6041 <div title="This is a long title with just one piece templated">foo</div>
6042
6043 !!end
6044
6045 !!test
6046 Templates: HTML Tag: 7. Generation of partial attribute key string
6047 !!input
6048 <div st{{echo|yle}}="color:red;">foo</div>
6049 !!result
6050 <div style="color:red;">foo</div>
6051
6052 !!end
6053
6054 !!test
6055 Templates: HTML Tables: 1. Generating start of a HTML table
6056 !!input
6057 {{echo|<table><tr><td>foo</td>}}</tr></table>
6058 !!result
6059 <table><tr><td>foo</td></tr></table>
6060
6061 !!end
6062
6063 !!test
6064 Templates: HTML Tables: 2a. Generating middle of a HTML table
6065 !!input
6066 <table><tr>{{echo|<td>foo</td>}}</tr></table>
6067 !!result
6068 <table><tr><td>foo</td></tr></table>
6069
6070 !!end
6071
6072 !!test
6073 Templates: HTML Tables: 2b. Generating middle of a HTML table
6074 !!input
6075 <table>{{echo|<tr><td>foo</td></tr>}}</table>
6076 !!result
6077 <table><tr><td>foo</td></tr></table>
6078
6079 !!end
6080
6081 !!test
6082 Templates: HTML Tables: 3. Generating end of a HTML table
6083 !!input
6084 <table><tr>{{echo|<td>foo</td></tr></table>}}
6085 !!result
6086 <table><tr><td>foo</td></tr></table>
6087
6088 !!end
6089
6090 !!test
6091 Templates: HTML Tables: 4a. Generating a single tag of a HTML table
6092 !!input
6093 {{echo|<table>}}<tr><td>foo</td></tr></table>
6094 !!result
6095 <table><tr><td>foo</td></tr></table>
6096
6097 !!end
6098
6099 !!test
6100 Templates: HTML Tables: 4b. Generating a single tag of a HTML table
6101 !!input
6102 <table>{{echo|<tr>}}<td>foo</td></tr></table>
6103 !!result
6104 <table><tr><td>foo</td></tr></table>
6105
6106 !!end
6107
6108 !!test
6109 Templates: HTML Tables: 4c. Generating a single tag of a HTML table
6110 !!input
6111 <table><tr>{{echo|<td>}}foo</td></tr></table>
6112 !!result
6113 <table><tr><td>foo</td></tr></table>
6114
6115 !!end
6116
6117 !!test
6118 Templates: HTML Tables: 4d. Generating a single tag of a HTML table
6119 !!input
6120 <table><tr><td>foo{{echo|</td>}}</tr></table>
6121 !!result
6122 <table><tr><td>foo</td></tr></table>
6123
6124 !!end
6125
6126 !!test
6127 Templates: HTML Tables: 4e. Generating a single tag of a HTML table
6128 !!input
6129 <table><tr><td>foo</td>{{echo|</tr>}}</table>
6130 !!result
6131 <table><tr><td>foo</td></tr></table>
6132
6133 !!end
6134
6135 !!test
6136 Templates: HTML Tables: 4f. Generating a single tag of a HTML table
6137 !!input
6138 <table><tr><td>foo</td></tr>{{echo|</table>}}
6139 !!result
6140 <table><tr><td>foo</td></tr></table>
6141
6142 !!end
6143
6144 !!test
6145 Templates: Wiki Tables: 1a. Fostering of entire template content
6146 !!input
6147 {|
6148 {{echo|a}}
6149 |}
6150 !!result
6151 <table>
6152 a
6153 <tr><td></td></tr></table>
6154
6155 !!end
6156
6157 !!test
6158 Templates: Wiki Tables: 1b. Fostering of entire template content
6159 !!input
6160 {|
6161 {{echo|<div>}}
6162 foo
6163 {{echo|</div>}}
6164 |}
6165 !!result
6166 <table>
6167 <div>
6168 <p>foo
6169 </p>
6170 </div>
6171 <tr><td></td></tr></table>
6172
6173 !!end
6174
6175 !!test
6176 Templates: Wiki Tables: 2. Fostering of partial template content
6177 !!input
6178 {|
6179 {{echo|a
6180 <div>b</div>}}
6181 |}
6182 !!result
6183 <table>
6184 a
6185 <div>b</div>
6186 <tr><td></td></tr></table>
6187
6188 !!end
6189
6190 !!test
6191 Templates: Wiki Tables: 3. td-content via multiple templates
6192 !!input
6193 {|
6194 {{echo|{{pipe}}a}}{{echo|b}}
6195 |}
6196 !!result
6197 <table>
6198 <tr>
6199 <td>ab
6200 </td></tr></table>
6201
6202 !!end
6203
6204 !!test
6205 Templates: Wiki Tables: 4. Templated tags, no content
6206 !!input
6207 {{tbl-start}}
6208 {{tbl-end}}
6209 !!result
6210 <table>
6211 <tr><td></td></tr></table>
6212
6213 !!end
6214
6215 !!test
6216 Templates: Wiki Tables: 5. Templated tags, regular td-tags
6217 !!input
6218 {{tbl-start}}
6219 |foo
6220 {{tbl-end}}
6221 !!result
6222 <table>
6223 <tr>
6224 <td>foo
6225 </td></tr></table>
6226
6227 !!end
6228
6229 !!test
6230 Templates: Wiki Tables: 6. Templated tags, templated td-tags
6231 !!input
6232 {{tbl-start}}
6233 {{!}}foo
6234 {{tbl-end}}
6235 !!result
6236 <table>
6237 <tr>
6238 <td>foo
6239 </td></tr></table>
6240
6241 !!end
6242
6243 !!test
6244 Templates: Lists: Multi-line list-items via templates
6245 !!input
6246 *{{echo|a {{nonexistent|
6247 unused}}}}
6248 *{{echo|b {{nonexistent|
6249 unused}}}}
6250 !!result
6251 <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>
6252 </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>
6253 </li></ul>
6254
6255 !!end
6256
6257 !!test
6258 Templates: Ugly nesting: 1. Quotes opened/closed across templates (echo)
6259 !!input
6260 {{echo|''a}}{{echo|b''c''d}}{{echo|''e}}
6261 !!result
6262 <p><i>ab</i>c<i>d</i>e
6263 </p>
6264 !!end
6265
6266 !!test
6267 Templates: Ugly nesting: 2. Quotes opened/closed across templates (echo_with_span)
6268 (PHP parser generates misnested html)
6269 !! options
6270 disabled
6271 !!input
6272 {{echo_with_span|''a}}{{echo_with_span|b''c''d}}{{echo_with_span|''e}}
6273 !!result
6274 <p><span><i>a</i></span><i><span>b</span></i><span>c</span><i>d</i><span>e</span></p>
6275 !!end
6276
6277 !!test
6278 Templates: Ugly nesting: 3. Quotes opened/closed across templates (echo_with_div)
6279 (PHP parser generates misnested html)
6280 !! options
6281 disabled
6282 !!input
6283 {{echo_with_div|''a}}{{echo_with_div|b''c''d}}{{echo_with_div|''e}}
6284 !!result
6285 <div><i>a</i></div>
6286 <div><i>b</i>c<i>d</i></div>
6287 <div>e</div>
6288 !!end
6289
6290 !!test
6291 Templates: Ugly nesting: 4. Divs opened/closed across templates
6292 !!input
6293 a<div>b{{echo|c</div>d}}e
6294 !!result
6295 a<div>bc</div>de
6296
6297 !!end
6298
6299 !!test
6300 Templates: Ugly templates: 1. Navbox template parses badly leading to table misnesting
6301 (Parsoid-centric)
6302 !! options
6303 parsoid
6304 !!input
6305 {|
6306 |{{echo|foo</table>}}
6307 |bar
6308 |}
6309 !!result
6310 <table about="#mwt1" typeof="mw:Object/Template ">
6311 <tbody><tr><td>foo</td></tr></tbody></table><span about="#mwt1">
6312 bar</span><span about="#mwt1">
6313 </span>
6314 !!end
6315
6316 !!test
6317 Templates: Ugly templates: 2. Navbox template parses badly leading to table misnesting
6318 (Parsoid-centric)
6319 !! options
6320 parsoid
6321 !!input
6322 <table>
6323 <tr>
6324 <td>
6325 <table>
6326 <tr>
6327 <td>1. {{echo|foo </table>}}</td>
6328 <td> bar </td>
6329 <td>2. {{echo|baz </table>}}</td>
6330 </tr>
6331 <tr>
6332 <td>abc</td>
6333 </tr>
6334 </table>
6335 </td>
6336 </tr>
6337 <tr>
6338 <td>xyz</td>
6339 </tr>
6340 </table>
6341 !!result
6342 <table about="#mwt1" typeof="mw:Object/Template">
6343 <tbody><tr >
6344 <td >
6345 <table >
6346 <tbody><tr >
6347 <td >1. foo </td></tr></tbody></table></td>
6348 <td > bar </td>
6349 <td >2. baz </td></tr></tbody></table><span about="#mwt1">
6350 </span><span about="#mwt1">
6351
6352 abc</span><span about="#mwt1">
6353 </span><span about="#mwt1">
6354 </span><span about="#mwt1">
6355 </span><span about="#mwt1">
6356 </span><span about="#mwt1">
6357
6358 xyz</span><span about="#mwt1">
6359 </span><span about="#mwt1">
6360 </span>
6361 !!end
6362
6363 !! test
6364 Templates: Ugly templates: 3. newline-only template parameter
6365 !! input
6366 foo {{echo|
6367 }}
6368 !! result
6369 <p>foo
6370 </p>
6371 !! end
6372
6373 # This looks like a bug: a single newline triggers p/br for some reason.
6374 !! test
6375 Templates: Ugly templates: 4. newline-only template parameter inconsistency
6376 !! input
6377 {{echo|
6378 }}
6379 !! result
6380 <p><br />
6381 </p>
6382 !! end
6383
6384
6385 !!test
6386 Parser Functions: 1. Simple example
6387 !!input
6388 {{uc:foo}}
6389 !!result
6390 <p>FOO
6391 </p>
6392 !!end
6393
6394 !!test
6395 Parser Functions: 2. Nested use (only outermost should be marked up)
6396 !!input
6397 {{uc:{{lc:FOO}}}}
6398 !!result
6399 <p>FOO
6400 </p>
6401 !!end
6402
6403 ###
6404 ### Pre-save transform tests
6405 ###
6406 !! test
6407 pre-save transform: subst:
6408 !! options
6409 PST
6410 !! input
6411 {{subst:test}}
6412 !! result
6413 This is a test template
6414 !! end
6415
6416 !! test
6417 pre-save transform: normal template
6418 !! options
6419 PST
6420 !! input
6421 {{test}}
6422 !! result
6423 {{test}}
6424 !! end
6425
6426 !! test
6427 pre-save transform: nonexistent template
6428 !! options
6429 PST
6430 !! input
6431 {{thistemplatedoesnotexist}}
6432 !! result
6433 {{thistemplatedoesnotexist}}
6434 !! end
6435
6436
6437 !! test
6438 pre-save transform: subst magic variables
6439 !! options
6440 PST
6441 !! input
6442 {{subst:SITENAME}}
6443 !! result
6444 MediaWiki
6445 !! end
6446
6447 # This is bug 89, which I fixed. -- wtm
6448 !! test
6449 pre-save transform: subst: templates with parameters
6450 !! options
6451 pst
6452 !! input
6453 {{subst:paramtest|param="something else"}}
6454 !! result
6455 This is a test template with parameter "something else"
6456 !! end
6457
6458 !! article
6459 Template:nowikitest
6460 !! text
6461 <nowiki>'''not wiki'''</nowiki>
6462 !! endarticle
6463
6464 !! test
6465 pre-save transform: nowiki in subst (bug 1188)
6466 !! options
6467 pst
6468 !! input
6469 {{subst:nowikitest}}
6470 !! result
6471 <nowiki>'''not wiki'''</nowiki>
6472 !! end
6473
6474
6475 !! article
6476 Template:commenttest
6477 !! text
6478 This template has <!-- a comment --> in it.
6479 !! endarticle
6480
6481 !! test
6482 pre-save transform: comment in subst (bug 1936)
6483 !! options
6484 pst
6485 !! input
6486 {{subst:commenttest}}
6487 !! result
6488 This template has <!-- a comment --> in it.
6489 !! end
6490
6491 !! test
6492 pre-save transform: unclosed tag
6493 !! options
6494 pst noxml
6495 !! input
6496 <nowiki>'''not wiki'''
6497 !! result
6498 <nowiki>'''not wiki'''
6499 !! end
6500
6501 !! test
6502 pre-save transform: mixed tag case
6503 !! options
6504 pst noxml
6505 !! input
6506 <NOwiki>'''not wiki'''</noWIKI>
6507 !! result
6508 <NOwiki>'''not wiki'''</noWIKI>
6509 !! end
6510
6511 !! test
6512 pre-save transform: unclosed comment in <nowiki>
6513 !! options
6514 pst noxml
6515 !! input
6516 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
6517 !! result
6518 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
6519 !!end
6520
6521 !! article
6522 Template:dangerous
6523 !!text
6524 <span onmouseover="alert('crap')">Oh no</span>
6525 !!endarticle
6526
6527 !!test
6528 (confirming safety of fix for subst bug 1936)
6529 !! input
6530 {{Template:dangerous}}
6531 !! result
6532 <p><span>Oh no</span>
6533 </p>
6534 !! end
6535
6536 !! test
6537 pre-save transform: comment containing gallery (bug 5024)
6538 !! options
6539 pst
6540 !! input
6541 <!-- <gallery>data</gallery> -->
6542 !!result
6543 <!-- <gallery>data</gallery> -->
6544 !!end
6545
6546 !! test
6547 pre-save transform: comment containing extension
6548 !! options
6549 pst
6550 !! input
6551 <!-- <tag>data</tag> -->
6552 !!result
6553 <!-- <tag>data</tag> -->
6554 !!end
6555
6556 !! test
6557 pre-save transform: comment containing nowiki
6558 !! options
6559 pst
6560 !! input
6561 <!-- <nowiki>data</nowiki> -->
6562 !!result
6563 <!-- <nowiki>data</nowiki> -->
6564 !!end
6565
6566 !! test
6567 pre-save transform: <noinclude> in subst (bug 3298)
6568 !! options
6569 pst
6570 !! input
6571 {{subst:Includes}}
6572 !! result
6573 Foobar
6574 !! end
6575
6576 !! test
6577 pre-save transform: <onlyinclude> in subst (bug 3298)
6578 !! options
6579 pst
6580 !! input
6581 {{subst:Includes2}}
6582 !! result
6583 Foo
6584 !! end
6585
6586 !! article
6587 Template:SubstTest
6588 !!text
6589 {{<includeonly>subst:</includeonly>Includes}}
6590 !! endarticle
6591
6592 !! article
6593 Template:SafeSubstTest
6594 !! text
6595 {{<includeonly>safesubst:</includeonly>Includes}}
6596 !! endarticle
6597
6598 !! test
6599 bug 22297: safesubst: works during PST
6600 !! options
6601 pst
6602 !! input
6603 {{subst:SafeSubstTest}}{{safesubst:SubstTest}}
6604 !! result
6605 FoobarFoobar
6606 !! end
6607
6608 !! test
6609 bug 22297: safesubst: works during normal parse
6610 !! input
6611 {{SafeSubstTest}}
6612 !! result
6613 <p>Foobar
6614 </p>
6615 !! end
6616
6617 !! test:
6618 subst: does not work during normal parse
6619 !! input
6620 {{SubstTest}}
6621 !! result
6622 <p>{{subst:Includes}}
6623 </p>
6624 !! end
6625
6626 !! test
6627 pre-save transform: context links ("pipe trick")
6628 !! options
6629 pst
6630 !! input
6631 [[Article (context)|]]
6632 [[Bar:Article|]]
6633 [[:Bar:Article|]]
6634 [[Bar:Article (context)|]]
6635 [[:Bar:Article (context)|]]
6636 [[|Article]]
6637 [[|Article (context)]]
6638 [[Bar:X (Y) Z|]]
6639 [[:Bar:X (Y) Z|]]
6640 !! result
6641 [[Article (context)|Article]]
6642 [[Bar:Article|Article]]
6643 [[:Bar:Article|Article]]
6644 [[Bar:Article (context)|Article]]
6645 [[:Bar:Article (context)|Article]]
6646 [[Article]]
6647 [[Article (context)]]
6648 [[Bar:X (Y) Z|X (Y) Z]]
6649 [[:Bar:X (Y) Z|X (Y) Z]]
6650 !! end
6651
6652 !! test
6653 pre-save transform: context links ("pipe trick") with interwiki prefix
6654 !! options
6655 pst
6656 !! input
6657 [[interwiki:Article|]]
6658 [[:interwiki:Article|]]
6659 [[interwiki:Bar:Article|]]
6660 [[:interwiki:Bar:Article|]]
6661 !! result
6662 [[interwiki:Article|Article]]
6663 [[:interwiki:Article|Article]]
6664 [[interwiki:Bar:Article|Bar:Article]]
6665 [[:interwiki:Bar:Article|Bar:Article]]
6666 !! end
6667
6668 !! test
6669 pre-save transform: context links ("pipe trick") with parens in title
6670 !! options
6671 pst title=[[Somearticle (context)]]
6672 !! input
6673 [[|Article]]
6674 !! result
6675 [[Article (context)|Article]]
6676 !! end
6677
6678 !! test
6679 pre-save transform: context links ("pipe trick") with comma in title
6680 !! options
6681 pst title=[[Someplace, Somewhere]]
6682 !! input
6683 [[|Otherplace]]
6684 [[Otherplace, Elsewhere|]]
6685 [[Otherplace, Elsewhere, Anywhere|]]
6686 !! result
6687 [[Otherplace, Somewhere|Otherplace]]
6688 [[Otherplace, Elsewhere|Otherplace]]
6689 [[Otherplace, Elsewhere, Anywhere|Otherplace]]
6690 !! end
6691
6692 !! test
6693 pre-save transform: context links ("pipe trick") with parens and comma
6694 !! options
6695 pst title=[[Someplace (IGNORED), Somewhere]]
6696 !! input
6697 [[|Otherplace]]
6698 [[Otherplace (place), Elsewhere|]]
6699 !! result
6700 [[Otherplace, Somewhere|Otherplace]]
6701 [[Otherplace (place), Elsewhere|Otherplace]]
6702 !! end
6703
6704 !! test
6705 pre-save transform: context links ("pipe trick") with comma and parens
6706 !! options
6707 pst title=[[Who, me? (context)]]
6708 !! input
6709 [[|Yes, you.]]
6710 [[Me, Myself, and I (1937 song)|]]
6711 !! result
6712 [[Yes, you. (context)|Yes, you.]]
6713 [[Me, Myself, and I (1937 song)|Me, Myself, and I]]
6714 !! end
6715
6716 !! test
6717 pre-save transform: context links ("pipe trick") with namespace
6718 !! options
6719 pst title=[[Ns:Somearticle]]
6720 !! input
6721 [[|Article]]
6722 !! result
6723 [[Ns:Article|Article]]
6724 !! end
6725
6726 !! test
6727 pre-save transform: context links ("pipe trick") with namespace and parens
6728 !! options
6729 pst title=[[Ns:Somearticle (context)]]
6730 !! input
6731 [[|Article]]
6732 !! result
6733 [[Ns:Article (context)|Article]]
6734 !! end
6735
6736 !! test
6737 pre-save transform: context links ("pipe trick") with namespace and comma
6738 !! options
6739 pst title=[[Ns:Somearticle, Context, Whatever]]
6740 !! input
6741 [[|Article]]
6742 !! result
6743 [[Ns:Article, Context, Whatever|Article]]
6744 !! end
6745
6746 !! test
6747 pre-save transform: context links ("pipe trick") with namespace, comma and parens
6748 !! options
6749 pst title=[[Ns:Somearticle, Context (context)]]
6750 !! input
6751 [[|Article]]
6752 !! result
6753 [[Ns:Article (context)|Article]]
6754 !! end
6755
6756 !! test
6757 pre-save transform: context links ("pipe trick") with namespace, parens and comma
6758 !! options
6759 pst title=[[Ns:Somearticle (IGNORED), Context]]
6760 !! input
6761 [[|Article]]
6762 !! result
6763 [[Ns:Article, Context|Article]]
6764 !! end
6765
6766 !! test
6767 pre-save transform: context links ("pipe trick") with full-width parens and no space (Japanese and Chinese style, bug 30149)
6768 !! options
6769 pst
6770 !! input
6771 [[Article(context)|]]
6772 [[Bar:Article(context)|]]
6773 [[:Bar:Article(context)|]]
6774 [[|Article(context)]]
6775 [[Bar:X(Y)Z|]]
6776 [[:Bar:X(Y)Z|]]
6777 !! result
6778 [[Article(context)|Article]]
6779 [[Bar:Article(context)|Article]]
6780 [[:Bar:Article(context)|Article]]
6781 [[Article(context)]]
6782 [[Bar:X(Y)Z|X(Y)Z]]
6783 [[:Bar:X(Y)Z|X(Y)Z]]
6784 !! end
6785
6786 !! test
6787 pre-save transform: context links ("pipe trick") with full-width parens and space (Japanese and Chinese style, bug 30149)
6788 !! options
6789 pst
6790 !! input
6791 [[Article (context)|]]
6792 [[Bar:Article (context)|]]
6793 [[:Bar:Article (context)|]]
6794 [[|Article (context)]]
6795 [[Bar:X (Y) Z|]]
6796 [[:Bar:X (Y) Z|]]
6797 !! result
6798 [[Article (context)|Article]]
6799 [[Bar:Article (context)|Article]]
6800 [[:Bar:Article (context)|Article]]
6801 [[Article (context)]]
6802 [[Bar:X (Y) Z|X (Y) Z]]
6803 [[:Bar:X (Y) Z|X (Y) Z]]
6804 !! end
6805
6806 !! test
6807 pre-save transform: context links ("pipe trick") with parens and no space (Korean style, bug 30149)
6808 !! options
6809 pst
6810 !! input
6811 [[Article(context)|]]
6812 [[Bar:Article(context)|]]
6813 [[:Bar:Article(context)|]]
6814 [[|Article(context)]]
6815 [[Bar:X(Y)Z|]]
6816 [[:Bar:X(Y)Z|]]
6817 !! result
6818 [[Article(context)|Article]]
6819 [[Bar:Article(context)|Article]]
6820 [[:Bar:Article(context)|Article]]
6821 [[Article(context)]]
6822 [[Bar:X(Y)Z|X(Y)Z]]
6823 [[:Bar:X(Y)Z|X(Y)Z]]
6824 !! end
6825
6826 !! test
6827 pre-save transform: context links ("pipe trick") with commas (bug 21660)
6828 !! options
6829 pst
6830 !! input
6831 [[Article (context), context|]]
6832 [[Article (context),context|]]
6833 [[Bar:Article (context), context|]]
6834 [[Bar:Article (context),context|]]
6835 [[:Bar:Article (context), context|]]
6836 [[:Bar:Article (context),context|]]
6837 !! result
6838 [[Article (context), context|Article]]
6839 [[Article (context),context|Article]]
6840 [[Bar:Article (context), context|Article]]
6841 [[Bar:Article (context),context|Article]]
6842 [[:Bar:Article (context), context|Article]]
6843 [[:Bar:Article (context),context|Article]]
6844 !! end
6845
6846 !! test
6847 pre-save transform: trim trailing empty lines
6848 !! options
6849 pst
6850 !! input
6851 Empty lines are trimmed
6852
6853
6854
6855
6856 !! result
6857 Empty lines are trimmed
6858 !! end
6859
6860 !! test
6861 pre-save transform: Signature expansion
6862 !! options
6863 pst
6864 !! input
6865 * ~~~
6866 * <noinclude>~~~</noinclude>
6867 * <includeonly>~~~</includeonly>
6868 * <onlyinclude>~~~</onlyinclude>
6869 !! result
6870 * [[Special:Contributions/127.0.0.1|127.0.0.1]]
6871 * <noinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</noinclude>
6872 * <includeonly>[[Special:Contributions/127.0.0.1|127.0.0.1]]</includeonly>
6873 * <onlyinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</onlyinclude>
6874 !! end
6875
6876
6877 !! test
6878 pre-save transform: Signature expansion in nowiki tags (bug 93)
6879 !! options
6880 pst disabled
6881 !! input
6882 Shall not expand:
6883
6884 <nowiki>~~~~</nowiki>
6885
6886 <includeonly><nowiki>~~~~</nowiki></includeonly>
6887
6888 <noinclude><nowiki>~~~~</nowiki></noinclude>
6889
6890 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
6891
6892 {{subst:Foo}} shall be converted to FOO
6893
6894 As well as inside noinclude/onlyinclude
6895 <noinclude>{{subst:Foo}}</noinclude>
6896 <onlyinclude>{{subst:Foo}}</onlyinclude>
6897
6898 But not inside includeonly
6899 <includeonly>{{subst:Foo}}</includeonly>
6900 !! result
6901 Shall not expand:
6902
6903 <nowiki>~~~~</nowiki>
6904
6905 <includeonly><nowiki>~~~~</nowiki></includeonly>
6906
6907 <noinclude><nowiki>~~~~</nowiki></noinclude>
6908
6909 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
6910
6911 FOO shall be converted to FOO
6912
6913 As well as inside noinclude/onlyinclude
6914 <noinclude>FOO</noinclude>
6915 <onlyinclude>FOO</onlyinclude>
6916
6917 But not inside includeonly
6918 <includeonly>{{subst:Foo}}</includeonly>
6919 !! end
6920
6921 ###
6922 ### Message transform tests
6923 ###
6924 !! test
6925 message transform: magic variables
6926 !! options
6927 msg
6928 !! input
6929 {{SITENAME}}
6930 !! result
6931 MediaWiki
6932 !! end
6933
6934 !! test
6935 message transform: should not transform wiki markup
6936 !! options
6937 msg
6938 !! input
6939 ''test''
6940 !! result
6941 ''test''
6942 !! end
6943
6944 !! test
6945 message transform: <noinclude> in transcluded template (bug 4926)
6946 !! options
6947 msg
6948 !! input
6949 {{Includes}}
6950 !! result
6951 Foobar
6952 !! end
6953
6954 !! test
6955 message transform: <onlyinclude> in transcluded template (bug 4926)
6956 !! options
6957 msg
6958 !! input
6959 {{Includes2}}
6960 !! result
6961 Foo
6962 !! end
6963
6964 !! test
6965 {{#special:}} page name, known
6966 !! options
6967 msg
6968 !! input
6969 {{#special:Recentchanges}}
6970 !! result
6971 Special:RecentChanges
6972 !! end
6973
6974 !! test
6975 {{#special:}} page name with subpage, known
6976 !! options
6977 msg
6978 !! input
6979 {{#special:Recentchanges/param}}
6980 !! result
6981 Special:RecentChanges/param
6982 !! end
6983
6984 !! test
6985 {{#special:}} page name, unknown
6986 !! options
6987 msg
6988 !! input
6989 {{#special:foobarnonexistent}}
6990 !! result
6991 No such special page
6992 !! end
6993
6994 !! test
6995 {{#speciale:}} page name, known
6996 !! options
6997 msg
6998 !! input
6999 {{#speciale:Recentchanges}}
7000 !! result
7001 Special:RecentChanges
7002 !! end
7003
7004 !! test
7005 {{#speciale:}} page name with subpage, known
7006 !! options
7007 msg
7008 !! input
7009 {{#speciale:Recentchanges/param}}
7010 !! result
7011 Special:RecentChanges/param
7012 !! end
7013
7014 !! test
7015 {{#speciale:}} page name, unknown
7016 !! options
7017 msg
7018 !! input
7019 {{#speciale:foobarnonexistent}}
7020 !! result
7021 No_such_special_page
7022 !! end
7023
7024 ###
7025 ### Images
7026 ###
7027 !! test
7028 Simple image
7029 !! input
7030 [[Image:foobar.jpg]]
7031 !! result
7032 <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>
7033 </p>
7034 !! end
7035
7036 !! test
7037 Right-aligned image
7038 !! input
7039 [[Image:foobar.jpg|right]]
7040 !! result
7041 <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>
7042
7043 !! end
7044
7045 !! test
7046 Simple image (using File: namespace, now canonical)
7047 !! input
7048 [[File:foobar.jpg]]
7049 !! result
7050 <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>
7051 </p>
7052 !! end
7053
7054 !! test
7055 Image with caption
7056 !! input
7057 [[Image:foobar.jpg|right|Caption text]]
7058 !! result
7059 <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>
7060
7061 !! end
7062
7063 !! test
7064 Image with empty attribute
7065 !! input
7066 [[Image:foobar.jpg|right||Caption text]]
7067 !! result
7068 <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>
7069
7070 !! end
7071
7072 !! test
7073 Image with link tails
7074 !! input
7075 123[[Image:foobar.jpg]]456
7076 123[[Image:foobar.jpg|right]]456
7077 123[[Image:foobar.jpg|thumb]]456
7078 !! result
7079 <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
7080 </p>
7081 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
7082 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
7083
7084 !! end
7085
7086 !! test
7087 Image with multiple captions -- only last one is accepted
7088 !! input
7089 [[Image:foobar.jpg|right|Caption1 - ignored|[[Caption2]] - ignored|Caption3 - accepted]]
7090 !! result
7091 <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>
7092
7093 !! end
7094
7095 !! test
7096 Image with width attribute at different positions
7097 !! input
7098 [[Image:foobar.jpg|200px|right|Caption]]
7099 [[Image:foobar.jpg|right|200px|Caption]]
7100 [[Image:foobar.jpg|right|Caption|200px]]
7101 !! result
7102 <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>
7103 <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>
7104 <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>
7105
7106 !! end
7107
7108 !! test
7109 Image with link parameter, wiki target
7110 !! input
7111 [[Image:foobar.jpg|link=Target page]]
7112 !! result
7113 <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>
7114 </p>
7115 !! end
7116
7117 !! test
7118 Image with link parameter, URL target
7119 !! input
7120 [[Image:foobar.jpg|link=http://example.com/]]
7121 !! result
7122 <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>
7123 </p>
7124 !! end
7125
7126 !! test
7127 Image with link parameter, wgExternalLinkTarget
7128 !! input
7129 [[Image:foobar.jpg|link=http://example.com/]]
7130 !! config
7131 wgExternalLinkTarget='foobar'
7132 !! result
7133 <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>
7134 </p>
7135 !! end
7136
7137 !! test
7138 Image with link parameter, wgNoFollowLinks set to false
7139 !! input
7140 [[Image:foobar.jpg|link=http://example.com/]]
7141 !! config
7142 wgNoFollowLinks=false
7143 !! result
7144 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
7145 </p>
7146 !! end
7147
7148 !! test
7149 Image with link parameter, wgNoFollowDomainExceptions
7150 !! input
7151 [[Image:foobar.jpg|link=http://example.com/]]
7152 !! config
7153 wgNoFollowDomainExceptions='example.com'
7154 !! result
7155 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
7156 </p>
7157 !! end
7158
7159 !! test
7160 Image with link parameter, wgExternalLinkTarget, unnamed parameter
7161 !! input
7162 [[Image:foobar.jpg|link=http://example.com/|Title]]
7163 !! config
7164 wgExternalLinkTarget='foobar'
7165 !! result
7166 <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>
7167 </p>
7168 !! end
7169
7170 !! test
7171 Image with empty link parameter
7172 !! input
7173 [[Image:foobar.jpg|link=]]
7174 !! result
7175 <p><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" />
7176 </p>
7177 !! end
7178
7179 !! test
7180 Image with link parameter (wiki target) and unnamed parameter
7181 !! input
7182 [[Image:foobar.jpg|link=Target page|Title]]
7183 !! result
7184 <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>
7185 </p>
7186 !! end
7187
7188 !! test
7189 Image with link parameter (URL target) and unnamed parameter
7190 !! input
7191 [[Image:foobar.jpg|link=http://example.com/|Title]]
7192 !! result
7193 <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>
7194 </p>
7195 !! end
7196
7197 !! test
7198 Thumbnail image with link parameter
7199 !! options
7200 php
7201 !! input
7202 [[Image:foobar.jpg|thumb|link=http://example.com/|Title]]
7203 !! result
7204 <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>
7205
7206 !! end
7207
7208 !! test
7209 Manually-specified thumbnail image
7210 !! options
7211 php
7212 !! input
7213 [[Image:Foobar.jpg|thumb=Thumb.png|Title]]
7214 !! result
7215 <div class="thumb tright"><div class="thumbinner" style="width:137px;"><a href="/wiki/File:Foobar.jpg"><img alt="" src="http://example.com/images/e/ea/Thumb.png" width="135" height="135" class="thumbimage" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>Title</div></div></div>
7216
7217 !! end
7218
7219 !! test
7220 Manually-specified thumbnail image with explicit link to wiki page
7221 !! options
7222 php
7223 !! input
7224 [[Image:Foobar.jpg|thumb=Thumb.png|link=Main Page|Title]]
7225 !! result
7226 <div class="thumb tright"><div class="thumbinner" style="width:137px;"><a href="/wiki/Main_Page" title="Main Page"><img alt="" src="http://example.com/images/e/ea/Thumb.png" width="135" height="135" class="thumbimage" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>Title</div></div></div>
7227
7228 !! end
7229
7230 !! test
7231 Manually-specified thumbnail image with explicit link to url
7232 !! options
7233 php
7234 !! input
7235 [[Image:Foobar.jpg|thumb=Thumb.png|link=http://example.com|Title]]
7236 !! result
7237 <div class="thumb tright"><div class="thumbinner" style="width:137px;"><a href="http://example.com"><img alt="" src="http://example.com/images/e/ea/Thumb.png" width="135" height="135" class="thumbimage" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>Title</div></div></div>
7238
7239 !! end
7240
7241 !! test
7242 Manually-specified thumbnail image with explicit no link
7243 !! options
7244 php
7245 !! input
7246 [[Image:Foobar.jpg|thumb=Thumb.png|link=|Title]]
7247 !! result
7248 <div class="thumb tright"><div class="thumbinner" style="width:137px;"><img alt="" src="http://example.com/images/e/ea/Thumb.png" width="135" height="135" class="thumbimage" /> <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>
7249
7250 !! end
7251
7252 !! test
7253 Manually-specified thumbnail image with explicit link and alt text
7254 !! options
7255 php
7256 !! input
7257 [[Image:Foobar.jpg|thumb=Thumb.png|link=Main Page|alt=alttext|Title]]
7258 !! result
7259 <div class="thumb tright"><div class="thumbinner" style="width:137px;"><a href="/wiki/Main_Page" title="Main Page"><img alt="alttext" src="http://example.com/images/e/ea/Thumb.png" width="135" height="135" class="thumbimage" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>Title</div></div></div>
7260
7261 !! end
7262
7263 !! test
7264 Image with frame and link
7265 !! input
7266 [[Image:Foobar.jpg|frame|left|This is a test image [[Main Page]]]]
7267 !! result
7268 <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>
7269
7270 !! end
7271
7272 !! test
7273 Image with frame and link and explicit alt
7274 !! input
7275 [[Image:Foobar.jpg|frame|left|This is a test image [[Main Page]]|alt=Altitude]]
7276 !! result
7277 <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>
7278
7279 !! end
7280
7281 !! test
7282 Image with wiki markup in implicit alt
7283 !! input
7284 [[Image:Foobar.jpg|testing '''bold''' in alt]]
7285 !! result
7286 <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>
7287 </p>
7288 !! end
7289
7290 !! test
7291 Image with wiki markup in explicit alt
7292 !! input
7293 [[Image:Foobar.jpg|alt=testing '''bold''' in alt]]
7294 !! result
7295 <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>
7296 </p>
7297 !! end
7298
7299 !! test
7300 Link to image page- image page normally doesn't exists, hence edit link
7301 Add test with existing image page
7302 #<p><a href="/wiki/File:Test" title="Image:Test">Image:test</a>
7303 !! input
7304 [[:Image:test]]
7305 !! result
7306 <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>
7307 </p>
7308 !! end
7309
7310 !! test
7311 bug 18784 Link to non-existent image page with caption should use caption as link text
7312 !! input
7313 [[:Image:test|caption]]
7314 !! result
7315 <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>
7316 </p>
7317 !! end
7318
7319 !! test
7320 Frameless image caption with a free URL
7321 !! input
7322 [[Image:foobar.jpg|http://example.com]]
7323 !! result
7324 <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>
7325 </p>
7326 !! end
7327
7328 !! test
7329 Thumbnail image caption with a free URL
7330 !! input
7331 [[Image:foobar.jpg|thumb|http://example.com]]
7332 !! result
7333 <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>
7334
7335 !! end
7336
7337 !! test
7338 Thumbnail image caption with a free URL and explicit alt
7339 !! input
7340 [[Image:foobar.jpg|thumb|http://example.com|alt=Alteration]]
7341 !! result
7342 <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>
7343
7344 !! end
7345
7346 !! test
7347 BUG 1887: A ISBN with a thumbnail
7348 !! input
7349 [[Image:foobar.jpg|thumb|ISBN 1235467890]]
7350 !! result
7351 <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>
7352
7353 !! end
7354
7355 !! test
7356 BUG 1887: A RFC with a thumbnail
7357 !! input
7358 [[Image:foobar.jpg|thumb|This is RFC 12354]]
7359 !! result
7360 <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" rel="nofollow" href="//tools.ietf.org/html/rfc12354">RFC 12354</a></div></div></div>
7361
7362 !! end
7363
7364 !! test
7365 BUG 1887: A mailto link with a thumbnail
7366 !! input
7367 [[Image:foobar.jpg|thumb|Please mailto:nobody@example.com]]
7368 !! result
7369 <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>
7370
7371 !! end
7372
7373 # Pending resolution to bug 368
7374 !! test
7375 BUG 648: Frameless image caption with a link
7376 !! input
7377 [[Image:foobar.jpg|text with a [[link]] in it]]
7378 !! result
7379 <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>
7380 </p>
7381 !! end
7382
7383 !! test
7384 BUG 648: Frameless image caption with a link (suffix)
7385 !! input
7386 [[Image:foobar.jpg|text with a [[link]]foo in it]]
7387 !! result
7388 <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>
7389 </p>
7390 !! end
7391
7392 !! test
7393 BUG 648: Frameless image caption with an interwiki link
7394 !! input
7395 [[Image:foobar.jpg|text with a [[MeatBall:Link]] in it]]
7396 !! result
7397 <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>
7398 </p>
7399 !! end
7400
7401 !! test
7402 BUG 648: Frameless image caption with a piped interwiki link
7403 !! input
7404 [[Image:foobar.jpg|text with a [[MeatBall:Link|link]] in it]]
7405 !! result
7406 <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>
7407 </p>
7408 !! end
7409
7410 !! test
7411 Escape HTML special chars in image alt text
7412 !! input
7413 [[Image:foobar.jpg|& < > "]]
7414 !! result
7415 <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>
7416 </p>
7417 !! end
7418
7419 !! test
7420 BUG 499: Alt text should have &#1234;, not &amp;1234;
7421 !! input
7422 [[Image:foobar.jpg|&#9792;]]
7423 !! result
7424 <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>
7425 </p>
7426 !! end
7427
7428 !! test
7429 Broken image caption with link
7430 !! input
7431 [[Image:Foobar.jpg|thumb|This is a broken caption. But [[Main Page|this]] is just an ordinary link.
7432 !! result
7433 <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.
7434 </p>
7435 !! end
7436
7437 !! test
7438 Image caption containing another image
7439 !! input
7440 [[Image:Foobar.jpg|thumb|This is a caption with another [[Image:icon.png|image]] inside it!]]
7441 !! result
7442 <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>
7443
7444 !! end
7445
7446 !! test
7447 Image caption containing a newline
7448 !! input
7449 [[Image:Foobar.jpg|This
7450 *is some text]]
7451 !! result
7452 <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>
7453 </p>
7454 !!end
7455
7456 !!test
7457 Parsoid: Image caption containing leading space
7458 (The leading space should not trigger nowiki escaping in wt2wt mode)
7459 !! input
7460 [[Image:Foobar.jpg|thumb| bar]]
7461 !! result
7462 <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>bar</div></div></div>
7463
7464 !!end
7465
7466 !! test
7467 Bug 3090: External links other than http: in image captions
7468 !! input
7469 [[Image:Foobar.jpg|thumb|200px|This caption has [irc://example.net irc] and [https://example.com Secure] ext links in it.]]
7470 !! result
7471 <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>
7472
7473 !! end
7474
7475 !! test
7476 Custom class
7477 !! input
7478 [[Image:foobar.jpg|a|class=b]]
7479 !! result
7480 <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>
7481 </p>
7482 !! end
7483
7484 !! test
7485 Localized image handling (1).
7486 !! options
7487 language=es
7488 !! input
7489 [[Archivo:Foobar.jpg|izquierda|enlace=foo|caption]]
7490 !! result
7491 <div class="floatleft"><a href="/wiki/Foo" title="caption"><img alt="caption" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a></div>
7492
7493 !! end
7494
7495 !! test
7496 Localized image handling (2).
7497 !! options
7498 language=es
7499 !! input
7500 [[Archivo:Foobar.jpg|miniatura|izquierda|enlace=foo|caption]]
7501 !! result
7502 <div class="thumb tleft"><div class="thumbinner" style="width:182px;"><a href="/wiki/Foo" title="Foo"><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/Archivo:Foobar.jpg" class="internal" title="Aumentar"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>caption</div></div></div>
7503
7504 !! end
7505
7506 !! test
7507 "border", "frameless" and "class" attributes on an image.
7508 !! input
7509 [[File:Foobar.jpg|frameless|border|class=extra|caption]]
7510 !! result
7511 <p><a href="/wiki/File:Foobar.jpg" class="image" title="caption"><img alt="caption" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" class="extra thumbborder" 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>
7512 </p>
7513 !! end
7514
7515 !! article
7516 File:Barfoo.jpg
7517 !! text
7518 #REDIRECT [[File:Barfoo.jpg]]
7519 !! endarticle
7520
7521 !! test
7522 Redirected image
7523 !! input
7524 [[Image:Barfoo.jpg]]
7525 !! result
7526 <p><a href="/wiki/File:Barfoo.jpg" title="File:Barfoo.jpg">File:Barfoo.jpg</a>
7527 </p>
7528 !! end
7529
7530 !! test
7531 Missing image with uploads disabled
7532 !! options
7533 wgEnableUploads=0
7534 !! input
7535 [[Image:Foobaz.jpg]]
7536 !! result
7537 <p><a href="/wiki/File:Foobaz.jpg" title="File:Foobaz.jpg">File:Foobaz.jpg</a>
7538 </p>
7539 !! end
7540
7541
7542 ###
7543 ### Subpages
7544 ###
7545 !! article
7546 Subpage test/subpage
7547 !! text
7548 foo
7549 !! endarticle
7550
7551 !! test
7552 Subpage link
7553 !! options
7554 subpage title=[[Subpage test]]
7555 !! input
7556 [[/subpage]]
7557 !! result
7558 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a>
7559 </p>
7560 !! end
7561
7562 !! test
7563 Subpage noslash link
7564 !! options
7565 subpage title=[[Subpage test]]
7566 !!input
7567 [[/subpage/]]
7568 !! result
7569 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">subpage</a>
7570 </p>
7571 !! end
7572
7573 !! test
7574 Disabled subpages
7575 !! input
7576 [[/subpage]]
7577 !! result
7578 <p><a href="/index.php?title=/subpage&amp;action=edit&amp;redlink=1" class="new" title="/subpage (page does not exist)">/subpage</a>
7579 </p>
7580 !! end
7581
7582 !! test
7583 BUG 561: {{/Subpage}}
7584 !! options
7585 subpage title=[[Page]]
7586 !! input
7587 {{/Subpage}}
7588 !! result
7589 <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>
7590 </p>
7591 !! end
7592
7593 ###
7594 ### Categories
7595 ###
7596 !! article
7597 Category:MediaWiki User's Guide
7598 !! text
7599 blah
7600 !! endarticle
7601
7602 !! test
7603 Link to category
7604 !! input
7605 [[:Category:MediaWiki User's Guide]]
7606 !! result
7607 <p><a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">Category:MediaWiki User's Guide</a>
7608 </p>
7609 !! end
7610
7611 !! test
7612 Simple category
7613 !! options
7614 cat
7615 !! input
7616 [[Category:MediaWiki User's Guide]]
7617 !! result
7618 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
7619 !! end
7620
7621 !! test
7622 PAGESINCATEGORY invalid title fatal (r33546 fix)
7623 !! input
7624 {{PAGESINCATEGORY:<bogus>}}
7625 !! result
7626 <p>0
7627 </p>
7628 !! end
7629
7630 !! test
7631 Category with different sort key
7632 !! options
7633 cat
7634 !! input
7635 [[Category:MediaWiki User's Guide|Foo]]
7636 !! result
7637 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
7638 !! end
7639
7640 !! test
7641 Category with identical sort key
7642 !! options
7643 cat
7644 !! input
7645 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
7646 !! result
7647 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
7648 !! end
7649
7650 !! test
7651 Category with empty sort key
7652 !! options
7653 cat
7654 pst
7655 !! input
7656 [[Category:MediaWiki User's Guide|]]
7657 !! result
7658 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
7659 !! end
7660
7661 !! test
7662 Category with empty sort key and parentheses
7663 !! options
7664 cat
7665 pst
7666 !! input
7667 [[Category:Foo (bar)|]]
7668 !! result
7669 [[Category:Foo (bar)|Foo]]
7670 !! end
7671
7672 !! test
7673 Category with link tail
7674 !! options
7675 cat
7676 pst
7677 !! input
7678 123[[Category:Foo]]456
7679 !! result
7680 123[[Category:Foo]]456
7681 !! end
7682
7683 !! test
7684 Category with template
7685 !! options
7686 cat
7687 pst
7688 !! input
7689 [[Category:{{echo|Foo}}]]
7690 !! result
7691 [[Category:{{echo|Foo}}]]
7692 !! end
7693
7694 !! test
7695 Category with template in sort key
7696 !! options
7697 cat
7698 pst
7699 !! input
7700 [[Category:Foo|{{echo|Bar}}]]
7701 !! result
7702 [[Category:Foo|{{echo|Bar}}]]
7703 !! end
7704
7705 !! test
7706 Category with template in sort key and title
7707 !! options
7708 cat
7709 pst
7710 !! input
7711 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
7712 !! result
7713 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
7714 !! end
7715
7716 !! test
7717 Category / paragraph interactions
7718 !! input
7719 Foo [[Category:Baz]] Bar
7720
7721 Foo [[Category:Baz]]
7722 Bar
7723
7724 Foo
7725 [[Category:Baz]]
7726 Bar
7727
7728 Foo
7729 [[Category:Baz]] Bar
7730
7731 Foo
7732 [[Category:Baz]]
7733 [[Category:Baz]]
7734 [[Category:Baz]]
7735 Bar
7736
7737 [[Category:Baz]]
7738 [[Category:Baz]]
7739 [[Category:Baz]]
7740
7741 [[Category:Baz]]
7742 {{echo|[[Category:Baz]]}}
7743 [[Category:Baz]]
7744 !! result
7745 <p>Foo Bar
7746 </p><p>Foo
7747 Bar
7748 </p><p>Foo
7749 Bar
7750 </p><p>Foo Bar
7751 </p><p>Foo
7752 Bar
7753 </p>
7754 !! end
7755
7756 ###
7757 ### Inter-language links
7758 ###
7759 !! test
7760 Inter-language links
7761 !! options
7762 ill
7763 !! input
7764 [[es:Alimento]]
7765 [[fr:Nourriture]]
7766 [[zh:&#39135;&#21697;]]
7767 !! result
7768 es:Alimento fr:Nourriture zh:食品
7769 !! end
7770
7771 !! test
7772 Duplicate interlanguage links (bug 24502)
7773 !! options
7774 ill
7775 !! input
7776 [[es:1]]
7777 [[es:2]]
7778 [[fr:1]]
7779 [[fr:2]]
7780 !! result
7781 es:1 fr:1
7782 !! end
7783
7784 ###
7785 ### Sections
7786 ###
7787 !! test
7788 Basic section headings
7789 !! input
7790 == Headline 1 ==
7791 Some text
7792
7793 ==Headline 2==
7794 More
7795 ===Smaller headline===
7796 Blah blah
7797 !! result
7798 <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>
7799 <p>Some text
7800 </p>
7801 <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>
7802 <p>More
7803 </p>
7804 <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>
7805 <p>Blah blah
7806 </p>
7807 !! end
7808
7809 !! test
7810 Section headings with TOC
7811 !! input
7812 == Headline 1 ==
7813 === Subheadline 1 ===
7814 ===== Skipping a level =====
7815 ====== Skipping a level ======
7816
7817 == Headline 2 ==
7818 Some text
7819 ===Another headline===
7820 !! result
7821 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
7822 <ul>
7823 <li class="toclevel-1 tocsection-1"><a href="#Headline_1"><span class="tocnumber">1</span> <span class="toctext">Headline 1</span></a>
7824 <ul>
7825 <li class="toclevel-2 tocsection-2"><a href="#Subheadline_1"><span class="tocnumber">1.1</span> <span class="toctext">Subheadline 1</span></a>
7826 <ul>
7827 <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>
7828 <ul>
7829 <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>
7830 </ul>
7831 </li>
7832 </ul>
7833 </li>
7834 </ul>
7835 </li>
7836 <li class="toclevel-1 tocsection-5"><a href="#Headline_2"><span class="tocnumber">2</span> <span class="toctext">Headline 2</span></a>
7837 <ul>
7838 <li class="toclevel-2 tocsection-6"><a href="#Another_headline"><span class="tocnumber">2.1</span> <span class="toctext">Another headline</span></a></li>
7839 </ul>
7840 </li>
7841 </ul>
7842 </td></tr></table>
7843 <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>
7844 <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>
7845 <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>
7846 <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>
7847 <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>
7848 <p>Some text
7849 </p>
7850 <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>
7851
7852 !! end
7853
7854 # perl -e 'print "="x$_," Level $_ heading","="x$_,"\n" for 1..10'
7855 !! test
7856 Handling of sections up to level 6 and beyond
7857 !! input
7858 = Level 1 Heading=
7859 == Level 2 Heading==
7860 === Level 3 Heading===
7861 ==== Level 4 Heading====
7862 ===== Level 5 Heading=====
7863 ====== Level 6 Heading======
7864 ======= Level 7 Heading=======
7865 ======== Level 8 Heading========
7866 ========= Level 9 Heading=========
7867 ========== Level 10 Heading==========
7868 !! result
7869 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
7870 <ul>
7871 <li class="toclevel-1 tocsection-1"><a href="#Level_1_Heading"><span class="tocnumber">1</span> <span class="toctext">Level 1 Heading</span></a>
7872 <ul>
7873 <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>
7874 <ul>
7875 <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>
7876 <ul>
7877 <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>
7878 <ul>
7879 <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>
7880 <ul>
7881 <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>
7882 <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>
7883 <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>
7884 <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>
7885 <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>
7886 </ul>
7887 </li>
7888 </ul>
7889 </li>
7890 </ul>
7891 </li>
7892 </ul>
7893 </li>
7894 </ul>
7895 </li>
7896 </ul>
7897 </td></tr></table>
7898 <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>
7899 <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>
7900 <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>
7901 <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>
7902 <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>
7903 <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>
7904 <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>
7905 <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>
7906 <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>
7907 <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>
7908
7909 !! end
7910
7911 !! test
7912 TOC regression (bug 9764)
7913 !! input
7914 == title 1 ==
7915 === title 1.1 ===
7916 ==== title 1.1.1 ====
7917 === title 1.2 ===
7918 == title 2 ==
7919 === title 2.1 ===
7920 !! result
7921 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
7922 <ul>
7923 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
7924 <ul>
7925 <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>
7926 <ul>
7927 <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>
7928 </ul>
7929 </li>
7930 <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>
7931 </ul>
7932 </li>
7933 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
7934 <ul>
7935 <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>
7936 </ul>
7937 </li>
7938 </ul>
7939 </td></tr></table>
7940 <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>
7941 <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>
7942 <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>
7943 <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>
7944 <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>
7945 <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>
7946
7947 !! end
7948
7949 !! test
7950 TOC with wgMaxTocLevel=3 (bug 6204)
7951 !! options
7952 wgMaxTocLevel=3
7953 !! input
7954 == title 1 ==
7955 === title 1.1 ===
7956 ==== title 1.1.1 ====
7957 === title 1.2 ===
7958 == title 2 ==
7959 === title 2.1 ===
7960 !! result
7961 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
7962 <ul>
7963 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
7964 <ul>
7965 <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>
7966 <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>
7967 </ul>
7968 </li>
7969 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
7970 <ul>
7971 <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>
7972 </ul>
7973 </li>
7974 </ul>
7975 </td></tr></table>
7976 <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>
7977 <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>
7978 <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>
7979 <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>
7980 <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>
7981 <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>
7982
7983 !! end
7984
7985 !! test
7986 TOC with wgMaxTocLevel=3 and two level four headings (bug 6204)
7987 !! options
7988 wgMaxTocLevel=3
7989 !! input
7990 ==Section 1==
7991 ===Section 1.1===
7992 ====Section 1.1.1====
7993 ====Section 1.1.1.1====
7994 ==Section 2==
7995 !! result
7996 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
7997 <ul>
7998 <li class="toclevel-1 tocsection-1"><a href="#Section_1"><span class="tocnumber">1</span> <span class="toctext">Section 1</span></a>
7999 <ul>
8000 <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>
8001 </ul>
8002 </li>
8003 <li class="toclevel-1 tocsection-5"><a href="#Section_2"><span class="tocnumber">2</span> <span class="toctext">Section 2</span></a></li>
8004 </ul>
8005 </td></tr></table>
8006 <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>
8007 <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>
8008 <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>
8009 <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>
8010 <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>
8011
8012 !! end
8013
8014
8015 !! test
8016 Resolving duplicate section names
8017 !! input
8018 == Foo bar ==
8019 == Foo bar ==
8020 !! result
8021 <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>
8022 <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>
8023
8024 !! end
8025
8026 !! test
8027 Resolving duplicate section names with differing case (bug 10721)
8028 !! input
8029 == Foo bar ==
8030 == Foo Bar ==
8031 !! result
8032 <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>
8033 <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>
8034
8035 !! end
8036
8037 !! article
8038 Template:sections
8039 !! text
8040 ===Section 1===
8041 ==Section 2==
8042 !! endarticle
8043
8044 !! test
8045 Template with sections, __NOTOC__
8046 !! input
8047 __NOTOC__
8048 ==Section 0==
8049 {{sections}}
8050 ==Section 4==
8051 !! result
8052 <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>
8053 <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>
8054 <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>
8055 <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>
8056
8057 !! end
8058
8059 !! test
8060 __NOEDITSECTION__ keyword
8061 !! input
8062 __NOEDITSECTION__
8063 ==Section 1==
8064 ==Section 2==
8065 !! result
8066 <h2> <span class="mw-headline" id="Section_1">Section 1</span></h2>
8067 <h2> <span class="mw-headline" id="Section_2">Section 2</span></h2>
8068
8069 !! end
8070
8071 !! test
8072 Link inside a section heading
8073 !! input
8074 ==Section with a [[Main Page|link]] in it==
8075 !! result
8076 <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>
8077
8078 !! end
8079
8080 !! test
8081 TOC regression (bug 12077)
8082 !! input
8083 __TOC__
8084 == title 1 ==
8085 === title 1.1 ===
8086 == title 2 ==
8087 !! result
8088 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
8089 <ul>
8090 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
8091 <ul>
8092 <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>
8093 </ul>
8094 </li>
8095 <li class="toclevel-1 tocsection-3"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a></li>
8096 </ul>
8097 </td></tr></table>
8098 <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>
8099 <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>
8100 <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>
8101
8102 !! end
8103
8104 !! test
8105 BUG 1219 URL next to image (good)
8106 !! input
8107 http://example.com [[Image:foobar.jpg]]
8108 !! result
8109 <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>
8110 </p>
8111 !!end
8112
8113 !! test
8114 Short headings with trailing space should match behavior of Parser::doHeadings (bug 19910)
8115 !! input
8116 ===
8117 The line above must have a trailing space!
8118 === <!--
8119 --> <!-- -->
8120 But just in case it doesn't...
8121 !! result
8122 <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>
8123 <p>The line above must have a trailing space!
8124 </p>
8125 <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>
8126 <p>But just in case it doesn't...
8127 </p>
8128 !! end
8129
8130 !! test
8131 Header with special characters (bug 25462)
8132 !! input
8133 The tooltips shall not show entities to the user (ie. be double escaped)
8134
8135 == text > text ==
8136 section 1
8137
8138 == text < text ==
8139 section 2
8140
8141 == text & text ==
8142 section 3
8143
8144 == text ' text ==
8145 section 4
8146
8147 == text " text ==
8148 section 5
8149 !! result
8150 <p>The tooltips shall not show entities to the user (ie. be double escaped)
8151 </p>
8152 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
8153 <ul>
8154 <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>
8155 <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>
8156 <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>
8157 <li class="toclevel-1 tocsection-4"><a href="#text_.27_text"><span class="tocnumber">4</span> <span class="toctext">text ' text</span></a></li>
8158 <li class="toclevel-1 tocsection-5"><a href="#text_.22_text"><span class="tocnumber">5</span> <span class="toctext">text " text</span></a></li>
8159 </ul>
8160 </td></tr></table>
8161 <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>
8162 <p>section 1
8163 </p>
8164 <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>
8165 <p>section 2
8166 </p>
8167 <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>
8168 <p>section 3
8169 </p>
8170 <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>
8171 <p>section 4
8172 </p>
8173 <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>
8174 <p>section 5
8175 </p>
8176 !! end
8177
8178 !! test
8179 Headers with excess '=' characters
8180 (Are similar tests necessary beyond the 1st level?)
8181 !! input
8182 =foo==
8183 ==foo=
8184 =''italic'' heading==
8185 ==''italic'' heading=
8186 !! result
8187 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
8188 <ul>
8189 <li class="toclevel-1 tocsection-1"><a href="#foo.3D"><span class="tocnumber">1</span> <span class="toctext">foo=</span></a></li>
8190 <li class="toclevel-1 tocsection-2"><a href="#.3Dfoo"><span class="tocnumber">2</span> <span class="toctext">=foo</span></a></li>
8191 <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>
8192 <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>
8193 </ul>
8194 </td></tr></table>
8195 <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>
8196 <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>
8197 <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>
8198 <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>
8199
8200 !! end
8201
8202 !! test
8203 HTML headers vs TOC (bug 23393)
8204 (__NOEDITSECTION__ for clearer output, doesn't matter here)
8205 !! input
8206 <h1>Header 1</h1>
8207 == Header 1.1 ==
8208 == Header 1.2 ==
8209
8210 <h1>Header 2
8211 </h1>
8212 == Header 2.1 ==
8213 == Header 2.2 ==
8214 __NOEDITSECTION__
8215 !! result
8216 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
8217 <ul>
8218 <li class="toclevel-1"><a href="#Header_1"><span class="tocnumber">1</span> <span class="toctext">Header 1</span></a>
8219 <ul>
8220 <li class="toclevel-2 tocsection-1"><a href="#Header_1.1"><span class="tocnumber">1.1</span> <span class="toctext">Header 1.1</span></a></li>
8221 <li class="toclevel-2 tocsection-2"><a href="#Header_1.2"><span class="tocnumber">1.2</span> <span class="toctext">Header 1.2</span></a></li>
8222 </ul>
8223 </li>
8224 <li class="toclevel-1"><a href="#Header_2"><span class="tocnumber">2</span> <span class="toctext">Header 2</span></a>
8225 <ul>
8226 <li class="toclevel-2 tocsection-3"><a href="#Header_2.1"><span class="tocnumber">2.1</span> <span class="toctext">Header 2.1</span></a></li>
8227 <li class="toclevel-2 tocsection-4"><a href="#Header_2.2"><span class="tocnumber">2.2</span> <span class="toctext">Header 2.2</span></a></li>
8228 </ul>
8229 </li>
8230 </ul>
8231 </td></tr></table>
8232 <h1> <span class="mw-headline" id="Header_1">Header 1</span></h1>
8233 <h2> <span class="mw-headline" id="Header_1.1">Header 1.1</span></h2>
8234 <h2> <span class="mw-headline" id="Header_1.2">Header 1.2</span></h2>
8235 <h1> <span class="mw-headline" id="Header_2">Header 2</span></h1>
8236 <h2> <span class="mw-headline" id="Header_2.1">Header 2.1</span></h2>
8237 <h2> <span class="mw-headline" id="Header_2.2">Header 2.2</span></h2>
8238
8239 !! end
8240
8241 !! test
8242 BUG 1219 URL next to image (broken)
8243 !! input
8244 http://example.com[[Image:foobar.jpg]]
8245 !! result
8246 <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>
8247 </p>
8248 !!end
8249
8250 !! test
8251 Bug 1186 news: in the middle of text
8252 !! input
8253 http://en.wikinews.org/wiki/Wikinews:Workplace
8254 !! result
8255 <p><a rel="nofollow" class="external free" href="http://en.wikinews.org/wiki/Wikinews:Workplace">http://en.wikinews.org/wiki/Wikinews:Workplace</a>
8256 </p>
8257 !!end
8258
8259
8260 !! test
8261 Namespaced link must have a title
8262 !! input
8263 [[Project:]]
8264 !! result
8265 <p>[[Project:]]
8266 </p>
8267 !!end
8268
8269 !! test
8270 Namespaced link must have a title (bad fragment version)
8271 !! input
8272 [[Project:#fragment]]
8273 !! result
8274 <p>[[Project:#fragment]]
8275 </p>
8276 !!end
8277
8278
8279 ###
8280 ### HTML tags and HTML attributes
8281 ###
8282
8283 !! test
8284 div with no attributes
8285 !! input
8286 <div>HTML rocks</div>
8287 !! result
8288 <div>HTML rocks</div>
8289
8290 !! end
8291
8292 !! test
8293 div with double-quoted attribute
8294 !! input
8295 <div id="rock">HTML rocks</div>
8296 !! result
8297 <div id="rock">HTML rocks</div>
8298
8299 !! end
8300
8301 !! test
8302 div with single-quoted attribute
8303 !! input
8304 <div id='rock'>HTML rocks</div>
8305 !! result
8306 <div id="rock">HTML rocks</div>
8307
8308 !! end
8309
8310 !! test
8311 div with unquoted attribute
8312 !! input
8313 <div id=rock>HTML rocks</div>
8314 !! result
8315 <div id="rock">HTML rocks</div>
8316
8317 !! end
8318
8319 !! test
8320 div with illegal double attributes
8321 !! input
8322 <div id="a" id="b">HTML rocks</div>
8323 !! result
8324 <div id="b">HTML rocks</div>
8325
8326 !!end
8327
8328 # FIXME: produce empty string instead of "class" in the PHP parser, following
8329 # the HTML5 spec.
8330 !! test
8331 div with empty attribute value, space before equals
8332 !! options
8333 disabled
8334 !! input
8335 <div class =>HTML rocks</div>
8336 !! result
8337 <div class="">HTML rocks</div>
8338
8339 !! end
8340
8341 # The PHP parser escapes the opening brace to &#123; for some reason, so
8342 # disabled this test for it.
8343 !! test
8344 div with braces in attribute value
8345 !! options
8346 disabled
8347 !! input
8348 <div title="{}">Foo</div>
8349 !! result
8350 <div title="{}">Foo</div>
8351 !! end
8352
8353 # This it very inconsistent in the PHP parser: it returns
8354 # class="class" if there is a space between the name and the equal sign (see
8355 # 'div with empty attribute value, space before equals'), but strips the
8356 # attribute completely if the space is missing. We hope that not much content
8357 # depends on this, so are implementing the behavior below in Parsoid for
8358 # consistencies' sake. Disabled for the PHP parser.
8359 # FIXME: fix this behavior in the PHP parser?
8360 !! test
8361 div with empty attribute value, no space before equals
8362 !! options
8363 disabled
8364 !! input
8365 <div class=>HTML rocks</div>
8366 !! result
8367 <div class="">HTML rocks</div>
8368
8369 !! end
8370
8371 !! test
8372 HTML multiple attributes correction
8373 !! input
8374 <p class="error" class="awesome">Awesome!</p>
8375 !! result
8376 <p class="awesome">Awesome!</p>
8377
8378 !!end
8379
8380 !! test
8381 Table multiple attributes correction
8382 !! input
8383 {|
8384 !+ class="error" class="awesome"| status
8385 |}
8386 !! result
8387 <table>
8388 <tr>
8389 <th class="awesome"> status
8390 </th></tr></table>
8391
8392 !!end
8393
8394 !! test
8395 DIV IN UPPERCASE
8396 !! input
8397 <DIV ID="x">HTML ROCKS</DIV>
8398 !! result
8399 <div id="x">HTML ROCKS</div>
8400
8401 !!end
8402
8403 !! test
8404 Non-ASCII pseudo-tags are rendered as text
8405 !! input
8406 <khyô>
8407 !! result
8408 <p>&lt;khyô&gt;
8409 </p>
8410 !! end
8411
8412 !! test
8413 Pseudo-tag with URL 'name' renders as url link
8414 !! input
8415 <http://example.com/>
8416 !! result
8417 <p>&lt;<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&gt;
8418 </p>
8419 !! end
8420
8421 !! test
8422 text with amp in the middle of nowhere
8423 !! input
8424 Remember AT&T?
8425 !!result
8426 <p>Remember AT&amp;T?
8427 </p>
8428 !! end
8429
8430 !! test
8431 text with character entity: eacute
8432 !! input
8433 I always thought &eacute; was a cute letter.
8434 !! result
8435 <p>I always thought &#233; was a cute letter.
8436 </p>
8437 !! end
8438
8439 !! test
8440 text with entity-escaped character entity-like string: eacute
8441 !! input
8442 I always thought &amp;eacute; was a cute letter.
8443 !! result
8444 <p>I always thought &amp;eacute; was a cute letter.
8445 </p>
8446 !! end
8447
8448 !! test
8449 text with undefined character entity: xacute
8450 !! input
8451 I always thought &xacute; was a cute letter.
8452 !! result
8453 <p>I always thought &amp;xacute; was a cute letter.
8454 </p>
8455 !! end
8456
8457
8458 ###
8459 ### Media links
8460 ###
8461
8462 !! test
8463 Media link
8464 !! input
8465 [[Media:Foobar.jpg]]
8466 !! result
8467 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Media:Foobar.jpg</a>
8468 </p>
8469 !! end
8470
8471 !! test
8472 Media link with text
8473 !! input
8474 [[Media:Foobar.jpg|A neat file to look at]]
8475 !! result
8476 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">A neat file to look at</a>
8477 </p>
8478 !! end
8479
8480 # FIXME: this is still bad HTML tag nesting
8481 !! test
8482 Media link with nasty text
8483 fixme: doBlockLevels won't wrap this in a paragraph because it contains a div
8484 !! input
8485 [[Media:Foobar.jpg|Safe Link<div style=display:none>" onmouseover="alert(document.cookie)" onfoo="</div>]]
8486 !! result
8487 <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>
8488
8489 !! end
8490
8491 !! test
8492 Media link to nonexistent file (bug 1702)
8493 !! input
8494 [[Media:No such.jpg]]
8495 !! result
8496 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=No_such.jpg" class="new" title="No such.jpg">Media:No such.jpg</a>
8497 </p>
8498 !! end
8499
8500 !! test
8501 Image link to nonexistent file (bug 1850 - good)
8502 !! input
8503 [[Image:No such.jpg]]
8504 !! result
8505 <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>
8506 </p>
8507 !! end
8508
8509 !! test
8510 :Image link to nonexistent file (bug 1850 - bad)
8511 !! input
8512 [[:Image:No such.jpg]]
8513 !! result
8514 <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>
8515 </p>
8516 !! end
8517
8518
8519
8520 !! test
8521 Character reference normalization in link text (bug 1938)
8522 !! input
8523 [[Main Page|this&that]]
8524 !! result
8525 <p><a href="/wiki/Main_Page" title="Main Page">this&amp;that</a>
8526 </p>
8527 !!end
8528
8529 !! article
8530 אַ
8531 !! text
8532 Test for unicode normalization
8533
8534 The page's name is U+05d0 U+05b7, with non-canonical form U+FB2E
8535 !! endarticle
8536
8537 !! test
8538 (bug 19451) Links should refer to the normalized form.
8539 !! input
8540 [[&#xFB2E;]]
8541 [[&#x5d0;&#x5b7;]]
8542 [[&#x5d0;ַ]]
8543 [[א&#x5b7;]]
8544 [[אַ]]
8545 !! result
8546 <p><a href="/wiki/%D7%90%D6%B7" title="אַ">&#xfb2e;</a>
8547 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;&#x5b7;</a>
8548 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;ַ</a>
8549 <a href="/wiki/%D7%90%D6%B7" title="אַ">א&#x5b7;</a>
8550 <a href="/wiki/%D7%90%D6%B7" title="אַ">אַ</a>
8551 </p>
8552 !! end
8553
8554 !! test
8555 Empty attribute crash test (bug 2067)
8556 !! input
8557 <font color="">foo</font>
8558 !! result
8559 <p><font color="">foo</font>
8560 </p>
8561 !! end
8562
8563 !! test
8564 Empty attribute crash test single-quotes (bug 2067)
8565 !! input
8566 <font color=''>foo</font>
8567 !! result
8568 <p><font color="">foo</font>
8569 </p>
8570 !! end
8571
8572 !! test
8573 Attribute test: equals, then nothing
8574 !! input
8575 <font color=>foo</font>
8576 !! result
8577 <p><font>foo</font>
8578 </p>
8579 !! end
8580
8581 !! test
8582 Attribute test: unquoted value
8583 !! input
8584 <font color=x>foo</font>
8585 !! result
8586 <p><font color="x">foo</font>
8587 </p>
8588 !! end
8589
8590 !! test
8591 Attribute test: unquoted but illegal value (hash)
8592 !! input
8593 <font color=#x>foo</font>
8594 !! result
8595 <p><font color="#x">foo</font>
8596 </p>
8597 !! end
8598
8599 !! test
8600 Attribute test: no value
8601 !! input
8602 <font color>foo</font>
8603 !! result
8604 <p><font color="color">foo</font>
8605 </p>
8606 !! end
8607
8608 !! test
8609 Bug 2095: link with three closing brackets
8610 !! input
8611 [[Main Page]]]
8612 !! result
8613 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>]
8614 </p>
8615 !! end
8616
8617 !! test
8618 Bug 2095: link with pipe and three closing brackets
8619 !! input
8620 [[Main Page|link]]]
8621 !! result
8622 <p><a href="/wiki/Main_Page" title="Main Page">link</a>]
8623 </p>
8624 !! end
8625
8626 !! test
8627 Bug 2095: link with pipe and three closing brackets, version 2
8628 !! input
8629 [[Main Page|[http://example.com/]]]
8630 !! result
8631 <p><a href="/wiki/Main_Page" title="Main Page">[http://example.com/]</a>
8632 </p>
8633 !! end
8634
8635
8636 ###
8637 ### Safety
8638 ###
8639
8640 !! article
8641 Template:Dangerous attribute
8642 !! text
8643 " onmouseover="alert(document.cookie)
8644 !! endarticle
8645
8646 !! article
8647 Template:Dangerous style attribute
8648 !! text
8649 border-size: expression(alert(document.cookie))
8650 !! endarticle
8651
8652 !! article
8653 Template:Div style
8654 !! text
8655 <div style="float: right; {{{1}}}">Magic div</div>
8656 !! endarticle
8657
8658 !! test
8659 Bug 2304: HTML attribute safety (safe template; regression bug 2309)
8660 !! input
8661 <div title="{{test}}"></div>
8662 !! result
8663 <div title="This is a test template"></div>
8664
8665 !! end
8666
8667 !! test
8668 Bug 2304: HTML attribute safety (dangerous template; 2309)
8669 !! input
8670 <div title="{{dangerous attribute}}"></div>
8671 !! result
8672 <div title=""></div>
8673
8674 !! end
8675
8676 !! test
8677 Bug 2304: HTML attribute safety (dangerous style template; 2309)
8678 !! input
8679 <div style="{{dangerous style attribute}}"></div>
8680 !! result
8681 <div style="/* insecure input */"></div>
8682
8683 !! end
8684
8685 !! test
8686 Bug 2304: HTML attribute safety (safe parameter; 2309)
8687 !! input
8688 {{div style|width: 200px}}
8689 !! result
8690 <div style="float: right; width: 200px">Magic div</div>
8691
8692 !! end
8693
8694 !! test
8695 Bug 2304: HTML attribute safety (unsafe parameter; 2309)
8696 !! input
8697 {{div style|width: expression(alert(document.cookie))}}
8698 !! result
8699 <div style="/* insecure input */">Magic div</div>
8700
8701 !! end
8702
8703 !! test
8704 Bug 2304: HTML attribute safety (unsafe breakout parameter; 2309)
8705 !! input
8706 {{div style|"><script>alert(document.cookie)</script>}}
8707 !! result
8708 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
8709
8710 !! end
8711
8712 !! test
8713 Bug 2304: HTML attribute safety (unsafe breakout parameter 2; 2309)
8714 !! input
8715 {{div style|" ><script>alert(document.cookie)</script>}}
8716 !! result
8717 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
8718
8719 !! end
8720
8721 !! test
8722 Bug 2304: HTML attribute safety (link)
8723 !! input
8724 <div title="[[Main Page]]"></div>
8725 !! result
8726 <div title="&#91;&#91;Main Page]]"></div>
8727
8728 !! end
8729
8730 !! test
8731 Bug 2304: HTML attribute safety (italics)
8732 !! input
8733 <div title="''foobar''"></div>
8734 !! result
8735 <div title="&#39;&#39;foobar&#39;&#39;"></div>
8736
8737 !! end
8738
8739 !! test
8740 Bug 2304: HTML attribute safety (bold)
8741 !! input
8742 <div title="'''foobar'''"></div>
8743 !! result
8744 <div title="&#39;&#39;&#39;foobar&#39;&#39;&#39;"></div>
8745
8746 !! end
8747
8748
8749 !! test
8750 Bug 2304: HTML attribute safety (ISBN)
8751 !! input
8752 <div title="ISBN 1234567890"></div>
8753 !! result
8754 <div title="&#73;SBN 1234567890"></div>
8755
8756 !! end
8757
8758 !! test
8759 Bug 2304: HTML attribute safety (RFC)
8760 !! input
8761 <div title="RFC 1234"></div>
8762 !! result
8763 <div title="&#82;FC 1234"></div>
8764
8765 !! end
8766
8767 !! test
8768 Bug 2304: HTML attribute safety (PMID)
8769 !! input
8770 <div title="PMID 1234567890"></div>
8771 !! result
8772 <div title="&#80;MID 1234567890"></div>
8773
8774 !! end
8775
8776 !! test
8777 Bug 2304: HTML attribute safety (web link)
8778 !! input
8779 <div title="http://example.com/"></div>
8780 !! result
8781 <div title="http&#58;//example.com/"></div>
8782
8783 !! end
8784
8785 !! test
8786 Bug 2304: HTML attribute safety (named web link)
8787 !! input
8788 <div title="[http://example.com/ link]"></div>
8789 !! result
8790 <div title="&#91;http&#58;//example.com/ link]"></div>
8791
8792 !! end
8793
8794 !! test
8795 Bug 3244: HTML attribute safety (extension; safe)
8796 !! input
8797 <div style="<nowiki>background:blue</nowiki>"></div>
8798 !! result
8799 <div style="background:blue"></div>
8800
8801 !! end
8802
8803 !! test
8804 Bug 3244: HTML attribute safety (extension; unsafe)
8805 !! input
8806 <div style="<nowiki>border-left:expression(alert(document.cookie))</nowiki>"></div>
8807 !! result
8808 <div style="/* insecure input */"></div>
8809
8810 !! end
8811
8812 # More MSIE fun discovered by Tom Gilder
8813
8814 !! test
8815 MSIE CSS safety test: spurious slash
8816 !! input
8817 <div style="background-image:u\rl(javascript:alert('boo'))">evil</div>
8818 !! result
8819 <div style="/* insecure input */">evil</div>
8820
8821 !! end
8822
8823 !! test
8824 MSIE CSS safety test: hex code
8825 !! input
8826 <div style="background-image:u\72l(javascript:alert('boo'))">evil</div>
8827 !! result
8828 <div style="/* insecure input */">evil</div>
8829
8830 !! end
8831
8832 !! test
8833 MSIE CSS safety test: comment in url
8834 !! input
8835 <div style="background-image:u/**/rl(javascript:alert('boo'))">evil</div>
8836 !! result
8837 <div style="background-image:u rl(javascript:alert(&#39;boo&#39;))">evil</div>
8838
8839 !! end
8840
8841 !! test
8842 MSIE CSS safety test: comment in expression
8843 !! input
8844 <div style="background-image:expres/**/sion(alert('boo4'))">evil4</div>
8845 !! result
8846 <div style="background-image:expres sion(alert(&#39;boo4&#39;))">evil4</div>
8847
8848 !! end
8849
8850
8851 !! test
8852 Table attribute legitimate extension
8853 !! input
8854 {|
8855 !+ style="<nowiki>color:blue</nowiki>"| status
8856 |}
8857 !! result
8858 <table>
8859 <tr>
8860 <th style="color:blue"> status
8861 </th></tr></table>
8862
8863 !!end
8864
8865 !! test
8866 Table attribute safety
8867 !! input
8868 {|
8869 !+ style="<nowiki>border-width:expression(0+alert(document.cookie))</nowiki>"| status
8870 |}
8871 !! result
8872 <table>
8873 <tr>
8874 <th style="/* insecure input */"> status
8875 </th></tr></table>
8876
8877 !! end
8878
8879 !! test
8880 CSS line continuation 1
8881 !! input
8882 <div style="background-image: u\&#10;rl(test.jpg);"></div>
8883 !! result
8884 <div style="/* insecure input */"></div>
8885
8886 !! end
8887
8888 !! test
8889 CSS line continuation 2
8890 !! input
8891 <div style="background-image: u\&#13;rl(test.jpg); "></div>
8892 !! result
8893 <div style="/* insecure input */"></div>
8894
8895 !! end
8896
8897 !! article
8898 Template:Identity
8899 !! text
8900 {{{1}}}
8901 !! endarticle
8902
8903 !! test
8904 Expansion of multi-line templates in attribute values (bug 6255)
8905 !! input
8906 <div style="background: {{identity|#00FF00}}">-</div>
8907 !! result
8908 <div style="background: #00FF00">-</div>
8909
8910 !! end
8911
8912
8913 !! test
8914 Expansion of multi-line templates in attribute values (bug 6255 sanity check)
8915 !! input
8916 <div style="background:
8917 #00FF00">-</div>
8918 !! result
8919 <div style="background: #00FF00">-</div>
8920
8921 !! end
8922
8923 !! test
8924 Expansion of multi-line templates in attribute values (bug 6255 sanity check 2)
8925 !! input
8926 <div style="background: &#10;#00FF00">-</div>
8927 !! result
8928 <div style="background: &#10;#00FF00">-</div>
8929
8930 !! end
8931
8932 ###
8933 ### Parser hooks (see maintenance/parserTestsParserHook.php for the <tag> extension)
8934 ###
8935 !! test
8936 Parser hook: empty input
8937 !! input
8938 <tag></tag>
8939 !! result
8940 <pre>
8941 ''
8942 array (
8943 )
8944 </pre>
8945
8946 !! end
8947
8948 !! test
8949 Parser hook: empty input using terminated empty elements
8950 !! input
8951 <tag/>
8952 !! result
8953 <pre>
8954 NULL
8955 array (
8956 )
8957 </pre>
8958
8959 !! end
8960
8961 !! test
8962 Parser hook: empty input using terminated empty elements (space before)
8963 !! input
8964 <tag />
8965 !! result
8966 <pre>
8967 NULL
8968 array (
8969 )
8970 </pre>
8971
8972 !! end
8973
8974 !! test
8975 Parser hook: basic input
8976 !! input
8977 <tag>input</tag>
8978 !! result
8979 <pre>
8980 'input'
8981 array (
8982 )
8983 </pre>
8984
8985 !! end
8986
8987
8988 !! test
8989 Parser hook: case insensitive
8990 !! input
8991 <TAG>input</TAG>
8992 !! result
8993 <pre>
8994 'input'
8995 array (
8996 )
8997 </pre>
8998
8999 !! end
9000
9001
9002 !! test
9003 Parser hook: case insensitive, redux
9004 !! input
9005 <TaG>input</TAg>
9006 !! result
9007 <pre>
9008 'input'
9009 array (
9010 )
9011 </pre>
9012
9013 !! end
9014
9015 !! test
9016 Parser hook: nested tags
9017 !! options
9018 noxml
9019 !! input
9020 <tag><tag></tag></tag>
9021 !! result
9022 <pre>
9023 '<tag>'
9024 array (
9025 )
9026 </pre>&lt;/tag&gt;
9027
9028 !! end
9029
9030 !! test
9031 Parser hook: basic arguments
9032 !! input
9033 <tag width=200 height = "100" depth = '50' square></tag>
9034 !! result
9035 <pre>
9036 ''
9037 array (
9038 'width' => '200',
9039 'height' => '100',
9040 'depth' => '50',
9041 'square' => 'square',
9042 )
9043 </pre>
9044
9045 !! end
9046
9047 !! test
9048 Parser hook: argument containing a forward slash (bug 5344)
9049 !! input
9050 <tag filename='/tmp/bla'></tag>
9051 !! result
9052 <pre>
9053 ''
9054 array (
9055 'filename' => '/tmp/bla',
9056 )
9057 </pre>
9058
9059 !! end
9060
9061 !! test
9062 Parser hook: empty input using terminated empty elements (bug 2374)
9063 !! input
9064 <tag foo=bar/>text
9065 !! result
9066 <pre>
9067 NULL
9068 array (
9069 'foo' => 'bar',
9070 )
9071 </pre>text
9072
9073 !! end
9074
9075 # </tag> should be output literally since there is no matching tag that begins it
9076 !! test
9077 Parser hook: basic arguments using terminated empty elements (bug 2374)
9078 !! input
9079 <tag width=200 height = "100" depth = '50' square/>
9080 other stuff
9081 </tag>
9082 !! result
9083 <pre>
9084 NULL
9085 array (
9086 'width' => '200',
9087 'height' => '100',
9088 'depth' => '50',
9089 'square' => 'square',
9090 )
9091 </pre>
9092 <p>other stuff
9093 &lt;/tag&gt;
9094 </p>
9095 !! end
9096
9097 ###
9098 ### (see maintenance/parserTestsStaticParserHook.php for the <statictag> extension)
9099 ###
9100
9101 !! test
9102 Parser hook: static parser hook not inside a comment
9103 !! input
9104 <statictag>hello, world</statictag>
9105 <statictag action=flush/>
9106 !! result
9107 <p>hello, world
9108 </p>
9109 !! end
9110
9111
9112 !! test
9113 Parser hook: static parser hook inside a comment
9114 !! input
9115 <!-- <statictag>hello, world</statictag> -->
9116 <statictag action=flush/>
9117 !! result
9118 <p><br />
9119 </p>
9120 !! end
9121
9122 # Nested template calls; this case was broken by Parser.php rev 1.506,
9123 # since reverted.
9124
9125 !! article
9126 Template:One-parameter
9127 !! text
9128 (My parameter is: {{{1}}})
9129 !! endarticle
9130
9131 !! article
9132 Template:Map-one-parameter
9133 !! text
9134 {{{{{1}}}|{{{2}}}}}
9135 !! endarticle
9136
9137 !! test
9138 Nested template calls
9139 !! input
9140 {{Map-one-parameter|One-parameter|param}}
9141 !! result
9142 <p>(My parameter is: param)
9143 </p>
9144 !! end
9145
9146
9147 ###
9148 ### Sanitizer
9149 ###
9150 !! test
9151 Sanitizer: Closing of open tags
9152 !! input
9153 <s></s><table></table>
9154 !! result
9155 <s></s><table></table>
9156
9157 !! end
9158
9159 !! test
9160 Sanitizer: Closing of open but not closed tags
9161 !! input
9162 <s>foo
9163 !! result
9164 <p><s>foo</s>
9165 </p>
9166 !! end
9167
9168 !! test
9169 Sanitizer: Closing of closed but not open tags
9170 !! input
9171 </s>
9172 !! result
9173 <p>&lt;/s&gt;
9174 </p>
9175 !! end
9176
9177 !! test
9178 Sanitizer: Closing of closed but not open table tags
9179 !! input
9180 Table not started</td></tr></table>
9181 !! result
9182 <p>Table not started&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
9183 </p>
9184 !! end
9185
9186 !! test
9187 Sanitizer: Escaping of spaces, multibyte characters, colons & other stuff in id=""
9188 !! input
9189 <span id="æ: v">byte</span>[[#æ: v|backlink]]
9190 !! result
9191 <p><span id=".C3.A6:_v">byte</span><a href="#.C3.A6:_v">backlink</a>
9192 </p>
9193 !! end
9194
9195 !! test
9196 Sanitizer: Validating the contents of the id attribute (bug 4515)
9197 !! options
9198 disabled
9199 !! input
9200 <br id=9 />
9201 !! result
9202 Something, but definitely not <br id="9" />...
9203 !! end
9204
9205 !! test
9206 Sanitizer: Validating id attribute uniqueness (bug 4515, bug 6301)
9207 !! options
9208 disabled
9209 !! input
9210 <br id="foo" /><br id="foo" />
9211 !! result
9212 Something need to be done. foo-2 ?
9213 !! end
9214
9215 !! test
9216 Sanitizer: Validating that <meta> and <link> work, but only for Microdata
9217 !! input
9218 <div itemscope>
9219 <meta itemprop="hello" content="world">
9220 <meta http-equiv="refresh" content="5">
9221 <meta itemprop="hello" http-equiv="refresh" content="5">
9222 <link itemprop="hello" href="{{SERVER}}">
9223 <link rel="stylesheet" href="{{SERVER}}">
9224 <link rel="stylesheet" itemprop="hello" href="{{SERVER}}">
9225 </div>
9226 !! result
9227 <div itemscope="itemscope">
9228 <p> <meta itemprop="hello" content="world" />
9229 &lt;meta http-equiv="refresh" content="5"&gt;
9230 <meta itemprop="hello" content="5" />
9231 </p>
9232 <link itemprop="hello" href="http&#58;//example.org" />
9233 &lt;link rel="stylesheet" href="<a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>"&gt;
9234 <link itemprop="hello" href="http&#58;//example.org" />
9235 </div>
9236
9237 !! end
9238
9239 !! test
9240 Language converter: output gets cut off unexpectedly (bug 5757)
9241 !! options
9242 language=zh
9243 !! input
9244 this bit is safe: }-
9245
9246 but if we add a conversion instance: -{zh-cn:xxx;zh-tw:yyy}-
9247
9248 then we get cut off here: }-
9249
9250 all additional text is vanished
9251 !! result
9252 <p>this bit is safe: }-
9253 </p><p>but if we add a conversion instance: xxx
9254 </p><p>then we get cut off here: }-
9255 </p><p>all additional text is vanished
9256 </p>
9257 !! end
9258
9259 !! test
9260 Self closed html pairs (bug 5487)
9261 !! options
9262 !! input
9263 <center><font id="bug" />Centered text</center>
9264 <div><font id="bug2" />In div text</div>
9265 !! result
9266 <center>&lt;font id="bug" /&gt;Centered text</center>
9267 <div>&lt;font id="bug2" /&gt;In div text</div>
9268
9269 !! end
9270
9271 #
9272 #
9273 #
9274
9275 !! test
9276 Punctuation: nbsp before exclamation
9277 !! input
9278 C'est grave !
9279 !! result
9280 <p>C'est grave&#160;!
9281 </p>
9282 !! end
9283
9284 !! test
9285 Punctuation: CSS !important (bug 11874)
9286 !! input
9287 <div style="width:50% !important">important</div>
9288 !! result
9289 <div style="width:50% !important">important</div>
9290
9291 !!end
9292
9293 !! test
9294 Punctuation: CSS ! important (bug 11874; with space after)
9295 !! input
9296 <div style="width:50% ! important">important</div>
9297 !! result
9298 <div style="width:50% ! important">important</div>
9299
9300 !!end
9301
9302
9303 !! test
9304 HTML bullet list, closed tags (bug 5497)
9305 !! input
9306 <ul>
9307 <li>One</li>
9308 <li>Two</li>
9309 </ul>
9310 !! result
9311 <ul>
9312 <li>One</li>
9313 <li>Two</li>
9314 </ul>
9315
9316 !! end
9317
9318 !! test
9319 HTML bullet list, unclosed tags (bug 5497)
9320 !! options
9321 disabled
9322 !! input
9323 <ul>
9324 <li>One
9325 <li>Two
9326 </ul>
9327 !! result
9328 <ul>
9329 <li>One
9330 </li><li>Two
9331 </li></ul>
9332
9333 !! end
9334
9335 !! test
9336 HTML ordered list, closed tags (bug 5497)
9337 !! input
9338 <ol>
9339 <li>One</li>
9340 <li>Two</li>
9341 </ol>
9342 !! result
9343 <ol>
9344 <li>One</li>
9345 <li>Two</li>
9346 </ol>
9347
9348 !! end
9349
9350 !! test
9351 HTML ordered list, unclosed tags (bug 5497)
9352 !! options
9353 disabled
9354 !! input
9355 <ol>
9356 <li>One
9357 <li>Two
9358 </ol>
9359 !! result
9360 <ol>
9361 <li>One
9362 </li><li>Two
9363 </li></ol>
9364
9365 !! end
9366
9367 !! test
9368 HTML nested bullet list, closed tags (bug 5497)
9369 !! input
9370 <ul>
9371 <li>One</li>
9372 <li>Two:
9373 <ul>
9374 <li>Sub-one</li>
9375 <li>Sub-two</li>
9376 </ul>
9377 </li>
9378 </ul>
9379 !! result
9380 <ul>
9381 <li>One</li>
9382 <li>Two:
9383 <ul>
9384 <li>Sub-one</li>
9385 <li>Sub-two</li>
9386 </ul>
9387 </li>
9388 </ul>
9389
9390 !! end
9391
9392 !! test
9393 HTML nested bullet list, open tags (bug 5497)
9394 !! options
9395 disabled
9396 !! input
9397 <ul>
9398 <li>One
9399 <li>Two:
9400 <ul>
9401 <li>Sub-one
9402 <li>Sub-two
9403 </ul>
9404 </ul>
9405 !! result
9406 <ul>
9407 <li>One
9408 </li><li>Two:
9409 <ul>
9410 <li>Sub-one
9411 </li><li>Sub-two
9412 </li></ul>
9413 </li></ul>
9414
9415 !! end
9416
9417 !! test
9418 HTML nested ordered list, closed tags (bug 5497)
9419 !! input
9420 <ol>
9421 <li>One</li>
9422 <li>Two:
9423 <ol>
9424 <li>Sub-one</li>
9425 <li>Sub-two</li>
9426 </ol>
9427 </li>
9428 </ol>
9429 !! result
9430 <ol>
9431 <li>One</li>
9432 <li>Two:
9433 <ol>
9434 <li>Sub-one</li>
9435 <li>Sub-two</li>
9436 </ol>
9437 </li>
9438 </ol>
9439
9440 !! end
9441
9442 !! test
9443 HTML nested ordered list, open tags (bug 5497)
9444 !! options
9445 disabled
9446 !! input
9447 <ol>
9448 <li>One
9449 <li>Two:
9450 <ol>
9451 <li>Sub-one
9452 <li>Sub-two
9453 </ol>
9454 </ol>
9455 !! result
9456 <ol>
9457 <li>One
9458 </li><li>Two:
9459 <ol>
9460 <li>Sub-one
9461 </li><li>Sub-two
9462 </li></ol>
9463 </li></ol>
9464
9465 !! end
9466
9467 !! test
9468 HTML ordered list item with parameters oddity
9469 !! input
9470 <ol><li id="fragment">One</li></ol>
9471 !! result
9472 <ol><li id="fragment">One</li></ol>
9473
9474 !! end
9475
9476 !!test
9477 bug 5918: autonumbering
9478 !! input
9479 [http://first/] [http://second] [ftp://ftp]
9480
9481 ftp://inlineftp
9482
9483 [mailto:enclosed@mail.tld With target]
9484
9485 [mailto:enclosed@mail.tld]
9486
9487 mailto:inline@mail.tld
9488 !! result
9489 <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>
9490 </p><p><a rel="nofollow" class="external free" href="ftp://inlineftp">ftp://inlineftp</a>
9491 </p><p><a rel="nofollow" class="external text" href="mailto:enclosed@mail.tld">With target</a>
9492 </p><p><a rel="nofollow" class="external autonumber" href="mailto:enclosed@mail.tld">[4]</a>
9493 </p><p><a rel="nofollow" class="external free" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a>
9494 </p>
9495 !! end
9496
9497
9498 #
9499 # Security and HTML correctness
9500 # From Nick Jenkins' fuzz testing
9501 #
9502
9503 !! test
9504 Fuzz testing: Parser13
9505 !! input
9506 {|
9507 | http://a|
9508 !! result
9509 <table>
9510 <tr>
9511 <td>
9512 </td>
9513 </tr>
9514 </table>
9515
9516 !! end
9517
9518 !! test
9519 Fuzz testing: Parser14
9520 !! input
9521 == onmouseover= ==
9522 http://__TOC__
9523 !! result
9524 <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>
9525 http://<table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
9526 <ul>
9527 <li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
9528 </ul>
9529 </td></tr></table>
9530
9531 !! end
9532
9533 !! test
9534 Fuzz testing: Parser14-table
9535 !! input
9536 ==a==
9537 {| STYLE=__TOC__
9538 !! result
9539 <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>
9540 <table style="&#95;_TOC&#95;_">
9541 <tr><td></td></tr>
9542 </table>
9543
9544 !! end
9545
9546 # Known to produce bogus xml (extra </td>)
9547 !! test
9548 Fuzz testing: Parser16
9549 !! options
9550 noxml
9551 !! input
9552 {|
9553 !https://||||||
9554 !! result
9555 <table>
9556 <tr>
9557 <th>https://</th>
9558 <th></th>
9559 <th></th>
9560 <th>
9561 </td>
9562 </tr>
9563 </table>
9564
9565 !! end
9566
9567 !! test
9568 Fuzz testing: Parser21
9569 !! input
9570 {|
9571 ! irc://{{ftp://a" onmouseover="alert('hello world');"
9572 |
9573 !! result
9574 <table>
9575 <tr>
9576 <th> <a rel="nofollow" class="external free" href="irc://{{ftp://a">irc://{{ftp://a</a>" onmouseover="alert('hello world');"
9577 </th>
9578 <td>
9579 </td>
9580 </tr>
9581 </table>
9582
9583 !! end
9584
9585 !! test
9586 Fuzz testing: Parser22
9587 !! input
9588 http://===r:::https://b
9589
9590 {|
9591 !!result
9592 <p><a rel="nofollow" class="external free" href="http://===r:::https://b">http://===r:::https://b</a>
9593 </p>
9594 <table>
9595 <tr><td></td></tr>
9596 </table>
9597
9598 !! end
9599
9600 # Known to produce bad XML for now
9601 !! test
9602 Fuzz testing: Parser24
9603 !! options
9604 noxml
9605 !! input
9606 {|
9607 {{{|
9608 <u CLASS=
9609 | {{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx--><noinclude>}}}} >
9610 <br style="onmouseover='alert(document.cookie);' " />
9611
9612 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
9613 |
9614 !! result
9615 <table>
9616 {{{|
9617 <u class="&#124;">}}}} &gt;
9618 <br style="onmouseover=&#39;alert(document.cookie);&#39;" />
9619
9620 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
9621 <tr>
9622 <td></u>
9623 </td>
9624 </tr>
9625 </table>
9626
9627 !! end
9628
9629 # Note: the current result listed for this is not what the original one was,
9630 # but the original bug was JavaScript injection, which is fixed in any case.
9631 # It's not clear that the original result listed was any more correct than the
9632 # current one. Original result:
9633 # <p>{{{|
9634 # </p>
9635 # <li class="&#124;&#124;">
9636 # }}}blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
9637 !!test
9638 Fuzz testing: Parser25 (bug 6055)
9639 !! input
9640 {{{
9641 |
9642 <LI CLASS=||
9643 >
9644 }}}blah" onmouseover="alert('hello world');" align="left"'''MOVE MOUSE CURSOR OVER HERE
9645 !! result
9646 <p>&lt;LI CLASS=blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
9647 </p>
9648 !! end
9649
9650 !!test
9651 Fuzz testing: URL adjacent extension (with space, clean)
9652 !! options
9653 !! input
9654 http://example.com <nowiki>junk</nowiki>
9655 !! result
9656 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a> junk
9657 </p>
9658 !!end
9659
9660 !!test
9661 Fuzz testing: URL adjacent extension (no space, dirty; nowiki)
9662 !! options
9663 !! input
9664 http://example.com<nowiki>junk</nowiki>
9665 !! result
9666 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>junk
9667 </p>
9668 !!end
9669
9670 !!test
9671 Fuzz testing: URL adjacent extension (no space, dirty; pre)
9672 !! options
9673 !! input
9674 http://example.com<pre>junk</pre>
9675 !! result
9676 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a><pre>junk</pre>
9677
9678 !!end
9679
9680 !!test
9681 Fuzz testing: image with bogus manual thumbnail
9682 !!input
9683 [[Image:foobar.jpg|thumbnail= ]]
9684 !!result
9685 <div class="thumb tright"><div class="thumbinner" style="width:182px;">Error creating thumbnail: <div class="thumbcaption"></div></div></div>
9686
9687 !!end
9688
9689 !! test
9690 Fuzz testing: encoded newline in generated HTML replacements (bug 6577)
9691 !! input
9692 <pre dir="&#10;"></pre>
9693 !! result
9694 <pre dir="&#10;"></pre>
9695
9696 !! end
9697
9698 !! test
9699 Parsing optional HTML elements (Bug 6171)
9700 !! options
9701 !! input
9702 <table>
9703 <tr>
9704 <td> Some tabular data</td>
9705 <td> More tabular data ...
9706 <td> And yet som tabular data</td>
9707 </tr>
9708 </table>
9709 !! result
9710 <table>
9711 <tr>
9712 <td> Some tabular data</td>
9713 <td> More tabular data ...
9714 </td><td> And yet som tabular data</td>
9715 </tr>
9716 </table>
9717
9718 !! end
9719
9720 !! test
9721 Correct handling of <td>, <tr> (Bug 6171)
9722 !! options
9723 !! input
9724 <table>
9725 <tr>
9726 <td> Some tabular data</td>
9727 <td> More tabular data ...</td>
9728 <td> And yet som tabular data</td>
9729 </tr>
9730 </table>
9731 !! result
9732 <table>
9733 <tr>
9734 <td> Some tabular data</td>
9735 <td> More tabular data ...</td>
9736 <td> And yet som tabular data</td>
9737 </tr>
9738 </table>
9739
9740 !! end
9741
9742
9743 !! test
9744 Parsing crashing regression (fr:JavaScript)
9745 !! input
9746 </body></x>
9747 !! result
9748 <p>&lt;/body&gt;&lt;/x&gt;
9749 </p>
9750 !! end
9751
9752 !! test
9753 Inline wiki vs wiki block nesting
9754 !! input
9755 '''Bold paragraph
9756
9757 New wiki paragraph
9758 !! result
9759 <p><b>Bold paragraph</b>
9760 </p><p>New wiki paragraph
9761 </p>
9762 !! end
9763
9764 !! test
9765 Inline HTML vs wiki block nesting
9766 !! options
9767 disabled
9768 !! input
9769 <b>Bold paragraph
9770
9771 New wiki paragraph
9772 !! result
9773 <p><b>Bold paragraph</b>
9774 </p><p>New wiki paragraph
9775 </p>
9776 !! end
9777
9778 # Original result was this:
9779 # <p><b>bold</b><b>bold<i>bolditalics</i></b>
9780 # </p>
9781 # While that might be marginally more intuitive, maybe, the six-apostrophe
9782 # construct is clearly pathological and the result stated here (which is what
9783 # the parser actually does) is about as reasonable as anything.
9784 !!test
9785 Mixing markup for italics and bold
9786 !! options
9787 !! input
9788 '''bold''''''bold''bolditalics'''''
9789 !! result
9790 <p>'<i>bold'</i><b>bold<i>bolditalics</i></b>
9791 </p>
9792 !! end
9793
9794
9795 !! article
9796 Xyzzyx
9797 !! text
9798 Article for special page transclusion test
9799 !! endarticle
9800
9801 !! test
9802 Special page transclusion
9803 !! options
9804 !! input
9805 {{Special:Prefixindex/Xyzzyx}}
9806 !! result
9807 <table id="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
9808
9809 !! end
9810
9811 !! test
9812 Special page transclusion twice (bug 5021)
9813 !! options
9814 !! input
9815 {{Special:Prefixindex/Xyzzyx}}
9816 {{Special:Prefixindex/Xyzzyx}}
9817 !! result
9818 <table id="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
9819 <table id="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
9820
9821 !! end
9822
9823 !! test
9824 Transclusion of default MediaWiki message
9825 !! input
9826 {{MediaWiki:Mainpage}}
9827 !!result
9828 <p>Main Page
9829 </p>
9830 !! end
9831
9832 !! test
9833 Transclusion of nonexistent MediaWiki message
9834 !! input
9835 {{MediaWiki:Mainpagexxx}}
9836 !!result
9837 <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>
9838 </p>
9839 !! end
9840
9841 !! test
9842 Transclusion of MediaWiki message with underscore
9843 !! input
9844 {{MediaWiki:history_short}}
9845 !! result
9846 <p>History
9847 </p>
9848 !! end
9849
9850 !! test
9851 Transclusion of MediaWiki message with space
9852 !! input
9853 {{MediaWiki:history short}}
9854 !! result
9855 <p>History
9856 </p>
9857 !! end
9858
9859 !! test
9860 Invalid header with following text
9861 !! input
9862 = x = y
9863 !! result
9864 <p>= x = y
9865 </p>
9866 !! end
9867
9868
9869 !! test
9870 Section extraction test (section 0)
9871 !! options
9872 section=0
9873 !! input
9874 start
9875 ==a==
9876 ===aa===
9877 ====aaa====
9878 ==b==
9879 ===ba===
9880 ===bb===
9881 ====bba====
9882 ===bc===
9883 ==c==
9884 ===ca===
9885 !! result
9886 start
9887 !! end
9888
9889 !! test
9890 Section extraction test (section 1)
9891 !! options
9892 section=1
9893 !! input
9894 start
9895 ==a==
9896 ===aa===
9897 ====aaa====
9898 ==b==
9899 ===ba===
9900 ===bb===
9901 ====bba====
9902 ===bc===
9903 ==c==
9904 ===ca===
9905 !! result
9906 ==a==
9907 ===aa===
9908 ====aaa====
9909 !! end
9910
9911 !! test
9912 Section extraction test (section 2)
9913 !! options
9914 section=2
9915 !! input
9916 start
9917 ==a==
9918 ===aa===
9919 ====aaa====
9920 ==b==
9921 ===ba===
9922 ===bb===
9923 ====bba====
9924 ===bc===
9925 ==c==
9926 ===ca===
9927 !! result
9928 ===aa===
9929 ====aaa====
9930 !! end
9931
9932 !! test
9933 Section extraction test (section 3)
9934 !! options
9935 section=3
9936 !! input
9937 start
9938 ==a==
9939 ===aa===
9940 ====aaa====
9941 ==b==
9942 ===ba===
9943 ===bb===
9944 ====bba====
9945 ===bc===
9946 ==c==
9947 ===ca===
9948 !! result
9949 ====aaa====
9950 !! end
9951
9952 !! test
9953 Section extraction test (section 4)
9954 !! options
9955 section=4
9956 !! input
9957 start
9958 ==a==
9959 ===aa===
9960 ====aaa====
9961 ==b==
9962 ===ba===
9963 ===bb===
9964 ====bba====
9965 ===bc===
9966 ==c==
9967 ===ca===
9968 !! result
9969 ==b==
9970 ===ba===
9971 ===bb===
9972 ====bba====
9973 ===bc===
9974 !! end
9975
9976 !! test
9977 Section extraction test (section 5)
9978 !! options
9979 section=5
9980 !! input
9981 start
9982 ==a==
9983 ===aa===
9984 ====aaa====
9985 ==b==
9986 ===ba===
9987 ===bb===
9988 ====bba====
9989 ===bc===
9990 ==c==
9991 ===ca===
9992 !! result
9993 ===ba===
9994 !! end
9995
9996 !! test
9997 Section extraction test (section 6)
9998 !! options
9999 section=6
10000 !! input
10001 start
10002 ==a==
10003 ===aa===
10004 ====aaa====
10005 ==b==
10006 ===ba===
10007 ===bb===
10008 ====bba====
10009 ===bc===
10010 ==c==
10011 ===ca===
10012 !! result
10013 ===bb===
10014 ====bba====
10015 !! end
10016
10017 !! test
10018 Section extraction test (section 7)
10019 !! options
10020 section=7
10021 !! input
10022 start
10023 ==a==
10024 ===aa===
10025 ====aaa====
10026 ==b==
10027 ===ba===
10028 ===bb===
10029 ====bba====
10030 ===bc===
10031 ==c==
10032 ===ca===
10033 !! result
10034 ====bba====
10035 !! end
10036
10037 !! test
10038 Section extraction test (section 8)
10039 !! options
10040 section=8
10041 !! input
10042 start
10043 ==a==
10044 ===aa===
10045 ====aaa====
10046 ==b==
10047 ===ba===
10048 ===bb===
10049 ====bba====
10050 ===bc===
10051 ==c==
10052 ===ca===
10053 !! result
10054 ===bc===
10055 !! end
10056
10057 !! test
10058 Section extraction test (section 9)
10059 !! options
10060 section=9
10061 !! input
10062 start
10063 ==a==
10064 ===aa===
10065 ====aaa====
10066 ==b==
10067 ===ba===
10068 ===bb===
10069 ====bba====
10070 ===bc===
10071 ==c==
10072 ===ca===
10073 !! result
10074 ==c==
10075 ===ca===
10076 !! end
10077
10078 !! test
10079 Section extraction test (section 10)
10080 !! options
10081 section=10
10082 !! input
10083 start
10084 ==a==
10085 ===aa===
10086 ====aaa====
10087 ==b==
10088 ===ba===
10089 ===bb===
10090 ====bba====
10091 ===bc===
10092 ==c==
10093 ===ca===
10094 !! result
10095 ===ca===
10096 !! end
10097
10098 !! test
10099 Section extraction test (nonexistent section 11)
10100 !! options
10101 section=11
10102 !! input
10103 start
10104 ==a==
10105 ===aa===
10106 ====aaa====
10107 ==b==
10108 ===ba===
10109 ===bb===
10110 ====bba====
10111 ===bc===
10112 ==c==
10113 ===ca===
10114 !! result
10115 !! end
10116
10117 !! test
10118 Section extraction test with bogus heading (section 1)
10119 !! options
10120 section=1
10121 !! input
10122 ==a==
10123 ==bogus== not a legal section
10124 ==b==
10125 !! result
10126 ==a==
10127 ==bogus== not a legal section
10128 !! end
10129
10130 !! test
10131 Section extraction test with bogus heading (section 2)
10132 !! options
10133 section=2
10134 !! input
10135 ==a==
10136 ==bogus== not a legal section
10137 ==b==
10138 !! result
10139 ==b==
10140 !! end
10141
10142 !! test
10143 Section extraction test with comment after heading (section 1)
10144 !! options
10145 section=1
10146 !! input
10147 ==a==
10148 ==b== <!-- -->
10149 ==c==
10150 !! result
10151 ==a==
10152 !! end
10153
10154 !! test
10155 Section extraction test with comment after heading (section 2)
10156 !! options
10157 section=2
10158 !! input
10159 ==a==
10160 ==b== <!-- -->
10161 ==c==
10162 !! result
10163 ==b== <!-- -->
10164 !! end
10165
10166 !! test
10167 Section extraction test with bogus <nowiki> heading (section 1)
10168 !! options
10169 section=1
10170 !! input
10171 ==a==
10172 ==bogus== <nowiki>not a legal section</nowiki>
10173 ==b==
10174 !! result
10175 ==a==
10176 ==bogus== <nowiki>not a legal section</nowiki>
10177 !! end
10178
10179 !! test
10180 Section extraction test with bogus <nowiki> heading (section 2)
10181 !! options
10182 section=2
10183 !! input
10184 ==a==
10185 ==bogus== <nowiki>not a legal section</nowiki>
10186 ==b==
10187 !! result
10188 ==b==
10189 !! end
10190
10191
10192 # Formerly testing for bug 2587, now resolved by the use of unmarked sections
10193 # instead of respecting commented sections
10194 !! test
10195 Section extraction prefixed by comment (section 1)
10196 !! options
10197 section=1
10198 !! input
10199 <!-- -->==sec1==
10200 ==sec2==
10201 !!result
10202 ==sec2==
10203 !!end
10204
10205 !! test
10206 Section extraction prefixed by comment (section 2)
10207 !! options
10208 section=2
10209 !! input
10210 <!-- -->==sec1==
10211 ==sec2==
10212 !!result
10213
10214 !!end
10215
10216
10217 # Formerly testing for bug 2607, now resolved by the use of unmarked sections
10218 # instead of respecting HTML-style headings
10219 !! test
10220 Section extraction, mixed wiki and html (section 1)
10221 !! options
10222 section=1
10223 !! input
10224 <h2>unmarked</h2>
10225 unmarked
10226 ==1==
10227 one
10228 ==2==
10229 two
10230 !! result
10231 ==1==
10232 one
10233 !! end
10234
10235 !! test
10236 Section extraction, mixed wiki and html (section 2)
10237 !! options
10238 section=2
10239 !! input
10240 <h2>unmarked</h2>
10241 unmarked
10242 ==1==
10243 one
10244 ==2==
10245 two
10246 !! result
10247 ==2==
10248 two
10249 !! end
10250
10251
10252 # Formerly testing for bug 3342
10253 !! test
10254 Section extraction, heading surrounded by <noinclude>
10255 !! options
10256 section=1
10257 !! input
10258 <noinclude>==unmarked==</noinclude>
10259 ==marked==
10260 !! result
10261 ==marked==
10262 !!end
10263
10264 # Test behavior of bug 19910
10265 !! test
10266 Sectiion with all-equals
10267 !! options
10268 section=2
10269 !! input
10270 ===
10271 The line above must have a trailing space
10272 === <!--
10273 --> <!-- -->
10274 But just in case it doesn't...
10275 !! result
10276 === <!--
10277 --> <!-- -->
10278 But just in case it doesn't...
10279 !! end
10280
10281 !! test
10282 Section replacement test (section 0)
10283 !! options
10284 replace=0,"xxx"
10285 !! input
10286 start
10287 ==a==
10288 ===aa===
10289 ====aaa====
10290 ==b==
10291 ===ba===
10292 ===bb===
10293 ====bba====
10294 ===bc===
10295 ==c==
10296 ===ca===
10297 !! result
10298 xxx
10299
10300 ==a==
10301 ===aa===
10302 ====aaa====
10303 ==b==
10304 ===ba===
10305 ===bb===
10306 ====bba====
10307 ===bc===
10308 ==c==
10309 ===ca===
10310 !! end
10311
10312 !! test
10313 Section replacement test (section 1)
10314 !! options
10315 replace=1,"xxx"
10316 !! input
10317 start
10318 ==a==
10319 ===aa===
10320 ====aaa====
10321 ==b==
10322 ===ba===
10323 ===bb===
10324 ====bba====
10325 ===bc===
10326 ==c==
10327 ===ca===
10328 !! result
10329 start
10330 xxx
10331
10332 ==b==
10333 ===ba===
10334 ===bb===
10335 ====bba====
10336 ===bc===
10337 ==c==
10338 ===ca===
10339 !! end
10340
10341 !! test
10342 Section replacement test (section 2)
10343 !! options
10344 replace=2,"xxx"
10345 !! input
10346 start
10347 ==a==
10348 ===aa===
10349 ====aaa====
10350 ==b==
10351 ===ba===
10352 ===bb===
10353 ====bba====
10354 ===bc===
10355 ==c==
10356 ===ca===
10357 !! result
10358 start
10359 ==a==
10360 xxx
10361
10362 ==b==
10363 ===ba===
10364 ===bb===
10365 ====bba====
10366 ===bc===
10367 ==c==
10368 ===ca===
10369 !! end
10370
10371 !! test
10372 Section replacement test (section 3)
10373 !! options
10374 replace=3,"xxx"
10375 !! input
10376 start
10377 ==a==
10378 ===aa===
10379 ====aaa====
10380 ==b==
10381 ===ba===
10382 ===bb===
10383 ====bba====
10384 ===bc===
10385 ==c==
10386 ===ca===
10387 !! result
10388 start
10389 ==a==
10390 ===aa===
10391 xxx
10392
10393 ==b==
10394 ===ba===
10395 ===bb===
10396 ====bba====
10397 ===bc===
10398 ==c==
10399 ===ca===
10400 !! end
10401
10402 !! test
10403 Section replacement test (section 4)
10404 !! options
10405 replace=4,"xxx"
10406 !! input
10407 start
10408 ==a==
10409 ===aa===
10410 ====aaa====
10411 ==b==
10412 ===ba===
10413 ===bb===
10414 ====bba====
10415 ===bc===
10416 ==c==
10417 ===ca===
10418 !! result
10419 start
10420 ==a==
10421 ===aa===
10422 ====aaa====
10423 xxx
10424
10425 ==c==
10426 ===ca===
10427 !! end
10428
10429 !! test
10430 Section replacement test (section 5)
10431 !! options
10432 replace=5,"xxx"
10433 !! input
10434 start
10435 ==a==
10436 ===aa===
10437 ====aaa====
10438 ==b==
10439 ===ba===
10440 ===bb===
10441 ====bba====
10442 ===bc===
10443 ==c==
10444 ===ca===
10445 !! result
10446 start
10447 ==a==
10448 ===aa===
10449 ====aaa====
10450 ==b==
10451 xxx
10452
10453 ===bb===
10454 ====bba====
10455 ===bc===
10456 ==c==
10457 ===ca===
10458 !! end
10459
10460 !! test
10461 Section replacement test (section 6)
10462 !! options
10463 replace=6,"xxx"
10464 !! input
10465 start
10466 ==a==
10467 ===aa===
10468 ====aaa====
10469 ==b==
10470 ===ba===
10471 ===bb===
10472 ====bba====
10473 ===bc===
10474 ==c==
10475 ===ca===
10476 !! result
10477 start
10478 ==a==
10479 ===aa===
10480 ====aaa====
10481 ==b==
10482 ===ba===
10483 xxx
10484
10485 ===bc===
10486 ==c==
10487 ===ca===
10488 !! end
10489
10490 !! test
10491 Section replacement test (section 7)
10492 !! options
10493 replace=7,"xxx"
10494 !! input
10495 start
10496 ==a==
10497 ===aa===
10498 ====aaa====
10499 ==b==
10500 ===ba===
10501 ===bb===
10502 ====bba====
10503 ===bc===
10504 ==c==
10505 ===ca===
10506 !! result
10507 start
10508 ==a==
10509 ===aa===
10510 ====aaa====
10511 ==b==
10512 ===ba===
10513 ===bb===
10514 xxx
10515
10516 ===bc===
10517 ==c==
10518 ===ca===
10519 !! end
10520
10521 !! test
10522 Section replacement test (section 8)
10523 !! options
10524 replace=8,"xxx"
10525 !! input
10526 start
10527 ==a==
10528 ===aa===
10529 ====aaa====
10530 ==b==
10531 ===ba===
10532 ===bb===
10533 ====bba====
10534 ===bc===
10535 ==c==
10536 ===ca===
10537 !! result
10538 start
10539 ==a==
10540 ===aa===
10541 ====aaa====
10542 ==b==
10543 ===ba===
10544 ===bb===
10545 ====bba====
10546 xxx
10547
10548 ==c==
10549 ===ca===
10550 !!end
10551
10552 !! test
10553 Section replacement test (section 9)
10554 !! options
10555 replace=9,"xxx"
10556 !! input
10557 start
10558 ==a==
10559 ===aa===
10560 ====aaa====
10561 ==b==
10562 ===ba===
10563 ===bb===
10564 ====bba====
10565 ===bc===
10566 ==c==
10567 ===ca===
10568 !! result
10569 start
10570 ==a==
10571 ===aa===
10572 ====aaa====
10573 ==b==
10574 ===ba===
10575 ===bb===
10576 ====bba====
10577 ===bc===
10578 xxx
10579 !! end
10580
10581 !! test
10582 Section replacement test (section 10)
10583 !! options
10584 replace=10,"xxx"
10585 !! input
10586 start
10587 ==a==
10588 ===aa===
10589 ====aaa====
10590 ==b==
10591 ===ba===
10592 ===bb===
10593 ====bba====
10594 ===bc===
10595 ==c==
10596 ===ca===
10597 !! result
10598 start
10599 ==a==
10600 ===aa===
10601 ====aaa====
10602 ==b==
10603 ===ba===
10604 ===bb===
10605 ====bba====
10606 ===bc===
10607 ==c==
10608 xxx
10609 !! end
10610
10611 !! test
10612 Section replacement test with initial whitespace (bug 13728)
10613 !! options
10614 replace=2,"xxx"
10615 !! input
10616 Preformatted initial line
10617 ==a==
10618 ===a===
10619 !! result
10620 Preformatted initial line
10621 ==a==
10622 xxx
10623 !! end
10624
10625
10626 !! test
10627 Section extraction, heading followed by pre with 20 spaces (bug 6398)
10628 !! options
10629 section=1
10630 !! input
10631 ==a==
10632 a
10633 !! result
10634 ==a==
10635 a
10636 !! end
10637
10638 !! test
10639 Section extraction, heading followed by pre with 19 spaces (bug 6398 sanity check)
10640 !! options
10641 section=1
10642 !! input
10643 ==a==
10644 a
10645 !! result
10646 ==a==
10647 a
10648 !! end
10649
10650
10651 !! test
10652 Section extraction, <pre> around bogus header (bug 10309)
10653 !! options
10654 noxml section=2
10655 !! input
10656 == Section One ==
10657 <pre>
10658 =======
10659 </pre>
10660
10661 == Section Two ==
10662 stuff
10663 !! result
10664 == Section Two ==
10665 stuff
10666 !! end
10667
10668 !! test
10669 Section replacement, <pre> around bogus header (bug 10309)
10670 !! options
10671 noxml replace=2,"xxx"
10672 !! input
10673 == Section One ==
10674 <pre>
10675 =======
10676 </pre>
10677
10678 == Section Two ==
10679 stuff
10680 !! result
10681 == Section One ==
10682 <pre>
10683 =======
10684 </pre>
10685
10686 xxx
10687 !! end
10688
10689
10690
10691 !! test
10692 Handling of &#x0A; in URLs
10693 !! input
10694 **irc://&#x0A;a
10695 !! result
10696 <ul><li><ul><li><a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a>
10697 </li></ul>
10698 </li></ul>
10699
10700 !!end
10701
10702 !! test
10703 5 quotes, code coverage +1 line
10704 !! input
10705 '''''
10706 !! result
10707 !! end
10708
10709 !! test
10710 Special:Search page linking.
10711 !! input
10712 {{Special:search}}
10713 !! result
10714 <p><a href="/wiki/Special:Search" title="Special:Search">Special:Search</a>
10715 </p>
10716 !! end
10717
10718 !! test
10719 Say the magic word
10720 !! input
10721 * {{PAGENAME}}
10722 * {{BASEPAGENAME}}
10723 * {{SUBPAGENAME}}
10724 * {{SUBPAGENAMEE}}
10725 * {{BASEPAGENAME}}
10726 * {{BASEPAGENAMEE}}
10727 * {{TALKPAGENAME}}
10728 * {{TALKPAGENAMEE}}
10729 * {{SUBJECTPAGENAME}}
10730 * {{SUBJECTPAGENAMEE}}
10731 * {{NAMESPACEE}}
10732 * {{NAMESPACE}}
10733 * {{TALKSPACE}}
10734 * {{TALKSPACEE}}
10735 * {{SUBJECTSPACE}}
10736 * {{SUBJECTSPACEE}}
10737 * {{Dynamic|{{NUMBEROFUSERS}}|{{NUMBEROFPAGES}}|{{CURRENTVERSION}}|{{CONTENTLANGUAGE}}|{{DIRECTIONMARK}}|{{CURRENTTIMESTAMP}}|{{NUMBEROFARTICLES}}}}
10738 !! result
10739 <ul><li> Parser test
10740 </li><li> Parser test
10741 </li><li> Parser test
10742 </li><li> Parser_test
10743 </li><li> Parser test
10744 </li><li> Parser_test
10745 </li><li> Talk:Parser test
10746 </li><li> Talk:Parser_test
10747 </li><li> Parser test
10748 </li><li> Parser_test
10749 </li><li>
10750 </li><li>
10751 </li><li> Talk
10752 </li><li> Talk
10753 </li><li>
10754 </li><li>
10755 </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>
10756 </li></ul>
10757
10758 !! end
10759 ### Note: Above tests excludes the "{{NUMBEROFADMINS}}" magic word because it generates a MySQL error when included.
10760
10761 !! test
10762 Gallery
10763 !! input
10764 <gallery>
10765 image1.png |
10766 image2.gif|||||
10767
10768 image3|
10769 image4 |300px| centre
10770 image5.svg| http://///////
10771 [[x|xx]]]]
10772 * image6
10773 </gallery>
10774 !! result
10775 <ul class="gallery">
10776 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
10777 <div style="height: 150px;">Image1.png</div>
10778 <div class="gallerytext">
10779 </div>
10780 </div></li>
10781 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
10782 <div style="height: 150px;">Image2.gif</div>
10783 <div class="gallerytext">
10784 <p>||||
10785 </p>
10786 </div>
10787 </div></li>
10788 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
10789 <div style="height: 150px;">Image3</div>
10790 <div class="gallerytext">
10791 </div>
10792 </div></li>
10793 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
10794 <div style="height: 150px;">Image4</div>
10795 <div class="gallerytext">
10796 <p>300px| centre
10797 </p>
10798 </div>
10799 </div></li>
10800 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
10801 <div style="height: 150px;">Image5.svg</div>
10802 <div class="gallerytext">
10803 <p><a rel="nofollow" class="external free" href="http://///////">http://///////</a>
10804 </p>
10805 </div>
10806 </div></li>
10807 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
10808 <div style="height: 150px;">* image6</div>
10809 <div class="gallerytext">
10810 </div>
10811 </div></li>
10812 </ul>
10813
10814 !! end
10815
10816 !! test
10817 Gallery (with options)
10818 !! input
10819 <gallery widths='70px' heights='40px' perrow='2' caption='Foo [[Main Page]]' >
10820 File:Nonexistant.jpg|caption
10821 File:Nonexistant.jpg
10822 image:foobar.jpg|some '''caption''' [[Main Page]]
10823 image:foobar.jpg
10824 image:foobar.jpg|Blabla|alt=This is a foo-bar.|blabla.
10825 </gallery>
10826 !! result
10827 <ul class="gallery" style="max-width: 226px;_width: 226px;">
10828 <li class='gallerycaption'>Foo <a href="/wiki/Main_Page" title="Main Page">Main Page</a></li>
10829 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
10830 <div style="height: 70px;">Nonexistant.jpg</div>
10831 <div class="gallerytext">
10832 <p>caption
10833 </p>
10834 </div>
10835 </div></li>
10836 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
10837 <div style="height: 70px;">Nonexistant.jpg</div>
10838 <div class="gallerytext">
10839 </div>
10840 </div></li>
10841 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
10842 <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>
10843 <div class="gallerytext">
10844 <p>some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
10845 </p>
10846 </div>
10847 </div></li>
10848 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
10849 <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>
10850 <div class="gallerytext">
10851 </div>
10852 </div></li>
10853 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
10854 <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>
10855 <div class="gallerytext">
10856 <p>Blabla|blabla.
10857 </p>
10858 </div>
10859 </div></li>
10860 </ul>
10861
10862 !! end
10863
10864 !! test
10865 Gallery with wikitext inside caption
10866 !! input
10867 <gallery>
10868 File:foobar.jpg|[[File:foobar.jpg|20px|desc|alt=inneralt]]|alt=galleryalt
10869 File:foobar.jpg|{{Test|unamedParam|alt=param}}|alt=galleryalt
10870 </gallery>
10871 !! result
10872 <ul class="gallery">
10873 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
10874 <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>
10875 <div class="gallerytext">
10876 <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>
10877 </p>
10878 </div>
10879 </div></li>
10880 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
10881 <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>
10882 <div class="gallerytext">
10883 <p>This is a test template
10884 </p>
10885 </div>
10886 </div></li>
10887 </ul>
10888
10889 !! end
10890
10891 !! test
10892 gallery (with showfilename option)
10893 !! input
10894 <gallery showfilename>
10895 File:Nonexistant.jpg|caption
10896 File:Nonexistant.jpg
10897 image:foobar.jpg|some '''caption''' [[Main Page]]
10898 File:Foobar.jpg
10899 </gallery>
10900 !! result
10901 <ul class="gallery">
10902 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
10903 <div style="height: 150px;">Nonexistant.jpg</div>
10904 <div class="gallerytext">
10905 <p><a href="/wiki/File:Nonexistant.jpg" title="File:Nonexistant.jpg">Nonexistant.jpg</a><br />
10906 caption
10907 </p>
10908 </div>
10909 </div></li>
10910 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
10911 <div style="height: 150px;">Nonexistant.jpg</div>
10912 <div class="gallerytext">
10913 <p><a href="/wiki/File:Nonexistant.jpg" title="File:Nonexistant.jpg">Nonexistant.jpg</a><br />
10914 </p>
10915 </div>
10916 </div></li>
10917 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
10918 <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>
10919 <div class="gallerytext">
10920 <p><a href="/wiki/File:Foobar.jpg" title="File:Foobar.jpg">Foobar.jpg</a><br />
10921 some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
10922 </p>
10923 </div>
10924 </div></li>
10925 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
10926 <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>
10927 <div class="gallerytext">
10928 <p><a href="/wiki/File:Foobar.jpg" title="File:Foobar.jpg">Foobar.jpg</a><br />
10929 </p>
10930 </div>
10931 </div></li>
10932 </ul>
10933
10934 !! end
10935
10936 !! test
10937 Gallery (with namespace-less filenames)
10938 !! input
10939 <gallery>
10940 File:Nonexistant.jpg
10941 Nonexistant.jpg
10942 image:foobar.jpg
10943 foobar.jpg
10944 </gallery>
10945 !! result
10946 <ul class="gallery">
10947 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
10948 <div style="height: 150px;">Nonexistant.jpg</div>
10949 <div class="gallerytext">
10950 </div>
10951 </div></li>
10952 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
10953 <div style="height: 150px;">Nonexistant.jpg</div>
10954 <div class="gallerytext">
10955 </div>
10956 </div></li>
10957 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
10958 <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>
10959 <div class="gallerytext">
10960 </div>
10961 </div></li>
10962 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
10963 <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>
10964 <div class="gallerytext">
10965 </div>
10966 </div></li>
10967 </ul>
10968
10969 !! end
10970
10971 !! test
10972 HTML Hex character encoding (spells the word "JavaScript")
10973 !! input
10974 &#x4A;&#x061;&#x0076;&#x00061;&#x000053;&#x0000063;&#114;&#x0000069;&#00000112;&#x0000000074;
10975 !! result
10976 <p>&#x4a;&#x61;&#x76;&#x61;&#x53;&#x63;&#114;&#x69;&#112;&#x74;
10977 </p>
10978 !! end
10979
10980 !! test
10981 HTML Hex character encoding bogus encoding (bug 26437 regression check)
10982 !! input
10983 &#xsee;&#XSEE;
10984 !! result
10985 <p>&amp;#xsee;&amp;#XSEE;
10986 </p>
10987 !! end
10988
10989 !! test
10990 HTML Hex character encoding mixed case
10991 !! input
10992 &#xEE;&#Xee;
10993 !! result
10994 <p>&#xee;&#xee;
10995 </p>
10996 !! end
10997
10998 !! test
10999 __FORCETOC__ override
11000 !! input
11001 __NEWSECTIONLINK__
11002 __FORCETOC__
11003 !! result
11004 <p><br />
11005 </p>
11006 !! end
11007
11008 !! test
11009 ISBN code coverage
11010 !! input
11011 ISBN 978-0-1234-56&#x20;789
11012 !! result
11013 <p><a href="/wiki/Special:BookSources/9780123456" class="internal mw-magiclink-isbn">ISBN 978-0-1234-56</a>&#x20;789
11014 </p>
11015 !! end
11016
11017 !! test
11018 ISBN followed by 5 spaces
11019 !! input
11020 ISBN
11021 !! result
11022 <p>ISBN
11023 </p>
11024 !! end
11025
11026 !! test
11027 Double ISBN
11028 !! input
11029 ISBN ISBN 1234567890
11030 !! result
11031 <p>ISBN <a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
11032 </p>
11033 !! end
11034
11035 !! test
11036 Bug 22905: <abbr> followed by ISBN followed by </a>
11037 !! input
11038 <abbr>(fr)</abbr> ISBN 2753300917 [http://www.example.com example.com]
11039 !! result
11040 <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>
11041 </p>
11042 !! end
11043
11044 !! test
11045 Double RFC
11046 !! input
11047 RFC RFC 1234
11048 !! result
11049 <p>RFC <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc1234">RFC 1234</a>
11050 </p>
11051 !! end
11052
11053 !! test
11054 Double RFC with a wiki link
11055 !! input
11056 RFC [[RFC 1234]]
11057 !! result
11058 <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>
11059 </p>
11060 !! end
11061
11062 !! test
11063 RFC code coverage
11064 !! input
11065 RFC 983&#x20;987
11066 !! result
11067 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc983">RFC 983</a>&#x20;987
11068 </p>
11069 !! end
11070
11071 !! test
11072 Centre-aligned image
11073 !! input
11074 [[Image:foobar.jpg|centre]]
11075 !! result
11076 <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>
11077
11078 !!end
11079
11080 !! test
11081 None-aligned image
11082 !! input
11083 [[Image:foobar.jpg|none]]
11084 !! result
11085 <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>
11086
11087 !!end
11088
11089 !! test
11090 Width + Height sized image (using px) (height is ignored)
11091 !! input
11092 [[Image:foobar.jpg|640x480px]]
11093 !! result
11094 <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>
11095 </p>
11096 !!end
11097
11098 !! test
11099 Width-sized image (using px, no following whitespace)
11100 !! input
11101 [[Image:foobar.jpg|640px]]
11102 !! result
11103 <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>
11104 </p>
11105 !!end
11106
11107 !! test
11108 Width-sized image (using px, with following whitespace - test regression from r39467)
11109 !! input
11110 [[Image:foobar.jpg|640px ]]
11111 !! result
11112 <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>
11113 </p>
11114 !!end
11115
11116 !! test
11117 Width-sized image (using px, with preceding whitespace - test regression from r39467)
11118 !! input
11119 [[Image:foobar.jpg| 640px]]
11120 !! result
11121 <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>
11122 </p>
11123 !!end
11124
11125 !! test
11126 Another italics / bold test
11127 !! input
11128 ''' ''x'
11129 !! result
11130 <pre>'<i> </i>x'
11131 </pre>
11132 !!end
11133
11134 # Note the results may be incorrect, as parserTest output included this:
11135 # XML error: Mismatched tag at byte 6120:
11136 # ...<dd> </dt></dl> </dd...
11137 !! test
11138 dt/dd/dl test
11139 !! options
11140 disabled
11141 !! input
11142 :;;;::
11143 !! result
11144 <dl><dd><dl><dt><dl><dt><dl><dt><dl><dd><dl><dd>
11145 </dd></dl>
11146 </dd></dl>
11147 </dt></dl>
11148 </dt></dl>
11149 </dt></dl>
11150 </dd></dl>
11151
11152 !!end
11153
11154
11155 # Images with the "|" character in external URLs in comment tags; Eats half the comment, leaves unmatched "</a>" tag.
11156 !! test
11157 Images with the "|" character in the comment
11158 !! input
11159 [[image:Foobar.jpg|thumb|An [http://test/?param1=|left|&param2=|x external] URL]]
11160 !! result
11161 <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>
11162
11163 !!end
11164
11165 !! test
11166 [Before] HTML without raw HTML enabled ($wgRawHtml==false)
11167 !! input
11168 <html><script>alert(1);</script></html>
11169 !! result
11170 <p>&lt;html&gt;&lt;script&gt;alert(1);&lt;/script&gt;&lt;/html&gt;
11171 </p>
11172 !! end
11173
11174 !! test
11175 HTML with raw HTML ($wgRawHtml==true)
11176 !! options
11177 rawhtml
11178 !! input
11179 <html><script>alert(1);</script></html>
11180 !! result
11181 <p><script>alert(1);</script>
11182 </p>
11183 !! end
11184
11185 !! test
11186 Parents of subpages, one level up
11187 !! options
11188 subpage title=[[Subpage test/L1/L2/L3]]
11189 !! input
11190 [[../|L2]]
11191 !! result
11192 <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>
11193 </p>
11194 !! end
11195
11196
11197 !! test
11198 Parents of subpages, one level up, not named
11199 !! options
11200 subpage title=[[Subpage test/L1/L2/L3]]
11201 !! input
11202 [[../]]
11203 !! result
11204 <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>
11205 </p>
11206 !! end
11207
11208
11209
11210 !! test
11211 Parents of subpages, two levels up
11212 !! options
11213 subpage title=[[Subpage test/L1/L2/L3]]
11214 !! input
11215 [[../../|L1]]2
11216
11217 [[../../|L1]]l
11218 !! result
11219 <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
11220 </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>
11221 </p>
11222 !! end
11223
11224 !! test
11225 Parents of subpages, two levels up, without trailing slash or name.
11226 !! options
11227 subpage title=[[Subpage test/L1/L2/L3]]
11228 !! input
11229 [[../..]]
11230 !! result
11231 <p>[[../..]]
11232 </p>
11233 !! end
11234
11235 !! test
11236 Parents of subpages, two levels up, with lots of extra trailing slashes.
11237 !! options
11238 subpage title=[[Subpage test/L1/L2/L3]]
11239 !! input
11240 [[../../////]]
11241 !! result
11242 <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>
11243 </p>
11244 !! end
11245
11246 !! test
11247 Definition list code coverage
11248 !! input
11249 ; title : def
11250 ; title : def
11251 ;title: def
11252 !! result
11253 <dl><dt> title &#160;</dt><dd> def
11254 </dd><dt> title&#160;</dt><dd> def
11255 </dd><dt>title</dt><dd> def
11256 </dd></dl>
11257
11258 !! end
11259
11260 !! test
11261 Don't fall for the self-closing div
11262 !! input
11263 <div>hello world</div/>
11264 !! result
11265 <div>hello world</div>
11266
11267 !! end
11268
11269 !! test
11270 MSGNW magic word
11271 !! input
11272 {{MSGNW:msg}}
11273 !! result
11274 <p>&#91;&#91;:Template:Msg&#93;&#93;
11275 </p>
11276 !! end
11277
11278 !! test
11279 RAW magic word
11280 !! input
11281 {{RAW:QUERTY}}
11282 !! result
11283 <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>
11284 </p>
11285 !! end
11286
11287 # This isn't needed for XHTML conformance, but would be handy as a fallback security measure
11288 !! test
11289 Always escape literal '>' in output, not just after '<'
11290 !! input
11291 ><>
11292 !! result
11293 <p>&gt;&lt;&gt;
11294 </p>
11295 !! end
11296
11297 !! test
11298 Template caching
11299 !! input
11300 {{Test}}
11301 {{Test}}
11302 !! result
11303 <p>This is a test template
11304 This is a test template
11305 </p>
11306 !! end
11307
11308
11309 !! article
11310 MediaWiki:Fake
11311 !! text
11312 ==header==
11313 !! endarticle
11314
11315 !! test
11316 Inclusion of !userCanEdit() content
11317 !! input
11318 {{MediaWiki:Fake}}
11319 !! result
11320 <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>
11321
11322 !! end
11323
11324
11325 !! test
11326 Out-of-order TOC heading levels
11327 !! input
11328 ==2==
11329 ======6======
11330 ===3===
11331 =1=
11332 =====5=====
11333 ==2==
11334 !! result
11335 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
11336 <ul>
11337 <li class="toclevel-1 tocsection-1"><a href="#2"><span class="tocnumber">1</span> <span class="toctext">2</span></a>
11338 <ul>
11339 <li class="toclevel-2 tocsection-2"><a href="#6"><span class="tocnumber">1.1</span> <span class="toctext">6</span></a></li>
11340 <li class="toclevel-2 tocsection-3"><a href="#3"><span class="tocnumber">1.2</span> <span class="toctext">3</span></a></li>
11341 </ul>
11342 </li>
11343 <li class="toclevel-1 tocsection-4"><a href="#1"><span class="tocnumber">2</span> <span class="toctext">1</span></a>
11344 <ul>
11345 <li class="toclevel-2 tocsection-5"><a href="#5"><span class="tocnumber">2.1</span> <span class="toctext">5</span></a></li>
11346 <li class="toclevel-2 tocsection-6"><a href="#2_2"><span class="tocnumber">2.2</span> <span class="toctext">2</span></a></li>
11347 </ul>
11348 </li>
11349 </ul>
11350 </td></tr></table>
11351 <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>
11352 <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>
11353 <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>
11354 <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>
11355 <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>
11356 <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>
11357
11358 !! end
11359
11360
11361 !! test
11362 ISBN with a dummy number
11363 !! input
11364 ISBN ---
11365 !! result
11366 <p>ISBN ---
11367 </p>
11368 !! end
11369
11370
11371 !! test
11372 ISBN with space-delimited number
11373 !! input
11374 ISBN 92 9017 032 8
11375 !! result
11376 <p><a href="/wiki/Special:BookSources/9290170328" class="internal mw-magiclink-isbn">ISBN 92 9017 032 8</a>
11377 </p>
11378 !! end
11379
11380
11381 !! test
11382 ISBN with multiple spaces, no number
11383 !! input
11384 ISBN foo
11385 !! result
11386 <p>ISBN foo
11387 </p>
11388 !! end
11389
11390
11391 !! test
11392 ISBN length
11393 !! input
11394 ISBN 123456789
11395
11396 ISBN 1234567890
11397
11398 ISBN 12345678901
11399 !! result
11400 <p>ISBN 123456789
11401 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
11402 </p><p>ISBN 12345678901
11403 </p>
11404 !! end
11405
11406
11407 !! test
11408 ISBN with trailing year (bug 8110)
11409 !! input
11410 ISBN 1-234-56789-0 - 2006
11411
11412 ISBN 1 234 56789 0 - 2006
11413 !! result
11414 <p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1-234-56789-0</a> - 2006
11415 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1 234 56789 0</a> - 2006
11416 </p>
11417 !! end
11418
11419
11420 !! test
11421 anchorencode
11422 !! input
11423 {{anchorencode:foo bar©#%n}}
11424 !! result
11425 <p>foo_bar.C2.A9.23.25n
11426 </p>
11427 !! end
11428
11429 !! test
11430 anchorencode trims spaces
11431 !! input
11432 {{anchorencode: __pretty__please__}}
11433 !! result
11434 <p>pretty_please
11435 </p>
11436 !! end
11437
11438 !! test
11439 anchorencode deals with links
11440 !! input
11441 {{anchorencode: [[hello|world]] [[hi]]}}
11442 !! result
11443 <p>world_hi
11444 </p>
11445 !! end
11446
11447 !! test
11448 anchorencode deals with templates
11449 !! input
11450 {{anchorencode: {{Foo}} }}
11451 !! result
11452 <p>FOO
11453 </p>
11454 !! end
11455
11456 !! test
11457 anchorencode encodes like the TOC generator: (bug 18431)
11458 !! input
11459 === _ +:.3A%3A&&amp;]] ===
11460 {{anchorencode: _ +:.3A%3A&&amp;]] }}
11461 __NOEDITSECTION__
11462 !! result
11463 <h3> <span class="mw-headline" id=".2B:.3A.253A.26.26.5D.5D">_ +:.3A%3A&amp;&amp;]]</span></h3>
11464 <p>.2B:.3A.253A.26.26.5D.5D
11465 </p>
11466 !! end
11467
11468 # Expected output in the following test is not necessarily expected (there
11469 # should probably be <p> tags inside the <blockquote> in the output) -- it's
11470 # only testing for well-formedness.
11471 !! test
11472 Bug 6200: blockquotes and paragraph formatting
11473 !! input
11474 <blockquote>
11475 foo
11476 </blockquote>
11477
11478 bar
11479
11480 baz
11481 !! result
11482 <blockquote>
11483 foo
11484 </blockquote>
11485 <p>bar
11486 </p>
11487 <pre>baz
11488 </pre>
11489 !! end
11490
11491 !! test
11492 Bug 8293: Use of center tag ruins paragraph formatting
11493 !! input
11494 <center>
11495 foo
11496 </center>
11497
11498 bar
11499
11500 baz
11501 !! result
11502 <center>
11503 <p>foo
11504 </p>
11505 </center>
11506 <p>bar
11507 </p>
11508 <pre>baz
11509 </pre>
11510 !! end
11511
11512 !!test
11513 Parsing of overlapping (improperly nested) inline html tags (PHP parser)
11514 !!options
11515 php
11516 !!input
11517 <span><s>x</span></s>
11518 !!result
11519 <p><span><s>x&lt;/span&gt;</s></span>
11520 </p>
11521 !!end
11522
11523 !!test
11524 Parsing of overlapping (improperly nested) inline html tags (Parsoid)
11525 !!options
11526 parsoid
11527 !!input
11528 <span><s>x</span></s>
11529 !!result
11530 <p><span><s>x</s></span><s></s>
11531 </p>
11532 !!end
11533
11534 ###
11535 ### Language variants related tests
11536 ###
11537 !! test
11538 Self-link in language variants
11539 !! options
11540 title=[[Dunav]] language=sr
11541 !! input
11542 Both [[Dunav]] and [[Дунав]] are names for this river.
11543 !! result
11544 <p>Both <strong class="selflink">Dunav</strong> and <strong class="selflink">Дунав</strong> are names for this river.
11545 </p>
11546 !!end
11547
11548 !! article
11549 Дуна
11550 !! text
11551 content
11552 !! endarticle
11553
11554 !! test
11555 Link to another existing title shouldn't be parsed as self-link even if it's a variant of this title
11556 !! options
11557 title=[[Duna]] language=sr
11558 !! input
11559 [[Дуна]] is not a self-link while [[Duna]] and [[Dуна]] are still self-links.
11560 !! result
11561 <p><a href="/wiki/%D0%94%D1%83%D0%BD%D0%B0" title="Дуна">Дуна</a> is not a self-link while <strong class="selflink">Duna</strong> and <strong class="selflink">Dуна</strong> are still self-links.
11562 </p>
11563 !! end
11564
11565 !! test
11566 Link to pages in language variants
11567 !! options
11568 language=sr
11569 !! input
11570 Main Page can be written as [[Маин Паге]]
11571 !! result
11572 <p>Main Page can be written as <a href="/wiki/Main_Page" title="Main Page">Маин Паге</a>
11573 </p>
11574 !!end
11575
11576
11577 !! test
11578 Multiple links to pages in language variants
11579 !! options
11580 language=sr
11581 !! input
11582 [[Main Page]] can be written as [[Маин Паге]] same as [[Маин Паге]].
11583 !! result
11584 <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>.
11585 </p>
11586 !!end
11587
11588
11589 !! test
11590 Simple template in language variants
11591 !! options
11592 language=sr
11593 !! input
11594 {{тест}}
11595 !! result
11596 <p>This is a test template
11597 </p>
11598 !! end
11599
11600
11601 !! test
11602 Template with explicit namespace in language variants
11603 !! options
11604 language=sr
11605 !! input
11606 {{Template:тест}}
11607 !! result
11608 <p>This is a test template
11609 </p>
11610 !! end
11611
11612
11613 !! test
11614 Basic test for template parameter in language variants
11615 !! options
11616 language=sr
11617 !! input
11618 {{парамтест|param=foo}}
11619 !! result
11620 <p>This is a test template with parameter foo
11621 </p>
11622 !! end
11623
11624
11625 !! test
11626 Simple category in language variants
11627 !! options
11628 language=sr cat
11629 !! input
11630 [[Category:МедиаWики Усер'с Гуиде]]
11631 !! result
11632 <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>
11633 !! end
11634
11635
11636 !! article
11637 Category:分类
11638 !! text
11639 blah
11640 !! endarticle
11641
11642 !! article
11643 Category:分類
11644 !! text
11645 blah
11646 !! endarticle
11647
11648 !! test
11649 Don't convert blue categorylinks to another variant (bug 33210)
11650 !! options
11651 language=zh cat
11652 !! input
11653 [[A]][[Category:分类]]
11654 !! result
11655 <a href="/wiki/Category:%E5%88%86%E7%B1%BB" title="Category:分类">分类</a>
11656 !! end
11657
11658
11659 !! test
11660 Stripping -{}- tags (language variants)
11661 !! options
11662 language=sr
11663 !! input
11664 Latin proverb: -{Ne nuntium necare}-
11665 !! result
11666 <p>Latin proverb: Ne nuntium necare
11667 </p>
11668 !! end
11669
11670
11671 !! test
11672 Prevent conversion with -{}- tags (language variants)
11673 !! options
11674 language=sr variant=sr-ec
11675 !! input
11676 Latinski: -{Ne nuntium necare}-
11677 !! result
11678 <p>Латински: Ne nuntium necare
11679 </p>
11680 !! end
11681
11682
11683 !! test
11684 Prevent conversion of text with -{}- tags (language variants)
11685 !! options
11686 language=sr variant=sr-ec
11687 !! input
11688 Latinski: -{Ne nuntium necare}-
11689 !! result
11690 <p>Латински: Ne nuntium necare
11691 </p>
11692 !! end
11693
11694
11695 !! test
11696 Prevent conversion of links with -{}- tags (language variants)
11697 !! options
11698 language=sr variant=sr-ec
11699 !! input
11700 -{[[Main Page]]}-
11701 !! result
11702 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
11703 </p>
11704 !! end
11705
11706
11707 !! test
11708 -{}- tags within headlines (within html for parserConvert())
11709 !! options
11710 language=sr variant=sr-ec
11711 !! input
11712 == -{Naslov}- ==
11713 !! result
11714 <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>
11715
11716 !! end
11717
11718
11719 !! test
11720 Explicit definition of language variant alternatives
11721 !! options
11722 language=zh variant=zh-tw
11723 !! input
11724 -{zh:China;zh-tw:Taiwan}-, not China
11725 !! result
11726 <p>Taiwan, not China
11727 </p>
11728 !! end
11729
11730
11731 !! test
11732 Conversion around HTML tags
11733 !! options
11734 language=sr variant=sr-ec
11735 !! input
11736 -{H|span=>sr-ec:script;title=>sr-ec:src;}-
11737 <span title="La-{sr-el:L;sr-ec:C;}-tin">ski</span>
11738 !! result
11739 <p>
11740 <span title="ЛаCтин">ски</span>
11741 </p>
11742 !! end
11743
11744
11745 !! test
11746 Explicit session-wise language variant mapping (A flag and - flag)
11747 !! options
11748 language=zh variant=zh-tw
11749 !! input
11750 Taiwan is not China.
11751 But -{A|zh:China;zh-tw:Taiwan}- is China,
11752 (This-{-|zh:China;zh-tw:Taiwan}- should be stripped!)
11753 and -{China}- is China.
11754 !! result
11755 <p>Taiwan is not China.
11756 But Taiwan is Taiwan,
11757 (This should be stripped!)
11758 and China is China.
11759 </p>
11760 !! end
11761
11762 !! test
11763 Explicit session-wise language variant mapping (H flag for hide)
11764 !! options
11765 language=zh variant=zh-tw
11766 !! input
11767 (This-{H|zh:China;zh-tw:Taiwan}- should be stripped!)
11768 Taiwan is China.
11769 !! result
11770 <p>(This should be stripped!)
11771 Taiwan is Taiwan.
11772 </p>
11773 !! end
11774
11775 !! test
11776 Adding explicit conversion rule for title (T flag)
11777 !! options
11778 language=zh variant=zh-tw showtitle
11779 !! input
11780 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
11781 !! result
11782 Taiwan
11783 <p>Should be stripped!
11784 </p>
11785 !! end
11786
11787 !! test
11788 Testing that changing the language variant here in the tests actually works
11789 !! options
11790 language=zh variant=zh showtitle
11791 !! input
11792 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
11793 !! result
11794 China
11795 <p>Should be stripped!
11796 </p>
11797 !! end
11798
11799 !! test
11800 Recursive conversion of alt and title attrs shouldn't clear converter state
11801 !! options
11802 language=zh variant=zh-cn showtitle
11803 !! input
11804 -{H|zh-cn:Exclamation;zh-tw:exclamation;}-
11805 Should be stripped-{T|zh-cn:China;zh-tw:Taiwan}-<span title="exclamation">!</span>
11806 !! result
11807 China
11808 <p>
11809 Should be stripped<span title="Exclamation">!</span>
11810 </p>
11811 !! end
11812
11813 !! test
11814 Bug 24072: more test on conversion rule for title
11815 !! options
11816 language=zh variant=zh-tw showtitle
11817 !! input
11818 This should be stripped-{T|zh:China;zh-tw:Taiwan}-!
11819 This won't take interferes with the title rule-{H|zh:Beijing;zh-tw:Taipei}-.
11820 !! result
11821 Taiwan
11822 <p>This should be stripped!
11823 This won't take interferes with the title rule.
11824 </p>
11825 !! end
11826
11827 !! test
11828 Raw output of variant escape tags (R flag)
11829 !! options
11830 language=zh variant=zh-tw
11831 !! input
11832 Raw: -{R|zh:China;zh-tw:Taiwan}-
11833 !! result
11834 <p>Raw: zh:China;zh-tw:Taiwan
11835 </p>
11836 !! end
11837
11838 !! test
11839 Nested using of manual convert syntax
11840 !! options
11841 language=zh variant=zh-hk
11842 !! input
11843 Nested: -{zh-hans:Hi -{zh-cn:China;zh-sg:Singapore;}-;zh-hant:Hello -{zh-tw:Taiwan;zh-hk:H-{ong}- K-{}-ong;}-;}-!
11844 !! result
11845 <p>Nested: Hello Hong Kong!
11846 </p>
11847 !! end
11848
11849 !! test
11850 Proper conversion of text in external links
11851 !! options
11852 language=sr variant=sr-ec
11853 !! input
11854 http://www.google.com
11855 gopher://www.google.com
11856 [http://www.google.com http://www.google.com]
11857 [gopher://www.google.com gopher://www.google.com]
11858 [https://www.google.com irc://www.google.com]
11859 [ftp://www.google.com www.google.com/ftp://dir]
11860 [//www.google.com www.google.com]
11861 !! result
11862 <p><a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
11863 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
11864 <a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
11865 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
11866 <a rel="nofollow" class="external text" href="https://www.google.com">irc://www.google.com</a>
11867 <a rel="nofollow" class="external text" href="ftp://www.google.com">www.гоогле.цом/фтп://дир</a>
11868 <a rel="nofollow" class="external text" href="//www.google.com">www.гоогле.цом</a>
11869 </p>
11870 !! end
11871
11872 !! test
11873 Do not convert roman numbers to language variants
11874 !! options
11875 language=sr variant=sr-ec
11876 !! input
11877 Fridrih IV je car.
11878 !! result
11879 <p>Фридрих IV је цар.
11880 </p>
11881 !! end
11882
11883 !! test
11884 Unclosed language converter markup "-{"
11885 !! options
11886 language=sr
11887 !! input
11888 -{T|hello
11889 !! result
11890 <p>-{T|hello
11891 </p>
11892 !! end
11893
11894 !! test
11895 Don't convert raw rule "-{R|=&gt;}-" to "=>"
11896 !! options
11897 language=sr
11898 !! input
11899 -{R|=&gt;}-
11900 !! result
11901 <p>=&gt;
11902 </p>
11903 !!end
11904
11905 !!article
11906 Template:Bullet
11907 !!text
11908 * Bar
11909 !!endarticle
11910
11911 !! test
11912 Bug 529: Uncovered bullet
11913 !! input
11914 * Foo {{bullet}}
11915 !! result
11916 <ul><li> Foo
11917 </li><li> Bar
11918 </li></ul>
11919
11920 !! end
11921
11922 # Plain MediaWiki does not remove empty lists, but tidy actually does.
11923 # Templates in Wikipedia rely on this behavior, as tidy has always been
11924 # enabled there. These tests are normally run *without* tidy, so specify the
11925 # full output here.
11926 # To test realistic parsing behavior, apply a tidy-like transformation to both
11927 # the expected output and your parser's output.
11928 !! test
11929 Bug 529: Uncovered bullet leaving empty list, normally removed by tidy
11930 !! input
11931 ******* Foo {{bullet}}
11932 !! result
11933 <ul><li><ul><li><ul><li><ul><li><ul><li><ul><li><ul><li> Foo
11934 </li></ul>
11935 </li></ul>
11936 </li></ul>
11937 </li></ul>
11938 </li></ul>
11939 </li></ul>
11940 </li><li> Bar
11941 </li></ul>
11942
11943 !! end
11944
11945 !! test
11946 Bug 529: Uncovered table already at line-start
11947 !! input
11948 x
11949
11950 {{table}}
11951 y
11952 !! result
11953 <p>x
11954 </p>
11955 <table>
11956 <tr>
11957 <td> 1 </td>
11958 <td> 2
11959 </td></tr>
11960 <tr>
11961 <td> 3 </td>
11962 <td> 4
11963 </td></tr></table>
11964 <p>y
11965 </p>
11966 !! end
11967
11968 !! test
11969 Bug 529: Uncovered bullet in parser function result
11970 !! input
11971 * Foo {{lc:{{bullet}} }}
11972 !! result
11973 <ul><li> Foo
11974 </li><li> bar
11975 </li></ul>
11976
11977 !! end
11978
11979 !! test
11980 Bug 5678: Double-parsed template argument
11981 !! input
11982 {{lc:{{{1}}}|hello}}
11983 !! result
11984 <p>{{{1}}}
11985 </p>
11986 !! end
11987
11988 !! test
11989 Bug 5678: Double-parsed template invocation
11990 !! input
11991 {{lc:{{paramtest {{!}} param = hello }} }}
11992 !! result
11993 <p>{{paramtest | param = hello }}
11994 </p>
11995 !! end
11996
11997 !! test
11998 Case insensitivity of parser functions for non-ASCII characters (bug 8143)
11999 !! options
12000 language=cs
12001 title=[[Main Page]]
12002 !! input
12003 {{PRVNÍVELKÉ:ěščř}}
12004 {{prvnívelké:ěščř}}
12005 {{PRVNÍMALÉ:ěščř}}
12006 {{prvnímalé:ěščř}}
12007 {{MALÁ:ěščř}}
12008 {{malá:ěščř}}
12009 {{VELKÁ:ěščř}}
12010 {{velká:ěščř}}
12011 !! result
12012 <p>Ěščř
12013 Ěščř
12014 ěščř
12015 ěščř
12016 ěščř
12017 ěščř
12018 ĚŠČŘ
12019 ĚŠČŘ
12020 </p>
12021 !! end
12022
12023 !! test
12024 Morwen/13: Unclosed link followed by heading
12025 !! input
12026 [[link
12027 ==heading==
12028 !! result
12029 <p>[[link
12030 </p>
12031 <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>
12032
12033 !! end
12034
12035 !! test
12036 HHP2.1: Heuristics for headings in preprocessor parenthetical structures
12037 !! input
12038 {{foo|
12039 =heading=
12040 !! result
12041 <p>{{foo|
12042 </p>
12043 <h1> <span class="mw-headline" id="heading">heading</span></h1>
12044
12045 !! end
12046
12047 !! test
12048 HHP2.2: Heuristics for headings in preprocessor parenthetical structures
12049 !! input
12050 {{foo|
12051 ==heading==
12052 !! result
12053 <p>{{foo|
12054 </p>
12055 <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>
12056
12057 !! end
12058
12059 !! test
12060 Tildes in comments
12061 !! options
12062 pst
12063 !! input
12064 <!-- ~~~~ -->
12065 !! result
12066 <!-- ~~~~ -->
12067 !! end
12068
12069 !! test
12070 Paragraphs inside divs (no extra line breaks)
12071 !! input
12072 <div>Line one
12073
12074 Line two</div>
12075 !! result
12076 <div>Line one
12077 Line two</div>
12078
12079 !! end
12080
12081 !! test
12082 Paragraphs inside divs (extra line break on open)
12083 !! input
12084 <div>
12085 Line one
12086
12087 Line two</div>
12088 !! result
12089 <div>
12090 <p>Line one
12091 </p>
12092 Line two</div>
12093
12094 !! end
12095
12096 !! test
12097 Paragraphs inside divs (extra line break on close)
12098 !! input
12099 <div>Line one
12100
12101 Line two
12102 </div>
12103 !! result
12104 <div>Line one
12105 <p>Line two
12106 </p>
12107 </div>
12108
12109 !! end
12110
12111 !! test
12112 Paragraphs inside divs (extra line break on open and close)
12113 !! input
12114 <div>
12115 Line one
12116
12117 Line two
12118 </div>
12119 !! result
12120 <div>
12121 <p>Line one
12122 </p><p>Line two
12123 </p>
12124 </div>
12125
12126 !! end
12127
12128 !! test
12129 Nesting tags, paragraphs on lines which begin with <div>
12130 !! options
12131 disabled
12132 !! input
12133 <div></div><strong>A
12134 B</strong>
12135 !! result
12136 <div></div>
12137 <p><strong>A
12138 B</strong>
12139 </p>
12140 !! end
12141
12142 # Bug 6200: <blockquote> should behave like <div> with respect to line breaks
12143 !! test
12144 Bug 6200: paragraphs inside blockquotes (no extra line breaks)
12145 !! options
12146 disabled
12147 !! input
12148 <blockquote>Line one
12149
12150 Line two</blockquote>
12151 !! result
12152 <blockquote>Line one
12153 Line two</blockquote>
12154
12155 !! end
12156
12157 !! test
12158 Bug 6200: paragraphs inside blockquotes (extra line break on open)
12159 !! options
12160 disabled
12161 !! input
12162 <blockquote>
12163 Line one
12164
12165 Line two</blockquote>
12166 !! result
12167 <blockquote>
12168 <p>Line one
12169 </p>
12170 Line two</blockquote>
12171
12172 !! end
12173
12174 !! test
12175 Bug 6200: paragraphs inside blockquotes (extra line break on close)
12176 !! options
12177 disabled
12178 !! input
12179 <blockquote>Line one
12180
12181 Line two
12182 </blockquote>
12183 !! result
12184 <blockquote>Line one
12185 <p>Line two
12186 </p>
12187 </blockquote>
12188
12189 !! end
12190
12191 !! test
12192 Bug 6200: paragraphs inside blockquotes (extra line break on open and close)
12193 !! options
12194 disabled
12195 !! input
12196 <blockquote>
12197 Line one
12198
12199 Line two
12200 </blockquote>
12201 !! result
12202 <blockquote>
12203 <p>Line one
12204 </p><p>Line two
12205 </p>
12206 </blockquote>
12207
12208 !! end
12209
12210 !! test
12211 Paragraphs inside blockquotes/divs (no extra line breaks)
12212 !! input
12213 <blockquote><div>Line one
12214
12215 Line two</div></blockquote>
12216 !! result
12217 <blockquote><div>Line one
12218 Line two</div></blockquote>
12219
12220 !! end
12221
12222 !! test
12223 Paragraphs inside blockquotes/divs (extra line break on open)
12224 !! input
12225 <blockquote><div>
12226 Line one
12227
12228 Line two</div></blockquote>
12229 !! result
12230 <blockquote><div>
12231 <p>Line one
12232 </p>
12233 Line two</div></blockquote>
12234
12235 !! end
12236
12237 !! test
12238 Paragraphs inside blockquotes/divs (extra line break on close)
12239 !! input
12240 <blockquote><div>Line one
12241
12242 Line two
12243 </div></blockquote>
12244 !! result
12245 <blockquote><div>Line one
12246 <p>Line two
12247 </p>
12248 </div></blockquote>
12249
12250 !! end
12251
12252 !! test
12253 Paragraphs inside blockquotes/divs (extra line break on open and close)
12254 !! input
12255 <blockquote><div>
12256 Line one
12257
12258 Line two
12259 </div></blockquote>
12260 !! result
12261 <blockquote><div>
12262 <p>Line one
12263 </p><p>Line two
12264 </p>
12265 </div></blockquote>
12266
12267 !! end
12268
12269 !! test
12270 Interwiki links trounced by replaceExternalLinks after early LinkHolderArray expansion
12271 !! options
12272 wgLinkHolderBatchSize=0
12273 !! input
12274 [[meatball:1]]
12275 [[meatball:2]]
12276 [[meatball:3]]
12277 !! result
12278 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?1" class="extiw" title="meatball:1">meatball:1</a>
12279 <a href="http://www.usemod.com/cgi-bin/mb.pl?2" class="extiw" title="meatball:2">meatball:2</a>
12280 <a href="http://www.usemod.com/cgi-bin/mb.pl?3" class="extiw" title="meatball:3">meatball:3</a>
12281 </p>
12282 !! end
12283
12284 !! test
12285 Free external link invading image caption
12286 !! input
12287 [[Image:Foobar.jpg|thumb|http://x|hello]]
12288 !! result
12289 <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>
12290
12291 !! end
12292
12293 !! test
12294 Bug 15196: localised external link numbers
12295 !! options
12296 language=fa
12297 !! input
12298 [http://en.wikipedia.org/]
12299 !! result
12300 <p><a rel="nofollow" class="external autonumber" href="http://en.wikipedia.org/">[۱]</a>
12301 </p>
12302 !! end
12303
12304 !! test
12305 Multibyte character in padleft
12306 !! input
12307 {{padleft:-Hello|7|Æ}}
12308 !! result
12309 <p>Æ-Hello
12310 </p>
12311 !! end
12312
12313 !! test
12314 Multibyte character in padright
12315 !! input
12316 {{padright:Hello-|7|Æ}}
12317 !! result
12318 <p>Hello-Æ
12319 </p>
12320 !! end
12321
12322 !!test
12323 formatdate parser function
12324 !!input
12325 {{#formatdate:2009-03-24}}
12326 !! result
12327 <p><span class="mw-formatted-date" title="2009-03-24">2009-03-24</span>
12328 </p>
12329 !! end
12330
12331 !!test
12332 formatdate parser function, with default format
12333 !!input
12334 {{#formatdate:2009-03-24|mdy}}
12335 !! result
12336 <p><span class="mw-formatted-date" title="2009-03-24">March 24, 2009</span>
12337 </p>
12338 !! end
12339
12340 !! test
12341 Spacing of numbers in formatted dates
12342 !! input
12343 {{#formatdate:January 15}}
12344 !! result
12345 <p><span class="mw-formatted-date" title="01-15">January 15</span>
12346 </p>
12347 !! end
12348
12349 !! test
12350 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
12351 !! options
12352 language=nl title=[[MediaWiki:Common.css]]
12353 !! input
12354 {{#formatdate:2009-03-24|dmy}}
12355 !! result
12356 <p><span class="mw-formatted-date" title="2009-03-24">24 March 2009</span>
12357 </p>
12358 !! end
12359
12360 #
12361 #
12362 #
12363
12364 #
12365 # Edit comments
12366 #
12367
12368 !! test
12369 Edit comment with link
12370 !! options
12371 comment
12372 !! input
12373 I like the [[Main Page]] a lot
12374 !! result
12375 I like the <a href="/wiki/Main_Page" title="Main Page">Main Page</a> a lot
12376 !!end
12377
12378 !! test
12379 Edit comment with link and link text
12380 !! options
12381 comment
12382 !! input
12383 I like the [[Main Page|best pages]] a lot
12384 !! result
12385 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
12386 !!end
12387
12388 !! test
12389 Edit comment with link and link text with suffix
12390 !! options
12391 comment
12392 !! input
12393 I like the [[Main Page|best page]]s a lot
12394 !! result
12395 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
12396 !!end
12397
12398 !! test
12399 Edit comment with section link (non-local, eg in history list)
12400 !! options
12401 comment title=[[Main Page]]
12402 !! input
12403 /* External links */ removed bogus entries
12404 !! result
12405 <a href="/wiki/Main_Page#External_links" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
12406 !!end
12407
12408 !! test
12409 Edit comment with section link and text before it (non-local, eg in history list)
12410 !! options
12411 comment title=[[Main Page]]
12412 !! input
12413 pre-comment text /* External links */ removed bogus entries
12414 !! result
12415 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>
12416 !!end
12417
12418 !! test
12419 Edit comment with section link (local, eg in diff view)
12420 !! options
12421 comment local title=[[Main Page]]
12422 !! input
12423 /* External links */ removed bogus entries
12424 !! result
12425 <a href="#External_links">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
12426 !!end
12427
12428 !! test
12429 Edit comment with subpage link (bug 14080)
12430 !! options
12431 comment
12432 subpage
12433 title=[[Subpage test]]
12434 !! input
12435 Poked at a [[/subpage]] here...
12436 !! result
12437 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a> here...
12438 !!end
12439
12440 !! test
12441 Edit comment with subpage link and link text (bug 14080)
12442 !! options
12443 comment
12444 subpage
12445 title=[[Subpage test]]
12446 !! input
12447 Poked at a [[/subpage|neat little page]] here...
12448 !! result
12449 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">neat little page</a> here...
12450 !!end
12451
12452 !! test
12453 Edit comment with bogus subpage link in non-subpage NS (bug 14080)
12454 !! options
12455 comment
12456 title=[[Subpage test]]
12457 !! input
12458 Poked at a [[/subpage]] here...
12459 !! result
12460 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...
12461 !!end
12462
12463 !! test
12464 Edit comment with bare anchor link (local, as on diff)
12465 !! options
12466 comment
12467 local
12468 title=[[Main Page]]
12469 !!input
12470 [[#section]]
12471 !! result
12472 <a href="#section">#section</a>
12473 !! end
12474
12475 !! test
12476 Edit comment with bare anchor link (non-local, as on history)
12477 !! options
12478 comment
12479 title=[[Main Page]]
12480 !!input
12481 [[#section]]
12482 !! result
12483 <a href="/wiki/Main_Page#section" title="Main Page">#section</a>
12484 !! end
12485
12486 !! test
12487 Anchor starting with underscore
12488 !!input
12489 [[#_ref|One]]
12490 !! result
12491 <p><a href="#_ref">One</a>
12492 </p>
12493 !! end
12494
12495 !! test
12496 Id starting with underscore
12497 !!input
12498 <div id="_ref"></div>
12499 !! result
12500 <div id="_ref"></div>
12501
12502 !! end
12503
12504 !! test
12505 Space normalisation on autocomment (bug 22784)
12506 !! options
12507 comment
12508 title=[[Main Page]]
12509 !!input
12510 /* __hello__world__ */
12511 !! result
12512 <a href="/wiki/Main_Page#hello_world" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">__hello__world__</span></span>
12513 !! end
12514
12515 !! test
12516 percent-encoding and + signs in comments (Bug 26410)
12517 !! options
12518 comment
12519 !!input
12520 [[ABC%33D% ++]] [[ABC%33D% ++|+%20]]
12521 !! result
12522 <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>
12523 !! end
12524
12525 !! test
12526 Bad images - basic functionality
12527 !! options
12528 disabled
12529 !! input
12530 [[File:Bad.jpg]]
12531 !! result
12532 !! end
12533
12534 !! test
12535 Bad images - bug 16039: text after bad image disappears
12536 !! options
12537 disabled
12538 !! input
12539 Foo bar
12540 [[File:Bad.jpg]]
12541 Bar foo
12542 !! result
12543 <p>Foo bar
12544 </p><p>Bar foo
12545 </p>
12546 !! end
12547
12548 !! test
12549 Verify that displaytitle works (bug #22501) no displaytitle
12550 !! options
12551 showtitle
12552 !! config
12553 wgAllowDisplayTitle=true
12554 wgRestrictDisplayTitle=false
12555 !! input
12556 this is not the the title
12557 !! result
12558 Parser test
12559 <p>this is not the the title
12560 </p>
12561 !! end
12562
12563 !! test
12564 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=false
12565 !! options
12566 showtitle
12567 title=[[Screen]]
12568 !! config
12569 wgAllowDisplayTitle=true
12570 wgRestrictDisplayTitle=false
12571 !! input
12572 this is not the the title
12573 {{DISPLAYTITLE:whatever}}
12574 !! result
12575 whatever
12576 <p>this is not the the title
12577 </p>
12578 !! end
12579
12580 !! test
12581 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true mismatch
12582 !! options
12583 showtitle
12584 title=[[Screen]]
12585 !! config
12586 wgAllowDisplayTitle=true
12587 wgRestrictDisplayTitle=true
12588 !! input
12589 this is not the the title
12590 {{DISPLAYTITLE:whatever}}
12591 !! result
12592 Screen
12593 <p>this is not the the title
12594 </p>
12595 !! end
12596
12597 !! test
12598 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true matching
12599 !! options
12600 showtitle
12601 title=[[Screen]]
12602 !! config
12603 wgAllowDisplayTitle=true
12604 wgRestrictDisplayTitle=true
12605 !! input
12606 this is not the the title
12607 {{DISPLAYTITLE:screen}}
12608 !! result
12609 screen
12610 <p>this is not the the title
12611 </p>
12612 !! end
12613
12614 !! test
12615 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false
12616 !! options
12617 showtitle
12618 title=[[Screen]]
12619 !! config
12620 wgAllowDisplayTitle=false
12621 !! input
12622 this is not the the title
12623 {{DISPLAYTITLE:screen}}
12624 !! result
12625 Screen
12626 <p>this is not the the title
12627 <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>
12628 </p>
12629 !! end
12630
12631 !! test
12632 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false no DISPLAYTITLE
12633 !! options
12634 showtitle
12635 title=[[Screen]]
12636 !! config
12637 wgAllowDisplayTitle=false
12638 !! input
12639 this is not the the title
12640 !! result
12641 Screen
12642 <p>this is not the the title
12643 </p>
12644 !! end
12645
12646 !! test
12647 preload: check <noinclude> and <includeonly>
12648 !! options
12649 preload
12650 !! input
12651 Hello <noinclude>cruel</noinclude><includeonly>kind</includeonly> world.
12652 !! result
12653 Hello kind world.
12654 !! end
12655
12656 !! test
12657 preload: check <onlyinclude>
12658 !! options
12659 preload
12660 !! input
12661 Goodbye <onlyinclude>Hello world</onlyinclude>
12662 !! result
12663 Hello world
12664 !! end
12665
12666 !! test
12667 preload: can pass tags through if we want to
12668 !! options
12669 preload
12670 !! input
12671 <includeonly><</includeonly>includeonly>Hello world<includeonly><</includeonly>/includeonly>
12672 !! result
12673 <includeonly>Hello world</includeonly>
12674 !! end
12675
12676 !! test
12677 preload: check that it doesn't try to do tricks
12678 !! options
12679 preload
12680 !! input
12681 * <!-- Hello --> ''{{world}}'' {{<includeonly>subst:</includeonly>How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
12682 !! result
12683 * <!-- Hello --> ''{{world}}'' {{subst:How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
12684 !! end
12685
12686 !! test
12687 Play a bit with r67090 and bug 3158
12688 !! options
12689 disabled
12690 !! input
12691 <div style="width:50% !important">&nbsp;</div>
12692 <div style="width:50%&nbsp;!important">&nbsp;</div>
12693 <div style="width:50%&#160;!important">&nbsp;</div>
12694 <div style="border : solid;">&nbsp;</div>
12695 !! result
12696 <div style="width:50% !important">&nbsp;</div>
12697 <div style="width:50% !important">&nbsp;</div>
12698 <div style="width:50% !important">&nbsp;</div>
12699 <div style="border&#160;: solid;">&nbsp;</div>
12700
12701 !! end
12702
12703 !! test
12704 HTML5 data attributes
12705 !! input
12706 <span data-foo="bar">Baz</span>
12707 <p data-abc-def_hij="">Quuz</p>
12708 !! result
12709 <p><span data-foo="bar">Baz</span>
12710 </p>
12711 <p data-abc-def_hij="">Quuz</p>
12712
12713 !! end
12714
12715 !! test
12716 percent-encoding and + signs in internal links (Bug 26410)
12717 !! input
12718 [[User:+%]] [[Page+title%]]
12719 [[%+]] [[%+|%20]] [[%+ ]] [[%+r]]
12720 [[%]] [[+]] [[image:%+abc%39|foo|[[bar]]]]
12721 [[%33%45]] [[%33%45+]]
12722 !! result
12723 <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>
12724 <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>
12725 <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>
12726 <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>
12727 </p>
12728 !! end
12729
12730 !! test
12731 Special characters in embedded file links (bug 27679)
12732 !! input
12733 [[File:Contains & ampersand.jpg]]
12734 [[File:Does not exist.jpg|Title with & ampersand]]
12735 !! result
12736 <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>
12737 <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>
12738 </p>
12739 !! end
12740
12741
12742 !! test
12743 Confirm that 'apos' named character reference doesn't make it to output (not legal in HTML 4)
12744 !! input
12745 Text&apos;s been normalized?
12746 !! result
12747 <p>Text&#39;s been normalized?
12748 </p>
12749 !! end
12750
12751 !! test
12752 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate free external links
12753 !! input
12754 http://www.example.org/ <-- U+3000 (vim: ^Vu3000)
12755 !! result
12756 <p><a rel="nofollow" class="external free" href="http://www.example.org/">http://www.example.org/</a> &lt;-- U+3000 (vim: ^Vu3000)
12757 </p>
12758 !! end
12759
12760 !! test
12761 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate bracketed external links
12762 !! input
12763 [http://www.example.org/ ideograms]
12764 !! result
12765 <p><a rel="nofollow" class="external text" href="http://www.example.org/">ideograms</a>
12766 </p>
12767 !! end
12768
12769 !! test
12770 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate external images links
12771 !! input
12772 http://www.example.org/pic.png <-- U+3000 (vim: ^Vu3000)
12773 !! result
12774 <p><img src="http://www.example.org/pic.png" alt="pic.png" /> &lt;-- U+3000 (vim: ^Vu3000)
12775 </p>
12776 !! end
12777
12778 !! article
12779 Mediawiki:loop1
12780 !! text
12781 {{Identical|A}}
12782 !! endarticle
12783
12784 !! article
12785 Mediawiki:loop2
12786 !! text
12787 {{Identical|B}}
12788 !! endarticle
12789
12790 !! article
12791 Template:Identical
12792 !! text
12793 {{int:loop1}}
12794 {{int:loop2}}
12795 !! endarticle
12796
12797 !! test
12798 Bug 31098 Template which includes system messages which includes the template
12799 !! input
12800 {{Identical}}
12801 !! result
12802 <p><span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
12803 <span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
12804 </p>
12805 !! end
12806
12807 !! test
12808 Bug31490 Turkish: ucfirst 'blah'
12809 !! options
12810 language=tr
12811 !! input
12812 {{ucfirst:blah}}
12813 !! result
12814 <p>Blah
12815 </p>
12816 !! end
12817
12818 !! test
12819 Bug31490 Turkish: ucfirst 'ix'
12820 !! options
12821 language=tr
12822 !! input
12823 {{ucfirst:ix}}
12824 !! result
12825 <p>İx
12826 </p>
12827 !! end
12828
12829 !! test
12830 Bug31490 Turkish: lcfirst 'BLAH'
12831 !! options
12832 language=tr
12833 !! input
12834 {{lcfirst:BLAH}}
12835 !! result
12836 <p>bLAH
12837 </p>
12838 !! end
12839
12840 !! test
12841 Bug31490 Turkish: ucfırst (with a dotless i)
12842 !! options
12843 language=tr
12844 !! input
12845 {{ucfırst:blah}}
12846 !! result
12847 <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>
12848 </p>
12849 !! end
12850
12851 !! test
12852 Bug31490 ucfırst (with a dotless i) with English language
12853 !! options
12854 language=en
12855 !! input
12856 {{ucfırst:blah}}
12857 !! result
12858 <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>
12859 </p>
12860 !! end
12861
12862 !! test
12863 Bug 26375: TOC with italics
12864 !! options
12865 title=[[Main Page]]
12866 !! input
12867 __TOC__
12868 == ''Lost'' episodes ==
12869 !! result
12870 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
12871 <ul>
12872 <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>
12873 </ul>
12874 </td></tr></table>
12875 <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>
12876
12877 !! end
12878
12879 !! test
12880 Bug 26375: TOC with bold
12881 !! options
12882 title=[[Main Page]]
12883 !! input
12884 __TOC__
12885 == '''should be bold''' then normal text ==
12886 !! result
12887 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
12888 <ul>
12889 <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>
12890 </ul>
12891 </td></tr></table>
12892 <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>
12893
12894 !! end
12895
12896 !! test
12897 Bug 33845: Headings become cursive in TOC when they contain an image
12898 !! options
12899 title=[[Main Page]]
12900 !! input
12901 __TOC__
12902 == Image [[Image:foobar.jpg]] ==
12903 !! result
12904 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
12905 <ul>
12906 <li class="toclevel-1 tocsection-1"><a href="#Image"><span class="tocnumber">1</span> <span class="toctext">Image</span></a></li>
12907 </ul>
12908 </td></tr></table>
12909 <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>
12910
12911 !! end
12912
12913 !! test
12914 Bug 33845 (2): Headings become bold in TOC when they contain a blockquote
12915 !! options
12916 title=[[Main Page]]
12917 !! input
12918 __TOC__
12919 == <blockquote>Quote</blockquote> ==
12920 !! result
12921 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
12922 <ul>
12923 <li class="toclevel-1 tocsection-1"><a href="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
12924 </ul>
12925 </td></tr></table>
12926 <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>
12927
12928 !! end
12929
12930 !! test
12931 Unclosed tags in TOC
12932 !! options
12933 title=[[Main Page]]
12934 !! input
12935 __TOC__
12936 == Proof: 2 < 3 ==
12937 <small>Hanc marginis exiguitas non caperet.</small>
12938 QED
12939 !! result
12940 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
12941 <ul>
12942 <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>
12943 </ul>
12944 </td></tr></table>
12945 <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>
12946 <p><small>Hanc marginis exiguitas non caperet.</small>
12947 QED
12948 </p>
12949 !! end
12950
12951 !! test
12952 Multiple tags in TOC
12953 !! input
12954 __TOC__
12955 == <i>Foo</i> <b>Bar</b> ==
12956
12957 == <i>Foo</i> <blockquote>Bar</blockquote> ==
12958 !! result
12959 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
12960 <ul>
12961 <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>
12962 <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>
12963 </ul>
12964 </td></tr></table>
12965 <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>
12966 <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>
12967
12968 !! end
12969
12970 !! test
12971 Tags with parameters in TOC
12972 !! input
12973 __TOC__
12974 == <sup class="in-h2">Hello</sup> ==
12975
12976 == <sup class="a > b">Evilbye</sup> ==
12977 !! result
12978 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
12979 <ul>
12980 <li class="toclevel-1 tocsection-1"><a href="#Hello"><span class="tocnumber">1</span> <span class="toctext"><sup>Hello</sup></span></a></li>
12981 <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>
12982 </ul>
12983 </td></tr></table>
12984 <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>
12985 <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>
12986
12987 !! end
12988
12989 !! test
12990 span tags with directionality in TOC
12991 !! input
12992 __TOC__
12993 == <span dir="ltr">C++</span> ==
12994
12995 == <span dir="rtl">זבנג!</span> ==
12996
12997 == <span style="font-style: italic">The attributes on these span tags must be deleted from the TOC</span> ==
12998
12999 == <span style="font-style: italic" dir="ltr">All attributes on these span tags must be deleted from the TOC</span> ==
13000
13001 == <span dir="ltr" style="font-style: italic">Attributes after dir on these span tags must be deleted from the TOC</span> ==
13002 !! result
13003 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
13004 <ul>
13005 <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>
13006 <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>
13007 <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>
13008 <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>
13009 <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>
13010 </ul>
13011 </td></tr></table>
13012 <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>
13013 <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>
13014 <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>
13015 <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>
13016 <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>
13017
13018 !! end
13019
13020 !! article
13021 MediaWiki:Bug32057
13022 !! text
13023 == {{int:headline_sample}} ==
13024 !! endarticle
13025
13026 !! test
13027 Bug 32057: Title needed when expanding <h> nodes.
13028 !! options
13029 title=[[Main Page]]
13030 !! input
13031 {{int:Bug32057}}
13032 !! result
13033 <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>
13034
13035 !! end
13036
13037 !! test
13038 Strip marker in urlencode
13039 !! input
13040 {{urlencode:x<nowiki/>y}}
13041 {{urlencode:x<nowiki/>y|wiki}}
13042 {{urlencode:x<nowiki/>y|path}}
13043 !! result
13044 <p>xy
13045 xy
13046 xy
13047 </p>
13048 !! end
13049
13050 !! test
13051 Strip marker in lc
13052 !! input
13053 {{lc:x<nowiki/>y}}
13054 !! result
13055 <p>xy
13056 </p>
13057 !! end
13058
13059 !! test
13060 Strip marker in uc
13061 !! input
13062 {{uc:x<nowiki/>y}}
13063 !! result
13064 <p>XY
13065 </p>
13066 !! end
13067
13068 !! test
13069 Strip marker in formatNum
13070 !! input
13071 {{formatnum:1<nowiki/>2}}
13072 {{formatnum:1<nowiki/>2|R}}
13073 !! result
13074 <p>12
13075 12
13076 </p>
13077 !! end
13078
13079 !! test
13080 Check noCommafy in formatNum
13081 !! options
13082 language=be-tarask
13083 !! input
13084 {{formatnum:123456.78}}
13085 {{formatnum:123456.78|NOSEP}}
13086 !! result
13087 <p>123 456,78
13088 123456.78
13089 </p>
13090 !! end
13091
13092 !! test
13093 Strip marker in grammar
13094 !! options
13095 language=fi
13096 !! input
13097 {{grammar:elative|foo<nowiki/>bar}}
13098 !! result
13099 <p>foobarista
13100 </p>
13101 !! end
13102
13103 !! test
13104 Strip marker in padleft
13105 !! input
13106 {{padleft:|2|x<nowiki/>y}}
13107 !! result
13108 <p>xy
13109 </p>
13110 !! end
13111
13112 !! test
13113 Strip marker in padright
13114 !! input
13115 {{padright:|2|x<nowiki/>y}}
13116 !! result
13117 <p>xy
13118 </p>
13119 !! end
13120
13121 !! test
13122 Strip marker in anchorencode
13123 !! input
13124 {{anchorencode:x<nowiki/>y}}
13125 !! result
13126 <p>xy
13127 </p>
13128 !! end
13129
13130 !! test
13131 nowiki inside link inside heading (bug 18295)
13132 !! input
13133 ==[[foo|x<nowiki>y</nowiki>z]]==
13134 !! result
13135 <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>
13136
13137 !! end
13138
13139 !! test
13140 new support for bdi element (bug 31817)
13141 !! input
13142 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
13143 !! result
13144 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
13145
13146 !!end
13147
13148 !! test
13149 Ignore pipe between table row attributes
13150 !! input
13151 {|
13152 | quux
13153 |- id=foo | style='color: red'
13154 | bar
13155 |}
13156 !! result
13157 <table>
13158 <tr>
13159 <td> quux
13160 </td></tr>
13161 <tr id="foo" style="color: red">
13162 <td> bar
13163 </td></tr></table>
13164
13165 !! end
13166
13167 !!test
13168 Gallery override link with WikiLink (bug 34852)
13169 !! input
13170 <gallery>
13171 File:foobar.jpg|caption|alt=galleryalt|link=InterWikiLink
13172 </gallery>
13173 !! result
13174 <ul class="gallery">
13175 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
13176 <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>
13177 <div class="gallerytext">
13178 <p>caption
13179 </p>
13180 </div>
13181 </div></li>
13182 </ul>
13183
13184 !! end
13185
13186 !!test
13187 Gallery override link with absolute external link (bug 34852)
13188 !! input
13189 <gallery>
13190 File:foobar.jpg|caption|alt=galleryalt|link=http://www.example.org
13191 </gallery>
13192 !! result
13193 <ul class="gallery">
13194 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
13195 <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>
13196 <div class="gallerytext">
13197 <p>caption
13198 </p>
13199 </div>
13200 </div></li>
13201 </ul>
13202
13203 !! end
13204
13205 !!test
13206 Gallery override link with malicious javascript (bug 34852)
13207 !! input
13208 <gallery>
13209 File:foobar.jpg|caption|alt=galleryalt|link=" onclick="alert('malicious javascript code!');
13210 </gallery>
13211 !! result
13212 <ul class="gallery">
13213 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
13214 <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>
13215 <div class="gallerytext">
13216 <p>caption
13217 </p>
13218 </div>
13219 </div></li>
13220 </ul>
13221
13222 !! end
13223
13224 !!test
13225 Gallery with invalid title as link (bug 43964)
13226 !! input
13227 <gallery>
13228 File:foobar.jpg|link=<
13229 </gallery>
13230 !! result
13231 <ul class="gallery">
13232 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
13233 <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>
13234 <div class="gallerytext">
13235 </div>
13236 </div></li>
13237 </ul>
13238
13239 !! end
13240
13241 !!test
13242 Language parser function
13243 !! input
13244 {{#language:ar}}
13245 !! result
13246 <p>العربية
13247 </p>
13248 !! end
13249
13250 !!test
13251 Padleft and padright as substr
13252 !! input
13253 {{padleft:|3|abcde}}
13254 {{padright:|3|abcde}}
13255 !! result
13256 <p>abc
13257 abc
13258 </p>
13259 !! end
13260
13261 !!test
13262 Bug 34939 - Case insensitive link parsing ([HttP://])
13263 !! input
13264 [HttP://MediaWiki.Org/]
13265 !! result
13266 <p><a rel="nofollow" class="external autonumber" href="HttP://MediaWiki.Org/">[1]</a>
13267 </p>
13268 !! end
13269
13270 !!test
13271 Bug 34939 - Case insensitive link parsing ([HttP:// title])
13272 !! input
13273 [HttP://MediaWiki.Org/ MediaWiki]
13274 !! result
13275 <p><a rel="nofollow" class="external text" href="HttP://MediaWiki.Org/">MediaWiki</a>
13276 </p>
13277 !! end
13278
13279 !!test
13280 Bug 34939 - Case insensitive link parsing (HttP://)
13281 !! input
13282 HttP://MediaWiki.Org/
13283 !! result
13284 <p><a rel="nofollow" class="external free" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a>
13285 </p>
13286 !! end
13287
13288 ###
13289 ### Parsoids-specific tests
13290 ### Parsoid-PHP parser incompatibilities
13291 ###
13292 !!test
13293 1. SOL-sensitive wikitext tokens as template-args
13294 !!options
13295 disabled
13296 !!input
13297 {{echo|*a}}
13298 {{echo|#a}}
13299 {{echo|:a}}
13300 !!result
13301 <p>*a
13302 #a
13303 :a
13304 </p>
13305 !!end
13306
13307 #### The following section of tests are primarily to test
13308 #### wikitext escaping capabilities of Parsoid.
13309 #### A lot of the tests are disabled for the PHP parser either
13310 #### because of minor newline diffs or other reasons.
13311 #### As Parsoid serializer can handle newlines and other HTML
13312 #### more robustly, some of these tests might get reenabled
13313 #### for the PHP parser.
13314
13315 #### --------------- Headings ---------------
13316 #### 0. Unnested
13317 #### 1. Nested inside html <h1>=foo=</h1>
13318 #### 2. Outside heading nest on a single line <h1>foo</h1>*bar
13319 #### 3. Nested inside html with wikitext split by html tags
13320 #### 4. No escape needed
13321 #### 5. Empty headings <h1></h1>
13322 #### 6. Heading chars in SOL context
13323 #### ----------------------------------------
13324 !! test
13325 Headings: 0. Unnested
13326 !! input
13327 <nowiki>=foo=</nowiki>
13328
13329 <nowiki>=foo</nowiki>''a''=
13330 !! result
13331 <p>=foo=
13332 </p><p>=foo<i>a</i>=
13333 </p>
13334 !!end
13335
13336 !! test
13337 Headings: 1. Nested inside html
13338 !! options
13339 disabled
13340 !! input
13341 =<nowiki>=foo=</nowiki>=
13342 ==<nowiki>=foo=</nowiki>==
13343 ===<nowiki>=foo=</nowiki>===
13344 ====<nowiki>=foo=</nowiki>====
13345 =====<nowiki>=foo=</nowiki>=====
13346 ======<nowiki>=foo=</nowiki>======
13347 !! result
13348 <h1>=foo=</h1>
13349 <h2>=foo=</h2>
13350 <h3>=foo=</h3>
13351 <h4>=foo=</h4>
13352 <h5>=foo=</h5>
13353 <h6>=foo=</h6>
13354 !!end
13355
13356 !! test
13357 Headings: 2. Outside heading nest on a single line <h1>foo</h1>*bar
13358 !! options
13359 disabled
13360 !! input
13361 =foo=
13362 <nowiki>*bar</nowiki>
13363 =foo=
13364 =bar
13365 =foo=
13366 <nowiki>=bar=</nowiki>
13367 !! result
13368 <h1>foo</h1>*bar
13369 <h1>foo</h1>=bar
13370 <h1>foo</h1>=bar=
13371 !!end
13372
13373 !! test
13374 Headings: 3. Nested inside html with wikitext split by html tags
13375 !! options
13376 disabled
13377 !! input
13378 =<nowiki>=</nowiki>'''bold'''foo==
13379 !! result
13380 <h1>=<b>bold</b>foo=</h1>
13381 !!end
13382
13383 !! test
13384 Headings: 4. No escaping needed (testing just h1 and h2)
13385 !! options
13386 disabled
13387 !! input
13388 ==foo=
13389 =foo==
13390 ===foo==
13391 ==foo===
13392 =''=''foo==
13393 ===
13394 !! result
13395 <h1>=foo</h1>
13396 <h1>foo=</h1>
13397 <h2>=foo</h2>
13398 <h2>foo=</h2>
13399 <h1><i>=</i>foo=</h1>
13400 <h1>=</h1>
13401 !!end
13402
13403 !! test
13404 Headings: 5. Empty headings
13405 !! options
13406 disabled
13407 !! input
13408 =<nowiki></nowiki>=
13409 ==<nowiki></nowiki>==
13410 ===<nowiki></nowiki>===
13411 ====<nowiki></nowiki>====
13412 =====<nowiki></nowiki>=====
13413 ======<nowiki></nowiki>======
13414 !! result
13415 <h1></h1>
13416 <h2></h2>
13417 <h3></h3>
13418 <h4></h4>
13419 <h5></h5>
13420 <h6></h6>
13421 !!end
13422
13423 !! test
13424 Headings: 6. Heading chars in SOL context
13425 !! options
13426 disabled
13427 !! input
13428 <!--cmt--><nowiki>=h1=</nowiki>
13429 !! result
13430 <p><!--cmt-->=h1=
13431 </p>
13432 !!end
13433
13434 #### --------------- Lists ---------------
13435 #### 0. Outside nests (*foo, etc.)
13436 #### 1. Nested inside html <ul><li>*foo</li></ul>
13437 #### 2. Inside definition lists
13438 #### 3. Only bullets at start should be escaped
13439 #### 4. No escapes needed
13440 #### 5. No unnecessary escapes
13441 #### 6. Escape bullets in SOL position
13442 #### 7. Escape bullets in a multi-line context
13443 #### ----------------------------------------
13444
13445 !! test
13446 Lists: 0. Outside nests
13447 !! input
13448 <nowiki>*foo</nowiki>
13449
13450 <nowiki>#foo</nowiki>
13451 !! result
13452 <p>*foo
13453 </p><p>#foo
13454 </p>
13455 !!end
13456
13457 !! test
13458 Lists: 1. Nested inside html
13459 !! input
13460 *<nowiki>*foo</nowiki>
13461
13462 *<nowiki>#foo</nowiki>
13463
13464 *<nowiki>:foo</nowiki>
13465
13466 *<nowiki>;foo</nowiki>
13467
13468 #<nowiki>*foo</nowiki>
13469
13470 #<nowiki>#foo</nowiki>
13471
13472 #<nowiki>:foo</nowiki>
13473
13474 #<nowiki>;foo</nowiki>
13475 !! result
13476 <ul><li>*foo
13477 </li></ul>
13478 <ul><li>#foo
13479 </li></ul>
13480 <ul><li>:foo
13481 </li></ul>
13482 <ul><li>;foo
13483 </li></ul>
13484 <ol><li>*foo
13485 </li></ol>
13486 <ol><li>#foo
13487 </li></ol>
13488 <ol><li>:foo
13489 </li></ol>
13490 <ol><li>;foo
13491 </li></ol>
13492
13493 !!end
13494
13495 !! test
13496 Lists: 2. Inside definition lists
13497 !! input
13498 ;<nowiki>;foo</nowiki>
13499
13500 ;<nowiki>:foo</nowiki>
13501
13502 ;<nowiki>:foo</nowiki>
13503 :bar
13504
13505 :<nowiki>:foo</nowiki>
13506 !! result
13507 <dl><dt>;foo
13508 </dt></dl>
13509 <dl><dt>:foo
13510 </dt></dl>
13511 <dl><dt>:foo
13512 </dt><dd>bar
13513 </dd></dl>
13514 <dl><dd>:foo
13515 </dd></dl>
13516
13517 !!end
13518
13519 !! test
13520 Lists: 3. Only bullets at start of text should be escaped
13521 !! input
13522 *<nowiki>*foo*bar</nowiki>
13523
13524 *<nowiki>*foo</nowiki>''it''*bar
13525 !! result
13526 <ul><li>*foo*bar
13527 </li></ul>
13528 <ul><li>*foo<i>it</i>*bar
13529 </li></ul>
13530
13531 !!end
13532
13533 !! test
13534 Lists: 4. No escapes needed
13535 !! options
13536 disabled
13537 !! input
13538 *foo*bar
13539
13540 *''foo''*bar
13541
13542 *[[Foo]]: bar
13543 !! result
13544 <ul><li>foo*bar
13545 </li></ul>
13546 <ul><li><i>foo</i>*bar
13547 </li></ul>
13548 <ul><li><a href="Foo" rel="mw:WikiLink">Foo</a>: bar
13549 </li></ul>
13550 !!end
13551
13552 !! test
13553 Lists: 5. No unnecessary escapes
13554 !! input
13555 * bar <span><nowiki>[[foo]]</nowiki></span>
13556
13557 *=bar <span><nowiki>[[foo]]</nowiki></span>
13558
13559 *[[bar <span><nowiki>[[foo]]</nowiki></span>
13560
13561 *<nowiki>]]bar </nowiki><span><nowiki>[[foo]]</nowiki></span>
13562
13563 *=bar <span>foo]]</span>=
13564 !! result
13565 <ul><li> bar <span>[[foo]]</span>
13566 </li></ul>
13567 <ul><li>=bar <span>[[foo]]</span>
13568 </li></ul>
13569 <ul><li>[[bar <span>[[foo]]</span>
13570 </li></ul>
13571 <ul><li>]]bar <span>[[foo]]</span>
13572 </li></ul>
13573 <ul><li>=bar <span>foo]]</span>=
13574 </li></ul>
13575
13576 !!end
13577
13578 !! test
13579 Lists: 6. Escape bullets in SOL position
13580 !! options
13581 disabled
13582 !! input
13583 <!--cmt--><nowiki>*foo</nowiki>
13584 !! result
13585 <p><!--cmt-->*foo
13586 </p>
13587 !!end
13588
13589 !! test
13590 Lists: 7. Escape bullets in a multi-line context
13591 !! input
13592 <nowiki>a
13593 *b</nowiki>
13594 !! result
13595 <p>a
13596 *b
13597 </p>
13598 !!end
13599
13600 #### --------------- HRs ---------------
13601 #### 1. Single line
13602 #### -----------------------------------
13603
13604 !! test
13605 HRs: 1. Single line
13606 !! options
13607 disabled
13608 !! input
13609 ----
13610 <nowiki>----</nowiki>
13611 ----
13612 <nowiki>=foo=</nowiki>
13613 ----
13614 <nowiki>*foo</nowiki>
13615 !! result
13616 <hr/>----
13617 <hr/>=foo=
13618 <hr/>*foo
13619 !! end
13620
13621 #### --------------- Tables ---------------
13622 #### 1a. Simple example
13623 #### 1b. No escaping needed (!foo)
13624 #### 1c. No escaping needed (|foo)
13625 #### 1d. No escaping needed (|}foo)
13626 ####
13627 #### 2a. Nested in td (<td>foo|bar</td>)
13628 #### 2b. Nested in td (<td>foo||bar</td>)
13629 #### 2c. Nested in td -- no escaping needed(<td>foo!!bar</td>)
13630 ####
13631 #### 3a. Nested in th (<th>foo!bar</th>)
13632 #### 3b. Nested in th (<th>foo!!bar</th>)
13633 #### 3c. Nested in th -- no escaping needed(<th>foo||bar</th>)
13634 ####
13635 #### 4a. Escape -
13636 #### 4b. Escape +
13637 #### 4c. No escaping needed
13638 #### --------------------------------------
13639
13640 !! test
13641 Tables: 1a. Simple example
13642 !! input
13643 <nowiki>{|
13644 |}</nowiki>
13645 !! result
13646 <p>{|
13647 |}
13648 </p>
13649 !! end
13650
13651 !! test
13652 Tables: 1b. No escaping needed
13653 !! input
13654 !foo
13655 !! result
13656 <p>!foo
13657 </p>
13658 !! end
13659
13660 !! test
13661 Tables: 1c. No escaping needed
13662 !! input
13663 |foo
13664 !! result
13665 <p>|foo
13666 </p>
13667 !! end
13668
13669 !! test
13670 Tables: 1d. No escaping needed
13671 !! input
13672 |}foo
13673 !! result
13674 <p>|}foo
13675 </p>
13676 !! end
13677
13678 !! test
13679 Tables: 2a. Nested in td
13680 !! options
13681 disabled
13682 !! input
13683 {|
13684 |<nowiki>foo|bar</nowiki>
13685 |}
13686 !! result
13687 <table>
13688 <tr><td>foo|bar
13689 </td></tr></table>
13690
13691 !! end
13692
13693 !! test
13694 Tables: 2b. Nested in td
13695 !! options
13696 disabled
13697 !! input
13698 {|
13699 |<nowiki>foo||bar</nowiki>
13700 |''it''<nowiki>foo||bar</nowiki>
13701 |}
13702 !! result
13703 <table>
13704 <tr><td>foo||bar
13705 </td><td><i>it</i>foo||bar
13706 </td></tr></table>
13707
13708 !! end
13709
13710 !! test
13711 Tables: 2c. Nested in td -- no escaping needed
13712 !! options
13713 disabled
13714 !! input
13715 {|
13716 |foo!!bar
13717 |}
13718 !! result
13719 <table>
13720 <tr><td>foo!!bar
13721 </td></tr></table>
13722
13723 !! end
13724
13725 !! test
13726 Tables: 3a. Nested in th
13727 !! options
13728 disabled
13729 !! input
13730 {|
13731 !foo!bar
13732 |}
13733 !! result
13734 <table>
13735 <tr><th>foo!bar
13736 </th></tr></table>
13737
13738 !! end
13739
13740 !! test
13741 Tables: 3b. Nested in th
13742 !! options
13743 disabled
13744 !! input
13745 {|
13746 !<nowiki>foo!!bar</nowiki>
13747 |}
13748 !! result
13749 <table>
13750 <tr><th>foo!!bar
13751 </th></tr></table>
13752
13753 !! end
13754
13755 !! test
13756 Tables: 3c. Nested in th -- no escaping needed
13757 !! options
13758 disabled
13759 !! input
13760 {|
13761 !foo||bar
13762 |}
13763 !! result
13764 <table>
13765 <tr><th>foo||bar
13766 </th></tr></table>
13767
13768 !! end
13769
13770 !! test
13771 Tables: 4a. Escape -
13772 !! options
13773 disabled
13774 !! input
13775 {|
13776 |-
13777 !-bar
13778 |-
13779 |<nowiki>-bar</nowiki>
13780 |}
13781 !! result
13782 <table><tbody>
13783 <tr><th>-bar</th></tr>
13784 <tr><td>-bar</td></tr>
13785 </tbody></table>
13786 !! end
13787
13788 !! test
13789 Tables: 4b. Escape +
13790 !! options
13791 disabled
13792 !! input
13793 {|
13794 |-
13795 !+bar
13796 |-
13797 |<nowiki>+bar</nowiki>
13798 |}
13799 !! result
13800 <table><tbody>
13801 <tr><th>+bar</th></tr>
13802 <tr><td>+bar</td></tr>
13803 </tbody></table>
13804 !! end
13805
13806 !! test
13807 Tables: 4c. No escaping needed
13808 !! options
13809 disabled
13810 !! input
13811 {|
13812 |-
13813 |foo-bar
13814 |foo+bar
13815 |-
13816 |''foo''-bar
13817 |''foo''+bar
13818 |}
13819 !! result
13820 <table><tbody>
13821 <tr><td>foo-bar</td><td>foo+bar</td></tr>
13822 <tr><td><i>foo</i>-bar</td><td><i>foo</i>+bar</td></tr>
13823 </tbody></table>
13824 !! end
13825
13826 !! test
13827 Tables: 4d. No escaping needed
13828 !! input
13829 {|
13830 ||+1
13831 ||-2
13832 |}
13833 !! result
13834 <table>
13835 <tr>
13836 <td>+1
13837 </td>
13838 <td>-2
13839 </td></tr></table>
13840
13841 !! end
13842
13843 #### --------------- Links ---------------
13844 #### 1. Quote marks in link text
13845 #### 2. Wikilinks: Escapes needed
13846 #### 3. Wikilinks: No escapes needed
13847 #### 4. Extlinks: Escapes needed
13848 #### 5. Extlinks: No escapes needed
13849 #### --------------------------------------
13850 !! test
13851 Links 1. Quote marks in link text
13852 !! options
13853 disabled
13854 !! input
13855 [[Foo|<nowiki>Foo''boo''</nowiki>]]
13856 !! result
13857 <a rel="mw:WikiLink" href="Foo">Foo''boo''</a>
13858 !! end
13859
13860 !! test
13861 Links 2. WikiLinks: Escapes needed
13862 !! options
13863 disabled
13864 !! input
13865 [[Foo|<nowiki>[Foobar]</nowiki>]]
13866 [[Foo|<nowiki>Foobar]</nowiki>]]
13867 [[Foo|<nowiki>x [Foobar] x</nowiki>]]
13868 [[Foo|<nowiki>x [http://google.com g] x</nowiki>]]
13869 [[Foo|<nowiki>[[Bar]]</nowiki>]]
13870 [[Foo|<nowiki>x [[Bar]] x</nowiki>]]
13871 [[Foo|<nowiki>|Bar</nowiki>]]
13872 !! result
13873 <a href="Foo" rel="mw:WikiLink">[Foobar]</a>
13874 <a href="Foo" rel="mw:WikiLink">Foobar]</a>
13875 <a href="Foo" rel="mw:WikiLink">x [Foobar] x</a>
13876 <a href="Foo" rel="mw:WikiLink">x [http://google.com g] x</a>
13877 <a href="Foo" rel="mw:WikiLink">[[Bar]]</a>
13878 <a href="Foo" rel="mw:WikiLink">x [[Bar]] x</a>
13879 <a href="Foo" rel="mw:WikiLink">|Bar</a>
13880 !! end
13881
13882 !! test
13883 Links 3. WikiLinks: No escapes needed
13884 !! options
13885 disabled
13886 !! input
13887 [[Foo|[Foobar]]
13888 [[Foo|foo|bar]]
13889 !! result
13890 <a href="Foo" rel="mw:WikiLink">[Foobar</a>
13891 <a href="Foo" rel="mw:WikiLink">foo|bar</a>
13892 !! end
13893
13894 !! test
13895 Links 4. ExtLinks: Escapes needed
13896 !! options
13897 disabled
13898 !! input
13899 [http://google.com <nowiki>[google]</nowiki>]
13900 [http://google.com <nowiki>google]</nowiki>]
13901 !! result
13902 <a href="http://google.com" rel="mw:ExtLink">[google]</a>
13903 <a href="http://google.com" rel="mw:ExtLink">google]</a>
13904 !! end
13905
13906 !! test
13907 Links 5. ExtLinks: No escapes needed
13908 !! options
13909 disabled
13910 !! input
13911 [http://google.com [google]
13912 !! result
13913 <a href="http://google.com" rel="mw:ExtLink">[google</a>
13914 !! end
13915
13916 #### --------------- Quotes ---------------
13917 #### 1. Quotes inside <b> and <i>
13918 #### 2. Link fragments separated by <i> and <b> tags
13919 #### 3. Link fragments inside <i> and <b>
13920 #### --------------------------------------
13921 !! test
13922 1. Quotes inside <b> and <i>
13923 !! input
13924 ''<nowiki>'foo'</nowiki>''
13925 ''<nowiki>''foo''</nowiki>''
13926 ''<nowiki>'''foo'''</nowiki>''
13927 '''<nowiki>'foo'</nowiki>'''
13928 '''<nowiki>''foo''</nowiki>'''
13929 '''<nowiki>'''foo'''</nowiki>'''
13930 '''<nowiki>foo'</nowiki>''<nowiki>bar'</nowiki>''baz'''
13931 !! result
13932 <p><i>'foo'</i>
13933 <i>''foo''</i>
13934 <i>'''foo'''</i>
13935 <b>'foo'</b>
13936 <b>''foo''</b>
13937 <b>'''foo'''</b>
13938 <b>foo'<i>bar'</i>baz</b>
13939 </p>
13940 !! end
13941
13942 !! test
13943 2. Link fragments separated by <i> and <b> tags
13944 !! input
13945 [[''foo''<nowiki>hello]]</nowiki>
13946
13947 [['''foo'''<nowiki>hello]]</nowiki>
13948 !! result
13949 <p>[[<i>foo</i>hello]]
13950 </p><p>[[<b>foo</b>hello]]
13951 </p>
13952 !! end
13953
13954 !! test
13955 2. Link fragments inside <i> and <b>
13956 (FIXME: Escaping one or both of [[ and ]] is also acceptable --
13957 this is one of the shortcomings of this format)
13958 !! input
13959 ''[[foo''<nowiki>]]</nowiki>
13960
13961 '''[[foo'''<nowiki>]]</nowiki>
13962 !! result
13963 <p><i>[[foo</i>]]
13964 </p><p><b>[[foo</b>]]
13965 </p>
13966 !! end
13967
13968 #### --------------- Paragraphs ---------------
13969 #### 1. No unnecessary escapes
13970 #### --------------------------------------
13971
13972 !! test
13973 1. No unnecessary escapes
13974 !! input
13975 bar <span><nowiki>[[foo]]</nowiki></span>
13976
13977 =bar <span><nowiki>[[foo]]</nowiki></span>
13978
13979 [[bar <span><nowiki>[[foo]]</nowiki></span>
13980
13981 <nowiki>]]bar </nowiki><span><nowiki>[[foo]]</nowiki></span>
13982
13983 <nowiki>=bar </nowiki><span>foo]]</span>=
13984 !! result
13985 <p>bar <span>[[foo]]</span>
13986 </p><p>=bar <span>[[foo]]</span>
13987 </p><p>[[bar <span>[[foo]]</span>
13988 </p><p>]]bar <span>[[foo]]</span>
13989 </p><p>=bar <span>foo]]</span>=
13990 </p>
13991 !!end
13992
13993 #### --------------- PRE ------------------
13994 #### 1. Leading space in SOL context should be escaped
13995 #### --------------------------------------
13996 !! test
13997 1. Leading space in SOL context should be escaped
13998 !! options
13999 disabled
14000 !! input
14001 <nowiki> foo</nowiki>
14002 <!--cmt--><nowiki> foo</nowiki>
14003 !! result
14004 <p> foo
14005 <!--cmt--> foo
14006 </p>
14007 !! end
14008
14009 #### --------------- HTML tags ---------------
14010 #### 1. a tags
14011 #### 2. other tags
14012 #### 3. multi-line html tag
14013 #### --------------------------------------
14014 !! test
14015 1. a tags
14016 !! options
14017 disabled
14018 !! input
14019 <a href="http://google.com">google</a>
14020 !! result
14021 &lt;a href=&quot;http://google.com&quot;&gt;google&lt;/a&gt;
14022 !! end
14023
14024 !! test
14025 2. other tags
14026 !! input
14027 <nowiki><div>foo</div>
14028 <div style="color:red">foo</div></nowiki>
14029 !! result
14030 <p>&lt;div&gt;foo&lt;/div&gt;
14031 &lt;div style=&quot;color:red&quot;&gt;foo&lt;/div&gt;
14032 </p>
14033 !! end
14034
14035 !! test
14036 3. multi-line html tag
14037 !! input
14038 <nowiki><div
14039 >foo</div
14040 ></nowiki>
14041 !! result
14042 <p>&lt;div
14043 &gt;foo&lt;/div
14044 &gt;
14045 </p>
14046 !! end
14047
14048 #### --------------- Others ---------------
14049 !! test
14050 Escaping nowikis
14051 !! input
14052 &lt;nowiki&gt;foo&lt;/nowiki&gt;
14053 !! result
14054 <p>&lt;nowiki&gt;foo&lt;/nowiki&gt;
14055 </p>
14056 !! end
14057
14058 !! test
14059 Tag-like HTML structures are passed through as text
14060 !! input
14061 <x y>
14062
14063 <x.y>
14064
14065 <x-y>
14066
14067 1>2
14068
14069 x<y
14070
14071 a>b
14072
14073 1<d e>f
14074 !! result
14075 <p>&lt;x y&gt;
14076 </p><p>&lt;x.y&gt;
14077 </p><p>&lt;x-y&gt;
14078 </p><p>1&gt;2
14079 </p><p>x&lt;y
14080 </p><p>a&gt;b
14081 </p><p>1&lt;d e&gt;f
14082 </p>
14083 !! end
14084
14085
14086 # This fails in the PHP parser (see bug 40670,
14087 # https://bugzilla.wikimedia.org/show_bug.cgi?id=40670), so disabled for it.
14088 !! test
14089 Tag names followed by punctuation should not be recognized as tags
14090 !! options
14091 disabled
14092 !! input
14093 <s.ome> text
14094 !! result
14095 <p>&lt;s.ome&gt text
14096 </p>
14097 !! end
14098
14099 !! test
14100 HTML tag with necessary entities in attributes
14101 !! input
14102 <span title="&amp;amp;">foo</span>
14103 !! result
14104 <p><span title="&amp;amp;">foo</span>
14105 </p>
14106 !! end
14107
14108 !! test
14109 HTML tag with 'unnecessary' entity encoding in attributes
14110 !! input
14111 <span title="&amp;">foo</span>
14112 !! result
14113 <p><span title="&amp;">foo</span>
14114 </p>
14115 !! end
14116
14117 !! test
14118 HTML tag with broken attribute value quoting
14119 !! input
14120 <span title="Hello world>Foo</span>
14121 !! result
14122 <p><span>Foo</span>
14123 </p>
14124 !! end
14125
14126 !! test
14127 Parsoid-only: HTML tag with broken attribute value quoting
14128 !! options
14129 parsoid
14130 !! input
14131 <span title="Hello world>Foo</span>
14132 !! result
14133 <p><span title="Hello world">Foo</span>
14134 </p>
14135 !! end
14136
14137 !! test
14138 Table with broken attribute value quoting
14139 !! input
14140 {|
14141 | title="Hello world|Foo
14142 |}
14143 !! result
14144 <table>
14145 <tr>
14146 <td>Foo
14147 </td></tr></table>
14148
14149 !! end
14150
14151 !! test
14152 Table with broken attribute value quoting on consecutive lines
14153 !! input
14154 {|
14155 | title="Hello world|Foo
14156 | style="color:red|Bar
14157 |}
14158 !! result
14159 <table>
14160 <tr>
14161 <td>Foo
14162 </td>
14163 <td>Bar
14164 </td></tr></table>
14165
14166 !! end
14167
14168 !! test
14169 Parsoid-only: Table with broken attribute value quoting on consecutive lines
14170 !! options
14171 parsoid
14172 !! input
14173 {|
14174 | title="Hello world|Foo
14175 | style="color:red|Bar
14176 |}
14177 !! result
14178 <table>
14179 <tr>
14180 <td title="Hello world">Foo
14181 </td><td style="color: red">Bar
14182 </td></tr></table>
14183
14184 !! end
14185
14186 !! test
14187 Parsoid-only: Don't wrap broken template tags in <nowiki> on wt2wt (Bug 42353)
14188 !! options
14189 parsoid
14190 !! input
14191 {{}}
14192 !! result
14193 {{}}
14194 !! end
14195
14196 !! test
14197 Parsoid-only: Don't wrap broken template tags in <nowiki> on wt2wt (Bug 42353)
14198 !! options
14199 parsoid
14200 !! input
14201 }}{{
14202 !! result
14203 }}{{
14204 !! end
14205
14206 !!test
14207 Accept empty td cell attribute
14208 !!input
14209 {|
14210 | align="center" | foo || |
14211 |}
14212 !!result
14213 <table>
14214 <tr>
14215 <td align="center"> foo </td>
14216 <td>
14217 </td></tr></table>
14218
14219 !!end
14220
14221 !!test
14222 Non-empty attributes in th-cells
14223 !!input
14224 {|
14225 ! Foo !! style="color: red" | Bar
14226 |}
14227 !!result
14228 <table>
14229 <tr>
14230 <th> Foo </th>
14231 <th style="color: red"> Bar
14232 </th></tr></table>
14233
14234 !!end
14235
14236 !!test
14237 Accept empty attributes in th-cells
14238 !!input
14239 {|
14240 !| foo !!| bar
14241 |}
14242 !!result
14243 <table>
14244 <tr>
14245 <th> foo </th>
14246 <th> bar
14247 </th></tr></table>
14248
14249 !!end
14250
14251 !!test
14252 Empty table rows go away
14253 !!input
14254 {|
14255 | Hello
14256 | there
14257 |- class="foo"
14258 |-
14259 |}
14260 !! result
14261 <table>
14262 <tr>
14263 <td> Hello
14264 </td>
14265 <td> there
14266 </td></tr>
14267
14268 </table>
14269
14270 !! end
14271
14272 ###
14273 ### Parsoid-centric tests for testing RTing of inter-element separators
14274 ### Edge cases not tested by existing parser tests and specific to
14275 ### Parsoid-specific serialization strategies.
14276 ###
14277
14278 !!test
14279 RT-ed inter-element separators should be valid separators
14280 !!input
14281 {|
14282 |- [[foo]]
14283 |}
14284 !!result
14285 <table>
14286
14287 </table>
14288
14289 !!end
14290
14291 !!test
14292 Trailing newlines in a deep dom-subtree that ends a wikitext line should be migrated out
14293 (Parsoid-only since PHP parser relies on Tidy for correct output)
14294 !!options
14295 parsoid
14296 !!input
14297 {|
14298 |<small>foo
14299 bar
14300 |}
14301
14302 {|
14303 |<small>foo<small>
14304 |}
14305 !!result
14306 !!end
14307
14308 !!test
14309 Empty TD followed by TD with tpl-generated attribute
14310 !!input
14311 {|
14312 |-
14313 |
14314 |{{echo|style='color:red'}}|foo
14315 |}
14316 !!result
14317 <table>
14318
14319 <tr>
14320 <td>
14321 </td>
14322 <td>foo
14323 </td></tr></table>
14324
14325 !!end
14326
14327 !!test
14328 Indented table with an empty td
14329 !!input
14330 {|
14331 |-
14332 |
14333 |foo
14334 |}
14335 !!result
14336 <table>
14337
14338 <tr>
14339 <td>
14340 </td>
14341 <td>foo
14342 </td></tr></table>
14343
14344 !!end
14345
14346 !!test
14347 Empty TR followed by a template-generated TR
14348 (Parsoid-specific since PHP parser doesn't handle this mixed tbl-wikitext)
14349 !!options
14350 parsoid
14351 !!input
14352 {|
14353 |-
14354 {{echo|<tr><td>foo</td></tr>}}
14355 |}
14356 !!result
14357 <table>
14358 <tbody>
14359 <tr>
14360 </tr>
14361 <tr>
14362 <td>foo</td></tr></tbody></table>
14363 !!end
14364
14365 ## PHP and parsoid output differ for this, and since this is primarily
14366 ## for testing Parsoid's serializer, marking this Parsoid only
14367 !!test
14368 Empty TR followed by mixed-ws-comment line should RT correctly
14369 !!options
14370 parsoid
14371 !!input
14372 {|
14373 |-
14374 <!--c-->
14375 |-
14376 <!--c--> <!--d-->
14377 |}
14378 !!result
14379 <table>
14380 <tbody>
14381 <tr>
14382 <td> <!--c--></td></tr>
14383 <tr>
14384 <td><!--c--> <!--d--></td></tr>
14385 </table>
14386
14387 !!end
14388
14389 !!test
14390 Multi-line image caption generated by templates with/without trailing newlines
14391 !!options
14392 parsoid
14393 !!input
14394 [[File:foo.jpg|thumb|300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}]]
14395 [[File:foo.jpg|thumb|300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}\n\n]]
14396 !!result
14397 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/index.php?title=Special:Upload&amp;wpDestFile=Foo.jpg" class="new" title="File:Foo.jpg">File:Foo.jpg</a> <div class="thumbcaption">foo\nA\nB\nC</div></div></div>
14398 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/index.php?title=Special:Upload&amp;wpDestFile=Foo.jpg" class="new" title="File:Foo.jpg">File:Foo.jpg</a> <div class="thumbcaption">foo\nA\nB\nC\n\n</div></div></div>
14399
14400 !!end
14401
14402 ## PHP emits broken html for this, and since this is primarily
14403 ## a Parsoid serializer test, marking this Parsoid only
14404 !!test
14405 Improperly nested inline or quotes tags with whitespace in between
14406 !!options
14407 parsoid
14408 !!input
14409 <span> <s>x</span> </s>
14410 ''' ''x''' ''
14411 !!result
14412 <p><span> <s>x</s></span><s> </s>
14413 <b> <i>x</i></b><i> </i></span>
14414 </p>
14415 !!end
14416
14417 TODO:
14418 more images
14419 more tables
14420 character entities
14421 and much more
14422 Try for 100% code coverage