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