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