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