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