Merge "(bug 43498) (bug 43574) Two wikilink types and {{int:}}."
[lhc/web/wiklou.git] / tests / parser / parserTests.txt
1 # MediaWiki Parser test cases
2 # Some taken from http://meta.wikimedia.org/wiki/Parser_testing
3 # All (C) their respective authors and released under the GPL
4 #
5 # The syntax should be fairly self-explanatory.
6 #
7 # Currently supported test options:
8 # One of the following three:
9 #
10 # (default) generate HTML output
11 # pst apply pre-save transform
12 # msg apply message transform
13 #
14 # Plus any combination of these:
15 #
16 # cat add category links
17 # ill add inter-language links
18 # subpage enable subpages (disabled by default)
19 # noxml don't check for XML well formdness
20 # title=[[XXX]] run test using article title XXX
21 # language=XXX set content language to XXX for this test
22 # variant=XXX set the variant of language for this test (eg zh-tw)
23 # disabled do not run test
24 # showtitle make the first line the title
25 # comment run through Linker::formatComment() instead of main parser
26 # local format section links in edit comment text as local links
27 #
28 # For testing purposes, temporary articles can created:
29 # !!article / NAMESPACE:TITLE / !!text / ARTICLE TEXT / !!endarticle
30 # where '/' denotes a newline.
31
32 # This is the standard article assumed to exist.
33 !! article
34 Main Page
35 !! text
36 blah blah
37 !! endarticle
38
39 !!article
40 Template:Foo
41 !!text
42 FOO
43 !!endarticle
44
45 !! article
46 Template:Blank
47 !! text
48 !! endarticle
49
50 !! article
51 Template:pipe
52 !! text
53 |
54 !! endarticle
55
56 !!article
57 MediaWiki:bad image list
58 !!text
59 * [[File:Bad.jpg]] except [[Nasty page]]
60 !!endarticle
61
62 !! article
63 Template:inner list
64 !! text
65 * item 1
66 !! endarticle
67
68 !! article
69 Template:tbl-start
70 !! text
71 {|
72 !! endarticle
73
74 !! article
75 Template:tbl-end
76 !! text
77 |}
78 !! endarticle
79
80 !! article
81 Template:!
82 !! text
83 |
84 !! endarticle
85
86 !! article
87 Template:echo
88 !! text
89 {{{1}}}
90 !! endarticle
91
92 !! article
93 Template:echo_with_span
94 !! text
95 <span>{{{1}}}</span>
96 !! endarticle
97
98 !! article
99 Template:echo_with_div
100 !! text
101 <div>{{{1}}}</div>
102 !! endarticle
103
104 !! article
105 Template:attr_str
106 !! text
107 {{{1}}}="{{{2}}}"
108 !! endarticle
109
110 !! article
111 Template:table_attribs
112 !! text
113 <noinclude>
114 |</noinclude>style="color: red"| Foo
115 !! endarticle
116
117 !! article
118 A?b
119 !! text
120 Weirdo titles!
121 !! endarticle
122
123 ###
124 ### Basic tests
125 ###
126 !! test
127 Blank input
128 !! input
129 !! result
130 !! end
131
132
133 !! test
134 Simple paragraph
135 !! input
136 This is a simple paragraph.
137 !! result
138 <p>This is a simple paragraph.
139 </p>
140 !! end
141
142 !! test
143 Paragraphs with extra newline spacing
144 !! input
145 foo
146
147 bar
148
149
150 baz
151
152
153
154 booz
155 !! result
156 <p>foo
157 </p><p>bar
158 </p><p><br />
159 baz
160 </p><p><br />
161 </p><p>booz
162 </p>
163 !! end
164
165 !! test
166 Simple list
167 !! input
168 * Item 1
169 * Item 2
170 !! result
171 <ul><li> Item 1
172 </li><li> Item 2
173 </li></ul>
174
175 !! end
176
177 !! test
178 Italics and bold
179 !! input
180 * plain
181 * plain''italic''plain
182 * plain''italic''plain''italic''plain
183 * plain'''bold'''plain
184 * plain'''bold'''plain'''bold'''plain
185 * plain''italic''plain'''bold'''plain
186 * plain'''bold'''plain''italic''plain
187 * plain''italic'''bold-italic'''italic''plain
188 * plain'''bold''bold-italic''bold'''plain
189 * plain'''''bold-italic'''italic''plain
190 * plain'''''bold-italic''bold'''plain
191 * plain''italic'''bold-italic'''''plain
192 * plain'''bold''bold-italic'''''plain
193 * plain l'''italic''plain
194 * plain l''''bold''' plain
195 !! result
196 <ul><li> plain
197 </li><li> plain<i>italic</i>plain
198 </li><li> plain<i>italic</i>plain<i>italic</i>plain
199 </li><li> plain<b>bold</b>plain
200 </li><li> plain<b>bold</b>plain<b>bold</b>plain
201 </li><li> plain<i>italic</i>plain<b>bold</b>plain
202 </li><li> plain<b>bold</b>plain<i>italic</i>plain
203 </li><li> plain<i>italic<b>bold-italic</b>italic</i>plain
204 </li><li> plain<b>bold<i>bold-italic</i>bold</b>plain
205 </li><li> plain<i><b>bold-italic</b>italic</i>plain
206 </li><li> plain<b><i>bold-italic</i>bold</b>plain
207 </li><li> plain<i>italic<b>bold-italic</b></i>plain
208 </li><li> plain<b>bold<i>bold-italic</i></b>plain
209 </li><li> plain l'<i>italic</i>plain
210 </li><li> plain l'<b>bold</b> plain
211 </li></ul>
212
213 !! end
214
215 ###
216 ### 2-quote opening sequence tests
217 ###
218 !! test
219 Italics and bold: 2-quote opening sequence: (2,2)
220 !! input
221 ''foo''
222 !! result
223 <p><i>foo</i>
224 </p>
225 !!end
226
227
228 !! test
229 Italics and bold: 2-quote opening sequence: (2,3)
230 !! input
231 ''foo'''
232 !! result
233 <p><i>foo'</i>
234 </p>
235 !!end
236
237
238 !! test
239 Italics and bold: 2-quote opening sequence: (2,4)
240 !! input
241 ''foo''''
242 !! result
243 <p><i>foo''</i>
244 </p>
245 !!end
246
247
248 !! test
249 Italics and bold: 2-quote opening sequence: (2,5)
250 !! input
251 ''foo'''''
252 !! result
253 <p><i>foo</i>
254 </p>
255 !!end
256
257
258 ###
259 ### 3-quote opening sequence tests
260 ###
261
262 !! test
263 Italics and bold: 3-quote opening sequence: (3,2)
264 !! input
265 '''foo''
266 !! result
267 <p>'<i>foo</i>
268 </p>
269 !!end
270
271
272 !! test
273 Italics and bold: 3-quote opening sequence: (3,3)
274 !! input
275 '''foo'''
276 !! result
277 <p><b>foo</b>
278 </p>
279 !!end
280
281
282 !! test
283 Italics and bold: 3-quote opening sequence: (3,4)
284 !! input
285 '''foo''''
286 !! result
287 <p><b>foo'</b>
288 </p>
289 !!end
290
291
292 !! test
293 Italics and bold: 3-quote opening sequence: (3,5)
294 !! input
295 '''foo'''''
296 !! result
297 <p><b>foo</b>
298 </p>
299 !!end
300
301
302 ###
303 ### 4-quote opening sequence tests
304 ###
305
306 !! test
307 Italics and bold: 4-quote opening sequence: (4,2)
308 !! input
309 ''''foo''
310 !! result
311 <p>''<i>foo</i>
312 </p>
313 !!end
314
315
316 !! test
317 Italics and bold: 4-quote opening sequence: (4,3)
318 !! input
319 ''''foo'''
320 !! result
321 <p>'<b>foo</b>
322 </p>
323 !!end
324
325
326 !! test
327 Italics and bold: 4-quote opening sequence: (4,4)
328 !! input
329 ''''foo''''
330 !! result
331 <p>'<b>foo'</b>
332 </p>
333 !!end
334
335
336 !! test
337 Italics and bold: 4-quote opening sequence: (4,5)
338 !! input
339 ''''foo'''''
340 !! result
341 <p>'<b>foo</b>
342 </p>
343 !!end
344
345
346 ###
347 ### 5-quote opening sequence tests
348 ###
349
350 !! test
351 Italics and bold: 5-quote opening sequence: (5,2)
352 !! input
353 '''''foo''
354 !! result
355 <p><b><i>foo</i></b>
356 </p>
357 !!end
358
359
360 !! test
361 Italics and bold: 5-quote opening sequence: (5,3)
362 !! input
363 '''''foo'''
364 !! result
365 <p><i><b>foo</b></i>
366 </p>
367 !!end
368
369
370 !! test
371 Italics and bold: 5-quote opening sequence: (5,4)
372 !! input
373 '''''foo''''
374 !! result
375 <p><i><b>foo'</b></i>
376 </p>
377 !!end
378
379
380 !! test
381 Italics and bold: 5-quote opening sequence: (5,5)
382 !! input
383 '''''foo'''''
384 !! result
385 <p><i><b>foo</b></i>
386 </p>
387 !!end
388
389 ###
390 ### multiple quote sequences in a line
391 ###
392 !! test
393 Italics and bold: multiple quote sequences: (2,4,2)
394 !! input
395 ''foo''''bar''
396 !! result
397 <p><i>foo'<b>bar</b></i>
398 </p>
399 !!end
400
401
402 !! test
403 Italics and bold: multiple quote sequences: (2,4,3)
404 !! input
405 ''foo''''bar'''
406 !! result
407 <p><i>foo'<b>bar</b></i>
408 </p>
409 !!end
410
411
412 !! test
413 Italics and bold: multiple quote sequences: (2,4,4)
414 !! input
415 ''foo''''bar''''
416 !! result
417 <p><i>foo'<b>bar'</b></i>
418 </p>
419 !!end
420
421
422 !! test
423 Italics and bold: multiple quote sequences: (3,4,2)
424 !! input
425 '''foo''''bar''
426 !! result
427 <p><b>foo'</b>bar
428 </p>
429 !!end
430
431
432 !! test
433 Italics and bold: multiple quote sequences: (3,4,3)
434 !! input
435 '''foo''''bar'''
436 !! result
437 <p><b>foo'</b>bar
438 </p>
439 !!end
440
441 ###
442 ### other quote tests
443 ###
444 !! test
445 Italics and bold: other quote tests: (2,3,5)
446 !! input
447 ''this is about '''foo's family'''''
448 !! result
449 <p><i>this is about <b>foo's family</b></i>
450 </p>
451 !!end
452
453
454 !! test
455 Italics and bold: other quote tests: (2,(3,3),2)
456 !! input
457 ''this is about '''foo's''' family''
458 !! result
459 <p><i>this is about <b>foo's</b> family</i>
460 </p>
461 !!end
462
463
464 !! test
465 Italics and bold: other quote tests: (3,2,3,2)
466 !! input
467 '''this is about ''foo'''s family''
468 !! result
469 <p><b>this is about <i>foo</i></b><i>s family</i>
470 </p>
471 !!end
472
473
474 !! test
475 Italics and bold: other quote tests: (3,2,3,3)
476 !! input
477 '''this is about ''foo'''s family'''
478 !! result
479 <p>'<i>this is about </i>foo<b>s family</b>
480 </p>
481 !!end
482
483
484
485 !! test
486 Italics and bold: other quote tests: (3,(2,2),3)
487 !! input
488 '''this is about ''foo's'' family'''
489 !! result
490 <p><b>this is about <i>foo's</i> family</b>
491 </p>
492 !!end
493
494 ###
495 ### <nowiki> test cases
496 ###
497
498 !! test
499 <nowiki> unordered list
500 !! input
501 <nowiki>* This is not an unordered list item.</nowiki>
502 !! result
503 <p>* This is not an unordered list item.
504 </p>
505 !! end
506
507 !! test
508 <nowiki> spacing
509 !! input
510 <nowiki>Lorem ipsum dolor
511
512 sed abit.
513 sed nullum.
514
515 :and a colon
516 </nowiki>
517 !! result
518 <p>Lorem ipsum dolor
519
520 sed abit.
521 sed nullum.
522
523 :and a colon
524
525 </p>
526 !! end
527
528 !! test
529 nowiki 3
530 !! input
531 :There is not nowiki.
532 :There is <nowiki>nowiki</nowiki>.
533
534 #There is not nowiki.
535 #There is <nowiki>nowiki</nowiki>.
536
537 *There is not nowiki.
538 *There is <nowiki>nowiki</nowiki>.
539 !! result
540 <dl><dd>There is not nowiki.
541 </dd><dd>There is nowiki.
542 </dd></dl>
543 <ol><li>There is not nowiki.
544 </li><li>There is nowiki.
545 </li></ol>
546 <ul><li>There is not nowiki.
547 </li><li>There is nowiki.
548 </li></ul>
549
550 !! end
551
552
553 ###
554 ### Comments
555 ###
556 !! test
557 Comments and Indent-Pre
558 !! input
559 <!-- comment 1 --> asdf
560
561 <!-- comment 1 --> asdf
562 <!-- comment 2 -->
563
564 <!-- comment 1 --> asdf
565 <!-- comment 2 -->xyz
566
567 <!-- comment 1 --> asdf
568 <!-- comment 2 --> xyz
569 !! result
570 <pre>asdf
571 </pre>
572 <pre>asdf
573 </pre>
574 <pre>asdf
575 </pre>
576 <p>xyz
577 </p>
578 <pre>asdf
579 xyz
580 </pre>
581 !! end
582
583 !! test
584 Comment test 2a
585 !! input
586 asdf
587 <!-- comment 1 -->
588 jkl
589 !! result
590 <p>asdf
591 jkl
592 </p>
593 !! end
594
595 !! test
596 Comment test 2b
597 !! input
598 asdf
599 <!-- comment 1 -->
600
601 jkl
602 !! result
603 <p>asdf
604 </p><p>jkl
605 </p>
606 !! end
607
608 !! test
609 Comment test 3
610 !! input
611 asdf
612 <!-- comment 1 -->
613 <!-- comment 2 -->
614 jkl
615 !! result
616 <p>asdf
617 jkl
618 </p>
619 !! end
620
621 !! test
622 Comment test 4
623 !! input
624 asdf<!-- comment 1 -->jkl
625 !! result
626 <p>asdfjkl
627 </p>
628 !! end
629
630 !! test
631 Comment spacing
632 !! input
633 a
634 <!-- foo --> b <!-- bar -->
635 c
636 !! result
637 <p>a
638 </p>
639 <pre> b
640 </pre>
641 <p>c
642 </p>
643 !! end
644
645 !! test
646 Comment whitespace
647 !! input
648 <!-- returns a single newline, not nothing, since the newline after > is not stripped -->
649 !! result
650
651 !! end
652
653 !! test
654 Comment semantics and delimiters
655 !! input
656 <!-- --><!----><!-----><!------>
657 !! result
658
659 !! end
660
661 !! test
662 Comment semantics and delimiters, redux
663 !! input
664 <!-- In SGML every "foo" here would actually show up in the text -- foo -- bar
665 -- foo -- funky huh? ... -->
666 !! result
667
668 !! end
669
670 !! test
671 Comment semantics and delimiters: directors cut
672 !! input
673 <!-- ... However we like to keep things simple and somewhat XML-ish so we eat
674 everything starting with < followed by !-- until the first -- and > we see,
675 that wouldn't be valid XML however, since in XML -- has to terminate a comment
676 -->-->
677 !! result
678 <p>--&gt;
679 </p>
680 !! end
681
682 !! test
683 Comment semantics: nesting
684 !! input
685 <!--<!-- no, we're not going to do anything fancy here -->-->
686 !! result
687 <p>--&gt;
688 </p>
689 !! end
690
691 !! test
692 Comment semantics: unclosed comment at end
693 !! input
694 <!--This comment will run out to the end of the document
695 !! result
696
697 !! end
698
699 !! test
700 Comment in template title
701 !! input
702 {{f<!---->oo}}
703 !! result
704 <p>FOO
705 </p>
706 !! end
707
708 !! test
709 Comment on its own line post-expand
710 !! input
711 a
712 {{blank}}<!---->
713 b
714 !! result
715 <p>a
716 </p><p>b
717 </p>
718 !! end
719
720 !! test
721 Comment on its own line post-expand with non-significant whitespace
722 !! input
723 a
724 {{blank}} <!---->
725 b
726 !! result
727 <p>a
728 </p><p>b
729 </p>
730 !! end
731
732 ###
733 ### paragraph wraping tests
734 ###
735 !! test
736 No block tags
737 !! input
738 a
739
740 b
741 !! result
742 <p>a
743 </p><p>b
744 </p>
745 !! end
746 !! test
747 Block tag on one line
748 !! input
749 a <div>foo</div>
750
751 b
752 !! result
753 a <div>foo</div>
754 <p>b
755 </p>
756 !! end
757
758 !! test
759 Block tag on both lines
760 !! input
761 a <div>foo</div>
762
763 b <div>foo</div>
764 !! result
765 a <div>foo</div>
766 b <div>foo</div>
767
768 !! end
769
770 !! test
771 Multiple lines without block tags
772 !! input
773 <div>foo</div> a
774 b
775 c
776 d<!--foo--> e
777 x <div>foo</div> z
778 !! result
779 <div>foo</div> a
780 <p>b
781 c
782 d e
783 </p>
784 x <div>foo</div> z
785
786 !! end
787
788 ###
789 ### Preformatted text
790 ###
791 !! test
792 Preformatted text
793 !! input
794 This is some
795 Preformatted text
796 With ''italic''
797 And '''bold'''
798 And a [[Main Page|link]]
799 !! result
800 <pre>This is some
801 Preformatted text
802 With <i>italic</i>
803 And <b>bold</b>
804 And a <a href="/wiki/Main_Page" title="Main Page">link</a>
805 </pre>
806 !! end
807
808 !! test
809 Ident preformatting with inline content
810 !! input
811 a
812 ''b''
813 !! result
814 <pre>a
815 <i>b</i>
816 </pre>
817 !! end
818
819 !! test
820 <pre> with <nowiki> inside (compatibility with 1.6 and earlier)
821 !! input
822 <pre><nowiki>
823 <b>
824 <cite>
825 <em>
826 </nowiki></pre>
827 !! result
828 <pre>
829 &lt;b&gt;
830 &lt;cite&gt;
831 &lt;em&gt;
832 </pre>
833
834 !! end
835
836 !! test
837 Regression with preformatted in <center>
838 !! input
839 <center>
840 Blah
841 </center>
842 !! result
843 <center>
844 <pre>Blah
845 </pre>
846 </center>
847
848 !! end
849
850 # Expected output in the following test is not really expected (there should be
851 # <pre> in the output) -- it's only testing for well-formedness.
852 !! test
853 Bug 6200: Preformatted in <blockquote>
854 !! input
855 <blockquote>
856 Blah
857 </blockquote>
858 !! result
859 <blockquote>
860 Blah
861 </blockquote>
862
863 !! end
864
865 !! test
866 <pre> with attributes (bug 3202)
867 !! input
868 <pre style="background: blue; color:white">Bluescreen of WikiDeath</pre>
869 !! result
870 <pre style="background: blue; color:white">Bluescreen of WikiDeath</pre>
871
872 !! end
873
874 !! test
875 <pre> with width attribute (bug 3202)
876 !! input
877 <pre width="8">Narrow screen goodies</pre>
878 !! result
879 <pre width="8">Narrow screen goodies</pre>
880
881 !! end
882
883 !! test
884 <pre> with forbidden attribute (bug 3202)
885 !! input
886 <pre width="8" onmouseover="alert(document.cookie)">Narrow screen goodies</pre>
887 !! result
888 <pre width="8">Narrow screen goodies</pre>
889
890 !! end
891
892 !! test
893 <pre> with forbidden attribute values (bug 3202)
894 !! input
895 <pre width="8" style="border-width: expression(alert(document.cookie))">Narrow screen goodies</pre>
896 !! result
897 <pre width="8" style="/* insecure input */">Narrow screen goodies</pre>
898
899 !! end
900
901 !! test
902 <nowiki> inside <pre> (bug 13238)
903 !! input
904 <pre>
905 <nowiki>
906 </pre>
907 <pre>
908 <nowiki></nowiki>
909 </pre>
910 <pre><nowiki><nowiki></nowiki>Foo<nowiki></nowiki></nowiki></pre>
911 !! result
912 <pre>
913 &lt;nowiki&gt;
914 </pre>
915 <pre>
916
917 </pre>
918 <pre>&lt;nowiki&gt;Foo&lt;/nowiki&gt;</pre>
919
920 !! end
921
922 !! test
923 <nowiki> and <pre> preference (first one wins)
924 !! input
925 <pre>
926 <nowiki>
927 </pre>
928 </nowiki>
929 </pre>
930
931 <nowiki>
932 <pre>
933 <nowiki>
934 </pre>
935 </nowiki>
936 </pre>
937
938 !! result
939 <pre>
940 &lt;nowiki&gt;
941 </pre>
942 <p>&lt;/nowiki&gt;
943 &lt;/pre&gt;
944 </p><p>
945 &lt;pre&gt;
946 &lt;nowiki&gt;
947 &lt;/pre&gt;
948
949 &lt;/pre&gt;
950 </p>
951 !! end
952
953 !! test
954 </pre> inside nowiki
955 !! input
956 <nowiki></pre></nowiki>
957 !! result
958 <p>&lt;/pre&gt;
959 </p>
960 !! end
961
962 !!test
963 Templates: Indent-Pre: 1a. Templates that break a line should suppress <pre>
964 !!input
965 {{echo|}}
966 !!result
967
968 !!end
969
970 !!test
971 Templates: Indent-Pre: 1b. Templates that break a line should suppress <pre>
972 !!input
973 {{echo|
974 foo}}
975 !!result
976 <p>foo
977 </p>
978 !!end
979
980 !! test
981 Templates: Indent-Pre: 1c: Wrapping should be based on expanded content
982 !! input
983 {{echo|a
984 b}}
985 !!result
986 <pre>a
987 </pre>
988 <p>b
989 </p>
990 !!end
991
992 !! test
993 Templates: Indent-Pre: 1d: Wrapping should be based on expanded content
994 !! input
995 {{echo|a
996 b
997 c
998 d
999 e
1000 }}
1001 !!result
1002 <pre>a
1003 </pre>
1004 <p>b
1005 c
1006 </p>
1007 <pre>d
1008 </pre>
1009 <p>e
1010 </p>
1011 !!end
1012
1013 !!test
1014 Templates: Indent-Pre: 1e. Wrapping should be based on expanded content
1015 !!input
1016 {{echo| foo}}
1017
1018 {{echo| foo}}{{echo| bar}}
1019
1020 {{echo| foo}}
1021 {{echo| bar}}
1022
1023 {{echo|<!--cmt--> foo}}
1024
1025 <!--cmt-->{{echo| foo}}
1026
1027 {{echo|{{echo| }}bar}}
1028 !!result
1029 <pre>foo
1030 </pre>
1031 <pre>foo bar
1032 </pre>
1033 <pre>foo
1034 bar
1035 </pre>
1036 <pre>foo
1037 </pre>
1038 <pre>foo
1039 </pre>
1040 <pre>bar
1041 </pre>
1042 !!end
1043
1044 !! test
1045 Templates: Indent-Pre: 1f: Wrapping should be based on expanded content
1046 !! input
1047 {{echo| }}a
1048
1049 {{echo|
1050 }}a
1051
1052 {{echo|
1053 b}}
1054
1055 {{echo|a
1056 }}b
1057
1058 {{echo|a
1059 }} b
1060 !!result
1061 <pre>a
1062 </pre>
1063 <p><br />
1064 </p>
1065 <pre>a
1066 </pre>
1067 <p><br />
1068 </p>
1069 <pre>b
1070 </pre>
1071 <p>a
1072 </p>
1073 <pre>b
1074 </pre>
1075 <p>a
1076 </p>
1077 <pre>b
1078 </pre>
1079 !!end
1080
1081 !! test
1082 Templates: Single-line variant of parameter whitespace stripping test
1083 !! input
1084 {{echo| a}}
1085
1086 {{echo|1= a}}
1087
1088 {{echo|{{echo| a}}}}
1089
1090 {{echo|1={{echo| a}}}}
1091 !! result
1092 <pre>a
1093 </pre>
1094 <p>a
1095 </p>
1096 <pre>a
1097 </pre>
1098 <p>a
1099 </p>
1100 !! end
1101
1102 !! test
1103 Templates: Strip whitespace from named parameters, but not positional ones
1104 !! input
1105 {{echo|
1106 foo}}
1107
1108 {{echo|
1109 * foo}}
1110
1111 {{echo| 1 =
1112 foo}}
1113
1114 {{echo| 1 =
1115 * foo}}
1116 !! result
1117 <pre>foo
1118 </pre>
1119 <p><br />
1120 </p>
1121 <ul><li> foo
1122 </li></ul>
1123 <p>foo
1124 </p>
1125 <ul><li> foo
1126 </li></ul>
1127
1128 !! end
1129
1130 ###
1131 ### Parsoid-centric tests for testing RT edge cases for pre
1132 ###
1133
1134 !!test
1135 1a. Indent-Pre and Comments
1136 !!input
1137 a
1138 <!--a-->
1139 c
1140 !!result
1141 <pre>a
1142 </pre>
1143 <p>c
1144 </p>
1145 !!end
1146
1147 !!test
1148 1b. Indent-Pre and Comments
1149 !!input
1150 a
1151 <!--a-->
1152 c
1153 !!result
1154 <pre>a
1155 </pre>
1156 <p>c
1157 </p>
1158 !!end
1159
1160 !!test
1161 1c. Indent-Pre and Comments
1162 !!input
1163 <!--a--> a
1164
1165 <!--a--> a
1166 !!result
1167 <pre> a
1168 </pre>
1169 <pre> a
1170 </pre>
1171 !!end
1172
1173 !!test
1174 2a. Indent-Pre and tables
1175 !!input
1176 {|
1177 |-
1178 !h1!!h2
1179 |foo||bar
1180 |}
1181 !!result
1182 <table>
1183
1184 <tr>
1185 <th>h1</th>
1186 <th>h2
1187 </th>
1188 <td>foo</td>
1189 <td>bar
1190 </td></tr></table>
1191
1192 !!end
1193
1194 !!test
1195 2b. Indent-Pre and tables
1196 !!input
1197 {|
1198 |-
1199 |foo
1200 |}
1201 !!result
1202 <table>
1203
1204 <tr>
1205 <td>foo
1206 </td></tr></table>
1207
1208 !!end
1209
1210 !!test
1211 3a. Indent-Pre and block tags (single-line html)
1212 !!input
1213 <p> foo </p>
1214 <div> foo </div>
1215 <span> foo </span>
1216 !!result
1217 <p> foo </p>
1218 <div> foo </div>
1219 <pre><span> foo </span>
1220 </pre>
1221 !!end
1222
1223 !!test
1224 3b. Indent-Pre and block tags (pre-content on separate line)
1225 !!input
1226 <p>
1227 foo
1228 </p>
1229
1230 <div>
1231 foo
1232 </div>
1233
1234 <center>
1235 foo
1236 </center>
1237
1238 <blockquote>
1239 foo
1240 </blockquote>
1241
1242 <table><tr><td>
1243 foo
1244 </td></tr></table>
1245
1246 <ul><li>
1247 foo
1248 </li></ul>
1249
1250 !!result
1251 <p>
1252 foo
1253 </p>
1254 <div>
1255 <pre>foo
1256 </pre>
1257 </div>
1258 <center>
1259 <pre>foo
1260 </pre>
1261 </center>
1262 <blockquote>
1263 foo
1264 </blockquote>
1265 <table><tr><td>
1266 <pre>foo
1267 </pre>
1268 </td></tr></table>
1269 <ul><li>
1270 foo
1271 </li></ul>
1272
1273 !!end
1274
1275 !!test
1276 4. Multiple spaces at start-of-line
1277 !!input
1278 <p> foo </p>
1279 foo
1280 {|
1281 |foo
1282 |}
1283 !!result
1284 <p> foo </p>
1285 <pre> foo
1286 </pre>
1287 <table>
1288 <tr>
1289 <td>foo
1290 </td></tr></table>
1291
1292 !!end
1293
1294 ###
1295 ### HTML-pre (some to spec PHP parser behavior and some Parsoid-RT-centric)
1296 ###
1297
1298 !!test
1299 HTML-pre: 1. embedded newlines
1300 !!input
1301 <pre>foo</pre>
1302
1303 <pre>
1304 foo
1305 </pre>
1306
1307 <pre>
1308
1309 foo
1310 </pre>
1311
1312 <pre>
1313
1314
1315 foo
1316 </pre>
1317 !!result
1318 <pre>foo</pre>
1319 <pre>
1320 foo
1321 </pre>
1322 <pre>
1323
1324 foo
1325 </pre>
1326 <pre>
1327
1328
1329 foo
1330 </pre>
1331
1332 !!end
1333
1334 !!test
1335 HTML-pre: 2: indented text
1336 !!input
1337 <pre>
1338 foo
1339 </pre>
1340 !!result
1341 <pre>
1342 foo
1343 </pre>
1344
1345 !!end
1346
1347 !!test
1348 HTML-pre: 3: other wikitext
1349 !!input
1350 <pre>
1351 * foo
1352 # bar
1353 = no-h =
1354 '' no-italic ''
1355 [[ NoLink ]]
1356 </pre>
1357 !!result
1358 <pre>
1359 * foo
1360 # bar
1361 = no-h =
1362 '' no-italic ''
1363 [[ NoLink ]]
1364 </pre>
1365
1366 !!end
1367
1368 ###
1369 ### Definition lists
1370 ###
1371 !! test
1372 Simple definition
1373 !! input
1374 ; name : Definition
1375 !! result
1376 <dl><dt> name&#160;</dt><dd> Definition
1377 </dd></dl>
1378
1379 !! end
1380
1381 !! test
1382 Definition list for indentation only
1383 !! input
1384 : Indented text
1385 !! result
1386 <dl><dd> Indented text
1387 </dd></dl>
1388
1389 !! end
1390
1391 !! test
1392 Definition list with no space
1393 !! input
1394 ;name:Definition
1395 !! result
1396 <dl><dt>name</dt><dd>Definition
1397 </dd></dl>
1398
1399 !!end
1400
1401 !! test
1402 Definition list with URL link
1403 !! input
1404 ; http://example.com/ : definition
1405 !! result
1406 <dl><dt> <a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&#160;</dt><dd> definition
1407 </dd></dl>
1408
1409 !! end
1410
1411 !! test
1412 Definition list with bracketed URL link
1413 !! input
1414 ;[http://www.example.com/ Example]:Something about it
1415 !! result
1416 <dl><dt><a rel="nofollow" class="external text" href="http://www.example.com/">Example</a></dt><dd>Something about it
1417 </dd></dl>
1418
1419 !! end
1420
1421 !! test
1422 Definition list with wikilink containing colon
1423 !! input
1424 ; [[Help:FAQ]]: The least-read page on Wikipedia
1425 !! result
1426 <dl><dt> <a href="/index.php?title=Help:FAQ&amp;action=edit&amp;redlink=1" class="new" title="Help:FAQ (page does not exist)">Help:FAQ</a></dt><dd> The least-read page on Wikipedia
1427 </dd></dl>
1428
1429 !! end
1430
1431 # At Brion's and JeLuF's insistence... :)
1432 !! test
1433 Definition list with news link containing colon
1434 !! input
1435 ; news:alt.wikipedia.rox: This isn't even a real newsgroup!
1436 !! result
1437 <dl><dt> <a rel="nofollow" class="external free" href="news:alt.wikipedia.rox">news:alt.wikipedia.rox</a></dt><dd> This isn't even a real newsgroup!
1438 </dd></dl>
1439
1440 !! end
1441
1442 !! test
1443 Malformed definition list with colon
1444 !! input
1445 ; news:alt.wikipedia.rox -- don't crash or enter an infinite loop
1446 !! result
1447 <dl><dt> <a rel="nofollow" class="external free" href="news:alt.wikipedia.rox">news:alt.wikipedia.rox</a> -- don't crash or enter an infinite loop
1448 </dt></dl>
1449
1450 !! end
1451
1452 !! test
1453 Definition lists: colon in external link text
1454 !! input
1455 ; [http://www.wikipedia2.org/ Wikipedia : The Next Generation]: OK, I made that up
1456 !! result
1457 <dl><dt> <a rel="nofollow" class="external text" href="http://www.wikipedia2.org/">Wikipedia&#160;: The Next Generation</a></dt><dd> OK, I made that up
1458 </dd></dl>
1459
1460 !! end
1461
1462 !! test
1463 Definition lists: colon in HTML attribute
1464 !! input
1465 ;<b style="display: inline">bold</b>
1466 !! result
1467 <dl><dt><b style="display: inline">bold</b>
1468 </dt></dl>
1469
1470 !! end
1471
1472 !! test
1473 Definition lists: self-closed tag
1474 !! input
1475 ;one<br/>two : two-line fun
1476 !! result
1477 <dl><dt>one<br />two&#160;</dt><dd> two-line fun
1478 </dd></dl>
1479
1480 !! end
1481
1482 !! test
1483 Bug 11748: Literal closing tags
1484 !! input
1485 <dl>
1486 <dt>test 1</dt>
1487 <dd>test test test test test</dd>
1488 <dt>test 2</dt>
1489 <dd>test test test test test</dd>
1490 </dl>
1491 !! result
1492 <dl>
1493 <dt>test 1</dt>
1494 <dd>test test test test test</dd>
1495 <dt>test 2</dt>
1496 <dd>test test test test test</dd>
1497 </dl>
1498
1499 !! end
1500
1501 !! test
1502 Definition and unordered list using wiki syntax nested in unordered list using html tags.
1503 !! input
1504 <ul><li>
1505 ; term : description
1506 * unordered
1507 </li>
1508 </ul>
1509 !! result
1510 <ul><li>
1511 <dl><dt> term&#160;</dt><dd> description
1512 </dd></dl>
1513 <ul><li> unordered
1514 </li></ul>
1515 </li>
1516 </ul>
1517
1518 !! end
1519
1520 !! test
1521
1522 Definition list with empty definition and following paragraph
1523 !! input
1524 ; term:
1525 Paragraph text
1526 !! result
1527 <dl><dt> term</dt><dd>
1528 </dd></dl>
1529 <p>Paragraph text
1530 </p>
1531 !! end
1532
1533 !! test
1534 Nested definition lists using html syntax
1535 !! input
1536 <dl><dd>
1537 <dl>
1538 <dd>Foo</dd>
1539 </dl>
1540 </dd></dl>
1541 !! result
1542 <dl><dd>
1543 <dl>
1544 <dd>Foo</dd>
1545 </dl>
1546 </dd></dl>
1547
1548 !! end
1549
1550 !! test
1551 Definition Lists: No nesting: Multiple dd's
1552 !! input
1553 ;x
1554 :a
1555 :b
1556 !! result
1557 <dl><dt>x
1558 </dt><dd>a
1559 </dd><dd>b
1560 </dd></dl>
1561
1562 !! end
1563
1564 !! test
1565 Definition Lists: Indentation: Regular
1566 !! input
1567 :i1
1568 ::i2
1569 :::i3
1570 !! result
1571 <dl><dd>i1
1572 <dl><dd>i2
1573 <dl><dd>i3
1574 </dd></dl>
1575 </dd></dl>
1576 </dd></dl>
1577
1578 !! end
1579
1580 !! test
1581 Definition Lists: Indentation: Missing 1st level
1582 !! input
1583 ::i2
1584 :::i3
1585 !! result
1586 <dl><dd><dl><dd>i2
1587 <dl><dd>i3
1588 </dd></dl>
1589 </dd></dl>
1590 </dd></dl>
1591
1592 !! end
1593
1594 !! test
1595 Definition Lists: Indentation: Multi-level indent
1596 !! input
1597 :::i3
1598 !! result
1599 <dl><dd><dl><dd><dl><dd>i3
1600 </dd></dl>
1601 </dd></dl>
1602 </dd></dl>
1603
1604 !! end
1605
1606 !! test
1607 Definition Lists: Hacky use to indent tables
1608 !! input
1609 ::{|
1610 |foo
1611 |bar
1612 |}
1613 this text
1614 should be left alone
1615 !! result
1616 <dl><dd><dl><dd><table>
1617 <tr>
1618 <td>foo
1619 </td>
1620 <td>bar
1621 </td></tr></table></dd></dl></dd></dl>
1622 <p>this text
1623 should be left alone
1624 </p>
1625 !! end
1626 ## The PHP parser treats : items (dd) without a corresponding ; item (dt)
1627 ## as an empty dt item. It also ignores all but the last ";" when followed
1628 ## by ":" later on. So, ";" are not ignored in ";;;t3" but are ignored in
1629 ## ";;;t3 :d1". So, PHP parser behavior is a little inconsistent wrt multiple
1630 ## ";"s.
1631 ##
1632 ## Ex: ";;t2 ::d2" is transformed into:
1633 ##
1634 ## <dl>
1635 ## <dt>t2 </dt>
1636 ## <dd>
1637 ## <dl>
1638 ## <dt></dt>
1639 ## <dd>d2</dd>
1640 ## </dl>
1641 ## </dd>
1642 ## </dl>
1643 ##
1644 ## But, Parsoid treats "; :" as a tight atomic unit and excess ":" as plain text
1645 ## So, the same wikitext above (;;t2 ::d2) is transformed into:
1646 ##
1647 ## <dl>
1648 ## <dt>
1649 ## <dl>
1650 ## <dt>t2 </dt>
1651 ## <dd>:d2</dd>
1652 ## </dl>
1653 ## </dt>
1654 ## </dl>
1655 ##
1656 ## All Parsoid only definition list tests have this difference.
1657 ##
1658 ## See also: https://bugzilla.wikimedia.org/show_bug.cgi?id=6569
1659 ## and http://lists.wikimedia.org/pipermail/wikitext-l/2011-November/000483.html
1660
1661 !! test
1662 Table / list interaction: indented table with lists in table contents
1663 !! input
1664 :{|
1665 |-
1666 | a
1667 * b
1668 |-
1669 | c
1670 * d
1671 |}
1672 !! result
1673 <dl><dd><table>
1674
1675 <tr>
1676 <td> a
1677 <ul><li> b
1678 </li></ul>
1679 </td></tr>
1680 <tr>
1681 <td> c
1682 <ul><li> d
1683 </li></ul>
1684 </td></tr></table></dd></dl>
1685
1686 !! end
1687
1688 !!test
1689 Table / list interaction: lists nested in tables nested in indented lists
1690 !!input
1691 :{|
1692 |
1693 :a
1694 :b
1695 |
1696 *c
1697 *d
1698 |}
1699
1700 *e
1701 *f
1702 !!result
1703 <dl><dd><table>
1704 <tr>
1705 <td>
1706 <dl><dd>a
1707 </dd><dd>b
1708 </dd></dl>
1709 </td>
1710 <td>
1711 <ul><li>c
1712 </li><li>d
1713 </li></ul>
1714 </td></tr></table></dd></dl>
1715 <ul><li>e
1716 </li><li>f
1717 </li></ul>
1718
1719 !!end
1720
1721 !! test
1722 Definition Lists: Nesting: Multi-level (Parsoid only)
1723 !! options
1724 disabled
1725 !! input
1726 ;t1 :d1
1727 ;;t2 ::d2
1728 ;;;t3 :::d3
1729 !! result
1730 <dl>
1731 <dt>t1 </dt>
1732 <dd>d1</dd>
1733 <dt>
1734 <dl>
1735 <dt>t2 </dt>
1736 <dd>:d2</dd>
1737 <dt>
1738 <dl>
1739 <dt>t3 </dt>
1740 <dd>::d3</dd>
1741 </dl>
1742 </dt>
1743 </dl>
1744 </dt>
1745 </dl>
1746
1747
1748 !! end
1749
1750
1751 !! test
1752 Definition Lists: Nesting: Test 2 (Parsoid only)
1753 !! options
1754 disabled
1755 !! input
1756 ;t1
1757 ::d2
1758 !! result
1759 <dl>
1760 <dt>t1</dt>
1761 <dd>
1762 <dl>
1763 <dd>d2</dd>
1764 </dl>
1765 </dd>
1766 </dl>
1767
1768 !! end
1769
1770
1771 !! test
1772 Definition Lists: Nesting: Test 3 (Parsoid only)
1773 !! options
1774 disabled
1775 !! input
1776 :;t1
1777 ::::d2
1778 !! result
1779 <dl>
1780 <dd>
1781 <dl>
1782 <dt>t1</dt>
1783 <dd>
1784 <dl>
1785 <dd>
1786 <dl>
1787 <dd>d2</dd>
1788 </dl>
1789 </dd>
1790 </dl>
1791 </dd>
1792 </dl>
1793 </dd>
1794 </dl>
1795
1796 !! end
1797
1798
1799 !! test
1800 Definition Lists: Nesting: Test 4
1801 !! input
1802 ::;t3
1803 :::d3
1804 !! result
1805 <dl><dd><dl><dd><dl><dt>t3
1806 </dt><dd>d3
1807 </dd></dl>
1808 </dd></dl>
1809 </dd></dl>
1810
1811 !! end
1812
1813
1814 !! test
1815 Definition Lists: Mixed Lists: Test 1
1816 !! input
1817 :;* foo
1818 ::* bar
1819 :; baz
1820 !! result
1821 <dl><dd><dl><dt><ul><li> foo
1822 </li><li> bar
1823 </li></ul>
1824 </dt></dl>
1825 <dl><dt> baz
1826 </dt></dl>
1827 </dd></dl>
1828
1829 !! end
1830
1831
1832 !! test
1833 Definition Lists: Mixed Lists: Test 2
1834 !! input
1835 *: d1
1836 *: d2
1837 !! result
1838 <ul><li><dl><dd> d1
1839 </dd><dd> d2
1840 </dd></dl>
1841 </li></ul>
1842
1843 !! end
1844
1845
1846 !! test
1847 Definition Lists: Mixed Lists: Test 3
1848 !! input
1849 *::: d1
1850 *::: d2
1851 !! result
1852 <ul><li><dl><dd><dl><dd><dl><dd> d1
1853 </dd><dd> d2
1854 </dd></dl>
1855 </dd></dl>
1856 </dd></dl>
1857 </li></ul>
1858
1859 !! end
1860
1861
1862 !! test
1863 Definition Lists: Mixed Lists: Test 4
1864 !! input
1865 *;d1 :d2
1866 *;d3 :d4
1867 !! result
1868 <ul><li><dl><dt>d1&#160;</dt><dd>d2
1869 </dd><dt>d3&#160;</dt><dd>d4
1870 </dd></dl>
1871 </li></ul>
1872
1873 !! end
1874
1875
1876 !! test
1877 Definition Lists: Mixed Lists: Test 5
1878 !! input
1879 *:d1
1880 *:: d2
1881 !! result
1882 <ul><li><dl><dd>d1
1883 <dl><dd> d2
1884 </dd></dl>
1885 </dd></dl>
1886 </li></ul>
1887
1888 !! end
1889
1890
1891 !! test
1892 Definition Lists: Mixed Lists: Test 6
1893 !! input
1894 #*:d1
1895 #*::: d3
1896 !! result
1897 <ol><li><ul><li><dl><dd>d1
1898 <dl><dd><dl><dd> d3
1899 </dd></dl>
1900 </dd></dl>
1901 </dd></dl>
1902 </li></ul>
1903 </li></ol>
1904
1905 !! end
1906
1907
1908 !! test
1909 Definition Lists: Mixed Lists: Test 7
1910 !! input
1911 :* d1
1912 :* d2
1913 !! result
1914 <dl><dd><ul><li> d1
1915 </li><li> d2
1916 </li></ul>
1917 </dd></dl>
1918
1919 !! end
1920
1921
1922 !! test
1923 Definition Lists: Mixed Lists: Test 8
1924 !! input
1925 :* d1
1926 ::* d2
1927 !! result
1928 <dl><dd><ul><li> d1
1929 </li></ul>
1930 <dl><dd><ul><li> d2
1931 </li></ul>
1932 </dd></dl>
1933 </dd></dl>
1934
1935 !! end
1936
1937
1938 !! test
1939 Definition Lists: Mixed Lists: Test 9
1940 !! input
1941 *;foo :bar
1942 !! result
1943 <ul><li><dl><dt>foo&#160;</dt><dd>bar
1944 </dd></dl>
1945 </li></ul>
1946
1947 !! end
1948
1949
1950 !! test
1951 Definition Lists: Mixed Lists: Test 10
1952 !! input
1953 *#;foo :bar
1954 !! result
1955 <ul><li><ol><li><dl><dt>foo&#160;</dt><dd>bar
1956 </dd></dl>
1957 </li></ol>
1958 </li></ul>
1959
1960 !! end
1961
1962
1963 !! test
1964 Definition Lists: Mixed Lists: Test 11
1965 !! input
1966 *#*#;*;;foo :bar
1967 *#*#;boo :baz
1968 !! result
1969 <ul><li><ol><li><ul><li><ol><li><dl><dt>foo&#160;</dt><dd><ul><li><dl><dt><dl><dt>bar
1970 </dt></dl>
1971 </dd></dl>
1972 </li></ul>
1973 </dd></dl>
1974 <dl><dt>boo&#160;</dt><dd>baz
1975 </dd></dl>
1976 </li></ol>
1977 </li></ul>
1978 </li></ol>
1979 </li></ul>
1980
1981 !! end
1982
1983
1984 !! test
1985 Definition Lists: Weird Ones: Test 1
1986 !! input
1987 *#;*::;; foo : bar (who uses this?)
1988 !! result
1989 <ul><li><ol><li><dl><dt> foo&#160;</dt><dd><ul><li><dl><dd><dl><dd><dl><dt><dl><dt> bar (who uses this?)
1990 </dt></dl>
1991 </dd></dl>
1992 </dd></dl>
1993 </dd></dl>
1994 </li></ul>
1995 </dd></dl>
1996 </li></ol>
1997 </li></ul>
1998
1999 !! end
2000
2001 ###
2002 ### External links
2003 ###
2004 !! test
2005 External links: non-bracketed
2006 !! input
2007 Non-bracketed: http://example.com
2008 !! result
2009 <p>Non-bracketed: <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
2010 </p>
2011 !! end
2012
2013 !! test
2014 External links: numbered
2015 !! input
2016 Numbered: [http://example.com]
2017 Numbered: [http://example.net]
2018 Numbered: [http://example.com]
2019 !! result
2020 <p>Numbered: <a rel="nofollow" class="external autonumber" href="http://example.com">[1]</a>
2021 Numbered: <a rel="nofollow" class="external autonumber" href="http://example.net">[2]</a>
2022 Numbered: <a rel="nofollow" class="external autonumber" href="http://example.com">[3]</a>
2023 </p>
2024 !!end
2025
2026 !! test
2027 External links: specified text
2028 !! input
2029 Specified text: [http://example.com link]
2030 !! result
2031 <p>Specified text: <a rel="nofollow" class="external text" href="http://example.com">link</a>
2032 </p>
2033 !!end
2034
2035 !! test
2036 External links: trail
2037 !! input
2038 Linktrails should not work for external links: [http://example.com link]s
2039 !! result
2040 <p>Linktrails should not work for external links: <a rel="nofollow" class="external text" href="http://example.com">link</a>s
2041 </p>
2042 !! end
2043
2044 !! test
2045 External links: dollar sign in URL
2046 !! input
2047 http://example.com/1$2345
2048 !! result
2049 <p><a rel="nofollow" class="external free" href="http://example.com/1$2345">http://example.com/1$2345</a>
2050 </p>
2051 !! end
2052
2053 !! test
2054 External links: dollar sign in URL (named)
2055 !! input
2056 [http://example.com/1$2345]
2057 !! result
2058 <p><a rel="nofollow" class="external autonumber" href="http://example.com/1$2345">[1]</a>
2059 </p>
2060 !!end
2061
2062 !! test
2063 External links: open square bracket forbidden in URL (bug 4377)
2064 !! input
2065 http://example.com/1[2345
2066 !! result
2067 <p><a rel="nofollow" class="external free" href="http://example.com/1">http://example.com/1</a>[2345
2068 </p>
2069 !! end
2070
2071 !! test
2072 External links: open square bracket forbidden in URL (named) (bug 4377)
2073 !! input
2074 [http://example.com/1[2345]
2075 !! result
2076 <p><a rel="nofollow" class="external text" href="http://example.com/1">[2345</a>
2077 </p>
2078 !!end
2079
2080 !! test
2081 External links: nowiki in URL link text (bug 6230)
2082 !!input
2083 [http://example.com/ <nowiki>''example site''</nowiki>]
2084 !! result
2085 <p><a rel="nofollow" class="external text" href="http://example.com/">''example site''</a>
2086 </p>
2087 !! end
2088
2089 !! test
2090 External links: newline forbidden in text (bug 6230 regression check)
2091 !! input
2092 [http://example.com/ first
2093 second]
2094 !! result
2095 <p>[<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a> first
2096 second]
2097 </p>
2098 !!end
2099
2100 !! test
2101 External links: Pipe char between url and text
2102 !! input
2103 [http://example.com | link]
2104 !! result
2105 <p><a rel="nofollow" class="external text" href="http://example.com">| link</a>
2106 </p>
2107 !!end
2108
2109 !! test
2110 External links: protocol-relative URL in brackets
2111 !! input
2112 [//example.com/ Test]
2113 !! result
2114 <p><a rel="nofollow" class="external text" href="//example.com/">Test</a>
2115 </p>
2116 !! end
2117
2118 !! test
2119 External links: protocol-relative URL in brackets without text
2120 !! input
2121 [//example.com]
2122 !! result
2123 <p><a rel="nofollow" class="external autonumber" href="//example.com">[1]</a>
2124 </p>
2125 !! end
2126
2127 !! test
2128 External links: protocol-relative URL in free text is left alone
2129 !! input
2130 //example.com/Foo
2131 !! result
2132 <p>//example.com/Foo
2133 </p>
2134 !!end
2135
2136 !! test
2137 External links: protocol-relative URL in the middle of a word is left alone (bug 30269)
2138 !! input
2139 foo//example.com/Foo
2140 !! result
2141 <p>foo//example.com/Foo
2142 </p>
2143 !! end
2144
2145 !! test
2146 External image
2147 !! input
2148 External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
2149 !! result
2150 <p>External image: <img src="http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" />
2151 </p>
2152 !! end
2153
2154 !! test
2155 External image from https
2156 !! input
2157 External image from https: https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
2158 !! result
2159 <p>External image from https: <img src="https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" />
2160 </p>
2161 !! end
2162
2163 !! test
2164 Link to non-http image, no img tag
2165 !! input
2166 Link to non-http image, no img tag: ftp://example.com/test.jpg
2167 !! result
2168 <p>Link to non-http image, no img tag: <a rel="nofollow" class="external free" href="ftp://example.com/test.jpg">ftp://example.com/test.jpg</a>
2169 </p>
2170 !! end
2171
2172 !! test
2173 External links: terminating separator
2174 !! input
2175 Terminating separator: http://example.com/thing,
2176 !! result
2177 <p>Terminating separator: <a rel="nofollow" class="external free" href="http://example.com/thing">http://example.com/thing</a>,
2178 </p>
2179 !! end
2180
2181 !! test
2182 External links: intervening separator
2183 !! input
2184 Intervening separator: http://example.com/1,2,3
2185 !! result
2186 <p>Intervening separator: <a rel="nofollow" class="external free" href="http://example.com/1,2,3">http://example.com/1,2,3</a>
2187 </p>
2188 !! end
2189
2190 !! test
2191 External links: old bug with URL in query
2192 !! input
2193 Old bug with URL in query: [http://example.com/thing?url=http://example.com link]
2194 !! result
2195 <p>Old bug with URL in query: <a rel="nofollow" class="external text" href="http://example.com/thing?url=http://example.com">link</a>
2196 </p>
2197 !! end
2198
2199 !! test
2200 External links: old URL-in-URL bug, mixed protocols
2201 !! input
2202 And again with mixed protocols: [ftp://example.com?url=http://example.com link]
2203 !! result
2204 <p>And again with mixed protocols: <a rel="nofollow" class="external text" href="ftp://example.com?url=http://example.com">link</a>
2205 </p>
2206 !!end
2207
2208 !! test
2209 External links: URL in text
2210 !! input
2211 URL in text: [http://example.com http://example.com]
2212 !! result
2213 <p>URL in text: <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
2214 </p>
2215 !! end
2216
2217 !! test
2218 External links: Clickable images
2219 !! input
2220 ja-style clickable images: [http://example.com http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png]
2221 !! result
2222 <p>ja-style clickable images: <a rel="nofollow" class="external text" href="http://example.com"><img src="http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" /></a>
2223 </p>
2224 !!end
2225
2226 !! test
2227 External links: raw ampersand
2228 !! input
2229 Old &amp; use: http://x&y
2230 !! result
2231 <p>Old &amp; use: <a rel="nofollow" class="external free" href="http://x&amp;y">http://x&amp;y</a>
2232 </p>
2233 !! end
2234
2235 !! test
2236 External links: encoded ampersand
2237 !! input
2238 Old &amp; use: http://x&amp;y
2239 !! result
2240 <p>Old &amp; use: <a rel="nofollow" class="external free" href="http://x&amp;y">http://x&amp;y</a>
2241 </p>
2242 !! end
2243
2244 !! test
2245 External links: encoded equals (bug 6102)
2246 !! input
2247 http://example.com/?foo&#61;bar
2248 !! result
2249 <p><a rel="nofollow" class="external free" href="http://example.com/?foo=bar">http://example.com/?foo=bar</a>
2250 </p>
2251 !! end
2252
2253 !! test
2254 External links: [raw ampersand]
2255 !! input
2256 Old &amp; use: [http://x&y]
2257 !! result
2258 <p>Old &amp; use: <a rel="nofollow" class="external autonumber" href="http://x&amp;y">[1]</a>
2259 </p>
2260 !! end
2261
2262 !! test
2263 External links: [encoded ampersand]
2264 !! input
2265 Old &amp; use: [http://x&amp;y]
2266 !! result
2267 <p>Old &amp; use: <a rel="nofollow" class="external autonumber" href="http://x&amp;y">[1]</a>
2268 </p>
2269 !! end
2270
2271 !! test
2272 External links: [encoded equals] (bug 6102)
2273 !! input
2274 [http://example.com/?foo&#61;bar]
2275 !! result
2276 <p><a rel="nofollow" class="external autonumber" href="http://example.com/?foo=bar">[1]</a>
2277 </p>
2278 !! end
2279
2280 !! test
2281 External links: [IDN ignored character reference in hostname; strip it right off]
2282 !! input
2283 [http://e&zwnj;xample.com/]
2284 !! result
2285 <p><a rel="nofollow" class="external autonumber" href="http://example.com/">[1]</a>
2286 </p>
2287 !! end
2288
2289 # FIXME: This test (the IDN characters in the text of a link) is an inconsistency.
2290 # Where an external link could easily circumvent the sanitization of the text of
2291 # a link like this (where an IDN-ignore character is in the URL somewhere), this
2292 # test demands a higher standard. That's a bit strange.
2293 #
2294 # Example:
2295 #
2296 # http://e‌xample.com -> [http://example.com|http://example.com]
2297 # [http://example.com|http://e‌xample.com] -> [http://example.com|http://e‌xample.com]
2298 #
2299 # The first example is sanitized, but the second is not. Any security benefits
2300 # from this production are trivial to circumvent. Either remove this test and
2301 # let the parser(s) do their thing unaccosted, or fix the inconsistency and change
2302 # the test accordingly.
2303 #
2304 # All our love,
2305 # The Parsoid team.
2306 !! test
2307 External links: IDN ignored character reference in hostname; strip it right off
2308 !! input
2309 http://e&zwnj;xample.com/
2310 !! result
2311 <p><a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>
2312 </p>
2313 !! end
2314
2315 !! test
2316 External links: www.jpeg.org (bug 554)
2317 !! input
2318 http://www.jpeg.org
2319 !!result
2320 <p><a rel="nofollow" class="external free" href="http://www.jpeg.org">http://www.jpeg.org</a>
2321 </p>
2322 !! end
2323
2324 !! test
2325 External links: URL within URL (original bug 2)
2326 !! input
2327 [http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp]
2328 !! result
2329 <p><a rel="nofollow" class="external autonumber" href="http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp">[1]</a>
2330 </p>
2331 !! end
2332
2333 !! test
2334 BUG 361: URL inside bracketed URL
2335 !! input
2336 [http://www.example.com/foo http://www.example.com/bar]
2337 !! result
2338 <p><a rel="nofollow" class="external text" href="http://www.example.com/foo">http://www.example.com/bar</a>
2339 </p>
2340 !! end
2341
2342 !! test
2343 BUG 361: URL within URL, not bracketed
2344 !! input
2345 http://www.example.com/foo?=http://www.example.com/bar
2346 !! result
2347 <p><a rel="nofollow" class="external free" href="http://www.example.com/foo?=http://www.example.com/bar">http://www.example.com/foo?=http://www.example.com/bar</a>
2348 </p>
2349 !! end
2350
2351 !! test
2352 BUG 289: ">"-token in URL-tail
2353 !! input
2354 http://www.example.com/<hello>
2355 !! result
2356 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a>&lt;hello&gt;
2357 </p>
2358 !!end
2359
2360 !! test
2361 BUG 289: literal ">"-token in URL-tail
2362 !! input
2363 http://www.example.com/<b>html</b>
2364 !! result
2365 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a><b>html</b>
2366 </p>
2367 !!end
2368
2369 !! test
2370 BUG 289: ">"-token in bracketed URL
2371 !! input
2372 [http://www.example.com/<hello> stuff]
2373 !! result
2374 <p><a rel="nofollow" class="external text" href="http://www.example.com/">&lt;hello&gt; stuff</a>
2375 </p>
2376 !!end
2377
2378 !! test
2379 BUG 289: literal ">"-token in bracketed URL
2380 !! input
2381 [http://www.example.com/<b>html</b> stuff]
2382 !! result
2383 <p><a rel="nofollow" class="external text" href="http://www.example.com/"><b>html</b> stuff</a>
2384 </p>
2385 !!end
2386
2387 !! test
2388 BUG 289: literal double quote at end of URL
2389 !! input
2390 http://www.example.com/"hello"
2391 !! result
2392 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a>"hello"
2393 </p>
2394 !!end
2395
2396 !! test
2397 BUG 289: literal double quote in bracketed URL
2398 !! input
2399 [http://www.example.com/"hello" stuff]
2400 !! result
2401 <p><a rel="nofollow" class="external text" href="http://www.example.com/">"hello" stuff</a>
2402 </p>
2403 !!end
2404
2405 !! test
2406 External links: multiple legal whitespace is fine, Magnus. Don't break it please. (bug 5081)
2407 !! input
2408 [http://www.example.com test]
2409 !! result
2410 <p><a rel="nofollow" class="external text" href="http://www.example.com">test</a>
2411 </p>
2412 !! end
2413
2414 !! test
2415 External links: wiki links within external link (Bug 3695)
2416 !! input
2417 [http://example.com [[wikilink]] embedded in ext link]
2418 !! result
2419 <p><a rel="nofollow" class="external text" href="http://example.com"></a><a href="/index.php?title=Wikilink&amp;action=edit&amp;redlink=1" class="new" title="Wikilink (page does not exist)">wikilink</a><a rel="nofollow" class="external text" href="http://example.com"> embedded in ext link</a>
2420 </p>
2421 !! end
2422
2423 !! test
2424 BUG 787: Links with one slash after the url protocol are invalid
2425 !! input
2426 http:/example.com
2427
2428 [http:/example.com title]
2429 !! result
2430 <p>http:/example.com
2431 </p><p>[http:/example.com title]
2432 </p>
2433 !! end
2434
2435 !! test
2436 Bracketed external links with template-generated invalid target
2437 !! input
2438 [{{echo|http:/example.com}} title]
2439 !! result
2440 <p>[http:/example.com title]
2441 </p>
2442 !! end
2443
2444 !! test
2445 Bug 2702: Mismatched <i>, <b> and <a> tags are invalid
2446 !! input
2447 ''[http://example.com text'']
2448 [http://example.com '''text]'''
2449 ''Something [http://example.com in italic'']
2450 ''Something [http://example.com mixed''''', even bold]'''
2451 '''''Now [http://example.com both''''']
2452 !! result
2453 <p><a rel="nofollow" class="external text" href="http://example.com"><i>text</i></a>
2454 <a rel="nofollow" class="external text" href="http://example.com"><b>text</b></a>
2455 <i>Something </i><a rel="nofollow" class="external text" href="http://example.com"><i>in italic</i></a>
2456 <i>Something </i><a rel="nofollow" class="external text" href="http://example.com"><i>mixed</i><b>, even bold</b></a>
2457 <i><b>Now </b></i><a rel="nofollow" class="external text" href="http://example.com"><i><b>both</b></i></a>
2458 </p>
2459 !! end
2460
2461
2462 !! test
2463 Bug 4781: %26 in URL
2464 !! input
2465 http://www.example.com/?title=AT%26T
2466 !! result
2467 <p><a rel="nofollow" class="external free" href="http://www.example.com/?title=AT%26T">http://www.example.com/?title=AT%26T</a>
2468 </p>
2469 !! end
2470
2471 # According to http://dev.w3.org/html5/spec/Overview.html#parsing-urls a plain
2472 # % is actually legal in HTML5. Any change in output would need testing though.
2473 !! test
2474 Bug 4781, 5267: %25 in URL
2475 !! input
2476 http://www.example.com/?title=100%25_Bran
2477 !! result
2478 <p><a rel="nofollow" class="external free" href="http://www.example.com/?title=100%25_Bran">http://www.example.com/?title=100%25_Bran</a>
2479 </p>
2480 !! end
2481
2482 !! test
2483 Bug 4781, 5267: %28, %29 in URL
2484 !! input
2485 http://www.example.com/?title=Ben-Hur_%281959_film%29
2486 !! result
2487 <p><a rel="nofollow" class="external free" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">http://www.example.com/?title=Ben-Hur_%281959_film%29</a>
2488 </p>
2489 !! end
2490
2491
2492 !! test
2493 Bug 4781: %26 in autonumber URL
2494 !! input
2495 [http://www.example.com/?title=AT%26T]
2496 !! result
2497 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=AT%26T">[1]</a>
2498 </p>
2499 !! end
2500
2501 !! test
2502 Bug 4781, 5267: %26 in autonumber URL
2503 !! input
2504 [http://www.example.com/?title=100%25_Bran]
2505 !! result
2506 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=100%25_Bran">[1]</a>
2507 </p>
2508 !! end
2509
2510 !! test
2511 Bug 4781, 5267: %28, %29 in autonumber URL
2512 !! input
2513 [http://www.example.com/?title=Ben-Hur_%281959_film%29]
2514 !! result
2515 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">[1]</a>
2516 </p>
2517 !! end
2518
2519
2520 !! test
2521 Bug 4781: %26 in bracketed URL
2522 !! input
2523 [http://www.example.com/?title=AT%26T link]
2524 !! result
2525 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=AT%26T">link</a>
2526 </p>
2527 !! end
2528
2529 !! test
2530 Bug 4781, 5267: %26 in bracketed URL
2531 !! input
2532 [http://www.example.com/?title=100%25_Bran link]
2533 !! result
2534 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=100%25_Bran">link</a>
2535 </p>
2536 !! end
2537
2538 !! test
2539 Bug 4781, 5267: %28, %29 in bracketed URL
2540 !! input
2541 [http://www.example.com/?title=Ben-Hur_%281959_film%29 link]
2542 !! result
2543 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">link</a>
2544 </p>
2545 !! end
2546
2547 !! test
2548 External link containing double-single-quotes in text '' (bug 4598 sanity check)
2549 !! input
2550 Some [http://example.com/ pretty ''italics'' and stuff]!
2551 !! result
2552 <p>Some <a rel="nofollow" class="external text" href="http://example.com/">pretty <i>italics</i> and stuff</a>!
2553 </p>
2554 !! end
2555
2556 !! test
2557 External link containing double-single-quotes in text embedded in italics (bug 4598 sanity check)
2558 !! input
2559 ''Some [http://example.com/ pretty ''italics'' and stuff]!''
2560 !! result
2561 <p><i>Some </i><a rel="nofollow" class="external text" href="http://example.com/"><i>pretty </i>italics<i> and stuff</i></a><i>!</i>
2562 </p>
2563 !! end
2564
2565 !! test
2566 External link containing double-single-quotes with no space separating the url from text in italics
2567 !! input
2568 [http://www.musee-picasso.fr/pages/page_id18528_u1l2.htm''La muerte de Casagemas'' (1901) en el sitio de [[Museo Picasso (París)|Museo Picasso]].]
2569 !! result
2570 <p><a rel="nofollow" class="external text" href="http://www.musee-picasso.fr/pages/page_id18528_u1l2.htm"><i>La muerte de Casagemas</i> (1901) en el sitio de <a href="/index.php?title=Museo_Picasso_(Par%C3%ADs)&amp;action=edit&amp;redlink=1" class="new" title="Museo Picasso (París) (page does not exist)">Museo Picasso</a>.</a>
2571 </p>
2572 !! end
2573
2574 !! test
2575 URL-encoding in URL functions (single parameter)
2576 !! input
2577 {{localurl:Some page|amp=&}}
2578 !! result
2579 <p>/index.php?title=Some_page&amp;amp=&amp;
2580 </p>
2581 !! end
2582
2583 !! test
2584 URL-encoding in URL functions (multiple parameters)
2585 !! input
2586 {{localurl:Some page|q=?&amp=&}}
2587 !! result
2588 <p>/index.php?title=Some_page&amp;q=?&amp;amp=&amp;
2589 </p>
2590 !! end
2591
2592 !! test
2593 Brackets in urls
2594 !! input
2595 http://example.com/index.php?foozoid%5B%5D=bar
2596
2597 http://example.com/index.php?foozoid&#x5B;&#x5D;=bar
2598 !! result
2599 <p><a rel="nofollow" class="external free" href="http://example.com/index.php?foozoid%5B%5D=bar">http://example.com/index.php?foozoid%5B%5D=bar</a>
2600 </p><p><a rel="nofollow" class="external free" href="http://example.com/index.php?foozoid%5B%5D=bar">http://example.com/index.php?foozoid%5B%5D=bar</a>
2601 </p>
2602 !! end
2603
2604 !! test
2605 IPv6 urls (bug 21261)
2606 !! options
2607 disabled
2608 !! input
2609 http://[2404:130:0:1000::187:2]/index.php
2610 !! result
2611 <p><a rel="nofollow" class="external free" href="http://[2404:130:0:1000::187:2]/index.php">http://[2404:130:0:1000::187:2]/index.php</a>
2612 </p>
2613 !! end
2614
2615 !! test
2616 Non-extlinks in brackets
2617 !! input
2618 [foo]
2619 [foo bar]
2620 [foo ''bar'']
2621 [fool's] errand
2622 [fool's errand]
2623 [{{echo|foo}}]
2624 [{{echo|foo}} bar]
2625 [{{echo|foo}} ''bar'']
2626 [{{echo|foo}}l's] errand
2627 [{{echo|foo}}l's errand]
2628 !! result
2629 <p>[foo]
2630 [foo bar]
2631 [foo <i>bar</i>]
2632 [fool's] errand
2633 [fool's errand]
2634 [foo]
2635 [foo bar]
2636 [foo <i>bar</i>]
2637 [fool's] errand
2638 [fool's errand]
2639 </p>
2640 !! end
2641
2642 ###
2643 ### Quotes
2644 ###
2645
2646 !! test
2647 Quotes
2648 !! input
2649 Normal text. '''Bold text.''' Normal text. ''Italic text.''
2650
2651 Normal text. '''''Bold italic text.''''' Normal text.
2652 !!result
2653 <p>Normal text. <b>Bold text.</b> Normal text. <i>Italic text.</i>
2654 </p><p>Normal text. <i><b>Bold italic text.</b></i> Normal text.
2655 </p>
2656 !! end
2657
2658
2659 !! test
2660 Unclosed and unmatched quotes
2661 !! input
2662 '''''Bold italic text '''with bold deactivated''' in between.'''''
2663
2664 '''''Bold italic text ''with italic deactivated'' in between.'''''
2665
2666 '''Bold text..
2667
2668 ..spanning two paragraphs (should not work).'''
2669
2670 '''Bold tag left open
2671
2672 ''Italic tag left open
2673
2674 Normal text.
2675
2676 <!-- Unmatching number of opening, closing tags: -->
2677 '''This year''''s election ''should'' beat '''last year''''s.
2678
2679 ''Tom'''s car is bigger than ''Susan'''s.
2680
2681 Plain ''italic'''s plain
2682 !! result
2683 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
2684 </p><p><b><i>Bold italic text </i>with italic deactivated<i> in between.</i></b>
2685 </p><p><b>Bold text..</b>
2686 </p><p>..spanning two paragraphs (should not work).
2687 </p><p><b>Bold tag left open</b>
2688 </p><p><i>Italic tag left open</i>
2689 </p><p>Normal text.
2690 </p><p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
2691 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
2692 </p><p>Plain <i>italic'</i>s plain
2693 </p>
2694 !! end
2695
2696 ###
2697 ### Tables
2698 ###
2699 ### some content taken from http://meta.wikimedia.org/wiki/MediaWiki_User%27s_Guide:_Using_tables
2700 ###
2701
2702 # This should not produce <table></table> as <table><tr><td></td></tr></table>
2703 # is the bare minimun required by the spec, see:
2704 # http://www.w3.org/TR/xhtml-modularization/dtd_module_defs.html#a_module_Basic_Tables
2705 !! test
2706 A table with no data.
2707 !! input
2708 {||}
2709 !! result
2710 !! end
2711
2712 # A table with nothing but a caption is invalid XHTML, we might want to render
2713 # this as <p>caption</p>
2714 !! test
2715 A table with nothing but a caption
2716 !! input
2717 {|
2718 |+ caption
2719 |}
2720 !! result
2721 <table>
2722 <caption> caption
2723 </caption><tr><td></td></tr></table>
2724
2725 !! end
2726
2727 !! test
2728 Table td-cell syntax variations
2729 !! input
2730 {|
2731 | foo bar foo | baz
2732 | foo bar foo || baz
2733 | style='color:red;' | baz
2734 | style='color:red;' || baz
2735 |}
2736 !! result
2737 <table>
2738 <tr>
2739 <td> baz
2740 </td>
2741 <td> foo bar foo </td>
2742 <td> baz
2743 </td>
2744 <td style="color:red;"> baz
2745 </td>
2746 <td> style='color:red;' </td>
2747 <td> baz
2748 </td></tr></table>
2749
2750 !! end
2751
2752 !! test
2753 Simple table
2754 !! input
2755 {|
2756 | 1 || 2
2757 |-
2758 | 3 || 4
2759 |}
2760 !! result
2761 <table>
2762 <tr>
2763 <td> 1 </td>
2764 <td> 2
2765 </td></tr>
2766 <tr>
2767 <td> 3 </td>
2768 <td> 4
2769 </td></tr></table>
2770
2771 !! end
2772
2773 !! test
2774 Simple table but with multiple dashes for row wikitext
2775 !! input
2776 {|
2777 | foo
2778 |-----
2779 | bar
2780 |}
2781 !! result
2782 <table>
2783 <tr>
2784 <td> foo
2785 </td></tr>
2786 <tr>
2787 <td> bar
2788 </td></tr></table>
2789
2790 !! end
2791 !! test
2792 Multiplication table
2793 !! input
2794 {| border="1" cellpadding="2"
2795 |+Multiplication table
2796 |-
2797 ! &times; !! 1 !! 2 !! 3
2798 |-
2799 ! 1
2800 | 1 || 2 || 3
2801 |-
2802 ! 2
2803 | 2 || 4 || 6
2804 |-
2805 ! 3
2806 | 3 || 6 || 9
2807 |-
2808 ! 4
2809 | 4 || 8 || 12
2810 |-
2811 ! 5
2812 | 5 || 10 || 15
2813 |}
2814 !! result
2815 <table border="1" cellpadding="2">
2816 <caption>Multiplication table
2817 </caption>
2818 <tr>
2819 <th> &#215; </th>
2820 <th> 1 </th>
2821 <th> 2 </th>
2822 <th> 3
2823 </th></tr>
2824 <tr>
2825 <th> 1
2826 </th>
2827 <td> 1 </td>
2828 <td> 2 </td>
2829 <td> 3
2830 </td></tr>
2831 <tr>
2832 <th> 2
2833 </th>
2834 <td> 2 </td>
2835 <td> 4 </td>
2836 <td> 6
2837 </td></tr>
2838 <tr>
2839 <th> 3
2840 </th>
2841 <td> 3 </td>
2842 <td> 6 </td>
2843 <td> 9
2844 </td></tr>
2845 <tr>
2846 <th> 4
2847 </th>
2848 <td> 4 </td>
2849 <td> 8 </td>
2850 <td> 12
2851 </td></tr>
2852 <tr>
2853 <th> 5
2854 </th>
2855 <td> 5 </td>
2856 <td> 10 </td>
2857 <td> 15
2858 </td></tr></table>
2859
2860 !! end
2861
2862 !! test
2863 Accept "||" in table headings
2864 !! input
2865 {|
2866 !h1 || h2
2867 |}
2868 !! result
2869 <table>
2870 <tr>
2871 <th>h1 </th>
2872 <th> h2
2873 </th></tr></table>
2874
2875 !! end
2876
2877 !! test
2878 Accept "||" in indented table headings
2879 !! input
2880 :{|
2881 !h1 || h2
2882 |}
2883 !! result
2884 <dl><dd><table>
2885 <tr>
2886 <th>h1 </th>
2887 <th> h2
2888 </th></tr></table></dd></dl>
2889
2890 !! end
2891
2892 !! test
2893 Accept empty attributes in td/th cells (td/th cells starting with leading ||)
2894 !! input
2895 {|
2896 !| h1
2897 || a
2898 |}
2899 !! result
2900 <table>
2901 <tr>
2902 <th> h1
2903 </th>
2904 <td> a
2905 </td></tr></table>
2906
2907 !! end
2908
2909 !!test
2910 Accept "| !" at start of line in tables (ignore !-attribute)
2911 !!input
2912 {|
2913 |-
2914 | !style="color:red" | bar
2915 |}
2916 !!result
2917 <table>
2918
2919 <tr>
2920 <td> bar
2921 </td></tr></table>
2922
2923 !!end
2924
2925 !!test
2926 Allow +/- in 2nd and later cells in a row, in 1st cell when td-attrs are present, or in 1st cell when there is a space between "|" and +/-
2927 !!input
2928 {|
2929 |-
2930 |style='color:red;'|+1
2931 |style='color:blue;'|-1
2932 |-
2933 | 1 || 2 || 3
2934 | 1 ||+2 ||-3
2935 |-
2936 | +1
2937 | -1
2938 |}
2939 !!result
2940 <table>
2941
2942 <tr>
2943 <td style="color:red;">+1
2944 </td>
2945 <td style="color:blue;">-1
2946 </td></tr>
2947 <tr>
2948 <td> 1 </td>
2949 <td> 2 </td>
2950 <td> 3
2951 </td>
2952 <td> 1 </td>
2953 <td>+2 </td>
2954 <td>-3
2955 </td></tr>
2956 <tr>
2957 <td> +1
2958 </td>
2959 <td> -1
2960 </td></tr></table>
2961
2962 !!end
2963
2964 !! test
2965 Table rowspan
2966 !! input
2967 {| border=1
2968 | Cell 1, row 1
2969 |rowspan=2| Cell 2, row 1 (and 2)
2970 | Cell 3, row 1
2971 |-
2972 | Cell 1, row 2
2973 | Cell 3, row 2
2974 |}
2975 !! result
2976 <table border="1">
2977 <tr>
2978 <td> Cell 1, row 1
2979 </td>
2980 <td rowspan="2"> Cell 2, row 1 (and 2)
2981 </td>
2982 <td> Cell 3, row 1
2983 </td></tr>
2984 <tr>
2985 <td> Cell 1, row 2
2986 </td>
2987 <td> Cell 3, row 2
2988 </td></tr></table>
2989
2990 !! end
2991
2992 !! test
2993 Nested table
2994 !! input
2995 {| border=1
2996 | &alpha;
2997 |
2998 {| bgcolor=#ABCDEF border=2
2999 |nested
3000 |-
3001 |table
3002 |}
3003 |the original table again
3004 |}
3005 !! result
3006 <table border="1">
3007 <tr>
3008 <td> &#945;
3009 </td>
3010 <td>
3011 <table bgcolor="#ABCDEF" border="2">
3012 <tr>
3013 <td>nested
3014 </td></tr>
3015 <tr>
3016 <td>table
3017 </td></tr></table>
3018 </td>
3019 <td>the original table again
3020 </td></tr></table>
3021
3022 !! end
3023
3024 !! test
3025 Invalid attributes in table cell (bug 1830)
3026 !! input
3027 {|
3028 |Cell:|broken
3029 |}
3030 !! result
3031 <table>
3032 <tr>
3033 <td>broken
3034 </td></tr></table>
3035
3036 !! end
3037
3038
3039 !! test
3040 Table security: embedded pipes (http://lists.wikimedia.org/mailman/htdig/wikitech-l/2006-April/022293.html)
3041 !! input
3042 {|
3043 | |[ftp://|x||]" onmouseover="alert(document.cookie)">test
3044 !! result
3045 <table>
3046 <tr>
3047 <td>[<a rel="nofollow" class="external free" href="ftp://%7Cx">ftp://%7Cx</a></td>
3048 <td>]" onmouseover="alert(document.cookie)"&gt;test
3049 </td>
3050 </tr>
3051 </table>
3052
3053 !! end
3054
3055
3056 !! test
3057 Indented table markup mixed with indented pre content (proposed in bug 6200)
3058 !! input
3059 <table>
3060 <tr>
3061 <td>
3062 Text that should be rendered preformatted
3063 </td>
3064 </tr>
3065 </table>
3066 !! result
3067 <table>
3068 <tr>
3069 <td>
3070 <pre>Text that should be rendered preformatted
3071 </pre>
3072 </td>
3073 </tr>
3074 </table>
3075
3076 !! end
3077
3078 !! test
3079 Template-generated table cell attributes and cell content
3080 !! input
3081 {|
3082 |{{table_attribs}}
3083 |}
3084 !! result
3085 <table>
3086 <tr>
3087 <td style="color: red"> Foo
3088 </td></tr></table>
3089
3090 !! end
3091
3092 !! test
3093 Table with row followed by newlines and table heading
3094 !! input
3095 {|
3096 |-
3097
3098 ! foo
3099 |}
3100 !! result
3101 <table>
3102
3103
3104 <tr>
3105 <th> foo
3106 </th></tr></table>
3107
3108 !! end
3109
3110 # FIXME: Preserve the attribute properly (with an empty string as value) in
3111 # the PHP parser. Parsoid implements the behavior below.
3112 !! test
3113 Table attributes with empty value
3114 !! options
3115 disabled
3116 !! input
3117 {|
3118 | style=| hello
3119 |}
3120 !! result
3121 <table>
3122 <tr>
3123 <td style=""> hello
3124 </td></tr></table>
3125
3126 !! end
3127
3128 !! test
3129 Wikitext table with a lot of comments
3130 !! input
3131 {|
3132 <!-- c0 -->
3133 | foo
3134 <!-- c1 -->
3135 |- <!-- c2 -->
3136 <!-- c3 -->
3137 |<!-- c4 -->
3138 <!-- c5 -->
3139 |}
3140 !! result
3141 <table>
3142 <tr>
3143 <td> foo
3144 </td></tr>
3145 <tr>
3146 <td>
3147 </td></tr></table>
3148
3149 !! end
3150
3151 ###
3152 ### Internal links
3153 ###
3154 !! test
3155 Plain link, capitalized
3156 !! input
3157 [[Main Page]]
3158 !! result
3159 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
3160 </p>
3161 !! end
3162
3163 !! test
3164 Plain link, uncapitalized
3165 !! input
3166 [[main Page]]
3167 !! result
3168 <p><a href="/wiki/Main_Page" title="Main Page">main Page</a>
3169 </p>
3170 !! end
3171
3172 !! test
3173 Piped link
3174 !! input
3175 [[Main Page|The Main Page]]
3176 !! result
3177 <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
3178 </p>
3179 !! end
3180
3181 !! test
3182 Broken link
3183 !! input
3184 [[Zigzagzogzagzig]]
3185 !! result
3186 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig</a>
3187 </p>
3188 !! end
3189
3190 !! test
3191 Broken link with fragment
3192 !! input
3193 [[Zigzagzogzagzig#zug]]
3194 !! result
3195 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig#zug</a>
3196 </p>
3197 !! end
3198
3199 !! test
3200 Special page link with fragment
3201 !! input
3202 [[Special:Version#anchor]]
3203 !! result
3204 <p><a href="/wiki/Special:Version#anchor" title="Special:Version">Special:Version#anchor</a>
3205 </p>
3206 !! end
3207
3208 !! test
3209 Nonexistent special page link with fragment
3210 !! input
3211 [[Special:ThisNameWillHopefullyNeverBeUsed#anchor]]
3212 !! result
3213 <p><a href="/wiki/Special:ThisNameWillHopefullyNeverBeUsed" class="new" title="Special:ThisNameWillHopefullyNeverBeUsed (page does not exist)">Special:ThisNameWillHopefullyNeverBeUsed#anchor</a>
3214 </p>
3215 !! end
3216
3217 !! test
3218 Link with prefix
3219 !! input
3220 xxx[[main Page]], xxx[[Main Page]], Xxx[[main Page]] XXX[[main Page]], XXX[[Main Page]]
3221 !! result
3222 <p>xxx<a href="/wiki/Main_Page" title="Main Page">main Page</a>, xxx<a href="/wiki/Main_Page" title="Main Page">Main Page</a>, Xxx<a href="/wiki/Main_Page" title="Main Page">main Page</a> XXX<a href="/wiki/Main_Page" title="Main Page">main Page</a>, XXX<a href="/wiki/Main_Page" title="Main Page">Main Page</a>
3223 </p>
3224 !! end
3225
3226 !! test
3227 Link with suffix
3228 !! input
3229 [[Main Page]]xxx, [[Main Page]]XXX, [[Main Page]]!!!
3230 !! result
3231 <p><a href="/wiki/Main_Page" title="Main Page">Main Pagexxx</a>, <a href="/wiki/Main_Page" title="Main Page">Main Page</a>XXX, <a href="/wiki/Main_Page" title="Main Page">Main Page</a>!!!
3232 </p>
3233 !! end
3234
3235 !! article
3236 prefixed article
3237 !! text
3238 Some text
3239 !! endarticle
3240
3241 !! test
3242 Bug 43661: Piped links with identical prefixes
3243 !! input
3244 [[prefixed article|prefixed articles with spaces]]
3245
3246 [[prefixed article|prefixed articlesaoeu]]
3247
3248 [[Main Page|Main Page test]]
3249 !! result
3250 <p><a href="/wiki/Prefixed_article" title="Prefixed article">prefixed articles with spaces</a>
3251 </p><p><a href="/wiki/Prefixed_article" title="Prefixed article">prefixed articlesaoeu</a>
3252 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page test</a>
3253 </p>
3254 !! end
3255
3256
3257 !! test
3258 Link with HTML entity in suffix / tail
3259 !! input
3260 [[Main Page]]&quot;, [[Main Page]]&#97;
3261 !! result
3262 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>&quot;, <a href="/wiki/Main_Page" title="Main Page">Main Page</a>&#97;
3263 </p>
3264 !! end
3265
3266 !! test
3267 Link with 3 brackets
3268 !! input
3269 [[[main page]]]
3270 !! result
3271 <p>[[[main page]]]
3272 </p>
3273 !! end
3274
3275 !! test
3276 Piped link with 3 brackets
3277 !! input
3278 [[[main page|the main page]]]
3279 !! result
3280 <p>[[[main page|the main page]]]
3281 </p>
3282 !! end
3283
3284 !! test
3285 Link with multiple pipes
3286 !! input
3287 [[Main Page|The|Main|Page]]
3288 !! result
3289 <p><a href="/wiki/Main_Page" title="Main Page">The|Main|Page</a>
3290 </p>
3291 !! end
3292
3293 !! test
3294 Link to namespaces
3295 !! input
3296 [[Talk:Parser testing]], [[Meta:Disclaimers]]
3297 !! result
3298 <p><a href="/index.php?title=Talk:Parser_testing&amp;action=edit&amp;redlink=1" class="new" title="Talk:Parser testing (page does not exist)">Talk:Parser testing</a>, <a href="/index.php?title=Meta:Disclaimers&amp;action=edit&amp;redlink=1" class="new" title="Meta:Disclaimers (page does not exist)">Meta:Disclaimers</a>
3299 </p>
3300 !! end
3301
3302 !! test
3303 Piped link to namespace
3304 !! input
3305 [[Meta:Disclaimers|The disclaimers]]
3306 !! result
3307 <p><a href="/index.php?title=Meta:Disclaimers&amp;action=edit&amp;redlink=1" class="new" title="Meta:Disclaimers (page does not exist)">The disclaimers</a>
3308 </p>
3309 !! end
3310
3311 !! test
3312 Link containing }
3313 !! input
3314 [[Usually caused by a typo (oops}]]
3315 !! result
3316 <p>[[Usually caused by a typo (oops}]]
3317 </p>
3318 !! end
3319
3320 !! test
3321 Link containing % (not as a hex sequence)
3322 !! input
3323 [[7% Solution]]
3324 !! result
3325 <p><a href="/index.php?title=7%25_Solution&amp;action=edit&amp;redlink=1" class="new" title="7% Solution (page does not exist)">7% Solution</a>
3326 </p>
3327 !! end
3328
3329 !! test
3330 Link containing % as a single hex sequence interpreted to char
3331 !! input
3332 [[7%25 Solution]]
3333 !! result
3334 <p><a href="/index.php?title=7%25_Solution&amp;action=edit&amp;redlink=1" class="new" title="7% Solution (page does not exist)">7% Solution</a>
3335 </p>
3336 !!end
3337
3338 !! test
3339 Link containing % as a double hex sequence interpreted to hex sequence
3340 !! input
3341 [[7%2525 Solution]]
3342 !! result
3343 <p>[[7%2525 Solution]]
3344 </p>
3345 !!end
3346
3347 !! test
3348 Link containing "#<" and "#>" % as a hex sequences- these are valid section anchors
3349 Example for such a section: == < ==
3350 !! input
3351 [[%23%3c]][[%23%3e]]
3352 !! result
3353 <p><a href="#.3C">#&lt;</a><a href="#.3E">#&gt;</a>
3354 </p>
3355 !! end
3356
3357 !! test
3358 Link containing "<#" and ">#" as a hex sequences
3359 !! input
3360 [[%3c%23]][[%3e%23]]
3361 !! result
3362 <p>[[%3c%23]][[%3e%23]]
3363 </p>
3364 !! end
3365
3366 !! test
3367 Link containing double-single-quotes '' (bug 4598)
3368 !! input
3369 [[Lista d''e paise d''o munno]]
3370 !! result
3371 <p><a href="/index.php?title=Lista_d%27%27e_paise_d%27%27o_munno&amp;action=edit&amp;redlink=1" class="new" title="Lista d''e paise d''o munno (page does not exist)">Lista d''e paise d''o munno</a>
3372 </p>
3373 !! end
3374
3375 !! test
3376 Link containing double-single-quotes '' in text (bug 4598 sanity check)
3377 !! input
3378 Some [[Link|pretty ''italics'' and stuff]]!
3379 !! result
3380 <p>Some <a href="/index.php?title=Link&amp;action=edit&amp;redlink=1" class="new" title="Link (page does not exist)">pretty <i>italics</i> and stuff</a>!
3381 </p>
3382 !! end
3383
3384 !! test
3385 Link containing double-single-quotes '' in text embedded in italics (bug 4598 sanity check)
3386 !! input
3387 ''Some [[Link|pretty ''italics'' and stuff]]!
3388 !! result
3389 <p><i>Some <a href="/index.php?title=Link&amp;action=edit&amp;redlink=1" class="new" title="Link (page does not exist)">pretty <i>italics</i> and stuff</a>!</i>
3390 </p>
3391 !! end
3392
3393 !! test
3394 Link with double quotes in title part (literal) and alternate part (interpreted)
3395 !! input
3396 [[File:Denys Savchenko ''Pentecoste''.jpg]]
3397
3398 [[''Pentecoste'']]
3399
3400 [[''Pentecoste''|Pentecoste]]
3401
3402 [[''Pentecoste''|''Pentecoste'']]
3403 !! result
3404 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=Denys_Savchenko_%27%27Pentecoste%27%27.jpg" class="new" title="File:Denys Savchenko &#39;&#39;Pentecoste&#39;&#39;.jpg">File:Denys Savchenko <i>Pentecoste</i>.jpg</a>
3405 </p><p><a href="/index.php?title=%27%27Pentecoste%27%27&amp;action=edit&amp;redlink=1" class="new" title="''Pentecoste'' (page does not exist)">''Pentecoste''</a>
3406 </p><p><a href="/index.php?title=%27%27Pentecoste%27%27&amp;action=edit&amp;redlink=1" class="new" title="''Pentecoste'' (page does not exist)">Pentecoste</a>
3407 </p><p><a href="/index.php?title=%27%27Pentecoste%27%27&amp;action=edit&amp;redlink=1" class="new" title="''Pentecoste'' (page does not exist)"><i>Pentecoste</i></a>
3408 </p>
3409 !! end
3410
3411 !! test
3412 Broken image links with HTML captions (bug 39700)
3413 !! input
3414 [[File:Nonexistent|<script></script>]]
3415 [[File:Nonexistent|100px|<script></script>]]
3416 [[File:Nonexistent|&lt;]]
3417 [[File:Nonexistent|a<i>b</i>c]]
3418 !! result
3419 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script&gt;&lt;/script&gt;</a>
3420 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script&gt;&lt;/script&gt;</a>
3421 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;</a>
3422 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">abc</a>
3423 </p>
3424 !! end
3425
3426 !! test
3427 Plain link to URL
3428 !! input
3429 [[http://www.example.com]]
3430 !! result
3431 <p>[<a rel="nofollow" class="external autonumber" href="http://www.example.com">[1]</a>]
3432 </p>
3433 !! end
3434
3435 !! test
3436 Plain link to URL with link text
3437 !! input
3438 [[http://www.example.com Link text]]
3439 !! result
3440 <p>[<a rel="nofollow" class="external text" href="http://www.example.com">Link text</a>]
3441 </p>
3442 !! end
3443
3444 !! test
3445 Plain link to protocol-relative URL
3446 !! input
3447 [[//www.example.com]]
3448 !! result
3449 <p>[<a rel="nofollow" class="external autonumber" href="//www.example.com">[1]</a>]
3450 </p>
3451 !! end
3452
3453 !! test
3454 Plain link to protocol-relative URL with link text
3455 !! input
3456 [[//www.example.com Link text]]
3457 !! result
3458 <p>[<a rel="nofollow" class="external text" href="//www.example.com">Link text</a>]
3459 </p>
3460 !! end
3461
3462 !! test
3463 Plain link to page with question mark in title
3464 !! input
3465 [[A?b]]
3466
3467 [[A?b|Baz]]
3468 !! result
3469 <p><a href="/wiki/A%3Fb" title="A?b">A?b</a>
3470 </p><p><a href="/wiki/A%3Fb" title="A?b">Baz</a>
3471 </p>
3472 !! end
3473
3474
3475 # I'm fairly sure the expected result here is wrong.
3476 # We want these to be URL links, not pseudo-pages with URLs for titles....
3477 # However the current output is also pretty screwy.
3478 #
3479 # ----
3480 # I'm changing it to match the current output--it arguably makes more
3481 # sense in the light of the test above. Old expected result was:
3482 #<p>Piped link to URL: <a href="/index.php?title=Http://www.example.com&amp;action=edit" class="new">an example URL</a>
3483 #</p>
3484 # But I think this test is bordering on "garbage in, garbage out" anyway.
3485 # -- wtm
3486 !! test
3487 Piped link to URL
3488 !! input
3489 Piped link to URL: [[http://www.example.com|an example URL]]
3490 !! result
3491 <p>Piped link to URL: [<a rel="nofollow" class="external text" href="http://www.example.com%7Can">example URL</a>]
3492 </p>
3493 !! end
3494
3495 !! test
3496 BUG 2: [[page|http://url/]] should link to page, not http://url/
3497 !! input
3498 [[Main Page|http://url/]]
3499 !! result
3500 <p><a href="/wiki/Main_Page" title="Main Page">http://url/</a>
3501 </p>
3502 !! end
3503
3504 !! test
3505 BUG 337: Escaped self-links should be bold
3506 !! options
3507 title=[[Bug462]]
3508 !! input
3509 [[Bu&#103;462]] [[Bug462]]
3510 !! result
3511 <p><strong class="selflink">Bu&#103;462</strong> <strong class="selflink">Bug462</strong>
3512 </p>
3513 !! end
3514
3515 !! test
3516 Self-link to section should not be bold
3517 !! options
3518 title=[[Main Page]]
3519 !! input
3520 [[Main Page#section]]
3521 !! result
3522 <p><a href="/wiki/Main_Page#section" title="Main Page">Main Page#section</a>
3523 </p>
3524 !! end
3525
3526 !! article
3527 00
3528 !! text
3529 This is 00.
3530 !! endarticle
3531
3532 !!test
3533 Self-link to numeric title
3534 !!options
3535 title=[[0]]
3536 !!input
3537 [[0]]
3538 !!result
3539 <p><strong class="selflink">0</strong>
3540 </p>
3541 !!end
3542
3543 !!test
3544 Link to numeric-equivalent title
3545 !!options
3546 title=[[0]]
3547 !!input
3548 [[00]]
3549 !!result
3550 <p><a href="/wiki/00" title="00">00</a>
3551 </p>
3552 !!end
3553
3554 !! test
3555 <nowiki> inside a link
3556 !! input
3557 [[Main<nowiki> Page</nowiki>]] [[Main Page|the main page <nowiki>[it's not very good]</nowiki>]]
3558 !! result
3559 <p>[[Main Page]] <a href="/wiki/Main_Page" title="Main Page">the main page [it's not very good]</a>
3560 </p>
3561 !! end
3562
3563 !! test
3564 Non-breaking spaces in title
3565 !! input
3566 [[&nbsp; Main &nbsp; Page &nbsp;]]
3567 !! result
3568 <p><a href="/wiki/Main_Page" title="Main Page">&#160; Main &#160; Page &#160;</a>
3569 </p>
3570 !!end
3571
3572 !! test
3573 Internal link with ca linktrail, surrounded by bold apostrophes (bug 27473 primary issue)
3574 !! options
3575 language=ca
3576 !! input
3577 '''[[Main Page]]'''
3578 !! result
3579 <p><b><a href="/wiki/Main_Page" title="Main Page">Main Page</a></b>
3580 </p>
3581 !! end
3582
3583 !! test
3584 Internal link with ca linktrail, surrounded by italic apostrophes (bug 27473 primary issue)
3585 !! options
3586 language=ca
3587 !! input
3588 ''[[Main Page]]''
3589 !! result
3590 <p><i><a href="/wiki/Main_Page" title="Main Page">Main Page</a></i>
3591 </p>
3592 !! end
3593
3594 !! test
3595 Internal link with en linktrail: no apostrophes (bug 27473)
3596 !! options
3597 language=en
3598 !! input
3599 [[Something]]'nice
3600 !! result
3601 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (page does not exist)">Something</a>'nice
3602 </p>
3603 !! end
3604
3605 !! test
3606 Internal link with ca linktrail with apostrophes (bug 27473)
3607 !! options
3608 language=ca
3609 !! input
3610 [[Something]]'nice
3611 !! result
3612 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (encara no existeix)">Something'nice</a>
3613 </p>
3614 !! end
3615
3616 !! test
3617 Internal link with kaa linktrail with apostrophes (bug 27473)
3618 !! options
3619 language=kaa
3620 !! input
3621 [[Something]]'nice
3622 !! result
3623 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (bet ele jaratılmag'an)">Something'nice</a>
3624 </p>
3625 !! end
3626
3627 ###
3628 ### Interwiki links (see maintenance/interwiki.sql)
3629 ###
3630
3631 !! test
3632 Inline interwiki link
3633 !! input
3634 [[MeatBall:SoftSecurity]]
3635 !! result
3636 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity</a>
3637 </p>
3638 !! end
3639
3640 !! test
3641 Inline interwiki link with empty title (bug 2372)
3642 !! input
3643 [[MeatBall:]]
3644 !! result
3645 <p><a href="http://www.usemod.com/cgi-bin/mb.pl" class="extiw" title="meatball:">MeatBall:</a>
3646 </p>
3647 !! end
3648
3649 !! test
3650 Interwiki link encoding conversion (bug 1636)
3651 !! input
3652 *[[Wikipedia:ro:Olteni&#0355;a]]
3653 *[[Wikipedia:ro:Olteni&#355;a]]
3654 !! result
3655 <ul><li><a href="http://en.wikipedia.org/wiki/ro:Olteni%C5%A3a" class="extiw" title="wikipedia:ro:Olteniţa">Wikipedia:ro:Olteni&#355;a</a>
3656 </li><li><a href="http://en.wikipedia.org/wiki/ro:Olteni%C5%A3a" class="extiw" title="wikipedia:ro:Olteniţa">Wikipedia:ro:Olteni&#355;a</a>
3657 </li></ul>
3658
3659 !! end
3660
3661 !! test
3662 Interwiki link with fragment (bug 2130)
3663 !! input
3664 [[MeatBall:SoftSecurity#foo]]
3665 !! result
3666 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity#foo" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity#foo</a>
3667 </p>
3668 !! end
3669
3670 !! test
3671 Interlanguage link
3672 !! input
3673 Blah blah blah
3674 [[zh:Chinese]]
3675 !!result
3676 <p>Blah blah blah
3677 </p>
3678 !! end
3679
3680 !! test
3681 Double interlanguage link
3682 !! input
3683 Blah blah blah
3684 [[es:Spanish]]
3685 [[zh:Chinese]]
3686 !!result
3687 <p>Blah blah blah
3688 </p>
3689 !! end
3690
3691 !! test
3692 Interlanguage link, with prefix links
3693 !! options
3694 language=ln
3695 !! input
3696 Blah blah blah
3697 [[zh:Chinese]]
3698 !!result
3699 <p>Blah blah blah
3700 </p>
3701 !! end
3702
3703 !! test
3704 Double interlanguage link, with prefix links (bug 8897)
3705 !! options
3706 language=ln
3707 !! input
3708 Blah blah blah
3709 [[es:Spanish]]
3710 [[zh:Chinese]]
3711 !!result
3712 <p>Blah blah blah
3713 </p>
3714 !! end
3715
3716 !! test
3717 Parsoid-specific test: Wikilinks with &nbsp; should RT properly
3718 !! options
3719 language=ln
3720 !! input
3721 [[WW&nbsp;II]]
3722 !!result
3723 <p><a href="/index.php?title=WW_II&amp;action=edit&amp;redlink=1" class="new" title="WW II (lonkásá ezalí tɛ̂)">WW&#160;II</a>
3724 </p>
3725 !! end
3726
3727 ##
3728 ## XHTML tidiness
3729 ###
3730
3731 !! test
3732 <br> to <br />
3733 !! input
3734 1<br>2<br />3
3735 !! result
3736 <p>1<br />2<br />3
3737 </p>
3738 !! end
3739
3740 !! test
3741 Broken br tag sanitization
3742 !! input
3743 </br>
3744 !! result
3745 <p>&lt;/br&gt;
3746 </p>
3747 !! end
3748
3749 !! test
3750 Incorrecly removing closing slashes from correctly formed XHTML
3751 !! input
3752 <br style="clear:both;" />
3753 !! result
3754 <p><br style="clear:both;" />
3755 </p>
3756 !! end
3757
3758 !! test
3759 Failing to transform badly formed HTML into correct XHTML
3760 !! input
3761 <br style="clear: left;">
3762 <br style="clear: right;">
3763 <br style="clear: both;">
3764 !! result
3765 <p><br style="clear: left;" />
3766 <br style="clear: right;" />
3767 <br style="clear: both;" />
3768 </p>
3769 !!end
3770
3771 !! test
3772 Handling html with a div self-closing tag
3773 !! input
3774 <div title />
3775 <div title/>
3776 <div title/ >
3777 <div title=bar />
3778 <div title=bar/>
3779 <div title=bar/ >
3780 !! result
3781 <p>&lt;div title /&gt;
3782 &lt;div title/&gt;
3783 </p>
3784 <div>
3785 <p>&lt;div title=bar /&gt;
3786 &lt;div title=bar/&gt;
3787 </p>
3788 <div title="bar/"></div>
3789 </div>
3790
3791 !! end
3792
3793 !! test
3794 Handling html with a br self-closing tag
3795 !! input
3796 <br title />
3797 <br title/>
3798 <br title/ >
3799 <br title=bar />
3800 <br title=bar/>
3801 <br title=bar/ >
3802 !! result
3803 <p><br title="title" />
3804 <br title="title" />
3805 <br />
3806 <br title="bar" />
3807 <br title="bar" />
3808 <br title="bar/" />
3809 </p>
3810 !! end
3811
3812 !! test
3813 Horizontal ruler (should it add that extra space?)
3814 !! input
3815 <hr>
3816 <hr >
3817 foo <hr
3818 > bar
3819 !! result
3820 <hr />
3821 <hr />
3822 foo <hr /> bar
3823
3824 !! end
3825
3826 !! test
3827 Horizontal ruler -- 4+ dashes render hr
3828 !! input
3829 ----
3830 !! result
3831 <hr />
3832
3833 !! end
3834
3835 !! test
3836 Horizontal ruler -- eats additional dashes on the same line
3837 !! input
3838 ---------
3839 !! result
3840 <hr />
3841
3842 !! end
3843
3844 !! test
3845 Horizontal ruler -- does not collaps dashes on consecutive lines
3846 !! input
3847 ----
3848 ----
3849 !! result
3850 <hr />
3851 <hr />
3852
3853 !! end
3854
3855 !! test
3856 Horizontal ruler -- <4 dashes render as plain text
3857 !! input
3858 ---
3859 !! result
3860 <p>---
3861 </p>
3862 !! end
3863
3864 !! test
3865 Horizontal ruler -- Supports content following dashes on same line
3866 !! input
3867 ---- Foo
3868 !! result
3869 <hr /> Foo
3870
3871 !! end
3872
3873 ###
3874 ### Block-level elements
3875 ###
3876 !! test
3877 Common list
3878 !! input
3879 *Common list
3880 * item 2
3881 *item 3
3882 !! result
3883 <ul><li>Common list
3884 </li><li> item 2
3885 </li><li>item 3
3886 </li></ul>
3887
3888 !! end
3889
3890 !! test
3891 Numbered list
3892 !! input
3893 #Numbered list
3894 #item 2
3895 # item 3
3896 !! result
3897 <ol><li>Numbered list
3898 </li><li>item 2
3899 </li><li> item 3
3900 </li></ol>
3901
3902 !! end
3903
3904 !! test
3905 Mixed list
3906 !! input
3907 *Mixed list
3908 *# with numbers
3909 ** and bullets
3910 *# and numbers
3911 *bullets again
3912 **bullet level 2
3913 ***bullet level 3
3914 ***#Number on level 4
3915 **bullet level 2
3916 **#Number on level 3
3917 **#Number on level 3
3918 *#number level 2
3919 *Level 1
3920 *** Level 3
3921 #** Level 3, but ordered
3922 !! result
3923 <ul><li>Mixed list
3924 <ol><li> with numbers
3925 </li></ol>
3926 <ul><li> and bullets
3927 </li></ul>
3928 <ol><li> and numbers
3929 </li></ol>
3930 </li><li>bullets again
3931 <ul><li>bullet level 2
3932 <ul><li>bullet level 3
3933 <ol><li>Number on level 4
3934 </li></ol>
3935 </li></ul>
3936 </li><li>bullet level 2
3937 <ol><li>Number on level 3
3938 </li><li>Number on level 3
3939 </li></ol>
3940 </li></ul>
3941 <ol><li>number level 2
3942 </li></ol>
3943 </li><li>Level 1
3944 <ul><li><ul><li> Level 3
3945 </li></ul>
3946 </li></ul>
3947 </li></ul>
3948 <ol><li><ul><li><ul><li> Level 3, but ordered
3949 </li></ul>
3950 </li></ul>
3951 </li></ol>
3952
3953 !! end
3954
3955 !! test
3956 Nested lists 1
3957 !! input
3958 *foo
3959 **bar
3960 !! result
3961 <ul><li>foo
3962 <ul><li>bar
3963 </li></ul>
3964 </li></ul>
3965
3966 !! end
3967
3968 !! test
3969 Nested lists 2
3970 !! input
3971 **foo
3972 *bar
3973 !! result
3974 <ul><li><ul><li>foo
3975 </li></ul>
3976 </li><li>bar
3977 </li></ul>
3978
3979 !! end
3980
3981 !! test
3982 Nested lists 3 (first element empty)
3983 !! input
3984 *
3985 **bar
3986 !! result
3987 <ul><li>
3988 <ul><li>bar
3989 </li></ul>
3990 </li></ul>
3991
3992 !! end
3993
3994 !! test
3995 Nested lists 4 (first element empty)
3996 !! input
3997 **
3998 *bar
3999 !! result
4000 <ul><li><ul><li>
4001 </li></ul>
4002 </li><li>bar
4003 </li></ul>
4004
4005 !! end
4006
4007 !! test
4008 Nested lists 5 (both elements empty)
4009 !! input
4010 **
4011 *
4012 !! result
4013 <ul><li><ul><li>
4014 </li></ul>
4015 </li><li>
4016 </li></ul>
4017
4018 !! end
4019
4020 !! test
4021 Nested lists 6 (both elements empty)
4022 !! input
4023 *
4024 **
4025 !! result
4026 <ul><li>
4027 <ul><li>
4028 </li></ul>
4029 </li></ul>
4030
4031 !! end
4032
4033 !! test
4034 Nested lists 7 (skip initial nesting levels)
4035 !! input
4036 *** foo
4037 !! result
4038 <ul><li><ul><li><ul><li> foo
4039 </li></ul>
4040 </li></ul>
4041 </li></ul>
4042
4043 !! end
4044
4045 !! test
4046 Nested lists 8 (multiple nesting transitions)
4047 !! input
4048 * foo
4049 *** bar
4050 ** baz
4051 * boo
4052 !! result
4053 <ul><li> foo
4054 <ul><li><ul><li> bar
4055 </li></ul>
4056 </li><li> baz
4057 </li></ul>
4058 </li><li> boo
4059 </li></ul>
4060
4061 !! end
4062
4063 !! test
4064 1. Lists with start-of-line-transparent tokens before bullets: Comments
4065 !! input
4066 *foo
4067 *<!--cmt-->bar
4068 <!--cmt-->*baz
4069 !! result
4070 <ul><li>foo
4071 </li><li>bar
4072 </li><li>baz
4073 </li></ul>
4074
4075 !! end
4076
4077 !! test
4078 2. Lists with start-of-line-transparent tokens before bullets: Template close
4079 !! input
4080 *foo {{echo|bar
4081 }}*baz
4082 !! result
4083 <ul><li>foo bar
4084 </li><li>baz
4085 </li></ul>
4086
4087 !! end
4088
4089 !! test
4090 Unbalanced closing block tags break a list
4091 (Disabled since php parser generates broken html -- relies on Tidy to fix up)
4092 !! options
4093 disabled
4094 !! input
4095 <div>
4096 *a</div><div>
4097 *b</div>
4098 !! result
4099 <div>
4100 <ul><li>a
4101 </li></ul></div><div>
4102 <ul><li>b
4103 </li></ul></div>
4104 !! end
4105
4106 !! test
4107 Unbalanced closing non-block tags don't break a list
4108 (Disabled since php parser generates broken html -- relies on Tidy to fix up)
4109 !! options
4110 disabled
4111 !! input
4112 <span>
4113 *a</span><span>
4114 *b</span>
4115 !! result
4116 <p><span></span>
4117 </p>
4118 <ul><li>a<span></span>
4119 </li><li>b
4120 </li></ul>
4121 !! end
4122
4123 !! test
4124 List items are not parsed correctly following a <pre> block (bug 785)
4125 !! input
4126 * <pre>foo</pre>
4127 * <pre>bar</pre>
4128 * zar
4129 !! result
4130 <ul><li> <pre>foo</pre>
4131 </li><li> <pre>bar</pre>
4132 </li><li> zar
4133 </li></ul>
4134
4135 !! end
4136
4137 !! test
4138 List items from template
4139 !! input
4140
4141 {{inner list}}
4142 * item 2
4143
4144 * item 0
4145 {{inner list}}
4146 * item 2
4147
4148 * item 0
4149 * notSOL{{inner list}}
4150 * item 2
4151 !! result
4152 <ul><li> item 1
4153 </li><li> item 2
4154 </li></ul>
4155 <ul><li> item 0
4156 </li><li> item 1
4157 </li><li> item 2
4158 </li></ul>
4159 <ul><li> item 0
4160 </li><li> notSOL
4161 </li><li> item 1
4162 </li><li> item 2
4163 </li></ul>
4164
4165 !! end
4166
4167 !! test
4168 List interrupted by empty line or heading
4169 !! input
4170 * foo
4171
4172 ** bar
4173 == A heading ==
4174 * Another list item
4175 !! result
4176 <ul><li> foo
4177 </li></ul>
4178 <ul><li><ul><li> bar
4179 </li></ul>
4180 </li></ul>
4181 <h2><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: A heading">edit</a>]</span> <span class="mw-headline" id="A_heading"> A heading </span></h2>
4182 <ul><li> Another list item
4183 </li></ul>
4184
4185 !!end
4186
4187 !!test
4188 Multiple list tags generated by templates
4189 !!input
4190 {{echo|<li>}}a
4191 {{echo|<li>}}b
4192 {{echo|<li>}}c
4193 !!result
4194 <li>a
4195 <li>b
4196 <li>c</li>
4197 </li>
4198 </li>
4199
4200 !!end
4201
4202 ###
4203 ### Magic Words
4204 ###
4205
4206 !! test
4207 Magic Word: {{CURRENTDAY}}
4208 !! input
4209 {{CURRENTDAY}}
4210 !! result
4211 <p>1
4212 </p>
4213 !! end
4214
4215 !! test
4216 Magic Word: {{CURRENTDAY2}}
4217 !! input
4218 {{CURRENTDAY2}}
4219 !! result
4220 <p>01
4221 </p>
4222 !! end
4223
4224 !! test
4225 Magic Word: {{CURRENTDAYNAME}}
4226 !! input
4227 {{CURRENTDAYNAME}}
4228 !! result
4229 <p>Thursday
4230 </p>
4231 !! end
4232
4233 !! test
4234 Magic Word: {{CURRENTDOW}}
4235 !! input
4236 {{CURRENTDOW}}
4237 !! result
4238 <p>4
4239 </p>
4240 !! end
4241
4242 !! test
4243 Magic Word: {{CURRENTMONTH}}
4244 !! input
4245 {{CURRENTMONTH}}
4246 !! result
4247 <p>01
4248 </p>
4249 !! end
4250
4251 !! test
4252 Magic Word: {{CURRENTMONTHABBREV}}
4253 !! input
4254 {{CURRENTMONTHABBREV}}
4255 !! result
4256 <p>Jan
4257 </p>
4258 !! end
4259
4260 !! test
4261 Magic Word: {{CURRENTMONTHNAME}}
4262 !! input
4263 {{CURRENTMONTHNAME}}
4264 !! result
4265 <p>January
4266 </p>
4267 !! end
4268
4269 !! test
4270 Magic Word: {{CURRENTMONTHNAMEGEN}}
4271 !! input
4272 {{CURRENTMONTHNAMEGEN}}
4273 !! result
4274 <p>January
4275 </p>
4276 !! end
4277
4278 !! test
4279 Magic Word: {{CURRENTTIME}}
4280 !! input
4281 {{CURRENTTIME}}
4282 !! result
4283 <p>00:02
4284 </p>
4285 !! end
4286
4287 !! test
4288 Magic Word: {{CURRENTWEEK}} (@bug 4594)
4289 !! input
4290 {{CURRENTWEEK}}
4291 !! result
4292 <p>1
4293 </p>
4294 !! end
4295
4296 !! test
4297 Magic Word: {{CURRENTYEAR}}
4298 !! input
4299 {{CURRENTYEAR}}
4300 !! result
4301 <p>1970
4302 </p>
4303 !! end
4304
4305 !! test
4306 Magic Word: {{FULLPAGENAME}}
4307 !! options
4308 title=[[User:Ævar Arnfjörð Bjarmason]]
4309 !! input
4310 {{FULLPAGENAME}}
4311 !! result
4312 <p>User:Ævar Arnfjörð Bjarmason
4313 </p>
4314 !! end
4315
4316 !! test
4317 Magic Word: {{FULLPAGENAMEE}}
4318 !! options
4319 title=[[User:Ævar Arnfjörð Bjarmason]]
4320 !! input
4321 {{FULLPAGENAMEE}}
4322 !! result
4323 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
4324 </p>
4325 !! end
4326
4327 !! test
4328 Magic Word: {{NAMESPACE}}
4329 !! options
4330 title=[[User:Ævar Arnfjörð Bjarmason]]
4331 !! input
4332 {{NAMESPACE}}
4333 !! result
4334 <p>User
4335 </p>
4336 !! end
4337
4338 !! test
4339 Magic Word: {{NAMESPACEE}}
4340 !! options
4341 title=[[User:Ævar Arnfjörð Bjarmason]]
4342 !! input
4343 {{NAMESPACEE}}
4344 !! result
4345 <p>User
4346 </p>
4347 !! end
4348
4349 !! test
4350 Magic Word: {{NAMESPACENUMBER}}
4351 !! options
4352 title=[[User:Ævar Arnfjörð Bjarmason]]
4353 !! input
4354 {{NAMESPACENUMBER}}
4355 !! result
4356 <p>2
4357 </p>
4358 !! end
4359
4360 !! test
4361 Magic Word: {{NUMBEROFFILES}}
4362 !! input
4363 {{NUMBEROFFILES}}
4364 !! result
4365 <p>2
4366 </p>
4367 !! end
4368
4369 !! test
4370 Magic Word: {{PAGENAME}}
4371 !! options
4372 title=[[User:Ævar Arnfjörð Bjarmason]]
4373 !! input
4374 {{PAGENAME}}
4375 !! result
4376 <p>Ævar Arnfjörð Bjarmason
4377 </p>
4378 !! end
4379
4380 !! test
4381 Magic Word: {{PAGENAME}} with metacharacters
4382 !! options
4383 title=[['foo & bar = baz']]
4384 !! input
4385 ''{{PAGENAME}}''
4386 !! result
4387 <p><i>&#39;foo &#38; bar &#61; baz&#39;</i>
4388 </p>
4389 !! end
4390
4391 !! test
4392 Magic Word: {{PAGENAME}} with metacharacters (bug 26781)
4393 !! options
4394 title=[[*RFC 1234 http://example.com/]]
4395 !! input
4396 {{PAGENAME}}
4397 !! result
4398 <p>&#42;RFC&#32;1234 http&#58;//example.com/
4399 </p>
4400 !! end
4401
4402 !! test
4403 Magic Word: {{PAGENAMEE}}
4404 !! options
4405 title=[[User:Ævar Arnfjörð Bjarmason]]
4406 !! input
4407 {{PAGENAMEE}}
4408 !! result
4409 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
4410 </p>
4411 !! end
4412
4413 !! test
4414 Magic Word: {{PAGENAMEE}} with metacharacters (bug 26781)
4415 !! options
4416 title=[[*RFC 1234 http://example.com/]]
4417 !! input
4418 {{PAGENAMEE}}
4419 !! result
4420 <p>&#42;RFC_1234_http&#58;//example.com/
4421 </p>
4422 !! end
4423
4424 !! test
4425 Magic Word: {{REVISIONID}}
4426 !! input
4427 {{REVISIONID}}
4428 !! result
4429 <p>1337
4430 </p>
4431 !! end
4432
4433 !! test
4434 Magic Word: {{SCRIPTPATH}}
4435 !! input
4436 {{SCRIPTPATH}}
4437 !! result
4438 <p>/
4439 </p>
4440 !! end
4441
4442 !! test
4443 Magic Word: {{SERVER}}
4444 !! input
4445 {{SERVER}}
4446 !! result
4447 <p><a rel="nofollow" class="external free" href="http://Britney-Spears">http://Britney-Spears</a>
4448 </p>
4449 !! end
4450
4451 !! test
4452 Magic Word: {{SERVERNAME}}
4453 !! input
4454 {{SERVERNAME}}
4455 !! result
4456 <p>Britney-Spears
4457 </p>
4458 !! end
4459
4460 !! test
4461 Magic Word: {{SITENAME}}
4462 !! input
4463 {{SITENAME}}
4464 !! result
4465 <p>MediaWiki
4466 </p>
4467 !! end
4468
4469 !! test
4470 Namespace 1 {{ns:1}}
4471 !! input
4472 {{ns:1}}
4473 !! result
4474 <p>Talk
4475 </p>
4476 !! end
4477
4478 !! test
4479 Namespace 1 {{ns:01}}
4480 !! input
4481 {{ns:01}}
4482 !! result
4483 <p>Talk
4484 </p>
4485 !! end
4486
4487 !! test
4488 Namespace 0 {{ns:0}} (bug 4783)
4489 !! input
4490 {{ns:0}}
4491 !! result
4492
4493 !! end
4494
4495 !! test
4496 Namespace 0 {{ns:00}} (bug 4783)
4497 !! input
4498 {{ns:00}}
4499 !! result
4500
4501 !! end
4502
4503 !! test
4504 Namespace -1 {{ns:-1}}
4505 !! input
4506 {{ns:-1}}
4507 !! result
4508 <p>Special
4509 </p>
4510 !! end
4511
4512 !! test
4513 Namespace User {{ns:User}}
4514 !! input
4515 {{ns:User}}
4516 !! result
4517 <p>User
4518 </p>
4519 !! end
4520
4521 !! test
4522 Namespace User talk {{ns:User_talk}}
4523 !! input
4524 {{ns:User_talk}}
4525 !! result
4526 <p>User talk
4527 </p>
4528 !! end
4529
4530 !! test
4531 Namespace User talk {{ns:uSeR tAlK}}
4532 !! input
4533 {{ns:uSeR tAlK}}
4534 !! result
4535 <p>User talk
4536 </p>
4537 !! end
4538
4539 !! test
4540 Namespace File {{ns:File}}
4541 !! input
4542 {{ns:File}}
4543 !! result
4544 <p>File
4545 </p>
4546 !! end
4547
4548 !! test
4549 Namespace File {{ns:Image}}
4550 !! input
4551 {{ns:Image}}
4552 !! result
4553 <p>File
4554 </p>
4555 !! end
4556
4557 !! test
4558 Namespace (lang=de) Benutzer {{ns:User}}
4559 !! options
4560 language=de
4561 !! input
4562 {{ns:User}}
4563 !! result
4564 <p>Benutzer
4565 </p>
4566 !! end
4567
4568 !! test
4569 Namespace (lang=de) Benutzer Diskussion {{ns:3}}
4570 !! options
4571 language=de
4572 !! input
4573 {{ns:3}}
4574 !! result
4575 <p>Benutzer Diskussion
4576 </p>
4577 !! end
4578
4579
4580 !! test
4581 Urlencode
4582 !! input
4583 {{urlencode:hi world?!}}
4584 {{urlencode:hi world?!|WIKI}}
4585 {{urlencode:hi world?!|PATH}}
4586 {{urlencode:hi world?!|QUERY}}
4587 !! result
4588 <p>hi+world%3F%21
4589 hi_world%3F!
4590 hi%20world%3F%21
4591 hi+world%3F%21
4592 </p>
4593 !! end
4594
4595 ###
4596 ### Magic links
4597 ###
4598 !! test
4599 Magic links: internal link to RFC (bug 479)
4600 !! input
4601 [[RFC 123]]
4602 !! result
4603 <p><a href="/index.php?title=RFC_123&amp;action=edit&amp;redlink=1" class="new" title="RFC 123 (page does not exist)">RFC 123</a>
4604 </p>
4605 !! end
4606
4607 !! test
4608 Magic links: RFC (bug 479)
4609 !! input
4610 RFC 822
4611 !! result
4612 <p><a class="external mw-magiclink-rfc" href="//tools.ietf.org/html/rfc822">RFC 822</a>
4613 </p>
4614 !! end
4615
4616 !! test
4617 Magic links: ISBN (bug 1937)
4618 !! input
4619 ISBN 0-306-40615-2
4620 !! result
4621 <p><a href="/wiki/Special:BookSources/0306406152" class="internal mw-magiclink-isbn">ISBN 0-306-40615-2</a>
4622 </p>
4623 !! end
4624
4625 !! test
4626 Magic links: PMID incorrectly converts space to underscore
4627 !! input
4628 PMID 1234
4629 !! result
4630 <p><a class="external mw-magiclink-pmid" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a>
4631 </p>
4632 !! end
4633
4634 ###
4635 ### Templates
4636 ####
4637
4638 !! test
4639 Nonexistent template
4640 !! input
4641 {{thistemplatedoesnotexist}}
4642 !! result
4643 <p><a href="/index.php?title=Template:Thistemplatedoesnotexist&amp;action=edit&amp;redlink=1" class="new" title="Template:Thistemplatedoesnotexist (page does not exist)">Template:Thistemplatedoesnotexist</a>
4644 </p>
4645 !! end
4646
4647 !! test
4648 Template with invalid target containing tags
4649 !! input
4650 {{a<b>b</b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
4651 !! result
4652 <p>{{a<b>b</b>|foo|a=b|a = b}}
4653 </p>
4654 !! end
4655
4656 !! test
4657 Template with invalid target containing unclosed tag
4658 !! input
4659 {{a<b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
4660 !! result
4661 <p>{{a<b>|foo|a=b|a = b}}</b>
4662 </p>
4663 !! end
4664
4665 !! article
4666 Template:test
4667 !! text
4668 This is a test template
4669 !! endarticle
4670
4671 !! test
4672 Simple template
4673 !! input
4674 {{test}}
4675 !! result
4676 <p>This is a test template
4677 </p>
4678 !! end
4679
4680 !! test
4681 Template with explicit namespace
4682 !! input
4683 {{Template:test}}
4684 !! result
4685 <p>This is a test template
4686 </p>
4687 !! end
4688
4689
4690 !! article
4691 Template:paramtest
4692 !! text
4693 This is a test template with parameter {{{param}}}
4694 !! endarticle
4695
4696 !! test
4697 Template parameter
4698 !! input
4699 {{paramtest|param=foo}}
4700 !! result
4701 <p>This is a test template with parameter foo
4702 </p>
4703 !! end
4704
4705 !! article
4706 Template:paramtestnum
4707 !! text
4708 [[{{{1}}}|{{{2}}}]]
4709 !! endarticle
4710
4711 !! test
4712 Template unnamed parameter
4713 !! input
4714 {{paramtestnum|Main Page|the main page}}
4715 !! result
4716 <p><a href="/wiki/Main_Page" title="Main Page">the main page</a>
4717 </p>
4718 !! end
4719
4720 !! article
4721 Template:templatesimple
4722 !! text
4723 (test)
4724 !! endarticle
4725
4726 !! article
4727 Template:templateredirect
4728 !! text
4729 #redirect [[Template:templatesimple]]
4730 !! endarticle
4731
4732 !! article
4733 Template:templateasargtestnum
4734 !! text
4735 {{{{{1}}}}}
4736 !! endarticle
4737
4738 !! article
4739 Template:templateasargtest
4740 !! text
4741 {{template{{{templ}}}}}
4742 !! endarticle
4743
4744 !! article
4745 Template:templateasargtest2
4746 !! text
4747 {{{{{templ}}}}}
4748 !! endarticle
4749
4750 !! test
4751 Template with template name as unnamed argument
4752 !! input
4753 {{templateasargtestnum|templatesimple}}
4754 !! result
4755 <p>(test)
4756 </p>
4757 !! end
4758
4759 !! test
4760 Template with template name as argument
4761 !! input
4762 {{templateasargtest|templ=simple}}
4763 !! result
4764 <p>(test)
4765 </p>
4766 !! end
4767
4768 !! test
4769 Template with template name as argument (2)
4770 !! input
4771 {{templateasargtest2|templ=templatesimple}}
4772 !! result
4773 <p>(test)
4774 </p>
4775 !! end
4776
4777 !! article
4778 Template:templateasargtestdefault
4779 !! text
4780 {{{{{templ|templatesimple}}}}}
4781 !! endarticle
4782
4783 !! article
4784 Template:templa
4785 !! text
4786 '''templ'''
4787 !! endarticle
4788
4789 !! test
4790 Template with default value
4791 !! input
4792 {{templateasargtestdefault}}
4793 !! result
4794 <p>(test)
4795 </p>
4796 !! end
4797
4798 !! test
4799 Template with default value (value set)
4800 !! input
4801 {{templateasargtestdefault|templ=templa}}
4802 !! result
4803 <p><b>templ</b>
4804 </p>
4805 !! end
4806
4807 !! test
4808 Template redirect
4809 !! input
4810 {{templateredirect}}
4811 !! result
4812 <p>(test)
4813 </p>
4814 !! end
4815
4816 !! test
4817 Template with argument in separate line
4818 !! input
4819 {{ templateasargtest |
4820 templ = simple }}
4821 !! result
4822 <p>(test)
4823 </p>
4824 !! end
4825
4826 !! test
4827 Template with complex template as argument
4828 !! input
4829 {{paramtest|
4830 param ={{ templateasargtest |
4831 templ = simple }}}}
4832 !! result
4833 <p>This is a test template with parameter (test)
4834 </p>
4835 !! end
4836
4837 !! test
4838 Template with thumb image (with link in description)
4839 !! input
4840 {{paramtest|
4841 param =[[Image:noimage.png|thumb|[[no link|link]] [[no link|caption]]]]}}
4842 !! result
4843 This is a test template with parameter <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/index.php?title=Special:Upload&amp;wpDestFile=Noimage.png" class="new" title="File:Noimage.png">File:Noimage.png</a> <div class="thumbcaption"><a href="/index.php?title=No_link&amp;action=edit&amp;redlink=1" class="new" title="No link (page does not exist)">link</a> <a href="/index.php?title=No_link&amp;action=edit&amp;redlink=1" class="new" title="No link (page does not exist)">caption</a></div></div></div>
4844
4845 !! end
4846
4847 !! article
4848 Template:complextemplate
4849 !! text
4850 {{{1}}} {{paramtest|
4851 param ={{{param}}}}}
4852 !! endarticle
4853
4854 !! test
4855 Template with complex arguments
4856 !! input
4857 {{complextemplate|
4858 param ={{ templateasargtest |
4859 templ = simple }}|[[Template:complextemplate|link]]}}
4860 !! result
4861 <p><a href="/wiki/Template:Complextemplate" title="Template:Complextemplate">link</a> This is a test template with parameter (test)
4862 </p>
4863 !! end
4864
4865 !! test
4866 BUG 553: link with two variables in a piped link
4867 !! input
4868 {|
4869 |[[{{{1}}}|{{{2}}}]]
4870 |}
4871 !! result
4872 <table>
4873 <tr>
4874 <td>[[{{{1}}}|{{{2}}}]]
4875 </td></tr></table>
4876
4877 !! end
4878
4879 !! test
4880 Magic variable as template parameter
4881 !! input
4882 {{paramtest|param={{SITENAME}}}}
4883 !! result
4884 <p>This is a test template with parameter MediaWiki
4885 </p>
4886 !! end
4887
4888 !! article
4889 Template:linktest
4890 !! text
4891 [[{{{param}}}|link]]
4892 !! endarticle
4893
4894 !! test
4895 Template parameter as link source
4896 !! input
4897 {{linktest|param=Main Page}}
4898 !! result
4899 <p><a href="/wiki/Main_Page" title="Main Page">link</a>
4900 </p>
4901 !! end
4902
4903 !!test
4904 Template-generated attribute string (k='v')
4905 !!input
4906 <span {{attr_str|id|v1}}>bar</span>
4907 !!result
4908 <p><span id="v1">bar</span>
4909 </p>
4910 !!end
4911
4912 !!article
4913 Template:paramtest2
4914 !! text
4915 including another template, {{paramtest|param={{{arg}}}}}
4916 !! endarticle
4917
4918 !! test
4919 Template passing argument to another template
4920 !! input
4921 {{paramtest2|arg='hmm'}}
4922 !! result
4923 <p>including another template, This is a test template with parameter 'hmm'
4924 </p>
4925 !! end
4926
4927 !! article
4928 Template:Linktest2
4929 !! text
4930 Main Page
4931 !! endarticle
4932
4933 !! test
4934 Template as link source
4935 !! input
4936 [[{{linktest2}}]]
4937
4938 [[{{linktest2}}|Main Page]]
4939
4940 [[{{linktest2}}]]Page
4941 !! result
4942 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
4943 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
4944 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>Page
4945 </p>
4946 !! end
4947
4948
4949 !! article
4950 Template:loop1
4951 !! text
4952 {{loop2}}
4953 !! endarticle
4954
4955 !! article
4956 Template:loop2
4957 !! text
4958 {{loop1}}
4959 !! endarticle
4960
4961 !! test
4962 Template infinite loop
4963 !! input
4964 {{loop1}}
4965 !! result
4966 <p><span class="error">Template loop detected: <a href="/wiki/Template:Loop1" title="Template:Loop1">Template:Loop1</a></span>
4967 </p>
4968 !! end
4969
4970 !! test
4971 Template from main namespace
4972 !! input
4973 {{:Main Page}}
4974 !! result
4975 <p>blah blah
4976 </p>
4977 !! end
4978
4979 !! article
4980 Template:table
4981 !! text
4982 {|
4983 | 1 || 2
4984 |-
4985 | 3 || 4
4986 |}
4987 !! endarticle
4988
4989 !! test
4990 BUG 529: Template with table, not included at beginning of line
4991 !! input
4992 foo {{table}}
4993 !! result
4994 <p>foo
4995 </p>
4996 <table>
4997 <tr>
4998 <td> 1 </td>
4999 <td> 2
5000 </td></tr>
5001 <tr>
5002 <td> 3 </td>
5003 <td> 4
5004 </td></tr></table>
5005
5006 !! end
5007
5008 !! test
5009 BUG 523: Template shouldn't eat newline (or add an extra one before table)
5010 !! input
5011 foo
5012 {{table}}
5013 !! result
5014 <p>foo
5015 </p>
5016 <table>
5017 <tr>
5018 <td> 1 </td>
5019 <td> 2
5020 </td></tr>
5021 <tr>
5022 <td> 3 </td>
5023 <td> 4
5024 </td></tr></table>
5025
5026 !! end
5027
5028 !! test
5029 BUG 41: Template parameters shown as broken links
5030 !! input
5031 {{{parameter}}}
5032 !! result
5033 <p>{{{parameter}}}
5034 </p>
5035 !! end
5036
5037 !! test
5038 Template with targets containing wikilinks
5039 !! input
5040 {{[[foo]]}}
5041
5042 {{[[{{echo|foo}}]]}}
5043
5044 {{{{echo|[[foo}}]]}}
5045 !! result
5046 <p>{{<a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">foo</a>}}
5047 </p><p>{{<a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">foo</a>}}
5048 </p><p>{{[[foo}}]]
5049 </p>
5050 !! end
5051
5052 !! article
5053 Template:MSGNW test
5054 !! text
5055 ''None'' of '''this''' should be
5056 * interpreted
5057 but rather passed unmodified
5058 {{test}}
5059 !! endarticle
5060
5061 # hmm, fix this or just deprecate msgnw and document its behavior?
5062 !! test
5063 msgnw keyword
5064 !! options
5065 disabled
5066 !! input
5067 {{msgnw:MSGNW test}}
5068 !! result
5069 <p>''None'' of '''this''' should be
5070 * interpreted
5071 but rather passed unmodified
5072 {{test}}
5073 </p>
5074 !! end
5075
5076 !! test
5077 int keyword
5078 !! input
5079 {{int:youhavenewmessages|lots of money|not!}}
5080 !! result
5081 <p>You have lots of money (not!).
5082 </p>
5083 !! end
5084
5085 !! article
5086 Template:Includes
5087 !! text
5088 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
5089 !! endarticle
5090
5091 !! test
5092 <includeonly> and <noinclude> being included
5093 !! input
5094 {{Includes}}
5095 !! result
5096 <p>Foobar
5097 </p>
5098 !! end
5099
5100 !! article
5101 Template:Includes2
5102 !! text
5103 <onlyinclude>Foo</onlyinclude>bar
5104 !! endarticle
5105
5106 !! test
5107 <onlyinclude> being included
5108 !! input
5109 {{Includes2}}
5110 !! result
5111 <p>Foo
5112 </p>
5113 !! end
5114
5115
5116 !! article
5117 Template:Includes3
5118 !! text
5119 <onlyinclude>Foo</onlyinclude>bar<includeonly>zar</includeonly>
5120 !! endarticle
5121
5122 !! test
5123 <onlyinclude> and <includeonly> being included
5124 !! input
5125 {{Includes3}}
5126 !! result
5127 <p>Foo
5128 </p>
5129 !! end
5130
5131 !! test
5132 <includeonly> and <noinclude> on a page
5133 !! input
5134 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
5135 !! result
5136 <p>Foozar
5137 </p>
5138 !! end
5139
5140 !! test
5141 Un-closed <noinclude>
5142 !! input
5143 <noinclude>
5144 !! result
5145 !! end
5146
5147 !! test
5148 <onlyinclude> on a page
5149 !! input
5150 <onlyinclude>Foo</onlyinclude>bar
5151 !! result
5152 <p>Foobar
5153 </p>
5154 !! end
5155
5156 !! test
5157 Un-closed <onlyinclude>
5158 !! input
5159 <onlyinclude>
5160 !! result
5161 !! end
5162
5163 !!test
5164 Self-closed noinclude, includeonly, onlyinclude tags
5165 !!input
5166 <noinclude />
5167 <includeonly />
5168 <onlyinclude />
5169 !!result
5170 <p><br />
5171 </p>
5172 !!end
5173
5174 !!test
5175 Unbalanced includeonly and noinclude tags
5176 !!input
5177 {|
5178 |a</noinclude>
5179 |b</noinclude></noinclude>
5180 |c</noinclude></includeonly>
5181 |d</includeonly></includeonly>
5182 |}
5183 !!result
5184 <table>
5185 <tr>
5186 <td>a
5187 </td>
5188 <td>b
5189 </td>
5190 <td>c&lt;/includeonly&gt;
5191 </td>
5192 <td>d&lt;/includeonly&gt;&lt;/includeonly&gt;
5193 </td></tr></table>
5194
5195 !!end
5196
5197 !! article
5198 Template:Includeonly section
5199 !! text
5200 <includeonly>
5201 ==Includeonly section==
5202 </includeonly>
5203 ==Section T-1==
5204 !!endarticle
5205
5206 !! test
5207 Bug 6563: Edit link generation for section shown by <includeonly>
5208 !! input
5209 {{includeonly section}}
5210 !! result
5211 <h2><span class="editsection">[<a href="/index.php?title=Template:Includeonly_section&amp;action=edit&amp;section=T-1" title="Template:Includeonly section">edit</a>]</span> <span class="mw-headline" id="Includeonly_section">Includeonly section</span></h2>
5212 <h2><span class="editsection">[<a href="/index.php?title=Template:Includeonly_section&amp;action=edit&amp;section=T-2" title="Template:Includeonly section">edit</a>]</span> <span class="mw-headline" id="Section_T-1">Section T-1</span></h2>
5213
5214 !! end
5215
5216 # Uses same input as the contents of [[Template:Includeonly section]]
5217 !! test
5218 Bug 6563: Section extraction for section shown by <includeonly>
5219 !! options
5220 section=T-2
5221 !! input
5222 <includeonly>
5223 ==Includeonly section==
5224 </includeonly>
5225 ==Section T-2==
5226 !! result
5227 ==Section T-2==
5228 !! end
5229
5230 !! test
5231 Bug 6563: Edit link generation for section suppressed by <includeonly>
5232 !! input
5233 <includeonly>
5234 ==Includeonly section==
5235 </includeonly>
5236 ==Section 1==
5237 !! result
5238 <h2><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: Section 1">edit</a>]</span> <span class="mw-headline" id="Section_1">Section 1</span></h2>
5239
5240 !! end
5241
5242 !! test
5243 Bug 6563: Section extraction for section suppressed by <includeonly>
5244 !! options
5245 section=1
5246 !! input
5247 <includeonly>
5248 ==Includeonly section==
5249 </includeonly>
5250 ==Section 1==
5251 !! result
5252 ==Section 1==
5253 !! end
5254
5255 !! test
5256 Un-closed <includeonly>
5257 !! input
5258 <includeonly>
5259 !! result
5260 !! end
5261
5262 ###
5263 ### <includeonly> and <noinclude> in attributes
5264 ###
5265 !!test
5266 0. includeonly around the entire attribute
5267 !!input
5268 <span <includeonly>id="v1"</includeonly><noinclude>id="v2"</noinclude>>bar</span>
5269 !!result
5270 <p><span id="v2">bar</span>
5271 </p>
5272 !!end
5273
5274 !!test
5275 1. includeonly in html attr key
5276 !!input
5277 <span <noinclude>id</noinclude><includeonly>about</includeonly>="foo">bar</span>
5278 !!result
5279 <p><span id="foo">bar</span>
5280 </p>
5281 !!end
5282
5283 !!test
5284 2. includeonly in html attr value
5285 !!input
5286 <span id="<noinclude>v1</noinclude><includeonly>v2</includeonly>">bar</span>
5287 <span id=<noinclude>"v1"</noinclude><includeonly>"v2"</includeonly>>bar</span>
5288 !!result
5289 <p><span id="v1">bar</span>
5290 <span id="v1">bar</span>
5291 </p>
5292 !!end
5293
5294 !!test
5295 3. includeonly in part of an attr value
5296 !!input
5297 <span style="color:<noinclude>red</noinclude><includeonly>blue</includeonly>;">bar</span>
5298 !!result
5299 <p><span style="color:red;">bar</span>
5300 </p>
5301 !!end
5302
5303 ###
5304 ### Testing parsing of templates where a template arg
5305 ### has the same name as the template itself.
5306 ###
5307
5308 !! article
5309 Template:quote
5310 !! text
5311 {{{quote|{{{1}}}}}}
5312 !! endarticle
5313
5314 !!test
5315 Templates: Template Name/Arg clash: 1. Use of positional param
5316 !!input
5317 {{quote|foo}}
5318 !!result
5319 <p>foo
5320 </p>
5321 !!end
5322
5323 !!test
5324 Templates: Template Name/Arg clash: 2. Use of named param
5325 !!input
5326 {{quote|quote=foo}}
5327 !!result
5328 <p>foo
5329 </p>
5330 !!end
5331
5332 !!test
5333 Templates: Template Name/Arg clash: 3. Use of named param with empty input
5334 !!input
5335 {{quote|quote}}
5336 !!result
5337 <p>quote
5338 </p>
5339 !!end
5340
5341 ###
5342 ### Parsoid-centric tests to stress Parsoid's ability to RT them unchanged
5343 ###
5344
5345 !!test
5346 Templates: 1. Simple use
5347 !!input
5348 {{echo|Foo}}
5349 !!result
5350 <p>Foo
5351 </p>
5352 !!end
5353
5354 !!test
5355 Templates: 2. Inside a block tag
5356 !!input
5357 <div>{{echo|Foo}}</div>
5358 !!result
5359 <div>Foo</div>
5360
5361 !!end
5362
5363 !!test
5364 Templates: P-wrapping: 1a. Templates on consecutive lines
5365 !!input
5366 {{echo|Foo}}
5367 {{echo|bar}}
5368 !!result
5369 <p>Foo
5370 bar
5371 </p>
5372 !!end
5373
5374 !!test
5375 Templates: P-wrapping: 1b. Templates on consecutive lines
5376 !!input
5377 Foo
5378
5379 {{echo|bar}}
5380 {{echo|baz}}
5381 !!result
5382 <p>Foo
5383 </p><p>bar
5384 baz
5385 </p>
5386 !!end
5387
5388 !!test
5389 Templates: P-wrapping: 1c. Templates on consecutive lines
5390 !!input
5391 {{echo|Foo}}
5392 {{echo|bar}} <div>baz</div>
5393 !!result
5394 <p>Foo
5395 </p>
5396 bar <div>baz</div>
5397
5398 !!end
5399
5400 !!test
5401 Templates: Inline Text: 1. Multiple tmeplate uses
5402 !!input
5403 {{echo|Foo}}bar{{echo|baz}}
5404 !!result
5405 <p>Foobarbaz
5406 </p>
5407 !!end
5408
5409 !!test
5410 Templates: Inline Text: 2. Back-to-back template uses
5411 !!input
5412 {{echo|Foo}}{{echo|bar}}
5413 !!result
5414 <p>Foobar
5415 </p>
5416 !!end
5417
5418 !!test
5419 Templates: Block Tags: 1. Multiple template uses
5420 !!input
5421 {{echo|<div>Foo</div>}}<div>bar</div>{{echo|<div>baz</div>}}
5422 !!result
5423 <div>Foo</div><div>bar</div><div>baz</div>
5424
5425 !!end
5426
5427 !!test
5428 Templates: Block Tags: 2. Back-to-back template uses
5429 !!input
5430 {{echo|<div>Foo</div>}}{{echo|<div>bar</div>}}
5431 !!result
5432 <div>Foo</div><div>bar</div>
5433
5434 !!end
5435
5436 !!test
5437 Templates: Links: 1. Simple example
5438 !!input
5439 {{echo|[[Foo|bar]]}}
5440 !!result
5441 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
5442 </p>
5443 !!end
5444
5445 !!test
5446 Templates: Links: 2. Generation of link href
5447 !!input
5448 [[{{echo|Foo}}|bar]]
5449 !!result
5450 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
5451 </p>
5452 !!end
5453
5454 !!test
5455 Templates: Links: 3. Generation of part of a link href
5456 !!input
5457 [[Fo{{echo|o}}|bar]]
5458
5459 [[Foo{{echo|bar}}]]
5460
5461 [[Foo{{echo|bar}}baz]]
5462
5463 [[Foo{{echo|bar}}|bar]]
5464
5465 [[:Foo{{echo|bar}}]]
5466
5467 [[:Foo{{echo|bar}}|bar]]
5468 !!result
5469 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
5470 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
5471 </p><p><a href="/index.php?title=Foobarbaz&amp;action=edit&amp;redlink=1" class="new" title="Foobarbaz (page does not exist)">Foobarbaz</a>
5472 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
5473 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
5474 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
5475 </p>
5476 !!end
5477
5478 !!test
5479 Templates: Links: 4. Multiple templates generating link href
5480 !!input
5481 [[{{echo|F}}{{echo|o}}ob{{echo|ar}}]]
5482 !!result
5483 <p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
5484 </p>
5485 !!end
5486
5487 !!test
5488 Templates: Links: 5. Generation of link text
5489 !!input
5490 [[Foo|{{echo|bar}}]]
5491 !!result
5492 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
5493 </p>
5494 !!end
5495
5496 !!test
5497 Templates: Links: 5. Nested templates (only outermost template should be marked)
5498 !!input
5499 {{echo|[[{{echo|Foo}}|bar]]}}
5500 !!result
5501 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
5502 </p>
5503 !!end
5504
5505 !!test
5506 Templates: HTML Tag: 1. Generation of HTML attr. key
5507 !!input
5508 <div {{echo|style}}="color:red;">foo</div>
5509 !!result
5510 <div style="color:red;">foo</div>
5511
5512 !!end
5513
5514 !!test
5515 Templates: HTML Tag: 2. Generation of HTML attr. value
5516 !!input
5517 <div style={{echo|'color:red;'}}>foo</div>
5518 !!result
5519 <div style="color:red;">foo</div>
5520
5521 !!end
5522
5523 !!test
5524 Templates: HTML Tag: 3. Generation of HTML attr key and value
5525 !!input
5526 <div {{echo|style}}={{echo|'color:red;'}}>foo</div>
5527 !!result
5528 <div style="color:red;">foo</div>
5529
5530 !!end
5531
5532 !!test
5533 Templates: HTML Tag: 4. Generation of starting piece of HTML attr value
5534 !!input
5535 <div title="{{echo|This is a long title}} with just one piece templated">foo</div>
5536 !!result
5537 <div title="This is a long title with just one piece templated">foo</div>
5538
5539 !!end
5540
5541 !!test
5542 Templates: HTML Tag: 5. Generation of middle piece of HTML attr value
5543 !!input
5544 <div title="This is a long title with just {{echo|one piece}} templated">foo</div>
5545 !!result
5546 <div title="This is a long title with just one piece templated">foo</div>
5547
5548 !!end
5549
5550 !!test
5551 Templates: HTML Tag: 6. Generation of end piece of HTML attr value
5552 !!input
5553 <div title="This is a long title with just one piece {{echo|templated}}">foo</div>
5554 !!result
5555 <div title="This is a long title with just one piece templated">foo</div>
5556
5557 !!end
5558
5559 !!test
5560 Templates: HTML Tables: 1. Generating start of a HTML table
5561 !!input
5562 {{echo|<table><tr><td>foo</td>}}</tr></table>
5563 !!result
5564 <table><tr><td>foo</td></tr></table>
5565
5566 !!end
5567
5568 !!test
5569 Templates: HTML Tables: 2a. Generating middle of a HTML table
5570 !!input
5571 <table><tr>{{echo|<td>foo</td>}}</tr></table>
5572 !!result
5573 <table><tr><td>foo</td></tr></table>
5574
5575 !!end
5576
5577 !!test
5578 Templates: HTML Tables: 2b. Generating middle of a HTML table
5579 !!input
5580 <table>{{echo|<tr><td>foo</td></tr>}}</table>
5581 !!result
5582 <table><tr><td>foo</td></tr></table>
5583
5584 !!end
5585
5586 !!test
5587 Templates: HTML Tables: 3. Generating end of a HTML table
5588 !!input
5589 <table><tr>{{echo|<td>foo</td></tr></table>}}
5590 !!result
5591 <table><tr><td>foo</td></tr></table>
5592
5593 !!end
5594
5595 !!test
5596 Templates: HTML Tables: 4a. Generating a single tag of a HTML table
5597 !!input
5598 {{echo|<table>}}<tr><td>foo</td></tr></table>
5599 !!result
5600 <table><tr><td>foo</td></tr></table>
5601
5602 !!end
5603
5604 !!test
5605 Templates: HTML Tables: 4b. Generating a single tag of a HTML table
5606 !!input
5607 <table>{{echo|<tr>}}<td>foo</td></tr></table>
5608 !!result
5609 <table><tr><td>foo</td></tr></table>
5610
5611 !!end
5612
5613 !!test
5614 Templates: HTML Tables: 4c. Generating a single tag of a HTML table
5615 !!input
5616 <table><tr>{{echo|<td>}}foo</td></tr></table>
5617 !!result
5618 <table><tr><td>foo</td></tr></table>
5619
5620 !!end
5621
5622 !!test
5623 Templates: HTML Tables: 4d. Generating a single tag of a HTML table
5624 !!input
5625 <table><tr><td>foo{{echo|</td>}}</tr></table>
5626 !!result
5627 <table><tr><td>foo</td></tr></table>
5628
5629 !!end
5630
5631 !!test
5632 Templates: HTML Tables: 4e. Generating a single tag of a HTML table
5633 !!input
5634 <table><tr><td>foo</td>{{echo|</tr>}}</table>
5635 !!result
5636 <table><tr><td>foo</td></tr></table>
5637
5638 !!end
5639
5640 !!test
5641 Templates: HTML Tables: 4f. Generating a single tag of a HTML table
5642 !!input
5643 <table><tr><td>foo</td></tr>{{echo|</table>}}
5644 !!result
5645 <table><tr><td>foo</td></tr></table>
5646
5647 !!end
5648
5649 !!test
5650 Templates: Wiki Tables: 1. Fostering of entire template content
5651 !!input
5652 {|
5653 {{echo|a}}
5654 |}
5655 !!result
5656 <table>
5657 a
5658 <tr><td></td></tr></table>
5659
5660 !!end
5661
5662 !!test
5663 Templates: Wiki Tables: 2. Fostering of partial template content
5664 !!input
5665 {|
5666 {{echo|a
5667 <div>b</div>}}
5668 |}
5669 !!result
5670 <table>
5671 a
5672 <div>b</div>
5673 <tr><td></td></tr></table>
5674
5675 !!end
5676
5677 !!test
5678 Templates: Wiki Tables: 3. td-content via multiple templates
5679 !!input
5680 {|
5681 {{echo|{{pipe}}a}}{{echo|b}}
5682 |}
5683 !!result
5684 <table>
5685 <tr>
5686 <td>ab
5687 </td></tr></table>
5688
5689 !!end
5690
5691 !!test
5692 Templates: Wiki Tables: 4. Templated tags, no content
5693 !!input
5694 {{tbl-start}}
5695 {{tbl-end}}
5696 !!result
5697 <table>
5698 <tr><td></td></tr></table>
5699
5700 !!end
5701
5702 !!test
5703 Templates: Wiki Tables: 4. Templated tags, regular td-tags
5704 !!input
5705 {{tbl-start}}
5706 |foo
5707 {{tbl-end}}
5708 !!result
5709 <table>
5710 <tr>
5711 <td>foo
5712 </td></tr></table>
5713
5714 !!end
5715
5716 !!test
5717 Templates: Wiki Tables: 4. Templated tags, templated td-tags
5718 !!input
5719 {{tbl-start}}
5720 {{!}}foo
5721 {{tbl-end}}
5722 !!result
5723 <table>
5724 <tr>
5725 <td>foo
5726 </td></tr></table>
5727
5728 !!end
5729
5730 !!test
5731 Templates: Lists: Multi-line list-items via templates
5732 !!input
5733 *{{echo|a {{nonexistent|
5734 unused}}}}
5735 *{{echo|b {{nonexistent|
5736 unused}}}}
5737 !!result
5738 <ul><li>a <a href="/index.php?title=Template:Nonexistent&amp;action=edit&amp;redlink=1" class="new" title="Template:Nonexistent (page does not exist)">Template:Nonexistent</a>
5739 </li><li>b <a href="/index.php?title=Template:Nonexistent&amp;action=edit&amp;redlink=1" class="new" title="Template:Nonexistent (page does not exist)">Template:Nonexistent</a>
5740 </li></ul>
5741
5742 !!end
5743
5744 !!test
5745 Templates: Ugly nesting: 1. Quotes opened/closed across templates (echo)
5746 !!input
5747 {{echo|''a}}{{echo|b''c''d}}{{echo|''e}}
5748 !!result
5749 <p><i>ab</i>c<i>d</i>e
5750 </p>
5751 !!end
5752
5753 !!test
5754 Templates: Ugly nesting: 2. Quotes opened/closed across templates (echo_with_span)
5755 (PHP parser generates misnested html)
5756 !! options
5757 disabled
5758 !!input
5759 {{echo_with_span|''a}}{{echo_with_span|b''c''d}}{{echo_with_span|''e}}
5760 !!result
5761 <p><span><i>a</i></span><i><span>b</span></i><span>c</span><i>d</i><span>e</span></p>
5762 !!end
5763
5764 !!test
5765 Templates: Ugly nesting: 3. Quotes opened/closed across templates (echo_with_div)
5766 (PHP parser generates misnested html)
5767 !! options
5768 disabled
5769 !!input
5770 {{echo_with_div|''a}}{{echo_with_div|b''c''d}}{{echo_with_div|''e}}
5771 !!result
5772 <div><i>a</i></div>
5773 <div><i>b</i>c<i>d</i></div>
5774 <div>e</div>
5775 !!end
5776
5777 !!test
5778 Templates: Ugly nesting: 4. Divs opened/closed across templates
5779 !!input
5780 a<div>b{{echo|c</div>d}}e
5781 !!result
5782 a<div>bc</div>de
5783
5784 !!end
5785
5786 !!test
5787 Templates: Ugly templates: 1. Navbox template parses badly leading to table misnesting
5788 (Parsoid-centric)
5789 !! options
5790 disabled
5791 !!input
5792 {|
5793 |{{echo|foo</table>}}
5794 |bar
5795 |}
5796 !!result
5797 <table about="#mwt1" typeof="mw:Object/Template ">
5798 <tbody><tr><td>foo</td></tr></tbody></table><span about="#mwt1">
5799 bar</span><span about="#mwt1">
5800 </span>
5801 !!end
5802
5803 !!test
5804 Templates: Ugly templates: 2. Navbox template parses badly leading to table misnesting
5805 (Parsoid-centric)
5806 !! options
5807 disabled
5808 !!input
5809 <table>
5810 <tr>
5811 <td>
5812 <table>
5813 <tr>
5814 <td>1. {{echo|foo </table>}}</td>
5815 <td> bar </td>
5816 <td>2. {{echo|baz </table>}}</td>
5817 </tr>
5818 <tr>
5819 <td>abc</td>
5820 </tr>
5821 </table>
5822 </td>
5823 </tr>
5824 <tr>
5825 <td>xyz</td>
5826 </tr>
5827 </table>
5828 !!result
5829 <table about="#mwt1" typeof="mw:Object/Template">
5830 <tbody><tr >
5831 <td >
5832 <table >
5833 <tbody><tr >
5834 <td >1. foo </td></tr></tbody></table></td>
5835 <td > bar </td>
5836 <td >2. baz </td></tr></tbody></table><span about="#mwt1">
5837 </span><span about="#mwt1">
5838
5839 abc</span><span about="#mwt1">
5840 </span><span about="#mwt1">
5841 </span><span about="#mwt1">
5842 </span><span about="#mwt1">
5843 </span><span about="#mwt1">
5844
5845 xyz</span><span about="#mwt1">
5846 </span><span about="#mwt1">
5847 </span>
5848 !!end
5849
5850 !! test
5851 Templates: Ugly templates: 3. newline-only template parameter
5852 !! input
5853 foo {{echo|
5854 }}
5855 !! result
5856 <p>foo
5857 </p>
5858 !! end
5859
5860 # This looks like a bug: a single newline triggers p/br for some reason.
5861 !! test
5862 Templates: Ugly templates: 4. newline-only template parameter inconsistency
5863 !! input
5864 {{echo|
5865 }}
5866 !! result
5867 <p><br />
5868 </p>
5869 !! end
5870
5871
5872 !!test
5873 Parser Functions: 1. Simple example
5874 !!input
5875 {{uc:foo}}
5876 !!result
5877 <p>FOO
5878 </p>
5879 !!end
5880
5881 !!test
5882 Parser Functions: 2. Nested use (only outermost should be marked up)
5883 !!input
5884 {{uc:{{lc:FOO}}}}
5885 !!result
5886 <p>FOO
5887 </p>
5888 !!end
5889
5890 ###
5891 ### Pre-save transform tests
5892 ###
5893 !! test
5894 pre-save transform: subst:
5895 !! options
5896 PST
5897 !! input
5898 {{subst:test}}
5899 !! result
5900 This is a test template
5901 !! end
5902
5903 !! test
5904 pre-save transform: normal template
5905 !! options
5906 PST
5907 !! input
5908 {{test}}
5909 !! result
5910 {{test}}
5911 !! end
5912
5913 !! test
5914 pre-save transform: nonexistent template
5915 !! options
5916 PST
5917 !! input
5918 {{thistemplatedoesnotexist}}
5919 !! result
5920 {{thistemplatedoesnotexist}}
5921 !! end
5922
5923
5924 !! test
5925 pre-save transform: subst magic variables
5926 !! options
5927 PST
5928 !! input
5929 {{subst:SITENAME}}
5930 !! result
5931 MediaWiki
5932 !! end
5933
5934 # This is bug 89, which I fixed. -- wtm
5935 !! test
5936 pre-save transform: subst: templates with parameters
5937 !! options
5938 pst
5939 !! input
5940 {{subst:paramtest|param="something else"}}
5941 !! result
5942 This is a test template with parameter "something else"
5943 !! end
5944
5945 !! article
5946 Template:nowikitest
5947 !! text
5948 <nowiki>'''not wiki'''</nowiki>
5949 !! endarticle
5950
5951 !! test
5952 pre-save transform: nowiki in subst (bug 1188)
5953 !! options
5954 pst
5955 !! input
5956 {{subst:nowikitest}}
5957 !! result
5958 <nowiki>'''not wiki'''</nowiki>
5959 !! end
5960
5961
5962 !! article
5963 Template:commenttest
5964 !! text
5965 This template has <!-- a comment --> in it.
5966 !! endarticle
5967
5968 !! test
5969 pre-save transform: comment in subst (bug 1936)
5970 !! options
5971 pst
5972 !! input
5973 {{subst:commenttest}}
5974 !! result
5975 This template has <!-- a comment --> in it.
5976 !! end
5977
5978 !! test
5979 pre-save transform: unclosed tag
5980 !! options
5981 pst noxml
5982 !! input
5983 <nowiki>'''not wiki'''
5984 !! result
5985 <nowiki>'''not wiki'''
5986 !! end
5987
5988 !! test
5989 pre-save transform: mixed tag case
5990 !! options
5991 pst noxml
5992 !! input
5993 <NOwiki>'''not wiki'''</noWIKI>
5994 !! result
5995 <NOwiki>'''not wiki'''</noWIKI>
5996 !! end
5997
5998 !! test
5999 pre-save transform: unclosed comment in <nowiki>
6000 !! options
6001 pst noxml
6002 !! input
6003 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
6004 !! result
6005 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
6006 !!end
6007
6008 !! article
6009 Template:dangerous
6010 !!text
6011 <span onmouseover="alert('crap')">Oh no</span>
6012 !!endarticle
6013
6014 !!test
6015 (confirming safety of fix for subst bug 1936)
6016 !! input
6017 {{Template:dangerous}}
6018 !! result
6019 <p><span>Oh no</span>
6020 </p>
6021 !! end
6022
6023 !! test
6024 pre-save transform: comment containing gallery (bug 5024)
6025 !! options
6026 pst
6027 !! input
6028 <!-- <gallery>data</gallery> -->
6029 !!result
6030 <!-- <gallery>data</gallery> -->
6031 !!end
6032
6033 !! test
6034 pre-save transform: comment containing extension
6035 !! options
6036 pst
6037 !! input
6038 <!-- <tag>data</tag> -->
6039 !!result
6040 <!-- <tag>data</tag> -->
6041 !!end
6042
6043 !! test
6044 pre-save transform: comment containing nowiki
6045 !! options
6046 pst
6047 !! input
6048 <!-- <nowiki>data</nowiki> -->
6049 !!result
6050 <!-- <nowiki>data</nowiki> -->
6051 !!end
6052
6053 !! test
6054 pre-save transform: <noinclude> in subst (bug 3298)
6055 !! options
6056 pst
6057 !! input
6058 {{subst:Includes}}
6059 !! result
6060 Foobar
6061 !! end
6062
6063 !! test
6064 pre-save transform: <onlyinclude> in subst (bug 3298)
6065 !! options
6066 pst
6067 !! input
6068 {{subst:Includes2}}
6069 !! result
6070 Foo
6071 !! end
6072
6073 !! article
6074 Template:SubstTest
6075 !!text
6076 {{<includeonly>subst:</includeonly>Includes}}
6077 !! endarticle
6078
6079 !! article
6080 Template:SafeSubstTest
6081 !! text
6082 {{<includeonly>safesubst:</includeonly>Includes}}
6083 !! endarticle
6084
6085 !! test
6086 bug 22297: safesubst: works during PST
6087 !! options
6088 pst
6089 !! input
6090 {{subst:SafeSubstTest}}{{safesubst:SubstTest}}
6091 !! result
6092 FoobarFoobar
6093 !! end
6094
6095 !! test
6096 bug 22297: safesubst: works during normal parse
6097 !! input
6098 {{SafeSubstTest}}
6099 !! result
6100 <p>Foobar
6101 </p>
6102 !! end
6103
6104 !! test:
6105 subst: does not work during normal parse
6106 !! input
6107 {{SubstTest}}
6108 !! result
6109 <p>{{subst:Includes}}
6110 </p>
6111 !! end
6112
6113 !! test
6114 pre-save transform: context links ("pipe trick")
6115 !! options
6116 pst
6117 !! input
6118 [[Article (context)|]]
6119 [[Bar:Article|]]
6120 [[:Bar:Article|]]
6121 [[Bar:Article (context)|]]
6122 [[:Bar:Article (context)|]]
6123 [[|Article]]
6124 [[|Article (context)]]
6125 [[Bar:X (Y) Z|]]
6126 [[:Bar:X (Y) Z|]]
6127 !! result
6128 [[Article (context)|Article]]
6129 [[Bar:Article|Article]]
6130 [[:Bar:Article|Article]]
6131 [[Bar:Article (context)|Article]]
6132 [[:Bar:Article (context)|Article]]
6133 [[Article]]
6134 [[Article (context)]]
6135 [[Bar:X (Y) Z|X (Y) Z]]
6136 [[:Bar:X (Y) Z|X (Y) Z]]
6137 !! end
6138
6139 !! test
6140 pre-save transform: context links ("pipe trick") with interwiki prefix
6141 !! options
6142 pst
6143 !! input
6144 [[interwiki:Article|]]
6145 [[:interwiki:Article|]]
6146 [[interwiki:Bar:Article|]]
6147 [[:interwiki:Bar:Article|]]
6148 !! result
6149 [[interwiki:Article|Article]]
6150 [[:interwiki:Article|Article]]
6151 [[interwiki:Bar:Article|Bar:Article]]
6152 [[:interwiki:Bar:Article|Bar:Article]]
6153 !! end
6154
6155 !! test
6156 pre-save transform: context links ("pipe trick") with parens in title
6157 !! options
6158 pst title=[[Somearticle (context)]]
6159 !! input
6160 [[|Article]]
6161 !! result
6162 [[Article (context)|Article]]
6163 !! end
6164
6165 !! test
6166 pre-save transform: context links ("pipe trick") with comma in title
6167 !! options
6168 pst title=[[Someplace, Somewhere]]
6169 !! input
6170 [[|Otherplace]]
6171 [[Otherplace, Elsewhere|]]
6172 [[Otherplace, Elsewhere, Anywhere|]]
6173 !! result
6174 [[Otherplace, Somewhere|Otherplace]]
6175 [[Otherplace, Elsewhere|Otherplace]]
6176 [[Otherplace, Elsewhere, Anywhere|Otherplace]]
6177 !! end
6178
6179 !! test
6180 pre-save transform: context links ("pipe trick") with parens and comma
6181 !! options
6182 pst title=[[Someplace (IGNORED), Somewhere]]
6183 !! input
6184 [[|Otherplace]]
6185 [[Otherplace (place), Elsewhere|]]
6186 !! result
6187 [[Otherplace, Somewhere|Otherplace]]
6188 [[Otherplace (place), Elsewhere|Otherplace]]
6189 !! end
6190
6191 !! test
6192 pre-save transform: context links ("pipe trick") with comma and parens
6193 !! options
6194 pst title=[[Who, me? (context)]]
6195 !! input
6196 [[|Yes, you.]]
6197 [[Me, Myself, and I (1937 song)|]]
6198 !! result
6199 [[Yes, you. (context)|Yes, you.]]
6200 [[Me, Myself, and I (1937 song)|Me, Myself, and I]]
6201 !! end
6202
6203 !! test
6204 pre-save transform: context links ("pipe trick") with namespace
6205 !! options
6206 pst title=[[Ns:Somearticle]]
6207 !! input
6208 [[|Article]]
6209 !! result
6210 [[Ns:Article|Article]]
6211 !! end
6212
6213 !! test
6214 pre-save transform: context links ("pipe trick") with namespace and parens
6215 !! options
6216 pst title=[[Ns:Somearticle (context)]]
6217 !! input
6218 [[|Article]]
6219 !! result
6220 [[Ns:Article (context)|Article]]
6221 !! end
6222
6223 !! test
6224 pre-save transform: context links ("pipe trick") with namespace and comma
6225 !! options
6226 pst title=[[Ns:Somearticle, Context, Whatever]]
6227 !! input
6228 [[|Article]]
6229 !! result
6230 [[Ns:Article, Context, Whatever|Article]]
6231 !! end
6232
6233 !! test
6234 pre-save transform: context links ("pipe trick") with namespace, comma and parens
6235 !! options
6236 pst title=[[Ns:Somearticle, Context (context)]]
6237 !! input
6238 [[|Article]]
6239 !! result
6240 [[Ns:Article (context)|Article]]
6241 !! end
6242
6243 !! test
6244 pre-save transform: context links ("pipe trick") with namespace, parens and comma
6245 !! options
6246 pst title=[[Ns:Somearticle (IGNORED), Context]]
6247 !! input
6248 [[|Article]]
6249 !! result
6250 [[Ns:Article, Context|Article]]
6251 !! end
6252
6253 !! test
6254 pre-save transform: context links ("pipe trick") with full-width parens and no space (Japanese and Chinese style, bug 30149)
6255 !! options
6256 pst
6257 !! input
6258 [[Article(context)|]]
6259 [[Bar:Article(context)|]]
6260 [[:Bar:Article(context)|]]
6261 [[|Article(context)]]
6262 [[Bar:X(Y)Z|]]
6263 [[:Bar:X(Y)Z|]]
6264 !! result
6265 [[Article(context)|Article]]
6266 [[Bar:Article(context)|Article]]
6267 [[:Bar:Article(context)|Article]]
6268 [[Article(context)]]
6269 [[Bar:X(Y)Z|X(Y)Z]]
6270 [[:Bar:X(Y)Z|X(Y)Z]]
6271 !! end
6272
6273 !! test
6274 pre-save transform: context links ("pipe trick") with full-width parens and space (Japanese and Chinese style, bug 30149)
6275 !! options
6276 pst
6277 !! input
6278 [[Article (context)|]]
6279 [[Bar:Article (context)|]]
6280 [[:Bar:Article (context)|]]
6281 [[|Article (context)]]
6282 [[Bar:X (Y) Z|]]
6283 [[:Bar:X (Y) Z|]]
6284 !! result
6285 [[Article (context)|Article]]
6286 [[Bar:Article (context)|Article]]
6287 [[:Bar:Article (context)|Article]]
6288 [[Article (context)]]
6289 [[Bar:X (Y) Z|X (Y) Z]]
6290 [[:Bar:X (Y) Z|X (Y) Z]]
6291 !! end
6292
6293 !! test
6294 pre-save transform: context links ("pipe trick") with parens and no space (Korean style, bug 30149)
6295 !! options
6296 pst
6297 !! input
6298 [[Article(context)|]]
6299 [[Bar:Article(context)|]]
6300 [[:Bar:Article(context)|]]
6301 [[|Article(context)]]
6302 [[Bar:X(Y)Z|]]
6303 [[:Bar:X(Y)Z|]]
6304 !! result
6305 [[Article(context)|Article]]
6306 [[Bar:Article(context)|Article]]
6307 [[:Bar:Article(context)|Article]]
6308 [[Article(context)]]
6309 [[Bar:X(Y)Z|X(Y)Z]]
6310 [[:Bar:X(Y)Z|X(Y)Z]]
6311 !! end
6312
6313 !! test
6314 pre-save transform: context links ("pipe trick") with commas (bug 21660)
6315 !! options
6316 pst
6317 !! input
6318 [[Article (context), context|]]
6319 [[Article (context),context|]]
6320 [[Bar:Article (context), context|]]
6321 [[Bar:Article (context),context|]]
6322 [[:Bar:Article (context), context|]]
6323 [[:Bar:Article (context),context|]]
6324 !! result
6325 [[Article (context), context|Article]]
6326 [[Article (context),context|Article]]
6327 [[Bar:Article (context), context|Article]]
6328 [[Bar:Article (context),context|Article]]
6329 [[:Bar:Article (context), context|Article]]
6330 [[:Bar:Article (context),context|Article]]
6331 !! end
6332
6333 !! test
6334 pre-save transform: trim trailing empty lines
6335 !! options
6336 pst
6337 !! input
6338 Empty lines are trimmed
6339
6340
6341
6342
6343 !! result
6344 Empty lines are trimmed
6345 !! end
6346
6347 !! test
6348 pre-save transform: Signature expansion
6349 !! options
6350 pst
6351 !! input
6352 * ~~~
6353 * <noinclude>~~~</noinclude>
6354 * <includeonly>~~~</includeonly>
6355 * <onlyinclude>~~~</onlyinclude>
6356 !! result
6357 * [[Special:Contributions/127.0.0.1|127.0.0.1]]
6358 * <noinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</noinclude>
6359 * <includeonly>[[Special:Contributions/127.0.0.1|127.0.0.1]]</includeonly>
6360 * <onlyinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</onlyinclude>
6361 !! end
6362
6363
6364 !! test
6365 pre-save transform: Signature expansion in nowiki tags (bug 93)
6366 !! options
6367 pst disabled
6368 !! input
6369 Shall not expand:
6370
6371 <nowiki>~~~~</nowiki>
6372
6373 <includeonly><nowiki>~~~~</nowiki></includeonly>
6374
6375 <noinclude><nowiki>~~~~</nowiki></noinclude>
6376
6377 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
6378
6379 {{subst:Foo}} shall be converted to FOO
6380
6381 As well as inside noinclude/onlyinclude
6382 <noinclude>{{subst:Foo}}</noinclude>
6383 <onlyinclude>{{subst:Foo}}</onlyinclude>
6384
6385 But not inside includeonly
6386 <includeonly>{{subst:Foo}}</includeonly>
6387 !! result
6388 Shall not expand:
6389
6390 <nowiki>~~~~</nowiki>
6391
6392 <includeonly><nowiki>~~~~</nowiki></includeonly>
6393
6394 <noinclude><nowiki>~~~~</nowiki></noinclude>
6395
6396 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
6397
6398 FOO shall be converted to FOO
6399
6400 As well as inside noinclude/onlyinclude
6401 <noinclude>FOO</noinclude>
6402 <onlyinclude>FOO</onlyinclude>
6403
6404 But not inside includeonly
6405 <includeonly>{{subst:Foo}}</includeonly>
6406 !! end
6407
6408 ###
6409 ### Message transform tests
6410 ###
6411 !! test
6412 message transform: magic variables
6413 !! options
6414 msg
6415 !! input
6416 {{SITENAME}}
6417 !! result
6418 MediaWiki
6419 !! end
6420
6421 !! test
6422 message transform: should not transform wiki markup
6423 !! options
6424 msg
6425 !! input
6426 ''test''
6427 !! result
6428 ''test''
6429 !! end
6430
6431 !! test
6432 message transform: <noinclude> in transcluded template (bug 4926)
6433 !! options
6434 msg
6435 !! input
6436 {{Includes}}
6437 !! result
6438 Foobar
6439 !! end
6440
6441 !! test
6442 message transform: <onlyinclude> in transcluded template (bug 4926)
6443 !! options
6444 msg
6445 !! input
6446 {{Includes2}}
6447 !! result
6448 Foo
6449 !! end
6450
6451 !! test
6452 {{#special:}} page name, known
6453 !! options
6454 msg
6455 !! input
6456 {{#special:Recentchanges}}
6457 !! result
6458 Special:RecentChanges
6459 !! end
6460
6461 !! test
6462 {{#special:}} page name with subpage, known
6463 !! options
6464 msg
6465 !! input
6466 {{#special:Recentchanges/param}}
6467 !! result
6468 Special:RecentChanges/param
6469 !! end
6470
6471 !! test
6472 {{#special:}} page name, unknown
6473 !! options
6474 msg
6475 !! input
6476 {{#special:foobarnonexistent}}
6477 !! result
6478 No such special page
6479 !! end
6480
6481 !! test
6482 {{#speciale:}} page name, known
6483 !! options
6484 msg
6485 !! input
6486 {{#speciale:Recentchanges}}
6487 !! result
6488 Special:RecentChanges
6489 !! end
6490
6491 !! test
6492 {{#speciale:}} page name with subpage, known
6493 !! options
6494 msg
6495 !! input
6496 {{#speciale:Recentchanges/param}}
6497 !! result
6498 Special:RecentChanges/param
6499 !! end
6500
6501 !! test
6502 {{#speciale:}} page name, unknown
6503 !! options
6504 msg
6505 !! input
6506 {{#speciale:foobarnonexistent}}
6507 !! result
6508 No_such_special_page
6509 !! end
6510
6511 ###
6512 ### Images
6513 ###
6514 !! test
6515 Simple image
6516 !! input
6517 [[Image:foobar.jpg]]
6518 !! result
6519 <p><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
6520 </p>
6521 !! end
6522
6523 !! test
6524 Right-aligned image
6525 !! input
6526 [[Image:foobar.jpg|right]]
6527 !! result
6528 <div class="floatright"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a></div>
6529
6530 !! end
6531
6532 !! test
6533 Simple image (using File: namespace, now canonical)
6534 !! input
6535 [[File:foobar.jpg]]
6536 !! result
6537 <p><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
6538 </p>
6539 !! end
6540
6541 !! test
6542 Image with caption
6543 !! input
6544 [[Image:foobar.jpg|right|Caption text]]
6545 !! result
6546 <div class="floatright"><a href="/wiki/File:Foobar.jpg" class="image" title="Caption text"><img alt="Caption text" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a></div>
6547
6548 !! end
6549
6550 !! test
6551 Image with empty attribute
6552 !! input
6553 [[Image:foobar.jpg|right||Caption text]]
6554 !! result
6555 <div class="floatright"><a href="/wiki/File:Foobar.jpg" class="image" title="Caption text"><img alt="Caption text" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a></div>
6556
6557 !! end
6558
6559 !! test
6560 Image with link tails
6561 !! input
6562 123[[Image:foobar.jpg]]456
6563 123[[Image:foobar.jpg|right]]456
6564 123[[Image:foobar.jpg|thumb]]456
6565 !! result
6566 <p>123<a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>456
6567 </p>
6568 123<div class="floatright"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a></div>456
6569 123<div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div></div></div></div>456
6570
6571 !! end
6572
6573 !! test
6574 Image with multiple captions -- only last one is accepted
6575 !! input
6576 [[Image:foobar.jpg|right|Caption1 - ignored|[[Caption2]] - ignored|Caption3 - accepted]]
6577 !! result
6578 <div class="floatright"><a href="/wiki/File:Foobar.jpg" class="image" title="Caption3 - accepted"><img alt="Caption3 - accepted" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a></div>
6579
6580 !! end
6581
6582 !! test
6583 Image with width attribute at different positions
6584 !! input
6585 [[Image:foobar.jpg|200px|right|Caption]]
6586 [[Image:foobar.jpg|right|200px|Caption]]
6587 [[Image:foobar.jpg|right|Caption|200px]]
6588 !! result
6589 <div class="floatright"><a href="/wiki/File:Foobar.jpg" class="image" title="Caption"><img alt="Caption" src="http://example.com/images/thumb/3/3a/Foobar.jpg/200px-Foobar.jpg" width="200" height="23" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/300px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/400px-Foobar.jpg 2x" /></a></div>
6590 <div class="floatright"><a href="/wiki/File:Foobar.jpg" class="image" title="Caption"><img alt="Caption" src="http://example.com/images/thumb/3/3a/Foobar.jpg/200px-Foobar.jpg" width="200" height="23" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/300px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/400px-Foobar.jpg 2x" /></a></div>
6591 <div class="floatright"><a href="/wiki/File:Foobar.jpg" class="image" title="Caption"><img alt="Caption" src="http://example.com/images/thumb/3/3a/Foobar.jpg/200px-Foobar.jpg" width="200" height="23" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/300px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/400px-Foobar.jpg 2x" /></a></div>
6592
6593 !! end
6594
6595 !! test
6596 Image with link parameter, wiki target
6597 !! input
6598 [[Image:foobar.jpg|link=Target page]]
6599 !! result
6600 <p><a href="/wiki/Target_page" title="Target page"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
6601 </p>
6602 !! end
6603
6604 !! test
6605 Image with link parameter, URL target
6606 !! input
6607 [[Image:foobar.jpg|link=http://example.com/]]
6608 !! result
6609 <p><a href="http://example.com/" rel="nofollow"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
6610 </p>
6611 !! end
6612
6613 !! test
6614 Image with link parameter, wgExternalLinkTarget
6615 !! input
6616 [[Image:foobar.jpg|link=http://example.com/]]
6617 !! config
6618 wgExternalLinkTarget='foobar'
6619 !! result
6620 <p><a href="http://example.com/" target="foobar" rel="nofollow"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
6621 </p>
6622 !! end
6623
6624 !! test
6625 Image with link parameter, wgNoFollowLinks set to false
6626 !! input
6627 [[Image:foobar.jpg|link=http://example.com/]]
6628 !! config
6629 wgNoFollowLinks=false
6630 !! result
6631 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
6632 </p>
6633 !! end
6634
6635 !! test
6636 Image with link parameter, wgNoFollowDomainExceptions
6637 !! input
6638 [[Image:foobar.jpg|link=http://example.com/]]
6639 !! config
6640 wgNoFollowDomainExceptions='example.com'
6641 !! result
6642 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
6643 </p>
6644 !! end
6645
6646 !! test
6647 Image with link parameter, wgExternalLinkTarget, unnamed parameter
6648 !! input
6649 [[Image:foobar.jpg|link=http://example.com/|Title]]
6650 !! config
6651 wgExternalLinkTarget='foobar'
6652 !! result
6653 <p><a href="http://example.com/" title="Title" target="foobar" rel="nofollow"><img alt="Title" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
6654 </p>
6655 !! end
6656
6657 !! test
6658 Image with empty link parameter
6659 !! input
6660 [[Image:foobar.jpg|link=]]
6661 !! result
6662 <p><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" />
6663 </p>
6664 !! end
6665
6666 !! test
6667 Image with link parameter (wiki target) and unnamed parameter
6668 !! input
6669 [[Image:foobar.jpg|link=Target page|Title]]
6670 !! result
6671 <p><a href="/wiki/Target_page" title="Title"><img alt="Title" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
6672 </p>
6673 !! end
6674
6675 !! test
6676 Image with link parameter (URL target) and unnamed parameter
6677 !! input
6678 [[Image:foobar.jpg|link=http://example.com/|Title]]
6679 !! result
6680 <p><a href="http://example.com/" title="Title" rel="nofollow"><img alt="Title" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
6681 </p>
6682 !! end
6683
6684 !! test
6685 Thumbnail image with link parameter
6686 !! input
6687 [[Image:foobar.jpg|thumb|link=http://example.com/|Title]]
6688 !! result
6689 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="http://example.com/"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>Title</div></div></div>
6690
6691 !! end
6692
6693 !! test
6694 Image with frame and link
6695 !! input
6696 [[Image:Foobar.jpg|frame|left|This is a test image [[Main Page]]]]
6697 !! result
6698 <div class="thumb tleft"><div class="thumbinner" style="width:1943px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" class="thumbimage" /></a> <div class="thumbcaption">This is a test image <a href="/wiki/Main_Page" title="Main Page">Main Page</a></div></div></div>
6699
6700 !! end
6701
6702 !! test
6703 Image with frame and link and explicit alt
6704 !! input
6705 [[Image:Foobar.jpg|frame|left|This is a test image [[Main Page]]|alt=Altitude]]
6706 !! result
6707 <div class="thumb tleft"><div class="thumbinner" style="width:1943px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Altitude" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" class="thumbimage" /></a> <div class="thumbcaption">This is a test image <a href="/wiki/Main_Page" title="Main Page">Main Page</a></div></div></div>
6708
6709 !! end
6710
6711 !! test
6712 Image with wiki markup in implicit alt
6713 !! input
6714 [[Image:Foobar.jpg|testing '''bold''' in alt]]
6715 !! result
6716 <p><a href="/wiki/File:Foobar.jpg" class="image" title="testing bold in alt"><img alt="testing bold in alt" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
6717 </p>
6718 !! end
6719
6720 !! test
6721 Image with wiki markup in explicit alt
6722 !! input
6723 [[Image:Foobar.jpg|alt=testing '''bold''' in alt]]
6724 !! result
6725 <p><a href="/wiki/File:Foobar.jpg" class="image"><img alt="testing bold in alt" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
6726 </p>
6727 !! end
6728
6729 !! test
6730 Link to image page- image page normally doesn't exists, hence edit link
6731 Add test with existing image page
6732 #<p><a href="/wiki/File:Test" title="Image:Test">Image:test</a>
6733 !! input
6734 [[:Image:test]]
6735 !! result
6736 <p><a href="/index.php?title=File:Test&amp;action=edit&amp;redlink=1" class="new" title="File:Test (page does not exist)">Image:test</a>
6737 </p>
6738 !! end
6739
6740 !! test
6741 bug 18784 Link to non-existent image page with caption should use caption as link text
6742 !! input
6743 [[:Image:test|caption]]
6744 !! result
6745 <p><a href="/index.php?title=File:Test&amp;action=edit&amp;redlink=1" class="new" title="File:Test (page does not exist)">caption</a>
6746 </p>
6747 !! end
6748
6749 !! test
6750 Frameless image caption with a free URL
6751 !! input
6752 [[Image:foobar.jpg|http://example.com]]
6753 !! result
6754 <p><a href="/wiki/File:Foobar.jpg" class="image" title="http://example.com"><img alt="http://example.com" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
6755 </p>
6756 !! end
6757
6758 !! test
6759 Thumbnail image caption with a free URL
6760 !! input
6761 [[Image:foobar.jpg|thumb|http://example.com]]
6762 !! result
6763 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a></div></div></div>
6764
6765 !! end
6766
6767 !! test
6768 Thumbnail image caption with a free URL and explicit alt
6769 !! input
6770 [[Image:foobar.jpg|thumb|http://example.com|alt=Alteration]]
6771 !! result
6772 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Alteration" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a></div></div></div>
6773
6774 !! end
6775
6776 !! test
6777 BUG 1887: A ISBN with a thumbnail
6778 !! input
6779 [[Image:foobar.jpg|thumb|ISBN 1235467890]]
6780 !! result
6781 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div><a href="/wiki/Special:BookSources/1235467890" class="internal mw-magiclink-isbn">ISBN 1235467890</a></div></div></div>
6782
6783 !! end
6784
6785 !! test
6786 BUG 1887: A RFC with a thumbnail
6787 !! input
6788 [[Image:foobar.jpg|thumb|This is RFC 12354]]
6789 !! result
6790 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>This is <a class="external mw-magiclink-rfc" href="//tools.ietf.org/html/rfc12354">RFC 12354</a></div></div></div>
6791
6792 !! end
6793
6794 !! test
6795 BUG 1887: A mailto link with a thumbnail
6796 !! input
6797 [[Image:foobar.jpg|thumb|Please mailto:nobody@example.com]]
6798 !! result
6799 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>Please <a rel="nofollow" class="external free" href="mailto:nobody@example.com">mailto:nobody@example.com</a></div></div></div>
6800
6801 !! end
6802
6803 # Pending resolution to bug 368
6804 !! test
6805 BUG 648: Frameless image caption with a link
6806 !! input
6807 [[Image:foobar.jpg|text with a [[link]] in it]]
6808 !! result
6809 <p><a href="/wiki/File:Foobar.jpg" class="image" title="text with a link in it"><img alt="text with a link in it" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
6810 </p>
6811 !! end
6812
6813 !! test
6814 BUG 648: Frameless image caption with a link (suffix)
6815 !! input
6816 [[Image:foobar.jpg|text with a [[link]]foo in it]]
6817 !! result
6818 <p><a href="/wiki/File:Foobar.jpg" class="image" title="text with a linkfoo in it"><img alt="text with a linkfoo in it" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
6819 </p>
6820 !! end
6821
6822 !! test
6823 BUG 648: Frameless image caption with an interwiki link
6824 !! input
6825 [[Image:foobar.jpg|text with a [[MeatBall:Link]] in it]]
6826 !! result
6827 <p><a href="/wiki/File:Foobar.jpg" class="image" title="text with a MeatBall:Link in it"><img alt="text with a MeatBall:Link in it" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
6828 </p>
6829 !! end
6830
6831 !! test
6832 BUG 648: Frameless image caption with a piped interwiki link
6833 !! input
6834 [[Image:foobar.jpg|text with a [[MeatBall:Link|link]] in it]]
6835 !! result
6836 <p><a href="/wiki/File:Foobar.jpg" class="image" title="text with a link in it"><img alt="text with a link in it" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
6837 </p>
6838 !! end
6839
6840 !! test
6841 Escape HTML special chars in image alt text
6842 !! input
6843 [[Image:foobar.jpg|& < > "]]
6844 !! result
6845 <p><a href="/wiki/File:Foobar.jpg" class="image" title="&amp; &lt; &gt; &quot;"><img alt="&amp; &lt; &gt; &quot;" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
6846 </p>
6847 !! end
6848
6849 !! test
6850 BUG 499: Alt text should have &#1234;, not &amp;1234;
6851 !! input
6852 [[Image:foobar.jpg|&#9792;]]
6853 !! result
6854 <p><a href="/wiki/File:Foobar.jpg" class="image" title="♀"><img alt="♀" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
6855 </p>
6856 !! end
6857
6858 !! test
6859 Broken image caption with link
6860 !! input
6861 [[Image:Foobar.jpg|thumb|This is a broken caption. But [[Main Page|this]] is just an ordinary link.
6862 !! result
6863 <p>[[Image:Foobar.jpg|thumb|This is a broken caption. But <a href="/wiki/Main_Page" title="Main Page">this</a> is just an ordinary link.
6864 </p>
6865 !! end
6866
6867 !! test
6868 Image caption containing another image
6869 !! input
6870 [[Image:Foobar.jpg|thumb|This is a caption with another [[Image:icon.png|image]] inside it!]]
6871 !! result
6872 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>This is a caption with another <a href="/index.php?title=Special:Upload&amp;wpDestFile=Icon.png" class="new" title="File:Icon.png">image</a> inside it!</div></div></div>
6873
6874 !! end
6875
6876 !! test
6877 Image caption containing a newline
6878 !! input
6879 [[Image:Foobar.jpg|This
6880 *is some text]]
6881 !! result
6882 <p><a href="/wiki/File:Foobar.jpg" class="image" title="This *is some text"><img alt="This *is some text" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
6883 </p>
6884 !!end
6885
6886
6887 !! test
6888 Bug 3090: External links other than http: in image captions
6889 !! input
6890 [[Image:Foobar.jpg|thumb|200px|This caption has [irc://example.net irc] and [https://example.com Secure] ext links in it.]]
6891 !! result
6892 <div class="thumb tright"><div class="thumbinner" style="width:202px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/200px-Foobar.jpg" width="200" height="23" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/300px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/400px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>This caption has <a rel="nofollow" class="external text" href="irc://example.net">irc</a> and <a rel="nofollow" class="external text" href="https://example.com">Secure</a> ext links in it.</div></div></div>
6893
6894 !! end
6895
6896 !! test
6897 Custom class
6898 !! input
6899 [[Image:foobar.jpg|a|class=b]]
6900 !! result
6901 <p><a href="/wiki/File:Foobar.jpg" class="image" title="a"><img alt="a" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" class="b" /></a>
6902 </p>
6903 !! end
6904
6905 !! article
6906 File:Barfoo.jpg
6907 !! text
6908 #REDIRECT [[File:Barfoo.jpg]]
6909 !! endarticle
6910
6911 !! test
6912 Redirected image
6913 !! input
6914 [[Image:Barfoo.jpg]]
6915 !! result
6916 <p><a href="/wiki/File:Barfoo.jpg" title="File:Barfoo.jpg">File:Barfoo.jpg</a>
6917 </p>
6918 !! end
6919
6920 !! test
6921 Missing image with uploads disabled
6922 !! options
6923 wgEnableUploads=0
6924 !! input
6925 [[Image:Foobaz.jpg]]
6926 !! result
6927 <p><a href="/wiki/File:Foobaz.jpg" title="File:Foobaz.jpg">File:Foobaz.jpg</a>
6928 </p>
6929 !! end
6930
6931
6932 ###
6933 ### Subpages
6934 ###
6935 !! article
6936 Subpage test/subpage
6937 !! text
6938 foo
6939 !! endarticle
6940
6941 !! test
6942 Subpage link
6943 !! options
6944 subpage title=[[Subpage test]]
6945 !! input
6946 [[/subpage]]
6947 !! result
6948 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a>
6949 </p>
6950 !! end
6951
6952 !! test
6953 Subpage noslash link
6954 !! options
6955 subpage title=[[Subpage test]]
6956 !!input
6957 [[/subpage/]]
6958 !! result
6959 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">subpage</a>
6960 </p>
6961 !! end
6962
6963 !! test
6964 Disabled subpages
6965 !! input
6966 [[/subpage]]
6967 !! result
6968 <p><a href="/index.php?title=/subpage&amp;action=edit&amp;redlink=1" class="new" title="/subpage (page does not exist)">/subpage</a>
6969 </p>
6970 !! end
6971
6972 !! test
6973 BUG 561: {{/Subpage}}
6974 !! options
6975 subpage title=[[Page]]
6976 !! input
6977 {{/Subpage}}
6978 !! result
6979 <p><a href="/index.php?title=Page/Subpage&amp;action=edit&amp;redlink=1" class="new" title="Page/Subpage (page does not exist)">Page/Subpage</a>
6980 </p>
6981 !! end
6982
6983 ###
6984 ### Categories
6985 ###
6986 !! article
6987 Category:MediaWiki User's Guide
6988 !! text
6989 blah
6990 !! endarticle
6991
6992 !! test
6993 Link to category
6994 !! input
6995 [[:Category:MediaWiki User's Guide]]
6996 !! result
6997 <p><a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">Category:MediaWiki User's Guide</a>
6998 </p>
6999 !! end
7000
7001 !! test
7002 Simple category
7003 !! options
7004 cat
7005 !! input
7006 [[Category:MediaWiki User's Guide]]
7007 !! result
7008 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
7009 !! end
7010
7011 !! test
7012 PAGESINCATEGORY invalid title fatal (r33546 fix)
7013 !! input
7014 {{PAGESINCATEGORY:<bogus>}}
7015 !! result
7016 <p>0
7017 </p>
7018 !! end
7019
7020 !! test
7021 Category with different sort key
7022 !! options
7023 cat
7024 !! input
7025 [[Category:MediaWiki User's Guide|Foo]]
7026 !! result
7027 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
7028 !! end
7029
7030 !! test
7031 Category with identical sort key
7032 !! options
7033 cat
7034 !! input
7035 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
7036 !! result
7037 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
7038 !! end
7039
7040 !! test
7041 Category with empty sort key
7042 !! options
7043 cat
7044 pst
7045 !! input
7046 [[Category:MediaWiki User's Guide|]]
7047 !! result
7048 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
7049 !! end
7050
7051 !! test
7052 Category with empty sort key and parentheses
7053 !! options
7054 cat
7055 pst
7056 !! input
7057 [[Category:Foo (bar)|]]
7058 !! result
7059 [[Category:Foo (bar)|Foo]]
7060 !! end
7061
7062 !! test
7063 Category with link tail
7064 !! options
7065 cat
7066 pst
7067 !! input
7068 123[[Category:Foo]]456
7069 !! result
7070 123[[Category:Foo]]456
7071 !! end
7072
7073 !! test
7074 Category with template
7075 !! options
7076 cat
7077 pst
7078 !! input
7079 [[Category:{{echo|Foo}}]]
7080 !! result
7081 [[Category:{{echo|Foo}}]]
7082 !! end
7083
7084 !! test
7085 Category with template in sort key
7086 !! options
7087 cat
7088 pst
7089 !! input
7090 [[Category:Foo|{{echo|Bar}}]]
7091 !! result
7092 [[Category:Foo|{{echo|Bar}}]]
7093 !! end
7094
7095 !! test
7096 Category with template in sort key and title
7097 !! options
7098 cat
7099 pst
7100 !! input
7101 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
7102 !! result
7103 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
7104 !! end
7105
7106 !! test
7107 Category / paragraph interactions
7108 !! input
7109 Foo [[Category:Baz]] Bar
7110
7111 Foo [[Category:Baz]]
7112 Bar
7113
7114 Foo
7115 [[Category:Baz]]
7116 Bar
7117
7118 Foo
7119 [[Category:Baz]] Bar
7120
7121 Foo
7122 [[Category:Baz]]
7123 [[Category:Baz]]
7124 [[Category:Baz]]
7125 Bar
7126
7127 [[Category:Baz]]
7128 [[Category:Baz]]
7129 [[Category:Baz]]
7130
7131 [[Category:Baz]]
7132 {{echo|[[Category:Baz]]}}
7133 [[Category:Baz]]
7134 !! result
7135 <p>Foo Bar
7136 </p><p>Foo
7137 Bar
7138 </p><p>Foo
7139 Bar
7140 </p><p>Foo Bar
7141 </p><p>Foo
7142 Bar
7143 </p>
7144 !! end
7145
7146 ###
7147 ### Inter-language links
7148 ###
7149 !! test
7150 Inter-language links
7151 !! options
7152 ill
7153 !! input
7154 [[es:Alimento]]
7155 [[fr:Nourriture]]
7156 [[zh:&#39135;&#21697;]]
7157 !! result
7158 es:Alimento fr:Nourriture zh:食品
7159 !! end
7160
7161 !! test
7162 Duplicate interlanguage links (bug 24502)
7163 !! options
7164 ill
7165 !! input
7166 [[es:1]]
7167 [[es:2]]
7168 [[fr:1]]
7169 [[fr:2]]
7170 !! result
7171 es:1 fr:1
7172 !! end
7173
7174 ###
7175 ### Sections
7176 ###
7177 !! test
7178 Basic section headings
7179 !! input
7180 == Headline 1 ==
7181 Some text
7182
7183 ==Headline 2==
7184 More
7185 ===Smaller headline===
7186 Blah blah
7187 !! result
7188 <h2><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: Headline 1">edit</a>]</span> <span class="mw-headline" id="Headline_1"> Headline 1 </span></h2>
7189 <p>Some text
7190 </p>
7191 <h2><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: Headline 2">edit</a>]</span> <span class="mw-headline" id="Headline_2">Headline 2</span></h2>
7192 <p>More
7193 </p>
7194 <h3><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=3" title="Edit section: Smaller headline">edit</a>]</span> <span class="mw-headline" id="Smaller_headline">Smaller headline</span></h3>
7195 <p>Blah blah
7196 </p>
7197 !! end
7198
7199 !! test
7200 Section headings with TOC
7201 !! input
7202 == Headline 1 ==
7203 === Subheadline 1 ===
7204 ===== Skipping a level =====
7205 ====== Skipping a level ======
7206
7207 == Headline 2 ==
7208 Some text
7209 ===Another headline===
7210 !! result
7211 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
7212 <ul>
7213 <li class="toclevel-1 tocsection-1"><a href="#Headline_1"><span class="tocnumber">1</span> <span class="toctext">Headline 1</span></a>
7214 <ul>
7215 <li class="toclevel-2 tocsection-2"><a href="#Subheadline_1"><span class="tocnumber">1.1</span> <span class="toctext">Subheadline 1</span></a>
7216 <ul>
7217 <li class="toclevel-3 tocsection-3"><a href="#Skipping_a_level"><span class="tocnumber">1.1.1</span> <span class="toctext">Skipping a level</span></a>
7218 <ul>
7219 <li class="toclevel-4 tocsection-4"><a href="#Skipping_a_level_2"><span class="tocnumber">1.1.1.1</span> <span class="toctext">Skipping a level</span></a></li>
7220 </ul>
7221 </li>
7222 </ul>
7223 </li>
7224 </ul>
7225 </li>
7226 <li class="toclevel-1 tocsection-5"><a href="#Headline_2"><span class="tocnumber">2</span> <span class="toctext">Headline 2</span></a>
7227 <ul>
7228 <li class="toclevel-2 tocsection-6"><a href="#Another_headline"><span class="tocnumber">2.1</span> <span class="toctext">Another headline</span></a></li>
7229 </ul>
7230 </li>
7231 </ul>
7232 </td></tr></table>
7233 <h2><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: Headline 1">edit</a>]</span> <span class="mw-headline" id="Headline_1"> Headline 1 </span></h2>
7234 <h3><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: Subheadline 1">edit</a>]</span> <span class="mw-headline" id="Subheadline_1"> Subheadline 1 </span></h3>
7235 <h5><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=3" title="Edit section: Skipping a level">edit</a>]</span> <span class="mw-headline" id="Skipping_a_level"> Skipping a level </span></h5>
7236 <h6><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=4" title="Edit section: Skipping a level">edit</a>]</span> <span class="mw-headline" id="Skipping_a_level_2"> Skipping a level </span></h6>
7237 <h2><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=5" title="Edit section: Headline 2">edit</a>]</span> <span class="mw-headline" id="Headline_2"> Headline 2 </span></h2>
7238 <p>Some text
7239 </p>
7240 <h3><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=6" title="Edit section: Another headline">edit</a>]</span> <span class="mw-headline" id="Another_headline">Another headline</span></h3>
7241
7242 !! end
7243
7244 # perl -e 'print "="x$_," Level $_ heading","="x$_,"\n" for 1..10'
7245 !! test
7246 Handling of sections up to level 6 and beyond
7247 !! input
7248 = Level 1 Heading=
7249 == Level 2 Heading==
7250 === Level 3 Heading===
7251 ==== Level 4 Heading====
7252 ===== Level 5 Heading=====
7253 ====== Level 6 Heading======
7254 ======= Level 7 Heading=======
7255 ======== Level 8 Heading========
7256 ========= Level 9 Heading=========
7257 ========== Level 10 Heading==========
7258 !! result
7259 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
7260 <ul>
7261 <li class="toclevel-1 tocsection-1"><a href="#Level_1_Heading"><span class="tocnumber">1</span> <span class="toctext">Level 1 Heading</span></a>
7262 <ul>
7263 <li class="toclevel-2 tocsection-2"><a href="#Level_2_Heading"><span class="tocnumber">1.1</span> <span class="toctext">Level 2 Heading</span></a>
7264 <ul>
7265 <li class="toclevel-3 tocsection-3"><a href="#Level_3_Heading"><span class="tocnumber">1.1.1</span> <span class="toctext">Level 3 Heading</span></a>
7266 <ul>
7267 <li class="toclevel-4 tocsection-4"><a href="#Level_4_Heading"><span class="tocnumber">1.1.1.1</span> <span class="toctext">Level 4 Heading</span></a>
7268 <ul>
7269 <li class="toclevel-5 tocsection-5"><a href="#Level_5_Heading"><span class="tocnumber">1.1.1.1.1</span> <span class="toctext">Level 5 Heading</span></a>
7270 <ul>
7271 <li class="toclevel-6 tocsection-6"><a href="#Level_6_Heading"><span class="tocnumber">1.1.1.1.1.1</span> <span class="toctext">Level 6 Heading</span></a></li>
7272 <li class="toclevel-6 tocsection-7"><a href="#.3D_Level_7_Heading.3D"><span class="tocnumber">1.1.1.1.1.2</span> <span class="toctext">= Level 7 Heading=</span></a></li>
7273 <li class="toclevel-6 tocsection-8"><a href="#.3D.3D_Level_8_Heading.3D.3D"><span class="tocnumber">1.1.1.1.1.3</span> <span class="toctext">== Level 8 Heading==</span></a></li>
7274 <li class="toclevel-6 tocsection-9"><a href="#.3D.3D.3D_Level_9_Heading.3D.3D.3D"><span class="tocnumber">1.1.1.1.1.4</span> <span class="toctext">=== Level 9 Heading===</span></a></li>
7275 <li class="toclevel-6 tocsection-10"><a href="#.3D.3D.3D.3D_Level_10_Heading.3D.3D.3D.3D"><span class="tocnumber">1.1.1.1.1.5</span> <span class="toctext">==== Level 10 Heading====</span></a></li>
7276 </ul>
7277 </li>
7278 </ul>
7279 </li>
7280 </ul>
7281 </li>
7282 </ul>
7283 </li>
7284 </ul>
7285 </li>
7286 </ul>
7287 </td></tr></table>
7288 <h1><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: Level 1 Heading">edit</a>]</span> <span class="mw-headline" id="Level_1_Heading"> Level 1 Heading</span></h1>
7289 <h2><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: Level 2 Heading">edit</a>]</span> <span class="mw-headline" id="Level_2_Heading"> Level 2 Heading</span></h2>
7290 <h3><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=3" title="Edit section: Level 3 Heading">edit</a>]</span> <span class="mw-headline" id="Level_3_Heading"> Level 3 Heading</span></h3>
7291 <h4><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=4" title="Edit section: Level 4 Heading">edit</a>]</span> <span class="mw-headline" id="Level_4_Heading"> Level 4 Heading</span></h4>
7292 <h5><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=5" title="Edit section: Level 5 Heading">edit</a>]</span> <span class="mw-headline" id="Level_5_Heading"> Level 5 Heading</span></h5>
7293 <h6><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=6" title="Edit section: Level 6 Heading">edit</a>]</span> <span class="mw-headline" id="Level_6_Heading"> Level 6 Heading</span></h6>
7294 <h6><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=7" title="Edit section: = Level 7 Heading=">edit</a>]</span> <span class="mw-headline" id=".3D_Level_7_Heading.3D">= Level 7 Heading=</span></h6>
7295 <h6><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=8" title="Edit section: == Level 8 Heading==">edit</a>]</span> <span class="mw-headline" id=".3D.3D_Level_8_Heading.3D.3D">== Level 8 Heading==</span></h6>
7296 <h6><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=9" title="Edit section: === Level 9 Heading===">edit</a>]</span> <span class="mw-headline" id=".3D.3D.3D_Level_9_Heading.3D.3D.3D">=== Level 9 Heading===</span></h6>
7297 <h6><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=10" title="Edit section: ==== Level 10 Heading====">edit</a>]</span> <span class="mw-headline" id=".3D.3D.3D.3D_Level_10_Heading.3D.3D.3D.3D">==== Level 10 Heading====</span></h6>
7298
7299 !! end
7300
7301 !! test
7302 TOC regression (bug 9764)
7303 !! input
7304 == title 1 ==
7305 === title 1.1 ===
7306 ==== title 1.1.1 ====
7307 === title 1.2 ===
7308 == title 2 ==
7309 === title 2.1 ===
7310 !! result
7311 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
7312 <ul>
7313 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
7314 <ul>
7315 <li class="toclevel-2 tocsection-2"><a href="#title_1.1"><span class="tocnumber">1.1</span> <span class="toctext">title 1.1</span></a>
7316 <ul>
7317 <li class="toclevel-3 tocsection-3"><a href="#title_1.1.1"><span class="tocnumber">1.1.1</span> <span class="toctext">title 1.1.1</span></a></li>
7318 </ul>
7319 </li>
7320 <li class="toclevel-2 tocsection-4"><a href="#title_1.2"><span class="tocnumber">1.2</span> <span class="toctext">title 1.2</span></a></li>
7321 </ul>
7322 </li>
7323 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
7324 <ul>
7325 <li class="toclevel-2 tocsection-6"><a href="#title_2.1"><span class="tocnumber">2.1</span> <span class="toctext">title 2.1</span></a></li>
7326 </ul>
7327 </li>
7328 </ul>
7329 </td></tr></table>
7330 <h2><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: title 1">edit</a>]</span> <span class="mw-headline" id="title_1"> title 1 </span></h2>
7331 <h3><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: title 1.1">edit</a>]</span> <span class="mw-headline" id="title_1.1"> title 1.1 </span></h3>
7332 <h4><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=3" title="Edit section: title 1.1.1">edit</a>]</span> <span class="mw-headline" id="title_1.1.1"> title 1.1.1 </span></h4>
7333 <h3><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=4" title="Edit section: title 1.2">edit</a>]</span> <span class="mw-headline" id="title_1.2"> title 1.2 </span></h3>
7334 <h2><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=5" title="Edit section: title 2">edit</a>]</span> <span class="mw-headline" id="title_2"> title 2 </span></h2>
7335 <h3><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=6" title="Edit section: title 2.1">edit</a>]</span> <span class="mw-headline" id="title_2.1"> title 2.1 </span></h3>
7336
7337 !! end
7338
7339 !! test
7340 TOC with wgMaxTocLevel=3 (bug 6204)
7341 !! options
7342 wgMaxTocLevel=3
7343 !! input
7344 == title 1 ==
7345 === title 1.1 ===
7346 ==== title 1.1.1 ====
7347 === title 1.2 ===
7348 == title 2 ==
7349 === title 2.1 ===
7350 !! result
7351 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
7352 <ul>
7353 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
7354 <ul>
7355 <li class="toclevel-2 tocsection-2"><a href="#title_1.1"><span class="tocnumber">1.1</span> <span class="toctext">title 1.1</span></a></li>
7356 <li class="toclevel-2 tocsection-4"><a href="#title_1.2"><span class="tocnumber">1.2</span> <span class="toctext">title 1.2</span></a></li>
7357 </ul>
7358 </li>
7359 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
7360 <ul>
7361 <li class="toclevel-2 tocsection-6"><a href="#title_2.1"><span class="tocnumber">2.1</span> <span class="toctext">title 2.1</span></a></li>
7362 </ul>
7363 </li>
7364 </ul>
7365 </td></tr></table>
7366 <h2><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: title 1">edit</a>]</span> <span class="mw-headline" id="title_1"> title 1 </span></h2>
7367 <h3><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: title 1.1">edit</a>]</span> <span class="mw-headline" id="title_1.1"> title 1.1 </span></h3>
7368 <h4><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=3" title="Edit section: title 1.1.1">edit</a>]</span> <span class="mw-headline" id="title_1.1.1"> title 1.1.1 </span></h4>
7369 <h3><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=4" title="Edit section: title 1.2">edit</a>]</span> <span class="mw-headline" id="title_1.2"> title 1.2 </span></h3>
7370 <h2><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=5" title="Edit section: title 2">edit</a>]</span> <span class="mw-headline" id="title_2"> title 2 </span></h2>
7371 <h3><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=6" title="Edit section: title 2.1">edit</a>]</span> <span class="mw-headline" id="title_2.1"> title 2.1 </span></h3>
7372
7373 !! end
7374
7375 !! test
7376 TOC with wgMaxTocLevel=3 and two level four headings (bug 6204)
7377 !! options
7378 wgMaxTocLevel=3
7379 !! input
7380 ==Section 1==
7381 ===Section 1.1===
7382 ====Section 1.1.1====
7383 ====Section 1.1.1.1====
7384 ==Section 2==
7385 !! result
7386 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
7387 <ul>
7388 <li class="toclevel-1 tocsection-1"><a href="#Section_1"><span class="tocnumber">1</span> <span class="toctext">Section 1</span></a>
7389 <ul>
7390 <li class="toclevel-2 tocsection-2"><a href="#Section_1.1"><span class="tocnumber">1.1</span> <span class="toctext">Section 1.1</span></a></li>
7391 </ul>
7392 </li>
7393 <li class="toclevel-1 tocsection-5"><a href="#Section_2"><span class="tocnumber">2</span> <span class="toctext">Section 2</span></a></li>
7394 </ul>
7395 </td></tr></table>
7396 <h2><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: Section 1">edit</a>]</span> <span class="mw-headline" id="Section_1">Section 1</span></h2>
7397 <h3><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: Section 1.1">edit</a>]</span> <span class="mw-headline" id="Section_1.1">Section 1.1</span></h3>
7398 <h4><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=3" title="Edit section: Section 1.1.1">edit</a>]</span> <span class="mw-headline" id="Section_1.1.1">Section 1.1.1</span></h4>
7399 <h4><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=4" title="Edit section: Section 1.1.1.1">edit</a>]</span> <span class="mw-headline" id="Section_1.1.1.1">Section 1.1.1.1</span></h4>
7400 <h2><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=5" title="Edit section: Section 2">edit</a>]</span> <span class="mw-headline" id="Section_2">Section 2</span></h2>
7401
7402 !! end
7403
7404
7405 !! test
7406 Resolving duplicate section names
7407 !! input
7408 == Foo bar ==
7409 == Foo bar ==
7410 !! result
7411 <h2><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: Foo bar">edit</a>]</span> <span class="mw-headline" id="Foo_bar"> Foo bar </span></h2>
7412 <h2><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: Foo bar">edit</a>]</span> <span class="mw-headline" id="Foo_bar_2"> Foo bar </span></h2>
7413
7414 !! end
7415
7416 !! test
7417 Resolving duplicate section names with differing case (bug 10721)
7418 !! input
7419 == Foo bar ==
7420 == Foo Bar ==
7421 !! result
7422 <h2><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: Foo bar">edit</a>]</span> <span class="mw-headline" id="Foo_bar"> Foo bar </span></h2>
7423 <h2><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: Foo Bar">edit</a>]</span> <span class="mw-headline" id="Foo_Bar_2"> Foo Bar </span></h2>
7424
7425 !! end
7426
7427 !! article
7428 Template:sections
7429 !! text
7430 ===Section 1===
7431 ==Section 2==
7432 !! endarticle
7433
7434 !! test
7435 Template with sections, __NOTOC__
7436 !! input
7437 __NOTOC__
7438 ==Section 0==
7439 {{sections}}
7440 ==Section 4==
7441 !! result
7442 <h2><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: Section 0">edit</a>]</span> <span class="mw-headline" id="Section_0">Section 0</span></h2>
7443 <h3><span class="editsection">[<a href="/index.php?title=Template:Sections&amp;action=edit&amp;section=T-1" title="Template:Sections">edit</a>]</span> <span class="mw-headline" id="Section_1">Section 1</span></h3>
7444 <h2><span class="editsection">[<a href="/index.php?title=Template:Sections&amp;action=edit&amp;section=T-2" title="Template:Sections">edit</a>]</span> <span class="mw-headline" id="Section_2">Section 2</span></h2>
7445 <h2><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: Section 4">edit</a>]</span> <span class="mw-headline" id="Section_4">Section 4</span></h2>
7446
7447 !! end
7448
7449 !! test
7450 __NOEDITSECTION__ keyword
7451 !! input
7452 __NOEDITSECTION__
7453 ==Section 1==
7454 ==Section 2==
7455 !! result
7456 <h2> <span class="mw-headline" id="Section_1">Section 1</span></h2>
7457 <h2> <span class="mw-headline" id="Section_2">Section 2</span></h2>
7458
7459 !! end
7460
7461 !! test
7462 Link inside a section heading
7463 !! input
7464 ==Section with a [[Main Page|link]] in it==
7465 !! result
7466 <h2><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: Section with a link in it">edit</a>]</span> <span class="mw-headline" id="Section_with_a_link_in_it">Section with a <a href="/wiki/Main_Page" title="Main Page">link</a> in it</span></h2>
7467
7468 !! end
7469
7470 !! test
7471 TOC regression (bug 12077)
7472 !! input
7473 __TOC__
7474 == title 1 ==
7475 === title 1.1 ===
7476 == title 2 ==
7477 !! result
7478 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
7479 <ul>
7480 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
7481 <ul>
7482 <li class="toclevel-2 tocsection-2"><a href="#title_1.1"><span class="tocnumber">1.1</span> <span class="toctext">title 1.1</span></a></li>
7483 </ul>
7484 </li>
7485 <li class="toclevel-1 tocsection-3"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a></li>
7486 </ul>
7487 </td></tr></table>
7488 <h2><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: title 1">edit</a>]</span> <span class="mw-headline" id="title_1"> title 1 </span></h2>
7489 <h3><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: title 1.1">edit</a>]</span> <span class="mw-headline" id="title_1.1"> title 1.1 </span></h3>
7490 <h2><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=3" title="Edit section: title 2">edit</a>]</span> <span class="mw-headline" id="title_2"> title 2 </span></h2>
7491
7492 !! end
7493
7494 !! test
7495 BUG 1219 URL next to image (good)
7496 !! input
7497 http://example.com [[Image:foobar.jpg]]
7498 !! result
7499 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a> <a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
7500 </p>
7501 !!end
7502
7503 !! test
7504 Short headings with trailing space should match behaviour of Parser::doHeadings (bug 19910)
7505 !! input
7506 ===
7507 The line above must have a trailing space!
7508 === <!--
7509 --> <!-- -->
7510 But just in case it doesn't...
7511 !! result
7512 <h1><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: =">edit</a>]</span> <span class="mw-headline" id=".3D">=</span></h1>
7513 <p>The line above must have a trailing space!
7514 </p>
7515 <h1><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: =">edit</a>]</span> <span class="mw-headline" id=".3D_2">=</span></h1>
7516 <p>But just in case it doesn't...
7517 </p>
7518 !! end
7519
7520 !! test
7521 Header with special characters (bug 25462)
7522 !! input
7523 The tooltips shall not show entities to the user (ie. be double escaped)
7524
7525 == text > text ==
7526 section 1
7527
7528 == text < text ==
7529 section 2
7530
7531 == text & text ==
7532 section 3
7533
7534 == text ' text ==
7535 section 4
7536
7537 == text " text ==
7538 section 5
7539 !! result
7540 <p>The tooltips shall not show entities to the user (ie. be double escaped)
7541 </p>
7542 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
7543 <ul>
7544 <li class="toclevel-1 tocsection-1"><a href="#text_.3E_text"><span class="tocnumber">1</span> <span class="toctext">text &gt; text</span></a></li>
7545 <li class="toclevel-1 tocsection-2"><a href="#text_.3C_text"><span class="tocnumber">2</span> <span class="toctext">text &lt; text</span></a></li>
7546 <li class="toclevel-1 tocsection-3"><a href="#text_.26_text"><span class="tocnumber">3</span> <span class="toctext">text &amp; text</span></a></li>
7547 <li class="toclevel-1 tocsection-4"><a href="#text_.27_text"><span class="tocnumber">4</span> <span class="toctext">text ' text</span></a></li>
7548 <li class="toclevel-1 tocsection-5"><a href="#text_.22_text"><span class="tocnumber">5</span> <span class="toctext">text " text</span></a></li>
7549 </ul>
7550 </td></tr></table>
7551 <h2><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: text > text">edit</a>]</span> <span class="mw-headline" id="text_.3E_text"> text &gt; text </span></h2>
7552 <p>section 1
7553 </p>
7554 <h2><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: text &lt; text">edit</a>]</span> <span class="mw-headline" id="text_.3C_text"> text &lt; text </span></h2>
7555 <p>section 2
7556 </p>
7557 <h2><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=3" title="Edit section: text &amp; text">edit</a>]</span> <span class="mw-headline" id="text_.26_text"> text &amp; text </span></h2>
7558 <p>section 3
7559 </p>
7560 <h2><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=4" title="Edit section: text ' text">edit</a>]</span> <span class="mw-headline" id="text_.27_text"> text ' text </span></h2>
7561 <p>section 4
7562 </p>
7563 <h2><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=5" title="Edit section: text &quot; text">edit</a>]</span> <span class="mw-headline" id="text_.22_text"> text " text </span></h2>
7564 <p>section 5
7565 </p>
7566 !! end
7567
7568 !! test
7569 Headers with excess '=' characters
7570 (Are similar tests necessary beyond the 1st level?)
7571 !! input
7572 =foo==
7573 ==foo=
7574 =''italic'' heading==
7575 ==''italic'' heading=
7576 !! result
7577 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
7578 <ul>
7579 <li class="toclevel-1 tocsection-1"><a href="#foo.3D"><span class="tocnumber">1</span> <span class="toctext">foo=</span></a></li>
7580 <li class="toclevel-1 tocsection-2"><a href="#.3Dfoo"><span class="tocnumber">2</span> <span class="toctext">=foo</span></a></li>
7581 <li class="toclevel-1 tocsection-3"><a href="#italic_heading.3D"><span class="tocnumber">3</span> <span class="toctext"><i>italic</i> heading=</span></a></li>
7582 <li class="toclevel-1 tocsection-4"><a href="#.3Ditalic_heading"><span class="tocnumber">4</span> <span class="toctext">=<i>italic</i> heading</span></a></li>
7583 </ul>
7584 </td></tr></table>
7585 <h1><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: foo=">edit</a>]</span> <span class="mw-headline" id="foo.3D">foo=</span></h1>
7586 <h1><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: =foo">edit</a>]</span> <span class="mw-headline" id=".3Dfoo">=foo</span></h1>
7587 <h1><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=3" title="Edit section: italic heading=">edit</a>]</span> <span class="mw-headline" id="italic_heading.3D"><i>italic</i> heading=</span></h1>
7588 <h1><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=4" title="Edit section: =italic heading">edit</a>]</span> <span class="mw-headline" id=".3Ditalic_heading">=<i>italic</i> heading</span></h1>
7589
7590 !! end
7591
7592 !! test
7593 BUG 1219 URL next to image (broken)
7594 !! input
7595 http://example.com[[Image:foobar.jpg]]
7596 !! result
7597 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
7598 </p>
7599 !!end
7600
7601 !! test
7602 Bug 1186 news: in the middle of text
7603 !! input
7604 http://en.wikinews.org/wiki/Wikinews:Workplace
7605 !! result
7606 <p><a rel="nofollow" class="external free" href="http://en.wikinews.org/wiki/Wikinews:Workplace">http://en.wikinews.org/wiki/Wikinews:Workplace</a>
7607 </p>
7608 !!end
7609
7610
7611 !! test
7612 Namespaced link must have a title
7613 !! input
7614 [[Project:]]
7615 !! result
7616 <p>[[Project:]]
7617 </p>
7618 !!end
7619
7620 !! test
7621 Namespaced link must have a title (bad fragment version)
7622 !! input
7623 [[Project:#fragment]]
7624 !! result
7625 <p>[[Project:#fragment]]
7626 </p>
7627 !!end
7628
7629
7630 ###
7631 ### HTML tags and HTML attributes
7632 ###
7633
7634 !! test
7635 div with no attributes
7636 !! input
7637 <div>HTML rocks</div>
7638 !! result
7639 <div>HTML rocks</div>
7640
7641 !! end
7642
7643 !! test
7644 div with double-quoted attribute
7645 !! input
7646 <div id="rock">HTML rocks</div>
7647 !! result
7648 <div id="rock">HTML rocks</div>
7649
7650 !! end
7651
7652 !! test
7653 div with single-quoted attribute
7654 !! input
7655 <div id='rock'>HTML rocks</div>
7656 !! result
7657 <div id="rock">HTML rocks</div>
7658
7659 !! end
7660
7661 !! test
7662 div with unquoted attribute
7663 !! input
7664 <div id=rock>HTML rocks</div>
7665 !! result
7666 <div id="rock">HTML rocks</div>
7667
7668 !! end
7669
7670 !! test
7671 div with illegal double attributes
7672 !! input
7673 <div id="a" id="b">HTML rocks</div>
7674 !! result
7675 <div id="b">HTML rocks</div>
7676
7677 !!end
7678
7679 # FIXME: produce empty string instead of "class" in the PHP parser, following
7680 # the HTML5 spec.
7681 !! test
7682 div with empty attribute value, space before equals
7683 !! options
7684 disabled
7685 !! input
7686 <div class =>HTML rocks</div>
7687 !! result
7688 <div class="">HTML rocks</div>
7689
7690 !! end
7691
7692 # The PHP parser escapes the opening brace to &#123; for some reason, so
7693 # disabled this test for it.
7694 !! test
7695 div with braces in attribute value
7696 !! options
7697 disabled
7698 !! input
7699 <div title="{}">Foo</div>
7700 !! result
7701 <div title="{}">Foo</div>
7702 !! end
7703
7704 # This it very inconsistent in the PHP parser: it returns
7705 # class="class" if there is a space between the name and the equal sign (see
7706 # 'div with empty attribute value, space before equals'), but strips the
7707 # attribute completely if the space is missing. We hope that not much content
7708 # depends on this, so are implementing the behavior below in Parsoid for
7709 # consistencies' sake. Disabled for the PHP parser.
7710 # FIXME: fix this behavior in the PHP parser?
7711 !! test
7712 div with empty attribute value, no space before equals
7713 !! options
7714 disabled
7715 !! input
7716 <div class=>HTML rocks</div>
7717 !! result
7718 <div class="">HTML rocks</div>
7719
7720 !! end
7721
7722 !! test
7723 HTML multiple attributes correction
7724 !! input
7725 <p class="error" class="awesome">Awesome!</p>
7726 !! result
7727 <p class="awesome">Awesome!</p>
7728
7729 !!end
7730
7731 !! test
7732 Table multiple attributes correction
7733 !! input
7734 {|
7735 !+ class="error" class="awesome"| status
7736 |}
7737 !! result
7738 <table>
7739 <tr>
7740 <th class="awesome"> status
7741 </th></tr></table>
7742
7743 !!end
7744
7745 !! test
7746 DIV IN UPPERCASE
7747 !! input
7748 <DIV ID="x">HTML ROCKS</DIV>
7749 !! result
7750 <div id="x">HTML ROCKS</div>
7751
7752 !!end
7753
7754 !! test
7755 Non-ASCII pseudo-tags are rendered as text
7756 !! input
7757 <khyô>
7758 !! result
7759 <p>&lt;khyô&gt;
7760 </p>
7761 !! end
7762
7763 !! test
7764 Pseudo-tag with URL 'name' renders as url link
7765 !! input
7766 <http://example.com/>
7767 !! result
7768 <p>&lt;<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&gt;
7769 </p>
7770 !! end
7771
7772 !! test
7773 text with amp in the middle of nowhere
7774 !! input
7775 Remember AT&T?
7776 !!result
7777 <p>Remember AT&amp;T?
7778 </p>
7779 !! end
7780
7781 !! test
7782 text with character entity: eacute
7783 !! input
7784 I always thought &eacute; was a cute letter.
7785 !! result
7786 <p>I always thought &#233; was a cute letter.
7787 </p>
7788 !! end
7789
7790 !! test
7791 text with entity-escaped character entity-like string: eacute
7792 !! input
7793 I always thought &amp;eacute; was a cute letter.
7794 !! result
7795 <p>I always thought &amp;eacute; was a cute letter.
7796 </p>
7797 !! end
7798
7799 !! test
7800 text with undefined character entity: xacute
7801 !! input
7802 I always thought &xacute; was a cute letter.
7803 !! result
7804 <p>I always thought &amp;xacute; was a cute letter.
7805 </p>
7806 !! end
7807
7808
7809 ###
7810 ### Media links
7811 ###
7812
7813 !! test
7814 Media link
7815 !! input
7816 [[Media:Foobar.jpg]]
7817 !! result
7818 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Media:Foobar.jpg</a>
7819 </p>
7820 !! end
7821
7822 !! test
7823 Media link with text
7824 !! input
7825 [[Media:Foobar.jpg|A neat file to look at]]
7826 !! result
7827 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">A neat file to look at</a>
7828 </p>
7829 !! end
7830
7831 # FIXME: this is still bad HTML tag nesting
7832 !! test
7833 Media link with nasty text
7834 fixme: doBlockLevels won't wrap this in a paragraph because it contains a div
7835 !! input
7836 [[Media:Foobar.jpg|Safe Link<div style=display:none>" onmouseover="alert(document.cookie)" onfoo="</div>]]
7837 !! result
7838 <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>
7839
7840 !! end
7841
7842 !! test
7843 Media link to nonexistent file (bug 1702)
7844 !! input
7845 [[Media:No such.jpg]]
7846 !! result
7847 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=No_such.jpg" class="new" title="No such.jpg">Media:No such.jpg</a>
7848 </p>
7849 !! end
7850
7851 !! test
7852 Image link to nonexistent file (bug 1850 - good)
7853 !! input
7854 [[Image:No such.jpg]]
7855 !! result
7856 <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>
7857 </p>
7858 !! end
7859
7860 !! test
7861 :Image link to nonexistent file (bug 1850 - bad)
7862 !! input
7863 [[:Image:No such.jpg]]
7864 !! result
7865 <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>
7866 </p>
7867 !! end
7868
7869
7870
7871 !! test
7872 Character reference normalization in link text (bug 1938)
7873 !! input
7874 [[Main Page|this&that]]
7875 !! result
7876 <p><a href="/wiki/Main_Page" title="Main Page">this&amp;that</a>
7877 </p>
7878 !!end
7879
7880 !! article
7881 אַ
7882 !! text
7883 Test for unicode normalization
7884
7885 The page's name is U+05d0 U+05b7, with non-canonical form U+FB2E
7886 !! endarticle
7887
7888 !! test
7889 (bug 19451) Links should refer to the normalized form.
7890 !! input
7891 [[&#xFB2E;]]
7892 [[&#x5d0;&#x5b7;]]
7893 [[&#x5d0;ַ]]
7894 [[א&#x5b7;]]
7895 [[אַ]]
7896 !! result
7897 <p><a href="/wiki/%D7%90%D6%B7" title="אַ">&#xfb2e;</a>
7898 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;&#x5b7;</a>
7899 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;ַ</a>
7900 <a href="/wiki/%D7%90%D6%B7" title="אַ">א&#x5b7;</a>
7901 <a href="/wiki/%D7%90%D6%B7" title="אַ">אַ</a>
7902 </p>
7903 !! end
7904
7905 !! test
7906 Empty attribute crash test (bug 2067)
7907 !! input
7908 <font color="">foo</font>
7909 !! result
7910 <p><font color="">foo</font>
7911 </p>
7912 !! end
7913
7914 !! test
7915 Empty attribute crash test single-quotes (bug 2067)
7916 !! input
7917 <font color=''>foo</font>
7918 !! result
7919 <p><font color="">foo</font>
7920 </p>
7921 !! end
7922
7923 !! test
7924 Attribute test: equals, then nothing
7925 !! input
7926 <font color=>foo</font>
7927 !! result
7928 <p><font>foo</font>
7929 </p>
7930 !! end
7931
7932 !! test
7933 Attribute test: unquoted value
7934 !! input
7935 <font color=x>foo</font>
7936 !! result
7937 <p><font color="x">foo</font>
7938 </p>
7939 !! end
7940
7941 !! test
7942 Attribute test: unquoted but illegal value (hash)
7943 !! input
7944 <font color=#x>foo</font>
7945 !! result
7946 <p><font color="#x">foo</font>
7947 </p>
7948 !! end
7949
7950 !! test
7951 Attribute test: no value
7952 !! input
7953 <font color>foo</font>
7954 !! result
7955 <p><font color="color">foo</font>
7956 </p>
7957 !! end
7958
7959 !! test
7960 Bug 2095: link with three closing brackets
7961 !! input
7962 [[Main Page]]]
7963 !! result
7964 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>]
7965 </p>
7966 !! end
7967
7968 !! test
7969 Bug 2095: link with pipe and three closing brackets
7970 !! input
7971 [[Main Page|link]]]
7972 !! result
7973 <p><a href="/wiki/Main_Page" title="Main Page">link</a>]
7974 </p>
7975 !! end
7976
7977 !! test
7978 Bug 2095: link with pipe and three closing brackets, version 2
7979 !! input
7980 [[Main Page|[http://example.com/]]]
7981 !! result
7982 <p><a href="/wiki/Main_Page" title="Main Page">[http://example.com/]</a>
7983 </p>
7984 !! end
7985
7986
7987 ###
7988 ### Safety
7989 ###
7990
7991 !! article
7992 Template:Dangerous attribute
7993 !! text
7994 " onmouseover="alert(document.cookie)
7995 !! endarticle
7996
7997 !! article
7998 Template:Dangerous style attribute
7999 !! text
8000 border-size: expression(alert(document.cookie))
8001 !! endarticle
8002
8003 !! article
8004 Template:Div style
8005 !! text
8006 <div style="float: right; {{{1}}}">Magic div</div>
8007 !! endarticle
8008
8009 !! test
8010 Bug 2304: HTML attribute safety (safe template; regression bug 2309)
8011 !! input
8012 <div title="{{test}}"></div>
8013 !! result
8014 <div title="This is a test template"></div>
8015
8016 !! end
8017
8018 !! test
8019 Bug 2304: HTML attribute safety (dangerous template; 2309)
8020 !! input
8021 <div title="{{dangerous attribute}}"></div>
8022 !! result
8023 <div title=""></div>
8024
8025 !! end
8026
8027 !! test
8028 Bug 2304: HTML attribute safety (dangerous style template; 2309)
8029 !! input
8030 <div style="{{dangerous style attribute}}"></div>
8031 !! result
8032 <div style="/* insecure input */"></div>
8033
8034 !! end
8035
8036 !! test
8037 Bug 2304: HTML attribute safety (safe parameter; 2309)
8038 !! input
8039 {{div style|width: 200px}}
8040 !! result
8041 <div style="float: right; width: 200px">Magic div</div>
8042
8043 !! end
8044
8045 !! test
8046 Bug 2304: HTML attribute safety (unsafe parameter; 2309)
8047 !! input
8048 {{div style|width: expression(alert(document.cookie))}}
8049 !! result
8050 <div style="/* insecure input */">Magic div</div>
8051
8052 !! end
8053
8054 !! test
8055 Bug 2304: HTML attribute safety (unsafe breakout parameter; 2309)
8056 !! input
8057 {{div style|"><script>alert(document.cookie)</script>}}
8058 !! result
8059 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
8060
8061 !! end
8062
8063 !! test
8064 Bug 2304: HTML attribute safety (unsafe breakout parameter 2; 2309)
8065 !! input
8066 {{div style|" ><script>alert(document.cookie)</script>}}
8067 !! result
8068 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
8069
8070 !! end
8071
8072 !! test
8073 Bug 2304: HTML attribute safety (link)
8074 !! input
8075 <div title="[[Main Page]]"></div>
8076 !! result
8077 <div title="&#91;&#91;Main Page]]"></div>
8078
8079 !! end
8080
8081 !! test
8082 Bug 2304: HTML attribute safety (italics)
8083 !! input
8084 <div title="''foobar''"></div>
8085 !! result
8086 <div title="&#39;&#39;foobar&#39;&#39;"></div>
8087
8088 !! end
8089
8090 !! test
8091 Bug 2304: HTML attribute safety (bold)
8092 !! input
8093 <div title="'''foobar'''"></div>
8094 !! result
8095 <div title="&#39;&#39;&#39;foobar&#39;&#39;&#39;"></div>
8096
8097 !! end
8098
8099
8100 !! test
8101 Bug 2304: HTML attribute safety (ISBN)
8102 !! input
8103 <div title="ISBN 1234567890"></div>
8104 !! result
8105 <div title="&#73;SBN 1234567890"></div>
8106
8107 !! end
8108
8109 !! test
8110 Bug 2304: HTML attribute safety (RFC)
8111 !! input
8112 <div title="RFC 1234"></div>
8113 !! result
8114 <div title="&#82;FC 1234"></div>
8115
8116 !! end
8117
8118 !! test
8119 Bug 2304: HTML attribute safety (PMID)
8120 !! input
8121 <div title="PMID 1234567890"></div>
8122 !! result
8123 <div title="&#80;MID 1234567890"></div>
8124
8125 !! end
8126
8127 !! test
8128 Bug 2304: HTML attribute safety (web link)
8129 !! input
8130 <div title="http://example.com/"></div>
8131 !! result
8132 <div title="http&#58;//example.com/"></div>
8133
8134 !! end
8135
8136 !! test
8137 Bug 2304: HTML attribute safety (named web link)
8138 !! input
8139 <div title="[http://example.com/ link]"></div>
8140 !! result
8141 <div title="&#91;http&#58;//example.com/ link]"></div>
8142
8143 !! end
8144
8145 !! test
8146 Bug 3244: HTML attribute safety (extension; safe)
8147 !! input
8148 <div style="<nowiki>background:blue</nowiki>"></div>
8149 !! result
8150 <div style="background:blue"></div>
8151
8152 !! end
8153
8154 !! test
8155 Bug 3244: HTML attribute safety (extension; unsafe)
8156 !! input
8157 <div style="<nowiki>border-left:expression(alert(document.cookie))</nowiki>"></div>
8158 !! result
8159 <div style="/* insecure input */"></div>
8160
8161 !! end
8162
8163 # More MSIE fun discovered by Tom Gilder
8164
8165 !! test
8166 MSIE CSS safety test: spurious slash
8167 !! input
8168 <div style="background-image:u\rl(javascript:alert('boo'))">evil</div>
8169 !! result
8170 <div style="/* insecure input */">evil</div>
8171
8172 !! end
8173
8174 !! test
8175 MSIE CSS safety test: hex code
8176 !! input
8177 <div style="background-image:u\72l(javascript:alert('boo'))">evil</div>
8178 !! result
8179 <div style="/* insecure input */">evil</div>
8180
8181 !! end
8182
8183 !! test
8184 MSIE CSS safety test: comment in url
8185 !! input
8186 <div style="background-image:u/**/rl(javascript:alert('boo'))">evil</div>
8187 !! result
8188 <div style="background-image:u rl(javascript:alert(&#39;boo&#39;))">evil</div>
8189
8190 !! end
8191
8192 !! test
8193 MSIE CSS safety test: comment in expression
8194 !! input
8195 <div style="background-image:expres/**/sion(alert('boo4'))">evil4</div>
8196 !! result
8197 <div style="background-image:expres sion(alert(&#39;boo4&#39;))">evil4</div>
8198
8199 !! end
8200
8201
8202 !! test
8203 Table attribute legitimate extension
8204 !! input
8205 {|
8206 !+ style="<nowiki>color:blue</nowiki>"| status
8207 |}
8208 !! result
8209 <table>
8210 <tr>
8211 <th style="color:blue"> status
8212 </th></tr></table>
8213
8214 !!end
8215
8216 !! test
8217 Table attribute safety
8218 !! input
8219 {|
8220 !+ style="<nowiki>border-width:expression(0+alert(document.cookie))</nowiki>"| status
8221 |}
8222 !! result
8223 <table>
8224 <tr>
8225 <th style="/* insecure input */"> status
8226 </th></tr></table>
8227
8228 !! end
8229
8230 !! test
8231 CSS line continuation 1
8232 !! input
8233 <div style="background-image: u\&#10;rl(test.jpg);"></div>
8234 !! result
8235 <div style="/* insecure input */"></div>
8236
8237 !! end
8238
8239 !! test
8240 CSS line continuation 2
8241 !! input
8242 <div style="background-image: u\&#13;rl(test.jpg); "></div>
8243 !! result
8244 <div style="/* insecure input */"></div>
8245
8246 !! end
8247
8248 !! article
8249 Template:Identity
8250 !! text
8251 {{{1}}}
8252 !! endarticle
8253
8254 !! test
8255 Expansion of multi-line templates in attribute values (bug 6255)
8256 !! input
8257 <div style="background: {{identity|#00FF00}}">-</div>
8258 !! result
8259 <div style="background: #00FF00">-</div>
8260
8261 !! end
8262
8263
8264 !! test
8265 Expansion of multi-line templates in attribute values (bug 6255 sanity check)
8266 !! input
8267 <div style="background:
8268 #00FF00">-</div>
8269 !! result
8270 <div style="background: #00FF00">-</div>
8271
8272 !! end
8273
8274 !! test
8275 Expansion of multi-line templates in attribute values (bug 6255 sanity check 2)
8276 !! input
8277 <div style="background: &#10;#00FF00">-</div>
8278 !! result
8279 <div style="background: &#10;#00FF00">-</div>
8280
8281 !! end
8282
8283 ###
8284 ### Parser hooks (see maintenance/parserTestsParserHook.php for the <tag> extension)
8285 ###
8286 !! test
8287 Parser hook: empty input
8288 !! input
8289 <tag></tag>
8290 !! result
8291 <pre>
8292 ''
8293 array (
8294 )
8295 </pre>
8296
8297 !! end
8298
8299 !! test
8300 Parser hook: empty input using terminated empty elements
8301 !! input
8302 <tag/>
8303 !! result
8304 <pre>
8305 NULL
8306 array (
8307 )
8308 </pre>
8309
8310 !! end
8311
8312 !! test
8313 Parser hook: empty input using terminated empty elements (space before)
8314 !! input
8315 <tag />
8316 !! result
8317 <pre>
8318 NULL
8319 array (
8320 )
8321 </pre>
8322
8323 !! end
8324
8325 !! test
8326 Parser hook: basic input
8327 !! input
8328 <tag>input</tag>
8329 !! result
8330 <pre>
8331 'input'
8332 array (
8333 )
8334 </pre>
8335
8336 !! end
8337
8338
8339 !! test
8340 Parser hook: case insensitive
8341 !! input
8342 <TAG>input</TAG>
8343 !! result
8344 <pre>
8345 'input'
8346 array (
8347 )
8348 </pre>
8349
8350 !! end
8351
8352
8353 !! test
8354 Parser hook: case insensitive, redux
8355 !! input
8356 <TaG>input</TAg>
8357 !! result
8358 <pre>
8359 'input'
8360 array (
8361 )
8362 </pre>
8363
8364 !! end
8365
8366 !! test
8367 Parser hook: nested tags
8368 !! options
8369 noxml
8370 !! input
8371 <tag><tag></tag></tag>
8372 !! result
8373 <pre>
8374 '<tag>'
8375 array (
8376 )
8377 </pre>&lt;/tag&gt;
8378
8379 !! end
8380
8381 !! test
8382 Parser hook: basic arguments
8383 !! input
8384 <tag width=200 height = "100" depth = '50' square></tag>
8385 !! result
8386 <pre>
8387 ''
8388 array (
8389 'width' => '200',
8390 'height' => '100',
8391 'depth' => '50',
8392 'square' => 'square',
8393 )
8394 </pre>
8395
8396 !! end
8397
8398 !! test
8399 Parser hook: argument containing a forward slash (bug 5344)
8400 !! input
8401 <tag filename='/tmp/bla'></tag>
8402 !! result
8403 <pre>
8404 ''
8405 array (
8406 'filename' => '/tmp/bla',
8407 )
8408 </pre>
8409
8410 !! end
8411
8412 !! test
8413 Parser hook: empty input using terminated empty elements (bug 2374)
8414 !! input
8415 <tag foo=bar/>text
8416 !! result
8417 <pre>
8418 NULL
8419 array (
8420 'foo' => 'bar',
8421 )
8422 </pre>text
8423
8424 !! end
8425
8426 # </tag> should be output literally since there is no matching tag that begins it
8427 !! test
8428 Parser hook: basic arguments using terminated empty elements (bug 2374)
8429 !! input
8430 <tag width=200 height = "100" depth = '50' square/>
8431 other stuff
8432 </tag>
8433 !! result
8434 <pre>
8435 NULL
8436 array (
8437 'width' => '200',
8438 'height' => '100',
8439 'depth' => '50',
8440 'square' => 'square',
8441 )
8442 </pre>
8443 <p>other stuff
8444 &lt;/tag&gt;
8445 </p>
8446 !! end
8447
8448 ###
8449 ### (see maintenance/parserTestsStaticParserHook.php for the <statictag> extension)
8450 ###
8451
8452 !! test
8453 Parser hook: static parser hook not inside a comment
8454 !! input
8455 <statictag>hello, world</statictag>
8456 <statictag action=flush/>
8457 !! result
8458 <p>hello, world
8459 </p>
8460 !! end
8461
8462
8463 !! test
8464 Parser hook: static parser hook inside a comment
8465 !! input
8466 <!-- <statictag>hello, world</statictag> -->
8467 <statictag action=flush/>
8468 !! result
8469 <p><br />
8470 </p>
8471 !! end
8472
8473 # Nested template calls; this case was broken by Parser.php rev 1.506,
8474 # since reverted.
8475
8476 !! article
8477 Template:One-parameter
8478 !! text
8479 (My parameter is: {{{1}}})
8480 !! endarticle
8481
8482 !! article
8483 Template:Map-one-parameter
8484 !! text
8485 {{{{{1}}}|{{{2}}}}}
8486 !! endarticle
8487
8488 !! test
8489 Nested template calls
8490 !! input
8491 {{Map-one-parameter|One-parameter|param}}
8492 !! result
8493 <p>(My parameter is: param)
8494 </p>
8495 !! end
8496
8497
8498 ###
8499 ### Sanitizer
8500 ###
8501 !! test
8502 Sanitizer: Closing of open tags
8503 !! input
8504 <s></s><table></table>
8505 !! result
8506 <s></s><table></table>
8507
8508 !! end
8509
8510 !! test
8511 Sanitizer: Closing of open but not closed tags
8512 !! input
8513 <s>foo
8514 !! result
8515 <p><s>foo</s>
8516 </p>
8517 !! end
8518
8519 !! test
8520 Sanitizer: Closing of closed but not open tags
8521 !! input
8522 </s>
8523 !! result
8524 <p>&lt;/s&gt;
8525 </p>
8526 !! end
8527
8528 !! test
8529 Sanitizer: Closing of closed but not open table tags
8530 !! input
8531 Table not started</td></tr></table>
8532 !! result
8533 <p>Table not started&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
8534 </p>
8535 !! end
8536
8537 !! test
8538 Sanitizer: Escaping of spaces, multibyte characters, colons & other stuff in id=""
8539 !! input
8540 <span id="æ: v">byte</span>[[#æ: v|backlink]]
8541 !! result
8542 <p><span id=".C3.A6:_v">byte</span><a href="#.C3.A6:_v">backlink</a>
8543 </p>
8544 !! end
8545
8546 !! test
8547 Sanitizer: Validating the contents of the id attribute (bug 4515)
8548 !! options
8549 disabled
8550 !! input
8551 <br id=9 />
8552 !! result
8553 Something, but definitely not <br id="9" />...
8554 !! end
8555
8556 !! test
8557 Sanitizer: Validating id attribute uniqueness (bug 4515, bug 6301)
8558 !! options
8559 disabled
8560 !! input
8561 <br id="foo" /><br id="foo" />
8562 !! result
8563 Something need to be done. foo-2 ?
8564 !! end
8565
8566 !! test
8567 Sanitizer: Validating that <meta> and <link> work, but only for Microdata
8568 !! input
8569 <div itemscope>
8570 <meta itemprop="hello" content="world">
8571 <meta http-equiv="refresh" content="5">
8572 <meta itemprop="hello" http-equiv="refresh" content="5">
8573 <link itemprop="hello" href="{{SERVER}}">
8574 <link rel="stylesheet" href="{{SERVER}}">
8575 <link rel="stylesheet" itemprop="hello" href="{{SERVER}}">
8576 </div>
8577 !! result
8578 <div itemscope="itemscope">
8579 <p> <meta itemprop="hello" content="world" />
8580 &lt;meta http-equiv="refresh" content="5"&gt;
8581 <meta itemprop="hello" content="5" />
8582 </p>
8583 <link itemprop="hello" href="http&#58;//Britney-Spears" />
8584 &lt;link rel="stylesheet" href="<a rel="nofollow" class="external free" href="http://Britney-Spears">http://Britney-Spears</a>"&gt;
8585 <link itemprop="hello" href="http&#58;//Britney-Spears" />
8586 </div>
8587
8588 !! end
8589
8590 !! test
8591 Language converter: output gets cut off unexpectedly (bug 5757)
8592 !! options
8593 language=zh
8594 !! input
8595 this bit is safe: }-
8596
8597 but if we add a conversion instance: -{zh-cn:xxx;zh-tw:yyy}-
8598
8599 then we get cut off here: }-
8600
8601 all additional text is vanished
8602 !! result
8603 <p>this bit is safe: }-
8604 </p><p>but if we add a conversion instance: xxx
8605 </p><p>then we get cut off here: }-
8606 </p><p>all additional text is vanished
8607 </p>
8608 !! end
8609
8610 !! test
8611 Self closed html pairs (bug 5487)
8612 !! options
8613 !! input
8614 <center><font id="bug" />Centered text</center>
8615 <div><font id="bug2" />In div text</div>
8616 !! result
8617 <center>&lt;font id="bug" /&gt;Centered text</center>
8618 <div>&lt;font id="bug2" /&gt;In div text</div>
8619
8620 !! end
8621
8622 #
8623 #
8624 #
8625
8626 !! test
8627 Punctuation: nbsp before exclamation
8628 !! input
8629 C'est grave !
8630 !! result
8631 <p>C'est grave&#160;!
8632 </p>
8633 !! end
8634
8635 !! test
8636 Punctuation: CSS !important (bug 11874)
8637 !! input
8638 <div style="width:50% !important">important</div>
8639 !! result
8640 <div style="width:50% !important">important</div>
8641
8642 !!end
8643
8644 !! test
8645 Punctuation: CSS ! important (bug 11874; with space after)
8646 !! input
8647 <div style="width:50% ! important">important</div>
8648 !! result
8649 <div style="width:50% ! important">important</div>
8650
8651 !!end
8652
8653
8654 !! test
8655 HTML bullet list, closed tags (bug 5497)
8656 !! input
8657 <ul>
8658 <li>One</li>
8659 <li>Two</li>
8660 </ul>
8661 !! result
8662 <ul>
8663 <li>One</li>
8664 <li>Two</li>
8665 </ul>
8666
8667 !! end
8668
8669 !! test
8670 HTML bullet list, unclosed tags (bug 5497)
8671 !! options
8672 disabled
8673 !! input
8674 <ul>
8675 <li>One
8676 <li>Two
8677 </ul>
8678 !! result
8679 <ul>
8680 <li>One
8681 </li><li>Two
8682 </li></ul>
8683
8684 !! end
8685
8686 !! test
8687 HTML ordered list, closed tags (bug 5497)
8688 !! input
8689 <ol>
8690 <li>One</li>
8691 <li>Two</li>
8692 </ol>
8693 !! result
8694 <ol>
8695 <li>One</li>
8696 <li>Two</li>
8697 </ol>
8698
8699 !! end
8700
8701 !! test
8702 HTML ordered list, unclosed tags (bug 5497)
8703 !! options
8704 disabled
8705 !! input
8706 <ol>
8707 <li>One
8708 <li>Two
8709 </ol>
8710 !! result
8711 <ol>
8712 <li>One
8713 </li><li>Two
8714 </li></ol>
8715
8716 !! end
8717
8718 !! test
8719 HTML nested bullet list, closed tags (bug 5497)
8720 !! input
8721 <ul>
8722 <li>One</li>
8723 <li>Two:
8724 <ul>
8725 <li>Sub-one</li>
8726 <li>Sub-two</li>
8727 </ul>
8728 </li>
8729 </ul>
8730 !! result
8731 <ul>
8732 <li>One</li>
8733 <li>Two:
8734 <ul>
8735 <li>Sub-one</li>
8736 <li>Sub-two</li>
8737 </ul>
8738 </li>
8739 </ul>
8740
8741 !! end
8742
8743 !! test
8744 HTML nested bullet list, open tags (bug 5497)
8745 !! options
8746 disabled
8747 !! input
8748 <ul>
8749 <li>One
8750 <li>Two:
8751 <ul>
8752 <li>Sub-one
8753 <li>Sub-two
8754 </ul>
8755 </ul>
8756 !! result
8757 <ul>
8758 <li>One
8759 </li><li>Two:
8760 <ul>
8761 <li>Sub-one
8762 </li><li>Sub-two
8763 </li></ul>
8764 </li></ul>
8765
8766 !! end
8767
8768 !! test
8769 HTML nested ordered list, closed tags (bug 5497)
8770 !! input
8771 <ol>
8772 <li>One</li>
8773 <li>Two:
8774 <ol>
8775 <li>Sub-one</li>
8776 <li>Sub-two</li>
8777 </ol>
8778 </li>
8779 </ol>
8780 !! result
8781 <ol>
8782 <li>One</li>
8783 <li>Two:
8784 <ol>
8785 <li>Sub-one</li>
8786 <li>Sub-two</li>
8787 </ol>
8788 </li>
8789 </ol>
8790
8791 !! end
8792
8793 !! test
8794 HTML nested ordered list, open tags (bug 5497)
8795 !! options
8796 disabled
8797 !! input
8798 <ol>
8799 <li>One
8800 <li>Two:
8801 <ol>
8802 <li>Sub-one
8803 <li>Sub-two
8804 </ol>
8805 </ol>
8806 !! result
8807 <ol>
8808 <li>One
8809 </li><li>Two:
8810 <ol>
8811 <li>Sub-one
8812 </li><li>Sub-two
8813 </li></ol>
8814 </li></ol>
8815
8816 !! end
8817
8818 !! test
8819 HTML ordered list item with parameters oddity
8820 !! input
8821 <ol><li id="fragment">One</li></ol>
8822 !! result
8823 <ol><li id="fragment">One</li></ol>
8824
8825 !! end
8826
8827 !!test
8828 bug 5918: autonumbering
8829 !! input
8830 [http://first/] [http://second] [ftp://ftp]
8831
8832 ftp://inlineftp
8833
8834 [mailto:enclosed@mail.tld With target]
8835
8836 [mailto:enclosed@mail.tld]
8837
8838 mailto:inline@mail.tld
8839 !! result
8840 <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>
8841 </p><p><a rel="nofollow" class="external free" href="ftp://inlineftp">ftp://inlineftp</a>
8842 </p><p><a rel="nofollow" class="external text" href="mailto:enclosed@mail.tld">With target</a>
8843 </p><p><a rel="nofollow" class="external autonumber" href="mailto:enclosed@mail.tld">[4]</a>
8844 </p><p><a rel="nofollow" class="external free" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a>
8845 </p>
8846 !! end
8847
8848
8849 #
8850 # Security and HTML correctness
8851 # From Nick Jenkins' fuzz testing
8852 #
8853
8854 !! test
8855 Fuzz testing: Parser13
8856 !! input
8857 {|
8858 | http://a|
8859 !! result
8860 <table>
8861 <tr>
8862 <td>
8863 </td>
8864 </tr>
8865 </table>
8866
8867 !! end
8868
8869 !! test
8870 Fuzz testing: Parser14
8871 !! input
8872 == onmouseover= ==
8873 http://__TOC__
8874 !! result
8875 <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>
8876 http://<table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
8877 <ul>
8878 <li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
8879 </ul>
8880 </td></tr></table>
8881
8882 !! end
8883
8884 !! test
8885 Fuzz testing: Parser14-table
8886 !! input
8887 ==a==
8888 {| STYLE=__TOC__
8889 !! result
8890 <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>
8891 <table style="&#95;_TOC&#95;_">
8892 <tr><td></td></tr>
8893 </table>
8894
8895 !! end
8896
8897 # Known to produce bogus xml (extra </td>)
8898 !! test
8899 Fuzz testing: Parser16
8900 !! options
8901 noxml
8902 !! input
8903 {|
8904 !https://||||||
8905 !! result
8906 <table>
8907 <tr>
8908 <th>https://</th>
8909 <th></th>
8910 <th></th>
8911 <th>
8912 </td>
8913 </tr>
8914 </table>
8915
8916 !! end
8917
8918 !! test
8919 Fuzz testing: Parser21
8920 !! input
8921 {|
8922 ! irc://{{ftp://a" onmouseover="alert('hello world');"
8923 |
8924 !! result
8925 <table>
8926 <tr>
8927 <th> <a rel="nofollow" class="external free" href="irc://{{ftp://a">irc://{{ftp://a</a>" onmouseover="alert('hello world');"
8928 </th>
8929 <td>
8930 </td>
8931 </tr>
8932 </table>
8933
8934 !! end
8935
8936 !! test
8937 Fuzz testing: Parser22
8938 !! input
8939 http://===r:::https://b
8940
8941 {|
8942 !!result
8943 <p><a rel="nofollow" class="external free" href="http://===r:::https://b">http://===r:::https://b</a>
8944 </p>
8945 <table>
8946 <tr><td></td></tr>
8947 </table>
8948
8949 !! end
8950
8951 # Known to produce bad XML for now
8952 !! test
8953 Fuzz testing: Parser24
8954 !! options
8955 noxml
8956 !! input
8957 {|
8958 {{{|
8959 <u CLASS=
8960 | {{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx--><noinclude>}}}} >
8961 <br style="onmouseover='alert(document.cookie);' " />
8962
8963 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
8964 |
8965 !! result
8966 <table>
8967 {{{|
8968 <u class="&#124;">}}}} &gt;
8969 <br style="onmouseover=&#39;alert(document.cookie);&#39;" />
8970
8971 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
8972 <tr>
8973 <td></u>
8974 </td>
8975 </tr>
8976 </table>
8977
8978 !! end
8979
8980 # Note: the current result listed for this is not what the original one was,
8981 # but the original bug was JavaScript injection, which is fixed in any case.
8982 # It's not clear that the original result listed was any more correct than the
8983 # current one. Original result:
8984 # <p>{{{|
8985 # </p>
8986 # <li class="&#124;&#124;">
8987 # }}}blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
8988 !!test
8989 Fuzz testing: Parser25 (bug 6055)
8990 !! input
8991 {{{
8992 |
8993 <LI CLASS=||
8994 >
8995 }}}blah" onmouseover="alert('hello world');" align="left"'''MOVE MOUSE CURSOR OVER HERE
8996 !! result
8997 <p>&lt;LI CLASS=blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
8998 </p>
8999 !! end
9000
9001 !!test
9002 Fuzz testing: URL adjacent extension (with space, clean)
9003 !! options
9004 !! input
9005 http://example.com <nowiki>junk</nowiki>
9006 !! result
9007 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a> junk
9008 </p>
9009 !!end
9010
9011 !!test
9012 Fuzz testing: URL adjacent extension (no space, dirty; nowiki)
9013 !! options
9014 !! input
9015 http://example.com<nowiki>junk</nowiki>
9016 !! result
9017 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>junk
9018 </p>
9019 !!end
9020
9021 !!test
9022 Fuzz testing: URL adjacent extension (no space, dirty; pre)
9023 !! options
9024 !! input
9025 http://example.com<pre>junk</pre>
9026 !! result
9027 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a><pre>junk</pre>
9028
9029 !!end
9030
9031 !!test
9032 Fuzz testing: image with bogus manual thumbnail
9033 !!input
9034 [[Image:foobar.jpg|thumbnail= ]]
9035 !!result
9036 <div class="thumb tright"><div class="thumbinner" style="width:1943px;">Error creating thumbnail: <div class="thumbcaption"></div></div></div>
9037
9038 !!end
9039
9040 !! test
9041 Fuzz testing: encoded newline in generated HTML replacements (bug 6577)
9042 !! input
9043 <pre dir="&#10;"></pre>
9044 !! result
9045 <pre dir="&#10;"></pre>
9046
9047 !! end
9048
9049 !! test
9050 Parsing optional HTML elements (Bug 6171)
9051 !! options
9052 !! input
9053 <table>
9054 <tr>
9055 <td> Some tabular data</td>
9056 <td> More tabular data ...
9057 <td> And yet som tabular data</td>
9058 </tr>
9059 </table>
9060 !! result
9061 <table>
9062 <tr>
9063 <td> Some tabular data</td>
9064 <td> More tabular data ...
9065 </td><td> And yet som tabular data</td>
9066 </tr>
9067 </table>
9068
9069 !! end
9070
9071 !! test
9072 Correct handling of <td>, <tr> (Bug 6171)
9073 !! options
9074 !! input
9075 <table>
9076 <tr>
9077 <td> Some tabular data</td>
9078 <td> More tabular data ...</td>
9079 <td> And yet som tabular data</td>
9080 </tr>
9081 </table>
9082 !! result
9083 <table>
9084 <tr>
9085 <td> Some tabular data</td>
9086 <td> More tabular data ...</td>
9087 <td> And yet som tabular data</td>
9088 </tr>
9089 </table>
9090
9091 !! end
9092
9093
9094 !! test
9095 Parsing crashing regression (fr:JavaScript)
9096 !! input
9097 </body></x>
9098 !! result
9099 <p>&lt;/body&gt;&lt;/x&gt;
9100 </p>
9101 !! end
9102
9103 !! test
9104 Inline wiki vs wiki block nesting
9105 !! input
9106 '''Bold paragraph
9107
9108 New wiki paragraph
9109 !! result
9110 <p><b>Bold paragraph</b>
9111 </p><p>New wiki paragraph
9112 </p>
9113 !! end
9114
9115 !! test
9116 Inline HTML vs wiki block nesting
9117 !! options
9118 disabled
9119 !! input
9120 <b>Bold paragraph
9121
9122 New wiki paragraph
9123 !! result
9124 <p><b>Bold paragraph</b>
9125 </p><p>New wiki paragraph
9126 </p>
9127 !! end
9128
9129 # Original result was this:
9130 # <p><b>bold</b><b>bold<i>bolditalics</i></b>
9131 # </p>
9132 # While that might be marginally more intuitive, maybe, the six-apostrophe
9133 # construct is clearly pathological and the result stated here (which is what
9134 # the parser actually does) is about as reasonable as anything.
9135 !!test
9136 Mixing markup for italics and bold
9137 !! options
9138 !! input
9139 '''bold''''''bold''bolditalics'''''
9140 !! result
9141 <p>'<i>bold'</i><b>bold<i>bolditalics</i></b>
9142 </p>
9143 !! end
9144
9145
9146 !! article
9147 Xyzzyx
9148 !! text
9149 Article for special page transclusion test
9150 !! endarticle
9151
9152 !! test
9153 Special page transclusion
9154 !! options
9155 !! input
9156 {{Special:Prefixindex/Xyzzyx}}
9157 !! result
9158 <table id="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
9159
9160 !! end
9161
9162 !! test
9163 Special page transclusion twice (bug 5021)
9164 !! options
9165 !! input
9166 {{Special:Prefixindex/Xyzzyx}}
9167 {{Special:Prefixindex/Xyzzyx}}
9168 !! result
9169 <table id="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
9170 <table id="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
9171
9172 !! end
9173
9174 !! test
9175 Transclusion of default MediaWiki message
9176 !! input
9177 {{MediaWiki:Mainpage}}
9178 !!result
9179 <p>Main Page
9180 </p>
9181 !! end
9182
9183 !! test
9184 Transclusion of nonexistent MediaWiki message
9185 !! input
9186 {{MediaWiki:Mainpagexxx}}
9187 !!result
9188 <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>
9189 </p>
9190 !! end
9191
9192 !! test
9193 Transclusion of MediaWiki message with underscore
9194 !! input
9195 {{MediaWiki:history_short}}
9196 !! result
9197 <p>History
9198 </p>
9199 !! end
9200
9201 !! test
9202 Transclusion of MediaWiki message with space
9203 !! input
9204 {{MediaWiki:history short}}
9205 !! result
9206 <p>History
9207 </p>
9208 !! end
9209
9210 !! test
9211 Invalid header with following text
9212 !! input
9213 = x = y
9214 !! result
9215 <p>= x = y
9216 </p>
9217 !! end
9218
9219
9220 !! test
9221 Section extraction test (section 0)
9222 !! options
9223 section=0
9224 !! input
9225 start
9226 ==a==
9227 ===aa===
9228 ====aaa====
9229 ==b==
9230 ===ba===
9231 ===bb===
9232 ====bba====
9233 ===bc===
9234 ==c==
9235 ===ca===
9236 !! result
9237 start
9238 !! end
9239
9240 !! test
9241 Section extraction test (section 1)
9242 !! options
9243 section=1
9244 !! input
9245 start
9246 ==a==
9247 ===aa===
9248 ====aaa====
9249 ==b==
9250 ===ba===
9251 ===bb===
9252 ====bba====
9253 ===bc===
9254 ==c==
9255 ===ca===
9256 !! result
9257 ==a==
9258 ===aa===
9259 ====aaa====
9260 !! end
9261
9262 !! test
9263 Section extraction test (section 2)
9264 !! options
9265 section=2
9266 !! input
9267 start
9268 ==a==
9269 ===aa===
9270 ====aaa====
9271 ==b==
9272 ===ba===
9273 ===bb===
9274 ====bba====
9275 ===bc===
9276 ==c==
9277 ===ca===
9278 !! result
9279 ===aa===
9280 ====aaa====
9281 !! end
9282
9283 !! test
9284 Section extraction test (section 3)
9285 !! options
9286 section=3
9287 !! input
9288 start
9289 ==a==
9290 ===aa===
9291 ====aaa====
9292 ==b==
9293 ===ba===
9294 ===bb===
9295 ====bba====
9296 ===bc===
9297 ==c==
9298 ===ca===
9299 !! result
9300 ====aaa====
9301 !! end
9302
9303 !! test
9304 Section extraction test (section 4)
9305 !! options
9306 section=4
9307 !! input
9308 start
9309 ==a==
9310 ===aa===
9311 ====aaa====
9312 ==b==
9313 ===ba===
9314 ===bb===
9315 ====bba====
9316 ===bc===
9317 ==c==
9318 ===ca===
9319 !! result
9320 ==b==
9321 ===ba===
9322 ===bb===
9323 ====bba====
9324 ===bc===
9325 !! end
9326
9327 !! test
9328 Section extraction test (section 5)
9329 !! options
9330 section=5
9331 !! input
9332 start
9333 ==a==
9334 ===aa===
9335 ====aaa====
9336 ==b==
9337 ===ba===
9338 ===bb===
9339 ====bba====
9340 ===bc===
9341 ==c==
9342 ===ca===
9343 !! result
9344 ===ba===
9345 !! end
9346
9347 !! test
9348 Section extraction test (section 6)
9349 !! options
9350 section=6
9351 !! input
9352 start
9353 ==a==
9354 ===aa===
9355 ====aaa====
9356 ==b==
9357 ===ba===
9358 ===bb===
9359 ====bba====
9360 ===bc===
9361 ==c==
9362 ===ca===
9363 !! result
9364 ===bb===
9365 ====bba====
9366 !! end
9367
9368 !! test
9369 Section extraction test (section 7)
9370 !! options
9371 section=7
9372 !! input
9373 start
9374 ==a==
9375 ===aa===
9376 ====aaa====
9377 ==b==
9378 ===ba===
9379 ===bb===
9380 ====bba====
9381 ===bc===
9382 ==c==
9383 ===ca===
9384 !! result
9385 ====bba====
9386 !! end
9387
9388 !! test
9389 Section extraction test (section 8)
9390 !! options
9391 section=8
9392 !! input
9393 start
9394 ==a==
9395 ===aa===
9396 ====aaa====
9397 ==b==
9398 ===ba===
9399 ===bb===
9400 ====bba====
9401 ===bc===
9402 ==c==
9403 ===ca===
9404 !! result
9405 ===bc===
9406 !! end
9407
9408 !! test
9409 Section extraction test (section 9)
9410 !! options
9411 section=9
9412 !! input
9413 start
9414 ==a==
9415 ===aa===
9416 ====aaa====
9417 ==b==
9418 ===ba===
9419 ===bb===
9420 ====bba====
9421 ===bc===
9422 ==c==
9423 ===ca===
9424 !! result
9425 ==c==
9426 ===ca===
9427 !! end
9428
9429 !! test
9430 Section extraction test (section 10)
9431 !! options
9432 section=10
9433 !! input
9434 start
9435 ==a==
9436 ===aa===
9437 ====aaa====
9438 ==b==
9439 ===ba===
9440 ===bb===
9441 ====bba====
9442 ===bc===
9443 ==c==
9444 ===ca===
9445 !! result
9446 ===ca===
9447 !! end
9448
9449 !! test
9450 Section extraction test (nonexistent section 11)
9451 !! options
9452 section=11
9453 !! input
9454 start
9455 ==a==
9456 ===aa===
9457 ====aaa====
9458 ==b==
9459 ===ba===
9460 ===bb===
9461 ====bba====
9462 ===bc===
9463 ==c==
9464 ===ca===
9465 !! result
9466 !! end
9467
9468 !! test
9469 Section extraction test with bogus heading (section 1)
9470 !! options
9471 section=1
9472 !! input
9473 ==a==
9474 ==bogus== not a legal section
9475 ==b==
9476 !! result
9477 ==a==
9478 ==bogus== not a legal section
9479 !! end
9480
9481 !! test
9482 Section extraction test with bogus heading (section 2)
9483 !! options
9484 section=2
9485 !! input
9486 ==a==
9487 ==bogus== not a legal section
9488 ==b==
9489 !! result
9490 ==b==
9491 !! end
9492
9493 !! test
9494 Section extraction test with comment after heading (section 1)
9495 !! options
9496 section=1
9497 !! input
9498 ==a==
9499 ==b== <!-- -->
9500 ==c==
9501 !! result
9502 ==a==
9503 !! end
9504
9505 !! test
9506 Section extraction test with comment after heading (section 2)
9507 !! options
9508 section=2
9509 !! input
9510 ==a==
9511 ==b== <!-- -->
9512 ==c==
9513 !! result
9514 ==b== <!-- -->
9515 !! end
9516
9517 !! test
9518 Section extraction test with bogus <nowiki> heading (section 1)
9519 !! options
9520 section=1
9521 !! input
9522 ==a==
9523 ==bogus== <nowiki>not a legal section</nowiki>
9524 ==b==
9525 !! result
9526 ==a==
9527 ==bogus== <nowiki>not a legal section</nowiki>
9528 !! end
9529
9530 !! test
9531 Section extraction test with bogus <nowiki> heading (section 2)
9532 !! options
9533 section=2
9534 !! input
9535 ==a==
9536 ==bogus== <nowiki>not a legal section</nowiki>
9537 ==b==
9538 !! result
9539 ==b==
9540 !! end
9541
9542
9543 # Formerly testing for bug 2587, now resolved by the use of unmarked sections
9544 # instead of respecting commented sections
9545 !! test
9546 Section extraction prefixed by comment (section 1)
9547 !! options
9548 section=1
9549 !! input
9550 <!-- -->==sec1==
9551 ==sec2==
9552 !!result
9553 ==sec2==
9554 !!end
9555
9556 !! test
9557 Section extraction prefixed by comment (section 2)
9558 !! options
9559 section=2
9560 !! input
9561 <!-- -->==sec1==
9562 ==sec2==
9563 !!result
9564
9565 !!end
9566
9567
9568 # Formerly testing for bug 2607, now resolved by the use of unmarked sections
9569 # instead of respecting HTML-style headings
9570 !! test
9571 Section extraction, mixed wiki and html (section 1)
9572 !! options
9573 section=1
9574 !! input
9575 <h2>unmarked</h2>
9576 unmarked
9577 ==1==
9578 one
9579 ==2==
9580 two
9581 !! result
9582 ==1==
9583 one
9584 !! end
9585
9586 !! test
9587 Section extraction, mixed wiki and html (section 2)
9588 !! options
9589 section=2
9590 !! input
9591 <h2>unmarked</h2>
9592 unmarked
9593 ==1==
9594 one
9595 ==2==
9596 two
9597 !! result
9598 ==2==
9599 two
9600 !! end
9601
9602
9603 # Formerly testing for bug 3342
9604 !! test
9605 Section extraction, heading surrounded by <noinclude>
9606 !! options
9607 section=1
9608 !! input
9609 <noinclude>==unmarked==</noinclude>
9610 ==marked==
9611 !! result
9612 ==marked==
9613 !!end
9614
9615 # Test behaviour of bug 19910
9616 !! test
9617 Sectiion with all-equals
9618 !! options
9619 section=2
9620 !! input
9621 ===
9622 The line above must have a trailing space
9623 === <!--
9624 --> <!-- -->
9625 But just in case it doesn't...
9626 !! result
9627 === <!--
9628 --> <!-- -->
9629 But just in case it doesn't...
9630 !! end
9631
9632 !! test
9633 Section replacement test (section 0)
9634 !! options
9635 replace=0,"xxx"
9636 !! input
9637 start
9638 ==a==
9639 ===aa===
9640 ====aaa====
9641 ==b==
9642 ===ba===
9643 ===bb===
9644 ====bba====
9645 ===bc===
9646 ==c==
9647 ===ca===
9648 !! result
9649 xxx
9650
9651 ==a==
9652 ===aa===
9653 ====aaa====
9654 ==b==
9655 ===ba===
9656 ===bb===
9657 ====bba====
9658 ===bc===
9659 ==c==
9660 ===ca===
9661 !! end
9662
9663 !! test
9664 Section replacement test (section 1)
9665 !! options
9666 replace=1,"xxx"
9667 !! input
9668 start
9669 ==a==
9670 ===aa===
9671 ====aaa====
9672 ==b==
9673 ===ba===
9674 ===bb===
9675 ====bba====
9676 ===bc===
9677 ==c==
9678 ===ca===
9679 !! result
9680 start
9681 xxx
9682
9683 ==b==
9684 ===ba===
9685 ===bb===
9686 ====bba====
9687 ===bc===
9688 ==c==
9689 ===ca===
9690 !! end
9691
9692 !! test
9693 Section replacement test (section 2)
9694 !! options
9695 replace=2,"xxx"
9696 !! input
9697 start
9698 ==a==
9699 ===aa===
9700 ====aaa====
9701 ==b==
9702 ===ba===
9703 ===bb===
9704 ====bba====
9705 ===bc===
9706 ==c==
9707 ===ca===
9708 !! result
9709 start
9710 ==a==
9711 xxx
9712
9713 ==b==
9714 ===ba===
9715 ===bb===
9716 ====bba====
9717 ===bc===
9718 ==c==
9719 ===ca===
9720 !! end
9721
9722 !! test
9723 Section replacement test (section 3)
9724 !! options
9725 replace=3,"xxx"
9726 !! input
9727 start
9728 ==a==
9729 ===aa===
9730 ====aaa====
9731 ==b==
9732 ===ba===
9733 ===bb===
9734 ====bba====
9735 ===bc===
9736 ==c==
9737 ===ca===
9738 !! result
9739 start
9740 ==a==
9741 ===aa===
9742 xxx
9743
9744 ==b==
9745 ===ba===
9746 ===bb===
9747 ====bba====
9748 ===bc===
9749 ==c==
9750 ===ca===
9751 !! end
9752
9753 !! test
9754 Section replacement test (section 4)
9755 !! options
9756 replace=4,"xxx"
9757 !! input
9758 start
9759 ==a==
9760 ===aa===
9761 ====aaa====
9762 ==b==
9763 ===ba===
9764 ===bb===
9765 ====bba====
9766 ===bc===
9767 ==c==
9768 ===ca===
9769 !! result
9770 start
9771 ==a==
9772 ===aa===
9773 ====aaa====
9774 xxx
9775
9776 ==c==
9777 ===ca===
9778 !! end
9779
9780 !! test
9781 Section replacement test (section 5)
9782 !! options
9783 replace=5,"xxx"
9784 !! input
9785 start
9786 ==a==
9787 ===aa===
9788 ====aaa====
9789 ==b==
9790 ===ba===
9791 ===bb===
9792 ====bba====
9793 ===bc===
9794 ==c==
9795 ===ca===
9796 !! result
9797 start
9798 ==a==
9799 ===aa===
9800 ====aaa====
9801 ==b==
9802 xxx
9803
9804 ===bb===
9805 ====bba====
9806 ===bc===
9807 ==c==
9808 ===ca===
9809 !! end
9810
9811 !! test
9812 Section replacement test (section 6)
9813 !! options
9814 replace=6,"xxx"
9815 !! input
9816 start
9817 ==a==
9818 ===aa===
9819 ====aaa====
9820 ==b==
9821 ===ba===
9822 ===bb===
9823 ====bba====
9824 ===bc===
9825 ==c==
9826 ===ca===
9827 !! result
9828 start
9829 ==a==
9830 ===aa===
9831 ====aaa====
9832 ==b==
9833 ===ba===
9834 xxx
9835
9836 ===bc===
9837 ==c==
9838 ===ca===
9839 !! end
9840
9841 !! test
9842 Section replacement test (section 7)
9843 !! options
9844 replace=7,"xxx"
9845 !! input
9846 start
9847 ==a==
9848 ===aa===
9849 ====aaa====
9850 ==b==
9851 ===ba===
9852 ===bb===
9853 ====bba====
9854 ===bc===
9855 ==c==
9856 ===ca===
9857 !! result
9858 start
9859 ==a==
9860 ===aa===
9861 ====aaa====
9862 ==b==
9863 ===ba===
9864 ===bb===
9865 xxx
9866
9867 ===bc===
9868 ==c==
9869 ===ca===
9870 !! end
9871
9872 !! test
9873 Section replacement test (section 8)
9874 !! options
9875 replace=8,"xxx"
9876 !! input
9877 start
9878 ==a==
9879 ===aa===
9880 ====aaa====
9881 ==b==
9882 ===ba===
9883 ===bb===
9884 ====bba====
9885 ===bc===
9886 ==c==
9887 ===ca===
9888 !! result
9889 start
9890 ==a==
9891 ===aa===
9892 ====aaa====
9893 ==b==
9894 ===ba===
9895 ===bb===
9896 ====bba====
9897 xxx
9898
9899 ==c==
9900 ===ca===
9901 !!end
9902
9903 !! test
9904 Section replacement test (section 9)
9905 !! options
9906 replace=9,"xxx"
9907 !! input
9908 start
9909 ==a==
9910 ===aa===
9911 ====aaa====
9912 ==b==
9913 ===ba===
9914 ===bb===
9915 ====bba====
9916 ===bc===
9917 ==c==
9918 ===ca===
9919 !! result
9920 start
9921 ==a==
9922 ===aa===
9923 ====aaa====
9924 ==b==
9925 ===ba===
9926 ===bb===
9927 ====bba====
9928 ===bc===
9929 xxx
9930 !! end
9931
9932 !! test
9933 Section replacement test (section 10)
9934 !! options
9935 replace=10,"xxx"
9936 !! input
9937 start
9938 ==a==
9939 ===aa===
9940 ====aaa====
9941 ==b==
9942 ===ba===
9943 ===bb===
9944 ====bba====
9945 ===bc===
9946 ==c==
9947 ===ca===
9948 !! result
9949 start
9950 ==a==
9951 ===aa===
9952 ====aaa====
9953 ==b==
9954 ===ba===
9955 ===bb===
9956 ====bba====
9957 ===bc===
9958 ==c==
9959 xxx
9960 !! end
9961
9962 !! test
9963 Section replacement test with initial whitespace (bug 13728)
9964 !! options
9965 replace=2,"xxx"
9966 !! input
9967 Preformatted initial line
9968 ==a==
9969 ===a===
9970 !! result
9971 Preformatted initial line
9972 ==a==
9973 xxx
9974 !! end
9975
9976
9977 !! test
9978 Section extraction, heading followed by pre with 20 spaces (bug 6398)
9979 !! options
9980 section=1
9981 !! input
9982 ==a==
9983 a
9984 !! result
9985 ==a==
9986 a
9987 !! end
9988
9989 !! test
9990 Section extraction, heading followed by pre with 19 spaces (bug 6398 sanity check)
9991 !! options
9992 section=1
9993 !! input
9994 ==a==
9995 a
9996 !! result
9997 ==a==
9998 a
9999 !! end
10000
10001
10002 !! test
10003 Section extraction, <pre> around bogus header (bug 10309)
10004 !! options
10005 noxml section=2
10006 !! input
10007 == Section One ==
10008 <pre>
10009 =======
10010 </pre>
10011
10012 == Section Two ==
10013 stuff
10014 !! result
10015 == Section Two ==
10016 stuff
10017 !! end
10018
10019 !! test
10020 Section replacement, <pre> around bogus header (bug 10309)
10021 !! options
10022 noxml replace=2,"xxx"
10023 !! input
10024 == Section One ==
10025 <pre>
10026 =======
10027 </pre>
10028
10029 == Section Two ==
10030 stuff
10031 !! result
10032 == Section One ==
10033 <pre>
10034 =======
10035 </pre>
10036
10037 xxx
10038 !! end
10039
10040
10041
10042 !! test
10043 Handling of &#x0A; in URLs
10044 !! input
10045 **irc://&#x0A;a
10046 !! result
10047 <ul><li><ul><li><a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a>
10048 </li></ul>
10049 </li></ul>
10050
10051 !!end
10052
10053 !! test
10054 5 quotes, code coverage +1 line
10055 !! input
10056 '''''
10057 !! result
10058 !! end
10059
10060 !! test
10061 Special:Search page linking.
10062 !! input
10063 {{Special:search}}
10064 !! result
10065 <p><a href="/wiki/Special:Search" title="Special:Search">Special:Search</a>
10066 </p>
10067 !! end
10068
10069 !! test
10070 Say the magic word
10071 !! input
10072 * {{PAGENAME}}
10073 * {{BASEPAGENAME}}
10074 * {{SUBPAGENAME}}
10075 * {{SUBPAGENAMEE}}
10076 * {{BASEPAGENAME}}
10077 * {{BASEPAGENAMEE}}
10078 * {{TALKPAGENAME}}
10079 * {{TALKPAGENAMEE}}
10080 * {{SUBJECTPAGENAME}}
10081 * {{SUBJECTPAGENAMEE}}
10082 * {{NAMESPACEE}}
10083 * {{NAMESPACE}}
10084 * {{TALKSPACE}}
10085 * {{TALKSPACEE}}
10086 * {{SUBJECTSPACE}}
10087 * {{SUBJECTSPACEE}}
10088 * {{Dynamic|{{NUMBEROFUSERS}}|{{NUMBEROFPAGES}}|{{CURRENTVERSION}}|{{CONTENTLANGUAGE}}|{{DIRECTIONMARK}}|{{CURRENTTIMESTAMP}}|{{NUMBEROFARTICLES}}}}
10089 !! result
10090 <ul><li> Parser test
10091 </li><li> Parser test
10092 </li><li> Parser test
10093 </li><li> Parser_test
10094 </li><li> Parser test
10095 </li><li> Parser_test
10096 </li><li> Talk:Parser test
10097 </li><li> Talk:Parser_test
10098 </li><li> Parser test
10099 </li><li> Parser_test
10100 </li><li>
10101 </li><li>
10102 </li><li> Talk
10103 </li><li> Talk
10104 </li><li>
10105 </li><li>
10106 </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>
10107 </li></ul>
10108
10109 !! end
10110 ### Note: Above tests excludes the "{{NUMBEROFADMINS}}" magic word because it generates a MySQL error when included.
10111
10112 !! test
10113 Gallery
10114 !! input
10115 <gallery>
10116 image1.png |
10117 image2.gif|||||
10118
10119 image3|
10120 image4 |300px| centre
10121 image5.svg| http://///////
10122 [[x|xx]]]]
10123 * image6
10124 </gallery>
10125 !! result
10126 <ul class="gallery">
10127 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
10128 <div style="height: 150px;">Image1.png</div>
10129 <div class="gallerytext">
10130 </div>
10131 </div></li>
10132 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
10133 <div style="height: 150px;">Image2.gif</div>
10134 <div class="gallerytext">
10135 <p>||||
10136 </p>
10137 </div>
10138 </div></li>
10139 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
10140 <div style="height: 150px;">Image3</div>
10141 <div class="gallerytext">
10142 </div>
10143 </div></li>
10144 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
10145 <div style="height: 150px;">Image4</div>
10146 <div class="gallerytext">
10147 <p>300px| centre
10148 </p>
10149 </div>
10150 </div></li>
10151 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
10152 <div style="height: 150px;">Image5.svg</div>
10153 <div class="gallerytext">
10154 <p><a rel="nofollow" class="external free" href="http://///////">http://///////</a>
10155 </p>
10156 </div>
10157 </div></li>
10158 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
10159 <div style="height: 150px;">* image6</div>
10160 <div class="gallerytext">
10161 </div>
10162 </div></li>
10163 </ul>
10164
10165 !! end
10166
10167 !! test
10168 Gallery (with options)
10169 !! input
10170 <gallery widths='70px' heights='40px' perrow='2' caption='Foo [[Main Page]]' >
10171 File:Nonexistant.jpg|caption
10172 File:Nonexistant.jpg
10173 image:foobar.jpg|some '''caption''' [[Main Page]]
10174 image:foobar.jpg
10175 image:foobar.jpg|Blabla|alt=This is a foo-bar.|blabla.
10176 </gallery>
10177 !! result
10178 <ul class="gallery" style="max-width: 226px;_width: 226px;">
10179 <li class='gallerycaption'>Foo <a href="/wiki/Main_Page" title="Main Page">Main Page</a></li>
10180 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
10181 <div style="height: 70px;">Nonexistant.jpg</div>
10182 <div class="gallerytext">
10183 <p>caption
10184 </p>
10185 </div>
10186 </div></li>
10187 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
10188 <div style="height: 70px;">Nonexistant.jpg</div>
10189 <div class="gallerytext">
10190 </div>
10191 </div></li>
10192 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
10193 <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>
10194 <div class="gallerytext">
10195 <p>some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
10196 </p>
10197 </div>
10198 </div></li>
10199 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
10200 <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>
10201 <div class="gallerytext">
10202 </div>
10203 </div></li>
10204 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
10205 <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>
10206 <div class="gallerytext">
10207 <p>Blabla|blabla.
10208 </p>
10209 </div>
10210 </div></li>
10211 </ul>
10212
10213 !! end
10214
10215 !! test
10216 Gallery with wikitext inside caption
10217 !! input
10218 <gallery>
10219 File:foobar.jpg|[[File:foobar.jpg|20px|desc|alt=inneralt]]|alt=galleryalt
10220 File:foobar.jpg|{{Test|unamedParam|alt=param}}|alt=galleryalt
10221 </gallery>
10222 !! result
10223 <ul class="gallery">
10224 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
10225 <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>
10226 <div class="gallerytext">
10227 <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>
10228 </p>
10229 </div>
10230 </div></li>
10231 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
10232 <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>
10233 <div class="gallerytext">
10234 <p>This is a test template
10235 </p>
10236 </div>
10237 </div></li>
10238 </ul>
10239
10240 !! end
10241
10242 !! test
10243 gallery (with showfilename option)
10244 !! input
10245 <gallery showfilename>
10246 File:Nonexistant.jpg|caption
10247 File:Nonexistant.jpg
10248 image:foobar.jpg|some '''caption''' [[Main Page]]
10249 File:Foobar.jpg
10250 </gallery>
10251 !! result
10252 <ul class="gallery">
10253 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
10254 <div style="height: 150px;">Nonexistant.jpg</div>
10255 <div class="gallerytext">
10256 <p><a href="/wiki/File:Nonexistant.jpg" title="File:Nonexistant.jpg">Nonexistant.jpg</a><br />
10257 caption
10258 </p>
10259 </div>
10260 </div></li>
10261 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
10262 <div style="height: 150px;">Nonexistant.jpg</div>
10263 <div class="gallerytext">
10264 <p><a href="/wiki/File:Nonexistant.jpg" title="File:Nonexistant.jpg">Nonexistant.jpg</a><br />
10265 </p>
10266 </div>
10267 </div></li>
10268 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
10269 <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>
10270 <div class="gallerytext">
10271 <p><a href="/wiki/File:Foobar.jpg" title="File:Foobar.jpg">Foobar.jpg</a><br />
10272 some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
10273 </p>
10274 </div>
10275 </div></li>
10276 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
10277 <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>
10278 <div class="gallerytext">
10279 <p><a href="/wiki/File:Foobar.jpg" title="File:Foobar.jpg">Foobar.jpg</a><br />
10280 </p>
10281 </div>
10282 </div></li>
10283 </ul>
10284
10285 !! end
10286
10287 !! test
10288 Gallery (with namespace-less filenames)
10289 !! input
10290 <gallery>
10291 File:Nonexistant.jpg
10292 Nonexistant.jpg
10293 image:foobar.jpg
10294 foobar.jpg
10295 </gallery>
10296 !! result
10297 <ul class="gallery">
10298 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
10299 <div style="height: 150px;">Nonexistant.jpg</div>
10300 <div class="gallerytext">
10301 </div>
10302 </div></li>
10303 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
10304 <div style="height: 150px;">Nonexistant.jpg</div>
10305 <div class="gallerytext">
10306 </div>
10307 </div></li>
10308 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
10309 <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>
10310 <div class="gallerytext">
10311 </div>
10312 </div></li>
10313 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
10314 <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>
10315 <div class="gallerytext">
10316 </div>
10317 </div></li>
10318 </ul>
10319
10320 !! end
10321
10322 !! test
10323 HTML Hex character encoding (spells the word "JavaScript")
10324 !! input
10325 &#x4A;&#x061;&#x0076;&#x00061;&#x000053;&#x0000063;&#114;&#x0000069;&#00000112;&#x0000000074;
10326 !! result
10327 <p>&#x4a;&#x61;&#x76;&#x61;&#x53;&#x63;&#114;&#x69;&#112;&#x74;
10328 </p>
10329 !! end
10330
10331 !! test
10332 HTML Hex character encoding bogus encoding (bug 26437 regression check)
10333 !! input
10334 &#xsee;&#XSEE;
10335 !! result
10336 <p>&amp;#xsee;&amp;#XSEE;
10337 </p>
10338 !! end
10339
10340 !! test
10341 HTML Hex character encoding mixed case
10342 !! input
10343 &#xEE;&#Xee;
10344 !! result
10345 <p>&#xee;&#xee;
10346 </p>
10347 !! end
10348
10349 !! test
10350 __FORCETOC__ override
10351 !! input
10352 __NEWSECTIONLINK__
10353 __FORCETOC__
10354 !! result
10355 <p><br />
10356 </p>
10357 !! end
10358
10359 !! test
10360 ISBN code coverage
10361 !! input
10362 ISBN 978-0-1234-56&#x20;789
10363 !! result
10364 <p><a href="/wiki/Special:BookSources/9780123456" class="internal mw-magiclink-isbn">ISBN 978-0-1234-56</a>&#x20;789
10365 </p>
10366 !! end
10367
10368 !! test
10369 ISBN followed by 5 spaces
10370 !! input
10371 ISBN
10372 !! result
10373 <p>ISBN
10374 </p>
10375 !! end
10376
10377 !! test
10378 Double ISBN
10379 !! input
10380 ISBN ISBN 1234567890
10381 !! result
10382 <p>ISBN <a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
10383 </p>
10384 !! end
10385
10386 !! test
10387 Bug 22905: <abbr> followed by ISBN followed by </a>
10388 !! input
10389 <abbr>(fr)</abbr> ISBN 2753300917 [http://www.example.com example.com]
10390 !! result
10391 <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>
10392 </p>
10393 !! end
10394
10395 !! test
10396 Double RFC
10397 !! input
10398 RFC RFC 1234
10399 !! result
10400 <p>RFC <a class="external mw-magiclink-rfc" href="//tools.ietf.org/html/rfc1234">RFC 1234</a>
10401 </p>
10402 !! end
10403
10404 !! test
10405 Double RFC with a wiki link
10406 !! input
10407 RFC [[RFC 1234]]
10408 !! result
10409 <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>
10410 </p>
10411 !! end
10412
10413 !! test
10414 RFC code coverage
10415 !! input
10416 RFC 983&#x20;987
10417 !! result
10418 <p><a class="external mw-magiclink-rfc" href="//tools.ietf.org/html/rfc983">RFC 983</a>&#x20;987
10419 </p>
10420 !! end
10421
10422 !! test
10423 Centre-aligned image
10424 !! input
10425 [[Image:foobar.jpg|centre]]
10426 !! result
10427 <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>
10428
10429 !!end
10430
10431 !! test
10432 None-aligned image
10433 !! input
10434 [[Image:foobar.jpg|none]]
10435 !! result
10436 <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>
10437
10438 !!end
10439
10440 !! test
10441 Width + Height sized image (using px) (height is ignored)
10442 !! input
10443 [[Image:foobar.jpg|640x480px]]
10444 !! result
10445 <p><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/640px-Foobar.jpg" width="640" height="73" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/960px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/1280px-Foobar.jpg 2x" /></a>
10446 </p>
10447 !!end
10448
10449 !! test
10450 Width-sized image (using px, no following whitespace)
10451 !! input
10452 [[Image:foobar.jpg|640px]]
10453 !! result
10454 <p><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/640px-Foobar.jpg" width="640" height="73" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/960px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/1280px-Foobar.jpg 2x" /></a>
10455 </p>
10456 !!end
10457
10458 !! test
10459 Width-sized image (using px, with following whitespace - test regression from r39467)
10460 !! input
10461 [[Image:foobar.jpg|640px ]]
10462 !! result
10463 <p><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/640px-Foobar.jpg" width="640" height="73" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/960px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/1280px-Foobar.jpg 2x" /></a>
10464 </p>
10465 !!end
10466
10467 !! test
10468 Width-sized image (using px, with preceding whitespace - test regression from r39467)
10469 !! input
10470 [[Image:foobar.jpg| 640px]]
10471 !! result
10472 <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>
10473 </p>
10474 !!end
10475
10476 !! test
10477 Another italics / bold test
10478 !! input
10479 ''' ''x'
10480 !! result
10481 <pre>'<i> </i>x'
10482 </pre>
10483 !!end
10484
10485 # Note the results may be incorrect, as parserTest output included this:
10486 # XML error: Mismatched tag at byte 6120:
10487 # ...<dd> </dt></dl> </dd...
10488 !! test
10489 dt/dd/dl test
10490 !! options
10491 disabled
10492 !! input
10493 :;;;::
10494 !! result
10495 <dl><dd><dl><dt><dl><dt><dl><dt><dl><dd><dl><dd>
10496 </dd></dl>
10497 </dd></dl>
10498 </dt></dl>
10499 </dt></dl>
10500 </dt></dl>
10501 </dd></dl>
10502
10503 !!end
10504
10505
10506 # Images with the "|" character in external URLs in comment tags; Eats half the comment, leaves unmatched "</a>" tag.
10507 !! test
10508 Images with the "|" character in the comment
10509 !! input
10510 [[image:Foobar.jpg|thumb|An [http://test/?param1=|left|&param2=|x external] URL]]
10511 !! result
10512 <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>
10513
10514 !!end
10515
10516 !! test
10517 [Before] HTML without raw HTML enabled ($wgRawHtml==false)
10518 !! input
10519 <html><script>alert(1);</script></html>
10520 !! result
10521 <p>&lt;html&gt;&lt;script&gt;alert(1);&lt;/script&gt;&lt;/html&gt;
10522 </p>
10523 !! end
10524
10525 !! test
10526 HTML with raw HTML ($wgRawHtml==true)
10527 !! options
10528 rawhtml
10529 !! input
10530 <html><script>alert(1);</script></html>
10531 !! result
10532 <p><script>alert(1);</script>
10533 </p>
10534 !! end
10535
10536 !! test
10537 Parents of subpages, one level up
10538 !! options
10539 subpage title=[[Subpage test/L1/L2/L3]]
10540 !! input
10541 [[../|L2]]
10542 !! result
10543 <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>
10544 </p>
10545 !! end
10546
10547
10548 !! test
10549 Parents of subpages, one level up, not named
10550 !! options
10551 subpage title=[[Subpage test/L1/L2/L3]]
10552 !! input
10553 [[../]]
10554 !! result
10555 <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>
10556 </p>
10557 !! end
10558
10559
10560
10561 !! test
10562 Parents of subpages, two levels up
10563 !! options
10564 subpage title=[[Subpage test/L1/L2/L3]]
10565 !! input
10566 [[../../|L1]]2
10567
10568 [[../../|L1]]l
10569 !! result
10570 <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
10571 </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>
10572 </p>
10573 !! end
10574
10575 !! test
10576 Parents of subpages, two levels up, without trailing slash or name.
10577 !! options
10578 subpage title=[[Subpage test/L1/L2/L3]]
10579 !! input
10580 [[../..]]
10581 !! result
10582 <p>[[../..]]
10583 </p>
10584 !! end
10585
10586 !! test
10587 Parents of subpages, two levels up, with lots of extra trailing slashes.
10588 !! options
10589 subpage title=[[Subpage test/L1/L2/L3]]
10590 !! input
10591 [[../../////]]
10592 !! result
10593 <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>
10594 </p>
10595 !! end
10596
10597 !! test
10598 Definition list code coverage
10599 !! input
10600 ; title : def
10601 ; title : def
10602 ;title: def
10603 !! result
10604 <dl><dt> title &#160;</dt><dd> def
10605 </dd><dt> title&#160;</dt><dd> def
10606 </dd><dt>title</dt><dd> def
10607 </dd></dl>
10608
10609 !! end
10610
10611 !! test
10612 Don't fall for the self-closing div
10613 !! input
10614 <div>hello world</div/>
10615 !! result
10616 <div>hello world</div>
10617
10618 !! end
10619
10620 !! test
10621 MSGNW magic word
10622 !! input
10623 {{MSGNW:msg}}
10624 !! result
10625 <p>&#91;&#91;:Template:Msg&#93;&#93;
10626 </p>
10627 !! end
10628
10629 !! test
10630 RAW magic word
10631 !! input
10632 {{RAW:QUERTY}}
10633 !! result
10634 <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>
10635 </p>
10636 !! end
10637
10638 # This isn't needed for XHTML conformance, but would be handy as a fallback security measure
10639 !! test
10640 Always escape literal '>' in output, not just after '<'
10641 !! input
10642 ><>
10643 !! result
10644 <p>&gt;&lt;&gt;
10645 </p>
10646 !! end
10647
10648 !! test
10649 Template caching
10650 !! input
10651 {{Test}}
10652 {{Test}}
10653 !! result
10654 <p>This is a test template
10655 This is a test template
10656 </p>
10657 !! end
10658
10659
10660 !! article
10661 MediaWiki:Fake
10662 !! text
10663 ==header==
10664 !! endarticle
10665
10666 !! test
10667 Inclusion of !userCanEdit() content
10668 !! input
10669 {{MediaWiki:Fake}}
10670 !! result
10671 <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>
10672
10673 !! end
10674
10675
10676 !! test
10677 Out-of-order TOC heading levels
10678 !! input
10679 ==2==
10680 ======6======
10681 ===3===
10682 =1=
10683 =====5=====
10684 ==2==
10685 !! result
10686 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
10687 <ul>
10688 <li class="toclevel-1 tocsection-1"><a href="#2"><span class="tocnumber">1</span> <span class="toctext">2</span></a>
10689 <ul>
10690 <li class="toclevel-2 tocsection-2"><a href="#6"><span class="tocnumber">1.1</span> <span class="toctext">6</span></a></li>
10691 <li class="toclevel-2 tocsection-3"><a href="#3"><span class="tocnumber">1.2</span> <span class="toctext">3</span></a></li>
10692 </ul>
10693 </li>
10694 <li class="toclevel-1 tocsection-4"><a href="#1"><span class="tocnumber">2</span> <span class="toctext">1</span></a>
10695 <ul>
10696 <li class="toclevel-2 tocsection-5"><a href="#5"><span class="tocnumber">2.1</span> <span class="toctext">5</span></a></li>
10697 <li class="toclevel-2 tocsection-6"><a href="#2_2"><span class="tocnumber">2.2</span> <span class="toctext">2</span></a></li>
10698 </ul>
10699 </li>
10700 </ul>
10701 </td></tr></table>
10702 <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>
10703 <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>
10704 <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>
10705 <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>
10706 <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>
10707 <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>
10708
10709 !! end
10710
10711
10712 !! test
10713 ISBN with a dummy number
10714 !! input
10715 ISBN ---
10716 !! result
10717 <p>ISBN ---
10718 </p>
10719 !! end
10720
10721
10722 !! test
10723 ISBN with space-delimited number
10724 !! input
10725 ISBN 92 9017 032 8
10726 !! result
10727 <p><a href="/wiki/Special:BookSources/9290170328" class="internal mw-magiclink-isbn">ISBN 92 9017 032 8</a>
10728 </p>
10729 !! end
10730
10731
10732 !! test
10733 ISBN with multiple spaces, no number
10734 !! input
10735 ISBN foo
10736 !! result
10737 <p>ISBN foo
10738 </p>
10739 !! end
10740
10741
10742 !! test
10743 ISBN length
10744 !! input
10745 ISBN 123456789
10746
10747 ISBN 1234567890
10748
10749 ISBN 12345678901
10750 !! result
10751 <p>ISBN 123456789
10752 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
10753 </p><p>ISBN 12345678901
10754 </p>
10755 !! end
10756
10757
10758 !! test
10759 ISBN with trailing year (bug 8110)
10760 !! input
10761 ISBN 1-234-56789-0 - 2006
10762
10763 ISBN 1 234 56789 0 - 2006
10764 !! result
10765 <p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1-234-56789-0</a> - 2006
10766 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1 234 56789 0</a> - 2006
10767 </p>
10768 !! end
10769
10770
10771 !! test
10772 anchorencode
10773 !! input
10774 {{anchorencode:foo bar©#%n}}
10775 !! result
10776 <p>foo_bar.C2.A9.23.25n
10777 </p>
10778 !! end
10779
10780 !! test
10781 anchorencode trims spaces
10782 !! input
10783 {{anchorencode: __pretty__please__}}
10784 !! result
10785 <p>pretty_please
10786 </p>
10787 !! end
10788
10789 !! test
10790 anchorencode deals with links
10791 !! input
10792 {{anchorencode: [[hello|world]] [[hi]]}}
10793 !! result
10794 <p>world_hi
10795 </p>
10796 !! end
10797
10798 !! test
10799 anchorencode deals with templates
10800 !! input
10801 {{anchorencode: {{Foo}} }}
10802 !! result
10803 <p>FOO
10804 </p>
10805 !! end
10806
10807 !! test
10808 anchorencode encodes like the TOC generator: (bug 18431)
10809 !! input
10810 === _ +:.3A%3A&&amp;]] ===
10811 {{anchorencode: _ +:.3A%3A&&amp;]] }}
10812 __NOEDITSECTION__
10813 !! result
10814 <h3> <span class="mw-headline" id=".2B:.3A.253A.26.26.5D.5D"> _ +:.3A%3A&amp;&amp;]] </span></h3>
10815 <p>.2B:.3A.253A.26.26.5D.5D
10816 </p>
10817 !! end
10818
10819 # Expected output in the following test is not necessarily expected (there
10820 # should probably be <p> tags inside the <blockquote> in the output) -- it's
10821 # only testing for well-formedness.
10822 !! test
10823 Bug 6200: blockquotes and paragraph formatting
10824 !! input
10825 <blockquote>
10826 foo
10827 </blockquote>
10828
10829 bar
10830
10831 baz
10832 !! result
10833 <blockquote>
10834 foo
10835 </blockquote>
10836 <p>bar
10837 </p>
10838 <pre>baz
10839 </pre>
10840 !! end
10841
10842 !! test
10843 Bug 8293: Use of center tag ruins paragraph formatting
10844 !! input
10845 <center>
10846 foo
10847 </center>
10848
10849 bar
10850
10851 baz
10852 !! result
10853 <center>
10854 <p>foo
10855 </p>
10856 </center>
10857 <p>bar
10858 </p>
10859 <pre>baz
10860 </pre>
10861 !! end
10862
10863
10864 ###
10865 ### Language variants related tests
10866 ###
10867 !! test
10868 Self-link in language variants
10869 !! options
10870 title=[[Dunav]] language=sr
10871 !! input
10872 Both [[Dunav]] and [[Дунав]] are names for this river.
10873 !! result
10874 <p>Both <strong class="selflink">Dunav</strong> and <strong class="selflink">Дунав</strong> are names for this river.
10875 </p>
10876 !!end
10877
10878
10879 !! test
10880 Link to pages in language variants
10881 !! options
10882 language=sr
10883 !! input
10884 Main Page can be written as [[Маин Паге]]
10885 !! result
10886 <p>Main Page can be written as <a href="/wiki/Main_Page" title="Main Page">Маин Паге</a>
10887 </p>
10888 !!end
10889
10890
10891 !! test
10892 Multiple links to pages in language variants
10893 !! options
10894 language=sr
10895 !! input
10896 [[Main Page]] can be written as [[Маин Паге]] same as [[Маин Паге]].
10897 !! result
10898 <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>.
10899 </p>
10900 !!end
10901
10902
10903 !! test
10904 Simple template in language variants
10905 !! options
10906 language=sr
10907 !! input
10908 {{тест}}
10909 !! result
10910 <p>This is a test template
10911 </p>
10912 !! end
10913
10914
10915 !! test
10916 Template with explicit namespace in language variants
10917 !! options
10918 language=sr
10919 !! input
10920 {{Template:тест}}
10921 !! result
10922 <p>This is a test template
10923 </p>
10924 !! end
10925
10926
10927 !! test
10928 Basic test for template parameter in language variants
10929 !! options
10930 language=sr
10931 !! input
10932 {{парамтест|param=foo}}
10933 !! result
10934 <p>This is a test template with parameter foo
10935 </p>
10936 !! end
10937
10938
10939 !! test
10940 Simple category in language variants
10941 !! options
10942 language=sr cat
10943 !! input
10944 [[Category:МедиаWики Усер'с Гуиде]]
10945 !! result
10946 <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>
10947 !! end
10948
10949
10950 !! article
10951 Category:分类
10952 !! text
10953 blah
10954 !! endarticle
10955
10956 !! article
10957 Category:分類
10958 !! text
10959 blah
10960 !! endarticle
10961
10962 !! test
10963 Don't convert blue categorylinks to another variant (bug 33210)
10964 !! options
10965 language=zh cat
10966 !! input
10967 [[A]][[Category:分类]]
10968 !! result
10969 <a href="/wiki/Category:%E5%88%86%E7%B1%BB" title="Category:分类">分类</a>
10970 !! end
10971
10972
10973 !! test
10974 Stripping -{}- tags (language variants)
10975 !! options
10976 language=sr
10977 !! input
10978 Latin proverb: -{Ne nuntium necare}-
10979 !! result
10980 <p>Latin proverb: Ne nuntium necare
10981 </p>
10982 !! end
10983
10984
10985 !! test
10986 Prevent conversion with -{}- tags (language variants)
10987 !! options
10988 language=sr variant=sr-ec
10989 !! input
10990 Latinski: -{Ne nuntium necare}-
10991 !! result
10992 <p>Латински: Ne nuntium necare
10993 </p>
10994 !! end
10995
10996
10997 !! test
10998 Prevent conversion of text with -{}- tags (language variants)
10999 !! options
11000 language=sr variant=sr-ec
11001 !! input
11002 Latinski: -{Ne nuntium necare}-
11003 !! result
11004 <p>Латински: Ne nuntium necare
11005 </p>
11006 !! end
11007
11008
11009 !! test
11010 Prevent conversion of links with -{}- tags (language variants)
11011 !! options
11012 language=sr variant=sr-ec
11013 !! input
11014 -{[[Main Page]]}-
11015 !! result
11016 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
11017 </p>
11018 !! end
11019
11020
11021 !! test
11022 -{}- tags within headlines (within html for parserConvert())
11023 !! options
11024 language=sr variant=sr-ec
11025 !! input
11026 == -{Naslov}- ==
11027 !! result
11028 <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>
11029
11030 !! end
11031
11032
11033 !! test
11034 Explicit definition of language variant alternatives
11035 !! options
11036 language=zh variant=zh-tw
11037 !! input
11038 -{zh:China;zh-tw:Taiwan}-, not China
11039 !! result
11040 <p>Taiwan, not China
11041 </p>
11042 !! end
11043
11044
11045 !! test
11046 Conversion around HTML tags
11047 !! options
11048 language=sr variant=sr-ec
11049 !! input
11050 -{H|span=>sr-ec:script;title=>sr-ec:src;}-
11051 <span title="La-{sr-el:L;sr-ec:C;}-tin">ski</span>
11052 !! result
11053 <p>
11054 <span title="ЛаCтин">ски</span>
11055 </p>
11056 !! end
11057
11058
11059 !! test
11060 Explicit session-wise language variant mapping (A flag and - flag)
11061 !! options
11062 language=zh variant=zh-tw
11063 !! input
11064 Taiwan is not China.
11065 But -{A|zh:China;zh-tw:Taiwan}- is China,
11066 (This-{-|zh:China;zh-tw:Taiwan}- should be stripped!)
11067 and -{China}- is China.
11068 !! result
11069 <p>Taiwan is not China.
11070 But Taiwan is Taiwan,
11071 (This should be stripped!)
11072 and China is China.
11073 </p>
11074 !! end
11075
11076 !! test
11077 Explicit session-wise language variant mapping (H flag for hide)
11078 !! options
11079 language=zh variant=zh-tw
11080 !! input
11081 (This-{H|zh:China;zh-tw:Taiwan}- should be stripped!)
11082 Taiwan is China.
11083 !! result
11084 <p>(This should be stripped!)
11085 Taiwan is Taiwan.
11086 </p>
11087 !! end
11088
11089 !! test
11090 Adding explicit conversion rule for title (T flag)
11091 !! options
11092 language=zh variant=zh-tw showtitle
11093 !! input
11094 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
11095 !! result
11096 Taiwan
11097 <p>Should be stripped!
11098 </p>
11099 !! end
11100
11101 !! test
11102 Testing that changing the language variant here in the tests actually works
11103 !! options
11104 language=zh variant=zh showtitle
11105 !! input
11106 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
11107 !! result
11108 China
11109 <p>Should be stripped!
11110 </p>
11111 !! end
11112
11113 !! test
11114 Recursive conversion of alt and title attrs shouldn't clear converter state
11115 !! options
11116 language=zh variant=zh-cn showtitle
11117 !! input
11118 -{H|zh-cn:Exclamation;zh-tw:exclamation;}-
11119 Should be stripped-{T|zh-cn:China;zh-tw:Taiwan}-<span title="exclamation">!</span>
11120 !! result
11121 China
11122 <p>
11123 Should be stripped<span title="Exclamation">!</span>
11124 </p>
11125 !! end
11126
11127 !! test
11128 Bug 24072: more test on conversion rule for title
11129 !! options
11130 language=zh variant=zh-tw showtitle
11131 !! input
11132 This should be stripped-{T|zh:China;zh-tw:Taiwan}-!
11133 This won't take interferes with the title rule-{H|zh:Beijing;zh-tw:Taipei}-.
11134 !! result
11135 Taiwan
11136 <p>This should be stripped!
11137 This won't take interferes with the title rule.
11138 </p>
11139 !! end
11140
11141 !! test
11142 Raw output of variant escape tags (R flag)
11143 !! options
11144 language=zh variant=zh-tw
11145 !! input
11146 Raw: -{R|zh:China;zh-tw:Taiwan}-
11147 !! result
11148 <p>Raw: zh:China;zh-tw:Taiwan
11149 </p>
11150 !! end
11151
11152 !! test
11153 Nested using of manual convert syntax
11154 !! options
11155 language=zh variant=zh-hk
11156 !! input
11157 Nested: -{zh-hans:Hi -{zh-cn:China;zh-sg:Singapore;}-;zh-hant:Hello -{zh-tw:Taiwan;zh-hk:H-{ong}- K-{}-ong;}-;}-!
11158 !! result
11159 <p>Nested: Hello Hong Kong!
11160 </p>
11161 !! end
11162
11163 !! test
11164 Proper conversion of text in external links
11165 !! options
11166 language=sr variant=sr-ec
11167 !! input
11168 http://www.google.com
11169 gopher://www.google.com
11170 [http://www.google.com http://www.google.com]
11171 [gopher://www.google.com gopher://www.google.com]
11172 [https://www.google.com irc://www.google.com]
11173 [ftp://www.google.com www.google.com/ftp://dir]
11174 [//www.google.com www.google.com]
11175 !! result
11176 <p><a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
11177 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
11178 <a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
11179 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
11180 <a rel="nofollow" class="external text" href="https://www.google.com">irc://www.google.com</a>
11181 <a rel="nofollow" class="external text" href="ftp://www.google.com">www.гоогле.цом/фтп://дир</a>
11182 <a rel="nofollow" class="external text" href="//www.google.com">www.гоогле.цом</a>
11183 </p>
11184 !! end
11185
11186 !! test
11187 Do not convert roman numbers to language variants
11188 !! options
11189 language=sr variant=sr-ec
11190 !! input
11191 Fridrih IV je car.
11192 !! result
11193 <p>Фридрих IV је цар.
11194 </p>
11195 !! end
11196
11197 !! test
11198 Unclosed language converter markup "-{"
11199 !! options
11200 language=sr
11201 !! input
11202 -{T|hello
11203 !! result
11204 <p>-{T|hello
11205 </p>
11206 !! end
11207
11208 !! test
11209 Don't convert raw rule "-{R|=&gt;}-" to "=>"
11210 !! options
11211 language=sr
11212 !! input
11213 -{R|=&gt;}-
11214 !! result
11215 <p>=&gt;
11216 </p>
11217 !!end
11218
11219 !!article
11220 Template:Bullet
11221 !!text
11222 * Bar
11223 !!endarticle
11224
11225 !! test
11226 Bug 529: Uncovered bullet
11227 !! input
11228 * Foo {{bullet}}
11229 !! result
11230 <ul><li> Foo
11231 </li><li> Bar
11232 </li></ul>
11233
11234 !! end
11235
11236 # Plain MediaWiki does not remove empty lists, but tidy actually does.
11237 # Templates in Wikipedia rely on this behavior, as tidy has always been
11238 # enabled there. These tests are normally run *without* tidy, so specify the
11239 # full output here.
11240 # To test realistic parsing behavior, apply a tidy-like transformation to both
11241 # the expected output and your parser's output.
11242 !! test
11243 Bug 529: Uncovered bullet leaving empty list, normally removed by tidy
11244 !! input
11245 ******* Foo {{bullet}}
11246 !! result
11247 <ul><li><ul><li><ul><li><ul><li><ul><li><ul><li><ul><li> Foo
11248 </li></ul>
11249 </li></ul>
11250 </li></ul>
11251 </li></ul>
11252 </li></ul>
11253 </li></ul>
11254 </li><li> Bar
11255 </li></ul>
11256
11257 !! end
11258
11259 !! test
11260 Bug 529: Uncovered table already at line-start
11261 !! input
11262 x
11263
11264 {{table}}
11265 y
11266 !! result
11267 <p>x
11268 </p>
11269 <table>
11270 <tr>
11271 <td> 1 </td>
11272 <td> 2
11273 </td></tr>
11274 <tr>
11275 <td> 3 </td>
11276 <td> 4
11277 </td></tr></table>
11278 <p>y
11279 </p>
11280 !! end
11281
11282 !! test
11283 Bug 529: Uncovered bullet in parser function result
11284 !! input
11285 * Foo {{lc:{{bullet}} }}
11286 !! result
11287 <ul><li> Foo
11288 </li><li> bar
11289 </li></ul>
11290
11291 !! end
11292
11293 !! test
11294 Bug 5678: Double-parsed template argument
11295 !! input
11296 {{lc:{{{1}}}|hello}}
11297 !! result
11298 <p>{{{1}}}
11299 </p>
11300 !! end
11301
11302 !! test
11303 Bug 5678: Double-parsed template invocation
11304 !! input
11305 {{lc:{{paramtest {{!}} param = hello }} }}
11306 !! result
11307 <p>{{paramtest | param = hello }}
11308 </p>
11309 !! end
11310
11311 !! test
11312 Case insensitivity of parser functions for non-ASCII characters (bug 8143)
11313 !! options
11314 language=cs
11315 title=[[Main Page]]
11316 !! input
11317 {{PRVNÍVELKÉ:ěščř}}
11318 {{prvnívelké:ěščř}}
11319 {{PRVNÍMALÉ:ěščř}}
11320 {{prvnímalé:ěščř}}
11321 {{MALÁ:ěščř}}
11322 {{malá:ěščř}}
11323 {{VELKÁ:ěščř}}
11324 {{velká:ěščř}}
11325 !! result
11326 <p>Ěščř
11327 Ěščř
11328 ěščř
11329 ěščř
11330 ěščř
11331 ěščř
11332 ĚŠČŘ
11333 ĚŠČŘ
11334 </p>
11335 !! end
11336
11337 !! test
11338 Morwen/13: Unclosed link followed by heading
11339 !! input
11340 [[link
11341 ==heading==
11342 !! result
11343 <p>[[link
11344 </p>
11345 <h2><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: heading">edit</a>]</span> <span class="mw-headline" id="heading">heading</span></h2>
11346
11347 !! end
11348
11349 !! test
11350 HHP2.1: Heuristics for headings in preprocessor parenthetical structures
11351 !! input
11352 {{foo|
11353 =heading=
11354 !! result
11355 <p>{{foo|
11356 </p>
11357 <h1> <span class="mw-headline" id="heading">heading</span></h1>
11358
11359 !! end
11360
11361 !! test
11362 HHP2.2: Heuristics for headings in preprocessor parenthetical structures
11363 !! input
11364 {{foo|
11365 ==heading==
11366 !! result
11367 <p>{{foo|
11368 </p>
11369 <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>
11370
11371 !! end
11372
11373 !! test
11374 Tildes in comments
11375 !! options
11376 pst
11377 !! input
11378 <!-- ~~~~ -->
11379 !! result
11380 <!-- ~~~~ -->
11381 !! end
11382
11383 !! test
11384 Paragraphs inside divs (no extra line breaks)
11385 !! input
11386 <div>Line one
11387
11388 Line two</div>
11389 !! result
11390 <div>Line one
11391 Line two</div>
11392
11393 !! end
11394
11395 !! test
11396 Paragraphs inside divs (extra line break on open)
11397 !! input
11398 <div>
11399 Line one
11400
11401 Line two</div>
11402 !! result
11403 <div>
11404 <p>Line one
11405 </p>
11406 Line two</div>
11407
11408 !! end
11409
11410 !! test
11411 Paragraphs inside divs (extra line break on close)
11412 !! input
11413 <div>Line one
11414
11415 Line two
11416 </div>
11417 !! result
11418 <div>Line one
11419 <p>Line two
11420 </p>
11421 </div>
11422
11423 !! end
11424
11425 !! test
11426 Paragraphs inside divs (extra line break on open and close)
11427 !! input
11428 <div>
11429 Line one
11430
11431 Line two
11432 </div>
11433 !! result
11434 <div>
11435 <p>Line one
11436 </p><p>Line two
11437 </p>
11438 </div>
11439
11440 !! end
11441
11442 !! test
11443 Nesting tags, paragraphs on lines which begin with <div>
11444 !! options
11445 disabled
11446 !! input
11447 <div></div><strong>A
11448 B</strong>
11449 !! result
11450 <div></div>
11451 <p><strong>A
11452 B</strong>
11453 </p>
11454 !! end
11455
11456 # Bug 6200: <blockquote> should behave like <div> with respect to line breaks
11457 !! test
11458 Bug 6200: paragraphs inside blockquotes (no extra line breaks)
11459 !! options
11460 disabled
11461 !! input
11462 <blockquote>Line one
11463
11464 Line two</blockquote>
11465 !! result
11466 <blockquote>Line one
11467 Line two</blockquote>
11468
11469 !! end
11470
11471 !! test
11472 Bug 6200: paragraphs inside blockquotes (extra line break on open)
11473 !! options
11474 disabled
11475 !! input
11476 <blockquote>
11477 Line one
11478
11479 Line two</blockquote>
11480 !! result
11481 <blockquote>
11482 <p>Line one
11483 </p>
11484 Line two</blockquote>
11485
11486 !! end
11487
11488 !! test
11489 Bug 6200: paragraphs inside blockquotes (extra line break on close)
11490 !! options
11491 disabled
11492 !! input
11493 <blockquote>Line one
11494
11495 Line two
11496 </blockquote>
11497 !! result
11498 <blockquote>Line one
11499 <p>Line two
11500 </p>
11501 </blockquote>
11502
11503 !! end
11504
11505 !! test
11506 Bug 6200: paragraphs inside blockquotes (extra line break on open and close)
11507 !! options
11508 disabled
11509 !! input
11510 <blockquote>
11511 Line one
11512
11513 Line two
11514 </blockquote>
11515 !! result
11516 <blockquote>
11517 <p>Line one
11518 </p><p>Line two
11519 </p>
11520 </blockquote>
11521
11522 !! end
11523
11524 !! test
11525 Paragraphs inside blockquotes/divs (no extra line breaks)
11526 !! input
11527 <blockquote><div>Line one
11528
11529 Line two</div></blockquote>
11530 !! result
11531 <blockquote><div>Line one
11532 Line two</div></blockquote>
11533
11534 !! end
11535
11536 !! test
11537 Paragraphs inside blockquotes/divs (extra line break on open)
11538 !! input
11539 <blockquote><div>
11540 Line one
11541
11542 Line two</div></blockquote>
11543 !! result
11544 <blockquote><div>
11545 <p>Line one
11546 </p>
11547 Line two</div></blockquote>
11548
11549 !! end
11550
11551 !! test
11552 Paragraphs inside blockquotes/divs (extra line break on close)
11553 !! input
11554 <blockquote><div>Line one
11555
11556 Line two
11557 </div></blockquote>
11558 !! result
11559 <blockquote><div>Line one
11560 <p>Line two
11561 </p>
11562 </div></blockquote>
11563
11564 !! end
11565
11566 !! test
11567 Paragraphs inside blockquotes/divs (extra line break on open and close)
11568 !! input
11569 <blockquote><div>
11570 Line one
11571
11572 Line two
11573 </div></blockquote>
11574 !! result
11575 <blockquote><div>
11576 <p>Line one
11577 </p><p>Line two
11578 </p>
11579 </div></blockquote>
11580
11581 !! end
11582
11583 !! test
11584 Interwiki links trounced by replaceExternalLinks after early LinkHolderArray expansion
11585 !! options
11586 wgLinkHolderBatchSize=0
11587 !! input
11588 [[meatball:1]]
11589 [[meatball:2]]
11590 [[meatball:3]]
11591 !! result
11592 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?1" class="extiw" title="meatball:1">meatball:1</a>
11593 <a href="http://www.usemod.com/cgi-bin/mb.pl?2" class="extiw" title="meatball:2">meatball:2</a>
11594 <a href="http://www.usemod.com/cgi-bin/mb.pl?3" class="extiw" title="meatball:3">meatball:3</a>
11595 </p>
11596 !! end
11597
11598 !! test
11599 Free external link invading image caption
11600 !! input
11601 [[Image:Foobar.jpg|thumb|http://x|hello]]
11602 !! result
11603 <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>
11604
11605 !! end
11606
11607 !! test
11608 Bug 15196: localised external link numbers
11609 !! options
11610 language=fa
11611 !! input
11612 [http://en.wikipedia.org/]
11613 !! result
11614 <p><a rel="nofollow" class="external autonumber" href="http://en.wikipedia.org/">[۱]</a>
11615 </p>
11616 !! end
11617
11618 !! test
11619 Multibyte character in padleft
11620 !! input
11621 {{padleft:-Hello|7|Æ}}
11622 !! result
11623 <p>Æ-Hello
11624 </p>
11625 !! end
11626
11627 !! test
11628 Multibyte character in padright
11629 !! input
11630 {{padright:Hello-|7|Æ}}
11631 !! result
11632 <p>Hello-Æ
11633 </p>
11634 !! end
11635
11636 !! test
11637 Formatted date
11638 !! config
11639 wgUseDynamicDates=1
11640 !! input
11641 [[2009-03-24]]
11642 !! result
11643 <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>
11644 </p>
11645 !!end
11646
11647 !!test
11648 formatdate parser function
11649 !!input
11650 {{#formatdate:2009-03-24}}
11651 !! result
11652 <p><span class="mw-formatted-date" title="2009-03-24">2009-03-24</span>
11653 </p>
11654 !! end
11655
11656 !!test
11657 formatdate parser function, with default format
11658 !!input
11659 {{#formatdate:2009-03-24|mdy}}
11660 !! result
11661 <p><span class="mw-formatted-date" title="2009-03-24">March 24, 2009</span>
11662 </p>
11663 !! end
11664
11665 !! test
11666 Linked date with autoformatting disabled
11667 !! config
11668 wgUseDynamicDates=false
11669 !! input
11670 [[2009-03-24]]
11671 !! result
11672 <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>
11673 </p>
11674 !! end
11675
11676 !! test
11677 Spacing of numbers in formatted dates
11678 !! input
11679 {{#formatdate:January 15}}
11680 !! result
11681 <p><span class="mw-formatted-date" title="01-15">January 15</span>
11682 </p>
11683 !! end
11684
11685 !! test
11686 Spacing of numbers in formatted dates (linked)
11687 !! config
11688 wgUseDynamicDates=true
11689 !! input
11690 [[January 15]]
11691 !! result
11692 <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>
11693 </p>
11694 !! end
11695
11696 !! test
11697 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
11698 !! options
11699 language=nl title=[[MediaWiki:Common.css]]
11700 !! input
11701 {{#formatdate:2009-03-24|dmy}}
11702 !! result
11703 <p><span class="mw-formatted-date" title="2009-03-24">24 March 2009</span>
11704 </p>
11705 !! end
11706
11707 #
11708 #
11709 #
11710
11711 #
11712 # Edit comments
11713 #
11714
11715 !! test
11716 Edit comment with link
11717 !! options
11718 comment
11719 !! input
11720 I like the [[Main Page]] a lot
11721 !! result
11722 I like the <a href="/wiki/Main_Page" title="Main Page">Main Page</a> a lot
11723 !!end
11724
11725 !! test
11726 Edit comment with link and link text
11727 !! options
11728 comment
11729 !! input
11730 I like the [[Main Page|best pages]] a lot
11731 !! result
11732 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
11733 !!end
11734
11735 !! test
11736 Edit comment with link and link text with suffix
11737 !! options
11738 comment
11739 !! input
11740 I like the [[Main Page|best page]]s a lot
11741 !! result
11742 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
11743 !!end
11744
11745 !! test
11746 Edit comment with section link (non-local, eg in history list)
11747 !! options
11748 comment title=[[Main Page]]
11749 !! input
11750 /* External links */ removed bogus entries
11751 !! result
11752 <a href="/wiki/Main_Page#External_links" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
11753 !!end
11754
11755 !! test
11756 Edit comment with section link and text before it (non-local, eg in history list)
11757 !! options
11758 comment title=[[Main Page]]
11759 !! input
11760 pre-comment text /* External links */ removed bogus entries
11761 !! result
11762 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>
11763 !!end
11764
11765 !! test
11766 Edit comment with section link (local, eg in diff view)
11767 !! options
11768 comment local title=[[Main Page]]
11769 !! input
11770 /* External links */ removed bogus entries
11771 !! result
11772 <a href="#External_links">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
11773 !!end
11774
11775 !! test
11776 Edit comment with subpage link (bug 14080)
11777 !! options
11778 comment
11779 subpage
11780 title=[[Subpage test]]
11781 !! input
11782 Poked at a [[/subpage]] here...
11783 !! result
11784 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a> here...
11785 !!end
11786
11787 !! test
11788 Edit comment with subpage link and link text (bug 14080)
11789 !! options
11790 comment
11791 subpage
11792 title=[[Subpage test]]
11793 !! input
11794 Poked at a [[/subpage|neat little page]] here...
11795 !! result
11796 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">neat little page</a> here...
11797 !!end
11798
11799 !! test
11800 Edit comment with bogus subpage link in non-subpage NS (bug 14080)
11801 !! options
11802 comment
11803 title=[[Subpage test]]
11804 !! input
11805 Poked at a [[/subpage]] here...
11806 !! result
11807 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...
11808 !!end
11809
11810 !! test
11811 Edit comment with bare anchor link (local, as on diff)
11812 !! options
11813 comment
11814 local
11815 title=[[Main Page]]
11816 !!input
11817 [[#section]]
11818 !! result
11819 <a href="#section">#section</a>
11820 !! end
11821
11822 !! test
11823 Edit comment with bare anchor link (non-local, as on history)
11824 !! options
11825 comment
11826 title=[[Main Page]]
11827 !!input
11828 [[#section]]
11829 !! result
11830 <a href="/wiki/Main_Page#section" title="Main Page">#section</a>
11831 !! end
11832
11833 !! test
11834 Anchor starting with underscore
11835 !!input
11836 [[#_ref|One]]
11837 !! result
11838 <p><a href="#_ref">One</a>
11839 </p>
11840 !! end
11841
11842 !! test
11843 Id starting with underscore
11844 !!input
11845 <div id="_ref"></div>
11846 !! result
11847 <div id="_ref"></div>
11848
11849 !! end
11850
11851 !! test
11852 Space normalisation on autocomment (bug 22784)
11853 !! options
11854 comment
11855 title=[[Main Page]]
11856 !!input
11857 /* __hello__world__ */
11858 !! result
11859 <a href="/wiki/Main_Page#hello_world" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">__hello__world__</span></span>
11860 !! end
11861
11862 !! test
11863 percent-encoding and + signs in comments (Bug 26410)
11864 !! options
11865 comment
11866 !!input
11867 [[ABC%33D% ++]] [[ABC%33D% ++|+%20]]
11868 !! result
11869 <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>
11870 !! end
11871
11872 !! test
11873 Bad images - basic functionality
11874 !! options
11875 disabled
11876 !! input
11877 [[File:Bad.jpg]]
11878 !! result
11879 !! end
11880
11881 !! test
11882 Bad images - bug 16039: text after bad image disappears
11883 !! options
11884 disabled
11885 !! input
11886 Foo bar
11887 [[File:Bad.jpg]]
11888 Bar foo
11889 !! result
11890 <p>Foo bar
11891 </p><p>Bar foo
11892 </p>
11893 !! end
11894
11895 !! test
11896 Verify that displaytitle works (bug #22501) no displaytitle
11897 !! options
11898 showtitle
11899 !! config
11900 wgAllowDisplayTitle=true
11901 wgRestrictDisplayTitle=false
11902 !! input
11903 this is not the the title
11904 !! result
11905 Parser test
11906 <p>this is not the the title
11907 </p>
11908 !! end
11909
11910 !! test
11911 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=false
11912 !! options
11913 showtitle
11914 title=[[Screen]]
11915 !! config
11916 wgAllowDisplayTitle=true
11917 wgRestrictDisplayTitle=false
11918 !! input
11919 this is not the the title
11920 {{DISPLAYTITLE:whatever}}
11921 !! result
11922 whatever
11923 <p>this is not the the title
11924 </p>
11925 !! end
11926
11927 !! test
11928 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true mismatch
11929 !! options
11930 showtitle
11931 title=[[Screen]]
11932 !! config
11933 wgAllowDisplayTitle=true
11934 wgRestrictDisplayTitle=true
11935 !! input
11936 this is not the the title
11937 {{DISPLAYTITLE:whatever}}
11938 !! result
11939 Screen
11940 <p>this is not the the title
11941 </p>
11942 !! end
11943
11944 !! test
11945 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true matching
11946 !! options
11947 showtitle
11948 title=[[Screen]]
11949 !! config
11950 wgAllowDisplayTitle=true
11951 wgRestrictDisplayTitle=true
11952 !! input
11953 this is not the the title
11954 {{DISPLAYTITLE:screen}}
11955 !! result
11956 screen
11957 <p>this is not the the title
11958 </p>
11959 !! end
11960
11961 !! test
11962 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false
11963 !! options
11964 showtitle
11965 title=[[Screen]]
11966 !! config
11967 wgAllowDisplayTitle=false
11968 !! input
11969 this is not the the title
11970 {{DISPLAYTITLE:screen}}
11971 !! result
11972 Screen
11973 <p>this is not the the title
11974 <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>
11975 </p>
11976 !! end
11977
11978 !! test
11979 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false no DISPLAYTITLE
11980 !! options
11981 showtitle
11982 title=[[Screen]]
11983 !! config
11984 wgAllowDisplayTitle=false
11985 !! input
11986 this is not the the title
11987 !! result
11988 Screen
11989 <p>this is not the the title
11990 </p>
11991 !! end
11992
11993 !! test
11994 preload: check <noinclude> and <includeonly>
11995 !! options
11996 preload
11997 !! input
11998 Hello <noinclude>cruel</noinclude><includeonly>kind</includeonly> world.
11999 !! result
12000 Hello kind world.
12001 !! end
12002
12003 !! test
12004 preload: check <onlyinclude>
12005 !! options
12006 preload
12007 !! input
12008 Goodbye <onlyinclude>Hello world</onlyinclude>
12009 !! result
12010 Hello world
12011 !! end
12012
12013 !! test
12014 preload: can pass tags through if we want to
12015 !! options
12016 preload
12017 !! input
12018 <includeonly><</includeonly>includeonly>Hello world<includeonly><</includeonly>/includeonly>
12019 !! result
12020 <includeonly>Hello world</includeonly>
12021 !! end
12022
12023 !! test
12024 preload: check that it doesn't try to do tricks
12025 !! options
12026 preload
12027 !! input
12028 * <!-- Hello --> ''{{world}}'' {{<includeonly>subst:</includeonly>How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
12029 !! result
12030 * <!-- Hello --> ''{{world}}'' {{subst:How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
12031 !! end
12032
12033 !! test
12034 Play a bit with r67090 and bug 3158
12035 !! options
12036 disabled
12037 !! input
12038 <div style="width:50% !important">&nbsp;</div>
12039 <div style="width:50%&nbsp;!important">&nbsp;</div>
12040 <div style="width:50%&#160;!important">&nbsp;</div>
12041 <div style="border : solid;">&nbsp;</div>
12042 !! result
12043 <div style="width:50% !important">&nbsp;</div>
12044 <div style="width:50% !important">&nbsp;</div>
12045 <div style="width:50% !important">&nbsp;</div>
12046 <div style="border&#160;: solid;">&nbsp;</div>
12047
12048 !! end
12049
12050 !! test
12051 HTML5 data attributes
12052 !! input
12053 <span data-foo="bar">Baz</span>
12054 <p data-abc-def_hij="">Quuz</p>
12055 !! result
12056 <p><span data-foo="bar">Baz</span>
12057 </p>
12058 <p data-abc-def_hij="">Quuz</p>
12059
12060 !! end
12061
12062 !! test
12063 percent-encoding and + signs in internal links (Bug 26410)
12064 !! input
12065 [[User:+%]] [[Page+title%]]
12066 [[%+]] [[%+|%20]] [[%+ ]] [[%+r]]
12067 [[%]] [[+]] [[image:%+abc%39|foo|[[bar]]]]
12068 [[%33%45]] [[%33%45+]]
12069 !! result
12070 <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>
12071 <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>
12072 <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>
12073 <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>
12074 </p>
12075 !! end
12076
12077 !! test
12078 Special characters in embedded file links (bug 27679)
12079 !! input
12080 [[File:Contains & ampersand.jpg]]
12081 [[File:Does not exist.jpg|Title with & ampersand]]
12082 !! result
12083 <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>
12084 <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>
12085 </p>
12086 !! end
12087
12088
12089 !! test
12090 Confirm that 'apos' named character reference doesn't make it to output (not legal in HTML 4)
12091 !! input
12092 Text&apos;s been normalized?
12093 !! result
12094 <p>Text&#39;s been normalized?
12095 </p>
12096 !! end
12097
12098 !! test
12099 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate free external links
12100 !! input
12101 http://www.example.org/ <-- U+3000 (vim: ^Vu3000)
12102 !! result
12103 <p><a rel="nofollow" class="external free" href="http://www.example.org/">http://www.example.org/</a> &lt;-- U+3000 (vim: ^Vu3000)
12104 </p>
12105 !! end
12106
12107 !! test
12108 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate bracketed external links
12109 !! input
12110 [http://www.example.org/ ideograms]
12111 !! result
12112 <p><a rel="nofollow" class="external text" href="http://www.example.org/">ideograms</a>
12113 </p>
12114 !! end
12115
12116 !! test
12117 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate external images links
12118 !! input
12119 http://www.example.org/pic.png <-- U+3000 (vim: ^Vu3000)
12120 !! result
12121 <p><img src="http://www.example.org/pic.png" alt="pic.png" /> &lt;-- U+3000 (vim: ^Vu3000)
12122 </p>
12123 !! end
12124
12125 !! article
12126 Mediawiki:loop1
12127 !! text
12128 {{Identical|A}}
12129 !! endarticle
12130
12131 !! article
12132 Mediawiki:loop2
12133 !! text
12134 {{Identical|B}}
12135 !! endarticle
12136
12137 !! article
12138 Template:Identical
12139 !! text
12140 {{int:loop1}}
12141 {{int:loop2}}
12142 !! endarticle
12143
12144 !! test
12145 Bug 31098 Template which includes system messages which includes the template
12146 !! input
12147 {{Identical}}
12148 !! result
12149 <p><span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
12150 <span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
12151 </p>
12152 !! end
12153
12154 !! test
12155 Bug31490 Turkish: ucfirst 'blah'
12156 !! options
12157 language=tr
12158 !! input
12159 {{ucfirst:blah}}
12160 !! result
12161 <p>Blah
12162 </p>
12163 !! end
12164
12165 !! test
12166 Bug31490 Turkish: ucfirst 'ix'
12167 !! options
12168 language=tr
12169 !! input
12170 {{ucfirst:ix}}
12171 !! result
12172 <p>İx
12173 </p>
12174 !! end
12175
12176 !! test
12177 Bug31490 Turkish: lcfirst 'BLAH'
12178 !! options
12179 language=tr
12180 !! input
12181 {{lcfirst:BLAH}}
12182 !! result
12183 <p>bLAH
12184 </p>
12185 !! end
12186
12187 !! test
12188 Bug31490 Turkish: ucfırst (with a dotless i)
12189 !! options
12190 language=tr
12191 !! input
12192 {{ucfırst:blah}}
12193 !! result
12194 <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>
12195 </p>
12196 !! end
12197
12198 !! test
12199 Bug31490 ucfırst (with a dotless i) with English language
12200 !! options
12201 language=en
12202 !! input
12203 {{ucfırst:blah}}
12204 !! result
12205 <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>
12206 </p>
12207 !! end
12208
12209 !! test
12210 Bug 26375: TOC with italics
12211 !! options
12212 title=[[Main Page]]
12213 !! input
12214 __TOC__
12215 == ''Lost'' episodes ==
12216 !! result
12217 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
12218 <ul>
12219 <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>
12220 </ul>
12221 </td></tr></table>
12222 <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>
12223
12224 !! end
12225
12226 !! test
12227 Bug 26375: TOC with bold
12228 !! options
12229 title=[[Main Page]]
12230 !! input
12231 __TOC__
12232 == '''should be bold''' then normal text ==
12233 !! result
12234 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
12235 <ul>
12236 <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>
12237 </ul>
12238 </td></tr></table>
12239 <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>
12240
12241 !! end
12242
12243 !! test
12244 Bug 33845: Headings become cursive in TOC when they contain an image
12245 !! options
12246 title=[[Main Page]]
12247 !! input
12248 __TOC__
12249 == Image [[Image:foobar.jpg]] ==
12250 !! result
12251 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
12252 <ul>
12253 <li class="toclevel-1 tocsection-1"><a href="#Image"><span class="tocnumber">1</span> <span class="toctext">Image</span></a></li>
12254 </ul>
12255 </td></tr></table>
12256 <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>
12257
12258 !! end
12259
12260 !! test
12261 Bug 33845 (2): Headings become bold in TOC when they contain a blockquote
12262 !! options
12263 title=[[Main Page]]
12264 !! input
12265 __TOC__
12266 == <blockquote>Quote</blockquote> ==
12267 !! result
12268 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
12269 <ul>
12270 <li class="toclevel-1 tocsection-1"><a href="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
12271 </ul>
12272 </td></tr></table>
12273 <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>
12274
12275 !! end
12276
12277 !! test
12278 Unclosed tags in TOC
12279 !! options
12280 title=[[Main Page]]
12281 !! input
12282 __TOC__
12283 == Proof: 2 < 3 ==
12284 <small>Hanc marginis exiguitas non caperet.</small>
12285 QED
12286 !! result
12287 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
12288 <ul>
12289 <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>
12290 </ul>
12291 </td></tr></table>
12292 <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>
12293 <p><small>Hanc marginis exiguitas non caperet.</small>
12294 QED
12295 </p>
12296 !! end
12297
12298 !! test
12299 Multiple tags in TOC
12300 !! input
12301 __TOC__
12302 == <i>Foo</i> <b>Bar</b> ==
12303
12304 == <i>Foo</i> <blockquote>Bar</blockquote> ==
12305 !! result
12306 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
12307 <ul>
12308 <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>
12309 <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>
12310 </ul>
12311 </td></tr></table>
12312 <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>
12313 <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>
12314
12315 !! end
12316
12317 !! test
12318 Tags with parameters in TOC
12319 !! input
12320 __TOC__
12321 == <sup class="in-h2">Hello</sup> ==
12322
12323 == <sup class="a > b">Evilbye</sup> ==
12324 !! result
12325 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
12326 <ul>
12327 <li class="toclevel-1 tocsection-1"><a href="#Hello"><span class="tocnumber">1</span> <span class="toctext"><sup>Hello</sup></span></a></li>
12328 <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>
12329 </ul>
12330 </td></tr></table>
12331 <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>
12332 <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>
12333
12334 !! end
12335
12336 !! test
12337 span tags with directionality in TOC
12338 !! input
12339 __TOC__
12340 == <span dir="ltr">C++</span> ==
12341
12342 == <span dir="rtl">זבנג!</span> ==
12343
12344 == <span style="font-style: italic">The attributes on these span tags must be deleted from the TOC</span> ==
12345
12346 == <span style="font-style: italic" dir="ltr">All attributes on these span tags must be deleted from the TOC</span> ==
12347
12348 == <span dir="ltr" style="font-style: italic">Attributes after dir on these span tags must be deleted from the TOC</span> ==
12349 !! result
12350 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
12351 <ul>
12352 <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>
12353 <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>
12354 <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>
12355 <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>
12356 <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>
12357 </ul>
12358 </td></tr></table>
12359 <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>
12360 <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>
12361 <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>
12362 <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>
12363 <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>
12364
12365 !! end
12366
12367 !! article
12368 MediaWiki:Bug32057
12369 !! text
12370 == {{int:headline_sample}} ==
12371 !! endarticle
12372
12373 !! test
12374 Bug 32057: Title needed when expanding <h> nodes.
12375 !! options
12376 title=[[Main Page]]
12377 !! input
12378 {{int:Bug32057}}
12379 !! result
12380 <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>
12381
12382 !! end
12383
12384 !! test
12385 Strip marker in urlencode
12386 !! input
12387 {{urlencode:x<nowiki/>y}}
12388 {{urlencode:x<nowiki/>y|wiki}}
12389 {{urlencode:x<nowiki/>y|path}}
12390 !! result
12391 <p>xy
12392 xy
12393 xy
12394 </p>
12395 !! end
12396
12397 !! test
12398 Strip marker in lc
12399 !! input
12400 {{lc:x<nowiki/>y}}
12401 !! result
12402 <p>xy
12403 </p>
12404 !! end
12405
12406 !! test
12407 Strip marker in uc
12408 !! input
12409 {{uc:x<nowiki/>y}}
12410 !! result
12411 <p>XY
12412 </p>
12413 !! end
12414
12415 !! test
12416 Strip marker in formatNum
12417 !! input
12418 {{formatnum:1<nowiki/>2}}
12419 {{formatnum:1<nowiki/>2|R}}
12420 !! result
12421 <p>12
12422 12
12423 </p>
12424 !! end
12425
12426 !! test
12427 Strip marker in grammar
12428 !! options
12429 language=fi
12430 !! input
12431 {{grammar:elative|foo<nowiki/>bar}}
12432 !! result
12433 <p>foobarista
12434 </p>
12435 !! end
12436
12437 !! test
12438 Strip marker in padleft
12439 !! input
12440 {{padleft:|2|x<nowiki/>y}}
12441 !! result
12442 <p>xy
12443 </p>
12444 !! end
12445
12446 !! test
12447 Strip marker in padright
12448 !! input
12449 {{padright:|2|x<nowiki/>y}}
12450 !! result
12451 <p>xy
12452 </p>
12453 !! end
12454
12455 !! test
12456 Strip marker in anchorencode
12457 !! input
12458 {{anchorencode:x<nowiki/>y}}
12459 !! result
12460 <p>xy
12461 </p>
12462 !! end
12463
12464 !! test
12465 nowiki inside link inside heading (bug 18295)
12466 !! input
12467 ==[[foo|x<nowiki>y</nowiki>z]]==
12468 !! result
12469 <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>
12470
12471 !! end
12472
12473 !! test
12474 new support for bdi element (bug 31817)
12475 !! input
12476 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
12477 !! result
12478 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
12479
12480 !!end
12481
12482 !! test
12483 Ignore pipe between table row attributes
12484 !! input
12485 {|
12486 | quux
12487 |- id=foo | style='color: red'
12488 | bar
12489 |}
12490 !! result
12491 <table>
12492 <tr>
12493 <td> quux
12494 </td></tr>
12495 <tr id="foo" style="color: red">
12496 <td> bar
12497 </td></tr></table>
12498
12499 !! end
12500
12501 !!test
12502 Gallery override link with WikiLink (bug 34852)
12503 !! input
12504 <gallery>
12505 File:foobar.jpg|caption|alt=galleryalt|link=InterWikiLink
12506 </gallery>
12507 !! result
12508 <ul class="gallery">
12509 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
12510 <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>
12511 <div class="gallerytext">
12512 <p>caption
12513 </p>
12514 </div>
12515 </div></li>
12516 </ul>
12517
12518 !! end
12519
12520 !!test
12521 Gallery override link with absolute external link (bug 34852)
12522 !! input
12523 <gallery>
12524 File:foobar.jpg|caption|alt=galleryalt|link=http://www.example.org
12525 </gallery>
12526 !! result
12527 <ul class="gallery">
12528 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
12529 <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>
12530 <div class="gallerytext">
12531 <p>caption
12532 </p>
12533 </div>
12534 </div></li>
12535 </ul>
12536
12537 !! end
12538
12539 !!test
12540 Gallery override link with malicious javascript (bug 34852)
12541 !! input
12542 <gallery>
12543 File:foobar.jpg|caption|alt=galleryalt|link=" onclick="alert('malicious javascript code!');
12544 </gallery>
12545 !! result
12546 <ul class="gallery">
12547 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
12548 <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>
12549 <div class="gallerytext">
12550 <p>caption
12551 </p>
12552 </div>
12553 </div></li>
12554 </ul>
12555
12556 !! end
12557
12558 !!test
12559 Language parser function
12560 !! input
12561 {{#language:ar}}
12562 !! result
12563 <p>العربية
12564 </p>
12565 !! end
12566
12567 !!test
12568 Padleft and padright as substr
12569 !! input
12570 {{padleft:|3|abcde}}
12571 {{padright:|3|abcde}}
12572 !! result
12573 <p>abc
12574 abc
12575 </p>
12576 !! end
12577
12578 !!test
12579 Bug 34939 - Case insensitive link parsing ([HttP://])
12580 !! input
12581 [HttP://MediaWiki.Org/]
12582 !! result
12583 <p><a rel="nofollow" class="external autonumber" href="HttP://MediaWiki.Org/">[1]</a>
12584 </p>
12585 !! end
12586
12587 !!test
12588 Bug 34939 - Case insensitive link parsing ([HttP:// title])
12589 !! input
12590 [HttP://MediaWiki.Org/ MediaWiki]
12591 !! result
12592 <p><a rel="nofollow" class="external text" href="HttP://MediaWiki.Org/">MediaWiki</a>
12593 </p>
12594 !! end
12595
12596 !!test
12597 Bug 34939 - Case insensitive link parsing (HttP://)
12598 !! input
12599 HttP://MediaWiki.Org/
12600 !! result
12601 <p><a rel="nofollow" class="external free" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a>
12602 </p>
12603 !! end
12604
12605 ###
12606 ### Parsoids-specific tests
12607 ### Parsoid-PHP parser incompatibilities
12608 ###
12609 !!test
12610 1. SOL-sensitive wikitext tokens as template-args
12611 !!options
12612 disabled
12613 !!input
12614 {{echo|*a}}
12615 {{echo|#a}}
12616 {{echo|:a}}
12617 !!result
12618 <p>*a
12619 #a
12620 :a
12621 </p>
12622 !!end
12623
12624 #### The following section of tests are primarily to test
12625 #### wikitext escaping capabilities of Parsoid.
12626 #### A lot of the tests are disabled for the PHP parser either
12627 #### because of minor newline diffs or other reasons.
12628 #### As Parsoid serializer can handle newlines and other HTML
12629 #### more robustly, some of these tests might get reenabled
12630 #### for the PHP parser.
12631
12632 #### --------------- Headings ---------------
12633 #### 0. Unnested
12634 #### 1. Nested inside html <h1>=foo=</h1>
12635 #### 2. Outside heading nest on a single line <h1>foo</h1>*bar
12636 #### 3. Nested inside html with wikitext split by html tags
12637 #### 4. No escape needed
12638 #### 5. Empty headings <h1></h1>
12639 #### 6. Heading chars in SOL context
12640 #### ----------------------------------------
12641 !! test
12642 Headings: 0. Unnested
12643 !! input
12644 <nowiki>=foo=</nowiki>
12645
12646 <nowiki>=foo</nowiki>''a''=
12647 !! result
12648 <p>=foo=
12649 </p><p>=foo<i>a</i>=
12650 </p>
12651 !!end
12652
12653 !! test
12654 Headings: 1. Nested inside html
12655 !! options
12656 disabled
12657 !! input
12658 =<nowiki>=foo=</nowiki>=
12659 ==<nowiki>=foo=</nowiki>==
12660 ===<nowiki>=foo=</nowiki>===
12661 ====<nowiki>=foo=</nowiki>====
12662 =====<nowiki>=foo=</nowiki>=====
12663 ======<nowiki>=foo=</nowiki>======
12664 !! result
12665 <h1>=foo=</h1>
12666 <h2>=foo=</h2>
12667 <h3>=foo=</h3>
12668 <h4>=foo=</h4>
12669 <h5>=foo=</h5>
12670 <h6>=foo=</h6>
12671 !!end
12672
12673 !! test
12674 Headings: 2. Outside heading nest on a single line <h1>foo</h1>*bar
12675 !! options
12676 disabled
12677 !! input
12678 =foo=
12679 <nowiki>*bar</nowiki>
12680 =foo=
12681 =bar
12682 =foo=
12683 <nowiki>=bar=</nowiki>
12684 !! result
12685 <h1>foo</h1>*bar
12686 <h1>foo</h1>=bar
12687 <h1>foo</h1>=bar=
12688 !!end
12689
12690 !! test
12691 Headings: 3. Nested inside html with wikitext split by html tags
12692 !! options
12693 disabled
12694 !! input
12695 =<nowiki>=</nowiki>'''bold'''foo==
12696 !! result
12697 <h1>=<b>bold</b>foo=</h1>
12698 !!end
12699
12700 !! test
12701 Headings: 4. No escaping needed (testing just h1 and h2)
12702 !! options
12703 disabled
12704 !! input
12705 ==foo=
12706 =foo==
12707 ===foo==
12708 ==foo===
12709 =''=''foo==
12710 ===
12711 !! result
12712 <h1>=foo</h1>
12713 <h1>foo=</h1>
12714 <h2>=foo</h2>
12715 <h2>foo=</h2>
12716 <h1><i>=</i>foo=</h1>
12717 <h1>=</h1>
12718 !!end
12719
12720 !! test
12721 Headings: 5. Empty headings
12722 !! options
12723 disabled
12724 !! input
12725 =<nowiki></nowiki>=
12726 ==<nowiki></nowiki>==
12727 ===<nowiki></nowiki>===
12728 ====<nowiki></nowiki>====
12729 =====<nowiki></nowiki>=====
12730 ======<nowiki></nowiki>======
12731 !! result
12732 <h1></h1>
12733 <h2></h2>
12734 <h3></h3>
12735 <h4></h4>
12736 <h5></h5>
12737 <h6></h6>
12738 !!end
12739
12740 !! test
12741 Headings: 6. Heading chars in SOL context
12742 !! options
12743 disabled
12744 !! input
12745 <!--cmt--><nowiki>=h1=</nowiki>
12746 !! result
12747 <p><!--cmt-->=h1=
12748 </p>
12749 !!end
12750
12751 #### --------------- Lists ---------------
12752 #### 0. Outside nests (*foo, etc.)
12753 #### 1. Nested inside html <ul><li>*foo</li></ul>
12754 #### 2. Inside definition lists
12755 #### 3. Only bullets at start should be escaped
12756 #### 4. No escapes needed
12757 #### 5. No unnecessary escapes
12758 #### 6. Escape bullets in SOL position
12759 #### 7. Escape bullets in a multi-line context
12760 #### ----------------------------------------
12761
12762 !! test
12763 Lists: 0. Outside nests
12764 !! input
12765 <nowiki>*foo</nowiki>
12766
12767 <nowiki>#foo</nowiki>
12768 !! result
12769 <p>*foo
12770 </p><p>#foo
12771 </p>
12772 !!end
12773
12774 !! test
12775 Lists: 1. Nested inside html
12776 !! input
12777 *<nowiki>*foo</nowiki>
12778
12779 *<nowiki>#foo</nowiki>
12780
12781 *<nowiki>:foo</nowiki>
12782
12783 *<nowiki>;foo</nowiki>
12784
12785 #<nowiki>*foo</nowiki>
12786
12787 #<nowiki>#foo</nowiki>
12788
12789 #<nowiki>:foo</nowiki>
12790
12791 #<nowiki>;foo</nowiki>
12792 !! result
12793 <ul><li>*foo
12794 </li></ul>
12795 <ul><li>#foo
12796 </li></ul>
12797 <ul><li>:foo
12798 </li></ul>
12799 <ul><li>;foo
12800 </li></ul>
12801 <ol><li>*foo
12802 </li></ol>
12803 <ol><li>#foo
12804 </li></ol>
12805 <ol><li>:foo
12806 </li></ol>
12807 <ol><li>;foo
12808 </li></ol>
12809
12810 !!end
12811
12812 !! test
12813 Lists: 2. Inside definition lists
12814 !! input
12815 ;<nowiki>;foo</nowiki>
12816
12817 ;<nowiki>:foo</nowiki>
12818
12819 ;<nowiki>:foo</nowiki>
12820 :bar
12821
12822 :<nowiki>:foo</nowiki>
12823 !! result
12824 <dl><dt>;foo
12825 </dt></dl>
12826 <dl><dt>:foo
12827 </dt></dl>
12828 <dl><dt>:foo
12829 </dt><dd>bar
12830 </dd></dl>
12831 <dl><dd>:foo
12832 </dd></dl>
12833
12834 !!end
12835
12836 !! test
12837 Lists: 3. Only bullets at start of text should be escaped
12838 !! input
12839 *<nowiki>*foo*bar</nowiki>
12840
12841 *<nowiki>*foo</nowiki>''it''*bar
12842 !! result
12843 <ul><li>*foo*bar
12844 </li></ul>
12845 <ul><li>*foo<i>it</i>*bar
12846 </li></ul>
12847
12848 !!end
12849
12850 !! test
12851 Lists: 4. No escapes needed
12852 !! options
12853 disabled
12854 !! input
12855 *foo*bar
12856
12857 *''foo''*bar
12858
12859 *[[Foo]]: bar
12860 !! result
12861 <ul><li>foo*bar
12862 </li></ul>
12863 <ul><li><i>foo</i>*bar
12864 </li></ul>
12865 <ul><li><a href="Foo" rel="mw:WikiLink">Foo</a>: bar
12866 </li></ul>
12867 !!end
12868
12869 !! test
12870 Lists: 5. No unnecessary escapes
12871 !! input
12872 * bar <span><nowiki>[[foo]]</nowiki></span>
12873
12874 *=bar <span><nowiki>[[foo]]</nowiki></span>
12875
12876 *[[bar <span><nowiki>[[foo]]</nowiki></span>
12877
12878 *<nowiki>]]bar </nowiki><span><nowiki>[[foo]]</nowiki></span>
12879
12880 *=bar <span>foo]]</span>=
12881 !! result
12882 <ul><li> bar <span>[[foo]]</span>
12883 </li></ul>
12884 <ul><li>=bar <span>[[foo]]</span>
12885 </li></ul>
12886 <ul><li>[[bar <span>[[foo]]</span>
12887 </li></ul>
12888 <ul><li>]]bar <span>[[foo]]</span>
12889 </li></ul>
12890 <ul><li>=bar <span>foo]]</span>=
12891 </li></ul>
12892
12893 !!end
12894
12895 !! test
12896 Lists: 6. Escape bullets in SOL position
12897 !! options
12898 disabled
12899 !! input
12900 <!--cmt--><nowiki>*foo</nowiki>
12901 !! result
12902 <p><!--cmt-->*foo
12903 </p>
12904 !!end
12905
12906 !! test
12907 Lists: 7. Escape bullets in a multi-line context
12908 !! input
12909 <nowiki>a
12910 *b</nowiki>
12911 !! result
12912 <p>a
12913 *b
12914 </p>
12915 !!end
12916
12917 #### --------------- HRs ---------------
12918 #### 1. Single line
12919 #### -----------------------------------
12920
12921 !! test
12922 HRs: 1. Single line
12923 !! options
12924 disabled
12925 !! input
12926 ----
12927 <nowiki>----</nowiki>
12928 ----
12929 <nowiki>=foo=</nowiki>
12930 ----
12931 <nowiki>*foo</nowiki>
12932 !! result
12933 <hr/>----
12934 <hr/>=foo=
12935 <hr/>*foo
12936 !! end
12937
12938 #### --------------- Tables ---------------
12939 #### 1a. Simple example
12940 #### 1b. No escaping needed (!foo)
12941 #### 1c. No escaping needed (|foo)
12942 #### 1d. No escaping needed (|}foo)
12943 ####
12944 #### 2a. Nested in td (<td>foo|bar</td>)
12945 #### 2b. Nested in td (<td>foo||bar</td>)
12946 #### 2c. Nested in td -- no escaping needed(<td>foo!!bar</td>)
12947 ####
12948 #### 3a. Nested in th (<th>foo!bar</th>)
12949 #### 3b. Nested in th (<th>foo!!bar</th>)
12950 #### 3c. Nested in th -- no escaping needed(<th>foo||bar</th>)
12951 ####
12952 #### 4a. Escape -
12953 #### 4b. Escape +
12954 #### 4c. No escaping needed
12955 #### --------------------------------------
12956
12957 !! test
12958 Tables: 1a. Simple example
12959 !! input
12960 <nowiki>{|
12961 |}</nowiki>
12962 !! result
12963 <p>{|
12964 |}
12965 </p>
12966 !! end
12967
12968 !! test
12969 Tables: 1b. No escaping needed
12970 !! input
12971 !foo
12972 !! result
12973 <p>!foo
12974 </p>
12975 !! end
12976
12977 !! test
12978 Tables: 1c. No escaping needed
12979 !! input
12980 |foo
12981 !! result
12982 <p>|foo
12983 </p>
12984 !! end
12985
12986 !! test
12987 Tables: 1d. No escaping needed
12988 !! input
12989 |}foo
12990 !! result
12991 <p>|}foo
12992 </p>
12993 !! end
12994
12995 !! test
12996 Tables: 2a. Nested in td
12997 !! options
12998 disabled
12999 !! input
13000 {|
13001 |<nowiki>foo|bar</nowiki>
13002 |}
13003 !! result
13004 <table>
13005 <tr><td>foo|bar
13006 </td></tr></table>
13007
13008 !! end
13009
13010 !! test
13011 Tables: 2b. Nested in td
13012 !! options
13013 disabled
13014 !! input
13015 {|
13016 |<nowiki>foo||bar</nowiki>
13017 |''it''<nowiki>foo||bar</nowiki>
13018 |}
13019 !! result
13020 <table>
13021 <tr><td>foo||bar
13022 </td><td><i>it</i>foo||bar
13023 </td></tr></table>
13024
13025 !! end
13026
13027 !! test
13028 Tables: 2c. Nested in td -- no escaping needed
13029 !! options
13030 disabled
13031 !! input
13032 {|
13033 |foo!!bar
13034 |}
13035 !! result
13036 <table>
13037 <tr><td>foo!!bar
13038 </td></tr></table>
13039
13040 !! end
13041
13042 !! test
13043 Tables: 3a. Nested in th
13044 !! options
13045 disabled
13046 !! input
13047 {|
13048 !foo!bar
13049 |}
13050 !! result
13051 <table>
13052 <tr><th>foo!bar
13053 </th></tr></table>
13054
13055 !! end
13056
13057 !! test
13058 Tables: 3b. Nested in th
13059 !! options
13060 disabled
13061 !! input
13062 {|
13063 !<nowiki>foo!!bar</nowiki>
13064 |}
13065 !! result
13066 <table>
13067 <tr><th>foo!!bar
13068 </th></tr></table>
13069
13070 !! end
13071
13072 !! test
13073 Tables: 3c. Nested in th -- no escaping needed
13074 !! options
13075 disabled
13076 !! input
13077 {|
13078 !foo||bar
13079 |}
13080 !! result
13081 <table>
13082 <tr><th>foo||bar
13083 </th></tr></table>
13084
13085 !! end
13086
13087 !! test
13088 Tables: 4a. Escape -
13089 !! options
13090 disabled
13091 !! input
13092 {|
13093 |-
13094 !-bar
13095 |-
13096 |<nowiki>-bar</nowiki>
13097 |}
13098 !! result
13099 <table><tbody>
13100 <tr><th>-bar</th></tr>
13101 <tr><td>-bar</td></tr>
13102 </tbody></table>
13103 !! end
13104
13105 !! test
13106 Tables: 4b. Escape +
13107 !! options
13108 disabled
13109 !! input
13110 {|
13111 |-
13112 !+bar
13113 |-
13114 |<nowiki>+bar</nowiki>
13115 |}
13116 !! result
13117 <table><tbody>
13118 <tr><th>+bar</th></tr>
13119 <tr><td>+bar</td></tr>
13120 </tbody></table>
13121 !! end
13122
13123 !! test
13124 Tables: 4c. No escaping needed
13125 !! options
13126 disabled
13127 !! input
13128 {|
13129 |-
13130 |foo-bar
13131 |foo+bar
13132 |-
13133 |''foo''-bar
13134 |''foo''+bar
13135 |}
13136 !! result
13137 <table><tbody>
13138 <tr><td>foo-bar</td><td>foo+bar</td></tr>
13139 <tr><td><i>foo</i>-bar</td><td><i>foo</i>+bar</td></tr>
13140 </tbody></table>
13141 !! end
13142
13143 #### --------------- Links ---------------
13144 #### 1. Quote marks in link text
13145 #### 2. Wikilinks: Escapes needed
13146 #### 3. Wikilinks: No escapes needed
13147 #### 4. Extlinks: Escapes needed
13148 #### 5. Extlinks: No escapes needed
13149 #### --------------------------------------
13150 !! test
13151 Links 1. Quote marks in link text
13152 !! options
13153 disabled
13154 !! input
13155 [[Foo|<nowiki>Foo''boo''</nowiki>]]
13156 !! result
13157 <a rel="mw:WikiLink" href="Foo">Foo''boo''</a>
13158 !! end
13159
13160 !! test
13161 Links 2. WikiLinks: Escapes needed
13162 !! options
13163 disabled
13164 !! input
13165 [[Foo|<nowiki>[Foobar]</nowiki>]]
13166 [[Foo|<nowiki>Foobar]</nowiki>]]
13167 [[Foo|<nowiki>x [Foobar] x</nowiki>]]
13168 [[Foo|<nowiki>x [http://google.com g] x</nowiki>]]
13169 [[Foo|<nowiki>[[Bar]]</nowiki>]]
13170 [[Foo|<nowiki>x [[Bar]] x</nowiki>]]
13171 [[Foo|<nowiki>|Bar</nowiki>]]
13172 !! result
13173 <a href="Foo" rel="mw:WikiLink">[Foobar]</a>
13174 <a href="Foo" rel="mw:WikiLink">Foobar]</a>
13175 <a href="Foo" rel="mw:WikiLink">x [Foobar] x</a>
13176 <a href="Foo" rel="mw:WikiLink">x [http://google.com g] x</a>
13177 <a href="Foo" rel="mw:WikiLink">[[Bar]]</a>
13178 <a href="Foo" rel="mw:WikiLink">x [[Bar]] x</a>
13179 <a href="Foo" rel="mw:WikiLink">|Bar</a>
13180 !! end
13181
13182 !! test
13183 Links 3. WikiLinks: No escapes needed
13184 !! options
13185 disabled
13186 !! input
13187 [[Foo|[Foobar]]
13188 [[Foo|foo|bar]]
13189 !! result
13190 <a href="Foo" rel="mw:WikiLink">[Foobar</a>
13191 <a href="Foo" rel="mw:WikiLink">foo|bar</a>
13192 !! end
13193
13194 !! test
13195 Links 4. ExtLinks: Escapes needed
13196 !! options
13197 disabled
13198 !! input
13199 [http://google.com <nowiki>[google]</nowiki>]
13200 [http://google.com <nowiki>google]</nowiki>]
13201 !! result
13202 <a href="http://google.com" rel="mw:ExtLink">[google]</a>
13203 <a href="http://google.com" rel="mw:ExtLink">google]</a>
13204 !! end
13205
13206 !! test
13207 Links 5. ExtLinks: No escapes needed
13208 !! options
13209 disabled
13210 !! input
13211 [http://google.com [google]
13212 !! result
13213 <a href="http://google.com" rel="mw:ExtLink">[google</a>
13214 !! end
13215
13216 #### --------------- Quotes ---------------
13217 #### 1. Quotes inside <b> and <i>
13218 #### 2. Link fragments separated by <i> and <b> tags
13219 #### 3. Link fragments inside <i> and <b>
13220 #### --------------------------------------
13221 !! test
13222 1. Quotes inside <b> and <i>
13223 !! input
13224 ''<nowiki>'foo'</nowiki>''
13225 ''<nowiki>''foo''</nowiki>''
13226 ''<nowiki>'''foo'''</nowiki>''
13227 '''<nowiki>'foo'</nowiki>'''
13228 '''<nowiki>''foo''</nowiki>'''
13229 '''<nowiki>'''foo'''</nowiki>'''
13230 '''<nowiki>foo'</nowiki>''<nowiki>bar'</nowiki>''baz'''
13231 !! result
13232 <p><i>'foo'</i>
13233 <i>''foo''</i>
13234 <i>'''foo'''</i>
13235 <b>'foo'</b>
13236 <b>''foo''</b>
13237 <b>'''foo'''</b>
13238 <b>foo'<i>bar'</i>baz</b>
13239 </p>
13240 !! end
13241
13242 !! test
13243 2. Link fragments separated by <i> and <b> tags
13244 !! input
13245 [[''foo''<nowiki>hello]]</nowiki>
13246
13247 [['''foo'''<nowiki>hello]]</nowiki>
13248 !! result
13249 <p>[[<i>foo</i>hello]]
13250 </p><p>[[<b>foo</b>hello]]
13251 </p>
13252 !! end
13253
13254 !! test
13255 2. Link fragments inside <i> and <b>
13256 (FIXME: Escaping one or both of [[ and ]] is also acceptable --
13257 this is one of the shortcomings of this format)
13258 !! input
13259 ''[[foo''<nowiki>]]</nowiki>
13260
13261 '''[[foo'''<nowiki>]]</nowiki>
13262 !! result
13263 <p><i>[[foo</i>]]
13264 </p><p><b>[[foo</b>]]
13265 </p>
13266 !! end
13267
13268 #### --------------- Paragraphs ---------------
13269 #### 1. No unnecessary escapes
13270 #### --------------------------------------
13271
13272 !! test
13273 1. No unnecessary escapes
13274 !! input
13275 bar <span><nowiki>[[foo]]</nowiki></span>
13276
13277 =bar <span><nowiki>[[foo]]</nowiki></span>
13278
13279 [[bar <span><nowiki>[[foo]]</nowiki></span>
13280
13281 <nowiki>]]bar </nowiki><span><nowiki>[[foo]]</nowiki></span>
13282
13283 <nowiki>=bar </nowiki><span>foo]]</span>=
13284 !! result
13285 <p>bar <span>[[foo]]</span>
13286 </p><p>=bar <span>[[foo]]</span>
13287 </p><p>[[bar <span>[[foo]]</span>
13288 </p><p>]]bar <span>[[foo]]</span>
13289 </p><p>=bar <span>foo]]</span>=
13290 </p>
13291 !!end
13292
13293 #### --------------- PRE ------------------
13294 #### 1. Leading space in SOL context should be escaped
13295 #### --------------------------------------
13296 !! test
13297 1. Leading space in SOL context should be escaped
13298 !! options
13299 disabled
13300 !! input
13301 <nowiki> foo</nowiki>
13302 <!--cmt--><nowiki> foo</nowiki>
13303 !! result
13304 <p> foo
13305 <!--cmt--> foo
13306 </p>
13307 !! end
13308
13309 #### --------------- HTML tags ---------------
13310 #### 1. a tags
13311 #### 2. other tags
13312 #### 3. multi-line html tag
13313 #### --------------------------------------
13314 !! test
13315 1. a tags
13316 !! options
13317 disabled
13318 !! input
13319 <a href="http://google.com">google</a>
13320 !! result
13321 &lt;a href=&quot;http://google.com&quot;&gt;google&lt;/a&gt;
13322 !! end
13323
13324 !! test
13325 2. other tags
13326 !! input
13327 <nowiki><div>foo</div>
13328 <div style="color:red">foo</div></nowiki>
13329 !! result
13330 <p>&lt;div&gt;foo&lt;/div&gt;
13331 &lt;div style=&quot;color:red&quot;&gt;foo&lt;/div&gt;
13332 </p>
13333 !! end
13334
13335 !! test
13336 3. multi-line html tag
13337 !! input
13338 <nowiki><div
13339 >foo</div
13340 ></nowiki>
13341 !! result
13342 <p>&lt;div
13343 &gt;foo&lt;/div
13344 &gt;
13345 </p>
13346 !! end
13347
13348 #### --------------- Others ---------------
13349 !! test
13350 Escaping nowikis
13351 !! input
13352 &lt;nowiki&gt;foo&lt;/nowiki&gt;
13353 !! result
13354 <p>&lt;nowiki&gt;foo&lt;/nowiki&gt;
13355 </p>
13356 !! end
13357
13358 !! test
13359 Tag-like HTML structures are passed through as text
13360 !! input
13361 <x y>
13362
13363 <x.y>
13364
13365 <x-y>
13366
13367 1>2
13368
13369 x<y
13370
13371 a>b
13372
13373 1<d e>f
13374 !! result
13375 <p>&lt;x y&gt;
13376 </p><p>&lt;x.y&gt;
13377 </p><p>&lt;x-y&gt;
13378 </p><p>1&gt;2
13379 </p><p>x&lt;y
13380 </p><p>a&gt;b
13381 </p><p>1&lt;d e&gt;f
13382 </p>
13383 !! end
13384
13385
13386 # This fails in the PHP parser (see bug 40670,
13387 # https://bugzilla.wikimedia.org/show_bug.cgi?id=40670), so disabled for it.
13388 !! test
13389 Tag names followed by punctuation should not be recognized as tags
13390 !! options
13391 disabled
13392 !! input
13393 <s.ome> text
13394 !! result
13395 <p>&lt;s.ome&gt text
13396 </p>
13397 !! end
13398
13399 !! test
13400 HTML tag with necessary entities in attributes
13401 !! input
13402 <span title="&amp;amp;">foo</span>
13403 !! result
13404 <p><span title="&amp;amp;">foo</span>
13405 </p>
13406 !! end
13407
13408 !! test
13409 HTML tag with 'unnecessary' entity encoding in attributes
13410 !! input
13411 <span title="&amp;">foo</span>
13412 !! result
13413 <p><span title="&amp;">foo</span>
13414 </p>
13415 !! end
13416
13417 TODO:
13418 more images
13419 more tables
13420 character entities
13421 and much more
13422 Try for 100% code coverage