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