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