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