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