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