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