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