Merge "(bug 42639) Fix API action=options for multiselect prefs"
[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 Parser Functions: 1. Simple example
5775 !!input
5776 {{uc:foo}}
5777 !!result
5778 <p>FOO
5779 </p>
5780 !!end
5781
5782 !!test
5783 Parser Functions: 2. Nested use (only outermost should be marked up)
5784 !!input
5785 {{uc:{{lc:FOO}}}}
5786 !!result
5787 <p>FOO
5788 </p>
5789 !!end
5790
5791 ###
5792 ### Pre-save transform tests
5793 ###
5794 !! test
5795 pre-save transform: subst:
5796 !! options
5797 PST
5798 !! input
5799 {{subst:test}}
5800 !! result
5801 This is a test template
5802 !! end
5803
5804 !! test
5805 pre-save transform: normal template
5806 !! options
5807 PST
5808 !! input
5809 {{test}}
5810 !! result
5811 {{test}}
5812 !! end
5813
5814 !! test
5815 pre-save transform: nonexistent template
5816 !! options
5817 PST
5818 !! input
5819 {{thistemplatedoesnotexist}}
5820 !! result
5821 {{thistemplatedoesnotexist}}
5822 !! end
5823
5824
5825 !! test
5826 pre-save transform: subst magic variables
5827 !! options
5828 PST
5829 !! input
5830 {{subst:SITENAME}}
5831 !! result
5832 MediaWiki
5833 !! end
5834
5835 # This is bug 89, which I fixed. -- wtm
5836 !! test
5837 pre-save transform: subst: templates with parameters
5838 !! options
5839 pst
5840 !! input
5841 {{subst:paramtest|param="something else"}}
5842 !! result
5843 This is a test template with parameter "something else"
5844 !! end
5845
5846 !! article
5847 Template:nowikitest
5848 !! text
5849 <nowiki>'''not wiki'''</nowiki>
5850 !! endarticle
5851
5852 !! test
5853 pre-save transform: nowiki in subst (bug 1188)
5854 !! options
5855 pst
5856 !! input
5857 {{subst:nowikitest}}
5858 !! result
5859 <nowiki>'''not wiki'''</nowiki>
5860 !! end
5861
5862
5863 !! article
5864 Template:commenttest
5865 !! text
5866 This template has <!-- a comment --> in it.
5867 !! endarticle
5868
5869 !! test
5870 pre-save transform: comment in subst (bug 1936)
5871 !! options
5872 pst
5873 !! input
5874 {{subst:commenttest}}
5875 !! result
5876 This template has <!-- a comment --> in it.
5877 !! end
5878
5879 !! test
5880 pre-save transform: unclosed tag
5881 !! options
5882 pst noxml
5883 !! input
5884 <nowiki>'''not wiki'''
5885 !! result
5886 <nowiki>'''not wiki'''
5887 !! end
5888
5889 !! test
5890 pre-save transform: mixed tag case
5891 !! options
5892 pst noxml
5893 !! input
5894 <NOwiki>'''not wiki'''</noWIKI>
5895 !! result
5896 <NOwiki>'''not wiki'''</noWIKI>
5897 !! end
5898
5899 !! test
5900 pre-save transform: unclosed comment in <nowiki>
5901 !! options
5902 pst noxml
5903 !! input
5904 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
5905 !! result
5906 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
5907 !!end
5908
5909 !! article
5910 Template:dangerous
5911 !!text
5912 <span onmouseover="alert('crap')">Oh no</span>
5913 !!endarticle
5914
5915 !!test
5916 (confirming safety of fix for subst bug 1936)
5917 !! input
5918 {{Template:dangerous}}
5919 !! result
5920 <p><span>Oh no</span>
5921 </p>
5922 !! end
5923
5924 !! test
5925 pre-save transform: comment containing gallery (bug 5024)
5926 !! options
5927 pst
5928 !! input
5929 <!-- <gallery>data</gallery> -->
5930 !!result
5931 <!-- <gallery>data</gallery> -->
5932 !!end
5933
5934 !! test
5935 pre-save transform: comment containing extension
5936 !! options
5937 pst
5938 !! input
5939 <!-- <tag>data</tag> -->
5940 !!result
5941 <!-- <tag>data</tag> -->
5942 !!end
5943
5944 !! test
5945 pre-save transform: comment containing nowiki
5946 !! options
5947 pst
5948 !! input
5949 <!-- <nowiki>data</nowiki> -->
5950 !!result
5951 <!-- <nowiki>data</nowiki> -->
5952 !!end
5953
5954 !! test
5955 pre-save transform: <noinclude> in subst (bug 3298)
5956 !! options
5957 pst
5958 !! input
5959 {{subst:Includes}}
5960 !! result
5961 Foobar
5962 !! end
5963
5964 !! test
5965 pre-save transform: <onlyinclude> in subst (bug 3298)
5966 !! options
5967 pst
5968 !! input
5969 {{subst:Includes2}}
5970 !! result
5971 Foo
5972 !! end
5973
5974 !! article
5975 Template:SubstTest
5976 !!text
5977 {{<includeonly>subst:</includeonly>Includes}}
5978 !! endarticle
5979
5980 !! article
5981 Template:SafeSubstTest
5982 !! text
5983 {{<includeonly>safesubst:</includeonly>Includes}}
5984 !! endarticle
5985
5986 !! test
5987 bug 22297: safesubst: works during PST
5988 !! options
5989 pst
5990 !! input
5991 {{subst:SafeSubstTest}}{{safesubst:SubstTest}}
5992 !! result
5993 FoobarFoobar
5994 !! end
5995
5996 !! test
5997 bug 22297: safesubst: works during normal parse
5998 !! input
5999 {{SafeSubstTest}}
6000 !! result
6001 <p>Foobar
6002 </p>
6003 !! end
6004
6005 !! test:
6006 subst: does not work during normal parse
6007 !! input
6008 {{SubstTest}}
6009 !! result
6010 <p>{{subst:Includes}}
6011 </p>
6012 !! end
6013
6014 !! test
6015 pre-save transform: context links ("pipe trick")
6016 !! options
6017 pst
6018 !! input
6019 [[Article (context)|]]
6020 [[Bar:Article|]]
6021 [[:Bar:Article|]]
6022 [[Bar:Article (context)|]]
6023 [[:Bar:Article (context)|]]
6024 [[|Article]]
6025 [[|Article (context)]]
6026 [[Bar:X (Y) Z|]]
6027 [[:Bar:X (Y) Z|]]
6028 !! result
6029 [[Article (context)|Article]]
6030 [[Bar:Article|Article]]
6031 [[:Bar:Article|Article]]
6032 [[Bar:Article (context)|Article]]
6033 [[:Bar:Article (context)|Article]]
6034 [[Article]]
6035 [[Article (context)]]
6036 [[Bar:X (Y) Z|X (Y) Z]]
6037 [[:Bar:X (Y) Z|X (Y) Z]]
6038 !! end
6039
6040 !! test
6041 pre-save transform: context links ("pipe trick") with interwiki prefix
6042 !! options
6043 pst
6044 !! input
6045 [[interwiki:Article|]]
6046 [[:interwiki:Article|]]
6047 [[interwiki:Bar:Article|]]
6048 [[:interwiki:Bar:Article|]]
6049 !! result
6050 [[interwiki:Article|Article]]
6051 [[:interwiki:Article|Article]]
6052 [[interwiki:Bar:Article|Bar:Article]]
6053 [[:interwiki:Bar:Article|Bar:Article]]
6054 !! end
6055
6056 !! test
6057 pre-save transform: context links ("pipe trick") with parens in title
6058 !! options
6059 pst title=[[Somearticle (context)]]
6060 !! input
6061 [[|Article]]
6062 !! result
6063 [[Article (context)|Article]]
6064 !! end
6065
6066 !! test
6067 pre-save transform: context links ("pipe trick") with comma in title
6068 !! options
6069 pst title=[[Someplace, Somewhere]]
6070 !! input
6071 [[|Otherplace]]
6072 [[Otherplace, Elsewhere|]]
6073 [[Otherplace, Elsewhere, Anywhere|]]
6074 !! result
6075 [[Otherplace, Somewhere|Otherplace]]
6076 [[Otherplace, Elsewhere|Otherplace]]
6077 [[Otherplace, Elsewhere, Anywhere|Otherplace]]
6078 !! end
6079
6080 !! test
6081 pre-save transform: context links ("pipe trick") with parens and comma
6082 !! options
6083 pst title=[[Someplace (IGNORED), Somewhere]]
6084 !! input
6085 [[|Otherplace]]
6086 [[Otherplace (place), Elsewhere|]]
6087 !! result
6088 [[Otherplace, Somewhere|Otherplace]]
6089 [[Otherplace (place), Elsewhere|Otherplace]]
6090 !! end
6091
6092 !! test
6093 pre-save transform: context links ("pipe trick") with comma and parens
6094 !! options
6095 pst title=[[Who, me? (context)]]
6096 !! input
6097 [[|Yes, you.]]
6098 [[Me, Myself, and I (1937 song)|]]
6099 !! result
6100 [[Yes, you. (context)|Yes, you.]]
6101 [[Me, Myself, and I (1937 song)|Me, Myself, and I]]
6102 !! end
6103
6104 !! test
6105 pre-save transform: context links ("pipe trick") with namespace
6106 !! options
6107 pst title=[[Ns:Somearticle]]
6108 !! input
6109 [[|Article]]
6110 !! result
6111 [[Ns:Article|Article]]
6112 !! end
6113
6114 !! test
6115 pre-save transform: context links ("pipe trick") with namespace and parens
6116 !! options
6117 pst title=[[Ns:Somearticle (context)]]
6118 !! input
6119 [[|Article]]
6120 !! result
6121 [[Ns:Article (context)|Article]]
6122 !! end
6123
6124 !! test
6125 pre-save transform: context links ("pipe trick") with namespace and comma
6126 !! options
6127 pst title=[[Ns:Somearticle, Context, Whatever]]
6128 !! input
6129 [[|Article]]
6130 !! result
6131 [[Ns:Article, Context, Whatever|Article]]
6132 !! end
6133
6134 !! test
6135 pre-save transform: context links ("pipe trick") with namespace, comma and parens
6136 !! options
6137 pst title=[[Ns:Somearticle, Context (context)]]
6138 !! input
6139 [[|Article]]
6140 !! result
6141 [[Ns:Article (context)|Article]]
6142 !! end
6143
6144 !! test
6145 pre-save transform: context links ("pipe trick") with namespace, parens and comma
6146 !! options
6147 pst title=[[Ns:Somearticle (IGNORED), Context]]
6148 !! input
6149 [[|Article]]
6150 !! result
6151 [[Ns:Article, Context|Article]]
6152 !! end
6153
6154 !! test
6155 pre-save transform: context links ("pipe trick") with full-width parens and no space (Japanese and Chinese style, bug 30149)
6156 !! options
6157 pst
6158 !! input
6159 [[Article(context)|]]
6160 [[Bar:Article(context)|]]
6161 [[:Bar:Article(context)|]]
6162 [[|Article(context)]]
6163 [[Bar:X(Y)Z|]]
6164 [[:Bar:X(Y)Z|]]
6165 !! result
6166 [[Article(context)|Article]]
6167 [[Bar:Article(context)|Article]]
6168 [[:Bar:Article(context)|Article]]
6169 [[Article(context)]]
6170 [[Bar:X(Y)Z|X(Y)Z]]
6171 [[:Bar:X(Y)Z|X(Y)Z]]
6172 !! end
6173
6174 !! test
6175 pre-save transform: context links ("pipe trick") with full-width parens and space (Japanese and Chinese style, bug 30149)
6176 !! options
6177 pst
6178 !! input
6179 [[Article (context)|]]
6180 [[Bar:Article (context)|]]
6181 [[:Bar:Article (context)|]]
6182 [[|Article (context)]]
6183 [[Bar:X (Y) Z|]]
6184 [[:Bar:X (Y) Z|]]
6185 !! result
6186 [[Article (context)|Article]]
6187 [[Bar:Article (context)|Article]]
6188 [[:Bar:Article (context)|Article]]
6189 [[Article (context)]]
6190 [[Bar:X (Y) Z|X (Y) Z]]
6191 [[:Bar:X (Y) Z|X (Y) Z]]
6192 !! end
6193
6194 !! test
6195 pre-save transform: context links ("pipe trick") with parens and no space (Korean style, bug 30149)
6196 !! options
6197 pst
6198 !! input
6199 [[Article(context)|]]
6200 [[Bar:Article(context)|]]
6201 [[:Bar:Article(context)|]]
6202 [[|Article(context)]]
6203 [[Bar:X(Y)Z|]]
6204 [[:Bar:X(Y)Z|]]
6205 !! result
6206 [[Article(context)|Article]]
6207 [[Bar:Article(context)|Article]]
6208 [[:Bar:Article(context)|Article]]
6209 [[Article(context)]]
6210 [[Bar:X(Y)Z|X(Y)Z]]
6211 [[:Bar:X(Y)Z|X(Y)Z]]
6212 !! end
6213
6214 !! test
6215 pre-save transform: context links ("pipe trick") with commas (bug 21660)
6216 !! options
6217 pst
6218 !! input
6219 [[Article (context), context|]]
6220 [[Article (context),context|]]
6221 [[Bar:Article (context), context|]]
6222 [[Bar:Article (context),context|]]
6223 [[:Bar:Article (context), context|]]
6224 [[:Bar:Article (context),context|]]
6225 !! result
6226 [[Article (context), context|Article]]
6227 [[Article (context),context|Article]]
6228 [[Bar:Article (context), context|Article]]
6229 [[Bar:Article (context),context|Article]]
6230 [[:Bar:Article (context), context|Article]]
6231 [[:Bar:Article (context),context|Article]]
6232 !! end
6233
6234 !! test
6235 pre-save transform: trim trailing empty lines
6236 !! options
6237 pst
6238 !! input
6239 Empty lines are trimmed
6240
6241
6242
6243
6244 !! result
6245 Empty lines are trimmed
6246 !! end
6247
6248 !! test
6249 pre-save transform: Signature expansion
6250 !! options
6251 pst
6252 !! input
6253 * ~~~
6254 * <noinclude>~~~</noinclude>
6255 * <includeonly>~~~</includeonly>
6256 * <onlyinclude>~~~</onlyinclude>
6257 !! result
6258 * [[Special:Contributions/127.0.0.1|127.0.0.1]]
6259 * <noinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</noinclude>
6260 * <includeonly>[[Special:Contributions/127.0.0.1|127.0.0.1]]</includeonly>
6261 * <onlyinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</onlyinclude>
6262 !! end
6263
6264
6265 !! test
6266 pre-save transform: Signature expansion in nowiki tags (bug 93)
6267 !! options
6268 pst disabled
6269 !! input
6270 Shall not expand:
6271
6272 <nowiki>~~~~</nowiki>
6273
6274 <includeonly><nowiki>~~~~</nowiki></includeonly>
6275
6276 <noinclude><nowiki>~~~~</nowiki></noinclude>
6277
6278 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
6279
6280 {{subst:Foo}} shall be converted to FOO
6281
6282 As well as inside noinclude/onlyinclude
6283 <noinclude>{{subst:Foo}}</noinclude>
6284 <onlyinclude>{{subst:Foo}}</onlyinclude>
6285
6286 But not inside includeonly
6287 <includeonly>{{subst:Foo}}</includeonly>
6288 !! result
6289 Shall not expand:
6290
6291 <nowiki>~~~~</nowiki>
6292
6293 <includeonly><nowiki>~~~~</nowiki></includeonly>
6294
6295 <noinclude><nowiki>~~~~</nowiki></noinclude>
6296
6297 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
6298
6299 FOO shall be converted to FOO
6300
6301 As well as inside noinclude/onlyinclude
6302 <noinclude>FOO</noinclude>
6303 <onlyinclude>FOO</onlyinclude>
6304
6305 But not inside includeonly
6306 <includeonly>{{subst:Foo}}</includeonly>
6307 !! end
6308
6309 ###
6310 ### Message transform tests
6311 ###
6312 !! test
6313 message transform: magic variables
6314 !! options
6315 msg
6316 !! input
6317 {{SITENAME}}
6318 !! result
6319 MediaWiki
6320 !! end
6321
6322 !! test
6323 message transform: should not transform wiki markup
6324 !! options
6325 msg
6326 !! input
6327 ''test''
6328 !! result
6329 ''test''
6330 !! end
6331
6332 !! test
6333 message transform: <noinclude> in transcluded template (bug 4926)
6334 !! options
6335 msg
6336 !! input
6337 {{Includes}}
6338 !! result
6339 Foobar
6340 !! end
6341
6342 !! test
6343 message transform: <onlyinclude> in transcluded template (bug 4926)
6344 !! options
6345 msg
6346 !! input
6347 {{Includes2}}
6348 !! result
6349 Foo
6350 !! end
6351
6352 !! test
6353 {{#special:}} page name, known
6354 !! options
6355 msg
6356 !! input
6357 {{#special:Recentchanges}}
6358 !! result
6359 Special:RecentChanges
6360 !! end
6361
6362 !! test
6363 {{#special:}} page name with subpage, known
6364 !! options
6365 msg
6366 !! input
6367 {{#special:Recentchanges/param}}
6368 !! result
6369 Special:RecentChanges/param
6370 !! end
6371
6372 !! test
6373 {{#special:}} page name, unknown
6374 !! options
6375 msg
6376 !! input
6377 {{#special:foobarnonexistent}}
6378 !! result
6379 No such special page
6380 !! end
6381
6382 !! test
6383 {{#speciale:}} page name, known
6384 !! options
6385 msg
6386 !! input
6387 {{#speciale:Recentchanges}}
6388 !! result
6389 Special:RecentChanges
6390 !! end
6391
6392 !! test
6393 {{#speciale:}} page name with subpage, known
6394 !! options
6395 msg
6396 !! input
6397 {{#speciale:Recentchanges/param}}
6398 !! result
6399 Special:RecentChanges/param
6400 !! end
6401
6402 !! test
6403 {{#speciale:}} page name, unknown
6404 !! options
6405 msg
6406 !! input
6407 {{#speciale:foobarnonexistent}}
6408 !! result
6409 No_such_special_page
6410 !! end
6411
6412 ###
6413 ### Images
6414 ###
6415 !! test
6416 Simple image
6417 !! input
6418 [[Image:foobar.jpg]]
6419 !! result
6420 <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>
6421 </p>
6422 !! end
6423
6424 !! test
6425 Right-aligned image
6426 !! input
6427 [[Image:foobar.jpg|right]]
6428 !! result
6429 <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>
6430
6431 !! end
6432
6433 !! test
6434 Simple image (using File: namespace, now canonical)
6435 !! input
6436 [[File:foobar.jpg]]
6437 !! result
6438 <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>
6439 </p>
6440 !! end
6441
6442 !! test
6443 Image with caption
6444 !! input
6445 [[Image:foobar.jpg|right|Caption text]]
6446 !! result
6447 <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>
6448
6449 !! end
6450
6451 !! test
6452 Image with empty attribute
6453 !! input
6454 [[Image:foobar.jpg|right||Caption text]]
6455 !! result
6456 <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>
6457
6458 !! end
6459
6460 !! test
6461 Image with link tails
6462 !! input
6463 123[[Image:foobar.jpg]]456
6464 123[[Image:foobar.jpg|right]]456
6465 123[[Image:foobar.jpg|thumb]]456
6466 !! result
6467 <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
6468 </p>
6469 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
6470 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
6471
6472 !! end
6473
6474 !! test
6475 Image with multiple captions -- only last one is accepted
6476 !! input
6477 [[Image:foobar.jpg|right|Caption1 - ignored|[[Caption2]] - ignored|Caption3 - accepted]]
6478 !! result
6479 <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>
6480
6481 !! end
6482
6483 !! test
6484 Image with width attribute at different positions
6485 !! input
6486 [[Image:foobar.jpg|200px|right|Caption]]
6487 [[Image:foobar.jpg|right|200px|Caption]]
6488 [[Image:foobar.jpg|right|Caption|200px]]
6489 !! result
6490 <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>
6491 <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>
6492 <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>
6493
6494 !! end
6495
6496 !! test
6497 Image with link parameter, wiki target
6498 !! input
6499 [[Image:foobar.jpg|link=Target page]]
6500 !! result
6501 <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>
6502 </p>
6503 !! end
6504
6505 !! test
6506 Image with link parameter, URL target
6507 !! input
6508 [[Image:foobar.jpg|link=http://example.com/]]
6509 !! result
6510 <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>
6511 </p>
6512 !! end
6513
6514 !! test
6515 Image with link parameter, wgExternalLinkTarget
6516 !! input
6517 [[Image:foobar.jpg|link=http://example.com/]]
6518 !! config
6519 wgExternalLinkTarget='foobar'
6520 !! result
6521 <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>
6522 </p>
6523 !! end
6524
6525 !! test
6526 Image with link parameter, wgNoFollowLinks set to false
6527 !! input
6528 [[Image:foobar.jpg|link=http://example.com/]]
6529 !! config
6530 wgNoFollowLinks=false
6531 !! result
6532 <p><a href="http://example.com/"><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, wgNoFollowDomainExceptions
6538 !! input
6539 [[Image:foobar.jpg|link=http://example.com/]]
6540 !! config
6541 wgNoFollowDomainExceptions='example.com'
6542 !! result
6543 <p><a href="http://example.com/"><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, wgExternalLinkTarget, unnamed parameter
6549 !! input
6550 [[Image:foobar.jpg|link=http://example.com/|Title]]
6551 !! config
6552 wgExternalLinkTarget='foobar'
6553 !! result
6554 <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>
6555 </p>
6556 !! end
6557
6558 !! test
6559 Image with empty link parameter
6560 !! input
6561 [[Image:foobar.jpg|link=]]
6562 !! result
6563 <p><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" />
6564 </p>
6565 !! end
6566
6567 !! test
6568 Image with link parameter (wiki target) and unnamed parameter
6569 !! input
6570 [[Image:foobar.jpg|link=Target page|Title]]
6571 !! result
6572 <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>
6573 </p>
6574 !! end
6575
6576 !! test
6577 Image with link parameter (URL target) and unnamed parameter
6578 !! input
6579 [[Image:foobar.jpg|link=http://example.com/|Title]]
6580 !! result
6581 <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>
6582 </p>
6583 !! end
6584
6585 !! test
6586 Thumbnail image with link parameter
6587 !! input
6588 [[Image:foobar.jpg|thumb|link=http://example.com/|Title]]
6589 !! result
6590 <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>
6591
6592 !! end
6593
6594 !! test
6595 Image with frame and link
6596 !! input
6597 [[Image:Foobar.jpg|frame|left|This is a test image [[Main Page]]]]
6598 !! result
6599 <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>
6600
6601 !! end
6602
6603 !! test
6604 Image with frame and link and explicit alt
6605 !! input
6606 [[Image:Foobar.jpg|frame|left|This is a test image [[Main Page]]|alt=Altitude]]
6607 !! result
6608 <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>
6609
6610 !! end
6611
6612 !! test
6613 Image with wiki markup in implicit alt
6614 !! input
6615 [[Image:Foobar.jpg|testing '''bold''' in alt]]
6616 !! result
6617 <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>
6618 </p>
6619 !! end
6620
6621 !! test
6622 Image with wiki markup in explicit alt
6623 !! input
6624 [[Image:Foobar.jpg|alt=testing '''bold''' in alt]]
6625 !! result
6626 <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>
6627 </p>
6628 !! end
6629
6630 !! test
6631 Link to image page- image page normally doesn't exists, hence edit link
6632 Add test with existing image page
6633 #<p><a href="/wiki/File:Test" title="Image:Test">Image:test</a>
6634 !! input
6635 [[:Image:test]]
6636 !! result
6637 <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>
6638 </p>
6639 !! end
6640
6641 !! test
6642 bug 18784 Link to non-existent image page with caption should use caption as link text
6643 !! input
6644 [[:Image:test|caption]]
6645 !! result
6646 <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>
6647 </p>
6648 !! end
6649
6650 !! test
6651 Frameless image caption with a free URL
6652 !! input
6653 [[Image:foobar.jpg|http://example.com]]
6654 !! result
6655 <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>
6656 </p>
6657 !! end
6658
6659 !! test
6660 Thumbnail image caption with a free URL
6661 !! input
6662 [[Image:foobar.jpg|thumb|http://example.com]]
6663 !! result
6664 <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>
6665
6666 !! end
6667
6668 !! test
6669 Thumbnail image caption with a free URL and explicit alt
6670 !! input
6671 [[Image:foobar.jpg|thumb|http://example.com|alt=Alteration]]
6672 !! result
6673 <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>
6674
6675 !! end
6676
6677 !! test
6678 BUG 1887: A ISBN with a thumbnail
6679 !! input
6680 [[Image:foobar.jpg|thumb|ISBN 1235467890]]
6681 !! result
6682 <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>
6683
6684 !! end
6685
6686 !! test
6687 BUG 1887: A RFC with a thumbnail
6688 !! input
6689 [[Image:foobar.jpg|thumb|This is RFC 12354]]
6690 !! result
6691 <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>
6692
6693 !! end
6694
6695 !! test
6696 BUG 1887: A mailto link with a thumbnail
6697 !! input
6698 [[Image:foobar.jpg|thumb|Please mailto:nobody@example.com]]
6699 !! result
6700 <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>
6701
6702 !! end
6703
6704 # Pending resolution to bug 368
6705 !! test
6706 BUG 648: Frameless image caption with a link
6707 !! input
6708 [[Image:foobar.jpg|text with a [[link]] in it]]
6709 !! result
6710 <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>
6711 </p>
6712 !! end
6713
6714 !! test
6715 BUG 648: Frameless image caption with a link (suffix)
6716 !! input
6717 [[Image:foobar.jpg|text with a [[link]]foo in it]]
6718 !! result
6719 <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>
6720 </p>
6721 !! end
6722
6723 !! test
6724 BUG 648: Frameless image caption with an interwiki link
6725 !! input
6726 [[Image:foobar.jpg|text with a [[MeatBall:Link]] in it]]
6727 !! result
6728 <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>
6729 </p>
6730 !! end
6731
6732 !! test
6733 BUG 648: Frameless image caption with a piped interwiki link
6734 !! input
6735 [[Image:foobar.jpg|text with a [[MeatBall:Link|link]] in it]]
6736 !! result
6737 <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>
6738 </p>
6739 !! end
6740
6741 !! test
6742 Escape HTML special chars in image alt text
6743 !! input
6744 [[Image:foobar.jpg|& < > "]]
6745 !! result
6746 <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>
6747 </p>
6748 !! end
6749
6750 !! test
6751 BUG 499: Alt text should have &#1234;, not &amp;1234;
6752 !! input
6753 [[Image:foobar.jpg|&#9792;]]
6754 !! result
6755 <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>
6756 </p>
6757 !! end
6758
6759 !! test
6760 Broken image caption with link
6761 !! input
6762 [[Image:Foobar.jpg|thumb|This is a broken caption. But [[Main Page|this]] is just an ordinary link.
6763 !! result
6764 <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.
6765 </p>
6766 !! end
6767
6768 !! test
6769 Image caption containing another image
6770 !! input
6771 [[Image:Foobar.jpg|thumb|This is a caption with another [[Image:icon.png|image]] inside it!]]
6772 !! result
6773 <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>
6774
6775 !! end
6776
6777 !! test
6778 Image caption containing a newline
6779 !! input
6780 [[Image:Foobar.jpg|This
6781 *is some text]]
6782 !! result
6783 <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>
6784 </p>
6785 !!end
6786
6787
6788 !! test
6789 Bug 3090: External links other than http: in image captions
6790 !! input
6791 [[Image:Foobar.jpg|thumb|200px|This caption has [irc://example.net irc] and [https://example.com Secure] ext links in it.]]
6792 !! result
6793 <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>
6794
6795 !! end
6796
6797 !! test
6798 Custom class
6799 !! input
6800 [[Image:foobar.jpg|a|class=b]]
6801 !! result
6802 <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>
6803 </p>
6804 !! end
6805
6806 !! article
6807 File:Barfoo.jpg
6808 !! text
6809 #REDIRECT [[File:Barfoo.jpg]]
6810 !! endarticle
6811
6812 !! test
6813 Redirected image
6814 !! input
6815 [[Image:Barfoo.jpg]]
6816 !! result
6817 <p><a href="/wiki/File:Barfoo.jpg" title="File:Barfoo.jpg">File:Barfoo.jpg</a>
6818 </p>
6819 !! end
6820
6821 !! test
6822 Missing image with uploads disabled
6823 !! options
6824 wgEnableUploads=0
6825 !! input
6826 [[Image:Foobaz.jpg]]
6827 !! result
6828 <p><a href="/wiki/File:Foobaz.jpg" title="File:Foobaz.jpg">File:Foobaz.jpg</a>
6829 </p>
6830 !! end
6831
6832
6833 ###
6834 ### Subpages
6835 ###
6836 !! article
6837 Subpage test/subpage
6838 !! text
6839 foo
6840 !! endarticle
6841
6842 !! test
6843 Subpage link
6844 !! options
6845 subpage title=[[Subpage test]]
6846 !! input
6847 [[/subpage]]
6848 !! result
6849 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a>
6850 </p>
6851 !! end
6852
6853 !! test
6854 Subpage noslash link
6855 !! options
6856 subpage title=[[Subpage test]]
6857 !!input
6858 [[/subpage/]]
6859 !! result
6860 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">subpage</a>
6861 </p>
6862 !! end
6863
6864 !! test
6865 Disabled subpages
6866 !! input
6867 [[/subpage]]
6868 !! result
6869 <p><a href="/index.php?title=/subpage&amp;action=edit&amp;redlink=1" class="new" title="/subpage (page does not exist)">/subpage</a>
6870 </p>
6871 !! end
6872
6873 !! test
6874 BUG 561: {{/Subpage}}
6875 !! options
6876 subpage title=[[Page]]
6877 !! input
6878 {{/Subpage}}
6879 !! result
6880 <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>
6881 </p>
6882 !! end
6883
6884 ###
6885 ### Categories
6886 ###
6887 !! article
6888 Category:MediaWiki User's Guide
6889 !! text
6890 blah
6891 !! endarticle
6892
6893 !! test
6894 Link to category
6895 !! input
6896 [[:Category:MediaWiki User's Guide]]
6897 !! result
6898 <p><a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">Category:MediaWiki User's Guide</a>
6899 </p>
6900 !! end
6901
6902 !! test
6903 Simple category
6904 !! options
6905 cat
6906 !! input
6907 [[Category:MediaWiki User's Guide]]
6908 !! result
6909 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
6910 !! end
6911
6912 !! test
6913 PAGESINCATEGORY invalid title fatal (r33546 fix)
6914 !! input
6915 {{PAGESINCATEGORY:<bogus>}}
6916 !! result
6917 <p>0
6918 </p>
6919 !! end
6920
6921 !! test
6922 Category with different sort key
6923 !! options
6924 cat
6925 !! input
6926 [[Category:MediaWiki User's Guide|Foo]]
6927 !! result
6928 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
6929 !! end
6930
6931 !! test
6932 Category with identical sort key
6933 !! options
6934 cat
6935 !! input
6936 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
6937 !! result
6938 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
6939 !! end
6940
6941 !! test
6942 Category with empty sort key
6943 !! options
6944 cat
6945 pst
6946 !! input
6947 [[Category:MediaWiki User's Guide|]]
6948 !! result
6949 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
6950 !! end
6951
6952 !! test
6953 Category with empty sort key and parentheses
6954 !! options
6955 cat
6956 pst
6957 !! input
6958 [[Category:Foo (bar)|]]
6959 !! result
6960 [[Category:Foo (bar)|Foo]]
6961 !! end
6962
6963 !! test
6964 Category with link tail
6965 !! options
6966 cat
6967 pst
6968 !! input
6969 123[[Category:Foo]]456
6970 !! result
6971 123[[Category:Foo]]456
6972 !! end
6973
6974 !! test
6975 Category with template
6976 !! options
6977 cat
6978 pst
6979 !! input
6980 [[Category:{{echo|Foo}}]]
6981 !! result
6982 [[Category:{{echo|Foo}}]]
6983 !! end
6984
6985 !! test
6986 Category with template in sort key
6987 !! options
6988 cat
6989 pst
6990 !! input
6991 [[Category:Foo|{{echo|Bar}}]]
6992 !! result
6993 [[Category:Foo|{{echo|Bar}}]]
6994 !! end
6995
6996 !! test
6997 Category with template in sort key and title
6998 !! options
6999 cat
7000 pst
7001 !! input
7002 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
7003 !! result
7004 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
7005 !! end
7006
7007 !! test
7008 Category / paragraph interactions
7009 !! input
7010 Foo [[Category:Baz]] Bar
7011
7012 Foo [[Category:Baz]]
7013 Bar
7014
7015 Foo
7016 [[Category:Baz]]
7017 Bar
7018
7019 Foo
7020 [[Category:Baz]] Bar
7021
7022 Foo
7023 [[Category:Baz]]
7024 [[Category:Baz]]
7025 [[Category:Baz]]
7026 Bar
7027
7028 [[Category:Baz]]
7029 [[Category:Baz]]
7030 [[Category:Baz]]
7031
7032 [[Category:Baz]]
7033 {{echo|[[Category:Baz]]}}
7034 [[Category:Baz]]
7035 !! result
7036 <p>Foo Bar
7037 </p><p>Foo
7038 Bar
7039 </p><p>Foo
7040 Bar
7041 </p><p>Foo Bar
7042 </p><p>Foo
7043 Bar
7044 </p>
7045 !! end
7046
7047 ###
7048 ### Inter-language links
7049 ###
7050 !! test
7051 Inter-language links
7052 !! options
7053 ill
7054 !! input
7055 [[es:Alimento]]
7056 [[fr:Nourriture]]
7057 [[zh:&#39135;&#21697;]]
7058 !! result
7059 es:Alimento fr:Nourriture zh:食品
7060 !! end
7061
7062 !! test
7063 Duplicate interlanguage links (bug 24502)
7064 !! options
7065 ill
7066 !! input
7067 [[es:1]]
7068 [[es:2]]
7069 [[fr:1]]
7070 [[fr:2]]
7071 !! result
7072 es:1 fr:1
7073 !! end
7074
7075 ###
7076 ### Sections
7077 ###
7078 !! test
7079 Basic section headings
7080 !! input
7081 == Headline 1 ==
7082 Some text
7083
7084 ==Headline 2==
7085 More
7086 ===Smaller headline===
7087 Blah blah
7088 !! result
7089 <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>
7090 <p>Some text
7091 </p>
7092 <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>
7093 <p>More
7094 </p>
7095 <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>
7096 <p>Blah blah
7097 </p>
7098 !! end
7099
7100 !! test
7101 Section headings with TOC
7102 !! input
7103 == Headline 1 ==
7104 === Subheadline 1 ===
7105 ===== Skipping a level =====
7106 ====== Skipping a level ======
7107
7108 == Headline 2 ==
7109 Some text
7110 ===Another headline===
7111 !! result
7112 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
7113 <ul>
7114 <li class="toclevel-1 tocsection-1"><a href="#Headline_1"><span class="tocnumber">1</span> <span class="toctext">Headline 1</span></a>
7115 <ul>
7116 <li class="toclevel-2 tocsection-2"><a href="#Subheadline_1"><span class="tocnumber">1.1</span> <span class="toctext">Subheadline 1</span></a>
7117 <ul>
7118 <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>
7119 <ul>
7120 <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>
7121 </ul>
7122 </li>
7123 </ul>
7124 </li>
7125 </ul>
7126 </li>
7127 <li class="toclevel-1 tocsection-5"><a href="#Headline_2"><span class="tocnumber">2</span> <span class="toctext">Headline 2</span></a>
7128 <ul>
7129 <li class="toclevel-2 tocsection-6"><a href="#Another_headline"><span class="tocnumber">2.1</span> <span class="toctext">Another headline</span></a></li>
7130 </ul>
7131 </li>
7132 </ul>
7133 </td></tr></table>
7134 <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>
7135 <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>
7136 <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>
7137 <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>
7138 <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>
7139 <p>Some text
7140 </p>
7141 <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>
7142
7143 !! end
7144
7145 # perl -e 'print "="x$_," Level $_ heading","="x$_,"\n" for 1..10'
7146 !! test
7147 Handling of sections up to level 6 and beyond
7148 !! input
7149 = Level 1 Heading=
7150 == Level 2 Heading==
7151 === Level 3 Heading===
7152 ==== Level 4 Heading====
7153 ===== Level 5 Heading=====
7154 ====== Level 6 Heading======
7155 ======= Level 7 Heading=======
7156 ======== Level 8 Heading========
7157 ========= Level 9 Heading=========
7158 ========== Level 10 Heading==========
7159 !! result
7160 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
7161 <ul>
7162 <li class="toclevel-1 tocsection-1"><a href="#Level_1_Heading"><span class="tocnumber">1</span> <span class="toctext">Level 1 Heading</span></a>
7163 <ul>
7164 <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>
7165 <ul>
7166 <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>
7167 <ul>
7168 <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>
7169 <ul>
7170 <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>
7171 <ul>
7172 <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>
7173 <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>
7174 <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>
7175 <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>
7176 <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>
7177 </ul>
7178 </li>
7179 </ul>
7180 </li>
7181 </ul>
7182 </li>
7183 </ul>
7184 </li>
7185 </ul>
7186 </li>
7187 </ul>
7188 </td></tr></table>
7189 <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>
7190 <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>
7191 <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>
7192 <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>
7193 <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>
7194 <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>
7195 <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>
7196 <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>
7197 <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>
7198 <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>
7199
7200 !! end
7201
7202 !! test
7203 TOC regression (bug 9764)
7204 !! input
7205 == title 1 ==
7206 === title 1.1 ===
7207 ==== title 1.1.1 ====
7208 === title 1.2 ===
7209 == title 2 ==
7210 === title 2.1 ===
7211 !! result
7212 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
7213 <ul>
7214 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
7215 <ul>
7216 <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>
7217 <ul>
7218 <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>
7219 </ul>
7220 </li>
7221 <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>
7222 </ul>
7223 </li>
7224 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
7225 <ul>
7226 <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>
7227 </ul>
7228 </li>
7229 </ul>
7230 </td></tr></table>
7231 <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>
7232 <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>
7233 <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>
7234 <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>
7235 <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>
7236 <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>
7237
7238 !! end
7239
7240 !! test
7241 TOC with wgMaxTocLevel=3 (bug 6204)
7242 !! options
7243 wgMaxTocLevel=3
7244 !! input
7245 == title 1 ==
7246 === title 1.1 ===
7247 ==== title 1.1.1 ====
7248 === title 1.2 ===
7249 == title 2 ==
7250 === title 2.1 ===
7251 !! result
7252 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
7253 <ul>
7254 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
7255 <ul>
7256 <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>
7257 <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>
7258 </ul>
7259 </li>
7260 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
7261 <ul>
7262 <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>
7263 </ul>
7264 </li>
7265 </ul>
7266 </td></tr></table>
7267 <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>
7268 <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>
7269 <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>
7270 <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>
7271 <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>
7272 <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>
7273
7274 !! end
7275
7276 !! test
7277 TOC with wgMaxTocLevel=3 and two level four headings (bug 6204)
7278 !! options
7279 wgMaxTocLevel=3
7280 !! input
7281 ==Section 1==
7282 ===Section 1.1===
7283 ====Section 1.1.1====
7284 ====Section 1.1.1.1====
7285 ==Section 2==
7286 !! result
7287 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
7288 <ul>
7289 <li class="toclevel-1 tocsection-1"><a href="#Section_1"><span class="tocnumber">1</span> <span class="toctext">Section 1</span></a>
7290 <ul>
7291 <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>
7292 </ul>
7293 </li>
7294 <li class="toclevel-1 tocsection-5"><a href="#Section_2"><span class="tocnumber">2</span> <span class="toctext">Section 2</span></a></li>
7295 </ul>
7296 </td></tr></table>
7297 <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>
7298 <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>
7299 <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>
7300 <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>
7301 <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>
7302
7303 !! end
7304
7305
7306 !! test
7307 Resolving duplicate section names
7308 !! input
7309 == Foo bar ==
7310 == Foo bar ==
7311 !! result
7312 <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>
7313 <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>
7314
7315 !! end
7316
7317 !! test
7318 Resolving duplicate section names with differing case (bug 10721)
7319 !! input
7320 == Foo bar ==
7321 == Foo Bar ==
7322 !! result
7323 <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>
7324 <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>
7325
7326 !! end
7327
7328 !! article
7329 Template:sections
7330 !! text
7331 ===Section 1===
7332 ==Section 2==
7333 !! endarticle
7334
7335 !! test
7336 Template with sections, __NOTOC__
7337 !! input
7338 __NOTOC__
7339 ==Section 0==
7340 {{sections}}
7341 ==Section 4==
7342 !! result
7343 <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>
7344 <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>
7345 <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>
7346 <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>
7347
7348 !! end
7349
7350 !! test
7351 __NOEDITSECTION__ keyword
7352 !! input
7353 __NOEDITSECTION__
7354 ==Section 1==
7355 ==Section 2==
7356 !! result
7357 <h2> <span class="mw-headline" id="Section_1">Section 1</span></h2>
7358 <h2> <span class="mw-headline" id="Section_2">Section 2</span></h2>
7359
7360 !! end
7361
7362 !! test
7363 Link inside a section heading
7364 !! input
7365 ==Section with a [[Main Page|link]] in it==
7366 !! result
7367 <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>
7368
7369 !! end
7370
7371 !! test
7372 TOC regression (bug 12077)
7373 !! input
7374 __TOC__
7375 == title 1 ==
7376 === title 1.1 ===
7377 == title 2 ==
7378 !! result
7379 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
7380 <ul>
7381 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
7382 <ul>
7383 <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>
7384 </ul>
7385 </li>
7386 <li class="toclevel-1 tocsection-3"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a></li>
7387 </ul>
7388 </td></tr></table>
7389 <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>
7390 <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>
7391 <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>
7392
7393 !! end
7394
7395 !! test
7396 BUG 1219 URL next to image (good)
7397 !! input
7398 http://example.com [[Image:foobar.jpg]]
7399 !! result
7400 <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>
7401 </p>
7402 !!end
7403
7404 !! test
7405 Short headings with trailing space should match behaviour of Parser::doHeadings (bug 19910)
7406 !! input
7407 ===
7408 The line above must have a trailing space!
7409 === <!--
7410 --> <!-- -->
7411 But just in case it doesn't...
7412 !! result
7413 <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>
7414 <p>The line above must have a trailing space!
7415 </p>
7416 <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>
7417 <p>But just in case it doesn't...
7418 </p>
7419 !! end
7420
7421 !! test
7422 Header with special characters (bug 25462)
7423 !! input
7424 The tooltips shall not show entities to the user (ie. be double escaped)
7425
7426 == text > text ==
7427 section 1
7428
7429 == text < text ==
7430 section 2
7431
7432 == text & text ==
7433 section 3
7434
7435 == text ' text ==
7436 section 4
7437
7438 == text " text ==
7439 section 5
7440 !! result
7441 <p>The tooltips shall not show entities to the user (ie. be double escaped)
7442 </p>
7443 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
7444 <ul>
7445 <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>
7446 <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>
7447 <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>
7448 <li class="toclevel-1 tocsection-4"><a href="#text_.27_text"><span class="tocnumber">4</span> <span class="toctext">text ' text</span></a></li>
7449 <li class="toclevel-1 tocsection-5"><a href="#text_.22_text"><span class="tocnumber">5</span> <span class="toctext">text " text</span></a></li>
7450 </ul>
7451 </td></tr></table>
7452 <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>
7453 <p>section 1
7454 </p>
7455 <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>
7456 <p>section 2
7457 </p>
7458 <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>
7459 <p>section 3
7460 </p>
7461 <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>
7462 <p>section 4
7463 </p>
7464 <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>
7465 <p>section 5
7466 </p>
7467 !! end
7468
7469 !! test
7470 Headers with excess '=' characters
7471 (Are similar tests necessary beyond the 1st level?)
7472 !! input
7473 =foo==
7474 ==foo=
7475 =''italic'' heading==
7476 ==''italic'' heading=
7477 !! result
7478 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
7479 <ul>
7480 <li class="toclevel-1 tocsection-1"><a href="#foo.3D"><span class="tocnumber">1</span> <span class="toctext">foo=</span></a></li>
7481 <li class="toclevel-1 tocsection-2"><a href="#.3Dfoo"><span class="tocnumber">2</span> <span class="toctext">=foo</span></a></li>
7482 <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>
7483 <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>
7484 </ul>
7485 </td></tr></table>
7486 <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>
7487 <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>
7488 <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>
7489 <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>
7490
7491 !! end
7492
7493 !! test
7494 BUG 1219 URL next to image (broken)
7495 !! input
7496 http://example.com[[Image:foobar.jpg]]
7497 !! result
7498 <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>
7499 </p>
7500 !!end
7501
7502 !! test
7503 Bug 1186 news: in the middle of text
7504 !! input
7505 http://en.wikinews.org/wiki/Wikinews:Workplace
7506 !! result
7507 <p><a rel="nofollow" class="external free" href="http://en.wikinews.org/wiki/Wikinews:Workplace">http://en.wikinews.org/wiki/Wikinews:Workplace</a>
7508 </p>
7509 !!end
7510
7511
7512 !! test
7513 Namespaced link must have a title
7514 !! input
7515 [[Project:]]
7516 !! result
7517 <p>[[Project:]]
7518 </p>
7519 !!end
7520
7521 !! test
7522 Namespaced link must have a title (bad fragment version)
7523 !! input
7524 [[Project:#fragment]]
7525 !! result
7526 <p>[[Project:#fragment]]
7527 </p>
7528 !!end
7529
7530
7531 ###
7532 ### HTML tags and HTML attributes
7533 ###
7534
7535 !! test
7536 div with no attributes
7537 !! input
7538 <div>HTML rocks</div>
7539 !! result
7540 <div>HTML rocks</div>
7541
7542 !! end
7543
7544 !! test
7545 div with double-quoted attribute
7546 !! input
7547 <div id="rock">HTML rocks</div>
7548 !! result
7549 <div id="rock">HTML rocks</div>
7550
7551 !! end
7552
7553 !! test
7554 div with single-quoted attribute
7555 !! input
7556 <div id='rock'>HTML rocks</div>
7557 !! result
7558 <div id="rock">HTML rocks</div>
7559
7560 !! end
7561
7562 !! test
7563 div with unquoted attribute
7564 !! input
7565 <div id=rock>HTML rocks</div>
7566 !! result
7567 <div id="rock">HTML rocks</div>
7568
7569 !! end
7570
7571 !! test
7572 div with illegal double attributes
7573 !! input
7574 <div id="a" id="b">HTML rocks</div>
7575 !! result
7576 <div id="b">HTML rocks</div>
7577
7578 !!end
7579
7580 # FIXME: produce empty string instead of "class" in the PHP parser, following
7581 # the HTML5 spec.
7582 !! test
7583 div with empty attribute value, space before equals
7584 !! options
7585 disabled
7586 !! input
7587 <div class =>HTML rocks</div>
7588 !! result
7589 <div class="">HTML rocks</div>
7590
7591 !! end
7592
7593 # The PHP parser escapes the opening brace to &#123; for some reason, so
7594 # disabled this test for it.
7595 !! test
7596 div with braces in attribute value
7597 !! options
7598 disabled
7599 !! input
7600 <div title="{}">Foo</div>
7601 !! result
7602 <div title="{}">Foo</div>
7603 !! end
7604
7605 # This it very inconsistent in the PHP parser: it returns
7606 # class="class" if there is a space between the name and the equal sign (see
7607 # 'div with empty attribute value, space before equals'), but strips the
7608 # attribute completely if the space is missing. We hope that not much content
7609 # depends on this, so are implementing the behavior below in Parsoid for
7610 # consistencies' sake. Disabled for the PHP parser.
7611 # FIXME: fix this behavior in the PHP parser?
7612 !! test
7613 div with empty attribute value, no space before equals
7614 !! options
7615 disabled
7616 !! input
7617 <div class=>HTML rocks</div>
7618 !! result
7619 <div class="">HTML rocks</div>
7620
7621 !! end
7622
7623 !! test
7624 HTML multiple attributes correction
7625 !! input
7626 <p class="error" class="awesome">Awesome!</p>
7627 !! result
7628 <p class="awesome">Awesome!</p>
7629
7630 !!end
7631
7632 !! test
7633 Table multiple attributes correction
7634 !! input
7635 {|
7636 !+ class="error" class="awesome"| status
7637 |}
7638 !! result
7639 <table>
7640 <tr>
7641 <th class="awesome"> status
7642 </th></tr></table>
7643
7644 !!end
7645
7646 !! test
7647 DIV IN UPPERCASE
7648 !! input
7649 <DIV ID="x">HTML ROCKS</DIV>
7650 !! result
7651 <div id="x">HTML ROCKS</div>
7652
7653 !!end
7654
7655 !! test
7656 Non-ASCII pseudo-tags are rendered as text
7657 !! input
7658 <khyô>
7659 !! result
7660 <p>&lt;khyô&gt;
7661 </p>
7662 !! end
7663
7664 !! test
7665 Pseudo-tag with URL 'name' renders as url link
7666 !! input
7667 <http://example.com/>
7668 !! result
7669 <p>&lt;<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&gt;
7670 </p>
7671 !! end
7672
7673 !! test
7674 text with amp in the middle of nowhere
7675 !! input
7676 Remember AT&T?
7677 !!result
7678 <p>Remember AT&amp;T?
7679 </p>
7680 !! end
7681
7682 !! test
7683 text with character entity: eacute
7684 !! input
7685 I always thought &eacute; was a cute letter.
7686 !! result
7687 <p>I always thought &#233; was a cute letter.
7688 </p>
7689 !! end
7690
7691 !! test
7692 text with undefined character entity: xacute
7693 !! input
7694 I always thought &xacute; was a cute letter.
7695 !! result
7696 <p>I always thought &amp;xacute; was a cute letter.
7697 </p>
7698 !! end
7699
7700
7701 ###
7702 ### Media links
7703 ###
7704
7705 !! test
7706 Media link
7707 !! input
7708 [[Media:Foobar.jpg]]
7709 !! result
7710 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Media:Foobar.jpg</a>
7711 </p>
7712 !! end
7713
7714 !! test
7715 Media link with text
7716 !! input
7717 [[Media:Foobar.jpg|A neat file to look at]]
7718 !! result
7719 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">A neat file to look at</a>
7720 </p>
7721 !! end
7722
7723 # FIXME: this is still bad HTML tag nesting
7724 !! test
7725 Media link with nasty text
7726 fixme: doBlockLevels won't wrap this in a paragraph because it contains a div
7727 !! input
7728 [[Media:Foobar.jpg|Safe Link<div style=display:none>" onmouseover="alert(document.cookie)" onfoo="</div>]]
7729 !! result
7730 <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>
7731
7732 !! end
7733
7734 !! test
7735 Media link to nonexistent file (bug 1702)
7736 !! input
7737 [[Media:No such.jpg]]
7738 !! result
7739 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=No_such.jpg" class="new" title="No such.jpg">Media:No such.jpg</a>
7740 </p>
7741 !! end
7742
7743 !! test
7744 Image link to nonexistent file (bug 1850 - good)
7745 !! input
7746 [[Image:No such.jpg]]
7747 !! result
7748 <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>
7749 </p>
7750 !! end
7751
7752 !! test
7753 :Image link to nonexistent file (bug 1850 - bad)
7754 !! input
7755 [[:Image:No such.jpg]]
7756 !! result
7757 <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>
7758 </p>
7759 !! end
7760
7761
7762
7763 !! test
7764 Character reference normalization in link text (bug 1938)
7765 !! input
7766 [[Main Page|this&that]]
7767 !! result
7768 <p><a href="/wiki/Main_Page" title="Main Page">this&amp;that</a>
7769 </p>
7770 !!end
7771
7772 !! article
7773 אַ
7774 !! text
7775 Test for unicode normalization
7776
7777 The page's name is U+05d0 U+05b7, with non-canonical form U+FB2E
7778 !! endarticle
7779
7780 !! test
7781 (bug 19451) Links should refer to the normalized form.
7782 !! input
7783 [[&#xFB2E;]]
7784 [[&#x5d0;&#x5b7;]]
7785 [[&#x5d0;ַ]]
7786 [[א&#x5b7;]]
7787 [[אַ]]
7788 !! result
7789 <p><a href="/wiki/%D7%90%D6%B7" title="אַ">&#xfb2e;</a>
7790 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;&#x5b7;</a>
7791 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;ַ</a>
7792 <a href="/wiki/%D7%90%D6%B7" title="אַ">א&#x5b7;</a>
7793 <a href="/wiki/%D7%90%D6%B7" title="אַ">אַ</a>
7794 </p>
7795 !! end
7796
7797 !! test
7798 Empty attribute crash test (bug 2067)
7799 !! input
7800 <font color="">foo</font>
7801 !! result
7802 <p><font color="">foo</font>
7803 </p>
7804 !! end
7805
7806 !! test
7807 Empty attribute crash test single-quotes (bug 2067)
7808 !! input
7809 <font color=''>foo</font>
7810 !! result
7811 <p><font color="">foo</font>
7812 </p>
7813 !! end
7814
7815 !! test
7816 Attribute test: equals, then nothing
7817 !! input
7818 <font color=>foo</font>
7819 !! result
7820 <p><font>foo</font>
7821 </p>
7822 !! end
7823
7824 !! test
7825 Attribute test: unquoted value
7826 !! input
7827 <font color=x>foo</font>
7828 !! result
7829 <p><font color="x">foo</font>
7830 </p>
7831 !! end
7832
7833 !! test
7834 Attribute test: unquoted but illegal value (hash)
7835 !! input
7836 <font color=#x>foo</font>
7837 !! result
7838 <p><font color="#x">foo</font>
7839 </p>
7840 !! end
7841
7842 !! test
7843 Attribute test: no value
7844 !! input
7845 <font color>foo</font>
7846 !! result
7847 <p><font color="color">foo</font>
7848 </p>
7849 !! end
7850
7851 !! test
7852 Bug 2095: link with three closing brackets
7853 !! input
7854 [[Main Page]]]
7855 !! result
7856 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>]
7857 </p>
7858 !! end
7859
7860 !! test
7861 Bug 2095: link with pipe and three closing brackets
7862 !! input
7863 [[Main Page|link]]]
7864 !! result
7865 <p><a href="/wiki/Main_Page" title="Main Page">link</a>]
7866 </p>
7867 !! end
7868
7869 !! test
7870 Bug 2095: link with pipe and three closing brackets, version 2
7871 !! input
7872 [[Main Page|[http://example.com/]]]
7873 !! result
7874 <p><a href="/wiki/Main_Page" title="Main Page">[http://example.com/]</a>
7875 </p>
7876 !! end
7877
7878
7879 ###
7880 ### Safety
7881 ###
7882
7883 !! article
7884 Template:Dangerous attribute
7885 !! text
7886 " onmouseover="alert(document.cookie)
7887 !! endarticle
7888
7889 !! article
7890 Template:Dangerous style attribute
7891 !! text
7892 border-size: expression(alert(document.cookie))
7893 !! endarticle
7894
7895 !! article
7896 Template:Div style
7897 !! text
7898 <div style="float: right; {{{1}}}">Magic div</div>
7899 !! endarticle
7900
7901 !! test
7902 Bug 2304: HTML attribute safety (safe template; regression bug 2309)
7903 !! input
7904 <div title="{{test}}"></div>
7905 !! result
7906 <div title="This is a test template"></div>
7907
7908 !! end
7909
7910 !! test
7911 Bug 2304: HTML attribute safety (dangerous template; 2309)
7912 !! input
7913 <div title="{{dangerous attribute}}"></div>
7914 !! result
7915 <div title=""></div>
7916
7917 !! end
7918
7919 !! test
7920 Bug 2304: HTML attribute safety (dangerous style template; 2309)
7921 !! input
7922 <div style="{{dangerous style attribute}}"></div>
7923 !! result
7924 <div style="/* insecure input */"></div>
7925
7926 !! end
7927
7928 !! test
7929 Bug 2304: HTML attribute safety (safe parameter; 2309)
7930 !! input
7931 {{div style|width: 200px}}
7932 !! result
7933 <div style="float: right; width: 200px">Magic div</div>
7934
7935 !! end
7936
7937 !! test
7938 Bug 2304: HTML attribute safety (unsafe parameter; 2309)
7939 !! input
7940 {{div style|width: expression(alert(document.cookie))}}
7941 !! result
7942 <div style="/* insecure input */">Magic div</div>
7943
7944 !! end
7945
7946 !! test
7947 Bug 2304: HTML attribute safety (unsafe breakout parameter; 2309)
7948 !! input
7949 {{div style|"><script>alert(document.cookie)</script>}}
7950 !! result
7951 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
7952
7953 !! end
7954
7955 !! test
7956 Bug 2304: HTML attribute safety (unsafe breakout parameter 2; 2309)
7957 !! input
7958 {{div style|" ><script>alert(document.cookie)</script>}}
7959 !! result
7960 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
7961
7962 !! end
7963
7964 !! test
7965 Bug 2304: HTML attribute safety (link)
7966 !! input
7967 <div title="[[Main Page]]"></div>
7968 !! result
7969 <div title="&#91;&#91;Main Page]]"></div>
7970
7971 !! end
7972
7973 !! test
7974 Bug 2304: HTML attribute safety (italics)
7975 !! input
7976 <div title="''foobar''"></div>
7977 !! result
7978 <div title="&#39;&#39;foobar&#39;&#39;"></div>
7979
7980 !! end
7981
7982 !! test
7983 Bug 2304: HTML attribute safety (bold)
7984 !! input
7985 <div title="'''foobar'''"></div>
7986 !! result
7987 <div title="&#39;&#39;&#39;foobar&#39;&#39;&#39;"></div>
7988
7989 !! end
7990
7991
7992 !! test
7993 Bug 2304: HTML attribute safety (ISBN)
7994 !! input
7995 <div title="ISBN 1234567890"></div>
7996 !! result
7997 <div title="&#73;SBN 1234567890"></div>
7998
7999 !! end
8000
8001 !! test
8002 Bug 2304: HTML attribute safety (RFC)
8003 !! input
8004 <div title="RFC 1234"></div>
8005 !! result
8006 <div title="&#82;FC 1234"></div>
8007
8008 !! end
8009
8010 !! test
8011 Bug 2304: HTML attribute safety (PMID)
8012 !! input
8013 <div title="PMID 1234567890"></div>
8014 !! result
8015 <div title="&#80;MID 1234567890"></div>
8016
8017 !! end
8018
8019 !! test
8020 Bug 2304: HTML attribute safety (web link)
8021 !! input
8022 <div title="http://example.com/"></div>
8023 !! result
8024 <div title="http&#58;//example.com/"></div>
8025
8026 !! end
8027
8028 !! test
8029 Bug 2304: HTML attribute safety (named web link)
8030 !! input
8031 <div title="[http://example.com/ link]"></div>
8032 !! result
8033 <div title="&#91;http&#58;//example.com/ link]"></div>
8034
8035 !! end
8036
8037 !! test
8038 Bug 3244: HTML attribute safety (extension; safe)
8039 !! input
8040 <div style="<nowiki>background:blue</nowiki>"></div>
8041 !! result
8042 <div style="background:blue"></div>
8043
8044 !! end
8045
8046 !! test
8047 Bug 3244: HTML attribute safety (extension; unsafe)
8048 !! input
8049 <div style="<nowiki>border-left:expression(alert(document.cookie))</nowiki>"></div>
8050 !! result
8051 <div style="/* insecure input */"></div>
8052
8053 !! end
8054
8055 # More MSIE fun discovered by Tom Gilder
8056
8057 !! test
8058 MSIE CSS safety test: spurious slash
8059 !! input
8060 <div style="background-image:u\rl(javascript:alert('boo'))">evil</div>
8061 !! result
8062 <div style="/* insecure input */">evil</div>
8063
8064 !! end
8065
8066 !! test
8067 MSIE CSS safety test: hex code
8068 !! input
8069 <div style="background-image:u\72l(javascript:alert('boo'))">evil</div>
8070 !! result
8071 <div style="/* insecure input */">evil</div>
8072
8073 !! end
8074
8075 !! test
8076 MSIE CSS safety test: comment in url
8077 !! input
8078 <div style="background-image:u/**/rl(javascript:alert('boo'))">evil</div>
8079 !! result
8080 <div style="background-image:u rl(javascript:alert(&#39;boo&#39;))">evil</div>
8081
8082 !! end
8083
8084 !! test
8085 MSIE CSS safety test: comment in expression
8086 !! input
8087 <div style="background-image:expres/**/sion(alert('boo4'))">evil4</div>
8088 !! result
8089 <div style="background-image:expres sion(alert(&#39;boo4&#39;))">evil4</div>
8090
8091 !! end
8092
8093
8094 !! test
8095 Table attribute legitimate extension
8096 !! input
8097 {|
8098 !+ style="<nowiki>color:blue</nowiki>"| status
8099 |}
8100 !! result
8101 <table>
8102 <tr>
8103 <th style="color:blue"> status
8104 </th></tr></table>
8105
8106 !!end
8107
8108 !! test
8109 Table attribute safety
8110 !! input
8111 {|
8112 !+ style="<nowiki>border-width:expression(0+alert(document.cookie))</nowiki>"| status
8113 |}
8114 !! result
8115 <table>
8116 <tr>
8117 <th style="/* insecure input */"> status
8118 </th></tr></table>
8119
8120 !! end
8121
8122 !! test
8123 CSS line continuation 1
8124 !! input
8125 <div style="background-image: u\&#10;rl(test.jpg);"></div>
8126 !! result
8127 <div style="/* insecure input */"></div>
8128
8129 !! end
8130
8131 !! test
8132 CSS line continuation 2
8133 !! input
8134 <div style="background-image: u\&#13;rl(test.jpg); "></div>
8135 !! result
8136 <div style="/* insecure input */"></div>
8137
8138 !! end
8139
8140 !! article
8141 Template:Identity
8142 !! text
8143 {{{1}}}
8144 !! endarticle
8145
8146 !! test
8147 Expansion of multi-line templates in attribute values (bug 6255)
8148 !! input
8149 <div style="background: {{identity|#00FF00}}">-</div>
8150 !! result
8151 <div style="background: #00FF00">-</div>
8152
8153 !! end
8154
8155
8156 !! test
8157 Expansion of multi-line templates in attribute values (bug 6255 sanity check)
8158 !! input
8159 <div style="background:
8160 #00FF00">-</div>
8161 !! result
8162 <div style="background: #00FF00">-</div>
8163
8164 !! end
8165
8166 !! test
8167 Expansion of multi-line templates in attribute values (bug 6255 sanity check 2)
8168 !! input
8169 <div style="background: &#10;#00FF00">-</div>
8170 !! result
8171 <div style="background: &#10;#00FF00">-</div>
8172
8173 !! end
8174
8175 ###
8176 ### Parser hooks (see maintenance/parserTestsParserHook.php for the <tag> extension)
8177 ###
8178 !! test
8179 Parser hook: empty input
8180 !! input
8181 <tag></tag>
8182 !! result
8183 <pre>
8184 ''
8185 array (
8186 )
8187 </pre>
8188
8189 !! end
8190
8191 !! test
8192 Parser hook: empty input using terminated empty elements
8193 !! input
8194 <tag/>
8195 !! result
8196 <pre>
8197 NULL
8198 array (
8199 )
8200 </pre>
8201
8202 !! end
8203
8204 !! test
8205 Parser hook: empty input using terminated empty elements (space before)
8206 !! input
8207 <tag />
8208 !! result
8209 <pre>
8210 NULL
8211 array (
8212 )
8213 </pre>
8214
8215 !! end
8216
8217 !! test
8218 Parser hook: basic input
8219 !! input
8220 <tag>input</tag>
8221 !! result
8222 <pre>
8223 'input'
8224 array (
8225 )
8226 </pre>
8227
8228 !! end
8229
8230
8231 !! test
8232 Parser hook: case insensitive
8233 !! input
8234 <TAG>input</TAG>
8235 !! result
8236 <pre>
8237 'input'
8238 array (
8239 )
8240 </pre>
8241
8242 !! end
8243
8244
8245 !! test
8246 Parser hook: case insensitive, redux
8247 !! input
8248 <TaG>input</TAg>
8249 !! result
8250 <pre>
8251 'input'
8252 array (
8253 )
8254 </pre>
8255
8256 !! end
8257
8258 !! test
8259 Parser hook: nested tags
8260 !! options
8261 noxml
8262 !! input
8263 <tag><tag></tag></tag>
8264 !! result
8265 <pre>
8266 '<tag>'
8267 array (
8268 )
8269 </pre>&lt;/tag&gt;
8270
8271 !! end
8272
8273 !! test
8274 Parser hook: basic arguments
8275 !! input
8276 <tag width=200 height = "100" depth = '50' square></tag>
8277 !! result
8278 <pre>
8279 ''
8280 array (
8281 'width' => '200',
8282 'height' => '100',
8283 'depth' => '50',
8284 'square' => 'square',
8285 )
8286 </pre>
8287
8288 !! end
8289
8290 !! test
8291 Parser hook: argument containing a forward slash (bug 5344)
8292 !! input
8293 <tag filename='/tmp/bla'></tag>
8294 !! result
8295 <pre>
8296 ''
8297 array (
8298 'filename' => '/tmp/bla',
8299 )
8300 </pre>
8301
8302 !! end
8303
8304 !! test
8305 Parser hook: empty input using terminated empty elements (bug 2374)
8306 !! input
8307 <tag foo=bar/>text
8308 !! result
8309 <pre>
8310 NULL
8311 array (
8312 'foo' => 'bar',
8313 )
8314 </pre>text
8315
8316 !! end
8317
8318 # </tag> should be output literally since there is no matching tag that begins it
8319 !! test
8320 Parser hook: basic arguments using terminated empty elements (bug 2374)
8321 !! input
8322 <tag width=200 height = "100" depth = '50' square/>
8323 other stuff
8324 </tag>
8325 !! result
8326 <pre>
8327 NULL
8328 array (
8329 'width' => '200',
8330 'height' => '100',
8331 'depth' => '50',
8332 'square' => 'square',
8333 )
8334 </pre>
8335 <p>other stuff
8336 &lt;/tag&gt;
8337 </p>
8338 !! end
8339
8340 ###
8341 ### (see maintenance/parserTestsStaticParserHook.php for the <statictag> extension)
8342 ###
8343
8344 !! test
8345 Parser hook: static parser hook not inside a comment
8346 !! input
8347 <statictag>hello, world</statictag>
8348 <statictag action=flush/>
8349 !! result
8350 <p>hello, world
8351 </p>
8352 !! end
8353
8354
8355 !! test
8356 Parser hook: static parser hook inside a comment
8357 !! input
8358 <!-- <statictag>hello, world</statictag> -->
8359 <statictag action=flush/>
8360 !! result
8361 <p><br />
8362 </p>
8363 !! end
8364
8365 # Nested template calls; this case was broken by Parser.php rev 1.506,
8366 # since reverted.
8367
8368 !! article
8369 Template:One-parameter
8370 !! text
8371 (My parameter is: {{{1}}})
8372 !! endarticle
8373
8374 !! article
8375 Template:Map-one-parameter
8376 !! text
8377 {{{{{1}}}|{{{2}}}}}
8378 !! endarticle
8379
8380 !! test
8381 Nested template calls
8382 !! input
8383 {{Map-one-parameter|One-parameter|param}}
8384 !! result
8385 <p>(My parameter is: param)
8386 </p>
8387 !! end
8388
8389
8390 ###
8391 ### Sanitizer
8392 ###
8393 !! test
8394 Sanitizer: Closing of open tags
8395 !! input
8396 <s></s><table></table>
8397 !! result
8398 <s></s><table></table>
8399
8400 !! end
8401
8402 !! test
8403 Sanitizer: Closing of open but not closed tags
8404 !! input
8405 <s>foo
8406 !! result
8407 <p><s>foo</s>
8408 </p>
8409 !! end
8410
8411 !! test
8412 Sanitizer: Closing of closed but not open tags
8413 !! input
8414 </s>
8415 !! result
8416 <p>&lt;/s&gt;
8417 </p>
8418 !! end
8419
8420 !! test
8421 Sanitizer: Closing of closed but not open table tags
8422 !! input
8423 Table not started</td></tr></table>
8424 !! result
8425 <p>Table not started&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
8426 </p>
8427 !! end
8428
8429 !! test
8430 Sanitizer: Escaping of spaces, multibyte characters, colons & other stuff in id=""
8431 !! input
8432 <span id="æ: v">byte</span>[[#æ: v|backlink]]
8433 !! result
8434 <p><span id=".C3.A6:_v">byte</span><a href="#.C3.A6:_v">backlink</a>
8435 </p>
8436 !! end
8437
8438 !! test
8439 Sanitizer: Validating the contents of the id attribute (bug 4515)
8440 !! options
8441 disabled
8442 !! input
8443 <br id=9 />
8444 !! result
8445 Something, but definitely not <br id="9" />...
8446 !! end
8447
8448 !! test
8449 Sanitizer: Validating id attribute uniqueness (bug 4515, bug 6301)
8450 !! options
8451 disabled
8452 !! input
8453 <br id="foo" /><br id="foo" />
8454 !! result
8455 Something need to be done. foo-2 ?
8456 !! end
8457
8458 !! test
8459 Sanitizer: Validating that <meta> and <link> work, but only for Microdata
8460 !! input
8461 <div itemscope>
8462 <meta itemprop="hello" content="world">
8463 <meta http-equiv="refresh" content="5">
8464 <meta itemprop="hello" http-equiv="refresh" content="5">
8465 <link itemprop="hello" href="{{SERVER}}">
8466 <link rel="stylesheet" href="{{SERVER}}">
8467 <link rel="stylesheet" itemprop="hello" href="{{SERVER}}">
8468 </div>
8469 !! result
8470 <div itemscope="itemscope">
8471 <p> <meta itemprop="hello" content="world" />
8472 &lt;meta http-equiv="refresh" content="5"&gt;
8473 <meta itemprop="hello" content="5" />
8474 </p>
8475 <link itemprop="hello" href="http&#58;//Britney-Spears" />
8476 &lt;link rel="stylesheet" href="<a rel="nofollow" class="external free" href="http://Britney-Spears">http://Britney-Spears</a>"&gt;
8477 <link itemprop="hello" href="http&#58;//Britney-Spears" />
8478 </div>
8479
8480 !! end
8481
8482 !! test
8483 Language converter: output gets cut off unexpectedly (bug 5757)
8484 !! options
8485 language=zh
8486 !! input
8487 this bit is safe: }-
8488
8489 but if we add a conversion instance: -{zh-cn:xxx;zh-tw:yyy}-
8490
8491 then we get cut off here: }-
8492
8493 all additional text is vanished
8494 !! result
8495 <p>this bit is safe: }-
8496 </p><p>but if we add a conversion instance: xxx
8497 </p><p>then we get cut off here: }-
8498 </p><p>all additional text is vanished
8499 </p>
8500 !! end
8501
8502 !! test
8503 Self closed html pairs (bug 5487)
8504 !! options
8505 !! input
8506 <center><font id="bug" />Centered text</center>
8507 <div><font id="bug2" />In div text</div>
8508 !! result
8509 <center>&lt;font id="bug" /&gt;Centered text</center>
8510 <div>&lt;font id="bug2" /&gt;In div text</div>
8511
8512 !! end
8513
8514 #
8515 #
8516 #
8517
8518 !! test
8519 Punctuation: nbsp before exclamation
8520 !! input
8521 C'est grave !
8522 !! result
8523 <p>C'est grave&#160;!
8524 </p>
8525 !! end
8526
8527 !! test
8528 Punctuation: CSS !important (bug 11874)
8529 !! input
8530 <div style="width:50% !important">important</div>
8531 !! result
8532 <div style="width:50% !important">important</div>
8533
8534 !!end
8535
8536 !! test
8537 Punctuation: CSS ! important (bug 11874; with space after)
8538 !! input
8539 <div style="width:50% ! important">important</div>
8540 !! result
8541 <div style="width:50% ! important">important</div>
8542
8543 !!end
8544
8545
8546 !! test
8547 HTML bullet list, closed tags (bug 5497)
8548 !! input
8549 <ul>
8550 <li>One</li>
8551 <li>Two</li>
8552 </ul>
8553 !! result
8554 <ul>
8555 <li>One</li>
8556 <li>Two</li>
8557 </ul>
8558
8559 !! end
8560
8561 !! test
8562 HTML bullet list, unclosed tags (bug 5497)
8563 !! options
8564 disabled
8565 !! input
8566 <ul>
8567 <li>One
8568 <li>Two
8569 </ul>
8570 !! result
8571 <ul>
8572 <li>One
8573 </li><li>Two
8574 </li></ul>
8575
8576 !! end
8577
8578 !! test
8579 HTML ordered list, closed tags (bug 5497)
8580 !! input
8581 <ol>
8582 <li>One</li>
8583 <li>Two</li>
8584 </ol>
8585 !! result
8586 <ol>
8587 <li>One</li>
8588 <li>Two</li>
8589 </ol>
8590
8591 !! end
8592
8593 !! test
8594 HTML ordered list, unclosed tags (bug 5497)
8595 !! options
8596 disabled
8597 !! input
8598 <ol>
8599 <li>One
8600 <li>Two
8601 </ol>
8602 !! result
8603 <ol>
8604 <li>One
8605 </li><li>Two
8606 </li></ol>
8607
8608 !! end
8609
8610 !! test
8611 HTML nested bullet list, closed tags (bug 5497)
8612 !! input
8613 <ul>
8614 <li>One</li>
8615 <li>Two:
8616 <ul>
8617 <li>Sub-one</li>
8618 <li>Sub-two</li>
8619 </ul>
8620 </li>
8621 </ul>
8622 !! result
8623 <ul>
8624 <li>One</li>
8625 <li>Two:
8626 <ul>
8627 <li>Sub-one</li>
8628 <li>Sub-two</li>
8629 </ul>
8630 </li>
8631 </ul>
8632
8633 !! end
8634
8635 !! test
8636 HTML nested bullet list, open tags (bug 5497)
8637 !! options
8638 disabled
8639 !! input
8640 <ul>
8641 <li>One
8642 <li>Two:
8643 <ul>
8644 <li>Sub-one
8645 <li>Sub-two
8646 </ul>
8647 </ul>
8648 !! result
8649 <ul>
8650 <li>One
8651 </li><li>Two:
8652 <ul>
8653 <li>Sub-one
8654 </li><li>Sub-two
8655 </li></ul>
8656 </li></ul>
8657
8658 !! end
8659
8660 !! test
8661 HTML nested ordered list, closed tags (bug 5497)
8662 !! input
8663 <ol>
8664 <li>One</li>
8665 <li>Two:
8666 <ol>
8667 <li>Sub-one</li>
8668 <li>Sub-two</li>
8669 </ol>
8670 </li>
8671 </ol>
8672 !! result
8673 <ol>
8674 <li>One</li>
8675 <li>Two:
8676 <ol>
8677 <li>Sub-one</li>
8678 <li>Sub-two</li>
8679 </ol>
8680 </li>
8681 </ol>
8682
8683 !! end
8684
8685 !! test
8686 HTML nested ordered list, open tags (bug 5497)
8687 !! options
8688 disabled
8689 !! input
8690 <ol>
8691 <li>One
8692 <li>Two:
8693 <ol>
8694 <li>Sub-one
8695 <li>Sub-two
8696 </ol>
8697 </ol>
8698 !! result
8699 <ol>
8700 <li>One
8701 </li><li>Two:
8702 <ol>
8703 <li>Sub-one
8704 </li><li>Sub-two
8705 </li></ol>
8706 </li></ol>
8707
8708 !! end
8709
8710 !! test
8711 HTML ordered list item with parameters oddity
8712 !! input
8713 <ol><li id="fragment">One</li></ol>
8714 !! result
8715 <ol><li id="fragment">One</li></ol>
8716
8717 !! end
8718
8719 !!test
8720 bug 5918: autonumbering
8721 !! input
8722 [http://first/] [http://second] [ftp://ftp]
8723
8724 ftp://inlineftp
8725
8726 [mailto:enclosed@mail.tld With target]
8727
8728 [mailto:enclosed@mail.tld]
8729
8730 mailto:inline@mail.tld
8731 !! result
8732 <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>
8733 </p><p><a rel="nofollow" class="external free" href="ftp://inlineftp">ftp://inlineftp</a>
8734 </p><p><a rel="nofollow" class="external text" href="mailto:enclosed@mail.tld">With target</a>
8735 </p><p><a rel="nofollow" class="external autonumber" href="mailto:enclosed@mail.tld">[4]</a>
8736 </p><p><a rel="nofollow" class="external free" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a>
8737 </p>
8738 !! end
8739
8740
8741 #
8742 # Security and HTML correctness
8743 # From Nick Jenkins' fuzz testing
8744 #
8745
8746 !! test
8747 Fuzz testing: Parser13
8748 !! input
8749 {|
8750 | http://a|
8751 !! result
8752 <table>
8753 <tr>
8754 <td>
8755 </td>
8756 </tr>
8757 </table>
8758
8759 !! end
8760
8761 !! test
8762 Fuzz testing: Parser14
8763 !! input
8764 == onmouseover= ==
8765 http://__TOC__
8766 !! result
8767 <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>
8768 http://<table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
8769 <ul>
8770 <li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
8771 </ul>
8772 </td></tr></table>
8773
8774 !! end
8775
8776 !! test
8777 Fuzz testing: Parser14-table
8778 !! input
8779 ==a==
8780 {| STYLE=__TOC__
8781 !! result
8782 <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>
8783 <table style="&#95;_TOC&#95;_">
8784 <tr><td></td></tr>
8785 </table>
8786
8787 !! end
8788
8789 # Known to produce bogus xml (extra </td>)
8790 !! test
8791 Fuzz testing: Parser16
8792 !! options
8793 noxml
8794 !! input
8795 {|
8796 !https://||||||
8797 !! result
8798 <table>
8799 <tr>
8800 <th>https://</th>
8801 <th></th>
8802 <th></th>
8803 <th>
8804 </td>
8805 </tr>
8806 </table>
8807
8808 !! end
8809
8810 !! test
8811 Fuzz testing: Parser21
8812 !! input
8813 {|
8814 ! irc://{{ftp://a" onmouseover="alert('hello world');"
8815 |
8816 !! result
8817 <table>
8818 <tr>
8819 <th> <a rel="nofollow" class="external free" href="irc://{{ftp://a">irc://{{ftp://a</a>" onmouseover="alert('hello world');"
8820 </th>
8821 <td>
8822 </td>
8823 </tr>
8824 </table>
8825
8826 !! end
8827
8828 !! test
8829 Fuzz testing: Parser22
8830 !! input
8831 http://===r:::https://b
8832
8833 {|
8834 !!result
8835 <p><a rel="nofollow" class="external free" href="http://===r:::https://b">http://===r:::https://b</a>
8836 </p>
8837 <table>
8838 <tr><td></td></tr>
8839 </table>
8840
8841 !! end
8842
8843 # Known to produce bad XML for now
8844 !! test
8845 Fuzz testing: Parser24
8846 !! options
8847 noxml
8848 !! input
8849 {|
8850 {{{|
8851 <u CLASS=
8852 | {{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx--><noinclude>}}}} >
8853 <br style="onmouseover='alert(document.cookie);' " />
8854
8855 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
8856 |
8857 !! result
8858 <table>
8859 {{{|
8860 <u class="&#124;">}}}} &gt;
8861 <br style="onmouseover=&#39;alert(document.cookie);&#39;" />
8862
8863 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
8864 <tr>
8865 <td></u>
8866 </td>
8867 </tr>
8868 </table>
8869
8870 !! end
8871
8872 # Note: the current result listed for this is not what the original one was,
8873 # but the original bug was JavaScript injection, which is fixed in any case.
8874 # It's not clear that the original result listed was any more correct than the
8875 # current one. Original result:
8876 # <p>{{{|
8877 # </p>
8878 # <li class="&#124;&#124;">
8879 # }}}blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
8880 !!test
8881 Fuzz testing: Parser25 (bug 6055)
8882 !! input
8883 {{{
8884 |
8885 <LI CLASS=||
8886 >
8887 }}}blah" onmouseover="alert('hello world');" align="left"'''MOVE MOUSE CURSOR OVER HERE
8888 !! result
8889 <p>&lt;LI CLASS=blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
8890 </p>
8891 !! end
8892
8893 !!test
8894 Fuzz testing: URL adjacent extension (with space, clean)
8895 !! options
8896 !! input
8897 http://example.com <nowiki>junk</nowiki>
8898 !! result
8899 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a> junk
8900 </p>
8901 !!end
8902
8903 !!test
8904 Fuzz testing: URL adjacent extension (no space, dirty; nowiki)
8905 !! options
8906 !! input
8907 http://example.com<nowiki>junk</nowiki>
8908 !! result
8909 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>junk
8910 </p>
8911 !!end
8912
8913 !!test
8914 Fuzz testing: URL adjacent extension (no space, dirty; pre)
8915 !! options
8916 !! input
8917 http://example.com<pre>junk</pre>
8918 !! result
8919 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a><pre>junk</pre>
8920
8921 !!end
8922
8923 !!test
8924 Fuzz testing: image with bogus manual thumbnail
8925 !!input
8926 [[Image:foobar.jpg|thumbnail= ]]
8927 !!result
8928 <div class="thumb tright"><div class="thumbinner" style="width:1943px;">Error creating thumbnail: <div class="thumbcaption"></div></div></div>
8929
8930 !!end
8931
8932 !! test
8933 Fuzz testing: encoded newline in generated HTML replacements (bug 6577)
8934 !! input
8935 <pre dir="&#10;"></pre>
8936 !! result
8937 <pre dir="&#10;"></pre>
8938
8939 !! end
8940
8941 !! test
8942 Parsing optional HTML elements (Bug 6171)
8943 !! options
8944 !! input
8945 <table>
8946 <tr>
8947 <td> Some tabular data</td>
8948 <td> More tabular data ...
8949 <td> And yet som tabular data</td>
8950 </tr>
8951 </table>
8952 !! result
8953 <table>
8954 <tr>
8955 <td> Some tabular data</td>
8956 <td> More tabular data ...
8957 </td><td> And yet som tabular data</td>
8958 </tr>
8959 </table>
8960
8961 !! end
8962
8963 !! test
8964 Correct handling of <td>, <tr> (Bug 6171)
8965 !! options
8966 !! input
8967 <table>
8968 <tr>
8969 <td> Some tabular data</td>
8970 <td> More tabular data ...</td>
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 ...</td>
8979 <td> And yet som tabular data</td>
8980 </tr>
8981 </table>
8982
8983 !! end
8984
8985
8986 !! test
8987 Parsing crashing regression (fr:JavaScript)
8988 !! input
8989 </body></x>
8990 !! result
8991 <p>&lt;/body&gt;&lt;/x&gt;
8992 </p>
8993 !! end
8994
8995 !! test
8996 Inline wiki vs wiki block nesting
8997 !! input
8998 '''Bold paragraph
8999
9000 New wiki paragraph
9001 !! result
9002 <p><b>Bold paragraph</b>
9003 </p><p>New wiki paragraph
9004 </p>
9005 !! end
9006
9007 !! test
9008 Inline HTML vs wiki block nesting
9009 !! options
9010 disabled
9011 !! input
9012 <b>Bold paragraph
9013
9014 New wiki paragraph
9015 !! result
9016 <p><b>Bold paragraph</b>
9017 </p><p>New wiki paragraph
9018 </p>
9019 !! end
9020
9021 # Original result was this:
9022 # <p><b>bold</b><b>bold<i>bolditalics</i></b>
9023 # </p>
9024 # While that might be marginally more intuitive, maybe, the six-apostrophe
9025 # construct is clearly pathological and the result stated here (which is what
9026 # the parser actually does) is about as reasonable as anything.
9027 !!test
9028 Mixing markup for italics and bold
9029 !! options
9030 !! input
9031 '''bold''''''bold''bolditalics'''''
9032 !! result
9033 <p>'<i>bold'</i><b>bold<i>bolditalics</i></b>
9034 </p>
9035 !! end
9036
9037
9038 !! article
9039 Xyzzyx
9040 !! text
9041 Article for special page transclusion test
9042 !! endarticle
9043
9044 !! test
9045 Special page transclusion
9046 !! options
9047 !! input
9048 {{Special:Prefixindex/Xyzzyx}}
9049 !! result
9050 <table id="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
9051
9052 !! end
9053
9054 !! test
9055 Special page transclusion twice (bug 5021)
9056 !! options
9057 !! input
9058 {{Special:Prefixindex/Xyzzyx}}
9059 {{Special:Prefixindex/Xyzzyx}}
9060 !! result
9061 <table id="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
9062 <table id="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
9063
9064 !! end
9065
9066 !! test
9067 Transclusion of default MediaWiki message
9068 !! input
9069 {{MediaWiki:Mainpage}}
9070 !!result
9071 <p>Main Page
9072 </p>
9073 !! end
9074
9075 !! test
9076 Transclusion of nonexistent MediaWiki message
9077 !! input
9078 {{MediaWiki:Mainpagexxx}}
9079 !!result
9080 <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>
9081 </p>
9082 !! end
9083
9084 !! test
9085 Transclusion of MediaWiki message with underscore
9086 !! input
9087 {{MediaWiki:history_short}}
9088 !! result
9089 <p>History
9090 </p>
9091 !! end
9092
9093 !! test
9094 Transclusion of MediaWiki message with space
9095 !! input
9096 {{MediaWiki:history short}}
9097 !! result
9098 <p>History
9099 </p>
9100 !! end
9101
9102 !! test
9103 Invalid header with following text
9104 !! input
9105 = x = y
9106 !! result
9107 <p>= x = y
9108 </p>
9109 !! end
9110
9111
9112 !! test
9113 Section extraction test (section 0)
9114 !! options
9115 section=0
9116 !! input
9117 start
9118 ==a==
9119 ===aa===
9120 ====aaa====
9121 ==b==
9122 ===ba===
9123 ===bb===
9124 ====bba====
9125 ===bc===
9126 ==c==
9127 ===ca===
9128 !! result
9129 start
9130 !! end
9131
9132 !! test
9133 Section extraction test (section 1)
9134 !! options
9135 section=1
9136 !! input
9137 start
9138 ==a==
9139 ===aa===
9140 ====aaa====
9141 ==b==
9142 ===ba===
9143 ===bb===
9144 ====bba====
9145 ===bc===
9146 ==c==
9147 ===ca===
9148 !! result
9149 ==a==
9150 ===aa===
9151 ====aaa====
9152 !! end
9153
9154 !! test
9155 Section extraction test (section 2)
9156 !! options
9157 section=2
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 ===aa===
9172 ====aaa====
9173 !! end
9174
9175 !! test
9176 Section extraction test (section 3)
9177 !! options
9178 section=3
9179 !! input
9180 start
9181 ==a==
9182 ===aa===
9183 ====aaa====
9184 ==b==
9185 ===ba===
9186 ===bb===
9187 ====bba====
9188 ===bc===
9189 ==c==
9190 ===ca===
9191 !! result
9192 ====aaa====
9193 !! end
9194
9195 !! test
9196 Section extraction test (section 4)
9197 !! options
9198 section=4
9199 !! input
9200 start
9201 ==a==
9202 ===aa===
9203 ====aaa====
9204 ==b==
9205 ===ba===
9206 ===bb===
9207 ====bba====
9208 ===bc===
9209 ==c==
9210 ===ca===
9211 !! result
9212 ==b==
9213 ===ba===
9214 ===bb===
9215 ====bba====
9216 ===bc===
9217 !! end
9218
9219 !! test
9220 Section extraction test (section 5)
9221 !! options
9222 section=5
9223 !! input
9224 start
9225 ==a==
9226 ===aa===
9227 ====aaa====
9228 ==b==
9229 ===ba===
9230 ===bb===
9231 ====bba====
9232 ===bc===
9233 ==c==
9234 ===ca===
9235 !! result
9236 ===ba===
9237 !! end
9238
9239 !! test
9240 Section extraction test (section 6)
9241 !! options
9242 section=6
9243 !! input
9244 start
9245 ==a==
9246 ===aa===
9247 ====aaa====
9248 ==b==
9249 ===ba===
9250 ===bb===
9251 ====bba====
9252 ===bc===
9253 ==c==
9254 ===ca===
9255 !! result
9256 ===bb===
9257 ====bba====
9258 !! end
9259
9260 !! test
9261 Section extraction test (section 7)
9262 !! options
9263 section=7
9264 !! input
9265 start
9266 ==a==
9267 ===aa===
9268 ====aaa====
9269 ==b==
9270 ===ba===
9271 ===bb===
9272 ====bba====
9273 ===bc===
9274 ==c==
9275 ===ca===
9276 !! result
9277 ====bba====
9278 !! end
9279
9280 !! test
9281 Section extraction test (section 8)
9282 !! options
9283 section=8
9284 !! input
9285 start
9286 ==a==
9287 ===aa===
9288 ====aaa====
9289 ==b==
9290 ===ba===
9291 ===bb===
9292 ====bba====
9293 ===bc===
9294 ==c==
9295 ===ca===
9296 !! result
9297 ===bc===
9298 !! end
9299
9300 !! test
9301 Section extraction test (section 9)
9302 !! options
9303 section=9
9304 !! input
9305 start
9306 ==a==
9307 ===aa===
9308 ====aaa====
9309 ==b==
9310 ===ba===
9311 ===bb===
9312 ====bba====
9313 ===bc===
9314 ==c==
9315 ===ca===
9316 !! result
9317 ==c==
9318 ===ca===
9319 !! end
9320
9321 !! test
9322 Section extraction test (section 10)
9323 !! options
9324 section=10
9325 !! input
9326 start
9327 ==a==
9328 ===aa===
9329 ====aaa====
9330 ==b==
9331 ===ba===
9332 ===bb===
9333 ====bba====
9334 ===bc===
9335 ==c==
9336 ===ca===
9337 !! result
9338 ===ca===
9339 !! end
9340
9341 !! test
9342 Section extraction test (nonexistent section 11)
9343 !! options
9344 section=11
9345 !! input
9346 start
9347 ==a==
9348 ===aa===
9349 ====aaa====
9350 ==b==
9351 ===ba===
9352 ===bb===
9353 ====bba====
9354 ===bc===
9355 ==c==
9356 ===ca===
9357 !! result
9358 !! end
9359
9360 !! test
9361 Section extraction test with bogus heading (section 1)
9362 !! options
9363 section=1
9364 !! input
9365 ==a==
9366 ==bogus== not a legal section
9367 ==b==
9368 !! result
9369 ==a==
9370 ==bogus== not a legal section
9371 !! end
9372
9373 !! test
9374 Section extraction test with bogus heading (section 2)
9375 !! options
9376 section=2
9377 !! input
9378 ==a==
9379 ==bogus== not a legal section
9380 ==b==
9381 !! result
9382 ==b==
9383 !! end
9384
9385 !! test
9386 Section extraction test with comment after heading (section 1)
9387 !! options
9388 section=1
9389 !! input
9390 ==a==
9391 ==b== <!-- -->
9392 ==c==
9393 !! result
9394 ==a==
9395 !! end
9396
9397 !! test
9398 Section extraction test with comment after heading (section 2)
9399 !! options
9400 section=2
9401 !! input
9402 ==a==
9403 ==b== <!-- -->
9404 ==c==
9405 !! result
9406 ==b== <!-- -->
9407 !! end
9408
9409 !! test
9410 Section extraction test with bogus <nowiki> heading (section 1)
9411 !! options
9412 section=1
9413 !! input
9414 ==a==
9415 ==bogus== <nowiki>not a legal section</nowiki>
9416 ==b==
9417 !! result
9418 ==a==
9419 ==bogus== <nowiki>not a legal section</nowiki>
9420 !! end
9421
9422 !! test
9423 Section extraction test with bogus <nowiki> heading (section 2)
9424 !! options
9425 section=2
9426 !! input
9427 ==a==
9428 ==bogus== <nowiki>not a legal section</nowiki>
9429 ==b==
9430 !! result
9431 ==b==
9432 !! end
9433
9434
9435 # Formerly testing for bug 2587, now resolved by the use of unmarked sections
9436 # instead of respecting commented sections
9437 !! test
9438 Section extraction prefixed by comment (section 1)
9439 !! options
9440 section=1
9441 !! input
9442 <!-- -->==sec1==
9443 ==sec2==
9444 !!result
9445 ==sec2==
9446 !!end
9447
9448 !! test
9449 Section extraction prefixed by comment (section 2)
9450 !! options
9451 section=2
9452 !! input
9453 <!-- -->==sec1==
9454 ==sec2==
9455 !!result
9456
9457 !!end
9458
9459
9460 # Formerly testing for bug 2607, now resolved by the use of unmarked sections
9461 # instead of respecting HTML-style headings
9462 !! test
9463 Section extraction, mixed wiki and html (section 1)
9464 !! options
9465 section=1
9466 !! input
9467 <h2>unmarked</h2>
9468 unmarked
9469 ==1==
9470 one
9471 ==2==
9472 two
9473 !! result
9474 ==1==
9475 one
9476 !! end
9477
9478 !! test
9479 Section extraction, mixed wiki and html (section 2)
9480 !! options
9481 section=2
9482 !! input
9483 <h2>unmarked</h2>
9484 unmarked
9485 ==1==
9486 one
9487 ==2==
9488 two
9489 !! result
9490 ==2==
9491 two
9492 !! end
9493
9494
9495 # Formerly testing for bug 3342
9496 !! test
9497 Section extraction, heading surrounded by <noinclude>
9498 !! options
9499 section=1
9500 !! input
9501 <noinclude>==unmarked==</noinclude>
9502 ==marked==
9503 !! result
9504 ==marked==
9505 !!end
9506
9507 # Test behaviour of bug 19910
9508 !! test
9509 Sectiion with all-equals
9510 !! options
9511 section=2
9512 !! input
9513 ===
9514 The line above must have a trailing space
9515 === <!--
9516 --> <!-- -->
9517 But just in case it doesn't...
9518 !! result
9519 === <!--
9520 --> <!-- -->
9521 But just in case it doesn't...
9522 !! end
9523
9524 !! test
9525 Section replacement test (section 0)
9526 !! options
9527 replace=0,"xxx"
9528 !! input
9529 start
9530 ==a==
9531 ===aa===
9532 ====aaa====
9533 ==b==
9534 ===ba===
9535 ===bb===
9536 ====bba====
9537 ===bc===
9538 ==c==
9539 ===ca===
9540 !! result
9541 xxx
9542
9543 ==a==
9544 ===aa===
9545 ====aaa====
9546 ==b==
9547 ===ba===
9548 ===bb===
9549 ====bba====
9550 ===bc===
9551 ==c==
9552 ===ca===
9553 !! end
9554
9555 !! test
9556 Section replacement test (section 1)
9557 !! options
9558 replace=1,"xxx"
9559 !! input
9560 start
9561 ==a==
9562 ===aa===
9563 ====aaa====
9564 ==b==
9565 ===ba===
9566 ===bb===
9567 ====bba====
9568 ===bc===
9569 ==c==
9570 ===ca===
9571 !! result
9572 start
9573 xxx
9574
9575 ==b==
9576 ===ba===
9577 ===bb===
9578 ====bba====
9579 ===bc===
9580 ==c==
9581 ===ca===
9582 !! end
9583
9584 !! test
9585 Section replacement test (section 2)
9586 !! options
9587 replace=2,"xxx"
9588 !! input
9589 start
9590 ==a==
9591 ===aa===
9592 ====aaa====
9593 ==b==
9594 ===ba===
9595 ===bb===
9596 ====bba====
9597 ===bc===
9598 ==c==
9599 ===ca===
9600 !! result
9601 start
9602 ==a==
9603 xxx
9604
9605 ==b==
9606 ===ba===
9607 ===bb===
9608 ====bba====
9609 ===bc===
9610 ==c==
9611 ===ca===
9612 !! end
9613
9614 !! test
9615 Section replacement test (section 3)
9616 !! options
9617 replace=3,"xxx"
9618 !! input
9619 start
9620 ==a==
9621 ===aa===
9622 ====aaa====
9623 ==b==
9624 ===ba===
9625 ===bb===
9626 ====bba====
9627 ===bc===
9628 ==c==
9629 ===ca===
9630 !! result
9631 start
9632 ==a==
9633 ===aa===
9634 xxx
9635
9636 ==b==
9637 ===ba===
9638 ===bb===
9639 ====bba====
9640 ===bc===
9641 ==c==
9642 ===ca===
9643 !! end
9644
9645 !! test
9646 Section replacement test (section 4)
9647 !! options
9648 replace=4,"xxx"
9649 !! input
9650 start
9651 ==a==
9652 ===aa===
9653 ====aaa====
9654 ==b==
9655 ===ba===
9656 ===bb===
9657 ====bba====
9658 ===bc===
9659 ==c==
9660 ===ca===
9661 !! result
9662 start
9663 ==a==
9664 ===aa===
9665 ====aaa====
9666 xxx
9667
9668 ==c==
9669 ===ca===
9670 !! end
9671
9672 !! test
9673 Section replacement test (section 5)
9674 !! options
9675 replace=5,"xxx"
9676 !! input
9677 start
9678 ==a==
9679 ===aa===
9680 ====aaa====
9681 ==b==
9682 ===ba===
9683 ===bb===
9684 ====bba====
9685 ===bc===
9686 ==c==
9687 ===ca===
9688 !! result
9689 start
9690 ==a==
9691 ===aa===
9692 ====aaa====
9693 ==b==
9694 xxx
9695
9696 ===bb===
9697 ====bba====
9698 ===bc===
9699 ==c==
9700 ===ca===
9701 !! end
9702
9703 !! test
9704 Section replacement test (section 6)
9705 !! options
9706 replace=6,"xxx"
9707 !! input
9708 start
9709 ==a==
9710 ===aa===
9711 ====aaa====
9712 ==b==
9713 ===ba===
9714 ===bb===
9715 ====bba====
9716 ===bc===
9717 ==c==
9718 ===ca===
9719 !! result
9720 start
9721 ==a==
9722 ===aa===
9723 ====aaa====
9724 ==b==
9725 ===ba===
9726 xxx
9727
9728 ===bc===
9729 ==c==
9730 ===ca===
9731 !! end
9732
9733 !! test
9734 Section replacement test (section 7)
9735 !! options
9736 replace=7,"xxx"
9737 !! input
9738 start
9739 ==a==
9740 ===aa===
9741 ====aaa====
9742 ==b==
9743 ===ba===
9744 ===bb===
9745 ====bba====
9746 ===bc===
9747 ==c==
9748 ===ca===
9749 !! result
9750 start
9751 ==a==
9752 ===aa===
9753 ====aaa====
9754 ==b==
9755 ===ba===
9756 ===bb===
9757 xxx
9758
9759 ===bc===
9760 ==c==
9761 ===ca===
9762 !! end
9763
9764 !! test
9765 Section replacement test (section 8)
9766 !! options
9767 replace=8,"xxx"
9768 !! input
9769 start
9770 ==a==
9771 ===aa===
9772 ====aaa====
9773 ==b==
9774 ===ba===
9775 ===bb===
9776 ====bba====
9777 ===bc===
9778 ==c==
9779 ===ca===
9780 !! result
9781 start
9782 ==a==
9783 ===aa===
9784 ====aaa====
9785 ==b==
9786 ===ba===
9787 ===bb===
9788 ====bba====
9789 xxx
9790
9791 ==c==
9792 ===ca===
9793 !!end
9794
9795 !! test
9796 Section replacement test (section 9)
9797 !! options
9798 replace=9,"xxx"
9799 !! input
9800 start
9801 ==a==
9802 ===aa===
9803 ====aaa====
9804 ==b==
9805 ===ba===
9806 ===bb===
9807 ====bba====
9808 ===bc===
9809 ==c==
9810 ===ca===
9811 !! result
9812 start
9813 ==a==
9814 ===aa===
9815 ====aaa====
9816 ==b==
9817 ===ba===
9818 ===bb===
9819 ====bba====
9820 ===bc===
9821 xxx
9822 !! end
9823
9824 !! test
9825 Section replacement test (section 10)
9826 !! options
9827 replace=10,"xxx"
9828 !! input
9829 start
9830 ==a==
9831 ===aa===
9832 ====aaa====
9833 ==b==
9834 ===ba===
9835 ===bb===
9836 ====bba====
9837 ===bc===
9838 ==c==
9839 ===ca===
9840 !! result
9841 start
9842 ==a==
9843 ===aa===
9844 ====aaa====
9845 ==b==
9846 ===ba===
9847 ===bb===
9848 ====bba====
9849 ===bc===
9850 ==c==
9851 xxx
9852 !! end
9853
9854 !! test
9855 Section replacement test with initial whitespace (bug 13728)
9856 !! options
9857 replace=2,"xxx"
9858 !! input
9859 Preformatted initial line
9860 ==a==
9861 ===a===
9862 !! result
9863 Preformatted initial line
9864 ==a==
9865 xxx
9866 !! end
9867
9868
9869 !! test
9870 Section extraction, heading followed by pre with 20 spaces (bug 6398)
9871 !! options
9872 section=1
9873 !! input
9874 ==a==
9875 a
9876 !! result
9877 ==a==
9878 a
9879 !! end
9880
9881 !! test
9882 Section extraction, heading followed by pre with 19 spaces (bug 6398 sanity check)
9883 !! options
9884 section=1
9885 !! input
9886 ==a==
9887 a
9888 !! result
9889 ==a==
9890 a
9891 !! end
9892
9893
9894 !! test
9895 Section extraction, <pre> around bogus header (bug 10309)
9896 !! options
9897 noxml section=2
9898 !! input
9899 == Section One ==
9900 <pre>
9901 =======
9902 </pre>
9903
9904 == Section Two ==
9905 stuff
9906 !! result
9907 == Section Two ==
9908 stuff
9909 !! end
9910
9911 !! test
9912 Section replacement, <pre> around bogus header (bug 10309)
9913 !! options
9914 noxml replace=2,"xxx"
9915 !! input
9916 == Section One ==
9917 <pre>
9918 =======
9919 </pre>
9920
9921 == Section Two ==
9922 stuff
9923 !! result
9924 == Section One ==
9925 <pre>
9926 =======
9927 </pre>
9928
9929 xxx
9930 !! end
9931
9932
9933
9934 !! test
9935 Handling of &#x0A; in URLs
9936 !! input
9937 **irc://&#x0A;a
9938 !! result
9939 <ul><li><ul><li><a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a>
9940 </li></ul>
9941 </li></ul>
9942
9943 !!end
9944
9945 !! test
9946 5 quotes, code coverage +1 line
9947 !! input
9948 '''''
9949 !! result
9950 !! end
9951
9952 !! test
9953 Special:Search page linking.
9954 !! input
9955 {{Special:search}}
9956 !! result
9957 <p><a href="/wiki/Special:Search" title="Special:Search">Special:Search</a>
9958 </p>
9959 !! end
9960
9961 !! test
9962 Say the magic word
9963 !! input
9964 * {{PAGENAME}}
9965 * {{BASEPAGENAME}}
9966 * {{SUBPAGENAME}}
9967 * {{SUBPAGENAMEE}}
9968 * {{BASEPAGENAME}}
9969 * {{BASEPAGENAMEE}}
9970 * {{TALKPAGENAME}}
9971 * {{TALKPAGENAMEE}}
9972 * {{SUBJECTPAGENAME}}
9973 * {{SUBJECTPAGENAMEE}}
9974 * {{NAMESPACEE}}
9975 * {{NAMESPACE}}
9976 * {{TALKSPACE}}
9977 * {{TALKSPACEE}}
9978 * {{SUBJECTSPACE}}
9979 * {{SUBJECTSPACEE}}
9980 * {{Dynamic|{{NUMBEROFUSERS}}|{{NUMBEROFPAGES}}|{{CURRENTVERSION}}|{{CONTENTLANGUAGE}}|{{DIRECTIONMARK}}|{{CURRENTTIMESTAMP}}|{{NUMBEROFARTICLES}}}}
9981 !! result
9982 <ul><li> Parser test
9983 </li><li> Parser test
9984 </li><li> Parser test
9985 </li><li> Parser_test
9986 </li><li> Parser test
9987 </li><li> Parser_test
9988 </li><li> Talk:Parser test
9989 </li><li> Talk:Parser_test
9990 </li><li> Parser test
9991 </li><li> Parser_test
9992 </li><li>
9993 </li><li>
9994 </li><li> Talk
9995 </li><li> Talk
9996 </li><li>
9997 </li><li>
9998 </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>
9999 </li></ul>
10000
10001 !! end
10002 ### Note: Above tests excludes the "{{NUMBEROFADMINS}}" magic word because it generates a MySQL error when included.
10003
10004 !! test
10005 Gallery
10006 !! input
10007 <gallery>
10008 image1.png |
10009 image2.gif|||||
10010
10011 image3|
10012 image4 |300px| centre
10013 image5.svg| http://///////
10014 [[x|xx]]]]
10015 * image6
10016 </gallery>
10017 !! result
10018 <ul class="gallery">
10019 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
10020 <div style="height: 150px;">Image1.png</div>
10021 <div class="gallerytext">
10022 </div>
10023 </div></li>
10024 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
10025 <div style="height: 150px;">Image2.gif</div>
10026 <div class="gallerytext">
10027 <p>||||
10028 </p>
10029 </div>
10030 </div></li>
10031 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
10032 <div style="height: 150px;">Image3</div>
10033 <div class="gallerytext">
10034 </div>
10035 </div></li>
10036 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
10037 <div style="height: 150px;">Image4</div>
10038 <div class="gallerytext">
10039 <p>300px| centre
10040 </p>
10041 </div>
10042 </div></li>
10043 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
10044 <div style="height: 150px;">Image5.svg</div>
10045 <div class="gallerytext">
10046 <p><a rel="nofollow" class="external free" href="http://///////">http://///////</a>
10047 </p>
10048 </div>
10049 </div></li>
10050 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
10051 <div style="height: 150px;">* image6</div>
10052 <div class="gallerytext">
10053 </div>
10054 </div></li>
10055 </ul>
10056
10057 !! end
10058
10059 !! test
10060 Gallery (with options)
10061 !! input
10062 <gallery widths='70px' heights='40px' perrow='2' caption='Foo [[Main Page]]' >
10063 File:Nonexistant.jpg|caption
10064 File:Nonexistant.jpg
10065 image:foobar.jpg|some '''caption''' [[Main Page]]
10066 image:foobar.jpg
10067 image:foobar.jpg|Blabla|alt=This is a foo-bar.|blabla.
10068 </gallery>
10069 !! result
10070 <ul class="gallery" style="max-width: 226px;_width: 226px;">
10071 <li class='gallerycaption'>Foo <a href="/wiki/Main_Page" title="Main Page">Main Page</a></li>
10072 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
10073 <div style="height: 70px;">Nonexistant.jpg</div>
10074 <div class="gallerytext">
10075 <p>caption
10076 </p>
10077 </div>
10078 </div></li>
10079 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
10080 <div style="height: 70px;">Nonexistant.jpg</div>
10081 <div class="gallerytext">
10082 </div>
10083 </div></li>
10084 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
10085 <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>
10086 <div class="gallerytext">
10087 <p>some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
10088 </p>
10089 </div>
10090 </div></li>
10091 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
10092 <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>
10093 <div class="gallerytext">
10094 </div>
10095 </div></li>
10096 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
10097 <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>
10098 <div class="gallerytext">
10099 <p>Blabla|blabla.
10100 </p>
10101 </div>
10102 </div></li>
10103 </ul>
10104
10105 !! end
10106
10107 !! test
10108 Gallery with wikitext inside caption
10109 !! input
10110 <gallery>
10111 File:foobar.jpg|[[File:foobar.jpg|20px|desc|alt=inneralt]]|alt=galleryalt
10112 File:foobar.jpg|{{Test|unamedParam|alt=param}}|alt=galleryalt
10113 </gallery>
10114 !! result
10115 <ul class="gallery">
10116 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
10117 <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>
10118 <div class="gallerytext">
10119 <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>
10120 </p>
10121 </div>
10122 </div></li>
10123 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
10124 <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>
10125 <div class="gallerytext">
10126 <p>This is a test template
10127 </p>
10128 </div>
10129 </div></li>
10130 </ul>
10131
10132 !! end
10133
10134 !! test
10135 gallery (with showfilename option)
10136 !! input
10137 <gallery showfilename>
10138 File:Nonexistant.jpg|caption
10139 File:Nonexistant.jpg
10140 image:foobar.jpg|some '''caption''' [[Main Page]]
10141 File:Foobar.jpg
10142 </gallery>
10143 !! result
10144 <ul class="gallery">
10145 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
10146 <div style="height: 150px;">Nonexistant.jpg</div>
10147 <div class="gallerytext">
10148 <p><a href="/wiki/File:Nonexistant.jpg" title="File:Nonexistant.jpg">Nonexistant.jpg</a><br />
10149 caption
10150 </p>
10151 </div>
10152 </div></li>
10153 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
10154 <div style="height: 150px;">Nonexistant.jpg</div>
10155 <div class="gallerytext">
10156 <p><a href="/wiki/File:Nonexistant.jpg" title="File:Nonexistant.jpg">Nonexistant.jpg</a><br />
10157 </p>
10158 </div>
10159 </div></li>
10160 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
10161 <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>
10162 <div class="gallerytext">
10163 <p><a href="/wiki/File:Foobar.jpg" title="File:Foobar.jpg">Foobar.jpg</a><br />
10164 some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
10165 </p>
10166 </div>
10167 </div></li>
10168 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
10169 <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>
10170 <div class="gallerytext">
10171 <p><a href="/wiki/File:Foobar.jpg" title="File:Foobar.jpg">Foobar.jpg</a><br />
10172 </p>
10173 </div>
10174 </div></li>
10175 </ul>
10176
10177 !! end
10178
10179 !! test
10180 Gallery (with namespace-less filenames)
10181 !! input
10182 <gallery>
10183 File:Nonexistant.jpg
10184 Nonexistant.jpg
10185 image:foobar.jpg
10186 foobar.jpg
10187 </gallery>
10188 !! result
10189 <ul class="gallery">
10190 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
10191 <div style="height: 150px;">Nonexistant.jpg</div>
10192 <div class="gallerytext">
10193 </div>
10194 </div></li>
10195 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
10196 <div style="height: 150px;">Nonexistant.jpg</div>
10197 <div class="gallerytext">
10198 </div>
10199 </div></li>
10200 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
10201 <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>
10202 <div class="gallerytext">
10203 </div>
10204 </div></li>
10205 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
10206 <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>
10207 <div class="gallerytext">
10208 </div>
10209 </div></li>
10210 </ul>
10211
10212 !! end
10213
10214 !! test
10215 HTML Hex character encoding (spells the word "JavaScript")
10216 !! input
10217 &#x4A;&#x061;&#x0076;&#x00061;&#x000053;&#x0000063;&#114;&#x0000069;&#00000112;&#x0000000074;
10218 !! result
10219 <p>&#x4a;&#x61;&#x76;&#x61;&#x53;&#x63;&#114;&#x69;&#112;&#x74;
10220 </p>
10221 !! end
10222
10223 !! test
10224 HTML Hex character encoding bogus encoding (bug 26437 regression check)
10225 !! input
10226 &#xsee;&#XSEE;
10227 !! result
10228 <p>&amp;#xsee;&amp;#XSEE;
10229 </p>
10230 !! end
10231
10232 !! test
10233 HTML Hex character encoding mixed case
10234 !! input
10235 &#xEE;&#Xee;
10236 !! result
10237 <p>&#xee;&#xee;
10238 </p>
10239 !! end
10240
10241 !! test
10242 __FORCETOC__ override
10243 !! input
10244 __NEWSECTIONLINK__
10245 __FORCETOC__
10246 !! result
10247 <p><br />
10248 </p>
10249 !! end
10250
10251 !! test
10252 ISBN code coverage
10253 !! input
10254 ISBN 978-0-1234-56&#x20;789
10255 !! result
10256 <p><a href="/wiki/Special:BookSources/9780123456" class="internal mw-magiclink-isbn">ISBN 978-0-1234-56</a>&#x20;789
10257 </p>
10258 !! end
10259
10260 !! test
10261 ISBN followed by 5 spaces
10262 !! input
10263 ISBN
10264 !! result
10265 <p>ISBN
10266 </p>
10267 !! end
10268
10269 !! test
10270 Double ISBN
10271 !! input
10272 ISBN ISBN 1234567890
10273 !! result
10274 <p>ISBN <a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
10275 </p>
10276 !! end
10277
10278 !! test
10279 Bug 22905: <abbr> followed by ISBN followed by </a>
10280 !! input
10281 <abbr>(fr)</abbr> ISBN 2753300917 [http://www.example.com example.com]
10282 !! result
10283 <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>
10284 </p>
10285 !! end
10286
10287 !! test
10288 Double RFC
10289 !! input
10290 RFC RFC 1234
10291 !! result
10292 <p>RFC <a class="external mw-magiclink-rfc" href="//tools.ietf.org/html/rfc1234">RFC 1234</a>
10293 </p>
10294 !! end
10295
10296 !! test
10297 Double RFC with a wiki link
10298 !! input
10299 RFC [[RFC 1234]]
10300 !! result
10301 <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>
10302 </p>
10303 !! end
10304
10305 !! test
10306 RFC code coverage
10307 !! input
10308 RFC 983&#x20;987
10309 !! result
10310 <p><a class="external mw-magiclink-rfc" href="//tools.ietf.org/html/rfc983">RFC 983</a>&#x20;987
10311 </p>
10312 !! end
10313
10314 !! test
10315 Centre-aligned image
10316 !! input
10317 [[Image:foobar.jpg|centre]]
10318 !! result
10319 <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>
10320
10321 !!end
10322
10323 !! test
10324 None-aligned image
10325 !! input
10326 [[Image:foobar.jpg|none]]
10327 !! result
10328 <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>
10329
10330 !!end
10331
10332 !! test
10333 Width + Height sized image (using px) (height is ignored)
10334 !! input
10335 [[Image:foobar.jpg|640x480px]]
10336 !! result
10337 <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>
10338 </p>
10339 !!end
10340
10341 !! test
10342 Width-sized image (using px, no following whitespace)
10343 !! input
10344 [[Image:foobar.jpg|640px]]
10345 !! result
10346 <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>
10347 </p>
10348 !!end
10349
10350 !! test
10351 Width-sized image (using px, with following whitespace - test regression from r39467)
10352 !! input
10353 [[Image:foobar.jpg|640px ]]
10354 !! result
10355 <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>
10356 </p>
10357 !!end
10358
10359 !! test
10360 Width-sized image (using px, with preceding whitespace - test regression from r39467)
10361 !! input
10362 [[Image:foobar.jpg| 640px]]
10363 !! result
10364 <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>
10365 </p>
10366 !!end
10367
10368 !! test
10369 Another italics / bold test
10370 !! input
10371 ''' ''x'
10372 !! result
10373 <pre>'<i> </i>x'
10374 </pre>
10375 !!end
10376
10377 # Note the results may be incorrect, as parserTest output included this:
10378 # XML error: Mismatched tag at byte 6120:
10379 # ...<dd> </dt></dl> </dd...
10380 !! test
10381 dt/dd/dl test
10382 !! options
10383 disabled
10384 !! input
10385 :;;;::
10386 !! result
10387 <dl><dd><dl><dt><dl><dt><dl><dt><dl><dd><dl><dd>
10388 </dd></dl>
10389 </dd></dl>
10390 </dt></dl>
10391 </dt></dl>
10392 </dt></dl>
10393 </dd></dl>
10394
10395 !!end
10396
10397
10398 # Images with the "|" character in external URLs in comment tags; Eats half the comment, leaves unmatched "</a>" tag.
10399 !! test
10400 Images with the "|" character in the comment
10401 !! input
10402 [[image:Foobar.jpg|thumb|An [http://test/?param1=|left|&param2=|x external] URL]]
10403 !! result
10404 <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>
10405
10406 !!end
10407
10408 !! test
10409 [Before] HTML without raw HTML enabled ($wgRawHtml==false)
10410 !! input
10411 <html><script>alert(1);</script></html>
10412 !! result
10413 <p>&lt;html&gt;&lt;script&gt;alert(1);&lt;/script&gt;&lt;/html&gt;
10414 </p>
10415 !! end
10416
10417 !! test
10418 HTML with raw HTML ($wgRawHtml==true)
10419 !! options
10420 rawhtml
10421 !! input
10422 <html><script>alert(1);</script></html>
10423 !! result
10424 <p><script>alert(1);</script>
10425 </p>
10426 !! end
10427
10428 !! test
10429 Parents of subpages, one level up
10430 !! options
10431 subpage title=[[Subpage test/L1/L2/L3]]
10432 !! input
10433 [[../|L2]]
10434 !! result
10435 <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>
10436 </p>
10437 !! end
10438
10439
10440 !! test
10441 Parents of subpages, one level up, not named
10442 !! options
10443 subpage title=[[Subpage test/L1/L2/L3]]
10444 !! input
10445 [[../]]
10446 !! result
10447 <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>
10448 </p>
10449 !! end
10450
10451
10452
10453 !! test
10454 Parents of subpages, two levels up
10455 !! options
10456 subpage title=[[Subpage test/L1/L2/L3]]
10457 !! input
10458 [[../../|L1]]2
10459
10460 [[../../|L1]]l
10461 !! result
10462 <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
10463 </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>
10464 </p>
10465 !! end
10466
10467 !! test
10468 Parents of subpages, two levels up, without trailing slash or name.
10469 !! options
10470 subpage title=[[Subpage test/L1/L2/L3]]
10471 !! input
10472 [[../..]]
10473 !! result
10474 <p>[[../..]]
10475 </p>
10476 !! end
10477
10478 !! test
10479 Parents of subpages, two levels up, with lots of extra trailing slashes.
10480 !! options
10481 subpage title=[[Subpage test/L1/L2/L3]]
10482 !! input
10483 [[../../////]]
10484 !! result
10485 <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>
10486 </p>
10487 !! end
10488
10489 !! test
10490 Definition list code coverage
10491 !! input
10492 ; title : def
10493 ; title : def
10494 ;title: def
10495 !! result
10496 <dl><dt> title &#160;</dt><dd> def
10497 </dd><dt> title&#160;</dt><dd> def
10498 </dd><dt>title</dt><dd> def
10499 </dd></dl>
10500
10501 !! end
10502
10503 !! test
10504 Don't fall for the self-closing div
10505 !! input
10506 <div>hello world</div/>
10507 !! result
10508 <div>hello world</div>
10509
10510 !! end
10511
10512 !! test
10513 MSGNW magic word
10514 !! input
10515 {{MSGNW:msg}}
10516 !! result
10517 <p>&#91;&#91;:Template:Msg&#93;&#93;
10518 </p>
10519 !! end
10520
10521 !! test
10522 RAW magic word
10523 !! input
10524 {{RAW:QUERTY}}
10525 !! result
10526 <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>
10527 </p>
10528 !! end
10529
10530 # This isn't needed for XHTML conformance, but would be handy as a fallback security measure
10531 !! test
10532 Always escape literal '>' in output, not just after '<'
10533 !! input
10534 ><>
10535 !! result
10536 <p>&gt;&lt;&gt;
10537 </p>
10538 !! end
10539
10540 !! test
10541 Template caching
10542 !! input
10543 {{Test}}
10544 {{Test}}
10545 !! result
10546 <p>This is a test template
10547 This is a test template
10548 </p>
10549 !! end
10550
10551
10552 !! article
10553 MediaWiki:Fake
10554 !! text
10555 ==header==
10556 !! endarticle
10557
10558 !! test
10559 Inclusion of !userCanEdit() content
10560 !! input
10561 {{MediaWiki:Fake}}
10562 !! result
10563 <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>
10564
10565 !! end
10566
10567
10568 !! test
10569 Out-of-order TOC heading levels
10570 !! input
10571 ==2==
10572 ======6======
10573 ===3===
10574 =1=
10575 =====5=====
10576 ==2==
10577 !! result
10578 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
10579 <ul>
10580 <li class="toclevel-1 tocsection-1"><a href="#2"><span class="tocnumber">1</span> <span class="toctext">2</span></a>
10581 <ul>
10582 <li class="toclevel-2 tocsection-2"><a href="#6"><span class="tocnumber">1.1</span> <span class="toctext">6</span></a></li>
10583 <li class="toclevel-2 tocsection-3"><a href="#3"><span class="tocnumber">1.2</span> <span class="toctext">3</span></a></li>
10584 </ul>
10585 </li>
10586 <li class="toclevel-1 tocsection-4"><a href="#1"><span class="tocnumber">2</span> <span class="toctext">1</span></a>
10587 <ul>
10588 <li class="toclevel-2 tocsection-5"><a href="#5"><span class="tocnumber">2.1</span> <span class="toctext">5</span></a></li>
10589 <li class="toclevel-2 tocsection-6"><a href="#2_2"><span class="tocnumber">2.2</span> <span class="toctext">2</span></a></li>
10590 </ul>
10591 </li>
10592 </ul>
10593 </td></tr></table>
10594 <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>
10595 <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>
10596 <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>
10597 <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>
10598 <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>
10599 <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>
10600
10601 !! end
10602
10603
10604 !! test
10605 ISBN with a dummy number
10606 !! input
10607 ISBN ---
10608 !! result
10609 <p>ISBN ---
10610 </p>
10611 !! end
10612
10613
10614 !! test
10615 ISBN with space-delimited number
10616 !! input
10617 ISBN 92 9017 032 8
10618 !! result
10619 <p><a href="/wiki/Special:BookSources/9290170328" class="internal mw-magiclink-isbn">ISBN 92 9017 032 8</a>
10620 </p>
10621 !! end
10622
10623
10624 !! test
10625 ISBN with multiple spaces, no number
10626 !! input
10627 ISBN foo
10628 !! result
10629 <p>ISBN foo
10630 </p>
10631 !! end
10632
10633
10634 !! test
10635 ISBN length
10636 !! input
10637 ISBN 123456789
10638
10639 ISBN 1234567890
10640
10641 ISBN 12345678901
10642 !! result
10643 <p>ISBN 123456789
10644 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
10645 </p><p>ISBN 12345678901
10646 </p>
10647 !! end
10648
10649
10650 !! test
10651 ISBN with trailing year (bug 8110)
10652 !! input
10653 ISBN 1-234-56789-0 - 2006
10654
10655 ISBN 1 234 56789 0 - 2006
10656 !! result
10657 <p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1-234-56789-0</a> - 2006
10658 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1 234 56789 0</a> - 2006
10659 </p>
10660 !! end
10661
10662
10663 !! test
10664 anchorencode
10665 !! input
10666 {{anchorencode:foo bar©#%n}}
10667 !! result
10668 <p>foo_bar.C2.A9.23.25n
10669 </p>
10670 !! end
10671
10672 !! test
10673 anchorencode trims spaces
10674 !! input
10675 {{anchorencode: __pretty__please__}}
10676 !! result
10677 <p>pretty_please
10678 </p>
10679 !! end
10680
10681 !! test
10682 anchorencode deals with links
10683 !! input
10684 {{anchorencode: [[hello|world]] [[hi]]}}
10685 !! result
10686 <p>world_hi
10687 </p>
10688 !! end
10689
10690 !! test
10691 anchorencode deals with templates
10692 !! input
10693 {{anchorencode: {{Foo}} }}
10694 !! result
10695 <p>FOO
10696 </p>
10697 !! end
10698
10699 !! test
10700 anchorencode encodes like the TOC generator: (bug 18431)
10701 !! input
10702 === _ +:.3A%3A&&amp;]] ===
10703 {{anchorencode: _ +:.3A%3A&&amp;]] }}
10704 __NOEDITSECTION__
10705 !! result
10706 <h3> <span class="mw-headline" id=".2B:.3A.253A.26.26.5D.5D"> _ +:.3A%3A&amp;&amp;]] </span></h3>
10707 <p>.2B:.3A.253A.26.26.5D.5D
10708 </p>
10709 !! end
10710
10711 # Expected output in the following test is not necessarily expected (there
10712 # should probably be <p> tags inside the <blockquote> in the output) -- it's
10713 # only testing for well-formedness.
10714 !! test
10715 Bug 6200: blockquotes and paragraph formatting
10716 !! input
10717 <blockquote>
10718 foo
10719 </blockquote>
10720
10721 bar
10722
10723 baz
10724 !! result
10725 <blockquote>
10726 foo
10727 </blockquote>
10728 <p>bar
10729 </p>
10730 <pre>baz
10731 </pre>
10732 !! end
10733
10734 !! test
10735 Bug 8293: Use of center tag ruins paragraph formatting
10736 !! input
10737 <center>
10738 foo
10739 </center>
10740
10741 bar
10742
10743 baz
10744 !! result
10745 <center>
10746 <p>foo
10747 </p>
10748 </center>
10749 <p>bar
10750 </p>
10751 <pre>baz
10752 </pre>
10753 !! end
10754
10755
10756 ###
10757 ### Language variants related tests
10758 ###
10759 !! test
10760 Self-link in language variants
10761 !! options
10762 title=[[Dunav]] language=sr
10763 !! input
10764 Both [[Dunav]] and [[Дунав]] are names for this river.
10765 !! result
10766 <p>Both <strong class="selflink">Dunav</strong> and <strong class="selflink">Дунав</strong> are names for this river.
10767 </p>
10768 !!end
10769
10770
10771 !! test
10772 Link to pages in language variants
10773 !! options
10774 language=sr
10775 !! input
10776 Main Page can be written as [[Маин Паге]]
10777 !! result
10778 <p>Main Page can be written as <a href="/wiki/Main_Page" title="Main Page">Маин Паге</a>
10779 </p>
10780 !!end
10781
10782
10783 !! test
10784 Multiple links to pages in language variants
10785 !! options
10786 language=sr
10787 !! input
10788 [[Main Page]] can be written as [[Маин Паге]] same as [[Маин Паге]].
10789 !! result
10790 <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>.
10791 </p>
10792 !!end
10793
10794
10795 !! test
10796 Simple template in language variants
10797 !! options
10798 language=sr
10799 !! input
10800 {{тест}}
10801 !! result
10802 <p>This is a test template
10803 </p>
10804 !! end
10805
10806
10807 !! test
10808 Template with explicit namespace in language variants
10809 !! options
10810 language=sr
10811 !! input
10812 {{Template:тест}}
10813 !! result
10814 <p>This is a test template
10815 </p>
10816 !! end
10817
10818
10819 !! test
10820 Basic test for template parameter in language variants
10821 !! options
10822 language=sr
10823 !! input
10824 {{парамтест|param=foo}}
10825 !! result
10826 <p>This is a test template with parameter foo
10827 </p>
10828 !! end
10829
10830
10831 !! test
10832 Simple category in language variants
10833 !! options
10834 language=sr cat
10835 !! input
10836 [[Category:МедиаWики Усер'с Гуиде]]
10837 !! result
10838 <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>
10839 !! end
10840
10841
10842 !! test
10843 Stripping -{}- tags (language variants)
10844 !! options
10845 language=sr
10846 !! input
10847 Latin proverb: -{Ne nuntium necare}-
10848 !! result
10849 <p>Latin proverb: Ne nuntium necare
10850 </p>
10851 !! end
10852
10853
10854 !! test
10855 Prevent conversion with -{}- tags (language variants)
10856 !! options
10857 language=sr variant=sr-ec
10858 !! input
10859 Latinski: -{Ne nuntium necare}-
10860 !! result
10861 <p>Латински: Ne nuntium necare
10862 </p>
10863 !! end
10864
10865
10866 !! test
10867 Prevent conversion of text with -{}- tags (language variants)
10868 !! options
10869 language=sr variant=sr-ec
10870 !! input
10871 Latinski: -{Ne nuntium necare}-
10872 !! result
10873 <p>Латински: Ne nuntium necare
10874 </p>
10875 !! end
10876
10877
10878 !! test
10879 Prevent conversion of links with -{}- tags (language variants)
10880 !! options
10881 language=sr variant=sr-ec
10882 !! input
10883 -{[[Main Page]]}-
10884 !! result
10885 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
10886 </p>
10887 !! end
10888
10889
10890 !! test
10891 -{}- tags within headlines (within html for parserConvert())
10892 !! options
10893 language=sr variant=sr-ec
10894 !! input
10895 == -{Naslov}- ==
10896 !! result
10897 <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>
10898
10899 !! end
10900
10901
10902 !! test
10903 Explicit definition of language variant alternatives
10904 !! options
10905 language=zh variant=zh-tw
10906 !! input
10907 -{zh:China;zh-tw:Taiwan}-, not China
10908 !! result
10909 <p>Taiwan, not China
10910 </p>
10911 !! end
10912
10913
10914 !! test
10915 Explicit session-wise language variant mapping (A flag and - flag)
10916 !! options
10917 language=zh variant=zh-tw
10918 !! input
10919 Taiwan is not China.
10920 But -{A|zh:China;zh-tw:Taiwan}- is China,
10921 (This-{-|zh:China;zh-tw:Taiwan}- should be stripped!)
10922 and -{China}- is China.
10923 !! result
10924 <p>Taiwan is not China.
10925 But Taiwan is Taiwan,
10926 (This should be stripped!)
10927 and China is China.
10928 </p>
10929 !! end
10930
10931 !! test
10932 Explicit session-wise language variant mapping (H flag for hide)
10933 !! options
10934 language=zh variant=zh-tw
10935 !! input
10936 (This-{H|zh:China;zh-tw:Taiwan}- should be stripped!)
10937 Taiwan is China.
10938 !! result
10939 <p>(This should be stripped!)
10940 Taiwan is Taiwan.
10941 </p>
10942 !! end
10943
10944 !! test
10945 Adding explicit conversion rule for title (T flag)
10946 !! options
10947 language=zh variant=zh-tw showtitle
10948 !! input
10949 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
10950 !! result
10951 Taiwan
10952 <p>Should be stripped!
10953 </p>
10954 !! end
10955
10956 !! test
10957 Testing that changing the language variant here in the tests actually works
10958 !! options
10959 language=zh variant=zh showtitle
10960 !! input
10961 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
10962 !! result
10963 China
10964 <p>Should be stripped!
10965 </p>
10966 !! end
10967
10968 !! test
10969 Bug 24072: more test on conversion rule for title
10970 !! options
10971 language=zh variant=zh-tw showtitle
10972 !! input
10973 This should be stripped-{T|zh:China;zh-tw:Taiwan}-!
10974 This won't take interferes with the title rule-{H|zh:Beijing;zh-tw:Taipei}-.
10975 !! result
10976 Taiwan
10977 <p>This should be stripped!
10978 This won't take interferes with the title rule.
10979 </p>
10980 !! end
10981
10982 !! test
10983 Raw output of variant escape tags (R flag)
10984 !! options
10985 language=zh variant=zh-tw
10986 !! input
10987 Raw: -{R|zh:China;zh-tw:Taiwan}-
10988 !! result
10989 <p>Raw: zh:China;zh-tw:Taiwan
10990 </p>
10991 !! end
10992
10993 !! test
10994 Nested using of manual convert syntax
10995 !! options
10996 language=zh variant=zh-hk
10997 !! input
10998 Nested: -{zh-hans:Hi -{zh-cn:China;zh-sg:Singapore;}-;zh-hant:Hello -{zh-tw:Taiwan;zh-hk:H-{ong}- K-{}-ong;}-;}-!
10999 !! result
11000 <p>Nested: Hello Hong Kong!
11001 </p>
11002 !! end
11003
11004 !! test
11005 Proper conversion of text in external links
11006 !! options
11007 language=sr variant=sr-ec
11008 !! input
11009 http://www.google.com
11010 gopher://www.google.com
11011 [http://www.google.com http://www.google.com]
11012 [gopher://www.google.com gopher://www.google.com]
11013 [https://www.google.com irc://www.google.com]
11014 [ftp://www.google.com www.google.com/ftp://dir]
11015 [//www.google.com www.google.com]
11016 !! result
11017 <p><a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
11018 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
11019 <a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
11020 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
11021 <a rel="nofollow" class="external text" href="https://www.google.com">irc://www.google.com</a>
11022 <a rel="nofollow" class="external text" href="ftp://www.google.com">www.гоогле.цом/фтп://дир</a>
11023 <a rel="nofollow" class="external text" href="//www.google.com">www.гоогле.цом</a>
11024 </p>
11025 !! end
11026
11027 !! test
11028 Do not convert roman numbers to language variants
11029 !! options
11030 language=sr variant=sr-ec
11031 !! input
11032 Fridrih IV je car.
11033 !! result
11034 <p>Фридрих IV је цар.
11035 </p>
11036 !! end
11037
11038 !! test
11039 Unclosed language converter markup "-{"
11040 !! options
11041 language=sr
11042 !! input
11043 -{T|hello
11044 !! result
11045 <p>-{T|hello
11046 </p>
11047 !! end
11048
11049 !! test
11050 Don't convert raw rule "-{R|=&gt;}-" to "=>"
11051 !! options
11052 language=sr
11053 !! input
11054 -{R|=&gt;}-
11055 !! result
11056 <p>=&gt;
11057 </p>
11058 !!end
11059
11060 !!article
11061 Template:Bullet
11062 !!text
11063 * Bar
11064 !!endarticle
11065
11066 !! test
11067 Bug 529: Uncovered bullet
11068 !! input
11069 * Foo {{bullet}}
11070 !! result
11071 <ul><li> Foo
11072 </li><li> Bar
11073 </li></ul>
11074
11075 !! end
11076
11077 # Plain MediaWiki does not remove empty lists, but tidy actually does.
11078 # Templates in Wikipedia rely on this behavior, as tidy has always been
11079 # enabled there. These tests are normally run *without* tidy, so specify the
11080 # full output here.
11081 # To test realistic parsing behavior, apply a tidy-like transformation to both
11082 # the expected output and your parser's output.
11083 !! test
11084 Bug 529: Uncovered bullet leaving empty list, normally removed by tidy
11085 !! input
11086 ******* Foo {{bullet}}
11087 !! result
11088 <ul><li><ul><li><ul><li><ul><li><ul><li><ul><li><ul><li> Foo
11089 </li></ul>
11090 </li></ul>
11091 </li></ul>
11092 </li></ul>
11093 </li></ul>
11094 </li></ul>
11095 </li><li> Bar
11096 </li></ul>
11097
11098 !! end
11099
11100 !! test
11101 Bug 529: Uncovered table already at line-start
11102 !! input
11103 x
11104
11105 {{table}}
11106 y
11107 !! result
11108 <p>x
11109 </p>
11110 <table>
11111 <tr>
11112 <td> 1 </td>
11113 <td> 2
11114 </td></tr>
11115 <tr>
11116 <td> 3 </td>
11117 <td> 4
11118 </td></tr></table>
11119 <p>y
11120 </p>
11121 !! end
11122
11123 !! test
11124 Bug 529: Uncovered bullet in parser function result
11125 !! input
11126 * Foo {{lc:{{bullet}} }}
11127 !! result
11128 <ul><li> Foo
11129 </li><li> bar
11130 </li></ul>
11131
11132 !! end
11133
11134 !! test
11135 Bug 5678: Double-parsed template argument
11136 !! input
11137 {{lc:{{{1}}}|hello}}
11138 !! result
11139 <p>{{{1}}}
11140 </p>
11141 !! end
11142
11143 !! test
11144 Bug 5678: Double-parsed template invocation
11145 !! input
11146 {{lc:{{paramtest {{!}} param = hello }} }}
11147 !! result
11148 <p>{{paramtest | param = hello }}
11149 </p>
11150 !! end
11151
11152 !! test
11153 Case insensitivity of parser functions for non-ASCII characters (bug 8143)
11154 !! options
11155 language=cs
11156 title=[[Main Page]]
11157 !! input
11158 {{PRVNÍVELKÉ:ěščř}}
11159 {{prvnívelké:ěščř}}
11160 {{PRVNÍMALÉ:ěščř}}
11161 {{prvnímalé:ěščř}}
11162 {{MALÁ:ěščř}}
11163 {{malá:ěščř}}
11164 {{VELKÁ:ěščř}}
11165 {{velká:ěščř}}
11166 !! result
11167 <p>Ěščř
11168 Ěščř
11169 ěščř
11170 ěščř
11171 ěščř
11172 ěščř
11173 ĚŠČŘ
11174 ĚŠČŘ
11175 </p>
11176 !! end
11177
11178 !! test
11179 Morwen/13: Unclosed link followed by heading
11180 !! input
11181 [[link
11182 ==heading==
11183 !! result
11184 <p>[[link
11185 </p>
11186 <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>
11187
11188 !! end
11189
11190 !! test
11191 HHP2.1: Heuristics for headings in preprocessor parenthetical structures
11192 !! input
11193 {{foo|
11194 =heading=
11195 !! result
11196 <p>{{foo|
11197 </p>
11198 <h1> <span class="mw-headline" id="heading">heading</span></h1>
11199
11200 !! end
11201
11202 !! test
11203 HHP2.2: Heuristics for headings in preprocessor parenthetical structures
11204 !! input
11205 {{foo|
11206 ==heading==
11207 !! result
11208 <p>{{foo|
11209 </p>
11210 <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>
11211
11212 !! end
11213
11214 !! test
11215 Tildes in comments
11216 !! options
11217 pst
11218 !! input
11219 <!-- ~~~~ -->
11220 !! result
11221 <!-- ~~~~ -->
11222 !! end
11223
11224 !! test
11225 Paragraphs inside divs (no extra line breaks)
11226 !! input
11227 <div>Line one
11228
11229 Line two</div>
11230 !! result
11231 <div>Line one
11232 Line two</div>
11233
11234 !! end
11235
11236 !! test
11237 Paragraphs inside divs (extra line break on open)
11238 !! input
11239 <div>
11240 Line one
11241
11242 Line two</div>
11243 !! result
11244 <div>
11245 <p>Line one
11246 </p>
11247 Line two</div>
11248
11249 !! end
11250
11251 !! test
11252 Paragraphs inside divs (extra line break on close)
11253 !! input
11254 <div>Line one
11255
11256 Line two
11257 </div>
11258 !! result
11259 <div>Line one
11260 <p>Line two
11261 </p>
11262 </div>
11263
11264 !! end
11265
11266 !! test
11267 Paragraphs inside divs (extra line break on open and close)
11268 !! input
11269 <div>
11270 Line one
11271
11272 Line two
11273 </div>
11274 !! result
11275 <div>
11276 <p>Line one
11277 </p><p>Line two
11278 </p>
11279 </div>
11280
11281 !! end
11282
11283 !! test
11284 Nesting tags, paragraphs on lines which begin with <div>
11285 !! options
11286 disabled
11287 !! input
11288 <div></div><strong>A
11289 B</strong>
11290 !! result
11291 <div></div>
11292 <p><strong>A
11293 B</strong>
11294 </p>
11295 !! end
11296
11297 # Bug 6200: <blockquote> should behave like <div> with respect to line breaks
11298 !! test
11299 Bug 6200: paragraphs inside blockquotes (no extra line breaks)
11300 !! options
11301 disabled
11302 !! input
11303 <blockquote>Line one
11304
11305 Line two</blockquote>
11306 !! result
11307 <blockquote>Line one
11308 Line two</blockquote>
11309
11310 !! end
11311
11312 !! test
11313 Bug 6200: paragraphs inside blockquotes (extra line break on open)
11314 !! options
11315 disabled
11316 !! input
11317 <blockquote>
11318 Line one
11319
11320 Line two</blockquote>
11321 !! result
11322 <blockquote>
11323 <p>Line one
11324 </p>
11325 Line two</blockquote>
11326
11327 !! end
11328
11329 !! test
11330 Bug 6200: paragraphs inside blockquotes (extra line break on close)
11331 !! options
11332 disabled
11333 !! input
11334 <blockquote>Line one
11335
11336 Line two
11337 </blockquote>
11338 !! result
11339 <blockquote>Line one
11340 <p>Line two
11341 </p>
11342 </blockquote>
11343
11344 !! end
11345
11346 !! test
11347 Bug 6200: paragraphs inside blockquotes (extra line break on open and close)
11348 !! options
11349 disabled
11350 !! input
11351 <blockquote>
11352 Line one
11353
11354 Line two
11355 </blockquote>
11356 !! result
11357 <blockquote>
11358 <p>Line one
11359 </p><p>Line two
11360 </p>
11361 </blockquote>
11362
11363 !! end
11364
11365 !! test
11366 Paragraphs inside blockquotes/divs (no extra line breaks)
11367 !! input
11368 <blockquote><div>Line one
11369
11370 Line two</div></blockquote>
11371 !! result
11372 <blockquote><div>Line one
11373 Line two</div></blockquote>
11374
11375 !! end
11376
11377 !! test
11378 Paragraphs inside blockquotes/divs (extra line break on open)
11379 !! input
11380 <blockquote><div>
11381 Line one
11382
11383 Line two</div></blockquote>
11384 !! result
11385 <blockquote><div>
11386 <p>Line one
11387 </p>
11388 Line two</div></blockquote>
11389
11390 !! end
11391
11392 !! test
11393 Paragraphs inside blockquotes/divs (extra line break on close)
11394 !! input
11395 <blockquote><div>Line one
11396
11397 Line two
11398 </div></blockquote>
11399 !! result
11400 <blockquote><div>Line one
11401 <p>Line two
11402 </p>
11403 </div></blockquote>
11404
11405 !! end
11406
11407 !! test
11408 Paragraphs inside blockquotes/divs (extra line break on open and close)
11409 !! input
11410 <blockquote><div>
11411 Line one
11412
11413 Line two
11414 </div></blockquote>
11415 !! result
11416 <blockquote><div>
11417 <p>Line one
11418 </p><p>Line two
11419 </p>
11420 </div></blockquote>
11421
11422 !! end
11423
11424 !! test
11425 Interwiki links trounced by replaceExternalLinks after early LinkHolderArray expansion
11426 !! options
11427 wgLinkHolderBatchSize=0
11428 !! input
11429 [[meatball:1]]
11430 [[meatball:2]]
11431 [[meatball:3]]
11432 !! result
11433 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?1" class="extiw" title="meatball:1">meatball:1</a>
11434 <a href="http://www.usemod.com/cgi-bin/mb.pl?2" class="extiw" title="meatball:2">meatball:2</a>
11435 <a href="http://www.usemod.com/cgi-bin/mb.pl?3" class="extiw" title="meatball:3">meatball:3</a>
11436 </p>
11437 !! end
11438
11439 !! test
11440 Free external link invading image caption
11441 !! input
11442 [[Image:Foobar.jpg|thumb|http://x|hello]]
11443 !! result
11444 <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>
11445
11446 !! end
11447
11448 !! test
11449 Bug 15196: localised external link numbers
11450 !! options
11451 language=fa
11452 !! input
11453 [http://en.wikipedia.org/]
11454 !! result
11455 <p><a rel="nofollow" class="external autonumber" href="http://en.wikipedia.org/">[۱]</a>
11456 </p>
11457 !! end
11458
11459 !! test
11460 Multibyte character in padleft
11461 !! input
11462 {{padleft:-Hello|7|Æ}}
11463 !! result
11464 <p>Æ-Hello
11465 </p>
11466 !! end
11467
11468 !! test
11469 Multibyte character in padright
11470 !! input
11471 {{padright:Hello-|7|Æ}}
11472 !! result
11473 <p>Hello-Æ
11474 </p>
11475 !! end
11476
11477 !! test
11478 Formatted date
11479 !! config
11480 wgUseDynamicDates=1
11481 !! input
11482 [[2009-03-24]]
11483 !! result
11484 <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>
11485 </p>
11486 !!end
11487
11488 !!test
11489 formatdate parser function
11490 !!input
11491 {{#formatdate:2009-03-24}}
11492 !! result
11493 <p><span class="mw-formatted-date" title="2009-03-24">2009-03-24</span>
11494 </p>
11495 !! end
11496
11497 !!test
11498 formatdate parser function, with default format
11499 !!input
11500 {{#formatdate:2009-03-24|mdy}}
11501 !! result
11502 <p><span class="mw-formatted-date" title="2009-03-24">March 24, 2009</span>
11503 </p>
11504 !! end
11505
11506 !! test
11507 Linked date with autoformatting disabled
11508 !! config
11509 wgUseDynamicDates=false
11510 !! input
11511 [[2009-03-24]]
11512 !! result
11513 <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>
11514 </p>
11515 !! end
11516
11517 !! test
11518 Spacing of numbers in formatted dates
11519 !! input
11520 {{#formatdate:January 15}}
11521 !! result
11522 <p><span class="mw-formatted-date" title="01-15">January 15</span>
11523 </p>
11524 !! end
11525
11526 !! test
11527 Spacing of numbers in formatted dates (linked)
11528 !! config
11529 wgUseDynamicDates=true
11530 !! input
11531 [[January 15]]
11532 !! result
11533 <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>
11534 </p>
11535 !! end
11536
11537 !! test
11538 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
11539 !! options
11540 language=nl title=[[MediaWiki:Common.css]]
11541 !! input
11542 {{#formatdate:2009-03-24|dmy}}
11543 !! result
11544 <p><span class="mw-formatted-date" title="2009-03-24">24 March 2009</span>
11545 </p>
11546 !! end
11547
11548 #
11549 #
11550 #
11551
11552 #
11553 # Edit comments
11554 #
11555
11556 !! test
11557 Edit comment with link
11558 !! options
11559 comment
11560 !! input
11561 I like the [[Main Page]] a lot
11562 !! result
11563 I like the <a href="/wiki/Main_Page" title="Main Page">Main Page</a> a lot
11564 !!end
11565
11566 !! test
11567 Edit comment with link and link text
11568 !! options
11569 comment
11570 !! input
11571 I like the [[Main Page|best pages]] a lot
11572 !! result
11573 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
11574 !!end
11575
11576 !! test
11577 Edit comment with link and link text with suffix
11578 !! options
11579 comment
11580 !! input
11581 I like the [[Main Page|best page]]s a lot
11582 !! result
11583 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
11584 !!end
11585
11586 !! test
11587 Edit comment with section link (non-local, eg in history list)
11588 !! options
11589 comment title=[[Main Page]]
11590 !! input
11591 /* External links */ removed bogus entries
11592 !! result
11593 <a href="/wiki/Main_Page#External_links" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
11594 !!end
11595
11596 !! test
11597 Edit comment with section link and text before it (non-local, eg in history list)
11598 !! options
11599 comment title=[[Main Page]]
11600 !! input
11601 pre-comment text /* External links */ removed bogus entries
11602 !! result
11603 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>
11604 !!end
11605
11606 !! test
11607 Edit comment with section link (local, eg in diff view)
11608 !! options
11609 comment local title=[[Main Page]]
11610 !! input
11611 /* External links */ removed bogus entries
11612 !! result
11613 <a href="#External_links">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
11614 !!end
11615
11616 !! test
11617 Edit comment with subpage link (bug 14080)
11618 !! options
11619 comment
11620 subpage
11621 title=[[Subpage test]]
11622 !! input
11623 Poked at a [[/subpage]] here...
11624 !! result
11625 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a> here...
11626 !!end
11627
11628 !! test
11629 Edit comment with subpage link and link text (bug 14080)
11630 !! options
11631 comment
11632 subpage
11633 title=[[Subpage test]]
11634 !! input
11635 Poked at a [[/subpage|neat little page]] here...
11636 !! result
11637 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">neat little page</a> here...
11638 !!end
11639
11640 !! test
11641 Edit comment with bogus subpage link in non-subpage NS (bug 14080)
11642 !! options
11643 comment
11644 title=[[Subpage test]]
11645 !! input
11646 Poked at a [[/subpage]] here...
11647 !! result
11648 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...
11649 !!end
11650
11651 !! test
11652 Edit comment with bare anchor link (local, as on diff)
11653 !! options
11654 comment
11655 local
11656 title=[[Main Page]]
11657 !!input
11658 [[#section]]
11659 !! result
11660 <a href="#section">#section</a>
11661 !! end
11662
11663 !! test
11664 Edit comment with bare anchor link (non-local, as on history)
11665 !! options
11666 comment
11667 title=[[Main Page]]
11668 !!input
11669 [[#section]]
11670 !! result
11671 <a href="/wiki/Main_Page#section" title="Main Page">#section</a>
11672 !! end
11673
11674 !! test
11675 Anchor starting with underscore
11676 !!input
11677 [[#_ref|One]]
11678 !! result
11679 <p><a href="#_ref">One</a>
11680 </p>
11681 !! end
11682
11683 !! test
11684 Id starting with underscore
11685 !!input
11686 <div id="_ref"></div>
11687 !! result
11688 <div id="_ref"></div>
11689
11690 !! end
11691
11692 !! test
11693 Space normalisation on autocomment (bug 22784)
11694 !! options
11695 comment
11696 title=[[Main Page]]
11697 !!input
11698 /* __hello__world__ */
11699 !! result
11700 <a href="/wiki/Main_Page#hello_world" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">__hello__world__</span></span>
11701 !! end
11702
11703 !! test
11704 percent-encoding and + signs in comments (Bug 26410)
11705 !! options
11706 comment
11707 !!input
11708 [[ABC%33D% ++]] [[ABC%33D% ++|+%20]]
11709 !! result
11710 <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>
11711 !! end
11712
11713 !! test
11714 Bad images - basic functionality
11715 !! options
11716 disabled
11717 !! input
11718 [[File:Bad.jpg]]
11719 !! result
11720 !! end
11721
11722 !! test
11723 Bad images - bug 16039: text after bad image disappears
11724 !! options
11725 disabled
11726 !! input
11727 Foo bar
11728 [[File:Bad.jpg]]
11729 Bar foo
11730 !! result
11731 <p>Foo bar
11732 </p><p>Bar foo
11733 </p>
11734 !! end
11735
11736 !! test
11737 Verify that displaytitle works (bug #22501) no displaytitle
11738 !! options
11739 showtitle
11740 !! config
11741 wgAllowDisplayTitle=true
11742 wgRestrictDisplayTitle=false
11743 !! input
11744 this is not the the title
11745 !! result
11746 Parser test
11747 <p>this is not the the title
11748 </p>
11749 !! end
11750
11751 !! test
11752 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=false
11753 !! options
11754 showtitle
11755 title=[[Screen]]
11756 !! config
11757 wgAllowDisplayTitle=true
11758 wgRestrictDisplayTitle=false
11759 !! input
11760 this is not the the title
11761 {{DISPLAYTITLE:whatever}}
11762 !! result
11763 whatever
11764 <p>this is not the the title
11765 </p>
11766 !! end
11767
11768 !! test
11769 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true mismatch
11770 !! options
11771 showtitle
11772 title=[[Screen]]
11773 !! config
11774 wgAllowDisplayTitle=true
11775 wgRestrictDisplayTitle=true
11776 !! input
11777 this is not the the title
11778 {{DISPLAYTITLE:whatever}}
11779 !! result
11780 Screen
11781 <p>this is not the the title
11782 </p>
11783 !! end
11784
11785 !! test
11786 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true matching
11787 !! options
11788 showtitle
11789 title=[[Screen]]
11790 !! config
11791 wgAllowDisplayTitle=true
11792 wgRestrictDisplayTitle=true
11793 !! input
11794 this is not the the title
11795 {{DISPLAYTITLE:screen}}
11796 !! result
11797 screen
11798 <p>this is not the the title
11799 </p>
11800 !! end
11801
11802 !! test
11803 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false
11804 !! options
11805 showtitle
11806 title=[[Screen]]
11807 !! config
11808 wgAllowDisplayTitle=false
11809 !! input
11810 this is not the the title
11811 {{DISPLAYTITLE:screen}}
11812 !! result
11813 Screen
11814 <p>this is not the the title
11815 <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>
11816 </p>
11817 !! end
11818
11819 !! test
11820 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false no DISPLAYTITLE
11821 !! options
11822 showtitle
11823 title=[[Screen]]
11824 !! config
11825 wgAllowDisplayTitle=false
11826 !! input
11827 this is not the the title
11828 !! result
11829 Screen
11830 <p>this is not the the title
11831 </p>
11832 !! end
11833
11834 !! test
11835 preload: check <noinclude> and <includeonly>
11836 !! options
11837 preload
11838 !! input
11839 Hello <noinclude>cruel</noinclude><includeonly>kind</includeonly> world.
11840 !! result
11841 Hello kind world.
11842 !! end
11843
11844 !! test
11845 preload: check <onlyinclude>
11846 !! options
11847 preload
11848 !! input
11849 Goodbye <onlyinclude>Hello world</onlyinclude>
11850 !! result
11851 Hello world
11852 !! end
11853
11854 !! test
11855 preload: can pass tags through if we want to
11856 !! options
11857 preload
11858 !! input
11859 <includeonly><</includeonly>includeonly>Hello world<includeonly><</includeonly>/includeonly>
11860 !! result
11861 <includeonly>Hello world</includeonly>
11862 !! end
11863
11864 !! test
11865 preload: check that it doesn't try to do tricks
11866 !! options
11867 preload
11868 !! input
11869 * <!-- Hello --> ''{{world}}'' {{<includeonly>subst:</includeonly>How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
11870 !! result
11871 * <!-- Hello --> ''{{world}}'' {{subst:How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
11872 !! end
11873
11874 !! test
11875 Play a bit with r67090 and bug 3158
11876 !! options
11877 disabled
11878 !! input
11879 <div style="width:50% !important">&nbsp;</div>
11880 <div style="width:50%&nbsp;!important">&nbsp;</div>
11881 <div style="width:50%&#160;!important">&nbsp;</div>
11882 <div style="border : solid;">&nbsp;</div>
11883 !! result
11884 <div style="width:50% !important">&nbsp;</div>
11885 <div style="width:50% !important">&nbsp;</div>
11886 <div style="width:50% !important">&nbsp;</div>
11887 <div style="border&#160;: solid;">&nbsp;</div>
11888
11889 !! end
11890
11891 !! test
11892 HTML5 data attributes
11893 !! input
11894 <span data-foo="bar">Baz</span>
11895 <p data-abc-def_hij="">Quuz</p>
11896 !! result
11897 <p><span data-foo="bar">Baz</span>
11898 </p>
11899 <p data-abc-def_hij="">Quuz</p>
11900
11901 !! end
11902
11903 !! test
11904 percent-encoding and + signs in internal links (Bug 26410)
11905 !! input
11906 [[User:+%]] [[Page+title%]]
11907 [[%+]] [[%+|%20]] [[%+ ]] [[%+r]]
11908 [[%]] [[+]] [[image:%+abc%39|foo|[[bar]]]]
11909 [[%33%45]] [[%33%45+]]
11910 !! result
11911 <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>
11912 <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>
11913 <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>
11914 <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>
11915 </p>
11916 !! end
11917
11918 !! test
11919 Special characters in embedded file links (bug 27679)
11920 !! input
11921 [[File:Contains & ampersand.jpg]]
11922 [[File:Does not exist.jpg|Title with & ampersand]]
11923 !! result
11924 <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>
11925 <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>
11926 </p>
11927 !! end
11928
11929
11930 !! test
11931 Confirm that 'apos' named character reference doesn't make it to output (not legal in HTML 4)
11932 !! input
11933 Text&apos;s been normalized?
11934 !! result
11935 <p>Text&#39;s been normalized?
11936 </p>
11937 !! end
11938
11939 !! test
11940 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate free external links
11941 !! input
11942 http://www.example.org/ <-- U+3000 (vim: ^Vu3000)
11943 !! result
11944 <p><a rel="nofollow" class="external free" href="http://www.example.org/">http://www.example.org/</a> &lt;-- U+3000 (vim: ^Vu3000)
11945 </p>
11946 !! end
11947
11948 !! test
11949 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate bracketed external links
11950 !! input
11951 [http://www.example.org/ ideograms]
11952 !! result
11953 <p><a rel="nofollow" class="external text" href="http://www.example.org/">ideograms</a>
11954 </p>
11955 !! end
11956
11957 !! test
11958 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate external images links
11959 !! input
11960 http://www.example.org/pic.png <-- U+3000 (vim: ^Vu3000)
11961 !! result
11962 <p><img src="http://www.example.org/pic.png" alt="pic.png" /> &lt;-- U+3000 (vim: ^Vu3000)
11963 </p>
11964 !! end
11965
11966 !! article
11967 Mediawiki:loop1
11968 !! text
11969 {{Identical|A}}
11970 !! endarticle
11971
11972 !! article
11973 Mediawiki:loop2
11974 !! text
11975 {{Identical|B}}
11976 !! endarticle
11977
11978 !! article
11979 Template:Identical
11980 !! text
11981 {{int:loop1}}
11982 {{int:loop2}}
11983 !! endarticle
11984
11985 !! test
11986 Bug 31098 Template which includes system messages which includes the template
11987 !! input
11988 {{Identical}}
11989 !! result
11990 <p><span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
11991 <span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
11992 </p>
11993 !! end
11994
11995 !! test
11996 Bug31490 Turkish: ucfirst 'blah'
11997 !! options
11998 language=tr
11999 !! input
12000 {{ucfirst:blah}}
12001 !! result
12002 <p>Blah
12003 </p>
12004 !! end
12005
12006 !! test
12007 Bug31490 Turkish: ucfirst 'ix'
12008 !! options
12009 language=tr
12010 !! input
12011 {{ucfirst:ix}}
12012 !! result
12013 <p>İx
12014 </p>
12015 !! end
12016
12017 !! test
12018 Bug31490 Turkish: lcfirst 'BLAH'
12019 !! options
12020 language=tr
12021 !! input
12022 {{lcfirst:BLAH}}
12023 !! result
12024 <p>bLAH
12025 </p>
12026 !! end
12027
12028 !! test
12029 Bug31490 Turkish: ucfırst (with a dotless i)
12030 !! options
12031 language=tr
12032 !! input
12033 {{ucfırst:blah}}
12034 !! result
12035 <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>
12036 </p>
12037 !! end
12038
12039 !! test
12040 Bug31490 ucfırst (with a dotless i) with English language
12041 !! options
12042 language=en
12043 !! input
12044 {{ucfırst:blah}}
12045 !! result
12046 <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>
12047 </p>
12048 !! end
12049
12050 !! test
12051 Bug 26375: TOC with italics
12052 !! options
12053 title=[[Main Page]]
12054 !! input
12055 __TOC__
12056 == ''Lost'' episodes ==
12057 !! result
12058 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
12059 <ul>
12060 <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>
12061 </ul>
12062 </td></tr></table>
12063 <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>
12064
12065 !! end
12066
12067 !! test
12068 Bug 26375: TOC with bold
12069 !! options
12070 title=[[Main Page]]
12071 !! input
12072 __TOC__
12073 == '''should be bold''' then normal text ==
12074 !! result
12075 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
12076 <ul>
12077 <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>
12078 </ul>
12079 </td></tr></table>
12080 <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>
12081
12082 !! end
12083
12084 !! test
12085 Bug 33845: Headings become cursive in TOC when they contain an image
12086 !! options
12087 title=[[Main Page]]
12088 !! input
12089 __TOC__
12090 == Image [[Image:foobar.jpg]] ==
12091 !! result
12092 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
12093 <ul>
12094 <li class="toclevel-1 tocsection-1"><a href="#Image"><span class="tocnumber">1</span> <span class="toctext">Image</span></a></li>
12095 </ul>
12096 </td></tr></table>
12097 <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>
12098
12099 !! end
12100
12101 !! test
12102 Bug 33845 (2): Headings become bold in TOC when they contain a blockquote
12103 !! options
12104 title=[[Main Page]]
12105 !! input
12106 __TOC__
12107 == <blockquote>Quote</blockquote> ==
12108 !! result
12109 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
12110 <ul>
12111 <li class="toclevel-1 tocsection-1"><a href="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
12112 </ul>
12113 </td></tr></table>
12114 <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>
12115
12116 !! end
12117
12118 !! test
12119 Unclosed tags in TOC
12120 !! options
12121 title=[[Main Page]]
12122 !! input
12123 __TOC__
12124 == Proof: 2 < 3 ==
12125 <small>Hanc marginis exiguitas non caperet.</small>
12126 QED
12127 !! result
12128 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
12129 <ul>
12130 <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>
12131 </ul>
12132 </td></tr></table>
12133 <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>
12134 <p><small>Hanc marginis exiguitas non caperet.</small>
12135 QED
12136 </p>
12137 !! end
12138
12139 !! test
12140 Multiple tags in TOC
12141 !! input
12142 __TOC__
12143 == <i>Foo</i> <b>Bar</b> ==
12144
12145 == <i>Foo</i> <blockquote>Bar</blockquote> ==
12146 !! result
12147 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
12148 <ul>
12149 <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>
12150 <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>
12151 </ul>
12152 </td></tr></table>
12153 <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>
12154 <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>
12155
12156 !! end
12157
12158 !! test
12159 Tags with parameters in TOC
12160 !! input
12161 __TOC__
12162 == <sup class="in-h2">Hello</sup> ==
12163
12164 == <sup class="a > b">Evilbye</sup> ==
12165 !! result
12166 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
12167 <ul>
12168 <li class="toclevel-1 tocsection-1"><a href="#Hello"><span class="tocnumber">1</span> <span class="toctext"><sup>Hello</sup></span></a></li>
12169 <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>
12170 </ul>
12171 </td></tr></table>
12172 <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>
12173 <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>
12174
12175 !! end
12176
12177 !! test
12178 span tags with directionality in TOC
12179 !! input
12180 __TOC__
12181 == <span dir="ltr">C++</span> ==
12182
12183 == <span dir="rtl">זבנג!</span> ==
12184
12185 == <span style="font-style: italic">The attributes on these span tags must be deleted from the TOC</span> ==
12186
12187 == <span style="font-style: italic" dir="ltr">All attributes on these span tags must be deleted from the TOC</span> ==
12188
12189 == <span dir="ltr" style="font-style: italic">Attributes after dir on these span tags must be deleted from the TOC</span> ==
12190 !! result
12191 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
12192 <ul>
12193 <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>
12194 <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>
12195 <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>
12196 <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>
12197 <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>
12198 </ul>
12199 </td></tr></table>
12200 <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>
12201 <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>
12202 <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>
12203 <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>
12204 <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>
12205
12206 !! end
12207
12208 !! article
12209 MediaWiki:Bug32057
12210 !! text
12211 == {{int:headline_sample}} ==
12212 !! endarticle
12213
12214 !! test
12215 Bug 32057: Title needed when expanding <h> nodes.
12216 !! options
12217 title=[[Main Page]]
12218 !! input
12219 {{int:Bug32057}}
12220 !! result
12221 <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>
12222
12223 !! end
12224
12225 !! test
12226 Strip marker in urlencode
12227 !! input
12228 {{urlencode:x<nowiki/>y}}
12229 {{urlencode:x<nowiki/>y|wiki}}
12230 {{urlencode:x<nowiki/>y|path}}
12231 !! result
12232 <p>xy
12233 xy
12234 xy
12235 </p>
12236 !! end
12237
12238 !! test
12239 Strip marker in lc
12240 !! input
12241 {{lc:x<nowiki/>y}}
12242 !! result
12243 <p>xy
12244 </p>
12245 !! end
12246
12247 !! test
12248 Strip marker in uc
12249 !! input
12250 {{uc:x<nowiki/>y}}
12251 !! result
12252 <p>XY
12253 </p>
12254 !! end
12255
12256 !! test
12257 Strip marker in formatNum
12258 !! input
12259 {{formatnum:1<nowiki/>2}}
12260 {{formatnum:1<nowiki/>2|R}}
12261 !! result
12262 <p>12
12263 12
12264 </p>
12265 !! end
12266
12267 !! test
12268 Strip marker in grammar
12269 !! options
12270 language=fi
12271 !! input
12272 {{grammar:elative|foo<nowiki/>bar}}
12273 !! result
12274 <p>foobarista
12275 </p>
12276 !! end
12277
12278 !! test
12279 Strip marker in padleft
12280 !! input
12281 {{padleft:|2|x<nowiki/>y}}
12282 !! result
12283 <p>xy
12284 </p>
12285 !! end
12286
12287 !! test
12288 Strip marker in padright
12289 !! input
12290 {{padright:|2|x<nowiki/>y}}
12291 !! result
12292 <p>xy
12293 </p>
12294 !! end
12295
12296 !! test
12297 Strip marker in anchorencode
12298 !! input
12299 {{anchorencode:x<nowiki/>y}}
12300 !! result
12301 <p>xy
12302 </p>
12303 !! end
12304
12305 !! test
12306 nowiki inside link inside heading (bug 18295)
12307 !! input
12308 ==[[foo|x<nowiki>y</nowiki>z]]==
12309 !! result
12310 <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>
12311
12312 !! end
12313
12314 !! test
12315 new support for bdi element (bug 31817)
12316 !! input
12317 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
12318 !! result
12319 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
12320
12321 !!end
12322
12323 !! test
12324 Ignore pipe between table row attributes
12325 !! input
12326 {|
12327 | quux
12328 |- id=foo | style='color: red'
12329 | bar
12330 |}
12331 !! result
12332 <table>
12333 <tr>
12334 <td> quux
12335 </td></tr>
12336 <tr id="foo" style="color: red">
12337 <td> bar
12338 </td></tr></table>
12339
12340 !! end
12341
12342 !!test
12343 Gallery override link with WikiLink (bug 34852)
12344 !! input
12345 <gallery>
12346 File:foobar.jpg|caption|alt=galleryalt|link=InterWikiLink
12347 </gallery>
12348 !! result
12349 <ul class="gallery">
12350 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
12351 <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>
12352 <div class="gallerytext">
12353 <p>caption
12354 </p>
12355 </div>
12356 </div></li>
12357 </ul>
12358
12359 !! end
12360
12361 !!test
12362 Gallery override link with absolute external link (bug 34852)
12363 !! input
12364 <gallery>
12365 File:foobar.jpg|caption|alt=galleryalt|link=http://www.example.org
12366 </gallery>
12367 !! result
12368 <ul class="gallery">
12369 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
12370 <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>
12371 <div class="gallerytext">
12372 <p>caption
12373 </p>
12374 </div>
12375 </div></li>
12376 </ul>
12377
12378 !! end
12379
12380 !!test
12381 Gallery override link with malicious javascript (bug 34852)
12382 !! input
12383 <gallery>
12384 File:foobar.jpg|caption|alt=galleryalt|link=" onclick="alert('malicious javascript code!');
12385 </gallery>
12386 !! result
12387 <ul class="gallery">
12388 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
12389 <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>
12390 <div class="gallerytext">
12391 <p>caption
12392 </p>
12393 </div>
12394 </div></li>
12395 </ul>
12396
12397 !! end
12398
12399 !!test
12400 Language parser function
12401 !! input
12402 {{#language:ar}}
12403 !! result
12404 <p>العربية
12405 </p>
12406 !! end
12407
12408 !!test
12409 Padleft and padright as substr
12410 !! input
12411 {{padleft:|3|abcde}}
12412 {{padright:|3|abcde}}
12413 !! result
12414 <p>abc
12415 abc
12416 </p>
12417 !! end
12418
12419 !!test
12420 Bug 34939 - Case insensitive link parsing ([HttP://])
12421 !! input
12422 [HttP://MediaWiki.Org/]
12423 !! result
12424 <p><a rel="nofollow" class="external autonumber" href="HttP://MediaWiki.Org/">[1]</a>
12425 </p>
12426 !! end
12427
12428 !!test
12429 Bug 34939 - Case insensitive link parsing ([HttP:// title])
12430 !! input
12431 [HttP://MediaWiki.Org/ MediaWiki]
12432 !! result
12433 <p><a rel="nofollow" class="external text" href="HttP://MediaWiki.Org/">MediaWiki</a>
12434 </p>
12435 !! end
12436
12437 !!test
12438 Bug 34939 - Case insensitive link parsing (HttP://)
12439 !! input
12440 HttP://MediaWiki.Org/
12441 !! result
12442 <p><a rel="nofollow" class="external free" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a>
12443 </p>
12444 !! end
12445
12446 ###
12447 ### Parsoids-specific tests
12448 ### Parsoid-PHP parser incompatibilities
12449 ###
12450 !!test
12451 1. SOL-sensitive wikitext tokens as template-args
12452 !!options
12453 disabled
12454 !!input
12455 {{echo|*a}}
12456 {{echo|#a}}
12457 {{echo|:a}}
12458 !!result
12459 <p>*a
12460 #a
12461 :a
12462 </p>
12463 !!end
12464
12465 #### The following section of tests are primarily to test
12466 #### wikitext escaping capabilities of Parsoid.
12467 #### A lot of the tests are disabled for the PHP parser either
12468 #### because of minor newline diffs or other reasons.
12469 #### As Parsoid serializer can handle newlines and other HTML
12470 #### more robustly, some of these tests might get reenabled
12471 #### for the PHP parser.
12472
12473 #### --------------- Headings ---------------
12474 #### 0. Unnested
12475 #### 1. Nested inside html <h1>=foo=</h1>
12476 #### 2. Outside heading nest on a single line <h1>foo</h1>*bar
12477 #### 3. Nested inside html with wikitext split by html tags
12478 #### 4. No escape needed
12479 #### 5. Empty headings <h1></h1>
12480 #### 6. Heading chars in SOL context
12481 #### ----------------------------------------
12482 !! test
12483 Headings: 0. Unnested
12484 !! input
12485 <nowiki>=foo=</nowiki>
12486
12487 <nowiki>=foo</nowiki>''a''=
12488 !! result
12489 <p>=foo=
12490 </p><p>=foo<i>a</i>=
12491 </p>
12492 !!end
12493
12494 !! test
12495 Headings: 1. Nested inside html
12496 !! options
12497 disabled
12498 !! input
12499 =<nowiki>=foo=</nowiki>=
12500 ==<nowiki>=foo=</nowiki>==
12501 ===<nowiki>=foo=</nowiki>===
12502 ====<nowiki>=foo=</nowiki>====
12503 =====<nowiki>=foo=</nowiki>=====
12504 ======<nowiki>=foo=</nowiki>======
12505 !! result
12506 <h1>=foo=</h1>
12507 <h2>=foo=</h2>
12508 <h3>=foo=</h3>
12509 <h4>=foo=</h4>
12510 <h5>=foo=</h5>
12511 <h6>=foo=</h6>
12512 !!end
12513
12514 !! test
12515 Headings: 2. Outside heading nest on a single line <h1>foo</h1>*bar
12516 !! options
12517 disabled
12518 !! input
12519 =foo=
12520 <nowiki>*bar</nowiki>
12521 =foo=
12522 =bar
12523 =foo=
12524 <nowiki>=bar=</nowiki>
12525 !! result
12526 <h1>foo</h1>*bar
12527 <h1>foo</h1>=bar
12528 <h1>foo</h1>=bar=
12529 !!end
12530
12531 !! test
12532 Headings: 3. Nested inside html with wikitext split by html tags
12533 !! options
12534 disabled
12535 !! input
12536 =<nowiki>=</nowiki>'''bold'''foo==
12537 !! result
12538 <h1>=<b>bold</b>foo=</h1>
12539 !!end
12540
12541 !! test
12542 Headings: 4. No escaping needed (testing just h1 and h2)
12543 !! options
12544 disabled
12545 !! input
12546 ==foo=
12547 =foo==
12548 ===foo==
12549 ==foo===
12550 =''=''foo==
12551 ===
12552 !! result
12553 <h1>=foo</h1>
12554 <h1>foo=</h1>
12555 <h2>=foo</h2>
12556 <h2>foo=</h2>
12557 <h1><i>=</i>foo=</h1>
12558 <h1>=</h1>
12559 !!end
12560
12561 !! test
12562 Headings: 5. Empty headings
12563 !! options
12564 disabled
12565 !! input
12566 =<nowiki></nowiki>=
12567 ==<nowiki></nowiki>==
12568 ===<nowiki></nowiki>===
12569 ====<nowiki></nowiki>====
12570 =====<nowiki></nowiki>=====
12571 ======<nowiki></nowiki>======
12572 !! result
12573 <h1></h1>
12574 <h2></h2>
12575 <h3></h3>
12576 <h4></h4>
12577 <h5></h5>
12578 <h6></h6>
12579 !!end
12580
12581 !! test
12582 Headings: 6. Heading chars in SOL context
12583 !! options
12584 disabled
12585 !! input
12586 <!--cmt--><nowiki>=h1=</nowiki>
12587 !! result
12588 <p><!--cmt-->=h1=
12589 </p>
12590 !!end
12591
12592 #### --------------- Lists ---------------
12593 #### 0. Outside nests (*foo, etc.)
12594 #### 1. Nested inside html <ul><li>*foo</li></ul>
12595 #### 2. Inside definition lists
12596 #### 3. Only bullets at start should be escaped
12597 #### 4. No escapes needed
12598 #### 5. No unnecessary escapes
12599 #### 6. Escape bullets in SOL position
12600 #### 7. Escape bullets in a multi-line context
12601 #### ----------------------------------------
12602
12603 !! test
12604 Lists: 0. Outside nests
12605 !! input
12606 <nowiki>*foo</nowiki>
12607
12608 <nowiki>#foo</nowiki>
12609 !! result
12610 <p>*foo
12611 </p><p>#foo
12612 </p>
12613 !!end
12614
12615 !! test
12616 Lists: 1. Nested inside html
12617 !! input
12618 *<nowiki>*foo</nowiki>
12619
12620 *<nowiki>#foo</nowiki>
12621
12622 *<nowiki>:foo</nowiki>
12623
12624 *<nowiki>;foo</nowiki>
12625
12626 #<nowiki>*foo</nowiki>
12627
12628 #<nowiki>#foo</nowiki>
12629
12630 #<nowiki>:foo</nowiki>
12631
12632 #<nowiki>;foo</nowiki>
12633 !! result
12634 <ul><li>*foo
12635 </li></ul>
12636 <ul><li>#foo
12637 </li></ul>
12638 <ul><li>:foo
12639 </li></ul>
12640 <ul><li>;foo
12641 </li></ul>
12642 <ol><li>*foo
12643 </li></ol>
12644 <ol><li>#foo
12645 </li></ol>
12646 <ol><li>:foo
12647 </li></ol>
12648 <ol><li>;foo
12649 </li></ol>
12650
12651 !!end
12652
12653 !! test
12654 Lists: 2. Inside definition lists
12655 !! input
12656 ;<nowiki>;foo</nowiki>
12657
12658 ;<nowiki>:foo</nowiki>
12659
12660 ;<nowiki>:foo</nowiki>
12661 :bar
12662
12663 :<nowiki>:foo</nowiki>
12664 !! result
12665 <dl><dt>;foo
12666 </dt></dl>
12667 <dl><dt>:foo
12668 </dt></dl>
12669 <dl><dt>:foo
12670 </dt><dd>bar
12671 </dd></dl>
12672 <dl><dd>:foo
12673 </dd></dl>
12674
12675 !!end
12676
12677 !! test
12678 Lists: 3. Only bullets at start of text should be escaped
12679 !! input
12680 *<nowiki>*foo*bar</nowiki>
12681
12682 *<nowiki>*foo</nowiki>''it''*bar
12683 !! result
12684 <ul><li>*foo*bar
12685 </li></ul>
12686 <ul><li>*foo<i>it</i>*bar
12687 </li></ul>
12688
12689 !!end
12690
12691 !! test
12692 Lists: 4. No escapes needed
12693 !! options
12694 disabled
12695 !! input
12696 *foo*bar
12697
12698 *''foo''*bar
12699
12700 *[[Foo]]: bar
12701 !! result
12702 <ul><li>foo*bar
12703 </li></ul>
12704 <ul><li><i>foo</i>*bar
12705 </li></ul>
12706 <ul><li><a href="Foo" rel="mw:WikiLink">Foo</a>: bar
12707 </li></ul>
12708 !!end
12709
12710 !! test
12711 Lists: 5. No unnecessary escapes
12712 !! input
12713 * bar <span><nowiki>[[foo]]</nowiki></span>
12714
12715 *=bar <span><nowiki>[[foo]]</nowiki></span>
12716
12717 *[[bar <span><nowiki>[[foo]]</nowiki></span>
12718
12719 *<nowiki>]]bar </nowiki><span><nowiki>[[foo]]</nowiki></span>
12720
12721 *=bar <span>foo]]</span>=
12722 !! result
12723 <ul><li> bar <span>[[foo]]</span>
12724 </li></ul>
12725 <ul><li>=bar <span>[[foo]]</span>
12726 </li></ul>
12727 <ul><li>[[bar <span>[[foo]]</span>
12728 </li></ul>
12729 <ul><li>]]bar <span>[[foo]]</span>
12730 </li></ul>
12731 <ul><li>=bar <span>foo]]</span>=
12732 </li></ul>
12733
12734 !!end
12735
12736 !! test
12737 Lists: 6. Escape bullets in SOL position
12738 !! options
12739 disabled
12740 !! input
12741 <!--cmt--><nowiki>*foo</nowiki>
12742 !! result
12743 <p><!--cmt-->*foo
12744 </p>
12745 !!end
12746
12747 !! test
12748 Lists: 7. Escape bullets in a multi-line context
12749 !! input
12750 <nowiki>a
12751 *b</nowiki>
12752 !! result
12753 <p>a
12754 *b
12755 </p>
12756 !!end
12757
12758 #### --------------- HRs ---------------
12759 #### 1. Single line
12760 #### -----------------------------------
12761
12762 !! test
12763 HRs: 1. Single line
12764 !! options
12765 disabled
12766 !! input
12767 ----
12768 <nowiki>----</nowiki>
12769 ----
12770 <nowiki>=foo=</nowiki>
12771 ----
12772 <nowiki>*foo</nowiki>
12773 !! result
12774 <hr/>----
12775 <hr/>=foo=
12776 <hr/>*foo
12777 !! end
12778
12779 #### --------------- Tables ---------------
12780 #### 1a. Simple example
12781 #### 1b. No escaping needed (!foo)
12782 #### 1c. No escaping needed (|foo)
12783 #### 1d. No escaping needed (|}foo)
12784 ####
12785 #### 2a. Nested in td (<td>foo|bar</td>)
12786 #### 2b. Nested in td (<td>foo||bar</td>)
12787 #### 2c. Nested in td -- no escaping needed(<td>foo!!bar</td>)
12788 ####
12789 #### 3a. Nested in th (<th>foo!bar</th>)
12790 #### 3b. Nested in th (<th>foo!!bar</th>)
12791 #### 3c. Nested in th -- no escaping needed(<th>foo||bar</th>)
12792 ####
12793 #### 4a. Escape -
12794 #### 4b. Escape +
12795 #### 4c. No escaping needed
12796 #### --------------------------------------
12797
12798 !! test
12799 Tables: 1a. Simple example
12800 !! input
12801 <nowiki>{|
12802 |}</nowiki>
12803 !! result
12804 <p>{|
12805 |}
12806 </p>
12807 !! end
12808
12809 !! test
12810 Tables: 1b. No escaping needed
12811 !! input
12812 !foo
12813 !! result
12814 <p>!foo
12815 </p>
12816 !! end
12817
12818 !! test
12819 Tables: 1c. No escaping needed
12820 !! input
12821 |foo
12822 !! result
12823 <p>|foo
12824 </p>
12825 !! end
12826
12827 !! test
12828 Tables: 1d. No escaping needed
12829 !! input
12830 |}foo
12831 !! result
12832 <p>|}foo
12833 </p>
12834 !! end
12835
12836 !! test
12837 Tables: 2a. Nested in td
12838 !! options
12839 disabled
12840 !! input
12841 {|
12842 |<nowiki>foo|bar</nowiki>
12843 |}
12844 !! result
12845 <table>
12846 <tr><td>foo|bar
12847 </td></tr></table>
12848
12849 !! end
12850
12851 !! test
12852 Tables: 2b. Nested in td
12853 !! options
12854 disabled
12855 !! input
12856 {|
12857 |<nowiki>foo||bar</nowiki>
12858 |''it''<nowiki>foo||bar</nowiki>
12859 |}
12860 !! result
12861 <table>
12862 <tr><td>foo||bar
12863 </td><td><i>it</i>foo||bar
12864 </td></tr></table>
12865
12866 !! end
12867
12868 !! test
12869 Tables: 2c. Nested in td -- no escaping needed
12870 !! options
12871 disabled
12872 !! input
12873 {|
12874 |foo!!bar
12875 |}
12876 !! result
12877 <table>
12878 <tr><td>foo!!bar
12879 </td></tr></table>
12880
12881 !! end
12882
12883 !! test
12884 Tables: 3a. Nested in th
12885 !! options
12886 disabled
12887 !! input
12888 {|
12889 !foo!bar
12890 |}
12891 !! result
12892 <table>
12893 <tr><th>foo!bar
12894 </th></tr></table>
12895
12896 !! end
12897
12898 !! test
12899 Tables: 3b. Nested in th
12900 !! options
12901 disabled
12902 !! input
12903 {|
12904 !<nowiki>foo!!bar</nowiki>
12905 |}
12906 !! result
12907 <table>
12908 <tr><th>foo!!bar
12909 </th></tr></table>
12910
12911 !! end
12912
12913 !! test
12914 Tables: 3c. Nested in th -- no escaping needed
12915 !! options
12916 disabled
12917 !! input
12918 {|
12919 !foo||bar
12920 |}
12921 !! result
12922 <table>
12923 <tr><th>foo||bar
12924 </th></tr></table>
12925
12926 !! end
12927
12928 !! test
12929 Tables: 4a. Escape -
12930 !! options
12931 disabled
12932 !! input
12933 {|
12934 |-
12935 !-bar
12936 |-
12937 |<nowiki>-bar</nowiki>
12938 |}
12939 !! result
12940 <table><tbody>
12941 <tr><th>-bar</th></tr>
12942 <tr><td>-bar</td></tr>
12943 </tbody></table>
12944 !! end
12945
12946 !! test
12947 Tables: 4b. Escape +
12948 !! options
12949 disabled
12950 !! input
12951 {|
12952 |-
12953 !+bar
12954 |-
12955 |<nowiki>+bar</nowiki>
12956 |}
12957 !! result
12958 <table><tbody>
12959 <tr><th>+bar</th></tr>
12960 <tr><td>+bar</td></tr>
12961 </tbody></table>
12962 !! end
12963
12964 !! test
12965 Tables: 4c. No escaping needed
12966 !! options
12967 disabled
12968 !! input
12969 {|
12970 |-
12971 |foo-bar
12972 |foo+bar
12973 |-
12974 |''foo''-bar
12975 |''foo''+bar
12976 |}
12977 !! result
12978 <table><tbody>
12979 <tr><td>foo-bar</td><td>foo+bar</td></tr>
12980 <tr><td><i>foo</i>-bar</td><td><i>foo</i>+bar</td></tr>
12981 </tbody></table>
12982 !! end
12983
12984 #### --------------- Links ---------------
12985 #### 1. Quote marks in link text
12986 #### 2. Wikilinks: Escapes needed
12987 #### 3. Wikilinks: No escapes needed
12988 #### 4. Extlinks: Escapes needed
12989 #### 5. Extlinks: No escapes needed
12990 #### --------------------------------------
12991 !! test
12992 Links 1. Quote marks in link text
12993 !! options
12994 disabled
12995 !! input
12996 [[Foo|<nowiki>Foo''boo''</nowiki>]]
12997 !! result
12998 <a rel="mw:WikiLink" href="Foo">Foo''boo''</a>
12999 !! end
13000
13001 !! test
13002 Links 2. WikiLinks: Escapes needed
13003 !! options
13004 disabled
13005 !! input
13006 [[Foo|<nowiki>[Foobar]</nowiki>]]
13007 [[Foo|<nowiki>Foobar]</nowiki>]]
13008 [[Foo|<nowiki>x [Foobar] x</nowiki>]]
13009 [[Foo|<nowiki>x [http://google.com g] x</nowiki>]]
13010 [[Foo|<nowiki>[[Bar]]</nowiki>]]
13011 [[Foo|<nowiki>x [[Bar]] x</nowiki>]]
13012 [[Foo|<nowiki>|Bar</nowiki>]]
13013 !! result
13014 <a href="Foo" rel="mw:WikiLink">[Foobar]</a>
13015 <a href="Foo" rel="mw:WikiLink">Foobar]</a>
13016 <a href="Foo" rel="mw:WikiLink">x [Foobar] x</a>
13017 <a href="Foo" rel="mw:WikiLink">x [http://google.com g] x</a>
13018 <a href="Foo" rel="mw:WikiLink">[[Bar]]</a>
13019 <a href="Foo" rel="mw:WikiLink">x [[Bar]] x</a>
13020 <a href="Foo" rel="mw:WikiLink">|Bar</a>
13021 !! end
13022
13023 !! test
13024 Links 3. WikiLinks: No escapes needed
13025 !! options
13026 disabled
13027 !! input
13028 [[Foo|[Foobar]]
13029 [[Foo|foo|bar]]
13030 !! result
13031 <a href="Foo" rel="mw:WikiLink">[Foobar</a>
13032 <a href="Foo" rel="mw:WikiLink">foo|bar</a>
13033 !! end
13034
13035 !! test
13036 Links 4. ExtLinks: Escapes needed
13037 !! options
13038 disabled
13039 !! input
13040 [http://google.com <nowiki>[google]</nowiki>]
13041 [http://google.com <nowiki>google]</nowiki>]
13042 !! result
13043 <a href="http://google.com" rel="mw:ExtLink">[google]</a>
13044 <a href="http://google.com" rel="mw:ExtLink">google]</a>
13045 !! end
13046
13047 !! test
13048 Links 5. ExtLinks: No escapes needed
13049 !! options
13050 disabled
13051 !! input
13052 [http://google.com [google]
13053 !! result
13054 <a href="http://google.com" rel="mw:ExtLink">[google</a>
13055 !! end
13056
13057 #### --------------- Quotes ---------------
13058 #### 1. Quotes inside <b> and <i>
13059 #### 2. Link fragments separated by <i> and <b> tags
13060 #### 3. Link fragments inside <i> and <b>
13061 #### --------------------------------------
13062 !! test
13063 1. Quotes inside <b> and <i>
13064 !! input
13065 ''<nowiki>'foo'</nowiki>''
13066 ''<nowiki>''foo''</nowiki>''
13067 ''<nowiki>'''foo'''</nowiki>''
13068 '''<nowiki>'foo'</nowiki>'''
13069 '''<nowiki>''foo''</nowiki>'''
13070 '''<nowiki>'''foo'''</nowiki>'''
13071 '''<nowiki>foo'</nowiki>''<nowiki>bar'</nowiki>''baz'''
13072 !! result
13073 <p><i>'foo'</i>
13074 <i>''foo''</i>
13075 <i>'''foo'''</i>
13076 <b>'foo'</b>
13077 <b>''foo''</b>
13078 <b>'''foo'''</b>
13079 <b>foo'<i>bar'</i>baz</b>
13080 </p>
13081 !! end
13082
13083 !! test
13084 2. Link fragments separated by <i> and <b> tags
13085 !! input
13086 [[''foo''<nowiki>hello]]</nowiki>
13087
13088 [['''foo'''<nowiki>hello]]</nowiki>
13089 !! result
13090 <p>[[<i>foo</i>hello]]
13091 </p><p>[[<b>foo</b>hello]]
13092 </p>
13093 !! end
13094
13095 !! test
13096 2. Link fragments inside <i> and <b>
13097 (FIXME: Escaping one or both of [[ and ]] is also acceptable --
13098 this is one of the shortcomings of this format)
13099 !! input
13100 ''[[foo''<nowiki>]]</nowiki>
13101
13102 '''[[foo'''<nowiki>]]</nowiki>
13103 !! result
13104 <p><i>[[foo</i>]]
13105 </p><p><b>[[foo</b>]]
13106 </p>
13107 !! end
13108
13109 #### --------------- Paragraphs ---------------
13110 #### 1. No unnecessary escapes
13111 #### --------------------------------------
13112
13113 !! test
13114 1. No unnecessary escapes
13115 !! input
13116 bar <span><nowiki>[[foo]]</nowiki></span>
13117
13118 =bar <span><nowiki>[[foo]]</nowiki></span>
13119
13120 [[bar <span><nowiki>[[foo]]</nowiki></span>
13121
13122 <nowiki>]]bar </nowiki><span><nowiki>[[foo]]</nowiki></span>
13123
13124 <nowiki>=bar </nowiki><span>foo]]</span>=
13125 !! result
13126 <p>bar <span>[[foo]]</span>
13127 </p><p>=bar <span>[[foo]]</span>
13128 </p><p>[[bar <span>[[foo]]</span>
13129 </p><p>]]bar <span>[[foo]]</span>
13130 </p><p>=bar <span>foo]]</span>=
13131 </p>
13132 !!end
13133
13134 #### --------------- PRE ------------------
13135 #### 1. Leading space in SOL context should be escaped
13136 #### --------------------------------------
13137 !! test
13138 1. Leading space in SOL context should be escaped
13139 !! options
13140 disabled
13141 !! input
13142 <nowiki> foo</nowiki>
13143 <!--cmt--><nowiki> foo</nowiki>
13144 !! result
13145 <p> foo
13146 <!--cmt--> foo
13147 </p>
13148 !! end
13149
13150 #### --------------- HTML tags ---------------
13151 #### 1. a tags
13152 #### 2. other tags
13153 #### 3. multi-line html tag
13154 #### --------------------------------------
13155 !! test
13156 1. a tags
13157 !! options
13158 disabled
13159 !! input
13160 <a href="http://google.com">google</a>
13161 !! result
13162 &lt;a href=&quot;http://google.com&quot;&gt;google&lt;/a&gt;
13163 !! end
13164
13165 !! test
13166 2. other tags
13167 !! input
13168 <nowiki><div>foo</div>
13169 <div style="color:red">foo</div></nowiki>
13170 !! result
13171 <p>&lt;div&gt;foo&lt;/div&gt;
13172 &lt;div style=&quot;color:red&quot;&gt;foo&lt;/div&gt;
13173 </p>
13174 !! end
13175
13176 !! test
13177 3. multi-line html tag
13178 !! input
13179 <nowiki><div
13180 >foo</div
13181 ></nowiki>
13182 !! result
13183 <p>&lt;div
13184 &gt;foo&lt;/div
13185 &gt;
13186 </p>
13187 !! end
13188
13189 #### --------------- Others ---------------
13190 !! test
13191 Escaping nowikis
13192 !! input
13193 &lt;nowiki&gt;foo&lt;/nowiki&gt;
13194 !! result
13195 <p>&lt;nowiki&gt;foo&lt;/nowiki&gt;
13196 </p>
13197 !! end
13198
13199 !! test
13200 Tag-like HTML structures are passed through as text
13201 !! input
13202 <x y>
13203
13204 <x.y>
13205
13206 <x-y>
13207
13208 1>2
13209
13210 x<y
13211
13212 a>b
13213
13214 1<d e>f
13215 !! result
13216 <p>&lt;x y&gt;
13217 </p><p>&lt;x.y&gt;
13218 </p><p>&lt;x-y&gt;
13219 </p><p>1&gt;2
13220 </p><p>x&lt;y
13221 </p><p>a&gt;b
13222 </p><p>1&lt;d e&gt;f
13223 </p>
13224 !! end
13225
13226
13227 # This fails in the PHP parser (see bug 40670,
13228 # https://bugzilla.wikimedia.org/show_bug.cgi?id=40670), so disabled for it.
13229 !! test
13230 Tag names followed by punctuation should not be recognized as tags
13231 !! options
13232 disabled
13233 !! input
13234 <s.ome> text
13235 !! result
13236 <p>&lt;s.ome&gt text
13237 </p>
13238 !! end
13239
13240
13241 TODO:
13242 more images
13243 more tables
13244 character entities
13245 and much more
13246 Try for 100% code coverage