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