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