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