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