b3b9262a9293fe071c0ec5201efb0d43c71015a7
[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 ###
5580 ### Inter-language links
5581 ###
5582 !! test
5583 Inter-language links
5584 !! options
5585 ill
5586 !! input
5587 [[es:Alimento]]
5588 [[fr:Nourriture]]
5589 [[zh:&#39135;&#21697;]]
5590 !! result
5591 es:Alimento fr:Nourriture zh:食品
5592 !! end
5593
5594 ###
5595 ### Sections
5596 ###
5597 !! test
5598 Basic section headings
5599 !! input
5600 == Headline 1 ==
5601 Some text
5602
5603 ==Headline 2==
5604 More
5605 ===Smaller headline===
5606 Blah blah
5607 !! result
5608 <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>
5609 <p>Some text
5610 </p>
5611 <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>
5612 <p>More
5613 </p>
5614 <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>
5615 <p>Blah blah
5616 </p>
5617 !! end
5618
5619 !! test
5620 Section headings with TOC
5621 !! input
5622 == Headline 1 ==
5623 === Subheadline 1 ===
5624 ===== Skipping a level =====
5625 ====== Skipping a level ======
5626
5627 == Headline 2 ==
5628 Some text
5629 ===Another headline===
5630 !! result
5631 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
5632 <ul>
5633 <li class="toclevel-1 tocsection-1"><a href="#Headline_1"><span class="tocnumber">1</span> <span class="toctext">Headline 1</span></a>
5634 <ul>
5635 <li class="toclevel-2 tocsection-2"><a href="#Subheadline_1"><span class="tocnumber">1.1</span> <span class="toctext">Subheadline 1</span></a>
5636 <ul>
5637 <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>
5638 <ul>
5639 <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>
5640 </ul>
5641 </li>
5642 </ul>
5643 </li>
5644 </ul>
5645 </li>
5646 <li class="toclevel-1 tocsection-5"><a href="#Headline_2"><span class="tocnumber">2</span> <span class="toctext">Headline 2</span></a>
5647 <ul>
5648 <li class="toclevel-2 tocsection-6"><a href="#Another_headline"><span class="tocnumber">2.1</span> <span class="toctext">Another headline</span></a></li>
5649 </ul>
5650 </li>
5651 </ul>
5652 </td></tr></table>
5653 <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>
5654 <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>
5655 <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>
5656 <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>
5657 <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>
5658 <p>Some text
5659 </p>
5660 <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>
5661
5662 !! end
5663
5664 # perl -e 'print "="x$_," Level $_ heading","="x$_,"\n" for 1..10'
5665 !! test
5666 Handling of sections up to level 6 and beyond
5667 !! input
5668 = Level 1 Heading=
5669 == Level 2 Heading==
5670 === Level 3 Heading===
5671 ==== Level 4 Heading====
5672 ===== Level 5 Heading=====
5673 ====== Level 6 Heading======
5674 ======= Level 7 Heading=======
5675 ======== Level 8 Heading========
5676 ========= Level 9 Heading=========
5677 ========== Level 10 Heading==========
5678 !! result
5679 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
5680 <ul>
5681 <li class="toclevel-1 tocsection-1"><a href="#Level_1_Heading"><span class="tocnumber">1</span> <span class="toctext">Level 1 Heading</span></a>
5682 <ul>
5683 <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>
5684 <ul>
5685 <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>
5686 <ul>
5687 <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>
5688 <ul>
5689 <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>
5690 <ul>
5691 <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>
5692 <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>
5693 <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>
5694 <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>
5695 <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>
5696 </ul>
5697 </li>
5698 </ul>
5699 </li>
5700 </ul>
5701 </li>
5702 </ul>
5703 </li>
5704 </ul>
5705 </li>
5706 </ul>
5707 </td></tr></table>
5708 <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>
5709 <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>
5710 <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>
5711 <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>
5712 <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>
5713 <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>
5714 <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>
5715 <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>
5716 <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>
5717 <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>
5718
5719 !! end
5720
5721 !! test
5722 TOC regression (bug 9764)
5723 !! input
5724 == title 1 ==
5725 === title 1.1 ===
5726 ==== title 1.1.1 ====
5727 === title 1.2 ===
5728 == title 2 ==
5729 === title 2.1 ===
5730 !! result
5731 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
5732 <ul>
5733 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
5734 <ul>
5735 <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>
5736 <ul>
5737 <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>
5738 </ul>
5739 </li>
5740 <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>
5741 </ul>
5742 </li>
5743 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
5744 <ul>
5745 <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>
5746 </ul>
5747 </li>
5748 </ul>
5749 </td></tr></table>
5750 <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>
5751 <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>
5752 <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>
5753 <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>
5754 <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>
5755 <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>
5756
5757 !! end
5758
5759 !! test
5760 TOC with wgMaxTocLevel=3 (bug 6204)
5761 !! options
5762 wgMaxTocLevel=3
5763 !! input
5764 == title 1 ==
5765 === title 1.1 ===
5766 ==== title 1.1.1 ====
5767 === title 1.2 ===
5768 == title 2 ==
5769 === title 2.1 ===
5770 !! result
5771 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
5772 <ul>
5773 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
5774 <ul>
5775 <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>
5776 <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>
5777 </ul>
5778 </li>
5779 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
5780 <ul>
5781 <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>
5782 </ul>
5783 </li>
5784 </ul>
5785 </td></tr></table>
5786 <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>
5787 <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>
5788 <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>
5789 <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>
5790 <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>
5791 <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>
5792
5793 !! end
5794
5795 !! test
5796 TOC with wgMaxTocLevel=3 and two level four headings (bug 6204)
5797 !! options
5798 wgMaxTocLevel=3
5799 !! input
5800 ==Section 1==
5801 ===Section 1.1===
5802 ====Section 1.1.1====
5803 ====Section 1.1.1.1====
5804 ==Section 2==
5805 !! result
5806 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
5807 <ul>
5808 <li class="toclevel-1 tocsection-1"><a href="#Section_1"><span class="tocnumber">1</span> <span class="toctext">Section 1</span></a>
5809 <ul>
5810 <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>
5811 </ul>
5812 </li>
5813 <li class="toclevel-1 tocsection-5"><a href="#Section_2"><span class="tocnumber">2</span> <span class="toctext">Section 2</span></a></li>
5814 </ul>
5815 </td></tr></table>
5816 <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>
5817 <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>
5818 <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>
5819 <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>
5820 <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>
5821
5822 !! end
5823
5824
5825 !! test
5826 Resolving duplicate section names
5827 !! input
5828 == Foo bar ==
5829 == Foo bar ==
5830 !! result
5831 <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>
5832 <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>
5833
5834 !! end
5835
5836 !! test
5837 Resolving duplicate section names with differing case (bug 10721)
5838 !! input
5839 == Foo bar ==
5840 == Foo Bar ==
5841 !! result
5842 <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>
5843 <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>
5844
5845 !! end
5846
5847 !! article
5848 Template:sections
5849 !! text
5850 ===Section 1===
5851 ==Section 2==
5852 !! endarticle
5853
5854 !! test
5855 Template with sections, __NOTOC__
5856 !! input
5857 __NOTOC__
5858 ==Section 0==
5859 {{sections}}
5860 ==Section 4==
5861 !! result
5862 <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>
5863 <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>
5864 <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>
5865 <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>
5866
5867 !! end
5868
5869 !! test
5870 __NOEDITSECTION__ keyword
5871 !! input
5872 __NOEDITSECTION__
5873 ==Section 1==
5874 ==Section 2==
5875 !! result
5876 <h2> <span class="mw-headline" id="Section_1">Section 1</span></h2>
5877 <h2> <span class="mw-headline" id="Section_2">Section 2</span></h2>
5878
5879 !! end
5880
5881 !! test
5882 Link inside a section heading
5883 !! input
5884 ==Section with a [[Main Page|link]] in it==
5885 !! result
5886 <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>
5887
5888 !! end
5889
5890 !! test
5891 TOC regression (bug 12077)
5892 !! input
5893 __TOC__
5894 == title 1 ==
5895 === title 1.1 ===
5896 == title 2 ==
5897 !! result
5898 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
5899 <ul>
5900 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
5901 <ul>
5902 <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>
5903 </ul>
5904 </li>
5905 <li class="toclevel-1 tocsection-3"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a></li>
5906 </ul>
5907 </td></tr></table>
5908 <h2><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: title 1">edit</a>]</span> <span class="mw-headline" id="title_1"> title 1 </span></h2>
5909 <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>
5910 <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>
5911
5912 !! end
5913
5914 !! test
5915 BUG 1219 URL next to image (good)
5916 !! input
5917 http://example.com [[Image:foobar.jpg]]
5918 !! result
5919 <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>
5920 </p>
5921 !!end
5922
5923 !! test
5924 Short headings with trailing space should match behaviour of Parser::doHeadings (bug 19910)
5925 !! input
5926 ===
5927 The line above must have a trailing space!
5928 === <!--
5929 --> <!-- -->
5930 But just in case it doesn't...
5931 !! result
5932 <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>
5933 <p>The line above must have a trailing space!
5934 </p>
5935 <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>
5936 <p>But just in case it doesn't...
5937 </p>
5938 !! end
5939
5940 !! test
5941 Header with special characters (bug 25462)
5942 !! input
5943 The tooltips shall not show entities to the user (ie. be double escaped)
5944
5945 == text > text ==
5946 section 1
5947
5948 == text < text ==
5949 section 2
5950
5951 == text & text ==
5952 section 3
5953
5954 == text ' text ==
5955 section 4
5956
5957 == text " text ==
5958 section 5
5959 !! result
5960 <p>The tooltips shall not show entities to the user (ie. be double escaped)
5961 </p>
5962 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
5963 <ul>
5964 <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>
5965 <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>
5966 <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>
5967 <li class="toclevel-1 tocsection-4"><a href="#text_.27_text"><span class="tocnumber">4</span> <span class="toctext">text ' text</span></a></li>
5968 <li class="toclevel-1 tocsection-5"><a href="#text_.22_text"><span class="tocnumber">5</span> <span class="toctext">text " text</span></a></li>
5969 </ul>
5970 </td></tr></table>
5971 <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>
5972 <p>section 1
5973 </p>
5974 <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>
5975 <p>section 2
5976 </p>
5977 <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>
5978 <p>section 3
5979 </p>
5980 <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>
5981 <p>section 4
5982 </p>
5983 <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>
5984 <p>section 5
5985 </p>
5986 !! end
5987
5988 !! test
5989 Headers with excess '=' characters
5990 (Are similar tests necessary beyond the 1st level?)
5991 !! input
5992 =foo==
5993 ==foo=
5994 =''italic'' heading==
5995 ==''italic'' heading=
5996 !! result
5997 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
5998 <ul>
5999 <li class="toclevel-1 tocsection-1"><a href="#foo.3D"><span class="tocnumber">1</span> <span class="toctext">foo=</span></a></li>
6000 <li class="toclevel-1 tocsection-2"><a href="#.3Dfoo"><span class="tocnumber">2</span> <span class="toctext">=foo</span></a></li>
6001 <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>
6002 <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>
6003 </ul>
6004 </td></tr></table>
6005 <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>
6006 <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>
6007 <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>
6008 <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>
6009
6010 !! end
6011
6012 !! test
6013 BUG 1219 URL next to image (broken)
6014 !! input
6015 http://example.com[[Image:foobar.jpg]]
6016 !! result
6017 <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>
6018 </p>
6019 !!end
6020
6021 !! test
6022 Bug 1186 news: in the middle of text
6023 !! input
6024 http://en.wikinews.org/wiki/Wikinews:Workplace
6025 !! result
6026 <p><a rel="nofollow" class="external free" href="http://en.wikinews.org/wiki/Wikinews:Workplace">http://en.wikinews.org/wiki/Wikinews:Workplace</a>
6027 </p>
6028 !!end
6029
6030
6031 !! test
6032 Namespaced link must have a title
6033 !! input
6034 [[Project:]]
6035 !! result
6036 <p>[[Project:]]
6037 </p>
6038 !!end
6039
6040 !! test
6041 Namespaced link must have a title (bad fragment version)
6042 !! input
6043 [[Project:#fragment]]
6044 !! result
6045 <p>[[Project:#fragment]]
6046 </p>
6047 !!end
6048
6049
6050 !! test
6051 div with no attributes
6052 !! input
6053 <div>HTML rocks</div>
6054 !! result
6055 <div>HTML rocks</div>
6056
6057 !! end
6058
6059 !! test
6060 div with double-quoted attribute
6061 !! input
6062 <div id="rock">HTML rocks</div>
6063 !! result
6064 <div id="rock">HTML rocks</div>
6065
6066 !! end
6067
6068 !! test
6069 div with single-quoted attribute
6070 !! input
6071 <div id='rock'>HTML rocks</div>
6072 !! result
6073 <div id="rock">HTML rocks</div>
6074
6075 !! end
6076
6077 !! test
6078 div with unquoted attribute
6079 !! input
6080 <div id=rock>HTML rocks</div>
6081 !! result
6082 <div id="rock">HTML rocks</div>
6083
6084 !! end
6085
6086 !! test
6087 div with illegal double attributes
6088 !! input
6089 <div id="a" id="b">HTML rocks</div>
6090 !! result
6091 <div id="b">HTML rocks</div>
6092
6093 !!end
6094
6095 !! test
6096 HTML multiple attributes correction
6097 !! input
6098 <p class="error" class="awesome">Awesome!</p>
6099 !! result
6100 <p class="awesome">Awesome!</p>
6101
6102 !!end
6103
6104 !! test
6105 Table multiple attributes correction
6106 !! input
6107 {|
6108 !+ class="error" class="awesome"| status
6109 |}
6110 !! result
6111 <table>
6112 <tr>
6113 <th class="awesome"> status
6114 </th></tr></table>
6115
6116 !!end
6117
6118 !! test
6119 DIV IN UPPERCASE
6120 !! input
6121 <DIV ID="x">HTML ROCKS</DIV>
6122 !! result
6123 <div id="x">HTML ROCKS</div>
6124
6125 !!end
6126
6127
6128 !! test
6129 text with amp in the middle of nowhere
6130 !! input
6131 Remember AT&T?
6132 !!result
6133 <p>Remember AT&amp;T?
6134 </p>
6135 !! end
6136
6137 !! test
6138 text with character entity: eacute
6139 !! input
6140 I always thought &eacute; was a cute letter.
6141 !! result
6142 <p>I always thought &#233; was a cute letter.
6143 </p>
6144 !! end
6145
6146 !! test
6147 text with undefined character entity: xacute
6148 !! input
6149 I always thought &xacute; was a cute letter.
6150 !! result
6151 <p>I always thought &amp;xacute; was a cute letter.
6152 </p>
6153 !! end
6154
6155
6156 ###
6157 ### Media links
6158 ###
6159
6160 !! test
6161 Media link
6162 !! input
6163 [[Media:Foobar.jpg]]
6164 !! result
6165 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Media:Foobar.jpg</a>
6166 </p>
6167 !! end
6168
6169 !! test
6170 Media link with text
6171 !! input
6172 [[Media:Foobar.jpg|A neat file to look at]]
6173 !! result
6174 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">A neat file to look at</a>
6175 </p>
6176 !! end
6177
6178 # FIXME: this is still bad HTML tag nesting
6179 !! test
6180 Media link with nasty text
6181 fixme: doBlockLevels won't wrap this in a paragraph because it contains a div
6182 !! input
6183 [[Media:Foobar.jpg|Safe Link<div style=display:none>" onmouseover="alert(document.cookie)" onfoo="</div>]]
6184 !! result
6185 <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>
6186
6187 !! end
6188
6189 !! test
6190 Media link to nonexistent file (bug 1702)
6191 !! input
6192 [[Media:No such.jpg]]
6193 !! result
6194 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=No_such.jpg" class="new" title="No such.jpg">Media:No such.jpg</a>
6195 </p>
6196 !! end
6197
6198 !! test
6199 Image link to nonexistent file (bug 1850 - good)
6200 !! input
6201 [[Image:No such.jpg]]
6202 !! result
6203 <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>
6204 </p>
6205 !! end
6206
6207 !! test
6208 :Image link to nonexistent file (bug 1850 - bad)
6209 !! input
6210 [[:Image:No such.jpg]]
6211 !! result
6212 <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>
6213 </p>
6214 !! end
6215
6216
6217
6218 !! test
6219 Character reference normalization in link text (bug 1938)
6220 !! input
6221 [[Main Page|this&that]]
6222 !! result
6223 <p><a href="/wiki/Main_Page" title="Main Page">this&amp;that</a>
6224 </p>
6225 !!end
6226
6227 !! article
6228 אַ
6229 !! text
6230 Test for unicode normalization
6231
6232 The page's name is U+05d0 U+05b7, with non-canonical form U+FB2E
6233 !! endarticle
6234
6235 !! test
6236 (bug 19451) Links should refer to the normalized form.
6237 !! input
6238 [[&#xFB2E;]]
6239 [[&#x5d0;&#x5b7;]]
6240 [[&#x5d0;ַ]]
6241 [[א&#x5b7;]]
6242 [[אַ]]
6243 !! result
6244 <p><a href="/wiki/%D7%90%D6%B7" title="אַ">&#xfb2e;</a>
6245 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;&#x5b7;</a>
6246 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;ַ</a>
6247 <a href="/wiki/%D7%90%D6%B7" title="אַ">א&#x5b7;</a>
6248 <a href="/wiki/%D7%90%D6%B7" title="אַ">אַ</a>
6249 </p>
6250 !! end
6251
6252 !! test
6253 Empty attribute crash test (bug 2067)
6254 !! input
6255 <font color="">foo</font>
6256 !! result
6257 <p><font color="">foo</font>
6258 </p>
6259 !! end
6260
6261 !! test
6262 Empty attribute crash test single-quotes (bug 2067)
6263 !! input
6264 <font color=''>foo</font>
6265 !! result
6266 <p><font color="">foo</font>
6267 </p>
6268 !! end
6269
6270 !! test
6271 Attribute test: equals, then nothing
6272 !! input
6273 <font color=>foo</font>
6274 !! result
6275 <p><font>foo</font>
6276 </p>
6277 !! end
6278
6279 !! test
6280 Attribute test: unquoted value
6281 !! input
6282 <font color=x>foo</font>
6283 !! result
6284 <p><font color="x">foo</font>
6285 </p>
6286 !! end
6287
6288 !! test
6289 Attribute test: unquoted but illegal value (hash)
6290 !! input
6291 <font color=#x>foo</font>
6292 !! result
6293 <p><font color="#x">foo</font>
6294 </p>
6295 !! end
6296
6297 !! test
6298 Attribute test: no value
6299 !! input
6300 <font color>foo</font>
6301 !! result
6302 <p><font color="color">foo</font>
6303 </p>
6304 !! end
6305
6306 !! test
6307 Bug 2095: link with three closing brackets
6308 !! input
6309 [[Main Page]]]
6310 !! result
6311 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>]
6312 </p>
6313 !! end
6314
6315 !! test
6316 Bug 2095: link with pipe and three closing brackets
6317 !! input
6318 [[Main Page|link]]]
6319 !! result
6320 <p><a href="/wiki/Main_Page" title="Main Page">link</a>]
6321 </p>
6322 !! end
6323
6324 !! test
6325 Bug 2095: link with pipe and three closing brackets, version 2
6326 !! input
6327 [[Main Page|[http://example.com/]]]
6328 !! result
6329 <p><a href="/wiki/Main_Page" title="Main Page">[http://example.com/]</a>
6330 </p>
6331 !! end
6332
6333
6334 ###
6335 ### Safety
6336 ###
6337
6338 !! article
6339 Template:Dangerous attribute
6340 !! text
6341 " onmouseover="alert(document.cookie)
6342 !! endarticle
6343
6344 !! article
6345 Template:Dangerous style attribute
6346 !! text
6347 border-size: expression(alert(document.cookie))
6348 !! endarticle
6349
6350 !! article
6351 Template:Div style
6352 !! text
6353 <div style="float: right; {{{1}}}">Magic div</div>
6354 !! endarticle
6355
6356 !! test
6357 Bug 2304: HTML attribute safety (safe template; regression bug 2309)
6358 !! input
6359 <div title="{{test}}"></div>
6360 !! result
6361 <div title="This is a test template"></div>
6362
6363 !! end
6364
6365 !! test
6366 Bug 2304: HTML attribute safety (dangerous template; 2309)
6367 !! input
6368 <div title="{{dangerous attribute}}"></div>
6369 !! result
6370 <div title=""></div>
6371
6372 !! end
6373
6374 !! test
6375 Bug 2304: HTML attribute safety (dangerous style template; 2309)
6376 !! input
6377 <div style="{{dangerous style attribute}}"></div>
6378 !! result
6379 <div style="/* insecure input */"></div>
6380
6381 !! end
6382
6383 !! test
6384 Bug 2304: HTML attribute safety (safe parameter; 2309)
6385 !! input
6386 {{div style|width: 200px}}
6387 !! result
6388 <div style="float: right; width: 200px">Magic div</div>
6389
6390 !! end
6391
6392 !! test
6393 Bug 2304: HTML attribute safety (unsafe parameter; 2309)
6394 !! input
6395 {{div style|width: expression(alert(document.cookie))}}
6396 !! result
6397 <div style="/* insecure input */">Magic div</div>
6398
6399 !! end
6400
6401 !! test
6402 Bug 2304: HTML attribute safety (unsafe breakout parameter; 2309)
6403 !! input
6404 {{div style|"><script>alert(document.cookie)</script>}}
6405 !! result
6406 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
6407
6408 !! end
6409
6410 !! test
6411 Bug 2304: HTML attribute safety (unsafe breakout parameter 2; 2309)
6412 !! input
6413 {{div style|" ><script>alert(document.cookie)</script>}}
6414 !! result
6415 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
6416
6417 !! end
6418
6419 !! test
6420 Bug 2304: HTML attribute safety (link)
6421 !! input
6422 <div title="[[Main Page]]"></div>
6423 !! result
6424 <div title="&#91;&#91;Main Page]]"></div>
6425
6426 !! end
6427
6428 !! test
6429 Bug 2304: HTML attribute safety (italics)
6430 !! input
6431 <div title="''foobar''"></div>
6432 !! result
6433 <div title="&#39;&#39;foobar&#39;&#39;"></div>
6434
6435 !! end
6436
6437 !! test
6438 Bug 2304: HTML attribute safety (bold)
6439 !! input
6440 <div title="'''foobar'''"></div>
6441 !! result
6442 <div title="&#39;&#39;&#39;foobar&#39;&#39;&#39;"></div>
6443
6444 !! end
6445
6446
6447 !! test
6448 Bug 2304: HTML attribute safety (ISBN)
6449 !! input
6450 <div title="ISBN 1234567890"></div>
6451 !! result
6452 <div title="&#73;SBN 1234567890"></div>
6453
6454 !! end
6455
6456 !! test
6457 Bug 2304: HTML attribute safety (RFC)
6458 !! input
6459 <div title="RFC 1234"></div>
6460 !! result
6461 <div title="&#82;FC 1234"></div>
6462
6463 !! end
6464
6465 !! test
6466 Bug 2304: HTML attribute safety (PMID)
6467 !! input
6468 <div title="PMID 1234567890"></div>
6469 !! result
6470 <div title="&#80;MID 1234567890"></div>
6471
6472 !! end
6473
6474 !! test
6475 Bug 2304: HTML attribute safety (web link)
6476 !! input
6477 <div title="http://example.com/"></div>
6478 !! result
6479 <div title="http&#58;//example.com/"></div>
6480
6481 !! end
6482
6483 !! test
6484 Bug 2304: HTML attribute safety (named web link)
6485 !! input
6486 <div title="[http://example.com/ link]"></div>
6487 !! result
6488 <div title="&#91;http&#58;//example.com/ link]"></div>
6489
6490 !! end
6491
6492 !! test
6493 Bug 3244: HTML attribute safety (extension; safe)
6494 !! input
6495 <div style="<nowiki>background:blue</nowiki>"></div>
6496 !! result
6497 <div style="background:blue"></div>
6498
6499 !! end
6500
6501 !! test
6502 Bug 3244: HTML attribute safety (extension; unsafe)
6503 !! input
6504 <div style="<nowiki>border-left:expression(alert(document.cookie))</nowiki>"></div>
6505 !! result
6506 <div style="/* insecure input */"></div>
6507
6508 !! end
6509
6510 # More MSIE fun discovered by Tom Gilder
6511
6512 !! test
6513 MSIE CSS safety test: spurious slash
6514 !! input
6515 <div style="background-image:u\rl(javascript:alert('boo'))">evil</div>
6516 !! result
6517 <div style="/* insecure input */">evil</div>
6518
6519 !! end
6520
6521 !! test
6522 MSIE CSS safety test: hex code
6523 !! input
6524 <div style="background-image:u\72l(javascript:alert('boo'))">evil</div>
6525 !! result
6526 <div style="/* insecure input */">evil</div>
6527
6528 !! end
6529
6530 !! test
6531 MSIE CSS safety test: comment in url
6532 !! input
6533 <div style="background-image:u/**/rl(javascript:alert('boo'))">evil</div>
6534 !! result
6535 <div style="background-image:u rl(javascript:alert(&#39;boo&#39;))">evil</div>
6536
6537 !! end
6538
6539 !! test
6540 MSIE CSS safety test: comment in expression
6541 !! input
6542 <div style="background-image:expres/**/sion(alert('boo4'))">evil4</div>
6543 !! result
6544 <div style="background-image:expres sion(alert(&#39;boo4&#39;))">evil4</div>
6545
6546 !! end
6547
6548
6549 !! test
6550 Table attribute legitimate extension
6551 !! input
6552 {|
6553 !+ style="<nowiki>color:blue</nowiki>"| status
6554 |}
6555 !! result
6556 <table>
6557 <tr>
6558 <th style="color:blue"> status
6559 </th></tr></table>
6560
6561 !!end
6562
6563 !! test
6564 Table attribute safety
6565 !! input
6566 {|
6567 !+ style="<nowiki>border-width:expression(0+alert(document.cookie))</nowiki>"| status
6568 |}
6569 !! result
6570 <table>
6571 <tr>
6572 <th style="/* insecure input */"> status
6573 </th></tr></table>
6574
6575 !! end
6576
6577 !! test
6578 CSS line continuation 1
6579 !! input
6580 <div style="background-image: u\&#10;rl(test.jpg);"></div>
6581 !! result
6582 <div style="/* insecure input */"></div>
6583
6584 !! end
6585
6586 !! test
6587 CSS line continuation 2
6588 !! input
6589 <div style="background-image: u\&#13;rl(test.jpg); "></div>
6590 !! result
6591 <div style="/* insecure input */"></div>
6592
6593 !! end
6594
6595 !! article
6596 Template:Identity
6597 !! text
6598 {{{1}}}
6599 !! endarticle
6600
6601 !! test
6602 Expansion of multi-line templates in attribute values (bug 6255)
6603 !! input
6604 <div style="background: {{identity|#00FF00}}">-</div>
6605 !! result
6606 <div style="background: #00FF00">-</div>
6607
6608 !! end
6609
6610
6611 !! test
6612 Expansion of multi-line templates in attribute values (bug 6255 sanity check)
6613 !! input
6614 <div style="background:
6615 #00FF00">-</div>
6616 !! result
6617 <div style="background: #00FF00">-</div>
6618
6619 !! end
6620
6621 !! test
6622 Expansion of multi-line templates in attribute values (bug 6255 sanity check 2)
6623 !! input
6624 <div style="background: &#10;#00FF00">-</div>
6625 !! result
6626 <div style="background: &#10;#00FF00">-</div>
6627
6628 !! end
6629
6630 ###
6631 ### Parser hooks (see maintenance/parserTestsParserHook.php for the <tag> extension)
6632 ###
6633 !! test
6634 Parser hook: empty input
6635 !! input
6636 <tag></tag>
6637 !! result
6638 <pre>
6639 string(0) ""
6640 array(0) {
6641 }
6642 </pre>
6643
6644 !! end
6645
6646 !! test
6647 Parser hook: empty input using terminated empty elements
6648 !! input
6649 <tag/>
6650 !! result
6651 <pre>
6652 NULL
6653 array(0) {
6654 }
6655 </pre>
6656
6657 !! end
6658
6659 !! test
6660 Parser hook: empty input using terminated empty elements (space before)
6661 !! input
6662 <tag />
6663 !! result
6664 <pre>
6665 NULL
6666 array(0) {
6667 }
6668 </pre>
6669
6670 !! end
6671
6672 !! test
6673 Parser hook: basic input
6674 !! input
6675 <tag>input</tag>
6676 !! result
6677 <pre>
6678 string(5) "input"
6679 array(0) {
6680 }
6681 </pre>
6682
6683 !! end
6684
6685
6686 !! test
6687 Parser hook: case insensitive
6688 !! input
6689 <TAG>input</TAG>
6690 !! result
6691 <pre>
6692 string(5) "input"
6693 array(0) {
6694 }
6695 </pre>
6696
6697 !! end
6698
6699
6700 !! test
6701 Parser hook: case insensitive, redux
6702 !! input
6703 <TaG>input</TAg>
6704 !! result
6705 <pre>
6706 string(5) "input"
6707 array(0) {
6708 }
6709 </pre>
6710
6711 !! end
6712
6713 !! test
6714 Parser hook: nested tags
6715 !! options
6716 noxml
6717 !! input
6718 <tag><tag></tag></tag>
6719 !! result
6720 <pre>
6721 string(5) "<tag>"
6722 array(0) {
6723 }
6724 </pre>&lt;/tag&gt;
6725
6726 !! end
6727
6728 !! test
6729 Parser hook: basic arguments
6730 !! input
6731 <tag width=200 height = "100" depth = '50' square></tag>
6732 !! result
6733 <pre>
6734 string(0) ""
6735 array(4) {
6736 ["width"]=>
6737 string(3) "200"
6738 ["height"]=>
6739 string(3) "100"
6740 ["depth"]=>
6741 string(2) "50"
6742 ["square"]=>
6743 string(6) "square"
6744 }
6745 </pre>
6746
6747 !! end
6748
6749 !! test
6750 Parser hook: argument containing a forward slash (bug 5344)
6751 !! input
6752 <tag filename='/tmp/bla'></tag>
6753 !! result
6754 <pre>
6755 string(0) ""
6756 array(1) {
6757 ["filename"]=>
6758 string(8) "/tmp/bla"
6759 }
6760 </pre>
6761
6762 !! end
6763
6764 !! test
6765 Parser hook: empty input using terminated empty elements (bug 2374)
6766 !! input
6767 <tag foo=bar/>text
6768 !! result
6769 <pre>
6770 NULL
6771 array(1) {
6772 ["foo"]=>
6773 string(3) "bar"
6774 }
6775 </pre>text
6776
6777 !! end
6778
6779 # </tag> should be output literally since there is no matching tag that begins it
6780 !! test
6781 Parser hook: basic arguments using terminated empty elements (bug 2374)
6782 !! input
6783 <tag width=200 height = "100" depth = '50' square/>
6784 other stuff
6785 </tag>
6786 !! result
6787 <pre>
6788 NULL
6789 array(4) {
6790 ["width"]=>
6791 string(3) "200"
6792 ["height"]=>
6793 string(3) "100"
6794 ["depth"]=>
6795 string(2) "50"
6796 ["square"]=>
6797 string(6) "square"
6798 }
6799 </pre>
6800 <p>other stuff
6801 &lt;/tag&gt;
6802 </p>
6803 !! end
6804
6805 ###
6806 ### (see maintenance/parserTestsStaticParserHook.php for the <statictag> extension)
6807 ###
6808
6809 !! test
6810 Parser hook: static parser hook not inside a comment
6811 !! input
6812 <statictag>hello, world</statictag>
6813 <statictag action=flush/>
6814 !! result
6815 <p>hello, world
6816 </p>
6817 !! end
6818
6819
6820 !! test
6821 Parser hook: static parser hook inside a comment
6822 !! input
6823 <!-- <statictag>hello, world</statictag> -->
6824 <statictag action=flush/>
6825 !! result
6826 <p><br />
6827 </p>
6828 !! end
6829
6830 # Nested template calls; this case was broken by Parser.php rev 1.506,
6831 # since reverted.
6832
6833 !! article
6834 Template:One-parameter
6835 !! text
6836 (My parameter is: {{{1}}})
6837 !! endarticle
6838
6839 !! article
6840 Template:Map-one-parameter
6841 !! text
6842 {{{{{1}}}|{{{2}}}}}
6843 !! endarticle
6844
6845 !! test
6846 Nested template calls
6847 !! input
6848 {{Map-one-parameter|One-parameter|param}}
6849 !! result
6850 <p>(My parameter is: param)
6851 </p>
6852 !! end
6853
6854
6855 ###
6856 ### Sanitizer
6857 ###
6858 !! test
6859 Sanitizer: Closing of open tags
6860 !! input
6861 <s></s><table></table>
6862 !! result
6863 <s></s><table></table>
6864
6865 !! end
6866
6867 !! test
6868 Sanitizer: Closing of open but not closed tags
6869 !! input
6870 <s>foo
6871 !! result
6872 <p><s>foo</s>
6873 </p>
6874 !! end
6875
6876 !! test
6877 Sanitizer: Closing of closed but not open tags
6878 !! input
6879 </s>
6880 !! result
6881 <p>&lt;/s&gt;
6882 </p>
6883 !! end
6884
6885 !! test
6886 Sanitizer: Closing of closed but not open table tags
6887 !! input
6888 Table not started</td></tr></table>
6889 !! result
6890 <p>Table not started&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
6891 </p>
6892 !! end
6893
6894 !! test
6895 Sanitizer: Escaping of spaces, multibyte characters, colons & other stuff in id=""
6896 !! input
6897 <span id="æ: v">byte</span>[[#æ: v|backlink]]
6898 !! result
6899 <p><span id=".C3.A6:_v">byte</span><a href="#.C3.A6:_v">backlink</a>
6900 </p>
6901 !! end
6902
6903 !! test
6904 Sanitizer: Validating the contents of the id attribute (bug 4515)
6905 !! options
6906 disabled
6907 !! input
6908 <br id=9 />
6909 !! result
6910 Something, but definitely not <br id="9" />...
6911 !! end
6912
6913 !! test
6914 Sanitizer: Validating id attribute uniqueness (bug 4515, bug 6301)
6915 !! options
6916 disabled
6917 !! input
6918 <br id="foo" /><br id="foo" />
6919 !! result
6920 Something need to be done. foo-2 ?
6921 !! end
6922
6923 !! test
6924 Language converter: output gets cut off unexpectedly (bug 5757)
6925 !! options
6926 language=zh
6927 !! input
6928 this bit is safe: }-
6929
6930 but if we add a conversion instance: -{zh-cn:xxx;zh-tw:yyy}-
6931
6932 then we get cut off here: }-
6933
6934 all additional text is vanished
6935 !! result
6936 <p>this bit is safe: }-
6937 </p><p>but if we add a conversion instance: xxx
6938 </p><p>then we get cut off here: }-
6939 </p><p>all additional text is vanished
6940 </p>
6941 !! end
6942
6943 !! test
6944 Self closed html pairs (bug 5487)
6945 !! options
6946 !! input
6947 <center><font id="bug" />Centered text</center>
6948 <div><font id="bug2" />In div text</div>
6949 !! result
6950 <center>&lt;font id="bug" /&gt;Centered text</center>
6951 <div>&lt;font id="bug2" /&gt;In div text</div>
6952
6953 !! end
6954
6955 #
6956 #
6957 #
6958
6959 !! test
6960 Punctuation: nbsp before exclamation
6961 !! input
6962 C'est grave !
6963 !! result
6964 <p>C'est grave&#160;!
6965 </p>
6966 !! end
6967
6968 !! test
6969 Punctuation: CSS !important (bug 11874)
6970 !! input
6971 <div style="width:50% !important">important</div>
6972 !! result
6973 <div style="width:50% !important">important</div>
6974
6975 !!end
6976
6977 !! test
6978 Punctuation: CSS ! important (bug 11874; with space after)
6979 !! input
6980 <div style="width:50% ! important">important</div>
6981 !! result
6982 <div style="width:50% ! important">important</div>
6983
6984 !!end
6985
6986
6987 !! test
6988 HTML bullet list, closed tags (bug 5497)
6989 !! input
6990 <ul>
6991 <li>One</li>
6992 <li>Two</li>
6993 </ul>
6994 !! result
6995 <ul>
6996 <li>One</li>
6997 <li>Two</li>
6998 </ul>
6999
7000 !! end
7001
7002 !! test
7003 HTML bullet list, unclosed tags (bug 5497)
7004 !! options
7005 disabled
7006 !! input
7007 <ul>
7008 <li>One
7009 <li>Two
7010 </ul>
7011 !! result
7012 <ul>
7013 <li>One
7014 </li><li>Two
7015 </li></ul>
7016
7017 !! end
7018
7019 !! test
7020 HTML ordered list, closed tags (bug 5497)
7021 !! input
7022 <ol>
7023 <li>One</li>
7024 <li>Two</li>
7025 </ol>
7026 !! result
7027 <ol>
7028 <li>One</li>
7029 <li>Two</li>
7030 </ol>
7031
7032 !! end
7033
7034 !! test
7035 HTML ordered list, unclosed tags (bug 5497)
7036 !! options
7037 disabled
7038 !! input
7039 <ol>
7040 <li>One
7041 <li>Two
7042 </ol>
7043 !! result
7044 <ol>
7045 <li>One
7046 </li><li>Two
7047 </li></ol>
7048
7049 !! end
7050
7051 !! test
7052 HTML nested bullet list, closed tags (bug 5497)
7053 !! input
7054 <ul>
7055 <li>One</li>
7056 <li>Two:
7057 <ul>
7058 <li>Sub-one</li>
7059 <li>Sub-two</li>
7060 </ul>
7061 </li>
7062 </ul>
7063 !! result
7064 <ul>
7065 <li>One</li>
7066 <li>Two:
7067 <ul>
7068 <li>Sub-one</li>
7069 <li>Sub-two</li>
7070 </ul>
7071 </li>
7072 </ul>
7073
7074 !! end
7075
7076 !! test
7077 HTML nested bullet list, open tags (bug 5497)
7078 !! options
7079 disabled
7080 !! input
7081 <ul>
7082 <li>One
7083 <li>Two:
7084 <ul>
7085 <li>Sub-one
7086 <li>Sub-two
7087 </ul>
7088 </ul>
7089 !! result
7090 <ul>
7091 <li>One
7092 </li><li>Two:
7093 <ul>
7094 <li>Sub-one
7095 </li><li>Sub-two
7096 </li></ul>
7097 </li></ul>
7098
7099 !! end
7100
7101 !! test
7102 HTML nested ordered list, closed tags (bug 5497)
7103 !! input
7104 <ol>
7105 <li>One</li>
7106 <li>Two:
7107 <ol>
7108 <li>Sub-one</li>
7109 <li>Sub-two</li>
7110 </ol>
7111 </li>
7112 </ol>
7113 !! result
7114 <ol>
7115 <li>One</li>
7116 <li>Two:
7117 <ol>
7118 <li>Sub-one</li>
7119 <li>Sub-two</li>
7120 </ol>
7121 </li>
7122 </ol>
7123
7124 !! end
7125
7126 !! test
7127 HTML nested ordered list, open tags (bug 5497)
7128 !! options
7129 disabled
7130 !! input
7131 <ol>
7132 <li>One
7133 <li>Two:
7134 <ol>
7135 <li>Sub-one
7136 <li>Sub-two
7137 </ol>
7138 </ol>
7139 !! result
7140 <ol>
7141 <li>One
7142 </li><li>Two:
7143 <ol>
7144 <li>Sub-one
7145 </li><li>Sub-two
7146 </li></ol>
7147 </li></ol>
7148
7149 !! end
7150
7151 !! test
7152 HTML ordered list item with parameters oddity
7153 !! input
7154 <ol><li id="fragment">One</li></ol>
7155 !! result
7156 <ol><li id="fragment">One</li></ol>
7157
7158 !! end
7159
7160 !!test
7161 bug 5918: autonumbering
7162 !! input
7163 [http://first/] [http://second] [ftp://ftp]
7164
7165 ftp://inlineftp
7166
7167 [mailto:enclosed@mail.tld With target]
7168
7169 [mailto:enclosed@mail.tld]
7170
7171 mailto:inline@mail.tld
7172 !! result
7173 <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>
7174 </p><p><a rel="nofollow" class="external free" href="ftp://inlineftp">ftp://inlineftp</a>
7175 </p><p><a rel="nofollow" class="external text" href="mailto:enclosed@mail.tld">With target</a>
7176 </p><p><a rel="nofollow" class="external autonumber" href="mailto:enclosed@mail.tld">[4]</a>
7177 </p><p><a rel="nofollow" class="external free" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a>
7178 </p>
7179 !! end
7180
7181
7182 #
7183 # Security and HTML correctness
7184 # From Nick Jenkins' fuzz testing
7185 #
7186
7187 !! test
7188 Fuzz testing: Parser13
7189 !! input
7190 {|
7191 | http://a|
7192 !! result
7193 <table>
7194 <tr>
7195 <td>
7196 </td>
7197 </tr>
7198 </table>
7199
7200 !! end
7201
7202 !! test
7203 Fuzz testing: Parser14
7204 !! input
7205 == onmouseover= ==
7206 http://__TOC__
7207 !! result
7208 <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>
7209 http://<table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
7210 <ul>
7211 <li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
7212 </ul>
7213 </td></tr></table>
7214
7215 !! end
7216
7217 !! test
7218 Fuzz testing: Parser14-table
7219 !! input
7220 ==a==
7221 {| STYLE=__TOC__
7222 !! result
7223 <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>
7224 <table style="&#95;_TOC&#95;_">
7225 <tr><td></td></tr>
7226 </table>
7227
7228 !! end
7229
7230 # Known to produce bogus xml (extra </td>)
7231 !! test
7232 Fuzz testing: Parser16
7233 !! options
7234 noxml
7235 !! input
7236 {|
7237 !https://||||||
7238 !! result
7239 <table>
7240 <tr>
7241 <th>https://</th>
7242 <th></th>
7243 <th></th>
7244 <th>
7245 </td>
7246 </tr>
7247 </table>
7248
7249 !! end
7250
7251 !! test
7252 Fuzz testing: Parser21
7253 !! input
7254 {|
7255 ! irc://{{ftp://a" onmouseover="alert('hello world');"
7256 |
7257 !! result
7258 <table>
7259 <tr>
7260 <th> <a rel="nofollow" class="external free" href="irc://{{ftp://a">irc://{{ftp://a</a>" onmouseover="alert('hello world');"
7261 </th>
7262 <td>
7263 </td>
7264 </tr>
7265 </table>
7266
7267 !! end
7268
7269 !! test
7270 Fuzz testing: Parser22
7271 !! input
7272 http://===r:::https://b
7273
7274 {|
7275 !!result
7276 <p><a rel="nofollow" class="external free" href="http://===r:::https://b">http://===r:::https://b</a>
7277 </p>
7278 <table>
7279 <tr><td></td></tr>
7280 </table>
7281
7282 !! end
7283
7284 # Known to produce bad XML for now
7285 !! test
7286 Fuzz testing: Parser24
7287 !! options
7288 noxml
7289 !! input
7290 {|
7291 {{{|
7292 <u CLASS=
7293 | {{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx--><noinclude>}}}} >
7294 <br style="onmouseover='alert(document.cookie);' " />
7295
7296 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
7297 |
7298 !! result
7299 <table>
7300 {{{|
7301 <u class="&#124;">}}}} &gt;
7302 <br style="onmouseover=&#39;alert(document.cookie);&#39;" />
7303
7304 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
7305 <tr>
7306 <td></u>
7307 </td>
7308 </tr>
7309 </table>
7310
7311 !! end
7312
7313 # Note: the current result listed for this is not what the original one was,
7314 # but the original bug was JavaScript injection, which is fixed in any case.
7315 # It's not clear that the original result listed was any more correct than the
7316 # current one. Original result:
7317 # <p>{{{|
7318 # </p>
7319 # <li class="&#124;&#124;">
7320 # }}}blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
7321 !!test
7322 Fuzz testing: Parser25 (bug 6055)
7323 !! input
7324 {{{
7325 |
7326 <LI CLASS=||
7327 >
7328 }}}blah" onmouseover="alert('hello world');" align="left"'''MOVE MOUSE CURSOR OVER HERE
7329 !! result
7330 <p>&lt;LI CLASS=blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
7331 </p>
7332 !! end
7333
7334 !!test
7335 Fuzz testing: URL adjacent extension (with space, clean)
7336 !! options
7337 !! input
7338 http://example.com <nowiki>junk</nowiki>
7339 !! result
7340 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a> junk
7341 </p>
7342 !!end
7343
7344 !!test
7345 Fuzz testing: URL adjacent extension (no space, dirty; nowiki)
7346 !! options
7347 !! input
7348 http://example.com<nowiki>junk</nowiki>
7349 !! result
7350 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>junk
7351 </p>
7352 !!end
7353
7354 !!test
7355 Fuzz testing: URL adjacent extension (no space, dirty; pre)
7356 !! options
7357 !! input
7358 http://example.com<pre>junk</pre>
7359 !! result
7360 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a><pre>junk</pre>
7361
7362 !!end
7363
7364 !!test
7365 Fuzz testing: image with bogus manual thumbnail
7366 !!input
7367 [[Image:foobar.jpg|thumbnail= ]]
7368 !!result
7369 <div class="thumb tright"><div class="thumbinner" style="width:1943px;">Error creating thumbnail: <div class="thumbcaption"></div></div></div>
7370
7371 !!end
7372
7373 !! test
7374 Fuzz testing: encoded newline in generated HTML replacements (bug 6577)
7375 !! input
7376 <pre dir="&#10;"></pre>
7377 !! result
7378 <pre dir="&#10;"></pre>
7379
7380 !! end
7381
7382 !! test
7383 Parsing optional HTML elements (Bug 6171)
7384 !! options
7385 !! input
7386 <table>
7387 <tr>
7388 <td> Some tabular data</td>
7389 <td> More tabular data ...
7390 <td> And yet som tabular data</td>
7391 </tr>
7392 </table>
7393 !! result
7394 <table>
7395 <tr>
7396 <td> Some tabular data</td>
7397 <td> More tabular data ...
7398 </td><td> And yet som tabular data</td>
7399 </tr>
7400 </table>
7401
7402 !! end
7403
7404 !! test
7405 Correct handling of <td>, <tr> (Bug 6171)
7406 !! options
7407 !! input
7408 <table>
7409 <tr>
7410 <td> Some tabular data</td>
7411 <td> More tabular data ...</td>
7412 <td> And yet som tabular data</td>
7413 </tr>
7414 </table>
7415 !! result
7416 <table>
7417 <tr>
7418 <td> Some tabular data</td>
7419 <td> More tabular data ...</td>
7420 <td> And yet som tabular data</td>
7421 </tr>
7422 </table>
7423
7424 !! end
7425
7426
7427 !! test
7428 Parsing crashing regression (fr:JavaScript)
7429 !! input
7430 </body></x>
7431 !! result
7432 <p>&lt;/body&gt;&lt;/x&gt;
7433 </p>
7434 !! end
7435
7436 !! test
7437 Inline wiki vs wiki block nesting
7438 !! input
7439 '''Bold paragraph
7440
7441 New wiki paragraph
7442 !! result
7443 <p><b>Bold paragraph</b>
7444 </p><p>New wiki paragraph
7445 </p>
7446 !! end
7447
7448 !! test
7449 Inline HTML vs wiki block nesting
7450 !! options
7451 disabled
7452 !! input
7453 <b>Bold paragraph
7454
7455 New wiki paragraph
7456 !! result
7457 <p><b>Bold paragraph</b>
7458 </p><p>New wiki paragraph
7459 </p>
7460 !! end
7461
7462 # Original result was this:
7463 # <p><b>bold</b><b>bold<i>bolditalics</i></b>
7464 # </p>
7465 # While that might be marginally more intuitive, maybe, the six-apostrophe
7466 # construct is clearly pathological and the result stated here (which is what
7467 # the parser actually does) is about as reasonable as anything.
7468 !!test
7469 Mixing markup for italics and bold
7470 !! options
7471 !! input
7472 '''bold''''''bold''bolditalics'''''
7473 !! result
7474 <p>'<i>bold'</i><b>bold<i>bolditalics</i></b>
7475 </p>
7476 !! end
7477
7478
7479 !! article
7480 Xyzzyx
7481 !! text
7482 Article for special page transclusion test
7483 !! endarticle
7484
7485 !! test
7486 Special page transclusion
7487 !! options
7488 !! input
7489 {{Special:Prefixindex/Xyzzyx}}
7490 !! result
7491 <table id="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
7492
7493 !! end
7494
7495 !! test
7496 Special page transclusion twice (bug 5021)
7497 !! options
7498 !! input
7499 {{Special:Prefixindex/Xyzzyx}}
7500 {{Special:Prefixindex/Xyzzyx}}
7501 !! result
7502 <table id="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
7503 <table id="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
7504
7505 !! end
7506
7507 !! test
7508 Transclusion of default MediaWiki message
7509 !! input
7510 {{MediaWiki:Mainpage}}
7511 !!result
7512 <p>Main Page
7513 </p>
7514 !! end
7515
7516 !! test
7517 Transclusion of nonexistent MediaWiki message
7518 !! input
7519 {{MediaWiki:Mainpagexxx}}
7520 !!result
7521 <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>
7522 </p>
7523 !! end
7524
7525 !! test
7526 Transclusion of MediaWiki message with underscore
7527 !! input
7528 {{MediaWiki:history_short}}
7529 !! result
7530 <p>History
7531 </p>
7532 !! end
7533
7534 !! test
7535 Transclusion of MediaWiki message with space
7536 !! input
7537 {{MediaWiki:history short}}
7538 !! result
7539 <p>History
7540 </p>
7541 !! end
7542
7543 !! test
7544 Invalid header with following text
7545 !! input
7546 = x = y
7547 !! result
7548 <p>= x = y
7549 </p>
7550 !! end
7551
7552
7553 !! test
7554 Section extraction test (section 0)
7555 !! options
7556 section=0
7557 !! input
7558 start
7559 ==a==
7560 ===aa===
7561 ====aaa====
7562 ==b==
7563 ===ba===
7564 ===bb===
7565 ====bba====
7566 ===bc===
7567 ==c==
7568 ===ca===
7569 !! result
7570 start
7571 !! end
7572
7573 !! test
7574 Section extraction test (section 1)
7575 !! options
7576 section=1
7577 !! input
7578 start
7579 ==a==
7580 ===aa===
7581 ====aaa====
7582 ==b==
7583 ===ba===
7584 ===bb===
7585 ====bba====
7586 ===bc===
7587 ==c==
7588 ===ca===
7589 !! result
7590 ==a==
7591 ===aa===
7592 ====aaa====
7593 !! end
7594
7595 !! test
7596 Section extraction test (section 2)
7597 !! options
7598 section=2
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 ===aa===
7613 ====aaa====
7614 !! end
7615
7616 !! test
7617 Section extraction test (section 3)
7618 !! options
7619 section=3
7620 !! input
7621 start
7622 ==a==
7623 ===aa===
7624 ====aaa====
7625 ==b==
7626 ===ba===
7627 ===bb===
7628 ====bba====
7629 ===bc===
7630 ==c==
7631 ===ca===
7632 !! result
7633 ====aaa====
7634 !! end
7635
7636 !! test
7637 Section extraction test (section 4)
7638 !! options
7639 section=4
7640 !! input
7641 start
7642 ==a==
7643 ===aa===
7644 ====aaa====
7645 ==b==
7646 ===ba===
7647 ===bb===
7648 ====bba====
7649 ===bc===
7650 ==c==
7651 ===ca===
7652 !! result
7653 ==b==
7654 ===ba===
7655 ===bb===
7656 ====bba====
7657 ===bc===
7658 !! end
7659
7660 !! test
7661 Section extraction test (section 5)
7662 !! options
7663 section=5
7664 !! input
7665 start
7666 ==a==
7667 ===aa===
7668 ====aaa====
7669 ==b==
7670 ===ba===
7671 ===bb===
7672 ====bba====
7673 ===bc===
7674 ==c==
7675 ===ca===
7676 !! result
7677 ===ba===
7678 !! end
7679
7680 !! test
7681 Section extraction test (section 6)
7682 !! options
7683 section=6
7684 !! input
7685 start
7686 ==a==
7687 ===aa===
7688 ====aaa====
7689 ==b==
7690 ===ba===
7691 ===bb===
7692 ====bba====
7693 ===bc===
7694 ==c==
7695 ===ca===
7696 !! result
7697 ===bb===
7698 ====bba====
7699 !! end
7700
7701 !! test
7702 Section extraction test (section 7)
7703 !! options
7704 section=7
7705 !! input
7706 start
7707 ==a==
7708 ===aa===
7709 ====aaa====
7710 ==b==
7711 ===ba===
7712 ===bb===
7713 ====bba====
7714 ===bc===
7715 ==c==
7716 ===ca===
7717 !! result
7718 ====bba====
7719 !! end
7720
7721 !! test
7722 Section extraction test (section 8)
7723 !! options
7724 section=8
7725 !! input
7726 start
7727 ==a==
7728 ===aa===
7729 ====aaa====
7730 ==b==
7731 ===ba===
7732 ===bb===
7733 ====bba====
7734 ===bc===
7735 ==c==
7736 ===ca===
7737 !! result
7738 ===bc===
7739 !! end
7740
7741 !! test
7742 Section extraction test (section 9)
7743 !! options
7744 section=9
7745 !! input
7746 start
7747 ==a==
7748 ===aa===
7749 ====aaa====
7750 ==b==
7751 ===ba===
7752 ===bb===
7753 ====bba====
7754 ===bc===
7755 ==c==
7756 ===ca===
7757 !! result
7758 ==c==
7759 ===ca===
7760 !! end
7761
7762 !! test
7763 Section extraction test (section 10)
7764 !! options
7765 section=10
7766 !! input
7767 start
7768 ==a==
7769 ===aa===
7770 ====aaa====
7771 ==b==
7772 ===ba===
7773 ===bb===
7774 ====bba====
7775 ===bc===
7776 ==c==
7777 ===ca===
7778 !! result
7779 ===ca===
7780 !! end
7781
7782 !! test
7783 Section extraction test (nonexistent section 11)
7784 !! options
7785 section=11
7786 !! input
7787 start
7788 ==a==
7789 ===aa===
7790 ====aaa====
7791 ==b==
7792 ===ba===
7793 ===bb===
7794 ====bba====
7795 ===bc===
7796 ==c==
7797 ===ca===
7798 !! result
7799 !! end
7800
7801 !! test
7802 Section extraction test with bogus heading (section 1)
7803 !! options
7804 section=1
7805 !! input
7806 ==a==
7807 ==bogus== not a legal section
7808 ==b==
7809 !! result
7810 ==a==
7811 ==bogus== not a legal section
7812 !! end
7813
7814 !! test
7815 Section extraction test with bogus heading (section 2)
7816 !! options
7817 section=2
7818 !! input
7819 ==a==
7820 ==bogus== not a legal section
7821 ==b==
7822 !! result
7823 ==b==
7824 !! end
7825
7826 !! test
7827 Section extraction test with comment after heading (section 1)
7828 !! options
7829 section=1
7830 !! input
7831 ==a==
7832 ==b== <!-- -->
7833 ==c==
7834 !! result
7835 ==a==
7836 !! end
7837
7838 !! test
7839 Section extraction test with comment after heading (section 2)
7840 !! options
7841 section=2
7842 !! input
7843 ==a==
7844 ==b== <!-- -->
7845 ==c==
7846 !! result
7847 ==b== <!-- -->
7848 !! end
7849
7850 !! test
7851 Section extraction test with bogus <nowiki> heading (section 1)
7852 !! options
7853 section=1
7854 !! input
7855 ==a==
7856 ==bogus== <nowiki>not a legal section</nowiki>
7857 ==b==
7858 !! result
7859 ==a==
7860 ==bogus== <nowiki>not a legal section</nowiki>
7861 !! end
7862
7863 !! test
7864 Section extraction test with bogus <nowiki> heading (section 2)
7865 !! options
7866 section=2
7867 !! input
7868 ==a==
7869 ==bogus== <nowiki>not a legal section</nowiki>
7870 ==b==
7871 !! result
7872 ==b==
7873 !! end
7874
7875
7876 # Formerly testing for bug 2587, now resolved by the use of unmarked sections
7877 # instead of respecting commented sections
7878 !! test
7879 Section extraction prefixed by comment (section 1)
7880 !! options
7881 section=1
7882 !! input
7883 <!-- -->==sec1==
7884 ==sec2==
7885 !!result
7886 ==sec2==
7887 !!end
7888
7889 !! test
7890 Section extraction prefixed by comment (section 2)
7891 !! options
7892 section=2
7893 !! input
7894 <!-- -->==sec1==
7895 ==sec2==
7896 !!result
7897
7898 !!end
7899
7900
7901 # Formerly testing for bug 2607, now resolved by the use of unmarked sections
7902 # instead of respecting HTML-style headings
7903 !! test
7904 Section extraction, mixed wiki and html (section 1)
7905 !! options
7906 section=1
7907 !! input
7908 <h2>unmarked</h2>
7909 unmarked
7910 ==1==
7911 one
7912 ==2==
7913 two
7914 !! result
7915 ==1==
7916 one
7917 !! end
7918
7919 !! test
7920 Section extraction, mixed wiki and html (section 2)
7921 !! options
7922 section=2
7923 !! input
7924 <h2>unmarked</h2>
7925 unmarked
7926 ==1==
7927 one
7928 ==2==
7929 two
7930 !! result
7931 ==2==
7932 two
7933 !! end
7934
7935
7936 # Formerly testing for bug 3342
7937 !! test
7938 Section extraction, heading surrounded by <noinclude>
7939 !! options
7940 section=1
7941 !! input
7942 <noinclude>==unmarked==</noinclude>
7943 ==marked==
7944 !! result
7945 ==marked==
7946 !!end
7947
7948 # Test behaviour of bug 19910
7949 !! test
7950 Sectiion with all-equals
7951 !! options
7952 section=2
7953 !! input
7954 ===
7955 The line above must have a trailing space
7956 === <!--
7957 --> <!-- -->
7958 But just in case it doesn't...
7959 !! result
7960 === <!--
7961 --> <!-- -->
7962 But just in case it doesn't...
7963 !! end
7964
7965 !! test
7966 Section replacement test (section 0)
7967 !! options
7968 replace=0,"xxx"
7969 !! input
7970 start
7971 ==a==
7972 ===aa===
7973 ====aaa====
7974 ==b==
7975 ===ba===
7976 ===bb===
7977 ====bba====
7978 ===bc===
7979 ==c==
7980 ===ca===
7981 !! result
7982 xxx
7983
7984 ==a==
7985 ===aa===
7986 ====aaa====
7987 ==b==
7988 ===ba===
7989 ===bb===
7990 ====bba====
7991 ===bc===
7992 ==c==
7993 ===ca===
7994 !! end
7995
7996 !! test
7997 Section replacement test (section 1)
7998 !! options
7999 replace=1,"xxx"
8000 !! input
8001 start
8002 ==a==
8003 ===aa===
8004 ====aaa====
8005 ==b==
8006 ===ba===
8007 ===bb===
8008 ====bba====
8009 ===bc===
8010 ==c==
8011 ===ca===
8012 !! result
8013 start
8014 xxx
8015
8016 ==b==
8017 ===ba===
8018 ===bb===
8019 ====bba====
8020 ===bc===
8021 ==c==
8022 ===ca===
8023 !! end
8024
8025 !! test
8026 Section replacement test (section 2)
8027 !! options
8028 replace=2,"xxx"
8029 !! input
8030 start
8031 ==a==
8032 ===aa===
8033 ====aaa====
8034 ==b==
8035 ===ba===
8036 ===bb===
8037 ====bba====
8038 ===bc===
8039 ==c==
8040 ===ca===
8041 !! result
8042 start
8043 ==a==
8044 xxx
8045
8046 ==b==
8047 ===ba===
8048 ===bb===
8049 ====bba====
8050 ===bc===
8051 ==c==
8052 ===ca===
8053 !! end
8054
8055 !! test
8056 Section replacement test (section 3)
8057 !! options
8058 replace=3,"xxx"
8059 !! input
8060 start
8061 ==a==
8062 ===aa===
8063 ====aaa====
8064 ==b==
8065 ===ba===
8066 ===bb===
8067 ====bba====
8068 ===bc===
8069 ==c==
8070 ===ca===
8071 !! result
8072 start
8073 ==a==
8074 ===aa===
8075 xxx
8076
8077 ==b==
8078 ===ba===
8079 ===bb===
8080 ====bba====
8081 ===bc===
8082 ==c==
8083 ===ca===
8084 !! end
8085
8086 !! test
8087 Section replacement test (section 4)
8088 !! options
8089 replace=4,"xxx"
8090 !! input
8091 start
8092 ==a==
8093 ===aa===
8094 ====aaa====
8095 ==b==
8096 ===ba===
8097 ===bb===
8098 ====bba====
8099 ===bc===
8100 ==c==
8101 ===ca===
8102 !! result
8103 start
8104 ==a==
8105 ===aa===
8106 ====aaa====
8107 xxx
8108
8109 ==c==
8110 ===ca===
8111 !! end
8112
8113 !! test
8114 Section replacement test (section 5)
8115 !! options
8116 replace=5,"xxx"
8117 !! input
8118 start
8119 ==a==
8120 ===aa===
8121 ====aaa====
8122 ==b==
8123 ===ba===
8124 ===bb===
8125 ====bba====
8126 ===bc===
8127 ==c==
8128 ===ca===
8129 !! result
8130 start
8131 ==a==
8132 ===aa===
8133 ====aaa====
8134 ==b==
8135 xxx
8136
8137 ===bb===
8138 ====bba====
8139 ===bc===
8140 ==c==
8141 ===ca===
8142 !! end
8143
8144 !! test
8145 Section replacement test (section 6)
8146 !! options
8147 replace=6,"xxx"
8148 !! input
8149 start
8150 ==a==
8151 ===aa===
8152 ====aaa====
8153 ==b==
8154 ===ba===
8155 ===bb===
8156 ====bba====
8157 ===bc===
8158 ==c==
8159 ===ca===
8160 !! result
8161 start
8162 ==a==
8163 ===aa===
8164 ====aaa====
8165 ==b==
8166 ===ba===
8167 xxx
8168
8169 ===bc===
8170 ==c==
8171 ===ca===
8172 !! end
8173
8174 !! test
8175 Section replacement test (section 7)
8176 !! options
8177 replace=7,"xxx"
8178 !! input
8179 start
8180 ==a==
8181 ===aa===
8182 ====aaa====
8183 ==b==
8184 ===ba===
8185 ===bb===
8186 ====bba====
8187 ===bc===
8188 ==c==
8189 ===ca===
8190 !! result
8191 start
8192 ==a==
8193 ===aa===
8194 ====aaa====
8195 ==b==
8196 ===ba===
8197 ===bb===
8198 xxx
8199
8200 ===bc===
8201 ==c==
8202 ===ca===
8203 !! end
8204
8205 !! test
8206 Section replacement test (section 8)
8207 !! options
8208 replace=8,"xxx"
8209 !! input
8210 start
8211 ==a==
8212 ===aa===
8213 ====aaa====
8214 ==b==
8215 ===ba===
8216 ===bb===
8217 ====bba====
8218 ===bc===
8219 ==c==
8220 ===ca===
8221 !! result
8222 start
8223 ==a==
8224 ===aa===
8225 ====aaa====
8226 ==b==
8227 ===ba===
8228 ===bb===
8229 ====bba====
8230 xxx
8231
8232 ==c==
8233 ===ca===
8234 !!end
8235
8236 !! test
8237 Section replacement test (section 9)
8238 !! options
8239 replace=9,"xxx"
8240 !! input
8241 start
8242 ==a==
8243 ===aa===
8244 ====aaa====
8245 ==b==
8246 ===ba===
8247 ===bb===
8248 ====bba====
8249 ===bc===
8250 ==c==
8251 ===ca===
8252 !! result
8253 start
8254 ==a==
8255 ===aa===
8256 ====aaa====
8257 ==b==
8258 ===ba===
8259 ===bb===
8260 ====bba====
8261 ===bc===
8262 xxx
8263 !! end
8264
8265 !! test
8266 Section replacement test (section 10)
8267 !! options
8268 replace=10,"xxx"
8269 !! input
8270 start
8271 ==a==
8272 ===aa===
8273 ====aaa====
8274 ==b==
8275 ===ba===
8276 ===bb===
8277 ====bba====
8278 ===bc===
8279 ==c==
8280 ===ca===
8281 !! result
8282 start
8283 ==a==
8284 ===aa===
8285 ====aaa====
8286 ==b==
8287 ===ba===
8288 ===bb===
8289 ====bba====
8290 ===bc===
8291 ==c==
8292 xxx
8293 !! end
8294
8295 !! test
8296 Section replacement test with initial whitespace (bug 13728)
8297 !! options
8298 replace=2,"xxx"
8299 !! input
8300 Preformatted initial line
8301 ==a==
8302 ===a===
8303 !! result
8304 Preformatted initial line
8305 ==a==
8306 xxx
8307 !! end
8308
8309
8310 !! test
8311 Section extraction, heading followed by pre with 20 spaces (bug 6398)
8312 !! options
8313 section=1
8314 !! input
8315 ==a==
8316 a
8317 !! result
8318 ==a==
8319 a
8320 !! end
8321
8322 !! test
8323 Section extraction, heading followed by pre with 19 spaces (bug 6398 sanity check)
8324 !! options
8325 section=1
8326 !! input
8327 ==a==
8328 a
8329 !! result
8330 ==a==
8331 a
8332 !! end
8333
8334
8335 !! test
8336 Section extraction, <pre> around bogus header (bug 10309)
8337 !! options
8338 noxml section=2
8339 !! input
8340 == Section One ==
8341 <pre>
8342 =======
8343 </pre>
8344
8345 == Section Two ==
8346 stuff
8347 !! result
8348 == Section Two ==
8349 stuff
8350 !! end
8351
8352 !! test
8353 Section replacement, <pre> around bogus header (bug 10309)
8354 !! options
8355 noxml replace=2,"xxx"
8356 !! input
8357 == Section One ==
8358 <pre>
8359 =======
8360 </pre>
8361
8362 == Section Two ==
8363 stuff
8364 !! result
8365 == Section One ==
8366 <pre>
8367 =======
8368 </pre>
8369
8370 xxx
8371 !! end
8372
8373
8374
8375 !! test
8376 Handling of &#x0A; in URLs
8377 !! input
8378 **irc://&#x0A;a
8379 !! result
8380 <ul><li><ul><li><a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a>
8381 </li></ul>
8382 </li></ul>
8383
8384 !!end
8385
8386 !! test
8387 5 quotes, code coverage +1 line
8388 !! input
8389 '''''
8390 !! result
8391 !! end
8392
8393 !! test
8394 Special:Search page linking.
8395 !! input
8396 {{Special:search}}
8397 !! result
8398 <p><a href="/wiki/Special:Search" title="Special:Search">Special:Search</a>
8399 </p>
8400 !! end
8401
8402 !! test
8403 Say the magic word
8404 !! input
8405 * {{PAGENAME}}
8406 * {{BASEPAGENAME}}
8407 * {{SUBPAGENAME}}
8408 * {{SUBPAGENAMEE}}
8409 * {{BASEPAGENAME}}
8410 * {{BASEPAGENAMEE}}
8411 * {{TALKPAGENAME}}
8412 * {{TALKPAGENAMEE}}
8413 * {{SUBJECTPAGENAME}}
8414 * {{SUBJECTPAGENAMEE}}
8415 * {{NAMESPACEE}}
8416 * {{NAMESPACE}}
8417 * {{TALKSPACE}}
8418 * {{TALKSPACEE}}
8419 * {{SUBJECTSPACE}}
8420 * {{SUBJECTSPACEE}}
8421 * {{Dynamic|{{NUMBEROFUSERS}}|{{NUMBEROFPAGES}}|{{CURRENTVERSION}}|{{CONTENTLANGUAGE}}|{{DIRECTIONMARK}}|{{CURRENTTIMESTAMP}}|{{NUMBEROFARTICLES}}}}
8422 !! result
8423 <ul><li> Parser test
8424 </li><li> Parser test
8425 </li><li> Parser test
8426 </li><li> Parser_test
8427 </li><li> Parser test
8428 </li><li> Parser_test
8429 </li><li> Talk:Parser test
8430 </li><li> Talk:Parser_test
8431 </li><li> Parser test
8432 </li><li> Parser_test
8433 </li><li>
8434 </li><li>
8435 </li><li> Talk
8436 </li><li> Talk
8437 </li><li>
8438 </li><li>
8439 </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>
8440 </li></ul>
8441
8442 !! end
8443 ### Note: Above tests excludes the "{{NUMBEROFADMINS}}" magic word because it generates a MySQL error when included.
8444
8445 !! test
8446 Gallery
8447 !! input
8448 <gallery>
8449 image1.png |
8450 image2.gif|||||
8451
8452 image3|
8453 image4 |300px| centre
8454 image5.svg| http://///////
8455 [[x|xx]]]]
8456 * image6
8457 </gallery>
8458 !! result
8459 <ul class="gallery">
8460 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
8461 <div style="height: 150px;">Image1.png</div>
8462 <div class="gallerytext">
8463 </div>
8464 </div></li>
8465 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
8466 <div style="height: 150px;">Image2.gif</div>
8467 <div class="gallerytext">
8468 <p>||||
8469 </p>
8470 </div>
8471 </div></li>
8472 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
8473 <div style="height: 150px;">Image3</div>
8474 <div class="gallerytext">
8475 </div>
8476 </div></li>
8477 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
8478 <div style="height: 150px;">Image4</div>
8479 <div class="gallerytext">
8480 <p>300px| centre
8481 </p>
8482 </div>
8483 </div></li>
8484 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
8485 <div style="height: 150px;">Image5.svg</div>
8486 <div class="gallerytext">
8487 <p><a rel="nofollow" class="external free" href="http://///////">http://///////</a>
8488 </p>
8489 </div>
8490 </div></li>
8491 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
8492 <div style="height: 150px;">* image6</div>
8493 <div class="gallerytext">
8494 </div>
8495 </div></li>
8496 </ul>
8497
8498 !! end
8499
8500 !! test
8501 Gallery (with options)
8502 !! input
8503 <gallery widths='70px' heights='40px' perrow='2' caption='Foo [[Main Page]]' >
8504 File:Nonexistant.jpg|caption
8505 File:Nonexistant.jpg
8506 image:foobar.jpg|some '''caption''' [[Main Page]]
8507 image:foobar.jpg
8508 image:foobar.jpg|Blabla|alt=This is a foo-bar.|blabla.
8509 </gallery>
8510 !! result
8511 <ul class="gallery" style="max-width: 226px;_width: 226px;">
8512 <li class='gallerycaption'>Foo <a href="/wiki/Main_Page" title="Main Page">Main Page</a></li>
8513 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
8514 <div style="height: 70px;">Nonexistant.jpg</div>
8515 <div class="gallerytext">
8516 <p>caption
8517 </p>
8518 </div>
8519 </div></li>
8520 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
8521 <div style="height: 70px;">Nonexistant.jpg</div>
8522 <div class="gallerytext">
8523 </div>
8524 </div></li>
8525 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
8526 <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>
8527 <div class="gallerytext">
8528 <p>some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
8529 </p>
8530 </div>
8531 </div></li>
8532 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
8533 <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>
8534 <div class="gallerytext">
8535 </div>
8536 </div></li>
8537 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
8538 <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>
8539 <div class="gallerytext">
8540 <p>Blabla|blabla.
8541 </p>
8542 </div>
8543 </div></li>
8544 </ul>
8545
8546 !! end
8547
8548 !! test
8549 Gallery with wikitext inside caption
8550 !! input
8551 <gallery>
8552 File:foobar.jpg|[[File:foobar.jpg|20px|desc|alt=inneralt]]|alt=galleryalt
8553 File:foobar.jpg|{{Test|unamedParam|alt=param}}|alt=galleryalt
8554 </gallery>
8555 !! result
8556 <ul class="gallery">
8557 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
8558 <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>
8559 <div class="gallerytext">
8560 <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>
8561 </p>
8562 </div>
8563 </div></li>
8564 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
8565 <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>
8566 <div class="gallerytext">
8567 <p>This is a test template
8568 </p>
8569 </div>
8570 </div></li>
8571 </ul>
8572
8573 !! end
8574
8575 !! test
8576 gallery (with showfilename option)
8577 !! input
8578 <gallery showfilename>
8579 File:Nonexistant.jpg|caption
8580 File:Nonexistant.jpg
8581 image:foobar.jpg|some '''caption''' [[Main Page]]
8582 File:Foobar.jpg
8583 </gallery>
8584 !! result
8585 <ul class="gallery">
8586 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
8587 <div style="height: 150px;">Nonexistant.jpg</div>
8588 <div class="gallerytext">
8589 <p><a href="/wiki/File:Nonexistant.jpg" title="File:Nonexistant.jpg">Nonexistant.jpg</a><br />
8590 caption
8591 </p>
8592 </div>
8593 </div></li>
8594 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
8595 <div style="height: 150px;">Nonexistant.jpg</div>
8596 <div class="gallerytext">
8597 <p><a href="/wiki/File:Nonexistant.jpg" title="File:Nonexistant.jpg">Nonexistant.jpg</a><br />
8598 </p>
8599 </div>
8600 </div></li>
8601 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
8602 <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>
8603 <div class="gallerytext">
8604 <p><a href="/wiki/File:Foobar.jpg" title="File:Foobar.jpg">Foobar.jpg</a><br />
8605 some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
8606 </p>
8607 </div>
8608 </div></li>
8609 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
8610 <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>
8611 <div class="gallerytext">
8612 <p><a href="/wiki/File:Foobar.jpg" title="File:Foobar.jpg">Foobar.jpg</a><br />
8613 </p>
8614 </div>
8615 </div></li>
8616 </ul>
8617
8618 !! end
8619
8620 !! test
8621 Gallery (with namespace-less filenames)
8622 !! input
8623 <gallery>
8624 File:Nonexistant.jpg
8625 Nonexistant.jpg
8626 image:foobar.jpg
8627 foobar.jpg
8628 </gallery>
8629 !! result
8630 <ul class="gallery">
8631 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
8632 <div style="height: 150px;">Nonexistant.jpg</div>
8633 <div class="gallerytext">
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 </div>
8640 </div></li>
8641 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
8642 <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>
8643 <div class="gallerytext">
8644 </div>
8645 </div></li>
8646 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
8647 <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>
8648 <div class="gallerytext">
8649 </div>
8650 </div></li>
8651 </ul>
8652
8653 !! end
8654
8655 !! test
8656 HTML Hex character encoding (spells the word "JavaScript")
8657 !! input
8658 &#x4A;&#x061;&#x0076;&#x00061;&#x000053;&#x0000063;&#114;&#x0000069;&#00000112;&#x0000000074;
8659 !! result
8660 <p>&#x4a;&#x61;&#x76;&#x61;&#x53;&#x63;&#114;&#x69;&#112;&#x74;
8661 </p>
8662 !! end
8663
8664 !! test
8665 HTML Hex character encoding bogus encoding (bug 26437 regression check)
8666 !! input
8667 &#xsee;&#XSEE;
8668 !! result
8669 <p>&amp;#xsee;&amp;#XSEE;
8670 </p>
8671 !! end
8672
8673 !! test
8674 HTML Hex character encoding mixed case
8675 !! input
8676 &#xEE;&#Xee;
8677 !! result
8678 <p>&#xee;&#xee;
8679 </p>
8680 !! end
8681
8682 !! test
8683 __FORCETOC__ override
8684 !! input
8685 __NEWSECTIONLINK__
8686 __FORCETOC__
8687 !! result
8688 <p><br />
8689 </p>
8690 !! end
8691
8692 !! test
8693 ISBN code coverage
8694 !! input
8695 ISBN 978-0-1234-56&#x20;789
8696 !! result
8697 <p><a href="/wiki/Special:BookSources/9780123456" class="internal mw-magiclink-isbn">ISBN 978-0-1234-56</a>&#x20;789
8698 </p>
8699 !! end
8700
8701 !! test
8702 ISBN followed by 5 spaces
8703 !! input
8704 ISBN
8705 !! result
8706 <p>ISBN
8707 </p>
8708 !! end
8709
8710 !! test
8711 Double ISBN
8712 !! input
8713 ISBN ISBN 1234567890
8714 !! result
8715 <p>ISBN <a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
8716 </p>
8717 !! end
8718
8719 !! test
8720 Bug 22905: <abbr> followed by ISBN followed by </a>
8721 !! input
8722 <abbr>(fr)</abbr> ISBN 2753300917 [http://www.example.com example.com]
8723 !! result
8724 <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>
8725 </p>
8726 !! end
8727
8728 !! test
8729 Double RFC
8730 !! input
8731 RFC RFC 1234
8732 !! result
8733 <p>RFC <a class="external mw-magiclink-rfc" href="//tools.ietf.org/html/rfc1234">RFC 1234</a>
8734 </p>
8735 !! end
8736
8737 !! test
8738 Double RFC with a wiki link
8739 !! input
8740 RFC [[RFC 1234]]
8741 !! result
8742 <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>
8743 </p>
8744 !! end
8745
8746 !! test
8747 RFC code coverage
8748 !! input
8749 RFC 983&#x20;987
8750 !! result
8751 <p><a class="external mw-magiclink-rfc" href="//tools.ietf.org/html/rfc983">RFC 983</a>&#x20;987
8752 </p>
8753 !! end
8754
8755 !! test
8756 Centre-aligned image
8757 !! input
8758 [[Image:foobar.jpg|centre]]
8759 !! result
8760 <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>
8761
8762 !!end
8763
8764 !! test
8765 None-aligned image
8766 !! input
8767 [[Image:foobar.jpg|none]]
8768 !! result
8769 <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>
8770
8771 !!end
8772
8773 !! test
8774 Width + Height sized image (using px) (height is ignored)
8775 !! input
8776 [[Image:foobar.jpg|640x480px]]
8777 !! result
8778 <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>
8779 </p>
8780 !!end
8781
8782 !! test
8783 Width-sized image (using px, no following whitespace)
8784 !! input
8785 [[Image:foobar.jpg|640px]]
8786 !! result
8787 <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>
8788 </p>
8789 !!end
8790
8791 !! test
8792 Width-sized image (using px, with following whitespace - test regression from r39467)
8793 !! input
8794 [[Image:foobar.jpg|640px ]]
8795 !! result
8796 <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>
8797 </p>
8798 !!end
8799
8800 !! test
8801 Width-sized image (using px, with preceding whitespace - test regression from r39467)
8802 !! input
8803 [[Image:foobar.jpg| 640px]]
8804 !! result
8805 <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>
8806 </p>
8807 !!end
8808
8809 !! test
8810 Another italics / bold test
8811 !! input
8812 ''' ''x'
8813 !! result
8814 <pre>'<i> </i>x'
8815 </pre>
8816 !!end
8817
8818 # Note the results may be incorrect, as parserTest output included this:
8819 # XML error: Mismatched tag at byte 6120:
8820 # ...<dd> </dt></dl> </dd...
8821 !! test
8822 dt/dd/dl test
8823 !! options
8824 disabled
8825 !! input
8826 :;;;::
8827 !! result
8828 <dl><dd><dl><dt><dl><dt><dl><dt><dl><dd><dl><dd>
8829 </dd></dl>
8830 </dd></dl>
8831 </dt></dl>
8832 </dt></dl>
8833 </dt></dl>
8834 </dd></dl>
8835
8836 !!end
8837
8838
8839 # Images with the "|" character in external URLs in comment tags; Eats half the comment, leaves unmatched "</a>" tag.
8840 !! test
8841 Images with the "|" character in the comment
8842 !! input
8843 [[image:Foobar.jpg|thumb|An [http://test/?param1=|left|&param2=|x external] URL]]
8844 !! result
8845 <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>
8846
8847 !!end
8848
8849 !! test
8850 [Before] HTML without raw HTML enabled ($wgRawHtml==false)
8851 !! input
8852 <html><script>alert(1);</script></html>
8853 !! result
8854 <p>&lt;html&gt;&lt;script&gt;alert(1);&lt;/script&gt;&lt;/html&gt;
8855 </p>
8856 !! end
8857
8858 !! test
8859 HTML with raw HTML ($wgRawHtml==true)
8860 !! options
8861 rawhtml
8862 !! input
8863 <html><script>alert(1);</script></html>
8864 !! result
8865 <p><script>alert(1);</script>
8866 </p>
8867 !! end
8868
8869 !! test
8870 Parents of subpages, one level up
8871 !! options
8872 subpage title=[[Subpage test/L1/L2/L3]]
8873 !! input
8874 [[../|L2]]
8875 !! result
8876 <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>
8877 </p>
8878 !! end
8879
8880
8881 !! test
8882 Parents of subpages, one level up, not named
8883 !! options
8884 subpage title=[[Subpage test/L1/L2/L3]]
8885 !! input
8886 [[../]]
8887 !! result
8888 <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>
8889 </p>
8890 !! end
8891
8892
8893
8894 !! test
8895 Parents of subpages, two levels up
8896 !! options
8897 subpage title=[[Subpage test/L1/L2/L3]]
8898 !! input
8899 [[../../|L1]]2
8900
8901 [[../../|L1]]l
8902 !! result
8903 <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
8904 </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>
8905 </p>
8906 !! end
8907
8908 !! test
8909 Parents of subpages, two levels up, without trailing slash or name.
8910 !! options
8911 subpage title=[[Subpage test/L1/L2/L3]]
8912 !! input
8913 [[../..]]
8914 !! result
8915 <p>[[../..]]
8916 </p>
8917 !! end
8918
8919 !! test
8920 Parents of subpages, two levels up, with lots of extra trailing slashes.
8921 !! options
8922 subpage title=[[Subpage test/L1/L2/L3]]
8923 !! input
8924 [[../../////]]
8925 !! result
8926 <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>
8927 </p>
8928 !! end
8929
8930 !! test
8931 Definition list code coverage
8932 !! input
8933 ; title : def
8934 ; title : def
8935 ;title: def
8936 !! result
8937 <dl><dt> title &#160;</dt><dd> def
8938 </dd><dt> title&#160;</dt><dd> def
8939 </dd><dt>title</dt><dd> def
8940 </dd></dl>
8941
8942 !! end
8943
8944 !! test
8945 Don't fall for the self-closing div
8946 !! input
8947 <div>hello world</div/>
8948 !! result
8949 <div>hello world</div>
8950
8951 !! end
8952
8953 !! test
8954 MSGNW magic word
8955 !! input
8956 {{MSGNW:msg}}
8957 !! result
8958 <p>&#91;&#91;:Template:Msg&#93;&#93;
8959 </p>
8960 !! end
8961
8962 !! test
8963 RAW magic word
8964 !! input
8965 {{RAW:QUERTY}}
8966 !! result
8967 <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>
8968 </p>
8969 !! end
8970
8971 # This isn't needed for XHTML conformance, but would be handy as a fallback security measure
8972 !! test
8973 Always escape literal '>' in output, not just after '<'
8974 !! input
8975 ><>
8976 !! result
8977 <p>&gt;&lt;&gt;
8978 </p>
8979 !! end
8980
8981 !! test
8982 Template caching
8983 !! input
8984 {{Test}}
8985 {{Test}}
8986 !! result
8987 <p>This is a test template
8988 This is a test template
8989 </p>
8990 !! end
8991
8992
8993 !! article
8994 MediaWiki:Fake
8995 !! text
8996 ==header==
8997 !! endarticle
8998
8999 !! test
9000 Inclusion of !userCanEdit() content
9001 !! input
9002 {{MediaWiki:Fake}}
9003 !! result
9004 <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>
9005
9006 !! end
9007
9008
9009 !! test
9010 Out-of-order TOC heading levels
9011 !! input
9012 ==2==
9013 ======6======
9014 ===3===
9015 =1=
9016 =====5=====
9017 ==2==
9018 !! result
9019 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
9020 <ul>
9021 <li class="toclevel-1 tocsection-1"><a href="#2"><span class="tocnumber">1</span> <span class="toctext">2</span></a>
9022 <ul>
9023 <li class="toclevel-2 tocsection-2"><a href="#6"><span class="tocnumber">1.1</span> <span class="toctext">6</span></a></li>
9024 <li class="toclevel-2 tocsection-3"><a href="#3"><span class="tocnumber">1.2</span> <span class="toctext">3</span></a></li>
9025 </ul>
9026 </li>
9027 <li class="toclevel-1 tocsection-4"><a href="#1"><span class="tocnumber">2</span> <span class="toctext">1</span></a>
9028 <ul>
9029 <li class="toclevel-2 tocsection-5"><a href="#5"><span class="tocnumber">2.1</span> <span class="toctext">5</span></a></li>
9030 <li class="toclevel-2 tocsection-6"><a href="#2_2"><span class="tocnumber">2.2</span> <span class="toctext">2</span></a></li>
9031 </ul>
9032 </li>
9033 </ul>
9034 </td></tr></table>
9035 <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>
9036 <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>
9037 <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>
9038 <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>
9039 <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>
9040 <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>
9041
9042 !! end
9043
9044
9045 !! test
9046 ISBN with a dummy number
9047 !! input
9048 ISBN ---
9049 !! result
9050 <p>ISBN ---
9051 </p>
9052 !! end
9053
9054
9055 !! test
9056 ISBN with space-delimited number
9057 !! input
9058 ISBN 92 9017 032 8
9059 !! result
9060 <p><a href="/wiki/Special:BookSources/9290170328" class="internal mw-magiclink-isbn">ISBN 92 9017 032 8</a>
9061 </p>
9062 !! end
9063
9064
9065 !! test
9066 ISBN with multiple spaces, no number
9067 !! input
9068 ISBN foo
9069 !! result
9070 <p>ISBN foo
9071 </p>
9072 !! end
9073
9074
9075 !! test
9076 ISBN length
9077 !! input
9078 ISBN 123456789
9079
9080 ISBN 1234567890
9081
9082 ISBN 12345678901
9083 !! result
9084 <p>ISBN 123456789
9085 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
9086 </p><p>ISBN 12345678901
9087 </p>
9088 !! end
9089
9090
9091 !! test
9092 ISBN with trailing year (bug 8110)
9093 !! input
9094 ISBN 1-234-56789-0 - 2006
9095
9096 ISBN 1 234 56789 0 - 2006
9097 !! result
9098 <p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1-234-56789-0</a> - 2006
9099 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1 234 56789 0</a> - 2006
9100 </p>
9101 !! end
9102
9103
9104 !! test
9105 anchorencode
9106 !! input
9107 {{anchorencode:foo bar©#%n}}
9108 !! result
9109 <p>foo_bar.C2.A9.23.25n
9110 </p>
9111 !! end
9112
9113 !! test
9114 anchorencode trims spaces
9115 !! input
9116 {{anchorencode: __pretty__please__}}
9117 !! result
9118 <p>pretty_please
9119 </p>
9120 !! end
9121
9122 !! test
9123 anchorencode deals with links
9124 !! input
9125 {{anchorencode: [[hello|world]] [[hi]]}}
9126 !! result
9127 <p>world_hi
9128 </p>
9129 !! end
9130
9131 !! test
9132 anchorencode deals with templates
9133 !! input
9134 {{anchorencode: {{Foo}} }}
9135 !! result
9136 <p>FOO
9137 </p>
9138 !! end
9139
9140 !! test
9141 anchorencode encodes like the TOC generator: (bug 18431)
9142 !! input
9143 === _ +:.3A%3A&&amp;]] ===
9144 {{anchorencode: _ +:.3A%3A&&amp;]] }}
9145 __NOEDITSECTION__
9146 !! result
9147 <h3> <span class="mw-headline" id=".2B:.3A.253A.26.26.5D.5D"> _ +:.3A%3A&amp;&amp;]] </span></h3>
9148 <p>.2B:.3A.253A.26.26.5D.5D
9149 </p>
9150 !! end
9151
9152 # Expected output in the following test is not necessarily expected (there
9153 # should probably be <p> tags inside the <blockquote> in the output) -- it's
9154 # only testing for well-formedness.
9155 !! test
9156 Bug 6200: blockquotes and paragraph formatting
9157 !! input
9158 <blockquote>
9159 foo
9160 </blockquote>
9161
9162 bar
9163
9164 baz
9165 !! result
9166 <blockquote>
9167 foo
9168 </blockquote>
9169 <p>bar
9170 </p>
9171 <pre>baz
9172 </pre>
9173 !! end
9174
9175 !! test
9176 Bug 8293: Use of center tag ruins paragraph formatting
9177 !! input
9178 <center>
9179 foo
9180 </center>
9181
9182 bar
9183
9184 baz
9185 !! result
9186 <center>
9187 <p>foo
9188 </p>
9189 </center>
9190 <p>bar
9191 </p>
9192 <pre>baz
9193 </pre>
9194 !! end
9195
9196
9197 ###
9198 ### Language variants related tests
9199 ###
9200 !! test
9201 Self-link in language variants
9202 !! options
9203 title=[[Dunav]] language=sr
9204 !! input
9205 Both [[Dunav]] and [[Дунав]] are names for this river.
9206 !! result
9207 <p>Both <strong class="selflink">Dunav</strong> and <strong class="selflink">Дунав</strong> are names for this river.
9208 </p>
9209 !!end
9210
9211
9212 !! test
9213 Link to pages in language variants
9214 !! options
9215 language=sr
9216 !! input
9217 Main Page can be written as [[Маин Паге]]
9218 !! result
9219 <p>Main Page can be written as <a href="/wiki/Main_Page" title="Main Page">Маин Паге</a>
9220 </p>
9221 !!end
9222
9223
9224 !! test
9225 Multiple links to pages in language variants
9226 !! options
9227 language=sr
9228 !! input
9229 [[Main Page]] can be written as [[Маин Паге]] same as [[Маин Паге]].
9230 !! result
9231 <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>.
9232 </p>
9233 !!end
9234
9235
9236 !! test
9237 Simple template in language variants
9238 !! options
9239 language=sr
9240 !! input
9241 {{тест}}
9242 !! result
9243 <p>This is a test template
9244 </p>
9245 !! end
9246
9247
9248 !! test
9249 Template with explicit namespace in language variants
9250 !! options
9251 language=sr
9252 !! input
9253 {{Template:тест}}
9254 !! result
9255 <p>This is a test template
9256 </p>
9257 !! end
9258
9259
9260 !! test
9261 Basic test for template parameter in language variants
9262 !! options
9263 language=sr
9264 !! input
9265 {{парамтест|param=foo}}
9266 !! result
9267 <p>This is a test template with parameter foo
9268 </p>
9269 !! end
9270
9271
9272 !! test
9273 Simple category in language variants
9274 !! options
9275 language=sr cat
9276 !! input
9277 [[Category:МедиаWики Усер'с Гуиде]]
9278 !! result
9279 <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>
9280 !! end
9281
9282
9283 !! test
9284 Stripping -{}- tags (language variants)
9285 !! options
9286 language=sr
9287 !! input
9288 Latin proverb: -{Ne nuntium necare}-
9289 !! result
9290 <p>Latin proverb: Ne nuntium necare
9291 </p>
9292 !! end
9293
9294
9295 !! test
9296 Prevent conversion with -{}- tags (language variants)
9297 !! options
9298 language=sr variant=sr-ec
9299 !! input
9300 Latinski: -{Ne nuntium necare}-
9301 !! result
9302 <p>Латински: Ne nuntium necare
9303 </p>
9304 !! end
9305
9306
9307 !! test
9308 Prevent conversion of text with -{}- tags (language variants)
9309 !! options
9310 language=sr variant=sr-ec
9311 !! input
9312 Latinski: -{Ne nuntium necare}-
9313 !! result
9314 <p>Латински: Ne nuntium necare
9315 </p>
9316 !! end
9317
9318
9319 !! test
9320 Prevent conversion of links with -{}- tags (language variants)
9321 !! options
9322 language=sr variant=sr-ec
9323 !! input
9324 -{[[Main Page]]}-
9325 !! result
9326 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
9327 </p>
9328 !! end
9329
9330
9331 !! test
9332 -{}- tags within headlines (within html for parserConvert())
9333 !! options
9334 language=sr variant=sr-ec
9335 !! input
9336 == -{Naslov}- ==
9337 !! result
9338 <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>
9339
9340 !! end
9341
9342
9343 !! test
9344 Explicit definition of language variant alternatives
9345 !! options
9346 language=zh variant=zh-tw
9347 !! input
9348 -{zh:China;zh-tw:Taiwan}-, not China
9349 !! result
9350 <p>Taiwan, not China
9351 </p>
9352 !! end
9353
9354
9355 !! test
9356 Explicit session-wise language variant mapping (A flag and - flag)
9357 !! options
9358 language=zh variant=zh-tw
9359 !! input
9360 Taiwan is not China.
9361 But -{A|zh:China;zh-tw:Taiwan}- is China,
9362 (This-{-|zh:China;zh-tw:Taiwan}- should be stripped!)
9363 and -{China}- is China.
9364 !! result
9365 <p>Taiwan is not China.
9366 But Taiwan is Taiwan,
9367 (This should be stripped!)
9368 and China is China.
9369 </p>
9370 !! end
9371
9372 !! test
9373 Explicit session-wise language variant mapping (H flag for hide)
9374 !! options
9375 language=zh variant=zh-tw
9376 !! input
9377 (This-{H|zh:China;zh-tw:Taiwan}- should be stripped!)
9378 Taiwan is China.
9379 !! result
9380 <p>(This should be stripped!)
9381 Taiwan is Taiwan.
9382 </p>
9383 !! end
9384
9385 !! test
9386 Adding explicit conversion rule for title (T flag)
9387 !! options
9388 language=zh variant=zh-tw showtitle
9389 !! input
9390 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
9391 !! result
9392 Taiwan
9393 <p>Should be stripped!
9394 </p>
9395 !! end
9396
9397 !! test
9398 Testing that changing the language variant here in the tests actually works
9399 !! options
9400 language=zh variant=zh showtitle
9401 !! input
9402 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
9403 !! result
9404 China
9405 <p>Should be stripped!
9406 </p>
9407 !! end
9408
9409 !! test
9410 Bug 24072: more test on conversion rule for title
9411 !! options
9412 language=zh variant=zh-tw showtitle
9413 !! input
9414 This should be stripped-{T|zh:China;zh-tw:Taiwan}-!
9415 This won't take interferes with the title rule-{H|zh:Beijing;zh-tw:Taipei}-.
9416 !! result
9417 Taiwan
9418 <p>This should be stripped!
9419 This won't take interferes with the title rule.
9420 </p>
9421 !! end
9422
9423 !! test
9424 Raw output of variant escape tags (R flag)
9425 !! options
9426 language=zh variant=zh-tw
9427 !! input
9428 Raw: -{R|zh:China;zh-tw:Taiwan}-
9429 !! result
9430 <p>Raw: zh:China;zh-tw:Taiwan
9431 </p>
9432 !! end
9433
9434 !! test
9435 Nested using of manual convert syntax
9436 !! options
9437 language=zh variant=zh-hk
9438 !! input
9439 Nested: -{zh-hans:Hi -{zh-cn:China;zh-sg:Singapore;}-;zh-hant:Hello -{zh-tw:Taiwan;zh-hk:H-{ong}- K-{}-ong;}-;}-!
9440 !! result
9441 <p>Nested: Hello Hong Kong!
9442 </p>
9443 !! end
9444
9445 !! test
9446 Do not convert roman numbers to language variants
9447 !! options
9448 language=sr variant=sr-ec
9449 !! input
9450 Fridrih IV je car.
9451 !! result
9452 <p>Фридрих IV је цар.
9453 </p>
9454 !! end
9455
9456 !! test
9457 Unclosed language converter markup "-{"
9458 !! options
9459 language=sr
9460 !! input
9461 -{T|hello
9462 !! result
9463 <p>-{T|hello
9464 </p>
9465 !! end
9466
9467 !! test
9468 Don't convert raw rule "-{R|=&gt;}-" to "=>"
9469 !! options
9470 language=sr
9471 !! input
9472 -{R|=&gt;}-
9473 !! result
9474 <p>=&gt;
9475 </p>
9476 !!end
9477
9478 !!article
9479 Template:Bullet
9480 !!text
9481 * Bar
9482 !!endarticle
9483
9484 !! test
9485 Bug 529: Uncovered bullet
9486 !! input
9487 * Foo {{bullet}}
9488 !! result
9489 <ul><li> Foo
9490 </li><li> Bar
9491 </li></ul>
9492
9493 !! end
9494
9495 !! test
9496 Bug 529: Uncovered table already at line-start
9497 !! input
9498 x
9499
9500 {{table}}
9501 y
9502 !! result
9503 <p>x
9504 </p>
9505 <table>
9506 <tr>
9507 <td> 1 </td>
9508 <td> 2
9509 </td></tr>
9510 <tr>
9511 <td> 3 </td>
9512 <td> 4
9513 </td></tr></table>
9514 <p>y
9515 </p>
9516 !! end
9517
9518 !! test
9519 Bug 529: Uncovered bullet in parser function result
9520 !! input
9521 * Foo {{lc:{{bullet}} }}
9522 !! result
9523 <ul><li> Foo
9524 </li><li> bar
9525 </li></ul>
9526
9527 !! end
9528
9529 !! test
9530 Bug 5678: Double-parsed template argument
9531 !! input
9532 {{lc:{{{1}}}|hello}}
9533 !! result
9534 <p>{{{1}}}
9535 </p>
9536 !! end
9537
9538 !! test
9539 Bug 5678: Double-parsed template invocation
9540 !! input
9541 {{lc:{{paramtest {{!}} param = hello }} }}
9542 !! result
9543 <p>{{paramtest | param = hello }}
9544 </p>
9545 !! end
9546
9547 !! test
9548 Case insensitivity of parser functions for non-ASCII characters (bug 8143)
9549 !! options
9550 language=cs
9551 title=[[Main Page]]
9552 !! input
9553 {{PRVNÍVELKÉ:ěščř}}
9554 {{prvnívelké:ěščř}}
9555 {{PRVNÍMALÉ:ěščř}}
9556 {{prvnímalé:ěščř}}
9557 {{MALÁ:ěščř}}
9558 {{malá:ěščř}}
9559 {{VELKÁ:ěščř}}
9560 {{velká:ěščř}}
9561 !! result
9562 <p>Ěščř
9563 Ěščř
9564 ěščř
9565 ěščř
9566 ěščř
9567 ěščř
9568 ĚŠČŘ
9569 ĚŠČŘ
9570 </p>
9571 !! end
9572
9573 !! test
9574 Morwen/13: Unclosed link followed by heading
9575 !! input
9576 [[link
9577 ==heading==
9578 !! result
9579 <p>[[link
9580 </p>
9581 <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>
9582
9583 !! end
9584
9585 !! test
9586 HHP2.1: Heuristics for headings in preprocessor parenthetical structures
9587 !! input
9588 {{foo|
9589 =heading=
9590 !! result
9591 <p>{{foo|
9592 </p>
9593 <h1> <span class="mw-headline" id="heading">heading</span></h1>
9594
9595 !! end
9596
9597 !! test
9598 HHP2.2: Heuristics for headings in preprocessor parenthetical structures
9599 !! input
9600 {{foo|
9601 ==heading==
9602 !! result
9603 <p>{{foo|
9604 </p>
9605 <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>
9606
9607 !! end
9608
9609 !! test
9610 Tildes in comments
9611 !! options
9612 pst
9613 !! input
9614 <!-- ~~~~ -->
9615 !! result
9616 <!-- ~~~~ -->
9617 !! end
9618
9619 !! test
9620 Paragraphs inside divs (no extra line breaks)
9621 !! input
9622 <div>Line one
9623
9624 Line two</div>
9625 !! result
9626 <div>Line one
9627 Line two</div>
9628
9629 !! end
9630
9631 !! test
9632 Paragraphs inside divs (extra line break on open)
9633 !! input
9634 <div>
9635 Line one
9636
9637 Line two</div>
9638 !! result
9639 <div>
9640 <p>Line one
9641 </p>
9642 Line two</div>
9643
9644 !! end
9645
9646 !! test
9647 Paragraphs inside divs (extra line break on close)
9648 !! input
9649 <div>Line one
9650
9651 Line two
9652 </div>
9653 !! result
9654 <div>Line one
9655 <p>Line two
9656 </p>
9657 </div>
9658
9659 !! end
9660
9661 !! test
9662 Paragraphs inside divs (extra line break on open and close)
9663 !! input
9664 <div>
9665 Line one
9666
9667 Line two
9668 </div>
9669 !! result
9670 <div>
9671 <p>Line one
9672 </p><p>Line two
9673 </p>
9674 </div>
9675
9676 !! end
9677
9678 !! test
9679 Nesting tags, paragraphs on lines which begin with <div>
9680 !! options
9681 disabled
9682 !! input
9683 <div></div><strong>A
9684 B</strong>
9685 !! result
9686 <div></div>
9687 <p><strong>A
9688 B</strong>
9689 </p>
9690 !! end
9691
9692 # Bug 6200: <blockquote> should behave like <div> with respect to line breaks
9693 !! test
9694 Bug 6200: paragraphs inside blockquotes (no extra line breaks)
9695 !! options
9696 disabled
9697 !! input
9698 <blockquote>Line one
9699
9700 Line two</blockquote>
9701 !! result
9702 <blockquote>Line one
9703 Line two</blockquote>
9704
9705 !! end
9706
9707 !! test
9708 Bug 6200: paragraphs inside blockquotes (extra line break on open)
9709 !! options
9710 disabled
9711 !! input
9712 <blockquote>
9713 Line one
9714
9715 Line two</blockquote>
9716 !! result
9717 <blockquote>
9718 <p>Line one
9719 </p>
9720 Line two</blockquote>
9721
9722 !! end
9723
9724 !! test
9725 Bug 6200: paragraphs inside blockquotes (extra line break on close)
9726 !! options
9727 disabled
9728 !! input
9729 <blockquote>Line one
9730
9731 Line two
9732 </blockquote>
9733 !! result
9734 <blockquote>Line one
9735 <p>Line two
9736 </p>
9737 </blockquote>
9738
9739 !! end
9740
9741 !! test
9742 Bug 6200: paragraphs inside blockquotes (extra line break on open and close)
9743 !! options
9744 disabled
9745 !! input
9746 <blockquote>
9747 Line one
9748
9749 Line two
9750 </blockquote>
9751 !! result
9752 <blockquote>
9753 <p>Line one
9754 </p><p>Line two
9755 </p>
9756 </blockquote>
9757
9758 !! end
9759
9760 !! test
9761 Paragraphs inside blockquotes/divs (no extra line breaks)
9762 !! input
9763 <blockquote><div>Line one
9764
9765 Line two</div></blockquote>
9766 !! result
9767 <blockquote><div>Line one
9768 Line two</div></blockquote>
9769
9770 !! end
9771
9772 !! test
9773 Paragraphs inside blockquotes/divs (extra line break on open)
9774 !! input
9775 <blockquote><div>
9776 Line one
9777
9778 Line two</div></blockquote>
9779 !! result
9780 <blockquote><div>
9781 <p>Line one
9782 </p>
9783 Line two</div></blockquote>
9784
9785 !! end
9786
9787 !! test
9788 Paragraphs inside blockquotes/divs (extra line break on close)
9789 !! input
9790 <blockquote><div>Line one
9791
9792 Line two
9793 </div></blockquote>
9794 !! result
9795 <blockquote><div>Line one
9796 <p>Line two
9797 </p>
9798 </div></blockquote>
9799
9800 !! end
9801
9802 !! test
9803 Paragraphs inside blockquotes/divs (extra line break on open and close)
9804 !! input
9805 <blockquote><div>
9806 Line one
9807
9808 Line two
9809 </div></blockquote>
9810 !! result
9811 <blockquote><div>
9812 <p>Line one
9813 </p><p>Line two
9814 </p>
9815 </div></blockquote>
9816
9817 !! end
9818
9819 !! test
9820 Interwiki links trounced by replaceExternalLinks after early LinkHolderArray expansion
9821 !! options
9822 wgLinkHolderBatchSize=0
9823 !! input
9824 [[meatball:1]]
9825 [[meatball:2]]
9826 [[meatball:3]]
9827 !! result
9828 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?1" class="extiw" title="meatball:1">meatball:1</a>
9829 <a href="http://www.usemod.com/cgi-bin/mb.pl?2" class="extiw" title="meatball:2">meatball:2</a>
9830 <a href="http://www.usemod.com/cgi-bin/mb.pl?3" class="extiw" title="meatball:3">meatball:3</a>
9831 </p>
9832 !! end
9833
9834 !! test
9835 Free external link invading image caption
9836 !! input
9837 [[Image:Foobar.jpg|thumb|http://x|hello]]
9838 !! result
9839 <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>
9840
9841 !! end
9842
9843 !! test
9844 Bug 15196: localised external link numbers
9845 !! options
9846 language=fa
9847 !! input
9848 [http://en.wikipedia.org/]
9849 !! result
9850 <p><a rel="nofollow" class="external autonumber" href="http://en.wikipedia.org/">[۱]</a>
9851 </p>
9852 !! end
9853
9854 !! test
9855 Multibyte character in padleft
9856 !! input
9857 {{padleft:-Hello|7|Æ}}
9858 !! result
9859 <p>Æ-Hello
9860 </p>
9861 !! end
9862
9863 !! test
9864 Multibyte character in padright
9865 !! input
9866 {{padright:Hello-|7|Æ}}
9867 !! result
9868 <p>Hello-Æ
9869 </p>
9870 !! end
9871
9872 !! test
9873 Formatted date
9874 !! config
9875 wgUseDynamicDates=1
9876 !! input
9877 [[2009-03-24]]
9878 !! result
9879 <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>
9880 </p>
9881 !!end
9882
9883 !!test
9884 formatdate parser function
9885 !!input
9886 {{#formatdate:2009-03-24}}
9887 !! result
9888 <p><span class="mw-formatted-date" title="2009-03-24">2009-03-24</span>
9889 </p>
9890 !! end
9891
9892 !!test
9893 formatdate parser function, with default format
9894 !!input
9895 {{#formatdate:2009-03-24|mdy}}
9896 !! result
9897 <p><span class="mw-formatted-date" title="2009-03-24">March 24, 2009</span>
9898 </p>
9899 !! end
9900
9901 !! test
9902 Linked date with autoformatting disabled
9903 !! config
9904 wgUseDynamicDates=false
9905 !! input
9906 [[2009-03-24]]
9907 !! result
9908 <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>
9909 </p>
9910 !! end
9911
9912 !! test
9913 Spacing of numbers in formatted dates
9914 !! input
9915 {{#formatdate:January 15}}
9916 !! result
9917 <p><span class="mw-formatted-date" title="01-15">January 15</span>
9918 </p>
9919 !! end
9920
9921 !! test
9922 Spacing of numbers in formatted dates (linked)
9923 !! config
9924 wgUseDynamicDates=true
9925 !! input
9926 [[January 15]]
9927 !! result
9928 <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>
9929 </p>
9930 !! end
9931
9932 !! test
9933 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
9934 !! options
9935 language=nl title=[[MediaWiki:Common.css]]
9936 !! input
9937 {{#formatdate:2009-03-24|dmy}}
9938 !! result
9939 <p><span class="mw-formatted-date" title="2009-03-24">24 March 2009</span>
9940 </p>
9941 !! end
9942
9943 #
9944 #
9945 #
9946
9947 #
9948 # Edit comments
9949 #
9950
9951 !! test
9952 Edit comment with link
9953 !! options
9954 comment
9955 !! input
9956 I like the [[Main Page]] a lot
9957 !! result
9958 I like the <a href="/wiki/Main_Page" title="Main Page">Main Page</a> a lot
9959 !!end
9960
9961 !! test
9962 Edit comment with link and link text
9963 !! options
9964 comment
9965 !! input
9966 I like the [[Main Page|best pages]] a lot
9967 !! result
9968 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
9969 !!end
9970
9971 !! test
9972 Edit comment with link and link text with suffix
9973 !! options
9974 comment
9975 !! input
9976 I like the [[Main Page|best page]]s a lot
9977 !! result
9978 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
9979 !!end
9980
9981 !! test
9982 Edit comment with section link (non-local, eg in history list)
9983 !! options
9984 comment title=[[Main Page]]
9985 !! input
9986 /* External links */ removed bogus entries
9987 !! result
9988 <a href="/wiki/Main_Page#External_links" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
9989 !!end
9990
9991 !! test
9992 Edit comment with section link and text before it (non-local, eg in history list)
9993 !! options
9994 comment title=[[Main Page]]
9995 !! input
9996 pre-comment text /* External links */ removed bogus entries
9997 !! result
9998 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>
9999 !!end
10000
10001 !! test
10002 Edit comment with section link (local, eg in diff view)
10003 !! options
10004 comment local title=[[Main Page]]
10005 !! input
10006 /* External links */ removed bogus entries
10007 !! result
10008 <a href="#External_links">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
10009 !!end
10010
10011 !! test
10012 Edit comment with subpage link (bug 14080)
10013 !! options
10014 comment
10015 subpage
10016 title=[[Subpage test]]
10017 !! input
10018 Poked at a [[/subpage]] here...
10019 !! result
10020 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a> here...
10021 !!end
10022
10023 !! test
10024 Edit comment with subpage link and link text (bug 14080)
10025 !! options
10026 comment
10027 subpage
10028 title=[[Subpage test]]
10029 !! input
10030 Poked at a [[/subpage|neat little page]] here...
10031 !! result
10032 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">neat little page</a> here...
10033 !!end
10034
10035 !! test
10036 Edit comment with bogus subpage link in non-subpage NS (bug 14080)
10037 !! options
10038 comment
10039 title=[[Subpage test]]
10040 !! input
10041 Poked at a [[/subpage]] here...
10042 !! result
10043 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...
10044 !!end
10045
10046 !! test
10047 Edit comment with bare anchor link (local, as on diff)
10048 !! options
10049 comment
10050 local
10051 title=[[Main Page]]
10052 !!input
10053 [[#section]]
10054 !! result
10055 <a href="#section">#section</a>
10056 !! end
10057
10058 !! test
10059 Edit comment with bare anchor link (non-local, as on history)
10060 !! options
10061 comment
10062 title=[[Main Page]]
10063 !!input
10064 [[#section]]
10065 !! result
10066 <a href="/wiki/Main_Page#section" title="Main Page">#section</a>
10067 !! end
10068
10069 !! test
10070 Anchor starting with underscore
10071 !!input
10072 [[#_ref|One]]
10073 !! result
10074 <p><a href="#_ref">One</a>
10075 </p>
10076 !! end
10077
10078 !! test
10079 Id starting with underscore
10080 !!input
10081 <div id="_ref"></div>
10082 !! result
10083 <div id="_ref"></div>
10084
10085 !! end
10086
10087 !! test
10088 Space normalisation on autocomment (bug 22784)
10089 !! options
10090 comment
10091 title=[[Main Page]]
10092 !!input
10093 /* __hello__world__ */
10094 !! result
10095 <a href="/wiki/Main_Page#hello_world" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">__hello__world__</span></span>
10096 !! end
10097
10098 !! test
10099 percent-encoding and + signs in comments (Bug 26410)
10100 !! options
10101 comment
10102 !!input
10103 [[ABC%33D% ++]] [[ABC%33D% ++|+%20]]
10104 !! result
10105 <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>
10106 !! end
10107
10108 !! test
10109 Bad images - basic functionality
10110 !! options
10111 disabled
10112 !! input
10113 [[File:Bad.jpg]]
10114 !! result
10115 !! end
10116
10117 !! test
10118 Bad images - bug 16039: text after bad image disappears
10119 !! options
10120 disabled
10121 !! input
10122 Foo bar
10123 [[File:Bad.jpg]]
10124 Bar foo
10125 !! result
10126 <p>Foo bar
10127 </p><p>Bar foo
10128 </p>
10129 !! end
10130
10131 !! test
10132 Verify that displaytitle works (bug #22501) no displaytitle
10133 !! options
10134 showtitle
10135 !! config
10136 wgAllowDisplayTitle=true
10137 wgRestrictDisplayTitle=false
10138 !! input
10139 this is not the the title
10140 !! result
10141 Parser test
10142 <p>this is not the the title
10143 </p>
10144 !! end
10145
10146 !! test
10147 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=false
10148 !! options
10149 showtitle
10150 title=[[Screen]]
10151 !! config
10152 wgAllowDisplayTitle=true
10153 wgRestrictDisplayTitle=false
10154 !! input
10155 this is not the the title
10156 {{DISPLAYTITLE:whatever}}
10157 !! result
10158 whatever
10159 <p>this is not the the title
10160 </p>
10161 !! end
10162
10163 !! test
10164 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true mismatch
10165 !! options
10166 showtitle
10167 title=[[Screen]]
10168 !! config
10169 wgAllowDisplayTitle=true
10170 wgRestrictDisplayTitle=true
10171 !! input
10172 this is not the the title
10173 {{DISPLAYTITLE:whatever}}
10174 !! result
10175 Screen
10176 <p>this is not the the title
10177 </p>
10178 !! end
10179
10180 !! test
10181 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true matching
10182 !! options
10183 showtitle
10184 title=[[Screen]]
10185 !! config
10186 wgAllowDisplayTitle=true
10187 wgRestrictDisplayTitle=true
10188 !! input
10189 this is not the the title
10190 {{DISPLAYTITLE:screen}}
10191 !! result
10192 screen
10193 <p>this is not the the title
10194 </p>
10195 !! end
10196
10197 !! test
10198 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false
10199 !! options
10200 showtitle
10201 title=[[Screen]]
10202 !! config
10203 wgAllowDisplayTitle=false
10204 !! input
10205 this is not the the title
10206 {{DISPLAYTITLE:screen}}
10207 !! result
10208 Screen
10209 <p>this is not the the title
10210 <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>
10211 </p>
10212 !! end
10213
10214 !! test
10215 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false no DISPLAYTITLE
10216 !! options
10217 showtitle
10218 title=[[Screen]]
10219 !! config
10220 wgAllowDisplayTitle=false
10221 !! input
10222 this is not the the title
10223 !! result
10224 Screen
10225 <p>this is not the the title
10226 </p>
10227 !! end
10228
10229 !! test
10230 preload: check <noinclude> and <includeonly>
10231 !! options
10232 preload
10233 !! input
10234 Hello <noinclude>cruel</noinclude><includeonly>kind</includeonly> world.
10235 !! result
10236 Hello kind world.
10237 !! end
10238
10239 !! test
10240 preload: check <onlyinclude>
10241 !! options
10242 preload
10243 !! input
10244 Goodbye <onlyinclude>Hello world</onlyinclude>
10245 !! result
10246 Hello world
10247 !! end
10248
10249 !! test
10250 preload: can pass tags through if we want to
10251 !! options
10252 preload
10253 !! input
10254 <includeonly><</includeonly>includeonly>Hello world<includeonly><</includeonly>/includeonly>
10255 !! result
10256 <includeonly>Hello world</includeonly>
10257 !! end
10258
10259 !! test
10260 preload: check that it doesn't try to do tricks
10261 !! options
10262 preload
10263 !! input
10264 * <!-- Hello --> ''{{world}}'' {{<includeonly>subst:</includeonly>How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
10265 !! result
10266 * <!-- Hello --> ''{{world}}'' {{subst:How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
10267 !! end
10268
10269 !! test
10270 Play a bit with r67090 and bug 3158
10271 !! options
10272 disabled
10273 !! input
10274 <div style="width:50% !important">&nbsp;</div>
10275 <div style="width:50%&nbsp;!important">&nbsp;</div>
10276 <div style="width:50%&#160;!important">&nbsp;</div>
10277 <div style="border : solid;">&nbsp;</div>
10278 !! result
10279 <div style="width:50% !important">&nbsp;</div>
10280 <div style="width:50% !important">&nbsp;</div>
10281 <div style="width:50% !important">&nbsp;</div>
10282 <div style="border&#160;: solid;">&nbsp;</div>
10283
10284 !! end
10285
10286 !! test
10287 HTML5 data attributes
10288 !! input
10289 <span data-foo="bar">Baz</span>
10290 <p data-abc-def_hij="">Quuz</p>
10291 !! result
10292 <p><span data-foo="bar">Baz</span>
10293 </p>
10294 <p data-abc-def_hij="">Quuz</p>
10295
10296 !! end
10297
10298 !! test
10299 percent-encoding and + signs in internal links (Bug 26410)
10300 !! input
10301 [[User:+%]] [[Page+title%]]
10302 [[%+]] [[%+|%20]] [[%+ ]] [[%+r]]
10303 [[%]] [[+]] [[image:%+abc%39|foo|[[bar]]]]
10304 [[%33%45]] [[%33%45+]]
10305 !! result
10306 <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>
10307 <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>
10308 <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>
10309 <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>
10310 </p>
10311 !! end
10312
10313 !! test
10314 Special characters in embedded file links (bug 27679)
10315 !! input
10316 [[File:Contains & ampersand.jpg]]
10317 [[File:Does not exist.jpg|Title with & ampersand]]
10318 !! result
10319 <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>
10320 <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>
10321 </p>
10322 !! end
10323
10324
10325 !! test
10326 Confirm that 'apos' named character reference doesn't make it to output (not legal in HTML 4)
10327 !! input
10328 Text&apos;s been normalized?
10329 !! result
10330 <p>Text&#39;s been normalized?
10331 </p>
10332 !! end
10333
10334 !! test
10335 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate free external links
10336 !! input
10337 http://www.example.org/ <-- U+3000 (vim: ^Vu3000)
10338 !! result
10339 <p><a rel="nofollow" class="external free" href="http://www.example.org/">http://www.example.org/</a> &lt;-- U+3000 (vim: ^Vu3000)
10340 </p>
10341 !! end
10342
10343 !! test
10344 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate bracketed external links
10345 !! input
10346 [http://www.example.org/ ideograms]
10347 !! result
10348 <p><a rel="nofollow" class="external text" href="http://www.example.org/">ideograms</a>
10349 </p>
10350 !! end
10351
10352 !! test
10353 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate external images links
10354 !! input
10355 http://www.example.org/pic.png <-- U+3000 (vim: ^Vu3000)
10356 !! result
10357 <p><img src="http://www.example.org/pic.png" alt="pic.png" /> &lt;-- U+3000 (vim: ^Vu3000)
10358 </p>
10359 !! end
10360
10361 !! article
10362 Mediawiki:loop1
10363 !! text
10364 {{Identical|A}}
10365 !! endarticle
10366
10367 !! article
10368 Mediawiki:loop2
10369 !! text
10370 {{Identical|B}}
10371 !! endarticle
10372
10373 !! article
10374 Template:Identical
10375 !! text
10376 {{int:loop1}}
10377 {{int:loop2}}
10378 !! endarticle
10379
10380 !! test
10381 Bug 31098 Template which includes system messages which includes the template
10382 !! input
10383 {{Identical}}
10384 !! result
10385 <p><span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
10386 <span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
10387 </p>
10388 !! end
10389
10390 !! test
10391 Deprecated presentational attributes are converted to css
10392 !! input
10393 {|
10394 | valign=top align=left width=100 height=25% | Asdf
10395 |}
10396 <ul type="disc"></ul>
10397 !! result
10398 <table>
10399 <tr>
10400 <td style="text-align: left; height: 25%; vertical-align: top; width: 100px;"> Asdf
10401 </td></tr></table>
10402 <ul style="list-style-type: disc;"></ul>
10403
10404 !! end
10405
10406 !! test
10407 Bug31490 Turkish: ucfirst 'blah'
10408 !! options
10409 language=tr
10410 !! input
10411 {{ucfirst:blah}}
10412 !! result
10413 <p>Blah
10414 </p>
10415 !! end
10416
10417 !! test
10418 Bug31490 Turkish: ucfirst 'ix'
10419 !! options
10420 language=tr
10421 !! input
10422 {{ucfirst:ix}}
10423 !! result
10424 <p>İx
10425 </p>
10426 !! end
10427
10428 !! test
10429 Bug31490 Turkish: lcfirst 'BLAH'
10430 !! options
10431 language=tr
10432 !! input
10433 {{lcfirst:BLAH}}
10434 !! result
10435 <p>bLAH
10436 </p>
10437 !! end
10438
10439 !! test
10440 Bug31490 Turkish: ucfırst (with a dotless i)
10441 !! options
10442 language=tr
10443 !! input
10444 {{ucfırst:blah}}
10445 !! result
10446 <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>
10447 </p>
10448 !! end
10449
10450 !! test
10451 Bug31490 ucfırst (with a dotless i) with English language
10452 !! options
10453 language=en
10454 !! input
10455 {{ucfırst:blah}}
10456 !! result
10457 <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>
10458 </p>
10459 !! end
10460
10461 !! test
10462 Bug 26375: TOC with italics
10463 !! options
10464 title=[[Main Page]]
10465 !! input
10466 __TOC__
10467 == ''Lost'' episodes ==
10468 !! result
10469 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
10470 <ul>
10471 <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>
10472 </ul>
10473 </td></tr></table>
10474 <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>
10475
10476 !! end
10477
10478 !! test
10479 Bug 26375: TOC with bold
10480 !! options
10481 title=[[Main Page]]
10482 !! input
10483 __TOC__
10484 == '''should be bold''' then normal text ==
10485 !! result
10486 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
10487 <ul>
10488 <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>
10489 </ul>
10490 </td></tr></table>
10491 <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>
10492
10493 !! end
10494
10495 !! test
10496 Bug 33845: Headings become cursive in TOC when they contain an image
10497 !! options
10498 title=[[Main Page]]
10499 !! input
10500 __TOC__
10501 == Image [[Image:foobar.jpg]] ==
10502 !! result
10503 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
10504 <ul>
10505 <li class="toclevel-1 tocsection-1"><a href="#Image"><span class="tocnumber">1</span> <span class="toctext">Image</span></a></li>
10506 </ul>
10507 </td></tr></table>
10508 <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>
10509
10510 !! end
10511
10512 !! test
10513 Bug 33845 (2): Headings become bold in TOC when they contain a blockquote
10514 !! options
10515 title=[[Main Page]]
10516 !! input
10517 __TOC__
10518 == <blockquote>Quote</blockquote> ==
10519 !! result
10520 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
10521 <ul>
10522 <li class="toclevel-1 tocsection-1"><a href="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
10523 </ul>
10524 </td></tr></table>
10525 <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>
10526
10527 !! end
10528
10529 !! test
10530 Unclosed tags in TOC
10531 !! options
10532 title=[[Main Page]]
10533 !! input
10534 __TOC__
10535 == Proof: 2 < 3 ==
10536 <small>Hanc marginis exiguitas non caperet.</small>
10537 QED
10538 !! result
10539 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
10540 <ul>
10541 <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>
10542 </ul>
10543 </td></tr></table>
10544 <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>
10545 <p><small>Hanc marginis exiguitas non caperet.</small>
10546 QED
10547 </p>
10548 !! end
10549
10550 !! test
10551 Multiple tags in TOC
10552 !! input
10553 __TOC__
10554 == <i>Foo</i> <b>Bar</b> ==
10555
10556 == <i>Foo</i> <blockquote>Bar</blockquote> ==
10557 !! result
10558 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
10559 <ul>
10560 <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>
10561 <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>
10562 </ul>
10563 </td></tr></table>
10564 <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>
10565 <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>
10566
10567 !! end
10568
10569 !! test
10570 Tags with parameters in TOC
10571 !! input
10572 __TOC__
10573 == <sup class="in-h2">Hello</sup> ==
10574
10575 == <sup class="a > b">Evilbye</sup> ==
10576 !! result
10577 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
10578 <ul>
10579 <li class="toclevel-1 tocsection-1"><a href="#Hello"><span class="tocnumber">1</span> <span class="toctext"><sup>Hello</sup></span></a></li>
10580 <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>
10581 </ul>
10582 </td></tr></table>
10583 <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>
10584 <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>
10585
10586 !! end
10587
10588 !! test
10589 span tags with directionality in TOC
10590 !! input
10591 __TOC__
10592 == <span dir="ltr">C++</span> ==
10593
10594 == <span dir="rtl">זבנג!</span> ==
10595
10596 == <span style="font-style: italic">The attributes on these span tags must be deleted from the TOC</span> ==
10597
10598 == <span style="font-style: italic" dir="ltr">All attributes on these span tags must be deleted from the TOC</span> ==
10599
10600 == <span dir="ltr" style="font-style: italic">Attributes after dir on these span tags must be deleted from the TOC</span> ==
10601 !! result
10602 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
10603 <ul>
10604 <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>
10605 <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>
10606 <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>
10607 <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>
10608 <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>
10609 </ul>
10610 </td></tr></table>
10611 <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>
10612 <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>
10613 <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>
10614 <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>
10615 <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>
10616
10617 !! end
10618
10619 !! article
10620 MediaWiki:Bug32057
10621 !! text
10622 == {{int:headline_sample}} ==
10623 !! endarticle
10624
10625 !! test
10626 Bug 32057: Title needed when expanding <h> nodes.
10627 !! options
10628 title=[[Main Page]]
10629 !! input
10630 {{int:Bug32057}}
10631 !! result
10632 <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>
10633
10634 !! end
10635
10636 !! test
10637 Strip marker in urlencode
10638 !! input
10639 {{urlencode:x<nowiki/>y}}
10640 {{urlencode:x<nowiki/>y|wiki}}
10641 {{urlencode:x<nowiki/>y|path}}
10642 !! result
10643 <p>xy
10644 xy
10645 xy
10646 </p>
10647 !! end
10648
10649 !! test
10650 Strip marker in lc
10651 !! input
10652 {{lc:x<nowiki/>y}}
10653 !! result
10654 <p>xy
10655 </p>
10656 !! end
10657
10658 !! test
10659 Strip marker in uc
10660 !! input
10661 {{uc:x<nowiki/>y}}
10662 !! result
10663 <p>XY
10664 </p>
10665 !! end
10666
10667 !! test
10668 Strip marker in formatNum
10669 !! input
10670 {{formatnum:1<nowiki/>2}}
10671 {{formatnum:1<nowiki/>2|R}}
10672 !! result
10673 <p>12
10674 12
10675 </p>
10676 !! end
10677
10678 !! test
10679 Strip marker in grammar
10680 !! options
10681 language=fi
10682 !! input
10683 {{grammar:elative|foo<nowiki/>bar}}
10684 !! result
10685 <p>foobarista
10686 </p>
10687 !! end
10688
10689 !! test
10690 Strip marker in padleft
10691 !! input
10692 {{padleft:|2|x<nowiki/>y}}
10693 !! result
10694 <p>xy
10695 </p>
10696 !! end
10697
10698 !! test
10699 Strip marker in padright
10700 !! input
10701 {{padright:|2|x<nowiki/>y}}
10702 !! result
10703 <p>xy
10704 </p>
10705 !! end
10706
10707 !! test
10708 Strip marker in anchorencode
10709 !! input
10710 {{anchorencode:x<nowiki/>y}}
10711 !! result
10712 <p>xy
10713 </p>
10714 !! end
10715
10716 !! test
10717 nowiki inside link inside heading (bug 18295)
10718 !! input
10719 ==[[foo|x<nowiki>y</nowiki>z]]==
10720 !! result
10721 <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>
10722
10723 !! end
10724
10725 !! test
10726 new support for bdi element (bug 31817)
10727 !! input
10728 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
10729 !! result
10730 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
10731
10732 !!end
10733
10734 !! test
10735 Ignore pipe between table row attributes
10736 !! input
10737 {|
10738 | quux
10739 |- id=foo | style='color: red'
10740 | bar
10741 |}
10742 !! result
10743 <table>
10744 <tr>
10745 <td> quux
10746 </td></tr>
10747 <tr id="foo" style="color: red">
10748 <td> bar
10749 </td></tr></table>
10750
10751 !! end
10752
10753 !!test
10754 Gallery override link with WikiLink (bug 34852)
10755 !! input
10756 <gallery>
10757 File:foobar.jpg|caption|alt=galleryalt|link=InterWikiLink
10758 </gallery>
10759 !! result
10760 <ul class="gallery">
10761 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
10762 <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>
10763 <div class="gallerytext">
10764 <p>caption
10765 </p>
10766 </div>
10767 </div></li>
10768 </ul>
10769
10770 !! end
10771
10772 !!test
10773 Gallery override link with absolute external link (bug 34852)
10774 !! input
10775 <gallery>
10776 File:foobar.jpg|caption|alt=galleryalt|link=http://www.example.org
10777 </gallery>
10778 !! result
10779 <ul class="gallery">
10780 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
10781 <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>
10782 <div class="gallerytext">
10783 <p>caption
10784 </p>
10785 </div>
10786 </div></li>
10787 </ul>
10788
10789 !! end
10790
10791 !!test
10792 Gallery override link with malicious javascript (bug 34852)
10793 !! input
10794 <gallery>
10795 File:foobar.jpg|caption|alt=galleryalt|link=" onclick="alert('malicious javascript code!');
10796 </gallery>
10797 !! result
10798 <ul class="gallery">
10799 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
10800 <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>
10801 <div class="gallerytext">
10802 <p>caption
10803 </p>
10804 </div>
10805 </div></li>
10806 </ul>
10807
10808 !! end
10809
10810 !!test
10811 Language parser function
10812 !! input
10813 {{#language:ar}}
10814 !! result
10815 <p>العربية
10816 </p>
10817 !! end
10818
10819 !!test
10820 Padleft and padright as substr
10821 !! input
10822 {{padleft:|3|abcde}}
10823 {{padright:|3|abcde}}
10824 !! result
10825 <p>abc
10826 abc
10827 </p>
10828 !! end
10829
10830 !!test
10831 Bug 34939 - Case insensitive link parsing ([HttP://])
10832 !! input
10833 [HttP://MediaWiki.Org/]
10834 !! result
10835 <p><a rel="nofollow" class="external autonumber" href="HttP://MediaWiki.Org/">[1]</a>
10836 </p>
10837 !! end
10838
10839 !!test
10840 Bug 34939 - Case insensitive link parsing ([HttP:// title])
10841 !! input
10842 [HttP://MediaWiki.Org/ MediaWiki]
10843 !! result
10844 <p><a rel="nofollow" class="external text" href="HttP://MediaWiki.Org/">MediaWiki</a>
10845 </p>
10846 !! end
10847
10848 !!test
10849 Bug 34939 - Case insensitive link parsing (HttP://)
10850 !! input
10851 HttP://MediaWiki.Org/
10852 !! result
10853 <p><a rel="nofollow" class="external free" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a>
10854 </p>
10855 !! end
10856
10857
10858 TODO:
10859 more images
10860 more tables
10861 character entities
10862 and much more
10863 Try for 100% code coverage