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