New paragraphs wrapping tests in the presence of comments & WS lines.
[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 # The expected HTML structure in this test is debatable. The PHP parser does
3501 # not parse this kind of table at all. The main focus for Parsoid is on
3502 # round-tripping, so this output is ok for now. TODO: revisit!
3503 !! test
3504 Wikitext table with html-syntax row (Parsoid)
3505 !! options
3506 parsoid
3507 !! input
3508 {|
3509 |-
3510 <td>foo</td>
3511 |}
3512 !! result
3513 <table>
3514 <tbody>
3515 <tr>
3516 <td></td>
3517 <td>foo</td></tr></tbody></table>
3518 !! end
3519
3520 ###
3521 ### Internal links
3522 ###
3523 !! test
3524 Plain link, capitalized
3525 !! input
3526 [[Main Page]]
3527 !! result
3528 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
3529 </p>
3530 !! end
3531
3532 !! test
3533 Plain link, uncapitalized
3534 !! input
3535 [[main Page]]
3536 !! result
3537 <p><a href="/wiki/Main_Page" title="Main Page">main Page</a>
3538 </p>
3539 !! end
3540
3541 !! test
3542 Piped link
3543 !! input
3544 [[Main Page|The Main Page]]
3545 !! result
3546 <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
3547 </p>
3548 !! end
3549
3550 !! test
3551 Broken link
3552 !! input
3553 [[Zigzagzogzagzig]]
3554 !! result
3555 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig</a>
3556 </p>
3557 !! end
3558
3559 !! test
3560 Broken link with fragment
3561 !! input
3562 [[Zigzagzogzagzig#zug]]
3563 !! result
3564 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig#zug</a>
3565 </p>
3566 !! end
3567
3568 !! test
3569 Special page link with fragment
3570 !! input
3571 [[Special:Version#anchor]]
3572 !! result
3573 <p><a href="/wiki/Special:Version#anchor" title="Special:Version">Special:Version#anchor</a>
3574 </p>
3575 !! end
3576
3577 !! test
3578 Nonexistent special page link with fragment
3579 !! input
3580 [[Special:ThisNameWillHopefullyNeverBeUsed#anchor]]
3581 !! result
3582 <p><a href="/wiki/Special:ThisNameWillHopefullyNeverBeUsed" class="new" title="Special:ThisNameWillHopefullyNeverBeUsed (page does not exist)">Special:ThisNameWillHopefullyNeverBeUsed#anchor</a>
3583 </p>
3584 !! end
3585
3586 !! test
3587 Link with prefix
3588 !! input
3589 xxx[[main Page]], xxx[[Main Page]], Xxx[[main Page]] XXX[[main Page]], XXX[[Main Page]]
3590 !! result
3591 <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>
3592 </p>
3593 !! end
3594
3595 !! test
3596 Link with suffix
3597 !! input
3598 [[Main Page]]xxx, [[Main Page]]XXX, [[Main Page]]!!!
3599 !! result
3600 <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>!!!
3601 </p>
3602 !! end
3603
3604 !! article
3605 prefixed article
3606 !! text
3607 Some text
3608 !! endarticle
3609
3610 !! test
3611 Bug 43661: Piped links with identical prefixes
3612 !! input
3613 [[prefixed article|prefixed articles with spaces]]
3614
3615 [[prefixed article|prefixed articlesaoeu]]
3616
3617 [[Main Page|Main Page test]]
3618 !! result
3619 <p><a href="/wiki/Prefixed_article" title="Prefixed article">prefixed articles with spaces</a>
3620 </p><p><a href="/wiki/Prefixed_article" title="Prefixed article">prefixed articlesaoeu</a>
3621 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page test</a>
3622 </p>
3623 !! end
3624
3625
3626 !! test
3627 Link with HTML entity in suffix / tail
3628 !! input
3629 [[Main Page]]&quot;, [[Main Page]]&#97;
3630 !! result
3631 <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;
3632 </p>
3633 !! end
3634
3635 !! test
3636 Link with 3 brackets
3637 !! input
3638 [[[main page]]]
3639 !! result
3640 <p>[[[main page]]]
3641 </p>
3642 !! end
3643
3644 !! test
3645 Piped link with 3 brackets
3646 !! input
3647 [[[main page|the main page]]]
3648 !! result
3649 <p>[[[main page|the main page]]]
3650 </p>
3651 !! end
3652
3653 !! test
3654 Link with multiple pipes
3655 !! input
3656 [[Main Page|The|Main|Page]]
3657 !! result
3658 <p><a href="/wiki/Main_Page" title="Main Page">The|Main|Page</a>
3659 </p>
3660 !! end
3661
3662 !! test
3663 Link to namespaces
3664 !! input
3665 [[Talk:Parser testing]], [[Meta:Disclaimers]]
3666 !! result
3667 <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>
3668 </p>
3669 !! end
3670
3671 !! test
3672 Piped link to namespace
3673 !! input
3674 [[Meta:Disclaimers|The disclaimers]]
3675 !! result
3676 <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>
3677 </p>
3678 !! end
3679
3680 !! test
3681 Link containing }
3682 !! input
3683 [[Usually caused by a typo (oops}]]
3684 !! result
3685 <p>[[Usually caused by a typo (oops}]]
3686 </p>
3687 !! end
3688
3689 !! test
3690 Link containing % (not as a hex sequence)
3691 !! input
3692 [[7% Solution]]
3693 !! result
3694 <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>
3695 </p>
3696 !! end
3697
3698 !! test
3699 Link containing % as a single hex sequence interpreted to char
3700 !! input
3701 [[7%25 Solution]]
3702 !! result
3703 <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>
3704 </p>
3705 !!end
3706
3707 !! test
3708 Link containing % as a double hex sequence interpreted to hex sequence
3709 !! input
3710 [[7%2525 Solution]]
3711 !! result
3712 <p>[[7%2525 Solution]]
3713 </p>
3714 !!end
3715
3716 !! test
3717 Link containing "#<" and "#>" % as a hex sequences- these are valid section anchors
3718 Example for such a section: == < ==
3719 !! input
3720 [[%23%3c]][[%23%3e]]
3721 !! result
3722 <p><a href="#.3C">#&lt;</a><a href="#.3E">#&gt;</a>
3723 </p>
3724 !! end
3725
3726 !! test
3727 Link containing "<#" and ">#" as a hex sequences
3728 !! input
3729 [[%3c%23]][[%3e%23]]
3730 !! result
3731 <p>[[%3c%23]][[%3e%23]]
3732 </p>
3733 !! end
3734
3735 !! test
3736 Link containing double-single-quotes '' (bug 4598)
3737 !! input
3738 [[Lista d''e paise d''o munno]]
3739 !! result
3740 <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>
3741 </p>
3742 !! end
3743
3744 !! test
3745 Link containing double-single-quotes '' in text (bug 4598 sanity check)
3746 !! input
3747 Some [[Link|pretty ''italics'' and stuff]]!
3748 !! result
3749 <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>!
3750 </p>
3751 !! end
3752
3753 !! test
3754 Link containing double-single-quotes '' in text embedded in italics (bug 4598 sanity check)
3755 !! input
3756 ''Some [[Link|pretty ''italics'' and stuff]]!
3757 !! result
3758 <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>
3759 </p>
3760 !! end
3761
3762 !! test
3763 Link with double quotes in title part (literal) and alternate part (interpreted)
3764 !! input
3765 [[File:Denys Savchenko ''Pentecoste''.jpg]]
3766
3767 [[''Pentecoste'']]
3768
3769 [[''Pentecoste''|Pentecoste]]
3770
3771 [[''Pentecoste''|''Pentecoste'']]
3772 !! result
3773 <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>
3774 </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>
3775 </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>
3776 </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>
3777 </p>
3778 !! end
3779
3780 !! test
3781 Broken image links with HTML captions (bug 39700)
3782 !! input
3783 [[File:Nonexistent|<script></script>]]
3784 [[File:Nonexistent|100px|<script></script>]]
3785 [[File:Nonexistent|&lt;]]
3786 [[File:Nonexistent|a<i>b</i>c]]
3787 !! result
3788 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script&gt;&lt;/script&gt;</a>
3789 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script&gt;&lt;/script&gt;</a>
3790 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;</a>
3791 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">abc</a>
3792 </p>
3793 !! end
3794
3795 !! test
3796 Plain link to URL
3797 !! input
3798 [[http://www.example.com]]
3799 !! result
3800 <p>[<a rel="nofollow" class="external autonumber" href="http://www.example.com">[1]</a>]
3801 </p>
3802 !! end
3803
3804 !! test
3805 Plain link to URL with link text
3806 !! input
3807 [[http://www.example.com Link text]]
3808 !! result
3809 <p>[<a rel="nofollow" class="external text" href="http://www.example.com">Link text</a>]
3810 </p>
3811 !! end
3812
3813 !! test
3814 Plain link to protocol-relative URL
3815 !! input
3816 [[//www.example.com]]
3817 !! result
3818 <p>[<a rel="nofollow" class="external autonumber" href="//www.example.com">[1]</a>]
3819 </p>
3820 !! end
3821
3822 !! test
3823 Plain link to protocol-relative URL with link text
3824 !! input
3825 [[//www.example.com Link text]]
3826 !! result
3827 <p>[<a rel="nofollow" class="external text" href="//www.example.com">Link text</a>]
3828 </p>
3829 !! end
3830
3831 !! test
3832 Plain link to page with question mark in title
3833 !! input
3834 [[A?b]]
3835
3836 [[A?b|Baz]]
3837 !! result
3838 <p><a href="/wiki/A%3Fb" title="A?b">A?b</a>
3839 </p><p><a href="/wiki/A%3Fb" title="A?b">Baz</a>
3840 </p>
3841 !! end
3842
3843
3844 # I'm fairly sure the expected result here is wrong.
3845 # We want these to be URL links, not pseudo-pages with URLs for titles....
3846 # However the current output is also pretty screwy.
3847 #
3848 # ----
3849 # I'm changing it to match the current output--it arguably makes more
3850 # sense in the light of the test above. Old expected result was:
3851 #<p>Piped link to URL: <a href="/index.php?title=Http://www.example.com&amp;action=edit" class="new">an example URL</a>
3852 #</p>
3853 # But I think this test is bordering on "garbage in, garbage out" anyway.
3854 # -- wtm
3855 !! test
3856 Piped link to URL
3857 !! input
3858 Piped link to URL: [[http://www.example.com|an example URL]]
3859 !! result
3860 <p>Piped link to URL: [<a rel="nofollow" class="external text" href="http://www.example.com%7Can">example URL</a>]
3861 </p>
3862 !! end
3863
3864 !! test
3865 BUG 2: [[page|http://url/]] should link to page, not http://url/
3866 !! input
3867 [[Main Page|http://url/]]
3868 !! result
3869 <p><a href="/wiki/Main_Page" title="Main Page">http://url/</a>
3870 </p>
3871 !! end
3872
3873 !! test
3874 BUG 337: Escaped self-links should be bold
3875 !! options
3876 title=[[Bug462]]
3877 !! input
3878 [[Bu&#103;462]] [[Bug462]]
3879 !! result
3880 <p><strong class="selflink">Bu&#103;462</strong> <strong class="selflink">Bug462</strong>
3881 </p>
3882 !! end
3883
3884 !! test
3885 Self-link to section should not be bold
3886 !! options
3887 title=[[Main Page]]
3888 !! input
3889 [[Main Page#section]]
3890 !! result
3891 <p><a href="/wiki/Main_Page#section" title="Main Page">Main Page#section</a>
3892 </p>
3893 !! end
3894
3895 !! article
3896 00
3897 !! text
3898 This is 00.
3899 !! endarticle
3900
3901 !!test
3902 Self-link to numeric title
3903 !!options
3904 title=[[0]]
3905 !!input
3906 [[0]]
3907 !!result
3908 <p><strong class="selflink">0</strong>
3909 </p>
3910 !!end
3911
3912 !!test
3913 Link to numeric-equivalent title
3914 !!options
3915 title=[[0]]
3916 !!input
3917 [[00]]
3918 !!result
3919 <p><a href="/wiki/00" title="00">00</a>
3920 </p>
3921 !!end
3922
3923 !! test
3924 <nowiki> inside a link
3925 !! input
3926 [[Main<nowiki> Page</nowiki>]] [[Main Page|the main page <nowiki>[it's not very good]</nowiki>]]
3927 !! result
3928 <p>[[Main Page]] <a href="/wiki/Main_Page" title="Main Page">the main page [it's not very good]</a>
3929 </p>
3930 !! end
3931
3932 !! test
3933 Non-breaking spaces in title
3934 !! input
3935 [[&nbsp; Main &nbsp; Page &nbsp;]]
3936 !! result
3937 <p><a href="/wiki/Main_Page" title="Main Page">&#160; Main &#160; Page &#160;</a>
3938 </p>
3939 !!end
3940
3941 !! test
3942 Internal link with ca linktrail, surrounded by bold apostrophes (bug 27473 primary issue)
3943 !! options
3944 language=ca
3945 !! input
3946 '''[[Main Page]]'''
3947 !! result
3948 <p><b><a href="/wiki/Main_Page" title="Main Page">Main Page</a></b>
3949 </p>
3950 !! end
3951
3952 !! test
3953 Internal link with ca linktrail, surrounded by italic apostrophes (bug 27473 primary issue)
3954 !! options
3955 language=ca
3956 !! input
3957 ''[[Main Page]]''
3958 !! result
3959 <p><i><a href="/wiki/Main_Page" title="Main Page">Main Page</a></i>
3960 </p>
3961 !! end
3962
3963 !! test
3964 Internal link with en linktrail: no apostrophes (bug 27473)
3965 !! options
3966 language=en
3967 !! input
3968 [[Something]]'nice
3969 !! result
3970 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (page does not exist)">Something</a>'nice
3971 </p>
3972 !! end
3973
3974 !! test
3975 Internal link with ca linktrail with apostrophes (bug 27473)
3976 !! options
3977 language=ca
3978 !! input
3979 [[Something]]'nice
3980 !! result
3981 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (encara no existeix)">Something'nice</a>
3982 </p>
3983 !! end
3984
3985 !! test
3986 Internal link with kaa linktrail with apostrophes (bug 27473)
3987 !! options
3988 language=kaa
3989 !! input
3990 [[Something]]'nice
3991 !! result
3992 <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>
3993 </p>
3994 !! end
3995
3996 !! test
3997 Parsoid-centric test: Whitespace in ext- and wiki-links should be preserved
3998 !! input
3999 [[Foo| bar]]
4000
4001 [[Foo| ''bar'']]
4002
4003 [http://wp.org foo]
4004
4005 [http://wp.org ''foo'']
4006 !! result
4007 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)"> bar</a>
4008 </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>
4009 </p><p><a rel="nofollow" class="external text" href="http://wp.org">foo</a>
4010 </p><p><a rel="nofollow" class="external text" href="http://wp.org"><i>foo</i></a>
4011 </p>
4012 !! end
4013
4014 ###
4015 ### Interwiki links (see maintenance/interwiki.sql)
4016 ###
4017
4018 !! test
4019 Inline interwiki link
4020 !! input
4021 [[MeatBall:SoftSecurity]]
4022 !! result
4023 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity</a>
4024 </p>
4025 !! end
4026
4027 !! test
4028 Inline interwiki link with empty title (bug 2372)
4029 !! input
4030 [[MeatBall:]]
4031 !! result
4032 <p><a href="http://www.usemod.com/cgi-bin/mb.pl" class="extiw" title="meatball:">MeatBall:</a>
4033 </p>
4034 !! end
4035
4036 !! test
4037 Interwiki link encoding conversion (bug 1636)
4038 !! input
4039 *[[Wikipedia:ro:Olteni&#0355;a]]
4040 *[[Wikipedia:ro:Olteni&#355;a]]
4041 !! result
4042 <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>
4043 </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>
4044 </li></ul>
4045
4046 !! end
4047
4048 !! test
4049 Interwiki link with fragment (bug 2130)
4050 !! input
4051 [[MeatBall:SoftSecurity#foo]]
4052 !! result
4053 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity#foo" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity#foo</a>
4054 </p>
4055 !! end
4056
4057 !! test
4058 Interlanguage link
4059 !! input
4060 Blah blah blah
4061 [[zh:Chinese]]
4062 !!result
4063 <p>Blah blah blah
4064 </p>
4065 !! end
4066
4067 !! test
4068 Double interlanguage link
4069 !! input
4070 Blah blah blah
4071 [[es:Spanish]]
4072 [[zh:Chinese]]
4073 !!result
4074 <p>Blah blah blah
4075 </p>
4076 !! end
4077
4078 !! test
4079 Interlanguage link, with prefix links
4080 !! options
4081 language=ln
4082 !! input
4083 Blah blah blah
4084 [[zh:Chinese]]
4085 !!result
4086 <p>Blah blah blah
4087 </p>
4088 !! end
4089
4090 !! test
4091 Double interlanguage link, with prefix links (bug 8897)
4092 !! options
4093 language=ln
4094 !! input
4095 Blah blah blah
4096 [[es:Spanish]]
4097 [[zh:Chinese]]
4098 !!result
4099 <p>Blah blah blah
4100 </p>
4101 !! end
4102
4103 !! test
4104 Parsoid-specific test: Wikilinks with &nbsp; should RT properly
4105 !! options
4106 language=ln
4107 !! input
4108 [[WW&nbsp;II]]
4109 !!result
4110 <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>
4111 </p>
4112 !! end
4113
4114 ##
4115 ## XHTML tidiness
4116 ###
4117
4118 !! test
4119 <br> to <br />
4120 !! input
4121 1<br>2<br />3
4122 !! result
4123 <p>1<br />2<br />3
4124 </p>
4125 !! end
4126
4127 !! test
4128 Broken br tag sanitization
4129 !! input
4130 </br>
4131 !! result
4132 <p>&lt;/br&gt;
4133 </p>
4134 !! end
4135
4136 !! test
4137 Incorrecly removing closing slashes from correctly formed XHTML
4138 !! input
4139 <br style="clear:both;" />
4140 !! result
4141 <p><br style="clear:both;" />
4142 </p>
4143 !! end
4144
4145 !! test
4146 Failing to transform badly formed HTML into correct XHTML
4147 !! input
4148 <br style="clear: left;">
4149 <br style="clear: right;">
4150 <br style="clear: both;">
4151 !! result
4152 <p><br style="clear: left;" />
4153 <br style="clear: right;" />
4154 <br style="clear: both;" />
4155 </p>
4156 !!end
4157
4158 !! test
4159 Handling html with a div self-closing tag
4160 !! input
4161 <div title />
4162 <div title/>
4163 <div title/ >
4164 <div title=bar />
4165 <div title=bar/>
4166 <div title=bar/ >
4167 !! result
4168 <p>&lt;div title /&gt;
4169 &lt;div title/&gt;
4170 </p>
4171 <div>
4172 <p>&lt;div title=bar /&gt;
4173 &lt;div title=bar/&gt;
4174 </p>
4175 <div title="bar/"></div>
4176 </div>
4177
4178 !! end
4179
4180 !! test
4181 Handling html with a br self-closing tag
4182 !! input
4183 <br title />
4184 <br title/>
4185 <br title/ >
4186 <br title=bar />
4187 <br title=bar/>
4188 <br title=bar/ >
4189 !! result
4190 <p><br title="title" />
4191 <br title="title" />
4192 <br />
4193 <br title="bar" />
4194 <br title="bar" />
4195 <br title="bar/" />
4196 </p>
4197 !! end
4198
4199 !! test
4200 Horizontal ruler (should it add that extra space?)
4201 !! input
4202 <hr>
4203 <hr >
4204 foo <hr
4205 > bar
4206 !! result
4207 <hr />
4208 <hr />
4209 foo <hr /> bar
4210
4211 !! end
4212
4213 !! test
4214 Horizontal ruler -- 4+ dashes render hr
4215 !! input
4216 ----
4217 !! result
4218 <hr />
4219
4220 !! end
4221
4222 !! test
4223 Horizontal ruler -- eats additional dashes on the same line
4224 !! input
4225 ---------
4226 !! result
4227 <hr />
4228
4229 !! end
4230
4231 !! test
4232 Horizontal ruler -- does not collaps dashes on consecutive lines
4233 !! input
4234 ----
4235 ----
4236 !! result
4237 <hr />
4238 <hr />
4239
4240 !! end
4241
4242 !! test
4243 Horizontal ruler -- <4 dashes render as plain text
4244 !! input
4245 ---
4246 !! result
4247 <p>---
4248 </p>
4249 !! end
4250
4251 !! test
4252 Horizontal ruler -- Supports content following dashes on same line
4253 !! input
4254 ---- Foo
4255 !! result
4256 <hr /> Foo
4257
4258 !! end
4259
4260 ###
4261 ### Block-level elements
4262 ###
4263 !! test
4264 Common list
4265 !! input
4266 *Common list
4267 * item 2
4268 *item 3
4269 !! result
4270 <ul><li>Common list
4271 </li><li> item 2
4272 </li><li>item 3
4273 </li></ul>
4274
4275 !! end
4276
4277 !! test
4278 Numbered list
4279 !! input
4280 #Numbered list
4281 #item 2
4282 # item 3
4283 !! result
4284 <ol><li>Numbered list
4285 </li><li>item 2
4286 </li><li> item 3
4287 </li></ol>
4288
4289 !! end
4290
4291 !! test
4292 Mixed list
4293 !! input
4294 *Mixed list
4295 *# with numbers
4296 ** and bullets
4297 *# and numbers
4298 *bullets again
4299 **bullet level 2
4300 ***bullet level 3
4301 ***#Number on level 4
4302 **bullet level 2
4303 **#Number on level 3
4304 **#Number on level 3
4305 *#number level 2
4306 *Level 1
4307 *** Level 3
4308 #** Level 3, but ordered
4309 !! result
4310 <ul><li>Mixed list
4311 <ol><li> with numbers
4312 </li></ol>
4313 <ul><li> and bullets
4314 </li></ul>
4315 <ol><li> and numbers
4316 </li></ol>
4317 </li><li>bullets again
4318 <ul><li>bullet level 2
4319 <ul><li>bullet level 3
4320 <ol><li>Number on level 4
4321 </li></ol>
4322 </li></ul>
4323 </li><li>bullet level 2
4324 <ol><li>Number on level 3
4325 </li><li>Number on level 3
4326 </li></ol>
4327 </li></ul>
4328 <ol><li>number level 2
4329 </li></ol>
4330 </li><li>Level 1
4331 <ul><li><ul><li> Level 3
4332 </li></ul>
4333 </li></ul>
4334 </li></ul>
4335 <ol><li><ul><li><ul><li> Level 3, but ordered
4336 </li></ul>
4337 </li></ul>
4338 </li></ol>
4339
4340 !! end
4341
4342 !! test
4343 Nested lists 1
4344 !! input
4345 *foo
4346 **bar
4347 !! result
4348 <ul><li>foo
4349 <ul><li>bar
4350 </li></ul>
4351 </li></ul>
4352
4353 !! end
4354
4355 !! test
4356 Nested lists 2
4357 !! input
4358 **foo
4359 *bar
4360 !! result
4361 <ul><li><ul><li>foo
4362 </li></ul>
4363 </li><li>bar
4364 </li></ul>
4365
4366 !! end
4367
4368 !! test
4369 Nested lists 3 (first element empty)
4370 !! input
4371 *
4372 **bar
4373 !! result
4374 <ul><li>
4375 <ul><li>bar
4376 </li></ul>
4377 </li></ul>
4378
4379 !! end
4380
4381 !! test
4382 Nested lists 4 (first element empty)
4383 !! input
4384 **
4385 *bar
4386 !! result
4387 <ul><li><ul><li>
4388 </li></ul>
4389 </li><li>bar
4390 </li></ul>
4391
4392 !! end
4393
4394 !! test
4395 Nested lists 5 (both elements empty)
4396 !! input
4397 **
4398 *
4399 !! result
4400 <ul><li><ul><li>
4401 </li></ul>
4402 </li><li>
4403 </li></ul>
4404
4405 !! end
4406
4407 !! test
4408 Nested lists 6 (both elements empty)
4409 !! input
4410 *
4411 **
4412 !! result
4413 <ul><li>
4414 <ul><li>
4415 </li></ul>
4416 </li></ul>
4417
4418 !! end
4419
4420 !! test
4421 Nested lists 7 (skip initial nesting levels)
4422 !! input
4423 *** foo
4424 !! result
4425 <ul><li><ul><li><ul><li> foo
4426 </li></ul>
4427 </li></ul>
4428 </li></ul>
4429
4430 !! end
4431
4432 !! test
4433 Nested lists 8 (multiple nesting transitions)
4434 !! input
4435 * foo
4436 *** bar
4437 ** baz
4438 * boo
4439 !! result
4440 <ul><li> foo
4441 <ul><li><ul><li> bar
4442 </li></ul>
4443 </li><li> baz
4444 </li></ul>
4445 </li><li> boo
4446 </li></ul>
4447
4448 !! end
4449
4450 !! test
4451 1. Lists with start-of-line-transparent tokens before bullets: Comments
4452 !! input
4453 *foo
4454 *<!--cmt-->bar
4455 <!--cmt-->*baz
4456 !! result
4457 <ul><li>foo
4458 </li><li>bar
4459 </li><li>baz
4460 </li></ul>
4461
4462 !! end
4463
4464 !! test
4465 2. Lists with start-of-line-transparent tokens before bullets: Template close
4466 !! input
4467 *foo {{echo|bar
4468 }}*baz
4469 !! result
4470 <ul><li>foo bar
4471 </li><li>baz
4472 </li></ul>
4473
4474 !! end
4475
4476 !! test
4477 Unbalanced closing block tags break a list
4478 (Disabled since php parser generates broken html -- relies on Tidy to fix up)
4479 !! options
4480 disabled
4481 !! input
4482 <div>
4483 *a</div><div>
4484 *b</div>
4485 !! result
4486 <div>
4487 <ul><li>a
4488 </li></ul></div><div>
4489 <ul><li>b
4490 </li></ul></div>
4491 !! end
4492
4493 !! test
4494 Unbalanced closing non-block tags don't break a list
4495 (Disabled since php parser generates broken html -- relies on Tidy to fix up)
4496 !! options
4497 disabled
4498 !! input
4499 <span>
4500 *a</span><span>
4501 *b</span>
4502 !! result
4503 <p><span></span>
4504 </p>
4505 <ul><li>a<span></span>
4506 </li><li>b
4507 </li></ul>
4508 !! end
4509
4510 !! test
4511 Unclosed formatting tags that straddle lists are closed and reopened
4512 (Disabled since php parser generates broken html -- relies on Tidy to fix up)
4513 !! options
4514 disabled
4515 !! input
4516 # <s> a
4517 # b </s>
4518 !! result
4519 <ol><li> <s> a </s>
4520 </li><li> <s> b </s>
4521 </li></ol>
4522 !! end
4523
4524 !!test
4525 List embedded in a non-block tag
4526 (Ugly Parsoid output -- worth fixing; Disabled for PHP parser since it relies on Tidy)
4527 !! options
4528 parsoid
4529 !!input
4530 <small>
4531 * foo
4532 </small>
4533 !!result
4534 <p><small></small></p>
4535 <small>
4536 <ul>
4537 <li> foo</li>
4538 </ul>
4539 </small>
4540 <p><small></small></p>
4541 !!end
4542
4543 !! test
4544 List items are not parsed correctly following a <pre> block (bug 785)
4545 !! input
4546 * <pre>foo</pre>
4547 * <pre>bar</pre>
4548 * zar
4549 !! result
4550 <ul><li> <pre>foo</pre>
4551 </li><li> <pre>bar</pre>
4552 </li><li> zar
4553 </li></ul>
4554
4555 !! end
4556
4557 !! test
4558 List items from template
4559 !! input
4560
4561 {{inner list}}
4562 * item 2
4563
4564 * item 0
4565 {{inner list}}
4566 * item 2
4567
4568 * item 0
4569 * notSOL{{inner list}}
4570 * item 2
4571 !! result
4572 <ul><li> item 1
4573 </li><li> item 2
4574 </li></ul>
4575 <ul><li> item 0
4576 </li><li> item 1
4577 </li><li> item 2
4578 </li></ul>
4579 <ul><li> item 0
4580 </li><li> notSOL
4581 </li><li> item 1
4582 </li><li> item 2
4583 </li></ul>
4584
4585 !! end
4586
4587 !! test
4588 List interrupted by empty line or heading
4589 !! input
4590 * foo
4591
4592 ** bar
4593 == A heading ==
4594 * Another list item
4595 !! result
4596 <ul><li> foo
4597 </li></ul>
4598 <ul><li><ul><li> bar
4599 </li></ul>
4600 </li></ul>
4601 <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>
4602 <ul><li> Another list item
4603 </li></ul>
4604
4605 !!end
4606
4607 !!test
4608 Multiple list tags generated by templates
4609 !!input
4610 {{echo|<li>}}a
4611 {{echo|<li>}}b
4612 {{echo|<li>}}c
4613 !!result
4614 <li>a
4615 <li>b
4616 <li>c</li>
4617 </li>
4618 </li>
4619
4620 !!end
4621
4622 ###
4623 ### Magic Words
4624 ###
4625
4626 !! test
4627 Magic Word: {{CURRENTDAY}}
4628 !! input
4629 {{CURRENTDAY}}
4630 !! result
4631 <p>1
4632 </p>
4633 !! end
4634
4635 !! test
4636 Magic Word: {{CURRENTDAY2}}
4637 !! input
4638 {{CURRENTDAY2}}
4639 !! result
4640 <p>01
4641 </p>
4642 !! end
4643
4644 !! test
4645 Magic Word: {{CURRENTDAYNAME}}
4646 !! input
4647 {{CURRENTDAYNAME}}
4648 !! result
4649 <p>Thursday
4650 </p>
4651 !! end
4652
4653 !! test
4654 Magic Word: {{CURRENTDOW}}
4655 !! input
4656 {{CURRENTDOW}}
4657 !! result
4658 <p>4
4659 </p>
4660 !! end
4661
4662 !! test
4663 Magic Word: {{CURRENTMONTH}}
4664 !! input
4665 {{CURRENTMONTH}}
4666 !! result
4667 <p>01
4668 </p>
4669 !! end
4670
4671 !! test
4672 Magic Word: {{CURRENTMONTHABBREV}}
4673 !! input
4674 {{CURRENTMONTHABBREV}}
4675 !! result
4676 <p>Jan
4677 </p>
4678 !! end
4679
4680 !! test
4681 Magic Word: {{CURRENTMONTHNAME}}
4682 !! input
4683 {{CURRENTMONTHNAME}}
4684 !! result
4685 <p>January
4686 </p>
4687 !! end
4688
4689 !! test
4690 Magic Word: {{CURRENTMONTHNAMEGEN}}
4691 !! input
4692 {{CURRENTMONTHNAMEGEN}}
4693 !! result
4694 <p>January
4695 </p>
4696 !! end
4697
4698 !! test
4699 Magic Word: {{CURRENTTIME}}
4700 !! input
4701 {{CURRENTTIME}}
4702 !! result
4703 <p>00:02
4704 </p>
4705 !! end
4706
4707 !! test
4708 Magic Word: {{CURRENTWEEK}} (@bug 4594)
4709 !! input
4710 {{CURRENTWEEK}}
4711 !! result
4712 <p>1
4713 </p>
4714 !! end
4715
4716 !! test
4717 Magic Word: {{CURRENTYEAR}}
4718 !! input
4719 {{CURRENTYEAR}}
4720 !! result
4721 <p>1970
4722 </p>
4723 !! end
4724
4725 !! test
4726 Magic Word: {{FULLPAGENAME}}
4727 !! options
4728 title=[[User:Ævar Arnfjörð Bjarmason]]
4729 !! input
4730 {{FULLPAGENAME}}
4731 !! result
4732 <p>User:Ævar Arnfjörð Bjarmason
4733 </p>
4734 !! end
4735
4736 !! test
4737 Magic Word: {{FULLPAGENAMEE}}
4738 !! options
4739 title=[[User:Ævar Arnfjörð Bjarmason]]
4740 !! input
4741 {{FULLPAGENAMEE}}
4742 !! result
4743 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
4744 </p>
4745 !! end
4746
4747 !! test
4748 Magic Word: {{NAMESPACE}}
4749 !! options
4750 title=[[User:Ævar Arnfjörð Bjarmason]]
4751 !! input
4752 {{NAMESPACE}}
4753 !! result
4754 <p>User
4755 </p>
4756 !! end
4757
4758 !! test
4759 Magic Word: {{NAMESPACEE}}
4760 !! options
4761 title=[[User:Ævar Arnfjörð Bjarmason]]
4762 !! input
4763 {{NAMESPACEE}}
4764 !! result
4765 <p>User
4766 </p>
4767 !! end
4768
4769 !! test
4770 Magic Word: {{NAMESPACENUMBER}}
4771 !! options
4772 title=[[User:Ævar Arnfjörð Bjarmason]]
4773 !! input
4774 {{NAMESPACENUMBER}}
4775 !! result
4776 <p>2
4777 </p>
4778 !! end
4779
4780 !! test
4781 Magic Word: {{NUMBEROFFILES}}
4782 !! input
4783 {{NUMBEROFFILES}}
4784 !! result
4785 <p>2
4786 </p>
4787 !! end
4788
4789 !! test
4790 Magic Word: {{PAGENAME}}
4791 !! options
4792 title=[[User:Ævar Arnfjörð Bjarmason]]
4793 !! input
4794 {{PAGENAME}}
4795 !! result
4796 <p>Ævar Arnfjörð Bjarmason
4797 </p>
4798 !! end
4799
4800 !! test
4801 Magic Word: {{PAGENAME}} with metacharacters
4802 !! options
4803 title=[['foo & bar = baz']]
4804 !! input
4805 ''{{PAGENAME}}''
4806 !! result
4807 <p><i>&#39;foo &#38; bar &#61; baz&#39;</i>
4808 </p>
4809 !! end
4810
4811 !! test
4812 Magic Word: {{PAGENAME}} with metacharacters (bug 26781)
4813 !! options
4814 title=[[*RFC 1234 http://example.com/]]
4815 !! input
4816 {{PAGENAME}}
4817 !! result
4818 <p>&#42;RFC&#32;1234 http&#58;//example.com/
4819 </p>
4820 !! end
4821
4822 !! test
4823 Magic Word: {{PAGENAMEE}}
4824 !! options
4825 title=[[User:Ævar Arnfjörð Bjarmason]]
4826 !! input
4827 {{PAGENAMEE}}
4828 !! result
4829 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
4830 </p>
4831 !! end
4832
4833 !! test
4834 Magic Word: {{PAGENAMEE}} with metacharacters (bug 26781)
4835 !! options
4836 title=[[*RFC 1234 http://example.com/]]
4837 !! input
4838 {{PAGENAMEE}}
4839 !! result
4840 <p>&#42;RFC_1234_http&#58;//example.com/
4841 </p>
4842 !! end
4843
4844 !! test
4845 Magic Word: {{REVISIONID}}
4846 !! input
4847 {{REVISIONID}}
4848 !! result
4849 <p>1337
4850 </p>
4851 !! end
4852
4853 !! test
4854 Magic Word: {{SCRIPTPATH}}
4855 !! input
4856 {{SCRIPTPATH}}
4857 !! result
4858 <p>/
4859 </p>
4860 !! end
4861
4862 !! test
4863 Magic Word: {{SERVER}}
4864 !! input
4865 {{SERVER}}
4866 !! result
4867 <p><a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
4868 </p>
4869 !! end
4870
4871 !! test
4872 Magic Word: {{SERVERNAME}}
4873 !! input
4874 {{SERVERNAME}}
4875 !! result
4876 <p>example.org
4877 </p>
4878 !! end
4879
4880 !! test
4881 Magic Word: {{SITENAME}}
4882 !! input
4883 {{SITENAME}}
4884 !! result
4885 <p>MediaWiki
4886 </p>
4887 !! end
4888
4889 !! test
4890 Case-sensitive magic words, when cased differently, should just be template transclusions
4891 !! input
4892 {{CurrentMonth}}
4893 {{currentday}}
4894 {{cURreNTweEK}}
4895 {{currentHour}}
4896 !! result
4897 <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>
4898 <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>
4899 <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>
4900 <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>
4901 </p>
4902 !! end
4903
4904 !! test
4905 Case-insensitive magic words should still work with weird casing.
4906 !! input
4907 {{sErVeRNaMe}}
4908 {{LCFirst:AOEU}}
4909 {{ucFIRST:aoeu}}
4910 {{SERver}}
4911 !! result
4912 <p>example.org
4913 aOEU
4914 Aoeu
4915 <a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
4916 </p>
4917 !! end
4918
4919 !! test
4920 Namespace 1 {{ns:1}}
4921 !! input
4922 {{ns:1}}
4923 !! result
4924 <p>Talk
4925 </p>
4926 !! end
4927
4928 !! test
4929 Namespace 1 {{ns:01}}
4930 !! input
4931 {{ns:01}}
4932 !! result
4933 <p>Talk
4934 </p>
4935 !! end
4936
4937 !! test
4938 Namespace 0 {{ns:0}} (bug 4783)
4939 !! input
4940 {{ns:0}}
4941 !! result
4942
4943 !! end
4944
4945 !! test
4946 Namespace 0 {{ns:00}} (bug 4783)
4947 !! input
4948 {{ns:00}}
4949 !! result
4950
4951 !! end
4952
4953 !! test
4954 Namespace -1 {{ns:-1}}
4955 !! input
4956 {{ns:-1}}
4957 !! result
4958 <p>Special
4959 </p>
4960 !! end
4961
4962 !! test
4963 Namespace User {{ns:User}}
4964 !! input
4965 {{ns:User}}
4966 !! result
4967 <p>User
4968 </p>
4969 !! end
4970
4971 !! test
4972 Namespace User talk {{ns:User_talk}}
4973 !! input
4974 {{ns:User_talk}}
4975 !! result
4976 <p>User talk
4977 </p>
4978 !! end
4979
4980 !! test
4981 Namespace User talk {{ns:uSeR tAlK}}
4982 !! input
4983 {{ns:uSeR tAlK}}
4984 !! result
4985 <p>User talk
4986 </p>
4987 !! end
4988
4989 !! test
4990 Namespace File {{ns:File}}
4991 !! input
4992 {{ns:File}}
4993 !! result
4994 <p>File
4995 </p>
4996 !! end
4997
4998 !! test
4999 Namespace File {{ns:Image}}
5000 !! input
5001 {{ns:Image}}
5002 !! result
5003 <p>File
5004 </p>
5005 !! end
5006
5007 !! test
5008 Namespace (lang=de) Benutzer {{ns:User}}
5009 !! options
5010 language=de
5011 !! input
5012 {{ns:User}}
5013 !! result
5014 <p>Benutzer
5015 </p>
5016 !! end
5017
5018 !! test
5019 Namespace (lang=de) Benutzer Diskussion {{ns:3}}
5020 !! options
5021 language=de
5022 !! input
5023 {{ns:3}}
5024 !! result
5025 <p>Benutzer Diskussion
5026 </p>
5027 !! end
5028
5029
5030 !! test
5031 Urlencode
5032 !! input
5033 {{urlencode:hi world?!}}
5034 {{urlencode:hi world?!|WIKI}}
5035 {{urlencode:hi world?!|PATH}}
5036 {{urlencode:hi world?!|QUERY}}
5037 !! result
5038 <p>hi+world%3F%21
5039 hi_world%3F!
5040 hi%20world%3F%21
5041 hi+world%3F%21
5042 </p>
5043 !! end
5044
5045 ###
5046 ### Magic links
5047 ###
5048 !! test
5049 Magic links: internal link to RFC (bug 479)
5050 !! input
5051 [[RFC 123]]
5052 !! result
5053 <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>
5054 </p>
5055 !! end
5056
5057 !! test
5058 Magic links: RFC (bug 479)
5059 !! input
5060 RFC 822
5061 !! result
5062 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc822">RFC 822</a>
5063 </p>
5064 !! end
5065
5066 !! test
5067 Magic links: ISBN (bug 1937)
5068 !! input
5069 ISBN 0-306-40615-2
5070 !! result
5071 <p><a href="/wiki/Special:BookSources/0306406152" class="internal mw-magiclink-isbn">ISBN 0-306-40615-2</a>
5072 </p>
5073 !! end
5074
5075 !! test
5076 Magic links: PMID incorrectly converts space to underscore
5077 !! input
5078 PMID 1234
5079 !! result
5080 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a>
5081 </p>
5082 !! end
5083
5084 ###
5085 ### Templates
5086 ####
5087
5088 !! test
5089 Nonexistent template
5090 !! input
5091 {{thistemplatedoesnotexist}}
5092 !! result
5093 <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>
5094 </p>
5095 !! end
5096
5097 !! test
5098 Template with invalid target containing tags
5099 !! input
5100 {{a<b>b</b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
5101 !! result
5102 <p>{{a<b>b</b>|foo|a=b|a = b}}
5103 </p>
5104 !! end
5105
5106 !! test
5107 Template with invalid target containing unclosed tag
5108 !! input
5109 {{a<b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
5110 !! result
5111 <p>{{a<b>|foo|a=b|a = b}}</b>
5112 </p>
5113 !! end
5114
5115 !! article
5116 Template:test
5117 !! text
5118 This is a test template
5119 !! endarticle
5120
5121 !! test
5122 Simple template
5123 !! input
5124 {{test}}
5125 !! result
5126 <p>This is a test template
5127 </p>
5128 !! end
5129
5130 !! test
5131 Template with explicit namespace
5132 !! input
5133 {{Template:test}}
5134 !! result
5135 <p>This is a test template
5136 </p>
5137 !! end
5138
5139
5140 !! article
5141 Template:paramtest
5142 !! text
5143 This is a test template with parameter {{{param}}}
5144 !! endarticle
5145
5146 !! test
5147 Template parameter
5148 !! input
5149 {{paramtest|param=foo}}
5150 !! result
5151 <p>This is a test template with parameter foo
5152 </p>
5153 !! end
5154
5155 !! article
5156 Template:paramtestnum
5157 !! text
5158 [[{{{1}}}|{{{2}}}]]
5159 !! endarticle
5160
5161 !! test
5162 Template unnamed parameter
5163 !! input
5164 {{paramtestnum|Main Page|the main page}}
5165 !! result
5166 <p><a href="/wiki/Main_Page" title="Main Page">the main page</a>
5167 </p>
5168 !! end
5169
5170 !! article
5171 Template:templatesimple
5172 !! text
5173 (test)
5174 !! endarticle
5175
5176 !! article
5177 Template:templateredirect
5178 !! text
5179 #redirect [[Template:templatesimple]]
5180 !! endarticle
5181
5182 !! article
5183 Template:templateasargtestnum
5184 !! text
5185 {{{{{1}}}}}
5186 !! endarticle
5187
5188 !! article
5189 Template:templateasargtest
5190 !! text
5191 {{template{{{templ}}}}}
5192 !! endarticle
5193
5194 !! article
5195 Template:templateasargtest2
5196 !! text
5197 {{{{{templ}}}}}
5198 !! endarticle
5199
5200 !! test
5201 Template with template name as unnamed argument
5202 !! input
5203 {{templateasargtestnum|templatesimple}}
5204 !! result
5205 <p>(test)
5206 </p>
5207 !! end
5208
5209 !! test
5210 Template with template name as argument
5211 !! input
5212 {{templateasargtest|templ=simple}}
5213 !! result
5214 <p>(test)
5215 </p>
5216 !! end
5217
5218 !! test
5219 Template with template name as argument (2)
5220 !! input
5221 {{templateasargtest2|templ=templatesimple}}
5222 !! result
5223 <p>(test)
5224 </p>
5225 !! end
5226
5227 !! article
5228 Template:templateasargtestdefault
5229 !! text
5230 {{{{{templ|templatesimple}}}}}
5231 !! endarticle
5232
5233 !! article
5234 Template:templa
5235 !! text
5236 '''templ'''
5237 !! endarticle
5238
5239 !! test
5240 Template with default value
5241 !! input
5242 {{templateasargtestdefault}}
5243 !! result
5244 <p>(test)
5245 </p>
5246 !! end
5247
5248 !! test
5249 Template with default value (value set)
5250 !! input
5251 {{templateasargtestdefault|templ=templa}}
5252 !! result
5253 <p><b>templ</b>
5254 </p>
5255 !! end
5256
5257 !! test
5258 Template redirect
5259 !! input
5260 {{templateredirect}}
5261 !! result
5262 <p>(test)
5263 </p>
5264 !! end
5265
5266 !! test
5267 Template with argument in separate line
5268 !! input
5269 {{ templateasargtest |
5270 templ = simple }}
5271 !! result
5272 <p>(test)
5273 </p>
5274 !! end
5275
5276 !! test
5277 Template with complex template as argument
5278 !! input
5279 {{paramtest|
5280 param ={{ templateasargtest |
5281 templ = simple }}}}
5282 !! result
5283 <p>This is a test template with parameter (test)
5284 </p>
5285 !! end
5286
5287 !! test
5288 Template with thumb image (with link in description)
5289 !! input
5290 {{paramtest|
5291 param =[[Image:noimage.png|thumb|[[no link|link]] [[no link|caption]]]]}}
5292 !! result
5293 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>
5294
5295 !! end
5296
5297 !! article
5298 Template:complextemplate
5299 !! text
5300 {{{1}}} {{paramtest|
5301 param ={{{param}}}}}
5302 !! endarticle
5303
5304 !! test
5305 Template with complex arguments
5306 !! input
5307 {{complextemplate|
5308 param ={{ templateasargtest |
5309 templ = simple }}|[[Template:complextemplate|link]]}}
5310 !! result
5311 <p><a href="/wiki/Template:Complextemplate" title="Template:Complextemplate">link</a> This is a test template with parameter (test)
5312 </p>
5313 !! end
5314
5315 !! test
5316 BUG 553: link with two variables in a piped link
5317 !! input
5318 {|
5319 |[[{{{1}}}|{{{2}}}]]
5320 |}
5321 !! result
5322 <table>
5323 <tr>
5324 <td>[[{{{1}}}|{{{2}}}]]
5325 </td></tr></table>
5326
5327 !! end
5328
5329 !! test
5330 Magic variable as template parameter
5331 !! input
5332 {{paramtest|param={{SITENAME}}}}
5333 !! result
5334 <p>This is a test template with parameter MediaWiki
5335 </p>
5336 !! end
5337
5338 !! article
5339 Template:linktest
5340 !! text
5341 [[{{{param}}}|link]]
5342 !! endarticle
5343
5344 !! test
5345 Template parameter as link source
5346 !! input
5347 {{linktest|param=Main Page}}
5348 !! result
5349 <p><a href="/wiki/Main_Page" title="Main Page">link</a>
5350 </p>
5351 !! end
5352
5353 !!test
5354 Template-generated attribute string (k='v')
5355 !!input
5356 <span {{attr_str|id|v1}}>bar</span>
5357 !!result
5358 <p><span id="v1">bar</span>
5359 </p>
5360 !!end
5361
5362 !!article
5363 Template:paramtest2
5364 !! text
5365 including another template, {{paramtest|param={{{arg}}}}}
5366 !! endarticle
5367
5368 !! test
5369 Template passing argument to another template
5370 !! input
5371 {{paramtest2|arg='hmm'}}
5372 !! result
5373 <p>including another template, This is a test template with parameter 'hmm'
5374 </p>
5375 !! end
5376
5377 !! article
5378 Template:Linktest2
5379 !! text
5380 Main Page
5381 !! endarticle
5382
5383 !! test
5384 Template as link source
5385 !! input
5386 [[{{linktest2}}]]
5387
5388 [[{{linktest2}}|Main Page]]
5389
5390 [[{{linktest2}}]]Page
5391 !! result
5392 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
5393 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
5394 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>Page
5395 </p>
5396 !! end
5397
5398
5399 !! article
5400 Template:loop1
5401 !! text
5402 {{loop2}}
5403 !! endarticle
5404
5405 !! article
5406 Template:loop2
5407 !! text
5408 {{loop1}}
5409 !! endarticle
5410
5411 !! test
5412 Template infinite loop
5413 !! input
5414 {{loop1}}
5415 !! result
5416 <p><span class="error">Template loop detected: <a href="/wiki/Template:Loop1" title="Template:Loop1">Template:Loop1</a></span>
5417 </p>
5418 !! end
5419
5420 !! test
5421 Template from main namespace
5422 !! input
5423 {{:Main Page}}
5424 !! result
5425 <p>blah blah
5426 </p>
5427 !! end
5428
5429 !! article
5430 Template:table
5431 !! text
5432 {|
5433 | 1 || 2
5434 |-
5435 | 3 || 4
5436 |}
5437 !! endarticle
5438
5439 !! test
5440 BUG 529: Template with table, not included at beginning of line
5441 !! input
5442 foo {{table}}
5443 !! result
5444 <p>foo
5445 </p>
5446 <table>
5447 <tr>
5448 <td> 1 </td>
5449 <td> 2
5450 </td></tr>
5451 <tr>
5452 <td> 3 </td>
5453 <td> 4
5454 </td></tr></table>
5455
5456 !! end
5457
5458 !! test
5459 BUG 523: Template shouldn't eat newline (or add an extra one before table)
5460 !! input
5461 foo
5462 {{table}}
5463 !! result
5464 <p>foo
5465 </p>
5466 <table>
5467 <tr>
5468 <td> 1 </td>
5469 <td> 2
5470 </td></tr>
5471 <tr>
5472 <td> 3 </td>
5473 <td> 4
5474 </td></tr></table>
5475
5476 !! end
5477
5478 !! test
5479 BUG 41: Template parameters shown as broken links
5480 !! input
5481 {{{parameter}}}
5482 !! result
5483 <p>{{{parameter}}}
5484 </p>
5485 !! end
5486
5487 !! test
5488 Template with targets containing wikilinks
5489 !! input
5490 {{[[foo]]}}
5491
5492 {{[[{{echo|foo}}]]}}
5493
5494 {{{{echo|[[foo}}]]}}
5495 !! result
5496 <p>{{<a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">foo</a>}}
5497 </p><p>{{<a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">foo</a>}}
5498 </p><p>{{[[foo}}]]
5499 </p>
5500 !! end
5501
5502 !! article
5503 Template:MSGNW test
5504 !! text
5505 ''None'' of '''this''' should be
5506 * interpreted
5507 but rather passed unmodified
5508 {{test}}
5509 !! endarticle
5510
5511 # hmm, fix this or just deprecate msgnw and document its behavior?
5512 !! test
5513 msgnw keyword
5514 !! options
5515 disabled
5516 !! input
5517 {{msgnw:MSGNW test}}
5518 !! result
5519 <p>''None'' of '''this''' should be
5520 * interpreted
5521 but rather passed unmodified
5522 {{test}}
5523 </p>
5524 !! end
5525
5526 !! test
5527 int keyword
5528 !! input
5529 {{int:youhavenewmessages|lots of money|not!}}
5530 !! result
5531 <p>You have lots of money (not!).
5532 </p>
5533 !! end
5534
5535 !! article
5536 Template:Includes
5537 !! text
5538 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
5539 !! endarticle
5540
5541 !! test
5542 <includeonly> and <noinclude> being included
5543 !! input
5544 {{Includes}}
5545 !! result
5546 <p>Foobar
5547 </p>
5548 !! end
5549
5550 !! article
5551 Template:Includes2
5552 !! text
5553 <onlyinclude>Foo</onlyinclude>bar
5554 !! endarticle
5555
5556 !! test
5557 <onlyinclude> being included
5558 !! input
5559 {{Includes2}}
5560 !! result
5561 <p>Foo
5562 </p>
5563 !! end
5564
5565
5566 !! article
5567 Template:Includes3
5568 !! text
5569 <onlyinclude>Foo</onlyinclude>bar<includeonly>zar</includeonly>
5570 !! endarticle
5571
5572 !! test
5573 <onlyinclude> and <includeonly> being included
5574 !! input
5575 {{Includes3}}
5576 !! result
5577 <p>Foo
5578 </p>
5579 !! end
5580
5581 !! test
5582 <includeonly> and <noinclude> on a page
5583 !! input
5584 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
5585 !! result
5586 <p>Foozar
5587 </p>
5588 !! end
5589
5590 !! test
5591 Un-closed <noinclude>
5592 !! input
5593 <noinclude>
5594 !! result
5595 !! end
5596
5597 !! test
5598 <onlyinclude> on a page
5599 !! input
5600 <onlyinclude>Foo</onlyinclude>bar
5601 !! result
5602 <p>Foobar
5603 </p>
5604 !! end
5605
5606 !! test
5607 Un-closed <onlyinclude>
5608 !! input
5609 <onlyinclude>
5610 !! result
5611 !! end
5612
5613 !!test
5614 Self-closed noinclude, includeonly, onlyinclude tags
5615 !!input
5616 <noinclude />
5617 <includeonly />
5618 <onlyinclude />
5619 !!result
5620 <p><br />
5621 </p>
5622 !!end
5623
5624 !!test
5625 Unbalanced includeonly and noinclude tags
5626 !!input
5627 {|
5628 |a</noinclude>
5629 |b</noinclude></noinclude>
5630 |c</noinclude></includeonly>
5631 |d</includeonly></includeonly>
5632 |}
5633 !!result
5634 <table>
5635 <tr>
5636 <td>a
5637 </td>
5638 <td>b
5639 </td>
5640 <td>c&lt;/includeonly&gt;
5641 </td>
5642 <td>d&lt;/includeonly&gt;&lt;/includeonly&gt;
5643 </td></tr></table>
5644
5645 !!end
5646
5647 !! article
5648 Template:Includeonly section
5649 !! text
5650 <includeonly>
5651 ==Includeonly section==
5652 </includeonly>
5653 ==Section T-1==
5654 !!endarticle
5655
5656 !! test
5657 Bug 6563: Edit link generation for section shown by <includeonly>
5658 !! input
5659 {{includeonly section}}
5660 !! result
5661 <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>
5662 <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>
5663
5664 !! end
5665
5666 # Uses same input as the contents of [[Template:Includeonly section]]
5667 !! test
5668 Bug 6563: Section extraction for section shown by <includeonly>
5669 !! options
5670 section=T-2
5671 !! input
5672 <includeonly>
5673 ==Includeonly section==
5674 </includeonly>
5675 ==Section T-2==
5676 !! result
5677 ==Section T-2==
5678 !! end
5679
5680 !! test
5681 Bug 6563: Edit link generation for section suppressed by <includeonly>
5682 !! input
5683 <includeonly>
5684 ==Includeonly section==
5685 </includeonly>
5686 ==Section 1==
5687 !! result
5688 <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>
5689
5690 !! end
5691
5692 !! test
5693 Bug 6563: Section extraction for section suppressed by <includeonly>
5694 !! options
5695 section=1
5696 !! input
5697 <includeonly>
5698 ==Includeonly section==
5699 </includeonly>
5700 ==Section 1==
5701 !! result
5702 ==Section 1==
5703 !! end
5704
5705 !! test
5706 Un-closed <includeonly>
5707 !! input
5708 <includeonly>
5709 !! result
5710 !! end
5711
5712 ###
5713 ### <includeonly> and <noinclude> in attributes
5714 ###
5715 !!test
5716 0. includeonly around the entire attribute
5717 !!input
5718 <span <includeonly>id="v1"</includeonly><noinclude>id="v2"</noinclude>>bar</span>
5719 !!result
5720 <p><span id="v2">bar</span>
5721 </p>
5722 !!end
5723
5724 !!test
5725 1. includeonly in html attr key
5726 !!input
5727 <span <noinclude>id</noinclude><includeonly>about</includeonly>="foo">bar</span>
5728 !!result
5729 <p><span id="foo">bar</span>
5730 </p>
5731 !!end
5732
5733 !!test
5734 2. includeonly in html attr value
5735 !!input
5736 <span id="<noinclude>v1</noinclude><includeonly>v2</includeonly>">bar</span>
5737 <span id=<noinclude>"v1"</noinclude><includeonly>"v2"</includeonly>>bar</span>
5738 !!result
5739 <p><span id="v1">bar</span>
5740 <span id="v1">bar</span>
5741 </p>
5742 !!end
5743
5744 !!test
5745 3. includeonly in part of an attr value
5746 !!input
5747 <span style="color:<noinclude>red</noinclude><includeonly>blue</includeonly>;">bar</span>
5748 !!result
5749 <p><span style="color:red;">bar</span>
5750 </p>
5751 !!end
5752
5753 ###
5754 ### Testing parsing of templates where a template arg
5755 ### has the same name as the template itself.
5756 ###
5757
5758 !! article
5759 Template:quote
5760 !! text
5761 {{{quote|{{{1}}}}}}
5762 !! endarticle
5763
5764 !!test
5765 Templates: Template Name/Arg clash: 1. Use of positional param
5766 !!input
5767 {{quote|foo}}
5768 !!result
5769 <p>foo
5770 </p>
5771 !!end
5772
5773 !!test
5774 Templates: Template Name/Arg clash: 2. Use of named param
5775 !!input
5776 {{quote|quote=foo}}
5777 !!result
5778 <p>foo
5779 </p>
5780 !!end
5781
5782 !!test
5783 Templates: Template Name/Arg clash: 3. Use of named param with empty input
5784 !!input
5785 {{quote|quote}}
5786 !!result
5787 <p>quote
5788 </p>
5789 !!end
5790
5791 ###
5792 ### Parsoid-centric tests to stress Parsoid's ability to RT them unchanged
5793 ###
5794
5795 !!test
5796 Templates: 1. Simple use
5797 !!input
5798 {{echo|Foo}}
5799 !!result
5800 <p>Foo
5801 </p>
5802 !!end
5803
5804 !!test
5805 Templates: 2. Inside a block tag
5806 !!input
5807 <div>{{echo|Foo}}</div>
5808 !!result
5809 <div>Foo</div>
5810
5811 !!end
5812
5813 !!test
5814 Templates: P-wrapping: 1a. Templates on consecutive lines
5815 !!input
5816 {{echo|Foo}}
5817 {{echo|bar}}
5818 !!result
5819 <p>Foo
5820 bar
5821 </p>
5822 !!end
5823
5824 !!test
5825 Templates: P-wrapping: 1b. Templates on consecutive lines
5826 !!input
5827 Foo
5828
5829 {{echo|bar}}
5830 {{echo|baz}}
5831 !!result
5832 <p>Foo
5833 </p><p>bar
5834 baz
5835 </p>
5836 !!end
5837
5838 !!test
5839 Templates: P-wrapping: 1c. Templates on consecutive lines
5840 !!input
5841 {{echo|Foo}}
5842 {{echo|bar}} <div>baz</div>
5843 !!result
5844 <p>Foo
5845 </p>
5846 bar <div>baz</div>
5847
5848 !!end
5849
5850 !!test
5851 Templates: Inline Text: 1. Multiple tmeplate uses
5852 !!input
5853 {{echo|Foo}}bar{{echo|baz}}
5854 !!result
5855 <p>Foobarbaz
5856 </p>
5857 !!end
5858
5859 !!test
5860 Templates: Inline Text: 2. Back-to-back template uses
5861 !!input
5862 {{echo|Foo}}{{echo|bar}}
5863 !!result
5864 <p>Foobar
5865 </p>
5866 !!end
5867
5868 !!test
5869 Templates: Block Tags: 1. Multiple template uses
5870 !!input
5871 {{echo|<div>Foo</div>}}<div>bar</div>{{echo|<div>baz</div>}}
5872 !!result
5873 <div>Foo</div><div>bar</div><div>baz</div>
5874
5875 !!end
5876
5877 !!test
5878 Templates: Block Tags: 2. Back-to-back template uses
5879 !!input
5880 {{echo|<div>Foo</div>}}{{echo|<div>bar</div>}}
5881 !!result
5882 <div>Foo</div><div>bar</div>
5883
5884 !!end
5885
5886 !!test
5887 Templates: Links: 1. Simple example
5888 !!input
5889 {{echo|[[Foo|bar]]}}
5890 !!result
5891 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
5892 </p>
5893 !!end
5894
5895 !!test
5896 Templates: Links: 2. Generation of link href
5897 !!input
5898 [[{{echo|Foo}}|bar]]
5899 !!result
5900 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
5901 </p>
5902 !!end
5903
5904 !!test
5905 Templates: Links: 3. Generation of part of a link href
5906 !!input
5907 [[Fo{{echo|o}}|bar]]
5908
5909 [[Foo{{echo|bar}}]]
5910
5911 [[Foo{{echo|bar}}baz]]
5912
5913 [[Foo{{echo|bar}}|bar]]
5914
5915 [[:Foo{{echo|bar}}]]
5916
5917 [[:Foo{{echo|bar}}|bar]]
5918 !!result
5919 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
5920 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
5921 </p><p><a href="/index.php?title=Foobarbaz&amp;action=edit&amp;redlink=1" class="new" title="Foobarbaz (page does not exist)">Foobarbaz</a>
5922 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
5923 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
5924 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
5925 </p>
5926 !!end
5927
5928 !!test
5929 Templates: Links: 4. Multiple templates generating link href
5930 !!input
5931 [[{{echo|F}}{{echo|o}}ob{{echo|ar}}]]
5932 !!result
5933 <p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
5934 </p>
5935 !!end
5936
5937 !!test
5938 Templates: Links: 5. Generation of link text
5939 !!input
5940 [[Foo|{{echo|bar}}]]
5941 !!result
5942 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
5943 </p>
5944 !!end
5945
5946 !!test
5947 Templates: Links: 5. Nested templates (only outermost template should be marked)
5948 !!input
5949 {{echo|[[{{echo|Foo}}|bar]]}}
5950 !!result
5951 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
5952 </p>
5953 !!end
5954
5955 !!test
5956 Templates: HTML Tag: 1. Generation of HTML attr. key
5957 !!input
5958 <div {{echo|style}}="color:red;">foo</div>
5959 !!result
5960 <div style="color:red;">foo</div>
5961
5962 !!end
5963
5964 !!test
5965 Templates: HTML Tag: 2. Generation of HTML attr. value
5966 !!input
5967 <div style={{echo|'color:red;'}}>foo</div>
5968 !!result
5969 <div style="color:red;">foo</div>
5970
5971 !!end
5972
5973 !!test
5974 Templates: HTML Tag: 3. Generation of HTML attr key and value
5975 !!input
5976 <div {{echo|style}}={{echo|'color:red;'}}>foo</div>
5977 !!result
5978 <div style="color:red;">foo</div>
5979
5980 !!end
5981
5982 !!test
5983 Templates: HTML Tag: 4. Generation of starting piece of HTML attr value
5984 !!input
5985 <div title="{{echo|This is a long title}} with just one piece templated">foo</div>
5986 !!result
5987 <div title="This is a long title with just one piece templated">foo</div>
5988
5989 !!end
5990
5991 !!test
5992 Templates: HTML Tag: 5. Generation of middle piece of HTML attr value
5993 !!input
5994 <div title="This is a long title with just {{echo|one piece}} templated">foo</div>
5995 !!result
5996 <div title="This is a long title with just one piece templated">foo</div>
5997
5998 !!end
5999
6000 !!test
6001 Templates: HTML Tag: 6. Generation of end piece of HTML attr value
6002 !!input
6003 <div title="This is a long title with just one piece {{echo|templated}}">foo</div>
6004 !!result
6005 <div title="This is a long title with just one piece templated">foo</div>
6006
6007 !!end
6008
6009 !!test
6010 Templates: HTML Tables: 1. Generating start of a HTML table
6011 !!input
6012 {{echo|<table><tr><td>foo</td>}}</tr></table>
6013 !!result
6014 <table><tr><td>foo</td></tr></table>
6015
6016 !!end
6017
6018 !!test
6019 Templates: HTML Tables: 2a. Generating middle of a HTML table
6020 !!input
6021 <table><tr>{{echo|<td>foo</td>}}</tr></table>
6022 !!result
6023 <table><tr><td>foo</td></tr></table>
6024
6025 !!end
6026
6027 !!test
6028 Templates: HTML Tables: 2b. Generating middle of a HTML table
6029 !!input
6030 <table>{{echo|<tr><td>foo</td></tr>}}</table>
6031 !!result
6032 <table><tr><td>foo</td></tr></table>
6033
6034 !!end
6035
6036 !!test
6037 Templates: HTML Tables: 3. Generating end of a HTML table
6038 !!input
6039 <table><tr>{{echo|<td>foo</td></tr></table>}}
6040 !!result
6041 <table><tr><td>foo</td></tr></table>
6042
6043 !!end
6044
6045 !!test
6046 Templates: HTML Tables: 4a. Generating a single tag of a HTML table
6047 !!input
6048 {{echo|<table>}}<tr><td>foo</td></tr></table>
6049 !!result
6050 <table><tr><td>foo</td></tr></table>
6051
6052 !!end
6053
6054 !!test
6055 Templates: HTML Tables: 4b. Generating a single tag of a HTML table
6056 !!input
6057 <table>{{echo|<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: 4c. Generating a single tag 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: 4d. Generating a single tag of a HTML table
6074 !!input
6075 <table><tr><td>foo{{echo|</td>}}</tr></table>
6076 !!result
6077 <table><tr><td>foo</td></tr></table>
6078
6079 !!end
6080
6081 !!test
6082 Templates: HTML Tables: 4e. Generating a single tag of a HTML table
6083 !!input
6084 <table><tr><td>foo</td>{{echo|</tr>}}</table>
6085 !!result
6086 <table><tr><td>foo</td></tr></table>
6087
6088 !!end
6089
6090 !!test
6091 Templates: HTML Tables: 4f. Generating a single tag of a HTML table
6092 !!input
6093 <table><tr><td>foo</td></tr>{{echo|</table>}}
6094 !!result
6095 <table><tr><td>foo</td></tr></table>
6096
6097 !!end
6098
6099 !!test
6100 Templates: Wiki Tables: 1a. Fostering of entire template content
6101 !!input
6102 {|
6103 {{echo|a}}
6104 |}
6105 !!result
6106 <table>
6107 a
6108 <tr><td></td></tr></table>
6109
6110 !!end
6111
6112 !!test
6113 Templates: Wiki Tables: 1b. Fostering of entire template content
6114 !!input
6115 {|
6116 {{echo|<div>}}
6117 foo
6118 {{echo|</div>}}
6119 |}
6120 !!result
6121 <table>
6122 <div>
6123 <p>foo
6124 </p>
6125 </div>
6126 <tr><td></td></tr></table>
6127
6128 !!end
6129
6130 !!test
6131 Templates: Wiki Tables: 2. Fostering of partial template content
6132 !!input
6133 {|
6134 {{echo|a
6135 <div>b</div>}}
6136 |}
6137 !!result
6138 <table>
6139 a
6140 <div>b</div>
6141 <tr><td></td></tr></table>
6142
6143 !!end
6144
6145 !!test
6146 Templates: Wiki Tables: 3. td-content via multiple templates
6147 !!input
6148 {|
6149 {{echo|{{pipe}}a}}{{echo|b}}
6150 |}
6151 !!result
6152 <table>
6153 <tr>
6154 <td>ab
6155 </td></tr></table>
6156
6157 !!end
6158
6159 !!test
6160 Templates: Wiki Tables: 4. Templated tags, no content
6161 !!input
6162 {{tbl-start}}
6163 {{tbl-end}}
6164 !!result
6165 <table>
6166 <tr><td></td></tr></table>
6167
6168 !!end
6169
6170 !!test
6171 Templates: Wiki Tables: 5. Templated tags, regular td-tags
6172 !!input
6173 {{tbl-start}}
6174 |foo
6175 {{tbl-end}}
6176 !!result
6177 <table>
6178 <tr>
6179 <td>foo
6180 </td></tr></table>
6181
6182 !!end
6183
6184 !!test
6185 Templates: Wiki Tables: 6. Templated tags, templated td-tags
6186 !!input
6187 {{tbl-start}}
6188 {{!}}foo
6189 {{tbl-end}}
6190 !!result
6191 <table>
6192 <tr>
6193 <td>foo
6194 </td></tr></table>
6195
6196 !!end
6197
6198 !!test
6199 Templates: Lists: Multi-line list-items via templates
6200 !!input
6201 *{{echo|a {{nonexistent|
6202 unused}}}}
6203 *{{echo|b {{nonexistent|
6204 unused}}}}
6205 !!result
6206 <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>
6207 </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>
6208 </li></ul>
6209
6210 !!end
6211
6212 !!test
6213 Templates: Ugly nesting: 1. Quotes opened/closed across templates (echo)
6214 !!input
6215 {{echo|''a}}{{echo|b''c''d}}{{echo|''e}}
6216 !!result
6217 <p><i>ab</i>c<i>d</i>e
6218 </p>
6219 !!end
6220
6221 !!test
6222 Templates: Ugly nesting: 2. Quotes opened/closed across templates (echo_with_span)
6223 (PHP parser generates misnested html)
6224 !! options
6225 disabled
6226 !!input
6227 {{echo_with_span|''a}}{{echo_with_span|b''c''d}}{{echo_with_span|''e}}
6228 !!result
6229 <p><span><i>a</i></span><i><span>b</span></i><span>c</span><i>d</i><span>e</span></p>
6230 !!end
6231
6232 !!test
6233 Templates: Ugly nesting: 3. Quotes opened/closed across templates (echo_with_div)
6234 (PHP parser generates misnested html)
6235 !! options
6236 disabled
6237 !!input
6238 {{echo_with_div|''a}}{{echo_with_div|b''c''d}}{{echo_with_div|''e}}
6239 !!result
6240 <div><i>a</i></div>
6241 <div><i>b</i>c<i>d</i></div>
6242 <div>e</div>
6243 !!end
6244
6245 !!test
6246 Templates: Ugly nesting: 4. Divs opened/closed across templates
6247 !!input
6248 a<div>b{{echo|c</div>d}}e
6249 !!result
6250 a<div>bc</div>de
6251
6252 !!end
6253
6254 !!test
6255 Templates: Ugly templates: 1. Navbox template parses badly leading to table misnesting
6256 (Parsoid-centric)
6257 !! options
6258 parsoid
6259 !!input
6260 {|
6261 |{{echo|foo</table>}}
6262 |bar
6263 |}
6264 !!result
6265 <table about="#mwt1" typeof="mw:Object/Template ">
6266 <tbody><tr><td>foo</td></tr></tbody></table><span about="#mwt1">
6267 bar</span><span about="#mwt1">
6268 </span>
6269 !!end
6270
6271 !!test
6272 Templates: Ugly templates: 2. Navbox template parses badly leading to table misnesting
6273 (Parsoid-centric)
6274 !! options
6275 parsoid
6276 !!input
6277 <table>
6278 <tr>
6279 <td>
6280 <table>
6281 <tr>
6282 <td>1. {{echo|foo </table>}}</td>
6283 <td> bar </td>
6284 <td>2. {{echo|baz </table>}}</td>
6285 </tr>
6286 <tr>
6287 <td>abc</td>
6288 </tr>
6289 </table>
6290 </td>
6291 </tr>
6292 <tr>
6293 <td>xyz</td>
6294 </tr>
6295 </table>
6296 !!result
6297 <table about="#mwt1" typeof="mw:Object/Template">
6298 <tbody><tr >
6299 <td >
6300 <table >
6301 <tbody><tr >
6302 <td >1. foo </td></tr></tbody></table></td>
6303 <td > bar </td>
6304 <td >2. baz </td></tr></tbody></table><span about="#mwt1">
6305 </span><span about="#mwt1">
6306
6307 abc</span><span about="#mwt1">
6308 </span><span about="#mwt1">
6309 </span><span about="#mwt1">
6310 </span><span about="#mwt1">
6311 </span><span about="#mwt1">
6312
6313 xyz</span><span about="#mwt1">
6314 </span><span about="#mwt1">
6315 </span>
6316 !!end
6317
6318 !! test
6319 Templates: Ugly templates: 3. newline-only template parameter
6320 !! input
6321 foo {{echo|
6322 }}
6323 !! result
6324 <p>foo
6325 </p>
6326 !! end
6327
6328 # This looks like a bug: a single newline triggers p/br for some reason.
6329 !! test
6330 Templates: Ugly templates: 4. newline-only template parameter inconsistency
6331 !! input
6332 {{echo|
6333 }}
6334 !! result
6335 <p><br />
6336 </p>
6337 !! end
6338
6339
6340 !!test
6341 Parser Functions: 1. Simple example
6342 !!input
6343 {{uc:foo}}
6344 !!result
6345 <p>FOO
6346 </p>
6347 !!end
6348
6349 !!test
6350 Parser Functions: 2. Nested use (only outermost should be marked up)
6351 !!input
6352 {{uc:{{lc:FOO}}}}
6353 !!result
6354 <p>FOO
6355 </p>
6356 !!end
6357
6358 ###
6359 ### Pre-save transform tests
6360 ###
6361 !! test
6362 pre-save transform: subst:
6363 !! options
6364 PST
6365 !! input
6366 {{subst:test}}
6367 !! result
6368 This is a test template
6369 !! end
6370
6371 !! test
6372 pre-save transform: normal template
6373 !! options
6374 PST
6375 !! input
6376 {{test}}
6377 !! result
6378 {{test}}
6379 !! end
6380
6381 !! test
6382 pre-save transform: nonexistent template
6383 !! options
6384 PST
6385 !! input
6386 {{thistemplatedoesnotexist}}
6387 !! result
6388 {{thistemplatedoesnotexist}}
6389 !! end
6390
6391
6392 !! test
6393 pre-save transform: subst magic variables
6394 !! options
6395 PST
6396 !! input
6397 {{subst:SITENAME}}
6398 !! result
6399 MediaWiki
6400 !! end
6401
6402 # This is bug 89, which I fixed. -- wtm
6403 !! test
6404 pre-save transform: subst: templates with parameters
6405 !! options
6406 pst
6407 !! input
6408 {{subst:paramtest|param="something else"}}
6409 !! result
6410 This is a test template with parameter "something else"
6411 !! end
6412
6413 !! article
6414 Template:nowikitest
6415 !! text
6416 <nowiki>'''not wiki'''</nowiki>
6417 !! endarticle
6418
6419 !! test
6420 pre-save transform: nowiki in subst (bug 1188)
6421 !! options
6422 pst
6423 !! input
6424 {{subst:nowikitest}}
6425 !! result
6426 <nowiki>'''not wiki'''</nowiki>
6427 !! end
6428
6429
6430 !! article
6431 Template:commenttest
6432 !! text
6433 This template has <!-- a comment --> in it.
6434 !! endarticle
6435
6436 !! test
6437 pre-save transform: comment in subst (bug 1936)
6438 !! options
6439 pst
6440 !! input
6441 {{subst:commenttest}}
6442 !! result
6443 This template has <!-- a comment --> in it.
6444 !! end
6445
6446 !! test
6447 pre-save transform: unclosed tag
6448 !! options
6449 pst noxml
6450 !! input
6451 <nowiki>'''not wiki'''
6452 !! result
6453 <nowiki>'''not wiki'''
6454 !! end
6455
6456 !! test
6457 pre-save transform: mixed tag case
6458 !! options
6459 pst noxml
6460 !! input
6461 <NOwiki>'''not wiki'''</noWIKI>
6462 !! result
6463 <NOwiki>'''not wiki'''</noWIKI>
6464 !! end
6465
6466 !! test
6467 pre-save transform: unclosed comment in <nowiki>
6468 !! options
6469 pst noxml
6470 !! input
6471 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
6472 !! result
6473 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
6474 !!end
6475
6476 !! article
6477 Template:dangerous
6478 !!text
6479 <span onmouseover="alert('crap')">Oh no</span>
6480 !!endarticle
6481
6482 !!test
6483 (confirming safety of fix for subst bug 1936)
6484 !! input
6485 {{Template:dangerous}}
6486 !! result
6487 <p><span>Oh no</span>
6488 </p>
6489 !! end
6490
6491 !! test
6492 pre-save transform: comment containing gallery (bug 5024)
6493 !! options
6494 pst
6495 !! input
6496 <!-- <gallery>data</gallery> -->
6497 !!result
6498 <!-- <gallery>data</gallery> -->
6499 !!end
6500
6501 !! test
6502 pre-save transform: comment containing extension
6503 !! options
6504 pst
6505 !! input
6506 <!-- <tag>data</tag> -->
6507 !!result
6508 <!-- <tag>data</tag> -->
6509 !!end
6510
6511 !! test
6512 pre-save transform: comment containing nowiki
6513 !! options
6514 pst
6515 !! input
6516 <!-- <nowiki>data</nowiki> -->
6517 !!result
6518 <!-- <nowiki>data</nowiki> -->
6519 !!end
6520
6521 !! test
6522 pre-save transform: <noinclude> in subst (bug 3298)
6523 !! options
6524 pst
6525 !! input
6526 {{subst:Includes}}
6527 !! result
6528 Foobar
6529 !! end
6530
6531 !! test
6532 pre-save transform: <onlyinclude> in subst (bug 3298)
6533 !! options
6534 pst
6535 !! input
6536 {{subst:Includes2}}
6537 !! result
6538 Foo
6539 !! end
6540
6541 !! article
6542 Template:SubstTest
6543 !!text
6544 {{<includeonly>subst:</includeonly>Includes}}
6545 !! endarticle
6546
6547 !! article
6548 Template:SafeSubstTest
6549 !! text
6550 {{<includeonly>safesubst:</includeonly>Includes}}
6551 !! endarticle
6552
6553 !! test
6554 bug 22297: safesubst: works during PST
6555 !! options
6556 pst
6557 !! input
6558 {{subst:SafeSubstTest}}{{safesubst:SubstTest}}
6559 !! result
6560 FoobarFoobar
6561 !! end
6562
6563 !! test
6564 bug 22297: safesubst: works during normal parse
6565 !! input
6566 {{SafeSubstTest}}
6567 !! result
6568 <p>Foobar
6569 </p>
6570 !! end
6571
6572 !! test:
6573 subst: does not work during normal parse
6574 !! input
6575 {{SubstTest}}
6576 !! result
6577 <p>{{subst:Includes}}
6578 </p>
6579 !! end
6580
6581 !! test
6582 pre-save transform: context links ("pipe trick")
6583 !! options
6584 pst
6585 !! input
6586 [[Article (context)|]]
6587 [[Bar:Article|]]
6588 [[:Bar:Article|]]
6589 [[Bar:Article (context)|]]
6590 [[:Bar:Article (context)|]]
6591 [[|Article]]
6592 [[|Article (context)]]
6593 [[Bar:X (Y) Z|]]
6594 [[:Bar:X (Y) Z|]]
6595 !! result
6596 [[Article (context)|Article]]
6597 [[Bar:Article|Article]]
6598 [[:Bar:Article|Article]]
6599 [[Bar:Article (context)|Article]]
6600 [[:Bar:Article (context)|Article]]
6601 [[Article]]
6602 [[Article (context)]]
6603 [[Bar:X (Y) Z|X (Y) Z]]
6604 [[:Bar:X (Y) Z|X (Y) Z]]
6605 !! end
6606
6607 !! test
6608 pre-save transform: context links ("pipe trick") with interwiki prefix
6609 !! options
6610 pst
6611 !! input
6612 [[interwiki:Article|]]
6613 [[:interwiki:Article|]]
6614 [[interwiki:Bar:Article|]]
6615 [[:interwiki:Bar:Article|]]
6616 !! result
6617 [[interwiki:Article|Article]]
6618 [[:interwiki:Article|Article]]
6619 [[interwiki:Bar:Article|Bar:Article]]
6620 [[:interwiki:Bar:Article|Bar:Article]]
6621 !! end
6622
6623 !! test
6624 pre-save transform: context links ("pipe trick") with parens in title
6625 !! options
6626 pst title=[[Somearticle (context)]]
6627 !! input
6628 [[|Article]]
6629 !! result
6630 [[Article (context)|Article]]
6631 !! end
6632
6633 !! test
6634 pre-save transform: context links ("pipe trick") with comma in title
6635 !! options
6636 pst title=[[Someplace, Somewhere]]
6637 !! input
6638 [[|Otherplace]]
6639 [[Otherplace, Elsewhere|]]
6640 [[Otherplace, Elsewhere, Anywhere|]]
6641 !! result
6642 [[Otherplace, Somewhere|Otherplace]]
6643 [[Otherplace, Elsewhere|Otherplace]]
6644 [[Otherplace, Elsewhere, Anywhere|Otherplace]]
6645 !! end
6646
6647 !! test
6648 pre-save transform: context links ("pipe trick") with parens and comma
6649 !! options
6650 pst title=[[Someplace (IGNORED), Somewhere]]
6651 !! input
6652 [[|Otherplace]]
6653 [[Otherplace (place), Elsewhere|]]
6654 !! result
6655 [[Otherplace, Somewhere|Otherplace]]
6656 [[Otherplace (place), Elsewhere|Otherplace]]
6657 !! end
6658
6659 !! test
6660 pre-save transform: context links ("pipe trick") with comma and parens
6661 !! options
6662 pst title=[[Who, me? (context)]]
6663 !! input
6664 [[|Yes, you.]]
6665 [[Me, Myself, and I (1937 song)|]]
6666 !! result
6667 [[Yes, you. (context)|Yes, you.]]
6668 [[Me, Myself, and I (1937 song)|Me, Myself, and I]]
6669 !! end
6670
6671 !! test
6672 pre-save transform: context links ("pipe trick") with namespace
6673 !! options
6674 pst title=[[Ns:Somearticle]]
6675 !! input
6676 [[|Article]]
6677 !! result
6678 [[Ns:Article|Article]]
6679 !! end
6680
6681 !! test
6682 pre-save transform: context links ("pipe trick") with namespace and parens
6683 !! options
6684 pst title=[[Ns:Somearticle (context)]]
6685 !! input
6686 [[|Article]]
6687 !! result
6688 [[Ns:Article (context)|Article]]
6689 !! end
6690
6691 !! test
6692 pre-save transform: context links ("pipe trick") with namespace and comma
6693 !! options
6694 pst title=[[Ns:Somearticle, Context, Whatever]]
6695 !! input
6696 [[|Article]]
6697 !! result
6698 [[Ns:Article, Context, Whatever|Article]]
6699 !! end
6700
6701 !! test
6702 pre-save transform: context links ("pipe trick") with namespace, comma and parens
6703 !! options
6704 pst title=[[Ns:Somearticle, Context (context)]]
6705 !! input
6706 [[|Article]]
6707 !! result
6708 [[Ns:Article (context)|Article]]
6709 !! end
6710
6711 !! test
6712 pre-save transform: context links ("pipe trick") with namespace, parens and comma
6713 !! options
6714 pst title=[[Ns:Somearticle (IGNORED), Context]]
6715 !! input
6716 [[|Article]]
6717 !! result
6718 [[Ns:Article, Context|Article]]
6719 !! end
6720
6721 !! test
6722 pre-save transform: context links ("pipe trick") with full-width parens and no space (Japanese and Chinese style, bug 30149)
6723 !! options
6724 pst
6725 !! input
6726 [[Article(context)|]]
6727 [[Bar:Article(context)|]]
6728 [[:Bar:Article(context)|]]
6729 [[|Article(context)]]
6730 [[Bar:X(Y)Z|]]
6731 [[:Bar:X(Y)Z|]]
6732 !! result
6733 [[Article(context)|Article]]
6734 [[Bar:Article(context)|Article]]
6735 [[:Bar:Article(context)|Article]]
6736 [[Article(context)]]
6737 [[Bar:X(Y)Z|X(Y)Z]]
6738 [[:Bar:X(Y)Z|X(Y)Z]]
6739 !! end
6740
6741 !! test
6742 pre-save transform: context links ("pipe trick") with full-width parens and space (Japanese and Chinese style, bug 30149)
6743 !! options
6744 pst
6745 !! input
6746 [[Article (context)|]]
6747 [[Bar:Article (context)|]]
6748 [[:Bar:Article (context)|]]
6749 [[|Article (context)]]
6750 [[Bar:X (Y) Z|]]
6751 [[:Bar:X (Y) Z|]]
6752 !! result
6753 [[Article (context)|Article]]
6754 [[Bar:Article (context)|Article]]
6755 [[:Bar:Article (context)|Article]]
6756 [[Article (context)]]
6757 [[Bar:X (Y) Z|X (Y) Z]]
6758 [[:Bar:X (Y) Z|X (Y) Z]]
6759 !! end
6760
6761 !! test
6762 pre-save transform: context links ("pipe trick") with parens and no space (Korean style, bug 30149)
6763 !! options
6764 pst
6765 !! input
6766 [[Article(context)|]]
6767 [[Bar:Article(context)|]]
6768 [[:Bar:Article(context)|]]
6769 [[|Article(context)]]
6770 [[Bar:X(Y)Z|]]
6771 [[:Bar:X(Y)Z|]]
6772 !! result
6773 [[Article(context)|Article]]
6774 [[Bar:Article(context)|Article]]
6775 [[:Bar:Article(context)|Article]]
6776 [[Article(context)]]
6777 [[Bar:X(Y)Z|X(Y)Z]]
6778 [[:Bar:X(Y)Z|X(Y)Z]]
6779 !! end
6780
6781 !! test
6782 pre-save transform: context links ("pipe trick") with commas (bug 21660)
6783 !! options
6784 pst
6785 !! input
6786 [[Article (context), context|]]
6787 [[Article (context),context|]]
6788 [[Bar:Article (context), context|]]
6789 [[Bar:Article (context),context|]]
6790 [[:Bar:Article (context), context|]]
6791 [[:Bar:Article (context),context|]]
6792 !! result
6793 [[Article (context), context|Article]]
6794 [[Article (context),context|Article]]
6795 [[Bar:Article (context), context|Article]]
6796 [[Bar:Article (context),context|Article]]
6797 [[:Bar:Article (context), context|Article]]
6798 [[:Bar:Article (context),context|Article]]
6799 !! end
6800
6801 !! test
6802 pre-save transform: trim trailing empty lines
6803 !! options
6804 pst
6805 !! input
6806 Empty lines are trimmed
6807
6808
6809
6810
6811 !! result
6812 Empty lines are trimmed
6813 !! end
6814
6815 !! test
6816 pre-save transform: Signature expansion
6817 !! options
6818 pst
6819 !! input
6820 * ~~~
6821 * <noinclude>~~~</noinclude>
6822 * <includeonly>~~~</includeonly>
6823 * <onlyinclude>~~~</onlyinclude>
6824 !! result
6825 * [[Special:Contributions/127.0.0.1|127.0.0.1]]
6826 * <noinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</noinclude>
6827 * <includeonly>[[Special:Contributions/127.0.0.1|127.0.0.1]]</includeonly>
6828 * <onlyinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</onlyinclude>
6829 !! end
6830
6831
6832 !! test
6833 pre-save transform: Signature expansion in nowiki tags (bug 93)
6834 !! options
6835 pst disabled
6836 !! input
6837 Shall not expand:
6838
6839 <nowiki>~~~~</nowiki>
6840
6841 <includeonly><nowiki>~~~~</nowiki></includeonly>
6842
6843 <noinclude><nowiki>~~~~</nowiki></noinclude>
6844
6845 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
6846
6847 {{subst:Foo}} shall be converted to FOO
6848
6849 As well as inside noinclude/onlyinclude
6850 <noinclude>{{subst:Foo}}</noinclude>
6851 <onlyinclude>{{subst:Foo}}</onlyinclude>
6852
6853 But not inside includeonly
6854 <includeonly>{{subst:Foo}}</includeonly>
6855 !! result
6856 Shall not expand:
6857
6858 <nowiki>~~~~</nowiki>
6859
6860 <includeonly><nowiki>~~~~</nowiki></includeonly>
6861
6862 <noinclude><nowiki>~~~~</nowiki></noinclude>
6863
6864 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
6865
6866 FOO shall be converted to FOO
6867
6868 As well as inside noinclude/onlyinclude
6869 <noinclude>FOO</noinclude>
6870 <onlyinclude>FOO</onlyinclude>
6871
6872 But not inside includeonly
6873 <includeonly>{{subst:Foo}}</includeonly>
6874 !! end
6875
6876 ###
6877 ### Message transform tests
6878 ###
6879 !! test
6880 message transform: magic variables
6881 !! options
6882 msg
6883 !! input
6884 {{SITENAME}}
6885 !! result
6886 MediaWiki
6887 !! end
6888
6889 !! test
6890 message transform: should not transform wiki markup
6891 !! options
6892 msg
6893 !! input
6894 ''test''
6895 !! result
6896 ''test''
6897 !! end
6898
6899 !! test
6900 message transform: <noinclude> in transcluded template (bug 4926)
6901 !! options
6902 msg
6903 !! input
6904 {{Includes}}
6905 !! result
6906 Foobar
6907 !! end
6908
6909 !! test
6910 message transform: <onlyinclude> in transcluded template (bug 4926)
6911 !! options
6912 msg
6913 !! input
6914 {{Includes2}}
6915 !! result
6916 Foo
6917 !! end
6918
6919 !! test
6920 {{#special:}} page name, known
6921 !! options
6922 msg
6923 !! input
6924 {{#special:Recentchanges}}
6925 !! result
6926 Special:RecentChanges
6927 !! end
6928
6929 !! test
6930 {{#special:}} page name with subpage, known
6931 !! options
6932 msg
6933 !! input
6934 {{#special:Recentchanges/param}}
6935 !! result
6936 Special:RecentChanges/param
6937 !! end
6938
6939 !! test
6940 {{#special:}} page name, unknown
6941 !! options
6942 msg
6943 !! input
6944 {{#special:foobarnonexistent}}
6945 !! result
6946 No such special page
6947 !! end
6948
6949 !! test
6950 {{#speciale:}} page name, known
6951 !! options
6952 msg
6953 !! input
6954 {{#speciale:Recentchanges}}
6955 !! result
6956 Special:RecentChanges
6957 !! end
6958
6959 !! test
6960 {{#speciale:}} page name with subpage, known
6961 !! options
6962 msg
6963 !! input
6964 {{#speciale:Recentchanges/param}}
6965 !! result
6966 Special:RecentChanges/param
6967 !! end
6968
6969 !! test
6970 {{#speciale:}} page name, unknown
6971 !! options
6972 msg
6973 !! input
6974 {{#speciale:foobarnonexistent}}
6975 !! result
6976 No_such_special_page
6977 !! end
6978
6979 ###
6980 ### Images
6981 ###
6982 !! test
6983 Simple image
6984 !! input
6985 [[Image:foobar.jpg]]
6986 !! result
6987 <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>
6988 </p>
6989 !! end
6990
6991 !! test
6992 Right-aligned image
6993 !! input
6994 [[Image:foobar.jpg|right]]
6995 !! result
6996 <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>
6997
6998 !! end
6999
7000 !! test
7001 Simple image (using File: namespace, now canonical)
7002 !! input
7003 [[File:foobar.jpg]]
7004 !! result
7005 <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>
7006 </p>
7007 !! end
7008
7009 !! test
7010 Image with caption
7011 !! input
7012 [[Image:foobar.jpg|right|Caption text]]
7013 !! result
7014 <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>
7015
7016 !! end
7017
7018 !! test
7019 Image with empty attribute
7020 !! input
7021 [[Image:foobar.jpg|right||Caption text]]
7022 !! result
7023 <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>
7024
7025 !! end
7026
7027 !! test
7028 Image with link tails
7029 !! input
7030 123[[Image:foobar.jpg]]456
7031 123[[Image:foobar.jpg|right]]456
7032 123[[Image:foobar.jpg|thumb]]456
7033 !! result
7034 <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
7035 </p>
7036 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
7037 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
7038
7039 !! end
7040
7041 !! test
7042 Image with multiple captions -- only last one is accepted
7043 !! input
7044 [[Image:foobar.jpg|right|Caption1 - ignored|[[Caption2]] - ignored|Caption3 - accepted]]
7045 !! result
7046 <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>
7047
7048 !! end
7049
7050 !! test
7051 Image with width attribute at different positions
7052 !! input
7053 [[Image:foobar.jpg|200px|right|Caption]]
7054 [[Image:foobar.jpg|right|200px|Caption]]
7055 [[Image:foobar.jpg|right|Caption|200px]]
7056 !! result
7057 <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>
7058 <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>
7059 <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>
7060
7061 !! end
7062
7063 !! test
7064 Image with link parameter, wiki target
7065 !! input
7066 [[Image:foobar.jpg|link=Target page]]
7067 !! result
7068 <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>
7069 </p>
7070 !! end
7071
7072 !! test
7073 Image with link parameter, URL target
7074 !! input
7075 [[Image:foobar.jpg|link=http://example.com/]]
7076 !! result
7077 <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>
7078 </p>
7079 !! end
7080
7081 !! test
7082 Image with link parameter, wgExternalLinkTarget
7083 !! input
7084 [[Image:foobar.jpg|link=http://example.com/]]
7085 !! config
7086 wgExternalLinkTarget='foobar'
7087 !! result
7088 <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>
7089 </p>
7090 !! end
7091
7092 !! test
7093 Image with link parameter, wgNoFollowLinks set to false
7094 !! input
7095 [[Image:foobar.jpg|link=http://example.com/]]
7096 !! config
7097 wgNoFollowLinks=false
7098 !! result
7099 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
7100 </p>
7101 !! end
7102
7103 !! test
7104 Image with link parameter, wgNoFollowDomainExceptions
7105 !! input
7106 [[Image:foobar.jpg|link=http://example.com/]]
7107 !! config
7108 wgNoFollowDomainExceptions='example.com'
7109 !! result
7110 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
7111 </p>
7112 !! end
7113
7114 !! test
7115 Image with link parameter, wgExternalLinkTarget, unnamed parameter
7116 !! input
7117 [[Image:foobar.jpg|link=http://example.com/|Title]]
7118 !! config
7119 wgExternalLinkTarget='foobar'
7120 !! result
7121 <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>
7122 </p>
7123 !! end
7124
7125 !! test
7126 Image with empty link parameter
7127 !! input
7128 [[Image:foobar.jpg|link=]]
7129 !! result
7130 <p><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" />
7131 </p>
7132 !! end
7133
7134 !! test
7135 Image with link parameter (wiki target) and unnamed parameter
7136 !! input
7137 [[Image:foobar.jpg|link=Target page|Title]]
7138 !! result
7139 <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>
7140 </p>
7141 !! end
7142
7143 !! test
7144 Image with link parameter (URL target) and unnamed parameter
7145 !! input
7146 [[Image:foobar.jpg|link=http://example.com/|Title]]
7147 !! result
7148 <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>
7149 </p>
7150 !! end
7151
7152 !! test
7153 Thumbnail image with link parameter
7154 !! input
7155 [[Image:foobar.jpg|thumb|link=http://example.com/|Title]]
7156 !! result
7157 <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>
7158
7159 !! end
7160
7161 !! test
7162 Image with frame and link
7163 !! input
7164 [[Image:Foobar.jpg|frame|left|This is a test image [[Main Page]]]]
7165 !! result
7166 <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>
7167
7168 !! end
7169
7170 !! test
7171 Image with frame and link and explicit alt
7172 !! input
7173 [[Image:Foobar.jpg|frame|left|This is a test image [[Main Page]]|alt=Altitude]]
7174 !! result
7175 <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>
7176
7177 !! end
7178
7179 !! test
7180 Image with wiki markup in implicit alt
7181 !! input
7182 [[Image:Foobar.jpg|testing '''bold''' in alt]]
7183 !! result
7184 <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>
7185 </p>
7186 !! end
7187
7188 !! test
7189 Image with wiki markup in explicit alt
7190 !! input
7191 [[Image:Foobar.jpg|alt=testing '''bold''' in alt]]
7192 !! result
7193 <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>
7194 </p>
7195 !! end
7196
7197 !! test
7198 Link to image page- image page normally doesn't exists, hence edit link
7199 Add test with existing image page
7200 #<p><a href="/wiki/File:Test" title="Image:Test">Image:test</a>
7201 !! input
7202 [[:Image:test]]
7203 !! result
7204 <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>
7205 </p>
7206 !! end
7207
7208 !! test
7209 bug 18784 Link to non-existent image page with caption should use caption as link text
7210 !! input
7211 [[:Image:test|caption]]
7212 !! result
7213 <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>
7214 </p>
7215 !! end
7216
7217 !! test
7218 Frameless image caption with a free URL
7219 !! input
7220 [[Image:foobar.jpg|http://example.com]]
7221 !! result
7222 <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>
7223 </p>
7224 !! end
7225
7226 !! test
7227 Thumbnail image caption with a free URL
7228 !! input
7229 [[Image:foobar.jpg|thumb|http://example.com]]
7230 !! result
7231 <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>
7232
7233 !! end
7234
7235 !! test
7236 Thumbnail image caption with a free URL and explicit alt
7237 !! input
7238 [[Image:foobar.jpg|thumb|http://example.com|alt=Alteration]]
7239 !! result
7240 <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>
7241
7242 !! end
7243
7244 !! test
7245 BUG 1887: A ISBN with a thumbnail
7246 !! input
7247 [[Image:foobar.jpg|thumb|ISBN 1235467890]]
7248 !! result
7249 <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>
7250
7251 !! end
7252
7253 !! test
7254 BUG 1887: A RFC with a thumbnail
7255 !! input
7256 [[Image:foobar.jpg|thumb|This is RFC 12354]]
7257 !! result
7258 <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>
7259
7260 !! end
7261
7262 !! test
7263 BUG 1887: A mailto link with a thumbnail
7264 !! input
7265 [[Image:foobar.jpg|thumb|Please mailto:nobody@example.com]]
7266 !! result
7267 <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>
7268
7269 !! end
7270
7271 # Pending resolution to bug 368
7272 !! test
7273 BUG 648: Frameless image caption with a link
7274 !! input
7275 [[Image:foobar.jpg|text with a [[link]] in it]]
7276 !! result
7277 <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>
7278 </p>
7279 !! end
7280
7281 !! test
7282 BUG 648: Frameless image caption with a link (suffix)
7283 !! input
7284 [[Image:foobar.jpg|text with a [[link]]foo in it]]
7285 !! result
7286 <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>
7287 </p>
7288 !! end
7289
7290 !! test
7291 BUG 648: Frameless image caption with an interwiki link
7292 !! input
7293 [[Image:foobar.jpg|text with a [[MeatBall:Link]] in it]]
7294 !! result
7295 <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>
7296 </p>
7297 !! end
7298
7299 !! test
7300 BUG 648: Frameless image caption with a piped interwiki link
7301 !! input
7302 [[Image:foobar.jpg|text with a [[MeatBall:Link|link]] in it]]
7303 !! result
7304 <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>
7305 </p>
7306 !! end
7307
7308 !! test
7309 Escape HTML special chars in image alt text
7310 !! input
7311 [[Image:foobar.jpg|& < > "]]
7312 !! result
7313 <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>
7314 </p>
7315 !! end
7316
7317 !! test
7318 BUG 499: Alt text should have &#1234;, not &amp;1234;
7319 !! input
7320 [[Image:foobar.jpg|&#9792;]]
7321 !! result
7322 <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>
7323 </p>
7324 !! end
7325
7326 !! test
7327 Broken image caption with link
7328 !! input
7329 [[Image:Foobar.jpg|thumb|This is a broken caption. But [[Main Page|this]] is just an ordinary link.
7330 !! result
7331 <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.
7332 </p>
7333 !! end
7334
7335 !! test
7336 Image caption containing another image
7337 !! input
7338 [[Image:Foobar.jpg|thumb|This is a caption with another [[Image:icon.png|image]] inside it!]]
7339 !! result
7340 <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>
7341
7342 !! end
7343
7344 !! test
7345 Image caption containing a newline
7346 !! input
7347 [[Image:Foobar.jpg|This
7348 *is some text]]
7349 !! result
7350 <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>
7351 </p>
7352 !!end
7353
7354 !!test
7355 Parsoid: Image caption containing leading space
7356 (The leading space should not trigger nowiki escaping in wt2wt mode)
7357 !! input
7358 [[Image:Foobar.jpg|thumb| bar]]
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>bar</div></div></div>
7361
7362 !!end
7363
7364 !! test
7365 Bug 3090: External links other than http: in image captions
7366 !! input
7367 [[Image:Foobar.jpg|thumb|200px|This caption has [irc://example.net irc] and [https://example.com Secure] ext links in it.]]
7368 !! result
7369 <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>
7370
7371 !! end
7372
7373 !! test
7374 Custom class
7375 !! input
7376 [[Image:foobar.jpg|a|class=b]]
7377 !! result
7378 <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>
7379 </p>
7380 !! end
7381
7382 !! test
7383 Localized image handling (1).
7384 !! options
7385 language=es
7386 !! input
7387 [[Archivo:Foobar.jpg|izquierda|enlace=foo|caption]]
7388 !! result
7389 <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>
7390
7391 !! end
7392
7393 !! test
7394 Localized image handling (2).
7395 !! options
7396 language=es
7397 !! input
7398 [[Archivo:Foobar.jpg|miniatura|izquierda|enlace=foo|caption]]
7399 !! result
7400 <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>
7401
7402 !! end
7403
7404 !! test
7405 "border", "frameless" and "class" attributes on an image.
7406 !! input
7407 [[File:Foobar.jpg|frameless|border|class=extra|caption]]
7408 !! result
7409 <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>
7410 </p>
7411 !! end
7412
7413 !! article
7414 File:Barfoo.jpg
7415 !! text
7416 #REDIRECT [[File:Barfoo.jpg]]
7417 !! endarticle
7418
7419 !! test
7420 Redirected image
7421 !! input
7422 [[Image:Barfoo.jpg]]
7423 !! result
7424 <p><a href="/wiki/File:Barfoo.jpg" title="File:Barfoo.jpg">File:Barfoo.jpg</a>
7425 </p>
7426 !! end
7427
7428 !! test
7429 Missing image with uploads disabled
7430 !! options
7431 wgEnableUploads=0
7432 !! input
7433 [[Image:Foobaz.jpg]]
7434 !! result
7435 <p><a href="/wiki/File:Foobaz.jpg" title="File:Foobaz.jpg">File:Foobaz.jpg</a>
7436 </p>
7437 !! end
7438
7439
7440 ###
7441 ### Subpages
7442 ###
7443 !! article
7444 Subpage test/subpage
7445 !! text
7446 foo
7447 !! endarticle
7448
7449 !! test
7450 Subpage link
7451 !! options
7452 subpage title=[[Subpage test]]
7453 !! input
7454 [[/subpage]]
7455 !! result
7456 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a>
7457 </p>
7458 !! end
7459
7460 !! test
7461 Subpage noslash link
7462 !! options
7463 subpage title=[[Subpage test]]
7464 !!input
7465 [[/subpage/]]
7466 !! result
7467 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">subpage</a>
7468 </p>
7469 !! end
7470
7471 !! test
7472 Disabled subpages
7473 !! input
7474 [[/subpage]]
7475 !! result
7476 <p><a href="/index.php?title=/subpage&amp;action=edit&amp;redlink=1" class="new" title="/subpage (page does not exist)">/subpage</a>
7477 </p>
7478 !! end
7479
7480 !! test
7481 BUG 561: {{/Subpage}}
7482 !! options
7483 subpage title=[[Page]]
7484 !! input
7485 {{/Subpage}}
7486 !! result
7487 <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>
7488 </p>
7489 !! end
7490
7491 ###
7492 ### Categories
7493 ###
7494 !! article
7495 Category:MediaWiki User's Guide
7496 !! text
7497 blah
7498 !! endarticle
7499
7500 !! test
7501 Link to category
7502 !! input
7503 [[:Category:MediaWiki User's Guide]]
7504 !! result
7505 <p><a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">Category:MediaWiki User's Guide</a>
7506 </p>
7507 !! end
7508
7509 !! test
7510 Simple category
7511 !! options
7512 cat
7513 !! input
7514 [[Category:MediaWiki User's Guide]]
7515 !! result
7516 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
7517 !! end
7518
7519 !! test
7520 PAGESINCATEGORY invalid title fatal (r33546 fix)
7521 !! input
7522 {{PAGESINCATEGORY:<bogus>}}
7523 !! result
7524 <p>0
7525 </p>
7526 !! end
7527
7528 !! test
7529 Category with different sort key
7530 !! options
7531 cat
7532 !! input
7533 [[Category:MediaWiki User's Guide|Foo]]
7534 !! result
7535 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
7536 !! end
7537
7538 !! test
7539 Category with identical sort key
7540 !! options
7541 cat
7542 !! input
7543 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
7544 !! result
7545 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
7546 !! end
7547
7548 !! test
7549 Category with empty sort key
7550 !! options
7551 cat
7552 pst
7553 !! input
7554 [[Category:MediaWiki User's Guide|]]
7555 !! result
7556 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
7557 !! end
7558
7559 !! test
7560 Category with empty sort key and parentheses
7561 !! options
7562 cat
7563 pst
7564 !! input
7565 [[Category:Foo (bar)|]]
7566 !! result
7567 [[Category:Foo (bar)|Foo]]
7568 !! end
7569
7570 !! test
7571 Category with link tail
7572 !! options
7573 cat
7574 pst
7575 !! input
7576 123[[Category:Foo]]456
7577 !! result
7578 123[[Category:Foo]]456
7579 !! end
7580
7581 !! test
7582 Category with template
7583 !! options
7584 cat
7585 pst
7586 !! input
7587 [[Category:{{echo|Foo}}]]
7588 !! result
7589 [[Category:{{echo|Foo}}]]
7590 !! end
7591
7592 !! test
7593 Category with template in sort key
7594 !! options
7595 cat
7596 pst
7597 !! input
7598 [[Category:Foo|{{echo|Bar}}]]
7599 !! result
7600 [[Category:Foo|{{echo|Bar}}]]
7601 !! end
7602
7603 !! test
7604 Category with template in sort key and title
7605 !! options
7606 cat
7607 pst
7608 !! input
7609 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
7610 !! result
7611 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
7612 !! end
7613
7614 !! test
7615 Category / paragraph interactions
7616 !! input
7617 Foo [[Category:Baz]] Bar
7618
7619 Foo [[Category:Baz]]
7620 Bar
7621
7622 Foo
7623 [[Category:Baz]]
7624 Bar
7625
7626 Foo
7627 [[Category:Baz]] Bar
7628
7629 Foo
7630 [[Category:Baz]]
7631 [[Category:Baz]]
7632 [[Category:Baz]]
7633 Bar
7634
7635 [[Category:Baz]]
7636 [[Category:Baz]]
7637 [[Category:Baz]]
7638
7639 [[Category:Baz]]
7640 {{echo|[[Category:Baz]]}}
7641 [[Category:Baz]]
7642 !! result
7643 <p>Foo Bar
7644 </p><p>Foo
7645 Bar
7646 </p><p>Foo
7647 Bar
7648 </p><p>Foo Bar
7649 </p><p>Foo
7650 Bar
7651 </p>
7652 !! end
7653
7654 ###
7655 ### Inter-language links
7656 ###
7657 !! test
7658 Inter-language links
7659 !! options
7660 ill
7661 !! input
7662 [[es:Alimento]]
7663 [[fr:Nourriture]]
7664 [[zh:&#39135;&#21697;]]
7665 !! result
7666 es:Alimento fr:Nourriture zh:食品
7667 !! end
7668
7669 !! test
7670 Duplicate interlanguage links (bug 24502)
7671 !! options
7672 ill
7673 !! input
7674 [[es:1]]
7675 [[es:2]]
7676 [[fr:1]]
7677 [[fr:2]]
7678 !! result
7679 es:1 fr:1
7680 !! end
7681
7682 ###
7683 ### Sections
7684 ###
7685 !! test
7686 Basic section headings
7687 !! input
7688 == Headline 1 ==
7689 Some text
7690
7691 ==Headline 2==
7692 More
7693 ===Smaller headline===
7694 Blah blah
7695 !! result
7696 <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>
7697 <p>Some text
7698 </p>
7699 <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>
7700 <p>More
7701 </p>
7702 <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>
7703 <p>Blah blah
7704 </p>
7705 !! end
7706
7707 !! test
7708 Section headings with TOC
7709 !! input
7710 == Headline 1 ==
7711 === Subheadline 1 ===
7712 ===== Skipping a level =====
7713 ====== Skipping a level ======
7714
7715 == Headline 2 ==
7716 Some text
7717 ===Another headline===
7718 !! result
7719 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
7720 <ul>
7721 <li class="toclevel-1 tocsection-1"><a href="#Headline_1"><span class="tocnumber">1</span> <span class="toctext">Headline 1</span></a>
7722 <ul>
7723 <li class="toclevel-2 tocsection-2"><a href="#Subheadline_1"><span class="tocnumber">1.1</span> <span class="toctext">Subheadline 1</span></a>
7724 <ul>
7725 <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>
7726 <ul>
7727 <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>
7728 </ul>
7729 </li>
7730 </ul>
7731 </li>
7732 </ul>
7733 </li>
7734 <li class="toclevel-1 tocsection-5"><a href="#Headline_2"><span class="tocnumber">2</span> <span class="toctext">Headline 2</span></a>
7735 <ul>
7736 <li class="toclevel-2 tocsection-6"><a href="#Another_headline"><span class="tocnumber">2.1</span> <span class="toctext">Another headline</span></a></li>
7737 </ul>
7738 </li>
7739 </ul>
7740 </td></tr></table>
7741 <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>
7742 <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>
7743 <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>
7744 <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>
7745 <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>
7746 <p>Some text
7747 </p>
7748 <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>
7749
7750 !! end
7751
7752 # perl -e 'print "="x$_," Level $_ heading","="x$_,"\n" for 1..10'
7753 !! test
7754 Handling of sections up to level 6 and beyond
7755 !! input
7756 = Level 1 Heading=
7757 == Level 2 Heading==
7758 === Level 3 Heading===
7759 ==== Level 4 Heading====
7760 ===== Level 5 Heading=====
7761 ====== Level 6 Heading======
7762 ======= Level 7 Heading=======
7763 ======== Level 8 Heading========
7764 ========= Level 9 Heading=========
7765 ========== Level 10 Heading==========
7766 !! result
7767 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
7768 <ul>
7769 <li class="toclevel-1 tocsection-1"><a href="#Level_1_Heading"><span class="tocnumber">1</span> <span class="toctext">Level 1 Heading</span></a>
7770 <ul>
7771 <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>
7772 <ul>
7773 <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>
7774 <ul>
7775 <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>
7776 <ul>
7777 <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>
7778 <ul>
7779 <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>
7780 <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>
7781 <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>
7782 <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>
7783 <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>
7784 </ul>
7785 </li>
7786 </ul>
7787 </li>
7788 </ul>
7789 </li>
7790 </ul>
7791 </li>
7792 </ul>
7793 </li>
7794 </ul>
7795 </td></tr></table>
7796 <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>
7797 <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>
7798 <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>
7799 <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>
7800 <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>
7801 <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>
7802 <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>
7803 <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>
7804 <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>
7805 <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>
7806
7807 !! end
7808
7809 !! test
7810 TOC regression (bug 9764)
7811 !! input
7812 == title 1 ==
7813 === title 1.1 ===
7814 ==== title 1.1.1 ====
7815 === title 1.2 ===
7816 == title 2 ==
7817 === title 2.1 ===
7818 !! result
7819 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
7820 <ul>
7821 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
7822 <ul>
7823 <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>
7824 <ul>
7825 <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>
7826 </ul>
7827 </li>
7828 <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>
7829 </ul>
7830 </li>
7831 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
7832 <ul>
7833 <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>
7834 </ul>
7835 </li>
7836 </ul>
7837 </td></tr></table>
7838 <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>
7839 <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>
7840 <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>
7841 <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>
7842 <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>
7843 <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>
7844
7845 !! end
7846
7847 !! test
7848 TOC with wgMaxTocLevel=3 (bug 6204)
7849 !! options
7850 wgMaxTocLevel=3
7851 !! input
7852 == title 1 ==
7853 === title 1.1 ===
7854 ==== title 1.1.1 ====
7855 === title 1.2 ===
7856 == title 2 ==
7857 === title 2.1 ===
7858 !! result
7859 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
7860 <ul>
7861 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
7862 <ul>
7863 <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>
7864 <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>
7865 </ul>
7866 </li>
7867 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
7868 <ul>
7869 <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>
7870 </ul>
7871 </li>
7872 </ul>
7873 </td></tr></table>
7874 <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>
7875 <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>
7876 <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>
7877 <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>
7878 <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>
7879 <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>
7880
7881 !! end
7882
7883 !! test
7884 TOC with wgMaxTocLevel=3 and two level four headings (bug 6204)
7885 !! options
7886 wgMaxTocLevel=3
7887 !! input
7888 ==Section 1==
7889 ===Section 1.1===
7890 ====Section 1.1.1====
7891 ====Section 1.1.1.1====
7892 ==Section 2==
7893 !! result
7894 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
7895 <ul>
7896 <li class="toclevel-1 tocsection-1"><a href="#Section_1"><span class="tocnumber">1</span> <span class="toctext">Section 1</span></a>
7897 <ul>
7898 <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>
7899 </ul>
7900 </li>
7901 <li class="toclevel-1 tocsection-5"><a href="#Section_2"><span class="tocnumber">2</span> <span class="toctext">Section 2</span></a></li>
7902 </ul>
7903 </td></tr></table>
7904 <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>
7905 <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>
7906 <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>
7907 <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>
7908 <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>
7909
7910 !! end
7911
7912
7913 !! test
7914 Resolving duplicate section names
7915 !! input
7916 == Foo bar ==
7917 == Foo bar ==
7918 !! result
7919 <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>
7920 <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>
7921
7922 !! end
7923
7924 !! test
7925 Resolving duplicate section names with differing case (bug 10721)
7926 !! input
7927 == Foo bar ==
7928 == Foo Bar ==
7929 !! result
7930 <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>
7931 <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>
7932
7933 !! end
7934
7935 !! article
7936 Template:sections
7937 !! text
7938 ===Section 1===
7939 ==Section 2==
7940 !! endarticle
7941
7942 !! test
7943 Template with sections, __NOTOC__
7944 !! input
7945 __NOTOC__
7946 ==Section 0==
7947 {{sections}}
7948 ==Section 4==
7949 !! result
7950 <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>
7951 <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>
7952 <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>
7953 <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>
7954
7955 !! end
7956
7957 !! test
7958 __NOEDITSECTION__ keyword
7959 !! input
7960 __NOEDITSECTION__
7961 ==Section 1==
7962 ==Section 2==
7963 !! result
7964 <h2> <span class="mw-headline" id="Section_1">Section 1</span></h2>
7965 <h2> <span class="mw-headline" id="Section_2">Section 2</span></h2>
7966
7967 !! end
7968
7969 !! test
7970 Link inside a section heading
7971 !! input
7972 ==Section with a [[Main Page|link]] in it==
7973 !! result
7974 <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>
7975
7976 !! end
7977
7978 !! test
7979 TOC regression (bug 12077)
7980 !! input
7981 __TOC__
7982 == title 1 ==
7983 === title 1.1 ===
7984 == title 2 ==
7985 !! result
7986 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
7987 <ul>
7988 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
7989 <ul>
7990 <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>
7991 </ul>
7992 </li>
7993 <li class="toclevel-1 tocsection-3"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a></li>
7994 </ul>
7995 </td></tr></table>
7996 <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>
7997 <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>
7998 <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>
7999
8000 !! end
8001
8002 !! test
8003 BUG 1219 URL next to image (good)
8004 !! input
8005 http://example.com [[Image:foobar.jpg]]
8006 !! result
8007 <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>
8008 </p>
8009 !!end
8010
8011 !! test
8012 Short headings with trailing space should match behavior of Parser::doHeadings (bug 19910)
8013 !! input
8014 ===
8015 The line above must have a trailing space!
8016 === <!--
8017 --> <!-- -->
8018 But just in case it doesn't...
8019 !! result
8020 <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>
8021 <p>The line above must have a trailing space!
8022 </p>
8023 <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>
8024 <p>But just in case it doesn't...
8025 </p>
8026 !! end
8027
8028 !! test
8029 Header with special characters (bug 25462)
8030 !! input
8031 The tooltips shall not show entities to the user (ie. be double escaped)
8032
8033 == text > text ==
8034 section 1
8035
8036 == text < text ==
8037 section 2
8038
8039 == text & text ==
8040 section 3
8041
8042 == text ' text ==
8043 section 4
8044
8045 == text " text ==
8046 section 5
8047 !! result
8048 <p>The tooltips shall not show entities to the user (ie. be double escaped)
8049 </p>
8050 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
8051 <ul>
8052 <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>
8053 <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>
8054 <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>
8055 <li class="toclevel-1 tocsection-4"><a href="#text_.27_text"><span class="tocnumber">4</span> <span class="toctext">text ' text</span></a></li>
8056 <li class="toclevel-1 tocsection-5"><a href="#text_.22_text"><span class="tocnumber">5</span> <span class="toctext">text " text</span></a></li>
8057 </ul>
8058 </td></tr></table>
8059 <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>
8060 <p>section 1
8061 </p>
8062 <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>
8063 <p>section 2
8064 </p>
8065 <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>
8066 <p>section 3
8067 </p>
8068 <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>
8069 <p>section 4
8070 </p>
8071 <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>
8072 <p>section 5
8073 </p>
8074 !! end
8075
8076 !! test
8077 Headers with excess '=' characters
8078 (Are similar tests necessary beyond the 1st level?)
8079 !! input
8080 =foo==
8081 ==foo=
8082 =''italic'' heading==
8083 ==''italic'' heading=
8084 !! result
8085 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
8086 <ul>
8087 <li class="toclevel-1 tocsection-1"><a href="#foo.3D"><span class="tocnumber">1</span> <span class="toctext">foo=</span></a></li>
8088 <li class="toclevel-1 tocsection-2"><a href="#.3Dfoo"><span class="tocnumber">2</span> <span class="toctext">=foo</span></a></li>
8089 <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>
8090 <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>
8091 </ul>
8092 </td></tr></table>
8093 <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>
8094 <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>
8095 <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>
8096 <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>
8097
8098 !! end
8099
8100 !! test
8101 HTML headers vs TOC (bug 23393)
8102 (__NOEDITSECTION__ for clearer output, doesn't matter here)
8103 !! input
8104 <h1>Header 1</h1>
8105 == Header 1.1 ==
8106 == Header 1.2 ==
8107
8108 <h1>Header 2
8109 </h1>
8110 == Header 2.1 ==
8111 == Header 2.2 ==
8112 __NOEDITSECTION__
8113 !! result
8114 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
8115 <ul>
8116 <li class="toclevel-1"><a href="#Header_1"><span class="tocnumber">1</span> <span class="toctext">Header 1</span></a>
8117 <ul>
8118 <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>
8119 <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>
8120 </ul>
8121 </li>
8122 <li class="toclevel-1"><a href="#Header_2"><span class="tocnumber">2</span> <span class="toctext">Header 2</span></a>
8123 <ul>
8124 <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>
8125 <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>
8126 </ul>
8127 </li>
8128 </ul>
8129 </td></tr></table>
8130 <h1> <span class="mw-headline" id="Header_1">Header 1</span></h1>
8131 <h2> <span class="mw-headline" id="Header_1.1">Header 1.1</span></h2>
8132 <h2> <span class="mw-headline" id="Header_1.2">Header 1.2</span></h2>
8133 <h1> <span class="mw-headline" id="Header_2">Header 2</span></h1>
8134 <h2> <span class="mw-headline" id="Header_2.1">Header 2.1</span></h2>
8135 <h2> <span class="mw-headline" id="Header_2.2">Header 2.2</span></h2>
8136
8137 !! end
8138
8139 !! test
8140 BUG 1219 URL next to image (broken)
8141 !! input
8142 http://example.com[[Image:foobar.jpg]]
8143 !! result
8144 <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>
8145 </p>
8146 !!end
8147
8148 !! test
8149 Bug 1186 news: in the middle of text
8150 !! input
8151 http://en.wikinews.org/wiki/Wikinews:Workplace
8152 !! result
8153 <p><a rel="nofollow" class="external free" href="http://en.wikinews.org/wiki/Wikinews:Workplace">http://en.wikinews.org/wiki/Wikinews:Workplace</a>
8154 </p>
8155 !!end
8156
8157
8158 !! test
8159 Namespaced link must have a title
8160 !! input
8161 [[Project:]]
8162 !! result
8163 <p>[[Project:]]
8164 </p>
8165 !!end
8166
8167 !! test
8168 Namespaced link must have a title (bad fragment version)
8169 !! input
8170 [[Project:#fragment]]
8171 !! result
8172 <p>[[Project:#fragment]]
8173 </p>
8174 !!end
8175
8176
8177 ###
8178 ### HTML tags and HTML attributes
8179 ###
8180
8181 !! test
8182 div with no attributes
8183 !! input
8184 <div>HTML rocks</div>
8185 !! result
8186 <div>HTML rocks</div>
8187
8188 !! end
8189
8190 !! test
8191 div with double-quoted attribute
8192 !! input
8193 <div id="rock">HTML rocks</div>
8194 !! result
8195 <div id="rock">HTML rocks</div>
8196
8197 !! end
8198
8199 !! test
8200 div with single-quoted attribute
8201 !! input
8202 <div id='rock'>HTML rocks</div>
8203 !! result
8204 <div id="rock">HTML rocks</div>
8205
8206 !! end
8207
8208 !! test
8209 div with unquoted attribute
8210 !! input
8211 <div id=rock>HTML rocks</div>
8212 !! result
8213 <div id="rock">HTML rocks</div>
8214
8215 !! end
8216
8217 !! test
8218 div with illegal double attributes
8219 !! input
8220 <div id="a" id="b">HTML rocks</div>
8221 !! result
8222 <div id="b">HTML rocks</div>
8223
8224 !!end
8225
8226 # FIXME: produce empty string instead of "class" in the PHP parser, following
8227 # the HTML5 spec.
8228 !! test
8229 div with empty attribute value, space before equals
8230 !! options
8231 disabled
8232 !! input
8233 <div class =>HTML rocks</div>
8234 !! result
8235 <div class="">HTML rocks</div>
8236
8237 !! end
8238
8239 # The PHP parser escapes the opening brace to &#123; for some reason, so
8240 # disabled this test for it.
8241 !! test
8242 div with braces in attribute value
8243 !! options
8244 disabled
8245 !! input
8246 <div title="{}">Foo</div>
8247 !! result
8248 <div title="{}">Foo</div>
8249 !! end
8250
8251 # This it very inconsistent in the PHP parser: it returns
8252 # class="class" if there is a space between the name and the equal sign (see
8253 # 'div with empty attribute value, space before equals'), but strips the
8254 # attribute completely if the space is missing. We hope that not much content
8255 # depends on this, so are implementing the behavior below in Parsoid for
8256 # consistencies' sake. Disabled for the PHP parser.
8257 # FIXME: fix this behavior in the PHP parser?
8258 !! test
8259 div with empty attribute value, no space before equals
8260 !! options
8261 disabled
8262 !! input
8263 <div class=>HTML rocks</div>
8264 !! result
8265 <div class="">HTML rocks</div>
8266
8267 !! end
8268
8269 !! test
8270 HTML multiple attributes correction
8271 !! input
8272 <p class="error" class="awesome">Awesome!</p>
8273 !! result
8274 <p class="awesome">Awesome!</p>
8275
8276 !!end
8277
8278 !! test
8279 Table multiple attributes correction
8280 !! input
8281 {|
8282 !+ class="error" class="awesome"| status
8283 |}
8284 !! result
8285 <table>
8286 <tr>
8287 <th class="awesome"> status
8288 </th></tr></table>
8289
8290 !!end
8291
8292 !! test
8293 DIV IN UPPERCASE
8294 !! input
8295 <DIV ID="x">HTML ROCKS</DIV>
8296 !! result
8297 <div id="x">HTML ROCKS</div>
8298
8299 !!end
8300
8301 !! test
8302 Non-ASCII pseudo-tags are rendered as text
8303 !! input
8304 <khyô>
8305 !! result
8306 <p>&lt;khyô&gt;
8307 </p>
8308 !! end
8309
8310 !! test
8311 Pseudo-tag with URL 'name' renders as url link
8312 !! input
8313 <http://example.com/>
8314 !! result
8315 <p>&lt;<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&gt;
8316 </p>
8317 !! end
8318
8319 !! test
8320 text with amp in the middle of nowhere
8321 !! input
8322 Remember AT&T?
8323 !!result
8324 <p>Remember AT&amp;T?
8325 </p>
8326 !! end
8327
8328 !! test
8329 text with character entity: eacute
8330 !! input
8331 I always thought &eacute; was a cute letter.
8332 !! result
8333 <p>I always thought &#233; was a cute letter.
8334 </p>
8335 !! end
8336
8337 !! test
8338 text with entity-escaped character entity-like string: eacute
8339 !! input
8340 I always thought &amp;eacute; was a cute letter.
8341 !! result
8342 <p>I always thought &amp;eacute; was a cute letter.
8343 </p>
8344 !! end
8345
8346 !! test
8347 text with undefined character entity: xacute
8348 !! input
8349 I always thought &xacute; was a cute letter.
8350 !! result
8351 <p>I always thought &amp;xacute; was a cute letter.
8352 </p>
8353 !! end
8354
8355
8356 ###
8357 ### Media links
8358 ###
8359
8360 !! test
8361 Media link
8362 !! input
8363 [[Media:Foobar.jpg]]
8364 !! result
8365 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Media:Foobar.jpg</a>
8366 </p>
8367 !! end
8368
8369 !! test
8370 Media link with text
8371 !! input
8372 [[Media:Foobar.jpg|A neat file to look at]]
8373 !! result
8374 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">A neat file to look at</a>
8375 </p>
8376 !! end
8377
8378 # FIXME: this is still bad HTML tag nesting
8379 !! test
8380 Media link with nasty text
8381 fixme: doBlockLevels won't wrap this in a paragraph because it contains a div
8382 !! input
8383 [[Media:Foobar.jpg|Safe Link<div style=display:none>" onmouseover="alert(document.cookie)" onfoo="</div>]]
8384 !! result
8385 <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>
8386
8387 !! end
8388
8389 !! test
8390 Media link to nonexistent file (bug 1702)
8391 !! input
8392 [[Media:No such.jpg]]
8393 !! result
8394 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=No_such.jpg" class="new" title="No such.jpg">Media:No such.jpg</a>
8395 </p>
8396 !! end
8397
8398 !! test
8399 Image link to nonexistent file (bug 1850 - good)
8400 !! input
8401 [[Image:No such.jpg]]
8402 !! result
8403 <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>
8404 </p>
8405 !! end
8406
8407 !! test
8408 :Image link to nonexistent file (bug 1850 - bad)
8409 !! input
8410 [[:Image:No such.jpg]]
8411 !! result
8412 <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>
8413 </p>
8414 !! end
8415
8416
8417
8418 !! test
8419 Character reference normalization in link text (bug 1938)
8420 !! input
8421 [[Main Page|this&that]]
8422 !! result
8423 <p><a href="/wiki/Main_Page" title="Main Page">this&amp;that</a>
8424 </p>
8425 !!end
8426
8427 !! article
8428 אַ
8429 !! text
8430 Test for unicode normalization
8431
8432 The page's name is U+05d0 U+05b7, with non-canonical form U+FB2E
8433 !! endarticle
8434
8435 !! test
8436 (bug 19451) Links should refer to the normalized form.
8437 !! input
8438 [[&#xFB2E;]]
8439 [[&#x5d0;&#x5b7;]]
8440 [[&#x5d0;ַ]]
8441 [[א&#x5b7;]]
8442 [[אַ]]
8443 !! result
8444 <p><a href="/wiki/%D7%90%D6%B7" title="אַ">&#xfb2e;</a>
8445 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;&#x5b7;</a>
8446 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;ַ</a>
8447 <a href="/wiki/%D7%90%D6%B7" title="אַ">א&#x5b7;</a>
8448 <a href="/wiki/%D7%90%D6%B7" title="אַ">אַ</a>
8449 </p>
8450 !! end
8451
8452 !! test
8453 Empty attribute crash test (bug 2067)
8454 !! input
8455 <font color="">foo</font>
8456 !! result
8457 <p><font color="">foo</font>
8458 </p>
8459 !! end
8460
8461 !! test
8462 Empty attribute crash test single-quotes (bug 2067)
8463 !! input
8464 <font color=''>foo</font>
8465 !! result
8466 <p><font color="">foo</font>
8467 </p>
8468 !! end
8469
8470 !! test
8471 Attribute test: equals, then nothing
8472 !! input
8473 <font color=>foo</font>
8474 !! result
8475 <p><font>foo</font>
8476 </p>
8477 !! end
8478
8479 !! test
8480 Attribute test: unquoted value
8481 !! input
8482 <font color=x>foo</font>
8483 !! result
8484 <p><font color="x">foo</font>
8485 </p>
8486 !! end
8487
8488 !! test
8489 Attribute test: unquoted but illegal value (hash)
8490 !! input
8491 <font color=#x>foo</font>
8492 !! result
8493 <p><font color="#x">foo</font>
8494 </p>
8495 !! end
8496
8497 !! test
8498 Attribute test: no value
8499 !! input
8500 <font color>foo</font>
8501 !! result
8502 <p><font color="color">foo</font>
8503 </p>
8504 !! end
8505
8506 !! test
8507 Bug 2095: link with three closing brackets
8508 !! input
8509 [[Main Page]]]
8510 !! result
8511 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>]
8512 </p>
8513 !! end
8514
8515 !! test
8516 Bug 2095: link with pipe and three closing brackets
8517 !! input
8518 [[Main Page|link]]]
8519 !! result
8520 <p><a href="/wiki/Main_Page" title="Main Page">link</a>]
8521 </p>
8522 !! end
8523
8524 !! test
8525 Bug 2095: link with pipe and three closing brackets, version 2
8526 !! input
8527 [[Main Page|[http://example.com/]]]
8528 !! result
8529 <p><a href="/wiki/Main_Page" title="Main Page">[http://example.com/]</a>
8530 </p>
8531 !! end
8532
8533
8534 ###
8535 ### Safety
8536 ###
8537
8538 !! article
8539 Template:Dangerous attribute
8540 !! text
8541 " onmouseover="alert(document.cookie)
8542 !! endarticle
8543
8544 !! article
8545 Template:Dangerous style attribute
8546 !! text
8547 border-size: expression(alert(document.cookie))
8548 !! endarticle
8549
8550 !! article
8551 Template:Div style
8552 !! text
8553 <div style="float: right; {{{1}}}">Magic div</div>
8554 !! endarticle
8555
8556 !! test
8557 Bug 2304: HTML attribute safety (safe template; regression bug 2309)
8558 !! input
8559 <div title="{{test}}"></div>
8560 !! result
8561 <div title="This is a test template"></div>
8562
8563 !! end
8564
8565 !! test
8566 Bug 2304: HTML attribute safety (dangerous template; 2309)
8567 !! input
8568 <div title="{{dangerous attribute}}"></div>
8569 !! result
8570 <div title=""></div>
8571
8572 !! end
8573
8574 !! test
8575 Bug 2304: HTML attribute safety (dangerous style template; 2309)
8576 !! input
8577 <div style="{{dangerous style attribute}}"></div>
8578 !! result
8579 <div style="/* insecure input */"></div>
8580
8581 !! end
8582
8583 !! test
8584 Bug 2304: HTML attribute safety (safe parameter; 2309)
8585 !! input
8586 {{div style|width: 200px}}
8587 !! result
8588 <div style="float: right; width: 200px">Magic div</div>
8589
8590 !! end
8591
8592 !! test
8593 Bug 2304: HTML attribute safety (unsafe parameter; 2309)
8594 !! input
8595 {{div style|width: expression(alert(document.cookie))}}
8596 !! result
8597 <div style="/* insecure input */">Magic div</div>
8598
8599 !! end
8600
8601 !! test
8602 Bug 2304: HTML attribute safety (unsafe breakout parameter; 2309)
8603 !! input
8604 {{div style|"><script>alert(document.cookie)</script>}}
8605 !! result
8606 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
8607
8608 !! end
8609
8610 !! test
8611 Bug 2304: HTML attribute safety (unsafe breakout parameter 2; 2309)
8612 !! input
8613 {{div style|" ><script>alert(document.cookie)</script>}}
8614 !! result
8615 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
8616
8617 !! end
8618
8619 !! test
8620 Bug 2304: HTML attribute safety (link)
8621 !! input
8622 <div title="[[Main Page]]"></div>
8623 !! result
8624 <div title="&#91;&#91;Main Page]]"></div>
8625
8626 !! end
8627
8628 !! test
8629 Bug 2304: HTML attribute safety (italics)
8630 !! input
8631 <div title="''foobar''"></div>
8632 !! result
8633 <div title="&#39;&#39;foobar&#39;&#39;"></div>
8634
8635 !! end
8636
8637 !! test
8638 Bug 2304: HTML attribute safety (bold)
8639 !! input
8640 <div title="'''foobar'''"></div>
8641 !! result
8642 <div title="&#39;&#39;&#39;foobar&#39;&#39;&#39;"></div>
8643
8644 !! end
8645
8646
8647 !! test
8648 Bug 2304: HTML attribute safety (ISBN)
8649 !! input
8650 <div title="ISBN 1234567890"></div>
8651 !! result
8652 <div title="&#73;SBN 1234567890"></div>
8653
8654 !! end
8655
8656 !! test
8657 Bug 2304: HTML attribute safety (RFC)
8658 !! input
8659 <div title="RFC 1234"></div>
8660 !! result
8661 <div title="&#82;FC 1234"></div>
8662
8663 !! end
8664
8665 !! test
8666 Bug 2304: HTML attribute safety (PMID)
8667 !! input
8668 <div title="PMID 1234567890"></div>
8669 !! result
8670 <div title="&#80;MID 1234567890"></div>
8671
8672 !! end
8673
8674 !! test
8675 Bug 2304: HTML attribute safety (web link)
8676 !! input
8677 <div title="http://example.com/"></div>
8678 !! result
8679 <div title="http&#58;//example.com/"></div>
8680
8681 !! end
8682
8683 !! test
8684 Bug 2304: HTML attribute safety (named web link)
8685 !! input
8686 <div title="[http://example.com/ link]"></div>
8687 !! result
8688 <div title="&#91;http&#58;//example.com/ link]"></div>
8689
8690 !! end
8691
8692 !! test
8693 Bug 3244: HTML attribute safety (extension; safe)
8694 !! input
8695 <div style="<nowiki>background:blue</nowiki>"></div>
8696 !! result
8697 <div style="background:blue"></div>
8698
8699 !! end
8700
8701 !! test
8702 Bug 3244: HTML attribute safety (extension; unsafe)
8703 !! input
8704 <div style="<nowiki>border-left:expression(alert(document.cookie))</nowiki>"></div>
8705 !! result
8706 <div style="/* insecure input */"></div>
8707
8708 !! end
8709
8710 # More MSIE fun discovered by Tom Gilder
8711
8712 !! test
8713 MSIE CSS safety test: spurious slash
8714 !! input
8715 <div style="background-image:u\rl(javascript:alert('boo'))">evil</div>
8716 !! result
8717 <div style="/* insecure input */">evil</div>
8718
8719 !! end
8720
8721 !! test
8722 MSIE CSS safety test: hex code
8723 !! input
8724 <div style="background-image:u\72l(javascript:alert('boo'))">evil</div>
8725 !! result
8726 <div style="/* insecure input */">evil</div>
8727
8728 !! end
8729
8730 !! test
8731 MSIE CSS safety test: comment in url
8732 !! input
8733 <div style="background-image:u/**/rl(javascript:alert('boo'))">evil</div>
8734 !! result
8735 <div style="background-image:u rl(javascript:alert(&#39;boo&#39;))">evil</div>
8736
8737 !! end
8738
8739 !! test
8740 MSIE CSS safety test: comment in expression
8741 !! input
8742 <div style="background-image:expres/**/sion(alert('boo4'))">evil4</div>
8743 !! result
8744 <div style="background-image:expres sion(alert(&#39;boo4&#39;))">evil4</div>
8745
8746 !! end
8747
8748
8749 !! test
8750 Table attribute legitimate extension
8751 !! input
8752 {|
8753 !+ style="<nowiki>color:blue</nowiki>"| status
8754 |}
8755 !! result
8756 <table>
8757 <tr>
8758 <th style="color:blue"> status
8759 </th></tr></table>
8760
8761 !!end
8762
8763 !! test
8764 Table attribute safety
8765 !! input
8766 {|
8767 !+ style="<nowiki>border-width:expression(0+alert(document.cookie))</nowiki>"| status
8768 |}
8769 !! result
8770 <table>
8771 <tr>
8772 <th style="/* insecure input */"> status
8773 </th></tr></table>
8774
8775 !! end
8776
8777 !! test
8778 CSS line continuation 1
8779 !! input
8780 <div style="background-image: u\&#10;rl(test.jpg);"></div>
8781 !! result
8782 <div style="/* insecure input */"></div>
8783
8784 !! end
8785
8786 !! test
8787 CSS line continuation 2
8788 !! input
8789 <div style="background-image: u\&#13;rl(test.jpg); "></div>
8790 !! result
8791 <div style="/* insecure input */"></div>
8792
8793 !! end
8794
8795 !! article
8796 Template:Identity
8797 !! text
8798 {{{1}}}
8799 !! endarticle
8800
8801 !! test
8802 Expansion of multi-line templates in attribute values (bug 6255)
8803 !! input
8804 <div style="background: {{identity|#00FF00}}">-</div>
8805 !! result
8806 <div style="background: #00FF00">-</div>
8807
8808 !! end
8809
8810
8811 !! test
8812 Expansion of multi-line templates in attribute values (bug 6255 sanity check)
8813 !! input
8814 <div style="background:
8815 #00FF00">-</div>
8816 !! result
8817 <div style="background: #00FF00">-</div>
8818
8819 !! end
8820
8821 !! test
8822 Expansion of multi-line templates in attribute values (bug 6255 sanity check 2)
8823 !! input
8824 <div style="background: &#10;#00FF00">-</div>
8825 !! result
8826 <div style="background: &#10;#00FF00">-</div>
8827
8828 !! end
8829
8830 ###
8831 ### Parser hooks (see maintenance/parserTestsParserHook.php for the <tag> extension)
8832 ###
8833 !! test
8834 Parser hook: empty input
8835 !! input
8836 <tag></tag>
8837 !! result
8838 <pre>
8839 ''
8840 array (
8841 )
8842 </pre>
8843
8844 !! end
8845
8846 !! test
8847 Parser hook: empty input using terminated empty elements
8848 !! input
8849 <tag/>
8850 !! result
8851 <pre>
8852 NULL
8853 array (
8854 )
8855 </pre>
8856
8857 !! end
8858
8859 !! test
8860 Parser hook: empty input using terminated empty elements (space before)
8861 !! input
8862 <tag />
8863 !! result
8864 <pre>
8865 NULL
8866 array (
8867 )
8868 </pre>
8869
8870 !! end
8871
8872 !! test
8873 Parser hook: basic input
8874 !! input
8875 <tag>input</tag>
8876 !! result
8877 <pre>
8878 'input'
8879 array (
8880 )
8881 </pre>
8882
8883 !! end
8884
8885
8886 !! test
8887 Parser hook: case insensitive
8888 !! input
8889 <TAG>input</TAG>
8890 !! result
8891 <pre>
8892 'input'
8893 array (
8894 )
8895 </pre>
8896
8897 !! end
8898
8899
8900 !! test
8901 Parser hook: case insensitive, redux
8902 !! input
8903 <TaG>input</TAg>
8904 !! result
8905 <pre>
8906 'input'
8907 array (
8908 )
8909 </pre>
8910
8911 !! end
8912
8913 !! test
8914 Parser hook: nested tags
8915 !! options
8916 noxml
8917 !! input
8918 <tag><tag></tag></tag>
8919 !! result
8920 <pre>
8921 '<tag>'
8922 array (
8923 )
8924 </pre>&lt;/tag&gt;
8925
8926 !! end
8927
8928 !! test
8929 Parser hook: basic arguments
8930 !! input
8931 <tag width=200 height = "100" depth = '50' square></tag>
8932 !! result
8933 <pre>
8934 ''
8935 array (
8936 'width' => '200',
8937 'height' => '100',
8938 'depth' => '50',
8939 'square' => 'square',
8940 )
8941 </pre>
8942
8943 !! end
8944
8945 !! test
8946 Parser hook: argument containing a forward slash (bug 5344)
8947 !! input
8948 <tag filename='/tmp/bla'></tag>
8949 !! result
8950 <pre>
8951 ''
8952 array (
8953 'filename' => '/tmp/bla',
8954 )
8955 </pre>
8956
8957 !! end
8958
8959 !! test
8960 Parser hook: empty input using terminated empty elements (bug 2374)
8961 !! input
8962 <tag foo=bar/>text
8963 !! result
8964 <pre>
8965 NULL
8966 array (
8967 'foo' => 'bar',
8968 )
8969 </pre>text
8970
8971 !! end
8972
8973 # </tag> should be output literally since there is no matching tag that begins it
8974 !! test
8975 Parser hook: basic arguments using terminated empty elements (bug 2374)
8976 !! input
8977 <tag width=200 height = "100" depth = '50' square/>
8978 other stuff
8979 </tag>
8980 !! result
8981 <pre>
8982 NULL
8983 array (
8984 'width' => '200',
8985 'height' => '100',
8986 'depth' => '50',
8987 'square' => 'square',
8988 )
8989 </pre>
8990 <p>other stuff
8991 &lt;/tag&gt;
8992 </p>
8993 !! end
8994
8995 ###
8996 ### (see maintenance/parserTestsStaticParserHook.php for the <statictag> extension)
8997 ###
8998
8999 !! test
9000 Parser hook: static parser hook not inside a comment
9001 !! input
9002 <statictag>hello, world</statictag>
9003 <statictag action=flush/>
9004 !! result
9005 <p>hello, world
9006 </p>
9007 !! end
9008
9009
9010 !! test
9011 Parser hook: static parser hook inside a comment
9012 !! input
9013 <!-- <statictag>hello, world</statictag> -->
9014 <statictag action=flush/>
9015 !! result
9016 <p><br />
9017 </p>
9018 !! end
9019
9020 # Nested template calls; this case was broken by Parser.php rev 1.506,
9021 # since reverted.
9022
9023 !! article
9024 Template:One-parameter
9025 !! text
9026 (My parameter is: {{{1}}})
9027 !! endarticle
9028
9029 !! article
9030 Template:Map-one-parameter
9031 !! text
9032 {{{{{1}}}|{{{2}}}}}
9033 !! endarticle
9034
9035 !! test
9036 Nested template calls
9037 !! input
9038 {{Map-one-parameter|One-parameter|param}}
9039 !! result
9040 <p>(My parameter is: param)
9041 </p>
9042 !! end
9043
9044
9045 ###
9046 ### Sanitizer
9047 ###
9048 !! test
9049 Sanitizer: Closing of open tags
9050 !! input
9051 <s></s><table></table>
9052 !! result
9053 <s></s><table></table>
9054
9055 !! end
9056
9057 !! test
9058 Sanitizer: Closing of open but not closed tags
9059 !! input
9060 <s>foo
9061 !! result
9062 <p><s>foo</s>
9063 </p>
9064 !! end
9065
9066 !! test
9067 Sanitizer: Closing of closed but not open tags
9068 !! input
9069 </s>
9070 !! result
9071 <p>&lt;/s&gt;
9072 </p>
9073 !! end
9074
9075 !! test
9076 Sanitizer: Closing of closed but not open table tags
9077 !! input
9078 Table not started</td></tr></table>
9079 !! result
9080 <p>Table not started&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
9081 </p>
9082 !! end
9083
9084 !! test
9085 Sanitizer: Escaping of spaces, multibyte characters, colons & other stuff in id=""
9086 !! input
9087 <span id="æ: v">byte</span>[[#æ: v|backlink]]
9088 !! result
9089 <p><span id=".C3.A6:_v">byte</span><a href="#.C3.A6:_v">backlink</a>
9090 </p>
9091 !! end
9092
9093 !! test
9094 Sanitizer: Validating the contents of the id attribute (bug 4515)
9095 !! options
9096 disabled
9097 !! input
9098 <br id=9 />
9099 !! result
9100 Something, but definitely not <br id="9" />...
9101 !! end
9102
9103 !! test
9104 Sanitizer: Validating id attribute uniqueness (bug 4515, bug 6301)
9105 !! options
9106 disabled
9107 !! input
9108 <br id="foo" /><br id="foo" />
9109 !! result
9110 Something need to be done. foo-2 ?
9111 !! end
9112
9113 !! test
9114 Sanitizer: Validating that <meta> and <link> work, but only for Microdata
9115 !! input
9116 <div itemscope>
9117 <meta itemprop="hello" content="world">
9118 <meta http-equiv="refresh" content="5">
9119 <meta itemprop="hello" http-equiv="refresh" content="5">
9120 <link itemprop="hello" href="{{SERVER}}">
9121 <link rel="stylesheet" href="{{SERVER}}">
9122 <link rel="stylesheet" itemprop="hello" href="{{SERVER}}">
9123 </div>
9124 !! result
9125 <div itemscope="itemscope">
9126 <p> <meta itemprop="hello" content="world" />
9127 &lt;meta http-equiv="refresh" content="5"&gt;
9128 <meta itemprop="hello" content="5" />
9129 </p>
9130 <link itemprop="hello" href="http&#58;//example.org" />
9131 &lt;link rel="stylesheet" href="<a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>"&gt;
9132 <link itemprop="hello" href="http&#58;//example.org" />
9133 </div>
9134
9135 !! end
9136
9137 !! test
9138 Language converter: output gets cut off unexpectedly (bug 5757)
9139 !! options
9140 language=zh
9141 !! input
9142 this bit is safe: }-
9143
9144 but if we add a conversion instance: -{zh-cn:xxx;zh-tw:yyy}-
9145
9146 then we get cut off here: }-
9147
9148 all additional text is vanished
9149 !! result
9150 <p>this bit is safe: }-
9151 </p><p>but if we add a conversion instance: xxx
9152 </p><p>then we get cut off here: }-
9153 </p><p>all additional text is vanished
9154 </p>
9155 !! end
9156
9157 !! test
9158 Self closed html pairs (bug 5487)
9159 !! options
9160 !! input
9161 <center><font id="bug" />Centered text</center>
9162 <div><font id="bug2" />In div text</div>
9163 !! result
9164 <center>&lt;font id="bug" /&gt;Centered text</center>
9165 <div>&lt;font id="bug2" /&gt;In div text</div>
9166
9167 !! end
9168
9169 #
9170 #
9171 #
9172
9173 !! test
9174 Punctuation: nbsp before exclamation
9175 !! input
9176 C'est grave !
9177 !! result
9178 <p>C'est grave&#160;!
9179 </p>
9180 !! end
9181
9182 !! test
9183 Punctuation: CSS !important (bug 11874)
9184 !! input
9185 <div style="width:50% !important">important</div>
9186 !! result
9187 <div style="width:50% !important">important</div>
9188
9189 !!end
9190
9191 !! test
9192 Punctuation: CSS ! important (bug 11874; with space after)
9193 !! input
9194 <div style="width:50% ! important">important</div>
9195 !! result
9196 <div style="width:50% ! important">important</div>
9197
9198 !!end
9199
9200
9201 !! test
9202 HTML bullet list, closed tags (bug 5497)
9203 !! input
9204 <ul>
9205 <li>One</li>
9206 <li>Two</li>
9207 </ul>
9208 !! result
9209 <ul>
9210 <li>One</li>
9211 <li>Two</li>
9212 </ul>
9213
9214 !! end
9215
9216 !! test
9217 HTML bullet list, unclosed tags (bug 5497)
9218 !! options
9219 disabled
9220 !! input
9221 <ul>
9222 <li>One
9223 <li>Two
9224 </ul>
9225 !! result
9226 <ul>
9227 <li>One
9228 </li><li>Two
9229 </li></ul>
9230
9231 !! end
9232
9233 !! test
9234 HTML ordered list, closed tags (bug 5497)
9235 !! input
9236 <ol>
9237 <li>One</li>
9238 <li>Two</li>
9239 </ol>
9240 !! result
9241 <ol>
9242 <li>One</li>
9243 <li>Two</li>
9244 </ol>
9245
9246 !! end
9247
9248 !! test
9249 HTML ordered list, unclosed tags (bug 5497)
9250 !! options
9251 disabled
9252 !! input
9253 <ol>
9254 <li>One
9255 <li>Two
9256 </ol>
9257 !! result
9258 <ol>
9259 <li>One
9260 </li><li>Two
9261 </li></ol>
9262
9263 !! end
9264
9265 !! test
9266 HTML nested bullet list, closed tags (bug 5497)
9267 !! input
9268 <ul>
9269 <li>One</li>
9270 <li>Two:
9271 <ul>
9272 <li>Sub-one</li>
9273 <li>Sub-two</li>
9274 </ul>
9275 </li>
9276 </ul>
9277 !! result
9278 <ul>
9279 <li>One</li>
9280 <li>Two:
9281 <ul>
9282 <li>Sub-one</li>
9283 <li>Sub-two</li>
9284 </ul>
9285 </li>
9286 </ul>
9287
9288 !! end
9289
9290 !! test
9291 HTML nested bullet list, open tags (bug 5497)
9292 !! options
9293 disabled
9294 !! input
9295 <ul>
9296 <li>One
9297 <li>Two:
9298 <ul>
9299 <li>Sub-one
9300 <li>Sub-two
9301 </ul>
9302 </ul>
9303 !! result
9304 <ul>
9305 <li>One
9306 </li><li>Two:
9307 <ul>
9308 <li>Sub-one
9309 </li><li>Sub-two
9310 </li></ul>
9311 </li></ul>
9312
9313 !! end
9314
9315 !! test
9316 HTML nested ordered list, closed tags (bug 5497)
9317 !! input
9318 <ol>
9319 <li>One</li>
9320 <li>Two:
9321 <ol>
9322 <li>Sub-one</li>
9323 <li>Sub-two</li>
9324 </ol>
9325 </li>
9326 </ol>
9327 !! result
9328 <ol>
9329 <li>One</li>
9330 <li>Two:
9331 <ol>
9332 <li>Sub-one</li>
9333 <li>Sub-two</li>
9334 </ol>
9335 </li>
9336 </ol>
9337
9338 !! end
9339
9340 !! test
9341 HTML nested ordered list, open tags (bug 5497)
9342 !! options
9343 disabled
9344 !! input
9345 <ol>
9346 <li>One
9347 <li>Two:
9348 <ol>
9349 <li>Sub-one
9350 <li>Sub-two
9351 </ol>
9352 </ol>
9353 !! result
9354 <ol>
9355 <li>One
9356 </li><li>Two:
9357 <ol>
9358 <li>Sub-one
9359 </li><li>Sub-two
9360 </li></ol>
9361 </li></ol>
9362
9363 !! end
9364
9365 !! test
9366 HTML ordered list item with parameters oddity
9367 !! input
9368 <ol><li id="fragment">One</li></ol>
9369 !! result
9370 <ol><li id="fragment">One</li></ol>
9371
9372 !! end
9373
9374 !!test
9375 bug 5918: autonumbering
9376 !! input
9377 [http://first/] [http://second] [ftp://ftp]
9378
9379 ftp://inlineftp
9380
9381 [mailto:enclosed@mail.tld With target]
9382
9383 [mailto:enclosed@mail.tld]
9384
9385 mailto:inline@mail.tld
9386 !! result
9387 <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>
9388 </p><p><a rel="nofollow" class="external free" href="ftp://inlineftp">ftp://inlineftp</a>
9389 </p><p><a rel="nofollow" class="external text" href="mailto:enclosed@mail.tld">With target</a>
9390 </p><p><a rel="nofollow" class="external autonumber" href="mailto:enclosed@mail.tld">[4]</a>
9391 </p><p><a rel="nofollow" class="external free" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a>
9392 </p>
9393 !! end
9394
9395
9396 #
9397 # Security and HTML correctness
9398 # From Nick Jenkins' fuzz testing
9399 #
9400
9401 !! test
9402 Fuzz testing: Parser13
9403 !! input
9404 {|
9405 | http://a|
9406 !! result
9407 <table>
9408 <tr>
9409 <td>
9410 </td>
9411 </tr>
9412 </table>
9413
9414 !! end
9415
9416 !! test
9417 Fuzz testing: Parser14
9418 !! input
9419 == onmouseover= ==
9420 http://__TOC__
9421 !! result
9422 <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>
9423 http://<table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
9424 <ul>
9425 <li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
9426 </ul>
9427 </td></tr></table>
9428
9429 !! end
9430
9431 !! test
9432 Fuzz testing: Parser14-table
9433 !! input
9434 ==a==
9435 {| STYLE=__TOC__
9436 !! result
9437 <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>
9438 <table style="&#95;_TOC&#95;_">
9439 <tr><td></td></tr>
9440 </table>
9441
9442 !! end
9443
9444 # Known to produce bogus xml (extra </td>)
9445 !! test
9446 Fuzz testing: Parser16
9447 !! options
9448 noxml
9449 !! input
9450 {|
9451 !https://||||||
9452 !! result
9453 <table>
9454 <tr>
9455 <th>https://</th>
9456 <th></th>
9457 <th></th>
9458 <th>
9459 </td>
9460 </tr>
9461 </table>
9462
9463 !! end
9464
9465 !! test
9466 Fuzz testing: Parser21
9467 !! input
9468 {|
9469 ! irc://{{ftp://a" onmouseover="alert('hello world');"
9470 |
9471 !! result
9472 <table>
9473 <tr>
9474 <th> <a rel="nofollow" class="external free" href="irc://{{ftp://a">irc://{{ftp://a</a>" onmouseover="alert('hello world');"
9475 </th>
9476 <td>
9477 </td>
9478 </tr>
9479 </table>
9480
9481 !! end
9482
9483 !! test
9484 Fuzz testing: Parser22
9485 !! input
9486 http://===r:::https://b
9487
9488 {|
9489 !!result
9490 <p><a rel="nofollow" class="external free" href="http://===r:::https://b">http://===r:::https://b</a>
9491 </p>
9492 <table>
9493 <tr><td></td></tr>
9494 </table>
9495
9496 !! end
9497
9498 # Known to produce bad XML for now
9499 !! test
9500 Fuzz testing: Parser24
9501 !! options
9502 noxml
9503 !! input
9504 {|
9505 {{{|
9506 <u CLASS=
9507 | {{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx--><noinclude>}}}} >
9508 <br style="onmouseover='alert(document.cookie);' " />
9509
9510 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
9511 |
9512 !! result
9513 <table>
9514 {{{|
9515 <u class="&#124;">}}}} &gt;
9516 <br style="onmouseover=&#39;alert(document.cookie);&#39;" />
9517
9518 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
9519 <tr>
9520 <td></u>
9521 </td>
9522 </tr>
9523 </table>
9524
9525 !! end
9526
9527 # Note: the current result listed for this is not what the original one was,
9528 # but the original bug was JavaScript injection, which is fixed in any case.
9529 # It's not clear that the original result listed was any more correct than the
9530 # current one. Original result:
9531 # <p>{{{|
9532 # </p>
9533 # <li class="&#124;&#124;">
9534 # }}}blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
9535 !!test
9536 Fuzz testing: Parser25 (bug 6055)
9537 !! input
9538 {{{
9539 |
9540 <LI CLASS=||
9541 >
9542 }}}blah" onmouseover="alert('hello world');" align="left"'''MOVE MOUSE CURSOR OVER HERE
9543 !! result
9544 <p>&lt;LI CLASS=blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
9545 </p>
9546 !! end
9547
9548 !!test
9549 Fuzz testing: URL adjacent extension (with space, clean)
9550 !! options
9551 !! input
9552 http://example.com <nowiki>junk</nowiki>
9553 !! result
9554 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a> junk
9555 </p>
9556 !!end
9557
9558 !!test
9559 Fuzz testing: URL adjacent extension (no space, dirty; nowiki)
9560 !! options
9561 !! input
9562 http://example.com<nowiki>junk</nowiki>
9563 !! result
9564 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>junk
9565 </p>
9566 !!end
9567
9568 !!test
9569 Fuzz testing: URL adjacent extension (no space, dirty; pre)
9570 !! options
9571 !! input
9572 http://example.com<pre>junk</pre>
9573 !! result
9574 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a><pre>junk</pre>
9575
9576 !!end
9577
9578 !!test
9579 Fuzz testing: image with bogus manual thumbnail
9580 !!input
9581 [[Image:foobar.jpg|thumbnail= ]]
9582 !!result
9583 <div class="thumb tright"><div class="thumbinner" style="width:1943px;">Error creating thumbnail: <div class="thumbcaption"></div></div></div>
9584
9585 !!end
9586
9587 !! test
9588 Fuzz testing: encoded newline in generated HTML replacements (bug 6577)
9589 !! input
9590 <pre dir="&#10;"></pre>
9591 !! result
9592 <pre dir="&#10;"></pre>
9593
9594 !! end
9595
9596 !! test
9597 Parsing optional HTML elements (Bug 6171)
9598 !! options
9599 !! input
9600 <table>
9601 <tr>
9602 <td> Some tabular data</td>
9603 <td> More tabular data ...
9604 <td> And yet som tabular data</td>
9605 </tr>
9606 </table>
9607 !! result
9608 <table>
9609 <tr>
9610 <td> Some tabular data</td>
9611 <td> More tabular data ...
9612 </td><td> And yet som tabular data</td>
9613 </tr>
9614 </table>
9615
9616 !! end
9617
9618 !! test
9619 Correct handling of <td>, <tr> (Bug 6171)
9620 !! options
9621 !! input
9622 <table>
9623 <tr>
9624 <td> Some tabular data</td>
9625 <td> More tabular data ...</td>
9626 <td> And yet som tabular data</td>
9627 </tr>
9628 </table>
9629 !! result
9630 <table>
9631 <tr>
9632 <td> Some tabular data</td>
9633 <td> More tabular data ...</td>
9634 <td> And yet som tabular data</td>
9635 </tr>
9636 </table>
9637
9638 !! end
9639
9640
9641 !! test
9642 Parsing crashing regression (fr:JavaScript)
9643 !! input
9644 </body></x>
9645 !! result
9646 <p>&lt;/body&gt;&lt;/x&gt;
9647 </p>
9648 !! end
9649
9650 !! test
9651 Inline wiki vs wiki block nesting
9652 !! input
9653 '''Bold paragraph
9654
9655 New wiki paragraph
9656 !! result
9657 <p><b>Bold paragraph</b>
9658 </p><p>New wiki paragraph
9659 </p>
9660 !! end
9661
9662 !! test
9663 Inline HTML vs wiki block nesting
9664 !! options
9665 disabled
9666 !! input
9667 <b>Bold paragraph
9668
9669 New wiki paragraph
9670 !! result
9671 <p><b>Bold paragraph</b>
9672 </p><p>New wiki paragraph
9673 </p>
9674 !! end
9675
9676 # Original result was this:
9677 # <p><b>bold</b><b>bold<i>bolditalics</i></b>
9678 # </p>
9679 # While that might be marginally more intuitive, maybe, the six-apostrophe
9680 # construct is clearly pathological and the result stated here (which is what
9681 # the parser actually does) is about as reasonable as anything.
9682 !!test
9683 Mixing markup for italics and bold
9684 !! options
9685 !! input
9686 '''bold''''''bold''bolditalics'''''
9687 !! result
9688 <p>'<i>bold'</i><b>bold<i>bolditalics</i></b>
9689 </p>
9690 !! end
9691
9692
9693 !! article
9694 Xyzzyx
9695 !! text
9696 Article for special page transclusion test
9697 !! endarticle
9698
9699 !! test
9700 Special page transclusion
9701 !! options
9702 !! input
9703 {{Special:Prefixindex/Xyzzyx}}
9704 !! result
9705 <table id="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
9706
9707 !! end
9708
9709 !! test
9710 Special page transclusion twice (bug 5021)
9711 !! options
9712 !! input
9713 {{Special:Prefixindex/Xyzzyx}}
9714 {{Special:Prefixindex/Xyzzyx}}
9715 !! result
9716 <table id="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
9717 <table id="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
9718
9719 !! end
9720
9721 !! test
9722 Transclusion of default MediaWiki message
9723 !! input
9724 {{MediaWiki:Mainpage}}
9725 !!result
9726 <p>Main Page
9727 </p>
9728 !! end
9729
9730 !! test
9731 Transclusion of nonexistent MediaWiki message
9732 !! input
9733 {{MediaWiki:Mainpagexxx}}
9734 !!result
9735 <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>
9736 </p>
9737 !! end
9738
9739 !! test
9740 Transclusion of MediaWiki message with underscore
9741 !! input
9742 {{MediaWiki:history_short}}
9743 !! result
9744 <p>History
9745 </p>
9746 !! end
9747
9748 !! test
9749 Transclusion of MediaWiki message with space
9750 !! input
9751 {{MediaWiki:history short}}
9752 !! result
9753 <p>History
9754 </p>
9755 !! end
9756
9757 !! test
9758 Invalid header with following text
9759 !! input
9760 = x = y
9761 !! result
9762 <p>= x = y
9763 </p>
9764 !! end
9765
9766
9767 !! test
9768 Section extraction test (section 0)
9769 !! options
9770 section=0
9771 !! input
9772 start
9773 ==a==
9774 ===aa===
9775 ====aaa====
9776 ==b==
9777 ===ba===
9778 ===bb===
9779 ====bba====
9780 ===bc===
9781 ==c==
9782 ===ca===
9783 !! result
9784 start
9785 !! end
9786
9787 !! test
9788 Section extraction test (section 1)
9789 !! options
9790 section=1
9791 !! input
9792 start
9793 ==a==
9794 ===aa===
9795 ====aaa====
9796 ==b==
9797 ===ba===
9798 ===bb===
9799 ====bba====
9800 ===bc===
9801 ==c==
9802 ===ca===
9803 !! result
9804 ==a==
9805 ===aa===
9806 ====aaa====
9807 !! end
9808
9809 !! test
9810 Section extraction test (section 2)
9811 !! options
9812 section=2
9813 !! input
9814 start
9815 ==a==
9816 ===aa===
9817 ====aaa====
9818 ==b==
9819 ===ba===
9820 ===bb===
9821 ====bba====
9822 ===bc===
9823 ==c==
9824 ===ca===
9825 !! result
9826 ===aa===
9827 ====aaa====
9828 !! end
9829
9830 !! test
9831 Section extraction test (section 3)
9832 !! options
9833 section=3
9834 !! input
9835 start
9836 ==a==
9837 ===aa===
9838 ====aaa====
9839 ==b==
9840 ===ba===
9841 ===bb===
9842 ====bba====
9843 ===bc===
9844 ==c==
9845 ===ca===
9846 !! result
9847 ====aaa====
9848 !! end
9849
9850 !! test
9851 Section extraction test (section 4)
9852 !! options
9853 section=4
9854 !! input
9855 start
9856 ==a==
9857 ===aa===
9858 ====aaa====
9859 ==b==
9860 ===ba===
9861 ===bb===
9862 ====bba====
9863 ===bc===
9864 ==c==
9865 ===ca===
9866 !! result
9867 ==b==
9868 ===ba===
9869 ===bb===
9870 ====bba====
9871 ===bc===
9872 !! end
9873
9874 !! test
9875 Section extraction test (section 5)
9876 !! options
9877 section=5
9878 !! input
9879 start
9880 ==a==
9881 ===aa===
9882 ====aaa====
9883 ==b==
9884 ===ba===
9885 ===bb===
9886 ====bba====
9887 ===bc===
9888 ==c==
9889 ===ca===
9890 !! result
9891 ===ba===
9892 !! end
9893
9894 !! test
9895 Section extraction test (section 6)
9896 !! options
9897 section=6
9898 !! input
9899 start
9900 ==a==
9901 ===aa===
9902 ====aaa====
9903 ==b==
9904 ===ba===
9905 ===bb===
9906 ====bba====
9907 ===bc===
9908 ==c==
9909 ===ca===
9910 !! result
9911 ===bb===
9912 ====bba====
9913 !! end
9914
9915 !! test
9916 Section extraction test (section 7)
9917 !! options
9918 section=7
9919 !! input
9920 start
9921 ==a==
9922 ===aa===
9923 ====aaa====
9924 ==b==
9925 ===ba===
9926 ===bb===
9927 ====bba====
9928 ===bc===
9929 ==c==
9930 ===ca===
9931 !! result
9932 ====bba====
9933 !! end
9934
9935 !! test
9936 Section extraction test (section 8)
9937 !! options
9938 section=8
9939 !! input
9940 start
9941 ==a==
9942 ===aa===
9943 ====aaa====
9944 ==b==
9945 ===ba===
9946 ===bb===
9947 ====bba====
9948 ===bc===
9949 ==c==
9950 ===ca===
9951 !! result
9952 ===bc===
9953 !! end
9954
9955 !! test
9956 Section extraction test (section 9)
9957 !! options
9958 section=9
9959 !! input
9960 start
9961 ==a==
9962 ===aa===
9963 ====aaa====
9964 ==b==
9965 ===ba===
9966 ===bb===
9967 ====bba====
9968 ===bc===
9969 ==c==
9970 ===ca===
9971 !! result
9972 ==c==
9973 ===ca===
9974 !! end
9975
9976 !! test
9977 Section extraction test (section 10)
9978 !! options
9979 section=10
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 ===ca===
9994 !! end
9995
9996 !! test
9997 Section extraction test (nonexistent section 11)
9998 !! options
9999 section=11
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 !! end
10014
10015 !! test
10016 Section extraction test with bogus heading (section 1)
10017 !! options
10018 section=1
10019 !! input
10020 ==a==
10021 ==bogus== not a legal section
10022 ==b==
10023 !! result
10024 ==a==
10025 ==bogus== not a legal section
10026 !! end
10027
10028 !! test
10029 Section extraction test with bogus heading (section 2)
10030 !! options
10031 section=2
10032 !! input
10033 ==a==
10034 ==bogus== not a legal section
10035 ==b==
10036 !! result
10037 ==b==
10038 !! end
10039
10040 !! test
10041 Section extraction test with comment after heading (section 1)
10042 !! options
10043 section=1
10044 !! input
10045 ==a==
10046 ==b== <!-- -->
10047 ==c==
10048 !! result
10049 ==a==
10050 !! end
10051
10052 !! test
10053 Section extraction test with comment after heading (section 2)
10054 !! options
10055 section=2
10056 !! input
10057 ==a==
10058 ==b== <!-- -->
10059 ==c==
10060 !! result
10061 ==b== <!-- -->
10062 !! end
10063
10064 !! test
10065 Section extraction test with bogus <nowiki> heading (section 1)
10066 !! options
10067 section=1
10068 !! input
10069 ==a==
10070 ==bogus== <nowiki>not a legal section</nowiki>
10071 ==b==
10072 !! result
10073 ==a==
10074 ==bogus== <nowiki>not a legal section</nowiki>
10075 !! end
10076
10077 !! test
10078 Section extraction test with bogus <nowiki> heading (section 2)
10079 !! options
10080 section=2
10081 !! input
10082 ==a==
10083 ==bogus== <nowiki>not a legal section</nowiki>
10084 ==b==
10085 !! result
10086 ==b==
10087 !! end
10088
10089
10090 # Formerly testing for bug 2587, now resolved by the use of unmarked sections
10091 # instead of respecting commented sections
10092 !! test
10093 Section extraction prefixed by comment (section 1)
10094 !! options
10095 section=1
10096 !! input
10097 <!-- -->==sec1==
10098 ==sec2==
10099 !!result
10100 ==sec2==
10101 !!end
10102
10103 !! test
10104 Section extraction prefixed by comment (section 2)
10105 !! options
10106 section=2
10107 !! input
10108 <!-- -->==sec1==
10109 ==sec2==
10110 !!result
10111
10112 !!end
10113
10114
10115 # Formerly testing for bug 2607, now resolved by the use of unmarked sections
10116 # instead of respecting HTML-style headings
10117 !! test
10118 Section extraction, mixed wiki and html (section 1)
10119 !! options
10120 section=1
10121 !! input
10122 <h2>unmarked</h2>
10123 unmarked
10124 ==1==
10125 one
10126 ==2==
10127 two
10128 !! result
10129 ==1==
10130 one
10131 !! end
10132
10133 !! test
10134 Section extraction, mixed wiki and html (section 2)
10135 !! options
10136 section=2
10137 !! input
10138 <h2>unmarked</h2>
10139 unmarked
10140 ==1==
10141 one
10142 ==2==
10143 two
10144 !! result
10145 ==2==
10146 two
10147 !! end
10148
10149
10150 # Formerly testing for bug 3342
10151 !! test
10152 Section extraction, heading surrounded by <noinclude>
10153 !! options
10154 section=1
10155 !! input
10156 <noinclude>==unmarked==</noinclude>
10157 ==marked==
10158 !! result
10159 ==marked==
10160 !!end
10161
10162 # Test behavior of bug 19910
10163 !! test
10164 Sectiion with all-equals
10165 !! options
10166 section=2
10167 !! input
10168 ===
10169 The line above must have a trailing space
10170 === <!--
10171 --> <!-- -->
10172 But just in case it doesn't...
10173 !! result
10174 === <!--
10175 --> <!-- -->
10176 But just in case it doesn't...
10177 !! end
10178
10179 !! test
10180 Section replacement test (section 0)
10181 !! options
10182 replace=0,"xxx"
10183 !! input
10184 start
10185 ==a==
10186 ===aa===
10187 ====aaa====
10188 ==b==
10189 ===ba===
10190 ===bb===
10191 ====bba====
10192 ===bc===
10193 ==c==
10194 ===ca===
10195 !! result
10196 xxx
10197
10198 ==a==
10199 ===aa===
10200 ====aaa====
10201 ==b==
10202 ===ba===
10203 ===bb===
10204 ====bba====
10205 ===bc===
10206 ==c==
10207 ===ca===
10208 !! end
10209
10210 !! test
10211 Section replacement test (section 1)
10212 !! options
10213 replace=1,"xxx"
10214 !! input
10215 start
10216 ==a==
10217 ===aa===
10218 ====aaa====
10219 ==b==
10220 ===ba===
10221 ===bb===
10222 ====bba====
10223 ===bc===
10224 ==c==
10225 ===ca===
10226 !! result
10227 start
10228 xxx
10229
10230 ==b==
10231 ===ba===
10232 ===bb===
10233 ====bba====
10234 ===bc===
10235 ==c==
10236 ===ca===
10237 !! end
10238
10239 !! test
10240 Section replacement test (section 2)
10241 !! options
10242 replace=2,"xxx"
10243 !! input
10244 start
10245 ==a==
10246 ===aa===
10247 ====aaa====
10248 ==b==
10249 ===ba===
10250 ===bb===
10251 ====bba====
10252 ===bc===
10253 ==c==
10254 ===ca===
10255 !! result
10256 start
10257 ==a==
10258 xxx
10259
10260 ==b==
10261 ===ba===
10262 ===bb===
10263 ====bba====
10264 ===bc===
10265 ==c==
10266 ===ca===
10267 !! end
10268
10269 !! test
10270 Section replacement test (section 3)
10271 !! options
10272 replace=3,"xxx"
10273 !! input
10274 start
10275 ==a==
10276 ===aa===
10277 ====aaa====
10278 ==b==
10279 ===ba===
10280 ===bb===
10281 ====bba====
10282 ===bc===
10283 ==c==
10284 ===ca===
10285 !! result
10286 start
10287 ==a==
10288 ===aa===
10289 xxx
10290
10291 ==b==
10292 ===ba===
10293 ===bb===
10294 ====bba====
10295 ===bc===
10296 ==c==
10297 ===ca===
10298 !! end
10299
10300 !! test
10301 Section replacement test (section 4)
10302 !! options
10303 replace=4,"xxx"
10304 !! input
10305 start
10306 ==a==
10307 ===aa===
10308 ====aaa====
10309 ==b==
10310 ===ba===
10311 ===bb===
10312 ====bba====
10313 ===bc===
10314 ==c==
10315 ===ca===
10316 !! result
10317 start
10318 ==a==
10319 ===aa===
10320 ====aaa====
10321 xxx
10322
10323 ==c==
10324 ===ca===
10325 !! end
10326
10327 !! test
10328 Section replacement test (section 5)
10329 !! options
10330 replace=5,"xxx"
10331 !! input
10332 start
10333 ==a==
10334 ===aa===
10335 ====aaa====
10336 ==b==
10337 ===ba===
10338 ===bb===
10339 ====bba====
10340 ===bc===
10341 ==c==
10342 ===ca===
10343 !! result
10344 start
10345 ==a==
10346 ===aa===
10347 ====aaa====
10348 ==b==
10349 xxx
10350
10351 ===bb===
10352 ====bba====
10353 ===bc===
10354 ==c==
10355 ===ca===
10356 !! end
10357
10358 !! test
10359 Section replacement test (section 6)
10360 !! options
10361 replace=6,"xxx"
10362 !! input
10363 start
10364 ==a==
10365 ===aa===
10366 ====aaa====
10367 ==b==
10368 ===ba===
10369 ===bb===
10370 ====bba====
10371 ===bc===
10372 ==c==
10373 ===ca===
10374 !! result
10375 start
10376 ==a==
10377 ===aa===
10378 ====aaa====
10379 ==b==
10380 ===ba===
10381 xxx
10382
10383 ===bc===
10384 ==c==
10385 ===ca===
10386 !! end
10387
10388 !! test
10389 Section replacement test (section 7)
10390 !! options
10391 replace=7,"xxx"
10392 !! input
10393 start
10394 ==a==
10395 ===aa===
10396 ====aaa====
10397 ==b==
10398 ===ba===
10399 ===bb===
10400 ====bba====
10401 ===bc===
10402 ==c==
10403 ===ca===
10404 !! result
10405 start
10406 ==a==
10407 ===aa===
10408 ====aaa====
10409 ==b==
10410 ===ba===
10411 ===bb===
10412 xxx
10413
10414 ===bc===
10415 ==c==
10416 ===ca===
10417 !! end
10418
10419 !! test
10420 Section replacement test (section 8)
10421 !! options
10422 replace=8,"xxx"
10423 !! input
10424 start
10425 ==a==
10426 ===aa===
10427 ====aaa====
10428 ==b==
10429 ===ba===
10430 ===bb===
10431 ====bba====
10432 ===bc===
10433 ==c==
10434 ===ca===
10435 !! result
10436 start
10437 ==a==
10438 ===aa===
10439 ====aaa====
10440 ==b==
10441 ===ba===
10442 ===bb===
10443 ====bba====
10444 xxx
10445
10446 ==c==
10447 ===ca===
10448 !!end
10449
10450 !! test
10451 Section replacement test (section 9)
10452 !! options
10453 replace=9,"xxx"
10454 !! input
10455 start
10456 ==a==
10457 ===aa===
10458 ====aaa====
10459 ==b==
10460 ===ba===
10461 ===bb===
10462 ====bba====
10463 ===bc===
10464 ==c==
10465 ===ca===
10466 !! result
10467 start
10468 ==a==
10469 ===aa===
10470 ====aaa====
10471 ==b==
10472 ===ba===
10473 ===bb===
10474 ====bba====
10475 ===bc===
10476 xxx
10477 !! end
10478
10479 !! test
10480 Section replacement test (section 10)
10481 !! options
10482 replace=10,"xxx"
10483 !! input
10484 start
10485 ==a==
10486 ===aa===
10487 ====aaa====
10488 ==b==
10489 ===ba===
10490 ===bb===
10491 ====bba====
10492 ===bc===
10493 ==c==
10494 ===ca===
10495 !! result
10496 start
10497 ==a==
10498 ===aa===
10499 ====aaa====
10500 ==b==
10501 ===ba===
10502 ===bb===
10503 ====bba====
10504 ===bc===
10505 ==c==
10506 xxx
10507 !! end
10508
10509 !! test
10510 Section replacement test with initial whitespace (bug 13728)
10511 !! options
10512 replace=2,"xxx"
10513 !! input
10514 Preformatted initial line
10515 ==a==
10516 ===a===
10517 !! result
10518 Preformatted initial line
10519 ==a==
10520 xxx
10521 !! end
10522
10523
10524 !! test
10525 Section extraction, heading followed by pre with 20 spaces (bug 6398)
10526 !! options
10527 section=1
10528 !! input
10529 ==a==
10530 a
10531 !! result
10532 ==a==
10533 a
10534 !! end
10535
10536 !! test
10537 Section extraction, heading followed by pre with 19 spaces (bug 6398 sanity check)
10538 !! options
10539 section=1
10540 !! input
10541 ==a==
10542 a
10543 !! result
10544 ==a==
10545 a
10546 !! end
10547
10548
10549 !! test
10550 Section extraction, <pre> around bogus header (bug 10309)
10551 !! options
10552 noxml section=2
10553 !! input
10554 == Section One ==
10555 <pre>
10556 =======
10557 </pre>
10558
10559 == Section Two ==
10560 stuff
10561 !! result
10562 == Section Two ==
10563 stuff
10564 !! end
10565
10566 !! test
10567 Section replacement, <pre> around bogus header (bug 10309)
10568 !! options
10569 noxml replace=2,"xxx"
10570 !! input
10571 == Section One ==
10572 <pre>
10573 =======
10574 </pre>
10575
10576 == Section Two ==
10577 stuff
10578 !! result
10579 == Section One ==
10580 <pre>
10581 =======
10582 </pre>
10583
10584 xxx
10585 !! end
10586
10587
10588
10589 !! test
10590 Handling of &#x0A; in URLs
10591 !! input
10592 **irc://&#x0A;a
10593 !! result
10594 <ul><li><ul><li><a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a>
10595 </li></ul>
10596 </li></ul>
10597
10598 !!end
10599
10600 !! test
10601 5 quotes, code coverage +1 line
10602 !! input
10603 '''''
10604 !! result
10605 !! end
10606
10607 !! test
10608 Special:Search page linking.
10609 !! input
10610 {{Special:search}}
10611 !! result
10612 <p><a href="/wiki/Special:Search" title="Special:Search">Special:Search</a>
10613 </p>
10614 !! end
10615
10616 !! test
10617 Say the magic word
10618 !! input
10619 * {{PAGENAME}}
10620 * {{BASEPAGENAME}}
10621 * {{SUBPAGENAME}}
10622 * {{SUBPAGENAMEE}}
10623 * {{BASEPAGENAME}}
10624 * {{BASEPAGENAMEE}}
10625 * {{TALKPAGENAME}}
10626 * {{TALKPAGENAMEE}}
10627 * {{SUBJECTPAGENAME}}
10628 * {{SUBJECTPAGENAMEE}}
10629 * {{NAMESPACEE}}
10630 * {{NAMESPACE}}
10631 * {{TALKSPACE}}
10632 * {{TALKSPACEE}}
10633 * {{SUBJECTSPACE}}
10634 * {{SUBJECTSPACEE}}
10635 * {{Dynamic|{{NUMBEROFUSERS}}|{{NUMBEROFPAGES}}|{{CURRENTVERSION}}|{{CONTENTLANGUAGE}}|{{DIRECTIONMARK}}|{{CURRENTTIMESTAMP}}|{{NUMBEROFARTICLES}}}}
10636 !! result
10637 <ul><li> Parser test
10638 </li><li> Parser test
10639 </li><li> Parser test
10640 </li><li> Parser_test
10641 </li><li> Parser test
10642 </li><li> Parser_test
10643 </li><li> Talk:Parser test
10644 </li><li> Talk:Parser_test
10645 </li><li> Parser test
10646 </li><li> Parser_test
10647 </li><li>
10648 </li><li>
10649 </li><li> Talk
10650 </li><li> Talk
10651 </li><li>
10652 </li><li>
10653 </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>
10654 </li></ul>
10655
10656 !! end
10657 ### Note: Above tests excludes the "{{NUMBEROFADMINS}}" magic word because it generates a MySQL error when included.
10658
10659 !! test
10660 Gallery
10661 !! input
10662 <gallery>
10663 image1.png |
10664 image2.gif|||||
10665
10666 image3|
10667 image4 |300px| centre
10668 image5.svg| http://///////
10669 [[x|xx]]]]
10670 * image6
10671 </gallery>
10672 !! result
10673 <ul class="gallery">
10674 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
10675 <div style="height: 150px;">Image1.png</div>
10676 <div class="gallerytext">
10677 </div>
10678 </div></li>
10679 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
10680 <div style="height: 150px;">Image2.gif</div>
10681 <div class="gallerytext">
10682 <p>||||
10683 </p>
10684 </div>
10685 </div></li>
10686 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
10687 <div style="height: 150px;">Image3</div>
10688 <div class="gallerytext">
10689 </div>
10690 </div></li>
10691 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
10692 <div style="height: 150px;">Image4</div>
10693 <div class="gallerytext">
10694 <p>300px| centre
10695 </p>
10696 </div>
10697 </div></li>
10698 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
10699 <div style="height: 150px;">Image5.svg</div>
10700 <div class="gallerytext">
10701 <p><a rel="nofollow" class="external free" href="http://///////">http://///////</a>
10702 </p>
10703 </div>
10704 </div></li>
10705 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
10706 <div style="height: 150px;">* image6</div>
10707 <div class="gallerytext">
10708 </div>
10709 </div></li>
10710 </ul>
10711
10712 !! end
10713
10714 !! test
10715 Gallery (with options)
10716 !! input
10717 <gallery widths='70px' heights='40px' perrow='2' caption='Foo [[Main Page]]' >
10718 File:Nonexistant.jpg|caption
10719 File:Nonexistant.jpg
10720 image:foobar.jpg|some '''caption''' [[Main Page]]
10721 image:foobar.jpg
10722 image:foobar.jpg|Blabla|alt=This is a foo-bar.|blabla.
10723 </gallery>
10724 !! result
10725 <ul class="gallery" style="max-width: 226px;_width: 226px;">
10726 <li class='gallerycaption'>Foo <a href="/wiki/Main_Page" title="Main Page">Main Page</a></li>
10727 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
10728 <div style="height: 70px;">Nonexistant.jpg</div>
10729 <div class="gallerytext">
10730 <p>caption
10731 </p>
10732 </div>
10733 </div></li>
10734 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
10735 <div style="height: 70px;">Nonexistant.jpg</div>
10736 <div class="gallerytext">
10737 </div>
10738 </div></li>
10739 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
10740 <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>
10741 <div class="gallerytext">
10742 <p>some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
10743 </p>
10744 </div>
10745 </div></li>
10746 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
10747 <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>
10748 <div class="gallerytext">
10749 </div>
10750 </div></li>
10751 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
10752 <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>
10753 <div class="gallerytext">
10754 <p>Blabla|blabla.
10755 </p>
10756 </div>
10757 </div></li>
10758 </ul>
10759
10760 !! end
10761
10762 !! test
10763 Gallery with wikitext inside caption
10764 !! input
10765 <gallery>
10766 File:foobar.jpg|[[File:foobar.jpg|20px|desc|alt=inneralt]]|alt=galleryalt
10767 File:foobar.jpg|{{Test|unamedParam|alt=param}}|alt=galleryalt
10768 </gallery>
10769 !! result
10770 <ul class="gallery">
10771 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
10772 <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>
10773 <div class="gallerytext">
10774 <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>
10775 </p>
10776 </div>
10777 </div></li>
10778 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
10779 <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>
10780 <div class="gallerytext">
10781 <p>This is a test template
10782 </p>
10783 </div>
10784 </div></li>
10785 </ul>
10786
10787 !! end
10788
10789 !! test
10790 gallery (with showfilename option)
10791 !! input
10792 <gallery showfilename>
10793 File:Nonexistant.jpg|caption
10794 File:Nonexistant.jpg
10795 image:foobar.jpg|some '''caption''' [[Main Page]]
10796 File:Foobar.jpg
10797 </gallery>
10798 !! result
10799 <ul class="gallery">
10800 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
10801 <div style="height: 150px;">Nonexistant.jpg</div>
10802 <div class="gallerytext">
10803 <p><a href="/wiki/File:Nonexistant.jpg" title="File:Nonexistant.jpg">Nonexistant.jpg</a><br />
10804 caption
10805 </p>
10806 </div>
10807 </div></li>
10808 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
10809 <div style="height: 150px;">Nonexistant.jpg</div>
10810 <div class="gallerytext">
10811 <p><a href="/wiki/File:Nonexistant.jpg" title="File:Nonexistant.jpg">Nonexistant.jpg</a><br />
10812 </p>
10813 </div>
10814 </div></li>
10815 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
10816 <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>
10817 <div class="gallerytext">
10818 <p><a href="/wiki/File:Foobar.jpg" title="File:Foobar.jpg">Foobar.jpg</a><br />
10819 some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
10820 </p>
10821 </div>
10822 </div></li>
10823 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
10824 <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>
10825 <div class="gallerytext">
10826 <p><a href="/wiki/File:Foobar.jpg" title="File:Foobar.jpg">Foobar.jpg</a><br />
10827 </p>
10828 </div>
10829 </div></li>
10830 </ul>
10831
10832 !! end
10833
10834 !! test
10835 Gallery (with namespace-less filenames)
10836 !! input
10837 <gallery>
10838 File:Nonexistant.jpg
10839 Nonexistant.jpg
10840 image:foobar.jpg
10841 foobar.jpg
10842 </gallery>
10843 !! result
10844 <ul class="gallery">
10845 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
10846 <div style="height: 150px;">Nonexistant.jpg</div>
10847 <div class="gallerytext">
10848 </div>
10849 </div></li>
10850 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
10851 <div style="height: 150px;">Nonexistant.jpg</div>
10852 <div class="gallerytext">
10853 </div>
10854 </div></li>
10855 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
10856 <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>
10857 <div class="gallerytext">
10858 </div>
10859 </div></li>
10860 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
10861 <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>
10862 <div class="gallerytext">
10863 </div>
10864 </div></li>
10865 </ul>
10866
10867 !! end
10868
10869 !! test
10870 HTML Hex character encoding (spells the word "JavaScript")
10871 !! input
10872 &#x4A;&#x061;&#x0076;&#x00061;&#x000053;&#x0000063;&#114;&#x0000069;&#00000112;&#x0000000074;
10873 !! result
10874 <p>&#x4a;&#x61;&#x76;&#x61;&#x53;&#x63;&#114;&#x69;&#112;&#x74;
10875 </p>
10876 !! end
10877
10878 !! test
10879 HTML Hex character encoding bogus encoding (bug 26437 regression check)
10880 !! input
10881 &#xsee;&#XSEE;
10882 !! result
10883 <p>&amp;#xsee;&amp;#XSEE;
10884 </p>
10885 !! end
10886
10887 !! test
10888 HTML Hex character encoding mixed case
10889 !! input
10890 &#xEE;&#Xee;
10891 !! result
10892 <p>&#xee;&#xee;
10893 </p>
10894 !! end
10895
10896 !! test
10897 __FORCETOC__ override
10898 !! input
10899 __NEWSECTIONLINK__
10900 __FORCETOC__
10901 !! result
10902 <p><br />
10903 </p>
10904 !! end
10905
10906 !! test
10907 ISBN code coverage
10908 !! input
10909 ISBN 978-0-1234-56&#x20;789
10910 !! result
10911 <p><a href="/wiki/Special:BookSources/9780123456" class="internal mw-magiclink-isbn">ISBN 978-0-1234-56</a>&#x20;789
10912 </p>
10913 !! end
10914
10915 !! test
10916 ISBN followed by 5 spaces
10917 !! input
10918 ISBN
10919 !! result
10920 <p>ISBN
10921 </p>
10922 !! end
10923
10924 !! test
10925 Double ISBN
10926 !! input
10927 ISBN ISBN 1234567890
10928 !! result
10929 <p>ISBN <a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
10930 </p>
10931 !! end
10932
10933 !! test
10934 Bug 22905: <abbr> followed by ISBN followed by </a>
10935 !! input
10936 <abbr>(fr)</abbr> ISBN 2753300917 [http://www.example.com example.com]
10937 !! result
10938 <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>
10939 </p>
10940 !! end
10941
10942 !! test
10943 Double RFC
10944 !! input
10945 RFC RFC 1234
10946 !! result
10947 <p>RFC <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc1234">RFC 1234</a>
10948 </p>
10949 !! end
10950
10951 !! test
10952 Double RFC with a wiki link
10953 !! input
10954 RFC [[RFC 1234]]
10955 !! result
10956 <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>
10957 </p>
10958 !! end
10959
10960 !! test
10961 RFC code coverage
10962 !! input
10963 RFC 983&#x20;987
10964 !! result
10965 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc983">RFC 983</a>&#x20;987
10966 </p>
10967 !! end
10968
10969 !! test
10970 Centre-aligned image
10971 !! input
10972 [[Image:foobar.jpg|centre]]
10973 !! result
10974 <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>
10975
10976 !!end
10977
10978 !! test
10979 None-aligned image
10980 !! input
10981 [[Image:foobar.jpg|none]]
10982 !! result
10983 <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>
10984
10985 !!end
10986
10987 !! test
10988 Width + Height sized image (using px) (height is ignored)
10989 !! input
10990 [[Image:foobar.jpg|640x480px]]
10991 !! result
10992 <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>
10993 </p>
10994 !!end
10995
10996 !! test
10997 Width-sized image (using px, no following whitespace)
10998 !! input
10999 [[Image:foobar.jpg|640px]]
11000 !! result
11001 <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>
11002 </p>
11003 !!end
11004
11005 !! test
11006 Width-sized image (using px, with following whitespace - test regression from r39467)
11007 !! input
11008 [[Image:foobar.jpg|640px ]]
11009 !! result
11010 <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>
11011 </p>
11012 !!end
11013
11014 !! test
11015 Width-sized image (using px, with preceding whitespace - test regression from r39467)
11016 !! input
11017 [[Image:foobar.jpg| 640px]]
11018 !! result
11019 <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>
11020 </p>
11021 !!end
11022
11023 !! test
11024 Another italics / bold test
11025 !! input
11026 ''' ''x'
11027 !! result
11028 <pre>'<i> </i>x'
11029 </pre>
11030 !!end
11031
11032 # Note the results may be incorrect, as parserTest output included this:
11033 # XML error: Mismatched tag at byte 6120:
11034 # ...<dd> </dt></dl> </dd...
11035 !! test
11036 dt/dd/dl test
11037 !! options
11038 disabled
11039 !! input
11040 :;;;::
11041 !! result
11042 <dl><dd><dl><dt><dl><dt><dl><dt><dl><dd><dl><dd>
11043 </dd></dl>
11044 </dd></dl>
11045 </dt></dl>
11046 </dt></dl>
11047 </dt></dl>
11048 </dd></dl>
11049
11050 !!end
11051
11052
11053 # Images with the "|" character in external URLs in comment tags; Eats half the comment, leaves unmatched "</a>" tag.
11054 !! test
11055 Images with the "|" character in the comment
11056 !! input
11057 [[image:Foobar.jpg|thumb|An [http://test/?param1=|left|&param2=|x external] URL]]
11058 !! result
11059 <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>
11060
11061 !!end
11062
11063 !! test
11064 [Before] HTML without raw HTML enabled ($wgRawHtml==false)
11065 !! input
11066 <html><script>alert(1);</script></html>
11067 !! result
11068 <p>&lt;html&gt;&lt;script&gt;alert(1);&lt;/script&gt;&lt;/html&gt;
11069 </p>
11070 !! end
11071
11072 !! test
11073 HTML with raw HTML ($wgRawHtml==true)
11074 !! options
11075 rawhtml
11076 !! input
11077 <html><script>alert(1);</script></html>
11078 !! result
11079 <p><script>alert(1);</script>
11080 </p>
11081 !! end
11082
11083 !! test
11084 Parents of subpages, one level up
11085 !! options
11086 subpage title=[[Subpage test/L1/L2/L3]]
11087 !! input
11088 [[../|L2]]
11089 !! result
11090 <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>
11091 </p>
11092 !! end
11093
11094
11095 !! test
11096 Parents of subpages, one level up, not named
11097 !! options
11098 subpage title=[[Subpage test/L1/L2/L3]]
11099 !! input
11100 [[../]]
11101 !! result
11102 <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>
11103 </p>
11104 !! end
11105
11106
11107
11108 !! test
11109 Parents of subpages, two levels up
11110 !! options
11111 subpage title=[[Subpage test/L1/L2/L3]]
11112 !! input
11113 [[../../|L1]]2
11114
11115 [[../../|L1]]l
11116 !! result
11117 <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
11118 </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>
11119 </p>
11120 !! end
11121
11122 !! test
11123 Parents of subpages, two levels up, without trailing slash or name.
11124 !! options
11125 subpage title=[[Subpage test/L1/L2/L3]]
11126 !! input
11127 [[../..]]
11128 !! result
11129 <p>[[../..]]
11130 </p>
11131 !! end
11132
11133 !! test
11134 Parents of subpages, two levels up, with lots of extra trailing slashes.
11135 !! options
11136 subpage title=[[Subpage test/L1/L2/L3]]
11137 !! input
11138 [[../../////]]
11139 !! result
11140 <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>
11141 </p>
11142 !! end
11143
11144 !! test
11145 Definition list code coverage
11146 !! input
11147 ; title : def
11148 ; title : def
11149 ;title: def
11150 !! result
11151 <dl><dt> title &#160;</dt><dd> def
11152 </dd><dt> title&#160;</dt><dd> def
11153 </dd><dt>title</dt><dd> def
11154 </dd></dl>
11155
11156 !! end
11157
11158 !! test
11159 Don't fall for the self-closing div
11160 !! input
11161 <div>hello world</div/>
11162 !! result
11163 <div>hello world</div>
11164
11165 !! end
11166
11167 !! test
11168 MSGNW magic word
11169 !! input
11170 {{MSGNW:msg}}
11171 !! result
11172 <p>&#91;&#91;:Template:Msg&#93;&#93;
11173 </p>
11174 !! end
11175
11176 !! test
11177 RAW magic word
11178 !! input
11179 {{RAW:QUERTY}}
11180 !! result
11181 <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>
11182 </p>
11183 !! end
11184
11185 # This isn't needed for XHTML conformance, but would be handy as a fallback security measure
11186 !! test
11187 Always escape literal '>' in output, not just after '<'
11188 !! input
11189 ><>
11190 !! result
11191 <p>&gt;&lt;&gt;
11192 </p>
11193 !! end
11194
11195 !! test
11196 Template caching
11197 !! input
11198 {{Test}}
11199 {{Test}}
11200 !! result
11201 <p>This is a test template
11202 This is a test template
11203 </p>
11204 !! end
11205
11206
11207 !! article
11208 MediaWiki:Fake
11209 !! text
11210 ==header==
11211 !! endarticle
11212
11213 !! test
11214 Inclusion of !userCanEdit() content
11215 !! input
11216 {{MediaWiki:Fake}}
11217 !! result
11218 <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>
11219
11220 !! end
11221
11222
11223 !! test
11224 Out-of-order TOC heading levels
11225 !! input
11226 ==2==
11227 ======6======
11228 ===3===
11229 =1=
11230 =====5=====
11231 ==2==
11232 !! result
11233 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
11234 <ul>
11235 <li class="toclevel-1 tocsection-1"><a href="#2"><span class="tocnumber">1</span> <span class="toctext">2</span></a>
11236 <ul>
11237 <li class="toclevel-2 tocsection-2"><a href="#6"><span class="tocnumber">1.1</span> <span class="toctext">6</span></a></li>
11238 <li class="toclevel-2 tocsection-3"><a href="#3"><span class="tocnumber">1.2</span> <span class="toctext">3</span></a></li>
11239 </ul>
11240 </li>
11241 <li class="toclevel-1 tocsection-4"><a href="#1"><span class="tocnumber">2</span> <span class="toctext">1</span></a>
11242 <ul>
11243 <li class="toclevel-2 tocsection-5"><a href="#5"><span class="tocnumber">2.1</span> <span class="toctext">5</span></a></li>
11244 <li class="toclevel-2 tocsection-6"><a href="#2_2"><span class="tocnumber">2.2</span> <span class="toctext">2</span></a></li>
11245 </ul>
11246 </li>
11247 </ul>
11248 </td></tr></table>
11249 <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>
11250 <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>
11251 <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>
11252 <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>
11253 <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>
11254 <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>
11255
11256 !! end
11257
11258
11259 !! test
11260 ISBN with a dummy number
11261 !! input
11262 ISBN ---
11263 !! result
11264 <p>ISBN ---
11265 </p>
11266 !! end
11267
11268
11269 !! test
11270 ISBN with space-delimited number
11271 !! input
11272 ISBN 92 9017 032 8
11273 !! result
11274 <p><a href="/wiki/Special:BookSources/9290170328" class="internal mw-magiclink-isbn">ISBN 92 9017 032 8</a>
11275 </p>
11276 !! end
11277
11278
11279 !! test
11280 ISBN with multiple spaces, no number
11281 !! input
11282 ISBN foo
11283 !! result
11284 <p>ISBN foo
11285 </p>
11286 !! end
11287
11288
11289 !! test
11290 ISBN length
11291 !! input
11292 ISBN 123456789
11293
11294 ISBN 1234567890
11295
11296 ISBN 12345678901
11297 !! result
11298 <p>ISBN 123456789
11299 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
11300 </p><p>ISBN 12345678901
11301 </p>
11302 !! end
11303
11304
11305 !! test
11306 ISBN with trailing year (bug 8110)
11307 !! input
11308 ISBN 1-234-56789-0 - 2006
11309
11310 ISBN 1 234 56789 0 - 2006
11311 !! result
11312 <p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1-234-56789-0</a> - 2006
11313 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1 234 56789 0</a> - 2006
11314 </p>
11315 !! end
11316
11317
11318 !! test
11319 anchorencode
11320 !! input
11321 {{anchorencode:foo bar©#%n}}
11322 !! result
11323 <p>foo_bar.C2.A9.23.25n
11324 </p>
11325 !! end
11326
11327 !! test
11328 anchorencode trims spaces
11329 !! input
11330 {{anchorencode: __pretty__please__}}
11331 !! result
11332 <p>pretty_please
11333 </p>
11334 !! end
11335
11336 !! test
11337 anchorencode deals with links
11338 !! input
11339 {{anchorencode: [[hello|world]] [[hi]]}}
11340 !! result
11341 <p>world_hi
11342 </p>
11343 !! end
11344
11345 !! test
11346 anchorencode deals with templates
11347 !! input
11348 {{anchorencode: {{Foo}} }}
11349 !! result
11350 <p>FOO
11351 </p>
11352 !! end
11353
11354 !! test
11355 anchorencode encodes like the TOC generator: (bug 18431)
11356 !! input
11357 === _ +:.3A%3A&&amp;]] ===
11358 {{anchorencode: _ +:.3A%3A&&amp;]] }}
11359 __NOEDITSECTION__
11360 !! result
11361 <h3> <span class="mw-headline" id=".2B:.3A.253A.26.26.5D.5D">_ +:.3A%3A&amp;&amp;]]</span></h3>
11362 <p>.2B:.3A.253A.26.26.5D.5D
11363 </p>
11364 !! end
11365
11366 # Expected output in the following test is not necessarily expected (there
11367 # should probably be <p> tags inside the <blockquote> in the output) -- it's
11368 # only testing for well-formedness.
11369 !! test
11370 Bug 6200: blockquotes and paragraph formatting
11371 !! input
11372 <blockquote>
11373 foo
11374 </blockquote>
11375
11376 bar
11377
11378 baz
11379 !! result
11380 <blockquote>
11381 foo
11382 </blockquote>
11383 <p>bar
11384 </p>
11385 <pre>baz
11386 </pre>
11387 !! end
11388
11389 !! test
11390 Bug 8293: Use of center tag ruins paragraph formatting
11391 !! input
11392 <center>
11393 foo
11394 </center>
11395
11396 bar
11397
11398 baz
11399 !! result
11400 <center>
11401 <p>foo
11402 </p>
11403 </center>
11404 <p>bar
11405 </p>
11406 <pre>baz
11407 </pre>
11408 !! end
11409
11410
11411 ###
11412 ### Language variants related tests
11413 ###
11414 !! test
11415 Self-link in language variants
11416 !! options
11417 title=[[Dunav]] language=sr
11418 !! input
11419 Both [[Dunav]] and [[Дунав]] are names for this river.
11420 !! result
11421 <p>Both <strong class="selflink">Dunav</strong> and <strong class="selflink">Дунав</strong> are names for this river.
11422 </p>
11423 !!end
11424
11425 !! article
11426 Дуна
11427 !! text
11428 content
11429 !! endarticle
11430
11431 !! test
11432 Link to another existing title shouldn't be parsed as self-link even if it's a variant of this title
11433 !! options
11434 title=[[Duna]] language=sr
11435 !! input
11436 [[Дуна]] is not a self-link while [[Duna]] and [[Dуна]] are still self-links.
11437 !! result
11438 <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.
11439 </p>
11440 !! end
11441
11442 !! test
11443 Link to pages in language variants
11444 !! options
11445 language=sr
11446 !! input
11447 Main Page can be written as [[Маин Паге]]
11448 !! result
11449 <p>Main Page can be written as <a href="/wiki/Main_Page" title="Main Page">Маин Паге</a>
11450 </p>
11451 !!end
11452
11453
11454 !! test
11455 Multiple links to pages in language variants
11456 !! options
11457 language=sr
11458 !! input
11459 [[Main Page]] can be written as [[Маин Паге]] same as [[Маин Паге]].
11460 !! result
11461 <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>.
11462 </p>
11463 !!end
11464
11465
11466 !! test
11467 Simple template in language variants
11468 !! options
11469 language=sr
11470 !! input
11471 {{тест}}
11472 !! result
11473 <p>This is a test template
11474 </p>
11475 !! end
11476
11477
11478 !! test
11479 Template with explicit namespace in language variants
11480 !! options
11481 language=sr
11482 !! input
11483 {{Template:тест}}
11484 !! result
11485 <p>This is a test template
11486 </p>
11487 !! end
11488
11489
11490 !! test
11491 Basic test for template parameter in language variants
11492 !! options
11493 language=sr
11494 !! input
11495 {{парамтест|param=foo}}
11496 !! result
11497 <p>This is a test template with parameter foo
11498 </p>
11499 !! end
11500
11501
11502 !! test
11503 Simple category in language variants
11504 !! options
11505 language=sr cat
11506 !! input
11507 [[Category:МедиаWики Усер'с Гуиде]]
11508 !! result
11509 <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>
11510 !! end
11511
11512
11513 !! article
11514 Category:分类
11515 !! text
11516 blah
11517 !! endarticle
11518
11519 !! article
11520 Category:分類
11521 !! text
11522 blah
11523 !! endarticle
11524
11525 !! test
11526 Don't convert blue categorylinks to another variant (bug 33210)
11527 !! options
11528 language=zh cat
11529 !! input
11530 [[A]][[Category:分类]]
11531 !! result
11532 <a href="/wiki/Category:%E5%88%86%E7%B1%BB" title="Category:分类">分类</a>
11533 !! end
11534
11535
11536 !! test
11537 Stripping -{}- tags (language variants)
11538 !! options
11539 language=sr
11540 !! input
11541 Latin proverb: -{Ne nuntium necare}-
11542 !! result
11543 <p>Latin proverb: Ne nuntium necare
11544 </p>
11545 !! end
11546
11547
11548 !! test
11549 Prevent conversion with -{}- tags (language variants)
11550 !! options
11551 language=sr variant=sr-ec
11552 !! input
11553 Latinski: -{Ne nuntium necare}-
11554 !! result
11555 <p>Латински: Ne nuntium necare
11556 </p>
11557 !! end
11558
11559
11560 !! test
11561 Prevent conversion of text with -{}- tags (language variants)
11562 !! options
11563 language=sr variant=sr-ec
11564 !! input
11565 Latinski: -{Ne nuntium necare}-
11566 !! result
11567 <p>Латински: Ne nuntium necare
11568 </p>
11569 !! end
11570
11571
11572 !! test
11573 Prevent conversion of links with -{}- tags (language variants)
11574 !! options
11575 language=sr variant=sr-ec
11576 !! input
11577 -{[[Main Page]]}-
11578 !! result
11579 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
11580 </p>
11581 !! end
11582
11583
11584 !! test
11585 -{}- tags within headlines (within html for parserConvert())
11586 !! options
11587 language=sr variant=sr-ec
11588 !! input
11589 == -{Naslov}- ==
11590 !! result
11591 <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>
11592
11593 !! end
11594
11595
11596 !! test
11597 Explicit definition of language variant alternatives
11598 !! options
11599 language=zh variant=zh-tw
11600 !! input
11601 -{zh:China;zh-tw:Taiwan}-, not China
11602 !! result
11603 <p>Taiwan, not China
11604 </p>
11605 !! end
11606
11607
11608 !! test
11609 Conversion around HTML tags
11610 !! options
11611 language=sr variant=sr-ec
11612 !! input
11613 -{H|span=>sr-ec:script;title=>sr-ec:src;}-
11614 <span title="La-{sr-el:L;sr-ec:C;}-tin">ski</span>
11615 !! result
11616 <p>
11617 <span title="ЛаCтин">ски</span>
11618 </p>
11619 !! end
11620
11621
11622 !! test
11623 Explicit session-wise language variant mapping (A flag and - flag)
11624 !! options
11625 language=zh variant=zh-tw
11626 !! input
11627 Taiwan is not China.
11628 But -{A|zh:China;zh-tw:Taiwan}- is China,
11629 (This-{-|zh:China;zh-tw:Taiwan}- should be stripped!)
11630 and -{China}- is China.
11631 !! result
11632 <p>Taiwan is not China.
11633 But Taiwan is Taiwan,
11634 (This should be stripped!)
11635 and China is China.
11636 </p>
11637 !! end
11638
11639 !! test
11640 Explicit session-wise language variant mapping (H flag for hide)
11641 !! options
11642 language=zh variant=zh-tw
11643 !! input
11644 (This-{H|zh:China;zh-tw:Taiwan}- should be stripped!)
11645 Taiwan is China.
11646 !! result
11647 <p>(This should be stripped!)
11648 Taiwan is Taiwan.
11649 </p>
11650 !! end
11651
11652 !! test
11653 Adding explicit conversion rule for title (T flag)
11654 !! options
11655 language=zh variant=zh-tw showtitle
11656 !! input
11657 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
11658 !! result
11659 Taiwan
11660 <p>Should be stripped!
11661 </p>
11662 !! end
11663
11664 !! test
11665 Testing that changing the language variant here in the tests actually works
11666 !! options
11667 language=zh variant=zh showtitle
11668 !! input
11669 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
11670 !! result
11671 China
11672 <p>Should be stripped!
11673 </p>
11674 !! end
11675
11676 !! test
11677 Recursive conversion of alt and title attrs shouldn't clear converter state
11678 !! options
11679 language=zh variant=zh-cn showtitle
11680 !! input
11681 -{H|zh-cn:Exclamation;zh-tw:exclamation;}-
11682 Should be stripped-{T|zh-cn:China;zh-tw:Taiwan}-<span title="exclamation">!</span>
11683 !! result
11684 China
11685 <p>
11686 Should be stripped<span title="Exclamation">!</span>
11687 </p>
11688 !! end
11689
11690 !! test
11691 Bug 24072: more test on conversion rule for title
11692 !! options
11693 language=zh variant=zh-tw showtitle
11694 !! input
11695 This should be stripped-{T|zh:China;zh-tw:Taiwan}-!
11696 This won't take interferes with the title rule-{H|zh:Beijing;zh-tw:Taipei}-.
11697 !! result
11698 Taiwan
11699 <p>This should be stripped!
11700 This won't take interferes with the title rule.
11701 </p>
11702 !! end
11703
11704 !! test
11705 Raw output of variant escape tags (R flag)
11706 !! options
11707 language=zh variant=zh-tw
11708 !! input
11709 Raw: -{R|zh:China;zh-tw:Taiwan}-
11710 !! result
11711 <p>Raw: zh:China;zh-tw:Taiwan
11712 </p>
11713 !! end
11714
11715 !! test
11716 Nested using of manual convert syntax
11717 !! options
11718 language=zh variant=zh-hk
11719 !! input
11720 Nested: -{zh-hans:Hi -{zh-cn:China;zh-sg:Singapore;}-;zh-hant:Hello -{zh-tw:Taiwan;zh-hk:H-{ong}- K-{}-ong;}-;}-!
11721 !! result
11722 <p>Nested: Hello Hong Kong!
11723 </p>
11724 !! end
11725
11726 !! test
11727 Proper conversion of text in external links
11728 !! options
11729 language=sr variant=sr-ec
11730 !! input
11731 http://www.google.com
11732 gopher://www.google.com
11733 [http://www.google.com http://www.google.com]
11734 [gopher://www.google.com gopher://www.google.com]
11735 [https://www.google.com irc://www.google.com]
11736 [ftp://www.google.com www.google.com/ftp://dir]
11737 [//www.google.com www.google.com]
11738 !! result
11739 <p><a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
11740 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
11741 <a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
11742 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
11743 <a rel="nofollow" class="external text" href="https://www.google.com">irc://www.google.com</a>
11744 <a rel="nofollow" class="external text" href="ftp://www.google.com">www.гоогле.цом/фтп://дир</a>
11745 <a rel="nofollow" class="external text" href="//www.google.com">www.гоогле.цом</a>
11746 </p>
11747 !! end
11748
11749 !! test
11750 Do not convert roman numbers to language variants
11751 !! options
11752 language=sr variant=sr-ec
11753 !! input
11754 Fridrih IV je car.
11755 !! result
11756 <p>Фридрих IV је цар.
11757 </p>
11758 !! end
11759
11760 !! test
11761 Unclosed language converter markup "-{"
11762 !! options
11763 language=sr
11764 !! input
11765 -{T|hello
11766 !! result
11767 <p>-{T|hello
11768 </p>
11769 !! end
11770
11771 !! test
11772 Don't convert raw rule "-{R|=&gt;}-" to "=>"
11773 !! options
11774 language=sr
11775 !! input
11776 -{R|=&gt;}-
11777 !! result
11778 <p>=&gt;
11779 </p>
11780 !!end
11781
11782 !!article
11783 Template:Bullet
11784 !!text
11785 * Bar
11786 !!endarticle
11787
11788 !! test
11789 Bug 529: Uncovered bullet
11790 !! input
11791 * Foo {{bullet}}
11792 !! result
11793 <ul><li> Foo
11794 </li><li> Bar
11795 </li></ul>
11796
11797 !! end
11798
11799 # Plain MediaWiki does not remove empty lists, but tidy actually does.
11800 # Templates in Wikipedia rely on this behavior, as tidy has always been
11801 # enabled there. These tests are normally run *without* tidy, so specify the
11802 # full output here.
11803 # To test realistic parsing behavior, apply a tidy-like transformation to both
11804 # the expected output and your parser's output.
11805 !! test
11806 Bug 529: Uncovered bullet leaving empty list, normally removed by tidy
11807 !! input
11808 ******* Foo {{bullet}}
11809 !! result
11810 <ul><li><ul><li><ul><li><ul><li><ul><li><ul><li><ul><li> Foo
11811 </li></ul>
11812 </li></ul>
11813 </li></ul>
11814 </li></ul>
11815 </li></ul>
11816 </li></ul>
11817 </li><li> Bar
11818 </li></ul>
11819
11820 !! end
11821
11822 !! test
11823 Bug 529: Uncovered table already at line-start
11824 !! input
11825 x
11826
11827 {{table}}
11828 y
11829 !! result
11830 <p>x
11831 </p>
11832 <table>
11833 <tr>
11834 <td> 1 </td>
11835 <td> 2
11836 </td></tr>
11837 <tr>
11838 <td> 3 </td>
11839 <td> 4
11840 </td></tr></table>
11841 <p>y
11842 </p>
11843 !! end
11844
11845 !! test
11846 Bug 529: Uncovered bullet in parser function result
11847 !! input
11848 * Foo {{lc:{{bullet}} }}
11849 !! result
11850 <ul><li> Foo
11851 </li><li> bar
11852 </li></ul>
11853
11854 !! end
11855
11856 !! test
11857 Bug 5678: Double-parsed template argument
11858 !! input
11859 {{lc:{{{1}}}|hello}}
11860 !! result
11861 <p>{{{1}}}
11862 </p>
11863 !! end
11864
11865 !! test
11866 Bug 5678: Double-parsed template invocation
11867 !! input
11868 {{lc:{{paramtest {{!}} param = hello }} }}
11869 !! result
11870 <p>{{paramtest | param = hello }}
11871 </p>
11872 !! end
11873
11874 !! test
11875 Case insensitivity of parser functions for non-ASCII characters (bug 8143)
11876 !! options
11877 language=cs
11878 title=[[Main Page]]
11879 !! input
11880 {{PRVNÍVELKÉ:ěščř}}
11881 {{prvnívelké:ěščř}}
11882 {{PRVNÍMALÉ:ěščř}}
11883 {{prvnímalé:ěščř}}
11884 {{MALÁ:ěščř}}
11885 {{malá:ěščř}}
11886 {{VELKÁ:ěščř}}
11887 {{velká:ěščř}}
11888 !! result
11889 <p>Ěščř
11890 Ěščř
11891 ěščř
11892 ěščř
11893 ěščř
11894 ěščř
11895 ĚŠČŘ
11896 ĚŠČŘ
11897 </p>
11898 !! end
11899
11900 !! test
11901 Morwen/13: Unclosed link followed by heading
11902 !! input
11903 [[link
11904 ==heading==
11905 !! result
11906 <p>[[link
11907 </p>
11908 <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>
11909
11910 !! end
11911
11912 !! test
11913 HHP2.1: Heuristics for headings in preprocessor parenthetical structures
11914 !! input
11915 {{foo|
11916 =heading=
11917 !! result
11918 <p>{{foo|
11919 </p>
11920 <h1> <span class="mw-headline" id="heading">heading</span></h1>
11921
11922 !! end
11923
11924 !! test
11925 HHP2.2: Heuristics for headings in preprocessor parenthetical structures
11926 !! input
11927 {{foo|
11928 ==heading==
11929 !! result
11930 <p>{{foo|
11931 </p>
11932 <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>
11933
11934 !! end
11935
11936 !! test
11937 Tildes in comments
11938 !! options
11939 pst
11940 !! input
11941 <!-- ~~~~ -->
11942 !! result
11943 <!-- ~~~~ -->
11944 !! end
11945
11946 !! test
11947 Paragraphs inside divs (no extra line breaks)
11948 !! input
11949 <div>Line one
11950
11951 Line two</div>
11952 !! result
11953 <div>Line one
11954 Line two</div>
11955
11956 !! end
11957
11958 !! test
11959 Paragraphs inside divs (extra line break on open)
11960 !! input
11961 <div>
11962 Line one
11963
11964 Line two</div>
11965 !! result
11966 <div>
11967 <p>Line one
11968 </p>
11969 Line two</div>
11970
11971 !! end
11972
11973 !! test
11974 Paragraphs inside divs (extra line break on close)
11975 !! input
11976 <div>Line one
11977
11978 Line two
11979 </div>
11980 !! result
11981 <div>Line one
11982 <p>Line two
11983 </p>
11984 </div>
11985
11986 !! end
11987
11988 !! test
11989 Paragraphs inside divs (extra line break on open and close)
11990 !! input
11991 <div>
11992 Line one
11993
11994 Line two
11995 </div>
11996 !! result
11997 <div>
11998 <p>Line one
11999 </p><p>Line two
12000 </p>
12001 </div>
12002
12003 !! end
12004
12005 !! test
12006 Nesting tags, paragraphs on lines which begin with <div>
12007 !! options
12008 disabled
12009 !! input
12010 <div></div><strong>A
12011 B</strong>
12012 !! result
12013 <div></div>
12014 <p><strong>A
12015 B</strong>
12016 </p>
12017 !! end
12018
12019 # Bug 6200: <blockquote> should behave like <div> with respect to line breaks
12020 !! test
12021 Bug 6200: paragraphs inside blockquotes (no extra line breaks)
12022 !! options
12023 disabled
12024 !! input
12025 <blockquote>Line one
12026
12027 Line two</blockquote>
12028 !! result
12029 <blockquote>Line one
12030 Line two</blockquote>
12031
12032 !! end
12033
12034 !! test
12035 Bug 6200: paragraphs inside blockquotes (extra line break on open)
12036 !! options
12037 disabled
12038 !! input
12039 <blockquote>
12040 Line one
12041
12042 Line two</blockquote>
12043 !! result
12044 <blockquote>
12045 <p>Line one
12046 </p>
12047 Line two</blockquote>
12048
12049 !! end
12050
12051 !! test
12052 Bug 6200: paragraphs inside blockquotes (extra line break on close)
12053 !! options
12054 disabled
12055 !! input
12056 <blockquote>Line one
12057
12058 Line two
12059 </blockquote>
12060 !! result
12061 <blockquote>Line one
12062 <p>Line two
12063 </p>
12064 </blockquote>
12065
12066 !! end
12067
12068 !! test
12069 Bug 6200: paragraphs inside blockquotes (extra line break on open and close)
12070 !! options
12071 disabled
12072 !! input
12073 <blockquote>
12074 Line one
12075
12076 Line two
12077 </blockquote>
12078 !! result
12079 <blockquote>
12080 <p>Line one
12081 </p><p>Line two
12082 </p>
12083 </blockquote>
12084
12085 !! end
12086
12087 !! test
12088 Paragraphs inside blockquotes/divs (no extra line breaks)
12089 !! input
12090 <blockquote><div>Line one
12091
12092 Line two</div></blockquote>
12093 !! result
12094 <blockquote><div>Line one
12095 Line two</div></blockquote>
12096
12097 !! end
12098
12099 !! test
12100 Paragraphs inside blockquotes/divs (extra line break on open)
12101 !! input
12102 <blockquote><div>
12103 Line one
12104
12105 Line two</div></blockquote>
12106 !! result
12107 <blockquote><div>
12108 <p>Line one
12109 </p>
12110 Line two</div></blockquote>
12111
12112 !! end
12113
12114 !! test
12115 Paragraphs inside blockquotes/divs (extra line break on close)
12116 !! input
12117 <blockquote><div>Line one
12118
12119 Line two
12120 </div></blockquote>
12121 !! result
12122 <blockquote><div>Line one
12123 <p>Line two
12124 </p>
12125 </div></blockquote>
12126
12127 !! end
12128
12129 !! test
12130 Paragraphs inside blockquotes/divs (extra line break on open and close)
12131 !! input
12132 <blockquote><div>
12133 Line one
12134
12135 Line two
12136 </div></blockquote>
12137 !! result
12138 <blockquote><div>
12139 <p>Line one
12140 </p><p>Line two
12141 </p>
12142 </div></blockquote>
12143
12144 !! end
12145
12146 !! test
12147 Interwiki links trounced by replaceExternalLinks after early LinkHolderArray expansion
12148 !! options
12149 wgLinkHolderBatchSize=0
12150 !! input
12151 [[meatball:1]]
12152 [[meatball:2]]
12153 [[meatball:3]]
12154 !! result
12155 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?1" class="extiw" title="meatball:1">meatball:1</a>
12156 <a href="http://www.usemod.com/cgi-bin/mb.pl?2" class="extiw" title="meatball:2">meatball:2</a>
12157 <a href="http://www.usemod.com/cgi-bin/mb.pl?3" class="extiw" title="meatball:3">meatball:3</a>
12158 </p>
12159 !! end
12160
12161 !! test
12162 Free external link invading image caption
12163 !! input
12164 [[Image:Foobar.jpg|thumb|http://x|hello]]
12165 !! result
12166 <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>
12167
12168 !! end
12169
12170 !! test
12171 Bug 15196: localised external link numbers
12172 !! options
12173 language=fa
12174 !! input
12175 [http://en.wikipedia.org/]
12176 !! result
12177 <p><a rel="nofollow" class="external autonumber" href="http://en.wikipedia.org/">[۱]</a>
12178 </p>
12179 !! end
12180
12181 !! test
12182 Multibyte character in padleft
12183 !! input
12184 {{padleft:-Hello|7|Æ}}
12185 !! result
12186 <p>Æ-Hello
12187 </p>
12188 !! end
12189
12190 !! test
12191 Multibyte character in padright
12192 !! input
12193 {{padright:Hello-|7|Æ}}
12194 !! result
12195 <p>Hello-Æ
12196 </p>
12197 !! end
12198
12199 !!test
12200 formatdate parser function
12201 !!input
12202 {{#formatdate:2009-03-24}}
12203 !! result
12204 <p><span class="mw-formatted-date" title="2009-03-24">2009-03-24</span>
12205 </p>
12206 !! end
12207
12208 !!test
12209 formatdate parser function, with default format
12210 !!input
12211 {{#formatdate:2009-03-24|mdy}}
12212 !! result
12213 <p><span class="mw-formatted-date" title="2009-03-24">March 24, 2009</span>
12214 </p>
12215 !! end
12216
12217 !! test
12218 Spacing of numbers in formatted dates
12219 !! input
12220 {{#formatdate:January 15}}
12221 !! result
12222 <p><span class="mw-formatted-date" title="01-15">January 15</span>
12223 </p>
12224 !! end
12225
12226 !! test
12227 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
12228 !! options
12229 language=nl title=[[MediaWiki:Common.css]]
12230 !! input
12231 {{#formatdate:2009-03-24|dmy}}
12232 !! result
12233 <p><span class="mw-formatted-date" title="2009-03-24">24 March 2009</span>
12234 </p>
12235 !! end
12236
12237 #
12238 #
12239 #
12240
12241 #
12242 # Edit comments
12243 #
12244
12245 !! test
12246 Edit comment with link
12247 !! options
12248 comment
12249 !! input
12250 I like the [[Main Page]] a lot
12251 !! result
12252 I like the <a href="/wiki/Main_Page" title="Main Page">Main Page</a> a lot
12253 !!end
12254
12255 !! test
12256 Edit comment with link and link text
12257 !! options
12258 comment
12259 !! input
12260 I like the [[Main Page|best pages]] a lot
12261 !! result
12262 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
12263 !!end
12264
12265 !! test
12266 Edit comment with link and link text with suffix
12267 !! options
12268 comment
12269 !! input
12270 I like the [[Main Page|best page]]s a lot
12271 !! result
12272 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
12273 !!end
12274
12275 !! test
12276 Edit comment with section link (non-local, eg in history list)
12277 !! options
12278 comment title=[[Main Page]]
12279 !! input
12280 /* External links */ removed bogus entries
12281 !! result
12282 <a href="/wiki/Main_Page#External_links" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
12283 !!end
12284
12285 !! test
12286 Edit comment with section link and text before it (non-local, eg in history list)
12287 !! options
12288 comment title=[[Main Page]]
12289 !! input
12290 pre-comment text /* External links */ removed bogus entries
12291 !! result
12292 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>
12293 !!end
12294
12295 !! test
12296 Edit comment with section link (local, eg in diff view)
12297 !! options
12298 comment local title=[[Main Page]]
12299 !! input
12300 /* External links */ removed bogus entries
12301 !! result
12302 <a href="#External_links">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
12303 !!end
12304
12305 !! test
12306 Edit comment with subpage link (bug 14080)
12307 !! options
12308 comment
12309 subpage
12310 title=[[Subpage test]]
12311 !! input
12312 Poked at a [[/subpage]] here...
12313 !! result
12314 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a> here...
12315 !!end
12316
12317 !! test
12318 Edit comment with subpage link and link text (bug 14080)
12319 !! options
12320 comment
12321 subpage
12322 title=[[Subpage test]]
12323 !! input
12324 Poked at a [[/subpage|neat little page]] here...
12325 !! result
12326 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">neat little page</a> here...
12327 !!end
12328
12329 !! test
12330 Edit comment with bogus subpage link in non-subpage NS (bug 14080)
12331 !! options
12332 comment
12333 title=[[Subpage test]]
12334 !! input
12335 Poked at a [[/subpage]] here...
12336 !! result
12337 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...
12338 !!end
12339
12340 !! test
12341 Edit comment with bare anchor link (local, as on diff)
12342 !! options
12343 comment
12344 local
12345 title=[[Main Page]]
12346 !!input
12347 [[#section]]
12348 !! result
12349 <a href="#section">#section</a>
12350 !! end
12351
12352 !! test
12353 Edit comment with bare anchor link (non-local, as on history)
12354 !! options
12355 comment
12356 title=[[Main Page]]
12357 !!input
12358 [[#section]]
12359 !! result
12360 <a href="/wiki/Main_Page#section" title="Main Page">#section</a>
12361 !! end
12362
12363 !! test
12364 Anchor starting with underscore
12365 !!input
12366 [[#_ref|One]]
12367 !! result
12368 <p><a href="#_ref">One</a>
12369 </p>
12370 !! end
12371
12372 !! test
12373 Id starting with underscore
12374 !!input
12375 <div id="_ref"></div>
12376 !! result
12377 <div id="_ref"></div>
12378
12379 !! end
12380
12381 !! test
12382 Space normalisation on autocomment (bug 22784)
12383 !! options
12384 comment
12385 title=[[Main Page]]
12386 !!input
12387 /* __hello__world__ */
12388 !! result
12389 <a href="/wiki/Main_Page#hello_world" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">__hello__world__</span></span>
12390 !! end
12391
12392 !! test
12393 percent-encoding and + signs in comments (Bug 26410)
12394 !! options
12395 comment
12396 !!input
12397 [[ABC%33D% ++]] [[ABC%33D% ++|+%20]]
12398 !! result
12399 <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>
12400 !! end
12401
12402 !! test
12403 Bad images - basic functionality
12404 !! options
12405 disabled
12406 !! input
12407 [[File:Bad.jpg]]
12408 !! result
12409 !! end
12410
12411 !! test
12412 Bad images - bug 16039: text after bad image disappears
12413 !! options
12414 disabled
12415 !! input
12416 Foo bar
12417 [[File:Bad.jpg]]
12418 Bar foo
12419 !! result
12420 <p>Foo bar
12421 </p><p>Bar foo
12422 </p>
12423 !! end
12424
12425 !! test
12426 Verify that displaytitle works (bug #22501) no displaytitle
12427 !! options
12428 showtitle
12429 !! config
12430 wgAllowDisplayTitle=true
12431 wgRestrictDisplayTitle=false
12432 !! input
12433 this is not the the title
12434 !! result
12435 Parser test
12436 <p>this is not the the title
12437 </p>
12438 !! end
12439
12440 !! test
12441 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=false
12442 !! options
12443 showtitle
12444 title=[[Screen]]
12445 !! config
12446 wgAllowDisplayTitle=true
12447 wgRestrictDisplayTitle=false
12448 !! input
12449 this is not the the title
12450 {{DISPLAYTITLE:whatever}}
12451 !! result
12452 whatever
12453 <p>this is not the the title
12454 </p>
12455 !! end
12456
12457 !! test
12458 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true mismatch
12459 !! options
12460 showtitle
12461 title=[[Screen]]
12462 !! config
12463 wgAllowDisplayTitle=true
12464 wgRestrictDisplayTitle=true
12465 !! input
12466 this is not the the title
12467 {{DISPLAYTITLE:whatever}}
12468 !! result
12469 Screen
12470 <p>this is not the the title
12471 </p>
12472 !! end
12473
12474 !! test
12475 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true matching
12476 !! options
12477 showtitle
12478 title=[[Screen]]
12479 !! config
12480 wgAllowDisplayTitle=true
12481 wgRestrictDisplayTitle=true
12482 !! input
12483 this is not the the title
12484 {{DISPLAYTITLE:screen}}
12485 !! result
12486 screen
12487 <p>this is not the the title
12488 </p>
12489 !! end
12490
12491 !! test
12492 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false
12493 !! options
12494 showtitle
12495 title=[[Screen]]
12496 !! config
12497 wgAllowDisplayTitle=false
12498 !! input
12499 this is not the the title
12500 {{DISPLAYTITLE:screen}}
12501 !! result
12502 Screen
12503 <p>this is not the the title
12504 <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>
12505 </p>
12506 !! end
12507
12508 !! test
12509 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false no DISPLAYTITLE
12510 !! options
12511 showtitle
12512 title=[[Screen]]
12513 !! config
12514 wgAllowDisplayTitle=false
12515 !! input
12516 this is not the the title
12517 !! result
12518 Screen
12519 <p>this is not the the title
12520 </p>
12521 !! end
12522
12523 !! test
12524 preload: check <noinclude> and <includeonly>
12525 !! options
12526 preload
12527 !! input
12528 Hello <noinclude>cruel</noinclude><includeonly>kind</includeonly> world.
12529 !! result
12530 Hello kind world.
12531 !! end
12532
12533 !! test
12534 preload: check <onlyinclude>
12535 !! options
12536 preload
12537 !! input
12538 Goodbye <onlyinclude>Hello world</onlyinclude>
12539 !! result
12540 Hello world
12541 !! end
12542
12543 !! test
12544 preload: can pass tags through if we want to
12545 !! options
12546 preload
12547 !! input
12548 <includeonly><</includeonly>includeonly>Hello world<includeonly><</includeonly>/includeonly>
12549 !! result
12550 <includeonly>Hello world</includeonly>
12551 !! end
12552
12553 !! test
12554 preload: check that it doesn't try to do tricks
12555 !! options
12556 preload
12557 !! input
12558 * <!-- Hello --> ''{{world}}'' {{<includeonly>subst:</includeonly>How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
12559 !! result
12560 * <!-- Hello --> ''{{world}}'' {{subst:How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
12561 !! end
12562
12563 !! test
12564 Play a bit with r67090 and bug 3158
12565 !! options
12566 disabled
12567 !! input
12568 <div style="width:50% !important">&nbsp;</div>
12569 <div style="width:50%&nbsp;!important">&nbsp;</div>
12570 <div style="width:50%&#160;!important">&nbsp;</div>
12571 <div style="border : solid;">&nbsp;</div>
12572 !! result
12573 <div style="width:50% !important">&nbsp;</div>
12574 <div style="width:50% !important">&nbsp;</div>
12575 <div style="width:50% !important">&nbsp;</div>
12576 <div style="border&#160;: solid;">&nbsp;</div>
12577
12578 !! end
12579
12580 !! test
12581 HTML5 data attributes
12582 !! input
12583 <span data-foo="bar">Baz</span>
12584 <p data-abc-def_hij="">Quuz</p>
12585 !! result
12586 <p><span data-foo="bar">Baz</span>
12587 </p>
12588 <p data-abc-def_hij="">Quuz</p>
12589
12590 !! end
12591
12592 !! test
12593 percent-encoding and + signs in internal links (Bug 26410)
12594 !! input
12595 [[User:+%]] [[Page+title%]]
12596 [[%+]] [[%+|%20]] [[%+ ]] [[%+r]]
12597 [[%]] [[+]] [[image:%+abc%39|foo|[[bar]]]]
12598 [[%33%45]] [[%33%45+]]
12599 !! result
12600 <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>
12601 <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>
12602 <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>
12603 <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>
12604 </p>
12605 !! end
12606
12607 !! test
12608 Special characters in embedded file links (bug 27679)
12609 !! input
12610 [[File:Contains & ampersand.jpg]]
12611 [[File:Does not exist.jpg|Title with & ampersand]]
12612 !! result
12613 <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>
12614 <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>
12615 </p>
12616 !! end
12617
12618
12619 !! test
12620 Confirm that 'apos' named character reference doesn't make it to output (not legal in HTML 4)
12621 !! input
12622 Text&apos;s been normalized?
12623 !! result
12624 <p>Text&#39;s been normalized?
12625 </p>
12626 !! end
12627
12628 !! test
12629 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate free external links
12630 !! input
12631 http://www.example.org/ <-- U+3000 (vim: ^Vu3000)
12632 !! result
12633 <p><a rel="nofollow" class="external free" href="http://www.example.org/">http://www.example.org/</a> &lt;-- U+3000 (vim: ^Vu3000)
12634 </p>
12635 !! end
12636
12637 !! test
12638 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate bracketed external links
12639 !! input
12640 [http://www.example.org/ ideograms]
12641 !! result
12642 <p><a rel="nofollow" class="external text" href="http://www.example.org/">ideograms</a>
12643 </p>
12644 !! end
12645
12646 !! test
12647 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate external images links
12648 !! input
12649 http://www.example.org/pic.png <-- U+3000 (vim: ^Vu3000)
12650 !! result
12651 <p><img src="http://www.example.org/pic.png" alt="pic.png" /> &lt;-- U+3000 (vim: ^Vu3000)
12652 </p>
12653 !! end
12654
12655 !! article
12656 Mediawiki:loop1
12657 !! text
12658 {{Identical|A}}
12659 !! endarticle
12660
12661 !! article
12662 Mediawiki:loop2
12663 !! text
12664 {{Identical|B}}
12665 !! endarticle
12666
12667 !! article
12668 Template:Identical
12669 !! text
12670 {{int:loop1}}
12671 {{int:loop2}}
12672 !! endarticle
12673
12674 !! test
12675 Bug 31098 Template which includes system messages which includes the template
12676 !! input
12677 {{Identical}}
12678 !! result
12679 <p><span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
12680 <span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
12681 </p>
12682 !! end
12683
12684 !! test
12685 Bug31490 Turkish: ucfirst 'blah'
12686 !! options
12687 language=tr
12688 !! input
12689 {{ucfirst:blah}}
12690 !! result
12691 <p>Blah
12692 </p>
12693 !! end
12694
12695 !! test
12696 Bug31490 Turkish: ucfirst 'ix'
12697 !! options
12698 language=tr
12699 !! input
12700 {{ucfirst:ix}}
12701 !! result
12702 <p>İx
12703 </p>
12704 !! end
12705
12706 !! test
12707 Bug31490 Turkish: lcfirst 'BLAH'
12708 !! options
12709 language=tr
12710 !! input
12711 {{lcfirst:BLAH}}
12712 !! result
12713 <p>bLAH
12714 </p>
12715 !! end
12716
12717 !! test
12718 Bug31490 Turkish: ucfırst (with a dotless i)
12719 !! options
12720 language=tr
12721 !! input
12722 {{ucfırst:blah}}
12723 !! result
12724 <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>
12725 </p>
12726 !! end
12727
12728 !! test
12729 Bug31490 ucfırst (with a dotless i) with English language
12730 !! options
12731 language=en
12732 !! input
12733 {{ucfırst:blah}}
12734 !! result
12735 <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>
12736 </p>
12737 !! end
12738
12739 !! test
12740 Bug 26375: TOC with italics
12741 !! options
12742 title=[[Main Page]]
12743 !! input
12744 __TOC__
12745 == ''Lost'' episodes ==
12746 !! result
12747 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
12748 <ul>
12749 <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>
12750 </ul>
12751 </td></tr></table>
12752 <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>
12753
12754 !! end
12755
12756 !! test
12757 Bug 26375: TOC with bold
12758 !! options
12759 title=[[Main Page]]
12760 !! input
12761 __TOC__
12762 == '''should be bold''' then normal text ==
12763 !! result
12764 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
12765 <ul>
12766 <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>
12767 </ul>
12768 </td></tr></table>
12769 <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>
12770
12771 !! end
12772
12773 !! test
12774 Bug 33845: Headings become cursive in TOC when they contain an image
12775 !! options
12776 title=[[Main Page]]
12777 !! input
12778 __TOC__
12779 == Image [[Image:foobar.jpg]] ==
12780 !! result
12781 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
12782 <ul>
12783 <li class="toclevel-1 tocsection-1"><a href="#Image"><span class="tocnumber">1</span> <span class="toctext">Image</span></a></li>
12784 </ul>
12785 </td></tr></table>
12786 <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>
12787
12788 !! end
12789
12790 !! test
12791 Bug 33845 (2): Headings become bold in TOC when they contain a blockquote
12792 !! options
12793 title=[[Main Page]]
12794 !! input
12795 __TOC__
12796 == <blockquote>Quote</blockquote> ==
12797 !! result
12798 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
12799 <ul>
12800 <li class="toclevel-1 tocsection-1"><a href="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
12801 </ul>
12802 </td></tr></table>
12803 <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>
12804
12805 !! end
12806
12807 !! test
12808 Unclosed tags in TOC
12809 !! options
12810 title=[[Main Page]]
12811 !! input
12812 __TOC__
12813 == Proof: 2 < 3 ==
12814 <small>Hanc marginis exiguitas non caperet.</small>
12815 QED
12816 !! result
12817 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
12818 <ul>
12819 <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>
12820 </ul>
12821 </td></tr></table>
12822 <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>
12823 <p><small>Hanc marginis exiguitas non caperet.</small>
12824 QED
12825 </p>
12826 !! end
12827
12828 !! test
12829 Multiple tags in TOC
12830 !! input
12831 __TOC__
12832 == <i>Foo</i> <b>Bar</b> ==
12833
12834 == <i>Foo</i> <blockquote>Bar</blockquote> ==
12835 !! result
12836 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
12837 <ul>
12838 <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>
12839 <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>
12840 </ul>
12841 </td></tr></table>
12842 <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>
12843 <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>
12844
12845 !! end
12846
12847 !! test
12848 Tags with parameters in TOC
12849 !! input
12850 __TOC__
12851 == <sup class="in-h2">Hello</sup> ==
12852
12853 == <sup class="a > b">Evilbye</sup> ==
12854 !! result
12855 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
12856 <ul>
12857 <li class="toclevel-1 tocsection-1"><a href="#Hello"><span class="tocnumber">1</span> <span class="toctext"><sup>Hello</sup></span></a></li>
12858 <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>
12859 </ul>
12860 </td></tr></table>
12861 <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>
12862 <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>
12863
12864 !! end
12865
12866 !! test
12867 span tags with directionality in TOC
12868 !! input
12869 __TOC__
12870 == <span dir="ltr">C++</span> ==
12871
12872 == <span dir="rtl">זבנג!</span> ==
12873
12874 == <span style="font-style: italic">The attributes on these span tags must be deleted from the TOC</span> ==
12875
12876 == <span style="font-style: italic" dir="ltr">All attributes on these span tags must be deleted from the TOC</span> ==
12877
12878 == <span dir="ltr" style="font-style: italic">Attributes after dir on these span tags must be deleted from the TOC</span> ==
12879 !! result
12880 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
12881 <ul>
12882 <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>
12883 <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>
12884 <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>
12885 <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>
12886 <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>
12887 </ul>
12888 </td></tr></table>
12889 <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>
12890 <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>
12891 <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>
12892 <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>
12893 <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>
12894
12895 !! end
12896
12897 !! article
12898 MediaWiki:Bug32057
12899 !! text
12900 == {{int:headline_sample}} ==
12901 !! endarticle
12902
12903 !! test
12904 Bug 32057: Title needed when expanding <h> nodes.
12905 !! options
12906 title=[[Main Page]]
12907 !! input
12908 {{int:Bug32057}}
12909 !! result
12910 <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>
12911
12912 !! end
12913
12914 !! test
12915 Strip marker in urlencode
12916 !! input
12917 {{urlencode:x<nowiki/>y}}
12918 {{urlencode:x<nowiki/>y|wiki}}
12919 {{urlencode:x<nowiki/>y|path}}
12920 !! result
12921 <p>xy
12922 xy
12923 xy
12924 </p>
12925 !! end
12926
12927 !! test
12928 Strip marker in lc
12929 !! input
12930 {{lc:x<nowiki/>y}}
12931 !! result
12932 <p>xy
12933 </p>
12934 !! end
12935
12936 !! test
12937 Strip marker in uc
12938 !! input
12939 {{uc:x<nowiki/>y}}
12940 !! result
12941 <p>XY
12942 </p>
12943 !! end
12944
12945 !! test
12946 Strip marker in formatNum
12947 !! input
12948 {{formatnum:1<nowiki/>2}}
12949 {{formatnum:1<nowiki/>2|R}}
12950 !! result
12951 <p>12
12952 12
12953 </p>
12954 !! end
12955
12956 !! test
12957 Check noCommafy in formatNum
12958 !! options
12959 language=be-tarask
12960 !! input
12961 {{formatnum:123456.78}}
12962 {{formatnum:123456.78|NOSEP}}
12963 !! result
12964 <p>123 456,78
12965 123456.78
12966 </p>
12967 !! end
12968
12969 !! test
12970 Strip marker in grammar
12971 !! options
12972 language=fi
12973 !! input
12974 {{grammar:elative|foo<nowiki/>bar}}
12975 !! result
12976 <p>foobarista
12977 </p>
12978 !! end
12979
12980 !! test
12981 Strip marker in padleft
12982 !! input
12983 {{padleft:|2|x<nowiki/>y}}
12984 !! result
12985 <p>xy
12986 </p>
12987 !! end
12988
12989 !! test
12990 Strip marker in padright
12991 !! input
12992 {{padright:|2|x<nowiki/>y}}
12993 !! result
12994 <p>xy
12995 </p>
12996 !! end
12997
12998 !! test
12999 Strip marker in anchorencode
13000 !! input
13001 {{anchorencode:x<nowiki/>y}}
13002 !! result
13003 <p>xy
13004 </p>
13005 !! end
13006
13007 !! test
13008 nowiki inside link inside heading (bug 18295)
13009 !! input
13010 ==[[foo|x<nowiki>y</nowiki>z]]==
13011 !! result
13012 <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>
13013
13014 !! end
13015
13016 !! test
13017 new support for bdi element (bug 31817)
13018 !! input
13019 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
13020 !! result
13021 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
13022
13023 !!end
13024
13025 !! test
13026 Ignore pipe between table row attributes
13027 !! input
13028 {|
13029 | quux
13030 |- id=foo | style='color: red'
13031 | bar
13032 |}
13033 !! result
13034 <table>
13035 <tr>
13036 <td> quux
13037 </td></tr>
13038 <tr id="foo" style="color: red">
13039 <td> bar
13040 </td></tr></table>
13041
13042 !! end
13043
13044 !!test
13045 Gallery override link with WikiLink (bug 34852)
13046 !! input
13047 <gallery>
13048 File:foobar.jpg|caption|alt=galleryalt|link=InterWikiLink
13049 </gallery>
13050 !! result
13051 <ul class="gallery">
13052 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
13053 <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>
13054 <div class="gallerytext">
13055 <p>caption
13056 </p>
13057 </div>
13058 </div></li>
13059 </ul>
13060
13061 !! end
13062
13063 !!test
13064 Gallery override link with absolute external link (bug 34852)
13065 !! input
13066 <gallery>
13067 File:foobar.jpg|caption|alt=galleryalt|link=http://www.example.org
13068 </gallery>
13069 !! result
13070 <ul class="gallery">
13071 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
13072 <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>
13073 <div class="gallerytext">
13074 <p>caption
13075 </p>
13076 </div>
13077 </div></li>
13078 </ul>
13079
13080 !! end
13081
13082 !!test
13083 Gallery override link with malicious javascript (bug 34852)
13084 !! input
13085 <gallery>
13086 File:foobar.jpg|caption|alt=galleryalt|link=" onclick="alert('malicious javascript code!');
13087 </gallery>
13088 !! result
13089 <ul class="gallery">
13090 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
13091 <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>
13092 <div class="gallerytext">
13093 <p>caption
13094 </p>
13095 </div>
13096 </div></li>
13097 </ul>
13098
13099 !! end
13100
13101 !!test
13102 Gallery with invalid title as link (bug 43964)
13103 !! input
13104 <gallery>
13105 File:foobar.jpg|link=<
13106 </gallery>
13107 !! result
13108 <ul class="gallery">
13109 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
13110 <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>
13111 <div class="gallerytext">
13112 </div>
13113 </div></li>
13114 </ul>
13115
13116 !! end
13117
13118 !!test
13119 Language parser function
13120 !! input
13121 {{#language:ar}}
13122 !! result
13123 <p>العربية
13124 </p>
13125 !! end
13126
13127 !!test
13128 Padleft and padright as substr
13129 !! input
13130 {{padleft:|3|abcde}}
13131 {{padright:|3|abcde}}
13132 !! result
13133 <p>abc
13134 abc
13135 </p>
13136 !! end
13137
13138 !!test
13139 Bug 34939 - Case insensitive link parsing ([HttP://])
13140 !! input
13141 [HttP://MediaWiki.Org/]
13142 !! result
13143 <p><a rel="nofollow" class="external autonumber" href="HttP://MediaWiki.Org/">[1]</a>
13144 </p>
13145 !! end
13146
13147 !!test
13148 Bug 34939 - Case insensitive link parsing ([HttP:// title])
13149 !! input
13150 [HttP://MediaWiki.Org/ MediaWiki]
13151 !! result
13152 <p><a rel="nofollow" class="external text" href="HttP://MediaWiki.Org/">MediaWiki</a>
13153 </p>
13154 !! end
13155
13156 !!test
13157 Bug 34939 - Case insensitive link parsing (HttP://)
13158 !! input
13159 HttP://MediaWiki.Org/
13160 !! result
13161 <p><a rel="nofollow" class="external free" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a>
13162 </p>
13163 !! end
13164
13165 ###
13166 ### Parsoids-specific tests
13167 ### Parsoid-PHP parser incompatibilities
13168 ###
13169 !!test
13170 1. SOL-sensitive wikitext tokens as template-args
13171 !!options
13172 disabled
13173 !!input
13174 {{echo|*a}}
13175 {{echo|#a}}
13176 {{echo|:a}}
13177 !!result
13178 <p>*a
13179 #a
13180 :a
13181 </p>
13182 !!end
13183
13184 #### The following section of tests are primarily to test
13185 #### wikitext escaping capabilities of Parsoid.
13186 #### A lot of the tests are disabled for the PHP parser either
13187 #### because of minor newline diffs or other reasons.
13188 #### As Parsoid serializer can handle newlines and other HTML
13189 #### more robustly, some of these tests might get reenabled
13190 #### for the PHP parser.
13191
13192 #### --------------- Headings ---------------
13193 #### 0. Unnested
13194 #### 1. Nested inside html <h1>=foo=</h1>
13195 #### 2. Outside heading nest on a single line <h1>foo</h1>*bar
13196 #### 3. Nested inside html with wikitext split by html tags
13197 #### 4. No escape needed
13198 #### 5. Empty headings <h1></h1>
13199 #### 6. Heading chars in SOL context
13200 #### ----------------------------------------
13201 !! test
13202 Headings: 0. Unnested
13203 !! input
13204 <nowiki>=foo=</nowiki>
13205
13206 <nowiki>=foo</nowiki>''a''=
13207 !! result
13208 <p>=foo=
13209 </p><p>=foo<i>a</i>=
13210 </p>
13211 !!end
13212
13213 !! test
13214 Headings: 1. Nested inside html
13215 !! options
13216 disabled
13217 !! input
13218 =<nowiki>=foo=</nowiki>=
13219 ==<nowiki>=foo=</nowiki>==
13220 ===<nowiki>=foo=</nowiki>===
13221 ====<nowiki>=foo=</nowiki>====
13222 =====<nowiki>=foo=</nowiki>=====
13223 ======<nowiki>=foo=</nowiki>======
13224 !! result
13225 <h1>=foo=</h1>
13226 <h2>=foo=</h2>
13227 <h3>=foo=</h3>
13228 <h4>=foo=</h4>
13229 <h5>=foo=</h5>
13230 <h6>=foo=</h6>
13231 !!end
13232
13233 !! test
13234 Headings: 2. Outside heading nest on a single line <h1>foo</h1>*bar
13235 !! options
13236 disabled
13237 !! input
13238 =foo=
13239 <nowiki>*bar</nowiki>
13240 =foo=
13241 =bar
13242 =foo=
13243 <nowiki>=bar=</nowiki>
13244 !! result
13245 <h1>foo</h1>*bar
13246 <h1>foo</h1>=bar
13247 <h1>foo</h1>=bar=
13248 !!end
13249
13250 !! test
13251 Headings: 3. Nested inside html with wikitext split by html tags
13252 !! options
13253 disabled
13254 !! input
13255 =<nowiki>=</nowiki>'''bold'''foo==
13256 !! result
13257 <h1>=<b>bold</b>foo=</h1>
13258 !!end
13259
13260 !! test
13261 Headings: 4. No escaping needed (testing just h1 and h2)
13262 !! options
13263 disabled
13264 !! input
13265 ==foo=
13266 =foo==
13267 ===foo==
13268 ==foo===
13269 =''=''foo==
13270 ===
13271 !! result
13272 <h1>=foo</h1>
13273 <h1>foo=</h1>
13274 <h2>=foo</h2>
13275 <h2>foo=</h2>
13276 <h1><i>=</i>foo=</h1>
13277 <h1>=</h1>
13278 !!end
13279
13280 !! test
13281 Headings: 5. Empty headings
13282 !! options
13283 disabled
13284 !! input
13285 =<nowiki></nowiki>=
13286 ==<nowiki></nowiki>==
13287 ===<nowiki></nowiki>===
13288 ====<nowiki></nowiki>====
13289 =====<nowiki></nowiki>=====
13290 ======<nowiki></nowiki>======
13291 !! result
13292 <h1></h1>
13293 <h2></h2>
13294 <h3></h3>
13295 <h4></h4>
13296 <h5></h5>
13297 <h6></h6>
13298 !!end
13299
13300 !! test
13301 Headings: 6. Heading chars in SOL context
13302 !! options
13303 disabled
13304 !! input
13305 <!--cmt--><nowiki>=h1=</nowiki>
13306 !! result
13307 <p><!--cmt-->=h1=
13308 </p>
13309 !!end
13310
13311 #### --------------- Lists ---------------
13312 #### 0. Outside nests (*foo, etc.)
13313 #### 1. Nested inside html <ul><li>*foo</li></ul>
13314 #### 2. Inside definition lists
13315 #### 3. Only bullets at start should be escaped
13316 #### 4. No escapes needed
13317 #### 5. No unnecessary escapes
13318 #### 6. Escape bullets in SOL position
13319 #### 7. Escape bullets in a multi-line context
13320 #### ----------------------------------------
13321
13322 !! test
13323 Lists: 0. Outside nests
13324 !! input
13325 <nowiki>*foo</nowiki>
13326
13327 <nowiki>#foo</nowiki>
13328 !! result
13329 <p>*foo
13330 </p><p>#foo
13331 </p>
13332 !!end
13333
13334 !! test
13335 Lists: 1. Nested inside html
13336 !! input
13337 *<nowiki>*foo</nowiki>
13338
13339 *<nowiki>#foo</nowiki>
13340
13341 *<nowiki>:foo</nowiki>
13342
13343 *<nowiki>;foo</nowiki>
13344
13345 #<nowiki>*foo</nowiki>
13346
13347 #<nowiki>#foo</nowiki>
13348
13349 #<nowiki>:foo</nowiki>
13350
13351 #<nowiki>;foo</nowiki>
13352 !! result
13353 <ul><li>*foo
13354 </li></ul>
13355 <ul><li>#foo
13356 </li></ul>
13357 <ul><li>:foo
13358 </li></ul>
13359 <ul><li>;foo
13360 </li></ul>
13361 <ol><li>*foo
13362 </li></ol>
13363 <ol><li>#foo
13364 </li></ol>
13365 <ol><li>:foo
13366 </li></ol>
13367 <ol><li>;foo
13368 </li></ol>
13369
13370 !!end
13371
13372 !! test
13373 Lists: 2. Inside definition lists
13374 !! input
13375 ;<nowiki>;foo</nowiki>
13376
13377 ;<nowiki>:foo</nowiki>
13378
13379 ;<nowiki>:foo</nowiki>
13380 :bar
13381
13382 :<nowiki>:foo</nowiki>
13383 !! result
13384 <dl><dt>;foo
13385 </dt></dl>
13386 <dl><dt>:foo
13387 </dt></dl>
13388 <dl><dt>:foo
13389 </dt><dd>bar
13390 </dd></dl>
13391 <dl><dd>:foo
13392 </dd></dl>
13393
13394 !!end
13395
13396 !! test
13397 Lists: 3. Only bullets at start of text should be escaped
13398 !! input
13399 *<nowiki>*foo*bar</nowiki>
13400
13401 *<nowiki>*foo</nowiki>''it''*bar
13402 !! result
13403 <ul><li>*foo*bar
13404 </li></ul>
13405 <ul><li>*foo<i>it</i>*bar
13406 </li></ul>
13407
13408 !!end
13409
13410 !! test
13411 Lists: 4. No escapes needed
13412 !! options
13413 disabled
13414 !! input
13415 *foo*bar
13416
13417 *''foo''*bar
13418
13419 *[[Foo]]: bar
13420 !! result
13421 <ul><li>foo*bar
13422 </li></ul>
13423 <ul><li><i>foo</i>*bar
13424 </li></ul>
13425 <ul><li><a href="Foo" rel="mw:WikiLink">Foo</a>: bar
13426 </li></ul>
13427 !!end
13428
13429 !! test
13430 Lists: 5. No unnecessary escapes
13431 !! input
13432 * bar <span><nowiki>[[foo]]</nowiki></span>
13433
13434 *=bar <span><nowiki>[[foo]]</nowiki></span>
13435
13436 *[[bar <span><nowiki>[[foo]]</nowiki></span>
13437
13438 *<nowiki>]]bar </nowiki><span><nowiki>[[foo]]</nowiki></span>
13439
13440 *=bar <span>foo]]</span>=
13441 !! result
13442 <ul><li> bar <span>[[foo]]</span>
13443 </li></ul>
13444 <ul><li>=bar <span>[[foo]]</span>
13445 </li></ul>
13446 <ul><li>[[bar <span>[[foo]]</span>
13447 </li></ul>
13448 <ul><li>]]bar <span>[[foo]]</span>
13449 </li></ul>
13450 <ul><li>=bar <span>foo]]</span>=
13451 </li></ul>
13452
13453 !!end
13454
13455 !! test
13456 Lists: 6. Escape bullets in SOL position
13457 !! options
13458 disabled
13459 !! input
13460 <!--cmt--><nowiki>*foo</nowiki>
13461 !! result
13462 <p><!--cmt-->*foo
13463 </p>
13464 !!end
13465
13466 !! test
13467 Lists: 7. Escape bullets in a multi-line context
13468 !! input
13469 <nowiki>a
13470 *b</nowiki>
13471 !! result
13472 <p>a
13473 *b
13474 </p>
13475 !!end
13476
13477 #### --------------- HRs ---------------
13478 #### 1. Single line
13479 #### -----------------------------------
13480
13481 !! test
13482 HRs: 1. Single line
13483 !! options
13484 disabled
13485 !! input
13486 ----
13487 <nowiki>----</nowiki>
13488 ----
13489 <nowiki>=foo=</nowiki>
13490 ----
13491 <nowiki>*foo</nowiki>
13492 !! result
13493 <hr/>----
13494 <hr/>=foo=
13495 <hr/>*foo
13496 !! end
13497
13498 #### --------------- Tables ---------------
13499 #### 1a. Simple example
13500 #### 1b. No escaping needed (!foo)
13501 #### 1c. No escaping needed (|foo)
13502 #### 1d. No escaping needed (|}foo)
13503 ####
13504 #### 2a. Nested in td (<td>foo|bar</td>)
13505 #### 2b. Nested in td (<td>foo||bar</td>)
13506 #### 2c. Nested in td -- no escaping needed(<td>foo!!bar</td>)
13507 ####
13508 #### 3a. Nested in th (<th>foo!bar</th>)
13509 #### 3b. Nested in th (<th>foo!!bar</th>)
13510 #### 3c. Nested in th -- no escaping needed(<th>foo||bar</th>)
13511 ####
13512 #### 4a. Escape -
13513 #### 4b. Escape +
13514 #### 4c. No escaping needed
13515 #### --------------------------------------
13516
13517 !! test
13518 Tables: 1a. Simple example
13519 !! input
13520 <nowiki>{|
13521 |}</nowiki>
13522 !! result
13523 <p>{|
13524 |}
13525 </p>
13526 !! end
13527
13528 !! test
13529 Tables: 1b. No escaping needed
13530 !! input
13531 !foo
13532 !! result
13533 <p>!foo
13534 </p>
13535 !! end
13536
13537 !! test
13538 Tables: 1c. No escaping needed
13539 !! input
13540 |foo
13541 !! result
13542 <p>|foo
13543 </p>
13544 !! end
13545
13546 !! test
13547 Tables: 1d. No escaping needed
13548 !! input
13549 |}foo
13550 !! result
13551 <p>|}foo
13552 </p>
13553 !! end
13554
13555 !! test
13556 Tables: 2a. Nested in td
13557 !! options
13558 disabled
13559 !! input
13560 {|
13561 |<nowiki>foo|bar</nowiki>
13562 |}
13563 !! result
13564 <table>
13565 <tr><td>foo|bar
13566 </td></tr></table>
13567
13568 !! end
13569
13570 !! test
13571 Tables: 2b. Nested in td
13572 !! options
13573 disabled
13574 !! input
13575 {|
13576 |<nowiki>foo||bar</nowiki>
13577 |''it''<nowiki>foo||bar</nowiki>
13578 |}
13579 !! result
13580 <table>
13581 <tr><td>foo||bar
13582 </td><td><i>it</i>foo||bar
13583 </td></tr></table>
13584
13585 !! end
13586
13587 !! test
13588 Tables: 2c. Nested in td -- no escaping needed
13589 !! options
13590 disabled
13591 !! input
13592 {|
13593 |foo!!bar
13594 |}
13595 !! result
13596 <table>
13597 <tr><td>foo!!bar
13598 </td></tr></table>
13599
13600 !! end
13601
13602 !! test
13603 Tables: 3a. Nested in th
13604 !! options
13605 disabled
13606 !! input
13607 {|
13608 !foo!bar
13609 |}
13610 !! result
13611 <table>
13612 <tr><th>foo!bar
13613 </th></tr></table>
13614
13615 !! end
13616
13617 !! test
13618 Tables: 3b. Nested in th
13619 !! options
13620 disabled
13621 !! input
13622 {|
13623 !<nowiki>foo!!bar</nowiki>
13624 |}
13625 !! result
13626 <table>
13627 <tr><th>foo!!bar
13628 </th></tr></table>
13629
13630 !! end
13631
13632 !! test
13633 Tables: 3c. Nested in th -- no escaping needed
13634 !! options
13635 disabled
13636 !! input
13637 {|
13638 !foo||bar
13639 |}
13640 !! result
13641 <table>
13642 <tr><th>foo||bar
13643 </th></tr></table>
13644
13645 !! end
13646
13647 !! test
13648 Tables: 4a. Escape -
13649 !! options
13650 disabled
13651 !! input
13652 {|
13653 |-
13654 !-bar
13655 |-
13656 |<nowiki>-bar</nowiki>
13657 |}
13658 !! result
13659 <table><tbody>
13660 <tr><th>-bar</th></tr>
13661 <tr><td>-bar</td></tr>
13662 </tbody></table>
13663 !! end
13664
13665 !! test
13666 Tables: 4b. Escape +
13667 !! options
13668 disabled
13669 !! input
13670 {|
13671 |-
13672 !+bar
13673 |-
13674 |<nowiki>+bar</nowiki>
13675 |}
13676 !! result
13677 <table><tbody>
13678 <tr><th>+bar</th></tr>
13679 <tr><td>+bar</td></tr>
13680 </tbody></table>
13681 !! end
13682
13683 !! test
13684 Tables: 4c. No escaping needed
13685 !! options
13686 disabled
13687 !! input
13688 {|
13689 |-
13690 |foo-bar
13691 |foo+bar
13692 |-
13693 |''foo''-bar
13694 |''foo''+bar
13695 |}
13696 !! result
13697 <table><tbody>
13698 <tr><td>foo-bar</td><td>foo+bar</td></tr>
13699 <tr><td><i>foo</i>-bar</td><td><i>foo</i>+bar</td></tr>
13700 </tbody></table>
13701 !! end
13702
13703 !! test
13704 Tables: 4d. No escaping needed
13705 !! input
13706 {|
13707 ||+1
13708 ||-2
13709 |}
13710 !! result
13711 <table>
13712 <tr>
13713 <td>+1
13714 </td>
13715 <td>-2
13716 </td></tr></table>
13717
13718 !! end
13719
13720 #### --------------- Links ---------------
13721 #### 1. Quote marks in link text
13722 #### 2. Wikilinks: Escapes needed
13723 #### 3. Wikilinks: No escapes needed
13724 #### 4. Extlinks: Escapes needed
13725 #### 5. Extlinks: No escapes needed
13726 #### --------------------------------------
13727 !! test
13728 Links 1. Quote marks in link text
13729 !! options
13730 disabled
13731 !! input
13732 [[Foo|<nowiki>Foo''boo''</nowiki>]]
13733 !! result
13734 <a rel="mw:WikiLink" href="Foo">Foo''boo''</a>
13735 !! end
13736
13737 !! test
13738 Links 2. WikiLinks: Escapes needed
13739 !! options
13740 disabled
13741 !! input
13742 [[Foo|<nowiki>[Foobar]</nowiki>]]
13743 [[Foo|<nowiki>Foobar]</nowiki>]]
13744 [[Foo|<nowiki>x [Foobar] x</nowiki>]]
13745 [[Foo|<nowiki>x [http://google.com g] x</nowiki>]]
13746 [[Foo|<nowiki>[[Bar]]</nowiki>]]
13747 [[Foo|<nowiki>x [[Bar]] x</nowiki>]]
13748 [[Foo|<nowiki>|Bar</nowiki>]]
13749 !! result
13750 <a href="Foo" rel="mw:WikiLink">[Foobar]</a>
13751 <a href="Foo" rel="mw:WikiLink">Foobar]</a>
13752 <a href="Foo" rel="mw:WikiLink">x [Foobar] x</a>
13753 <a href="Foo" rel="mw:WikiLink">x [http://google.com g] x</a>
13754 <a href="Foo" rel="mw:WikiLink">[[Bar]]</a>
13755 <a href="Foo" rel="mw:WikiLink">x [[Bar]] x</a>
13756 <a href="Foo" rel="mw:WikiLink">|Bar</a>
13757 !! end
13758
13759 !! test
13760 Links 3. WikiLinks: No escapes needed
13761 !! options
13762 disabled
13763 !! input
13764 [[Foo|[Foobar]]
13765 [[Foo|foo|bar]]
13766 !! result
13767 <a href="Foo" rel="mw:WikiLink">[Foobar</a>
13768 <a href="Foo" rel="mw:WikiLink">foo|bar</a>
13769 !! end
13770
13771 !! test
13772 Links 4. ExtLinks: Escapes needed
13773 !! options
13774 disabled
13775 !! input
13776 [http://google.com <nowiki>[google]</nowiki>]
13777 [http://google.com <nowiki>google]</nowiki>]
13778 !! result
13779 <a href="http://google.com" rel="mw:ExtLink">[google]</a>
13780 <a href="http://google.com" rel="mw:ExtLink">google]</a>
13781 !! end
13782
13783 !! test
13784 Links 5. ExtLinks: No escapes needed
13785 !! options
13786 disabled
13787 !! input
13788 [http://google.com [google]
13789 !! result
13790 <a href="http://google.com" rel="mw:ExtLink">[google</a>
13791 !! end
13792
13793 #### --------------- Quotes ---------------
13794 #### 1. Quotes inside <b> and <i>
13795 #### 2. Link fragments separated by <i> and <b> tags
13796 #### 3. Link fragments inside <i> and <b>
13797 #### --------------------------------------
13798 !! test
13799 1. Quotes inside <b> and <i>
13800 !! input
13801 ''<nowiki>'foo'</nowiki>''
13802 ''<nowiki>''foo''</nowiki>''
13803 ''<nowiki>'''foo'''</nowiki>''
13804 '''<nowiki>'foo'</nowiki>'''
13805 '''<nowiki>''foo''</nowiki>'''
13806 '''<nowiki>'''foo'''</nowiki>'''
13807 '''<nowiki>foo'</nowiki>''<nowiki>bar'</nowiki>''baz'''
13808 !! result
13809 <p><i>'foo'</i>
13810 <i>''foo''</i>
13811 <i>'''foo'''</i>
13812 <b>'foo'</b>
13813 <b>''foo''</b>
13814 <b>'''foo'''</b>
13815 <b>foo'<i>bar'</i>baz</b>
13816 </p>
13817 !! end
13818
13819 !! test
13820 2. Link fragments separated by <i> and <b> tags
13821 !! input
13822 [[''foo''<nowiki>hello]]</nowiki>
13823
13824 [['''foo'''<nowiki>hello]]</nowiki>
13825 !! result
13826 <p>[[<i>foo</i>hello]]
13827 </p><p>[[<b>foo</b>hello]]
13828 </p>
13829 !! end
13830
13831 !! test
13832 2. Link fragments inside <i> and <b>
13833 (FIXME: Escaping one or both of [[ and ]] is also acceptable --
13834 this is one of the shortcomings of this format)
13835 !! input
13836 ''[[foo''<nowiki>]]</nowiki>
13837
13838 '''[[foo'''<nowiki>]]</nowiki>
13839 !! result
13840 <p><i>[[foo</i>]]
13841 </p><p><b>[[foo</b>]]
13842 </p>
13843 !! end
13844
13845 #### --------------- Paragraphs ---------------
13846 #### 1. No unnecessary escapes
13847 #### --------------------------------------
13848
13849 !! test
13850 1. No unnecessary escapes
13851 !! input
13852 bar <span><nowiki>[[foo]]</nowiki></span>
13853
13854 =bar <span><nowiki>[[foo]]</nowiki></span>
13855
13856 [[bar <span><nowiki>[[foo]]</nowiki></span>
13857
13858 <nowiki>]]bar </nowiki><span><nowiki>[[foo]]</nowiki></span>
13859
13860 <nowiki>=bar </nowiki><span>foo]]</span>=
13861 !! result
13862 <p>bar <span>[[foo]]</span>
13863 </p><p>=bar <span>[[foo]]</span>
13864 </p><p>[[bar <span>[[foo]]</span>
13865 </p><p>]]bar <span>[[foo]]</span>
13866 </p><p>=bar <span>foo]]</span>=
13867 </p>
13868 !!end
13869
13870 #### --------------- PRE ------------------
13871 #### 1. Leading space in SOL context should be escaped
13872 #### --------------------------------------
13873 !! test
13874 1. Leading space in SOL context should be escaped
13875 !! options
13876 disabled
13877 !! input
13878 <nowiki> foo</nowiki>
13879 <!--cmt--><nowiki> foo</nowiki>
13880 !! result
13881 <p> foo
13882 <!--cmt--> foo
13883 </p>
13884 !! end
13885
13886 #### --------------- HTML tags ---------------
13887 #### 1. a tags
13888 #### 2. other tags
13889 #### 3. multi-line html tag
13890 #### --------------------------------------
13891 !! test
13892 1. a tags
13893 !! options
13894 disabled
13895 !! input
13896 <a href="http://google.com">google</a>
13897 !! result
13898 &lt;a href=&quot;http://google.com&quot;&gt;google&lt;/a&gt;
13899 !! end
13900
13901 !! test
13902 2. other tags
13903 !! input
13904 <nowiki><div>foo</div>
13905 <div style="color:red">foo</div></nowiki>
13906 !! result
13907 <p>&lt;div&gt;foo&lt;/div&gt;
13908 &lt;div style=&quot;color:red&quot;&gt;foo&lt;/div&gt;
13909 </p>
13910 !! end
13911
13912 !! test
13913 3. multi-line html tag
13914 !! input
13915 <nowiki><div
13916 >foo</div
13917 ></nowiki>
13918 !! result
13919 <p>&lt;div
13920 &gt;foo&lt;/div
13921 &gt;
13922 </p>
13923 !! end
13924
13925 #### --------------- Others ---------------
13926 !! test
13927 Escaping nowikis
13928 !! input
13929 &lt;nowiki&gt;foo&lt;/nowiki&gt;
13930 !! result
13931 <p>&lt;nowiki&gt;foo&lt;/nowiki&gt;
13932 </p>
13933 !! end
13934
13935 !! test
13936 Tag-like HTML structures are passed through as text
13937 !! input
13938 <x y>
13939
13940 <x.y>
13941
13942 <x-y>
13943
13944 1>2
13945
13946 x<y
13947
13948 a>b
13949
13950 1<d e>f
13951 !! result
13952 <p>&lt;x y&gt;
13953 </p><p>&lt;x.y&gt;
13954 </p><p>&lt;x-y&gt;
13955 </p><p>1&gt;2
13956 </p><p>x&lt;y
13957 </p><p>a&gt;b
13958 </p><p>1&lt;d e&gt;f
13959 </p>
13960 !! end
13961
13962
13963 # This fails in the PHP parser (see bug 40670,
13964 # https://bugzilla.wikimedia.org/show_bug.cgi?id=40670), so disabled for it.
13965 !! test
13966 Tag names followed by punctuation should not be recognized as tags
13967 !! options
13968 disabled
13969 !! input
13970 <s.ome> text
13971 !! result
13972 <p>&lt;s.ome&gt text
13973 </p>
13974 !! end
13975
13976 !! test
13977 HTML tag with necessary entities in attributes
13978 !! input
13979 <span title="&amp;amp;">foo</span>
13980 !! result
13981 <p><span title="&amp;amp;">foo</span>
13982 </p>
13983 !! end
13984
13985 !! test
13986 HTML tag with 'unnecessary' entity encoding in attributes
13987 !! input
13988 <span title="&amp;">foo</span>
13989 !! result
13990 <p><span title="&amp;">foo</span>
13991 </p>
13992 !! end
13993
13994 !! test
13995 HTML tag with broken attribute value quoting
13996 !! input
13997 <span title="Hello world>Foo</span>
13998 !! result
13999 <p><span>Foo</span>
14000 </p>
14001 !! end
14002
14003 !! test
14004 Parsoid-only: HTML tag with broken attribute value quoting
14005 !! options
14006 parsoid
14007 !! input
14008 <span title="Hello world>Foo</span>
14009 !! result
14010 <p><span title="Hello world">Foo</span>
14011 </p>
14012 !! end
14013
14014 !! test
14015 Table with broken attribute value quoting
14016 !! input
14017 {|
14018 | title="Hello world|Foo
14019 |}
14020 !! result
14021 <table>
14022 <tr>
14023 <td>Foo
14024 </td></tr></table>
14025
14026 !! end
14027
14028 !! test
14029 Table with broken attribute value quoting on consecutive lines
14030 !! input
14031 {|
14032 | title="Hello world|Foo
14033 | style="color:red|Bar
14034 |}
14035 !! result
14036 <table>
14037 <tr>
14038 <td>Foo
14039 </td>
14040 <td>Bar
14041 </td></tr></table>
14042
14043 !! end
14044
14045 !! test
14046 Parsoid-only: Table with broken attribute value quoting on consecutive lines
14047 !! options
14048 parsoid
14049 !! input
14050 {|
14051 | title="Hello world|Foo
14052 | style="color:red|Bar
14053 |}
14054 !! result
14055 <table>
14056 <tr>
14057 <td title="Hello world">Foo
14058 </td><td style="color: red">Bar
14059 </td></tr></table>
14060
14061 !! end
14062
14063 !!test
14064 Accept empty td cell attribute
14065 !!input
14066 {|
14067 | align="center" | foo || |
14068 |}
14069 !!result
14070 <table>
14071 <tr>
14072 <td align="center"> foo </td>
14073 <td>
14074 </td></tr></table>
14075
14076 !!end
14077
14078 !!test
14079 Non-empty attributes in th-cells
14080 !!input
14081 {|
14082 ! Foo !! style="color: red" | Bar
14083 |}
14084 !!result
14085 <table>
14086 <tr>
14087 <th> Foo </th>
14088 <th style="color: red"> Bar
14089 </th></tr></table>
14090
14091 !!end
14092
14093 !!test
14094 Accept empty attributes in th-cells
14095 !!input
14096 {|
14097 !| foo !!| bar
14098 |}
14099 !!result
14100 <table>
14101 <tr>
14102 <th> foo </th>
14103 <th> bar
14104 </th></tr></table>
14105
14106 !!end
14107
14108 !!test
14109 Empty table rows go away
14110 !!input
14111 {|
14112 | Hello
14113 | there
14114 |- class="foo"
14115 |-
14116 |}
14117 !! result
14118 <table>
14119 <tr>
14120 <td> Hello
14121 </td>
14122 <td> there
14123 </td></tr>
14124
14125 </table>
14126
14127 !! end
14128
14129 TODO:
14130 more images
14131 more tables
14132 character entities
14133 and much more
14134 Try for 100% code coverage