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