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