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