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