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