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