Merge "Add wfSuppressWarnings(); to CologneBlue."
[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 ''
7026 array (
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 (
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 (
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 'input'
7065 array (
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 'input'
7079 array (
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 'input'
7093 array (
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 '<tag>'
7108 array (
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 ''
7121 array (
7122 'width' => '200',
7123 'height' => '100',
7124 'depth' => '50',
7125 'square' => 'square',
7126 )
7127 </pre>
7128
7129 !! end
7130
7131 !! test
7132 Parser hook: argument containing a forward slash (bug 5344)
7133 !! input
7134 <tag filename='/tmp/bla'></tag>
7135 !! result
7136 <pre>
7137 ''
7138 array (
7139 'filename' => '/tmp/bla',
7140 )
7141 </pre>
7142
7143 !! end
7144
7145 !! test
7146 Parser hook: empty input using terminated empty elements (bug 2374)
7147 !! input
7148 <tag foo=bar/>text
7149 !! result
7150 <pre>
7151 NULL
7152 array (
7153 'foo' => 'bar',
7154 )
7155 </pre>text
7156
7157 !! end
7158
7159 # </tag> should be output literally since there is no matching tag that begins it
7160 !! test
7161 Parser hook: basic arguments using terminated empty elements (bug 2374)
7162 !! input
7163 <tag width=200 height = "100" depth = '50' square/>
7164 other stuff
7165 </tag>
7166 !! result
7167 <pre>
7168 NULL
7169 array (
7170 'width' => '200',
7171 'height' => '100',
7172 'depth' => '50',
7173 'square' => 'square',
7174 )
7175 </pre>
7176 <p>other stuff
7177 &lt;/tag&gt;
7178 </p>
7179 !! end
7180
7181 ###
7182 ### (see maintenance/parserTestsStaticParserHook.php for the <statictag> extension)
7183 ###
7184
7185 !! test
7186 Parser hook: static parser hook not inside a comment
7187 !! input
7188 <statictag>hello, world</statictag>
7189 <statictag action=flush/>
7190 !! result
7191 <p>hello, world
7192 </p>
7193 !! end
7194
7195
7196 !! test
7197 Parser hook: static parser hook inside a comment
7198 !! input
7199 <!-- <statictag>hello, world</statictag> -->
7200 <statictag action=flush/>
7201 !! result
7202 <p><br />
7203 </p>
7204 !! end
7205
7206 # Nested template calls; this case was broken by Parser.php rev 1.506,
7207 # since reverted.
7208
7209 !! article
7210 Template:One-parameter
7211 !! text
7212 (My parameter is: {{{1}}})
7213 !! endarticle
7214
7215 !! article
7216 Template:Map-one-parameter
7217 !! text
7218 {{{{{1}}}|{{{2}}}}}
7219 !! endarticle
7220
7221 !! test
7222 Nested template calls
7223 !! input
7224 {{Map-one-parameter|One-parameter|param}}
7225 !! result
7226 <p>(My parameter is: param)
7227 </p>
7228 !! end
7229
7230
7231 ###
7232 ### Sanitizer
7233 ###
7234 !! test
7235 Sanitizer: Closing of open tags
7236 !! input
7237 <s></s><table></table>
7238 !! result
7239 <s></s><table></table>
7240
7241 !! end
7242
7243 !! test
7244 Sanitizer: Closing of open but not closed tags
7245 !! input
7246 <s>foo
7247 !! result
7248 <p><s>foo</s>
7249 </p>
7250 !! end
7251
7252 !! test
7253 Sanitizer: Closing of closed but not open tags
7254 !! input
7255 </s>
7256 !! result
7257 <p>&lt;/s&gt;
7258 </p>
7259 !! end
7260
7261 !! test
7262 Sanitizer: Closing of closed but not open table tags
7263 !! input
7264 Table not started</td></tr></table>
7265 !! result
7266 <p>Table not started&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
7267 </p>
7268 !! end
7269
7270 !! test
7271 Sanitizer: Escaping of spaces, multibyte characters, colons & other stuff in id=""
7272 !! input
7273 <span id="æ: v">byte</span>[[#æ: v|backlink]]
7274 !! result
7275 <p><span id=".C3.A6:_v">byte</span><a href="#.C3.A6:_v">backlink</a>
7276 </p>
7277 !! end
7278
7279 !! test
7280 Sanitizer: Validating the contents of the id attribute (bug 4515)
7281 !! options
7282 disabled
7283 !! input
7284 <br id=9 />
7285 !! result
7286 Something, but definitely not <br id="9" />...
7287 !! end
7288
7289 !! test
7290 Sanitizer: Validating id attribute uniqueness (bug 4515, bug 6301)
7291 !! options
7292 disabled
7293 !! input
7294 <br id="foo" /><br id="foo" />
7295 !! result
7296 Something need to be done. foo-2 ?
7297 !! end
7298
7299 !! test
7300 Language converter: output gets cut off unexpectedly (bug 5757)
7301 !! options
7302 language=zh
7303 !! input
7304 this bit is safe: }-
7305
7306 but if we add a conversion instance: -{zh-cn:xxx;zh-tw:yyy}-
7307
7308 then we get cut off here: }-
7309
7310 all additional text is vanished
7311 !! result
7312 <p>this bit is safe: }-
7313 </p><p>but if we add a conversion instance: xxx
7314 </p><p>then we get cut off here: }-
7315 </p><p>all additional text is vanished
7316 </p>
7317 !! end
7318
7319 !! test
7320 Self closed html pairs (bug 5487)
7321 !! options
7322 !! input
7323 <center><font id="bug" />Centered text</center>
7324 <div><font id="bug2" />In div text</div>
7325 !! result
7326 <center>&lt;font id="bug" /&gt;Centered text</center>
7327 <div>&lt;font id="bug2" /&gt;In div text</div>
7328
7329 !! end
7330
7331 #
7332 #
7333 #
7334
7335 !! test
7336 Punctuation: nbsp before exclamation
7337 !! input
7338 C'est grave !
7339 !! result
7340 <p>C'est grave&#160;!
7341 </p>
7342 !! end
7343
7344 !! test
7345 Punctuation: CSS !important (bug 11874)
7346 !! input
7347 <div style="width:50% !important">important</div>
7348 !! result
7349 <div style="width:50% !important">important</div>
7350
7351 !!end
7352
7353 !! test
7354 Punctuation: CSS ! important (bug 11874; with space after)
7355 !! input
7356 <div style="width:50% ! important">important</div>
7357 !! result
7358 <div style="width:50% ! important">important</div>
7359
7360 !!end
7361
7362
7363 !! test
7364 HTML bullet list, closed tags (bug 5497)
7365 !! input
7366 <ul>
7367 <li>One</li>
7368 <li>Two</li>
7369 </ul>
7370 !! result
7371 <ul>
7372 <li>One</li>
7373 <li>Two</li>
7374 </ul>
7375
7376 !! end
7377
7378 !! test
7379 HTML bullet list, unclosed tags (bug 5497)
7380 !! options
7381 disabled
7382 !! input
7383 <ul>
7384 <li>One
7385 <li>Two
7386 </ul>
7387 !! result
7388 <ul>
7389 <li>One
7390 </li><li>Two
7391 </li></ul>
7392
7393 !! end
7394
7395 !! test
7396 HTML ordered list, closed tags (bug 5497)
7397 !! input
7398 <ol>
7399 <li>One</li>
7400 <li>Two</li>
7401 </ol>
7402 !! result
7403 <ol>
7404 <li>One</li>
7405 <li>Two</li>
7406 </ol>
7407
7408 !! end
7409
7410 !! test
7411 HTML ordered list, unclosed tags (bug 5497)
7412 !! options
7413 disabled
7414 !! input
7415 <ol>
7416 <li>One
7417 <li>Two
7418 </ol>
7419 !! result
7420 <ol>
7421 <li>One
7422 </li><li>Two
7423 </li></ol>
7424
7425 !! end
7426
7427 !! test
7428 HTML nested bullet list, closed tags (bug 5497)
7429 !! input
7430 <ul>
7431 <li>One</li>
7432 <li>Two:
7433 <ul>
7434 <li>Sub-one</li>
7435 <li>Sub-two</li>
7436 </ul>
7437 </li>
7438 </ul>
7439 !! result
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
7450 !! end
7451
7452 !! test
7453 HTML nested bullet list, open tags (bug 5497)
7454 !! options
7455 disabled
7456 !! input
7457 <ul>
7458 <li>One
7459 <li>Two:
7460 <ul>
7461 <li>Sub-one
7462 <li>Sub-two
7463 </ul>
7464 </ul>
7465 !! result
7466 <ul>
7467 <li>One
7468 </li><li>Two:
7469 <ul>
7470 <li>Sub-one
7471 </li><li>Sub-two
7472 </li></ul>
7473 </li></ul>
7474
7475 !! end
7476
7477 !! test
7478 HTML nested ordered list, closed tags (bug 5497)
7479 !! input
7480 <ol>
7481 <li>One</li>
7482 <li>Two:
7483 <ol>
7484 <li>Sub-one</li>
7485 <li>Sub-two</li>
7486 </ol>
7487 </li>
7488 </ol>
7489 !! result
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
7500 !! end
7501
7502 !! test
7503 HTML nested ordered list, open tags (bug 5497)
7504 !! options
7505 disabled
7506 !! input
7507 <ol>
7508 <li>One
7509 <li>Two:
7510 <ol>
7511 <li>Sub-one
7512 <li>Sub-two
7513 </ol>
7514 </ol>
7515 !! result
7516 <ol>
7517 <li>One
7518 </li><li>Two:
7519 <ol>
7520 <li>Sub-one
7521 </li><li>Sub-two
7522 </li></ol>
7523 </li></ol>
7524
7525 !! end
7526
7527 !! test
7528 HTML ordered list item with parameters oddity
7529 !! input
7530 <ol><li id="fragment">One</li></ol>
7531 !! result
7532 <ol><li id="fragment">One</li></ol>
7533
7534 !! end
7535
7536 !!test
7537 bug 5918: autonumbering
7538 !! input
7539 [http://first/] [http://second] [ftp://ftp]
7540
7541 ftp://inlineftp
7542
7543 [mailto:enclosed@mail.tld With target]
7544
7545 [mailto:enclosed@mail.tld]
7546
7547 mailto:inline@mail.tld
7548 !! result
7549 <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>
7550 </p><p><a rel="nofollow" class="external free" href="ftp://inlineftp">ftp://inlineftp</a>
7551 </p><p><a rel="nofollow" class="external text" href="mailto:enclosed@mail.tld">With target</a>
7552 </p><p><a rel="nofollow" class="external autonumber" href="mailto:enclosed@mail.tld">[4]</a>
7553 </p><p><a rel="nofollow" class="external free" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a>
7554 </p>
7555 !! end
7556
7557
7558 #
7559 # Security and HTML correctness
7560 # From Nick Jenkins' fuzz testing
7561 #
7562
7563 !! test
7564 Fuzz testing: Parser13
7565 !! input
7566 {|
7567 | http://a|
7568 !! result
7569 <table>
7570 <tr>
7571 <td>
7572 </td>
7573 </tr>
7574 </table>
7575
7576 !! end
7577
7578 !! test
7579 Fuzz testing: Parser14
7580 !! input
7581 == onmouseover= ==
7582 http://__TOC__
7583 !! result
7584 <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>
7585 http://<table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
7586 <ul>
7587 <li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
7588 </ul>
7589 </td></tr></table>
7590
7591 !! end
7592
7593 !! test
7594 Fuzz testing: Parser14-table
7595 !! input
7596 ==a==
7597 {| STYLE=__TOC__
7598 !! result
7599 <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>
7600 <table style="&#95;_TOC&#95;_">
7601 <tr><td></td></tr>
7602 </table>
7603
7604 !! end
7605
7606 # Known to produce bogus xml (extra </td>)
7607 !! test
7608 Fuzz testing: Parser16
7609 !! options
7610 noxml
7611 !! input
7612 {|
7613 !https://||||||
7614 !! result
7615 <table>
7616 <tr>
7617 <th>https://</th>
7618 <th></th>
7619 <th></th>
7620 <th>
7621 </td>
7622 </tr>
7623 </table>
7624
7625 !! end
7626
7627 !! test
7628 Fuzz testing: Parser21
7629 !! input
7630 {|
7631 ! irc://{{ftp://a" onmouseover="alert('hello world');"
7632 |
7633 !! result
7634 <table>
7635 <tr>
7636 <th> <a rel="nofollow" class="external free" href="irc://{{ftp://a">irc://{{ftp://a</a>" onmouseover="alert('hello world');"
7637 </th>
7638 <td>
7639 </td>
7640 </tr>
7641 </table>
7642
7643 !! end
7644
7645 !! test
7646 Fuzz testing: Parser22
7647 !! input
7648 http://===r:::https://b
7649
7650 {|
7651 !!result
7652 <p><a rel="nofollow" class="external free" href="http://===r:::https://b">http://===r:::https://b</a>
7653 </p>
7654 <table>
7655 <tr><td></td></tr>
7656 </table>
7657
7658 !! end
7659
7660 # Known to produce bad XML for now
7661 !! test
7662 Fuzz testing: Parser24
7663 !! options
7664 noxml
7665 !! input
7666 {|
7667 {{{|
7668 <u CLASS=
7669 | {{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx--><noinclude>}}}} >
7670 <br style="onmouseover='alert(document.cookie);' " />
7671
7672 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
7673 |
7674 !! result
7675 <table>
7676 {{{|
7677 <u class="&#124;">}}}} &gt;
7678 <br style="onmouseover=&#39;alert(document.cookie);&#39;" />
7679
7680 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
7681 <tr>
7682 <td></u>
7683 </td>
7684 </tr>
7685 </table>
7686
7687 !! end
7688
7689 # Note: the current result listed for this is not what the original one was,
7690 # but the original bug was JavaScript injection, which is fixed in any case.
7691 # It's not clear that the original result listed was any more correct than the
7692 # current one. Original result:
7693 # <p>{{{|
7694 # </p>
7695 # <li class="&#124;&#124;">
7696 # }}}blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
7697 !!test
7698 Fuzz testing: Parser25 (bug 6055)
7699 !! input
7700 {{{
7701 |
7702 <LI CLASS=||
7703 >
7704 }}}blah" onmouseover="alert('hello world');" align="left"'''MOVE MOUSE CURSOR OVER HERE
7705 !! result
7706 <p>&lt;LI CLASS=blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
7707 </p>
7708 !! end
7709
7710 !!test
7711 Fuzz testing: URL adjacent extension (with space, clean)
7712 !! options
7713 !! input
7714 http://example.com <nowiki>junk</nowiki>
7715 !! result
7716 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a> junk
7717 </p>
7718 !!end
7719
7720 !!test
7721 Fuzz testing: URL adjacent extension (no space, dirty; nowiki)
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; pre)
7732 !! options
7733 !! input
7734 http://example.com<pre>junk</pre>
7735 !! result
7736 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a><pre>junk</pre>
7737
7738 !!end
7739
7740 !!test
7741 Fuzz testing: image with bogus manual thumbnail
7742 !!input
7743 [[Image:foobar.jpg|thumbnail= ]]
7744 !!result
7745 <div class="thumb tright"><div class="thumbinner" style="width:1943px;">Error creating thumbnail: <div class="thumbcaption"></div></div></div>
7746
7747 !!end
7748
7749 !! test
7750 Fuzz testing: encoded newline in generated HTML replacements (bug 6577)
7751 !! input
7752 <pre dir="&#10;"></pre>
7753 !! result
7754 <pre dir="&#10;"></pre>
7755
7756 !! end
7757
7758 !! test
7759 Parsing optional HTML elements (Bug 6171)
7760 !! options
7761 !! input
7762 <table>
7763 <tr>
7764 <td> Some tabular data</td>
7765 <td> More tabular data ...
7766 <td> And yet som tabular data</td>
7767 </tr>
7768 </table>
7769 !! result
7770 <table>
7771 <tr>
7772 <td> Some tabular data</td>
7773 <td> More tabular data ...
7774 </td><td> And yet som tabular data</td>
7775 </tr>
7776 </table>
7777
7778 !! end
7779
7780 !! test
7781 Correct handling of <td>, <tr> (Bug 6171)
7782 !! options
7783 !! input
7784 <table>
7785 <tr>
7786 <td> Some tabular data</td>
7787 <td> More tabular data ...</td>
7788 <td> And yet som tabular data</td>
7789 </tr>
7790 </table>
7791 !! result
7792 <table>
7793 <tr>
7794 <td> Some tabular data</td>
7795 <td> More tabular data ...</td>
7796 <td> And yet som tabular data</td>
7797 </tr>
7798 </table>
7799
7800 !! end
7801
7802
7803 !! test
7804 Parsing crashing regression (fr:JavaScript)
7805 !! input
7806 </body></x>
7807 !! result
7808 <p>&lt;/body&gt;&lt;/x&gt;
7809 </p>
7810 !! end
7811
7812 !! test
7813 Inline wiki vs wiki block nesting
7814 !! input
7815 '''Bold paragraph
7816
7817 New wiki paragraph
7818 !! result
7819 <p><b>Bold paragraph</b>
7820 </p><p>New wiki paragraph
7821 </p>
7822 !! end
7823
7824 !! test
7825 Inline HTML vs wiki block nesting
7826 !! options
7827 disabled
7828 !! input
7829 <b>Bold paragraph
7830
7831 New wiki paragraph
7832 !! result
7833 <p><b>Bold paragraph</b>
7834 </p><p>New wiki paragraph
7835 </p>
7836 !! end
7837
7838 # Original result was this:
7839 # <p><b>bold</b><b>bold<i>bolditalics</i></b>
7840 # </p>
7841 # While that might be marginally more intuitive, maybe, the six-apostrophe
7842 # construct is clearly pathological and the result stated here (which is what
7843 # the parser actually does) is about as reasonable as anything.
7844 !!test
7845 Mixing markup for italics and bold
7846 !! options
7847 !! input
7848 '''bold''''''bold''bolditalics'''''
7849 !! result
7850 <p>'<i>bold'</i><b>bold<i>bolditalics</i></b>
7851 </p>
7852 !! end
7853
7854
7855 !! article
7856 Xyzzyx
7857 !! text
7858 Article for special page transclusion test
7859 !! endarticle
7860
7861 !! test
7862 Special page transclusion
7863 !! options
7864 !! input
7865 {{Special:Prefixindex/Xyzzyx}}
7866 !! result
7867 <table id="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
7868
7869 !! end
7870
7871 !! test
7872 Special page transclusion twice (bug 5021)
7873 !! options
7874 !! input
7875 {{Special:Prefixindex/Xyzzyx}}
7876 {{Special:Prefixindex/Xyzzyx}}
7877 !! result
7878 <table id="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
7879 <table id="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
7880
7881 !! end
7882
7883 !! test
7884 Transclusion of default MediaWiki message
7885 !! input
7886 {{MediaWiki:Mainpage}}
7887 !!result
7888 <p>Main Page
7889 </p>
7890 !! end
7891
7892 !! test
7893 Transclusion of nonexistent MediaWiki message
7894 !! input
7895 {{MediaWiki:Mainpagexxx}}
7896 !!result
7897 <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>
7898 </p>
7899 !! end
7900
7901 !! test
7902 Transclusion of MediaWiki message with underscore
7903 !! input
7904 {{MediaWiki:history_short}}
7905 !! result
7906 <p>History
7907 </p>
7908 !! end
7909
7910 !! test
7911 Transclusion of MediaWiki message with space
7912 !! input
7913 {{MediaWiki:history short}}
7914 !! result
7915 <p>History
7916 </p>
7917 !! end
7918
7919 !! test
7920 Invalid header with following text
7921 !! input
7922 = x = y
7923 !! result
7924 <p>= x = y
7925 </p>
7926 !! end
7927
7928
7929 !! test
7930 Section extraction test (section 0)
7931 !! options
7932 section=0
7933 !! input
7934 start
7935 ==a==
7936 ===aa===
7937 ====aaa====
7938 ==b==
7939 ===ba===
7940 ===bb===
7941 ====bba====
7942 ===bc===
7943 ==c==
7944 ===ca===
7945 !! result
7946 start
7947 !! end
7948
7949 !! test
7950 Section extraction test (section 1)
7951 !! options
7952 section=1
7953 !! input
7954 start
7955 ==a==
7956 ===aa===
7957 ====aaa====
7958 ==b==
7959 ===ba===
7960 ===bb===
7961 ====bba====
7962 ===bc===
7963 ==c==
7964 ===ca===
7965 !! result
7966 ==a==
7967 ===aa===
7968 ====aaa====
7969 !! end
7970
7971 !! test
7972 Section extraction test (section 2)
7973 !! options
7974 section=2
7975 !! input
7976 start
7977 ==a==
7978 ===aa===
7979 ====aaa====
7980 ==b==
7981 ===ba===
7982 ===bb===
7983 ====bba====
7984 ===bc===
7985 ==c==
7986 ===ca===
7987 !! result
7988 ===aa===
7989 ====aaa====
7990 !! end
7991
7992 !! test
7993 Section extraction test (section 3)
7994 !! options
7995 section=3
7996 !! input
7997 start
7998 ==a==
7999 ===aa===
8000 ====aaa====
8001 ==b==
8002 ===ba===
8003 ===bb===
8004 ====bba====
8005 ===bc===
8006 ==c==
8007 ===ca===
8008 !! result
8009 ====aaa====
8010 !! end
8011
8012 !! test
8013 Section extraction test (section 4)
8014 !! options
8015 section=4
8016 !! input
8017 start
8018 ==a==
8019 ===aa===
8020 ====aaa====
8021 ==b==
8022 ===ba===
8023 ===bb===
8024 ====bba====
8025 ===bc===
8026 ==c==
8027 ===ca===
8028 !! result
8029 ==b==
8030 ===ba===
8031 ===bb===
8032 ====bba====
8033 ===bc===
8034 !! end
8035
8036 !! test
8037 Section extraction test (section 5)
8038 !! options
8039 section=5
8040 !! input
8041 start
8042 ==a==
8043 ===aa===
8044 ====aaa====
8045 ==b==
8046 ===ba===
8047 ===bb===
8048 ====bba====
8049 ===bc===
8050 ==c==
8051 ===ca===
8052 !! result
8053 ===ba===
8054 !! end
8055
8056 !! test
8057 Section extraction test (section 6)
8058 !! options
8059 section=6
8060 !! input
8061 start
8062 ==a==
8063 ===aa===
8064 ====aaa====
8065 ==b==
8066 ===ba===
8067 ===bb===
8068 ====bba====
8069 ===bc===
8070 ==c==
8071 ===ca===
8072 !! result
8073 ===bb===
8074 ====bba====
8075 !! end
8076
8077 !! test
8078 Section extraction test (section 7)
8079 !! options
8080 section=7
8081 !! input
8082 start
8083 ==a==
8084 ===aa===
8085 ====aaa====
8086 ==b==
8087 ===ba===
8088 ===bb===
8089 ====bba====
8090 ===bc===
8091 ==c==
8092 ===ca===
8093 !! result
8094 ====bba====
8095 !! end
8096
8097 !! test
8098 Section extraction test (section 8)
8099 !! options
8100 section=8
8101 !! input
8102 start
8103 ==a==
8104 ===aa===
8105 ====aaa====
8106 ==b==
8107 ===ba===
8108 ===bb===
8109 ====bba====
8110 ===bc===
8111 ==c==
8112 ===ca===
8113 !! result
8114 ===bc===
8115 !! end
8116
8117 !! test
8118 Section extraction test (section 9)
8119 !! options
8120 section=9
8121 !! input
8122 start
8123 ==a==
8124 ===aa===
8125 ====aaa====
8126 ==b==
8127 ===ba===
8128 ===bb===
8129 ====bba====
8130 ===bc===
8131 ==c==
8132 ===ca===
8133 !! result
8134 ==c==
8135 ===ca===
8136 !! end
8137
8138 !! test
8139 Section extraction test (section 10)
8140 !! options
8141 section=10
8142 !! input
8143 start
8144 ==a==
8145 ===aa===
8146 ====aaa====
8147 ==b==
8148 ===ba===
8149 ===bb===
8150 ====bba====
8151 ===bc===
8152 ==c==
8153 ===ca===
8154 !! result
8155 ===ca===
8156 !! end
8157
8158 !! test
8159 Section extraction test (nonexistent section 11)
8160 !! options
8161 section=11
8162 !! input
8163 start
8164 ==a==
8165 ===aa===
8166 ====aaa====
8167 ==b==
8168 ===ba===
8169 ===bb===
8170 ====bba====
8171 ===bc===
8172 ==c==
8173 ===ca===
8174 !! result
8175 !! end
8176
8177 !! test
8178 Section extraction test with bogus heading (section 1)
8179 !! options
8180 section=1
8181 !! input
8182 ==a==
8183 ==bogus== not a legal section
8184 ==b==
8185 !! result
8186 ==a==
8187 ==bogus== not a legal section
8188 !! end
8189
8190 !! test
8191 Section extraction test with bogus heading (section 2)
8192 !! options
8193 section=2
8194 !! input
8195 ==a==
8196 ==bogus== not a legal section
8197 ==b==
8198 !! result
8199 ==b==
8200 !! end
8201
8202 !! test
8203 Section extraction test with comment after heading (section 1)
8204 !! options
8205 section=1
8206 !! input
8207 ==a==
8208 ==b== <!-- -->
8209 ==c==
8210 !! result
8211 ==a==
8212 !! end
8213
8214 !! test
8215 Section extraction test with comment after heading (section 2)
8216 !! options
8217 section=2
8218 !! input
8219 ==a==
8220 ==b== <!-- -->
8221 ==c==
8222 !! result
8223 ==b== <!-- -->
8224 !! end
8225
8226 !! test
8227 Section extraction test with bogus <nowiki> heading (section 1)
8228 !! options
8229 section=1
8230 !! input
8231 ==a==
8232 ==bogus== <nowiki>not a legal section</nowiki>
8233 ==b==
8234 !! result
8235 ==a==
8236 ==bogus== <nowiki>not a legal section</nowiki>
8237 !! end
8238
8239 !! test
8240 Section extraction test with bogus <nowiki> heading (section 2)
8241 !! options
8242 section=2
8243 !! input
8244 ==a==
8245 ==bogus== <nowiki>not a legal section</nowiki>
8246 ==b==
8247 !! result
8248 ==b==
8249 !! end
8250
8251
8252 # Formerly testing for bug 2587, now resolved by the use of unmarked sections
8253 # instead of respecting commented sections
8254 !! test
8255 Section extraction prefixed by comment (section 1)
8256 !! options
8257 section=1
8258 !! input
8259 <!-- -->==sec1==
8260 ==sec2==
8261 !!result
8262 ==sec2==
8263 !!end
8264
8265 !! test
8266 Section extraction prefixed by comment (section 2)
8267 !! options
8268 section=2
8269 !! input
8270 <!-- -->==sec1==
8271 ==sec2==
8272 !!result
8273
8274 !!end
8275
8276
8277 # Formerly testing for bug 2607, now resolved by the use of unmarked sections
8278 # instead of respecting HTML-style headings
8279 !! test
8280 Section extraction, mixed wiki and html (section 1)
8281 !! options
8282 section=1
8283 !! input
8284 <h2>unmarked</h2>
8285 unmarked
8286 ==1==
8287 one
8288 ==2==
8289 two
8290 !! result
8291 ==1==
8292 one
8293 !! end
8294
8295 !! test
8296 Section extraction, mixed wiki and html (section 2)
8297 !! options
8298 section=2
8299 !! input
8300 <h2>unmarked</h2>
8301 unmarked
8302 ==1==
8303 one
8304 ==2==
8305 two
8306 !! result
8307 ==2==
8308 two
8309 !! end
8310
8311
8312 # Formerly testing for bug 3342
8313 !! test
8314 Section extraction, heading surrounded by <noinclude>
8315 !! options
8316 section=1
8317 !! input
8318 <noinclude>==unmarked==</noinclude>
8319 ==marked==
8320 !! result
8321 ==marked==
8322 !!end
8323
8324 # Test behaviour of bug 19910
8325 !! test
8326 Sectiion with all-equals
8327 !! options
8328 section=2
8329 !! input
8330 ===
8331 The line above must have a trailing space
8332 === <!--
8333 --> <!-- -->
8334 But just in case it doesn't...
8335 !! result
8336 === <!--
8337 --> <!-- -->
8338 But just in case it doesn't...
8339 !! end
8340
8341 !! test
8342 Section replacement test (section 0)
8343 !! options
8344 replace=0,"xxx"
8345 !! input
8346 start
8347 ==a==
8348 ===aa===
8349 ====aaa====
8350 ==b==
8351 ===ba===
8352 ===bb===
8353 ====bba====
8354 ===bc===
8355 ==c==
8356 ===ca===
8357 !! result
8358 xxx
8359
8360 ==a==
8361 ===aa===
8362 ====aaa====
8363 ==b==
8364 ===ba===
8365 ===bb===
8366 ====bba====
8367 ===bc===
8368 ==c==
8369 ===ca===
8370 !! end
8371
8372 !! test
8373 Section replacement test (section 1)
8374 !! options
8375 replace=1,"xxx"
8376 !! input
8377 start
8378 ==a==
8379 ===aa===
8380 ====aaa====
8381 ==b==
8382 ===ba===
8383 ===bb===
8384 ====bba====
8385 ===bc===
8386 ==c==
8387 ===ca===
8388 !! result
8389 start
8390 xxx
8391
8392 ==b==
8393 ===ba===
8394 ===bb===
8395 ====bba====
8396 ===bc===
8397 ==c==
8398 ===ca===
8399 !! end
8400
8401 !! test
8402 Section replacement test (section 2)
8403 !! options
8404 replace=2,"xxx"
8405 !! input
8406 start
8407 ==a==
8408 ===aa===
8409 ====aaa====
8410 ==b==
8411 ===ba===
8412 ===bb===
8413 ====bba====
8414 ===bc===
8415 ==c==
8416 ===ca===
8417 !! result
8418 start
8419 ==a==
8420 xxx
8421
8422 ==b==
8423 ===ba===
8424 ===bb===
8425 ====bba====
8426 ===bc===
8427 ==c==
8428 ===ca===
8429 !! end
8430
8431 !! test
8432 Section replacement test (section 3)
8433 !! options
8434 replace=3,"xxx"
8435 !! input
8436 start
8437 ==a==
8438 ===aa===
8439 ====aaa====
8440 ==b==
8441 ===ba===
8442 ===bb===
8443 ====bba====
8444 ===bc===
8445 ==c==
8446 ===ca===
8447 !! result
8448 start
8449 ==a==
8450 ===aa===
8451 xxx
8452
8453 ==b==
8454 ===ba===
8455 ===bb===
8456 ====bba====
8457 ===bc===
8458 ==c==
8459 ===ca===
8460 !! end
8461
8462 !! test
8463 Section replacement test (section 4)
8464 !! options
8465 replace=4,"xxx"
8466 !! input
8467 start
8468 ==a==
8469 ===aa===
8470 ====aaa====
8471 ==b==
8472 ===ba===
8473 ===bb===
8474 ====bba====
8475 ===bc===
8476 ==c==
8477 ===ca===
8478 !! result
8479 start
8480 ==a==
8481 ===aa===
8482 ====aaa====
8483 xxx
8484
8485 ==c==
8486 ===ca===
8487 !! end
8488
8489 !! test
8490 Section replacement test (section 5)
8491 !! options
8492 replace=5,"xxx"
8493 !! input
8494 start
8495 ==a==
8496 ===aa===
8497 ====aaa====
8498 ==b==
8499 ===ba===
8500 ===bb===
8501 ====bba====
8502 ===bc===
8503 ==c==
8504 ===ca===
8505 !! result
8506 start
8507 ==a==
8508 ===aa===
8509 ====aaa====
8510 ==b==
8511 xxx
8512
8513 ===bb===
8514 ====bba====
8515 ===bc===
8516 ==c==
8517 ===ca===
8518 !! end
8519
8520 !! test
8521 Section replacement test (section 6)
8522 !! options
8523 replace=6,"xxx"
8524 !! input
8525 start
8526 ==a==
8527 ===aa===
8528 ====aaa====
8529 ==b==
8530 ===ba===
8531 ===bb===
8532 ====bba====
8533 ===bc===
8534 ==c==
8535 ===ca===
8536 !! result
8537 start
8538 ==a==
8539 ===aa===
8540 ====aaa====
8541 ==b==
8542 ===ba===
8543 xxx
8544
8545 ===bc===
8546 ==c==
8547 ===ca===
8548 !! end
8549
8550 !! test
8551 Section replacement test (section 7)
8552 !! options
8553 replace=7,"xxx"
8554 !! input
8555 start
8556 ==a==
8557 ===aa===
8558 ====aaa====
8559 ==b==
8560 ===ba===
8561 ===bb===
8562 ====bba====
8563 ===bc===
8564 ==c==
8565 ===ca===
8566 !! result
8567 start
8568 ==a==
8569 ===aa===
8570 ====aaa====
8571 ==b==
8572 ===ba===
8573 ===bb===
8574 xxx
8575
8576 ===bc===
8577 ==c==
8578 ===ca===
8579 !! end
8580
8581 !! test
8582 Section replacement test (section 8)
8583 !! options
8584 replace=8,"xxx"
8585 !! input
8586 start
8587 ==a==
8588 ===aa===
8589 ====aaa====
8590 ==b==
8591 ===ba===
8592 ===bb===
8593 ====bba====
8594 ===bc===
8595 ==c==
8596 ===ca===
8597 !! result
8598 start
8599 ==a==
8600 ===aa===
8601 ====aaa====
8602 ==b==
8603 ===ba===
8604 ===bb===
8605 ====bba====
8606 xxx
8607
8608 ==c==
8609 ===ca===
8610 !!end
8611
8612 !! test
8613 Section replacement test (section 9)
8614 !! options
8615 replace=9,"xxx"
8616 !! input
8617 start
8618 ==a==
8619 ===aa===
8620 ====aaa====
8621 ==b==
8622 ===ba===
8623 ===bb===
8624 ====bba====
8625 ===bc===
8626 ==c==
8627 ===ca===
8628 !! result
8629 start
8630 ==a==
8631 ===aa===
8632 ====aaa====
8633 ==b==
8634 ===ba===
8635 ===bb===
8636 ====bba====
8637 ===bc===
8638 xxx
8639 !! end
8640
8641 !! test
8642 Section replacement test (section 10)
8643 !! options
8644 replace=10,"xxx"
8645 !! input
8646 start
8647 ==a==
8648 ===aa===
8649 ====aaa====
8650 ==b==
8651 ===ba===
8652 ===bb===
8653 ====bba====
8654 ===bc===
8655 ==c==
8656 ===ca===
8657 !! result
8658 start
8659 ==a==
8660 ===aa===
8661 ====aaa====
8662 ==b==
8663 ===ba===
8664 ===bb===
8665 ====bba====
8666 ===bc===
8667 ==c==
8668 xxx
8669 !! end
8670
8671 !! test
8672 Section replacement test with initial whitespace (bug 13728)
8673 !! options
8674 replace=2,"xxx"
8675 !! input
8676 Preformatted initial line
8677 ==a==
8678 ===a===
8679 !! result
8680 Preformatted initial line
8681 ==a==
8682 xxx
8683 !! end
8684
8685
8686 !! test
8687 Section extraction, heading followed by pre with 20 spaces (bug 6398)
8688 !! options
8689 section=1
8690 !! input
8691 ==a==
8692 a
8693 !! result
8694 ==a==
8695 a
8696 !! end
8697
8698 !! test
8699 Section extraction, heading followed by pre with 19 spaces (bug 6398 sanity check)
8700 !! options
8701 section=1
8702 !! input
8703 ==a==
8704 a
8705 !! result
8706 ==a==
8707 a
8708 !! end
8709
8710
8711 !! test
8712 Section extraction, <pre> around bogus header (bug 10309)
8713 !! options
8714 noxml section=2
8715 !! input
8716 == Section One ==
8717 <pre>
8718 =======
8719 </pre>
8720
8721 == Section Two ==
8722 stuff
8723 !! result
8724 == Section Two ==
8725 stuff
8726 !! end
8727
8728 !! test
8729 Section replacement, <pre> around bogus header (bug 10309)
8730 !! options
8731 noxml replace=2,"xxx"
8732 !! input
8733 == Section One ==
8734 <pre>
8735 =======
8736 </pre>
8737
8738 == Section Two ==
8739 stuff
8740 !! result
8741 == Section One ==
8742 <pre>
8743 =======
8744 </pre>
8745
8746 xxx
8747 !! end
8748
8749
8750
8751 !! test
8752 Handling of &#x0A; in URLs
8753 !! input
8754 **irc://&#x0A;a
8755 !! result
8756 <ul><li><ul><li><a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a>
8757 </li></ul>
8758 </li></ul>
8759
8760 !!end
8761
8762 !! test
8763 5 quotes, code coverage +1 line
8764 !! input
8765 '''''
8766 !! result
8767 !! end
8768
8769 !! test
8770 Special:Search page linking.
8771 !! input
8772 {{Special:search}}
8773 !! result
8774 <p><a href="/wiki/Special:Search" title="Special:Search">Special:Search</a>
8775 </p>
8776 !! end
8777
8778 !! test
8779 Say the magic word
8780 !! input
8781 * {{PAGENAME}}
8782 * {{BASEPAGENAME}}
8783 * {{SUBPAGENAME}}
8784 * {{SUBPAGENAMEE}}
8785 * {{BASEPAGENAME}}
8786 * {{BASEPAGENAMEE}}
8787 * {{TALKPAGENAME}}
8788 * {{TALKPAGENAMEE}}
8789 * {{SUBJECTPAGENAME}}
8790 * {{SUBJECTPAGENAMEE}}
8791 * {{NAMESPACEE}}
8792 * {{NAMESPACE}}
8793 * {{TALKSPACE}}
8794 * {{TALKSPACEE}}
8795 * {{SUBJECTSPACE}}
8796 * {{SUBJECTSPACEE}}
8797 * {{Dynamic|{{NUMBEROFUSERS}}|{{NUMBEROFPAGES}}|{{CURRENTVERSION}}|{{CONTENTLANGUAGE}}|{{DIRECTIONMARK}}|{{CURRENTTIMESTAMP}}|{{NUMBEROFARTICLES}}}}
8798 !! result
8799 <ul><li> Parser test
8800 </li><li> Parser test
8801 </li><li> Parser test
8802 </li><li> Parser_test
8803 </li><li> Parser test
8804 </li><li> Parser_test
8805 </li><li> Talk:Parser test
8806 </li><li> Talk:Parser_test
8807 </li><li> Parser test
8808 </li><li> Parser_test
8809 </li><li>
8810 </li><li>
8811 </li><li> Talk
8812 </li><li> Talk
8813 </li><li>
8814 </li><li>
8815 </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>
8816 </li></ul>
8817
8818 !! end
8819 ### Note: Above tests excludes the "{{NUMBEROFADMINS}}" magic word because it generates a MySQL error when included.
8820
8821 !! test
8822 Gallery
8823 !! input
8824 <gallery>
8825 image1.png |
8826 image2.gif|||||
8827
8828 image3|
8829 image4 |300px| centre
8830 image5.svg| http://///////
8831 [[x|xx]]]]
8832 * image6
8833 </gallery>
8834 !! result
8835 <ul class="gallery">
8836 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
8837 <div style="height: 150px;">Image1.png</div>
8838 <div class="gallerytext">
8839 </div>
8840 </div></li>
8841 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
8842 <div style="height: 150px;">Image2.gif</div>
8843 <div class="gallerytext">
8844 <p>||||
8845 </p>
8846 </div>
8847 </div></li>
8848 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
8849 <div style="height: 150px;">Image3</div>
8850 <div class="gallerytext">
8851 </div>
8852 </div></li>
8853 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
8854 <div style="height: 150px;">Image4</div>
8855 <div class="gallerytext">
8856 <p>300px| centre
8857 </p>
8858 </div>
8859 </div></li>
8860 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
8861 <div style="height: 150px;">Image5.svg</div>
8862 <div class="gallerytext">
8863 <p><a rel="nofollow" class="external free" href="http://///////">http://///////</a>
8864 </p>
8865 </div>
8866 </div></li>
8867 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
8868 <div style="height: 150px;">* image6</div>
8869 <div class="gallerytext">
8870 </div>
8871 </div></li>
8872 </ul>
8873
8874 !! end
8875
8876 !! test
8877 Gallery (with options)
8878 !! input
8879 <gallery widths='70px' heights='40px' perrow='2' caption='Foo [[Main Page]]' >
8880 File:Nonexistant.jpg|caption
8881 File:Nonexistant.jpg
8882 image:foobar.jpg|some '''caption''' [[Main Page]]
8883 image:foobar.jpg
8884 image:foobar.jpg|Blabla|alt=This is a foo-bar.|blabla.
8885 </gallery>
8886 !! result
8887 <ul class="gallery" style="max-width: 226px;_width: 226px;">
8888 <li class='gallerycaption'>Foo <a href="/wiki/Main_Page" title="Main Page">Main Page</a></li>
8889 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
8890 <div style="height: 70px;">Nonexistant.jpg</div>
8891 <div class="gallerytext">
8892 <p>caption
8893 </p>
8894 </div>
8895 </div></li>
8896 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
8897 <div style="height: 70px;">Nonexistant.jpg</div>
8898 <div class="gallerytext">
8899 </div>
8900 </div></li>
8901 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
8902 <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>
8903 <div class="gallerytext">
8904 <p>some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
8905 </p>
8906 </div>
8907 </div></li>
8908 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
8909 <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>
8910 <div class="gallerytext">
8911 </div>
8912 </div></li>
8913 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
8914 <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>
8915 <div class="gallerytext">
8916 <p>Blabla|blabla.
8917 </p>
8918 </div>
8919 </div></li>
8920 </ul>
8921
8922 !! end
8923
8924 !! test
8925 Gallery with wikitext inside caption
8926 !! input
8927 <gallery>
8928 File:foobar.jpg|[[File:foobar.jpg|20px|desc|alt=inneralt]]|alt=galleryalt
8929 File:foobar.jpg|{{Test|unamedParam|alt=param}}|alt=galleryalt
8930 </gallery>
8931 !! result
8932 <ul class="gallery">
8933 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
8934 <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>
8935 <div class="gallerytext">
8936 <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>
8937 </p>
8938 </div>
8939 </div></li>
8940 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
8941 <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>
8942 <div class="gallerytext">
8943 <p>This is a test template
8944 </p>
8945 </div>
8946 </div></li>
8947 </ul>
8948
8949 !! end
8950
8951 !! test
8952 gallery (with showfilename option)
8953 !! input
8954 <gallery showfilename>
8955 File:Nonexistant.jpg|caption
8956 File:Nonexistant.jpg
8957 image:foobar.jpg|some '''caption''' [[Main Page]]
8958 File:Foobar.jpg
8959 </gallery>
8960 !! result
8961 <ul class="gallery">
8962 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
8963 <div style="height: 150px;">Nonexistant.jpg</div>
8964 <div class="gallerytext">
8965 <p><a href="/wiki/File:Nonexistant.jpg" title="File:Nonexistant.jpg">Nonexistant.jpg</a><br />
8966 caption
8967 </p>
8968 </div>
8969 </div></li>
8970 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
8971 <div style="height: 150px;">Nonexistant.jpg</div>
8972 <div class="gallerytext">
8973 <p><a href="/wiki/File:Nonexistant.jpg" title="File:Nonexistant.jpg">Nonexistant.jpg</a><br />
8974 </p>
8975 </div>
8976 </div></li>
8977 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
8978 <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>
8979 <div class="gallerytext">
8980 <p><a href="/wiki/File:Foobar.jpg" title="File:Foobar.jpg">Foobar.jpg</a><br />
8981 some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
8982 </p>
8983 </div>
8984 </div></li>
8985 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
8986 <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>
8987 <div class="gallerytext">
8988 <p><a href="/wiki/File:Foobar.jpg" title="File:Foobar.jpg">Foobar.jpg</a><br />
8989 </p>
8990 </div>
8991 </div></li>
8992 </ul>
8993
8994 !! end
8995
8996 !! test
8997 Gallery (with namespace-less filenames)
8998 !! input
8999 <gallery>
9000 File:Nonexistant.jpg
9001 Nonexistant.jpg
9002 image:foobar.jpg
9003 foobar.jpg
9004 </gallery>
9005 !! result
9006 <ul class="gallery">
9007 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
9008 <div style="height: 150px;">Nonexistant.jpg</div>
9009 <div class="gallerytext">
9010 </div>
9011 </div></li>
9012 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
9013 <div style="height: 150px;">Nonexistant.jpg</div>
9014 <div class="gallerytext">
9015 </div>
9016 </div></li>
9017 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
9018 <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>
9019 <div class="gallerytext">
9020 </div>
9021 </div></li>
9022 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
9023 <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>
9024 <div class="gallerytext">
9025 </div>
9026 </div></li>
9027 </ul>
9028
9029 !! end
9030
9031 !! test
9032 HTML Hex character encoding (spells the word "JavaScript")
9033 !! input
9034 &#x4A;&#x061;&#x0076;&#x00061;&#x000053;&#x0000063;&#114;&#x0000069;&#00000112;&#x0000000074;
9035 !! result
9036 <p>&#x4a;&#x61;&#x76;&#x61;&#x53;&#x63;&#114;&#x69;&#112;&#x74;
9037 </p>
9038 !! end
9039
9040 !! test
9041 HTML Hex character encoding bogus encoding (bug 26437 regression check)
9042 !! input
9043 &#xsee;&#XSEE;
9044 !! result
9045 <p>&amp;#xsee;&amp;#XSEE;
9046 </p>
9047 !! end
9048
9049 !! test
9050 HTML Hex character encoding mixed case
9051 !! input
9052 &#xEE;&#Xee;
9053 !! result
9054 <p>&#xee;&#xee;
9055 </p>
9056 !! end
9057
9058 !! test
9059 __FORCETOC__ override
9060 !! input
9061 __NEWSECTIONLINK__
9062 __FORCETOC__
9063 !! result
9064 <p><br />
9065 </p>
9066 !! end
9067
9068 !! test
9069 ISBN code coverage
9070 !! input
9071 ISBN 978-0-1234-56&#x20;789
9072 !! result
9073 <p><a href="/wiki/Special:BookSources/9780123456" class="internal mw-magiclink-isbn">ISBN 978-0-1234-56</a>&#x20;789
9074 </p>
9075 !! end
9076
9077 !! test
9078 ISBN followed by 5 spaces
9079 !! input
9080 ISBN
9081 !! result
9082 <p>ISBN
9083 </p>
9084 !! end
9085
9086 !! test
9087 Double ISBN
9088 !! input
9089 ISBN ISBN 1234567890
9090 !! result
9091 <p>ISBN <a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
9092 </p>
9093 !! end
9094
9095 !! test
9096 Bug 22905: <abbr> followed by ISBN followed by </a>
9097 !! input
9098 <abbr>(fr)</abbr> ISBN 2753300917 [http://www.example.com example.com]
9099 !! result
9100 <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>
9101 </p>
9102 !! end
9103
9104 !! test
9105 Double RFC
9106 !! input
9107 RFC RFC 1234
9108 !! result
9109 <p>RFC <a class="external mw-magiclink-rfc" href="//tools.ietf.org/html/rfc1234">RFC 1234</a>
9110 </p>
9111 !! end
9112
9113 !! test
9114 Double RFC with a wiki link
9115 !! input
9116 RFC [[RFC 1234]]
9117 !! result
9118 <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>
9119 </p>
9120 !! end
9121
9122 !! test
9123 RFC code coverage
9124 !! input
9125 RFC 983&#x20;987
9126 !! result
9127 <p><a class="external mw-magiclink-rfc" href="//tools.ietf.org/html/rfc983">RFC 983</a>&#x20;987
9128 </p>
9129 !! end
9130
9131 !! test
9132 Centre-aligned image
9133 !! input
9134 [[Image:foobar.jpg|centre]]
9135 !! result
9136 <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>
9137
9138 !!end
9139
9140 !! test
9141 None-aligned image
9142 !! input
9143 [[Image:foobar.jpg|none]]
9144 !! result
9145 <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>
9146
9147 !!end
9148
9149 !! test
9150 Width + Height sized image (using px) (height is ignored)
9151 !! input
9152 [[Image:foobar.jpg|640x480px]]
9153 !! result
9154 <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>
9155 </p>
9156 !!end
9157
9158 !! test
9159 Width-sized image (using px, no following whitespace)
9160 !! input
9161 [[Image:foobar.jpg|640px]]
9162 !! result
9163 <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>
9164 </p>
9165 !!end
9166
9167 !! test
9168 Width-sized image (using px, with following whitespace - test regression from r39467)
9169 !! input
9170 [[Image:foobar.jpg|640px ]]
9171 !! result
9172 <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>
9173 </p>
9174 !!end
9175
9176 !! test
9177 Width-sized image (using px, with preceding whitespace - test regression from r39467)
9178 !! input
9179 [[Image:foobar.jpg| 640px]]
9180 !! result
9181 <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>
9182 </p>
9183 !!end
9184
9185 !! test
9186 Another italics / bold test
9187 !! input
9188 ''' ''x'
9189 !! result
9190 <pre>'<i> </i>x'
9191 </pre>
9192 !!end
9193
9194 # Note the results may be incorrect, as parserTest output included this:
9195 # XML error: Mismatched tag at byte 6120:
9196 # ...<dd> </dt></dl> </dd...
9197 !! test
9198 dt/dd/dl test
9199 !! options
9200 disabled
9201 !! input
9202 :;;;::
9203 !! result
9204 <dl><dd><dl><dt><dl><dt><dl><dt><dl><dd><dl><dd>
9205 </dd></dl>
9206 </dd></dl>
9207 </dt></dl>
9208 </dt></dl>
9209 </dt></dl>
9210 </dd></dl>
9211
9212 !!end
9213
9214
9215 # Images with the "|" character in external URLs in comment tags; Eats half the comment, leaves unmatched "</a>" tag.
9216 !! test
9217 Images with the "|" character in the comment
9218 !! input
9219 [[image:Foobar.jpg|thumb|An [http://test/?param1=|left|&param2=|x external] URL]]
9220 !! result
9221 <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>
9222
9223 !!end
9224
9225 !! test
9226 [Before] HTML without raw HTML enabled ($wgRawHtml==false)
9227 !! input
9228 <html><script>alert(1);</script></html>
9229 !! result
9230 <p>&lt;html&gt;&lt;script&gt;alert(1);&lt;/script&gt;&lt;/html&gt;
9231 </p>
9232 !! end
9233
9234 !! test
9235 HTML with raw HTML ($wgRawHtml==true)
9236 !! options
9237 rawhtml
9238 !! input
9239 <html><script>alert(1);</script></html>
9240 !! result
9241 <p><script>alert(1);</script>
9242 </p>
9243 !! end
9244
9245 !! test
9246 Parents of subpages, one level up
9247 !! options
9248 subpage title=[[Subpage test/L1/L2/L3]]
9249 !! input
9250 [[../|L2]]
9251 !! result
9252 <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>
9253 </p>
9254 !! end
9255
9256
9257 !! test
9258 Parents of subpages, one level up, not named
9259 !! options
9260 subpage title=[[Subpage test/L1/L2/L3]]
9261 !! input
9262 [[../]]
9263 !! result
9264 <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>
9265 </p>
9266 !! end
9267
9268
9269
9270 !! test
9271 Parents of subpages, two levels up
9272 !! options
9273 subpage title=[[Subpage test/L1/L2/L3]]
9274 !! input
9275 [[../../|L1]]2
9276
9277 [[../../|L1]]l
9278 !! result
9279 <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
9280 </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>
9281 </p>
9282 !! end
9283
9284 !! test
9285 Parents of subpages, two levels up, without trailing slash or name.
9286 !! options
9287 subpage title=[[Subpage test/L1/L2/L3]]
9288 !! input
9289 [[../..]]
9290 !! result
9291 <p>[[../..]]
9292 </p>
9293 !! end
9294
9295 !! test
9296 Parents of subpages, two levels up, with lots of extra trailing slashes.
9297 !! options
9298 subpage title=[[Subpage test/L1/L2/L3]]
9299 !! input
9300 [[../../////]]
9301 !! result
9302 <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>
9303 </p>
9304 !! end
9305
9306 !! test
9307 Definition list code coverage
9308 !! input
9309 ; title : def
9310 ; title : def
9311 ;title: def
9312 !! result
9313 <dl><dt> title &#160;</dt><dd> def
9314 </dd><dt> title&#160;</dt><dd> def
9315 </dd><dt>title</dt><dd> def
9316 </dd></dl>
9317
9318 !! end
9319
9320 !! test
9321 Don't fall for the self-closing div
9322 !! input
9323 <div>hello world</div/>
9324 !! result
9325 <div>hello world</div>
9326
9327 !! end
9328
9329 !! test
9330 MSGNW magic word
9331 !! input
9332 {{MSGNW:msg}}
9333 !! result
9334 <p>&#91;&#91;:Template:Msg&#93;&#93;
9335 </p>
9336 !! end
9337
9338 !! test
9339 RAW magic word
9340 !! input
9341 {{RAW:QUERTY}}
9342 !! result
9343 <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>
9344 </p>
9345 !! end
9346
9347 # This isn't needed for XHTML conformance, but would be handy as a fallback security measure
9348 !! test
9349 Always escape literal '>' in output, not just after '<'
9350 !! input
9351 ><>
9352 !! result
9353 <p>&gt;&lt;&gt;
9354 </p>
9355 !! end
9356
9357 !! test
9358 Template caching
9359 !! input
9360 {{Test}}
9361 {{Test}}
9362 !! result
9363 <p>This is a test template
9364 This is a test template
9365 </p>
9366 !! end
9367
9368
9369 !! article
9370 MediaWiki:Fake
9371 !! text
9372 ==header==
9373 !! endarticle
9374
9375 !! test
9376 Inclusion of !userCanEdit() content
9377 !! input
9378 {{MediaWiki:Fake}}
9379 !! result
9380 <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>
9381
9382 !! end
9383
9384
9385 !! test
9386 Out-of-order TOC heading levels
9387 !! input
9388 ==2==
9389 ======6======
9390 ===3===
9391 =1=
9392 =====5=====
9393 ==2==
9394 !! result
9395 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
9396 <ul>
9397 <li class="toclevel-1 tocsection-1"><a href="#2"><span class="tocnumber">1</span> <span class="toctext">2</span></a>
9398 <ul>
9399 <li class="toclevel-2 tocsection-2"><a href="#6"><span class="tocnumber">1.1</span> <span class="toctext">6</span></a></li>
9400 <li class="toclevel-2 tocsection-3"><a href="#3"><span class="tocnumber">1.2</span> <span class="toctext">3</span></a></li>
9401 </ul>
9402 </li>
9403 <li class="toclevel-1 tocsection-4"><a href="#1"><span class="tocnumber">2</span> <span class="toctext">1</span></a>
9404 <ul>
9405 <li class="toclevel-2 tocsection-5"><a href="#5"><span class="tocnumber">2.1</span> <span class="toctext">5</span></a></li>
9406 <li class="toclevel-2 tocsection-6"><a href="#2_2"><span class="tocnumber">2.2</span> <span class="toctext">2</span></a></li>
9407 </ul>
9408 </li>
9409 </ul>
9410 </td></tr></table>
9411 <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>
9412 <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>
9413 <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>
9414 <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>
9415 <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>
9416 <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>
9417
9418 !! end
9419
9420
9421 !! test
9422 ISBN with a dummy number
9423 !! input
9424 ISBN ---
9425 !! result
9426 <p>ISBN ---
9427 </p>
9428 !! end
9429
9430
9431 !! test
9432 ISBN with space-delimited number
9433 !! input
9434 ISBN 92 9017 032 8
9435 !! result
9436 <p><a href="/wiki/Special:BookSources/9290170328" class="internal mw-magiclink-isbn">ISBN 92 9017 032 8</a>
9437 </p>
9438 !! end
9439
9440
9441 !! test
9442 ISBN with multiple spaces, no number
9443 !! input
9444 ISBN foo
9445 !! result
9446 <p>ISBN foo
9447 </p>
9448 !! end
9449
9450
9451 !! test
9452 ISBN length
9453 !! input
9454 ISBN 123456789
9455
9456 ISBN 1234567890
9457
9458 ISBN 12345678901
9459 !! result
9460 <p>ISBN 123456789
9461 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
9462 </p><p>ISBN 12345678901
9463 </p>
9464 !! end
9465
9466
9467 !! test
9468 ISBN with trailing year (bug 8110)
9469 !! input
9470 ISBN 1-234-56789-0 - 2006
9471
9472 ISBN 1 234 56789 0 - 2006
9473 !! result
9474 <p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1-234-56789-0</a> - 2006
9475 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1 234 56789 0</a> - 2006
9476 </p>
9477 !! end
9478
9479
9480 !! test
9481 anchorencode
9482 !! input
9483 {{anchorencode:foo bar©#%n}}
9484 !! result
9485 <p>foo_bar.C2.A9.23.25n
9486 </p>
9487 !! end
9488
9489 !! test
9490 anchorencode trims spaces
9491 !! input
9492 {{anchorencode: __pretty__please__}}
9493 !! result
9494 <p>pretty_please
9495 </p>
9496 !! end
9497
9498 !! test
9499 anchorencode deals with links
9500 !! input
9501 {{anchorencode: [[hello|world]] [[hi]]}}
9502 !! result
9503 <p>world_hi
9504 </p>
9505 !! end
9506
9507 !! test
9508 anchorencode deals with templates
9509 !! input
9510 {{anchorencode: {{Foo}} }}
9511 !! result
9512 <p>FOO
9513 </p>
9514 !! end
9515
9516 !! test
9517 anchorencode encodes like the TOC generator: (bug 18431)
9518 !! input
9519 === _ +:.3A%3A&&amp;]] ===
9520 {{anchorencode: _ +:.3A%3A&&amp;]] }}
9521 __NOEDITSECTION__
9522 !! result
9523 <h3> <span class="mw-headline" id=".2B:.3A.253A.26.26.5D.5D"> _ +:.3A%3A&amp;&amp;]] </span></h3>
9524 <p>.2B:.3A.253A.26.26.5D.5D
9525 </p>
9526 !! end
9527
9528 # Expected output in the following test is not necessarily expected (there
9529 # should probably be <p> tags inside the <blockquote> in the output) -- it's
9530 # only testing for well-formedness.
9531 !! test
9532 Bug 6200: blockquotes and paragraph formatting
9533 !! input
9534 <blockquote>
9535 foo
9536 </blockquote>
9537
9538 bar
9539
9540 baz
9541 !! result
9542 <blockquote>
9543 foo
9544 </blockquote>
9545 <p>bar
9546 </p>
9547 <pre>baz
9548 </pre>
9549 !! end
9550
9551 !! test
9552 Bug 8293: Use of center tag ruins paragraph formatting
9553 !! input
9554 <center>
9555 foo
9556 </center>
9557
9558 bar
9559
9560 baz
9561 !! result
9562 <center>
9563 <p>foo
9564 </p>
9565 </center>
9566 <p>bar
9567 </p>
9568 <pre>baz
9569 </pre>
9570 !! end
9571
9572
9573 ###
9574 ### Language variants related tests
9575 ###
9576 !! test
9577 Self-link in language variants
9578 !! options
9579 title=[[Dunav]] language=sr
9580 !! input
9581 Both [[Dunav]] and [[Дунав]] are names for this river.
9582 !! result
9583 <p>Both <strong class="selflink">Dunav</strong> and <strong class="selflink">Дунав</strong> are names for this river.
9584 </p>
9585 !!end
9586
9587
9588 !! test
9589 Link to pages in language variants
9590 !! options
9591 language=sr
9592 !! input
9593 Main Page can be written as [[Маин Паге]]
9594 !! result
9595 <p>Main Page can be written as <a href="/wiki/Main_Page" title="Main Page">Маин Паге</a>
9596 </p>
9597 !!end
9598
9599
9600 !! test
9601 Multiple links to pages in language variants
9602 !! options
9603 language=sr
9604 !! input
9605 [[Main Page]] can be written as [[Маин Паге]] same as [[Маин Паге]].
9606 !! result
9607 <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>.
9608 </p>
9609 !!end
9610
9611
9612 !! test
9613 Simple template in language variants
9614 !! options
9615 language=sr
9616 !! input
9617 {{тест}}
9618 !! result
9619 <p>This is a test template
9620 </p>
9621 !! end
9622
9623
9624 !! test
9625 Template with explicit namespace in language variants
9626 !! options
9627 language=sr
9628 !! input
9629 {{Template:тест}}
9630 !! result
9631 <p>This is a test template
9632 </p>
9633 !! end
9634
9635
9636 !! test
9637 Basic test for template parameter in language variants
9638 !! options
9639 language=sr
9640 !! input
9641 {{парамтест|param=foo}}
9642 !! result
9643 <p>This is a test template with parameter foo
9644 </p>
9645 !! end
9646
9647
9648 !! test
9649 Simple category in language variants
9650 !! options
9651 language=sr cat
9652 !! input
9653 [[Category:МедиаWики Усер'с Гуиде]]
9654 !! result
9655 <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>
9656 !! end
9657
9658
9659 !! test
9660 Stripping -{}- tags (language variants)
9661 !! options
9662 language=sr
9663 !! input
9664 Latin proverb: -{Ne nuntium necare}-
9665 !! result
9666 <p>Latin proverb: Ne nuntium necare
9667 </p>
9668 !! end
9669
9670
9671 !! test
9672 Prevent conversion with -{}- tags (language variants)
9673 !! options
9674 language=sr variant=sr-ec
9675 !! input
9676 Latinski: -{Ne nuntium necare}-
9677 !! result
9678 <p>Латински: Ne nuntium necare
9679 </p>
9680 !! end
9681
9682
9683 !! test
9684 Prevent conversion of text with -{}- tags (language variants)
9685 !! options
9686 language=sr variant=sr-ec
9687 !! input
9688 Latinski: -{Ne nuntium necare}-
9689 !! result
9690 <p>Латински: Ne nuntium necare
9691 </p>
9692 !! end
9693
9694
9695 !! test
9696 Prevent conversion of links with -{}- tags (language variants)
9697 !! options
9698 language=sr variant=sr-ec
9699 !! input
9700 -{[[Main Page]]}-
9701 !! result
9702 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
9703 </p>
9704 !! end
9705
9706
9707 !! test
9708 -{}- tags within headlines (within html for parserConvert())
9709 !! options
9710 language=sr variant=sr-ec
9711 !! input
9712 == -{Naslov}- ==
9713 !! result
9714 <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>
9715
9716 !! end
9717
9718
9719 !! test
9720 Explicit definition of language variant alternatives
9721 !! options
9722 language=zh variant=zh-tw
9723 !! input
9724 -{zh:China;zh-tw:Taiwan}-, not China
9725 !! result
9726 <p>Taiwan, not China
9727 </p>
9728 !! end
9729
9730
9731 !! test
9732 Explicit session-wise language variant mapping (A flag and - flag)
9733 !! options
9734 language=zh variant=zh-tw
9735 !! input
9736 Taiwan is not China.
9737 But -{A|zh:China;zh-tw:Taiwan}- is China,
9738 (This-{-|zh:China;zh-tw:Taiwan}- should be stripped!)
9739 and -{China}- is China.
9740 !! result
9741 <p>Taiwan is not China.
9742 But Taiwan is Taiwan,
9743 (This should be stripped!)
9744 and China is China.
9745 </p>
9746 !! end
9747
9748 !! test
9749 Explicit session-wise language variant mapping (H flag for hide)
9750 !! options
9751 language=zh variant=zh-tw
9752 !! input
9753 (This-{H|zh:China;zh-tw:Taiwan}- should be stripped!)
9754 Taiwan is China.
9755 !! result
9756 <p>(This should be stripped!)
9757 Taiwan is Taiwan.
9758 </p>
9759 !! end
9760
9761 !! test
9762 Adding explicit conversion rule for title (T flag)
9763 !! options
9764 language=zh variant=zh-tw showtitle
9765 !! input
9766 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
9767 !! result
9768 Taiwan
9769 <p>Should be stripped!
9770 </p>
9771 !! end
9772
9773 !! test
9774 Testing that changing the language variant here in the tests actually works
9775 !! options
9776 language=zh variant=zh showtitle
9777 !! input
9778 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
9779 !! result
9780 China
9781 <p>Should be stripped!
9782 </p>
9783 !! end
9784
9785 !! test
9786 Bug 24072: more test on conversion rule for title
9787 !! options
9788 language=zh variant=zh-tw showtitle
9789 !! input
9790 This should be stripped-{T|zh:China;zh-tw:Taiwan}-!
9791 This won't take interferes with the title rule-{H|zh:Beijing;zh-tw:Taipei}-.
9792 !! result
9793 Taiwan
9794 <p>This should be stripped!
9795 This won't take interferes with the title rule.
9796 </p>
9797 !! end
9798
9799 !! test
9800 Raw output of variant escape tags (R flag)
9801 !! options
9802 language=zh variant=zh-tw
9803 !! input
9804 Raw: -{R|zh:China;zh-tw:Taiwan}-
9805 !! result
9806 <p>Raw: zh:China;zh-tw:Taiwan
9807 </p>
9808 !! end
9809
9810 !! test
9811 Nested using of manual convert syntax
9812 !! options
9813 language=zh variant=zh-hk
9814 !! input
9815 Nested: -{zh-hans:Hi -{zh-cn:China;zh-sg:Singapore;}-;zh-hant:Hello -{zh-tw:Taiwan;zh-hk:H-{ong}- K-{}-ong;}-;}-!
9816 !! result
9817 <p>Nested: Hello Hong Kong!
9818 </p>
9819 !! end
9820
9821 !! test
9822 Do not convert roman numbers to language variants
9823 !! options
9824 language=sr variant=sr-ec
9825 !! input
9826 Fridrih IV je car.
9827 !! result
9828 <p>Фридрих IV је цар.
9829 </p>
9830 !! end
9831
9832 !! test
9833 Unclosed language converter markup "-{"
9834 !! options
9835 language=sr
9836 !! input
9837 -{T|hello
9838 !! result
9839 <p>-{T|hello
9840 </p>
9841 !! end
9842
9843 !! test
9844 Don't convert raw rule "-{R|=&gt;}-" to "=>"
9845 !! options
9846 language=sr
9847 !! input
9848 -{R|=&gt;}-
9849 !! result
9850 <p>=&gt;
9851 </p>
9852 !!end
9853
9854 !!article
9855 Template:Bullet
9856 !!text
9857 * Bar
9858 !!endarticle
9859
9860 !! test
9861 Bug 529: Uncovered bullet
9862 !! input
9863 * Foo {{bullet}}
9864 !! result
9865 <ul><li> Foo
9866 </li><li> Bar
9867 </li></ul>
9868
9869 !! end
9870
9871 !! test
9872 Bug 529: Uncovered table already at line-start
9873 !! input
9874 x
9875
9876 {{table}}
9877 y
9878 !! result
9879 <p>x
9880 </p>
9881 <table>
9882 <tr>
9883 <td> 1 </td>
9884 <td> 2
9885 </td></tr>
9886 <tr>
9887 <td> 3 </td>
9888 <td> 4
9889 </td></tr></table>
9890 <p>y
9891 </p>
9892 !! end
9893
9894 !! test
9895 Bug 529: Uncovered bullet in parser function result
9896 !! input
9897 * Foo {{lc:{{bullet}} }}
9898 !! result
9899 <ul><li> Foo
9900 </li><li> bar
9901 </li></ul>
9902
9903 !! end
9904
9905 !! test
9906 Bug 5678: Double-parsed template argument
9907 !! input
9908 {{lc:{{{1}}}|hello}}
9909 !! result
9910 <p>{{{1}}}
9911 </p>
9912 !! end
9913
9914 !! test
9915 Bug 5678: Double-parsed template invocation
9916 !! input
9917 {{lc:{{paramtest {{!}} param = hello }} }}
9918 !! result
9919 <p>{{paramtest | param = hello }}
9920 </p>
9921 !! end
9922
9923 !! test
9924 Case insensitivity of parser functions for non-ASCII characters (bug 8143)
9925 !! options
9926 language=cs
9927 title=[[Main Page]]
9928 !! input
9929 {{PRVNÍVELKÉ:ěščř}}
9930 {{prvnívelké:ěščř}}
9931 {{PRVNÍMALÉ:ěščř}}
9932 {{prvnímalé:ěščř}}
9933 {{MALÁ:ěščř}}
9934 {{malá:ěščř}}
9935 {{VELKÁ:ěščř}}
9936 {{velká:ěščř}}
9937 !! result
9938 <p>Ěščř
9939 Ěščř
9940 ěščř
9941 ěščř
9942 ěščř
9943 ěščř
9944 ĚŠČŘ
9945 ĚŠČŘ
9946 </p>
9947 !! end
9948
9949 !! test
9950 Morwen/13: Unclosed link followed by heading
9951 !! input
9952 [[link
9953 ==heading==
9954 !! result
9955 <p>[[link
9956 </p>
9957 <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>
9958
9959 !! end
9960
9961 !! test
9962 HHP2.1: Heuristics for headings in preprocessor parenthetical structures
9963 !! input
9964 {{foo|
9965 =heading=
9966 !! result
9967 <p>{{foo|
9968 </p>
9969 <h1> <span class="mw-headline" id="heading">heading</span></h1>
9970
9971 !! end
9972
9973 !! test
9974 HHP2.2: Heuristics for headings in preprocessor parenthetical structures
9975 !! input
9976 {{foo|
9977 ==heading==
9978 !! result
9979 <p>{{foo|
9980 </p>
9981 <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>
9982
9983 !! end
9984
9985 !! test
9986 Tildes in comments
9987 !! options
9988 pst
9989 !! input
9990 <!-- ~~~~ -->
9991 !! result
9992 <!-- ~~~~ -->
9993 !! end
9994
9995 !! test
9996 Paragraphs inside divs (no extra line breaks)
9997 !! input
9998 <div>Line one
9999
10000 Line two</div>
10001 !! result
10002 <div>Line one
10003 Line two</div>
10004
10005 !! end
10006
10007 !! test
10008 Paragraphs inside divs (extra line break on open)
10009 !! input
10010 <div>
10011 Line one
10012
10013 Line two</div>
10014 !! result
10015 <div>
10016 <p>Line one
10017 </p>
10018 Line two</div>
10019
10020 !! end
10021
10022 !! test
10023 Paragraphs inside divs (extra line break on close)
10024 !! input
10025 <div>Line one
10026
10027 Line two
10028 </div>
10029 !! result
10030 <div>Line one
10031 <p>Line two
10032 </p>
10033 </div>
10034
10035 !! end
10036
10037 !! test
10038 Paragraphs inside divs (extra line break on open and close)
10039 !! input
10040 <div>
10041 Line one
10042
10043 Line two
10044 </div>
10045 !! result
10046 <div>
10047 <p>Line one
10048 </p><p>Line two
10049 </p>
10050 </div>
10051
10052 !! end
10053
10054 !! test
10055 Nesting tags, paragraphs on lines which begin with <div>
10056 !! options
10057 disabled
10058 !! input
10059 <div></div><strong>A
10060 B</strong>
10061 !! result
10062 <div></div>
10063 <p><strong>A
10064 B</strong>
10065 </p>
10066 !! end
10067
10068 # Bug 6200: <blockquote> should behave like <div> with respect to line breaks
10069 !! test
10070 Bug 6200: paragraphs inside blockquotes (no extra line breaks)
10071 !! options
10072 disabled
10073 !! input
10074 <blockquote>Line one
10075
10076 Line two</blockquote>
10077 !! result
10078 <blockquote>Line one
10079 Line two</blockquote>
10080
10081 !! end
10082
10083 !! test
10084 Bug 6200: paragraphs inside blockquotes (extra line break on open)
10085 !! options
10086 disabled
10087 !! input
10088 <blockquote>
10089 Line one
10090
10091 Line two</blockquote>
10092 !! result
10093 <blockquote>
10094 <p>Line one
10095 </p>
10096 Line two</blockquote>
10097
10098 !! end
10099
10100 !! test
10101 Bug 6200: paragraphs inside blockquotes (extra line break on close)
10102 !! options
10103 disabled
10104 !! input
10105 <blockquote>Line one
10106
10107 Line two
10108 </blockquote>
10109 !! result
10110 <blockquote>Line one
10111 <p>Line two
10112 </p>
10113 </blockquote>
10114
10115 !! end
10116
10117 !! test
10118 Bug 6200: paragraphs inside blockquotes (extra line break on open and close)
10119 !! options
10120 disabled
10121 !! input
10122 <blockquote>
10123 Line one
10124
10125 Line two
10126 </blockquote>
10127 !! result
10128 <blockquote>
10129 <p>Line one
10130 </p><p>Line two
10131 </p>
10132 </blockquote>
10133
10134 !! end
10135
10136 !! test
10137 Paragraphs inside blockquotes/divs (no extra line breaks)
10138 !! input
10139 <blockquote><div>Line one
10140
10141 Line two</div></blockquote>
10142 !! result
10143 <blockquote><div>Line one
10144 Line two</div></blockquote>
10145
10146 !! end
10147
10148 !! test
10149 Paragraphs inside blockquotes/divs (extra line break on open)
10150 !! input
10151 <blockquote><div>
10152 Line one
10153
10154 Line two</div></blockquote>
10155 !! result
10156 <blockquote><div>
10157 <p>Line one
10158 </p>
10159 Line two</div></blockquote>
10160
10161 !! end
10162
10163 !! test
10164 Paragraphs inside blockquotes/divs (extra line break on close)
10165 !! input
10166 <blockquote><div>Line one
10167
10168 Line two
10169 </div></blockquote>
10170 !! result
10171 <blockquote><div>Line one
10172 <p>Line two
10173 </p>
10174 </div></blockquote>
10175
10176 !! end
10177
10178 !! test
10179 Paragraphs inside blockquotes/divs (extra line break on open and close)
10180 !! input
10181 <blockquote><div>
10182 Line one
10183
10184 Line two
10185 </div></blockquote>
10186 !! result
10187 <blockquote><div>
10188 <p>Line one
10189 </p><p>Line two
10190 </p>
10191 </div></blockquote>
10192
10193 !! end
10194
10195 !! test
10196 Interwiki links trounced by replaceExternalLinks after early LinkHolderArray expansion
10197 !! options
10198 wgLinkHolderBatchSize=0
10199 !! input
10200 [[meatball:1]]
10201 [[meatball:2]]
10202 [[meatball:3]]
10203 !! result
10204 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?1" class="extiw" title="meatball:1">meatball:1</a>
10205 <a href="http://www.usemod.com/cgi-bin/mb.pl?2" class="extiw" title="meatball:2">meatball:2</a>
10206 <a href="http://www.usemod.com/cgi-bin/mb.pl?3" class="extiw" title="meatball:3">meatball:3</a>
10207 </p>
10208 !! end
10209
10210 !! test
10211 Free external link invading image caption
10212 !! input
10213 [[Image:Foobar.jpg|thumb|http://x|hello]]
10214 !! result
10215 <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>
10216
10217 !! end
10218
10219 !! test
10220 Bug 15196: localised external link numbers
10221 !! options
10222 language=fa
10223 !! input
10224 [http://en.wikipedia.org/]
10225 !! result
10226 <p><a rel="nofollow" class="external autonumber" href="http://en.wikipedia.org/">[۱]</a>
10227 </p>
10228 !! end
10229
10230 !! test
10231 Multibyte character in padleft
10232 !! input
10233 {{padleft:-Hello|7|Æ}}
10234 !! result
10235 <p>Æ-Hello
10236 </p>
10237 !! end
10238
10239 !! test
10240 Multibyte character in padright
10241 !! input
10242 {{padright:Hello-|7|Æ}}
10243 !! result
10244 <p>Hello-Æ
10245 </p>
10246 !! end
10247
10248 !! test
10249 Formatted date
10250 !! config
10251 wgUseDynamicDates=1
10252 !! input
10253 [[2009-03-24]]
10254 !! result
10255 <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>
10256 </p>
10257 !!end
10258
10259 !!test
10260 formatdate parser function
10261 !!input
10262 {{#formatdate:2009-03-24}}
10263 !! result
10264 <p><span class="mw-formatted-date" title="2009-03-24">2009-03-24</span>
10265 </p>
10266 !! end
10267
10268 !!test
10269 formatdate parser function, with default format
10270 !!input
10271 {{#formatdate:2009-03-24|mdy}}
10272 !! result
10273 <p><span class="mw-formatted-date" title="2009-03-24">March 24, 2009</span>
10274 </p>
10275 !! end
10276
10277 !! test
10278 Linked date with autoformatting disabled
10279 !! config
10280 wgUseDynamicDates=false
10281 !! input
10282 [[2009-03-24]]
10283 !! result
10284 <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>
10285 </p>
10286 !! end
10287
10288 !! test
10289 Spacing of numbers in formatted dates
10290 !! input
10291 {{#formatdate:January 15}}
10292 !! result
10293 <p><span class="mw-formatted-date" title="01-15">January 15</span>
10294 </p>
10295 !! end
10296
10297 !! test
10298 Spacing of numbers in formatted dates (linked)
10299 !! config
10300 wgUseDynamicDates=true
10301 !! input
10302 [[January 15]]
10303 !! result
10304 <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>
10305 </p>
10306 !! end
10307
10308 !! test
10309 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
10310 !! options
10311 language=nl title=[[MediaWiki:Common.css]]
10312 !! input
10313 {{#formatdate:2009-03-24|dmy}}
10314 !! result
10315 <p><span class="mw-formatted-date" title="2009-03-24">24 March 2009</span>
10316 </p>
10317 !! end
10318
10319 #
10320 #
10321 #
10322
10323 #
10324 # Edit comments
10325 #
10326
10327 !! test
10328 Edit comment with link
10329 !! options
10330 comment
10331 !! input
10332 I like the [[Main Page]] a lot
10333 !! result
10334 I like the <a href="/wiki/Main_Page" title="Main Page">Main Page</a> a lot
10335 !!end
10336
10337 !! test
10338 Edit comment with link and link text
10339 !! options
10340 comment
10341 !! input
10342 I like the [[Main Page|best pages]] a lot
10343 !! result
10344 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
10345 !!end
10346
10347 !! test
10348 Edit comment with link and link text with suffix
10349 !! options
10350 comment
10351 !! input
10352 I like the [[Main Page|best page]]s 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 section link (non-local, eg in history list)
10359 !! options
10360 comment title=[[Main Page]]
10361 !! input
10362 /* External links */ removed bogus entries
10363 !! result
10364 <a href="/wiki/Main_Page#External_links" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
10365 !!end
10366
10367 !! test
10368 Edit comment with section link and text before it (non-local, eg in history list)
10369 !! options
10370 comment title=[[Main Page]]
10371 !! input
10372 pre-comment text /* External links */ removed bogus entries
10373 !! result
10374 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>
10375 !!end
10376
10377 !! test
10378 Edit comment with section link (local, eg in diff view)
10379 !! options
10380 comment local title=[[Main Page]]
10381 !! input
10382 /* External links */ removed bogus entries
10383 !! result
10384 <a href="#External_links">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
10385 !!end
10386
10387 !! test
10388 Edit comment with subpage link (bug 14080)
10389 !! options
10390 comment
10391 subpage
10392 title=[[Subpage test]]
10393 !! input
10394 Poked at a [[/subpage]] here...
10395 !! result
10396 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a> here...
10397 !!end
10398
10399 !! test
10400 Edit comment with subpage link and link text (bug 14080)
10401 !! options
10402 comment
10403 subpage
10404 title=[[Subpage test]]
10405 !! input
10406 Poked at a [[/subpage|neat little page]] here...
10407 !! result
10408 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">neat little page</a> here...
10409 !!end
10410
10411 !! test
10412 Edit comment with bogus subpage link in non-subpage NS (bug 14080)
10413 !! options
10414 comment
10415 title=[[Subpage test]]
10416 !! input
10417 Poked at a [[/subpage]] here...
10418 !! result
10419 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...
10420 !!end
10421
10422 !! test
10423 Edit comment with bare anchor link (local, as on diff)
10424 !! options
10425 comment
10426 local
10427 title=[[Main Page]]
10428 !!input
10429 [[#section]]
10430 !! result
10431 <a href="#section">#section</a>
10432 !! end
10433
10434 !! test
10435 Edit comment with bare anchor link (non-local, as on history)
10436 !! options
10437 comment
10438 title=[[Main Page]]
10439 !!input
10440 [[#section]]
10441 !! result
10442 <a href="/wiki/Main_Page#section" title="Main Page">#section</a>
10443 !! end
10444
10445 !! test
10446 Anchor starting with underscore
10447 !!input
10448 [[#_ref|One]]
10449 !! result
10450 <p><a href="#_ref">One</a>
10451 </p>
10452 !! end
10453
10454 !! test
10455 Id starting with underscore
10456 !!input
10457 <div id="_ref"></div>
10458 !! result
10459 <div id="_ref"></div>
10460
10461 !! end
10462
10463 !! test
10464 Space normalisation on autocomment (bug 22784)
10465 !! options
10466 comment
10467 title=[[Main Page]]
10468 !!input
10469 /* __hello__world__ */
10470 !! result
10471 <a href="/wiki/Main_Page#hello_world" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">__hello__world__</span></span>
10472 !! end
10473
10474 !! test
10475 percent-encoding and + signs in comments (Bug 26410)
10476 !! options
10477 comment
10478 !!input
10479 [[ABC%33D% ++]] [[ABC%33D% ++|+%20]]
10480 !! result
10481 <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>
10482 !! end
10483
10484 !! test
10485 Bad images - basic functionality
10486 !! options
10487 disabled
10488 !! input
10489 [[File:Bad.jpg]]
10490 !! result
10491 !! end
10492
10493 !! test
10494 Bad images - bug 16039: text after bad image disappears
10495 !! options
10496 disabled
10497 !! input
10498 Foo bar
10499 [[File:Bad.jpg]]
10500 Bar foo
10501 !! result
10502 <p>Foo bar
10503 </p><p>Bar foo
10504 </p>
10505 !! end
10506
10507 !! test
10508 Verify that displaytitle works (bug #22501) no displaytitle
10509 !! options
10510 showtitle
10511 !! config
10512 wgAllowDisplayTitle=true
10513 wgRestrictDisplayTitle=false
10514 !! input
10515 this is not the the title
10516 !! result
10517 Parser test
10518 <p>this is not the the title
10519 </p>
10520 !! end
10521
10522 !! test
10523 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=false
10524 !! options
10525 showtitle
10526 title=[[Screen]]
10527 !! config
10528 wgAllowDisplayTitle=true
10529 wgRestrictDisplayTitle=false
10530 !! input
10531 this is not the the title
10532 {{DISPLAYTITLE:whatever}}
10533 !! result
10534 whatever
10535 <p>this is not the the title
10536 </p>
10537 !! end
10538
10539 !! test
10540 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true mismatch
10541 !! options
10542 showtitle
10543 title=[[Screen]]
10544 !! config
10545 wgAllowDisplayTitle=true
10546 wgRestrictDisplayTitle=true
10547 !! input
10548 this is not the the title
10549 {{DISPLAYTITLE:whatever}}
10550 !! result
10551 Screen
10552 <p>this is not the the title
10553 </p>
10554 !! end
10555
10556 !! test
10557 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true matching
10558 !! options
10559 showtitle
10560 title=[[Screen]]
10561 !! config
10562 wgAllowDisplayTitle=true
10563 wgRestrictDisplayTitle=true
10564 !! input
10565 this is not the the title
10566 {{DISPLAYTITLE:screen}}
10567 !! result
10568 screen
10569 <p>this is not the the title
10570 </p>
10571 !! end
10572
10573 !! test
10574 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false
10575 !! options
10576 showtitle
10577 title=[[Screen]]
10578 !! config
10579 wgAllowDisplayTitle=false
10580 !! input
10581 this is not the the title
10582 {{DISPLAYTITLE:screen}}
10583 !! result
10584 Screen
10585 <p>this is not the the title
10586 <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>
10587 </p>
10588 !! end
10589
10590 !! test
10591 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false no DISPLAYTITLE
10592 !! options
10593 showtitle
10594 title=[[Screen]]
10595 !! config
10596 wgAllowDisplayTitle=false
10597 !! input
10598 this is not the the title
10599 !! result
10600 Screen
10601 <p>this is not the the title
10602 </p>
10603 !! end
10604
10605 !! test
10606 preload: check <noinclude> and <includeonly>
10607 !! options
10608 preload
10609 !! input
10610 Hello <noinclude>cruel</noinclude><includeonly>kind</includeonly> world.
10611 !! result
10612 Hello kind world.
10613 !! end
10614
10615 !! test
10616 preload: check <onlyinclude>
10617 !! options
10618 preload
10619 !! input
10620 Goodbye <onlyinclude>Hello world</onlyinclude>
10621 !! result
10622 Hello world
10623 !! end
10624
10625 !! test
10626 preload: can pass tags through if we want to
10627 !! options
10628 preload
10629 !! input
10630 <includeonly><</includeonly>includeonly>Hello world<includeonly><</includeonly>/includeonly>
10631 !! result
10632 <includeonly>Hello world</includeonly>
10633 !! end
10634
10635 !! test
10636 preload: check that it doesn't try to do tricks
10637 !! options
10638 preload
10639 !! input
10640 * <!-- Hello --> ''{{world}}'' {{<includeonly>subst:</includeonly>How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
10641 !! result
10642 * <!-- Hello --> ''{{world}}'' {{subst:How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
10643 !! end
10644
10645 !! test
10646 Play a bit with r67090 and bug 3158
10647 !! options
10648 disabled
10649 !! input
10650 <div style="width:50% !important">&nbsp;</div>
10651 <div style="width:50%&nbsp;!important">&nbsp;</div>
10652 <div style="width:50%&#160;!important">&nbsp;</div>
10653 <div style="border : solid;">&nbsp;</div>
10654 !! result
10655 <div style="width:50% !important">&nbsp;</div>
10656 <div style="width:50% !important">&nbsp;</div>
10657 <div style="width:50% !important">&nbsp;</div>
10658 <div style="border&#160;: solid;">&nbsp;</div>
10659
10660 !! end
10661
10662 !! test
10663 HTML5 data attributes
10664 !! input
10665 <span data-foo="bar">Baz</span>
10666 <p data-abc-def_hij="">Quuz</p>
10667 !! result
10668 <p><span data-foo="bar">Baz</span>
10669 </p>
10670 <p data-abc-def_hij="">Quuz</p>
10671
10672 !! end
10673
10674 !! test
10675 percent-encoding and + signs in internal links (Bug 26410)
10676 !! input
10677 [[User:+%]] [[Page+title%]]
10678 [[%+]] [[%+|%20]] [[%+ ]] [[%+r]]
10679 [[%]] [[+]] [[image:%+abc%39|foo|[[bar]]]]
10680 [[%33%45]] [[%33%45+]]
10681 !! result
10682 <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>
10683 <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>
10684 <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>
10685 <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>
10686 </p>
10687 !! end
10688
10689 !! test
10690 Special characters in embedded file links (bug 27679)
10691 !! input
10692 [[File:Contains & ampersand.jpg]]
10693 [[File:Does not exist.jpg|Title with & ampersand]]
10694 !! result
10695 <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>
10696 <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>
10697 </p>
10698 !! end
10699
10700
10701 !! test
10702 Confirm that 'apos' named character reference doesn't make it to output (not legal in HTML 4)
10703 !! input
10704 Text&apos;s been normalized?
10705 !! result
10706 <p>Text&#39;s been normalized?
10707 </p>
10708 !! end
10709
10710 !! test
10711 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate free external links
10712 !! input
10713 http://www.example.org/ <-- U+3000 (vim: ^Vu3000)
10714 !! result
10715 <p><a rel="nofollow" class="external free" href="http://www.example.org/">http://www.example.org/</a> &lt;-- U+3000 (vim: ^Vu3000)
10716 </p>
10717 !! end
10718
10719 !! test
10720 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate bracketed external links
10721 !! input
10722 [http://www.example.org/ ideograms]
10723 !! result
10724 <p><a rel="nofollow" class="external text" href="http://www.example.org/">ideograms</a>
10725 </p>
10726 !! end
10727
10728 !! test
10729 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate external images links
10730 !! input
10731 http://www.example.org/pic.png <-- U+3000 (vim: ^Vu3000)
10732 !! result
10733 <p><img src="http://www.example.org/pic.png" alt="pic.png" /> &lt;-- U+3000 (vim: ^Vu3000)
10734 </p>
10735 !! end
10736
10737 !! article
10738 Mediawiki:loop1
10739 !! text
10740 {{Identical|A}}
10741 !! endarticle
10742
10743 !! article
10744 Mediawiki:loop2
10745 !! text
10746 {{Identical|B}}
10747 !! endarticle
10748
10749 !! article
10750 Template:Identical
10751 !! text
10752 {{int:loop1}}
10753 {{int:loop2}}
10754 !! endarticle
10755
10756 !! test
10757 Bug 31098 Template which includes system messages which includes the template
10758 !! input
10759 {{Identical}}
10760 !! result
10761 <p><span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
10762 <span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
10763 </p>
10764 !! end
10765
10766 !! test
10767 Deprecated presentational attributes are converted to css
10768 !! input
10769 {|
10770 | valign=top align=left width=100 height=25% | Asdf
10771 |}
10772 <ul type="disc"></ul>
10773 !! result
10774 <table>
10775 <tr>
10776 <td style="text-align: left; height: 25%; vertical-align: top; width: 100px;"> Asdf
10777 </td></tr></table>
10778 <ul style="list-style-type: disc;"></ul>
10779
10780 !! end
10781
10782 !! test
10783 Bug31490 Turkish: ucfirst 'blah'
10784 !! options
10785 language=tr
10786 !! input
10787 {{ucfirst:blah}}
10788 !! result
10789 <p>Blah
10790 </p>
10791 !! end
10792
10793 !! test
10794 Bug31490 Turkish: ucfirst 'ix'
10795 !! options
10796 language=tr
10797 !! input
10798 {{ucfirst:ix}}
10799 !! result
10800 <p>İx
10801 </p>
10802 !! end
10803
10804 !! test
10805 Bug31490 Turkish: lcfirst 'BLAH'
10806 !! options
10807 language=tr
10808 !! input
10809 {{lcfirst:BLAH}}
10810 !! result
10811 <p>bLAH
10812 </p>
10813 !! end
10814
10815 !! test
10816 Bug31490 Turkish: ucfırst (with a dotless i)
10817 !! options
10818 language=tr
10819 !! input
10820 {{ucfırst:blah}}
10821 !! result
10822 <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>
10823 </p>
10824 !! end
10825
10826 !! test
10827 Bug31490 ucfırst (with a dotless i) with English language
10828 !! options
10829 language=en
10830 !! input
10831 {{ucfırst:blah}}
10832 !! result
10833 <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>
10834 </p>
10835 !! end
10836
10837 !! test
10838 Bug 26375: TOC with italics
10839 !! options
10840 title=[[Main Page]]
10841 !! input
10842 __TOC__
10843 == ''Lost'' episodes ==
10844 !! result
10845 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
10846 <ul>
10847 <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>
10848 </ul>
10849 </td></tr></table>
10850 <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>
10851
10852 !! end
10853
10854 !! test
10855 Bug 26375: TOC with bold
10856 !! options
10857 title=[[Main Page]]
10858 !! input
10859 __TOC__
10860 == '''should be bold''' then normal text ==
10861 !! result
10862 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
10863 <ul>
10864 <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>
10865 </ul>
10866 </td></tr></table>
10867 <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>
10868
10869 !! end
10870
10871 !! test
10872 Bug 33845: Headings become cursive in TOC when they contain an image
10873 !! options
10874 title=[[Main Page]]
10875 !! input
10876 __TOC__
10877 == Image [[Image:foobar.jpg]] ==
10878 !! result
10879 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
10880 <ul>
10881 <li class="toclevel-1 tocsection-1"><a href="#Image"><span class="tocnumber">1</span> <span class="toctext">Image</span></a></li>
10882 </ul>
10883 </td></tr></table>
10884 <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>
10885
10886 !! end
10887
10888 !! test
10889 Bug 33845 (2): Headings become bold in TOC when they contain a blockquote
10890 !! options
10891 title=[[Main Page]]
10892 !! input
10893 __TOC__
10894 == <blockquote>Quote</blockquote> ==
10895 !! result
10896 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
10897 <ul>
10898 <li class="toclevel-1 tocsection-1"><a href="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
10899 </ul>
10900 </td></tr></table>
10901 <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>
10902
10903 !! end
10904
10905 !! test
10906 Unclosed tags in TOC
10907 !! options
10908 title=[[Main Page]]
10909 !! input
10910 __TOC__
10911 == Proof: 2 < 3 ==
10912 <small>Hanc marginis exiguitas non caperet.</small>
10913 QED
10914 !! result
10915 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
10916 <ul>
10917 <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>
10918 </ul>
10919 </td></tr></table>
10920 <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>
10921 <p><small>Hanc marginis exiguitas non caperet.</small>
10922 QED
10923 </p>
10924 !! end
10925
10926 !! test
10927 Multiple tags in TOC
10928 !! input
10929 __TOC__
10930 == <i>Foo</i> <b>Bar</b> ==
10931
10932 == <i>Foo</i> <blockquote>Bar</blockquote> ==
10933 !! result
10934 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
10935 <ul>
10936 <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>
10937 <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>
10938 </ul>
10939 </td></tr></table>
10940 <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>
10941 <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>
10942
10943 !! end
10944
10945 !! test
10946 Tags with parameters in TOC
10947 !! input
10948 __TOC__
10949 == <sup class="in-h2">Hello</sup> ==
10950
10951 == <sup class="a > b">Evilbye</sup> ==
10952 !! result
10953 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
10954 <ul>
10955 <li class="toclevel-1 tocsection-1"><a href="#Hello"><span class="tocnumber">1</span> <span class="toctext"><sup>Hello</sup></span></a></li>
10956 <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>
10957 </ul>
10958 </td></tr></table>
10959 <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>
10960 <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>
10961
10962 !! end
10963
10964 !! test
10965 span tags with directionality in TOC
10966 !! input
10967 __TOC__
10968 == <span dir="ltr">C++</span> ==
10969
10970 == <span dir="rtl">זבנג!</span> ==
10971
10972 == <span style="font-style: italic">The attributes on these span tags must be deleted from the TOC</span> ==
10973
10974 == <span style="font-style: italic" dir="ltr">All attributes on these span tags must be deleted from the TOC</span> ==
10975
10976 == <span dir="ltr" style="font-style: italic">Attributes after dir on these span tags must be deleted from the TOC</span> ==
10977 !! result
10978 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
10979 <ul>
10980 <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>
10981 <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>
10982 <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>
10983 <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>
10984 <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>
10985 </ul>
10986 </td></tr></table>
10987 <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>
10988 <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>
10989 <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>
10990 <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>
10991 <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>
10992
10993 !! end
10994
10995 !! article
10996 MediaWiki:Bug32057
10997 !! text
10998 == {{int:headline_sample}} ==
10999 !! endarticle
11000
11001 !! test
11002 Bug 32057: Title needed when expanding <h> nodes.
11003 !! options
11004 title=[[Main Page]]
11005 !! input
11006 {{int:Bug32057}}
11007 !! result
11008 <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>
11009
11010 !! end
11011
11012 !! test
11013 Strip marker in urlencode
11014 !! input
11015 {{urlencode:x<nowiki/>y}}
11016 {{urlencode:x<nowiki/>y|wiki}}
11017 {{urlencode:x<nowiki/>y|path}}
11018 !! result
11019 <p>xy
11020 xy
11021 xy
11022 </p>
11023 !! end
11024
11025 !! test
11026 Strip marker in lc
11027 !! input
11028 {{lc:x<nowiki/>y}}
11029 !! result
11030 <p>xy
11031 </p>
11032 !! end
11033
11034 !! test
11035 Strip marker in uc
11036 !! input
11037 {{uc:x<nowiki/>y}}
11038 !! result
11039 <p>XY
11040 </p>
11041 !! end
11042
11043 !! test
11044 Strip marker in formatNum
11045 !! input
11046 {{formatnum:1<nowiki/>2}}
11047 {{formatnum:1<nowiki/>2|R}}
11048 !! result
11049 <p>12
11050 12
11051 </p>
11052 !! end
11053
11054 !! test
11055 Strip marker in grammar
11056 !! options
11057 language=fi
11058 !! input
11059 {{grammar:elative|foo<nowiki/>bar}}
11060 !! result
11061 <p>foobarista
11062 </p>
11063 !! end
11064
11065 !! test
11066 Strip marker in padleft
11067 !! input
11068 {{padleft:|2|x<nowiki/>y}}
11069 !! result
11070 <p>xy
11071 </p>
11072 !! end
11073
11074 !! test
11075 Strip marker in padright
11076 !! input
11077 {{padright:|2|x<nowiki/>y}}
11078 !! result
11079 <p>xy
11080 </p>
11081 !! end
11082
11083 !! test
11084 Strip marker in anchorencode
11085 !! input
11086 {{anchorencode:x<nowiki/>y}}
11087 !! result
11088 <p>xy
11089 </p>
11090 !! end
11091
11092 !! test
11093 nowiki inside link inside heading (bug 18295)
11094 !! input
11095 ==[[foo|x<nowiki>y</nowiki>z]]==
11096 !! result
11097 <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>
11098
11099 !! end
11100
11101 !! test
11102 new support for bdi element (bug 31817)
11103 !! input
11104 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
11105 !! result
11106 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
11107
11108 !!end
11109
11110 !! test
11111 Ignore pipe between table row attributes
11112 !! input
11113 {|
11114 | quux
11115 |- id=foo | style='color: red'
11116 | bar
11117 |}
11118 !! result
11119 <table>
11120 <tr>
11121 <td> quux
11122 </td></tr>
11123 <tr id="foo" style="color: red">
11124 <td> bar
11125 </td></tr></table>
11126
11127 !! end
11128
11129 !!test
11130 Gallery override link with WikiLink (bug 34852)
11131 !! input
11132 <gallery>
11133 File:foobar.jpg|caption|alt=galleryalt|link=InterWikiLink
11134 </gallery>
11135 !! result
11136 <ul class="gallery">
11137 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
11138 <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>
11139 <div class="gallerytext">
11140 <p>caption
11141 </p>
11142 </div>
11143 </div></li>
11144 </ul>
11145
11146 !! end
11147
11148 !!test
11149 Gallery override link with absolute external link (bug 34852)
11150 !! input
11151 <gallery>
11152 File:foobar.jpg|caption|alt=galleryalt|link=http://www.example.org
11153 </gallery>
11154 !! result
11155 <ul class="gallery">
11156 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
11157 <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>
11158 <div class="gallerytext">
11159 <p>caption
11160 </p>
11161 </div>
11162 </div></li>
11163 </ul>
11164
11165 !! end
11166
11167 !!test
11168 Gallery override link with malicious javascript (bug 34852)
11169 !! input
11170 <gallery>
11171 File:foobar.jpg|caption|alt=galleryalt|link=" onclick="alert('malicious javascript code!');
11172 </gallery>
11173 !! result
11174 <ul class="gallery">
11175 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
11176 <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>
11177 <div class="gallerytext">
11178 <p>caption
11179 </p>
11180 </div>
11181 </div></li>
11182 </ul>
11183
11184 !! end
11185
11186 !!test
11187 Language parser function
11188 !! input
11189 {{#language:ar}}
11190 !! result
11191 <p>العربية
11192 </p>
11193 !! end
11194
11195 !!test
11196 Padleft and padright as substr
11197 !! input
11198 {{padleft:|3|abcde}}
11199 {{padright:|3|abcde}}
11200 !! result
11201 <p>abc
11202 abc
11203 </p>
11204 !! end
11205
11206 !!test
11207 Bug 34939 - Case insensitive link parsing ([HttP://])
11208 !! input
11209 [HttP://MediaWiki.Org/]
11210 !! result
11211 <p><a rel="nofollow" class="external autonumber" href="HttP://MediaWiki.Org/">[1]</a>
11212 </p>
11213 !! end
11214
11215 !!test
11216 Bug 34939 - Case insensitive link parsing ([HttP:// title])
11217 !! input
11218 [HttP://MediaWiki.Org/ MediaWiki]
11219 !! result
11220 <p><a rel="nofollow" class="external text" href="HttP://MediaWiki.Org/">MediaWiki</a>
11221 </p>
11222 !! end
11223
11224 !!test
11225 Bug 34939 - Case insensitive link parsing (HttP://)
11226 !! input
11227 HttP://MediaWiki.Org/
11228 !! result
11229 <p><a rel="nofollow" class="external free" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a>
11230 </p>
11231 !! end
11232
11233 ###
11234 ### Parsoids-specific tests
11235 ### Parsoid-PHP parser incompatibilities
11236 ###
11237 !!test
11238 1. SOL-sensitive wikitext tokens as template-args
11239 !!options
11240 disabled
11241 !!input
11242 {{echo|*a}}
11243 {{echo|#a}}
11244 {{echo|:a}}
11245 !!result
11246 <p>*a
11247 #a
11248 :a
11249 </p>
11250 !!end
11251
11252 TODO:
11253 more images
11254 more tables
11255 character entities
11256 and much more
11257 Try for 100% code coverage