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