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