Merge "Test some more partly template-generated wikilink targets"
[lhc/web/wiklou.git] / tests / parser / parserTests.txt
1 # MediaWiki Parser test cases
2 # Some taken from http://meta.wikimedia.org/wiki/Parser_testing
3 # All (C) their respective authors and released under the GPL
4 #
5 # The syntax should be fairly self-explanatory.
6 #
7 # Currently supported test options:
8 # One of the following three:
9 #
10 # (default) generate HTML output
11 # pst apply pre-save transform
12 # msg apply message transform
13 #
14 # Plus any combination of these:
15 #
16 # cat add category links
17 # ill add inter-language links
18 # subpage enable subpages (disabled by default)
19 # noxml don't check for XML well formdness
20 # title=[[XXX]] run test using article title XXX
21 # language=XXX set content language to XXX for this test
22 # variant=XXX set the variant of language for this test (eg zh-tw)
23 # disabled do not run test
24 # showtitle make the first line the title
25 # comment run through Linker::formatComment() instead of main parser
26 # local format section links in edit comment text as local links
27 #
28 # For testing purposes, temporary articles can created:
29 # !!article / NAMESPACE:TITLE / !!text / ARTICLE TEXT / !!endarticle
30 # where '/' denotes a newline.
31
32 # This is the standard article assumed to exist.
33 !! article
34 Main Page
35 !! text
36 blah blah
37 !! endarticle
38
39 !!article
40 Template:Foo
41 !!text
42 FOO
43 !!endarticle
44
45 !! article
46 Template:Blank
47 !! text
48 !! endarticle
49
50 !! article
51 Template:pipe
52 !! text
53 |
54 !! endarticle
55
56 !!article
57 MediaWiki:bad image list
58 !!text
59 * [[File:Bad.jpg]] except [[Nasty page]]
60 !!endarticle
61
62 !! article
63 Template:inner list
64 !! text
65 * item 1
66 !! endarticle
67
68 !! article
69 Template:tbl-start
70 !! text
71 {|
72 !! endarticle
73
74 !! article
75 Template:tbl-end
76 !! text
77 |}
78 !! endarticle
79
80 !! article
81 Template:!
82 !! text
83 |
84 !! endarticle
85
86 !! article
87 Template:echo
88 !! text
89 {{{1}}}
90 !! endarticle
91
92 !! article
93 Template:echo_with_span
94 !! text
95 <span>{{{1}}}</span>
96 !! endarticle
97
98 !! article
99 Template:echo_with_div
100 !! text
101 <div>{{{1}}}</div>
102 !! endarticle
103
104 !! article
105 Template:attr_str
106 !! text
107 {{{1}}}="{{{2}}}"
108 !! endarticle
109
110 !! article
111 Template:table_attribs
112 !! text
113 <noinclude>
114 |</noinclude>style="color: red"| Foo
115 !! endarticle
116
117 !! article
118 A?b
119 !! text
120 Weirdo titles!
121 !! endarticle
122
123 ###
124 ### Basic tests
125 ###
126 !! test
127 Blank input
128 !! input
129 !! result
130 !! end
131
132
133 !! test
134 Simple paragraph
135 !! input
136 This is a simple paragraph.
137 !! result
138 <p>This is a simple paragraph.
139 </p>
140 !! end
141
142 !! test
143 Paragraphs with extra newline spacing
144 !! input
145 foo
146
147 bar
148
149
150 baz
151
152
153
154 booz
155 !! result
156 <p>foo
157 </p><p>bar
158 </p><p><br />
159 baz
160 </p><p><br />
161 </p><p>booz
162 </p>
163 !! end
164
165 !! test
166 Simple list
167 !! input
168 * Item 1
169 * Item 2
170 !! result
171 <ul><li> Item 1
172 </li><li> Item 2
173 </li></ul>
174
175 !! end
176
177 !! test
178 Italics and bold
179 !! input
180 * plain
181 * plain''italic''plain
182 * plain''italic''plain''italic''plain
183 * plain'''bold'''plain
184 * plain'''bold'''plain'''bold'''plain
185 * plain''italic''plain'''bold'''plain
186 * plain'''bold'''plain''italic''plain
187 * plain''italic'''bold-italic'''italic''plain
188 * plain'''bold''bold-italic''bold'''plain
189 * plain'''''bold-italic'''italic''plain
190 * plain'''''bold-italic''bold'''plain
191 * plain''italic'''bold-italic'''''plain
192 * plain'''bold''bold-italic'''''plain
193 * plain l'''italic''plain
194 * plain l''''bold''' plain
195 !! result
196 <ul><li> plain
197 </li><li> plain<i>italic</i>plain
198 </li><li> plain<i>italic</i>plain<i>italic</i>plain
199 </li><li> plain<b>bold</b>plain
200 </li><li> plain<b>bold</b>plain<b>bold</b>plain
201 </li><li> plain<i>italic</i>plain<b>bold</b>plain
202 </li><li> plain<b>bold</b>plain<i>italic</i>plain
203 </li><li> plain<i>italic<b>bold-italic</b>italic</i>plain
204 </li><li> plain<b>bold<i>bold-italic</i>bold</b>plain
205 </li><li> plain<i><b>bold-italic</b>italic</i>plain
206 </li><li> plain<b><i>bold-italic</i>bold</b>plain
207 </li><li> plain<i>italic<b>bold-italic</b></i>plain
208 </li><li> plain<b>bold<i>bold-italic</i></b>plain
209 </li><li> plain l'<i>italic</i>plain
210 </li><li> plain l'<b>bold</b> plain
211 </li></ul>
212
213 !! end
214
215 ###
216 ### 2-quote opening sequence tests
217 ###
218 !! test
219 Italics and bold: 2-quote opening sequence: (2,2)
220 !! input
221 ''foo''
222 !! result
223 <p><i>foo</i>
224 </p>
225 !!end
226
227
228 !! test
229 Italics and bold: 2-quote opening sequence: (2,3)
230 !! input
231 ''foo'''
232 !! result
233 <p><i>foo'</i>
234 </p>
235 !!end
236
237
238 !! test
239 Italics and bold: 2-quote opening sequence: (2,4)
240 !! input
241 ''foo''''
242 !! result
243 <p><i>foo''</i>
244 </p>
245 !!end
246
247
248 !! test
249 Italics and bold: 2-quote opening sequence: (2,5)
250 !! input
251 ''foo'''''
252 !! result
253 <p><i>foo</i>
254 </p>
255 !!end
256
257
258 ###
259 ### 3-quote opening sequence tests
260 ###
261
262 !! test
263 Italics and bold: 3-quote opening sequence: (3,2)
264 !! input
265 '''foo''
266 !! result
267 <p>'<i>foo</i>
268 </p>
269 !!end
270
271
272 !! test
273 Italics and bold: 3-quote opening sequence: (3,3)
274 !! input
275 '''foo'''
276 !! result
277 <p><b>foo</b>
278 </p>
279 !!end
280
281
282 !! test
283 Italics and bold: 3-quote opening sequence: (3,4)
284 !! input
285 '''foo''''
286 !! result
287 <p><b>foo'</b>
288 </p>
289 !!end
290
291
292 !! test
293 Italics and bold: 3-quote opening sequence: (3,5)
294 !! input
295 '''foo'''''
296 !! result
297 <p><b>foo</b>
298 </p>
299 !!end
300
301
302 ###
303 ### 4-quote opening sequence tests
304 ###
305
306 !! test
307 Italics and bold: 4-quote opening sequence: (4,2)
308 !! input
309 ''''foo''
310 !! result
311 <p>''<i>foo</i>
312 </p>
313 !!end
314
315
316 !! test
317 Italics and bold: 4-quote opening sequence: (4,3)
318 !! input
319 ''''foo'''
320 !! result
321 <p>'<b>foo</b>
322 </p>
323 !!end
324
325
326 !! test
327 Italics and bold: 4-quote opening sequence: (4,4)
328 !! input
329 ''''foo''''
330 !! result
331 <p>'<b>foo'</b>
332 </p>
333 !!end
334
335
336 !! test
337 Italics and bold: 4-quote opening sequence: (4,5)
338 !! input
339 ''''foo'''''
340 !! result
341 <p>'<b>foo</b>
342 </p>
343 !!end
344
345
346 ###
347 ### 5-quote opening sequence tests
348 ###
349
350 !! test
351 Italics and bold: 5-quote opening sequence: (5,2)
352 !! input
353 '''''foo''
354 !! result
355 <p><b><i>foo</i></b>
356 </p>
357 !!end
358
359
360 !! test
361 Italics and bold: 5-quote opening sequence: (5,3)
362 !! input
363 '''''foo'''
364 !! result
365 <p><i><b>foo</b></i>
366 </p>
367 !!end
368
369
370 !! test
371 Italics and bold: 5-quote opening sequence: (5,4)
372 !! input
373 '''''foo''''
374 !! result
375 <p><i><b>foo'</b></i>
376 </p>
377 !!end
378
379
380 !! test
381 Italics and bold: 5-quote opening sequence: (5,5)
382 !! input
383 '''''foo'''''
384 !! result
385 <p><i><b>foo</b></i>
386 </p>
387 !!end
388
389 ###
390 ### multiple quote sequences in a line
391 ###
392 !! test
393 Italics and bold: multiple quote sequences: (2,4,2)
394 !! input
395 ''foo''''bar''
396 !! result
397 <p><i>foo'<b>bar</b></i>
398 </p>
399 !!end
400
401
402 !! test
403 Italics and bold: multiple quote sequences: (2,4,3)
404 !! input
405 ''foo''''bar'''
406 !! result
407 <p><i>foo'<b>bar</b></i>
408 </p>
409 !!end
410
411
412 !! test
413 Italics and bold: multiple quote sequences: (2,4,4)
414 !! input
415 ''foo''''bar''''
416 !! result
417 <p><i>foo'<b>bar'</b></i>
418 </p>
419 !!end
420
421
422 !! test
423 Italics and bold: multiple quote sequences: (3,4,2)
424 !! input
425 '''foo''''bar''
426 !! result
427 <p><b>foo'</b>bar
428 </p>
429 !!end
430
431
432 !! test
433 Italics and bold: multiple quote sequences: (3,4,3)
434 !! input
435 '''foo''''bar'''
436 !! result
437 <p><b>foo'</b>bar
438 </p>
439 !!end
440
441 ###
442 ### other quote tests
443 ###
444 !! test
445 Italics and bold: other quote tests: (2,3,5)
446 !! input
447 ''this is about '''foo's family'''''
448 !! result
449 <p><i>this is about <b>foo's family</b></i>
450 </p>
451 !!end
452
453
454 !! test
455 Italics and bold: other quote tests: (2,(3,3),2)
456 !! input
457 ''this is about '''foo's''' family''
458 !! result
459 <p><i>this is about <b>foo's</b> family</i>
460 </p>
461 !!end
462
463
464 !! test
465 Italics and bold: other quote tests: (3,2,3,2)
466 !! input
467 '''this is about ''foo'''s family''
468 !! result
469 <p><b>this is about <i>foo</i></b><i>s family</i>
470 </p>
471 !!end
472
473
474 !! test
475 Italics and bold: other quote tests: (3,2,3,3)
476 !! input
477 '''this is about ''foo'''s family'''
478 !! result
479 <p>'<i>this is about </i>foo<b>s family</b>
480 </p>
481 !!end
482
483
484
485 !! test
486 Italics and bold: other quote tests: (3,(2,2),3)
487 !! input
488 '''this is about ''foo's'' family'''
489 !! result
490 <p><b>this is about <i>foo's</i> family</b>
491 </p>
492 !!end
493
494 ###
495 ### <nowiki> test cases
496 ###
497
498 !! test
499 <nowiki> unordered list
500 !! input
501 <nowiki>* This is not an unordered list item.</nowiki>
502 !! result
503 <p>* This is not an unordered list item.
504 </p>
505 !! end
506
507 !! test
508 <nowiki> spacing
509 !! input
510 <nowiki>Lorem ipsum dolor
511
512 sed abit.
513 sed nullum.
514
515 :and a colon
516 </nowiki>
517 !! result
518 <p>Lorem ipsum dolor
519
520 sed abit.
521 sed nullum.
522
523 :and a colon
524
525 </p>
526 !! end
527
528 !! test
529 nowiki 3
530 !! input
531 :There is not nowiki.
532 :There is <nowiki>nowiki</nowiki>.
533
534 #There is not nowiki.
535 #There is <nowiki>nowiki</nowiki>.
536
537 *There is not nowiki.
538 *There is <nowiki>nowiki</nowiki>.
539 !! result
540 <dl><dd>There is not nowiki.
541 </dd><dd>There is nowiki.
542 </dd></dl>
543 <ol><li>There is not nowiki.
544 </li><li>There is nowiki.
545 </li></ol>
546 <ul><li>There is not nowiki.
547 </li><li>There is nowiki.
548 </li></ul>
549
550 !! end
551
552
553 ###
554 ### Comments
555 ###
556 !! test
557 Comments and Indent-Pre
558 !! input
559 <!-- comment 1 --> asdf
560
561 <!-- comment 1 --> asdf
562 <!-- comment 2 -->
563
564 <!-- comment 1 --> asdf
565 <!-- comment 2 -->xyz
566
567 <!-- comment 1 --> asdf
568 <!-- comment 2 --> xyz
569 !! result
570 <pre>asdf
571 </pre>
572 <pre>asdf
573 </pre>
574 <pre>asdf
575 </pre>
576 <p>xyz
577 </p>
578 <pre>asdf
579 xyz
580 </pre>
581 !! end
582
583 !! test
584 Comment test 2a
585 !! input
586 asdf
587 <!-- comment 1 -->
588 jkl
589 !! result
590 <p>asdf
591 jkl
592 </p>
593 !! end
594
595 !! test
596 Comment test 2b
597 !! input
598 asdf
599 <!-- comment 1 -->
600
601 jkl
602 !! result
603 <p>asdf
604 </p><p>jkl
605 </p>
606 !! end
607
608 !! test
609 Comment test 3
610 !! input
611 asdf
612 <!-- comment 1 -->
613 <!-- comment 2 -->
614 jkl
615 !! result
616 <p>asdf
617 jkl
618 </p>
619 !! end
620
621 !! test
622 Comment test 4
623 !! input
624 asdf<!-- comment 1 -->jkl
625 !! result
626 <p>asdfjkl
627 </p>
628 !! end
629
630 !! test
631 Comment spacing
632 !! input
633 a
634 <!-- foo --> b <!-- bar -->
635 c
636 !! result
637 <p>a
638 </p>
639 <pre> b
640 </pre>
641 <p>c
642 </p>
643 !! end
644
645 !! test
646 Comment whitespace
647 !! input
648 <!-- returns a single newline, not nothing, since the newline after > is not stripped -->
649 !! result
650
651 !! end
652
653 !! test
654 Comment semantics and delimiters
655 !! input
656 <!-- --><!----><!-----><!------>
657 !! result
658
659 !! end
660
661 !! test
662 Comment semantics and delimiters, redux
663 !! input
664 <!-- In SGML every "foo" here would actually show up in the text -- foo -- bar
665 -- foo -- funky huh? ... -->
666 !! result
667
668 !! end
669
670 !! test
671 Comment semantics and delimiters: directors cut
672 !! input
673 <!-- ... However we like to keep things simple and somewhat XML-ish so we eat
674 everything starting with < followed by !-- until the first -- and > we see,
675 that wouldn't be valid XML however, since in XML -- has to terminate a comment
676 -->-->
677 !! result
678 <p>--&gt;
679 </p>
680 !! end
681
682 !! test
683 Comment semantics: nesting
684 !! input
685 <!--<!-- no, we're not going to do anything fancy here -->-->
686 !! result
687 <p>--&gt;
688 </p>
689 !! end
690
691 !! test
692 Comment semantics: unclosed comment at end
693 !! input
694 <!--This comment will run out to the end of the document
695 !! result
696
697 !! end
698
699 !! test
700 Comment in template title
701 !! input
702 {{f<!---->oo}}
703 !! result
704 <p>FOO
705 </p>
706 !! end
707
708 !! test
709 Comment on its own line post-expand
710 !! input
711 a
712 {{blank}}<!---->
713 b
714 !! result
715 <p>a
716 </p><p>b
717 </p>
718 !! end
719
720 !! test
721 Comment on its own line post-expand with non-significant whitespace
722 !! input
723 a
724 {{blank}} <!---->
725 b
726 !! result
727 <p>a
728 </p><p>b
729 </p>
730 !! end
731
732 ###
733 ### paragraph wraping tests
734 ###
735 !! test
736 No block tags
737 !! input
738 a
739
740 b
741 !! result
742 <p>a
743 </p><p>b
744 </p>
745 !! end
746 !! test
747 Block tag on one line
748 !! input
749 a <div>foo</div>
750
751 b
752 !! result
753 a <div>foo</div>
754 <p>b
755 </p>
756 !! end
757
758 !! test
759 Block tag on both lines
760 !! input
761 a <div>foo</div>
762
763 b <div>foo</div>
764 !! result
765 a <div>foo</div>
766 b <div>foo</div>
767
768 !! end
769
770 !! test
771 Multiple lines without block tags
772 !! input
773 <div>foo</div> a
774 b
775 c
776 d<!--foo--> e
777 x <div>foo</div> z
778 !! result
779 <div>foo</div> a
780 <p>b
781 c
782 d e
783 </p>
784 x <div>foo</div> z
785
786 !! end
787
788 ###
789 ### Preformatted text
790 ###
791 !! test
792 Preformatted text
793 !! input
794 This is some
795 Preformatted text
796 With ''italic''
797 And '''bold'''
798 And a [[Main Page|link]]
799 !! result
800 <pre>This is some
801 Preformatted text
802 With <i>italic</i>
803 And <b>bold</b>
804 And a <a href="/wiki/Main_Page" title="Main Page">link</a>
805 </pre>
806 !! end
807
808 !! test
809 Ident preformatting with inline content
810 !! input
811 a
812 ''b''
813 !! result
814 <pre>a
815 <i>b</i>
816 </pre>
817 !! end
818
819 !! test
820 <pre> with <nowiki> inside (compatibility with 1.6 and earlier)
821 !! input
822 <pre><nowiki>
823 <b>
824 <cite>
825 <em>
826 </nowiki></pre>
827 !! result
828 <pre>
829 &lt;b&gt;
830 &lt;cite&gt;
831 &lt;em&gt;
832 </pre>
833
834 !! end
835
836 !! test
837 Regression with preformatted in <center>
838 !! input
839 <center>
840 Blah
841 </center>
842 !! result
843 <center>
844 <pre>Blah
845 </pre>
846 </center>
847
848 !! end
849
850 # Expected output in the following test is not really expected (there should be
851 # <pre> in the output) -- it's only testing for well-formedness.
852 !! test
853 Bug 6200: Preformatted in <blockquote>
854 !! input
855 <blockquote>
856 Blah
857 </blockquote>
858 !! result
859 <blockquote>
860 Blah
861 </blockquote>
862
863 !! end
864
865 !! test
866 <pre> with attributes (bug 3202)
867 !! input
868 <pre style="background: blue; color:white">Bluescreen of WikiDeath</pre>
869 !! result
870 <pre style="background: blue; color:white">Bluescreen of WikiDeath</pre>
871
872 !! end
873
874 !! test
875 <pre> with width attribute (bug 3202)
876 !! input
877 <pre width="8">Narrow screen goodies</pre>
878 !! result
879 <pre width="8">Narrow screen goodies</pre>
880
881 !! end
882
883 !! test
884 <pre> with forbidden attribute (bug 3202)
885 !! input
886 <pre width="8" onmouseover="alert(document.cookie)">Narrow screen goodies</pre>
887 !! result
888 <pre width="8">Narrow screen goodies</pre>
889
890 !! end
891
892 !! test
893 <pre> with forbidden attribute values (bug 3202)
894 !! input
895 <pre width="8" style="border-width: expression(alert(document.cookie))">Narrow screen goodies</pre>
896 !! result
897 <pre width="8" style="/* insecure input */">Narrow screen goodies</pre>
898
899 !! end
900
901 !! test
902 <nowiki> inside <pre> (bug 13238)
903 !! input
904 <pre>
905 <nowiki>
906 </pre>
907 <pre>
908 <nowiki></nowiki>
909 </pre>
910 <pre><nowiki><nowiki></nowiki>Foo<nowiki></nowiki></nowiki></pre>
911 !! result
912 <pre>
913 &lt;nowiki&gt;
914 </pre>
915 <pre>
916
917 </pre>
918 <pre>&lt;nowiki&gt;Foo&lt;/nowiki&gt;</pre>
919
920 !! end
921
922 !! test
923 <nowiki> and <pre> preference (first one wins)
924 !! input
925 <pre>
926 <nowiki>
927 </pre>
928 </nowiki>
929 </pre>
930
931 <nowiki>
932 <pre>
933 <nowiki>
934 </pre>
935 </nowiki>
936 </pre>
937
938 !! result
939 <pre>
940 &lt;nowiki&gt;
941 </pre>
942 <p>&lt;/nowiki&gt;
943 &lt;/pre&gt;
944 </p><p>
945 &lt;pre&gt;
946 &lt;nowiki&gt;
947 &lt;/pre&gt;
948
949 &lt;/pre&gt;
950 </p>
951 !! end
952
953 !! test
954 </pre> inside nowiki
955 !! input
956 <nowiki></pre></nowiki>
957 !! result
958 <p>&lt;/pre&gt;
959 </p>
960 !! end
961
962 !!test
963 Templates: Indent-Pre: 1a. Templates that break a line should suppress <pre>
964 !!input
965 {{echo|}}
966 !!result
967
968 !!end
969
970 !!test
971 Templates: Indent-Pre: 1b. Templates that break a line should suppress <pre>
972 !!input
973 {{echo|
974 foo}}
975 !!result
976 <p>foo
977 </p>
978 !!end
979
980 !! test
981 Templates: Indent-Pre: 1c: Wrapping should be based on expanded content
982 !! input
983 {{echo|a
984 b}}
985 !!result
986 <pre>a
987 </pre>
988 <p>b
989 </p>
990 !!end
991
992 !! test
993 Templates: Indent-Pre: 1d: Wrapping should be based on expanded content
994 !! input
995 {{echo|a
996 b
997 c
998 d
999 e
1000 }}
1001 !!result
1002 <pre>a
1003 </pre>
1004 <p>b
1005 c
1006 </p>
1007 <pre>d
1008 </pre>
1009 <p>e
1010 </p>
1011 !!end
1012
1013 !!test
1014 Templates: Indent-Pre: 1e. Wrapping should be based on expanded content
1015 !!input
1016 {{echo| foo}}
1017
1018 {{echo| foo}}{{echo| bar}}
1019
1020 {{echo| foo}}
1021 {{echo| bar}}
1022
1023 {{echo|<!--cmt--> foo}}
1024
1025 <!--cmt-->{{echo| foo}}
1026
1027 {{echo|{{echo| }}bar}}
1028 !!result
1029 <pre>foo
1030 </pre>
1031 <pre>foo bar
1032 </pre>
1033 <pre>foo
1034 bar
1035 </pre>
1036 <pre>foo
1037 </pre>
1038 <pre>foo
1039 </pre>
1040 <pre>bar
1041 </pre>
1042 !!end
1043
1044 !! test
1045 Templates: Indent-Pre: 1f: Wrapping should be based on expanded content
1046 !! input
1047 {{echo| }}a
1048
1049 {{echo|
1050 }}a
1051
1052 {{echo|
1053 b}}
1054
1055 {{echo|a
1056 }}b
1057
1058 {{echo|a
1059 }} b
1060 !!result
1061 <pre>a
1062 </pre>
1063 <p><br />
1064 </p>
1065 <pre>a
1066 </pre>
1067 <p><br />
1068 </p>
1069 <pre>b
1070 </pre>
1071 <p>a
1072 </p>
1073 <pre>b
1074 </pre>
1075 <p>a
1076 </p>
1077 <pre>b
1078 </pre>
1079 !!end
1080
1081 !! test
1082 Templates: Single-line variant of parameter whitespace stripping test
1083 !! input
1084 {{echo| a}}
1085
1086 {{echo|1= a}}
1087
1088 {{echo|{{echo| a}}}}
1089
1090 {{echo|1={{echo| a}}}}
1091 !! result
1092 <pre>a
1093 </pre>
1094 <p>a
1095 </p>
1096 <pre>a
1097 </pre>
1098 <p>a
1099 </p>
1100 !! end
1101
1102 !! test
1103 Templates: Strip whitespace from named parameters, but not positional ones
1104 !! input
1105 {{echo|
1106 foo}}
1107
1108 {{echo|
1109 * foo}}
1110
1111 {{echo| 1 =
1112 foo}}
1113
1114 {{echo| 1 =
1115 * foo}}
1116 !! result
1117 <pre>foo
1118 </pre>
1119 <p><br />
1120 </p>
1121 <ul><li> foo
1122 </li></ul>
1123 <p>foo
1124 </p>
1125 <ul><li> foo
1126 </li></ul>
1127
1128 !! end
1129
1130 ###
1131 ### Parsoid-centric tests for testing RT edge cases for pre
1132 ###
1133
1134 !!test
1135 1a. Indent-Pre and Comments
1136 !!input
1137 a
1138 <!--a-->
1139 c
1140 !!result
1141 <pre>a
1142 </pre>
1143 <p>c
1144 </p>
1145 !!end
1146
1147 !!test
1148 1b. Indent-Pre and Comments
1149 !!input
1150 a
1151 <!--a-->
1152 c
1153 !!result
1154 <pre>a
1155 </pre>
1156 <p>c
1157 </p>
1158 !!end
1159
1160 !!test
1161 1c. Indent-Pre and Comments
1162 !!input
1163 <!--a--> a
1164
1165 <!--a--> a
1166 !!result
1167 <pre> a
1168 </pre>
1169 <pre> a
1170 </pre>
1171 !!end
1172
1173 !!test
1174 2a. Indent-Pre and tables
1175 !!input
1176 {|
1177 |-
1178 !h1!!h2
1179 |foo||bar
1180 |}
1181 !!result
1182 <table>
1183
1184 <tr>
1185 <th>h1</th>
1186 <th>h2
1187 </th>
1188 <td>foo</td>
1189 <td>bar
1190 </td></tr></table>
1191
1192 !!end
1193
1194 !!test
1195 2b. Indent-Pre and tables
1196 !!input
1197 {|
1198 |-
1199 |foo
1200 |}
1201 !!result
1202 <table>
1203
1204 <tr>
1205 <td>foo
1206 </td></tr></table>
1207
1208 !!end
1209
1210 !!test
1211 3a. Indent-Pre and block tags (single-line html)
1212 !!input
1213 <p> foo </p>
1214 <div> foo </div>
1215 <span> foo </span>
1216 !!result
1217 <p> foo </p>
1218 <div> foo </div>
1219 <pre><span> foo </span>
1220 </pre>
1221 !!end
1222
1223 !!test
1224 3b. Indent-Pre and block tags (pre-content on separate line)
1225 !!input
1226 <p>
1227 foo
1228 </p>
1229
1230 <div>
1231 foo
1232 </div>
1233
1234 <center>
1235 foo
1236 </center>
1237
1238 <blockquote>
1239 foo
1240 </blockquote>
1241
1242 <table><tr><td>
1243 foo
1244 </td></tr></table>
1245
1246 <ul><li>
1247 foo
1248 </li></ul>
1249
1250 !!result
1251 <p>
1252 foo
1253 </p>
1254 <div>
1255 <pre>foo
1256 </pre>
1257 </div>
1258 <center>
1259 <pre>foo
1260 </pre>
1261 </center>
1262 <blockquote>
1263 foo
1264 </blockquote>
1265 <table><tr><td>
1266 <pre>foo
1267 </pre>
1268 </td></tr></table>
1269 <ul><li>
1270 foo
1271 </li></ul>
1272
1273 !!end
1274
1275 !!test
1276 4. Multiple spaces at start-of-line
1277 !!input
1278 <p> foo </p>
1279 foo
1280 {|
1281 |foo
1282 |}
1283 !!result
1284 <p> foo </p>
1285 <pre> foo
1286 </pre>
1287 <table>
1288 <tr>
1289 <td>foo
1290 </td></tr></table>
1291
1292 !!end
1293
1294 ###
1295 ### HTML-pre (some to spec PHP parser behavior and some Parsoid-RT-centric)
1296 ###
1297
1298 !!test
1299 HTML-pre: 1. embedded newlines
1300 !!input
1301 <pre>foo</pre>
1302
1303 <pre>
1304 foo
1305 </pre>
1306
1307 <pre>
1308
1309 foo
1310 </pre>
1311
1312 <pre>
1313
1314
1315 foo
1316 </pre>
1317 !!result
1318 <pre>foo</pre>
1319 <pre>
1320 foo
1321 </pre>
1322 <pre>
1323
1324 foo
1325 </pre>
1326 <pre>
1327
1328
1329 foo
1330 </pre>
1331
1332 !!end
1333
1334 !!test
1335 HTML-pre: 2: indented text
1336 !!input
1337 <pre>
1338 foo
1339 </pre>
1340 !!result
1341 <pre>
1342 foo
1343 </pre>
1344
1345 !!end
1346
1347 !!test
1348 HTML-pre: 3: other wikitext
1349 !!input
1350 <pre>
1351 * foo
1352 # bar
1353 = no-h =
1354 '' no-italic ''
1355 [[ NoLink ]]
1356 </pre>
1357 !!result
1358 <pre>
1359 * foo
1360 # bar
1361 = no-h =
1362 '' no-italic ''
1363 [[ NoLink ]]
1364 </pre>
1365
1366 !!end
1367
1368 ###
1369 ### Definition lists
1370 ###
1371 !! test
1372 Simple definition
1373 !! input
1374 ; name : Definition
1375 !! result
1376 <dl><dt> name&#160;</dt><dd> Definition
1377 </dd></dl>
1378
1379 !! end
1380
1381 !! test
1382 Definition list for indentation only
1383 !! input
1384 : Indented text
1385 !! result
1386 <dl><dd> Indented text
1387 </dd></dl>
1388
1389 !! end
1390
1391 !! test
1392 Definition list with no space
1393 !! input
1394 ;name:Definition
1395 !! result
1396 <dl><dt>name</dt><dd>Definition
1397 </dd></dl>
1398
1399 !!end
1400
1401 !! test
1402 Definition list with URL link
1403 !! input
1404 ; http://example.com/ : definition
1405 !! result
1406 <dl><dt> <a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&#160;</dt><dd> definition
1407 </dd></dl>
1408
1409 !! end
1410
1411 !! test
1412 Definition list with bracketed URL link
1413 !! input
1414 ;[http://www.example.com/ Example]:Something about it
1415 !! result
1416 <dl><dt><a rel="nofollow" class="external text" href="http://www.example.com/">Example</a></dt><dd>Something about it
1417 </dd></dl>
1418
1419 !! end
1420
1421 !! test
1422 Definition list with wikilink containing colon
1423 !! input
1424 ; [[Help:FAQ]]: The least-read page on Wikipedia
1425 !! result
1426 <dl><dt> <a href="/index.php?title=Help:FAQ&amp;action=edit&amp;redlink=1" class="new" title="Help:FAQ (page does not exist)">Help:FAQ</a></dt><dd> The least-read page on Wikipedia
1427 </dd></dl>
1428
1429 !! end
1430
1431 # At Brion's and JeLuF's insistence... :)
1432 !! test
1433 Definition list with news link containing colon
1434 !! input
1435 ; news:alt.wikipedia.rox: This isn't even a real newsgroup!
1436 !! result
1437 <dl><dt> <a rel="nofollow" class="external free" href="news:alt.wikipedia.rox">news:alt.wikipedia.rox</a></dt><dd> This isn't even a real newsgroup!
1438 </dd></dl>
1439
1440 !! end
1441
1442 !! test
1443 Malformed definition list with colon
1444 !! input
1445 ; news:alt.wikipedia.rox -- don't crash or enter an infinite loop
1446 !! result
1447 <dl><dt> <a rel="nofollow" class="external free" href="news:alt.wikipedia.rox">news:alt.wikipedia.rox</a> -- don't crash or enter an infinite loop
1448 </dt></dl>
1449
1450 !! end
1451
1452 !! test
1453 Definition lists: colon in external link text
1454 !! input
1455 ; [http://www.wikipedia2.org/ Wikipedia : The Next Generation]: OK, I made that up
1456 !! result
1457 <dl><dt> <a rel="nofollow" class="external text" href="http://www.wikipedia2.org/">Wikipedia&#160;: The Next Generation</a></dt><dd> OK, I made that up
1458 </dd></dl>
1459
1460 !! end
1461
1462 !! test
1463 Definition lists: colon in HTML attribute
1464 !! input
1465 ;<b style="display: inline">bold</b>
1466 !! result
1467 <dl><dt><b style="display: inline">bold</b>
1468 </dt></dl>
1469
1470 !! end
1471
1472 !! test
1473 Definition lists: self-closed tag
1474 !! input
1475 ;one<br/>two : two-line fun
1476 !! result
1477 <dl><dt>one<br />two&#160;</dt><dd> two-line fun
1478 </dd></dl>
1479
1480 !! end
1481
1482 !! test
1483 Bug 11748: Literal closing tags
1484 !! input
1485 <dl>
1486 <dt>test 1</dt>
1487 <dd>test test test test test</dd>
1488 <dt>test 2</dt>
1489 <dd>test test test test test</dd>
1490 </dl>
1491 !! result
1492 <dl>
1493 <dt>test 1</dt>
1494 <dd>test test test test test</dd>
1495 <dt>test 2</dt>
1496 <dd>test test test test test</dd>
1497 </dl>
1498
1499 !! end
1500
1501 !! test
1502 Definition and unordered list using wiki syntax nested in unordered list using html tags.
1503 !! input
1504 <ul><li>
1505 ; term : description
1506 * unordered
1507 </li>
1508 </ul>
1509 !! result
1510 <ul><li>
1511 <dl><dt> term&#160;</dt><dd> description
1512 </dd></dl>
1513 <ul><li> unordered
1514 </li></ul>
1515 </li>
1516 </ul>
1517
1518 !! end
1519
1520 !! test
1521
1522 Definition list with empty definition and following paragraph
1523 !! input
1524 ; term:
1525 Paragraph text
1526 !! result
1527 <dl><dt> term</dt><dd>
1528 </dd></dl>
1529 <p>Paragraph text
1530 </p>
1531 !! end
1532
1533 !! test
1534 Nested definition lists using html syntax
1535 !! input
1536 <dl><dd>
1537 <dl>
1538 <dd>Foo</dd>
1539 </dl>
1540 </dd></dl>
1541 !! result
1542 <dl><dd>
1543 <dl>
1544 <dd>Foo</dd>
1545 </dl>
1546 </dd></dl>
1547
1548 !! end
1549
1550 !! test
1551 Definition Lists: No nesting: Multiple dd's
1552 !! input
1553 ;x
1554 :a
1555 :b
1556 !! result
1557 <dl><dt>x
1558 </dt><dd>a
1559 </dd><dd>b
1560 </dd></dl>
1561
1562 !! end
1563
1564 !! test
1565 Definition Lists: Indentation: Regular
1566 !! input
1567 :i1
1568 ::i2
1569 :::i3
1570 !! result
1571 <dl><dd>i1
1572 <dl><dd>i2
1573 <dl><dd>i3
1574 </dd></dl>
1575 </dd></dl>
1576 </dd></dl>
1577
1578 !! end
1579
1580 !! test
1581 Definition Lists: Indentation: Missing 1st level
1582 !! input
1583 ::i2
1584 :::i3
1585 !! result
1586 <dl><dd><dl><dd>i2
1587 <dl><dd>i3
1588 </dd></dl>
1589 </dd></dl>
1590 </dd></dl>
1591
1592 !! end
1593
1594 !! test
1595 Definition Lists: Indentation: Multi-level indent
1596 !! input
1597 :::i3
1598 !! result
1599 <dl><dd><dl><dd><dl><dd>i3
1600 </dd></dl>
1601 </dd></dl>
1602 </dd></dl>
1603
1604 !! end
1605
1606 !! test
1607 Definition Lists: Hacky use to indent tables
1608 !! input
1609 ::{|
1610 |foo
1611 |bar
1612 |}
1613 this text
1614 should be left alone
1615 !! result
1616 <dl><dd><dl><dd><table>
1617 <tr>
1618 <td>foo
1619 </td>
1620 <td>bar
1621 </td></tr></table></dd></dl></dd></dl>
1622 <p>this text
1623 should be left alone
1624 </p>
1625 !! end
1626 ## The PHP parser treats : items (dd) without a corresponding ; item (dt)
1627 ## as an empty dt item. It also ignores all but the last ";" when followed
1628 ## by ":" later on. So, ";" are not ignored in ";;;t3" but are ignored in
1629 ## ";;;t3 :d1". So, PHP parser behavior is a little inconsistent wrt multiple
1630 ## ";"s.
1631 ##
1632 ## Ex: ";;t2 ::d2" is transformed into:
1633 ##
1634 ## <dl>
1635 ## <dt>t2 </dt>
1636 ## <dd>
1637 ## <dl>
1638 ## <dt></dt>
1639 ## <dd>d2</dd>
1640 ## </dl>
1641 ## </dd>
1642 ## </dl>
1643 ##
1644 ## But, Parsoid treats "; :" as a tight atomic unit and excess ":" as plain text
1645 ## So, the same wikitext above (;;t2 ::d2) is transformed into:
1646 ##
1647 ## <dl>
1648 ## <dt>
1649 ## <dl>
1650 ## <dt>t2 </dt>
1651 ## <dd>:d2</dd>
1652 ## </dl>
1653 ## </dt>
1654 ## </dl>
1655 ##
1656 ## All Parsoid only definition list tests have this difference.
1657 ##
1658 ## See also: https://bugzilla.wikimedia.org/show_bug.cgi?id=6569
1659 ## and http://lists.wikimedia.org/pipermail/wikitext-l/2011-November/000483.html
1660
1661 !! test
1662 Table / list interaction: indented table with lists in table contents
1663 !! input
1664 :{|
1665 |-
1666 | a
1667 * b
1668 |-
1669 | c
1670 * d
1671 |}
1672 !! result
1673 <dl><dd><table>
1674
1675 <tr>
1676 <td> a
1677 <ul><li> b
1678 </li></ul>
1679 </td></tr>
1680 <tr>
1681 <td> c
1682 <ul><li> d
1683 </li></ul>
1684 </td></tr></table></dd></dl>
1685
1686 !! end
1687
1688 !!test
1689 Table / list interaction: lists nested in tables nested in indented lists
1690 !!input
1691 :{|
1692 |
1693 :a
1694 :b
1695 |
1696 *c
1697 *d
1698 |}
1699
1700 *e
1701 *f
1702 !!result
1703 <dl><dd><table>
1704 <tr>
1705 <td>
1706 <dl><dd>a
1707 </dd><dd>b
1708 </dd></dl>
1709 </td>
1710 <td>
1711 <ul><li>c
1712 </li><li>d
1713 </li></ul>
1714 </td></tr></table></dd></dl>
1715 <ul><li>e
1716 </li><li>f
1717 </li></ul>
1718
1719 !!end
1720
1721 !! test
1722 Definition Lists: Nesting: Multi-level (Parsoid only)
1723 !! options
1724 disabled
1725 !! input
1726 ;t1 :d1
1727 ;;t2 ::d2
1728 ;;;t3 :::d3
1729 !! result
1730 <dl>
1731 <dt>t1 </dt>
1732 <dd>d1</dd>
1733 <dt>
1734 <dl>
1735 <dt>t2 </dt>
1736 <dd>:d2</dd>
1737 <dt>
1738 <dl>
1739 <dt>t3 </dt>
1740 <dd>::d3</dd>
1741 </dl>
1742 </dt>
1743 </dl>
1744 </dt>
1745 </dl>
1746
1747
1748 !! end
1749
1750
1751 !! test
1752 Definition Lists: Nesting: Test 2 (Parsoid only)
1753 !! options
1754 disabled
1755 !! input
1756 ;t1
1757 ::d2
1758 !! result
1759 <dl>
1760 <dt>t1</dt>
1761 <dd>
1762 <dl>
1763 <dd>d2</dd>
1764 </dl>
1765 </dd>
1766 </dl>
1767
1768 !! end
1769
1770
1771 !! test
1772 Definition Lists: Nesting: Test 3 (Parsoid only)
1773 !! options
1774 disabled
1775 !! input
1776 :;t1
1777 ::::d2
1778 !! result
1779 <dl>
1780 <dd>
1781 <dl>
1782 <dt>t1</dt>
1783 <dd>
1784 <dl>
1785 <dd>
1786 <dl>
1787 <dd>d2</dd>
1788 </dl>
1789 </dd>
1790 </dl>
1791 </dd>
1792 </dl>
1793 </dd>
1794 </dl>
1795
1796 !! end
1797
1798
1799 !! test
1800 Definition Lists: Nesting: Test 4
1801 !! input
1802 ::;t3
1803 :::d3
1804 !! result
1805 <dl><dd><dl><dd><dl><dt>t3
1806 </dt><dd>d3
1807 </dd></dl>
1808 </dd></dl>
1809 </dd></dl>
1810
1811 !! end
1812
1813
1814 !! test
1815 Definition Lists: Mixed Lists: Test 1
1816 !! input
1817 :;* foo
1818 ::* bar
1819 :; baz
1820 !! result
1821 <dl><dd><dl><dt><ul><li> foo
1822 </li><li> bar
1823 </li></ul>
1824 </dt></dl>
1825 <dl><dt> baz
1826 </dt></dl>
1827 </dd></dl>
1828
1829 !! end
1830
1831
1832 !! test
1833 Definition Lists: Mixed Lists: Test 2
1834 !! input
1835 *: d1
1836 *: d2
1837 !! result
1838 <ul><li><dl><dd> d1
1839 </dd><dd> d2
1840 </dd></dl>
1841 </li></ul>
1842
1843 !! end
1844
1845
1846 !! test
1847 Definition Lists: Mixed Lists: Test 3
1848 !! input
1849 *::: d1
1850 *::: d2
1851 !! result
1852 <ul><li><dl><dd><dl><dd><dl><dd> d1
1853 </dd><dd> d2
1854 </dd></dl>
1855 </dd></dl>
1856 </dd></dl>
1857 </li></ul>
1858
1859 !! end
1860
1861
1862 !! test
1863 Definition Lists: Mixed Lists: Test 4
1864 !! input
1865 *;d1 :d2
1866 *;d3 :d4
1867 !! result
1868 <ul><li><dl><dt>d1&#160;</dt><dd>d2
1869 </dd><dt>d3&#160;</dt><dd>d4
1870 </dd></dl>
1871 </li></ul>
1872
1873 !! end
1874
1875
1876 !! test
1877 Definition Lists: Mixed Lists: Test 5
1878 !! input
1879 *:d1
1880 *:: d2
1881 !! result
1882 <ul><li><dl><dd>d1
1883 <dl><dd> d2
1884 </dd></dl>
1885 </dd></dl>
1886 </li></ul>
1887
1888 !! end
1889
1890
1891 !! test
1892 Definition Lists: Mixed Lists: Test 6
1893 !! input
1894 #*:d1
1895 #*::: d3
1896 !! result
1897 <ol><li><ul><li><dl><dd>d1
1898 <dl><dd><dl><dd> d3
1899 </dd></dl>
1900 </dd></dl>
1901 </dd></dl>
1902 </li></ul>
1903 </li></ol>
1904
1905 !! end
1906
1907
1908 !! test
1909 Definition Lists: Mixed Lists: Test 7
1910 !! input
1911 :* d1
1912 :* d2
1913 !! result
1914 <dl><dd><ul><li> d1
1915 </li><li> d2
1916 </li></ul>
1917 </dd></dl>
1918
1919 !! end
1920
1921
1922 !! test
1923 Definition Lists: Mixed Lists: Test 8
1924 !! input
1925 :* d1
1926 ::* d2
1927 !! result
1928 <dl><dd><ul><li> d1
1929 </li></ul>
1930 <dl><dd><ul><li> d2
1931 </li></ul>
1932 </dd></dl>
1933 </dd></dl>
1934
1935 !! end
1936
1937
1938 !! test
1939 Definition Lists: Mixed Lists: Test 9
1940 !! input
1941 *;foo :bar
1942 !! result
1943 <ul><li><dl><dt>foo&#160;</dt><dd>bar
1944 </dd></dl>
1945 </li></ul>
1946
1947 !! end
1948
1949
1950 !! test
1951 Definition Lists: Mixed Lists: Test 10
1952 !! input
1953 *#;foo :bar
1954 !! result
1955 <ul><li><ol><li><dl><dt>foo&#160;</dt><dd>bar
1956 </dd></dl>
1957 </li></ol>
1958 </li></ul>
1959
1960 !! end
1961
1962
1963 !! test
1964 Definition Lists: Mixed Lists: Test 11
1965 !! input
1966 *#*#;*;;foo :bar
1967 *#*#;boo :baz
1968 !! result
1969 <ul><li><ol><li><ul><li><ol><li><dl><dt>foo&#160;</dt><dd><ul><li><dl><dt><dl><dt>bar
1970 </dt></dl>
1971 </dd></dl>
1972 </li></ul>
1973 </dd></dl>
1974 <dl><dt>boo&#160;</dt><dd>baz
1975 </dd></dl>
1976 </li></ol>
1977 </li></ul>
1978 </li></ol>
1979 </li></ul>
1980
1981 !! end
1982
1983
1984 !! test
1985 Definition Lists: Weird Ones: Test 1
1986 !! input
1987 *#;*::;; foo : bar (who uses this?)
1988 !! result
1989 <ul><li><ol><li><dl><dt> foo&#160;</dt><dd><ul><li><dl><dd><dl><dd><dl><dt><dl><dt> bar (who uses this?)
1990 </dt></dl>
1991 </dd></dl>
1992 </dd></dl>
1993 </dd></dl>
1994 </li></ul>
1995 </dd></dl>
1996 </li></ol>
1997 </li></ul>
1998
1999 !! end
2000
2001 ###
2002 ### External links
2003 ###
2004 !! test
2005 External links: non-bracketed
2006 !! input
2007 Non-bracketed: http://example.com
2008 !! result
2009 <p>Non-bracketed: <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
2010 </p>
2011 !! end
2012
2013 !! test
2014 External links: numbered
2015 !! input
2016 Numbered: [http://example.com]
2017 Numbered: [http://example.net]
2018 Numbered: [http://example.com]
2019 !! result
2020 <p>Numbered: <a rel="nofollow" class="external autonumber" href="http://example.com">[1]</a>
2021 Numbered: <a rel="nofollow" class="external autonumber" href="http://example.net">[2]</a>
2022 Numbered: <a rel="nofollow" class="external autonumber" href="http://example.com">[3]</a>
2023 </p>
2024 !!end
2025
2026 !! test
2027 External links: specified text
2028 !! input
2029 Specified text: [http://example.com link]
2030 !! result
2031 <p>Specified text: <a rel="nofollow" class="external text" href="http://example.com">link</a>
2032 </p>
2033 !!end
2034
2035 !! test
2036 External links: trail
2037 !! input
2038 Linktrails should not work for external links: [http://example.com link]s
2039 !! result
2040 <p>Linktrails should not work for external links: <a rel="nofollow" class="external text" href="http://example.com">link</a>s
2041 </p>
2042 !! end
2043
2044 !! test
2045 External links: dollar sign in URL
2046 !! input
2047 http://example.com/1$2345
2048 !! result
2049 <p><a rel="nofollow" class="external free" href="http://example.com/1$2345">http://example.com/1$2345</a>
2050 </p>
2051 !! end
2052
2053 !! test
2054 External links: dollar sign in URL (named)
2055 !! input
2056 [http://example.com/1$2345]
2057 !! result
2058 <p><a rel="nofollow" class="external autonumber" href="http://example.com/1$2345">[1]</a>
2059 </p>
2060 !!end
2061
2062 !! test
2063 External links: open square bracket forbidden in URL (bug 4377)
2064 !! input
2065 http://example.com/1[2345
2066 !! result
2067 <p><a rel="nofollow" class="external free" href="http://example.com/1">http://example.com/1</a>[2345
2068 </p>
2069 !! end
2070
2071 !! test
2072 External links: open square bracket forbidden in URL (named) (bug 4377)
2073 !! input
2074 [http://example.com/1[2345]
2075 !! result
2076 <p><a rel="nofollow" class="external text" href="http://example.com/1">[2345</a>
2077 </p>
2078 !!end
2079
2080 !! test
2081 External links: nowiki in URL link text (bug 6230)
2082 !!input
2083 [http://example.com/ <nowiki>''example site''</nowiki>]
2084 !! result
2085 <p><a rel="nofollow" class="external text" href="http://example.com/">''example site''</a>
2086 </p>
2087 !! end
2088
2089 !! test
2090 External links: newline forbidden in text (bug 6230 regression check)
2091 !! input
2092 [http://example.com/ first
2093 second]
2094 !! result
2095 <p>[<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a> first
2096 second]
2097 </p>
2098 !!end
2099
2100 !! test
2101 External links: Pipe char between url and text
2102 !! input
2103 [http://example.com | link]
2104 !! result
2105 <p><a rel="nofollow" class="external text" href="http://example.com">| link</a>
2106 </p>
2107 !!end
2108
2109 !! test
2110 External links: protocol-relative URL in brackets
2111 !! input
2112 [//example.com/ Test]
2113 !! result
2114 <p><a rel="nofollow" class="external text" href="//example.com/">Test</a>
2115 </p>
2116 !! end
2117
2118 !! test
2119 External links: protocol-relative URL in brackets without text
2120 !! input
2121 [//example.com]
2122 !! result
2123 <p><a rel="nofollow" class="external autonumber" href="//example.com">[1]</a>
2124 </p>
2125 !! end
2126
2127 !! test
2128 External links: protocol-relative URL in free text is left alone
2129 !! input
2130 //example.com/Foo
2131 !! result
2132 <p>//example.com/Foo
2133 </p>
2134 !!end
2135
2136 !! test
2137 External links: protocol-relative URL in the middle of a word is left alone (bug 30269)
2138 !! input
2139 foo//example.com/Foo
2140 !! result
2141 <p>foo//example.com/Foo
2142 </p>
2143 !! end
2144
2145 !! test
2146 External image
2147 !! input
2148 External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
2149 !! result
2150 <p>External image: <img src="http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" />
2151 </p>
2152 !! end
2153
2154 !! test
2155 External image from https
2156 !! input
2157 External image from https: https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
2158 !! result
2159 <p>External image from https: <img src="https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" />
2160 </p>
2161 !! end
2162
2163 !! test
2164 Link to non-http image, no img tag
2165 !! input
2166 Link to non-http image, no img tag: ftp://example.com/test.jpg
2167 !! result
2168 <p>Link to non-http image, no img tag: <a rel="nofollow" class="external free" href="ftp://example.com/test.jpg">ftp://example.com/test.jpg</a>
2169 </p>
2170 !! end
2171
2172 !! test
2173 External links: terminating separator
2174 !! input
2175 Terminating separator: http://example.com/thing,
2176 !! result
2177 <p>Terminating separator: <a rel="nofollow" class="external free" href="http://example.com/thing">http://example.com/thing</a>,
2178 </p>
2179 !! end
2180
2181 !! test
2182 External links: intervening separator
2183 !! input
2184 Intervening separator: http://example.com/1,2,3
2185 !! result
2186 <p>Intervening separator: <a rel="nofollow" class="external free" href="http://example.com/1,2,3">http://example.com/1,2,3</a>
2187 </p>
2188 !! end
2189
2190 !! test
2191 External links: old bug with URL in query
2192 !! input
2193 Old bug with URL in query: [http://example.com/thing?url=http://example.com link]
2194 !! result
2195 <p>Old bug with URL in query: <a rel="nofollow" class="external text" href="http://example.com/thing?url=http://example.com">link</a>
2196 </p>
2197 !! end
2198
2199 !! test
2200 External links: old URL-in-URL bug, mixed protocols
2201 !! input
2202 And again with mixed protocols: [ftp://example.com?url=http://example.com link]
2203 !! result
2204 <p>And again with mixed protocols: <a rel="nofollow" class="external text" href="ftp://example.com?url=http://example.com">link</a>
2205 </p>
2206 !!end
2207
2208 !! test
2209 External links: URL in text
2210 !! input
2211 URL in text: [http://example.com http://example.com]
2212 !! result
2213 <p>URL in text: <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
2214 </p>
2215 !! end
2216
2217 !! test
2218 External links: Clickable images
2219 !! input
2220 ja-style clickable images: [http://example.com http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png]
2221 !! result
2222 <p>ja-style clickable images: <a rel="nofollow" class="external text" href="http://example.com"><img src="http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" /></a>
2223 </p>
2224 !!end
2225
2226 !! test
2227 External links: raw ampersand
2228 !! input
2229 Old &amp; use: http://x&y
2230 !! result
2231 <p>Old &amp; use: <a rel="nofollow" class="external free" href="http://x&amp;y">http://x&amp;y</a>
2232 </p>
2233 !! end
2234
2235 !! test
2236 External links: encoded ampersand
2237 !! input
2238 Old &amp; use: http://x&amp;y
2239 !! result
2240 <p>Old &amp; use: <a rel="nofollow" class="external free" href="http://x&amp;y">http://x&amp;y</a>
2241 </p>
2242 !! end
2243
2244 !! test
2245 External links: encoded equals (bug 6102)
2246 !! input
2247 http://example.com/?foo&#61;bar
2248 !! result
2249 <p><a rel="nofollow" class="external free" href="http://example.com/?foo=bar">http://example.com/?foo=bar</a>
2250 </p>
2251 !! end
2252
2253 !! test
2254 External links: [raw ampersand]
2255 !! input
2256 Old &amp; use: [http://x&y]
2257 !! result
2258 <p>Old &amp; use: <a rel="nofollow" class="external autonumber" href="http://x&amp;y">[1]</a>
2259 </p>
2260 !! end
2261
2262 !! test
2263 External links: [encoded ampersand]
2264 !! input
2265 Old &amp; use: [http://x&amp;y]
2266 !! result
2267 <p>Old &amp; use: <a rel="nofollow" class="external autonumber" href="http://x&amp;y">[1]</a>
2268 </p>
2269 !! end
2270
2271 !! test
2272 External links: [encoded equals] (bug 6102)
2273 !! input
2274 [http://example.com/?foo&#61;bar]
2275 !! result
2276 <p><a rel="nofollow" class="external autonumber" href="http://example.com/?foo=bar">[1]</a>
2277 </p>
2278 !! end
2279
2280 !! test
2281 External links: [IDN ignored character reference in hostname; strip it right off]
2282 !! input
2283 [http://e&zwnj;xample.com/]
2284 !! result
2285 <p><a rel="nofollow" class="external autonumber" href="http://example.com/">[1]</a>
2286 </p>
2287 !! end
2288
2289 # FIXME: This test (the IDN characters in the text of a link) is an inconsistency.
2290 # Where an external link could easily circumvent the sanitization of the text of
2291 # a link like this (where an IDN-ignore character is in the URL somewhere), this
2292 # test demands a higher standard. That's a bit strange.
2293 #
2294 # Example:
2295 #
2296 # http://e‌xample.com -> [http://example.com|http://example.com]
2297 # [http://example.com|http://e‌xample.com] -> [http://example.com|http://e‌xample.com]
2298 #
2299 # The first example is sanitized, but the second is not. Any security benefits
2300 # from this production are trivial to circumvent. Either remove this test and
2301 # let the parser(s) do their thing unaccosted, or fix the inconsistency and change
2302 # the test accordingly.
2303 #
2304 # All our love,
2305 # The Parsoid team.
2306 !! test
2307 External links: IDN ignored character reference in hostname; strip it right off
2308 !! input
2309 http://e&zwnj;xample.com/
2310 !! result
2311 <p><a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>
2312 </p>
2313 !! end
2314
2315 !! test
2316 External links: www.jpeg.org (bug 554)
2317 !! input
2318 http://www.jpeg.org
2319 !!result
2320 <p><a rel="nofollow" class="external free" href="http://www.jpeg.org">http://www.jpeg.org</a>
2321 </p>
2322 !! end
2323
2324 !! test
2325 External links: URL within URL (original bug 2)
2326 !! input
2327 [http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp]
2328 !! result
2329 <p><a rel="nofollow" class="external autonumber" href="http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp">[1]</a>
2330 </p>
2331 !! end
2332
2333 !! test
2334 BUG 361: URL inside bracketed URL
2335 !! input
2336 [http://www.example.com/foo http://www.example.com/bar]
2337 !! result
2338 <p><a rel="nofollow" class="external text" href="http://www.example.com/foo">http://www.example.com/bar</a>
2339 </p>
2340 !! end
2341
2342 !! test
2343 BUG 361: URL within URL, not bracketed
2344 !! input
2345 http://www.example.com/foo?=http://www.example.com/bar
2346 !! result
2347 <p><a rel="nofollow" class="external free" href="http://www.example.com/foo?=http://www.example.com/bar">http://www.example.com/foo?=http://www.example.com/bar</a>
2348 </p>
2349 !! end
2350
2351 !! test
2352 BUG 289: ">"-token in URL-tail
2353 !! input
2354 http://www.example.com/<hello>
2355 !! result
2356 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a>&lt;hello&gt;
2357 </p>
2358 !!end
2359
2360 !! test
2361 BUG 289: literal ">"-token in URL-tail
2362 !! input
2363 http://www.example.com/<b>html</b>
2364 !! result
2365 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a><b>html</b>
2366 </p>
2367 !!end
2368
2369 !! test
2370 BUG 289: ">"-token in bracketed URL
2371 !! input
2372 [http://www.example.com/<hello> stuff]
2373 !! result
2374 <p><a rel="nofollow" class="external text" href="http://www.example.com/">&lt;hello&gt; stuff</a>
2375 </p>
2376 !!end
2377
2378 !! test
2379 BUG 289: literal ">"-token in bracketed URL
2380 !! input
2381 [http://www.example.com/<b>html</b> stuff]
2382 !! result
2383 <p><a rel="nofollow" class="external text" href="http://www.example.com/"><b>html</b> stuff</a>
2384 </p>
2385 !!end
2386
2387 !! test
2388 BUG 289: literal double quote at end of URL
2389 !! input
2390 http://www.example.com/"hello"
2391 !! result
2392 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a>"hello"
2393 </p>
2394 !!end
2395
2396 !! test
2397 BUG 289: literal double quote in bracketed URL
2398 !! input
2399 [http://www.example.com/"hello" stuff]
2400 !! result
2401 <p><a rel="nofollow" class="external text" href="http://www.example.com/">"hello" stuff</a>
2402 </p>
2403 !!end
2404
2405 !! test
2406 External links: multiple legal whitespace is fine, Magnus. Don't break it please. (bug 5081)
2407 !! input
2408 [http://www.example.com test]
2409 !! result
2410 <p><a rel="nofollow" class="external text" href="http://www.example.com">test</a>
2411 </p>
2412 !! end
2413
2414 !! test
2415 External links: wiki links within external link (Bug 3695)
2416 !! input
2417 [http://example.com [[wikilink]] embedded in ext link]
2418 !! result
2419 <p><a rel="nofollow" class="external text" href="http://example.com"></a><a href="/index.php?title=Wikilink&amp;action=edit&amp;redlink=1" class="new" title="Wikilink (page does not exist)">wikilink</a><a rel="nofollow" class="external text" href="http://example.com"> embedded in ext link</a>
2420 </p>
2421 !! end
2422
2423 !! test
2424 BUG 787: Links with one slash after the url protocol are invalid
2425 !! input
2426 http:/example.com
2427
2428 [http:/example.com title]
2429 !! result
2430 <p>http:/example.com
2431 </p><p>[http:/example.com title]
2432 </p>
2433 !! end
2434
2435 !! test
2436 Bracketed external links with template-generated invalid target
2437 !! input
2438 [{{echo|http:/example.com}} title]
2439 !! result
2440 <p>[http:/example.com title]
2441 </p>
2442 !! end
2443
2444 !! test
2445 Bug 2702: Mismatched <i>, <b> and <a> tags are invalid
2446 !! input
2447 ''[http://example.com text'']
2448 [http://example.com '''text]'''
2449 ''Something [http://example.com in italic'']
2450 ''Something [http://example.com mixed''''', even bold]'''
2451 '''''Now [http://example.com both''''']
2452 !! result
2453 <p><a rel="nofollow" class="external text" href="http://example.com"><i>text</i></a>
2454 <a rel="nofollow" class="external text" href="http://example.com"><b>text</b></a>
2455 <i>Something </i><a rel="nofollow" class="external text" href="http://example.com"><i>in italic</i></a>
2456 <i>Something </i><a rel="nofollow" class="external text" href="http://example.com"><i>mixed</i><b>, even bold</b></a>
2457 <i><b>Now </b></i><a rel="nofollow" class="external text" href="http://example.com"><i><b>both</b></i></a>
2458 </p>
2459 !! end
2460
2461
2462 !! test
2463 Bug 4781: %26 in URL
2464 !! input
2465 http://www.example.com/?title=AT%26T
2466 !! result
2467 <p><a rel="nofollow" class="external free" href="http://www.example.com/?title=AT%26T">http://www.example.com/?title=AT%26T</a>
2468 </p>
2469 !! end
2470
2471 # According to http://dev.w3.org/html5/spec/Overview.html#parsing-urls a plain
2472 # % is actually legal in HTML5. Any change in output would need testing though.
2473 !! test
2474 Bug 4781, 5267: %25 in URL
2475 !! input
2476 http://www.example.com/?title=100%25_Bran
2477 !! result
2478 <p><a rel="nofollow" class="external free" href="http://www.example.com/?title=100%25_Bran">http://www.example.com/?title=100%25_Bran</a>
2479 </p>
2480 !! end
2481
2482 !! test
2483 Bug 4781, 5267: %28, %29 in URL
2484 !! input
2485 http://www.example.com/?title=Ben-Hur_%281959_film%29
2486 !! result
2487 <p><a rel="nofollow" class="external free" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">http://www.example.com/?title=Ben-Hur_%281959_film%29</a>
2488 </p>
2489 !! end
2490
2491
2492 !! test
2493 Bug 4781: %26 in autonumber URL
2494 !! input
2495 [http://www.example.com/?title=AT%26T]
2496 !! result
2497 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=AT%26T">[1]</a>
2498 </p>
2499 !! end
2500
2501 !! test
2502 Bug 4781, 5267: %26 in autonumber URL
2503 !! input
2504 [http://www.example.com/?title=100%25_Bran]
2505 !! result
2506 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=100%25_Bran">[1]</a>
2507 </p>
2508 !! end
2509
2510 !! test
2511 Bug 4781, 5267: %28, %29 in autonumber URL
2512 !! input
2513 [http://www.example.com/?title=Ben-Hur_%281959_film%29]
2514 !! result
2515 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">[1]</a>
2516 </p>
2517 !! end
2518
2519
2520 !! test
2521 Bug 4781: %26 in bracketed URL
2522 !! input
2523 [http://www.example.com/?title=AT%26T link]
2524 !! result
2525 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=AT%26T">link</a>
2526 </p>
2527 !! end
2528
2529 !! test
2530 Bug 4781, 5267: %26 in bracketed URL
2531 !! input
2532 [http://www.example.com/?title=100%25_Bran link]
2533 !! result
2534 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=100%25_Bran">link</a>
2535 </p>
2536 !! end
2537
2538 !! test
2539 Bug 4781, 5267: %28, %29 in bracketed URL
2540 !! input
2541 [http://www.example.com/?title=Ben-Hur_%281959_film%29 link]
2542 !! result
2543 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">link</a>
2544 </p>
2545 !! end
2546
2547 !! test
2548 External link containing double-single-quotes in text '' (bug 4598 sanity check)
2549 !! input
2550 Some [http://example.com/ pretty ''italics'' and stuff]!
2551 !! result
2552 <p>Some <a rel="nofollow" class="external text" href="http://example.com/">pretty <i>italics</i> and stuff</a>!
2553 </p>
2554 !! end
2555
2556 !! test
2557 External link containing double-single-quotes in text embedded in italics (bug 4598 sanity check)
2558 !! input
2559 ''Some [http://example.com/ pretty ''italics'' and stuff]!''
2560 !! result
2561 <p><i>Some </i><a rel="nofollow" class="external text" href="http://example.com/"><i>pretty </i>italics<i> and stuff</i></a><i>!</i>
2562 </p>
2563 !! end
2564
2565 !! test
2566 External link containing double-single-quotes with no space separating the url from text in italics
2567 !! input
2568 [http://www.musee-picasso.fr/pages/page_id18528_u1l2.htm''La muerte de Casagemas'' (1901) en el sitio de [[Museo Picasso (París)|Museo Picasso]].]
2569 !! result
2570 <p><a rel="nofollow" class="external text" href="http://www.musee-picasso.fr/pages/page_id18528_u1l2.htm"><i>La muerte de Casagemas</i> (1901) en el sitio de <a href="/index.php?title=Museo_Picasso_(Par%C3%ADs)&amp;action=edit&amp;redlink=1" class="new" title="Museo Picasso (París) (page does not exist)">Museo Picasso</a>.</a>
2571 </p>
2572 !! end
2573
2574 !! test
2575 URL-encoding in URL functions (single parameter)
2576 !! input
2577 {{localurl:Some page|amp=&}}
2578 !! result
2579 <p>/index.php?title=Some_page&amp;amp=&amp;
2580 </p>
2581 !! end
2582
2583 !! test
2584 URL-encoding in URL functions (multiple parameters)
2585 !! input
2586 {{localurl:Some page|q=?&amp=&}}
2587 !! result
2588 <p>/index.php?title=Some_page&amp;q=?&amp;amp=&amp;
2589 </p>
2590 !! end
2591
2592 !! test
2593 Brackets in urls
2594 !! input
2595 http://example.com/index.php?foozoid%5B%5D=bar
2596
2597 http://example.com/index.php?foozoid&#x5B;&#x5D;=bar
2598 !! result
2599 <p><a rel="nofollow" class="external free" href="http://example.com/index.php?foozoid%5B%5D=bar">http://example.com/index.php?foozoid%5B%5D=bar</a>
2600 </p><p><a rel="nofollow" class="external free" href="http://example.com/index.php?foozoid%5B%5D=bar">http://example.com/index.php?foozoid%5B%5D=bar</a>
2601 </p>
2602 !! end
2603
2604 !! test
2605 IPv6 urls (bug 21261)
2606 !! options
2607 disabled
2608 !! input
2609 http://[2404:130:0:1000::187:2]/index.php
2610 !! result
2611 <p><a rel="nofollow" class="external free" href="http://[2404:130:0:1000::187:2]/index.php">http://[2404:130:0:1000::187:2]/index.php</a>
2612 </p>
2613 !! end
2614
2615 !! test
2616 Non-extlinks in brackets
2617 !! input
2618 [foo]
2619 [foo bar]
2620 [foo ''bar'']
2621 [fool's] errand
2622 [fool's errand]
2623 [{{echo|foo}}]
2624 [{{echo|foo}} bar]
2625 [{{echo|foo}} ''bar'']
2626 [{{echo|foo}}l's] errand
2627 [{{echo|foo}}l's errand]
2628 !! result
2629 <p>[foo]
2630 [foo bar]
2631 [foo <i>bar</i>]
2632 [fool's] errand
2633 [fool's errand]
2634 [foo]
2635 [foo bar]
2636 [foo <i>bar</i>]
2637 [fool's] errand
2638 [fool's errand]
2639 </p>
2640 !! end
2641
2642 ###
2643 ### Quotes
2644 ###
2645
2646 !! test
2647 Quotes
2648 !! input
2649 Normal text. '''Bold text.''' Normal text. ''Italic text.''
2650
2651 Normal text. '''''Bold italic text.''''' Normal text.
2652 !!result
2653 <p>Normal text. <b>Bold text.</b> Normal text. <i>Italic text.</i>
2654 </p><p>Normal text. <i><b>Bold italic text.</b></i> Normal text.
2655 </p>
2656 !! end
2657
2658
2659 !! test
2660 Unclosed and unmatched quotes
2661 !! input
2662 '''''Bold italic text '''with bold deactivated''' in between.'''''
2663
2664 '''''Bold italic text ''with italic deactivated'' in between.'''''
2665
2666 '''Bold text..
2667
2668 ..spanning two paragraphs (should not work).'''
2669
2670 '''Bold tag left open
2671
2672 ''Italic tag left open
2673
2674 Normal text.
2675
2676 <!-- Unmatching number of opening, closing tags: -->
2677 '''This year''''s election ''should'' beat '''last year''''s.
2678
2679 ''Tom'''s car is bigger than ''Susan'''s.
2680
2681 Plain ''italic'''s plain
2682 !! result
2683 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
2684 </p><p><b><i>Bold italic text </i>with italic deactivated<i> in between.</i></b>
2685 </p><p><b>Bold text..</b>
2686 </p><p>..spanning two paragraphs (should not work).
2687 </p><p><b>Bold tag left open</b>
2688 </p><p><i>Italic tag left open</i>
2689 </p><p>Normal text.
2690 </p><p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
2691 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
2692 </p><p>Plain <i>italic'</i>s plain
2693 </p>
2694 !! end
2695
2696 ###
2697 ### Tables
2698 ###
2699 ### some content taken from http://meta.wikimedia.org/wiki/MediaWiki_User%27s_Guide:_Using_tables
2700 ###
2701
2702 # This should not produce <table></table> as <table><tr><td></td></tr></table>
2703 # is the bare minimun required by the spec, see:
2704 # http://www.w3.org/TR/xhtml-modularization/dtd_module_defs.html#a_module_Basic_Tables
2705 !! test
2706 A table with no data.
2707 !! input
2708 {||}
2709 !! result
2710 !! end
2711
2712 # A table with nothing but a caption is invalid XHTML, we might want to render
2713 # this as <p>caption</p>
2714 !! test
2715 A table with nothing but a caption
2716 !! input
2717 {|
2718 |+ caption
2719 |}
2720 !! result
2721 <table>
2722 <caption> caption
2723 </caption><tr><td></td></tr></table>
2724
2725 !! end
2726
2727 !! test
2728 Table td-cell syntax variations
2729 !! input
2730 {|
2731 | foo bar foo | baz
2732 | foo bar foo || baz
2733 | style='color:red;' | baz
2734 | style='color:red;' || baz
2735 |}
2736 !! result
2737 <table>
2738 <tr>
2739 <td> baz
2740 </td>
2741 <td> foo bar foo </td>
2742 <td> baz
2743 </td>
2744 <td style="color:red;"> baz
2745 </td>
2746 <td> style='color:red;' </td>
2747 <td> baz
2748 </td></tr></table>
2749
2750 !! end
2751
2752 !! test
2753 Simple table
2754 !! input
2755 {|
2756 | 1 || 2
2757 |-
2758 | 3 || 4
2759 |}
2760 !! result
2761 <table>
2762 <tr>
2763 <td> 1 </td>
2764 <td> 2
2765 </td></tr>
2766 <tr>
2767 <td> 3 </td>
2768 <td> 4
2769 </td></tr></table>
2770
2771 !! end
2772
2773 !! test
2774 Simple table but with multiple dashes for row wikitext
2775 !! input
2776 {|
2777 | foo
2778 |-----
2779 | bar
2780 |}
2781 !! result
2782 <table>
2783 <tr>
2784 <td> foo
2785 </td></tr>
2786 <tr>
2787 <td> bar
2788 </td></tr></table>
2789
2790 !! end
2791 !! test
2792 Multiplication table
2793 !! input
2794 {| border="1" cellpadding="2"
2795 |+Multiplication table
2796 |-
2797 ! &times; !! 1 !! 2 !! 3
2798 |-
2799 ! 1
2800 | 1 || 2 || 3
2801 |-
2802 ! 2
2803 | 2 || 4 || 6
2804 |-
2805 ! 3
2806 | 3 || 6 || 9
2807 |-
2808 ! 4
2809 | 4 || 8 || 12
2810 |-
2811 ! 5
2812 | 5 || 10 || 15
2813 |}
2814 !! result
2815 <table border="1" cellpadding="2">
2816 <caption>Multiplication table
2817 </caption>
2818 <tr>
2819 <th> &#215; </th>
2820 <th> 1 </th>
2821 <th> 2 </th>
2822 <th> 3
2823 </th></tr>
2824 <tr>
2825 <th> 1
2826 </th>
2827 <td> 1 </td>
2828 <td> 2 </td>
2829 <td> 3
2830 </td></tr>
2831 <tr>
2832 <th> 2
2833 </th>
2834 <td> 2 </td>
2835 <td> 4 </td>
2836 <td> 6
2837 </td></tr>
2838 <tr>
2839 <th> 3
2840 </th>
2841 <td> 3 </td>
2842 <td> 6 </td>
2843 <td> 9
2844 </td></tr>
2845 <tr>
2846 <th> 4
2847 </th>
2848 <td> 4 </td>
2849 <td> 8 </td>
2850 <td> 12
2851 </td></tr>
2852 <tr>
2853 <th> 5
2854 </th>
2855 <td> 5 </td>
2856 <td> 10 </td>
2857 <td> 15
2858 </td></tr></table>
2859
2860 !! end
2861
2862 !! test
2863 Accept "||" in table headings
2864 !! input
2865 {|
2866 !h1 || h2
2867 |}
2868 !! result
2869 <table>
2870 <tr>
2871 <th>h1 </th>
2872 <th> h2
2873 </th></tr></table>
2874
2875 !! end
2876
2877 !! test
2878 Accept "||" in indented table headings
2879 !! input
2880 :{|
2881 !h1 || h2
2882 |}
2883 !! result
2884 <dl><dd><table>
2885 <tr>
2886 <th>h1 </th>
2887 <th> h2
2888 </th></tr></table></dd></dl>
2889
2890 !! end
2891
2892 !! test
2893 Accept empty attributes in td/th cells (td/th cells starting with leading ||)
2894 !! input
2895 {|
2896 !| h1
2897 || a
2898 |}
2899 !! result
2900 <table>
2901 <tr>
2902 <th> h1
2903 </th>
2904 <td> a
2905 </td></tr></table>
2906
2907 !! end
2908
2909 !!test
2910 Accept "| !" at start of line in tables (ignore !-attribute)
2911 !!input
2912 {|
2913 |-
2914 | !style="color:red" | bar
2915 |}
2916 !!result
2917 <table>
2918
2919 <tr>
2920 <td> bar
2921 </td></tr></table>
2922
2923 !!end
2924
2925 !!test
2926 Allow +/- in 2nd and later cells in a row, in 1st cell when td-attrs are present, or in 1st cell when there is a space between "|" and +/-
2927 !!input
2928 {|
2929 |-
2930 |style='color:red;'|+1
2931 |style='color:blue;'|-1
2932 |-
2933 | 1 || 2 || 3
2934 | 1 ||+2 ||-3
2935 |-
2936 | +1
2937 | -1
2938 |}
2939 !!result
2940 <table>
2941
2942 <tr>
2943 <td style="color:red;">+1
2944 </td>
2945 <td style="color:blue;">-1
2946 </td></tr>
2947 <tr>
2948 <td> 1 </td>
2949 <td> 2 </td>
2950 <td> 3
2951 </td>
2952 <td> 1 </td>
2953 <td>+2 </td>
2954 <td>-3
2955 </td></tr>
2956 <tr>
2957 <td> +1
2958 </td>
2959 <td> -1
2960 </td></tr></table>
2961
2962 !!end
2963
2964 !! test
2965 Table rowspan
2966 !! input
2967 {| border=1
2968 | Cell 1, row 1
2969 |rowspan=2| Cell 2, row 1 (and 2)
2970 | Cell 3, row 1
2971 |-
2972 | Cell 1, row 2
2973 | Cell 3, row 2
2974 |}
2975 !! result
2976 <table border="1">
2977 <tr>
2978 <td> Cell 1, row 1
2979 </td>
2980 <td rowspan="2"> Cell 2, row 1 (and 2)
2981 </td>
2982 <td> Cell 3, row 1
2983 </td></tr>
2984 <tr>
2985 <td> Cell 1, row 2
2986 </td>
2987 <td> Cell 3, row 2
2988 </td></tr></table>
2989
2990 !! end
2991
2992 !! test
2993 Nested table
2994 !! input
2995 {| border=1
2996 | &alpha;
2997 |
2998 {| bgcolor=#ABCDEF border=2
2999 |nested
3000 |-
3001 |table
3002 |}
3003 |the original table again
3004 |}
3005 !! result
3006 <table border="1">
3007 <tr>
3008 <td> &#945;
3009 </td>
3010 <td>
3011 <table bgcolor="#ABCDEF" border="2">
3012 <tr>
3013 <td>nested
3014 </td></tr>
3015 <tr>
3016 <td>table
3017 </td></tr></table>
3018 </td>
3019 <td>the original table again
3020 </td></tr></table>
3021
3022 !! end
3023
3024 !! test
3025 Invalid attributes in table cell (bug 1830)
3026 !! input
3027 {|
3028 |Cell:|broken
3029 |}
3030 !! result
3031 <table>
3032 <tr>
3033 <td>broken
3034 </td></tr></table>
3035
3036 !! end
3037
3038
3039 !! test
3040 Table security: embedded pipes (http://lists.wikimedia.org/mailman/htdig/wikitech-l/2006-April/022293.html)
3041 !! input
3042 {|
3043 | |[ftp://|x||]" onmouseover="alert(document.cookie)">test
3044 !! result
3045 <table>
3046 <tr>
3047 <td>[<a rel="nofollow" class="external free" href="ftp://%7Cx">ftp://%7Cx</a></td>
3048 <td>]" onmouseover="alert(document.cookie)"&gt;test
3049 </td>
3050 </tr>
3051 </table>
3052
3053 !! end
3054
3055
3056 !! test
3057 Indented table markup mixed with indented pre content (proposed in bug 6200)
3058 !! input
3059 <table>
3060 <tr>
3061 <td>
3062 Text that should be rendered preformatted
3063 </td>
3064 </tr>
3065 </table>
3066 !! result
3067 <table>
3068 <tr>
3069 <td>
3070 <pre>Text that should be rendered preformatted
3071 </pre>
3072 </td>
3073 </tr>
3074 </table>
3075
3076 !! end
3077
3078 !! test
3079 Template-generated table cell attributes and cell content
3080 !! input
3081 {|
3082 |{{table_attribs}}
3083 |}
3084 !! result
3085 <table>
3086 <tr>
3087 <td style="color: red"> Foo
3088 </td></tr></table>
3089
3090 !! end
3091
3092 !! test
3093 Table with row followed by newlines and table heading
3094 !! input
3095 {|
3096 |-
3097
3098 ! foo
3099 |}
3100 !! result
3101 <table>
3102
3103
3104 <tr>
3105 <th> foo
3106 </th></tr></table>
3107
3108 !! end
3109
3110 # FIXME: Preserve the attribute properly (with an empty string as value) in
3111 # the PHP parser. Parsoid implements the behavior below.
3112 !! test
3113 Table attributes with empty value
3114 !! options
3115 disabled
3116 !! input
3117 {|
3118 | style=| hello
3119 |}
3120 !! result
3121 <table>
3122 <tr>
3123 <td style=""> hello
3124 </td></tr></table>
3125
3126 !! end
3127
3128 !! test
3129 Wikitext table with a lot of comments
3130 !! input
3131 {|
3132 <!-- c0 -->
3133 | foo
3134 <!-- c1 -->
3135 |- <!-- c2 -->
3136 <!-- c3 -->
3137 |<!-- c4 -->
3138 <!-- c5 -->
3139 |}
3140 !! result
3141 <table>
3142 <tr>
3143 <td> foo
3144 </td></tr>
3145 <tr>
3146 <td>
3147 </td></tr></table>
3148
3149 !! end
3150
3151 ###
3152 ### Internal links
3153 ###
3154 !! test
3155 Plain link, capitalized
3156 !! input
3157 [[Main Page]]
3158 !! result
3159 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
3160 </p>
3161 !! end
3162
3163 !! test
3164 Plain link, uncapitalized
3165 !! input
3166 [[main Page]]
3167 !! result
3168 <p><a href="/wiki/Main_Page" title="Main Page">main Page</a>
3169 </p>
3170 !! end
3171
3172 !! test
3173 Piped link
3174 !! input
3175 [[Main Page|The Main Page]]
3176 !! result
3177 <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
3178 </p>
3179 !! end
3180
3181 !! test
3182 Broken link
3183 !! input
3184 [[Zigzagzogzagzig]]
3185 !! result
3186 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig</a>
3187 </p>
3188 !! end
3189
3190 !! test
3191 Broken link with fragment
3192 !! input
3193 [[Zigzagzogzagzig#zug]]
3194 !! result
3195 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig#zug</a>
3196 </p>
3197 !! end
3198
3199 !! test
3200 Special page link with fragment
3201 !! input
3202 [[Special:Version#anchor]]
3203 !! result
3204 <p><a href="/wiki/Special:Version#anchor" title="Special:Version">Special:Version#anchor</a>
3205 </p>
3206 !! end
3207
3208 !! test
3209 Nonexistent special page link with fragment
3210 !! input
3211 [[Special:ThisNameWillHopefullyNeverBeUsed#anchor]]
3212 !! result
3213 <p><a href="/wiki/Special:ThisNameWillHopefullyNeverBeUsed" class="new" title="Special:ThisNameWillHopefullyNeverBeUsed (page does not exist)">Special:ThisNameWillHopefullyNeverBeUsed#anchor</a>
3214 </p>
3215 !! end
3216
3217 !! test
3218 Link with prefix
3219 !! input
3220 xxx[[main Page]], xxx[[Main Page]], Xxx[[main Page]] XXX[[main Page]], XXX[[Main Page]]
3221 !! result
3222 <p>xxx<a href="/wiki/Main_Page" title="Main Page">main Page</a>, xxx<a href="/wiki/Main_Page" title="Main Page">Main Page</a>, Xxx<a href="/wiki/Main_Page" title="Main Page">main Page</a> XXX<a href="/wiki/Main_Page" title="Main Page">main Page</a>, XXX<a href="/wiki/Main_Page" title="Main Page">Main Page</a>
3223 </p>
3224 !! end
3225
3226 !! test
3227 Link with suffix
3228 !! input
3229 [[Main Page]]xxx, [[Main Page]]XXX, [[Main Page]]!!!
3230 !! result
3231 <p><a href="/wiki/Main_Page" title="Main Page">Main Pagexxx</a>, <a href="/wiki/Main_Page" title="Main Page">Main Page</a>XXX, <a href="/wiki/Main_Page" title="Main Page">Main Page</a>!!!
3232 </p>
3233 !! end
3234
3235 !! article
3236 prefixed article
3237 !! text
3238 Some text
3239 !! endarticle
3240
3241 !! test
3242 Bug 43661: Piped links with identical prefixes
3243 !! input
3244 [[prefixed article|prefixed articles with spaces]]
3245
3246 [[prefixed article|prefixed articlesaoeu]]
3247
3248 [[Main Page|Main Page test]]
3249 !! result
3250 <p><a href="/wiki/Prefixed_article" title="Prefixed article">prefixed articles with spaces</a>
3251 </p><p><a href="/wiki/Prefixed_article" title="Prefixed article">prefixed articlesaoeu</a>
3252 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page test</a>
3253 </p>
3254 !! end
3255
3256
3257 !! test
3258 Link with HTML entity in suffix / tail
3259 !! input
3260 [[Main Page]]&quot;, [[Main Page]]&#97;
3261 !! result
3262 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>&quot;, <a href="/wiki/Main_Page" title="Main Page">Main Page</a>&#97;
3263 </p>
3264 !! end
3265
3266 !! test
3267 Link with 3 brackets
3268 !! input
3269 [[[main page]]]
3270 !! result
3271 <p>[[[main page]]]
3272 </p>
3273 !! end
3274
3275 !! test
3276 Piped link with 3 brackets
3277 !! input
3278 [[[main page|the main page]]]
3279 !! result
3280 <p>[[[main page|the main page]]]
3281 </p>
3282 !! end
3283
3284 !! test
3285 Link with multiple pipes
3286 !! input
3287 [[Main Page|The|Main|Page]]
3288 !! result
3289 <p><a href="/wiki/Main_Page" title="Main Page">The|Main|Page</a>
3290 </p>
3291 !! end
3292
3293 !! test
3294 Link to namespaces
3295 !! input
3296 [[Talk:Parser testing]], [[Meta:Disclaimers]]
3297 !! result
3298 <p><a href="/index.php?title=Talk:Parser_testing&amp;action=edit&amp;redlink=1" class="new" title="Talk:Parser testing (page does not exist)">Talk:Parser testing</a>, <a href="/index.php?title=Meta:Disclaimers&amp;action=edit&amp;redlink=1" class="new" title="Meta:Disclaimers (page does not exist)">Meta:Disclaimers</a>
3299 </p>
3300 !! end
3301
3302 !! test
3303 Piped link to namespace
3304 !! input
3305 [[Meta:Disclaimers|The disclaimers]]
3306 !! result
3307 <p><a href="/index.php?title=Meta:Disclaimers&amp;action=edit&amp;redlink=1" class="new" title="Meta:Disclaimers (page does not exist)">The disclaimers</a>
3308 </p>
3309 !! end
3310
3311 !! test
3312 Link containing }
3313 !! input
3314 [[Usually caused by a typo (oops}]]
3315 !! result
3316 <p>[[Usually caused by a typo (oops}]]
3317 </p>
3318 !! end
3319
3320 !! test
3321 Link containing % (not as a hex sequence)
3322 !! input
3323 [[7% Solution]]
3324 !! result
3325 <p><a href="/index.php?title=7%25_Solution&amp;action=edit&amp;redlink=1" class="new" title="7% Solution (page does not exist)">7% Solution</a>
3326 </p>
3327 !! end
3328
3329 !! test
3330 Link containing % as a single hex sequence interpreted to char
3331 !! input
3332 [[7%25 Solution]]
3333 !! result
3334 <p><a href="/index.php?title=7%25_Solution&amp;action=edit&amp;redlink=1" class="new" title="7% Solution (page does not exist)">7% Solution</a>
3335 </p>
3336 !!end
3337
3338 !! test
3339 Link containing % as a double hex sequence interpreted to hex sequence
3340 !! input
3341 [[7%2525 Solution]]
3342 !! result
3343 <p>[[7%2525 Solution]]
3344 </p>
3345 !!end
3346
3347 !! test
3348 Link containing "#<" and "#>" % as a hex sequences- these are valid section anchors
3349 Example for such a section: == < ==
3350 !! input
3351 [[%23%3c]][[%23%3e]]
3352 !! result
3353 <p><a href="#.3C">#&lt;</a><a href="#.3E">#&gt;</a>
3354 </p>
3355 !! end
3356
3357 !! test
3358 Link containing "<#" and ">#" as a hex sequences
3359 !! input
3360 [[%3c%23]][[%3e%23]]
3361 !! result
3362 <p>[[%3c%23]][[%3e%23]]
3363 </p>
3364 !! end
3365
3366 !! test
3367 Link containing double-single-quotes '' (bug 4598)
3368 !! input
3369 [[Lista d''e paise d''o munno]]
3370 !! result
3371 <p><a href="/index.php?title=Lista_d%27%27e_paise_d%27%27o_munno&amp;action=edit&amp;redlink=1" class="new" title="Lista d''e paise d''o munno (page does not exist)">Lista d''e paise d''o munno</a>
3372 </p>
3373 !! end
3374
3375 !! test
3376 Link containing double-single-quotes '' in text (bug 4598 sanity check)
3377 !! input
3378 Some [[Link|pretty ''italics'' and stuff]]!
3379 !! result
3380 <p>Some <a href="/index.php?title=Link&amp;action=edit&amp;redlink=1" class="new" title="Link (page does not exist)">pretty <i>italics</i> and stuff</a>!
3381 </p>
3382 !! end
3383
3384 !! test
3385 Link containing double-single-quotes '' in text embedded in italics (bug 4598 sanity check)
3386 !! input
3387 ''Some [[Link|pretty ''italics'' and stuff]]!
3388 !! result
3389 <p><i>Some <a href="/index.php?title=Link&amp;action=edit&amp;redlink=1" class="new" title="Link (page does not exist)">pretty <i>italics</i> and stuff</a>!</i>
3390 </p>
3391 !! end
3392
3393 !! test
3394 Link with double quotes in title part (literal) and alternate part (interpreted)
3395 !! input
3396 [[File:Denys Savchenko ''Pentecoste''.jpg]]
3397
3398 [[''Pentecoste'']]
3399
3400 [[''Pentecoste''|Pentecoste]]
3401
3402 [[''Pentecoste''|''Pentecoste'']]
3403 !! result
3404 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=Denys_Savchenko_%27%27Pentecoste%27%27.jpg" class="new" title="File:Denys Savchenko &#39;&#39;Pentecoste&#39;&#39;.jpg">File:Denys Savchenko <i>Pentecoste</i>.jpg</a>
3405 </p><p><a href="/index.php?title=%27%27Pentecoste%27%27&amp;action=edit&amp;redlink=1" class="new" title="''Pentecoste'' (page does not exist)">''Pentecoste''</a>
3406 </p><p><a href="/index.php?title=%27%27Pentecoste%27%27&amp;action=edit&amp;redlink=1" class="new" title="''Pentecoste'' (page does not exist)">Pentecoste</a>
3407 </p><p><a href="/index.php?title=%27%27Pentecoste%27%27&amp;action=edit&amp;redlink=1" class="new" title="''Pentecoste'' (page does not exist)"><i>Pentecoste</i></a>
3408 </p>
3409 !! end
3410
3411 !! test
3412 Broken image links with HTML captions (bug 39700)
3413 !! input
3414 [[File:Nonexistent|<script></script>]]
3415 [[File:Nonexistent|100px|<script></script>]]
3416 [[File:Nonexistent|&lt;]]
3417 [[File:Nonexistent|a<i>b</i>c]]
3418 !! result
3419 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script&gt;&lt;/script&gt;</a>
3420 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script&gt;&lt;/script&gt;</a>
3421 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;</a>
3422 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">abc</a>
3423 </p>
3424 !! end
3425
3426 !! test
3427 Plain link to URL
3428 !! input
3429 [[http://www.example.com]]
3430 !! result
3431 <p>[<a rel="nofollow" class="external autonumber" href="http://www.example.com">[1]</a>]
3432 </p>
3433 !! end
3434
3435 !! test
3436 Plain link to URL with link text
3437 !! input
3438 [[http://www.example.com Link text]]
3439 !! result
3440 <p>[<a rel="nofollow" class="external text" href="http://www.example.com">Link text</a>]
3441 </p>
3442 !! end
3443
3444 !! test
3445 Plain link to protocol-relative URL
3446 !! input
3447 [[//www.example.com]]
3448 !! result
3449 <p>[<a rel="nofollow" class="external autonumber" href="//www.example.com">[1]</a>]
3450 </p>
3451 !! end
3452
3453 !! test
3454 Plain link to protocol-relative URL with link text
3455 !! input
3456 [[//www.example.com Link text]]
3457 !! result
3458 <p>[<a rel="nofollow" class="external text" href="//www.example.com">Link text</a>]
3459 </p>
3460 !! end
3461
3462 !! test
3463 Plain link to page with question mark in title
3464 !! input
3465 [[A?b]]
3466
3467 [[A?b|Baz]]
3468 !! result
3469 <p><a href="/wiki/A%3Fb" title="A?b">A?b</a>
3470 </p><p><a href="/wiki/A%3Fb" title="A?b">Baz</a>
3471 </p>
3472 !! end
3473
3474
3475 # I'm fairly sure the expected result here is wrong.
3476 # We want these to be URL links, not pseudo-pages with URLs for titles....
3477 # However the current output is also pretty screwy.
3478 #
3479 # ----
3480 # I'm changing it to match the current output--it arguably makes more
3481 # sense in the light of the test above. Old expected result was:
3482 #<p>Piped link to URL: <a href="/index.php?title=Http://www.example.com&amp;action=edit" class="new">an example URL</a>
3483 #</p>
3484 # But I think this test is bordering on "garbage in, garbage out" anyway.
3485 # -- wtm
3486 !! test
3487 Piped link to URL
3488 !! input
3489 Piped link to URL: [[http://www.example.com|an example URL]]
3490 !! result
3491 <p>Piped link to URL: [<a rel="nofollow" class="external text" href="http://www.example.com%7Can">example URL</a>]
3492 </p>
3493 !! end
3494
3495 !! test
3496 BUG 2: [[page|http://url/]] should link to page, not http://url/
3497 !! input
3498 [[Main Page|http://url/]]
3499 !! result
3500 <p><a href="/wiki/Main_Page" title="Main Page">http://url/</a>
3501 </p>
3502 !! end
3503
3504 !! test
3505 BUG 337: Escaped self-links should be bold
3506 !! options
3507 title=[[Bug462]]
3508 !! input
3509 [[Bu&#103;462]] [[Bug462]]
3510 !! result
3511 <p><strong class="selflink">Bu&#103;462</strong> <strong class="selflink">Bug462</strong>
3512 </p>
3513 !! end
3514
3515 !! test
3516 Self-link to section should not be bold
3517 !! options
3518 title=[[Main Page]]
3519 !! input
3520 [[Main Page#section]]
3521 !! result
3522 <p><a href="/wiki/Main_Page#section" title="Main Page">Main Page#section</a>
3523 </p>
3524 !! end
3525
3526 !! article
3527 00
3528 !! text
3529 This is 00.
3530 !! endarticle
3531
3532 !!test
3533 Self-link to numeric title
3534 !!options
3535 title=[[0]]
3536 !!input
3537 [[0]]
3538 !!result
3539 <p><strong class="selflink">0</strong>
3540 </p>
3541 !!end
3542
3543 !!test
3544 Link to numeric-equivalent title
3545 !!options
3546 title=[[0]]
3547 !!input
3548 [[00]]
3549 !!result
3550 <p><a href="/wiki/00" title="00">00</a>
3551 </p>
3552 !!end
3553
3554 !! test
3555 <nowiki> inside a link
3556 !! input
3557 [[Main<nowiki> Page</nowiki>]] [[Main Page|the main page <nowiki>[it's not very good]</nowiki>]]
3558 !! result
3559 <p>[[Main Page]] <a href="/wiki/Main_Page" title="Main Page">the main page [it's not very good]</a>
3560 </p>
3561 !! end
3562
3563 !! test
3564 Non-breaking spaces in title
3565 !! input
3566 [[&nbsp; Main &nbsp; Page &nbsp;]]
3567 !! result
3568 <p><a href="/wiki/Main_Page" title="Main Page">&#160; Main &#160; Page &#160;</a>
3569 </p>
3570 !!end
3571
3572 !! test
3573 Internal link with ca linktrail, surrounded by bold apostrophes (bug 27473 primary issue)
3574 !! options
3575 language=ca
3576 !! input
3577 '''[[Main Page]]'''
3578 !! result
3579 <p><b><a href="/wiki/Main_Page" title="Main Page">Main Page</a></b>
3580 </p>
3581 !! end
3582
3583 !! test
3584 Internal link with ca linktrail, surrounded by italic apostrophes (bug 27473 primary issue)
3585 !! options
3586 language=ca
3587 !! input
3588 ''[[Main Page]]''
3589 !! result
3590 <p><i><a href="/wiki/Main_Page" title="Main Page">Main Page</a></i>
3591 </p>
3592 !! end
3593
3594 !! test
3595 Internal link with en linktrail: no apostrophes (bug 27473)
3596 !! options
3597 language=en
3598 !! input
3599 [[Something]]'nice
3600 !! result
3601 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (page does not exist)">Something</a>'nice
3602 </p>
3603 !! end
3604
3605 !! test
3606 Internal link with ca linktrail with apostrophes (bug 27473)
3607 !! options
3608 language=ca
3609 !! input
3610 [[Something]]'nice
3611 !! result
3612 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (encara no existeix)">Something'nice</a>
3613 </p>
3614 !! end
3615
3616 !! test
3617 Internal link with kaa linktrail with apostrophes (bug 27473)
3618 !! options
3619 language=kaa
3620 !! input
3621 [[Something]]'nice
3622 !! result
3623 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (bet ele jaratılmag'an)">Something'nice</a>
3624 </p>
3625 !! end
3626
3627 ###
3628 ### Interwiki links (see maintenance/interwiki.sql)
3629 ###
3630
3631 !! test
3632 Inline interwiki link
3633 !! input
3634 [[MeatBall:SoftSecurity]]
3635 !! result
3636 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity</a>
3637 </p>
3638 !! end
3639
3640 !! test
3641 Inline interwiki link with empty title (bug 2372)
3642 !! input
3643 [[MeatBall:]]
3644 !! result
3645 <p><a href="http://www.usemod.com/cgi-bin/mb.pl" class="extiw" title="meatball:">MeatBall:</a>
3646 </p>
3647 !! end
3648
3649 !! test
3650 Interwiki link encoding conversion (bug 1636)
3651 !! input
3652 *[[Wikipedia:ro:Olteni&#0355;a]]
3653 *[[Wikipedia:ro:Olteni&#355;a]]
3654 !! result
3655 <ul><li><a href="http://en.wikipedia.org/wiki/ro:Olteni%C5%A3a" class="extiw" title="wikipedia:ro:Olteniţa">Wikipedia:ro:Olteni&#355;a</a>
3656 </li><li><a href="http://en.wikipedia.org/wiki/ro:Olteni%C5%A3a" class="extiw" title="wikipedia:ro:Olteniţa">Wikipedia:ro:Olteni&#355;a</a>
3657 </li></ul>
3658
3659 !! end
3660
3661 !! test
3662 Interwiki link with fragment (bug 2130)
3663 !! input
3664 [[MeatBall:SoftSecurity#foo]]
3665 !! result
3666 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity#foo" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity#foo</a>
3667 </p>
3668 !! end
3669
3670 !! test
3671 Interlanguage link
3672 !! input
3673 Blah blah blah
3674 [[zh:Chinese]]
3675 !!result
3676 <p>Blah blah blah
3677 </p>
3678 !! end
3679
3680 !! test
3681 Double interlanguage link
3682 !! input
3683 Blah blah blah
3684 [[es:Spanish]]
3685 [[zh:Chinese]]
3686 !!result
3687 <p>Blah blah blah
3688 </p>
3689 !! end
3690
3691 !! test
3692 Interlanguage link, with prefix links
3693 !! options
3694 language=ln
3695 !! input
3696 Blah blah blah
3697 [[zh:Chinese]]
3698 !!result
3699 <p>Blah blah blah
3700 </p>
3701 !! end
3702
3703 !! test
3704 Double interlanguage link, with prefix links (bug 8897)
3705 !! options
3706 language=ln
3707 !! input
3708 Blah blah blah
3709 [[es:Spanish]]
3710 [[zh:Chinese]]
3711 !!result
3712 <p>Blah blah blah
3713 </p>
3714 !! end
3715
3716 !! test
3717 Parsoid-specific test: Wikilinks with &nbsp; should RT properly
3718 !! options
3719 language=ln
3720 !! input
3721 [[WW&nbsp;II]]
3722 !!result
3723 <p><a href="/index.php?title=WW_II&amp;action=edit&amp;redlink=1" class="new" title="WW II (lonkásá ezalí tɛ̂)">WW&#160;II</a>
3724 </p>
3725 !! end
3726
3727 ##
3728 ## XHTML tidiness
3729 ###
3730
3731 !! test
3732 <br> to <br />
3733 !! input
3734 1<br>2<br />3
3735 !! result
3736 <p>1<br />2<br />3
3737 </p>
3738 !! end
3739
3740 !! test
3741 Broken br tag sanitization
3742 !! input
3743 </br>
3744 !! result
3745 <p>&lt;/br&gt;
3746 </p>
3747 !! end
3748
3749 !! test
3750 Incorrecly removing closing slashes from correctly formed XHTML
3751 !! input
3752 <br style="clear:both;" />
3753 !! result
3754 <p><br style="clear:both;" />
3755 </p>
3756 !! end
3757
3758 !! test
3759 Failing to transform badly formed HTML into correct XHTML
3760 !! input
3761 <br style="clear: left;">
3762 <br style="clear: right;">
3763 <br style="clear: both;">
3764 !! result
3765 <p><br style="clear: left;" />
3766 <br style="clear: right;" />
3767 <br style="clear: both;" />
3768 </p>
3769 !!end
3770
3771 !! test
3772 Handling html with a div self-closing tag
3773 !! input
3774 <div title />
3775 <div title/>
3776 <div title/ >
3777 <div title=bar />
3778 <div title=bar/>
3779 <div title=bar/ >
3780 !! result
3781 <p>&lt;div title /&gt;
3782 &lt;div title/&gt;
3783 </p>
3784 <div>
3785 <p>&lt;div title=bar /&gt;
3786 &lt;div title=bar/&gt;
3787 </p>
3788 <div title="bar/"></div>
3789 </div>
3790
3791 !! end
3792
3793 !! test
3794 Handling html with a br self-closing tag
3795 !! input
3796 <br title />
3797 <br title/>
3798 <br title/ >
3799 <br title=bar />
3800 <br title=bar/>
3801 <br title=bar/ >
3802 !! result
3803 <p><br title="title" />
3804 <br title="title" />
3805 <br />
3806 <br title="bar" />
3807 <br title="bar" />
3808 <br title="bar/" />
3809 </p>
3810 !! end
3811
3812 !! test
3813 Horizontal ruler (should it add that extra space?)
3814 !! input
3815 <hr>
3816 <hr >
3817 foo <hr
3818 > bar
3819 !! result
3820 <hr />
3821 <hr />
3822 foo <hr /> bar
3823
3824 !! end
3825
3826 !! test
3827 Horizontal ruler -- 4+ dashes render hr
3828 !! input
3829 ----
3830 !! result
3831 <hr />
3832
3833 !! end
3834
3835 !! test
3836 Horizontal ruler -- eats additional dashes on the same line
3837 !! input
3838 ---------
3839 !! result
3840 <hr />
3841
3842 !! end
3843
3844 !! test
3845 Horizontal ruler -- does not collaps dashes on consecutive lines
3846 !! input
3847 ----
3848 ----
3849 !! result
3850 <hr />
3851 <hr />
3852
3853 !! end
3854
3855 !! test
3856 Horizontal ruler -- <4 dashes render as plain text
3857 !! input
3858 ---
3859 !! result
3860 <p>---
3861 </p>
3862 !! end
3863
3864 !! test
3865 Horizontal ruler -- Supports content following dashes on same line
3866 !! input
3867 ---- Foo
3868 !! result
3869 <hr /> Foo
3870
3871 !! end
3872
3873 ###
3874 ### Block-level elements
3875 ###
3876 !! test
3877 Common list
3878 !! input
3879 *Common list
3880 * item 2
3881 *item 3
3882 !! result
3883 <ul><li>Common list
3884 </li><li> item 2
3885 </li><li>item 3
3886 </li></ul>
3887
3888 !! end
3889
3890 !! test
3891 Numbered list
3892 !! input
3893 #Numbered list
3894 #item 2
3895 # item 3
3896 !! result
3897 <ol><li>Numbered list
3898 </li><li>item 2
3899 </li><li> item 3
3900 </li></ol>
3901
3902 !! end
3903
3904 !! test
3905 Mixed list
3906 !! input
3907 *Mixed list
3908 *# with numbers
3909 ** and bullets
3910 *# and numbers
3911 *bullets again
3912 **bullet level 2
3913 ***bullet level 3
3914 ***#Number on level 4
3915 **bullet level 2
3916 **#Number on level 3
3917 **#Number on level 3
3918 *#number level 2
3919 *Level 1
3920 *** Level 3
3921 #** Level 3, but ordered
3922 !! result
3923 <ul><li>Mixed list
3924 <ol><li> with numbers
3925 </li></ol>
3926 <ul><li> and bullets
3927 </li></ul>
3928 <ol><li> and numbers
3929 </li></ol>
3930 </li><li>bullets again
3931 <ul><li>bullet level 2
3932 <ul><li>bullet level 3
3933 <ol><li>Number on level 4
3934 </li></ol>
3935 </li></ul>
3936 </li><li>bullet level 2
3937 <ol><li>Number on level 3
3938 </li><li>Number on level 3
3939 </li></ol>
3940 </li></ul>
3941 <ol><li>number level 2
3942 </li></ol>
3943 </li><li>Level 1
3944 <ul><li><ul><li> Level 3
3945 </li></ul>
3946 </li></ul>
3947 </li></ul>
3948 <ol><li><ul><li><ul><li> Level 3, but ordered
3949 </li></ul>
3950 </li></ul>
3951 </li></ol>
3952
3953 !! end
3954
3955 !! test
3956 Nested lists 1
3957 !! input
3958 *foo
3959 **bar
3960 !! result
3961 <ul><li>foo
3962 <ul><li>bar
3963 </li></ul>
3964 </li></ul>
3965
3966 !! end
3967
3968 !! test
3969 Nested lists 2
3970 !! input
3971 **foo
3972 *bar
3973 !! result
3974 <ul><li><ul><li>foo
3975 </li></ul>
3976 </li><li>bar
3977 </li></ul>
3978
3979 !! end
3980
3981 !! test
3982 Nested lists 3 (first element empty)
3983 !! input
3984 *
3985 **bar
3986 !! result
3987 <ul><li>
3988 <ul><li>bar
3989 </li></ul>
3990 </li></ul>
3991
3992 !! end
3993
3994 !! test
3995 Nested lists 4 (first element empty)
3996 !! input
3997 **
3998 *bar
3999 !! result
4000 <ul><li><ul><li>
4001 </li></ul>
4002 </li><li>bar
4003 </li></ul>
4004
4005 !! end
4006
4007 !! test
4008 Nested lists 5 (both elements empty)
4009 !! input
4010 **
4011 *
4012 !! result
4013 <ul><li><ul><li>
4014 </li></ul>
4015 </li><li>
4016 </li></ul>
4017
4018 !! end
4019
4020 !! test
4021 Nested lists 6 (both elements empty)
4022 !! input
4023 *
4024 **
4025 !! result
4026 <ul><li>
4027 <ul><li>
4028 </li></ul>
4029 </li></ul>
4030
4031 !! end
4032
4033 !! test
4034 Nested lists 7 (skip initial nesting levels)
4035 !! input
4036 *** foo
4037 !! result
4038 <ul><li><ul><li><ul><li> foo
4039 </li></ul>
4040 </li></ul>
4041 </li></ul>
4042
4043 !! end
4044
4045 !! test
4046 Nested lists 8 (multiple nesting transitions)
4047 !! input
4048 * foo
4049 *** bar
4050 ** baz
4051 * boo
4052 !! result
4053 <ul><li> foo
4054 <ul><li><ul><li> bar
4055 </li></ul>
4056 </li><li> baz
4057 </li></ul>
4058 </li><li> boo
4059 </li></ul>
4060
4061 !! end
4062
4063 !! test
4064 1. Lists with start-of-line-transparent tokens before bullets: Comments
4065 !! input
4066 *foo
4067 *<!--cmt-->bar
4068 <!--cmt-->*baz
4069 !! result
4070 <ul><li>foo
4071 </li><li>bar
4072 </li><li>baz
4073 </li></ul>
4074
4075 !! end
4076
4077 !! test
4078 2. Lists with start-of-line-transparent tokens before bullets: Template close
4079 !! input
4080 *foo {{echo|bar
4081 }}*baz
4082 !! result
4083 <ul><li>foo bar
4084 </li><li>baz
4085 </li></ul>
4086
4087 !! end
4088
4089 !! test
4090 Unbalanced closing block tags break a list
4091 (Disabled since php parser generates broken html -- relies on Tidy to fix up)
4092 !! options
4093 disabled
4094 !! input
4095 <div>
4096 *a</div><div>
4097 *b</div>
4098 !! result
4099 <div>
4100 <ul><li>a
4101 </li></ul></div><div>
4102 <ul><li>b
4103 </li></ul></div>
4104 !! end
4105
4106 !! test
4107 Unbalanced closing non-block tags don't break a list
4108 (Disabled since php parser generates broken html -- relies on Tidy to fix up)
4109 !! options
4110 disabled
4111 !! input
4112 <span>
4113 *a</span><span>
4114 *b</span>
4115 !! result
4116 <p><span></span>
4117 </p>
4118 <ul><li>a<span></span>
4119 </li><li>b
4120 </li></ul>
4121 !! end
4122
4123 !! test
4124 List items are not parsed correctly following a <pre> block (bug 785)
4125 !! input
4126 * <pre>foo</pre>
4127 * <pre>bar</pre>
4128 * zar
4129 !! result
4130 <ul><li> <pre>foo</pre>
4131 </li><li> <pre>bar</pre>
4132 </li><li> zar
4133 </li></ul>
4134
4135 !! end
4136
4137 !! test
4138 List items from template
4139 !! input
4140
4141 {{inner list}}
4142 * item 2
4143
4144 * item 0
4145 {{inner list}}
4146 * item 2
4147
4148 * item 0
4149 * notSOL{{inner list}}
4150 * item 2
4151 !! result
4152 <ul><li> item 1
4153 </li><li> item 2
4154 </li></ul>
4155 <ul><li> item 0
4156 </li><li> item 1
4157 </li><li> item 2
4158 </li></ul>
4159 <ul><li> item 0
4160 </li><li> notSOL
4161 </li><li> item 1
4162 </li><li> item 2
4163 </li></ul>
4164
4165 !! end
4166
4167 !! test
4168 List interrupted by empty line or heading
4169 !! input
4170 * foo
4171
4172 ** bar
4173 == A heading ==
4174 * Another list item
4175 !! result
4176 <ul><li> foo
4177 </li></ul>
4178 <ul><li><ul><li> bar
4179 </li></ul>
4180 </li></ul>
4181 <h2><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: A heading">edit</a>]</span> <span class="mw-headline" id="A_heading"> A heading </span></h2>
4182 <ul><li> Another list item
4183 </li></ul>
4184
4185 !!end
4186
4187 !!test
4188 Multiple list tags generated by templates
4189 !!input
4190 {{echo|<li>}}a
4191 {{echo|<li>}}b
4192 {{echo|<li>}}c
4193 !!result
4194 <li>a
4195 <li>b
4196 <li>c</li>
4197 </li>
4198 </li>
4199
4200 !!end
4201
4202 ###
4203 ### Magic Words
4204 ###
4205
4206 !! test
4207 Magic Word: {{CURRENTDAY}}
4208 !! input
4209 {{CURRENTDAY}}
4210 !! result
4211 <p>1
4212 </p>
4213 !! end
4214
4215 !! test
4216 Magic Word: {{CURRENTDAY2}}
4217 !! input
4218 {{CURRENTDAY2}}
4219 !! result
4220 <p>01
4221 </p>
4222 !! end
4223
4224 !! test
4225 Magic Word: {{CURRENTDAYNAME}}
4226 !! input
4227 {{CURRENTDAYNAME}}
4228 !! result
4229 <p>Thursday
4230 </p>
4231 !! end
4232
4233 !! test
4234 Magic Word: {{CURRENTDOW}}
4235 !! input
4236 {{CURRENTDOW}}
4237 !! result
4238 <p>4
4239 </p>
4240 !! end
4241
4242 !! test
4243 Magic Word: {{CURRENTMONTH}}
4244 !! input
4245 {{CURRENTMONTH}}
4246 !! result
4247 <p>01
4248 </p>
4249 !! end
4250
4251 !! test
4252 Magic Word: {{CURRENTMONTHABBREV}}
4253 !! input
4254 {{CURRENTMONTHABBREV}}
4255 !! result
4256 <p>Jan
4257 </p>
4258 !! end
4259
4260 !! test
4261 Magic Word: {{CURRENTMONTHNAME}}
4262 !! input
4263 {{CURRENTMONTHNAME}}
4264 !! result
4265 <p>January
4266 </p>
4267 !! end
4268
4269 !! test
4270 Magic Word: {{CURRENTMONTHNAMEGEN}}
4271 !! input
4272 {{CURRENTMONTHNAMEGEN}}
4273 !! result
4274 <p>January
4275 </p>
4276 !! end
4277
4278 !! test
4279 Magic Word: {{CURRENTTIME}}
4280 !! input
4281 {{CURRENTTIME}}
4282 !! result
4283 <p>00:02
4284 </p>
4285 !! end
4286
4287 !! test
4288 Magic Word: {{CURRENTWEEK}} (@bug 4594)
4289 !! input
4290 {{CURRENTWEEK}}
4291 !! result
4292 <p>1
4293 </p>
4294 !! end
4295
4296 !! test
4297 Magic Word: {{CURRENTYEAR}}
4298 !! input
4299 {{CURRENTYEAR}}
4300 !! result
4301 <p>1970
4302 </p>
4303 !! end
4304
4305 !! test
4306 Magic Word: {{FULLPAGENAME}}
4307 !! options
4308 title=[[User:Ævar Arnfjörð Bjarmason]]
4309 !! input
4310 {{FULLPAGENAME}}
4311 !! result
4312 <p>User:Ævar Arnfjörð Bjarmason
4313 </p>
4314 !! end
4315
4316 !! test
4317 Magic Word: {{FULLPAGENAMEE}}
4318 !! options
4319 title=[[User:Ævar Arnfjörð Bjarmason]]
4320 !! input
4321 {{FULLPAGENAMEE}}
4322 !! result
4323 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
4324 </p>
4325 !! end
4326
4327 !! test
4328 Magic Word: {{NAMESPACE}}
4329 !! options
4330 title=[[User:Ævar Arnfjörð Bjarmason]]
4331 !! input
4332 {{NAMESPACE}}
4333 !! result
4334 <p>User
4335 </p>
4336 !! end
4337
4338 !! test
4339 Magic Word: {{NAMESPACEE}}
4340 !! options
4341 title=[[User:Ævar Arnfjörð Bjarmason]]
4342 !! input
4343 {{NAMESPACEE}}
4344 !! result
4345 <p>User
4346 </p>
4347 !! end
4348
4349 !! test
4350 Magic Word: {{NAMESPACENUMBER}}
4351 !! options
4352 title=[[User:Ævar Arnfjörð Bjarmason]]
4353 !! input
4354 {{NAMESPACENUMBER}}
4355 !! result
4356 <p>2
4357 </p>
4358 !! end
4359
4360 !! test
4361 Magic Word: {{NUMBEROFFILES}}
4362 !! input
4363 {{NUMBEROFFILES}}
4364 !! result
4365 <p>2
4366 </p>
4367 !! end
4368
4369 !! test
4370 Magic Word: {{PAGENAME}}
4371 !! options
4372 title=[[User:Ævar Arnfjörð Bjarmason]]
4373 !! input
4374 {{PAGENAME}}
4375 !! result
4376 <p>Ævar Arnfjörð Bjarmason
4377 </p>
4378 !! end
4379
4380 !! test
4381 Magic Word: {{PAGENAME}} with metacharacters
4382 !! options
4383 title=[['foo & bar = baz']]
4384 !! input
4385 ''{{PAGENAME}}''
4386 !! result
4387 <p><i>&#39;foo &#38; bar &#61; baz&#39;</i>
4388 </p>
4389 !! end
4390
4391 !! test
4392 Magic Word: {{PAGENAME}} with metacharacters (bug 26781)
4393 !! options
4394 title=[[*RFC 1234 http://example.com/]]
4395 !! input
4396 {{PAGENAME}}
4397 !! result
4398 <p>&#42;RFC&#32;1234 http&#58;//example.com/
4399 </p>
4400 !! end
4401
4402 !! test
4403 Magic Word: {{PAGENAMEE}}
4404 !! options
4405 title=[[User:Ævar Arnfjörð Bjarmason]]
4406 !! input
4407 {{PAGENAMEE}}
4408 !! result
4409 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
4410 </p>
4411 !! end
4412
4413 !! test
4414 Magic Word: {{PAGENAMEE}} with metacharacters (bug 26781)
4415 !! options
4416 title=[[*RFC 1234 http://example.com/]]
4417 !! input
4418 {{PAGENAMEE}}
4419 !! result
4420 <p>&#42;RFC_1234_http&#58;//example.com/
4421 </p>
4422 !! end
4423
4424 !! test
4425 Magic Word: {{REVISIONID}}
4426 !! input
4427 {{REVISIONID}}
4428 !! result
4429 <p>1337
4430 </p>
4431 !! end
4432
4433 !! test
4434 Magic Word: {{SCRIPTPATH}}
4435 !! input
4436 {{SCRIPTPATH}}
4437 !! result
4438 <p>/
4439 </p>
4440 !! end
4441
4442 !! test
4443 Magic Word: {{SERVER}}
4444 !! input
4445 {{SERVER}}
4446 !! result
4447 <p><a rel="nofollow" class="external free" href="http://Britney-Spears">http://Britney-Spears</a>
4448 </p>
4449 !! end
4450
4451 !! test
4452 Magic Word: {{SERVERNAME}}
4453 !! input
4454 {{SERVERNAME}}
4455 !! result
4456 <p>Britney-Spears
4457 </p>
4458 !! end
4459
4460 !! test
4461 Magic Word: {{SITENAME}}
4462 !! input
4463 {{SITENAME}}
4464 !! result
4465 <p>MediaWiki
4466 </p>
4467 !! end
4468
4469 !! test
4470 Namespace 1 {{ns:1}}
4471 !! input
4472 {{ns:1}}
4473 !! result
4474 <p>Talk
4475 </p>
4476 !! end
4477
4478 !! test
4479 Namespace 1 {{ns:01}}
4480 !! input
4481 {{ns:01}}
4482 !! result
4483 <p>Talk
4484 </p>
4485 !! end
4486
4487 !! test
4488 Namespace 0 {{ns:0}} (bug 4783)
4489 !! input
4490 {{ns:0}}
4491 !! result
4492
4493 !! end
4494
4495 !! test
4496 Namespace 0 {{ns:00}} (bug 4783)
4497 !! input
4498 {{ns:00}}
4499 !! result
4500
4501 !! end
4502
4503 !! test
4504 Namespace -1 {{ns:-1}}
4505 !! input
4506 {{ns:-1}}
4507 !! result
4508 <p>Special
4509 </p>
4510 !! end
4511
4512 !! test
4513 Namespace User {{ns:User}}
4514 !! input
4515 {{ns:User}}
4516 !! result
4517 <p>User
4518 </p>
4519 !! end
4520
4521 !! test
4522 Namespace User talk {{ns:User_talk}}
4523 !! input
4524 {{ns:User_talk}}
4525 !! result
4526 <p>User talk
4527 </p>
4528 !! end
4529
4530 !! test
4531 Namespace User talk {{ns:uSeR tAlK}}
4532 !! input
4533 {{ns:uSeR tAlK}}
4534 !! result
4535 <p>User talk
4536 </p>
4537 !! end
4538
4539 !! test
4540 Namespace File {{ns:File}}
4541 !! input
4542 {{ns:File}}
4543 !! result
4544 <p>File
4545 </p>
4546 !! end
4547
4548 !! test
4549 Namespace File {{ns:Image}}
4550 !! input
4551 {{ns:Image}}
4552 !! result
4553 <p>File
4554 </p>
4555 !! end
4556
4557 !! test
4558 Namespace (lang=de) Benutzer {{ns:User}}
4559 !! options
4560 language=de
4561 !! input
4562 {{ns:User}}
4563 !! result
4564 <p>Benutzer
4565 </p>
4566 !! end
4567
4568 !! test
4569 Namespace (lang=de) Benutzer Diskussion {{ns:3}}
4570 !! options
4571 language=de
4572 !! input
4573 {{ns:3}}
4574 !! result
4575 <p>Benutzer Diskussion
4576 </p>
4577 !! end
4578
4579
4580 !! test
4581 Urlencode
4582 !! input
4583 {{urlencode:hi world?!}}
4584 {{urlencode:hi world?!|WIKI}}
4585 {{urlencode:hi world?!|PATH}}
4586 {{urlencode:hi world?!|QUERY}}
4587 !! result
4588 <p>hi+world%3F%21
4589 hi_world%3F!
4590 hi%20world%3F%21
4591 hi+world%3F%21
4592 </p>
4593 !! end
4594
4595 ###
4596 ### Magic links
4597 ###
4598 !! test
4599 Magic links: internal link to RFC (bug 479)
4600 !! input
4601 [[RFC 123]]
4602 !! result
4603 <p><a href="/index.php?title=RFC_123&amp;action=edit&amp;redlink=1" class="new" title="RFC 123 (page does not exist)">RFC 123</a>
4604 </p>
4605 !! end
4606
4607 !! test
4608 Magic links: RFC (bug 479)
4609 !! input
4610 RFC 822
4611 !! result
4612 <p><a class="external mw-magiclink-rfc" href="//tools.ietf.org/html/rfc822">RFC 822</a>
4613 </p>
4614 !! end
4615
4616 !! test
4617 Magic links: ISBN (bug 1937)
4618 !! input
4619 ISBN 0-306-40615-2
4620 !! result
4621 <p><a href="/wiki/Special:BookSources/0306406152" class="internal mw-magiclink-isbn">ISBN 0-306-40615-2</a>
4622 </p>
4623 !! end
4624
4625 !! test
4626 Magic links: PMID incorrectly converts space to underscore
4627 !! input
4628 PMID 1234
4629 !! result
4630 <p><a class="external mw-magiclink-pmid" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a>
4631 </p>
4632 !! end
4633
4634 ###
4635 ### Templates
4636 ####
4637
4638 !! test
4639 Nonexistent template
4640 !! input
4641 {{thistemplatedoesnotexist}}
4642 !! result
4643 <p><a href="/index.php?title=Template:Thistemplatedoesnotexist&amp;action=edit&amp;redlink=1" class="new" title="Template:Thistemplatedoesnotexist (page does not exist)">Template:Thistemplatedoesnotexist</a>
4644 </p>
4645 !! end
4646
4647 !! test
4648 Template with invalid target containing tags
4649 !! input
4650 {{a<b>b</b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
4651 !! result
4652 <p>{{a<b>b</b>|foo|a=b|a = b}}
4653 </p>
4654 !! end
4655
4656 !! test
4657 Template with invalid target containing unclosed tag
4658 !! input
4659 {{a<b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
4660 !! result
4661 <p>{{a<b>|foo|a=b|a = b}}</b>
4662 </p>
4663 !! end
4664
4665 !! article
4666 Template:test
4667 !! text
4668 This is a test template
4669 !! endarticle
4670
4671 !! test
4672 Simple template
4673 !! input
4674 {{test}}
4675 !! result
4676 <p>This is a test template
4677 </p>
4678 !! end
4679
4680 !! test
4681 Template with explicit namespace
4682 !! input
4683 {{Template:test}}
4684 !! result
4685 <p>This is a test template
4686 </p>
4687 !! end
4688
4689
4690 !! article
4691 Template:paramtest
4692 !! text
4693 This is a test template with parameter {{{param}}}
4694 !! endarticle
4695
4696 !! test
4697 Template parameter
4698 !! input
4699 {{paramtest|param=foo}}
4700 !! result
4701 <p>This is a test template with parameter foo
4702 </p>
4703 !! end
4704
4705 !! article
4706 Template:paramtestnum
4707 !! text
4708 [[{{{1}}}|{{{2}}}]]
4709 !! endarticle
4710
4711 !! test
4712 Template unnamed parameter
4713 !! input
4714 {{paramtestnum|Main Page|the main page}}
4715 !! result
4716 <p><a href="/wiki/Main_Page" title="Main Page">the main page</a>
4717 </p>
4718 !! end
4719
4720 !! article
4721 Template:templatesimple
4722 !! text
4723 (test)
4724 !! endarticle
4725
4726 !! article
4727 Template:templateredirect
4728 !! text
4729 #redirect [[Template:templatesimple]]
4730 !! endarticle
4731
4732 !! article
4733 Template:templateasargtestnum
4734 !! text
4735 {{{{{1}}}}}
4736 !! endarticle
4737
4738 !! article
4739 Template:templateasargtest
4740 !! text
4741 {{template{{{templ}}}}}
4742 !! endarticle
4743
4744 !! article
4745 Template:templateasargtest2
4746 !! text
4747 {{{{{templ}}}}}
4748 !! endarticle
4749
4750 !! test
4751 Template with template name as unnamed argument
4752 !! input
4753 {{templateasargtestnum|templatesimple}}
4754 !! result
4755 <p>(test)
4756 </p>
4757 !! end
4758
4759 !! test
4760 Template with template name as argument
4761 !! input
4762 {{templateasargtest|templ=simple}}
4763 !! result
4764 <p>(test)
4765 </p>
4766 !! end
4767
4768 !! test
4769 Template with template name as argument (2)
4770 !! input
4771 {{templateasargtest2|templ=templatesimple}}
4772 !! result
4773 <p>(test)
4774 </p>
4775 !! end
4776
4777 !! article
4778 Template:templateasargtestdefault
4779 !! text
4780 {{{{{templ|templatesimple}}}}}
4781 !! endarticle
4782
4783 !! article
4784 Template:templa
4785 !! text
4786 '''templ'''
4787 !! endarticle
4788
4789 !! test
4790 Template with default value
4791 !! input
4792 {{templateasargtestdefault}}
4793 !! result
4794 <p>(test)
4795 </p>
4796 !! end
4797
4798 !! test
4799 Template with default value (value set)
4800 !! input
4801 {{templateasargtestdefault|templ=templa}}
4802 !! result
4803 <p><b>templ</b>
4804 </p>
4805 !! end
4806
4807 !! test
4808 Template redirect
4809 !! input
4810 {{templateredirect}}
4811 !! result
4812 <p>(test)
4813 </p>
4814 !! end
4815
4816 !! test
4817 Template with argument in separate line
4818 !! input
4819 {{ templateasargtest |
4820 templ = simple }}
4821 !! result
4822 <p>(test)
4823 </p>
4824 !! end
4825
4826 !! test
4827 Template with complex template as argument
4828 !! input
4829 {{paramtest|
4830 param ={{ templateasargtest |
4831 templ = simple }}}}
4832 !! result
4833 <p>This is a test template with parameter (test)
4834 </p>
4835 !! end
4836
4837 !! test
4838 Template with thumb image (with link in description)
4839 !! input
4840 {{paramtest|
4841 param =[[Image:noimage.png|thumb|[[no link|link]] [[no link|caption]]]]}}
4842 !! result
4843 This is a test template with parameter <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/index.php?title=Special:Upload&amp;wpDestFile=Noimage.png" class="new" title="File:Noimage.png">File:Noimage.png</a> <div class="thumbcaption"><a href="/index.php?title=No_link&amp;action=edit&amp;redlink=1" class="new" title="No link (page does not exist)">link</a> <a href="/index.php?title=No_link&amp;action=edit&amp;redlink=1" class="new" title="No link (page does not exist)">caption</a></div></div></div>
4844
4845 !! end
4846
4847 !! article
4848 Template:complextemplate
4849 !! text
4850 {{{1}}} {{paramtest|
4851 param ={{{param}}}}}
4852 !! endarticle
4853
4854 !! test
4855 Template with complex arguments
4856 !! input
4857 {{complextemplate|
4858 param ={{ templateasargtest |
4859 templ = simple }}|[[Template:complextemplate|link]]}}
4860 !! result
4861 <p><a href="/wiki/Template:Complextemplate" title="Template:Complextemplate">link</a> This is a test template with parameter (test)
4862 </p>
4863 !! end
4864
4865 !! test
4866 BUG 553: link with two variables in a piped link
4867 !! input
4868 {|
4869 |[[{{{1}}}|{{{2}}}]]
4870 |}
4871 !! result
4872 <table>
4873 <tr>
4874 <td>[[{{{1}}}|{{{2}}}]]
4875 </td></tr></table>
4876
4877 !! end
4878
4879 !! test
4880 Magic variable as template parameter
4881 !! input
4882 {{paramtest|param={{SITENAME}}}}
4883 !! result
4884 <p>This is a test template with parameter MediaWiki
4885 </p>
4886 !! end
4887
4888 !! article
4889 Template:linktest
4890 !! text
4891 [[{{{param}}}|link]]
4892 !! endarticle
4893
4894 !! test
4895 Template parameter as link source
4896 !! input
4897 {{linktest|param=Main Page}}
4898 !! result
4899 <p><a href="/wiki/Main_Page" title="Main Page">link</a>
4900 </p>
4901 !! end
4902
4903 !!test
4904 Template-generated attribute string (k='v')
4905 !!input
4906 <span {{attr_str|id|v1}}>bar</span>
4907 !!result
4908 <p><span id="v1">bar</span>
4909 </p>
4910 !!end
4911
4912 !!article
4913 Template:paramtest2
4914 !! text
4915 including another template, {{paramtest|param={{{arg}}}}}
4916 !! endarticle
4917
4918 !! test
4919 Template passing argument to another template
4920 !! input
4921 {{paramtest2|arg='hmm'}}
4922 !! result
4923 <p>including another template, This is a test template with parameter 'hmm'
4924 </p>
4925 !! end
4926
4927 !! article
4928 Template:Linktest2
4929 !! text
4930 Main Page
4931 !! endarticle
4932
4933 !! test
4934 Template as link source
4935 !! input
4936 [[{{linktest2}}]]
4937
4938 [[{{linktest2}}|Main Page]]
4939
4940 [[{{linktest2}}]]Page
4941 !! result
4942 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
4943 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
4944 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>Page
4945 </p>
4946 !! end
4947
4948
4949 !! article
4950 Template:loop1
4951 !! text
4952 {{loop2}}
4953 !! endarticle
4954
4955 !! article
4956 Template:loop2
4957 !! text
4958 {{loop1}}
4959 !! endarticle
4960
4961 !! test
4962 Template infinite loop
4963 !! input
4964 {{loop1}}
4965 !! result
4966 <p><span class="error">Template loop detected: <a href="/wiki/Template:Loop1" title="Template:Loop1">Template:Loop1</a></span>
4967 </p>
4968 !! end
4969
4970 !! test
4971 Template from main namespace
4972 !! input
4973 {{:Main Page}}
4974 !! result
4975 <p>blah blah
4976 </p>
4977 !! end
4978
4979 !! article
4980 Template:table
4981 !! text
4982 {|
4983 | 1 || 2
4984 |-
4985 | 3 || 4
4986 |}
4987 !! endarticle
4988
4989 !! test
4990 BUG 529: Template with table, not included at beginning of line
4991 !! input
4992 foo {{table}}
4993 !! result
4994 <p>foo
4995 </p>
4996 <table>
4997 <tr>
4998 <td> 1 </td>
4999 <td> 2
5000 </td></tr>
5001 <tr>
5002 <td> 3 </td>
5003 <td> 4
5004 </td></tr></table>
5005
5006 !! end
5007
5008 !! test
5009 BUG 523: Template shouldn't eat newline (or add an extra one before table)
5010 !! input
5011 foo
5012 {{table}}
5013 !! result
5014 <p>foo
5015 </p>
5016 <table>
5017 <tr>
5018 <td> 1 </td>
5019 <td> 2
5020 </td></tr>
5021 <tr>
5022 <td> 3 </td>
5023 <td> 4
5024 </td></tr></table>
5025
5026 !! end
5027
5028 !! test
5029 BUG 41: Template parameters shown as broken links
5030 !! input
5031 {{{parameter}}}
5032 !! result
5033 <p>{{{parameter}}}
5034 </p>
5035 !! end
5036
5037 !! test
5038 Template with targets containing wikilinks
5039 !! input
5040 {{[[foo]]}}
5041
5042 {{[[{{echo|foo}}]]}}
5043
5044 {{{{echo|[[foo}}]]}}
5045 !! result
5046 <p>{{<a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">foo</a>}}
5047 </p><p>{{<a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">foo</a>}}
5048 </p><p>{{[[foo}}]]
5049 </p>
5050 !! end
5051
5052 !! article
5053 Template:MSGNW test
5054 !! text
5055 ''None'' of '''this''' should be
5056 * interpreted
5057 but rather passed unmodified
5058 {{test}}
5059 !! endarticle
5060
5061 # hmm, fix this or just deprecate msgnw and document its behavior?
5062 !! test
5063 msgnw keyword
5064 !! options
5065 disabled
5066 !! input
5067 {{msgnw:MSGNW test}}
5068 !! result
5069 <p>''None'' of '''this''' should be
5070 * interpreted
5071 but rather passed unmodified
5072 {{test}}
5073 </p>
5074 !! end
5075
5076 !! test
5077 int keyword
5078 !! input
5079 {{int:youhavenewmessages|lots of money|not!}}
5080 !! result
5081 <p>You have lots of money (not!).
5082 </p>
5083 !! end
5084
5085 !! article
5086 Template:Includes
5087 !! text
5088 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
5089 !! endarticle
5090
5091 !! test
5092 <includeonly> and <noinclude> being included
5093 !! input
5094 {{Includes}}
5095 !! result
5096 <p>Foobar
5097 </p>
5098 !! end
5099
5100 !! article
5101 Template:Includes2
5102 !! text
5103 <onlyinclude>Foo</onlyinclude>bar
5104 !! endarticle
5105
5106 !! test
5107 <onlyinclude> being included
5108 !! input
5109 {{Includes2}}
5110 !! result
5111 <p>Foo
5112 </p>
5113 !! end
5114
5115
5116 !! article
5117 Template:Includes3
5118 !! text
5119 <onlyinclude>Foo</onlyinclude>bar<includeonly>zar</includeonly>
5120 !! endarticle
5121
5122 !! test
5123 <onlyinclude> and <includeonly> being included
5124 !! input
5125 {{Includes3}}
5126 !! result
5127 <p>Foo
5128 </p>
5129 !! end
5130
5131 !! test
5132 <includeonly> and <noinclude> on a page
5133 !! input
5134 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
5135 !! result
5136 <p>Foozar
5137 </p>
5138 !! end
5139
5140 !! test
5141 Un-closed <noinclude>
5142 !! input
5143 <noinclude>
5144 !! result
5145 !! end
5146
5147 !! test
5148 <onlyinclude> on a page
5149 !! input
5150 <onlyinclude>Foo</onlyinclude>bar
5151 !! result
5152 <p>Foobar
5153 </p>
5154 !! end
5155
5156 !! test
5157 Un-closed <onlyinclude>
5158 !! input
5159 <onlyinclude>
5160 !! result
5161 !! end
5162
5163 !!test
5164 Self-closed noinclude, includeonly, onlyinclude tags
5165 !!input
5166 <noinclude />
5167 <includeonly />
5168 <onlyinclude />
5169 !!result
5170 <p><br />
5171 </p>
5172 !!end
5173
5174 !!test
5175 Unbalanced includeonly and noinclude tags
5176 !!input
5177 {|
5178 |a</noinclude>
5179 |b</noinclude></noinclude>
5180 |c</noinclude></includeonly>
5181 |d</includeonly></includeonly>
5182 |}
5183 !!result
5184 <table>
5185 <tr>
5186 <td>a
5187 </td>
5188 <td>b
5189 </td>
5190 <td>c&lt;/includeonly&gt;
5191 </td>
5192 <td>d&lt;/includeonly&gt;&lt;/includeonly&gt;
5193 </td></tr></table>
5194
5195 !!end
5196
5197 !! article
5198 Template:Includeonly section
5199 !! text
5200 <includeonly>
5201 ==Includeonly section==
5202 </includeonly>
5203 ==Section T-1==
5204 !!endarticle
5205
5206 !! test
5207 Bug 6563: Edit link generation for section shown by <includeonly>
5208 !! input
5209 {{includeonly section}}
5210 !! result
5211 <h2><span class="editsection">[<a href="/index.php?title=Template:Includeonly_section&amp;action=edit&amp;section=T-1" title="Template:Includeonly section">edit</a>]</span> <span class="mw-headline" id="Includeonly_section">Includeonly section</span></h2>
5212 <h2><span class="editsection">[<a href="/index.php?title=Template:Includeonly_section&amp;action=edit&amp;section=T-2" title="Template:Includeonly section">edit</a>]</span> <span class="mw-headline" id="Section_T-1">Section T-1</span></h2>
5213
5214 !! end
5215
5216 # Uses same input as the contents of [[Template:Includeonly section]]
5217 !! test
5218 Bug 6563: Section extraction for section shown by <includeonly>
5219 !! options
5220 section=T-2
5221 !! input
5222 <includeonly>
5223 ==Includeonly section==
5224 </includeonly>
5225 ==Section T-2==
5226 !! result
5227 ==Section T-2==
5228 !! end
5229
5230 !! test
5231 Bug 6563: Edit link generation for section suppressed by <includeonly>
5232 !! input
5233 <includeonly>
5234 ==Includeonly section==
5235 </includeonly>
5236 ==Section 1==
5237 !! result
5238 <h2><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: Section 1">edit</a>]</span> <span class="mw-headline" id="Section_1">Section 1</span></h2>
5239
5240 !! end
5241
5242 !! test
5243 Bug 6563: Section extraction for section suppressed by <includeonly>
5244 !! options
5245 section=1
5246 !! input
5247 <includeonly>
5248 ==Includeonly section==
5249 </includeonly>
5250 ==Section 1==
5251 !! result
5252 ==Section 1==
5253 !! end
5254
5255 !! test
5256 Un-closed <includeonly>
5257 !! input
5258 <includeonly>
5259 !! result
5260 !! end
5261
5262 ###
5263 ### <includeonly> and <noinclude> in attributes
5264 ###
5265 !!test
5266 0. includeonly around the entire attribute
5267 !!input
5268 <span <includeonly>id="v1"</includeonly><noinclude>id="v2"</noinclude>>bar</span>
5269 !!result
5270 <p><span id="v2">bar</span>
5271 </p>
5272 !!end
5273
5274 !!test
5275 1. includeonly in html attr key
5276 !!input
5277 <span <noinclude>id</noinclude><includeonly>about</includeonly>="foo">bar</span>
5278 !!result
5279 <p><span id="foo">bar</span>
5280 </p>
5281 !!end
5282
5283 !!test
5284 2. includeonly in html attr value
5285 !!input
5286 <span id="<noinclude>v1</noinclude><includeonly>v2</includeonly>">bar</span>
5287 <span id=<noinclude>"v1"</noinclude><includeonly>"v2"</includeonly>>bar</span>
5288 !!result
5289 <p><span id="v1">bar</span>
5290 <span id="v1">bar</span>
5291 </p>
5292 !!end
5293
5294 !!test
5295 3. includeonly in part of an attr value
5296 !!input
5297 <span style="color:<noinclude>red</noinclude><includeonly>blue</includeonly>;">bar</span>
5298 !!result
5299 <p><span style="color:red;">bar</span>
5300 </p>
5301 !!end
5302
5303 ###
5304 ### Testing parsing of templates where a template arg
5305 ### has the same name as the template itself.
5306 ###
5307
5308 !! article
5309 Template:quote
5310 !! text
5311 {{{quote|{{{1}}}}}}
5312 !! endarticle
5313
5314 !!test
5315 Templates: Template Name/Arg clash: 1. Use of positional param
5316 !!input
5317 {{quote|foo}}
5318 !!result
5319 <p>foo
5320 </p>
5321 !!end
5322
5323 !!test
5324 Templates: Template Name/Arg clash: 2. Use of named param
5325 !!input
5326 {{quote|quote=foo}}
5327 !!result
5328 <p>foo
5329 </p>
5330 !!end
5331
5332 !!test
5333 Templates: Template Name/Arg clash: 3. Use of named param with empty input
5334 !!input
5335 {{quote|quote}}
5336 !!result
5337 <p>quote
5338 </p>
5339 !!end
5340
5341 ###
5342 ### Parsoid-centric tests to stress Parsoid's ability to RT them unchanged
5343 ###
5344
5345 !!test
5346 Templates: 1. Simple use
5347 !!input
5348 {{echo|Foo}}
5349 !!result
5350 <p>Foo
5351 </p>
5352 !!end
5353
5354 !!test
5355 Templates: 2. Inside a block tag
5356 !!input
5357 <div>{{echo|Foo}}</div>
5358 !!result
5359 <div>Foo</div>
5360
5361 !!end
5362
5363 !!test
5364 Templates: P-wrapping: 1a. Templates on consecutive lines
5365 !!input
5366 {{echo|Foo}}
5367 {{echo|bar}}
5368 !!result
5369 <p>Foo
5370 bar
5371 </p>
5372 !!end
5373
5374 !!test
5375 Templates: P-wrapping: 1b. Templates on consecutive lines
5376 !!input
5377 Foo
5378
5379 {{echo|bar}}
5380 {{echo|baz}}
5381 !!result
5382 <p>Foo
5383 </p><p>bar
5384 baz
5385 </p>
5386 !!end
5387
5388 !!test
5389 Templates: P-wrapping: 1c. Templates on consecutive lines
5390 !!input
5391 {{echo|Foo}}
5392 {{echo|bar}} <div>baz</div>
5393 !!result
5394 <p>Foo
5395 </p>
5396 bar <div>baz</div>
5397
5398 !!end
5399
5400 !!test
5401 Templates: Inline Text: 1. Multiple tmeplate uses
5402 !!input
5403 {{echo|Foo}}bar{{echo|baz}}
5404 !!result
5405 <p>Foobarbaz
5406 </p>
5407 !!end
5408
5409 !!test
5410 Templates: Inline Text: 2. Back-to-back template uses
5411 !!input
5412 {{echo|Foo}}{{echo|bar}}
5413 !!result
5414 <p>Foobar
5415 </p>
5416 !!end
5417
5418 !!test
5419 Templates: Block Tags: 1. Multiple template uses
5420 !!input
5421 {{echo|<div>Foo</div>}}<div>bar</div>{{echo|<div>baz</div>}}
5422 !!result
5423 <div>Foo</div><div>bar</div><div>baz</div>
5424
5425 !!end
5426
5427 !!test
5428 Templates: Block Tags: 2. Back-to-back template uses
5429 !!input
5430 {{echo|<div>Foo</div>}}{{echo|<div>bar</div>}}
5431 !!result
5432 <div>Foo</div><div>bar</div>
5433
5434 !!end
5435
5436 !!test
5437 Templates: Links: 1. Simple example
5438 !!input
5439 {{echo|[[Foo|bar]]}}
5440 !!result
5441 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
5442 </p>
5443 !!end
5444
5445 !!test
5446 Templates: Links: 2. Generation of link href
5447 !!input
5448 [[{{echo|Foo}}|bar]]
5449 !!result
5450 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
5451 </p>
5452 !!end
5453
5454 !!test
5455 Templates: Links: 3. Generation of part of a link href
5456 !!input
5457 [[Fo{{echo|o}}|bar]]
5458
5459 [[Foo{{echo|bar}}]]
5460
5461 [[Foo{{echo|bar}}baz]]
5462
5463 [[Foo{{echo|bar}}|bar]]
5464
5465 [[:Foo{{echo|bar}}]]
5466
5467 [[:Foo{{echo|bar}}|bar]]
5468 !!result
5469 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
5470 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
5471 </p><p><a href="/index.php?title=Foobarbaz&amp;action=edit&amp;redlink=1" class="new" title="Foobarbaz (page does not exist)">Foobarbaz</a>
5472 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
5473 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
5474 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
5475 </p>
5476 !!end
5477
5478 !!test
5479 Templates: Links: 4. Multiple templates generating link href
5480 !!input
5481 [[{{echo|F}}{{echo|o}}ob{{echo|ar}}]]
5482 !!result
5483 <p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
5484 </p>
5485 !!end
5486
5487 !!test
5488 Templates: Links: 5. Generation of link text
5489 !!input
5490 [[Foo|{{echo|bar}}]]
5491 !!result
5492 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
5493 </p>
5494 !!end
5495
5496 !!test
5497 Templates: Links: 5. Nested templates (only outermost template should be marked)
5498 !!input
5499 {{echo|[[{{echo|Foo}}|bar]]}}
5500 !!result
5501 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
5502 </p>
5503 !!end
5504
5505 !!test
5506 Templates: HTML Tag: 1. Generation of HTML attr. key
5507 !!input
5508 <div {{echo|style}}="color:red;">foo</div>
5509 !!result
5510 <div style="color:red;">foo</div>
5511
5512 !!end
5513
5514 !!test
5515 Templates: HTML Tag: 2. Generation of HTML attr. value
5516 !!input
5517 <div style={{echo|'color:red;'}}>foo</div>
5518 !!result
5519 <div style="color:red;">foo</div>
5520
5521 !!end
5522
5523 !!test
5524 Templates: HTML Tag: 3. Generation of HTML attr key and value
5525 !!input
5526 <div {{echo|style}}={{echo|'color:red;'}}>foo</div>
5527 !!result
5528 <div style="color:red;">foo</div>
5529
5530 !!end
5531
5532 !!test
5533 Templates: HTML Tag: 4. Generation of starting piece of HTML attr value
5534 !!input
5535 <div title="{{echo|This is a long title}} with just one piece templated">foo</div>
5536 !!result
5537 <div title="This is a long title with just one piece templated">foo</div>
5538
5539 !!end
5540
5541 !!test
5542 Templates: HTML Tag: 5. Generation of middle piece of HTML attr value
5543 !!input
5544 <div title="This is a long title with just {{echo|one piece}} templated">foo</div>
5545 !!result
5546 <div title="This is a long title with just one piece templated">foo</div>
5547
5548 !!end
5549
5550 !!test
5551 Templates: HTML Tag: 6. Generation of end piece of HTML attr value
5552 !!input
5553 <div title="This is a long title with just one piece {{echo|templated}}">foo</div>
5554 !!result
5555 <div title="This is a long title with just one piece templated">foo</div>
5556
5557 !!end
5558
5559 !!test
5560 Templates: HTML Tables: 1. Generating start of a HTML table
5561 !!input
5562 {{echo|<table><tr><td>foo</td>}}</tr></table>
5563 !!result
5564 <table><tr><td>foo</td></tr></table>
5565
5566 !!end
5567
5568 !!test
5569 Templates: HTML Tables: 2a. Generating middle of a HTML table
5570 !!input
5571 <table><tr>{{echo|<td>foo</td>}}</tr></table>
5572 !!result
5573 <table><tr><td>foo</td></tr></table>
5574
5575 !!end
5576
5577 !!test
5578 Templates: HTML Tables: 2b. Generating middle of a HTML table
5579 !!input
5580 <table>{{echo|<tr><td>foo</td></tr>}}</table>
5581 !!result
5582 <table><tr><td>foo</td></tr></table>
5583
5584 !!end
5585
5586 !!test
5587 Templates: HTML Tables: 3. Generating end of a HTML table
5588 !!input
5589 <table><tr>{{echo|<td>foo</td></tr></table>}}
5590 !!result
5591 <table><tr><td>foo</td></tr></table>
5592
5593 !!end
5594
5595 !!test
5596 Templates: HTML Tables: 4a. Generating a single tag of a HTML table
5597 !!input
5598 {{echo|<table>}}<tr><td>foo</td></tr></table>
5599 !!result
5600 <table><tr><td>foo</td></tr></table>
5601
5602 !!end
5603
5604 !!test
5605 Templates: HTML Tables: 4b. Generating a single tag of a HTML table
5606 !!input
5607 <table>{{echo|<tr>}}<td>foo</td></tr></table>
5608 !!result
5609 <table><tr><td>foo</td></tr></table>
5610
5611 !!end
5612
5613 !!test
5614 Templates: HTML Tables: 4c. Generating a single tag of a HTML table
5615 !!input
5616 <table><tr>{{echo|<td>}}foo</td></tr></table>
5617 !!result
5618 <table><tr><td>foo</td></tr></table>
5619
5620 !!end
5621
5622 !!test
5623 Templates: HTML Tables: 4d. Generating a single tag of a HTML table
5624 !!input
5625 <table><tr><td>foo{{echo|</td>}}</tr></table>
5626 !!result
5627 <table><tr><td>foo</td></tr></table>
5628
5629 !!end
5630
5631 !!test
5632 Templates: HTML Tables: 4e. Generating a single tag of a HTML table
5633 !!input
5634 <table><tr><td>foo</td>{{echo|</tr>}}</table>
5635 !!result
5636 <table><tr><td>foo</td></tr></table>
5637
5638 !!end
5639
5640 !!test
5641 Templates: HTML Tables: 4f. Generating a single tag of a HTML table
5642 !!input
5643 <table><tr><td>foo</td></tr>{{echo|</table>}}
5644 !!result
5645 <table><tr><td>foo</td></tr></table>
5646
5647 !!end
5648
5649 !!test
5650 Templates: Wiki Tables: 1. Fostering of entire template content
5651 !!input
5652 {|
5653 {{echo|a}}
5654 |}
5655 !!result
5656 <table>
5657 a
5658 <tr><td></td></tr></table>
5659
5660 !!end
5661
5662 !!test
5663 Templates: Wiki Tables: 2. Fostering of partial template content
5664 !!input
5665 {|
5666 {{echo|a
5667 <div>b</div>}}
5668 |}
5669 !!result
5670 <table>
5671 a
5672 <div>b</div>
5673 <tr><td></td></tr></table>
5674
5675 !!end
5676
5677 !!test
5678 Templates: Wiki Tables: 3. td-content via multiple templates
5679 !!input
5680 {|
5681 {{echo|{{pipe}}a}}{{echo|b}}
5682 |}
5683 !!result
5684 <table>
5685 <tr>
5686 <td>ab
5687 </td></tr></table>
5688
5689 !!end
5690
5691 !!test
5692 Templates: Wiki Tables: 4. Templated tags, no content
5693 !!input
5694 {{tbl-start}}
5695 {{tbl-end}}
5696 !!result
5697 <table>
5698 <tr><td></td></tr></table>
5699
5700 !!end
5701
5702 !!test
5703 Templates: Wiki Tables: 4. Templated tags, regular td-tags
5704 !!input
5705 {{tbl-start}}
5706 |foo
5707 {{tbl-end}}
5708 !!result
5709 <table>
5710 <tr>
5711 <td>foo
5712 </td></tr></table>
5713
5714 !!end
5715
5716 !!test
5717 Templates: Wiki Tables: 4. Templated tags, templated td-tags
5718 !!input
5719 {{tbl-start}}
5720 {{!}}foo
5721 {{tbl-end}}
5722 !!result
5723 <table>
5724 <tr>
5725 <td>foo
5726 </td></tr></table>
5727
5728 !!end
5729
5730 !!test
5731 Templates: Lists: Multi-line list-items via templates
5732 !!input
5733 *{{echo|a {{nonexistent|
5734 unused}}}}
5735 *{{echo|b {{nonexistent|
5736 unused}}}}
5737 !!result
5738 <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>
5739 </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>
5740 </li></ul>
5741
5742 !!end
5743
5744 !!test
5745 Templates: Ugly nesting: 1. Quotes opened/closed across templates (echo)
5746 !!input
5747 {{echo|''a}}{{echo|b''c''d}}{{echo|''e}}
5748 !!result
5749 <p><i>ab</i>c<i>d</i>e
5750 </p>
5751 !!end
5752
5753 !!test
5754 Templates: Ugly nesting: 2. Quotes opened/closed across templates (echo_with_span)
5755 (PHP parser generates misnested html)
5756 !! options
5757 disabled
5758 !!input
5759 {{echo_with_span|''a}}{{echo_with_span|b''c''d}}{{echo_with_span|''e}}
5760 !!result
5761 <p><span><i>a</i></span><i><span>b</span></i><span>c</span><i>d</i><span>e</span></p>
5762 !!end
5763
5764 !!test
5765 Templates: Ugly nesting: 3. Quotes opened/closed across templates (echo_with_div)
5766 (PHP parser generates misnested html)
5767 !! options
5768 disabled
5769 !!input
5770 {{echo_with_div|''a}}{{echo_with_div|b''c''d}}{{echo_with_div|''e}}
5771 !!result
5772 <div><i>a</i></div>
5773 <div><i>b</i>c<i>d</i></div>
5774 <div>e</div>
5775 !!end
5776
5777 !!test
5778 Templates: Ugly nesting: 4. Divs opened/closed across templates
5779 !!input
5780 a<div>b{{echo|c</div>d}}e
5781 !!result
5782 a<div>bc</div>de
5783
5784 !!end
5785
5786 !!test
5787 Templates: Ugly templates: 1. Navbox template parses badly leading to table misnesting
5788 (Parsoid-centric)
5789 !! options
5790 disabled
5791 !!input
5792 {|
5793 |{{echo|foo</table>}}
5794 |bar
5795 |}
5796 !!result
5797 <table about="#mwt1" typeof="mw:Object/Template ">
5798 <tbody><tr><td>foo</td></tr></tbody></table><span about="#mwt1">
5799 bar</span><span about="#mwt1">
5800 </span>
5801 !!end
5802
5803 !!test
5804 Templates: Ugly templates: 2. Navbox template parses badly leading to table misnesting
5805 (Parsoid-centric)
5806 !! options
5807 disabled
5808 !!input
5809 <table>
5810 <tr>
5811 <td>
5812 <table>
5813 <tr>
5814 <td>1. {{echo|foo </table>}}</td>
5815 <td> bar </td>
5816 <td>2. {{echo|baz </table>}}</td>
5817 </tr>
5818 <tr>
5819 <td>abc</td>
5820 </tr>
5821 </table>
5822 </td>
5823 </tr>
5824 <tr>
5825 <td>xyz</td>
5826 </tr>
5827 </table>
5828 !!result
5829 <table about="#mwt1" typeof="mw:Object/Template">
5830 <tbody><tr >
5831 <td >
5832 <table >
5833 <tbody><tr >
5834 <td >1. foo </td></tr></tbody></table></td>
5835 <td > bar </td>
5836 <td >2. baz </td></tr></tbody></table><span about="#mwt1">
5837 </span><span about="#mwt1">
5838
5839 abc</span><span about="#mwt1">
5840 </span><span about="#mwt1">
5841 </span><span about="#mwt1">
5842 </span><span about="#mwt1">
5843 </span><span about="#mwt1">
5844
5845 xyz</span><span about="#mwt1">
5846 </span><span about="#mwt1">
5847 </span>
5848 !!end
5849
5850 !! test
5851 Templates: Ugly templates: 3. newline-only template parameter
5852 !! input
5853 foo {{echo|
5854 }}
5855 !! result
5856 <p>foo
5857 </p>
5858 !! end
5859
5860 # This looks like a bug: a single newline triggers p/br for some reason.
5861 !! test
5862 Templates: Ugly templates: 4. newline-only template parameter inconsistency
5863 !! input
5864 {{echo|
5865 }}
5866 !! result
5867 <p><br />
5868 </p>
5869 !! end
5870
5871
5872 !!test
5873 Parser Functions: 1. Simple example
5874 !!input
5875 {{uc:foo}}
5876 !!result
5877 <p>FOO
5878 </p>
5879 !!end
5880
5881 !!test
5882 Parser Functions: 2. Nested use (only outermost should be marked up)
5883 !!input
5884 {{uc:{{lc:FOO}}}}
5885 !!result
5886 <p>FOO
5887 </p>
5888 !!end
5889
5890 ###
5891 ### Pre-save transform tests
5892 ###
5893 !! test
5894 pre-save transform: subst:
5895 !! options
5896 PST
5897 !! input
5898 {{subst:test}}
5899 !! result
5900 This is a test template
5901 !! end
5902
5903 !! test
5904 pre-save transform: normal template
5905 !! options
5906 PST
5907 !! input
5908 {{test}}
5909 !! result
5910 {{test}}
5911 !! end
5912
5913 !! test
5914 pre-save transform: nonexistent template
5915 !! options
5916 PST
5917 !! input
5918 {{thistemplatedoesnotexist}}
5919 !! result
5920 {{thistemplatedoesnotexist}}
5921 !! end
5922
5923
5924 !! test
5925 pre-save transform: subst magic variables
5926 !! options
5927 PST
5928 !! input
5929 {{subst:SITENAME}}
5930 !! result
5931 MediaWiki
5932 !! end
5933
5934 # This is bug 89, which I fixed. -- wtm
5935 !! test
5936 pre-save transform: subst: templates with parameters
5937 !! options
5938 pst
5939 !! input
5940 {{subst:paramtest|param="something else"}}
5941 !! result
5942 This is a test template with parameter "something else"
5943 !! end
5944
5945 !! article
5946 Template:nowikitest
5947 !! text
5948 <nowiki>'''not wiki'''</nowiki>
5949 !! endarticle
5950
5951 !! test
5952 pre-save transform: nowiki in subst (bug 1188)
5953 !! options
5954 pst
5955 !! input
5956 {{subst:nowikitest}}
5957 !! result
5958 <nowiki>'''not wiki'''</nowiki>
5959 !! end
5960
5961
5962 !! article
5963 Template:commenttest
5964 !! text
5965 This template has <!-- a comment --> in it.
5966 !! endarticle
5967
5968 !! test
5969 pre-save transform: comment in subst (bug 1936)
5970 !! options
5971 pst
5972 !! input
5973 {{subst:commenttest}}
5974 !! result
5975 This template has <!-- a comment --> in it.
5976 !! end
5977
5978 !! test
5979 pre-save transform: unclosed tag
5980 !! options
5981 pst noxml
5982 !! input
5983 <nowiki>'''not wiki'''
5984 !! result
5985 <nowiki>'''not wiki'''
5986 !! end
5987
5988 !! test
5989 pre-save transform: mixed tag case
5990 !! options
5991 pst noxml
5992 !! input
5993 <NOwiki>'''not wiki'''</noWIKI>
5994 !! result
5995 <NOwiki>'''not wiki'''</noWIKI>
5996 !! end
5997
5998 !! test
5999 pre-save transform: unclosed comment in <nowiki>
6000 !! options
6001 pst noxml
6002 !! input
6003 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
6004 !! result
6005 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
6006 !!end
6007
6008 !! article
6009 Template:dangerous
6010 !!text
6011 <span onmouseover="alert('crap')">Oh no</span>
6012 !!endarticle
6013
6014 !!test
6015 (confirming safety of fix for subst bug 1936)
6016 !! input
6017 {{Template:dangerous}}
6018 !! result
6019 <p><span>Oh no</span>
6020 </p>
6021 !! end
6022
6023 !! test
6024 pre-save transform: comment containing gallery (bug 5024)
6025 !! options
6026 pst
6027 !! input
6028 <!-- <gallery>data</gallery> -->
6029 !!result
6030 <!-- <gallery>data</gallery> -->
6031 !!end
6032
6033 !! test
6034 pre-save transform: comment containing extension
6035 !! options
6036 pst
6037 !! input
6038 <!-- <tag>data</tag> -->
6039 !!result
6040 <!-- <tag>data</tag> -->
6041 !!end
6042
6043 !! test
6044 pre-save transform: comment containing nowiki
6045 !! options
6046 pst
6047 !! input
6048 <!-- <nowiki>data</nowiki> -->
6049 !!result
6050 <!-- <nowiki>data</nowiki> -->
6051 !!end
6052
6053 !! test
6054 pre-save transform: <noinclude> in subst (bug 3298)
6055 !! options
6056 pst
6057 !! input
6058 {{subst:Includes}}
6059 !! result
6060 Foobar
6061 !! end
6062
6063 !! test
6064 pre-save transform: <onlyinclude> in subst (bug 3298)
6065 !! options
6066 pst
6067 !! input
6068 {{subst:Includes2}}
6069 !! result
6070 Foo
6071 !! end
6072
6073 !! article
6074 Template:SubstTest
6075 !!text
6076 {{<includeonly>subst:</includeonly>Includes}}
6077 !! endarticle
6078
6079 !! article
6080 Template:SafeSubstTest
6081 !! text
6082 {{<includeonly>safesubst:</includeonly>Includes}}
6083 !! endarticle
6084
6085 !! test
6086 bug 22297: safesubst: works during PST
6087 !! options
6088 pst
6089 !! input
6090 {{subst:SafeSubstTest}}{{safesubst:SubstTest}}
6091 !! result
6092 FoobarFoobar
6093 !! end
6094
6095 !! test
6096 bug 22297: safesubst: works during normal parse
6097 !! input
6098 {{SafeSubstTest}}
6099 !! result
6100 <p>Foobar
6101 </p>
6102 !! end
6103
6104 !! test:
6105 subst: does not work during normal parse
6106 !! input
6107 {{SubstTest}}
6108 !! result
6109 <p>{{subst:Includes}}
6110 </p>
6111 !! end
6112
6113 !! test
6114 pre-save transform: context links ("pipe trick")
6115 !! options
6116 pst
6117 !! input
6118 [[Article (context)|]]
6119 [[Bar:Article|]]
6120 [[:Bar:Article|]]
6121 [[Bar:Article (context)|]]
6122 [[:Bar:Article (context)|]]
6123 [[|Article]]
6124 [[|Article (context)]]
6125 [[Bar:X (Y) Z|]]
6126 [[:Bar:X (Y) Z|]]
6127 !! result
6128 [[Article (context)|Article]]
6129 [[Bar:Article|Article]]
6130 [[:Bar:Article|Article]]
6131 [[Bar:Article (context)|Article]]
6132 [[:Bar:Article (context)|Article]]
6133 [[Article]]
6134 [[Article (context)]]
6135 [[Bar:X (Y) Z|X (Y) Z]]
6136 [[:Bar:X (Y) Z|X (Y) Z]]
6137 !! end
6138
6139 !! test
6140 pre-save transform: context links ("pipe trick") with interwiki prefix
6141 !! options
6142 pst
6143 !! input
6144 [[interwiki:Article|]]
6145 [[:interwiki:Article|]]
6146 [[interwiki:Bar:Article|]]
6147 [[:interwiki:Bar:Article|]]
6148 !! result
6149 [[interwiki:Article|Article]]
6150 [[:interwiki:Article|Article]]
6151 [[interwiki:Bar:Article|Bar:Article]]
6152 [[:interwiki:Bar:Article|Bar:Article]]
6153 !! end
6154
6155 !! test
6156 pre-save transform: context links ("pipe trick") with parens in title
6157 !! options
6158 pst title=[[Somearticle (context)]]
6159 !! input
6160 [[|Article]]
6161 !! result
6162 [[Article (context)|Article]]
6163 !! end
6164
6165 !! test
6166 pre-save transform: context links ("pipe trick") with comma in title
6167 !! options
6168 pst title=[[Someplace, Somewhere]]
6169 !! input
6170 [[|Otherplace]]
6171 [[Otherplace, Elsewhere|]]
6172 [[Otherplace, Elsewhere, Anywhere|]]
6173 !! result
6174 [[Otherplace, Somewhere|Otherplace]]
6175 [[Otherplace, Elsewhere|Otherplace]]
6176 [[Otherplace, Elsewhere, Anywhere|Otherplace]]
6177 !! end
6178
6179 !! test
6180 pre-save transform: context links ("pipe trick") with parens and comma
6181 !! options
6182 pst title=[[Someplace (IGNORED), Somewhere]]
6183 !! input
6184 [[|Otherplace]]
6185 [[Otherplace (place), Elsewhere|]]
6186 !! result
6187 [[Otherplace, Somewhere|Otherplace]]
6188 [[Otherplace (place), Elsewhere|Otherplace]]
6189 !! end
6190
6191 !! test
6192 pre-save transform: context links ("pipe trick") with comma and parens
6193 !! options
6194 pst title=[[Who, me? (context)]]
6195 !! input
6196 [[|Yes, you.]]
6197 [[Me, Myself, and I (1937 song)|]]
6198 !! result
6199 [[Yes, you. (context)|Yes, you.]]
6200 [[Me, Myself, and I (1937 song)|Me, Myself, and I]]
6201 !! end
6202
6203 !! test
6204 pre-save transform: context links ("pipe trick") with namespace
6205 !! options
6206 pst title=[[Ns:Somearticle]]
6207 !! input
6208 [[|Article]]
6209 !! result
6210 [[Ns:Article|Article]]
6211 !! end
6212
6213 !! test
6214 pre-save transform: context links ("pipe trick") with namespace and parens
6215 !! options
6216 pst title=[[Ns:Somearticle (context)]]
6217 !! input
6218 [[|Article]]
6219 !! result
6220 [[Ns:Article (context)|Article]]
6221 !! end
6222
6223 !! test
6224 pre-save transform: context links ("pipe trick") with namespace and comma
6225 !! options
6226 pst title=[[Ns:Somearticle, Context, Whatever]]
6227 !! input
6228 [[|Article]]
6229 !! result
6230 [[Ns:Article, Context, Whatever|Article]]
6231 !! end
6232
6233 !! test
6234 pre-save transform: context links ("pipe trick") with namespace, comma and parens
6235 !! options
6236 pst title=[[Ns:Somearticle, Context (context)]]
6237 !! input
6238 [[|Article]]
6239 !! result
6240 [[Ns:Article (context)|Article]]
6241 !! end
6242
6243 !! test
6244 pre-save transform: context links ("pipe trick") with namespace, parens and comma
6245 !! options
6246 pst title=[[Ns:Somearticle (IGNORED), Context]]
6247 !! input
6248 [[|Article]]
6249 !! result
6250 [[Ns:Article, Context|Article]]
6251 !! end
6252
6253 !! test
6254 pre-save transform: context links ("pipe trick") with full-width parens and no space (Japanese and Chinese style, bug 30149)
6255 !! options
6256 pst
6257 !! input
6258 [[Article(context)|]]
6259 [[Bar:Article(context)|]]
6260 [[:Bar:Article(context)|]]
6261 [[|Article(context)]]
6262 [[Bar:X(Y)Z|]]
6263 [[:Bar:X(Y)Z|]]
6264 !! result
6265 [[Article(context)|Article]]
6266 [[Bar:Article(context)|Article]]
6267 [[:Bar:Article(context)|Article]]
6268 [[Article(context)]]
6269 [[Bar:X(Y)Z|X(Y)Z]]
6270 [[:Bar:X(Y)Z|X(Y)Z]]
6271 !! end
6272
6273 !! test
6274 pre-save transform: context links ("pipe trick") with full-width parens and space (Japanese and Chinese style, bug 30149)
6275 !! options
6276 pst
6277 !! input
6278 [[Article (context)|]]
6279 [[Bar:Article (context)|]]
6280 [[:Bar:Article (context)|]]
6281 [[|Article (context)]]
6282 [[Bar:X (Y) Z|]]
6283 [[:Bar:X (Y) Z|]]
6284 !! result
6285 [[Article (context)|Article]]
6286 [[Bar:Article (context)|Article]]
6287 [[:Bar:Article (context)|Article]]
6288 [[Article (context)]]
6289 [[Bar:X (Y) Z|X (Y) Z]]
6290 [[:Bar:X (Y) Z|X (Y) Z]]
6291 !! end
6292
6293 !! test
6294 pre-save transform: context links ("pipe trick") with parens and no space (Korean style, bug 30149)
6295 !! options
6296 pst
6297 !! input
6298 [[Article(context)|]]
6299 [[Bar:Article(context)|]]
6300 [[:Bar:Article(context)|]]
6301 [[|Article(context)]]
6302 [[Bar:X(Y)Z|]]
6303 [[:Bar:X(Y)Z|]]
6304 !! result
6305 [[Article(context)|Article]]
6306 [[Bar:Article(context)|Article]]
6307 [[:Bar:Article(context)|Article]]
6308 [[Article(context)]]
6309 [[Bar:X(Y)Z|X(Y)Z]]
6310 [[:Bar:X(Y)Z|X(Y)Z]]
6311 !! end
6312
6313 !! test
6314 pre-save transform: context links ("pipe trick") with commas (bug 21660)
6315 !! options
6316 pst
6317 !! input
6318 [[Article (context), context|]]
6319 [[Article (context),context|]]
6320 [[Bar:Article (context), context|]]
6321 [[Bar:Article (context),context|]]
6322 [[:Bar:Article (context), context|]]
6323 [[:Bar:Article (context),context|]]
6324 !! result
6325 [[Article (context), context|Article]]
6326 [[Article (context),context|Article]]
6327 [[Bar:Article (context), context|Article]]
6328 [[Bar:Article (context),context|Article]]
6329 [[:Bar:Article (context), context|Article]]
6330 [[:Bar:Article (context),context|Article]]
6331 !! end
6332
6333 !! test
6334 pre-save transform: trim trailing empty lines
6335 !! options
6336 pst
6337 !! input
6338 Empty lines are trimmed
6339
6340
6341
6342
6343 !! result
6344 Empty lines are trimmed
6345 !! end
6346
6347 !! test
6348 pre-save transform: Signature expansion
6349 !! options
6350 pst
6351 !! input
6352 * ~~~
6353 * <noinclude>~~~</noinclude>
6354 * <includeonly>~~~</includeonly>
6355 * <onlyinclude>~~~</onlyinclude>
6356 !! result
6357 * [[Special:Contributions/127.0.0.1|127.0.0.1]]
6358 * <noinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</noinclude>
6359 * <includeonly>[[Special:Contributions/127.0.0.1|127.0.0.1]]</includeonly>
6360 * <onlyinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</onlyinclude>
6361 !! end
6362
6363
6364 !! test
6365 pre-save transform: Signature expansion in nowiki tags (bug 93)
6366 !! options
6367 pst disabled
6368 !! input
6369 Shall not expand:
6370
6371 <nowiki>~~~~</nowiki>
6372
6373 <includeonly><nowiki>~~~~</nowiki></includeonly>
6374
6375 <noinclude><nowiki>~~~~</nowiki></noinclude>
6376
6377 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
6378
6379 {{subst:Foo}} shall be converted to FOO
6380
6381 As well as inside noinclude/onlyinclude
6382 <noinclude>{{subst:Foo}}</noinclude>
6383 <onlyinclude>{{subst:Foo}}</onlyinclude>
6384
6385 But not inside includeonly
6386 <includeonly>{{subst:Foo}}</includeonly>
6387 !! result
6388 Shall not expand:
6389
6390 <nowiki>~~~~</nowiki>
6391
6392 <includeonly><nowiki>~~~~</nowiki></includeonly>
6393
6394 <noinclude><nowiki>~~~~</nowiki></noinclude>
6395
6396 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
6397
6398 FOO shall be converted to FOO
6399
6400 As well as inside noinclude/onlyinclude
6401 <noinclude>FOO</noinclude>
6402 <onlyinclude>FOO</onlyinclude>
6403
6404 But not inside includeonly
6405 <includeonly>{{subst:Foo}}</includeonly>
6406 !! end
6407
6408 ###
6409 ### Message transform tests
6410 ###
6411 !! test
6412 message transform: magic variables
6413 !! options
6414 msg
6415 !! input
6416 {{SITENAME}}
6417 !! result
6418 MediaWiki
6419 !! end
6420
6421 !! test
6422 message transform: should not transform wiki markup
6423 !! options
6424 msg
6425 !! input
6426 ''test''
6427 !! result
6428 ''test''
6429 !! end
6430
6431 !! test
6432 message transform: <noinclude> in transcluded template (bug 4926)
6433 !! options
6434 msg
6435 !! input
6436 {{Includes}}
6437 !! result
6438 Foobar
6439 !! end
6440
6441 !! test
6442 message transform: <onlyinclude> in transcluded template (bug 4926)
6443 !! options
6444 msg
6445 !! input
6446 {{Includes2}}
6447 !! result
6448 Foo
6449 !! end
6450
6451 !! test
6452 {{#special:}} page name, known
6453 !! options
6454 msg
6455 !! input
6456 {{#special:Recentchanges}}
6457 !! result
6458 Special:RecentChanges
6459 !! end
6460
6461 !! test
6462 {{#special:}} page name with subpage, known
6463 !! options
6464 msg
6465 !! input
6466 {{#special:Recentchanges/param}}
6467 !! result
6468 Special:RecentChanges/param
6469 !! end
6470
6471 !! test
6472 {{#special:}} page name, unknown
6473 !! options
6474 msg
6475 !! input
6476 {{#special:foobarnonexistent}}
6477 !! result
6478 No such special page
6479 !! end
6480
6481 !! test
6482 {{#speciale:}} page name, known
6483 !! options
6484 msg
6485 !! input
6486 {{#speciale:Recentchanges}}
6487 !! result
6488 Special:RecentChanges
6489 !! end
6490
6491 !! test
6492 {{#speciale:}} page name with subpage, known
6493 !! options
6494 msg
6495 !! input
6496 {{#speciale:Recentchanges/param}}
6497 !! result
6498 Special:RecentChanges/param
6499 !! end
6500
6501 !! test
6502 {{#speciale:}} page name, unknown
6503 !! options
6504 msg
6505 !! input
6506 {{#speciale:foobarnonexistent}}
6507 !! result
6508 No_such_special_page
6509 !! end
6510
6511 ###
6512 ### Images
6513 ###
6514 !! test
6515 Simple image
6516 !! input
6517 [[Image:foobar.jpg]]
6518 !! result
6519 <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>
6520 </p>
6521 !! end
6522
6523 !! test
6524 Right-aligned image
6525 !! input
6526 [[Image:foobar.jpg|right]]
6527 !! result
6528 <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>
6529
6530 !! end
6531
6532 !! test
6533 Simple image (using File: namespace, now canonical)
6534 !! input
6535 [[File:foobar.jpg]]
6536 !! result
6537 <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>
6538 </p>
6539 !! end
6540
6541 !! test
6542 Image with caption
6543 !! input
6544 [[Image:foobar.jpg|right|Caption text]]
6545 !! result
6546 <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>
6547
6548 !! end
6549
6550 !! test
6551 Image with empty attribute
6552 !! input
6553 [[Image:foobar.jpg|right||Caption text]]
6554 !! result
6555 <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>
6556
6557 !! end
6558
6559 !! test
6560 Image with link tails
6561 !! input
6562 123[[Image:foobar.jpg]]456
6563 123[[Image:foobar.jpg|right]]456
6564 123[[Image:foobar.jpg|thumb]]456
6565 !! result
6566 <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
6567 </p>
6568 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
6569 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
6570
6571 !! end
6572
6573 !! test
6574 Image with multiple captions -- only last one is accepted
6575 !! input
6576 [[Image:foobar.jpg|right|Caption1 - ignored|[[Caption2]] - ignored|Caption3 - accepted]]
6577 !! result
6578 <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>
6579
6580 !! end
6581
6582 !! test
6583 Image with width attribute at different positions
6584 !! input
6585 [[Image:foobar.jpg|200px|right|Caption]]
6586 [[Image:foobar.jpg|right|200px|Caption]]
6587 [[Image:foobar.jpg|right|Caption|200px]]
6588 !! result
6589 <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>
6590 <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>
6591 <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>
6592
6593 !! end
6594
6595 !! test
6596 Image with link parameter, wiki target
6597 !! input
6598 [[Image:foobar.jpg|link=Target page]]
6599 !! result
6600 <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>
6601 </p>
6602 !! end
6603
6604 !! test
6605 Image with link parameter, URL target
6606 !! input
6607 [[Image:foobar.jpg|link=http://example.com/]]
6608 !! result
6609 <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>
6610 </p>
6611 !! end
6612
6613 !! test
6614 Image with link parameter, wgExternalLinkTarget
6615 !! input
6616 [[Image:foobar.jpg|link=http://example.com/]]
6617 !! config
6618 wgExternalLinkTarget='foobar'
6619 !! result
6620 <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>
6621 </p>
6622 !! end
6623
6624 !! test
6625 Image with link parameter, wgNoFollowLinks set to false
6626 !! input
6627 [[Image:foobar.jpg|link=http://example.com/]]
6628 !! config
6629 wgNoFollowLinks=false
6630 !! result
6631 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
6632 </p>
6633 !! end
6634
6635 !! test
6636 Image with link parameter, wgNoFollowDomainExceptions
6637 !! input
6638 [[Image:foobar.jpg|link=http://example.com/]]
6639 !! config
6640 wgNoFollowDomainExceptions='example.com'
6641 !! result
6642 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
6643 </p>
6644 !! end
6645
6646 !! test
6647 Image with link parameter, wgExternalLinkTarget, unnamed parameter
6648 !! input
6649 [[Image:foobar.jpg|link=http://example.com/|Title]]
6650 !! config
6651 wgExternalLinkTarget='foobar'
6652 !! result
6653 <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>
6654 </p>
6655 !! end
6656
6657 !! test
6658 Image with empty link parameter
6659 !! input
6660 [[Image:foobar.jpg|link=]]
6661 !! result
6662 <p><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" />
6663 </p>
6664 !! end
6665
6666 !! test
6667 Image with link parameter (wiki target) and unnamed parameter
6668 !! input
6669 [[Image:foobar.jpg|link=Target page|Title]]
6670 !! result
6671 <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>
6672 </p>
6673 !! end
6674
6675 !! test
6676 Image with link parameter (URL target) and unnamed parameter
6677 !! input
6678 [[Image:foobar.jpg|link=http://example.com/|Title]]
6679 !! result
6680 <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>
6681 </p>
6682 !! end
6683
6684 !! test
6685 Thumbnail image with link parameter
6686 !! input
6687 [[Image:foobar.jpg|thumb|link=http://example.com/|Title]]
6688 !! result
6689 <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>
6690
6691 !! end
6692
6693 !! test
6694 Image with frame and link
6695 !! input
6696 [[Image:Foobar.jpg|frame|left|This is a test image [[Main Page]]]]
6697 !! result
6698 <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>
6699
6700 !! end
6701
6702 !! test
6703 Image with frame and link and explicit alt
6704 !! input
6705 [[Image:Foobar.jpg|frame|left|This is a test image [[Main Page]]|alt=Altitude]]
6706 !! result
6707 <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>
6708
6709 !! end
6710
6711 !! test
6712 Image with wiki markup in implicit alt
6713 !! input
6714 [[Image:Foobar.jpg|testing '''bold''' in alt]]
6715 !! result
6716 <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>
6717 </p>
6718 !! end
6719
6720 !! test
6721 Image with wiki markup in explicit alt
6722 !! input
6723 [[Image:Foobar.jpg|alt=testing '''bold''' in alt]]
6724 !! result
6725 <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>
6726 </p>
6727 !! end
6728
6729 !! test
6730 Link to image page- image page normally doesn't exists, hence edit link
6731 Add test with existing image page
6732 #<p><a href="/wiki/File:Test" title="Image:Test">Image:test</a>
6733 !! input
6734 [[:Image:test]]
6735 !! result
6736 <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>
6737 </p>
6738 !! end
6739
6740 !! test
6741 bug 18784 Link to non-existent image page with caption should use caption as link text
6742 !! input
6743 [[:Image:test|caption]]
6744 !! result
6745 <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>
6746 </p>
6747 !! end
6748
6749 !! test
6750 Frameless image caption with a free URL
6751 !! input
6752 [[Image:foobar.jpg|http://example.com]]
6753 !! result
6754 <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>
6755 </p>
6756 !! end
6757
6758 !! test
6759 Thumbnail image caption with a free URL
6760 !! input
6761 [[Image:foobar.jpg|thumb|http://example.com]]
6762 !! result
6763 <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>
6764
6765 !! end
6766
6767 !! test
6768 Thumbnail image caption with a free URL and explicit alt
6769 !! input
6770 [[Image:foobar.jpg|thumb|http://example.com|alt=Alteration]]
6771 !! result
6772 <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>
6773
6774 !! end
6775
6776 !! test
6777 BUG 1887: A ISBN with a thumbnail
6778 !! input
6779 [[Image:foobar.jpg|thumb|ISBN 1235467890]]
6780 !! result
6781 <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>
6782
6783 !! end
6784
6785 !! test
6786 BUG 1887: A RFC with a thumbnail
6787 !! input
6788 [[Image:foobar.jpg|thumb|This is RFC 12354]]
6789 !! result
6790 <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>
6791
6792 !! end
6793
6794 !! test
6795 BUG 1887: A mailto link with a thumbnail
6796 !! input
6797 [[Image:foobar.jpg|thumb|Please mailto:nobody@example.com]]
6798 !! result
6799 <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>
6800
6801 !! end
6802
6803 # Pending resolution to bug 368
6804 !! test
6805 BUG 648: Frameless image caption with a link
6806 !! input
6807 [[Image:foobar.jpg|text with a [[link]] in it]]
6808 !! result
6809 <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>
6810 </p>
6811 !! end
6812
6813 !! test
6814 BUG 648: Frameless image caption with a link (suffix)
6815 !! input
6816 [[Image:foobar.jpg|text with a [[link]]foo in it]]
6817 !! result
6818 <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>
6819 </p>
6820 !! end
6821
6822 !! test
6823 BUG 648: Frameless image caption with an interwiki link
6824 !! input
6825 [[Image:foobar.jpg|text with a [[MeatBall:Link]] in it]]
6826 !! result
6827 <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>
6828 </p>
6829 !! end
6830
6831 !! test
6832 BUG 648: Frameless image caption with a piped interwiki link
6833 !! input
6834 [[Image:foobar.jpg|text with a [[MeatBall:Link|link]] in it]]
6835 !! result
6836 <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>
6837 </p>
6838 !! end
6839
6840 !! test
6841 Escape HTML special chars in image alt text
6842 !! input
6843 [[Image:foobar.jpg|& < > "]]
6844 !! result
6845 <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>
6846 </p>
6847 !! end
6848
6849 !! test
6850 BUG 499: Alt text should have &#1234;, not &amp;1234;
6851 !! input
6852 [[Image:foobar.jpg|&#9792;]]
6853 !! result
6854 <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>
6855 </p>
6856 !! end
6857
6858 !! test
6859 Broken image caption with link
6860 !! input
6861 [[Image:Foobar.jpg|thumb|This is a broken caption. But [[Main Page|this]] is just an ordinary link.
6862 !! result
6863 <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.
6864 </p>
6865 !! end
6866
6867 !! test
6868 Image caption containing another image
6869 !! input
6870 [[Image:Foobar.jpg|thumb|This is a caption with another [[Image:icon.png|image]] inside it!]]
6871 !! result
6872 <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>
6873
6874 !! end
6875
6876 !! test
6877 Image caption containing a newline
6878 !! input
6879 [[Image:Foobar.jpg|This
6880 *is some text]]
6881 !! result
6882 <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>
6883 </p>
6884 !!end
6885
6886
6887 !! test
6888 Bug 3090: External links other than http: in image captions
6889 !! input
6890 [[Image:Foobar.jpg|thumb|200px|This caption has [irc://example.net irc] and [https://example.com Secure] ext links in it.]]
6891 !! result
6892 <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>
6893
6894 !! end
6895
6896 !! test
6897 Custom class
6898 !! input
6899 [[Image:foobar.jpg|a|class=b]]
6900 !! result
6901 <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>
6902 </p>
6903 !! end
6904
6905 !! article
6906 File:Barfoo.jpg
6907 !! text
6908 #REDIRECT [[File:Barfoo.jpg]]
6909 !! endarticle
6910
6911 !! test
6912 Redirected image
6913 !! input
6914 [[Image:Barfoo.jpg]]
6915 !! result
6916 <p><a href="/wiki/File:Barfoo.jpg" title="File:Barfoo.jpg">File:Barfoo.jpg</a>
6917 </p>
6918 !! end
6919
6920 !! test
6921 Missing image with uploads disabled
6922 !! options
6923 wgEnableUploads=0
6924 !! input
6925 [[Image:Foobaz.jpg]]
6926 !! result
6927 <p><a href="/wiki/File:Foobaz.jpg" title="File:Foobaz.jpg">File:Foobaz.jpg</a>
6928 </p>
6929 !! end
6930
6931
6932 ###
6933 ### Subpages
6934 ###
6935 !! article
6936 Subpage test/subpage
6937 !! text
6938 foo
6939 !! endarticle
6940
6941 !! test
6942 Subpage link
6943 !! options
6944 subpage title=[[Subpage test]]
6945 !! input
6946 [[/subpage]]
6947 !! result
6948 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a>
6949 </p>
6950 !! end
6951
6952 !! test
6953 Subpage noslash link
6954 !! options
6955 subpage title=[[Subpage test]]
6956 !!input
6957 [[/subpage/]]
6958 !! result
6959 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">subpage</a>
6960 </p>
6961 !! end
6962
6963 !! test
6964 Disabled subpages
6965 !! input
6966 [[/subpage]]
6967 !! result
6968 <p><a href="/index.php?title=/subpage&amp;action=edit&amp;redlink=1" class="new" title="/subpage (page does not exist)">/subpage</a>
6969 </p>
6970 !! end
6971
6972 !! test
6973 BUG 561: {{/Subpage}}
6974 !! options
6975 subpage title=[[Page]]
6976 !! input
6977 {{/Subpage}}
6978 !! result
6979 <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>
6980 </p>
6981 !! end
6982
6983 ###
6984 ### Categories
6985 ###
6986 !! article
6987 Category:MediaWiki User's Guide
6988 !! text
6989 blah
6990 !! endarticle
6991
6992 !! test
6993 Link to category
6994 !! input
6995 [[:Category:MediaWiki User's Guide]]
6996 !! result
6997 <p><a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">Category:MediaWiki User's Guide</a>
6998 </p>
6999 !! end
7000
7001 !! test
7002 Simple category
7003 !! options
7004 cat
7005 !! input
7006 [[Category:MediaWiki User's Guide]]
7007 !! result
7008 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
7009 !! end
7010
7011 !! test
7012 PAGESINCATEGORY invalid title fatal (r33546 fix)
7013 !! input
7014 {{PAGESINCATEGORY:<bogus>}}
7015 !! result
7016 <p>0
7017 </p>
7018 !! end
7019
7020 !! test
7021 Category with different sort key
7022 !! options
7023 cat
7024 !! input
7025 [[Category:MediaWiki User's Guide|Foo]]
7026 !! result
7027 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
7028 !! end
7029
7030 !! test
7031 Category with identical sort key
7032 !! options
7033 cat
7034 !! input
7035 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
7036 !! result
7037 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
7038 !! end
7039
7040 !! test
7041 Category with empty sort key
7042 !! options
7043 cat
7044 pst
7045 !! input
7046 [[Category:MediaWiki User's Guide|]]
7047 !! result
7048 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
7049 !! end
7050
7051 !! test
7052 Category with empty sort key and parentheses
7053 !! options
7054 cat
7055 pst
7056 !! input
7057 [[Category:Foo (bar)|]]
7058 !! result
7059 [[Category:Foo (bar)|Foo]]
7060 !! end
7061
7062 !! test
7063 Category with link tail
7064 !! options
7065 cat
7066 pst
7067 !! input
7068 123[[Category:Foo]]456
7069 !! result
7070 123[[Category:Foo]]456
7071 !! end
7072
7073 !! test
7074 Category with template
7075 !! options
7076 cat
7077 pst
7078 !! input
7079 [[Category:{{echo|Foo}}]]
7080 !! result
7081 [[Category:{{echo|Foo}}]]
7082 !! end
7083
7084 !! test
7085 Category with template in sort key
7086 !! options
7087 cat
7088 pst
7089 !! input
7090 [[Category:Foo|{{echo|Bar}}]]
7091 !! result
7092 [[Category:Foo|{{echo|Bar}}]]
7093 !! end
7094
7095 !! test
7096 Category with template in sort key and title
7097 !! options
7098 cat
7099 pst
7100 !! input
7101 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
7102 !! result
7103 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
7104 !! end
7105
7106 !! test
7107 Category / paragraph interactions
7108 !! input
7109 Foo [[Category:Baz]] Bar
7110
7111 Foo [[Category:Baz]]
7112 Bar
7113
7114 Foo
7115 [[Category:Baz]]
7116 Bar
7117
7118 Foo
7119 [[Category:Baz]] Bar
7120
7121 Foo
7122 [[Category:Baz]]
7123 [[Category:Baz]]
7124 [[Category:Baz]]
7125 Bar
7126
7127 [[Category:Baz]]
7128 [[Category:Baz]]
7129 [[Category:Baz]]
7130
7131 [[Category:Baz]]
7132 {{echo|[[Category:Baz]]}}
7133 [[Category:Baz]]
7134 !! result
7135 <p>Foo Bar
7136 </p><p>Foo
7137 Bar
7138 </p><p>Foo
7139 Bar
7140 </p><p>Foo Bar
7141 </p><p>Foo
7142 Bar
7143 </p>
7144 !! end
7145
7146 ###
7147 ### Inter-language links
7148 ###
7149 !! test
7150 Inter-language links
7151 !! options
7152 ill
7153 !! input
7154 [[es:Alimento]]
7155 [[fr:Nourriture]]
7156 [[zh:&#39135;&#21697;]]
7157 !! result
7158 es:Alimento fr:Nourriture zh:食品
7159 !! end
7160
7161 !! test
7162 Duplicate interlanguage links (bug 24502)
7163 !! options
7164 ill
7165 !! input
7166 [[es:1]]
7167 [[es:2]]
7168 [[fr:1]]
7169 [[fr:2]]
7170 !! result
7171 es:1 fr:1
7172 !! end
7173
7174 ###
7175 ### Sections
7176 ###
7177 !! test
7178 Basic section headings
7179 !! input
7180 == Headline 1 ==
7181 Some text
7182
7183 ==Headline 2==
7184 More
7185 ===Smaller headline===
7186 Blah blah
7187 !! result
7188 <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>
7189 <p>Some text
7190 </p>
7191 <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>
7192 <p>More
7193 </p>
7194 <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>
7195 <p>Blah blah
7196 </p>
7197 !! end
7198
7199 !! test
7200 Section headings with TOC
7201 !! input
7202 == Headline 1 ==
7203 === Subheadline 1 ===
7204 ===== Skipping a level =====
7205 ====== Skipping a level ======
7206
7207 == Headline 2 ==
7208 Some text
7209 ===Another headline===
7210 !! result
7211 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
7212 <ul>
7213 <li class="toclevel-1 tocsection-1"><a href="#Headline_1"><span class="tocnumber">1</span> <span class="toctext">Headline 1</span></a>
7214 <ul>
7215 <li class="toclevel-2 tocsection-2"><a href="#Subheadline_1"><span class="tocnumber">1.1</span> <span class="toctext">Subheadline 1</span></a>
7216 <ul>
7217 <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>
7218 <ul>
7219 <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>
7220 </ul>
7221 </li>
7222 </ul>
7223 </li>
7224 </ul>
7225 </li>
7226 <li class="toclevel-1 tocsection-5"><a href="#Headline_2"><span class="tocnumber">2</span> <span class="toctext">Headline 2</span></a>
7227 <ul>
7228 <li class="toclevel-2 tocsection-6"><a href="#Another_headline"><span class="tocnumber">2.1</span> <span class="toctext">Another headline</span></a></li>
7229 </ul>
7230 </li>
7231 </ul>
7232 </td></tr></table>
7233 <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>
7234 <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>
7235 <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>
7236 <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>
7237 <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>
7238 <p>Some text
7239 </p>
7240 <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>
7241
7242 !! end
7243
7244 # perl -e 'print "="x$_," Level $_ heading","="x$_,"\n" for 1..10'
7245 !! test
7246 Handling of sections up to level 6 and beyond
7247 !! input
7248 = Level 1 Heading=
7249 == Level 2 Heading==
7250 === Level 3 Heading===
7251 ==== Level 4 Heading====
7252 ===== Level 5 Heading=====
7253 ====== Level 6 Heading======
7254 ======= Level 7 Heading=======
7255 ======== Level 8 Heading========
7256 ========= Level 9 Heading=========
7257 ========== Level 10 Heading==========
7258 !! result
7259 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
7260 <ul>
7261 <li class="toclevel-1 tocsection-1"><a href="#Level_1_Heading"><span class="tocnumber">1</span> <span class="toctext">Level 1 Heading</span></a>
7262 <ul>
7263 <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>
7264 <ul>
7265 <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>
7266 <ul>
7267 <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>
7268 <ul>
7269 <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>
7270 <ul>
7271 <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>
7272 <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>
7273 <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>
7274 <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>
7275 <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>
7276 </ul>
7277 </li>
7278 </ul>
7279 </li>
7280 </ul>
7281 </li>
7282 </ul>
7283 </li>
7284 </ul>
7285 </li>
7286 </ul>
7287 </td></tr></table>
7288 <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>
7289 <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>
7290 <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>
7291 <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>
7292 <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>
7293 <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>
7294 <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>
7295 <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>
7296 <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>
7297 <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>
7298
7299 !! end
7300
7301 !! test
7302 TOC regression (bug 9764)
7303 !! input
7304 == title 1 ==
7305 === title 1.1 ===
7306 ==== title 1.1.1 ====
7307 === title 1.2 ===
7308 == title 2 ==
7309 === title 2.1 ===
7310 !! result
7311 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
7312 <ul>
7313 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
7314 <ul>
7315 <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>
7316 <ul>
7317 <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>
7318 </ul>
7319 </li>
7320 <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>
7321 </ul>
7322 </li>
7323 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
7324 <ul>
7325 <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>
7326 </ul>
7327 </li>
7328 </ul>
7329 </td></tr></table>
7330 <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>
7331 <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>
7332 <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>
7333 <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>
7334 <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>
7335 <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>
7336
7337 !! end
7338
7339 !! test
7340 TOC with wgMaxTocLevel=3 (bug 6204)
7341 !! options
7342 wgMaxTocLevel=3
7343 !! input
7344 == title 1 ==
7345 === title 1.1 ===
7346 ==== title 1.1.1 ====
7347 === title 1.2 ===
7348 == title 2 ==
7349 === title 2.1 ===
7350 !! result
7351 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
7352 <ul>
7353 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
7354 <ul>
7355 <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>
7356 <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>
7357 </ul>
7358 </li>
7359 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
7360 <ul>
7361 <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>
7362 </ul>
7363 </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 <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>
7369 <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>
7370 <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>
7371 <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>
7372
7373 !! end
7374
7375 !! test
7376 TOC with wgMaxTocLevel=3 and two level four headings (bug 6204)
7377 !! options
7378 wgMaxTocLevel=3
7379 !! input
7380 ==Section 1==
7381 ===Section 1.1===
7382 ====Section 1.1.1====
7383 ====Section 1.1.1.1====
7384 ==Section 2==
7385 !! result
7386 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
7387 <ul>
7388 <li class="toclevel-1 tocsection-1"><a href="#Section_1"><span class="tocnumber">1</span> <span class="toctext">Section 1</span></a>
7389 <ul>
7390 <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>
7391 </ul>
7392 </li>
7393 <li class="toclevel-1 tocsection-5"><a href="#Section_2"><span class="tocnumber">2</span> <span class="toctext">Section 2</span></a></li>
7394 </ul>
7395 </td></tr></table>
7396 <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>
7397 <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>
7398 <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>
7399 <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>
7400 <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>
7401
7402 !! end
7403
7404
7405 !! test
7406 Resolving duplicate section names
7407 !! input
7408 == Foo bar ==
7409 == Foo bar ==
7410 !! result
7411 <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>
7412 <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>
7413
7414 !! end
7415
7416 !! test
7417 Resolving duplicate section names with differing case (bug 10721)
7418 !! input
7419 == Foo bar ==
7420 == Foo Bar ==
7421 !! result
7422 <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>
7423 <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>
7424
7425 !! end
7426
7427 !! article
7428 Template:sections
7429 !! text
7430 ===Section 1===
7431 ==Section 2==
7432 !! endarticle
7433
7434 !! test
7435 Template with sections, __NOTOC__
7436 !! input
7437 __NOTOC__
7438 ==Section 0==
7439 {{sections}}
7440 ==Section 4==
7441 !! result
7442 <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>
7443 <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>
7444 <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>
7445 <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>
7446
7447 !! end
7448
7449 !! test
7450 __NOEDITSECTION__ keyword
7451 !! input
7452 __NOEDITSECTION__
7453 ==Section 1==
7454 ==Section 2==
7455 !! result
7456 <h2> <span class="mw-headline" id="Section_1">Section 1</span></h2>
7457 <h2> <span class="mw-headline" id="Section_2">Section 2</span></h2>
7458
7459 !! end
7460
7461 !! test
7462 Link inside a section heading
7463 !! input
7464 ==Section with a [[Main Page|link]] in it==
7465 !! result
7466 <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>
7467
7468 !! end
7469
7470 !! test
7471 TOC regression (bug 12077)
7472 !! input
7473 __TOC__
7474 == title 1 ==
7475 === title 1.1 ===
7476 == title 2 ==
7477 !! result
7478 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
7479 <ul>
7480 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
7481 <ul>
7482 <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>
7483 </ul>
7484 </li>
7485 <li class="toclevel-1 tocsection-3"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a></li>
7486 </ul>
7487 </td></tr></table>
7488 <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>
7489 <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>
7490 <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>
7491
7492 !! end
7493
7494 !! test
7495 BUG 1219 URL next to image (good)
7496 !! input
7497 http://example.com [[Image:foobar.jpg]]
7498 !! result
7499 <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>
7500 </p>
7501 !!end
7502
7503 !! test
7504 Short headings with trailing space should match behaviour of Parser::doHeadings (bug 19910)
7505 !! input
7506 ===
7507 The line above must have a trailing space!
7508 === <!--
7509 --> <!-- -->
7510 But just in case it doesn't...
7511 !! result
7512 <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>
7513 <p>The line above must have a trailing space!
7514 </p>
7515 <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>
7516 <p>But just in case it doesn't...
7517 </p>
7518 !! end
7519
7520 !! test
7521 Header with special characters (bug 25462)
7522 !! input
7523 The tooltips shall not show entities to the user (ie. be double escaped)
7524
7525 == text > text ==
7526 section 1
7527
7528 == text < text ==
7529 section 2
7530
7531 == text & text ==
7532 section 3
7533
7534 == text ' text ==
7535 section 4
7536
7537 == text " text ==
7538 section 5
7539 !! result
7540 <p>The tooltips shall not show entities to the user (ie. be double escaped)
7541 </p>
7542 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
7543 <ul>
7544 <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>
7545 <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>
7546 <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>
7547 <li class="toclevel-1 tocsection-4"><a href="#text_.27_text"><span class="tocnumber">4</span> <span class="toctext">text ' text</span></a></li>
7548 <li class="toclevel-1 tocsection-5"><a href="#text_.22_text"><span class="tocnumber">5</span> <span class="toctext">text " text</span></a></li>
7549 </ul>
7550 </td></tr></table>
7551 <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>
7552 <p>section 1
7553 </p>
7554 <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>
7555 <p>section 2
7556 </p>
7557 <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>
7558 <p>section 3
7559 </p>
7560 <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>
7561 <p>section 4
7562 </p>
7563 <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>
7564 <p>section 5
7565 </p>
7566 !! end
7567
7568 !! test
7569 Headers with excess '=' characters
7570 (Are similar tests necessary beyond the 1st level?)
7571 !! input
7572 =foo==
7573 ==foo=
7574 =''italic'' heading==
7575 ==''italic'' heading=
7576 !! result
7577 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
7578 <ul>
7579 <li class="toclevel-1 tocsection-1"><a href="#foo.3D"><span class="tocnumber">1</span> <span class="toctext">foo=</span></a></li>
7580 <li class="toclevel-1 tocsection-2"><a href="#.3Dfoo"><span class="tocnumber">2</span> <span class="toctext">=foo</span></a></li>
7581 <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>
7582 <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>
7583 </ul>
7584 </td></tr></table>
7585 <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>
7586 <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>
7587 <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>
7588 <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>
7589
7590 !! end
7591
7592 !! test
7593 BUG 1219 URL next to image (broken)
7594 !! input
7595 http://example.com[[Image:foobar.jpg]]
7596 !! result
7597 <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>
7598 </p>
7599 !!end
7600
7601 !! test
7602 Bug 1186 news: in the middle of text
7603 !! input
7604 http://en.wikinews.org/wiki/Wikinews:Workplace
7605 !! result
7606 <p><a rel="nofollow" class="external free" href="http://en.wikinews.org/wiki/Wikinews:Workplace">http://en.wikinews.org/wiki/Wikinews:Workplace</a>
7607 </p>
7608 !!end
7609
7610
7611 !! test
7612 Namespaced link must have a title
7613 !! input
7614 [[Project:]]
7615 !! result
7616 <p>[[Project:]]
7617 </p>
7618 !!end
7619
7620 !! test
7621 Namespaced link must have a title (bad fragment version)
7622 !! input
7623 [[Project:#fragment]]
7624 !! result
7625 <p>[[Project:#fragment]]
7626 </p>
7627 !!end
7628
7629
7630 ###
7631 ### HTML tags and HTML attributes
7632 ###
7633
7634 !! test
7635 div with no attributes
7636 !! input
7637 <div>HTML rocks</div>
7638 !! result
7639 <div>HTML rocks</div>
7640
7641 !! end
7642
7643 !! test
7644 div with double-quoted attribute
7645 !! input
7646 <div id="rock">HTML rocks</div>
7647 !! result
7648 <div id="rock">HTML rocks</div>
7649
7650 !! end
7651
7652 !! test
7653 div with single-quoted attribute
7654 !! input
7655 <div id='rock'>HTML rocks</div>
7656 !! result
7657 <div id="rock">HTML rocks</div>
7658
7659 !! end
7660
7661 !! test
7662 div with unquoted attribute
7663 !! input
7664 <div id=rock>HTML rocks</div>
7665 !! result
7666 <div id="rock">HTML rocks</div>
7667
7668 !! end
7669
7670 !! test
7671 div with illegal double attributes
7672 !! input
7673 <div id="a" id="b">HTML rocks</div>
7674 !! result
7675 <div id="b">HTML rocks</div>
7676
7677 !!end
7678
7679 # FIXME: produce empty string instead of "class" in the PHP parser, following
7680 # the HTML5 spec.
7681 !! test
7682 div with empty attribute value, space before equals
7683 !! options
7684 disabled
7685 !! input
7686 <div class =>HTML rocks</div>
7687 !! result
7688 <div class="">HTML rocks</div>
7689
7690 !! end
7691
7692 # The PHP parser escapes the opening brace to &#123; for some reason, so
7693 # disabled this test for it.
7694 !! test
7695 div with braces in attribute value
7696 !! options
7697 disabled
7698 !! input
7699 <div title="{}">Foo</div>
7700 !! result
7701 <div title="{}">Foo</div>
7702 !! end
7703
7704 # This it very inconsistent in the PHP parser: it returns
7705 # class="class" if there is a space between the name and the equal sign (see
7706 # 'div with empty attribute value, space before equals'), but strips the
7707 # attribute completely if the space is missing. We hope that not much content
7708 # depends on this, so are implementing the behavior below in Parsoid for
7709 # consistencies' sake. Disabled for the PHP parser.
7710 # FIXME: fix this behavior in the PHP parser?
7711 !! test
7712 div with empty attribute value, no space before equals
7713 !! options
7714 disabled
7715 !! input
7716 <div class=>HTML rocks</div>
7717 !! result
7718 <div class="">HTML rocks</div>
7719
7720 !! end
7721
7722 !! test
7723 HTML multiple attributes correction
7724 !! input
7725 <p class="error" class="awesome">Awesome!</p>
7726 !! result
7727 <p class="awesome">Awesome!</p>
7728
7729 !!end
7730
7731 !! test
7732 Table multiple attributes correction
7733 !! input
7734 {|
7735 !+ class="error" class="awesome"| status
7736 |}
7737 !! result
7738 <table>
7739 <tr>
7740 <th class="awesome"> status
7741 </th></tr></table>
7742
7743 !!end
7744
7745 !! test
7746 DIV IN UPPERCASE
7747 !! input
7748 <DIV ID="x">HTML ROCKS</DIV>
7749 !! result
7750 <div id="x">HTML ROCKS</div>
7751
7752 !!end
7753
7754 !! test
7755 Non-ASCII pseudo-tags are rendered as text
7756 !! input
7757 <khyô>
7758 !! result
7759 <p>&lt;khyô&gt;
7760 </p>
7761 !! end
7762
7763 !! test
7764 Pseudo-tag with URL 'name' renders as url link
7765 !! input
7766 <http://example.com/>
7767 !! result
7768 <p>&lt;<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&gt;
7769 </p>
7770 !! end
7771
7772 !! test
7773 text with amp in the middle of nowhere
7774 !! input
7775 Remember AT&T?
7776 !!result
7777 <p>Remember AT&amp;T?
7778 </p>
7779 !! end
7780
7781 !! test
7782 text with character entity: eacute
7783 !! input
7784 I always thought &eacute; was a cute letter.
7785 !! result
7786 <p>I always thought &#233; was a cute letter.
7787 </p>
7788 !! end
7789
7790 !! test
7791 text with undefined character entity: xacute
7792 !! input
7793 I always thought &xacute; was a cute letter.
7794 !! result
7795 <p>I always thought &amp;xacute; was a cute letter.
7796 </p>
7797 !! end
7798
7799
7800 ###
7801 ### Media links
7802 ###
7803
7804 !! test
7805 Media link
7806 !! input
7807 [[Media:Foobar.jpg]]
7808 !! result
7809 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Media:Foobar.jpg</a>
7810 </p>
7811 !! end
7812
7813 !! test
7814 Media link with text
7815 !! input
7816 [[Media:Foobar.jpg|A neat file to look at]]
7817 !! result
7818 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">A neat file to look at</a>
7819 </p>
7820 !! end
7821
7822 # FIXME: this is still bad HTML tag nesting
7823 !! test
7824 Media link with nasty text
7825 fixme: doBlockLevels won't wrap this in a paragraph because it contains a div
7826 !! input
7827 [[Media:Foobar.jpg|Safe Link<div style=display:none>" onmouseover="alert(document.cookie)" onfoo="</div>]]
7828 !! result
7829 <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>
7830
7831 !! end
7832
7833 !! test
7834 Media link to nonexistent file (bug 1702)
7835 !! input
7836 [[Media:No such.jpg]]
7837 !! result
7838 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=No_such.jpg" class="new" title="No such.jpg">Media:No such.jpg</a>
7839 </p>
7840 !! end
7841
7842 !! test
7843 Image link to nonexistent file (bug 1850 - good)
7844 !! input
7845 [[Image:No such.jpg]]
7846 !! result
7847 <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>
7848 </p>
7849 !! end
7850
7851 !! test
7852 :Image link to nonexistent file (bug 1850 - bad)
7853 !! input
7854 [[:Image:No such.jpg]]
7855 !! result
7856 <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>
7857 </p>
7858 !! end
7859
7860
7861
7862 !! test
7863 Character reference normalization in link text (bug 1938)
7864 !! input
7865 [[Main Page|this&that]]
7866 !! result
7867 <p><a href="/wiki/Main_Page" title="Main Page">this&amp;that</a>
7868 </p>
7869 !!end
7870
7871 !! article
7872 אַ
7873 !! text
7874 Test for unicode normalization
7875
7876 The page's name is U+05d0 U+05b7, with non-canonical form U+FB2E
7877 !! endarticle
7878
7879 !! test
7880 (bug 19451) Links should refer to the normalized form.
7881 !! input
7882 [[&#xFB2E;]]
7883 [[&#x5d0;&#x5b7;]]
7884 [[&#x5d0;ַ]]
7885 [[א&#x5b7;]]
7886 [[אַ]]
7887 !! result
7888 <p><a href="/wiki/%D7%90%D6%B7" title="אַ">&#xfb2e;</a>
7889 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;&#x5b7;</a>
7890 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;ַ</a>
7891 <a href="/wiki/%D7%90%D6%B7" title="אַ">א&#x5b7;</a>
7892 <a href="/wiki/%D7%90%D6%B7" title="אַ">אַ</a>
7893 </p>
7894 !! end
7895
7896 !! test
7897 Empty attribute crash test (bug 2067)
7898 !! input
7899 <font color="">foo</font>
7900 !! result
7901 <p><font color="">foo</font>
7902 </p>
7903 !! end
7904
7905 !! test
7906 Empty attribute crash test single-quotes (bug 2067)
7907 !! input
7908 <font color=''>foo</font>
7909 !! result
7910 <p><font color="">foo</font>
7911 </p>
7912 !! end
7913
7914 !! test
7915 Attribute test: equals, then nothing
7916 !! input
7917 <font color=>foo</font>
7918 !! result
7919 <p><font>foo</font>
7920 </p>
7921 !! end
7922
7923 !! test
7924 Attribute test: unquoted value
7925 !! input
7926 <font color=x>foo</font>
7927 !! result
7928 <p><font color="x">foo</font>
7929 </p>
7930 !! end
7931
7932 !! test
7933 Attribute test: unquoted but illegal value (hash)
7934 !! input
7935 <font color=#x>foo</font>
7936 !! result
7937 <p><font color="#x">foo</font>
7938 </p>
7939 !! end
7940
7941 !! test
7942 Attribute test: no value
7943 !! input
7944 <font color>foo</font>
7945 !! result
7946 <p><font color="color">foo</font>
7947 </p>
7948 !! end
7949
7950 !! test
7951 Bug 2095: link with three closing brackets
7952 !! input
7953 [[Main Page]]]
7954 !! result
7955 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>]
7956 </p>
7957 !! end
7958
7959 !! test
7960 Bug 2095: link with pipe and three closing brackets
7961 !! input
7962 [[Main Page|link]]]
7963 !! result
7964 <p><a href="/wiki/Main_Page" title="Main Page">link</a>]
7965 </p>
7966 !! end
7967
7968 !! test
7969 Bug 2095: link with pipe and three closing brackets, version 2
7970 !! input
7971 [[Main Page|[http://example.com/]]]
7972 !! result
7973 <p><a href="/wiki/Main_Page" title="Main Page">[http://example.com/]</a>
7974 </p>
7975 !! end
7976
7977
7978 ###
7979 ### Safety
7980 ###
7981
7982 !! article
7983 Template:Dangerous attribute
7984 !! text
7985 " onmouseover="alert(document.cookie)
7986 !! endarticle
7987
7988 !! article
7989 Template:Dangerous style attribute
7990 !! text
7991 border-size: expression(alert(document.cookie))
7992 !! endarticle
7993
7994 !! article
7995 Template:Div style
7996 !! text
7997 <div style="float: right; {{{1}}}">Magic div</div>
7998 !! endarticle
7999
8000 !! test
8001 Bug 2304: HTML attribute safety (safe template; regression bug 2309)
8002 !! input
8003 <div title="{{test}}"></div>
8004 !! result
8005 <div title="This is a test template"></div>
8006
8007 !! end
8008
8009 !! test
8010 Bug 2304: HTML attribute safety (dangerous template; 2309)
8011 !! input
8012 <div title="{{dangerous attribute}}"></div>
8013 !! result
8014 <div title=""></div>
8015
8016 !! end
8017
8018 !! test
8019 Bug 2304: HTML attribute safety (dangerous style template; 2309)
8020 !! input
8021 <div style="{{dangerous style attribute}}"></div>
8022 !! result
8023 <div style="/* insecure input */"></div>
8024
8025 !! end
8026
8027 !! test
8028 Bug 2304: HTML attribute safety (safe parameter; 2309)
8029 !! input
8030 {{div style|width: 200px}}
8031 !! result
8032 <div style="float: right; width: 200px">Magic div</div>
8033
8034 !! end
8035
8036 !! test
8037 Bug 2304: HTML attribute safety (unsafe parameter; 2309)
8038 !! input
8039 {{div style|width: expression(alert(document.cookie))}}
8040 !! result
8041 <div style="/* insecure input */">Magic div</div>
8042
8043 !! end
8044
8045 !! test
8046 Bug 2304: HTML attribute safety (unsafe breakout parameter; 2309)
8047 !! input
8048 {{div style|"><script>alert(document.cookie)</script>}}
8049 !! result
8050 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
8051
8052 !! end
8053
8054 !! test
8055 Bug 2304: HTML attribute safety (unsafe breakout parameter 2; 2309)
8056 !! input
8057 {{div style|" ><script>alert(document.cookie)</script>}}
8058 !! result
8059 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
8060
8061 !! end
8062
8063 !! test
8064 Bug 2304: HTML attribute safety (link)
8065 !! input
8066 <div title="[[Main Page]]"></div>
8067 !! result
8068 <div title="&#91;&#91;Main Page]]"></div>
8069
8070 !! end
8071
8072 !! test
8073 Bug 2304: HTML attribute safety (italics)
8074 !! input
8075 <div title="''foobar''"></div>
8076 !! result
8077 <div title="&#39;&#39;foobar&#39;&#39;"></div>
8078
8079 !! end
8080
8081 !! test
8082 Bug 2304: HTML attribute safety (bold)
8083 !! input
8084 <div title="'''foobar'''"></div>
8085 !! result
8086 <div title="&#39;&#39;&#39;foobar&#39;&#39;&#39;"></div>
8087
8088 !! end
8089
8090
8091 !! test
8092 Bug 2304: HTML attribute safety (ISBN)
8093 !! input
8094 <div title="ISBN 1234567890"></div>
8095 !! result
8096 <div title="&#73;SBN 1234567890"></div>
8097
8098 !! end
8099
8100 !! test
8101 Bug 2304: HTML attribute safety (RFC)
8102 !! input
8103 <div title="RFC 1234"></div>
8104 !! result
8105 <div title="&#82;FC 1234"></div>
8106
8107 !! end
8108
8109 !! test
8110 Bug 2304: HTML attribute safety (PMID)
8111 !! input
8112 <div title="PMID 1234567890"></div>
8113 !! result
8114 <div title="&#80;MID 1234567890"></div>
8115
8116 !! end
8117
8118 !! test
8119 Bug 2304: HTML attribute safety (web link)
8120 !! input
8121 <div title="http://example.com/"></div>
8122 !! result
8123 <div title="http&#58;//example.com/"></div>
8124
8125 !! end
8126
8127 !! test
8128 Bug 2304: HTML attribute safety (named web link)
8129 !! input
8130 <div title="[http://example.com/ link]"></div>
8131 !! result
8132 <div title="&#91;http&#58;//example.com/ link]"></div>
8133
8134 !! end
8135
8136 !! test
8137 Bug 3244: HTML attribute safety (extension; safe)
8138 !! input
8139 <div style="<nowiki>background:blue</nowiki>"></div>
8140 !! result
8141 <div style="background:blue"></div>
8142
8143 !! end
8144
8145 !! test
8146 Bug 3244: HTML attribute safety (extension; unsafe)
8147 !! input
8148 <div style="<nowiki>border-left:expression(alert(document.cookie))</nowiki>"></div>
8149 !! result
8150 <div style="/* insecure input */"></div>
8151
8152 !! end
8153
8154 # More MSIE fun discovered by Tom Gilder
8155
8156 !! test
8157 MSIE CSS safety test: spurious slash
8158 !! input
8159 <div style="background-image:u\rl(javascript:alert('boo'))">evil</div>
8160 !! result
8161 <div style="/* insecure input */">evil</div>
8162
8163 !! end
8164
8165 !! test
8166 MSIE CSS safety test: hex code
8167 !! input
8168 <div style="background-image:u\72l(javascript:alert('boo'))">evil</div>
8169 !! result
8170 <div style="/* insecure input */">evil</div>
8171
8172 !! end
8173
8174 !! test
8175 MSIE CSS safety test: comment in url
8176 !! input
8177 <div style="background-image:u/**/rl(javascript:alert('boo'))">evil</div>
8178 !! result
8179 <div style="background-image:u rl(javascript:alert(&#39;boo&#39;))">evil</div>
8180
8181 !! end
8182
8183 !! test
8184 MSIE CSS safety test: comment in expression
8185 !! input
8186 <div style="background-image:expres/**/sion(alert('boo4'))">evil4</div>
8187 !! result
8188 <div style="background-image:expres sion(alert(&#39;boo4&#39;))">evil4</div>
8189
8190 !! end
8191
8192
8193 !! test
8194 Table attribute legitimate extension
8195 !! input
8196 {|
8197 !+ style="<nowiki>color:blue</nowiki>"| status
8198 |}
8199 !! result
8200 <table>
8201 <tr>
8202 <th style="color:blue"> status
8203 </th></tr></table>
8204
8205 !!end
8206
8207 !! test
8208 Table attribute safety
8209 !! input
8210 {|
8211 !+ style="<nowiki>border-width:expression(0+alert(document.cookie))</nowiki>"| status
8212 |}
8213 !! result
8214 <table>
8215 <tr>
8216 <th style="/* insecure input */"> status
8217 </th></tr></table>
8218
8219 !! end
8220
8221 !! test
8222 CSS line continuation 1
8223 !! input
8224 <div style="background-image: u\&#10;rl(test.jpg);"></div>
8225 !! result
8226 <div style="/* insecure input */"></div>
8227
8228 !! end
8229
8230 !! test
8231 CSS line continuation 2
8232 !! input
8233 <div style="background-image: u\&#13;rl(test.jpg); "></div>
8234 !! result
8235 <div style="/* insecure input */"></div>
8236
8237 !! end
8238
8239 !! article
8240 Template:Identity
8241 !! text
8242 {{{1}}}
8243 !! endarticle
8244
8245 !! test
8246 Expansion of multi-line templates in attribute values (bug 6255)
8247 !! input
8248 <div style="background: {{identity|#00FF00}}">-</div>
8249 !! result
8250 <div style="background: #00FF00">-</div>
8251
8252 !! end
8253
8254
8255 !! test
8256 Expansion of multi-line templates in attribute values (bug 6255 sanity check)
8257 !! input
8258 <div style="background:
8259 #00FF00">-</div>
8260 !! result
8261 <div style="background: #00FF00">-</div>
8262
8263 !! end
8264
8265 !! test
8266 Expansion of multi-line templates in attribute values (bug 6255 sanity check 2)
8267 !! input
8268 <div style="background: &#10;#00FF00">-</div>
8269 !! result
8270 <div style="background: &#10;#00FF00">-</div>
8271
8272 !! end
8273
8274 ###
8275 ### Parser hooks (see maintenance/parserTestsParserHook.php for the <tag> extension)
8276 ###
8277 !! test
8278 Parser hook: empty input
8279 !! input
8280 <tag></tag>
8281 !! result
8282 <pre>
8283 ''
8284 array (
8285 )
8286 </pre>
8287
8288 !! end
8289
8290 !! test
8291 Parser hook: empty input using terminated empty elements
8292 !! input
8293 <tag/>
8294 !! result
8295 <pre>
8296 NULL
8297 array (
8298 )
8299 </pre>
8300
8301 !! end
8302
8303 !! test
8304 Parser hook: empty input using terminated empty elements (space before)
8305 !! input
8306 <tag />
8307 !! result
8308 <pre>
8309 NULL
8310 array (
8311 )
8312 </pre>
8313
8314 !! end
8315
8316 !! test
8317 Parser hook: basic input
8318 !! input
8319 <tag>input</tag>
8320 !! result
8321 <pre>
8322 'input'
8323 array (
8324 )
8325 </pre>
8326
8327 !! end
8328
8329
8330 !! test
8331 Parser hook: case insensitive
8332 !! input
8333 <TAG>input</TAG>
8334 !! result
8335 <pre>
8336 'input'
8337 array (
8338 )
8339 </pre>
8340
8341 !! end
8342
8343
8344 !! test
8345 Parser hook: case insensitive, redux
8346 !! input
8347 <TaG>input</TAg>
8348 !! result
8349 <pre>
8350 'input'
8351 array (
8352 )
8353 </pre>
8354
8355 !! end
8356
8357 !! test
8358 Parser hook: nested tags
8359 !! options
8360 noxml
8361 !! input
8362 <tag><tag></tag></tag>
8363 !! result
8364 <pre>
8365 '<tag>'
8366 array (
8367 )
8368 </pre>&lt;/tag&gt;
8369
8370 !! end
8371
8372 !! test
8373 Parser hook: basic arguments
8374 !! input
8375 <tag width=200 height = "100" depth = '50' square></tag>
8376 !! result
8377 <pre>
8378 ''
8379 array (
8380 'width' => '200',
8381 'height' => '100',
8382 'depth' => '50',
8383 'square' => 'square',
8384 )
8385 </pre>
8386
8387 !! end
8388
8389 !! test
8390 Parser hook: argument containing a forward slash (bug 5344)
8391 !! input
8392 <tag filename='/tmp/bla'></tag>
8393 !! result
8394 <pre>
8395 ''
8396 array (
8397 'filename' => '/tmp/bla',
8398 )
8399 </pre>
8400
8401 !! end
8402
8403 !! test
8404 Parser hook: empty input using terminated empty elements (bug 2374)
8405 !! input
8406 <tag foo=bar/>text
8407 !! result
8408 <pre>
8409 NULL
8410 array (
8411 'foo' => 'bar',
8412 )
8413 </pre>text
8414
8415 !! end
8416
8417 # </tag> should be output literally since there is no matching tag that begins it
8418 !! test
8419 Parser hook: basic arguments using terminated empty elements (bug 2374)
8420 !! input
8421 <tag width=200 height = "100" depth = '50' square/>
8422 other stuff
8423 </tag>
8424 !! result
8425 <pre>
8426 NULL
8427 array (
8428 'width' => '200',
8429 'height' => '100',
8430 'depth' => '50',
8431 'square' => 'square',
8432 )
8433 </pre>
8434 <p>other stuff
8435 &lt;/tag&gt;
8436 </p>
8437 !! end
8438
8439 ###
8440 ### (see maintenance/parserTestsStaticParserHook.php for the <statictag> extension)
8441 ###
8442
8443 !! test
8444 Parser hook: static parser hook not inside a comment
8445 !! input
8446 <statictag>hello, world</statictag>
8447 <statictag action=flush/>
8448 !! result
8449 <p>hello, world
8450 </p>
8451 !! end
8452
8453
8454 !! test
8455 Parser hook: static parser hook inside a comment
8456 !! input
8457 <!-- <statictag>hello, world</statictag> -->
8458 <statictag action=flush/>
8459 !! result
8460 <p><br />
8461 </p>
8462 !! end
8463
8464 # Nested template calls; this case was broken by Parser.php rev 1.506,
8465 # since reverted.
8466
8467 !! article
8468 Template:One-parameter
8469 !! text
8470 (My parameter is: {{{1}}})
8471 !! endarticle
8472
8473 !! article
8474 Template:Map-one-parameter
8475 !! text
8476 {{{{{1}}}|{{{2}}}}}
8477 !! endarticle
8478
8479 !! test
8480 Nested template calls
8481 !! input
8482 {{Map-one-parameter|One-parameter|param}}
8483 !! result
8484 <p>(My parameter is: param)
8485 </p>
8486 !! end
8487
8488
8489 ###
8490 ### Sanitizer
8491 ###
8492 !! test
8493 Sanitizer: Closing of open tags
8494 !! input
8495 <s></s><table></table>
8496 !! result
8497 <s></s><table></table>
8498
8499 !! end
8500
8501 !! test
8502 Sanitizer: Closing of open but not closed tags
8503 !! input
8504 <s>foo
8505 !! result
8506 <p><s>foo</s>
8507 </p>
8508 !! end
8509
8510 !! test
8511 Sanitizer: Closing of closed but not open tags
8512 !! input
8513 </s>
8514 !! result
8515 <p>&lt;/s&gt;
8516 </p>
8517 !! end
8518
8519 !! test
8520 Sanitizer: Closing of closed but not open table tags
8521 !! input
8522 Table not started</td></tr></table>
8523 !! result
8524 <p>Table not started&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
8525 </p>
8526 !! end
8527
8528 !! test
8529 Sanitizer: Escaping of spaces, multibyte characters, colons & other stuff in id=""
8530 !! input
8531 <span id="æ: v">byte</span>[[#æ: v|backlink]]
8532 !! result
8533 <p><span id=".C3.A6:_v">byte</span><a href="#.C3.A6:_v">backlink</a>
8534 </p>
8535 !! end
8536
8537 !! test
8538 Sanitizer: Validating the contents of the id attribute (bug 4515)
8539 !! options
8540 disabled
8541 !! input
8542 <br id=9 />
8543 !! result
8544 Something, but definitely not <br id="9" />...
8545 !! end
8546
8547 !! test
8548 Sanitizer: Validating id attribute uniqueness (bug 4515, bug 6301)
8549 !! options
8550 disabled
8551 !! input
8552 <br id="foo" /><br id="foo" />
8553 !! result
8554 Something need to be done. foo-2 ?
8555 !! end
8556
8557 !! test
8558 Sanitizer: Validating that <meta> and <link> work, but only for Microdata
8559 !! input
8560 <div itemscope>
8561 <meta itemprop="hello" content="world">
8562 <meta http-equiv="refresh" content="5">
8563 <meta itemprop="hello" http-equiv="refresh" content="5">
8564 <link itemprop="hello" href="{{SERVER}}">
8565 <link rel="stylesheet" href="{{SERVER}}">
8566 <link rel="stylesheet" itemprop="hello" href="{{SERVER}}">
8567 </div>
8568 !! result
8569 <div itemscope="itemscope">
8570 <p> <meta itemprop="hello" content="world" />
8571 &lt;meta http-equiv="refresh" content="5"&gt;
8572 <meta itemprop="hello" content="5" />
8573 </p>
8574 <link itemprop="hello" href="http&#58;//Britney-Spears" />
8575 &lt;link rel="stylesheet" href="<a rel="nofollow" class="external free" href="http://Britney-Spears">http://Britney-Spears</a>"&gt;
8576 <link itemprop="hello" href="http&#58;//Britney-Spears" />
8577 </div>
8578
8579 !! end
8580
8581 !! test
8582 Language converter: output gets cut off unexpectedly (bug 5757)
8583 !! options
8584 language=zh
8585 !! input
8586 this bit is safe: }-
8587
8588 but if we add a conversion instance: -{zh-cn:xxx;zh-tw:yyy}-
8589
8590 then we get cut off here: }-
8591
8592 all additional text is vanished
8593 !! result
8594 <p>this bit is safe: }-
8595 </p><p>but if we add a conversion instance: xxx
8596 </p><p>then we get cut off here: }-
8597 </p><p>all additional text is vanished
8598 </p>
8599 !! end
8600
8601 !! test
8602 Self closed html pairs (bug 5487)
8603 !! options
8604 !! input
8605 <center><font id="bug" />Centered text</center>
8606 <div><font id="bug2" />In div text</div>
8607 !! result
8608 <center>&lt;font id="bug" /&gt;Centered text</center>
8609 <div>&lt;font id="bug2" /&gt;In div text</div>
8610
8611 !! end
8612
8613 #
8614 #
8615 #
8616
8617 !! test
8618 Punctuation: nbsp before exclamation
8619 !! input
8620 C'est grave !
8621 !! result
8622 <p>C'est grave&#160;!
8623 </p>
8624 !! end
8625
8626 !! test
8627 Punctuation: CSS !important (bug 11874)
8628 !! input
8629 <div style="width:50% !important">important</div>
8630 !! result
8631 <div style="width:50% !important">important</div>
8632
8633 !!end
8634
8635 !! test
8636 Punctuation: CSS ! important (bug 11874; with space after)
8637 !! input
8638 <div style="width:50% ! important">important</div>
8639 !! result
8640 <div style="width:50% ! important">important</div>
8641
8642 !!end
8643
8644
8645 !! test
8646 HTML bullet list, closed tags (bug 5497)
8647 !! input
8648 <ul>
8649 <li>One</li>
8650 <li>Two</li>
8651 </ul>
8652 !! result
8653 <ul>
8654 <li>One</li>
8655 <li>Two</li>
8656 </ul>
8657
8658 !! end
8659
8660 !! test
8661 HTML bullet list, unclosed tags (bug 5497)
8662 !! options
8663 disabled
8664 !! input
8665 <ul>
8666 <li>One
8667 <li>Two
8668 </ul>
8669 !! result
8670 <ul>
8671 <li>One
8672 </li><li>Two
8673 </li></ul>
8674
8675 !! end
8676
8677 !! test
8678 HTML ordered list, closed tags (bug 5497)
8679 !! input
8680 <ol>
8681 <li>One</li>
8682 <li>Two</li>
8683 </ol>
8684 !! result
8685 <ol>
8686 <li>One</li>
8687 <li>Two</li>
8688 </ol>
8689
8690 !! end
8691
8692 !! test
8693 HTML ordered list, unclosed tags (bug 5497)
8694 !! options
8695 disabled
8696 !! input
8697 <ol>
8698 <li>One
8699 <li>Two
8700 </ol>
8701 !! result
8702 <ol>
8703 <li>One
8704 </li><li>Two
8705 </li></ol>
8706
8707 !! end
8708
8709 !! test
8710 HTML nested bullet list, closed tags (bug 5497)
8711 !! input
8712 <ul>
8713 <li>One</li>
8714 <li>Two:
8715 <ul>
8716 <li>Sub-one</li>
8717 <li>Sub-two</li>
8718 </ul>
8719 </li>
8720 </ul>
8721 !! result
8722 <ul>
8723 <li>One</li>
8724 <li>Two:
8725 <ul>
8726 <li>Sub-one</li>
8727 <li>Sub-two</li>
8728 </ul>
8729 </li>
8730 </ul>
8731
8732 !! end
8733
8734 !! test
8735 HTML nested bullet list, open tags (bug 5497)
8736 !! options
8737 disabled
8738 !! input
8739 <ul>
8740 <li>One
8741 <li>Two:
8742 <ul>
8743 <li>Sub-one
8744 <li>Sub-two
8745 </ul>
8746 </ul>
8747 !! result
8748 <ul>
8749 <li>One
8750 </li><li>Two:
8751 <ul>
8752 <li>Sub-one
8753 </li><li>Sub-two
8754 </li></ul>
8755 </li></ul>
8756
8757 !! end
8758
8759 !! test
8760 HTML nested ordered list, closed tags (bug 5497)
8761 !! input
8762 <ol>
8763 <li>One</li>
8764 <li>Two:
8765 <ol>
8766 <li>Sub-one</li>
8767 <li>Sub-two</li>
8768 </ol>
8769 </li>
8770 </ol>
8771 !! result
8772 <ol>
8773 <li>One</li>
8774 <li>Two:
8775 <ol>
8776 <li>Sub-one</li>
8777 <li>Sub-two</li>
8778 </ol>
8779 </li>
8780 </ol>
8781
8782 !! end
8783
8784 !! test
8785 HTML nested ordered list, open tags (bug 5497)
8786 !! options
8787 disabled
8788 !! input
8789 <ol>
8790 <li>One
8791 <li>Two:
8792 <ol>
8793 <li>Sub-one
8794 <li>Sub-two
8795 </ol>
8796 </ol>
8797 !! result
8798 <ol>
8799 <li>One
8800 </li><li>Two:
8801 <ol>
8802 <li>Sub-one
8803 </li><li>Sub-two
8804 </li></ol>
8805 </li></ol>
8806
8807 !! end
8808
8809 !! test
8810 HTML ordered list item with parameters oddity
8811 !! input
8812 <ol><li id="fragment">One</li></ol>
8813 !! result
8814 <ol><li id="fragment">One</li></ol>
8815
8816 !! end
8817
8818 !!test
8819 bug 5918: autonumbering
8820 !! input
8821 [http://first/] [http://second] [ftp://ftp]
8822
8823 ftp://inlineftp
8824
8825 [mailto:enclosed@mail.tld With target]
8826
8827 [mailto:enclosed@mail.tld]
8828
8829 mailto:inline@mail.tld
8830 !! result
8831 <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>
8832 </p><p><a rel="nofollow" class="external free" href="ftp://inlineftp">ftp://inlineftp</a>
8833 </p><p><a rel="nofollow" class="external text" href="mailto:enclosed@mail.tld">With target</a>
8834 </p><p><a rel="nofollow" class="external autonumber" href="mailto:enclosed@mail.tld">[4]</a>
8835 </p><p><a rel="nofollow" class="external free" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a>
8836 </p>
8837 !! end
8838
8839
8840 #
8841 # Security and HTML correctness
8842 # From Nick Jenkins' fuzz testing
8843 #
8844
8845 !! test
8846 Fuzz testing: Parser13
8847 !! input
8848 {|
8849 | http://a|
8850 !! result
8851 <table>
8852 <tr>
8853 <td>
8854 </td>
8855 </tr>
8856 </table>
8857
8858 !! end
8859
8860 !! test
8861 Fuzz testing: Parser14
8862 !! input
8863 == onmouseover= ==
8864 http://__TOC__
8865 !! result
8866 <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>
8867 http://<table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
8868 <ul>
8869 <li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
8870 </ul>
8871 </td></tr></table>
8872
8873 !! end
8874
8875 !! test
8876 Fuzz testing: Parser14-table
8877 !! input
8878 ==a==
8879 {| STYLE=__TOC__
8880 !! result
8881 <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>
8882 <table style="&#95;_TOC&#95;_">
8883 <tr><td></td></tr>
8884 </table>
8885
8886 !! end
8887
8888 # Known to produce bogus xml (extra </td>)
8889 !! test
8890 Fuzz testing: Parser16
8891 !! options
8892 noxml
8893 !! input
8894 {|
8895 !https://||||||
8896 !! result
8897 <table>
8898 <tr>
8899 <th>https://</th>
8900 <th></th>
8901 <th></th>
8902 <th>
8903 </td>
8904 </tr>
8905 </table>
8906
8907 !! end
8908
8909 !! test
8910 Fuzz testing: Parser21
8911 !! input
8912 {|
8913 ! irc://{{ftp://a" onmouseover="alert('hello world');"
8914 |
8915 !! result
8916 <table>
8917 <tr>
8918 <th> <a rel="nofollow" class="external free" href="irc://{{ftp://a">irc://{{ftp://a</a>" onmouseover="alert('hello world');"
8919 </th>
8920 <td>
8921 </td>
8922 </tr>
8923 </table>
8924
8925 !! end
8926
8927 !! test
8928 Fuzz testing: Parser22
8929 !! input
8930 http://===r:::https://b
8931
8932 {|
8933 !!result
8934 <p><a rel="nofollow" class="external free" href="http://===r:::https://b">http://===r:::https://b</a>
8935 </p>
8936 <table>
8937 <tr><td></td></tr>
8938 </table>
8939
8940 !! end
8941
8942 # Known to produce bad XML for now
8943 !! test
8944 Fuzz testing: Parser24
8945 !! options
8946 noxml
8947 !! input
8948 {|
8949 {{{|
8950 <u CLASS=
8951 | {{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx--><noinclude>}}}} >
8952 <br style="onmouseover='alert(document.cookie);' " />
8953
8954 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
8955 |
8956 !! result
8957 <table>
8958 {{{|
8959 <u class="&#124;">}}}} &gt;
8960 <br style="onmouseover=&#39;alert(document.cookie);&#39;" />
8961
8962 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
8963 <tr>
8964 <td></u>
8965 </td>
8966 </tr>
8967 </table>
8968
8969 !! end
8970
8971 # Note: the current result listed for this is not what the original one was,
8972 # but the original bug was JavaScript injection, which is fixed in any case.
8973 # It's not clear that the original result listed was any more correct than the
8974 # current one. Original result:
8975 # <p>{{{|
8976 # </p>
8977 # <li class="&#124;&#124;">
8978 # }}}blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
8979 !!test
8980 Fuzz testing: Parser25 (bug 6055)
8981 !! input
8982 {{{
8983 |
8984 <LI CLASS=||
8985 >
8986 }}}blah" onmouseover="alert('hello world');" align="left"'''MOVE MOUSE CURSOR OVER HERE
8987 !! result
8988 <p>&lt;LI CLASS=blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
8989 </p>
8990 !! end
8991
8992 !!test
8993 Fuzz testing: URL adjacent extension (with space, clean)
8994 !! options
8995 !! input
8996 http://example.com <nowiki>junk</nowiki>
8997 !! result
8998 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a> junk
8999 </p>
9000 !!end
9001
9002 !!test
9003 Fuzz testing: URL adjacent extension (no space, dirty; nowiki)
9004 !! options
9005 !! input
9006 http://example.com<nowiki>junk</nowiki>
9007 !! result
9008 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>junk
9009 </p>
9010 !!end
9011
9012 !!test
9013 Fuzz testing: URL adjacent extension (no space, dirty; pre)
9014 !! options
9015 !! input
9016 http://example.com<pre>junk</pre>
9017 !! result
9018 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a><pre>junk</pre>
9019
9020 !!end
9021
9022 !!test
9023 Fuzz testing: image with bogus manual thumbnail
9024 !!input
9025 [[Image:foobar.jpg|thumbnail= ]]
9026 !!result
9027 <div class="thumb tright"><div class="thumbinner" style="width:1943px;">Error creating thumbnail: <div class="thumbcaption"></div></div></div>
9028
9029 !!end
9030
9031 !! test
9032 Fuzz testing: encoded newline in generated HTML replacements (bug 6577)
9033 !! input
9034 <pre dir="&#10;"></pre>
9035 !! result
9036 <pre dir="&#10;"></pre>
9037
9038 !! end
9039
9040 !! test
9041 Parsing optional HTML elements (Bug 6171)
9042 !! options
9043 !! input
9044 <table>
9045 <tr>
9046 <td> Some tabular data</td>
9047 <td> More tabular data ...
9048 <td> And yet som tabular data</td>
9049 </tr>
9050 </table>
9051 !! result
9052 <table>
9053 <tr>
9054 <td> Some tabular data</td>
9055 <td> More tabular data ...
9056 </td><td> And yet som tabular data</td>
9057 </tr>
9058 </table>
9059
9060 !! end
9061
9062 !! test
9063 Correct handling of <td>, <tr> (Bug 6171)
9064 !! options
9065 !! input
9066 <table>
9067 <tr>
9068 <td> Some tabular data</td>
9069 <td> More tabular data ...</td>
9070 <td> And yet som tabular data</td>
9071 </tr>
9072 </table>
9073 !! result
9074 <table>
9075 <tr>
9076 <td> Some tabular data</td>
9077 <td> More tabular data ...</td>
9078 <td> And yet som tabular data</td>
9079 </tr>
9080 </table>
9081
9082 !! end
9083
9084
9085 !! test
9086 Parsing crashing regression (fr:JavaScript)
9087 !! input
9088 </body></x>
9089 !! result
9090 <p>&lt;/body&gt;&lt;/x&gt;
9091 </p>
9092 !! end
9093
9094 !! test
9095 Inline wiki vs wiki block nesting
9096 !! input
9097 '''Bold paragraph
9098
9099 New wiki paragraph
9100 !! result
9101 <p><b>Bold paragraph</b>
9102 </p><p>New wiki paragraph
9103 </p>
9104 !! end
9105
9106 !! test
9107 Inline HTML vs wiki block nesting
9108 !! options
9109 disabled
9110 !! input
9111 <b>Bold paragraph
9112
9113 New wiki paragraph
9114 !! result
9115 <p><b>Bold paragraph</b>
9116 </p><p>New wiki paragraph
9117 </p>
9118 !! end
9119
9120 # Original result was this:
9121 # <p><b>bold</b><b>bold<i>bolditalics</i></b>
9122 # </p>
9123 # While that might be marginally more intuitive, maybe, the six-apostrophe
9124 # construct is clearly pathological and the result stated here (which is what
9125 # the parser actually does) is about as reasonable as anything.
9126 !!test
9127 Mixing markup for italics and bold
9128 !! options
9129 !! input
9130 '''bold''''''bold''bolditalics'''''
9131 !! result
9132 <p>'<i>bold'</i><b>bold<i>bolditalics</i></b>
9133 </p>
9134 !! end
9135
9136
9137 !! article
9138 Xyzzyx
9139 !! text
9140 Article for special page transclusion test
9141 !! endarticle
9142
9143 !! test
9144 Special page transclusion
9145 !! options
9146 !! input
9147 {{Special:Prefixindex/Xyzzyx}}
9148 !! result
9149 <table id="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
9150
9151 !! end
9152
9153 !! test
9154 Special page transclusion twice (bug 5021)
9155 !! options
9156 !! input
9157 {{Special:Prefixindex/Xyzzyx}}
9158 {{Special:Prefixindex/Xyzzyx}}
9159 !! result
9160 <table id="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
9161 <table id="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
9162
9163 !! end
9164
9165 !! test
9166 Transclusion of default MediaWiki message
9167 !! input
9168 {{MediaWiki:Mainpage}}
9169 !!result
9170 <p>Main Page
9171 </p>
9172 !! end
9173
9174 !! test
9175 Transclusion of nonexistent MediaWiki message
9176 !! input
9177 {{MediaWiki:Mainpagexxx}}
9178 !!result
9179 <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>
9180 </p>
9181 !! end
9182
9183 !! test
9184 Transclusion of MediaWiki message with underscore
9185 !! input
9186 {{MediaWiki:history_short}}
9187 !! result
9188 <p>History
9189 </p>
9190 !! end
9191
9192 !! test
9193 Transclusion of MediaWiki message with space
9194 !! input
9195 {{MediaWiki:history short}}
9196 !! result
9197 <p>History
9198 </p>
9199 !! end
9200
9201 !! test
9202 Invalid header with following text
9203 !! input
9204 = x = y
9205 !! result
9206 <p>= x = y
9207 </p>
9208 !! end
9209
9210
9211 !! test
9212 Section extraction test (section 0)
9213 !! options
9214 section=0
9215 !! input
9216 start
9217 ==a==
9218 ===aa===
9219 ====aaa====
9220 ==b==
9221 ===ba===
9222 ===bb===
9223 ====bba====
9224 ===bc===
9225 ==c==
9226 ===ca===
9227 !! result
9228 start
9229 !! end
9230
9231 !! test
9232 Section extraction test (section 1)
9233 !! options
9234 section=1
9235 !! input
9236 start
9237 ==a==
9238 ===aa===
9239 ====aaa====
9240 ==b==
9241 ===ba===
9242 ===bb===
9243 ====bba====
9244 ===bc===
9245 ==c==
9246 ===ca===
9247 !! result
9248 ==a==
9249 ===aa===
9250 ====aaa====
9251 !! end
9252
9253 !! test
9254 Section extraction test (section 2)
9255 !! options
9256 section=2
9257 !! input
9258 start
9259 ==a==
9260 ===aa===
9261 ====aaa====
9262 ==b==
9263 ===ba===
9264 ===bb===
9265 ====bba====
9266 ===bc===
9267 ==c==
9268 ===ca===
9269 !! result
9270 ===aa===
9271 ====aaa====
9272 !! end
9273
9274 !! test
9275 Section extraction test (section 3)
9276 !! options
9277 section=3
9278 !! input
9279 start
9280 ==a==
9281 ===aa===
9282 ====aaa====
9283 ==b==
9284 ===ba===
9285 ===bb===
9286 ====bba====
9287 ===bc===
9288 ==c==
9289 ===ca===
9290 !! result
9291 ====aaa====
9292 !! end
9293
9294 !! test
9295 Section extraction test (section 4)
9296 !! options
9297 section=4
9298 !! input
9299 start
9300 ==a==
9301 ===aa===
9302 ====aaa====
9303 ==b==
9304 ===ba===
9305 ===bb===
9306 ====bba====
9307 ===bc===
9308 ==c==
9309 ===ca===
9310 !! result
9311 ==b==
9312 ===ba===
9313 ===bb===
9314 ====bba====
9315 ===bc===
9316 !! end
9317
9318 !! test
9319 Section extraction test (section 5)
9320 !! options
9321 section=5
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 ===ba===
9336 !! end
9337
9338 !! test
9339 Section extraction test (section 6)
9340 !! options
9341 section=6
9342 !! input
9343 start
9344 ==a==
9345 ===aa===
9346 ====aaa====
9347 ==b==
9348 ===ba===
9349 ===bb===
9350 ====bba====
9351 ===bc===
9352 ==c==
9353 ===ca===
9354 !! result
9355 ===bb===
9356 ====bba====
9357 !! end
9358
9359 !! test
9360 Section extraction test (section 7)
9361 !! options
9362 section=7
9363 !! input
9364 start
9365 ==a==
9366 ===aa===
9367 ====aaa====
9368 ==b==
9369 ===ba===
9370 ===bb===
9371 ====bba====
9372 ===bc===
9373 ==c==
9374 ===ca===
9375 !! result
9376 ====bba====
9377 !! end
9378
9379 !! test
9380 Section extraction test (section 8)
9381 !! options
9382 section=8
9383 !! input
9384 start
9385 ==a==
9386 ===aa===
9387 ====aaa====
9388 ==b==
9389 ===ba===
9390 ===bb===
9391 ====bba====
9392 ===bc===
9393 ==c==
9394 ===ca===
9395 !! result
9396 ===bc===
9397 !! end
9398
9399 !! test
9400 Section extraction test (section 9)
9401 !! options
9402 section=9
9403 !! input
9404 start
9405 ==a==
9406 ===aa===
9407 ====aaa====
9408 ==b==
9409 ===ba===
9410 ===bb===
9411 ====bba====
9412 ===bc===
9413 ==c==
9414 ===ca===
9415 !! result
9416 ==c==
9417 ===ca===
9418 !! end
9419
9420 !! test
9421 Section extraction test (section 10)
9422 !! options
9423 section=10
9424 !! input
9425 start
9426 ==a==
9427 ===aa===
9428 ====aaa====
9429 ==b==
9430 ===ba===
9431 ===bb===
9432 ====bba====
9433 ===bc===
9434 ==c==
9435 ===ca===
9436 !! result
9437 ===ca===
9438 !! end
9439
9440 !! test
9441 Section extraction test (nonexistent section 11)
9442 !! options
9443 section=11
9444 !! input
9445 start
9446 ==a==
9447 ===aa===
9448 ====aaa====
9449 ==b==
9450 ===ba===
9451 ===bb===
9452 ====bba====
9453 ===bc===
9454 ==c==
9455 ===ca===
9456 !! result
9457 !! end
9458
9459 !! test
9460 Section extraction test with bogus heading (section 1)
9461 !! options
9462 section=1
9463 !! input
9464 ==a==
9465 ==bogus== not a legal section
9466 ==b==
9467 !! result
9468 ==a==
9469 ==bogus== not a legal section
9470 !! end
9471
9472 !! test
9473 Section extraction test with bogus heading (section 2)
9474 !! options
9475 section=2
9476 !! input
9477 ==a==
9478 ==bogus== not a legal section
9479 ==b==
9480 !! result
9481 ==b==
9482 !! end
9483
9484 !! test
9485 Section extraction test with comment after heading (section 1)
9486 !! options
9487 section=1
9488 !! input
9489 ==a==
9490 ==b== <!-- -->
9491 ==c==
9492 !! result
9493 ==a==
9494 !! end
9495
9496 !! test
9497 Section extraction test with comment after heading (section 2)
9498 !! options
9499 section=2
9500 !! input
9501 ==a==
9502 ==b== <!-- -->
9503 ==c==
9504 !! result
9505 ==b== <!-- -->
9506 !! end
9507
9508 !! test
9509 Section extraction test with bogus <nowiki> heading (section 1)
9510 !! options
9511 section=1
9512 !! input
9513 ==a==
9514 ==bogus== <nowiki>not a legal section</nowiki>
9515 ==b==
9516 !! result
9517 ==a==
9518 ==bogus== <nowiki>not a legal section</nowiki>
9519 !! end
9520
9521 !! test
9522 Section extraction test with bogus <nowiki> heading (section 2)
9523 !! options
9524 section=2
9525 !! input
9526 ==a==
9527 ==bogus== <nowiki>not a legal section</nowiki>
9528 ==b==
9529 !! result
9530 ==b==
9531 !! end
9532
9533
9534 # Formerly testing for bug 2587, now resolved by the use of unmarked sections
9535 # instead of respecting commented sections
9536 !! test
9537 Section extraction prefixed by comment (section 1)
9538 !! options
9539 section=1
9540 !! input
9541 <!-- -->==sec1==
9542 ==sec2==
9543 !!result
9544 ==sec2==
9545 !!end
9546
9547 !! test
9548 Section extraction prefixed by comment (section 2)
9549 !! options
9550 section=2
9551 !! input
9552 <!-- -->==sec1==
9553 ==sec2==
9554 !!result
9555
9556 !!end
9557
9558
9559 # Formerly testing for bug 2607, now resolved by the use of unmarked sections
9560 # instead of respecting HTML-style headings
9561 !! test
9562 Section extraction, mixed wiki and html (section 1)
9563 !! options
9564 section=1
9565 !! input
9566 <h2>unmarked</h2>
9567 unmarked
9568 ==1==
9569 one
9570 ==2==
9571 two
9572 !! result
9573 ==1==
9574 one
9575 !! end
9576
9577 !! test
9578 Section extraction, mixed wiki and html (section 2)
9579 !! options
9580 section=2
9581 !! input
9582 <h2>unmarked</h2>
9583 unmarked
9584 ==1==
9585 one
9586 ==2==
9587 two
9588 !! result
9589 ==2==
9590 two
9591 !! end
9592
9593
9594 # Formerly testing for bug 3342
9595 !! test
9596 Section extraction, heading surrounded by <noinclude>
9597 !! options
9598 section=1
9599 !! input
9600 <noinclude>==unmarked==</noinclude>
9601 ==marked==
9602 !! result
9603 ==marked==
9604 !!end
9605
9606 # Test behaviour of bug 19910
9607 !! test
9608 Sectiion with all-equals
9609 !! options
9610 section=2
9611 !! input
9612 ===
9613 The line above must have a trailing space
9614 === <!--
9615 --> <!-- -->
9616 But just in case it doesn't...
9617 !! result
9618 === <!--
9619 --> <!-- -->
9620 But just in case it doesn't...
9621 !! end
9622
9623 !! test
9624 Section replacement test (section 0)
9625 !! options
9626 replace=0,"xxx"
9627 !! input
9628 start
9629 ==a==
9630 ===aa===
9631 ====aaa====
9632 ==b==
9633 ===ba===
9634 ===bb===
9635 ====bba====
9636 ===bc===
9637 ==c==
9638 ===ca===
9639 !! result
9640 xxx
9641
9642 ==a==
9643 ===aa===
9644 ====aaa====
9645 ==b==
9646 ===ba===
9647 ===bb===
9648 ====bba====
9649 ===bc===
9650 ==c==
9651 ===ca===
9652 !! end
9653
9654 !! test
9655 Section replacement test (section 1)
9656 !! options
9657 replace=1,"xxx"
9658 !! input
9659 start
9660 ==a==
9661 ===aa===
9662 ====aaa====
9663 ==b==
9664 ===ba===
9665 ===bb===
9666 ====bba====
9667 ===bc===
9668 ==c==
9669 ===ca===
9670 !! result
9671 start
9672 xxx
9673
9674 ==b==
9675 ===ba===
9676 ===bb===
9677 ====bba====
9678 ===bc===
9679 ==c==
9680 ===ca===
9681 !! end
9682
9683 !! test
9684 Section replacement test (section 2)
9685 !! options
9686 replace=2,"xxx"
9687 !! input
9688 start
9689 ==a==
9690 ===aa===
9691 ====aaa====
9692 ==b==
9693 ===ba===
9694 ===bb===
9695 ====bba====
9696 ===bc===
9697 ==c==
9698 ===ca===
9699 !! result
9700 start
9701 ==a==
9702 xxx
9703
9704 ==b==
9705 ===ba===
9706 ===bb===
9707 ====bba====
9708 ===bc===
9709 ==c==
9710 ===ca===
9711 !! end
9712
9713 !! test
9714 Section replacement test (section 3)
9715 !! options
9716 replace=3,"xxx"
9717 !! input
9718 start
9719 ==a==
9720 ===aa===
9721 ====aaa====
9722 ==b==
9723 ===ba===
9724 ===bb===
9725 ====bba====
9726 ===bc===
9727 ==c==
9728 ===ca===
9729 !! result
9730 start
9731 ==a==
9732 ===aa===
9733 xxx
9734
9735 ==b==
9736 ===ba===
9737 ===bb===
9738 ====bba====
9739 ===bc===
9740 ==c==
9741 ===ca===
9742 !! end
9743
9744 !! test
9745 Section replacement test (section 4)
9746 !! options
9747 replace=4,"xxx"
9748 !! input
9749 start
9750 ==a==
9751 ===aa===
9752 ====aaa====
9753 ==b==
9754 ===ba===
9755 ===bb===
9756 ====bba====
9757 ===bc===
9758 ==c==
9759 ===ca===
9760 !! result
9761 start
9762 ==a==
9763 ===aa===
9764 ====aaa====
9765 xxx
9766
9767 ==c==
9768 ===ca===
9769 !! end
9770
9771 !! test
9772 Section replacement test (section 5)
9773 !! options
9774 replace=5,"xxx"
9775 !! input
9776 start
9777 ==a==
9778 ===aa===
9779 ====aaa====
9780 ==b==
9781 ===ba===
9782 ===bb===
9783 ====bba====
9784 ===bc===
9785 ==c==
9786 ===ca===
9787 !! result
9788 start
9789 ==a==
9790 ===aa===
9791 ====aaa====
9792 ==b==
9793 xxx
9794
9795 ===bb===
9796 ====bba====
9797 ===bc===
9798 ==c==
9799 ===ca===
9800 !! end
9801
9802 !! test
9803 Section replacement test (section 6)
9804 !! options
9805 replace=6,"xxx"
9806 !! input
9807 start
9808 ==a==
9809 ===aa===
9810 ====aaa====
9811 ==b==
9812 ===ba===
9813 ===bb===
9814 ====bba====
9815 ===bc===
9816 ==c==
9817 ===ca===
9818 !! result
9819 start
9820 ==a==
9821 ===aa===
9822 ====aaa====
9823 ==b==
9824 ===ba===
9825 xxx
9826
9827 ===bc===
9828 ==c==
9829 ===ca===
9830 !! end
9831
9832 !! test
9833 Section replacement test (section 7)
9834 !! options
9835 replace=7,"xxx"
9836 !! input
9837 start
9838 ==a==
9839 ===aa===
9840 ====aaa====
9841 ==b==
9842 ===ba===
9843 ===bb===
9844 ====bba====
9845 ===bc===
9846 ==c==
9847 ===ca===
9848 !! result
9849 start
9850 ==a==
9851 ===aa===
9852 ====aaa====
9853 ==b==
9854 ===ba===
9855 ===bb===
9856 xxx
9857
9858 ===bc===
9859 ==c==
9860 ===ca===
9861 !! end
9862
9863 !! test
9864 Section replacement test (section 8)
9865 !! options
9866 replace=8,"xxx"
9867 !! input
9868 start
9869 ==a==
9870 ===aa===
9871 ====aaa====
9872 ==b==
9873 ===ba===
9874 ===bb===
9875 ====bba====
9876 ===bc===
9877 ==c==
9878 ===ca===
9879 !! result
9880 start
9881 ==a==
9882 ===aa===
9883 ====aaa====
9884 ==b==
9885 ===ba===
9886 ===bb===
9887 ====bba====
9888 xxx
9889
9890 ==c==
9891 ===ca===
9892 !!end
9893
9894 !! test
9895 Section replacement test (section 9)
9896 !! options
9897 replace=9,"xxx"
9898 !! input
9899 start
9900 ==a==
9901 ===aa===
9902 ====aaa====
9903 ==b==
9904 ===ba===
9905 ===bb===
9906 ====bba====
9907 ===bc===
9908 ==c==
9909 ===ca===
9910 !! result
9911 start
9912 ==a==
9913 ===aa===
9914 ====aaa====
9915 ==b==
9916 ===ba===
9917 ===bb===
9918 ====bba====
9919 ===bc===
9920 xxx
9921 !! end
9922
9923 !! test
9924 Section replacement test (section 10)
9925 !! options
9926 replace=10,"xxx"
9927 !! input
9928 start
9929 ==a==
9930 ===aa===
9931 ====aaa====
9932 ==b==
9933 ===ba===
9934 ===bb===
9935 ====bba====
9936 ===bc===
9937 ==c==
9938 ===ca===
9939 !! result
9940 start
9941 ==a==
9942 ===aa===
9943 ====aaa====
9944 ==b==
9945 ===ba===
9946 ===bb===
9947 ====bba====
9948 ===bc===
9949 ==c==
9950 xxx
9951 !! end
9952
9953 !! test
9954 Section replacement test with initial whitespace (bug 13728)
9955 !! options
9956 replace=2,"xxx"
9957 !! input
9958 Preformatted initial line
9959 ==a==
9960 ===a===
9961 !! result
9962 Preformatted initial line
9963 ==a==
9964 xxx
9965 !! end
9966
9967
9968 !! test
9969 Section extraction, heading followed by pre with 20 spaces (bug 6398)
9970 !! options
9971 section=1
9972 !! input
9973 ==a==
9974 a
9975 !! result
9976 ==a==
9977 a
9978 !! end
9979
9980 !! test
9981 Section extraction, heading followed by pre with 19 spaces (bug 6398 sanity check)
9982 !! options
9983 section=1
9984 !! input
9985 ==a==
9986 a
9987 !! result
9988 ==a==
9989 a
9990 !! end
9991
9992
9993 !! test
9994 Section extraction, <pre> around bogus header (bug 10309)
9995 !! options
9996 noxml section=2
9997 !! input
9998 == Section One ==
9999 <pre>
10000 =======
10001 </pre>
10002
10003 == Section Two ==
10004 stuff
10005 !! result
10006 == Section Two ==
10007 stuff
10008 !! end
10009
10010 !! test
10011 Section replacement, <pre> around bogus header (bug 10309)
10012 !! options
10013 noxml replace=2,"xxx"
10014 !! input
10015 == Section One ==
10016 <pre>
10017 =======
10018 </pre>
10019
10020 == Section Two ==
10021 stuff
10022 !! result
10023 == Section One ==
10024 <pre>
10025 =======
10026 </pre>
10027
10028 xxx
10029 !! end
10030
10031
10032
10033 !! test
10034 Handling of &#x0A; in URLs
10035 !! input
10036 **irc://&#x0A;a
10037 !! result
10038 <ul><li><ul><li><a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a>
10039 </li></ul>
10040 </li></ul>
10041
10042 !!end
10043
10044 !! test
10045 5 quotes, code coverage +1 line
10046 !! input
10047 '''''
10048 !! result
10049 !! end
10050
10051 !! test
10052 Special:Search page linking.
10053 !! input
10054 {{Special:search}}
10055 !! result
10056 <p><a href="/wiki/Special:Search" title="Special:Search">Special:Search</a>
10057 </p>
10058 !! end
10059
10060 !! test
10061 Say the magic word
10062 !! input
10063 * {{PAGENAME}}
10064 * {{BASEPAGENAME}}
10065 * {{SUBPAGENAME}}
10066 * {{SUBPAGENAMEE}}
10067 * {{BASEPAGENAME}}
10068 * {{BASEPAGENAMEE}}
10069 * {{TALKPAGENAME}}
10070 * {{TALKPAGENAMEE}}
10071 * {{SUBJECTPAGENAME}}
10072 * {{SUBJECTPAGENAMEE}}
10073 * {{NAMESPACEE}}
10074 * {{NAMESPACE}}
10075 * {{TALKSPACE}}
10076 * {{TALKSPACEE}}
10077 * {{SUBJECTSPACE}}
10078 * {{SUBJECTSPACEE}}
10079 * {{Dynamic|{{NUMBEROFUSERS}}|{{NUMBEROFPAGES}}|{{CURRENTVERSION}}|{{CONTENTLANGUAGE}}|{{DIRECTIONMARK}}|{{CURRENTTIMESTAMP}}|{{NUMBEROFARTICLES}}}}
10080 !! result
10081 <ul><li> Parser test
10082 </li><li> Parser test
10083 </li><li> Parser test
10084 </li><li> Parser_test
10085 </li><li> Parser test
10086 </li><li> Parser_test
10087 </li><li> Talk:Parser test
10088 </li><li> Talk:Parser_test
10089 </li><li> Parser test
10090 </li><li> Parser_test
10091 </li><li>
10092 </li><li>
10093 </li><li> Talk
10094 </li><li> Talk
10095 </li><li>
10096 </li><li>
10097 </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>
10098 </li></ul>
10099
10100 !! end
10101 ### Note: Above tests excludes the "{{NUMBEROFADMINS}}" magic word because it generates a MySQL error when included.
10102
10103 !! test
10104 Gallery
10105 !! input
10106 <gallery>
10107 image1.png |
10108 image2.gif|||||
10109
10110 image3|
10111 image4 |300px| centre
10112 image5.svg| http://///////
10113 [[x|xx]]]]
10114 * image6
10115 </gallery>
10116 !! result
10117 <ul class="gallery">
10118 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
10119 <div style="height: 150px;">Image1.png</div>
10120 <div class="gallerytext">
10121 </div>
10122 </div></li>
10123 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
10124 <div style="height: 150px;">Image2.gif</div>
10125 <div class="gallerytext">
10126 <p>||||
10127 </p>
10128 </div>
10129 </div></li>
10130 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
10131 <div style="height: 150px;">Image3</div>
10132 <div class="gallerytext">
10133 </div>
10134 </div></li>
10135 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
10136 <div style="height: 150px;">Image4</div>
10137 <div class="gallerytext">
10138 <p>300px| centre
10139 </p>
10140 </div>
10141 </div></li>
10142 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
10143 <div style="height: 150px;">Image5.svg</div>
10144 <div class="gallerytext">
10145 <p><a rel="nofollow" class="external free" href="http://///////">http://///////</a>
10146 </p>
10147 </div>
10148 </div></li>
10149 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
10150 <div style="height: 150px;">* image6</div>
10151 <div class="gallerytext">
10152 </div>
10153 </div></li>
10154 </ul>
10155
10156 !! end
10157
10158 !! test
10159 Gallery (with options)
10160 !! input
10161 <gallery widths='70px' heights='40px' perrow='2' caption='Foo [[Main Page]]' >
10162 File:Nonexistant.jpg|caption
10163 File:Nonexistant.jpg
10164 image:foobar.jpg|some '''caption''' [[Main Page]]
10165 image:foobar.jpg
10166 image:foobar.jpg|Blabla|alt=This is a foo-bar.|blabla.
10167 </gallery>
10168 !! result
10169 <ul class="gallery" style="max-width: 226px;_width: 226px;">
10170 <li class='gallerycaption'>Foo <a href="/wiki/Main_Page" title="Main Page">Main Page</a></li>
10171 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
10172 <div style="height: 70px;">Nonexistant.jpg</div>
10173 <div class="gallerytext">
10174 <p>caption
10175 </p>
10176 </div>
10177 </div></li>
10178 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
10179 <div style="height: 70px;">Nonexistant.jpg</div>
10180 <div class="gallerytext">
10181 </div>
10182 </div></li>
10183 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
10184 <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>
10185 <div class="gallerytext">
10186 <p>some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
10187 </p>
10188 </div>
10189 </div></li>
10190 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
10191 <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>
10192 <div class="gallerytext">
10193 </div>
10194 </div></li>
10195 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
10196 <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>
10197 <div class="gallerytext">
10198 <p>Blabla|blabla.
10199 </p>
10200 </div>
10201 </div></li>
10202 </ul>
10203
10204 !! end
10205
10206 !! test
10207 Gallery with wikitext inside caption
10208 !! input
10209 <gallery>
10210 File:foobar.jpg|[[File:foobar.jpg|20px|desc|alt=inneralt]]|alt=galleryalt
10211 File:foobar.jpg|{{Test|unamedParam|alt=param}}|alt=galleryalt
10212 </gallery>
10213 !! result
10214 <ul class="gallery">
10215 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
10216 <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>
10217 <div class="gallerytext">
10218 <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>
10219 </p>
10220 </div>
10221 </div></li>
10222 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
10223 <div class="thumb" style="width: 150px;"><div style="margin:68px auto;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="galleryalt" src="http://example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" width="120" height="14" /></a></div></div>
10224 <div class="gallerytext">
10225 <p>This is a test template
10226 </p>
10227 </div>
10228 </div></li>
10229 </ul>
10230
10231 !! end
10232
10233 !! test
10234 gallery (with showfilename option)
10235 !! input
10236 <gallery showfilename>
10237 File:Nonexistant.jpg|caption
10238 File:Nonexistant.jpg
10239 image:foobar.jpg|some '''caption''' [[Main Page]]
10240 File:Foobar.jpg
10241 </gallery>
10242 !! result
10243 <ul class="gallery">
10244 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
10245 <div style="height: 150px;">Nonexistant.jpg</div>
10246 <div class="gallerytext">
10247 <p><a href="/wiki/File:Nonexistant.jpg" title="File:Nonexistant.jpg">Nonexistant.jpg</a><br />
10248 caption
10249 </p>
10250 </div>
10251 </div></li>
10252 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
10253 <div style="height: 150px;">Nonexistant.jpg</div>
10254 <div class="gallerytext">
10255 <p><a href="/wiki/File:Nonexistant.jpg" title="File:Nonexistant.jpg">Nonexistant.jpg</a><br />
10256 </p>
10257 </div>
10258 </div></li>
10259 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
10260 <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>
10261 <div class="gallerytext">
10262 <p><a href="/wiki/File:Foobar.jpg" title="File:Foobar.jpg">Foobar.jpg</a><br />
10263 some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
10264 </p>
10265 </div>
10266 </div></li>
10267 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
10268 <div class="thumb" style="width: 150px;"><div style="margin:68px auto;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" width="120" height="14" /></a></div></div>
10269 <div class="gallerytext">
10270 <p><a href="/wiki/File:Foobar.jpg" title="File:Foobar.jpg">Foobar.jpg</a><br />
10271 </p>
10272 </div>
10273 </div></li>
10274 </ul>
10275
10276 !! end
10277
10278 !! test
10279 Gallery (with namespace-less filenames)
10280 !! input
10281 <gallery>
10282 File:Nonexistant.jpg
10283 Nonexistant.jpg
10284 image:foobar.jpg
10285 foobar.jpg
10286 </gallery>
10287 !! result
10288 <ul class="gallery">
10289 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
10290 <div style="height: 150px;">Nonexistant.jpg</div>
10291 <div class="gallerytext">
10292 </div>
10293 </div></li>
10294 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
10295 <div style="height: 150px;">Nonexistant.jpg</div>
10296 <div class="gallerytext">
10297 </div>
10298 </div></li>
10299 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
10300 <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>
10301 <div class="gallerytext">
10302 </div>
10303 </div></li>
10304 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
10305 <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>
10306 <div class="gallerytext">
10307 </div>
10308 </div></li>
10309 </ul>
10310
10311 !! end
10312
10313 !! test
10314 HTML Hex character encoding (spells the word "JavaScript")
10315 !! input
10316 &#x4A;&#x061;&#x0076;&#x00061;&#x000053;&#x0000063;&#114;&#x0000069;&#00000112;&#x0000000074;
10317 !! result
10318 <p>&#x4a;&#x61;&#x76;&#x61;&#x53;&#x63;&#114;&#x69;&#112;&#x74;
10319 </p>
10320 !! end
10321
10322 !! test
10323 HTML Hex character encoding bogus encoding (bug 26437 regression check)
10324 !! input
10325 &#xsee;&#XSEE;
10326 !! result
10327 <p>&amp;#xsee;&amp;#XSEE;
10328 </p>
10329 !! end
10330
10331 !! test
10332 HTML Hex character encoding mixed case
10333 !! input
10334 &#xEE;&#Xee;
10335 !! result
10336 <p>&#xee;&#xee;
10337 </p>
10338 !! end
10339
10340 !! test
10341 __FORCETOC__ override
10342 !! input
10343 __NEWSECTIONLINK__
10344 __FORCETOC__
10345 !! result
10346 <p><br />
10347 </p>
10348 !! end
10349
10350 !! test
10351 ISBN code coverage
10352 !! input
10353 ISBN 978-0-1234-56&#x20;789
10354 !! result
10355 <p><a href="/wiki/Special:BookSources/9780123456" class="internal mw-magiclink-isbn">ISBN 978-0-1234-56</a>&#x20;789
10356 </p>
10357 !! end
10358
10359 !! test
10360 ISBN followed by 5 spaces
10361 !! input
10362 ISBN
10363 !! result
10364 <p>ISBN
10365 </p>
10366 !! end
10367
10368 !! test
10369 Double ISBN
10370 !! input
10371 ISBN ISBN 1234567890
10372 !! result
10373 <p>ISBN <a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
10374 </p>
10375 !! end
10376
10377 !! test
10378 Bug 22905: <abbr> followed by ISBN followed by </a>
10379 !! input
10380 <abbr>(fr)</abbr> ISBN 2753300917 [http://www.example.com example.com]
10381 !! result
10382 <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>
10383 </p>
10384 !! end
10385
10386 !! test
10387 Double RFC
10388 !! input
10389 RFC RFC 1234
10390 !! result
10391 <p>RFC <a class="external mw-magiclink-rfc" href="//tools.ietf.org/html/rfc1234">RFC 1234</a>
10392 </p>
10393 !! end
10394
10395 !! test
10396 Double RFC with a wiki link
10397 !! input
10398 RFC [[RFC 1234]]
10399 !! result
10400 <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>
10401 </p>
10402 !! end
10403
10404 !! test
10405 RFC code coverage
10406 !! input
10407 RFC 983&#x20;987
10408 !! result
10409 <p><a class="external mw-magiclink-rfc" href="//tools.ietf.org/html/rfc983">RFC 983</a>&#x20;987
10410 </p>
10411 !! end
10412
10413 !! test
10414 Centre-aligned image
10415 !! input
10416 [[Image:foobar.jpg|centre]]
10417 !! result
10418 <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>
10419
10420 !!end
10421
10422 !! test
10423 None-aligned image
10424 !! input
10425 [[Image:foobar.jpg|none]]
10426 !! result
10427 <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>
10428
10429 !!end
10430
10431 !! test
10432 Width + Height sized image (using px) (height is ignored)
10433 !! input
10434 [[Image:foobar.jpg|640x480px]]
10435 !! result
10436 <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>
10437 </p>
10438 !!end
10439
10440 !! test
10441 Width-sized image (using px, no following whitespace)
10442 !! input
10443 [[Image:foobar.jpg|640px]]
10444 !! result
10445 <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>
10446 </p>
10447 !!end
10448
10449 !! test
10450 Width-sized image (using px, with following whitespace - test regression from r39467)
10451 !! input
10452 [[Image:foobar.jpg|640px ]]
10453 !! result
10454 <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>
10455 </p>
10456 !!end
10457
10458 !! test
10459 Width-sized image (using px, with preceding whitespace - test regression from r39467)
10460 !! input
10461 [[Image:foobar.jpg| 640px]]
10462 !! result
10463 <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>
10464 </p>
10465 !!end
10466
10467 !! test
10468 Another italics / bold test
10469 !! input
10470 ''' ''x'
10471 !! result
10472 <pre>'<i> </i>x'
10473 </pre>
10474 !!end
10475
10476 # Note the results may be incorrect, as parserTest output included this:
10477 # XML error: Mismatched tag at byte 6120:
10478 # ...<dd> </dt></dl> </dd...
10479 !! test
10480 dt/dd/dl test
10481 !! options
10482 disabled
10483 !! input
10484 :;;;::
10485 !! result
10486 <dl><dd><dl><dt><dl><dt><dl><dt><dl><dd><dl><dd>
10487 </dd></dl>
10488 </dd></dl>
10489 </dt></dl>
10490 </dt></dl>
10491 </dt></dl>
10492 </dd></dl>
10493
10494 !!end
10495
10496
10497 # Images with the "|" character in external URLs in comment tags; Eats half the comment, leaves unmatched "</a>" tag.
10498 !! test
10499 Images with the "|" character in the comment
10500 !! input
10501 [[image:Foobar.jpg|thumb|An [http://test/?param1=|left|&param2=|x external] URL]]
10502 !! result
10503 <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>
10504
10505 !!end
10506
10507 !! test
10508 [Before] HTML without raw HTML enabled ($wgRawHtml==false)
10509 !! input
10510 <html><script>alert(1);</script></html>
10511 !! result
10512 <p>&lt;html&gt;&lt;script&gt;alert(1);&lt;/script&gt;&lt;/html&gt;
10513 </p>
10514 !! end
10515
10516 !! test
10517 HTML with raw HTML ($wgRawHtml==true)
10518 !! options
10519 rawhtml
10520 !! input
10521 <html><script>alert(1);</script></html>
10522 !! result
10523 <p><script>alert(1);</script>
10524 </p>
10525 !! end
10526
10527 !! test
10528 Parents of subpages, one level up
10529 !! options
10530 subpage title=[[Subpage test/L1/L2/L3]]
10531 !! input
10532 [[../|L2]]
10533 !! result
10534 <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>
10535 </p>
10536 !! end
10537
10538
10539 !! test
10540 Parents of subpages, one level up, not named
10541 !! options
10542 subpage title=[[Subpage test/L1/L2/L3]]
10543 !! input
10544 [[../]]
10545 !! result
10546 <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>
10547 </p>
10548 !! end
10549
10550
10551
10552 !! test
10553 Parents of subpages, two levels up
10554 !! options
10555 subpage title=[[Subpage test/L1/L2/L3]]
10556 !! input
10557 [[../../|L1]]2
10558
10559 [[../../|L1]]l
10560 !! result
10561 <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
10562 </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>
10563 </p>
10564 !! end
10565
10566 !! test
10567 Parents of subpages, two levels up, without trailing slash or name.
10568 !! options
10569 subpage title=[[Subpage test/L1/L2/L3]]
10570 !! input
10571 [[../..]]
10572 !! result
10573 <p>[[../..]]
10574 </p>
10575 !! end
10576
10577 !! test
10578 Parents of subpages, two levels up, with lots of extra trailing slashes.
10579 !! options
10580 subpage title=[[Subpage test/L1/L2/L3]]
10581 !! input
10582 [[../../////]]
10583 !! result
10584 <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>
10585 </p>
10586 !! end
10587
10588 !! test
10589 Definition list code coverage
10590 !! input
10591 ; title : def
10592 ; title : def
10593 ;title: def
10594 !! result
10595 <dl><dt> title &#160;</dt><dd> def
10596 </dd><dt> title&#160;</dt><dd> def
10597 </dd><dt>title</dt><dd> def
10598 </dd></dl>
10599
10600 !! end
10601
10602 !! test
10603 Don't fall for the self-closing div
10604 !! input
10605 <div>hello world</div/>
10606 !! result
10607 <div>hello world</div>
10608
10609 !! end
10610
10611 !! test
10612 MSGNW magic word
10613 !! input
10614 {{MSGNW:msg}}
10615 !! result
10616 <p>&#91;&#91;:Template:Msg&#93;&#93;
10617 </p>
10618 !! end
10619
10620 !! test
10621 RAW magic word
10622 !! input
10623 {{RAW:QUERTY}}
10624 !! result
10625 <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>
10626 </p>
10627 !! end
10628
10629 # This isn't needed for XHTML conformance, but would be handy as a fallback security measure
10630 !! test
10631 Always escape literal '>' in output, not just after '<'
10632 !! input
10633 ><>
10634 !! result
10635 <p>&gt;&lt;&gt;
10636 </p>
10637 !! end
10638
10639 !! test
10640 Template caching
10641 !! input
10642 {{Test}}
10643 {{Test}}
10644 !! result
10645 <p>This is a test template
10646 This is a test template
10647 </p>
10648 !! end
10649
10650
10651 !! article
10652 MediaWiki:Fake
10653 !! text
10654 ==header==
10655 !! endarticle
10656
10657 !! test
10658 Inclusion of !userCanEdit() content
10659 !! input
10660 {{MediaWiki:Fake}}
10661 !! result
10662 <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>
10663
10664 !! end
10665
10666
10667 !! test
10668 Out-of-order TOC heading levels
10669 !! input
10670 ==2==
10671 ======6======
10672 ===3===
10673 =1=
10674 =====5=====
10675 ==2==
10676 !! result
10677 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
10678 <ul>
10679 <li class="toclevel-1 tocsection-1"><a href="#2"><span class="tocnumber">1</span> <span class="toctext">2</span></a>
10680 <ul>
10681 <li class="toclevel-2 tocsection-2"><a href="#6"><span class="tocnumber">1.1</span> <span class="toctext">6</span></a></li>
10682 <li class="toclevel-2 tocsection-3"><a href="#3"><span class="tocnumber">1.2</span> <span class="toctext">3</span></a></li>
10683 </ul>
10684 </li>
10685 <li class="toclevel-1 tocsection-4"><a href="#1"><span class="tocnumber">2</span> <span class="toctext">1</span></a>
10686 <ul>
10687 <li class="toclevel-2 tocsection-5"><a href="#5"><span class="tocnumber">2.1</span> <span class="toctext">5</span></a></li>
10688 <li class="toclevel-2 tocsection-6"><a href="#2_2"><span class="tocnumber">2.2</span> <span class="toctext">2</span></a></li>
10689 </ul>
10690 </li>
10691 </ul>
10692 </td></tr></table>
10693 <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>
10694 <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>
10695 <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>
10696 <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>
10697 <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>
10698 <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>
10699
10700 !! end
10701
10702
10703 !! test
10704 ISBN with a dummy number
10705 !! input
10706 ISBN ---
10707 !! result
10708 <p>ISBN ---
10709 </p>
10710 !! end
10711
10712
10713 !! test
10714 ISBN with space-delimited number
10715 !! input
10716 ISBN 92 9017 032 8
10717 !! result
10718 <p><a href="/wiki/Special:BookSources/9290170328" class="internal mw-magiclink-isbn">ISBN 92 9017 032 8</a>
10719 </p>
10720 !! end
10721
10722
10723 !! test
10724 ISBN with multiple spaces, no number
10725 !! input
10726 ISBN foo
10727 !! result
10728 <p>ISBN foo
10729 </p>
10730 !! end
10731
10732
10733 !! test
10734 ISBN length
10735 !! input
10736 ISBN 123456789
10737
10738 ISBN 1234567890
10739
10740 ISBN 12345678901
10741 !! result
10742 <p>ISBN 123456789
10743 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
10744 </p><p>ISBN 12345678901
10745 </p>
10746 !! end
10747
10748
10749 !! test
10750 ISBN with trailing year (bug 8110)
10751 !! input
10752 ISBN 1-234-56789-0 - 2006
10753
10754 ISBN 1 234 56789 0 - 2006
10755 !! result
10756 <p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1-234-56789-0</a> - 2006
10757 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1 234 56789 0</a> - 2006
10758 </p>
10759 !! end
10760
10761
10762 !! test
10763 anchorencode
10764 !! input
10765 {{anchorencode:foo bar©#%n}}
10766 !! result
10767 <p>foo_bar.C2.A9.23.25n
10768 </p>
10769 !! end
10770
10771 !! test
10772 anchorencode trims spaces
10773 !! input
10774 {{anchorencode: __pretty__please__}}
10775 !! result
10776 <p>pretty_please
10777 </p>
10778 !! end
10779
10780 !! test
10781 anchorencode deals with links
10782 !! input
10783 {{anchorencode: [[hello|world]] [[hi]]}}
10784 !! result
10785 <p>world_hi
10786 </p>
10787 !! end
10788
10789 !! test
10790 anchorencode deals with templates
10791 !! input
10792 {{anchorencode: {{Foo}} }}
10793 !! result
10794 <p>FOO
10795 </p>
10796 !! end
10797
10798 !! test
10799 anchorencode encodes like the TOC generator: (bug 18431)
10800 !! input
10801 === _ +:.3A%3A&&amp;]] ===
10802 {{anchorencode: _ +:.3A%3A&&amp;]] }}
10803 __NOEDITSECTION__
10804 !! result
10805 <h3> <span class="mw-headline" id=".2B:.3A.253A.26.26.5D.5D"> _ +:.3A%3A&amp;&amp;]] </span></h3>
10806 <p>.2B:.3A.253A.26.26.5D.5D
10807 </p>
10808 !! end
10809
10810 # Expected output in the following test is not necessarily expected (there
10811 # should probably be <p> tags inside the <blockquote> in the output) -- it's
10812 # only testing for well-formedness.
10813 !! test
10814 Bug 6200: blockquotes and paragraph formatting
10815 !! input
10816 <blockquote>
10817 foo
10818 </blockquote>
10819
10820 bar
10821
10822 baz
10823 !! result
10824 <blockquote>
10825 foo
10826 </blockquote>
10827 <p>bar
10828 </p>
10829 <pre>baz
10830 </pre>
10831 !! end
10832
10833 !! test
10834 Bug 8293: Use of center tag ruins paragraph formatting
10835 !! input
10836 <center>
10837 foo
10838 </center>
10839
10840 bar
10841
10842 baz
10843 !! result
10844 <center>
10845 <p>foo
10846 </p>
10847 </center>
10848 <p>bar
10849 </p>
10850 <pre>baz
10851 </pre>
10852 !! end
10853
10854
10855 ###
10856 ### Language variants related tests
10857 ###
10858 !! test
10859 Self-link in language variants
10860 !! options
10861 title=[[Dunav]] language=sr
10862 !! input
10863 Both [[Dunav]] and [[Дунав]] are names for this river.
10864 !! result
10865 <p>Both <strong class="selflink">Dunav</strong> and <strong class="selflink">Дунав</strong> are names for this river.
10866 </p>
10867 !!end
10868
10869
10870 !! test
10871 Link to pages in language variants
10872 !! options
10873 language=sr
10874 !! input
10875 Main Page can be written as [[Маин Паге]]
10876 !! result
10877 <p>Main Page can be written as <a href="/wiki/Main_Page" title="Main Page">Маин Паге</a>
10878 </p>
10879 !!end
10880
10881
10882 !! test
10883 Multiple links to pages in language variants
10884 !! options
10885 language=sr
10886 !! input
10887 [[Main Page]] can be written as [[Маин Паге]] same as [[Маин Паге]].
10888 !! result
10889 <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>.
10890 </p>
10891 !!end
10892
10893
10894 !! test
10895 Simple template in language variants
10896 !! options
10897 language=sr
10898 !! input
10899 {{тест}}
10900 !! result
10901 <p>This is a test template
10902 </p>
10903 !! end
10904
10905
10906 !! test
10907 Template with explicit namespace in language variants
10908 !! options
10909 language=sr
10910 !! input
10911 {{Template:тест}}
10912 !! result
10913 <p>This is a test template
10914 </p>
10915 !! end
10916
10917
10918 !! test
10919 Basic test for template parameter in language variants
10920 !! options
10921 language=sr
10922 !! input
10923 {{парамтест|param=foo}}
10924 !! result
10925 <p>This is a test template with parameter foo
10926 </p>
10927 !! end
10928
10929
10930 !! test
10931 Simple category in language variants
10932 !! options
10933 language=sr cat
10934 !! input
10935 [[Category:МедиаWики Усер'с Гуиде]]
10936 !! result
10937 <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>
10938 !! end
10939
10940
10941 !! article
10942 Category:分类
10943 !! text
10944 blah
10945 !! endarticle
10946
10947 !! article
10948 Category:分類
10949 !! text
10950 blah
10951 !! endarticle
10952
10953 !! test
10954 Don't convert blue categorylinks to another variant (bug 33210)
10955 !! options
10956 language=zh cat
10957 !! input
10958 [[A]][[Category:分类]]
10959 !! result
10960 <a href="/wiki/Category:%E5%88%86%E7%B1%BB" title="Category:分类">分类</a>
10961 !! end
10962
10963
10964 !! test
10965 Stripping -{}- tags (language variants)
10966 !! options
10967 language=sr
10968 !! input
10969 Latin proverb: -{Ne nuntium necare}-
10970 !! result
10971 <p>Latin proverb: Ne nuntium necare
10972 </p>
10973 !! end
10974
10975
10976 !! test
10977 Prevent conversion with -{}- tags (language variants)
10978 !! options
10979 language=sr variant=sr-ec
10980 !! input
10981 Latinski: -{Ne nuntium necare}-
10982 !! result
10983 <p>Латински: Ne nuntium necare
10984 </p>
10985 !! end
10986
10987
10988 !! test
10989 Prevent conversion of text with -{}- tags (language variants)
10990 !! options
10991 language=sr variant=sr-ec
10992 !! input
10993 Latinski: -{Ne nuntium necare}-
10994 !! result
10995 <p>Латински: Ne nuntium necare
10996 </p>
10997 !! end
10998
10999
11000 !! test
11001 Prevent conversion of links with -{}- tags (language variants)
11002 !! options
11003 language=sr variant=sr-ec
11004 !! input
11005 -{[[Main Page]]}-
11006 !! result
11007 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
11008 </p>
11009 !! end
11010
11011
11012 !! test
11013 -{}- tags within headlines (within html for parserConvert())
11014 !! options
11015 language=sr variant=sr-ec
11016 !! input
11017 == -{Naslov}- ==
11018 !! result
11019 <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>
11020
11021 !! end
11022
11023
11024 !! test
11025 Explicit definition of language variant alternatives
11026 !! options
11027 language=zh variant=zh-tw
11028 !! input
11029 -{zh:China;zh-tw:Taiwan}-, not China
11030 !! result
11031 <p>Taiwan, not China
11032 </p>
11033 !! end
11034
11035
11036 !! test
11037 Conversion around HTML tags
11038 !! options
11039 language=sr variant=sr-ec
11040 !! input
11041 -{H|span=>sr-ec:script;title=>sr-ec:src;}-
11042 <span title="La-{sr-el:L;sr-ec:C;}-tin">ski</span>
11043 !! result
11044 <p>
11045 <span title="ЛаCтин">ски</span>
11046 </p>
11047 !! end
11048
11049
11050 !! test
11051 Explicit session-wise language variant mapping (A flag and - flag)
11052 !! options
11053 language=zh variant=zh-tw
11054 !! input
11055 Taiwan is not China.
11056 But -{A|zh:China;zh-tw:Taiwan}- is China,
11057 (This-{-|zh:China;zh-tw:Taiwan}- should be stripped!)
11058 and -{China}- is China.
11059 !! result
11060 <p>Taiwan is not China.
11061 But Taiwan is Taiwan,
11062 (This should be stripped!)
11063 and China is China.
11064 </p>
11065 !! end
11066
11067 !! test
11068 Explicit session-wise language variant mapping (H flag for hide)
11069 !! options
11070 language=zh variant=zh-tw
11071 !! input
11072 (This-{H|zh:China;zh-tw:Taiwan}- should be stripped!)
11073 Taiwan is China.
11074 !! result
11075 <p>(This should be stripped!)
11076 Taiwan is Taiwan.
11077 </p>
11078 !! end
11079
11080 !! test
11081 Adding explicit conversion rule for title (T flag)
11082 !! options
11083 language=zh variant=zh-tw showtitle
11084 !! input
11085 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
11086 !! result
11087 Taiwan
11088 <p>Should be stripped!
11089 </p>
11090 !! end
11091
11092 !! test
11093 Testing that changing the language variant here in the tests actually works
11094 !! options
11095 language=zh variant=zh showtitle
11096 !! input
11097 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
11098 !! result
11099 China
11100 <p>Should be stripped!
11101 </p>
11102 !! end
11103
11104 !! test
11105 Recursive conversion of alt and title attrs shouldn't clear converter state
11106 !! options
11107 language=zh variant=zh-cn showtitle
11108 !! input
11109 -{H|zh-cn:Exclamation;zh-tw:exclamation;}-
11110 Should be stripped-{T|zh-cn:China;zh-tw:Taiwan}-<span title="exclamation">!</span>
11111 !! result
11112 China
11113 <p>
11114 Should be stripped<span title="Exclamation">!</span>
11115 </p>
11116 !! end
11117
11118 !! test
11119 Bug 24072: more test on conversion rule for title
11120 !! options
11121 language=zh variant=zh-tw showtitle
11122 !! input
11123 This should be stripped-{T|zh:China;zh-tw:Taiwan}-!
11124 This won't take interferes with the title rule-{H|zh:Beijing;zh-tw:Taipei}-.
11125 !! result
11126 Taiwan
11127 <p>This should be stripped!
11128 This won't take interferes with the title rule.
11129 </p>
11130 !! end
11131
11132 !! test
11133 Raw output of variant escape tags (R flag)
11134 !! options
11135 language=zh variant=zh-tw
11136 !! input
11137 Raw: -{R|zh:China;zh-tw:Taiwan}-
11138 !! result
11139 <p>Raw: zh:China;zh-tw:Taiwan
11140 </p>
11141 !! end
11142
11143 !! test
11144 Nested using of manual convert syntax
11145 !! options
11146 language=zh variant=zh-hk
11147 !! input
11148 Nested: -{zh-hans:Hi -{zh-cn:China;zh-sg:Singapore;}-;zh-hant:Hello -{zh-tw:Taiwan;zh-hk:H-{ong}- K-{}-ong;}-;}-!
11149 !! result
11150 <p>Nested: Hello Hong Kong!
11151 </p>
11152 !! end
11153
11154 !! test
11155 Proper conversion of text in external links
11156 !! options
11157 language=sr variant=sr-ec
11158 !! input
11159 http://www.google.com
11160 gopher://www.google.com
11161 [http://www.google.com http://www.google.com]
11162 [gopher://www.google.com gopher://www.google.com]
11163 [https://www.google.com irc://www.google.com]
11164 [ftp://www.google.com www.google.com/ftp://dir]
11165 [//www.google.com www.google.com]
11166 !! result
11167 <p><a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
11168 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
11169 <a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
11170 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
11171 <a rel="nofollow" class="external text" href="https://www.google.com">irc://www.google.com</a>
11172 <a rel="nofollow" class="external text" href="ftp://www.google.com">www.гоогле.цом/фтп://дир</a>
11173 <a rel="nofollow" class="external text" href="//www.google.com">www.гоогле.цом</a>
11174 </p>
11175 !! end
11176
11177 !! test
11178 Do not convert roman numbers to language variants
11179 !! options
11180 language=sr variant=sr-ec
11181 !! input
11182 Fridrih IV je car.
11183 !! result
11184 <p>Фридрих IV је цар.
11185 </p>
11186 !! end
11187
11188 !! test
11189 Unclosed language converter markup "-{"
11190 !! options
11191 language=sr
11192 !! input
11193 -{T|hello
11194 !! result
11195 <p>-{T|hello
11196 </p>
11197 !! end
11198
11199 !! test
11200 Don't convert raw rule "-{R|=&gt;}-" to "=>"
11201 !! options
11202 language=sr
11203 !! input
11204 -{R|=&gt;}-
11205 !! result
11206 <p>=&gt;
11207 </p>
11208 !!end
11209
11210 !!article
11211 Template:Bullet
11212 !!text
11213 * Bar
11214 !!endarticle
11215
11216 !! test
11217 Bug 529: Uncovered bullet
11218 !! input
11219 * Foo {{bullet}}
11220 !! result
11221 <ul><li> Foo
11222 </li><li> Bar
11223 </li></ul>
11224
11225 !! end
11226
11227 # Plain MediaWiki does not remove empty lists, but tidy actually does.
11228 # Templates in Wikipedia rely on this behavior, as tidy has always been
11229 # enabled there. These tests are normally run *without* tidy, so specify the
11230 # full output here.
11231 # To test realistic parsing behavior, apply a tidy-like transformation to both
11232 # the expected output and your parser's output.
11233 !! test
11234 Bug 529: Uncovered bullet leaving empty list, normally removed by tidy
11235 !! input
11236 ******* Foo {{bullet}}
11237 !! result
11238 <ul><li><ul><li><ul><li><ul><li><ul><li><ul><li><ul><li> Foo
11239 </li></ul>
11240 </li></ul>
11241 </li></ul>
11242 </li></ul>
11243 </li></ul>
11244 </li></ul>
11245 </li><li> Bar
11246 </li></ul>
11247
11248 !! end
11249
11250 !! test
11251 Bug 529: Uncovered table already at line-start
11252 !! input
11253 x
11254
11255 {{table}}
11256 y
11257 !! result
11258 <p>x
11259 </p>
11260 <table>
11261 <tr>
11262 <td> 1 </td>
11263 <td> 2
11264 </td></tr>
11265 <tr>
11266 <td> 3 </td>
11267 <td> 4
11268 </td></tr></table>
11269 <p>y
11270 </p>
11271 !! end
11272
11273 !! test
11274 Bug 529: Uncovered bullet in parser function result
11275 !! input
11276 * Foo {{lc:{{bullet}} }}
11277 !! result
11278 <ul><li> Foo
11279 </li><li> bar
11280 </li></ul>
11281
11282 !! end
11283
11284 !! test
11285 Bug 5678: Double-parsed template argument
11286 !! input
11287 {{lc:{{{1}}}|hello}}
11288 !! result
11289 <p>{{{1}}}
11290 </p>
11291 !! end
11292
11293 !! test
11294 Bug 5678: Double-parsed template invocation
11295 !! input
11296 {{lc:{{paramtest {{!}} param = hello }} }}
11297 !! result
11298 <p>{{paramtest | param = hello }}
11299 </p>
11300 !! end
11301
11302 !! test
11303 Case insensitivity of parser functions for non-ASCII characters (bug 8143)
11304 !! options
11305 language=cs
11306 title=[[Main Page]]
11307 !! input
11308 {{PRVNÍVELKÉ:ěščř}}
11309 {{prvnívelké:ěščř}}
11310 {{PRVNÍMALÉ:ěščř}}
11311 {{prvnímalé:ěščř}}
11312 {{MALÁ:ěščř}}
11313 {{malá:ěščř}}
11314 {{VELKÁ:ěščř}}
11315 {{velká:ěščř}}
11316 !! result
11317 <p>Ěščř
11318 Ěščř
11319 ěščř
11320 ěščř
11321 ěščř
11322 ěščř
11323 ĚŠČŘ
11324 ĚŠČŘ
11325 </p>
11326 !! end
11327
11328 !! test
11329 Morwen/13: Unclosed link followed by heading
11330 !! input
11331 [[link
11332 ==heading==
11333 !! result
11334 <p>[[link
11335 </p>
11336 <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>
11337
11338 !! end
11339
11340 !! test
11341 HHP2.1: Heuristics for headings in preprocessor parenthetical structures
11342 !! input
11343 {{foo|
11344 =heading=
11345 !! result
11346 <p>{{foo|
11347 </p>
11348 <h1> <span class="mw-headline" id="heading">heading</span></h1>
11349
11350 !! end
11351
11352 !! test
11353 HHP2.2: Heuristics for headings in preprocessor parenthetical structures
11354 !! input
11355 {{foo|
11356 ==heading==
11357 !! result
11358 <p>{{foo|
11359 </p>
11360 <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>
11361
11362 !! end
11363
11364 !! test
11365 Tildes in comments
11366 !! options
11367 pst
11368 !! input
11369 <!-- ~~~~ -->
11370 !! result
11371 <!-- ~~~~ -->
11372 !! end
11373
11374 !! test
11375 Paragraphs inside divs (no extra line breaks)
11376 !! input
11377 <div>Line one
11378
11379 Line two</div>
11380 !! result
11381 <div>Line one
11382 Line two</div>
11383
11384 !! end
11385
11386 !! test
11387 Paragraphs inside divs (extra line break on open)
11388 !! input
11389 <div>
11390 Line one
11391
11392 Line two</div>
11393 !! result
11394 <div>
11395 <p>Line one
11396 </p>
11397 Line two</div>
11398
11399 !! end
11400
11401 !! test
11402 Paragraphs inside divs (extra line break on close)
11403 !! input
11404 <div>Line one
11405
11406 Line two
11407 </div>
11408 !! result
11409 <div>Line one
11410 <p>Line two
11411 </p>
11412 </div>
11413
11414 !! end
11415
11416 !! test
11417 Paragraphs inside divs (extra line break on open and close)
11418 !! input
11419 <div>
11420 Line one
11421
11422 Line two
11423 </div>
11424 !! result
11425 <div>
11426 <p>Line one
11427 </p><p>Line two
11428 </p>
11429 </div>
11430
11431 !! end
11432
11433 !! test
11434 Nesting tags, paragraphs on lines which begin with <div>
11435 !! options
11436 disabled
11437 !! input
11438 <div></div><strong>A
11439 B</strong>
11440 !! result
11441 <div></div>
11442 <p><strong>A
11443 B</strong>
11444 </p>
11445 !! end
11446
11447 # Bug 6200: <blockquote> should behave like <div> with respect to line breaks
11448 !! test
11449 Bug 6200: paragraphs inside blockquotes (no extra line breaks)
11450 !! options
11451 disabled
11452 !! input
11453 <blockquote>Line one
11454
11455 Line two</blockquote>
11456 !! result
11457 <blockquote>Line one
11458 Line two</blockquote>
11459
11460 !! end
11461
11462 !! test
11463 Bug 6200: paragraphs inside blockquotes (extra line break on open)
11464 !! options
11465 disabled
11466 !! input
11467 <blockquote>
11468 Line one
11469
11470 Line two</blockquote>
11471 !! result
11472 <blockquote>
11473 <p>Line one
11474 </p>
11475 Line two</blockquote>
11476
11477 !! end
11478
11479 !! test
11480 Bug 6200: paragraphs inside blockquotes (extra line break on close)
11481 !! options
11482 disabled
11483 !! input
11484 <blockquote>Line one
11485
11486 Line two
11487 </blockquote>
11488 !! result
11489 <blockquote>Line one
11490 <p>Line two
11491 </p>
11492 </blockquote>
11493
11494 !! end
11495
11496 !! test
11497 Bug 6200: paragraphs inside blockquotes (extra line break on open and close)
11498 !! options
11499 disabled
11500 !! input
11501 <blockquote>
11502 Line one
11503
11504 Line two
11505 </blockquote>
11506 !! result
11507 <blockquote>
11508 <p>Line one
11509 </p><p>Line two
11510 </p>
11511 </blockquote>
11512
11513 !! end
11514
11515 !! test
11516 Paragraphs inside blockquotes/divs (no extra line breaks)
11517 !! input
11518 <blockquote><div>Line one
11519
11520 Line two</div></blockquote>
11521 !! result
11522 <blockquote><div>Line one
11523 Line two</div></blockquote>
11524
11525 !! end
11526
11527 !! test
11528 Paragraphs inside blockquotes/divs (extra line break on open)
11529 !! input
11530 <blockquote><div>
11531 Line one
11532
11533 Line two</div></blockquote>
11534 !! result
11535 <blockquote><div>
11536 <p>Line one
11537 </p>
11538 Line two</div></blockquote>
11539
11540 !! end
11541
11542 !! test
11543 Paragraphs inside blockquotes/divs (extra line break on close)
11544 !! input
11545 <blockquote><div>Line one
11546
11547 Line two
11548 </div></blockquote>
11549 !! result
11550 <blockquote><div>Line one
11551 <p>Line two
11552 </p>
11553 </div></blockquote>
11554
11555 !! end
11556
11557 !! test
11558 Paragraphs inside blockquotes/divs (extra line break on open and close)
11559 !! input
11560 <blockquote><div>
11561 Line one
11562
11563 Line two
11564 </div></blockquote>
11565 !! result
11566 <blockquote><div>
11567 <p>Line one
11568 </p><p>Line two
11569 </p>
11570 </div></blockquote>
11571
11572 !! end
11573
11574 !! test
11575 Interwiki links trounced by replaceExternalLinks after early LinkHolderArray expansion
11576 !! options
11577 wgLinkHolderBatchSize=0
11578 !! input
11579 [[meatball:1]]
11580 [[meatball:2]]
11581 [[meatball:3]]
11582 !! result
11583 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?1" class="extiw" title="meatball:1">meatball:1</a>
11584 <a href="http://www.usemod.com/cgi-bin/mb.pl?2" class="extiw" title="meatball:2">meatball:2</a>
11585 <a href="http://www.usemod.com/cgi-bin/mb.pl?3" class="extiw" title="meatball:3">meatball:3</a>
11586 </p>
11587 !! end
11588
11589 !! test
11590 Free external link invading image caption
11591 !! input
11592 [[Image:Foobar.jpg|thumb|http://x|hello]]
11593 !! result
11594 <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>
11595
11596 !! end
11597
11598 !! test
11599 Bug 15196: localised external link numbers
11600 !! options
11601 language=fa
11602 !! input
11603 [http://en.wikipedia.org/]
11604 !! result
11605 <p><a rel="nofollow" class="external autonumber" href="http://en.wikipedia.org/">[۱]</a>
11606 </p>
11607 !! end
11608
11609 !! test
11610 Multibyte character in padleft
11611 !! input
11612 {{padleft:-Hello|7|Æ}}
11613 !! result
11614 <p>Æ-Hello
11615 </p>
11616 !! end
11617
11618 !! test
11619 Multibyte character in padright
11620 !! input
11621 {{padright:Hello-|7|Æ}}
11622 !! result
11623 <p>Hello-Æ
11624 </p>
11625 !! end
11626
11627 !! test
11628 Formatted date
11629 !! config
11630 wgUseDynamicDates=1
11631 !! input
11632 [[2009-03-24]]
11633 !! result
11634 <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>
11635 </p>
11636 !!end
11637
11638 !!test
11639 formatdate parser function
11640 !!input
11641 {{#formatdate:2009-03-24}}
11642 !! result
11643 <p><span class="mw-formatted-date" title="2009-03-24">2009-03-24</span>
11644 </p>
11645 !! end
11646
11647 !!test
11648 formatdate parser function, with default format
11649 !!input
11650 {{#formatdate:2009-03-24|mdy}}
11651 !! result
11652 <p><span class="mw-formatted-date" title="2009-03-24">March 24, 2009</span>
11653 </p>
11654 !! end
11655
11656 !! test
11657 Linked date with autoformatting disabled
11658 !! config
11659 wgUseDynamicDates=false
11660 !! input
11661 [[2009-03-24]]
11662 !! result
11663 <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>
11664 </p>
11665 !! end
11666
11667 !! test
11668 Spacing of numbers in formatted dates
11669 !! input
11670 {{#formatdate:January 15}}
11671 !! result
11672 <p><span class="mw-formatted-date" title="01-15">January 15</span>
11673 </p>
11674 !! end
11675
11676 !! test
11677 Spacing of numbers in formatted dates (linked)
11678 !! config
11679 wgUseDynamicDates=true
11680 !! input
11681 [[January 15]]
11682 !! result
11683 <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>
11684 </p>
11685 !! end
11686
11687 !! test
11688 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
11689 !! options
11690 language=nl title=[[MediaWiki:Common.css]]
11691 !! input
11692 {{#formatdate:2009-03-24|dmy}}
11693 !! result
11694 <p><span class="mw-formatted-date" title="2009-03-24">24 March 2009</span>
11695 </p>
11696 !! end
11697
11698 #
11699 #
11700 #
11701
11702 #
11703 # Edit comments
11704 #
11705
11706 !! test
11707 Edit comment with link
11708 !! options
11709 comment
11710 !! input
11711 I like the [[Main Page]] a lot
11712 !! result
11713 I like the <a href="/wiki/Main_Page" title="Main Page">Main Page</a> a lot
11714 !!end
11715
11716 !! test
11717 Edit comment with link and link text
11718 !! options
11719 comment
11720 !! input
11721 I like the [[Main Page|best pages]] a lot
11722 !! result
11723 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
11724 !!end
11725
11726 !! test
11727 Edit comment with link and link text with suffix
11728 !! options
11729 comment
11730 !! input
11731 I like the [[Main Page|best page]]s a lot
11732 !! result
11733 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
11734 !!end
11735
11736 !! test
11737 Edit comment with section link (non-local, eg in history list)
11738 !! options
11739 comment title=[[Main Page]]
11740 !! input
11741 /* External links */ removed bogus entries
11742 !! result
11743 <a href="/wiki/Main_Page#External_links" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
11744 !!end
11745
11746 !! test
11747 Edit comment with section link and text before it (non-local, eg in history list)
11748 !! options
11749 comment title=[[Main Page]]
11750 !! input
11751 pre-comment text /* External links */ removed bogus entries
11752 !! result
11753 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>
11754 !!end
11755
11756 !! test
11757 Edit comment with section link (local, eg in diff view)
11758 !! options
11759 comment local title=[[Main Page]]
11760 !! input
11761 /* External links */ removed bogus entries
11762 !! result
11763 <a href="#External_links">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
11764 !!end
11765
11766 !! test
11767 Edit comment with subpage link (bug 14080)
11768 !! options
11769 comment
11770 subpage
11771 title=[[Subpage test]]
11772 !! input
11773 Poked at a [[/subpage]] here...
11774 !! result
11775 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a> here...
11776 !!end
11777
11778 !! test
11779 Edit comment with subpage link and link text (bug 14080)
11780 !! options
11781 comment
11782 subpage
11783 title=[[Subpage test]]
11784 !! input
11785 Poked at a [[/subpage|neat little page]] here...
11786 !! result
11787 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">neat little page</a> here...
11788 !!end
11789
11790 !! test
11791 Edit comment with bogus subpage link in non-subpage NS (bug 14080)
11792 !! options
11793 comment
11794 title=[[Subpage test]]
11795 !! input
11796 Poked at a [[/subpage]] here...
11797 !! result
11798 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...
11799 !!end
11800
11801 !! test
11802 Edit comment with bare anchor link (local, as on diff)
11803 !! options
11804 comment
11805 local
11806 title=[[Main Page]]
11807 !!input
11808 [[#section]]
11809 !! result
11810 <a href="#section">#section</a>
11811 !! end
11812
11813 !! test
11814 Edit comment with bare anchor link (non-local, as on history)
11815 !! options
11816 comment
11817 title=[[Main Page]]
11818 !!input
11819 [[#section]]
11820 !! result
11821 <a href="/wiki/Main_Page#section" title="Main Page">#section</a>
11822 !! end
11823
11824 !! test
11825 Anchor starting with underscore
11826 !!input
11827 [[#_ref|One]]
11828 !! result
11829 <p><a href="#_ref">One</a>
11830 </p>
11831 !! end
11832
11833 !! test
11834 Id starting with underscore
11835 !!input
11836 <div id="_ref"></div>
11837 !! result
11838 <div id="_ref"></div>
11839
11840 !! end
11841
11842 !! test
11843 Space normalisation on autocomment (bug 22784)
11844 !! options
11845 comment
11846 title=[[Main Page]]
11847 !!input
11848 /* __hello__world__ */
11849 !! result
11850 <a href="/wiki/Main_Page#hello_world" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">__hello__world__</span></span>
11851 !! end
11852
11853 !! test
11854 percent-encoding and + signs in comments (Bug 26410)
11855 !! options
11856 comment
11857 !!input
11858 [[ABC%33D% ++]] [[ABC%33D% ++|+%20]]
11859 !! result
11860 <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>
11861 !! end
11862
11863 !! test
11864 Bad images - basic functionality
11865 !! options
11866 disabled
11867 !! input
11868 [[File:Bad.jpg]]
11869 !! result
11870 !! end
11871
11872 !! test
11873 Bad images - bug 16039: text after bad image disappears
11874 !! options
11875 disabled
11876 !! input
11877 Foo bar
11878 [[File:Bad.jpg]]
11879 Bar foo
11880 !! result
11881 <p>Foo bar
11882 </p><p>Bar foo
11883 </p>
11884 !! end
11885
11886 !! test
11887 Verify that displaytitle works (bug #22501) no displaytitle
11888 !! options
11889 showtitle
11890 !! config
11891 wgAllowDisplayTitle=true
11892 wgRestrictDisplayTitle=false
11893 !! input
11894 this is not the the title
11895 !! result
11896 Parser test
11897 <p>this is not the the title
11898 </p>
11899 !! end
11900
11901 !! test
11902 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=false
11903 !! options
11904 showtitle
11905 title=[[Screen]]
11906 !! config
11907 wgAllowDisplayTitle=true
11908 wgRestrictDisplayTitle=false
11909 !! input
11910 this is not the the title
11911 {{DISPLAYTITLE:whatever}}
11912 !! result
11913 whatever
11914 <p>this is not the the title
11915 </p>
11916 !! end
11917
11918 !! test
11919 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true mismatch
11920 !! options
11921 showtitle
11922 title=[[Screen]]
11923 !! config
11924 wgAllowDisplayTitle=true
11925 wgRestrictDisplayTitle=true
11926 !! input
11927 this is not the the title
11928 {{DISPLAYTITLE:whatever}}
11929 !! result
11930 Screen
11931 <p>this is not the the title
11932 </p>
11933 !! end
11934
11935 !! test
11936 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true matching
11937 !! options
11938 showtitle
11939 title=[[Screen]]
11940 !! config
11941 wgAllowDisplayTitle=true
11942 wgRestrictDisplayTitle=true
11943 !! input
11944 this is not the the title
11945 {{DISPLAYTITLE:screen}}
11946 !! result
11947 screen
11948 <p>this is not the the title
11949 </p>
11950 !! end
11951
11952 !! test
11953 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false
11954 !! options
11955 showtitle
11956 title=[[Screen]]
11957 !! config
11958 wgAllowDisplayTitle=false
11959 !! input
11960 this is not the the title
11961 {{DISPLAYTITLE:screen}}
11962 !! result
11963 Screen
11964 <p>this is not the the title
11965 <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>
11966 </p>
11967 !! end
11968
11969 !! test
11970 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false no DISPLAYTITLE
11971 !! options
11972 showtitle
11973 title=[[Screen]]
11974 !! config
11975 wgAllowDisplayTitle=false
11976 !! input
11977 this is not the the title
11978 !! result
11979 Screen
11980 <p>this is not the the title
11981 </p>
11982 !! end
11983
11984 !! test
11985 preload: check <noinclude> and <includeonly>
11986 !! options
11987 preload
11988 !! input
11989 Hello <noinclude>cruel</noinclude><includeonly>kind</includeonly> world.
11990 !! result
11991 Hello kind world.
11992 !! end
11993
11994 !! test
11995 preload: check <onlyinclude>
11996 !! options
11997 preload
11998 !! input
11999 Goodbye <onlyinclude>Hello world</onlyinclude>
12000 !! result
12001 Hello world
12002 !! end
12003
12004 !! test
12005 preload: can pass tags through if we want to
12006 !! options
12007 preload
12008 !! input
12009 <includeonly><</includeonly>includeonly>Hello world<includeonly><</includeonly>/includeonly>
12010 !! result
12011 <includeonly>Hello world</includeonly>
12012 !! end
12013
12014 !! test
12015 preload: check that it doesn't try to do tricks
12016 !! options
12017 preload
12018 !! input
12019 * <!-- Hello --> ''{{world}}'' {{<includeonly>subst:</includeonly>How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
12020 !! result
12021 * <!-- Hello --> ''{{world}}'' {{subst:How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
12022 !! end
12023
12024 !! test
12025 Play a bit with r67090 and bug 3158
12026 !! options
12027 disabled
12028 !! input
12029 <div style="width:50% !important">&nbsp;</div>
12030 <div style="width:50%&nbsp;!important">&nbsp;</div>
12031 <div style="width:50%&#160;!important">&nbsp;</div>
12032 <div style="border : solid;">&nbsp;</div>
12033 !! result
12034 <div style="width:50% !important">&nbsp;</div>
12035 <div style="width:50% !important">&nbsp;</div>
12036 <div style="width:50% !important">&nbsp;</div>
12037 <div style="border&#160;: solid;">&nbsp;</div>
12038
12039 !! end
12040
12041 !! test
12042 HTML5 data attributes
12043 !! input
12044 <span data-foo="bar">Baz</span>
12045 <p data-abc-def_hij="">Quuz</p>
12046 !! result
12047 <p><span data-foo="bar">Baz</span>
12048 </p>
12049 <p data-abc-def_hij="">Quuz</p>
12050
12051 !! end
12052
12053 !! test
12054 percent-encoding and + signs in internal links (Bug 26410)
12055 !! input
12056 [[User:+%]] [[Page+title%]]
12057 [[%+]] [[%+|%20]] [[%+ ]] [[%+r]]
12058 [[%]] [[+]] [[image:%+abc%39|foo|[[bar]]]]
12059 [[%33%45]] [[%33%45+]]
12060 !! result
12061 <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>
12062 <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>
12063 <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>
12064 <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>
12065 </p>
12066 !! end
12067
12068 !! test
12069 Special characters in embedded file links (bug 27679)
12070 !! input
12071 [[File:Contains & ampersand.jpg]]
12072 [[File:Does not exist.jpg|Title with & ampersand]]
12073 !! result
12074 <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>
12075 <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>
12076 </p>
12077 !! end
12078
12079
12080 !! test
12081 Confirm that 'apos' named character reference doesn't make it to output (not legal in HTML 4)
12082 !! input
12083 Text&apos;s been normalized?
12084 !! result
12085 <p>Text&#39;s been normalized?
12086 </p>
12087 !! end
12088
12089 !! test
12090 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate free external links
12091 !! input
12092 http://www.example.org/ <-- U+3000 (vim: ^Vu3000)
12093 !! result
12094 <p><a rel="nofollow" class="external free" href="http://www.example.org/">http://www.example.org/</a> &lt;-- U+3000 (vim: ^Vu3000)
12095 </p>
12096 !! end
12097
12098 !! test
12099 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate bracketed external links
12100 !! input
12101 [http://www.example.org/ ideograms]
12102 !! result
12103 <p><a rel="nofollow" class="external text" href="http://www.example.org/">ideograms</a>
12104 </p>
12105 !! end
12106
12107 !! test
12108 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate external images links
12109 !! input
12110 http://www.example.org/pic.png <-- U+3000 (vim: ^Vu3000)
12111 !! result
12112 <p><img src="http://www.example.org/pic.png" alt="pic.png" /> &lt;-- U+3000 (vim: ^Vu3000)
12113 </p>
12114 !! end
12115
12116 !! article
12117 Mediawiki:loop1
12118 !! text
12119 {{Identical|A}}
12120 !! endarticle
12121
12122 !! article
12123 Mediawiki:loop2
12124 !! text
12125 {{Identical|B}}
12126 !! endarticle
12127
12128 !! article
12129 Template:Identical
12130 !! text
12131 {{int:loop1}}
12132 {{int:loop2}}
12133 !! endarticle
12134
12135 !! test
12136 Bug 31098 Template which includes system messages which includes the template
12137 !! input
12138 {{Identical}}
12139 !! result
12140 <p><span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
12141 <span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
12142 </p>
12143 !! end
12144
12145 !! test
12146 Bug31490 Turkish: ucfirst 'blah'
12147 !! options
12148 language=tr
12149 !! input
12150 {{ucfirst:blah}}
12151 !! result
12152 <p>Blah
12153 </p>
12154 !! end
12155
12156 !! test
12157 Bug31490 Turkish: ucfirst 'ix'
12158 !! options
12159 language=tr
12160 !! input
12161 {{ucfirst:ix}}
12162 !! result
12163 <p>İx
12164 </p>
12165 !! end
12166
12167 !! test
12168 Bug31490 Turkish: lcfirst 'BLAH'
12169 !! options
12170 language=tr
12171 !! input
12172 {{lcfirst:BLAH}}
12173 !! result
12174 <p>bLAH
12175 </p>
12176 !! end
12177
12178 !! test
12179 Bug31490 Turkish: ucfırst (with a dotless i)
12180 !! options
12181 language=tr
12182 !! input
12183 {{ucfırst:blah}}
12184 !! result
12185 <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>
12186 </p>
12187 !! end
12188
12189 !! test
12190 Bug31490 ucfırst (with a dotless i) with English language
12191 !! options
12192 language=en
12193 !! input
12194 {{ucfırst:blah}}
12195 !! result
12196 <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>
12197 </p>
12198 !! end
12199
12200 !! test
12201 Bug 26375: TOC with italics
12202 !! options
12203 title=[[Main Page]]
12204 !! input
12205 __TOC__
12206 == ''Lost'' episodes ==
12207 !! result
12208 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
12209 <ul>
12210 <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>
12211 </ul>
12212 </td></tr></table>
12213 <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>
12214
12215 !! end
12216
12217 !! test
12218 Bug 26375: TOC with bold
12219 !! options
12220 title=[[Main Page]]
12221 !! input
12222 __TOC__
12223 == '''should be bold''' then normal text ==
12224 !! result
12225 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
12226 <ul>
12227 <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>
12228 </ul>
12229 </td></tr></table>
12230 <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>
12231
12232 !! end
12233
12234 !! test
12235 Bug 33845: Headings become cursive in TOC when they contain an image
12236 !! options
12237 title=[[Main Page]]
12238 !! input
12239 __TOC__
12240 == Image [[Image:foobar.jpg]] ==
12241 !! result
12242 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
12243 <ul>
12244 <li class="toclevel-1 tocsection-1"><a href="#Image"><span class="tocnumber">1</span> <span class="toctext">Image</span></a></li>
12245 </ul>
12246 </td></tr></table>
12247 <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>
12248
12249 !! end
12250
12251 !! test
12252 Bug 33845 (2): Headings become bold in TOC when they contain a blockquote
12253 !! options
12254 title=[[Main Page]]
12255 !! input
12256 __TOC__
12257 == <blockquote>Quote</blockquote> ==
12258 !! result
12259 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
12260 <ul>
12261 <li class="toclevel-1 tocsection-1"><a href="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
12262 </ul>
12263 </td></tr></table>
12264 <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>
12265
12266 !! end
12267
12268 !! test
12269 Unclosed tags in TOC
12270 !! options
12271 title=[[Main Page]]
12272 !! input
12273 __TOC__
12274 == Proof: 2 < 3 ==
12275 <small>Hanc marginis exiguitas non caperet.</small>
12276 QED
12277 !! result
12278 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
12279 <ul>
12280 <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>
12281 </ul>
12282 </td></tr></table>
12283 <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>
12284 <p><small>Hanc marginis exiguitas non caperet.</small>
12285 QED
12286 </p>
12287 !! end
12288
12289 !! test
12290 Multiple tags in TOC
12291 !! input
12292 __TOC__
12293 == <i>Foo</i> <b>Bar</b> ==
12294
12295 == <i>Foo</i> <blockquote>Bar</blockquote> ==
12296 !! result
12297 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
12298 <ul>
12299 <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>
12300 <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>
12301 </ul>
12302 </td></tr></table>
12303 <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>
12304 <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>
12305
12306 !! end
12307
12308 !! test
12309 Tags with parameters in TOC
12310 !! input
12311 __TOC__
12312 == <sup class="in-h2">Hello</sup> ==
12313
12314 == <sup class="a > b">Evilbye</sup> ==
12315 !! result
12316 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
12317 <ul>
12318 <li class="toclevel-1 tocsection-1"><a href="#Hello"><span class="tocnumber">1</span> <span class="toctext"><sup>Hello</sup></span></a></li>
12319 <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>
12320 </ul>
12321 </td></tr></table>
12322 <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>
12323 <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>
12324
12325 !! end
12326
12327 !! test
12328 span tags with directionality in TOC
12329 !! input
12330 __TOC__
12331 == <span dir="ltr">C++</span> ==
12332
12333 == <span dir="rtl">זבנג!</span> ==
12334
12335 == <span style="font-style: italic">The attributes on these span tags must be deleted from the TOC</span> ==
12336
12337 == <span style="font-style: italic" dir="ltr">All attributes on these span tags must be deleted from the TOC</span> ==
12338
12339 == <span dir="ltr" style="font-style: italic">Attributes after dir on these span tags must be deleted from the TOC</span> ==
12340 !! result
12341 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
12342 <ul>
12343 <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>
12344 <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>
12345 <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>
12346 <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>
12347 <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>
12348 </ul>
12349 </td></tr></table>
12350 <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>
12351 <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>
12352 <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>
12353 <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>
12354 <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>
12355
12356 !! end
12357
12358 !! article
12359 MediaWiki:Bug32057
12360 !! text
12361 == {{int:headline_sample}} ==
12362 !! endarticle
12363
12364 !! test
12365 Bug 32057: Title needed when expanding <h> nodes.
12366 !! options
12367 title=[[Main Page]]
12368 !! input
12369 {{int:Bug32057}}
12370 !! result
12371 <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>
12372
12373 !! end
12374
12375 !! test
12376 Strip marker in urlencode
12377 !! input
12378 {{urlencode:x<nowiki/>y}}
12379 {{urlencode:x<nowiki/>y|wiki}}
12380 {{urlencode:x<nowiki/>y|path}}
12381 !! result
12382 <p>xy
12383 xy
12384 xy
12385 </p>
12386 !! end
12387
12388 !! test
12389 Strip marker in lc
12390 !! input
12391 {{lc:x<nowiki/>y}}
12392 !! result
12393 <p>xy
12394 </p>
12395 !! end
12396
12397 !! test
12398 Strip marker in uc
12399 !! input
12400 {{uc:x<nowiki/>y}}
12401 !! result
12402 <p>XY
12403 </p>
12404 !! end
12405
12406 !! test
12407 Strip marker in formatNum
12408 !! input
12409 {{formatnum:1<nowiki/>2}}
12410 {{formatnum:1<nowiki/>2|R}}
12411 !! result
12412 <p>12
12413 12
12414 </p>
12415 !! end
12416
12417 !! test
12418 Strip marker in grammar
12419 !! options
12420 language=fi
12421 !! input
12422 {{grammar:elative|foo<nowiki/>bar}}
12423 !! result
12424 <p>foobarista
12425 </p>
12426 !! end
12427
12428 !! test
12429 Strip marker in padleft
12430 !! input
12431 {{padleft:|2|x<nowiki/>y}}
12432 !! result
12433 <p>xy
12434 </p>
12435 !! end
12436
12437 !! test
12438 Strip marker in padright
12439 !! input
12440 {{padright:|2|x<nowiki/>y}}
12441 !! result
12442 <p>xy
12443 </p>
12444 !! end
12445
12446 !! test
12447 Strip marker in anchorencode
12448 !! input
12449 {{anchorencode:x<nowiki/>y}}
12450 !! result
12451 <p>xy
12452 </p>
12453 !! end
12454
12455 !! test
12456 nowiki inside link inside heading (bug 18295)
12457 !! input
12458 ==[[foo|x<nowiki>y</nowiki>z]]==
12459 !! result
12460 <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>
12461
12462 !! end
12463
12464 !! test
12465 new support for bdi element (bug 31817)
12466 !! input
12467 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
12468 !! result
12469 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
12470
12471 !!end
12472
12473 !! test
12474 Ignore pipe between table row attributes
12475 !! input
12476 {|
12477 | quux
12478 |- id=foo | style='color: red'
12479 | bar
12480 |}
12481 !! result
12482 <table>
12483 <tr>
12484 <td> quux
12485 </td></tr>
12486 <tr id="foo" style="color: red">
12487 <td> bar
12488 </td></tr></table>
12489
12490 !! end
12491
12492 !!test
12493 Gallery override link with WikiLink (bug 34852)
12494 !! input
12495 <gallery>
12496 File:foobar.jpg|caption|alt=galleryalt|link=InterWikiLink
12497 </gallery>
12498 !! result
12499 <ul class="gallery">
12500 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
12501 <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>
12502 <div class="gallerytext">
12503 <p>caption
12504 </p>
12505 </div>
12506 </div></li>
12507 </ul>
12508
12509 !! end
12510
12511 !!test
12512 Gallery override link with absolute external link (bug 34852)
12513 !! input
12514 <gallery>
12515 File:foobar.jpg|caption|alt=galleryalt|link=http://www.example.org
12516 </gallery>
12517 !! result
12518 <ul class="gallery">
12519 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
12520 <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>
12521 <div class="gallerytext">
12522 <p>caption
12523 </p>
12524 </div>
12525 </div></li>
12526 </ul>
12527
12528 !! end
12529
12530 !!test
12531 Gallery override link with malicious javascript (bug 34852)
12532 !! input
12533 <gallery>
12534 File:foobar.jpg|caption|alt=galleryalt|link=" onclick="alert('malicious javascript code!');
12535 </gallery>
12536 !! result
12537 <ul class="gallery">
12538 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
12539 <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>
12540 <div class="gallerytext">
12541 <p>caption
12542 </p>
12543 </div>
12544 </div></li>
12545 </ul>
12546
12547 !! end
12548
12549 !!test
12550 Language parser function
12551 !! input
12552 {{#language:ar}}
12553 !! result
12554 <p>العربية
12555 </p>
12556 !! end
12557
12558 !!test
12559 Padleft and padright as substr
12560 !! input
12561 {{padleft:|3|abcde}}
12562 {{padright:|3|abcde}}
12563 !! result
12564 <p>abc
12565 abc
12566 </p>
12567 !! end
12568
12569 !!test
12570 Bug 34939 - Case insensitive link parsing ([HttP://])
12571 !! input
12572 [HttP://MediaWiki.Org/]
12573 !! result
12574 <p><a rel="nofollow" class="external autonumber" href="HttP://MediaWiki.Org/">[1]</a>
12575 </p>
12576 !! end
12577
12578 !!test
12579 Bug 34939 - Case insensitive link parsing ([HttP:// title])
12580 !! input
12581 [HttP://MediaWiki.Org/ MediaWiki]
12582 !! result
12583 <p><a rel="nofollow" class="external text" href="HttP://MediaWiki.Org/">MediaWiki</a>
12584 </p>
12585 !! end
12586
12587 !!test
12588 Bug 34939 - Case insensitive link parsing (HttP://)
12589 !! input
12590 HttP://MediaWiki.Org/
12591 !! result
12592 <p><a rel="nofollow" class="external free" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a>
12593 </p>
12594 !! end
12595
12596 ###
12597 ### Parsoids-specific tests
12598 ### Parsoid-PHP parser incompatibilities
12599 ###
12600 !!test
12601 1. SOL-sensitive wikitext tokens as template-args
12602 !!options
12603 disabled
12604 !!input
12605 {{echo|*a}}
12606 {{echo|#a}}
12607 {{echo|:a}}
12608 !!result
12609 <p>*a
12610 #a
12611 :a
12612 </p>
12613 !!end
12614
12615 #### The following section of tests are primarily to test
12616 #### wikitext escaping capabilities of Parsoid.
12617 #### A lot of the tests are disabled for the PHP parser either
12618 #### because of minor newline diffs or other reasons.
12619 #### As Parsoid serializer can handle newlines and other HTML
12620 #### more robustly, some of these tests might get reenabled
12621 #### for the PHP parser.
12622
12623 #### --------------- Headings ---------------
12624 #### 0. Unnested
12625 #### 1. Nested inside html <h1>=foo=</h1>
12626 #### 2. Outside heading nest on a single line <h1>foo</h1>*bar
12627 #### 3. Nested inside html with wikitext split by html tags
12628 #### 4. No escape needed
12629 #### 5. Empty headings <h1></h1>
12630 #### 6. Heading chars in SOL context
12631 #### ----------------------------------------
12632 !! test
12633 Headings: 0. Unnested
12634 !! input
12635 <nowiki>=foo=</nowiki>
12636
12637 <nowiki>=foo</nowiki>''a''=
12638 !! result
12639 <p>=foo=
12640 </p><p>=foo<i>a</i>=
12641 </p>
12642 !!end
12643
12644 !! test
12645 Headings: 1. Nested inside html
12646 !! options
12647 disabled
12648 !! input
12649 =<nowiki>=foo=</nowiki>=
12650 ==<nowiki>=foo=</nowiki>==
12651 ===<nowiki>=foo=</nowiki>===
12652 ====<nowiki>=foo=</nowiki>====
12653 =====<nowiki>=foo=</nowiki>=====
12654 ======<nowiki>=foo=</nowiki>======
12655 !! result
12656 <h1>=foo=</h1>
12657 <h2>=foo=</h2>
12658 <h3>=foo=</h3>
12659 <h4>=foo=</h4>
12660 <h5>=foo=</h5>
12661 <h6>=foo=</h6>
12662 !!end
12663
12664 !! test
12665 Headings: 2. Outside heading nest on a single line <h1>foo</h1>*bar
12666 !! options
12667 disabled
12668 !! input
12669 =foo=
12670 <nowiki>*bar</nowiki>
12671 =foo=
12672 =bar
12673 =foo=
12674 <nowiki>=bar=</nowiki>
12675 !! result
12676 <h1>foo</h1>*bar
12677 <h1>foo</h1>=bar
12678 <h1>foo</h1>=bar=
12679 !!end
12680
12681 !! test
12682 Headings: 3. Nested inside html with wikitext split by html tags
12683 !! options
12684 disabled
12685 !! input
12686 =<nowiki>=</nowiki>'''bold'''foo==
12687 !! result
12688 <h1>=<b>bold</b>foo=</h1>
12689 !!end
12690
12691 !! test
12692 Headings: 4. No escaping needed (testing just h1 and h2)
12693 !! options
12694 disabled
12695 !! input
12696 ==foo=
12697 =foo==
12698 ===foo==
12699 ==foo===
12700 =''=''foo==
12701 ===
12702 !! result
12703 <h1>=foo</h1>
12704 <h1>foo=</h1>
12705 <h2>=foo</h2>
12706 <h2>foo=</h2>
12707 <h1><i>=</i>foo=</h1>
12708 <h1>=</h1>
12709 !!end
12710
12711 !! test
12712 Headings: 5. Empty headings
12713 !! options
12714 disabled
12715 !! input
12716 =<nowiki></nowiki>=
12717 ==<nowiki></nowiki>==
12718 ===<nowiki></nowiki>===
12719 ====<nowiki></nowiki>====
12720 =====<nowiki></nowiki>=====
12721 ======<nowiki></nowiki>======
12722 !! result
12723 <h1></h1>
12724 <h2></h2>
12725 <h3></h3>
12726 <h4></h4>
12727 <h5></h5>
12728 <h6></h6>
12729 !!end
12730
12731 !! test
12732 Headings: 6. Heading chars in SOL context
12733 !! options
12734 disabled
12735 !! input
12736 <!--cmt--><nowiki>=h1=</nowiki>
12737 !! result
12738 <p><!--cmt-->=h1=
12739 </p>
12740 !!end
12741
12742 #### --------------- Lists ---------------
12743 #### 0. Outside nests (*foo, etc.)
12744 #### 1. Nested inside html <ul><li>*foo</li></ul>
12745 #### 2. Inside definition lists
12746 #### 3. Only bullets at start should be escaped
12747 #### 4. No escapes needed
12748 #### 5. No unnecessary escapes
12749 #### 6. Escape bullets in SOL position
12750 #### 7. Escape bullets in a multi-line context
12751 #### ----------------------------------------
12752
12753 !! test
12754 Lists: 0. Outside nests
12755 !! input
12756 <nowiki>*foo</nowiki>
12757
12758 <nowiki>#foo</nowiki>
12759 !! result
12760 <p>*foo
12761 </p><p>#foo
12762 </p>
12763 !!end
12764
12765 !! test
12766 Lists: 1. Nested inside html
12767 !! input
12768 *<nowiki>*foo</nowiki>
12769
12770 *<nowiki>#foo</nowiki>
12771
12772 *<nowiki>:foo</nowiki>
12773
12774 *<nowiki>;foo</nowiki>
12775
12776 #<nowiki>*foo</nowiki>
12777
12778 #<nowiki>#foo</nowiki>
12779
12780 #<nowiki>:foo</nowiki>
12781
12782 #<nowiki>;foo</nowiki>
12783 !! result
12784 <ul><li>*foo
12785 </li></ul>
12786 <ul><li>#foo
12787 </li></ul>
12788 <ul><li>:foo
12789 </li></ul>
12790 <ul><li>;foo
12791 </li></ul>
12792 <ol><li>*foo
12793 </li></ol>
12794 <ol><li>#foo
12795 </li></ol>
12796 <ol><li>:foo
12797 </li></ol>
12798 <ol><li>;foo
12799 </li></ol>
12800
12801 !!end
12802
12803 !! test
12804 Lists: 2. Inside definition lists
12805 !! input
12806 ;<nowiki>;foo</nowiki>
12807
12808 ;<nowiki>:foo</nowiki>
12809
12810 ;<nowiki>:foo</nowiki>
12811 :bar
12812
12813 :<nowiki>:foo</nowiki>
12814 !! result
12815 <dl><dt>;foo
12816 </dt></dl>
12817 <dl><dt>:foo
12818 </dt></dl>
12819 <dl><dt>:foo
12820 </dt><dd>bar
12821 </dd></dl>
12822 <dl><dd>:foo
12823 </dd></dl>
12824
12825 !!end
12826
12827 !! test
12828 Lists: 3. Only bullets at start of text should be escaped
12829 !! input
12830 *<nowiki>*foo*bar</nowiki>
12831
12832 *<nowiki>*foo</nowiki>''it''*bar
12833 !! result
12834 <ul><li>*foo*bar
12835 </li></ul>
12836 <ul><li>*foo<i>it</i>*bar
12837 </li></ul>
12838
12839 !!end
12840
12841 !! test
12842 Lists: 4. No escapes needed
12843 !! options
12844 disabled
12845 !! input
12846 *foo*bar
12847
12848 *''foo''*bar
12849
12850 *[[Foo]]: bar
12851 !! result
12852 <ul><li>foo*bar
12853 </li></ul>
12854 <ul><li><i>foo</i>*bar
12855 </li></ul>
12856 <ul><li><a href="Foo" rel="mw:WikiLink">Foo</a>: bar
12857 </li></ul>
12858 !!end
12859
12860 !! test
12861 Lists: 5. No unnecessary escapes
12862 !! input
12863 * bar <span><nowiki>[[foo]]</nowiki></span>
12864
12865 *=bar <span><nowiki>[[foo]]</nowiki></span>
12866
12867 *[[bar <span><nowiki>[[foo]]</nowiki></span>
12868
12869 *<nowiki>]]bar </nowiki><span><nowiki>[[foo]]</nowiki></span>
12870
12871 *=bar <span>foo]]</span>=
12872 !! result
12873 <ul><li> bar <span>[[foo]]</span>
12874 </li></ul>
12875 <ul><li>=bar <span>[[foo]]</span>
12876 </li></ul>
12877 <ul><li>[[bar <span>[[foo]]</span>
12878 </li></ul>
12879 <ul><li>]]bar <span>[[foo]]</span>
12880 </li></ul>
12881 <ul><li>=bar <span>foo]]</span>=
12882 </li></ul>
12883
12884 !!end
12885
12886 !! test
12887 Lists: 6. Escape bullets in SOL position
12888 !! options
12889 disabled
12890 !! input
12891 <!--cmt--><nowiki>*foo</nowiki>
12892 !! result
12893 <p><!--cmt-->*foo
12894 </p>
12895 !!end
12896
12897 !! test
12898 Lists: 7. Escape bullets in a multi-line context
12899 !! input
12900 <nowiki>a
12901 *b</nowiki>
12902 !! result
12903 <p>a
12904 *b
12905 </p>
12906 !!end
12907
12908 #### --------------- HRs ---------------
12909 #### 1. Single line
12910 #### -----------------------------------
12911
12912 !! test
12913 HRs: 1. Single line
12914 !! options
12915 disabled
12916 !! input
12917 ----
12918 <nowiki>----</nowiki>
12919 ----
12920 <nowiki>=foo=</nowiki>
12921 ----
12922 <nowiki>*foo</nowiki>
12923 !! result
12924 <hr/>----
12925 <hr/>=foo=
12926 <hr/>*foo
12927 !! end
12928
12929 #### --------------- Tables ---------------
12930 #### 1a. Simple example
12931 #### 1b. No escaping needed (!foo)
12932 #### 1c. No escaping needed (|foo)
12933 #### 1d. No escaping needed (|}foo)
12934 ####
12935 #### 2a. Nested in td (<td>foo|bar</td>)
12936 #### 2b. Nested in td (<td>foo||bar</td>)
12937 #### 2c. Nested in td -- no escaping needed(<td>foo!!bar</td>)
12938 ####
12939 #### 3a. Nested in th (<th>foo!bar</th>)
12940 #### 3b. Nested in th (<th>foo!!bar</th>)
12941 #### 3c. Nested in th -- no escaping needed(<th>foo||bar</th>)
12942 ####
12943 #### 4a. Escape -
12944 #### 4b. Escape +
12945 #### 4c. No escaping needed
12946 #### --------------------------------------
12947
12948 !! test
12949 Tables: 1a. Simple example
12950 !! input
12951 <nowiki>{|
12952 |}</nowiki>
12953 !! result
12954 <p>{|
12955 |}
12956 </p>
12957 !! end
12958
12959 !! test
12960 Tables: 1b. No escaping needed
12961 !! input
12962 !foo
12963 !! result
12964 <p>!foo
12965 </p>
12966 !! end
12967
12968 !! test
12969 Tables: 1c. No escaping needed
12970 !! input
12971 |foo
12972 !! result
12973 <p>|foo
12974 </p>
12975 !! end
12976
12977 !! test
12978 Tables: 1d. No escaping needed
12979 !! input
12980 |}foo
12981 !! result
12982 <p>|}foo
12983 </p>
12984 !! end
12985
12986 !! test
12987 Tables: 2a. Nested in td
12988 !! options
12989 disabled
12990 !! input
12991 {|
12992 |<nowiki>foo|bar</nowiki>
12993 |}
12994 !! result
12995 <table>
12996 <tr><td>foo|bar
12997 </td></tr></table>
12998
12999 !! end
13000
13001 !! test
13002 Tables: 2b. Nested in td
13003 !! options
13004 disabled
13005 !! input
13006 {|
13007 |<nowiki>foo||bar</nowiki>
13008 |''it''<nowiki>foo||bar</nowiki>
13009 |}
13010 !! result
13011 <table>
13012 <tr><td>foo||bar
13013 </td><td><i>it</i>foo||bar
13014 </td></tr></table>
13015
13016 !! end
13017
13018 !! test
13019 Tables: 2c. Nested in td -- no escaping needed
13020 !! options
13021 disabled
13022 !! input
13023 {|
13024 |foo!!bar
13025 |}
13026 !! result
13027 <table>
13028 <tr><td>foo!!bar
13029 </td></tr></table>
13030
13031 !! end
13032
13033 !! test
13034 Tables: 3a. Nested in th
13035 !! options
13036 disabled
13037 !! input
13038 {|
13039 !foo!bar
13040 |}
13041 !! result
13042 <table>
13043 <tr><th>foo!bar
13044 </th></tr></table>
13045
13046 !! end
13047
13048 !! test
13049 Tables: 3b. Nested in th
13050 !! options
13051 disabled
13052 !! input
13053 {|
13054 !<nowiki>foo!!bar</nowiki>
13055 |}
13056 !! result
13057 <table>
13058 <tr><th>foo!!bar
13059 </th></tr></table>
13060
13061 !! end
13062
13063 !! test
13064 Tables: 3c. Nested in th -- no escaping needed
13065 !! options
13066 disabled
13067 !! input
13068 {|
13069 !foo||bar
13070 |}
13071 !! result
13072 <table>
13073 <tr><th>foo||bar
13074 </th></tr></table>
13075
13076 !! end
13077
13078 !! test
13079 Tables: 4a. Escape -
13080 !! options
13081 disabled
13082 !! input
13083 {|
13084 |-
13085 !-bar
13086 |-
13087 |<nowiki>-bar</nowiki>
13088 |}
13089 !! result
13090 <table><tbody>
13091 <tr><th>-bar</th></tr>
13092 <tr><td>-bar</td></tr>
13093 </tbody></table>
13094 !! end
13095
13096 !! test
13097 Tables: 4b. Escape +
13098 !! options
13099 disabled
13100 !! input
13101 {|
13102 |-
13103 !+bar
13104 |-
13105 |<nowiki>+bar</nowiki>
13106 |}
13107 !! result
13108 <table><tbody>
13109 <tr><th>+bar</th></tr>
13110 <tr><td>+bar</td></tr>
13111 </tbody></table>
13112 !! end
13113
13114 !! test
13115 Tables: 4c. No escaping needed
13116 !! options
13117 disabled
13118 !! input
13119 {|
13120 |-
13121 |foo-bar
13122 |foo+bar
13123 |-
13124 |''foo''-bar
13125 |''foo''+bar
13126 |}
13127 !! result
13128 <table><tbody>
13129 <tr><td>foo-bar</td><td>foo+bar</td></tr>
13130 <tr><td><i>foo</i>-bar</td><td><i>foo</i>+bar</td></tr>
13131 </tbody></table>
13132 !! end
13133
13134 #### --------------- Links ---------------
13135 #### 1. Quote marks in link text
13136 #### 2. Wikilinks: Escapes needed
13137 #### 3. Wikilinks: No escapes needed
13138 #### 4. Extlinks: Escapes needed
13139 #### 5. Extlinks: No escapes needed
13140 #### --------------------------------------
13141 !! test
13142 Links 1. Quote marks in link text
13143 !! options
13144 disabled
13145 !! input
13146 [[Foo|<nowiki>Foo''boo''</nowiki>]]
13147 !! result
13148 <a rel="mw:WikiLink" href="Foo">Foo''boo''</a>
13149 !! end
13150
13151 !! test
13152 Links 2. WikiLinks: Escapes needed
13153 !! options
13154 disabled
13155 !! input
13156 [[Foo|<nowiki>[Foobar]</nowiki>]]
13157 [[Foo|<nowiki>Foobar]</nowiki>]]
13158 [[Foo|<nowiki>x [Foobar] x</nowiki>]]
13159 [[Foo|<nowiki>x [http://google.com g] x</nowiki>]]
13160 [[Foo|<nowiki>[[Bar]]</nowiki>]]
13161 [[Foo|<nowiki>x [[Bar]] x</nowiki>]]
13162 [[Foo|<nowiki>|Bar</nowiki>]]
13163 !! result
13164 <a href="Foo" rel="mw:WikiLink">[Foobar]</a>
13165 <a href="Foo" rel="mw:WikiLink">Foobar]</a>
13166 <a href="Foo" rel="mw:WikiLink">x [Foobar] x</a>
13167 <a href="Foo" rel="mw:WikiLink">x [http://google.com g] x</a>
13168 <a href="Foo" rel="mw:WikiLink">[[Bar]]</a>
13169 <a href="Foo" rel="mw:WikiLink">x [[Bar]] x</a>
13170 <a href="Foo" rel="mw:WikiLink">|Bar</a>
13171 !! end
13172
13173 !! test
13174 Links 3. WikiLinks: No escapes needed
13175 !! options
13176 disabled
13177 !! input
13178 [[Foo|[Foobar]]
13179 [[Foo|foo|bar]]
13180 !! result
13181 <a href="Foo" rel="mw:WikiLink">[Foobar</a>
13182 <a href="Foo" rel="mw:WikiLink">foo|bar</a>
13183 !! end
13184
13185 !! test
13186 Links 4. ExtLinks: Escapes needed
13187 !! options
13188 disabled
13189 !! input
13190 [http://google.com <nowiki>[google]</nowiki>]
13191 [http://google.com <nowiki>google]</nowiki>]
13192 !! result
13193 <a href="http://google.com" rel="mw:ExtLink">[google]</a>
13194 <a href="http://google.com" rel="mw:ExtLink">google]</a>
13195 !! end
13196
13197 !! test
13198 Links 5. ExtLinks: No escapes needed
13199 !! options
13200 disabled
13201 !! input
13202 [http://google.com [google]
13203 !! result
13204 <a href="http://google.com" rel="mw:ExtLink">[google</a>
13205 !! end
13206
13207 #### --------------- Quotes ---------------
13208 #### 1. Quotes inside <b> and <i>
13209 #### 2. Link fragments separated by <i> and <b> tags
13210 #### 3. Link fragments inside <i> and <b>
13211 #### --------------------------------------
13212 !! test
13213 1. Quotes inside <b> and <i>
13214 !! input
13215 ''<nowiki>'foo'</nowiki>''
13216 ''<nowiki>''foo''</nowiki>''
13217 ''<nowiki>'''foo'''</nowiki>''
13218 '''<nowiki>'foo'</nowiki>'''
13219 '''<nowiki>''foo''</nowiki>'''
13220 '''<nowiki>'''foo'''</nowiki>'''
13221 '''<nowiki>foo'</nowiki>''<nowiki>bar'</nowiki>''baz'''
13222 !! result
13223 <p><i>'foo'</i>
13224 <i>''foo''</i>
13225 <i>'''foo'''</i>
13226 <b>'foo'</b>
13227 <b>''foo''</b>
13228 <b>'''foo'''</b>
13229 <b>foo'<i>bar'</i>baz</b>
13230 </p>
13231 !! end
13232
13233 !! test
13234 2. Link fragments separated by <i> and <b> tags
13235 !! input
13236 [[''foo''<nowiki>hello]]</nowiki>
13237
13238 [['''foo'''<nowiki>hello]]</nowiki>
13239 !! result
13240 <p>[[<i>foo</i>hello]]
13241 </p><p>[[<b>foo</b>hello]]
13242 </p>
13243 !! end
13244
13245 !! test
13246 2. Link fragments inside <i> and <b>
13247 (FIXME: Escaping one or both of [[ and ]] is also acceptable --
13248 this is one of the shortcomings of this format)
13249 !! input
13250 ''[[foo''<nowiki>]]</nowiki>
13251
13252 '''[[foo'''<nowiki>]]</nowiki>
13253 !! result
13254 <p><i>[[foo</i>]]
13255 </p><p><b>[[foo</b>]]
13256 </p>
13257 !! end
13258
13259 #### --------------- Paragraphs ---------------
13260 #### 1. No unnecessary escapes
13261 #### --------------------------------------
13262
13263 !! test
13264 1. No unnecessary escapes
13265 !! input
13266 bar <span><nowiki>[[foo]]</nowiki></span>
13267
13268 =bar <span><nowiki>[[foo]]</nowiki></span>
13269
13270 [[bar <span><nowiki>[[foo]]</nowiki></span>
13271
13272 <nowiki>]]bar </nowiki><span><nowiki>[[foo]]</nowiki></span>
13273
13274 <nowiki>=bar </nowiki><span>foo]]</span>=
13275 !! result
13276 <p>bar <span>[[foo]]</span>
13277 </p><p>=bar <span>[[foo]]</span>
13278 </p><p>[[bar <span>[[foo]]</span>
13279 </p><p>]]bar <span>[[foo]]</span>
13280 </p><p>=bar <span>foo]]</span>=
13281 </p>
13282 !!end
13283
13284 #### --------------- PRE ------------------
13285 #### 1. Leading space in SOL context should be escaped
13286 #### --------------------------------------
13287 !! test
13288 1. Leading space in SOL context should be escaped
13289 !! options
13290 disabled
13291 !! input
13292 <nowiki> foo</nowiki>
13293 <!--cmt--><nowiki> foo</nowiki>
13294 !! result
13295 <p> foo
13296 <!--cmt--> foo
13297 </p>
13298 !! end
13299
13300 #### --------------- HTML tags ---------------
13301 #### 1. a tags
13302 #### 2. other tags
13303 #### 3. multi-line html tag
13304 #### --------------------------------------
13305 !! test
13306 1. a tags
13307 !! options
13308 disabled
13309 !! input
13310 <a href="http://google.com">google</a>
13311 !! result
13312 &lt;a href=&quot;http://google.com&quot;&gt;google&lt;/a&gt;
13313 !! end
13314
13315 !! test
13316 2. other tags
13317 !! input
13318 <nowiki><div>foo</div>
13319 <div style="color:red">foo</div></nowiki>
13320 !! result
13321 <p>&lt;div&gt;foo&lt;/div&gt;
13322 &lt;div style=&quot;color:red&quot;&gt;foo&lt;/div&gt;
13323 </p>
13324 !! end
13325
13326 !! test
13327 3. multi-line html tag
13328 !! input
13329 <nowiki><div
13330 >foo</div
13331 ></nowiki>
13332 !! result
13333 <p>&lt;div
13334 &gt;foo&lt;/div
13335 &gt;
13336 </p>
13337 !! end
13338
13339 #### --------------- Others ---------------
13340 !! test
13341 Escaping nowikis
13342 !! input
13343 &lt;nowiki&gt;foo&lt;/nowiki&gt;
13344 !! result
13345 <p>&lt;nowiki&gt;foo&lt;/nowiki&gt;
13346 </p>
13347 !! end
13348
13349 !! test
13350 Tag-like HTML structures are passed through as text
13351 !! input
13352 <x y>
13353
13354 <x.y>
13355
13356 <x-y>
13357
13358 1>2
13359
13360 x<y
13361
13362 a>b
13363
13364 1<d e>f
13365 !! result
13366 <p>&lt;x y&gt;
13367 </p><p>&lt;x.y&gt;
13368 </p><p>&lt;x-y&gt;
13369 </p><p>1&gt;2
13370 </p><p>x&lt;y
13371 </p><p>a&gt;b
13372 </p><p>1&lt;d e&gt;f
13373 </p>
13374 !! end
13375
13376
13377 # This fails in the PHP parser (see bug 40670,
13378 # https://bugzilla.wikimedia.org/show_bug.cgi?id=40670), so disabled for it.
13379 !! test
13380 Tag names followed by punctuation should not be recognized as tags
13381 !! options
13382 disabled
13383 !! input
13384 <s.ome> text
13385 !! result
13386 <p>&lt;s.ome&gt text
13387 </p>
13388 !! end
13389
13390
13391 TODO:
13392 more images
13393 more tables
13394 character entities
13395 and much more
13396 Try for 100% code coverage