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