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