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