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