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