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