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