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