Merge "Add ss_active_users in SiteStats::isSane"
[mediawiki.git] / tests / parser / parserTests.txt
blobd5e221a92df02e596ce77cec6f4d45be11c8dcdd
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
5 # The syntax should be fairly self-explanatory.
7 # Currently supported test options:
8 # One of the following three:
10 #  (default)  generate HTML output
11 #  pst        apply pre-save transform
12 #  msg        apply message transform
14 # Plus any combination of these:
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 # parsoid       parsoid-only test (not run by PHP parser)
25 # php           php-only test (not run by the parsoid parser)
26 # showtitle     make the first line the title
27 # comment       run through Linker::formatComment() instead of main parser
28 # local         format section links in edit comment text as local links
30 # For testing purposes, temporary articles can created:
31 # !!article / NAMESPACE:TITLE / !!text / ARTICLE TEXT / !!endarticle
32 # where '/' denotes a newline.
34 # This is the standard article assumed to exist.
35 !! article
36 Main Page
37 !! text
38 blah blah
39 !! endarticle
41 !!article
42 Template:Foo
43 !!text
44 FOO
45 !!endarticle
47 !! article
48 Template:Blank
49 !! text
50 !! endarticle
52 !! article
53 Template:pipe
54 !! text
56 !! endarticle
58 !!article
59 MediaWiki:bad image list
60 !!text
61 * [[File:Bad.jpg]] except [[Nasty page]]
62 !!endarticle
64 !! article
65 Template:inner list
66 !! text
67 * item 1
68 !! endarticle
70 !! article
71 Template:tbl-start
72 !! text
74 !! endarticle
76 !! article
77 Template:tbl-end
78 !! text
80 !! endarticle
82 !! article
83 Template:!
84 !! text
86 !! endarticle
88 !! article
89 Template:echo
90 !! text
91 {{{1}}}
92 !! endarticle
94 !! article
95 Template:echo_with_span
96 !! text
97 <span>{{{1}}}</span>
98 !! endarticle
100 !! article
101 Template:echo_with_div
102 !! text
103 <div>{{{1}}}</div>
104 !! endarticle
106 !! article
107 Template:attr_str
108 !! text
109 {{{1}}}="{{{2}}}"
110 !! endarticle
112 !! article
113 Template:table_attribs
114 !! text
115 <noinclude>
116 |</noinclude>style="color: red"| Foo
117 !! endarticle
119 !! article
121 !! text
122 Weirdo titles!
123 !! endarticle
126 ### Basic tests
128 !! test
129 Blank input
130 !! input
131 !! result
132 !! end
135 !! test
136 Simple paragraph
137 !! input
138 This is a simple paragraph.
139 !! result
140 <p>This is a simple paragraph.
141 </p>
142 !! end
144 !! test
145 Paragraphs with extra newline spacing
146 !! input
156 booz
157 !! result
158 <p>foo
159 </p><p>bar
160 </p><p><br />
162 </p><p><br />
163 </p><p>booz
164 </p>
165 !! end
167 !! test
168 Paragraphs with newline spacing with comment lines in between
169 !! input
170 ----
172 <!--foo-->
174 ----
176 <!--foo--><!--More than 1 comment disables stripping of this line!-->
178 ----
180 <!--foo-->
183 ----
186 <!--foo-->
188 ----
190 <!--foo-->
194 ----
198 <!--foo-->
200 ----
201 !! result
202 <hr />
203 <p>a
205 </p>
206 <hr />
207 <p>a
208 </p><p>b
209 </p>
210 <hr />
211 <p>a
212 </p><p>b
213 </p>
214 <hr />
215 <p>a
216 </p><p>b
217 </p>
218 <hr />
219 <p>a
220 </p><p><br />
222 </p>
223 <hr />
224 <p>a
225 </p><p><br />
227 </p>
228 <hr />
230 !! end
232 !! test
233 Paragraphs with newline spacing with non-empty white-space lines in between
234 !! input
235 ----
239 ----
244 ----
245 !! result
246 <hr />
247 <p>a
248 </p><p>b
249 </p>
250 <hr />
251 <p>a
252 </p><p><br /> 
254 </p>
255 <hr />
257 !! end
259 !! test
260 Paragraphs with newline spacing with non-empty mixed comment and white-space lines in between
261 !! input
262 ----
264  <!--foo-->
266 ----
268  <!--foo--><!--More than 1 comment disables stripping of this line!-->
270 ----
273 <!--foo-->
274  <!--bar-->
276 ----
279  <!--foo-->
280  <!--bar-->
283 ----
284 !! result
285 <hr />
286 <p>a
288 </p>
289 <hr />
290 <p>a
291 </p><p>b
292 </p>
293 <hr />
294 <p>a
295 </p><p>b
296 </p>
297 <hr />
298 <p>a
299 </p><p><br /> 
301 </p>
302 <hr />
304 !! end
306 !! test
307 Extra newlines: More paragraphs with indented comment
308 !! input
311    <!--boo-->
314 !!result
315 <p>a
316 </p><p><br />
318 </p>
319 !!end
321 !! test
322 Extra newlines followed by heading
323 !! input
329 [[a]]
333 !! result
334 <p>a
335 </p><p><br />
336 </p>
337 <h1><span class="mw-headline" id="b">b</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: b">edit</a>]</span></h1>
338 <p><a href="/index.php?title=A&amp;action=edit&amp;redlink=1" class="new" title="A (page does not exist)">a</a>
339 </p><p><br />
340 </p>
341 <h1><span class="mw-headline" id="b_2">b</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: b">edit</a>]</span></h1>
343 !! end
345 !! test
346 Extra newlines between heading and content are swallowed
347 !! input
352 [[a]]
353 !! result
354 <h1><span class="mw-headline" id="b">b</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: b">edit</a>]</span></h1>
355 <p><a href="/index.php?title=A&amp;action=edit&amp;redlink=1" class="new" title="A (page does not exist)">a</a>
356 </p>
357 !! end
359 !! test
360 Parsing an URL
361 !! input
362 http://fr.wikipedia.org/wiki/🍺
363 <!-- EasterEgg we love beer, better be able be able to link to it -->
364 !! result
365 <p><a rel="nofollow" class="external free" href="http://fr.wikipedia.org/wiki/🍺">http://fr.wikipedia.org/wiki/🍺</a>
366 </p>
367 !! end
369 !! test
370 Simple list
371 !! input
372 * Item 1
373 * Item 2
374 !! result
375 <ul><li> Item 1
376 </li><li> Item 2
377 </li></ul>
379 !! end
381 !! test
382 Italics and bold
383 !! input
384 * plain
385 * plain''italic''plain
386 * plain''italic''plain''italic''plain
387 * plain'''bold'''plain
388 * plain'''bold'''plain'''bold'''plain
389 * plain''italic''plain'''bold'''plain
390 * plain'''bold'''plain''italic''plain
391 * plain''italic'''bold-italic'''italic''plain
392 * plain'''bold''bold-italic''bold'''plain
393 * plain'''''bold-italic'''italic''plain
394 * plain'''''bold-italic''bold'''plain
395 * plain''italic'''bold-italic'''''plain
396 * plain'''bold''bold-italic'''''plain
397 * plain l'''italic''plain
398 * plain l''''bold''' plain
399 !! result
400 <ul><li> plain
401 </li><li> plain<i>italic</i>plain
402 </li><li> plain<i>italic</i>plain<i>italic</i>plain
403 </li><li> plain<b>bold</b>plain
404 </li><li> plain<b>bold</b>plain<b>bold</b>plain
405 </li><li> plain<i>italic</i>plain<b>bold</b>plain
406 </li><li> plain<b>bold</b>plain<i>italic</i>plain
407 </li><li> plain<i>italic<b>bold-italic</b>italic</i>plain
408 </li><li> plain<b>bold<i>bold-italic</i>bold</b>plain
409 </li><li> plain<i><b>bold-italic</b>italic</i>plain
410 </li><li> plain<b><i>bold-italic</i>bold</b>plain
411 </li><li> plain<i>italic<b>bold-italic</b></i>plain
412 </li><li> plain<b>bold<i>bold-italic</i></b>plain
413 </li><li> plain l'<i>italic</i>plain
414 </li><li> plain l'<b>bold</b> plain
415 </li></ul>
417 !! end
419 # this example taken from the simple/Moon article
420 !! test
421 Italics and possessives
422 !! input
423 obtained by ''[[Lunar Prospector]]'''s gamma-ray spectrometer
424 !! result
425 <p>obtained by <i><a href="/index.php?title=Lunar_Prospector&amp;action=edit&amp;redlink=1" class="new" title="Lunar Prospector (page does not exist)">Lunar Prospector</a>'</i>s gamma-ray spectrometer
426 </p>
427 !! end
430 ### 2-quote opening sequence tests
432 !! test
433 Italics and bold: 2-quote opening sequence: (2,2)
434 !! input
435 ''foo''
436 !! result
437 <p><i>foo</i>
438 </p>
439 !!end
442 !! test
443 Italics and bold: 2-quote opening sequence: (2,3)
444 !! input
445 ''foo'''
446 !! result
447 <p><i>foo'</i>
448 </p>
449 !!end
452 !! test
453 Italics and bold: 2-quote opening sequence: (2,4)
454 !! input
455 ''foo''''
456 !! result
457 <p><i>foo''</i>
458 </p>
459 !!end
462 !! test
463 Italics and bold: 2-quote opening sequence: (2,5) (php)
464 !! options
466 !! input
467 ''foo'''''
468 !! result
469 <p><i>foo</i>
470 </p>
471 !!end
472 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
473 !! test
474 Italics and bold: 2-quote opening sequence: (2,5) (parsoid)
475 !! options
476 parsoid
477 !! input
478 ''foo'''''
479 !! result
480 <p><i>foo</i><b></b>
481 </p>
482 !!end
486 ### 3-quote opening sequence tests
489 !! test
490 Italics and bold: 3-quote opening sequence: (3,2)
491 !! input
492 '''foo''
493 !! result
494 <p>'<i>foo</i>
495 </p>
496 !!end
499 !! test
500 Italics and bold: 3-quote opening sequence: (3,3)
501 !! input
502 '''foo'''
503 !! result
504 <p><b>foo</b>
505 </p>
506 !!end
509 !! test
510 Italics and bold: 3-quote opening sequence: (3,4)
511 !! input
512 '''foo''''
513 !! result
514 <p><b>foo'</b>
515 </p>
516 !!end
519 !! test
520 Italics and bold: 3-quote opening sequence: (3,5) (php)
521 !! options
523 !! input
524 '''foo'''''
525 !! result
526 <p><b>foo</b>
527 </p>
528 !!end
529 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
530 !! test
531 Italics and bold: 3-quote opening sequence: (3,5) (parsoid)
532 !! options
533 parsoid
534 !! input
535 '''foo'''''
536 !! result
537 <p><b>foo<i></i></b>
538 </p>
539 !!end
543 ### 4-quote opening sequence tests
546 !! test
547 Italics and bold: 4-quote opening sequence: (4,2)
548 !! input
549 ''''foo''
550 !! result
551 <p>''<i>foo</i>
552 </p>
553 !!end
556 !! test
557 Italics and bold: 4-quote opening sequence: (4,3)
558 !! input
559 ''''foo'''
560 !! result
561 <p>'<b>foo</b>
562 </p>
563 !!end
566 !! test
567 Italics and bold: 4-quote opening sequence: (4,4)
568 !! input
569 ''''foo''''
570 !! result
571 <p>'<b>foo'</b>
572 </p>
573 !!end
576 !! test
577 Italics and bold: 4-quote opening sequence: (4,5) (php)
578 !! options
580 !! input
581 ''''foo'''''
582 !! result
583 <p>'<b>foo</b>
584 </p>
585 !!end
586 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
587 !! test
588 Italics and bold: 4-quote opening sequence: (4,5) (parsoid)
589 !! options
590 parsoid
591 !! input
592 ''''foo'''''
593 !! result
594 <p>'<b>foo<i></i></b>
595 </p>
596 !!end
600 ### 5-quote opening sequence tests
603 !! test
604 Italics and bold: 5-quote opening sequence: (5,2) (php)
605 !! options
607 !! input
608 '''''foo''
609 !! result
610 <p><b><i>foo</i></b>
611 </p>
612 !!end
613 # Parsoid reverses the nesting order, compared to the PHP parser
614 !! test
615 Italics and bold: 5-quote opening sequence: (5,2) (parsoid)
616 !! options
617 parsoid
618 !! input
619 '''''foo''
620 !! result
621 <p><i><b>foo</b></i>
622 </p>
623 !!end
626 !! test
627 Italics and bold: 5-quote opening sequence: (5,3)
628 !! input
629 '''''foo'''
630 !! result
631 <p><i><b>foo</b></i>
632 </p>
633 !!end
636 !! test
637 Italics and bold: 5-quote opening sequence: (5,4)
638 !! input
639 '''''foo''''
640 !! result
641 <p><i><b>foo'</b></i>
642 </p>
643 !!end
646 !! test
647 Italics and bold: 5-quote opening sequence: (5,5)
648 !! input
649 '''''foo'''''
650 !! result
651 <p><i><b>foo</b></i>
652 </p>
653 !!end
656 ### multiple quote sequences in a line
658 !! test
659 Italics and bold: multiple quote sequences: (2,4,2)
660 !! input
661 ''foo''''bar''
662 !! result
663 <p><i>foo'<b>bar</b></i>
664 </p>
665 !!end
668 !! test
669 Italics and bold: multiple quote sequences: (2,4,3)
670 !! input
671 ''foo''''bar'''
672 !! result
673 <p><i>foo'<b>bar</b></i>
674 </p>
675 !!end
678 !! test
679 Italics and bold: multiple quote sequences: (2,4,4)
680 !! input
681 ''foo''''bar''''
682 !! result
683 <p><i>foo'<b>bar'</b></i>
684 </p>
685 !!end
688 !! test
689 Italics and bold: multiple quote sequences: (3,4,2) (php)
690 !! options
692 !! input
693 '''foo''''bar''
694 !! result
695 <p><b>foo'</b>bar
696 </p>
697 !!end
698 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
699 !! test
700 Italics and bold: multiple quote sequences: (3,4,2) (parsoid)
701 !! options
702 parsoid
703 !! input
704 '''foo''''bar''
705 !! result
706 <p><b>foo'</b>bar<i></i>
707 </p>
708 !!end
711 !! test
712 Italics and bold: multiple quote sequences: (3,4,3) (php)
713 !! options
715 !! input
716 '''foo''''bar'''
717 !! result
718 <p><b>foo'</b>bar
719 </p>
720 !!end
721 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
722 !! test
723 Italics and bold: multiple quote sequences: (3,4,3) (parsoid)
724 !! options
725 parsoid
726 !! input
727 '''foo''''bar'''
728 !! result
729 <p><b>foo'</b>bar<b></b>
730 </p>
731 !!end
734 ### other quote tests
736 !! test
737 Italics and bold: other quote tests: (2,3,5)
738 !! input
739 ''this is about '''foo's family'''''
740 !! result
741 <p><i>this is about <b>foo's family</b></i>
742 </p>
743 !!end
746 !! test
747 Italics and bold: other quote tests: (2,(3,3),2)
748 !! input
749 ''this is about '''foo's''' family''
750 !! result
751 <p><i>this is about <b>foo's</b> family</i>
752 </p>
753 !!end
756 !! test
757 Italics and bold: other quote tests: (3,2,3,2)
758 !! input
759 '''this is about ''foo'''s family''
760 !! result
761 <p><b>this is about <i>foo</i></b><i>s family</i>
762 </p>
763 !!end
766 # The Parsoid team believes the PHP parser's output on this test is wrong.
767 # It only checks for convert-to-bold-on-single-character-word when the word
768 # matches with a bold tag ("'''") that is *odd* in the list of quote tokens.
769 # This means that the bold token in position 2 (0-indexed) gets converted by
770 # parsoid, but doesn't get changed by the PHP parser.
771 !! test
772 Italics and bold: other quote tests: (3,2,3,3) (php)
773 !! options
775 !! input
776 '''this is about ''foo'''s family'''
777 !! result
778 <p>'<i>this is about </i>foo<b>s family</b>
779 </p>
780 !!end
781 # This is the output the Parsoid team believes to be correct.
782 !! test
783 Italics and bold: other quote tests: (3,2,3,3) (parsoid)
784 !! options
785 parsoid
786 !! input
787 '''this is about ''foo'''s family'''
788 !! result
789 <p><b>this is about <i>foo'</i>s family</b>
790 </p>
791 !!end
794 !! test
795 Italics and bold: other quote tests: (3,(2,2),3)
796 !! input
797 '''this is about ''foo's'' family'''
798 !! result
799 <p><b>this is about <i>foo's</i> family</b>
800 </p>
801 !!end
804 !! test
805 Italicized possessive
806 !! input
807 The ''[[Main Page]]'''s talk page.
808 !! result
809 <p>The <i><a href="/wiki/Main_Page" title="Main Page">Main Page</a>'</i>s talk page.
810 </p>
811 !! end
814 ### Non-html5 tags
817 !! test
818 Non-html5 tags should be accepted
819 !! input
820 <center>''foo''</center>
821 <big>''foo''</big>
822 <font>''foo''</font>
823 <strike>''foo''</strike>
824 <tt>''foo''</tt>
825 !! result
826 <center><i>foo</i></center>
827 <p><big><i>foo</i></big>
828 <font><i>foo</i></font>
829 <strike><i>foo</i></strike>
830 <tt><i>foo</i></tt>
831 </p>
832 !! end
835 ### <nowiki> test cases
838 !! test
839 <nowiki> unordered list
840 !! input
841 <nowiki>* This is not an unordered list item.</nowiki>
842 !! result
843 <p>* This is not an unordered list item.
844 </p>
845 !! end
847 !! test
848 <nowiki> spacing
849 !! input
850 <nowiki>Lorem ipsum dolor
852 sed abit.
853   sed nullum.
855 :and a colon
856 </nowiki>
857 !! result
858 <p>Lorem ipsum dolor
860 sed abit.
861   sed nullum.
863 :and a colon
865 </p>
866 !! end
868 !! test
869 nowiki 3
870 !! input
871 :There is not nowiki.
872 :There is <nowiki>nowiki</nowiki>.
874 #There is not nowiki.
875 #There is <nowiki>nowiki</nowiki>.
877 *There is not nowiki.
878 *There is <nowiki>nowiki</nowiki>.
879 !! result
880 <dl><dd>There is not nowiki.
881 </dd><dd>There is nowiki.
882 </dd></dl>
883 <ol><li>There is not nowiki.
884 </li><li>There is nowiki.
885 </li></ol>
886 <ul><li>There is not nowiki.
887 </li><li>There is nowiki.
888 </li></ul>
890 !! end
892 !! test
893 Entities inside <nowiki>
894 !! input
895 <nowiki>&lt;</nowiki>
896 !! result
897 <p>&lt;
898 </p>
899 !! end
903 ### Comments
905 !! test
906 Comments and Indent-Pre
907 !! input
908 <!-- comment 1 --> asdf
910 <!-- comment 1 --> asdf
911 <!-- comment 2 -->
913 <!-- comment 1 --> asdf
914 <!-- comment 2 -->xyz
916 <!-- comment 1 --> asdf
917 <!-- comment 2 --> xyz
918 !! result
919 <pre>asdf
920 </pre>
921 <pre>asdf
922 </pre>
923 <pre>asdf
924 </pre>
925 <p>xyz
926 </p>
927 <pre>asdf
929 </pre>
930 !! end
932 !! test
933 Comment test 2a
934 !! input
935 asdf
936 <!-- comment 1 -->
938 !! result
939 <p>asdf
941 </p>
942 !! end
944 !! test
945 Comment test 2b
946 !! input
947 asdf
948 <!-- comment 1 -->
951 !! result
952 <p>asdf
953 </p><p>jkl
954 </p>
955 !! end
957 !! test
958 Comment test 3
959 !! input
960 asdf
961 <!-- comment 1 -->
962 <!-- comment 2 -->
964 !! result
965 <p>asdf
967 </p>
968 !! end
970 !! test
971 Comment test 4
972 !! input
973 asdf<!-- comment 1 -->jkl
974 !! result
975 <p>asdfjkl
976 </p>
977 !! end
979 !! test
980 Comment spacing
981 !! input
983  <!-- foo --> b <!-- bar -->
985 !! result
986 <p>a
987 </p>
988 <pre> b 
989 </pre>
990 <p>c
991 </p>
992 !! end
994 !! test
995 Comment whitespace
996 !! input
997 <!-- returns a single newline, not nothing, since the newline after > is not stripped -->
998 !! result
1000 !! end
1002 !! test
1003 Comment semantics and delimiters
1004 !! input
1005 <!-- --><!----><!-----><!------>
1006 !! result
1008 !! end
1010 !! test
1011 Comment semantics and delimiters, redux
1012 !! input
1013 <!-- In SGML every "foo" here would actually show up in the text -- foo -- bar
1014 -- foo -- funky huh? ... -->
1015 !! result
1017 !! end
1019 !! test
1020 Comment semantics and delimiters: directors cut
1021 !! input
1022 <!-- ... However we like to keep things simple and somewhat XML-ish so we eat
1023 everything starting with < followed by !-- until the first -- and > we see,
1024 that wouldn't be valid XML however, since in XML -- has to terminate a comment
1025 -->-->
1026 !! result
1027 <p>--&gt;
1028 </p>
1029 !! end
1031 !! test
1032 Comment semantics: nesting
1033 !! input
1034 <!--<!-- no, we're not going to do anything fancy here -->-->
1035 !! result
1036 <p>--&gt;
1037 </p>
1038 !! end
1040 !! test
1041 Comment semantics: unclosed comment at end
1042 !! input
1043 <!--This comment will run out to the end of the document
1044 !! result
1046 !! end
1048 !! test
1049 Comment in template title
1050 !! input
1051 {{f<!---->oo}}
1052 !! result
1053 <p>FOO
1054 </p>
1055 !! end
1057 !! test
1058 Comment on its own line post-expand
1059 !! input
1061 {{blank}}<!---->
1063 !! result
1064 <p>a
1065 </p><p>b
1066 </p>
1067 !! end
1069 !! test
1070 Comment on its own line post-expand with non-significant whitespace
1071 !! input
1073  {{blank}} <!----> 
1075 !! result
1076 <p>a
1077 </p><p>b
1078 </p>
1079 !! end
1082 ### paragraph wraping tests
1084 !! test
1085 No block tags
1086 !! input
1090 !! result
1091 <p>a
1092 </p><p>b
1093 </p>
1094 !! end
1095 !! test
1096 Block tag on one line
1097 !! input
1098 a <div>foo</div>
1101 !! result
1102 a <div>foo</div>
1103 <p>b
1104 </p>
1105 !! end
1107 !! test
1108 Block tag on both lines
1109 !! input
1110 a <div>foo</div>
1112 b <div>foo</div>
1113 !! result
1114 a <div>foo</div>
1115 b <div>foo</div>
1117 !! end
1119 !! test
1120 Multiple lines without block tags
1121 !! input
1122 <div>foo</div> a
1125 d<!--foo--> e
1126 x <div>foo</div> z
1127 !! result
1128 <div>foo</div> a
1129 <p>b
1131 d e
1132 </p>
1133 x <div>foo</div> z
1135 !! end
1137 !! test
1138 Empty lines between lines with block tags
1139 !! input
1140 <div></div>
1143 <div></div>a
1146 <div>a</div>b
1148 <div>b</div>d
1151 <div>e</div>
1152 !! result
1153 <div></div>
1154 <p><br />
1155 </p>
1156 <div></div>a
1157 <p>b
1158 </p>
1159 <div>a</div>b
1160 <div>b</div>d
1161 <p><br />
1162 </p>
1163 <div>e</div>
1165 !! end
1168 ### Preformatted text
1170 !! test
1171 Preformatted text
1172 !! input
1173  This is some
1174  Preformatted text
1175  With ''italic''
1176  And '''bold'''
1177  And a [[Main Page|link]]
1178 !! result
1179 <pre>This is some
1180 Preformatted text
1181 With <i>italic</i>
1182 And <b>bold</b>
1183 And a <a href="/wiki/Main_Page" title="Main Page">link</a>
1184 </pre>
1185 !! end
1187 !! test
1188 Ident preformatting with inline content
1189 !! input
1191  ''b''
1192 !! result
1193 <pre>a
1194 <i>b</i>
1195 </pre>
1196 !! end
1198 !! test
1199 <pre> with <nowiki> inside (compatibility with 1.6 and earlier)
1200 !! input
1201 <pre><nowiki>
1203 <cite>
1204 <em>
1205 </nowiki></pre>
1206 !! result
1207 <pre>
1208 &lt;b&gt;
1209 &lt;cite&gt;
1210 &lt;em&gt;
1211 </pre>
1213 !! end
1215 !! test
1216 Regression with preformatted in <center>
1217 !! input
1218 <center>
1219  Blah
1220 </center>
1221 !! result
1222 <center>
1223 <pre>Blah
1224 </pre>
1225 </center>
1227 !! end
1229 # Expected output in the following test is not really expected (there should be
1230 # <pre> in the output) -- it's only testing for well-formedness.
1231 !! test
1232 Bug 6200: Preformatted in <blockquote>
1233 !! input
1234 <blockquote>
1235  Blah
1236 </blockquote>
1237 !! result
1238 <blockquote>
1239  Blah
1240 </blockquote>
1242 !! end
1244 !! test
1245 <pre> with attributes (bug 3202)
1246 !! input
1247 <pre style="background: blue; color:white">Bluescreen of WikiDeath</pre>
1248 !! result
1249 <pre style="background: blue; color:white">Bluescreen of WikiDeath</pre>
1251 !! end
1253 !! test
1254 <pre> with width attribute (bug 3202)
1255 !! input
1256 <pre width="8">Narrow screen goodies</pre>
1257 !! result
1258 <pre width="8">Narrow screen goodies</pre>
1260 !! end
1262 !! test
1263 <pre> with forbidden attribute (bug 3202)
1264 !! input
1265 <pre width="8" onmouseover="alert(document.cookie)">Narrow screen goodies</pre>
1266 !! result
1267 <pre width="8">Narrow screen goodies</pre>
1269 !! end
1271 !! test
1272 Entities inside <pre>
1273 !! input
1274 <pre>&lt;</pre>
1275 !! result
1276 <pre>&lt;</pre>
1278 !! end
1280 !! test
1281 <pre> with forbidden attribute values (bug 3202)
1282 !! input
1283 <pre width="8" style="border-width: expression(alert(document.cookie))">Narrow screen goodies</pre>
1284 !! result
1285 <pre width="8" style="/* insecure input */">Narrow screen goodies</pre>
1287 !! end
1289 !! test
1290 <nowiki> inside <pre> (bug 13238)
1291 !! input
1292 <pre>
1293 <nowiki>
1294 </pre>
1295 <pre>
1296 <nowiki></nowiki>
1297 </pre>
1298 <pre><nowiki><nowiki></nowiki>Foo<nowiki></nowiki></nowiki></pre>
1299 !! result
1300 <pre>
1301 &lt;nowiki&gt;
1302 </pre>
1303 <pre>
1305 </pre>
1306 <pre>&lt;nowiki&gt;Foo&lt;/nowiki&gt;</pre>
1308 !! end
1310 !! test
1311 <nowiki> and <pre> preference (first one wins)
1312 !! input
1313 <pre>
1314 <nowiki>
1315 </pre>
1316 </nowiki>
1317 </pre>
1319 <nowiki>
1320 <pre>
1321 <nowiki>
1322 </pre>
1323 </nowiki>
1324 </pre>
1326 !! result
1327 <pre>
1328 &lt;nowiki&gt;
1329 </pre>
1330 <p>&lt;/nowiki&gt;
1331 &lt;/pre&gt;
1332 </p><p>
1333 &lt;pre&gt;
1334 &lt;nowiki&gt;
1335 &lt;/pre&gt;
1337 &lt;/pre&gt;
1338 </p>
1339 !! end
1341 !! test
1342 </pre> inside nowiki
1343 !! input
1344 <nowiki></pre></nowiki>
1345 !! result
1346 <p>&lt;/pre&gt;
1347 </p>
1348 !! end
1350 !!test
1351 Templates: Indent-Pre: 1a. Templates that break a line should suppress <pre>
1352 !!input
1353  {{echo|}}
1354 !!result
1356 !!end
1358 !!test
1359 Templates: Indent-Pre: 1b. Templates that break a line should suppress <pre>
1360 !!input
1361  {{echo|
1362 foo}}
1363 !!result
1364 <p>foo
1365 </p>
1366 !!end
1368 !! test
1369 Templates: Indent-Pre: 1c: Wrapping should be based on expanded content
1370 !! input
1371  {{echo|a
1373 !!result
1374 <pre>a
1375 </pre>
1376 <p>b
1377 </p>
1378 !!end
1380 !! test
1381 Templates: Indent-Pre: 1d: Wrapping should be based on expanded content
1382 !! input
1383  {{echo|a
1389 !!result
1390 <pre>a
1391 </pre>
1392 <p>b
1394 </p>
1395 <pre>d
1396 </pre>
1397 <p>e
1398 </p>
1399 !!end
1401 !!test
1402 Templates: Indent-Pre: 1e. Wrapping should be based on expanded content
1403 !!input
1404 {{echo| foo}}
1406 {{echo| foo}}{{echo| bar}}
1408 {{echo| foo}}
1409 {{echo| bar}}
1411 {{echo|<!--cmt--> foo}}
1413 <!--cmt-->{{echo| foo}}
1415 {{echo|{{echo| }}bar}}
1416 !!result
1417 <pre>foo
1418 </pre>
1419 <pre>foo bar
1420 </pre>
1421 <pre>foo
1423 </pre>
1424 <pre>foo
1425 </pre>
1426 <pre>foo
1427 </pre>
1428 <pre>bar
1429 </pre>
1430 !!end
1432 !! test
1433 Templates: Indent-Pre: 1f: Wrapping should be based on expanded content
1434 !! input
1435 {{echo| }}a
1437 {{echo|
1438  }}a
1440 {{echo|
1441  b}}
1443 {{echo|a
1444  }}b
1446 {{echo|a
1447 }} b
1448 !!result
1449 <pre>a
1450 </pre>
1451 <p><br />
1452 </p>
1453 <pre>a
1454 </pre>
1455 <p><br />
1456 </p>
1457 <pre>b
1458 </pre>
1459 <p>a
1460 </p>
1461 <pre>b
1462 </pre>
1463 <p>a
1464 </p>
1465 <pre>b
1466 </pre>
1467 !!end
1469 !! test
1470 Templates: Single-line variant of parameter whitespace stripping test
1471 !! input
1472 {{echo| a}}
1474 {{echo|1= a}}
1476 {{echo|{{echo| a}}}}
1478 {{echo|1={{echo| a}}}}
1479 !! result
1480 <pre>a
1481 </pre>
1482 <p>a
1483 </p>
1484 <pre>a
1485 </pre>
1486 <p>a
1487 </p>
1488 !! end
1490 !! test
1491 Templates: Strip whitespace from named parameters, but not positional ones
1492 !! input
1493 {{echo|
1494  foo}}
1496 {{echo|
1497 * foo}}
1499 {{echo| 1 =
1500  foo}}
1502 {{echo| 1 =
1503 * foo}}
1504 !! result
1505 <pre>foo
1506 </pre>
1507 <p><br />
1508 </p>
1509 <ul><li> foo
1510 </li></ul>
1511 <p>foo
1512 </p>
1513 <ul><li> foo
1514 </li></ul>
1516 !! end
1519 ### Parsoid-centric tests for testing RT edge cases for pre
1522 !!test
1523 1a. Indent-Pre and Comments
1524 !!input
1526 <!--a-->
1528 !!result
1529 <pre>a
1530 </pre>
1531 <p>c
1532 </p>
1533 !!end
1535 !!test
1536 1b. Indent-Pre and Comments
1537 !!input
1539  <!--a-->
1541 !!result
1542 <pre>a
1543 </pre>
1544 <p>c
1545 </p>
1546 !!end
1548 !!test
1549 1c. Indent-Pre and Comments
1550 !!input
1551 <!--a-->  a
1553  <!--a--> a
1554 !!result
1555 <pre> a
1556 </pre>
1557 <pre> a
1558 </pre>
1559 !!end
1561 !!test
1562 2a. Indent-Pre and tables
1563 !!input
1564  {|
1565  |-
1566  !h1!!h2
1567  |foo||bar
1568  |}
1569 !!result
1570 <table>
1572 <tr>
1573 <th>h1</th>
1574 <th>h2
1575 </th>
1576 <td>foo</td>
1577 <td>bar
1578 </td></tr></table>
1580 !!end
1582 !!test
1583 2b. Indent-Pre and tables
1584 !!input
1585   {|
1586  |-
1587 |foo
1589 !!result
1590 <table>
1592 <tr>
1593 <td>foo
1594 </td></tr></table>
1596 !!end
1598 !!test
1599 2c. Indent-Pre and tables (bug 42252)
1600 !!input
1602  |+ foo
1603  !  | bar
1605 !!result
1606 <table>
1607 <caption> foo
1608 </caption>
1609 <tr>
1610 <th> bar
1611 </th></tr></table>
1613 !!end
1615 !!test
1616 3a. Indent-Pre and block tags (single-line html)
1617 !!input
1618  <p> foo </p>
1619  <div> foo </div>
1620  <span> foo </span>
1621 !!result
1622  <p> foo </p>
1623  <div> foo </div>
1624 <pre><span> foo </span>
1625 </pre>
1626 !!end
1628 !!test
1629 3b. Indent-Pre and block tags (pre-content on separate line)
1630 !!input
1632  foo
1633 </p>
1635 <div>
1636  foo
1637 </div>
1639 <center>
1640  foo
1641 </center>
1643 <blockquote>
1644  foo
1645 </blockquote>
1647 <table><tr><td>
1648  foo
1649 </td></tr></table>
1651 <ul><li>
1652   foo
1653 </li></ul>
1655 !!result
1657  foo
1658 </p>
1659 <div>
1660 <pre>foo
1661 </pre>
1662 </div>
1663 <center>
1664 <pre>foo
1665 </pre>
1666 </center>
1667 <blockquote>
1668  foo
1669 </blockquote>
1670 <table><tr><td>
1671 <pre>foo
1672 </pre>
1673 </td></tr></table>
1674 <ul><li>
1675   foo
1676 </li></ul>
1678 !!end
1680 !!test
1681 4. Multiple spaces at start-of-line
1682 !!input
1683     <p> foo </p>
1684     foo
1685         {|
1686 |foo
1688 !!result
1689     <p> foo </p>
1690 <pre>   foo
1691 </pre>
1692 <table>
1693 <tr>
1694 <td>foo
1695 </td></tr></table>
1697 !!end
1699 !! test
1700 5. White-space in indent-pre
1701 NOTE: the white-space char on 2nd line is significant
1702 !! input
1703  a<br/>
1706 !! result
1707 <pre>a<br />
1710 </pre>
1711 !! end
1714 ### HTML-pre (some to spec PHP parser behavior and some Parsoid-RT-centric)
1717 !!test
1718 HTML-pre: 1. embedded newlines
1719 !!input
1720 <pre>foo</pre>
1722 <pre>
1724 </pre>
1726 <pre>
1729 </pre>
1731 <pre>
1735 </pre>
1736 !!result
1737 <pre>foo</pre>
1738 <pre>
1740 </pre>
1741 <pre>
1744 </pre>
1745 <pre>
1749 </pre>
1751 !!end
1753 !!test
1754 HTML-pre: 2: indented text
1755 !!input
1756 <pre>
1757  foo
1758 </pre>
1759 !!result
1760 <pre>
1761  foo
1762 </pre>
1764 !!end
1766 !!test
1767 HTML-pre: 3: other wikitext
1768 !!input
1769 <pre>
1770 * foo
1771 # bar
1772 = no-h =
1773 '' no-italic ''
1774 [[ NoLink ]]
1775 </pre>
1776 !!result
1777 <pre>
1778 * foo
1779 # bar
1780 = no-h =
1781 '' no-italic ''
1782 [[ NoLink ]]
1783 </pre>
1785 !!end
1788 ### Definition lists
1790 !! test
1791 Simple definition
1792 !! input
1793 ; name : Definition
1794 !! result
1795 <dl><dt> name&#160;</dt><dd> Definition
1796 </dd></dl>
1798 !! end
1800 !! test
1801 Definition list for indentation only
1802 !! input
1803 : Indented text
1804 !! result
1805 <dl><dd> Indented text
1806 </dd></dl>
1808 !! end
1810 !! test
1811 Definition list with no space
1812 !! input
1813 ;name:Definition
1814 !! result
1815 <dl><dt>name</dt><dd>Definition
1816 </dd></dl>
1818 !!end
1820 !! test
1821 Definition list with URL link
1822 !! input
1823 ; http://example.com/ : definition
1824 !! result
1825 <dl><dt> <a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&#160;</dt><dd> definition
1826 </dd></dl>
1828 !! end
1830 !! test
1831 Definition list with bracketed URL link
1832 !! input
1833 ;[http://www.example.com/ Example]:Something about it
1834 !! result
1835 <dl><dt><a rel="nofollow" class="external text" href="http://www.example.com/">Example</a></dt><dd>Something about it
1836 </dd></dl>
1838 !! end
1840 !! test
1841 Definition list with wikilink containing colon
1842 !! input
1843 ; [[Help:FAQ]]: The least-read page on Wikipedia
1844 !! result
1845 <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
1846 </dd></dl>
1848 !! end
1850 # At Brion's and JeLuF's insistence... :)
1851 !! test
1852 Definition list with news link containing colon
1853 !! input
1854 ;  news:alt.wikipedia.rox: This isn't even a real newsgroup!
1855 !! result
1856 <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!
1857 </dd></dl>
1859 !! end
1861 !! test
1862 Malformed definition list with colon
1863 !! input
1864 ;  news:alt.wikipedia.rox -- don't crash or enter an infinite loop
1865 !! result
1866 <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
1867 </dt></dl>
1869 !! end
1871 !! test
1872 Definition lists: colon in external link text
1873 !! input
1874 ; [http://www.wikipedia2.org/ Wikipedia : The Next Generation]: OK, I made that up
1875 !! result
1876 <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
1877 </dd></dl>
1879 !! end
1881 !! test
1882 Definition lists: colon in HTML attribute
1883 !! input
1884 ;<b style="display: inline">bold</b>
1885 !! result
1886 <dl><dt><b style="display: inline">bold</b>
1887 </dt></dl>
1889 !! end
1891 !! test
1892 Definition lists: self-closed tag
1893 !! input
1894 ;one<br/>two : two-line fun
1895 !! result
1896 <dl><dt>one<br />two&#160;</dt><dd> two-line fun
1897 </dd></dl>
1899 !! end
1901 !! test
1902 Bug 11748: Literal closing tags
1903 !! input
1904 <dl>
1905 <dt>test 1</dt>
1906 <dd>test test test test test</dd>
1907 <dt>test 2</dt>
1908 <dd>test test test test test</dd>
1909 </dl>
1910 !! result
1911 <dl>
1912 <dt>test 1</dt>
1913 <dd>test test test test test</dd>
1914 <dt>test 2</dt>
1915 <dd>test test test test test</dd>
1916 </dl>
1918 !! end
1920 !! test
1921 Definition and unordered list using wiki syntax nested in unordered list using html tags.
1922 !! input
1923 <ul><li>
1924 ; term : description
1925 * unordered
1926 </li>
1927 </ul>
1928 !! result
1929 <ul><li>
1930 <dl><dt> term&#160;</dt><dd> description
1931 </dd></dl>
1932 <ul><li> unordered
1933 </li></ul>
1934 </li>
1935 </ul>
1937 !! end
1939 !! test
1941 Definition list with empty definition and following paragraph
1942 !! input
1943 ; term:
1944 Paragraph text
1945 !! result
1946 <dl><dt> term</dt><dd>
1947 </dd></dl>
1948 <p>Paragraph text
1949 </p>
1950 !! end
1952 !! test
1953 Nested definition lists using html syntax
1954 !! input
1955 <dl><dd>
1956 <dl>
1957 <dd>Foo</dd>
1958 </dl>
1959 </dd></dl>
1960 !! result
1961 <dl><dd>
1962 <dl>
1963 <dd>Foo</dd>
1964 </dl>
1965 </dd></dl>
1967 !! end
1969 !! test
1970 Definition Lists: No nesting: Multiple dd's
1971 !! input
1975 !! result
1976 <dl><dt>x
1977 </dt><dd>a
1978 </dd><dd>b
1979 </dd></dl>
1981 !! end
1983 !! test
1984 Definition Lists: Indentation: Regular
1985 !! input
1987 ::i2
1988 :::i3
1989 !! result
1990 <dl><dd>i1
1991 <dl><dd>i2
1992 <dl><dd>i3
1993 </dd></dl>
1994 </dd></dl>
1995 </dd></dl>
1997 !! end
1999 !! test
2000 Definition Lists: Indentation: Missing 1st level
2001 !! input
2002 ::i2
2003 :::i3
2004 !! result
2005 <dl><dd><dl><dd>i2
2006 <dl><dd>i3
2007 </dd></dl>
2008 </dd></dl>
2009 </dd></dl>
2011 !! end
2013 !! test
2014 Definition Lists: Indentation: Multi-level indent
2015 !! input
2016 :::i3
2017 !! result
2018 <dl><dd><dl><dd><dl><dd>i3
2019 </dd></dl>
2020 </dd></dl>
2021 </dd></dl>
2023 !! end
2025 !! test
2026 Definition Lists: Hacky use to indent tables
2027 !! input
2028 ::{|
2029 |foo
2030 |bar
2032 this text
2033 should be left alone
2034 !! result
2035 <dl><dd><dl><dd><table>
2036 <tr>
2037 <td>foo
2038 </td>
2039 <td>bar
2040 </td></tr></table></dd></dl></dd></dl>
2041 <p>this text
2042 should be left alone
2043 </p>
2044 !! end
2045 ## The PHP parser treats : items (dd) without a corresponding ; item (dt)
2046 ## as an empty dt item.  It also ignores all but the last ";" when followed
2047 ## by ":" later on.  So, ";" are not ignored in ";;;t3" but are ignored  in
2048 ## ";;;t3 :d1".  So, PHP parser behavior is a little inconsistent wrt multiple
2049 ## ";"s.
2051 ## Ex: ";;t2 ::d2" is transformed into:
2053 ## <dl>
2054 ##   <dt>t2 </dt>
2055 ##   <dd>
2056 ##     <dl>
2057 ##       <dt></dt>
2058 ##       <dd>d2</dd>
2059 ##     </dl>
2060 ##   </dd>
2061 ## </dl>
2063 ## But, Parsoid treats "; :" as a tight atomic unit and excess ":" as plain text
2064 ## So, the same wikitext above (;;t2 ::d2) is transformed into:
2066 ## <dl>
2067 ##   <dt>
2068 ##     <dl>
2069 ##       <dt>t2 </dt>
2070 ##       <dd>:d2</dd>
2071 ##     </dl>
2072 ##    </dt>
2073 ## </dl>
2075 ## All Parsoid only definition list tests have this difference.
2077 ## See also: https://bugzilla.wikimedia.org/show_bug.cgi?id=6569
2078 ## and http://lists.wikimedia.org/pipermail/wikitext-l/2011-November/000483.html
2080 !! test
2081 Table / list interaction: indented table with lists in table contents
2082 !! input
2085 | a
2086 * b
2088 | c
2089 * d
2091 !! result
2092 <dl><dd><table>
2094 <tr>
2095 <td> a
2096 <ul><li> b
2097 </li></ul>
2098 </td></tr>
2099 <tr>
2100 <td> c
2101 <ul><li> d
2102 </li></ul>
2103 </td></tr></table></dd></dl>
2105 !! end
2107 !!test
2108 Table / list interaction: lists nested in tables nested in indented lists
2109 !!input
2121 !!result
2122 <dl><dd><table>
2123 <tr>
2124 <td>
2125 <dl><dd>a
2126 </dd><dd>b
2127 </dd></dl>
2128 </td>
2129 <td>
2130 <ul><li>c
2131 </li><li>d
2132 </li></ul>
2133 </td></tr></table></dd></dl>
2134 <ul><li>e
2135 </li><li>f
2136 </li></ul>
2138 !!end
2140 !! test
2141 Definition Lists: Nesting: Multi-level (Parsoid only)
2142 !! options
2143 parsoid
2144 !! input
2145 ;t1 :d1
2146 ;;t2 ::d2
2147 ;;;t3 :::d3
2148 !! result
2149 <dl>
2150   <dt>t1 </dt>
2151   <dd>d1</dd>
2152   <dt>
2153     <dl>
2154       <dt>t2 </dt>
2155       <dd>:d2</dd>
2156       <dt>
2157         <dl>
2158           <dt>t3 </dt>
2159           <dd>::d3</dd>
2160         </dl>
2161       </dt>
2162     </dl>
2163   </dt>
2164 </dl>
2167 !! end
2170 !! test
2171 Definition Lists: Nesting: Test 2 (Parsoid only)
2172 !! options
2173 parsoid
2174 !! input
2176 ::d2
2177 !! result
2178 <dl>
2179   <dt>t1</dt>
2180   <dd>
2181     <dl>
2182       <dd>d2</dd>
2183     </dl>
2184   </dd>
2185 </dl>
2187 !! end
2190 !! test
2191 Definition Lists: Nesting: Test 3 (Parsoid only)
2192 !! options
2193 parsoid
2194 !! input
2195 :;t1
2196 ::::d2
2197 !! result
2198 <dl>
2199   <dd>
2200     <dl>
2201       <dt>t1</dt>
2202       <dd>
2203         <dl>
2204           <dd>
2205             <dl>
2206               <dd>d2</dd>
2207             </dl>
2208           </dd>
2209         </dl>
2210       </dd>
2211     </dl>
2212   </dd>
2213 </dl>
2215 !! end
2218 !! test
2219 Definition Lists: Nesting: Test 4
2220 !! input
2221 ::;t3
2222 :::d3
2223 !! result
2224 <dl><dd><dl><dd><dl><dt>t3
2225 </dt><dd>d3
2226 </dd></dl>
2227 </dd></dl>
2228 </dd></dl>
2230 !! end
2233 ## The Parsoid team believes the following three test exposes a
2234 ## bug in the PHP parser.  (Parsoid team thinks the PHP parser is
2235 ## wrong to close the <dl> after the <dt> containing the <ul>.)
2236 !! test
2237 Definition Lists: Mixed Lists: Test 1 (php)
2238 !! options
2240 !! input
2241 :;* foo
2242 ::* bar
2243 :; baz
2244 !! result
2245 <dl><dd><dl><dt><ul><li> foo
2246 </li><li> bar
2247 </li></ul>
2248 </dt></dl>
2249 <dl><dt> baz
2250 </dt></dl>
2251 </dd></dl>
2253 !! end
2254 !! test
2255 Definition Lists: Mixed Lists: Test 1 (parsoid)
2256 !! options
2257 parsoid
2258 !! input
2259 :;* foo
2260 ::* bar
2261 :; baz
2262 !! result
2263 <dl><dd><dl><dt><ul><li> foo
2264 </li></ul></dt><dd><ul><li> bar
2265 </li></ul></dd><dt> baz</dt></dl></dd></dl>
2266 !! end
2268 !! test
2269 Definition Lists: Mixed Lists: Test 2
2270 !! input
2271 *: d1
2272 *: d2
2273 !! result
2274 <ul><li><dl><dd> d1
2275 </dd><dd> d2
2276 </dd></dl>
2277 </li></ul>
2279 !! end
2282 !! test
2283 Definition Lists: Mixed Lists: Test 3
2284 !! input
2285 *::: d1
2286 *::: d2
2287 !! result
2288 <ul><li><dl><dd><dl><dd><dl><dd> d1
2289 </dd><dd> d2
2290 </dd></dl>
2291 </dd></dl>
2292 </dd></dl>
2293 </li></ul>
2295 !! end
2298 !! test
2299 Definition Lists: Mixed Lists: Test 4
2300 !! input
2301 *;d1 :d2
2302 *;d3 :d4
2303 !! result
2304 <ul><li><dl><dt>d1&#160;</dt><dd>d2
2305 </dd><dt>d3&#160;</dt><dd>d4
2306 </dd></dl>
2307 </li></ul>
2309 !! end
2312 !! test
2313 Definition Lists: Mixed Lists: Test 5
2314 !! input
2315 *:d1
2316 *:: d2
2317 !! result
2318 <ul><li><dl><dd>d1
2319 <dl><dd> d2
2320 </dd></dl>
2321 </dd></dl>
2322 </li></ul>
2324 !! end
2327 !! test
2328 Definition Lists: Mixed Lists: Test 6
2329 !! input
2330 #*:d1
2331 #*::: d3
2332 !! result
2333 <ol><li><ul><li><dl><dd>d1
2334 <dl><dd><dl><dd> d3
2335 </dd></dl>
2336 </dd></dl>
2337 </dd></dl>
2338 </li></ul>
2339 </li></ol>
2341 !! end
2344 !! test
2345 Definition Lists: Mixed Lists: Test 7
2346 !! input
2347 :* d1
2348 :* d2
2349 !! result
2350 <dl><dd><ul><li> d1
2351 </li><li> d2
2352 </li></ul>
2353 </dd></dl>
2355 !! end
2358 !! test
2359 Definition Lists: Mixed Lists: Test 8
2360 !! input
2361 :* d1
2362 ::* d2
2363 !! result
2364 <dl><dd><ul><li> d1
2365 </li></ul>
2366 <dl><dd><ul><li> d2
2367 </li></ul>
2368 </dd></dl>
2369 </dd></dl>
2371 !! end
2374 !! test
2375 Definition Lists: Mixed Lists: Test 9
2376 !! input
2377 *;foo :bar
2378 !! result
2379 <ul><li><dl><dt>foo&#160;</dt><dd>bar
2380 </dd></dl>
2381 </li></ul>
2383 !! end
2386 !! test
2387 Definition Lists: Mixed Lists: Test 10
2388 !! input
2389 *#;foo :bar
2390 !! result
2391 <ul><li><ol><li><dl><dt>foo&#160;</dt><dd>bar
2392 </dd></dl>
2393 </li></ol>
2394 </li></ul>
2396 !! end
2398 # The Parsoid team disagrees with the PHP parser's seemingly-random
2399 # rules regarding dd/dt on the next two tests.  Parsoid is more
2400 # consistent, and recognizes the shared nesting and keeps the
2401 # still-open tags around until the nesting is complete.
2403 !! test
2404 Definition Lists: Mixed Lists: Test 11 (php)
2405 !! options
2407 !! input
2408 *#*#;*;;foo :bar
2409 *#*#;boo :baz
2410 !! result
2411 <ul><li><ol><li><ul><li><ol><li><dl><dt>foo&#160;</dt><dd><ul><li><dl><dt><dl><dt>bar
2412 </dt></dl>
2413 </dd></dl>
2414 </li></ul>
2415 </dd></dl>
2416 <dl><dt>boo&#160;</dt><dd>baz
2417 </dd></dl>
2418 </li></ol>
2419 </li></ul>
2420 </li></ol>
2421 </li></ul>
2423 !! end
2424 !! test
2425 Definition Lists: Mixed Lists: Test 11 (parsoid)
2426 !! options
2427 parsoid
2428 !! input
2429 *#*#;*;;foo :bar
2430 *#*#;boo :baz
2431 !! result
2432 <ul>
2433 <li>
2434 <ol>
2435 <li>
2436 <ul>
2437 <li>
2438 <ol>
2439 <li>
2440 <dl>
2441 <dt>
2442 <ul>
2443 <li>
2444 <dl>
2445 <dt>
2446 <dl>
2447 <dt>foo<span typeof="mw:Placeholder" data-parsoid='{"src":" "}'>&nbsp;</span></dt>
2448 <dd data-parsoid='{"stx":"row"}'>bar</dd></dl></dt></dl></li></ul></dt>
2449 <dt>boo<span typeof="mw:Placeholder" data-parsoid='{"src":" "}'>&nbsp;</span></dt>
2450 <dd data-parsoid='{"stx":"row"}'>baz</dd></dl></li></ol></li></ul></li></ol></li></ul>
2451 !! end
2454 !! test
2455 Definition Lists: Weird Ones: Test 1 (php)
2456 !! options
2458 !! input
2459 *#;*::;; foo : bar (who uses this?)
2460 !! result
2461 <ul><li><ol><li><dl><dt> foo&#160;</dt><dd><ul><li><dl><dd><dl><dd><dl><dt><dl><dt> bar (who uses this?)
2462 </dt></dl>
2463 </dd></dl>
2464 </dd></dl>
2465 </dd></dl>
2466 </li></ul>
2467 </dd></dl>
2468 </li></ol>
2469 </li></ul>
2471 !! end
2472 !! test
2473 Definition Lists: Weird Ones: Test 1 (parsoid)
2474 !! options
2475 parsoid
2476 !! input
2477 *#;*::;; foo : bar (who uses this?)
2478 !! result
2479 <ul>
2480 <li>
2481 <ol>
2482 <li>
2483 <dl>
2484 <dt>
2485 <ul>
2486 <li>
2487 <dl>
2488 <dd>
2489 <dl>
2490 <dd>
2491 <dl>
2492 <dt>
2493 <dl>
2494 <dt> foo<span typeof="mw:Placeholder" data-parsoid='{"src":" "}'>&nbsp;</span></dt>
2495 <dd data-parsoid='{"stx":"row"}'> bar (who uses this?)</dd></dl></dt></dl></dd></dl></dd></dl></li></ul></dt></dl></li></ol></li></ul>
2496 !! end
2499 ### External links
2501 !! test
2502 External links: non-bracketed
2503 !! input
2504 Non-bracketed: http://example.com
2505 !! result
2506 <p>Non-bracketed: <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
2507 </p>
2508 !! end
2510 !! test
2511 External links: numbered
2512 !! input
2513 Numbered: [http://example.com]
2514 Numbered: [http://example.net]
2515 Numbered: [http://example.com]
2516 !! result
2517 <p>Numbered: <a rel="nofollow" class="external autonumber" href="http://example.com">[1]</a>
2518 Numbered: <a rel="nofollow" class="external autonumber" href="http://example.net">[2]</a>
2519 Numbered: <a rel="nofollow" class="external autonumber" href="http://example.com">[3]</a>
2520 </p>
2521 !!end
2523 !! test
2524 External links: specified text
2525 !! input
2526 Specified text: [http://example.com link]
2527 !! result
2528 <p>Specified text: <a rel="nofollow" class="external text" href="http://example.com">link</a>
2529 </p>
2530 !!end
2532 !! test
2533 External links: trail
2534 !! input
2535 Linktrails should not work for external links: [http://example.com link]s
2536 !! result
2537 <p>Linktrails should not work for external links: <a rel="nofollow" class="external text" href="http://example.com">link</a>s
2538 </p>
2539 !! end
2541 !! test
2542 External links: dollar sign in URL
2543 !! input
2544 http://example.com/1$2345
2545 !! result
2546 <p><a rel="nofollow" class="external free" href="http://example.com/1$2345">http://example.com/1$2345</a>
2547 </p>
2548 !! end
2550 !! test
2551 External links: dollar sign in URL (named)
2552 !! input
2553 [http://example.com/1$2345]
2554 !! result
2555 <p><a rel="nofollow" class="external autonumber" href="http://example.com/1$2345">[1]</a>
2556 </p>
2557 !!end
2559 !! test
2560 External links: open square bracket forbidden in URL (bug 4377)
2561 !! input
2562 http://example.com/1[2345
2563 !! result
2564 <p><a rel="nofollow" class="external free" href="http://example.com/1">http://example.com/1</a>[2345
2565 </p>
2566 !! end
2568 !! test
2569 External links: open square bracket forbidden in URL (named) (bug 4377)
2570 !! input
2571 [http://example.com/1[2345]
2572 !! result
2573 <p><a rel="nofollow" class="external text" href="http://example.com/1">[2345</a>
2574 </p>
2575 !!end
2577 !! test
2578 External links: nowiki in URL link text (bug 6230)
2579 !!input
2580 [http://example.com/ <nowiki>''example site''</nowiki>]
2581 !! result
2582 <p><a rel="nofollow" class="external text" href="http://example.com/">''example site''</a>
2583 </p>
2584 !! end
2586 !! test
2587 External links: newline forbidden in text (bug 6230 regression check)
2588 !! input
2589 [http://example.com/ first
2590 second]
2591 !! result
2592 <p>[<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a> first
2593 second]
2594 </p>
2595 !!end
2597 !! test
2598 External links: Pipe char between url and text
2599 !! input
2600 [http://example.com | link]
2601 !! result
2602 <p><a rel="nofollow" class="external text" href="http://example.com">| link</a>
2603 </p>
2604 !!end
2606 !! test
2607 External links: protocol-relative URL in brackets
2608 !! input
2609 [//example.com/ Test]
2610 !! result
2611 <p><a rel="nofollow" class="external text" href="//example.com/">Test</a>
2612 </p>
2613 !! end
2615 !! test
2616 External links: protocol-relative URL in brackets without text
2617 !! input
2618 [//example.com]
2619 !! result
2620 <p><a rel="nofollow" class="external autonumber" href="//example.com">[1]</a>
2621 </p>
2622 !! end
2624 !! test
2625 External links: protocol-relative URL in free text is left alone
2626 !! input
2627 //example.com/Foo
2628 !! result
2629 <p>//example.com/Foo
2630 </p>
2631 !!end
2633 !! test
2634 External links: protocol-relative URL in the middle of a word is left alone (bug 30269)
2635 !! input
2636 foo//example.com/Foo
2637 !! result
2638 <p>foo//example.com/Foo
2639 </p>
2640 !! end
2642 !! test
2643 External image
2644 !! input
2645 External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
2646 !! result
2647 <p>External image: <img src="http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" />
2648 </p>
2649 !! end
2651 !! test
2652 External image from https
2653 !! input
2654 External image from https: https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
2655 !! result
2656 <p>External image from https: <img src="https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" />
2657 </p>
2658 !! end
2660 !! test
2661 Link to non-http image, no img tag
2662 !! input
2663 Link to non-http image, no img tag: ftp://example.com/test.jpg
2664 !! result
2665 <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>
2666 </p>
2667 !! end
2669 !! test
2670 External links: terminating separator
2671 !! input
2672 Terminating separator: http://example.com/thing,
2673 !! result
2674 <p>Terminating separator: <a rel="nofollow" class="external free" href="http://example.com/thing">http://example.com/thing</a>,
2675 </p>
2676 !! end
2678 !! test
2679 External links: intervening separator
2680 !! input
2681 Intervening separator: http://example.com/1,2,3
2682 !! result
2683 <p>Intervening separator: <a rel="nofollow" class="external free" href="http://example.com/1,2,3">http://example.com/1,2,3</a>
2684 </p>
2685 !! end
2687 !! test
2688 External links: old bug with URL in query
2689 !! input
2690 Old bug with URL in query: [http://example.com/thing?url=http://example.com link]
2691 !! result
2692 <p>Old bug with URL in query: <a rel="nofollow" class="external text" href="http://example.com/thing?url=http://example.com">link</a>
2693 </p>
2694 !! end
2696 !! test
2697 External links: old URL-in-URL bug, mixed protocols
2698 !! input
2699 And again with mixed protocols: [ftp://example.com?url=http://example.com link]
2700 !! result
2701 <p>And again with mixed protocols: <a rel="nofollow" class="external text" href="ftp://example.com?url=http://example.com">link</a>
2702 </p>
2703 !!end
2705 !! test
2706 External links: URL in text
2707 !! input
2708 URL in text: [http://example.com http://example.com]
2709 !! result
2710 <p>URL in text: <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
2711 </p>
2712 !! end
2714 !! test
2715 External links: Clickable images
2716 !! input
2717 ja-style clickable images: [http://example.com http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png]
2718 !! result
2719 <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>
2720 </p>
2721 !!end
2723 !! test
2724 External links: raw ampersand
2725 !! input
2726 Old &amp; use: http://x&y
2727 !! result
2728 <p>Old &amp; use: <a rel="nofollow" class="external free" href="http://x&amp;y">http://x&amp;y</a>
2729 </p>
2730 !! end
2732 !! test
2733 External links: encoded ampersand
2734 !! input
2735 Old &amp; use: http://x&amp;y
2736 !! result
2737 <p>Old &amp; use: <a rel="nofollow" class="external free" href="http://x&amp;y">http://x&amp;y</a>
2738 </p>
2739 !! end
2741 !! test
2742 External links: encoded equals (bug 6102)
2743 !! input
2744 http://example.com/?foo&#61;bar
2745 !! result
2746 <p><a rel="nofollow" class="external free" href="http://example.com/?foo=bar">http://example.com/?foo=bar</a>
2747 </p>
2748 !! end
2750 !! test
2751 External links: [raw ampersand]
2752 !! input
2753 Old &amp; use: [http://x&y]
2754 !! result
2755 <p>Old &amp; use: <a rel="nofollow" class="external autonumber" href="http://x&amp;y">[1]</a>
2756 </p>
2757 !! end
2759 !! test
2760 External links: [encoded ampersand]
2761 !! input
2762 Old &amp; use: [http://x&amp;y]
2763 !! result
2764 <p>Old &amp; use: <a rel="nofollow" class="external autonumber" href="http://x&amp;y">[1]</a>
2765 </p>
2766 !! end
2768 !! test
2769 External links: [encoded equals] (bug 6102)
2770 !! input
2771 [http://example.com/?foo&#61;bar]
2772 !! result
2773 <p><a rel="nofollow" class="external autonumber" href="http://example.com/?foo=bar">[1]</a>
2774 </p>
2775 !! end
2777 !! test
2778 External links: [IDN ignored character reference in hostname; strip it right off]
2779 !! input
2780 [http://e&zwnj;xample.com/]
2781 !! result
2782 <p><a rel="nofollow" class="external autonumber" href="http://example.com/">[1]</a>
2783 </p>
2784 !! end
2786 # FIXME: This test (the IDN characters in the text of a link) is an inconsistency.
2787 # Where an external link could easily circumvent the sanitization of the text of
2788 # a link like this (where an IDN-ignore character is in the URL somewhere), this
2789 # test demands a higher standard. That's a bit strange.
2791 # Example:
2793 # http://e‌xample.com -> [http://example.com|http://example.com]
2794 # [http://example.com|http://e‌xample.com] -> [http://example.com|http://e‌xample.com]
2796 # The first example is sanitized, but the second is not. Any security benefits
2797 # from this production are trivial to circumvent. Either remove this test and
2798 # let the parser(s) do their thing unaccosted, or fix the inconsistency and change
2799 # the test accordingly.
2801 # All our love,
2802 # The Parsoid team.
2803 !! test
2804 External links: IDN ignored character reference in hostname; strip it right off
2805 !! input
2806 http://e&zwnj;xample.com/
2807 !! result
2808 <p><a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>
2809 </p>
2810 !! end
2812 !! test
2813 External links: www.jpeg.org (bug 554)
2814 !! input
2815 http://www.jpeg.org
2816 !!result
2817 <p><a rel="nofollow" class="external free" href="http://www.jpeg.org">http://www.jpeg.org</a>
2818 </p>
2819 !! end
2821 !! test
2822 External links: URL within URL (original bug 2)
2823 !! input
2824 [http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp]
2825 !! result
2826 <p><a rel="nofollow" class="external autonumber" href="http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp">[1]</a>
2827 </p>
2828 !! end
2830 !! test
2831 BUG 361: URL inside bracketed URL
2832 !! input
2833 [http://www.example.com/foo http://www.example.com/bar]
2834 !! result
2835 <p><a rel="nofollow" class="external text" href="http://www.example.com/foo">http://www.example.com/bar</a>
2836 </p>
2837 !! end
2839 !! test
2840 BUG 361: URL within URL, not bracketed
2841 !! input
2842 http://www.example.com/foo?=http://www.example.com/bar
2843 !! result
2844 <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>
2845 </p>
2846 !! end
2848 !! test
2849 BUG 289: ">"-token in URL-tail
2850 !! input
2851 http://www.example.com/<hello>
2852 !! result
2853 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a>&lt;hello&gt;
2854 </p>
2855 !!end
2857 !! test
2858 BUG 289: literal ">"-token in URL-tail
2859 !! input
2860 http://www.example.com/<b>html</b>
2861 !! result
2862 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a><b>html</b>
2863 </p>
2864 !!end
2866 !! test
2867 BUG 289: ">"-token in bracketed URL
2868 !! input
2869 [http://www.example.com/<hello> stuff]
2870 !! result
2871 <p><a rel="nofollow" class="external text" href="http://www.example.com/">&lt;hello&gt; stuff</a>
2872 </p>
2873 !!end
2875 !! test
2876 BUG 289: literal ">"-token in bracketed URL
2877 !! input
2878 [http://www.example.com/<b>html</b> stuff]
2879 !! result
2880 <p><a rel="nofollow" class="external text" href="http://www.example.com/"><b>html</b> stuff</a>
2881 </p>
2882 !!end
2884 !! test
2885 BUG 289: literal double quote at end of URL
2886 !! input
2887 http://www.example.com/"hello"
2888 !! result
2889 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a>"hello"
2890 </p>
2891 !!end
2893 !! test
2894 BUG 289: literal double quote in bracketed URL
2895 !! input
2896 [http://www.example.com/"hello" stuff]
2897 !! result
2898 <p><a rel="nofollow" class="external text" href="http://www.example.com/">"hello" stuff</a>
2899 </p>
2900 !!end
2902 !! test
2903 External links: multiple legal whitespace is fine, Magnus. Don't break it please. (bug 5081)
2904 !! input
2905 [http://www.example.com  test]
2906 !! result
2907 <p><a rel="nofollow" class="external text" href="http://www.example.com">test</a>
2908 </p>
2909 !! end
2911 !! test
2912 External links: link text with spaces
2913 !! input
2914 [http://www.example.com a b c]
2915 [http://www.example.com ''a'' ''b'']
2916 !! result
2917 <p><a rel="nofollow" class="external text" href="http://www.example.com">a b c</a>
2918 <a rel="nofollow" class="external text" href="http://www.example.com"><i>a</i> <i>b</i></a>
2919 </p>
2920 !! end
2922 !! test
2923 External links: wiki links within external link (Bug 3695)
2924 !! input
2925 [http://example.com [[wikilink]] embedded in ext link]
2926 !! result
2927 <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>
2928 </p>
2929 !! end
2931 !! test
2932 BUG 787: Links with one slash after the url protocol are invalid
2933 !! input
2934 http:/example.com
2936 [http:/example.com title]
2937 !! result
2938 <p>http:/example.com
2939 </p><p>[http:/example.com title]
2940 </p>
2941 !! end
2943 !! test
2944 Bracketed external links with template-generated invalid target
2945 !! input
2946 [{{echo|http:/example.com}} title]
2947 !! result
2948 <p>[http:/example.com title]
2949 </p>
2950 !! end
2952 !! test
2953 Bug 2702: Mismatched <i>, <b> and <a> tags are invalid
2954 !! input
2955 ''[http://example.com text'']
2956 [http://example.com '''text]'''
2957 ''Something [http://example.com in italic'']
2958 ''Something [http://example.com mixed''''', even bold]'''
2959 '''''Now [http://example.com both''''']
2960 !! result
2961 <p><a rel="nofollow" class="external text" href="http://example.com"><i>text</i></a>
2962 <a rel="nofollow" class="external text" href="http://example.com"><b>text</b></a>
2963 <i>Something </i><a rel="nofollow" class="external text" href="http://example.com"><i>in italic</i></a>
2964 <i>Something </i><a rel="nofollow" class="external text" href="http://example.com"><i>mixed</i><b>, even bold</b></a>
2965 <i><b>Now </b></i><a rel="nofollow" class="external text" href="http://example.com"><i><b>both</b></i></a>
2966 </p>
2967 !! end
2970 !! test
2971 Bug 4781: %26 in URL
2972 !! input
2973 http://www.example.com/?title=AT%26T
2974 !! result
2975 <p><a rel="nofollow" class="external free" href="http://www.example.com/?title=AT%26T">http://www.example.com/?title=AT%26T</a>
2976 </p>
2977 !! end
2979 # According to http://dev.w3.org/html5/spec/Overview.html#parsing-urls a plain
2980 # % is actually legal in HTML5. Any change in output would need testing though.
2981 !! test
2982 Bug 4781, 5267: %25 in URL
2983 !! input
2984 http://www.example.com/?title=100%25_Bran
2985 !! result
2986 <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>
2987 </p>
2988 !! end
2990 !! test
2991 Bug 4781, 5267: %28, %29 in URL
2992 !! input
2993 http://www.example.com/?title=Ben-Hur_%281959_film%29
2994 !! result
2995 <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>
2996 </p>
2997 !! end
3000 !! test
3001 Bug 4781: %26 in autonumber URL
3002 !! input
3003 [http://www.example.com/?title=AT%26T]
3004 !! result
3005 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=AT%26T">[1]</a>
3006 </p>
3007 !! end
3009 !! test
3010 Bug 4781, 5267: %26 in autonumber URL
3011 !! input
3012 [http://www.example.com/?title=100%25_Bran]
3013 !! result
3014 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=100%25_Bran">[1]</a>
3015 </p>
3016 !! end
3018 !! test
3019 Bug 4781, 5267: %28, %29 in autonumber URL
3020 !! input
3021 [http://www.example.com/?title=Ben-Hur_%281959_film%29]
3022 !! result
3023 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">[1]</a>
3024 </p>
3025 !! end
3028 !! test
3029 Bug 4781: %26 in bracketed URL
3030 !! input
3031 [http://www.example.com/?title=AT%26T link]
3032 !! result
3033 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=AT%26T">link</a>
3034 </p>
3035 !! end
3037 !! test
3038 Bug 4781, 5267: %26 in bracketed URL
3039 !! input
3040 [http://www.example.com/?title=100%25_Bran link]
3041 !! result
3042 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=100%25_Bran">link</a>
3043 </p>
3044 !! end
3046 !! test
3047 Bug 4781, 5267: %28, %29 in bracketed URL
3048 !! input
3049 [http://www.example.com/?title=Ben-Hur_%281959_film%29 link]
3050 !! result
3051 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">link</a>
3052 </p>
3053 !! end
3055 !! test
3056 External link containing double-single-quotes in text '' (bug 4598 sanity check)
3057 !! input
3058 Some [http://example.com/ pretty ''italics'' and stuff]!
3059 !! result
3060 <p>Some <a rel="nofollow" class="external text" href="http://example.com/">pretty <i>italics</i> and stuff</a>!
3061 </p>
3062 !! end
3064 !! test
3065 External link containing double-single-quotes in text embedded in italics (bug 4598 sanity check)
3066 !! input
3067 ''Some [http://example.com/ pretty ''italics'' and stuff]!''
3068 !! result
3069 <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>
3070 </p>
3071 !! end
3073 !! test
3074 External link containing double-single-quotes with no space separating the url from text in italics
3075 !! input
3076 [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]].]
3077 !! result
3078 <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>
3079 </p>
3080 !! end
3082 !! test
3083 URL-encoding in URL functions (single parameter)
3084 !! input
3085 {{localurl:Some page|amp=&}}
3086 !! result
3087 <p>/index.php?title=Some_page&amp;amp=&amp;
3088 </p>
3089 !! end
3091 !! test
3092 URL-encoding in URL functions (multiple parameters)
3093 !! input
3094 {{localurl:Some page|q=?&amp=&}}
3095 !! result
3096 <p>/index.php?title=Some_page&amp;q=?&amp;amp=&amp;
3097 </p>
3098 !! end
3100 !! test
3101 Brackets in urls
3102 !! input
3103 http://example.com/index.php?foozoid%5B%5D=bar
3105 http://example.com/index.php?foozoid&#x5B;&#x5D;=bar
3106 !! result
3107 <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>
3108 </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>
3109 </p>
3110 !! end
3112 !! test
3113 IPv6 urls (bug 21261)
3114 !! options
3115 disabled
3116 !! input
3117 http://[2404:130:0:1000::187:2]/index.php
3118 !! result
3119 <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>
3120 </p>
3121 !! end
3123 !! test
3124 Non-extlinks in brackets
3125 !! input
3126 [foo]
3127 [foo bar]
3128 [foo ''bar'']
3129 [fool's] errand
3130 [fool's errand]
3131 [{{echo|foo}}]
3132 [{{echo|foo}} bar]
3133 [{{echo|foo}} ''bar'']
3134 [{{echo|foo}}l's] errand
3135 [{{echo|foo}}l's errand]
3136 [url={{echo|foo}}]
3137 [url=http://example.com]
3138 !! result
3139 <p>[foo]
3140 [foo bar]
3141 [foo <i>bar</i>]
3142 [fool's] errand
3143 [fool's errand]
3144 [foo]
3145 [foo bar]
3146 [foo <i>bar</i>]
3147 [fool's] errand
3148 [fool's errand]
3149 [url=foo]
3150 [url=<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>]
3151 </p>
3152 !! end
3155 ### Quotes
3158 !! test
3159 Quotes
3160 !! input
3161 Normal text. '''Bold text.''' Normal text. ''Italic text.''
3163 Normal text. '''''Bold italic text.''''' Normal text.
3164 !!result
3165 <p>Normal text. <b>Bold text.</b> Normal text. <i>Italic text.</i>
3166 </p><p>Normal text. <i><b>Bold italic text.</b></i> Normal text.
3167 </p>
3168 !! end
3171 !! test
3172 Unclosed and unmatched quotes (php)
3173 !! options
3175 !! input
3176 '''''Bold italic text '''with bold deactivated''' in between.'''''
3178 '''''Bold italic text ''with italic deactivated'' in between.'''''
3180 '''Bold text..
3182 ..spanning two paragraphs (should not work).'''
3184 '''Bold tag left open
3186 ''Italic tag left open
3188 Normal text.
3190 <!-- Unmatching number of opening, closing tags: -->
3191 '''This year''''s election ''should'' beat '''last year''''s.
3193 ''Tom'''s car is bigger than ''Susan'''s.
3195 Plain ''italic'''s plain
3196 !! result
3197 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
3198 </p><p><b><i>Bold italic text </i>with italic deactivated<i> in between.</i></b>
3199 </p><p><b>Bold text..</b>
3200 </p><p>..spanning two paragraphs (should not work).
3201 </p><p><b>Bold tag left open</b>
3202 </p><p><i>Italic tag left open</i>
3203 </p><p>Normal text.
3204 </p><p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
3205 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
3206 </p><p>Plain <i>italic'</i>s plain
3207 </p>
3208 !! end
3209 # Parsoid inserts an empty bold tag pair at the end of the line, that the PHP
3210 # parser strips. The wikitext contains just the first half of the bold
3211 # quote pair. (There's also a case where Parsoid nests <b> and <i>
3212 # differently than the PHP parser.)
3213 !! test
3214 Unclosed and unmatched quotes (parsoid)
3215 !! options
3216 parsoid
3217 !! input
3218 '''''Bold italic text '''with bold deactivated''' in between.'''''
3220 '''''Bold italic text ''with italic deactivated'' in between.'''''
3222 '''Bold text..
3224 ..spanning two paragraphs (should not work).'''
3226 '''Bold tag left open
3228 ''Italic tag left open
3230 Normal text.
3232 <!-- Unmatching number of opening, closing tags: -->
3233 '''This year''''s election ''should'' beat '''last year''''s.
3235 ''Tom'''s car is bigger than ''Susan'''s.
3237 Plain ''italic'''s plain
3238 !! result
3239 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
3240 </p><p><i><b>Bold italic text </b></i><b>with italic deactivated<i> in between.</i></b>
3241 </p><p><b>Bold text..</b>
3242 </p><p>..spanning two paragraphs (should not work).<b></b>
3243 </p><p><b>Bold tag left open</b>
3244 </p><p><i>Italic tag left open</i>
3245 </p><p>Normal text.
3246 </p><p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
3247 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
3248 </p><p>Plain <i>italic'</i>s plain
3249 </p>
3250 !! end
3253 ### Tables
3255 ### some content taken from http://meta.wikimedia.org/wiki/MediaWiki_User%27s_Guide:_Using_tables
3258 # This should not produce <table></table> as <table><tr><td></td></tr></table>
3259 # is the bare minimun required by the spec, see:
3260 # http://www.w3.org/TR/xhtml-modularization/dtd_module_defs.html#a_module_Basic_Tables
3261 !! test
3262 A table with no data. (php)
3263 !! options
3265 !! input
3266 {||}
3267 !! result
3268 !! end
3269 # Parsoid team replies: empty table tags are legal in HTML5
3270 !! test
3271 A table with no data. (parsoid)
3272 !! options
3273 parsoid
3274 !! input
3275 {||}
3276 !! result
3277 <table></table>
3278 !! end
3280 # A table with nothing but a caption is invalid XHTML, we might want to render
3281 # this as <p>caption</p>
3282 !! test
3283 A table with nothing but a caption (php)
3284 !! options
3286 !! input
3288 |+ caption
3290 !! result
3291 <table>
3292 <caption> caption
3293 </caption><tr><td></td></tr></table>
3295 !! end
3296 # Parsoid team replies: table with only a caption is legal in HTML5
3297 !! test
3298 A table with nothing but a caption (parsoid)
3299 !! options
3300 parsoid
3301 !! input
3303 |+ caption
3305 !! result
3306 <table><caption> caption</caption></table>
3307 !! end
3309 !! test
3310 A table with caption with default-spaced attributes and a table row
3311 !! input
3313 |+ style="color: red;" | caption1
3315 | foo
3317 !! result
3318 <table>
3319 <caption style="color: red;"> caption1
3320 </caption>
3321 <tr>
3322 <td> foo
3323 </td></tr></table>
3325 !! end
3327 !! test
3328 A table with captions with non-default spaced attributes and a table row
3329 !! input
3331 |+style="color: red;"|caption2
3332 |+ style="color: red;"| caption3
3334 | foo
3336 !! result
3337 <table>
3338 <caption style="color: red;">caption2
3339 </caption>
3340 <caption style="color: red;"> caption3
3341 </caption>
3342 <tr>
3343 <td> foo
3344 </td></tr></table>
3346 !! end
3348 !! test
3349 Table td-cell syntax variations
3350 !! input
3352 | foo bar foo | baz
3353 | foo bar foo || baz
3354 | style='color:red;' | baz
3355 | style='color:red;' || baz
3357 !! result
3358 <table>
3359 <tr>
3360 <td> baz
3361 </td>
3362 <td> foo bar foo </td>
3363 <td> baz
3364 </td>
3365 <td style="color:red;"> baz
3366 </td>
3367 <td> style='color:red;' </td>
3368 <td> baz
3369 </td></tr></table>
3371 !! end
3373 !! test
3374 Simple table
3375 !! input
3377 | 1 || 2
3379 | 3 || 4
3381 !! result
3382 <table>
3383 <tr>
3384 <td> 1 </td>
3385 <td> 2
3386 </td></tr>
3387 <tr>
3388 <td> 3 </td>
3389 <td> 4
3390 </td></tr></table>
3392 !! end
3394 !! test
3395 Simple table but with multiple dashes for row wikitext
3396 !! input
3398 | foo
3399 |-----
3400 | bar
3402 !! result
3403 <table>
3404 <tr>
3405 <td> foo
3406 </td></tr>
3407 <tr>
3408 <td> bar
3409 </td></tr></table>
3411 !! end
3412 !! test
3413 Multiplication table
3414 !! input
3415 {| border="1" cellpadding="2"
3416 |+Multiplication table
3418 ! &times; !! 1 !! 2 !! 3
3420 ! 1
3421 | 1 || 2 || 3
3423 ! 2
3424 | 2 || 4 || 6
3426 ! 3
3427 | 3 || 6 || 9
3429 ! 4
3430 | 4 || 8 || 12
3432 ! 5
3433 | 5 || 10 || 15
3435 !! result
3436 <table border="1" cellpadding="2">
3437 <caption>Multiplication table
3438 </caption>
3439 <tr>
3440 <th> &#215; </th>
3441 <th> 1 </th>
3442 <th> 2 </th>
3443 <th> 3
3444 </th></tr>
3445 <tr>
3446 <th> 1
3447 </th>
3448 <td> 1 </td>
3449 <td> 2 </td>
3450 <td> 3
3451 </td></tr>
3452 <tr>
3453 <th> 2
3454 </th>
3455 <td> 2 </td>
3456 <td> 4 </td>
3457 <td> 6
3458 </td></tr>
3459 <tr>
3460 <th> 3
3461 </th>
3462 <td> 3 </td>
3463 <td> 6 </td>
3464 <td> 9
3465 </td></tr>
3466 <tr>
3467 <th> 4
3468 </th>
3469 <td> 4 </td>
3470 <td> 8 </td>
3471 <td> 12
3472 </td></tr>
3473 <tr>
3474 <th> 5
3475 </th>
3476 <td> 5 </td>
3477 <td> 10 </td>
3478 <td> 15
3479 </td></tr></table>
3481 !! end
3483 !! test
3484 Accept "||" in table headings
3485 !! input
3487 !h1 || h2
3489 !! result
3490 <table>
3491 <tr>
3492 <th>h1 </th>
3493 <th> h2
3494 </th></tr></table>
3496 !! end
3498 !! test
3499 Accept "||" in indented table headings
3500 !! input
3502 !h1 || h2
3504 !! result
3505 <dl><dd><table>
3506 <tr>
3507 <th>h1 </th>
3508 <th> h2
3509 </th></tr></table></dd></dl>
3511 !! end
3513 !! test
3514 Accept empty attributes in td/th cells (td/th cells starting with leading ||)
3515 !! input
3517 !| h1
3518 || a
3520 !! result
3521 <table>
3522 <tr>
3523 <th> h1
3524 </th>
3525 <td> a
3526 </td></tr></table>
3528 !! end
3530 !!test
3531 Accept "| !" at start of line in tables (ignore !-attribute)
3532 !!input
3535 | !style="color:red" | bar
3537 !!result
3538 <table>
3540 <tr>
3541 <td> bar
3542 </td></tr></table>
3544 !!end
3546 !!test
3547 Allow +/- in 2nd and later cells in a row, in 1st cell when td-attrs are present, or in 1st cell when there is a space between "|" and +/- 
3548 !!input
3551 |style='color:red;'|+1
3552 |style='color:blue;'|-1
3554 | 1 || 2 || 3
3555 | 1 ||+2 ||-3
3557 | +1
3558 | -1
3560 !!result
3561 <table>
3563 <tr>
3564 <td style="color:red;">+1
3565 </td>
3566 <td style="color:blue;">-1
3567 </td></tr>
3568 <tr>
3569 <td> 1 </td>
3570 <td> 2 </td>
3571 <td> 3
3572 </td>
3573 <td> 1 </td>
3574 <td>+2 </td>
3575 <td>-3
3576 </td></tr>
3577 <tr>
3578 <td> +1
3579 </td>
3580 <td> -1
3581 </td></tr></table>
3583 !!end
3585 !! test
3586 Table rowspan
3587 !! input
3588 {| border=1
3589 | Cell 1, row 1
3590 |rowspan=2| Cell 2, row 1 (and 2)
3591 | Cell 3, row 1
3593 | Cell 1, row 2
3594 | Cell 3, row 2
3596 !! result
3597 <table border="1">
3598 <tr>
3599 <td> Cell 1, row 1
3600 </td>
3601 <td rowspan="2"> Cell 2, row 1 (and 2)
3602 </td>
3603 <td> Cell 3, row 1
3604 </td></tr>
3605 <tr>
3606 <td> Cell 1, row 2
3607 </td>
3608 <td> Cell 3, row 2
3609 </td></tr></table>
3611 !! end
3613 !! test
3614 Nested table
3615 !! input
3616 {| border=1
3617 | &alpha;
3619 {| bgcolor=#ABCDEF border=2
3620 |nested
3622 |table
3624 |the original table again
3626 !! result
3627 <table border="1">
3628 <tr>
3629 <td> &#945;
3630 </td>
3631 <td>
3632 <table bgcolor="#ABCDEF" border="2">
3633 <tr>
3634 <td>nested
3635 </td></tr>
3636 <tr>
3637 <td>table
3638 </td></tr></table>
3639 </td>
3640 <td>the original table again
3641 </td></tr></table>
3643 !! end
3645 !! test
3646 Invalid attributes in table cell (bug 1830)
3647 !! input
3649 |Cell:|broken
3651 !! result
3652 <table>
3653 <tr>
3654 <td>broken
3655 </td></tr></table>
3657 !! end
3660 !! test
3661 Table security: embedded pipes (http://lists.wikimedia.org/mailman/htdig/wikitech-l/2006-April/022293.html)
3662 !! input
3664 | |[ftp://|x||]" onmouseover="alert(document.cookie)">test
3665 !! result
3666 <table>
3667 <tr>
3668 <td>[<a rel="nofollow" class="external free" href="ftp://%7Cx">ftp://%7Cx</a></td>
3669 <td>]" onmouseover="alert(document.cookie)"&gt;test
3670 </td>
3671 </tr>
3672 </table>
3674 !! end
3677 !! test
3678 Indented table markup mixed with indented pre content (proposed in bug 6200)
3679 !! input
3680  <table>
3681  <tr>
3682  <td>
3683  Text that should be rendered preformatted
3684  </td>
3685  </tr>
3686  </table>
3687 !! result
3688  <table>
3689  <tr>
3690  <td>
3691 <pre>Text that should be rendered preformatted
3692 </pre>
3693  </td>
3694  </tr>
3695  </table>
3697 !! end
3699 !! test
3700 Template-generated table cell attributes and cell content
3701 !! input
3703 |{{table_attribs}}
3705 !! result
3706 <table>
3707 <tr>
3708 <td style="color: red"> Foo
3709 </td></tr></table>
3711 !! end
3713 !! test
3714 Table with row followed by newlines and table heading
3715 !! input
3719 ! foo
3721 !! result
3722 <table>
3725 <tr>
3726 <th> foo
3727 </th></tr></table>
3729 !! end
3731 !! test
3732 Table with empty line following the start tag
3733 !! input
3737 | foo
3739 !! result
3740 <table>
3743 <tr>
3744 <td> foo
3745 </td></tr></table>
3747 !! end
3749 # FIXME: Preserve the attribute properly (with an empty string as value) in
3750 # the PHP parser. Parsoid implements the behavior below.
3751 !! test
3752 Table attributes with empty value
3753 !! options
3754 parsoid
3755 !! input
3757 | style=| hello
3759 !! result
3760 <table>
3761 <tbody>
3762 <tr>
3763 <td style=""> hello
3764 </td></tr></tbody></table>
3766 !! end
3768 !! test
3769 Wikitext table with a lot of comments
3770 !! input
3772 <!-- c0 -->
3773 | foo
3774 <!-- c1 -->
3775 |- <!-- c2 -->
3776 <!-- c3 -->
3777 |<!-- c4 -->
3778 <!-- c5 -->
3780 !! result
3781 <table>
3782 <tr>
3783 <td> foo
3784 </td></tr>
3785 <tr>
3786 <td>
3787 </td></tr></table>
3789 !! end
3791 !! test
3792 Wikitext table with double-line table cell
3793 !! input
3798 !! result
3799 <table>
3800 <tr>
3801 <td>a
3802 <p>b
3803 </p>
3804 </td></tr></table>
3806 !! end
3808 !! test
3809 Table cell with a single comment
3810 !! input
3812 | <!-- c1 -->
3813 | a
3815 !! result
3816 <table>
3817 <tr>
3818 <td>
3819 </td>
3820 <td> a
3821 </td></tr></table>
3823 !! end
3825 # The expected HTML structure in this test is debatable. The PHP parser does
3826 # not parse this kind of table at all. The main focus for Parsoid is on
3827 # round-tripping, so this output is ok for now. TODO: revisit!
3828 !! test
3829 Wikitext table with html-syntax row (Parsoid)
3830 !! options
3831 parsoid
3832 !! input
3835 <td>foo</td>
3837 !! result
3838 <table>
3839 <tbody>
3840 <tr>
3841 <td>foo</td></tr></tbody></table>
3842 !! end
3845 ### Internal links
3847 !! test
3848 Plain link, capitalized
3849 !! input
3850 [[Main Page]]
3851 !! result
3852 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
3853 </p>
3854 !! end
3856 !! test
3857 Plain link, uncapitalized
3858 !! input
3859 [[main Page]]
3860 !! result
3861 <p><a href="/wiki/Main_Page" title="Main Page">main Page</a>
3862 </p>
3863 !! end
3865 !! test
3866 Piped link
3867 !! input
3868 [[Main Page|The Main Page]]
3869 !! result
3870 <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
3871 </p>
3872 !! end
3874 !! test
3875 Broken link
3876 !! input
3877 [[Zigzagzogzagzig]]
3878 !! result
3879 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig</a>
3880 </p>
3881 !! end
3883 !! test
3884 Broken link with fragment
3885 !! input
3886 [[Zigzagzogzagzig#zug]]
3887 !! result
3888 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig#zug</a>
3889 </p>
3890 !! end
3892 !! test
3893 Special page link with fragment
3894 !! input
3895 [[Special:Version#anchor]]
3896 !! result
3897 <p><a href="/wiki/Special:Version#anchor" title="Special:Version">Special:Version#anchor</a>
3898 </p>
3899 !! end
3901 !! test
3902 Nonexistent special page link with fragment
3903 !! input
3904 [[Special:ThisNameWillHopefullyNeverBeUsed#anchor]]
3905 !! result
3906 <p><a href="/wiki/Special:ThisNameWillHopefullyNeverBeUsed" class="new" title="Special:ThisNameWillHopefullyNeverBeUsed (page does not exist)">Special:ThisNameWillHopefullyNeverBeUsed#anchor</a>
3907 </p>
3908 !! end
3910 !! test
3911 Link with prefix
3912 !! input
3913 xxx[[main Page]], xxx[[Main Page]], Xxx[[main Page]] XXX[[main Page]], XXX[[Main Page]]
3914 !! result
3915 <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>
3916 </p>
3917 !! end
3919 !! test
3920 Link with suffix
3921 !! input
3922 [[Main Page]]xxx, [[Main Page]]XXX, [[Main Page]]!!!
3923 !! result
3924 <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>!!!
3925 </p>
3926 !! end
3928 !! article
3929 prefixed article
3930 !! text
3931 Some text
3932 !! endarticle
3934 !! test
3935 Bug 43661: Piped links with identical prefixes
3936 !! input
3937 [[prefixed article|prefixed articles with spaces]]
3939 [[prefixed article|prefixed articlesaoeu]]
3941 [[Main Page|Main Page test]]
3942 !! result
3943 <p><a href="/wiki/Prefixed_article" title="Prefixed article">prefixed articles with spaces</a>
3944 </p><p><a href="/wiki/Prefixed_article" title="Prefixed article">prefixed articlesaoeu</a>
3945 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page test</a>
3946 </p>
3947 !! end
3950 !! test
3951 Link with HTML entity in suffix / tail
3952 !! input
3953 [[Main Page]]&quot;, [[Main Page]]&#97;
3954 !! result
3955 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>&quot;, <a href="/wiki/Main_Page" title="Main Page">Main Page</a>&#97;
3956 </p>
3957 !! end
3959 !! test
3960 Link with 3 brackets
3961 !! input
3962 [[[main page]]]
3963 !! result
3964 <p>[[[main page]]]
3965 </p>
3966 !! end
3968 !! test
3969 Piped link with 3 brackets
3970 !! input
3971 [[[main page|the main page]]]
3972 !! result
3973 <p>[[[main page|the main page]]]
3974 </p>
3975 !! end
3977 !! test
3978 Link with multiple pipes
3979 !! input
3980 [[Main Page|The|Main|Page]]
3981 !! result
3982 <p><a href="/wiki/Main_Page" title="Main Page">The|Main|Page</a>
3983 </p>
3984 !! end
3986 !! test
3987 Link to namespaces
3988 !! input
3989 [[Talk:Parser testing]], [[Meta:Disclaimers]]
3990 !! result
3991 <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>
3992 </p>
3993 !! end
3995 !! test
3996 Piped link to namespace
3997 !! input
3998 [[Meta:Disclaimers|The disclaimers]]
3999 !! result
4000 <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>
4001 </p>
4002 !! end
4004 !! test
4005 Link containing }
4006 !! input
4007 [[Usually caused by a typo (oops}]]
4008 !! result
4009 <p>[[Usually caused by a typo (oops}]]
4010 </p>
4011 !! end
4013 !! test
4014 Link containing % (not as a hex sequence)
4015 !! input
4016 [[7% Solution]]
4017 !! result
4018 <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>
4019 </p>
4020 !! end
4022 !! test
4023 Link containing % as a single hex sequence interpreted to char
4024 !! input
4025 [[7%25 Solution]]
4026 !! result
4027 <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>
4028 </p>
4029 !!end
4031 !! test
4032 Link containing % as a double hex sequence interpreted to hex sequence
4033 !! input
4034 [[7%2525 Solution]]
4035 !! result
4036 <p>[[7%2525 Solution]]
4037 </p>
4038 !!end
4040 !! test
4041 Link containing "#<" and "#>" % as a hex sequences- these are valid section anchors
4042 Example for such a section: == < ==
4043 !! input
4044 [[%23%3c]][[%23%3e]]
4045 !! result
4046 <p><a href="#.3C">#&lt;</a><a href="#.3E">#&gt;</a>
4047 </p>
4048 !! end
4050 !! test
4051 Link containing "<#" and ">#" as a hex sequences
4052 !! input
4053 [[%3c%23]][[%3e%23]]
4054 !! result
4055 <p>[[%3c%23]][[%3e%23]]
4056 </p>
4057 !! end
4059 !! test
4060 Link containing an equals sign
4061 !! input
4062 [[Special:BookSources/isbn=4-00-026157-6]]
4063 !! result
4064 <p><a href="/wiki/Special:BookSources/isbn%3D4-00-026157-6" title="Special:BookSources/isbn=4-00-026157-6">Special:BookSources/isbn=4-00-026157-6</a>
4065 </p>
4066 !! end
4068 !! article
4069 Foo~bar
4070 !! text
4071 Just a test of an article title containing a tilde.
4072 !! endarticle
4074 # note that links containing signatures, like [[Foo~~~~]], are
4075 # massaged by the pre-save transform (PST) and so the tildes are never
4076 # seen by the parser.
4077 !! test
4078 Link containing a tilde
4079 !! input
4080 [[Foo~bar]]
4081 !! result
4082 <p><a href="/wiki/Foo%7Ebar" title="Foo~bar">Foo~bar</a>
4083 </p>
4084 !! end
4086 !! test
4087 Link containing double-single-quotes '' (bug 4598)
4088 !! input
4089 [[Lista d''e paise d''o munno]]
4090 !! result
4091 <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>
4092 </p>
4093 !! end
4095 !! test
4096 Link containing double-single-quotes '' in text (bug 4598 sanity check)
4097 !! input
4098 Some [[Link|pretty ''italics'' and stuff]]!
4099 !! result
4100 <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>!
4101 </p>
4102 !! end
4104 !! test
4105 Link containing double-single-quotes '' in text embedded in italics (bug 4598 sanity check)
4106 !! input
4107 ''Some [[Link|pretty ''italics'' and stuff]]!
4108 !! result
4109 <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>
4110 </p>
4111 !! end
4113 !! test
4114 Link with double quotes in title part (literal) and alternate part (interpreted)
4115 !! input
4116 [[File:Denys Savchenko ''Pentecoste''.jpg]]
4118 [[''Pentecoste'']]
4120 [[''Pentecoste''|Pentecoste]]
4122 [[''Pentecoste''|''Pentecoste'']]
4123 !! result
4124 <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>
4125 </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>
4126 </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>
4127 </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>
4128 </p>
4129 !! end
4131 !! test
4132 Broken image links with HTML captions (bug 39700)
4133 !! input
4134 [[File:Nonexistent|<script></script>]]
4135 [[File:Nonexistent|100px|<script></script>]]
4136 [[File:Nonexistent|&lt;]]
4137 [[File:Nonexistent|a<i>b</i>c]]
4138 !! result
4139 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script&gt;&lt;/script&gt;</a>
4140 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script&gt;&lt;/script&gt;</a>
4141 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;</a>
4142 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">abc</a>
4143 </p>
4144 !! end
4146 !! test
4147 Plain link to URL
4148 !! input
4149 [[http://www.example.com]]
4150 !! result
4151 <p>[<a rel="nofollow" class="external autonumber" href="http://www.example.com">[1]</a>]
4152 </p>
4153 !! end
4155 !! test
4156 Plain link to URL with link text
4157 !! input
4158 [[http://www.example.com Link text]]
4159 !! result
4160 <p>[<a rel="nofollow" class="external text" href="http://www.example.com">Link text</a>]
4161 </p>
4162 !! end
4164 !! test
4165 Plain link to protocol-relative URL
4166 !! input
4167 [[//www.example.com]]
4168 !! result
4169 <p>[<a rel="nofollow" class="external autonumber" href="//www.example.com">[1]</a>]
4170 </p>
4171 !! end
4173 !! test
4174 Plain link to protocol-relative URL with link text
4175 !! input
4176 [[//www.example.com Link text]]
4177 !! result
4178 <p>[<a rel="nofollow" class="external text" href="//www.example.com">Link text</a>]
4179 </p>
4180 !! end
4182 !! test
4183 Plain link to page with question mark in title
4184 !! input
4185 [[A?b]]
4187 [[A?b|Baz]]
4188 !! result
4189 <p><a href="/wiki/A%3Fb" title="A?b">A?b</a>
4190 </p><p><a href="/wiki/A%3Fb" title="A?b">Baz</a>
4191 </p>
4192 !! end
4195 # I'm fairly sure the expected result here is wrong.
4196 # We want these to be URL links, not pseudo-pages with URLs for titles....
4197 # However the current output is also pretty screwy.
4199 # ----
4200 # I'm changing it to match the current output--it arguably makes more
4201 # sense in the light of the test above. Old expected result was:
4202 #<p>Piped link to URL: <a href="/index.php?title=Http://www.example.com&amp;action=edit" class="new">an example URL</a>
4203 #</p>
4204 # But I think this test is bordering on "garbage in, garbage out" anyway.
4205 # -- wtm
4206 !! test
4207 Piped link to URL
4208 !! input
4209 Piped link to URL: [[http://www.example.com|an example URL]]
4210 !! result
4211 <p>Piped link to URL: [<a rel="nofollow" class="external text" href="http://www.example.com%7Can">example URL</a>]
4212 </p>
4213 !! end
4215 !! test
4216 BUG 2: [[page|http://url/]] should link to page, not http://url/
4217 !! input
4218 [[Main Page|http://url/]]
4219 !! result
4220 <p><a href="/wiki/Main_Page" title="Main Page">http://url/</a>
4221 </p>
4222 !! end
4224 !! test
4225 BUG 337: Escaped self-links should be bold
4226 !! options
4227 title=[[Bug462]]
4228 !! input
4229 [[Bu&#103;462]] [[Bug462]]
4230 !! result
4231 <p><strong class="selflink">Bu&#103;462</strong> <strong class="selflink">Bug462</strong>
4232 </p>
4233 !! end
4235 !! test
4236 Self-link to section should not be bold
4237 !! options
4238 title=[[Main Page]]
4239 !! input
4240 [[Main Page#section]]
4241 !! result
4242 <p><a href="/wiki/Main_Page#section" title="Main Page">Main Page#section</a>
4243 </p>
4244 !! end
4246 !! article
4248 !! text
4249 This is 00.
4250 !! endarticle
4252 !!test
4253 Self-link to numeric title
4254 !!options
4255 title=[[0]]
4256 !!input
4257 [[0]]
4258 !!result
4259 <p><strong class="selflink">0</strong>
4260 </p>
4261 !!end
4263 !!test
4264 Link to numeric-equivalent title
4265 !!options
4266 title=[[0]]
4267 !!input
4268 [[00]]
4269 !!result
4270 <p><a href="/wiki/00" title="00">00</a>
4271 </p>
4272 !!end
4274 !! test
4275 <nowiki> inside a link
4276 !! input
4277 [[Main<nowiki> Page</nowiki>]] [[Main Page|the main page <nowiki>[it's not very good]</nowiki>]]
4278 !! result
4279 <p>[[Main Page]] <a href="/wiki/Main_Page" title="Main Page">the main page [it's not very good]</a>
4280 </p>
4281 !! end
4283 !! test
4284 Non-breaking spaces in title
4285 !! input
4286 [[&nbsp; Main &nbsp; Page &nbsp;]]
4287 !! result
4288 <p><a href="/wiki/Main_Page" title="Main Page">&#160; Main &#160; Page &#160;</a>
4289 </p>
4290 !!end
4292 !! test
4293 Internal link with ca linktrail, surrounded by bold apostrophes (bug 27473 primary issue)
4294 !! options
4295 language=ca
4296 !! input
4297 '''[[Main Page]]'''
4298 !! result
4299 <p><b><a href="/wiki/Main_Page" title="Main Page">Main Page</a></b>
4300 </p>
4301 !! end
4303 !! test
4304 Internal link with ca linktrail, surrounded by italic apostrophes (bug 27473 primary issue)
4305 !! options
4306 language=ca
4307 !! input
4308 ''[[Main Page]]''
4309 !! result
4310 <p><i><a href="/wiki/Main_Page" title="Main Page">Main Page</a></i>
4311 </p>
4312 !! end
4314 !! test
4315 Internal link with en linktrail: no apostrophes (bug 27473)
4316 !! options
4317 language=en
4318 !! input
4319 [[Something]]'nice
4320 !! result
4321 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (page does not exist)">Something</a>'nice
4322 </p>
4323 !! end
4325 !! test
4326 Internal link with ca linktrail with apostrophes (bug 27473)
4327 !! options
4328 language=ca
4329 !! input
4330 [[Something]]'nice
4331 !! result
4332 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (encara no existeix)">Something'nice</a>
4333 </p>
4334 !! end
4336 !! test
4337 Internal link with kaa linktrail with apostrophes (bug 27473)
4338 !! options
4339 language=kaa
4340 !! input
4341 [[Something]]'nice
4342 !! result
4343 <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>
4344 </p>
4345 !! end
4347 !! article
4348 Söfnuður
4349 !! text
4350 Test.
4351 !! endarticle
4353 !! test
4354 Internal link with is link prefix
4355 !! options
4356 language=is
4357 !! input
4358 Aðrir mótmælenda[[söfnuður|söfnuðir]] og
4359 !! result
4360 <p>Aðrir <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðir</a> og
4361 </p>
4362 !! end
4364 !! article
4365 Mótmælendatrú
4366 !! text
4367 Test.
4368 !! endarticle
4370 !! test
4371 Internal link with is link trail and link prefix
4372 !! options
4373 language=is
4374 !! input
4375 [[mótmælendatrú|xxx]]ar
4376 [[mótmælendatrú]]ar
4377 mótmælenda[[söfnuður]]
4378 mótmælenda[[söfnuður|söfnuðir]]
4379 mótmælenda[[söfnuður|söfnuðir]]xxx
4380 !! result
4381 <p><a href="/wiki/M%C3%B3tm%C3%A6lendatr%C3%BA" title="Mótmælendatrú">xxxar</a>
4382 <a href="/wiki/M%C3%B3tm%C3%A6lendatr%C3%BA" title="Mótmælendatrú">mótmælendatrúar</a>
4383 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuður</a>
4384 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðir</a>
4385 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðirxxx</a>
4386 </p>
4387 !! end
4389 !! test
4390 Parsoid link trail escaping
4391 !! options
4392 parsoid=html2wt,html2html
4393 !! input
4394 [[apple]]<nowiki/>s
4395 !! result
4396 <p><a rel="mw:WikiLink" href="Apple">apple</a>s</p>
4397 !! end
4399 !! test
4400 Parsoid link prefix escaping
4401 !! options
4402 language=is
4403 parsoid=html2wt,html2html
4404 !! input
4405 Aðrir mótmælenda<nowiki/>[[söfnuður]]
4406 !! result
4407 <p>Aðrir mótmælenda<a rel="mw:WikiLink" href="Söfnuður">söfnuður</a></p>
4408 !! end
4410 !! test
4411 Parsoid-centric test: Whitespace in ext- and wiki-links should be preserved
4412 !! input
4413 [[Foo|  bar]]
4415 [[Foo|  ''bar'']]
4417 [http://wp.org   foo]
4419 [http://wp.org   ''foo'']
4420 !! result
4421 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">  bar</a>
4422 </p><p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">  <i>bar</i></a>
4423 </p><p><a rel="nofollow" class="external text" href="http://wp.org">foo</a>
4424 </p><p><a rel="nofollow" class="external text" href="http://wp.org"><i>foo</i></a>
4425 </p>
4426 !! end
4429 ### Interwiki links (see maintenance/interwiki.sql)
4432 !! test
4433 Inline interwiki link
4434 !! input
4435 [[MeatBall:SoftSecurity]]
4436 !! result
4437 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity</a>
4438 </p>
4439 !! end
4441 !! test
4442 Inline interwiki link with empty title (bug 2372)
4443 !! input
4444 [[MeatBall:]]
4445 !! result
4446 <p><a href="http://www.usemod.com/cgi-bin/mb.pl" class="extiw" title="meatball:">MeatBall:</a>
4447 </p>
4448 !! end
4450 !! test
4451 Interwiki link encoding conversion (bug 1636)
4452 !! input
4453 *[[Wikipedia:ro:Olteni&#0355;a]]
4454 *[[Wikipedia:ro:Olteni&#355;a]]
4455 !! result
4456 <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>
4457 </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>
4458 </li></ul>
4460 !! end
4462 !! test
4463 Interwiki link with fragment (bug 2130)
4464 !! input
4465 [[MeatBall:SoftSecurity#foo]]
4466 !! result
4467 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity#foo" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity#foo</a>
4468 </p>
4469 !! end
4471 !! test
4472 Interlanguage link
4473 !! input
4474 Blah blah blah
4475 [[zh:Chinese]]
4476 !!result
4477 <p>Blah blah blah
4478 </p>
4479 !! end
4481 !! test
4482 Double interlanguage link
4483 !! input
4484 Blah blah blah
4485 [[es:Spanish]]
4486 [[zh:Chinese]]
4487 !!result
4488 <p>Blah blah blah
4489 </p>
4490 !! end
4492 !! test
4493 Interlanguage link, with prefix links
4494 !! options
4495 language=ln
4496 !! input
4497 Blah blah blah
4498 [[zh:Chinese]]
4499 !!result
4500 <p>Blah blah blah
4501 </p>
4502 !! end
4504 !! test
4505 Double interlanguage link, with prefix links (bug 8897)
4506 !! options
4507 language=ln
4508 !! input
4509 Blah blah blah
4510 [[es:Spanish]]
4511 [[zh:Chinese]]
4512 !!result
4513 <p>Blah blah blah
4514 </p>
4515 !! end
4517 !! test
4518 Parsoid-specific test: Wikilinks with &nbsp; should RT properly
4519 !! options
4520 language=ln
4521 !! input
4522 [[WW&nbsp;II]]
4523 !!result
4524 <p><a href="/index.php?title=WW_II&amp;action=edit&amp;redlink=1" class="new" title="WW II (lonkásá  ezalí tɛ̂)">WW&#160;II</a>
4525 </p>
4526 !! end
4529 ## XHTML tidiness
4532 !! test
4533 <br> to <br />
4534 !! input
4535 1<br>2<br />3
4536 !! result
4537 <p>1<br />2<br />3
4538 </p>
4539 !! end
4541 !! test
4542 Broken br tag sanitization
4543 !! input
4544 </br>
4545 !! result
4546 <p>&lt;/br&gt;
4547 </p>
4548 !! end
4550 !! test
4551 Incorrecly removing closing slashes from correctly formed XHTML
4552 !! input
4553 <br style="clear:both;" />
4554 !! result
4555 <p><br style="clear:both;" />
4556 </p>
4557 !! end
4559 !! test
4560 Failing to transform badly formed HTML into correct XHTML
4561 !! input
4562 <br style="clear: left;">
4563 <br style="clear: right;">
4564 <br style="clear: both;">
4565 !! result
4566 <p><br style="clear: left;" />
4567 <br style="clear: right;" />
4568 <br style="clear: both;" />
4569 </p>
4570 !!end
4572 !! test
4573 Handling html with a div self-closing tag
4574 !! input
4575 <div title />
4576 <div title/>
4577 <div title/ >
4578 <div title=bar />
4579 <div title=bar/>
4580 <div title=bar/ >
4581 !! result
4582 <p>&lt;div title /&gt;
4583 &lt;div title/&gt;
4584 </p>
4585 <div>
4586 <p>&lt;div title=bar /&gt;
4587 &lt;div title=bar/&gt;
4588 </p>
4589 <div title="bar/"></div>
4590 </div>
4592 !! end
4594 !! test
4595 Handling html with a br self-closing tag
4596 !! input
4597 <br title />
4598 <br title/>
4599 <br title/ >
4600 <br title=bar />
4601 <br title=bar/>
4602 <br title=bar/ >
4603 !! result
4604 <p><br title="title" />
4605 <br title="title" />
4606 <br />
4607 <br title="bar" />
4608 <br title="bar" />
4609 <br title="bar/" />
4610 </p>
4611 !! end
4613 !! test
4614 Horizontal ruler (should it add that extra space?)
4615 !! input
4616 <hr>
4617 <hr >
4618 foo <hr
4619 > bar
4620 !! result
4621 <hr />
4622 <hr />
4623 foo <hr /> bar
4625 !! end
4627 !! test
4628 Horizontal ruler -- 4+ dashes render hr
4629 !! input
4630 ----
4631 !! result
4632 <hr />
4634 !! end
4636 !! test
4637 Horizontal ruler -- eats additional dashes on the same line
4638 !! input
4639 ---------
4640 !! result
4641 <hr />
4643 !! end
4645 !! test
4646 Horizontal ruler -- does not collapse dashes on consecutive lines
4647 !! input
4648 ----
4649 ----
4650 !! result
4651 <hr />
4652 <hr />
4654 !! end
4656 !! test
4657 Horizontal ruler -- <4 dashes render as plain text
4658 !! input
4660 !! result
4661 <p>---
4662 </p>
4663 !! end
4665 !! test
4666 Horizontal ruler -- Supports content following dashes on same line
4667 !! input
4668 ---- Foo
4669 !! result
4670 <hr /> Foo
4672 !! end
4675 ### Block-level elements
4677 !! test
4678 Common list
4679 !! input
4680 *Common list
4681 * item 2
4682 *item 3
4683 !! result
4684 <ul><li>Common list
4685 </li><li> item 2
4686 </li><li>item 3
4687 </li></ul>
4689 !! end
4691 !! test
4692 Numbered list
4693 !! input
4694 #Numbered list
4695 #item 2
4696 # item 3
4697 !! result
4698 <ol><li>Numbered list
4699 </li><li>item 2
4700 </li><li> item 3
4701 </li></ol>
4703 !! end
4705 !! test
4706 Mixed list
4707 !! input
4708 *Mixed list
4709 *# with numbers
4710 ** and bullets
4711 *# and numbers
4712 *bullets again
4713 **bullet level 2
4714 ***bullet level 3
4715 ***#Number on level 4
4716 **bullet level 2
4717 **#Number on level 3
4718 **#Number on level 3
4719 *#number level 2
4720 *Level 1
4721 *** Level 3
4722 #** Level 3, but ordered
4723 !! result
4724 <ul><li>Mixed list
4725 <ol><li> with numbers
4726 </li></ol>
4727 <ul><li> and bullets
4728 </li></ul>
4729 <ol><li> and numbers
4730 </li></ol>
4731 </li><li>bullets again
4732 <ul><li>bullet level 2
4733 <ul><li>bullet level 3
4734 <ol><li>Number on level 4
4735 </li></ol>
4736 </li></ul>
4737 </li><li>bullet level 2
4738 <ol><li>Number on level 3
4739 </li><li>Number on level 3
4740 </li></ol>
4741 </li></ul>
4742 <ol><li>number level 2
4743 </li></ol>
4744 </li><li>Level 1
4745 <ul><li><ul><li> Level 3
4746 </li></ul>
4747 </li></ul>
4748 </li></ul>
4749 <ol><li><ul><li><ul><li> Level 3, but ordered
4750 </li></ul>
4751 </li></ul>
4752 </li></ol>
4754 !! end
4756 !! test
4757 Nested lists 1
4758 !! input
4759 *foo
4760 **bar
4761 !! result
4762 <ul><li>foo
4763 <ul><li>bar
4764 </li></ul>
4765 </li></ul>
4767 !! end
4769 !! test
4770 Nested lists 2
4771 !! input
4772 **foo
4773 *bar
4774 !! result
4775 <ul><li><ul><li>foo
4776 </li></ul>
4777 </li><li>bar
4778 </li></ul>
4780 !! end
4782 !! test
4783 Nested lists 3 (first element empty)
4784 !! input
4786 **bar
4787 !! result
4788 <ul><li>
4789 <ul><li>bar
4790 </li></ul>
4791 </li></ul>
4793 !! end
4795 !! test
4796 Nested lists 4 (first element empty)
4797 !! input
4799 *bar
4800 !! result
4801 <ul><li><ul><li>
4802 </li></ul>
4803 </li><li>bar
4804 </li></ul>
4806 !! end
4808 !! test
4809 Nested lists 5 (both elements empty)
4810 !! input
4813 !! result
4814 <ul><li><ul><li>
4815 </li></ul>
4816 </li><li>
4817 </li></ul>
4819 !! end
4821 !! test
4822 Nested lists 6 (both elements empty)
4823 !! input
4826 !! result
4827 <ul><li>
4828 <ul><li>
4829 </li></ul>
4830 </li></ul>
4832 !! end
4834 !! test
4835 Nested lists 7 (skip initial nesting levels)
4836 !! input
4837 *** foo
4838 !! result
4839 <ul><li><ul><li><ul><li> foo
4840 </li></ul>
4841 </li></ul>
4842 </li></ul>
4844 !! end
4846 !! test
4847 Nested lists 8 (multiple nesting transitions)
4848 !! input
4849 * foo
4850 *** bar
4851 ** baz
4852 * boo
4853 !! result
4854 <ul><li> foo
4855 <ul><li><ul><li> bar
4856 </li></ul>
4857 </li><li> baz
4858 </li></ul>
4859 </li><li> boo
4860 </li></ul>
4862 !! end
4864 !! test
4865 1. Lists with start-of-line-transparent tokens before bullets: Comments
4866 !! input
4867 *foo
4868 *<!--cmt-->bar
4869 <!--cmt-->*baz
4870 !! result
4871 <ul><li>foo
4872 </li><li>bar
4873 </li><li>baz
4874 </li></ul>
4876 !! end
4878 !! test
4879 2. Lists with start-of-line-transparent tokens before bullets: Template close
4880 !! input
4881 *foo {{echo|bar
4882 }}*baz
4883 !! result
4884 <ul><li>foo bar
4885 </li><li>baz
4886 </li></ul>
4888 !! end
4890 !! test
4891 Unbalanced closing block tags break a list
4892 (Parsoid-only since php parser generates broken html -- relies on Tidy to fix up)
4893 !! options
4894 parsoid
4895 !! input
4896 <div>
4897 *a</div><div>
4898 *b</div>
4899 !! result
4900 <div>
4901 <ul><li>a
4902 </li></ul></div><div>
4903 <ul><li>b
4904 </li></ul></div>
4905 !! end
4907 !! test
4908 Unbalanced closing non-block tags don't break a list
4909 (Parsoid-only since php parser generates broken html -- relies on Tidy to fix up)
4910 !! options
4911 parsoid
4912 !! input
4913 <span>
4914 *a</span><span>
4915 *b</span>
4916 !! result
4917 <p><span></span>
4918 </p>
4919 <ul><li>a<span></span>
4920 </li><li>b
4921 </li></ul>
4922 !! end
4924 !! test
4925 Unclosed formatting tags that straddle lists are closed and reopened
4926 (Parsoid-only since php parser generates broken html -- relies on Tidy to fix up)
4927 !! options
4928 parsoid
4929 !! input
4930 # <s> a
4931 # b </s>
4932 !! result
4933 <ol><li> <s> a </s>
4934 </li><li> <s> b </s>
4935 </li></ol>
4936 !! end
4938 !!test
4939 List embedded in a non-block tag
4940 (Ugly Parsoid output -- worth fixing; Disabled for PHP parser since it relies on Tidy)
4941 !! options
4942 parsoid
4943 !!input
4944 <small>
4945 * foo
4946 </small>
4947 !!result
4948 <p><small></small></p>
4949 <small>
4950 <ul>
4951 <li> foo</li>
4952 </ul>
4953 </small>
4954 <p><small></small></p>
4955 !!end
4957 !! test
4958 List items are not parsed correctly following a <pre> block (bug 785)
4959 !! input
4960 * <pre>foo</pre>
4961 * <pre>bar</pre>
4962 * zar
4963 !! result
4964 <ul><li> <pre>foo</pre>
4965 </li><li> <pre>bar</pre>
4966 </li><li> zar
4967 </li></ul>
4969 !! end
4971 !! test
4972 List items from template
4973 !! input
4975 {{inner list}}
4976 * item 2
4978 * item 0
4979 {{inner list}}
4980 * item 2
4982 * item 0
4983 * notSOL{{inner list}}
4984 * item 2
4985 !! result
4986 <ul><li> item 1
4987 </li><li> item 2
4988 </li></ul>
4989 <ul><li> item 0
4990 </li><li> item 1
4991 </li><li> item 2
4992 </li></ul>
4993 <ul><li> item 0
4994 </li><li> notSOL
4995 </li><li> item 1
4996 </li><li> item 2
4997 </li></ul>
4999 !! end
5001 !! test
5002 List interrupted by empty line or heading
5003 !! input
5004 * foo
5006 ** bar
5007 == A heading ==
5008 * Another list item
5009 !! result
5010 <ul><li> foo
5011 </li></ul>
5012 <ul><li><ul><li> bar
5013 </li></ul>
5014 </li></ul>
5015 <h2><span class="mw-headline" id="A_heading">A heading</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: A heading">edit</a>]</span></h2>
5016 <ul><li> Another list item
5017 </li></ul>
5019 !!end
5021 !!test
5022 Multiple list tags generated by templates
5023 !!input
5024 {{echo|<li>}}a
5025 {{echo|<li>}}b
5026 {{echo|<li>}}c
5027 !!result
5028 <li>a
5029 <li>b
5030 <li>c</li>
5031 </li>
5032 </li>
5034 !!end
5036 !!test
5037 Single-comment whitespace lines dont break lists, but multi-comment whitespace lines do
5038 !!input
5040 <!--This line will NOT split the list-->
5042  <!--This line will NOT split the list either-->
5044  <!--foo--> <!--This line with more than 1 comment will split the list-->
5046 !!result
5047 <ul><li>a
5048 </li><li>b
5049 </li><li>c
5050 </li></ul>
5051 <ul><li>d
5052 </li></ul>
5054 !!end
5057 ### Magic Words
5060 !! test
5061 Magic Word: {{CURRENTDAY}}
5062 !! input
5063 {{CURRENTDAY}}
5064 !! result
5065 <p>1
5066 </p>
5067 !! end
5069 !! test
5070 Magic Word: {{CURRENTDAY2}}
5071 !! input
5072 {{CURRENTDAY2}}
5073 !! result
5074 <p>01
5075 </p>
5076 !! end
5078 !! test
5079 Magic Word: {{CURRENTDAYNAME}}
5080 !! input
5081 {{CURRENTDAYNAME}}
5082 !! result
5083 <p>Thursday
5084 </p>
5085 !! end
5087 !! test
5088 Magic Word: {{CURRENTDOW}}
5089 !! input
5090 {{CURRENTDOW}}
5091 !! result
5092 <p>4
5093 </p>
5094 !! end
5096 !! test
5097 Magic Word: {{CURRENTMONTH}}
5098 !! input
5099 {{CURRENTMONTH}}
5100 !! result
5101 <p>01
5102 </p>
5103 !! end
5105 !! test
5106 Magic Word: {{CURRENTMONTHABBREV}}
5107 !! input
5108 {{CURRENTMONTHABBREV}}
5109 !! result
5110 <p>Jan
5111 </p>
5112 !! end
5114 !! test
5115 Magic Word: {{CURRENTMONTHNAME}}
5116 !! input
5117 {{CURRENTMONTHNAME}}
5118 !! result
5119 <p>January
5120 </p>
5121 !! end
5123 !! test
5124 Magic Word: {{CURRENTMONTHNAMEGEN}}
5125 !! input
5126 {{CURRENTMONTHNAMEGEN}}
5127 !! result
5128 <p>January
5129 </p>
5130 !! end
5132 !! test
5133 Magic Word: {{CURRENTTIME}}
5134 !! input
5135 {{CURRENTTIME}}
5136 !! result
5137 <p>00:02
5138 </p>
5139 !! end
5141 !! test
5142 Magic Word: {{CURRENTWEEK}} (@bug 4594)
5143 !! input
5144 {{CURRENTWEEK}}
5145 !! result
5146 <p>1
5147 </p>
5148 !! end
5150 !! test
5151 Magic Word: {{CURRENTYEAR}}
5152 !! input
5153 {{CURRENTYEAR}}
5154 !! result
5155 <p>1970
5156 </p>
5157 !! end
5159 !! test
5160 Magic Word: {{FULLPAGENAME}}
5161 !! options
5162 title=[[User:Ævar Arnfjörð Bjarmason]]
5163 !! input
5164 {{FULLPAGENAME}}
5165 !! result
5166 <p>User:Ævar Arnfjörð Bjarmason
5167 </p>
5168 !! end
5170 !! test
5171 Magic Word: {{FULLPAGENAMEE}}
5172 !! options
5173 title=[[User:Ævar Arnfjörð Bjarmason]]
5174 !! input
5175 {{FULLPAGENAMEE}}
5176 !! result
5177 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
5178 </p>
5179 !! end
5181 !! test
5182 Magic Word: {{NAMESPACE}}
5183 !! options
5184 title=[[User:Ævar Arnfjörð Bjarmason]]
5185 !! input
5186 {{NAMESPACE}}
5187 !! result
5188 <p>User
5189 </p>
5190 !! end
5192 !! test
5193 Magic Word: {{NAMESPACEE}}
5194 !! options
5195 title=[[User:Ævar Arnfjörð Bjarmason]]
5196 !! input
5197 {{NAMESPACEE}}
5198 !! result
5199 <p>User
5200 </p>
5201 !! end
5203 !! test
5204 Magic Word: {{NAMESPACENUMBER}}
5205 !! options
5206 title=[[User:Ævar Arnfjörð Bjarmason]]
5207 !! input
5208 {{NAMESPACENUMBER}}
5209 !! result
5210 <p>2
5211 </p>
5212 !! end
5214 !! test
5215 Magic Word: {{NUMBEROFFILES}}
5216 !! input
5217 {{NUMBEROFFILES}}
5218 !! result
5219 <p>3
5220 </p>
5221 !! end
5223 !! test
5224 Magic Word: {{PAGENAME}}
5225 !! options
5226 title=[[User:Ævar Arnfjörð Bjarmason]]
5227 !! input
5228 {{PAGENAME}}
5229 !! result
5230 <p>Ævar Arnfjörð Bjarmason
5231 </p>
5232 !! end
5234 !! test
5235 Magic Word: {{PAGENAME}} with metacharacters
5236 !! options
5237 title=[['foo & bar = baz']]
5238 !! input
5239 ''{{PAGENAME}}''
5240 !! result
5241 <p><i>&#39;foo &#38; bar &#61; baz&#39;</i>
5242 </p>
5243 !! end
5245 !! test
5246 Magic Word: {{PAGENAME}} with metacharacters (bug 26781)
5247 !! options
5248 title=[[*RFC 1234 http://example.com/]]
5249 !! input
5250 {{PAGENAME}}
5251 !! result
5252 <p>&#42;RFC&#32;1234 http&#58;//example.com/
5253 </p>
5254 !! end
5256 !! test
5257 Magic Word: {{PAGENAMEE}}
5258 !! options
5259 title=[[User:Ævar Arnfjörð Bjarmason]]
5260 !! input
5261 {{PAGENAMEE}}
5262 !! result
5263 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
5264 </p>
5265 !! end
5267 !! test
5268 Magic Word: {{PAGENAMEE}} with metacharacters (bug 26781)
5269 !! options
5270 title=[[*RFC 1234 http://example.com/]]
5271 !! input
5272 {{PAGENAMEE}}
5273 !! result
5274 <p>&#42;RFC_1234_http&#58;//example.com/
5275 </p>
5276 !! end
5278 !! test
5279 Magic Word: {{REVISIONID}}
5280 !! input
5281 {{REVISIONID}}
5282 !! result
5283 <p>1337
5284 </p>
5285 !! end
5287 !! test
5288 Magic Word: {{SCRIPTPATH}}
5289 !! input
5290 {{SCRIPTPATH}}
5291 !! result
5292 <p>/
5293 </p>
5294 !! end
5296 !! test
5297 Magic Word: {{SERVER}}
5298 !! input
5299 {{SERVER}}
5300 !! result
5301 <p><a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
5302 </p>
5303 !! end
5305 !! test
5306 Magic Word: {{SERVERNAME}}
5307 !! input
5308 {{SERVERNAME}}
5309 !! result
5310 <p>example.org
5311 </p>
5312 !! end
5314 !! test
5315 Magic Word: {{SITENAME}}
5316 !! input
5317 {{SITENAME}}
5318 !! result
5319 <p>MediaWiki
5320 </p>
5321 !! end
5323 !! test
5324 Case-sensitive magic words, when cased differently, should just be template transclusions
5325 !! input
5326 {{CurrentMonth}}
5327 {{currentday}}
5328 {{cURreNTweEK}}
5329 {{currentHour}}
5330 !! result
5331 <p><a href="/index.php?title=Template:CurrentMonth&amp;action=edit&amp;redlink=1" class="new" title="Template:CurrentMonth (page does not exist)">Template:CurrentMonth</a>
5332 <a href="/index.php?title=Template:Currentday&amp;action=edit&amp;redlink=1" class="new" title="Template:Currentday (page does not exist)">Template:Currentday</a>
5333 <a href="/index.php?title=Template:CURreNTweEK&amp;action=edit&amp;redlink=1" class="new" title="Template:CURreNTweEK (page does not exist)">Template:CURreNTweEK</a>
5334 <a href="/index.php?title=Template:CurrentHour&amp;action=edit&amp;redlink=1" class="new" title="Template:CurrentHour (page does not exist)">Template:CurrentHour</a>
5335 </p>
5336 !! end
5338 !! test
5339 Case-insensitive magic words should still work with weird casing.
5340 !! input
5341 {{sErVeRNaMe}}
5342 {{LCFirst:AOEU}}
5343 {{ucFIRST:aoeu}}
5344 {{SERver}}
5345 !! result
5346 <p>example.org
5347 aOEU
5348 Aoeu
5349 <a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
5350 </p>
5351 !! end
5353 !! test
5354 Namespace 1 {{ns:1}}
5355 !! input
5356 {{ns:1}}
5357 !! result
5358 <p>Talk
5359 </p>
5360 !! end
5362 !! test
5363 Namespace 1 {{ns:01}}
5364 !! input
5365 {{ns:01}}
5366 !! result
5367 <p>Talk
5368 </p>
5369 !! end
5371 !! test
5372 Namespace 0 {{ns:0}} (bug 4783)
5373 !! input
5374 {{ns:0}}
5375 !! result
5377 !! end
5379 !! test
5380 Namespace 0 {{ns:00}} (bug 4783)
5381 !! input
5382 {{ns:00}}
5383 !! result
5385 !! end
5387 !! test
5388 Namespace -1 {{ns:-1}}
5389 !! input
5390 {{ns:-1}}
5391 !! result
5392 <p>Special
5393 </p>
5394 !! end
5396 !! test
5397 Namespace User {{ns:User}}
5398 !! input
5399 {{ns:User}}
5400 !! result
5401 <p>User
5402 </p>
5403 !! end
5405 !! test
5406 Namespace User talk {{ns:User_talk}}
5407 !! input
5408 {{ns:User_talk}}
5409 !! result
5410 <p>User talk
5411 </p>
5412 !! end
5414 !! test
5415 Namespace User talk {{ns:uSeR tAlK}}
5416 !! input
5417 {{ns:uSeR tAlK}}
5418 !! result
5419 <p>User talk
5420 </p>
5421 !! end
5423 !! test
5424 Namespace File {{ns:File}}
5425 !! input
5426 {{ns:File}}
5427 !! result
5428 <p>File
5429 </p>
5430 !! end
5432 !! test
5433 Namespace File {{ns:Image}}
5434 !! input
5435 {{ns:Image}}
5436 !! result
5437 <p>File
5438 </p>
5439 !! end
5441 !! test
5442 Namespace (lang=de) Benutzer {{ns:User}}
5443 !! options
5444 language=de
5445 !! input
5446 {{ns:User}}
5447 !! result
5448 <p>Benutzer
5449 </p>
5450 !! end
5452 !! test
5453 Namespace (lang=de) Benutzer Diskussion {{ns:3}}
5454 !! options
5455 language=de
5456 !! input
5457 {{ns:3}}
5458 !! result
5459 <p>Benutzer Diskussion
5460 </p>
5461 !! end
5464 !! test
5465 Urlencode
5466 !! input
5467 {{urlencode:hi world?!}}
5468 {{urlencode:hi world?!|WIKI}}
5469 {{urlencode:hi world?!|PATH}}
5470 {{urlencode:hi world?!|QUERY}}
5471 !! result
5472 <p>hi+world%3F%21
5473 hi_world%3F!
5474 hi%20world%3F%21
5475 hi+world%3F%21
5476 </p>
5477 !! end
5480 ### Magic links
5482 !! test
5483 Magic links: internal link to RFC (bug 479)
5484 !! input
5485 [[RFC 123]]
5486 !! result
5487 <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>
5488 </p>
5489 !! end
5491 !! test
5492 Magic links: RFC (bug 479)
5493 !! input
5494 RFC 822
5495 !! result
5496 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc822">RFC 822</a>
5497 </p>
5498 !! end
5500 !! test
5501 Magic links: ISBN (bug 1937)
5502 !! input
5503 ISBN 0-306-40615-2
5504 !! result
5505 <p><a href="/wiki/Special:BookSources/0306406152" class="internal mw-magiclink-isbn">ISBN 0-306-40615-2</a>
5506 </p>
5507 !! end
5509 !! test
5510 Magic links: PMID incorrectly converts space to underscore
5511 !! input
5512 PMID 1234
5513 !! result
5514 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a>
5515 </p>
5516 !! end
5519 ### Templates
5520 ####
5522 !! test
5523 Nonexistent template
5524 !! input
5525 {{thistemplatedoesnotexist}}
5526 !! result
5527 <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>
5528 </p>
5529 !! end
5531 !! test
5532 Template with invalid target containing tags
5533 !! input
5534 {{a<b>b</b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
5535 !! result
5536 <p>{{a<b>b</b>|foo|a=b|a = b}}
5537 </p>
5538 !! end
5540 !! test
5541 Template with invalid target containing unclosed tag
5542 !! input
5543 {{a<b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
5544 !! result
5545 <p>{{a<b>|foo|a=b|a = b}}</b>
5546 </p>
5547 !! end
5549 !! article
5550 Template:test
5551 !! text
5552 This is a test template
5553 !! endarticle
5555 !! test
5556 Simple template
5557 !! input
5558 {{test}}
5559 !! result
5560 <p>This is a test template
5561 </p>
5562 !! end
5564 !! test
5565 Template with explicit namespace
5566 !! input
5567 {{Template:test}}
5568 !! result
5569 <p>This is a test template
5570 </p>
5571 !! end
5574 !! article
5575 Template:paramtest
5576 !! text
5577 This is a test template with parameter {{{param}}}
5578 !! endarticle
5580 !! test
5581 Template parameter
5582 !! input
5583 {{paramtest|param=foo}}
5584 !! result
5585 <p>This is a test template with parameter foo
5586 </p>
5587 !! end
5589 !! article
5590 Template:paramtestnum
5591 !! text
5592 [[{{{1}}}|{{{2}}}]]
5593 !! endarticle
5595 !! test
5596 Template unnamed parameter
5597 !! input
5598 {{paramtestnum|Main Page|the main page}}
5599 !! result
5600 <p><a href="/wiki/Main_Page" title="Main Page">the main page</a>
5601 </p>
5602 !! end
5604 !! article
5605 Template:templatesimple
5606 !! text
5607 (test)
5608 !! endarticle
5610 !! article
5611 Template:templateredirect
5612 !! text
5613 #redirect [[Template:templatesimple]]
5614 !! endarticle
5616 !! article
5617 Template:templateasargtestnum
5618 !! text
5619 {{{{{1}}}}}
5620 !! endarticle
5622 !! article
5623 Template:templateasargtest
5624 !! text
5625 {{template{{{templ}}}}}
5626 !! endarticle
5628 !! article
5629 Template:templateasargtest2
5630 !! text
5631 {{{{{templ}}}}}
5632 !! endarticle
5634 !! test
5635 Template with template name as unnamed argument
5636 !! input
5637 {{templateasargtestnum|templatesimple}}
5638 !! result
5639 <p>(test)
5640 </p>
5641 !! end
5643 !! test
5644 Template with template name as argument
5645 !! input
5646 {{templateasargtest|templ=simple}}
5647 !! result
5648 <p>(test)
5649 </p>
5650 !! end
5652 !! test
5653 Template with template name as argument (2)
5654 !! input
5655 {{templateasargtest2|templ=templatesimple}}
5656 !! result
5657 <p>(test)
5658 </p>
5659 !! end
5661 !! article
5662 Template:templateasargtestdefault
5663 !! text
5664 {{{{{templ|templatesimple}}}}}
5665 !! endarticle
5667 !! article
5668 Template:templa
5669 !! text
5670 '''templ'''
5671 !! endarticle
5673 !! test
5674 Template with default value
5675 !! input
5676 {{templateasargtestdefault}}
5677 !! result
5678 <p>(test)
5679 </p>
5680 !! end
5682 !! test
5683 Template with default value (value set)
5684 !! input
5685 {{templateasargtestdefault|templ=templa}}
5686 !! result
5687 <p><b>templ</b>
5688 </p>
5689 !! end
5691 !! test
5692 Template redirect
5693 !! input
5694 {{templateredirect}}
5695 !! result
5696 <p>(test)
5697 </p>
5698 !! end
5700 !! test
5701 Template with argument in separate line
5702 !! input
5703 {{ templateasargtest  |
5704  templ = simple }}
5705 !! result
5706 <p>(test)
5707 </p>
5708 !! end
5710 !! test
5711 Template with complex template as argument
5712 !! input
5713 {{paramtest|
5714   param ={{ templateasargtest  |
5715  templ = simple }}}}
5716 !! result
5717 <p>This is a test template with parameter (test)
5718 </p>
5719 !! end
5721 !! test
5722 Template with thumb image (with link in description)
5723 !! input
5724 {{paramtest|
5725   param =[[Image:noimage.png|thumb|[[no link|link]] [[no link|caption]]]]}}
5726 !! result
5727 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>
5729 !! end
5731 !! article
5732 Template:complextemplate
5733 !! text
5734 {{{1}}} {{paramtest|
5735   param ={{{param}}}}}
5736 !! endarticle
5738 !! test
5739 Template with complex arguments
5740 !! input
5741 {{complextemplate|
5742   param ={{ templateasargtest  |
5743  templ = simple }}|[[Template:complextemplate|link]]}}
5744 !! result
5745 <p><a href="/wiki/Template:Complextemplate" title="Template:Complextemplate">link</a> This is a test template with parameter (test)
5746 </p>
5747 !! end
5749 !! test
5750 BUG 553: link with two variables in a piped link
5751 !! input
5753 |[[{{{1}}}|{{{2}}}]]
5755 !! result
5756 <table>
5757 <tr>
5758 <td>[[{{{1}}}|{{{2}}}]]
5759 </td></tr></table>
5761 !! end
5763 !! test
5764 Magic variable as template parameter
5765 !! input
5766 {{paramtest|param={{SITENAME}}}}
5767 !! result
5768 <p>This is a test template with parameter MediaWiki
5769 </p>
5770 !! end
5772 !! article
5773 Template:linktest
5774 !! text
5775 [[{{{param}}}|link]]
5776 !! endarticle
5778 !! test
5779 Template parameter as link source
5780 !! input
5781 {{linktest|param=Main Page}}
5782 !! result
5783 <p><a href="/wiki/Main_Page" title="Main Page">link</a>
5784 </p>
5785 !! end
5787 !!test
5788 Template-generated attribute string (k='v')
5789 !!input
5790 <span {{attr_str|id|v1}}>bar</span>
5791 !!result
5792 <p><span id="v1">bar</span>
5793 </p>
5794 !!end
5796 !!article
5797 Template:paramtest2
5798 !! text
5799 including another template, {{paramtest|param={{{arg}}}}}
5800 !! endarticle
5802 !! test
5803 Template passing argument to another template
5804 !! input
5805 {{paramtest2|arg='hmm'}}
5806 !! result
5807 <p>including another template, This is a test template with parameter 'hmm'
5808 </p>
5809 !! end
5811 !! article
5812 Template:Linktest2
5813 !! text
5814 Main Page
5815 !! endarticle
5817 !! test
5818 Template as link source
5819 !! input
5820 [[{{linktest2}}]]
5822 [[{{linktest2}}|Main Page]]
5824 [[{{linktest2}}]]Page
5825 !! result
5826 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
5827 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
5828 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>Page
5829 </p>
5830 !! end
5833 !! article
5834 Template:loop1
5835 !! text
5836 {{loop2}}
5837 !! endarticle
5839 !! article
5840 Template:loop2
5841 !! text
5842 {{loop1}}
5843 !! endarticle
5845 !! test
5846 Template infinite loop
5847 !! input
5848 {{loop1}}
5849 !! result
5850 <p><span class="error">Template loop detected: <a href="/wiki/Template:Loop1" title="Template:Loop1">Template:Loop1</a></span>
5851 </p>
5852 !! end
5854 !! test
5855 Template from main namespace
5856 !! input
5857 {{:Main Page}}
5858 !! result
5859 <p>blah blah
5860 </p>
5861 !! end
5863 !! article
5864 Template:table
5865 !! text
5867 | 1 || 2
5869 | 3 || 4
5871 !! endarticle
5873 !! test
5874 BUG 529: Template with table, not included at beginning of line
5875 !! input
5876 foo {{table}}
5877 !! result
5878 <p>foo 
5879 </p>
5880 <table>
5881 <tr>
5882 <td> 1 </td>
5883 <td> 2
5884 </td></tr>
5885 <tr>
5886 <td> 3 </td>
5887 <td> 4
5888 </td></tr></table>
5890 !! end
5892 !! test
5893 BUG 523: Template shouldn't eat newline (or add an extra one before table)
5894 !! input
5896 {{table}}
5897 !! result
5898 <p>foo
5899 </p>
5900 <table>
5901 <tr>
5902 <td> 1 </td>
5903 <td> 2
5904 </td></tr>
5905 <tr>
5906 <td> 3 </td>
5907 <td> 4
5908 </td></tr></table>
5910 !! end
5912 !! test
5913 BUG 41: Template parameters shown as broken links
5914 !! input
5915 {{{parameter}}}
5916 !! result
5917 <p>{{{parameter}}}
5918 </p>
5919 !! end
5921 !! test
5922 Template with targets containing wikilinks
5923 !! input
5924 {{[[foo]]}}
5926 {{[[{{echo|foo}}]]}}
5928 {{{{echo|[[foo}}]]}}
5929 !! result
5930 <p>{{<a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">foo</a>}}
5931 </p><p>{{<a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">foo</a>}}
5932 </p><p>{{[[foo}}]]
5933 </p>
5934 !! end
5936 !! article
5937 Template:MSGNW test
5938 !! text
5939 ''None'' of '''this''' should be 
5940 * interpreted
5941  but rather passed unmodified
5942 {{test}}
5943 !! endarticle
5945 # hmm, fix this or just deprecate msgnw and document its behavior?
5946 !! test
5947 msgnw keyword
5948 !! options
5949 disabled
5950 !! input
5951 {{msgnw:MSGNW test}}
5952 !! result
5953 <p>''None'' of '''this''' should be 
5954 * interpreted
5955  but rather passed unmodified
5956 {{test}}
5957 </p>
5958 !! end
5960 !! test
5961 int keyword
5962 !! input
5963 {{int:youhavenewmessages|lots of money|not!}}
5964 !! result
5965 <p>You have lots of money (not!).
5966 </p>
5967 !! end
5969 !! article
5970 Template:Includes
5971 !! text
5972 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
5973 !! endarticle
5975 !! test
5976 <includeonly> and <noinclude> being included
5977 !! input
5978 {{Includes}}
5979 !! result
5980 <p>Foobar
5981 </p>
5982 !! end
5984 !! article
5985 Template:Includes2
5986 !! text
5987 <onlyinclude>Foo</onlyinclude>bar
5988 !! endarticle
5990 !! test
5991 <onlyinclude> being included
5992 !! input
5993 {{Includes2}}
5994 !! result
5995 <p>Foo
5996 </p>
5997 !! end
6000 !! article
6001 Template:Includes3
6002 !! text
6003 <onlyinclude>Foo</onlyinclude>bar<includeonly>zar</includeonly>
6004 !! endarticle
6006 !! test
6007 <onlyinclude> and <includeonly> being included
6008 !! input
6009 {{Includes3}}
6010 !! result
6011 <p>Foo
6012 </p>
6013 !! end
6015 !! test
6016 <includeonly> and <noinclude> on a page
6017 !! input
6018 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
6019 !! result
6020 <p>Foozar
6021 </p>
6022 !! end
6024 !! test
6025 Un-closed <noinclude>
6026 !! input
6027 <noinclude>
6028 !! result
6029 !! end
6031 !! test
6032 <onlyinclude> on a page
6033 !! input
6034 <onlyinclude>Foo</onlyinclude>bar
6035 !! result
6036 <p>Foobar
6037 </p>
6038 !! end
6040 !! test
6041 Un-closed <onlyinclude>
6042 !! input
6043 <onlyinclude>
6044 !! result
6045 !! end
6047 !!test
6048 Self-closed noinclude, includeonly, onlyinclude tags
6049 !!input
6050 <noinclude />
6051 <includeonly />
6052 <onlyinclude />
6053 !!result
6054 <p><br />
6055 </p>
6056 !!end
6058 !!test
6059 Unbalanced includeonly and noinclude tags
6060 !!input
6062 |a</noinclude>
6063 |b</noinclude></noinclude>
6064 |c</noinclude></includeonly>
6065 |d</includeonly></includeonly>
6067 !!result
6068 <table>
6069 <tr>
6070 <td>a
6071 </td>
6072 <td>b
6073 </td>
6074 <td>c&lt;/includeonly&gt;
6075 </td>
6076 <td>d&lt;/includeonly&gt;&lt;/includeonly&gt;
6077 </td></tr></table>
6079 !!end
6081 !! article
6082 Template:Includeonly section
6083 !! text
6084 <includeonly>
6085 ==Includeonly section==
6086 </includeonly>
6087 ==Section T-1==
6088 !!endarticle
6090 !! test
6091 Bug 6563: Edit link generation for section shown by <includeonly>
6092 !! input
6093 {{includeonly section}}
6094 !! result
6095 <h2><span class="mw-headline" id="Includeonly_section">Includeonly section</span><span class="mw-editsection">[<a href="/index.php?title=Template:Includeonly_section&amp;action=edit&amp;section=T-1" title="Template:Includeonly section">edit</a>]</span></h2>
6096 <h2><span class="mw-headline" id="Section_T-1">Section T-1</span><span class="mw-editsection">[<a href="/index.php?title=Template:Includeonly_section&amp;action=edit&amp;section=T-2" title="Template:Includeonly section">edit</a>]</span></h2>
6098 !! end
6100 # Uses same input as the contents of [[Template:Includeonly section]]
6101 !! test
6102 Bug 6563: Section extraction for section shown by <includeonly>
6103 !! options
6104 section=T-2
6105 !! input
6106 <includeonly>
6107 ==Includeonly section==
6108 </includeonly>
6109 ==Section T-2==
6110 !! result
6111 ==Section T-2==
6112 !! end
6114 !! test
6115 Bug 6563: Edit link generation for section suppressed by <includeonly>
6116 !! input
6117 <includeonly>
6118 ==Includeonly section==
6119 </includeonly>
6120 ==Section 1==
6121 !! result
6122 <h2><span class="mw-headline" id="Section_1">Section 1</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: Section 1">edit</a>]</span></h2>
6124 !! end
6126 !! test
6127 Bug 6563: Section extraction for section suppressed by <includeonly>
6128 !! options
6129 section=1
6130 !! input
6131 <includeonly>
6132 ==Includeonly section==
6133 </includeonly>
6134 ==Section 1==
6135 !! result
6136 ==Section 1==
6137 !! end
6139 !! test
6140 Un-closed <includeonly>
6141 !! input
6142 <includeonly>
6143 !! result
6144 !! end
6147 ### <includeonly> and <noinclude> in attributes
6149 !!test
6150 0. includeonly around the entire attribute
6151 !!input
6152 <span <includeonly>id="v1"</includeonly><noinclude>id="v2"</noinclude>>bar</span>
6153 !!result
6154 <p><span id="v2">bar</span>
6155 </p>
6156 !!end
6158 !!test
6159 1. includeonly in html attr key
6160 !!input
6161 <span <noinclude>id</noinclude><includeonly>about</includeonly>="foo">bar</span>
6162 !!result
6163 <p><span id="foo">bar</span>
6164 </p>
6165 !!end
6167 !!test
6168 2. includeonly in html attr value
6169 !!input
6170 <span id="<noinclude>v1</noinclude><includeonly>v2</includeonly>">bar</span>
6171 <span id=<noinclude>"v1"</noinclude><includeonly>"v2"</includeonly>>bar</span>
6172 !!result
6173 <p><span id="v1">bar</span>
6174 <span id="v1">bar</span>
6175 </p>
6176 !!end
6178 !!test
6179 3. includeonly in part of an attr value
6180 !!input
6181 <span style="color:<noinclude>red</noinclude><includeonly>blue</includeonly>;">bar</span>
6182 !!result
6183 <p><span style="color:red;">bar</span>
6184 </p>
6185 !!end
6188 ### Testing parsing of templates where a template arg
6189 ### has the same name as the template itself.
6192 !! article
6193 Template:quote
6194 !! text
6195 {{{quote|{{{1}}}}}}
6196 !! endarticle
6198 !!test
6199 Templates: Template Name/Arg clash: 1. Use of positional param
6200 !!input
6201 {{quote|foo}}
6202 !!result
6203 <p>foo
6204 </p>
6205 !!end
6207 !!test
6208 Templates: Template Name/Arg clash: 2. Use of named param
6209 !!input
6210 {{quote|quote=foo}}
6211 !!result
6212 <p>foo
6213 </p>
6214 !!end
6216 !!test
6217 Templates: Template Name/Arg clash: 3. Use of named param with empty input
6218 !!input
6219 {{quote|quote}}
6220 !!result
6221 <p>quote
6222 </p>
6223 !!end
6226 ### Parsoid-centric tests to stress Parsoid's ability to RT them unchanged
6229 !!test
6230 Templates: 1. Simple use
6231 !!input
6232 {{echo|Foo}}
6233 !!result
6234 <p>Foo
6235 </p>
6236 !!end
6238 !!test
6239 Templates: 2. Inside a block tag
6240 !!input
6241 <div>{{echo|Foo}}</div>
6242 !!result
6243 <div>Foo</div>
6245 !!end
6247 !!test
6248 Templates: P-wrapping: 1a. Templates on consecutive lines
6249 !!input
6250 {{echo|Foo}}
6251 {{echo|bar}}
6252 !!result
6253 <p>Foo
6255 </p>
6256 !!end
6258 !!test
6259 Templates: P-wrapping: 1b. Templates on consecutive lines
6260 !!input
6263 {{echo|bar}}
6264 {{echo|baz}}
6265 !!result
6266 <p>Foo
6267 </p><p>bar
6269 </p>
6270 !!end
6272 !!test
6273 Templates: P-wrapping: 1c. Templates on consecutive lines
6274 !!input
6275 {{echo|Foo}}
6276 {{echo|bar}} <div>baz</div>
6277 !!result
6278 <p>Foo
6279 </p>
6280 bar <div>baz</div>
6282 !!end
6284 !!test
6285 Templates: P-wrapping: 1d. Template preceded by comment-only line
6286 !!options
6287 parsoid=wt2html,wt2wt
6288 !!input
6289 <!-- foo -->
6290 {{echo|Bar}}
6291 !!result
6292 <!-- foo -->
6293 <p typeof="mw:Object/Template">Bar
6294 </p>
6295 !!end
6297 !!test
6298 Templates: Inline Text: 1. Multiple tmeplate uses
6299 !!input
6300 {{echo|Foo}}bar{{echo|baz}}
6301 !!result
6302 <p>Foobarbaz
6303 </p>
6304 !!end
6306 !!test
6307 Templates: Inline Text: 2. Back-to-back template uses
6308 !!input
6309 {{echo|Foo}}{{echo|bar}}
6310 !!result
6311 <p>Foobar
6312 </p>
6313 !!end
6315 !!test
6316 Templates: Block Tags: 1. Multiple template uses
6317 !!input
6318 {{echo|<div>Foo</div>}}<div>bar</div>{{echo|<div>baz</div>}}
6319 !!result
6320 <div>Foo</div><div>bar</div><div>baz</div>
6322 !!end
6324 !!test
6325 Templates: Block Tags: 2. Back-to-back template uses
6326 !!input
6327 {{echo|<div>Foo</div>}}{{echo|<div>bar</div>}}
6328 !!result
6329 <div>Foo</div><div>bar</div>
6331 !!end
6333 !!test
6334 Templates: Links: 1. Simple example
6335 !!input
6336 {{echo|[[Foo|bar]]}}
6337 !!result
6338 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
6339 </p>
6340 !!end
6342 !!test
6343 Templates: Links: 2. Generation of link href
6344 !!input
6345 [[{{echo|Foo}}|bar]]
6346 !!result
6347 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
6348 </p>
6349 !!end
6351 !!test
6352 Templates: Links: 3. Generation of part of a link href
6353 !!input
6354 [[Fo{{echo|o}}|bar]]
6356 [[Foo{{echo|bar}}]]
6358 [[Foo{{echo|bar}}baz]]
6360 [[Foo{{echo|bar}}|bar]]
6362 [[:Foo{{echo|bar}}]]
6364 [[:Foo{{echo|bar}}|bar]]
6365 !!result
6366 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
6367 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
6368 </p><p><a href="/index.php?title=Foobarbaz&amp;action=edit&amp;redlink=1" class="new" title="Foobarbaz (page does not exist)">Foobarbaz</a>
6369 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
6370 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
6371 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
6372 </p>
6373 !!end
6375 !!test
6376 Templates: Links: 4. Multiple templates generating link href
6377 !!input
6378 [[{{echo|F}}{{echo|o}}ob{{echo|ar}}]]
6379 !!result
6380 <p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
6381 </p>
6382 !!end
6384 !!test
6385 Templates: Links: 5. Generation of link text
6386 !!input
6387 [[Foo|{{echo|bar}}]]
6388 !!result
6389 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
6390 </p>
6391 !!end
6393 !!test
6394 Templates: Links: 5. Nested templates (only outermost template should be marked)
6395 !!input
6396 {{echo|[[{{echo|Foo}}|bar]]}}
6397 !!result
6398 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
6399 </p>
6400 !!end
6402 !!test
6403 Templates: HTML Tag: 1. Generation of HTML attr. key
6404 !!input
6405 <div {{echo|style}}="color:red;">foo</div>
6406 !!result
6407 <div style="color:red;">foo</div>
6409 !!end
6411 !!test
6412 Templates: HTML Tag: 2. Generation of HTML attr. value
6413 !!input
6414 <div style={{echo|'color:red;'}}>foo</div>
6415 !!result
6416 <div style="color:red;">foo</div>
6418 !!end
6420 !!test
6421 Templates: HTML Tag: 3. Generation of HTML attr key and value
6422 !!input
6423 <div {{echo|style}}={{echo|'color:red;'}}>foo</div>
6424 !!result
6425 <div style="color:red;">foo</div>
6427 !!end
6429 !!test
6430 Templates: HTML Tag: 4. Generation of starting piece of HTML attr value
6431 !!input
6432 <div title="{{echo|This is a long title}} with just one piece templated">foo</div>
6433 !!result
6434 <div title="This is a long title with just one piece templated">foo</div>
6436 !!end
6438 !!test
6439 Templates: HTML Tag: 5. Generation of middle piece of HTML attr value
6440 !!input
6441 <div title="This is a long title with just {{echo|one piece}} templated">foo</div>
6442 !!result
6443 <div title="This is a long title with just one piece templated">foo</div>
6445 !!end
6447 !!test
6448 Templates: HTML Tag: 6. Generation of end piece of HTML attr value
6449 !!input
6450 <div title="This is a long title with just one piece {{echo|templated}}">foo</div>
6451 !!result
6452 <div title="This is a long title with just one piece templated">foo</div>
6454 !!end
6456 !!test
6457 Templates: HTML Tag: 7. Generation of partial attribute key string
6458 !!input
6459 <div st{{echo|yle}}="color:red;">foo</div>
6460 !!result
6461 <div style="color:red;">foo</div>
6463 !!end
6465 !!test
6466 Templates: HTML Tables: 1. Generating start of a HTML table
6467 !!input
6468 {{echo|<table><tr><td>foo</td>}}</tr></table>
6469 !!result
6470 <table><tr><td>foo</td></tr></table>
6472 !!end
6474 !!test
6475 Templates: HTML Tables: 2a. Generating middle of a HTML table
6476 !!input
6477 <table><tr>{{echo|<td>foo</td>}}</tr></table>
6478 !!result
6479 <table><tr><td>foo</td></tr></table>
6481 !!end
6483 !!test
6484 Templates: HTML Tables: 2b. Generating middle of a HTML table
6485 !!input
6486 <table>{{echo|<tr><td>foo</td></tr>}}</table>
6487 !!result
6488 <table><tr><td>foo</td></tr></table>
6490 !!end
6492 !!test
6493 Templates: HTML Tables: 3. Generating end of a HTML table
6494 !!input
6495 <table><tr>{{echo|<td>foo</td></tr></table>}}
6496 !!result
6497 <table><tr><td>foo</td></tr></table>
6499 !!end
6501 !!test
6502 Templates: HTML Tables: 4a. Generating a single tag of a HTML table
6503 !!input
6504 {{echo|<table>}}<tr><td>foo</td></tr></table>
6505 !!result
6506 <table><tr><td>foo</td></tr></table>
6508 !!end
6510 !!test
6511 Templates: HTML Tables: 4b. Generating a single tag of a HTML table
6512 !!input
6513 <table>{{echo|<tr>}}<td>foo</td></tr></table>
6514 !!result
6515 <table><tr><td>foo</td></tr></table>
6517 !!end
6519 !!test
6520 Templates: HTML Tables: 4c. Generating a single tag of a HTML table
6521 !!input
6522 <table><tr>{{echo|<td>}}foo</td></tr></table>
6523 !!result
6524 <table><tr><td>foo</td></tr></table>
6526 !!end
6528 !!test
6529 Templates: HTML Tables: 4d. Generating a single tag of a HTML table
6530 !!input
6531 <table><tr><td>foo{{echo|</td>}}</tr></table>
6532 !!result
6533 <table><tr><td>foo</td></tr></table>
6535 !!end
6537 !!test
6538 Templates: HTML Tables: 4e. Generating a single tag of a HTML table
6539 !!input
6540 <table><tr><td>foo</td>{{echo|</tr>}}</table>
6541 !!result
6542 <table><tr><td>foo</td></tr></table>
6544 !!end
6546 !!test
6547 Templates: HTML Tables: 4f. Generating a single tag of a HTML table
6548 !!input
6549 <table><tr><td>foo</td></tr>{{echo|</table>}}
6550 !!result
6551 <table><tr><td>foo</td></tr></table>
6553 !!end
6555 !!test
6556 Templates: Wiki Tables: 1a. Fostering of entire template content
6557 !!input
6559 {{echo|a}}
6561 !!result
6562 <table>
6564 <tr><td></td></tr></table>
6566 !!end
6568 !!test
6569 Templates: Wiki Tables: 1b. Fostering of entire template content
6570 !!input
6572 {{echo|<div>}}
6574 {{echo|</div>}}
6576 !!result
6577 <table>
6578 <div>
6579 <p>foo
6580 </p>
6581 </div>
6582 <tr><td></td></tr></table>
6584 !!end
6586 !!test
6587 Templates: Wiki Tables: 2. Fostering of partial template content
6588 !!input
6590 {{echo|a
6591 <div>b</div>}}
6593 !!result
6594 <table>
6596 <div>b</div>
6597 <tr><td></td></tr></table>
6599 !!end
6601 !!test
6602 Templates: Wiki Tables: 3. td-content via multiple templates
6603 !!input
6605 {{echo|{{pipe}}a}}{{echo|b}}
6607 !!result
6608 <table>
6609 <tr>
6610 <td>ab
6611 </td></tr></table>
6613 !!end
6615 !!test
6616 Templates: Wiki Tables: 4. Templated tags, no content
6617 !!input
6618 {{tbl-start}}
6619 {{tbl-end}}
6620 !!result
6621 <table>
6622 <tr><td></td></tr></table>
6624 !!end
6626 !!test
6627 Templates: Wiki Tables: 5. Templated tags, regular td-tags
6628 !!input
6629 {{tbl-start}}
6630 |foo
6631 {{tbl-end}}
6632 !!result
6633 <table>
6634 <tr>
6635 <td>foo
6636 </td></tr></table>
6638 !!end
6640 !!test
6641 Templates: Wiki Tables: 6. Templated tags, templated td-tags
6642 !!input
6643 {{tbl-start}}
6644 {{!}}foo
6645 {{tbl-end}}
6646 !!result
6647 <table>
6648 <tr>
6649 <td>foo
6650 </td></tr></table>
6652 !!end
6654 !!test
6655 Templates: Lists: Multi-line list-items via templates
6656 !!input
6657 *{{echo|a {{nonexistent|
6658 unused}}}}
6659 *{{echo|b {{nonexistent|
6660 unused}}}}
6661 !!result
6662 <ul><li>a <a href="/index.php?title=Template:Nonexistent&amp;action=edit&amp;redlink=1" class="new" title="Template:Nonexistent (page does not exist)">Template:Nonexistent</a>
6663 </li><li>b <a href="/index.php?title=Template:Nonexistent&amp;action=edit&amp;redlink=1" class="new" title="Template:Nonexistent (page does not exist)">Template:Nonexistent</a>
6664 </li></ul>
6666 !!end
6668 !!test
6669 Templates: Ugly nesting: 1. Quotes opened/closed across templates (echo)
6670 !!input
6671 {{echo|''a}}{{echo|b''c''d}}{{echo|''e}}
6672 !!result
6673 <p><i>ab</i>c<i>d</i>e
6674 </p>
6675 !!end
6677 !!test
6678 Templates: Ugly nesting: 2. Quotes opened/closed across templates (echo_with_span)
6679 (PHP parser generates misnested html)
6680 !! options
6681 parsoid=wt2html,wt2wt
6682 !!input
6683 {{echo_with_span|''a}}{{echo_with_span|b''c''d}}{{echo_with_span|''e}}
6684 !!result
6685 <p><span typeof="mw:Object/Template"><i>a</i></span><i typeof="mw:Object/Template"><span>b</span></i><span>c</span><i>d</i><span>e</span></p>
6686 !!end
6688 !!test
6689 Templates: Ugly nesting: 3. Quotes opened/closed across templates (echo_with_div)
6690 (PHP parser generates misnested html)
6691 !! options
6692 parsoid=wt2html,wt2wt
6693 !!input
6694 {{echo_with_div|''a}}{{echo_with_div|b''c''d}}{{echo_with_div|''e}}
6695 !!result
6696 <div typeof="mw:Object/Template"><i>a</i></div>
6697 <div typeof="mw:Object/Template"><i>b</i>c<i>d</i></div>
6698 <div typeof="mw:Object/Template">e</div>
6699 !!end
6701 !!test
6702 Templates: Ugly nesting: 4. Divs opened/closed across templates
6703 !!input
6704 a<div>b{{echo|c</div>d}}e
6705 !!result
6706 a<div>bc</div>de
6708 !!end
6710 !!test
6711 Templates: Ugly templates: 1. Navbox template parses badly leading to table misnesting
6712 (Parsoid-centric)
6713 !! options
6714 parsoid
6715 !!input
6717 |{{echo|foo</table>}}
6718 |bar
6720 !!result
6721 <table typeof="mw:Object/Template">
6722 <tbody>
6723 <tr>
6724 <td>foo</td></tr></tbody></table><span>bar</span>
6725 !!end
6727 !!test
6728 Templates: Ugly templates: 2. Navbox template parses badly leading to table misnesting
6729 (Parsoid-centric)
6730 !! options
6731 parsoid
6732 !!input
6733 <table>
6734   <tr>
6735     <td>
6736     <table>
6737       <tr>
6738         <td>1. {{echo|foo </table>}}</td>
6739         <td> bar </td>
6740         <td>2. {{echo|baz </table>}}</td>
6741       </tr>
6742       <tr>
6743         <td>abc</td>
6744       </tr>
6745     </table>
6746     </td>
6747   </tr>
6748   <tr>
6749     <td>xyz</td>
6750   </tr>
6751 </table>
6752 !!result
6753 <table  about="#mwt1" typeof="mw:Object/Template">
6754   <tbody><tr >
6755     <td >
6756     <table >
6757       <tbody><tr >
6758         <td >1. foo </td></tr></tbody></table></td>
6759         <td > bar </td>
6760         <td >2. baz </td></tr></tbody></table><span about="#mwt1">
6761       </span><span about="#mwt1">
6762       
6763         abc</span><span about="#mwt1">
6764       </span><span about="#mwt1">
6765     </span><span about="#mwt1">
6766     </span><span about="#mwt1">
6767   </span><span about="#mwt1">
6768   
6769     xyz</span><span about="#mwt1">
6770   </span><span about="#mwt1">
6771 </span>
6772 !!end
6774 !! test
6775 Templates: Ugly templates: 3. newline-only template parameter
6776 !! input
6777 foo {{echo|
6779 !! result
6780 <p>foo 
6781 </p>
6782 !! end
6784 # This looks like a bug: a single newline triggers p/br for some reason.
6785 !! test
6786 Templates: Ugly templates: 4. newline-only template parameter inconsistency
6787 !! input
6788 {{echo|
6790 !! result
6791 <p><br />
6792 </p>
6793 !! end
6796 !!test
6797 Parser Functions: 1. Simple example
6798 !!input
6799 {{uc:foo}}
6800 !!result
6801 <p>FOO
6802 </p>
6803 !!end
6805 !!test
6806 Parser Functions: 2. Nested use (only outermost should be marked up)
6807 !!input
6808 {{uc:{{lc:FOO}}}}
6809 !!result
6810 <p>FOO
6811 </p>
6812 !!end
6815 ### Pre-save transform tests
6817 !! test
6818 pre-save transform: subst:
6819 !! options
6821 !! input
6822 {{subst:test}}
6823 !! result
6824 This is a test template
6825 !! end
6827 !! test
6828 pre-save transform: normal template
6829 !! options
6831 !! input
6832 {{test}}
6833 !! result
6834 {{test}}
6835 !! end
6837 !! test
6838 pre-save transform: nonexistent template
6839 !! options
6841 !! input
6842 {{thistemplatedoesnotexist}}
6843 !! result
6844 {{thistemplatedoesnotexist}}
6845 !! end
6848 !! test
6849 pre-save transform: subst magic variables
6850 !! options
6852 !! input
6853 {{subst:SITENAME}}
6854 !! result
6855 MediaWiki
6856 !! end
6858 # This is bug 89, which I fixed. -- wtm
6859 !! test
6860 pre-save transform: subst: templates with parameters
6861 !! options
6863 !! input
6864 {{subst:paramtest|param="something else"}}
6865 !! result
6866 This is a test template with parameter "something else"
6867 !! end
6869 !! article
6870 Template:nowikitest
6871 !! text
6872 <nowiki>'''not wiki'''</nowiki>
6873 !! endarticle
6875 !! test
6876 pre-save transform: nowiki in subst (bug 1188)
6877 !! options
6879 !! input
6880 {{subst:nowikitest}}
6881 !! result
6882 <nowiki>'''not wiki'''</nowiki>
6883 !! end
6886 !! article
6887 Template:commenttest
6888 !! text
6889 This template has <!-- a comment --> in it.
6890 !! endarticle
6892 !! test
6893 pre-save transform: comment in subst (bug 1936)
6894 !! options
6896 !! input
6897 {{subst:commenttest}}
6898 !! result
6899 This template has <!-- a comment --> in it.
6900 !! end
6902 !! test
6903 pre-save transform: unclosed tag
6904 !! options
6905 pst noxml
6906 !! input
6907 <nowiki>'''not wiki'''
6908 !! result
6909 <nowiki>'''not wiki'''
6910 !! end
6912 !! test
6913 pre-save transform: mixed tag case
6914 !! options
6915 pst noxml
6916 !! input
6917 <NOwiki>'''not wiki'''</noWIKI>
6918 !! result
6919 <NOwiki>'''not wiki'''</noWIKI>
6920 !! end
6922 !! test
6923 pre-save transform: unclosed comment in <nowiki>
6924 !! options
6925 pst noxml
6926 !! input
6927 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
6928 !! result
6929 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
6930 !!end
6932 # Leading @ in this template definition works around a limitation
6933 # in parsoid's parserTests which otherwise strips the <span> from the
6934 # result (confusing it for a template wrapper)
6935 !! article
6936 Template:dangerous
6937 !!text
6938 @<span onmouseover="alert('crap')">Oh no</span>
6939 !!endarticle
6941 !!test
6942 (confirming safety of fix for subst bug 1936)
6943 !! input
6944 {{Template:dangerous}}
6945 !! result
6946 <p>@<span>Oh no</span>
6947 </p>
6948 !! end
6950 !! test
6951 pre-save transform: comment containing gallery (bug 5024)
6952 !! options
6954 !! input
6955 <!-- <gallery>data</gallery> -->
6956 !!result
6957 <!-- <gallery>data</gallery> -->
6958 !!end
6960 !! test
6961 pre-save transform: comment containing extension
6962 !! options
6964 !! input
6965 <!-- <tag>data</tag> -->
6966 !!result
6967 <!-- <tag>data</tag> -->
6968 !!end
6970 !! test
6971 pre-save transform: comment containing nowiki
6972 !! options
6974 !! input
6975 <!-- <nowiki>data</nowiki> -->
6976 !!result
6977 <!-- <nowiki>data</nowiki> -->
6978 !!end
6980 !! test
6981 pre-save transform: <noinclude> in subst (bug 3298)
6982 !! options
6984 !! input
6985 {{subst:Includes}}
6986 !! result
6987 Foobar
6988 !! end
6990 !! test
6991 pre-save transform: <onlyinclude> in subst (bug 3298)
6992 !! options
6994 !! input
6995 {{subst:Includes2}}
6996 !! result
6998 !! end
7000 !! article
7001 Template:SubstTest
7002 !!text
7003 {{<includeonly>subst:</includeonly>Includes}}
7004 !! endarticle
7006 !! article
7007 Template:SafeSubstTest
7008 !! text
7009 {{<includeonly>safesubst:</includeonly>Includes}}
7010 !! endarticle
7012 !! test
7013 bug 22297: safesubst: works during PST
7014 !! options
7016 !! input
7017 {{subst:SafeSubstTest}}{{safesubst:SubstTest}}
7018 !! result
7019 FoobarFoobar
7020 !! end
7022 !! test
7023 bug 22297: safesubst: works during normal parse
7024 !! input
7025 {{SafeSubstTest}}
7026 !! result
7027 <p>Foobar
7028 </p>
7029 !! end
7031 !! test:
7032 subst: does not work during normal parse
7033 !! input
7034 {{SubstTest}}
7035 !! result
7036 <p>{{subst:Includes}}
7037 </p>
7038 !! end
7040 !! test
7041 pre-save transform: context links ("pipe trick")
7042 !! options
7044 !! input
7045 [[Article (context)|]]
7046 [[Bar:Article|]]
7047 [[:Bar:Article|]]
7048 [[Bar:Article (context)|]]
7049 [[:Bar:Article (context)|]]
7050 [[|Article]]
7051 [[|Article (context)]]
7052 [[Bar:X (Y) Z|]]
7053 [[:Bar:X (Y) Z|]]
7054 !! result
7055 [[Article (context)|Article]]
7056 [[Bar:Article|Article]]
7057 [[:Bar:Article|Article]]
7058 [[Bar:Article (context)|Article]]
7059 [[:Bar:Article (context)|Article]]
7060 [[Article]]
7061 [[Article (context)]]
7062 [[Bar:X (Y) Z|X (Y) Z]]
7063 [[:Bar:X (Y) Z|X (Y) Z]]
7064 !! end
7066 !! test
7067 pre-save transform: context links ("pipe trick") with interwiki prefix
7068 !! options
7070 !! input
7071 [[interwiki:Article|]]
7072 [[:interwiki:Article|]]
7073 [[interwiki:Bar:Article|]]
7074 [[:interwiki:Bar:Article|]]
7075 !! result
7076 [[interwiki:Article|Article]]
7077 [[:interwiki:Article|Article]]
7078 [[interwiki:Bar:Article|Bar:Article]]
7079 [[:interwiki:Bar:Article|Bar:Article]]
7080 !! end
7082 !! test
7083 pre-save transform: context links ("pipe trick") with parens in title
7084 !! options
7085 pst title=[[Somearticle (context)]]
7086 !! input
7087 [[|Article]]
7088 !! result
7089 [[Article (context)|Article]]
7090 !! end
7092 !! test
7093 pre-save transform: context links ("pipe trick") with comma in title
7094 !! options
7095 pst title=[[Someplace, Somewhere]]
7096 !! input
7097 [[|Otherplace]]
7098 [[Otherplace, Elsewhere|]]
7099 [[Otherplace, Elsewhere, Anywhere|]]
7100 !! result
7101 [[Otherplace, Somewhere|Otherplace]]
7102 [[Otherplace, Elsewhere|Otherplace]]
7103 [[Otherplace, Elsewhere, Anywhere|Otherplace]]
7104 !! end
7106 !! test
7107 pre-save transform: context links ("pipe trick") with parens and comma
7108 !! options
7109 pst title=[[Someplace (IGNORED), Somewhere]]
7110 !! input
7111 [[|Otherplace]]
7112 [[Otherplace (place), Elsewhere|]]
7113 !! result
7114 [[Otherplace, Somewhere|Otherplace]]
7115 [[Otherplace (place), Elsewhere|Otherplace]]
7116 !! end
7118 !! test
7119 pre-save transform: context links ("pipe trick") with comma and parens
7120 !! options
7121 pst title=[[Who, me? (context)]]
7122 !! input
7123 [[|Yes, you.]]
7124 [[Me, Myself, and I (1937 song)|]]
7125 !! result
7126 [[Yes, you. (context)|Yes, you.]]
7127 [[Me, Myself, and I (1937 song)|Me, Myself, and I]]
7128 !! end
7130 !! test
7131 pre-save transform: context links ("pipe trick") with namespace
7132 !! options
7133 pst title=[[Ns:Somearticle]]
7134 !! input
7135 [[|Article]]
7136 !! result
7137 [[Ns:Article|Article]]
7138 !! end
7140 !! test
7141 pre-save transform: context links ("pipe trick") with namespace and parens
7142 !! options
7143 pst title=[[Ns:Somearticle (context)]]
7144 !! input
7145 [[|Article]]
7146 !! result
7147 [[Ns:Article (context)|Article]]
7148 !! end
7150 !! test
7151 pre-save transform: context links ("pipe trick") with namespace and comma
7152 !! options
7153 pst title=[[Ns:Somearticle, Context, Whatever]]
7154 !! input
7155 [[|Article]]
7156 !! result
7157 [[Ns:Article, Context, Whatever|Article]]
7158 !! end
7160 !! test
7161 pre-save transform: context links ("pipe trick") with namespace, comma and parens
7162 !! options
7163 pst title=[[Ns:Somearticle, Context (context)]]
7164 !! input
7165 [[|Article]]
7166 !! result
7167 [[Ns:Article (context)|Article]]
7168 !! end
7170 !! test
7171 pre-save transform: context links ("pipe trick") with namespace, parens and comma
7172 !! options
7173 pst title=[[Ns:Somearticle (IGNORED), Context]]
7174 !! input
7175 [[|Article]]
7176 !! result
7177 [[Ns:Article, Context|Article]]
7178 !! end
7180 !! test
7181 pre-save transform: context links ("pipe trick") with full-width parens and no space (Japanese and Chinese style, bug 30149)
7182 !! options
7184 !! input
7185 [[Article(context)|]]
7186 [[Bar:Article(context)|]]
7187 [[:Bar:Article(context)|]]
7188 [[|Article(context)]]
7189 [[Bar:X(Y)Z|]]
7190 [[:Bar:X(Y)Z|]]
7191 !! result
7192 [[Article(context)|Article]]
7193 [[Bar:Article(context)|Article]]
7194 [[:Bar:Article(context)|Article]]
7195 [[Article(context)]]
7196 [[Bar:X(Y)Z|X(Y)Z]]
7197 [[:Bar:X(Y)Z|X(Y)Z]]
7198 !! end
7200 !! test
7201 pre-save transform: context links ("pipe trick") with full-width parens and space (Japanese and Chinese style, bug 30149)
7202 !! options
7204 !! input
7205 [[Article (context)|]]
7206 [[Bar:Article (context)|]]
7207 [[:Bar:Article (context)|]]
7208 [[|Article (context)]]
7209 [[Bar:X (Y) Z|]]
7210 [[:Bar:X (Y) Z|]]
7211 !! result
7212 [[Article (context)|Article]]
7213 [[Bar:Article (context)|Article]]
7214 [[:Bar:Article (context)|Article]]
7215 [[Article (context)]]
7216 [[Bar:X (Y) Z|X (Y) Z]]
7217 [[:Bar:X (Y) Z|X (Y) Z]]
7218 !! end
7220 !! test
7221 pre-save transform: context links ("pipe trick") with parens and no space (Korean style, bug 30149)
7222 !! options
7224 !! input
7225 [[Article(context)|]]
7226 [[Bar:Article(context)|]]
7227 [[:Bar:Article(context)|]]
7228 [[|Article(context)]]
7229 [[Bar:X(Y)Z|]]
7230 [[:Bar:X(Y)Z|]]
7231 !! result
7232 [[Article(context)|Article]]
7233 [[Bar:Article(context)|Article]]
7234 [[:Bar:Article(context)|Article]]
7235 [[Article(context)]]
7236 [[Bar:X(Y)Z|X(Y)Z]]
7237 [[:Bar:X(Y)Z|X(Y)Z]]
7238 !! end
7240 !! test
7241 pre-save transform: context links ("pipe trick") with commas (bug 21660)
7242 !! options
7244 !! input
7245 [[Article (context), context|]]
7246 [[Article (context),context|]]
7247 [[Bar:Article (context), context|]]
7248 [[Bar:Article (context),context|]]
7249 [[:Bar:Article (context), context|]]
7250 [[:Bar:Article (context),context|]]
7251 !! result
7252 [[Article (context), context|Article]]
7253 [[Article (context),context|Article]]
7254 [[Bar:Article (context), context|Article]]
7255 [[Bar:Article (context),context|Article]]
7256 [[:Bar:Article (context), context|Article]]
7257 [[:Bar:Article (context),context|Article]]
7258 !! end
7260 !! test
7261 pre-save transform: trim trailing empty lines
7262 !! options
7264 !! input
7265 Empty lines are trimmed
7270 !! result
7271 Empty lines are trimmed
7272 !! end
7274 !! test
7275 pre-save transform: Signature expansion
7276 !! options
7278 !! input
7279 * ~~~
7280 * <noinclude>~~~</noinclude>
7281 * <includeonly>~~~</includeonly>
7282 * <onlyinclude>~~~</onlyinclude>
7283 !! result
7284 * [[Special:Contributions/127.0.0.1|127.0.0.1]]
7285 * <noinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</noinclude>
7286 * <includeonly>[[Special:Contributions/127.0.0.1|127.0.0.1]]</includeonly>
7287 * <onlyinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</onlyinclude>
7288 !! end
7291 !! test
7292 pre-save transform: Signature expansion in nowiki tags (bug 93)
7293 !! options
7294 pst disabled
7295 !! input
7296 Shall not expand:
7298 <nowiki>~~~~</nowiki>
7300 <includeonly><nowiki>~~~~</nowiki></includeonly>
7302 <noinclude><nowiki>~~~~</nowiki></noinclude>
7304 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
7306 {{subst:Foo}} shall be converted to FOO
7308 As well as inside noinclude/onlyinclude
7309 <noinclude>{{subst:Foo}}</noinclude>
7310 <onlyinclude>{{subst:Foo}}</onlyinclude>
7312 But not inside includeonly
7313 <includeonly>{{subst:Foo}}</includeonly>
7314 !! result
7315 Shall not expand:
7317 <nowiki>~~~~</nowiki>
7319 <includeonly><nowiki>~~~~</nowiki></includeonly>
7321 <noinclude><nowiki>~~~~</nowiki></noinclude>
7323 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
7325 FOO shall be converted to FOO
7327 As well as inside noinclude/onlyinclude
7328 <noinclude>FOO</noinclude>
7329 <onlyinclude>FOO</onlyinclude>
7331 But not inside includeonly
7332 <includeonly>{{subst:Foo}}</includeonly>
7333 !! end
7336 ### Message transform tests
7338 !! test
7339 message transform: magic variables
7340 !! options
7342 !! input
7343 {{SITENAME}}
7344 !! result
7345 MediaWiki
7346 !! end
7348 !! test
7349 message transform: should not transform wiki markup
7350 !! options
7352 !! input
7353 ''test''
7354 !! result
7355 ''test''
7356 !! end
7358 !! test
7359 message transform: <noinclude> in transcluded template (bug 4926)
7360 !! options
7362 !! input
7363 {{Includes}}
7364 !! result
7365 Foobar
7366 !! end
7368 !! test
7369 message transform: <onlyinclude> in transcluded template (bug 4926)
7370 !! options
7372 !! input
7373 {{Includes2}}
7374 !! result
7376 !! end
7378 !! test
7379 {{#special:}} page name, known
7380 !! options
7382 !! input
7383 {{#special:Recentchanges}}
7384 !! result
7385 Special:RecentChanges
7386 !! end
7388 !! test
7389 {{#special:}} page name with subpage, known
7390 !! options
7392 !! input
7393 {{#special:Recentchanges/param}}
7394 !! result
7395 Special:RecentChanges/param
7396 !! end
7398 !! test
7399 {{#special:}} page name, unknown
7400 !! options
7402 !! input
7403 {{#special:foobarnonexistent}}
7404 !! result
7405 No such special page
7406 !! end
7408 !! test
7409 {{#speciale:}} page name, known
7410 !! options
7412 !! input
7413 {{#speciale:Recentchanges}}
7414 !! result
7415 Special:RecentChanges
7416 !! end
7418 !! test
7419 {{#speciale:}} page name with subpage, known
7420 !! options
7422 !! input
7423 {{#speciale:Recentchanges/param}}
7424 !! result
7425 Special:RecentChanges/param
7426 !! end
7428 !! test
7429 {{#speciale:}} page name, unknown
7430 !! options
7432 !! input
7433 {{#speciale:foobarnonexistent}}
7434 !! result
7435 No_such_special_page
7436 !! end
7439 ### Images
7441 !! test
7442 Simple image
7443 !! input
7444 [[Image:foobar.jpg]]
7445 !! result
7446 <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>
7447 </p>
7448 !! end
7450 !! test
7451 Right-aligned image
7452 !! input
7453 [[Image:foobar.jpg|right]]
7454 !! result
7455 <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>
7457 !! end
7459 !! test
7460 Simple image (using File: namespace, now canonical)
7461 !! input
7462 [[File:foobar.jpg]]
7463 !! result
7464 <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>
7465 </p>
7466 !! end
7468 !! test
7469 Image with caption
7470 !! input
7471 [[Image:foobar.jpg|right|Caption text]]
7472 !! result
7473 <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>
7475 !! end
7477 !! test
7478 Image with empty attribute
7479 !! input
7480 [[Image:foobar.jpg|right||Caption text]]
7481 !! result
7482 <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>
7484 !! end
7486 !! test
7487 Image with link tails
7488 !! input
7489 123[[Image:foobar.jpg]]456
7490 123[[Image:foobar.jpg|right]]456
7491 123[[Image:foobar.jpg|thumb]]456
7492 !! result
7493 <p>123<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>456
7494 </p>
7495 123<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>456
7496 123<div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></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></div></div></div>456
7498 !! end
7500 !! test
7501 Image with multiple captions -- only last one is accepted
7502 !! input
7503 [[Image:foobar.jpg|right|Caption1 - ignored|[[Caption2]] - ignored|Caption3 - accepted]]
7504 !! result
7505 <div class="floatright"><a href="/wiki/File:Foobar.jpg" class="image" title="Caption3 - accepted"><img alt="Caption3 - accepted" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a></div>
7507 !! end
7509 !! test
7510 Image with width attribute at different positions
7511 !! input
7512 [[Image:foobar.jpg|200px|right|Caption]]
7513 [[Image:foobar.jpg|right|200px|Caption]]
7514 [[Image:foobar.jpg|right|Caption|200px]]
7515 !! result
7516 <div class="floatright"><a href="/wiki/File:Foobar.jpg" class="image" title="Caption"><img alt="Caption" src="http://example.com/images/thumb/3/3a/Foobar.jpg/200px-Foobar.jpg" width="200" height="23" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/300px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/400px-Foobar.jpg 2x" /></a></div>
7517 <div class="floatright"><a href="/wiki/File:Foobar.jpg" class="image" title="Caption"><img alt="Caption" src="http://example.com/images/thumb/3/3a/Foobar.jpg/200px-Foobar.jpg" width="200" height="23" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/300px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/400px-Foobar.jpg 2x" /></a></div>
7518 <div class="floatright"><a href="/wiki/File:Foobar.jpg" class="image" title="Caption"><img alt="Caption" src="http://example.com/images/thumb/3/3a/Foobar.jpg/200px-Foobar.jpg" width="200" height="23" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/300px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/400px-Foobar.jpg 2x" /></a></div>
7520 !! end
7522 !! test
7523 Image with link parameter, wiki target
7524 !! input
7525 [[Image:foobar.jpg|link=Target page]]
7526 !! result
7527 <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>
7528 </p>
7529 !! end
7531 !! test
7532 Image with link parameter, URL target
7533 !! input
7534 [[Image:foobar.jpg|link=http://example.com/]]
7535 !! result
7536 <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>
7537 </p>
7538 !! end
7540 !! test
7541 Image with link parameter, wgExternalLinkTarget
7542 !! input
7543 [[Image:foobar.jpg|link=http://example.com/]]
7544 !! config
7545 wgExternalLinkTarget='foobar'
7546 !! result
7547 <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>
7548 </p>
7549 !! end
7551 !! test
7552 Image with link parameter, wgNoFollowLinks set to false
7553 !! input
7554 [[Image:foobar.jpg|link=http://example.com/]]
7555 !! config
7556 wgNoFollowLinks=false
7557 !! result
7558 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
7559 </p>
7560 !! end
7562 !! test
7563 Image with link parameter, wgNoFollowDomainExceptions
7564 !! input
7565 [[Image:foobar.jpg|link=http://example.com/]]
7566 !! config
7567 wgNoFollowDomainExceptions='example.com'
7568 !! result
7569 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
7570 </p>
7571 !! end
7573 !! test
7574 Image with link parameter, wgExternalLinkTarget, unnamed parameter
7575 !! input
7576 [[Image:foobar.jpg|link=http://example.com/|Title]]
7577 !! config
7578 wgExternalLinkTarget='foobar'
7579 !! result
7580 <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>
7581 </p>
7582 !! end
7584 !! test
7585 Image with empty link parameter
7586 !! input
7587 [[Image:foobar.jpg|link=]]
7588 !! result
7589 <p><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" />
7590 </p>
7591 !! end
7593 !! test
7594 Image with link parameter (wiki target) and unnamed parameter
7595 !! input
7596 [[Image:foobar.jpg|link=Target page|Title]]
7597 !! result
7598 <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>
7599 </p>
7600 !! end
7602 !! test
7603 Image with link parameter (URL target) and unnamed parameter
7604 !! input
7605 [[Image:foobar.jpg|link=http://example.com/|Title]]
7606 !! result
7607 <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>
7608 </p>
7609 !! end
7611 !! test
7612 Thumbnail image with link parameter
7613 !! options
7615 !! input
7616 [[Image:foobar.jpg|thumb|link=http://example.com/|Title]]
7617 !! result
7618 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="http://example.com/"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></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>
7620 !! end
7622 !! test
7623 Manually-specified thumbnail image
7624 !! options
7626 !! input
7627 [[Image:Foobar.jpg|thumb=Thumb.png|Title]]
7628 !! result
7629 <div class="thumb tright"><div class="thumbinner" style="width:137px;"><a href="/wiki/File:Foobar.jpg"><img alt="" src="http://example.com/images/e/ea/Thumb.png" width="135" height="135" 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>
7631 !! end
7633 !! test
7634 Manually-specified thumbnail image with explicit link to wiki page
7635 !! options
7637 !! input
7638 [[Image:Foobar.jpg|thumb=Thumb.png|link=Main Page|Title]]
7639 !! result
7640 <div class="thumb tright"><div class="thumbinner" style="width:137px;"><a href="/wiki/Main_Page" title="Main Page"><img alt="" src="http://example.com/images/e/ea/Thumb.png" width="135" height="135" 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>
7642 !! end
7644 !! test
7645 Manually-specified thumbnail image with explicit link to url
7646 !! options
7648 !! input
7649 [[Image:Foobar.jpg|thumb=Thumb.png|link=http://example.com|Title]]
7650 !! result
7651 <div class="thumb tright"><div class="thumbinner" style="width:137px;"><a href="http://example.com"><img alt="" src="http://example.com/images/e/ea/Thumb.png" width="135" height="135" 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>
7653 !! end
7655 !! test
7656 Manually-specified thumbnail image with explicit no link
7657 !! options
7659 !! input
7660 [[Image:Foobar.jpg|thumb=Thumb.png|link=|Title]]
7661 !! result
7662 <div class="thumb tright"><div class="thumbinner" style="width:137px;"><img alt="" src="http://example.com/images/e/ea/Thumb.png" width="135" height="135" class="thumbimage" />  <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>
7664 !! end
7666 !! test
7667 Manually-specified thumbnail image with explicit link and alt text
7668 !! options
7670 !! input
7671 [[Image:Foobar.jpg|thumb=Thumb.png|link=Main Page|alt=alttext|Title]]
7672 !! result
7673 <div class="thumb tright"><div class="thumbinner" style="width:137px;"><a href="/wiki/Main_Page" title="Main Page"><img alt="alttext" src="http://example.com/images/e/ea/Thumb.png" width="135" height="135" 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>
7675 !! end
7677 !! test
7678 Image with frame and link
7679 !! input
7680 [[Image:Foobar.jpg|frame|left|This is a test image [[Main Page]]]]
7681 !! result
7682 <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>
7684 !! end
7686 !! test
7687 Image with frame and link and explicit alt
7688 !! input
7689 [[Image:Foobar.jpg|frame|left|This is a test image [[Main Page]]|alt=Altitude]]
7690 !! result
7691 <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>
7693 !! end
7695 !! test
7696 Image with wiki markup in implicit alt
7697 !! input
7698 [[Image:Foobar.jpg|testing '''bold''' in alt]]
7699 !! result
7700 <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>
7701 </p>
7702 !! end
7704 !! test
7705 Image with wiki markup in explicit alt
7706 !! input
7707 [[Image:Foobar.jpg|alt=testing '''bold''' in alt]]
7708 !! result
7709 <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>
7710 </p>
7711 !! end
7713 !! test
7714 Link to image page- image page normally doesn't exists, hence edit link
7715 Add test with existing image page
7716 #<p><a href="/wiki/File:Test" title="Image:Test">Image:test</a>
7717 !! input
7718 [[:Image:test]]
7719 !! result
7720 <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>
7721 </p>
7722 !! end
7724 !! test
7725 bug 18784  Link to non-existent image page with caption should use caption as link text
7726 !! input
7727 [[:Image:test|caption]]
7728 !! result
7729 <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>
7730 </p>
7731 !! end
7733 !! test
7734 Frameless image caption with a free URL
7735 !! input
7736 [[Image:foobar.jpg|http://example.com]]
7737 !! result
7738 <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>
7739 </p>
7740 !! end
7742 !! test
7743 Thumbnail image caption with a free URL
7744 !! input
7745 [[Image:foobar.jpg|thumb|http://example.com]]
7746 !! result
7747 <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/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></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>
7749 !! end
7751 !! test
7752 Thumbnail image caption with a free URL and explicit alt
7753 !! input
7754 [[Image:foobar.jpg|thumb|http://example.com|alt=Alteration]]
7755 !! result
7756 <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/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></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>
7758 !! end
7760 !! test
7761 BUG 1887: A ISBN with a thumbnail
7762 !! input
7763 [[Image:foobar.jpg|thumb|ISBN 1235467890]]
7764 !! result
7765 <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/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></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>
7767 !! end
7769 !! test
7770 BUG 1887: A RFC with a thumbnail
7771 !! input
7772 [[Image:foobar.jpg|thumb|This is RFC 12354]]
7773 !! result
7774 <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/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></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" rel="nofollow" href="//tools.ietf.org/html/rfc12354">RFC 12354</a></div></div></div>
7776 !! end
7778 !! test
7779 BUG 1887: A mailto link with a thumbnail
7780 !! input
7781 [[Image:foobar.jpg|thumb|Please mailto:nobody@example.com]]
7782 !! result
7783 <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/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></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>
7785 !! end
7787 # Pending resolution to bug 368
7788 !! test
7789 BUG 648: Frameless image caption with a link
7790 !! input
7791 [[Image:foobar.jpg|text with a [[link]] in it]]
7792 !! result
7793 <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>
7794 </p>
7795 !! end
7797 !! test
7798 BUG 648: Frameless image caption with a link (suffix)
7799 !! input
7800 [[Image:foobar.jpg|text with a [[link]]foo in it]]
7801 !! result
7802 <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>
7803 </p>
7804 !! end
7806 !! test
7807 BUG 648: Frameless image caption with an interwiki link
7808 !! input
7809 [[Image:foobar.jpg|text with a [[MeatBall:Link]] in it]]
7810 !! result
7811 <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>
7812 </p>
7813 !! end
7815 !! test
7816 BUG 648: Frameless image caption with a piped interwiki link
7817 !! input
7818 [[Image:foobar.jpg|text with a [[MeatBall:Link|link]] in it]]
7819 !! result
7820 <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>
7821 </p>
7822 !! end
7824 !! test
7825 Escape HTML special chars in image alt text
7826 !! input
7827 [[Image:foobar.jpg|& < > "]]
7828 !! result
7829 <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>
7830 </p>
7831 !! end
7833 !! test
7834 BUG 499: Alt text should have &#1234;, not &amp;1234;
7835 !! input
7836 [[Image:foobar.jpg|&#9792;]]
7837 !! result
7838 <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>
7839 </p>
7840 !! end
7842 !! test
7843 Broken image caption with link
7844 !! input
7845 [[Image:Foobar.jpg|thumb|This is a broken caption. But [[Main Page|this]] is just an ordinary link.
7846 !! result
7847 <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.
7848 </p>
7849 !! end
7851 !! test
7852 Image caption containing another image
7853 !! input
7854 [[Image:Foobar.jpg|thumb|This is a caption with another [[Image:icon.png|image]] inside it!]]
7855 !! result
7856 <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/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></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>
7858 !! end
7860 !! test
7861 Image caption containing a newline
7862 !! input
7863 [[Image:Foobar.jpg|This
7864 *is some text]]
7865 !! result
7866 <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>
7867 </p>
7868 !!end
7870 !!test
7871 Parsoid: Image caption containing leading space
7872 (The leading space should not trigger nowiki escaping in wt2wt mode)
7873 !! input
7874 [[Image:Foobar.jpg|thumb| bar]]
7875 !! result
7876 <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/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></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>bar</div></div></div>
7878 !!end
7880 !! test
7881 Bug 3090: External links other than http: in image captions
7882 !! input
7883 [[Image:Foobar.jpg|thumb|200px|This caption has [irc://example.net irc] and [https://example.com Secure] ext links in it.]]
7884 !! result
7885 <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/thumb/3/3a/Foobar.jpg/200px-Foobar.jpg" width="200" height="23" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/300px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/400px-Foobar.jpg 2x" /></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>
7887 !! end
7889 !! test
7890 Custom class
7891 !! input
7892 [[Image:foobar.jpg|a|class=b]]
7893 !! result
7894 <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>
7895 </p>
7896 !! end
7898 !! test
7899 Localized image handling (1).
7900 !! options
7901 language=es
7902 !! input
7903 [[Archivo:Foobar.jpg|izquierda|enlace=foo|caption]]
7904 !! result
7905 <div class="floatleft"><a href="/wiki/Foo" title="caption"><img alt="caption" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a></div>
7907 !! end
7909 !! test
7910 Localized image handling (2).
7911 !! options
7912 language=es
7913 !! input
7914 [[Archivo:Foobar.jpg|miniatura|izquierda|enlace=foo|caption]]
7915 !! result
7916 <div class="thumb tleft"><div class="thumbinner" style="width:182px;"><a href="/wiki/Foo" title="Foo"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a>  <div class="thumbcaption"><div class="magnify"><a href="/wiki/Archivo:Foobar.jpg" class="internal" title="Aumentar"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>caption</div></div></div>
7918 !! end
7920 !! test
7921 "border", "frameless" and "class" attributes on an image.
7922 !! input
7923 [[File:Foobar.jpg|frameless|border|class=extra|caption]]
7924 !! result
7925 <p><a href="/wiki/File:Foobar.jpg" class="image" title="caption"><img alt="caption" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" class="extra thumbborder" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a>
7926 </p>
7927 !! end
7929 !! article
7930 File:Barfoo.jpg
7931 !! text
7932 #REDIRECT [[File:Barfoo.jpg]]
7933 !! endarticle
7935 !! test
7936 Redirected image
7937 !! input
7938 [[Image:Barfoo.jpg]]
7939 !! result
7940 <p><a href="/wiki/File:Barfoo.jpg" title="File:Barfoo.jpg">File:Barfoo.jpg</a>
7941 </p>
7942 !! end
7944 !! test
7945 Missing image with uploads disabled
7946 !! options
7947 wgEnableUploads=0
7948 !! input
7949 [[Image:Foobaz.jpg]]
7950 !! result
7951 <p><a href="/wiki/File:Foobaz.jpg" title="File:Foobaz.jpg">File:Foobaz.jpg</a>
7952 </p>
7953 !! end
7955 # Parsoid-specific testing for images
7956 # http://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec#Images
7957 # Currently imperfect due to a flaw in the Parsoid testrunner
7958 # Work in progress
7960 !! test
7961 Parsoid-specific image handling - simple image
7962 !! options
7963 parsoid
7964 !! input
7965 [[Image:Foobar.jpg]]
7966 !! result
7968 <span class="mw-default-size" typeof="mw:Image">
7969 <a href="File:Foobar.jpg">
7970 <img resource="./File:Foobar.jpg" src="http://upload.wikimedia.org/wikipedia/commons/3/3a/Foobar.jpg" height="220" width="1941">
7971 </a>
7972 </span>
7973 </p>
7974 !! end
7976 !! test
7977 Parsoid-specific image handling - simple image without link
7978 !! options
7979 parsoid
7980 !! input
7981 [[Image:Foobar.jpg|link=]]
7982 !! result
7984 <span class="mw-default-size" typeof="mw:Image">
7985 <span>
7986 <img resource="./File:Foobar.jpg" src="http://upload.wikimedia.org/wikipedia/commons/3/3a/Foobar.jpg" height="220" width="1941">
7987 </span>
7988 </span>
7989 </p>
7990 !! end
7992 !! test
7993 Parsoid-specific image handling - simple image with specific link
7994 !! options
7995 parsoid
7996 !! input
7997 [[Image:Foobar.jpg|link=Main Page]]
7998 !! result
8000 <span class="mw-default-size" typeof="mw:Image">
8001 <a href="Main_Page">
8002 <img resource="./File:Foobar.jpg" src="http://upload.wikimedia.org/wikipedia/commons/3/3a/Foobar.jpg" height="220" width="1941">
8003 </a>
8004 </span>
8005 </p>
8006 !! end
8008 !! test
8009 Parsoid-specific image handling - simple image with size and middle alignment
8010 !! options
8011 parsoid
8012 !! input
8013 [[Image:Foobar.jpg|50px|middle]]
8014 !! result
8016 <span class="mw-valign-middle" typeof="mw:Image">
8017 <a href="File:Foobar.jpg">
8018 <img resource="./File:Foobar.jpg" src="http://upload.wikimedia.org/wikipedia/commons/3/3a/Foobar.jpg/50px-Foobar.jpg" height="6" width="50">
8019 </a>
8020 </span>
8021 </p>
8022 !! end
8024 !! test
8025 Parsoid-specific image handling - simple image with both sizes, a baseline alignment, and a caption
8026 !! options
8027 parsoid
8028 !! input
8029 [[Image:Foobar.jpg|500x10px|baseline|caption]]
8030 !! result
8032 <span class="mw-valign-baseline" typeof="mw:Image" data-mw="{&quot;caption&quot;:&quot;caption&quot;}">
8033 <a href="File:Foobar.jpg">
8034 <img resource="./File:Foobar.jpg" src="http://upload.wikimedia.org/wikipedia/commons/3/3a/Foobar.jpg/89px-Foobar.jpg" height="10" width="89">
8035 </a>
8036 </span>
8037 </p>
8038 !! end
8040 !! test
8041 Parsoid-specific image handling - simple image with border and size spec
8042 !! options
8043 parsoid
8044 !! input
8045 [[Image:Foobar.jpg|50px|border|caption]]
8046 !! result
8048 <span class="mw-image-border" typeof="mw:Image" data-mw="{&quot;caption&quot;:&quot;caption&quot;}">
8049 <a href="File:Foobar.jpg">
8050 <img resource="./File:Foobar.jpg" src="http://upload.wikimedia.org/wikipedia/commons/3/3a/Foobar.jpg/50px-Foobar.jpg" height="6" width="50">
8051 </a>
8052 </span>
8053 </p>
8054 !! end
8056 !! test
8057 Parsoid-specific image handling - thumbnail with halign, valign, and caption
8058 !! options
8059 parsoid
8060 !! input
8061 [[Image:Foobar.jpg|thumb|left|baseline|caption content]]
8062 !! result
8063 <figure class="mw-default-size mw-halign-left mw-valign-baseline" typeof="mw:Image/Thumb">
8064 <a href="File:Foobar.jpg">
8065 <img resource="./File:Foobar.jpg" src="http://upload.wikimedia.org/wikipedia/commons/3/3a/Foobar.jpg/180px-Foobar.jpg" height="21" width="180" />
8066 </a>
8067 <figcaption class="mw-figcaption">caption content</figcaption>
8068 </figure>
8069 !! end
8071 !! test
8072 Parsoid-specific image handling - thumbnail with specific size, halign, valign, and caption
8073 !! options
8074 parsoid
8075 !! input
8076 [[Image:Foobar.jpg|thumb|50x50px|right|middle|caption]]
8077 !! result
8078 <figure class="mw-halign-right mw-valign-middle" typeof="mw:Image/Thumb">
8079 <a href="File:Foobar.jpg">
8080 <img resource="./File:Foobar.jpg" src="http://upload.wikimedia.org/wikipedia/commons/3/3a/Foobar.jpg/50px-Foobar.jpg" height="6" width="50" />
8081 </a>
8082 <figcaption class="mw-figcaption">caption</figcaption>
8083 </figure>
8084 !! end
8086 !! test
8087 Parsoid-specific image handling - framed image with specific size and caption
8088 !! options
8089 parsoid
8090 !! input
8091 [[Image:Foobar.jpg|500x50px|frame|caption]]
8092 !! result
8093 <figure typeof="mw:Image/Frame">
8094 <a href="File:Foobar.jpg">
8095 <img resource="./File:Foobar.jpg" src="http://upload.wikimedia.org/wikipedia/commons/3/3a/Foobar.jpg/442px-Foobar.jpg" height="50" width="442" />
8096 </a>
8097 <figcaption class="mw-figcaption">caption</figcaption>
8098 </figure>
8099 !! end
8101 !! test
8102 Parsoid-specific image handling - framed image with specific size, halign, valign, and caption
8103 !! options
8104 parsoid
8105 !! input
8106 [[Image:Foobar.jpg|500x50px|frame|left|baseline|caption]]
8107 !! result
8108 <figure class="mw-halign-left mw-valign-baseline" typeof="mw:Image/Frame">
8109 <a href="File:Foobar.jpg">
8110 <img resource="./File:Foobar.jpg" src="http://upload.wikimedia.org/wikipedia/commons/3/3a/Foobar.jpg/442px-Foobar.jpg" height="50" width="442" />
8111 </a>
8112 <figcaption class="mw-figcaption">caption</figcaption>
8113 </figure>
8114 !! end
8116 !! test
8117 Parsoid-specific image handling - frameless image with specific size, border, and caption
8118 !! options
8119 parsoid
8120 !! input
8121 [[Image:Foobar.jpg|frameless|500x50px|border|caption]]
8122 !! result
8124 <span class="mw-image-border" typeof="mw:Image/Frameless" data-mw="{&quot;caption&quot;:&quot;caption&quot;}">
8125 <a href="File:Foobar.jpg">
8126 <img resource="./File:Foobar.jpg" src="http://upload.wikimedia.org/wikipedia/commons/3/3a/Foobar.jpg/442px-Foobar.jpg" height="50" width="442" />
8127 </a>
8128 </p>
8129 !! end
8131 #!! test
8132 #Parsoid-specific image handling - simple image with a formatted caption
8133 #!! options
8134 #parsoid
8135 #!! input
8136 #[[Image:Foobar.jpg|<table><tr><td>a</td><td>b</td></tr><tr><td>c</td></tr></table>]]
8137 #!! result
8138 #<p>
8139 #<span typeof="mw:Image">
8140 #<a class="mw-default-size" href="Image:Foobar.jpg">
8141 #<img alt="Foobar.jpg" class="mw-default-size" src="http://upload.wikimedia.org/wikipedia/commons/3/3a/Foobar.jpg" height="220" width="1941">
8142 #</a>
8143 #<span>abc</span>
8144 #</span>
8145 #</p>
8149 ### Subpages
8151 !! article
8152 Subpage test/subpage
8153 !! text
8155 !! endarticle
8157 !! test
8158 Subpage link
8159 !! options
8160 subpage title=[[Subpage test]]
8161 !! input
8162 [[/subpage]]
8163 !! result
8164 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a>
8165 </p>
8166 !! end
8168 !! test
8169 Subpage noslash link
8170 !! options
8171 subpage title=[[Subpage test]]
8172 !!input
8173 [[/subpage/]]
8174 !! result
8175 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">subpage</a>
8176 </p>
8177 !! end
8179 !! test
8180 Disabled subpages
8181 !! input
8182 [[/subpage]]
8183 !! result
8184 <p><a href="/index.php?title=/subpage&amp;action=edit&amp;redlink=1" class="new" title="/subpage (page does not exist)">/subpage</a>
8185 </p>
8186 !! end
8188 !! test
8189 BUG 561: {{/Subpage}}
8190 !! options
8191 subpage title=[[Page]]
8192 !! input
8193 {{/Subpage}}
8194 !! result
8195 <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>
8196 </p>
8197 !! end
8200 ### Categories
8202 !! article
8203 Category:MediaWiki User's Guide
8204 !! text
8205 blah
8206 !! endarticle
8208 !! test
8209 Link to category
8210 !! input
8211 [[:Category:MediaWiki User's Guide]]
8212 !! result
8213 <p><a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">Category:MediaWiki User's Guide</a>
8214 </p>
8215 !! end
8217 !! test
8218 Simple category
8219 !! options
8221 !! input
8222 [[Category:MediaWiki User's Guide]]
8223 !! result
8224 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
8225 !! end
8227 !! test
8228 PAGESINCATEGORY invalid title fatal (r33546 fix)
8229 !! input
8230 {{PAGESINCATEGORY:<bogus>}}
8231 !! result
8232 <p>0
8233 </p>
8234 !! end
8236 !! test
8237 Category with different sort key
8238 !! options
8240 !! input
8241 [[Category:MediaWiki User's Guide|Foo]]
8242 !! result
8243 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
8244 !! end
8246 !! test
8247 Category with identical sort key
8248 !! options
8250 !! input
8251 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
8252 !! result
8253 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
8254 !! end
8256 !! test
8257 Category with empty sort key
8258 !! options
8261 !! input
8262 [[Category:MediaWiki User's Guide|]]
8263 !! result
8264 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
8265 !! end
8267 !! test
8268 Category with empty sort key and parentheses
8269 !! options
8272 !! input
8273 [[Category:Foo (bar)|]]
8274 !! result
8275 [[Category:Foo (bar)|Foo]]
8276 !! end
8278 !! test
8279 Category with link tail
8280 !! options
8283 !! input
8284 123[[Category:Foo]]456
8285 !! result
8286 123[[Category:Foo]]456
8287 !! end
8289 !! test
8290 Category with template
8291 !! options
8294 !! input
8295 [[Category:{{echo|Foo}}]]
8296 !! result
8297 [[Category:{{echo|Foo}}]]
8298 !! end
8300 !! test
8301 Category with template in sort key
8302 !! options
8305 !! input
8306 [[Category:Foo|{{echo|Bar}}]]
8307 !! result
8308 [[Category:Foo|{{echo|Bar}}]]
8309 !! end
8311 !! test
8312 Category with template in sort key and title
8313 !! options
8316 !! input
8317 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
8318 !! result
8319 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
8320 !! end
8322 !! test
8323 Category / paragraph interactions
8324 !! input
8325 Foo [[Category:Baz]] Bar
8327 Foo [[Category:Baz]]
8331 [[Category:Baz]]
8335 [[Category:Baz]] Bar
8338 [[Category:Baz]]
8339  [[Category:Baz]]
8340 [[Category:Baz]]
8343 [[Category:Baz]]
8344  [[Category:Baz]]
8345 [[Category:Baz]]
8347 [[Category:Baz]]
8348  {{echo|[[Category:Baz]]}}
8349 [[Category:Baz]]
8350 !! result
8351 <p>Foo Bar
8352 </p><p>Foo
8354 </p><p>Foo
8356 </p><p>Foo Bar
8357 </p><p>Foo
8359 </p>
8360 !! end
8363 ### Inter-language links
8365 !! test
8366 Inter-language links
8367 !! options
8369 !! input
8370 [[es:Alimento]]
8371 [[fr:Nourriture]]
8372 [[zh:&#39135;&#21697;]]
8373 !! result
8374 es:Alimento fr:Nourriture zh:食品
8375 !! end
8377 !! test
8378 Duplicate interlanguage links (bug 24502)
8379 !! options
8381 !! input
8382 [[es:1]]
8383 [[es:2]]
8384 [[fr:1]]
8385 [[fr:2]]
8386 !! result
8387 es:1 fr:1
8388 !! end
8391 ### Sections
8393 !! test
8394 Basic section headings
8395 !! input
8396 == Headline 1 ==
8397 Some text
8399 ==Headline 2==
8400 More
8401 ===Smaller headline===
8402 Blah blah
8403 !! result
8404 <h2><span class="mw-headline" id="Headline_1">Headline 1</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: Headline 1">edit</a>]</span></h2>
8405 <p>Some text
8406 </p>
8407 <h2><span class="mw-headline" id="Headline_2">Headline 2</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: Headline 2">edit</a>]</span></h2>
8408 <p>More
8409 </p>
8410 <h3><span class="mw-headline" id="Smaller_headline">Smaller headline</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=3" title="Edit section: Smaller headline">edit</a>]</span></h3>
8411 <p>Blah blah
8412 </p>
8413 !! end
8415 !! test
8416 Section headings with TOC
8417 !! input
8418 == Headline 1 ==
8419 === Subheadline 1 ===
8420 ===== Skipping a level =====
8421 ====== Skipping a level ======
8423 == Headline 2 ==
8424 Some text
8425 ===Another headline===
8426 !! result
8427 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
8428 <ul>
8429 <li class="toclevel-1 tocsection-1"><a href="#Headline_1"><span class="tocnumber">1</span> <span class="toctext">Headline 1</span></a>
8430 <ul>
8431 <li class="toclevel-2 tocsection-2"><a href="#Subheadline_1"><span class="tocnumber">1.1</span> <span class="toctext">Subheadline 1</span></a>
8432 <ul>
8433 <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>
8434 <ul>
8435 <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>
8436 </ul>
8437 </li>
8438 </ul>
8439 </li>
8440 </ul>
8441 </li>
8442 <li class="toclevel-1 tocsection-5"><a href="#Headline_2"><span class="tocnumber">2</span> <span class="toctext">Headline 2</span></a>
8443 <ul>
8444 <li class="toclevel-2 tocsection-6"><a href="#Another_headline"><span class="tocnumber">2.1</span> <span class="toctext">Another headline</span></a></li>
8445 </ul>
8446 </li>
8447 </ul>
8448 </td></tr></table>
8449 <h2><span class="mw-headline" id="Headline_1">Headline 1</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: Headline 1">edit</a>]</span></h2>
8450 <h3><span class="mw-headline" id="Subheadline_1">Subheadline 1</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: Subheadline 1">edit</a>]</span></h3>
8451 <h5><span class="mw-headline" id="Skipping_a_level">Skipping a level</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=3" title="Edit section: Skipping a level">edit</a>]</span></h5>
8452 <h6><span class="mw-headline" id="Skipping_a_level_2">Skipping a level</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=4" title="Edit section: Skipping a level">edit</a>]</span></h6>
8453 <h2><span class="mw-headline" id="Headline_2">Headline 2</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=5" title="Edit section: Headline 2">edit</a>]</span></h2>
8454 <p>Some text
8455 </p>
8456 <h3><span class="mw-headline" id="Another_headline">Another headline</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=6" title="Edit section: Another headline">edit</a>]</span></h3>
8458 !! end
8460 # perl -e 'print "="x$_," Level $_ heading","="x$_,"\n" for 1..10'
8461 !! test
8462 Handling of sections up to level 6 and beyond
8463 !! input
8464 = Level 1 Heading=
8465 == Level 2 Heading==
8466 === Level 3 Heading===
8467 ==== Level 4 Heading====
8468 ===== Level 5 Heading=====
8469 ====== Level 6 Heading======
8470 ======= Level 7 Heading=======
8471 ======== Level 8 Heading========
8472 ========= Level 9 Heading=========
8473 ========== Level 10 Heading==========
8474 !! result
8475 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
8476 <ul>
8477 <li class="toclevel-1 tocsection-1"><a href="#Level_1_Heading"><span class="tocnumber">1</span> <span class="toctext">Level 1 Heading</span></a>
8478 <ul>
8479 <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>
8480 <ul>
8481 <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>
8482 <ul>
8483 <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>
8484 <ul>
8485 <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>
8486 <ul>
8487 <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>
8488 <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>
8489 <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>
8490 <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>
8491 <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>
8492 </ul>
8493 </li>
8494 </ul>
8495 </li>
8496 </ul>
8497 </li>
8498 </ul>
8499 </li>
8500 </ul>
8501 </li>
8502 </ul>
8503 </td></tr></table>
8504 <h1><span class="mw-headline" id="Level_1_Heading">Level 1 Heading</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: Level 1 Heading">edit</a>]</span></h1>
8505 <h2><span class="mw-headline" id="Level_2_Heading">Level 2 Heading</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: Level 2 Heading">edit</a>]</span></h2>
8506 <h3><span class="mw-headline" id="Level_3_Heading">Level 3 Heading</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=3" title="Edit section: Level 3 Heading">edit</a>]</span></h3>
8507 <h4><span class="mw-headline" id="Level_4_Heading">Level 4 Heading</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=4" title="Edit section: Level 4 Heading">edit</a>]</span></h4>
8508 <h5><span class="mw-headline" id="Level_5_Heading">Level 5 Heading</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=5" title="Edit section: Level 5 Heading">edit</a>]</span></h5>
8509 <h6><span class="mw-headline" id="Level_6_Heading">Level 6 Heading</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=6" title="Edit section: Level 6 Heading">edit</a>]</span></h6>
8510 <h6><span class="mw-headline" id=".3D_Level_7_Heading.3D">= Level 7 Heading=</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=7" title="Edit section: = Level 7 Heading=">edit</a>]</span></h6>
8511 <h6><span class="mw-headline" id=".3D.3D_Level_8_Heading.3D.3D">== Level 8 Heading==</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=8" title="Edit section: == Level 8 Heading==">edit</a>]</span></h6>
8512 <h6><span class="mw-headline" id=".3D.3D.3D_Level_9_Heading.3D.3D.3D">=== Level 9 Heading===</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=9" title="Edit section: === Level 9 Heading===">edit</a>]</span></h6>
8513 <h6><span class="mw-headline" id=".3D.3D.3D.3D_Level_10_Heading.3D.3D.3D.3D">==== Level 10 Heading====</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=10" title="Edit section: ==== Level 10 Heading====">edit</a>]</span></h6>
8515 !! end
8517 !! test
8518 TOC regression (bug 9764)
8519 !! input
8520 == title 1 ==
8521 === title 1.1 ===
8522 ==== title 1.1.1 ====
8523 === title 1.2 ===
8524 == title 2 ==
8525 === title 2.1 ===
8526 !! result
8527 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
8528 <ul>
8529 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
8530 <ul>
8531 <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>
8532 <ul>
8533 <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>
8534 </ul>
8535 </li>
8536 <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>
8537 </ul>
8538 </li>
8539 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
8540 <ul>
8541 <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>
8542 </ul>
8543 </li>
8544 </ul>
8545 </td></tr></table>
8546 <h2><span class="mw-headline" id="title_1">title 1</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: title 1">edit</a>]</span></h2>
8547 <h3><span class="mw-headline" id="title_1.1">title 1.1</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: title 1.1">edit</a>]</span></h3>
8548 <h4><span class="mw-headline" id="title_1.1.1">title 1.1.1</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=3" title="Edit section: title 1.1.1">edit</a>]</span></h4>
8549 <h3><span class="mw-headline" id="title_1.2">title 1.2</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=4" title="Edit section: title 1.2">edit</a>]</span></h3>
8550 <h2><span class="mw-headline" id="title_2">title 2</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=5" title="Edit section: title 2">edit</a>]</span></h2>
8551 <h3><span class="mw-headline" id="title_2.1">title 2.1</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=6" title="Edit section: title 2.1">edit</a>]</span></h3>
8553 !! end
8555 !! test
8556 TOC with wgMaxTocLevel=3 (bug 6204)
8557 !! options
8558 wgMaxTocLevel=3
8559 !! input
8560 == title 1 ==
8561 === title 1.1 ===
8562 ==== title 1.1.1 ====
8563 === title 1.2 ===
8564 == title 2 ==
8565 === title 2.1 ===
8566 !! result
8567 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
8568 <ul>
8569 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
8570 <ul>
8571 <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>
8572 <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>
8573 </ul>
8574 </li>
8575 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
8576 <ul>
8577 <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>
8578 </ul>
8579 </li>
8580 </ul>
8581 </td></tr></table>
8582 <h2><span class="mw-headline" id="title_1">title 1</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: title 1">edit</a>]</span></h2>
8583 <h3><span class="mw-headline" id="title_1.1">title 1.1</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: title 1.1">edit</a>]</span></h3>
8584 <h4><span class="mw-headline" id="title_1.1.1">title 1.1.1</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=3" title="Edit section: title 1.1.1">edit</a>]</span></h4>
8585 <h3><span class="mw-headline" id="title_1.2">title 1.2</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=4" title="Edit section: title 1.2">edit</a>]</span></h3>
8586 <h2><span class="mw-headline" id="title_2">title 2</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=5" title="Edit section: title 2">edit</a>]</span></h2>
8587 <h3><span class="mw-headline" id="title_2.1">title 2.1</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=6" title="Edit section: title 2.1">edit</a>]</span></h3>
8589 !! end
8591 !! test
8592 TOC with wgMaxTocLevel=3 and two level four headings (bug 6204)
8593 !! options
8594 wgMaxTocLevel=3
8595 !! input
8596 ==Section 1==
8597 ===Section 1.1===
8598 ====Section 1.1.1====
8599 ====Section 1.1.1.1====
8600 ==Section 2==
8601 !! result
8602 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
8603 <ul>
8604 <li class="toclevel-1 tocsection-1"><a href="#Section_1"><span class="tocnumber">1</span> <span class="toctext">Section 1</span></a>
8605 <ul>
8606 <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>
8607 </ul>
8608 </li>
8609 <li class="toclevel-1 tocsection-5"><a href="#Section_2"><span class="tocnumber">2</span> <span class="toctext">Section 2</span></a></li>
8610 </ul>
8611 </td></tr></table>
8612 <h2><span class="mw-headline" id="Section_1">Section 1</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: Section 1">edit</a>]</span></h2>
8613 <h3><span class="mw-headline" id="Section_1.1">Section 1.1</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: Section 1.1">edit</a>]</span></h3>
8614 <h4><span class="mw-headline" id="Section_1.1.1">Section 1.1.1</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=3" title="Edit section: Section 1.1.1">edit</a>]</span></h4>
8615 <h4><span class="mw-headline" id="Section_1.1.1.1">Section 1.1.1.1</span><span class="mw-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></h4>
8616 <h2><span class="mw-headline" id="Section_2">Section 2</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=5" title="Edit section: Section 2">edit</a>]</span></h2>
8618 !! end
8621 !! test
8622 Resolving duplicate section names
8623 !! input
8624 == Foo bar ==
8625 == Foo bar ==
8626 !! result
8627 <h2><span class="mw-headline" id="Foo_bar">Foo bar</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: Foo bar">edit</a>]</span></h2>
8628 <h2><span class="mw-headline" id="Foo_bar_2">Foo bar</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: Foo bar">edit</a>]</span></h2>
8630 !! end
8632 !! test
8633 Resolving duplicate section names with differing case (bug 10721)
8634 !! input
8635 == Foo bar ==
8636 == Foo Bar ==
8637 !! result
8638 <h2><span class="mw-headline" id="Foo_bar">Foo bar</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: Foo bar">edit</a>]</span></h2>
8639 <h2><span class="mw-headline" id="Foo_Bar_2">Foo Bar</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: Foo Bar">edit</a>]</span></h2>
8641 !! end
8643 !! article
8644 Template:sections
8645 !! text
8646 ===Section 1===
8647 ==Section 2==
8648 !! endarticle
8650 !! test
8651 Template with sections, __NOTOC__
8652 !! input
8653 __NOTOC__
8654 ==Section 0==
8655 {{sections}}
8656 ==Section 4==
8657 !! result
8658 <h2><span class="mw-headline" id="Section_0">Section 0</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: Section 0">edit</a>]</span></h2>
8659 <h3><span class="mw-headline" id="Section_1">Section 1</span><span class="mw-editsection">[<a href="/index.php?title=Template:Sections&amp;action=edit&amp;section=T-1" title="Template:Sections">edit</a>]</span></h3>
8660 <h2><span class="mw-headline" id="Section_2">Section 2</span><span class="mw-editsection">[<a href="/index.php?title=Template:Sections&amp;action=edit&amp;section=T-2" title="Template:Sections">edit</a>]</span></h2>
8661 <h2><span class="mw-headline" id="Section_4">Section 4</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: Section 4">edit</a>]</span></h2>
8663 !! end
8665 !! test
8666 __NOEDITSECTION__ keyword
8667 !! input
8668 __NOEDITSECTION__
8669 ==Section 1==
8670 ==Section 2==
8671 !! result
8672 <h2><span class="mw-headline" id="Section_1">Section 1</span></h2>
8673 <h2><span class="mw-headline" id="Section_2">Section 2</span></h2>
8675 !! end
8677 !! test
8678 Link inside a section heading
8679 !! input
8680 ==Section with a [[Main Page|link]] in it==
8681 !! result
8682 <h2><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><span class="mw-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></h2>
8684 !! end
8686 !! test
8687 TOC regression (bug 12077)
8688 !! input
8689 __TOC__
8690 == title 1 ==
8691 === title 1.1 ===
8692 == title 2 ==
8693 !! result
8694 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
8695 <ul>
8696 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
8697 <ul>
8698 <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>
8699 </ul>
8700 </li>
8701 <li class="toclevel-1 tocsection-3"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a></li>
8702 </ul>
8703 </td></tr></table>
8704 <h2><span class="mw-headline" id="title_1">title 1</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: title 1">edit</a>]</span></h2>
8705 <h3><span class="mw-headline" id="title_1.1">title 1.1</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: title 1.1">edit</a>]</span></h3>
8706 <h2><span class="mw-headline" id="title_2">title 2</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=3" title="Edit section: title 2">edit</a>]</span></h2>
8708 !! end
8710 !! test
8711 BUG 1219 URL next to image (good)
8712 !! input
8713 http://example.com [[Image:foobar.jpg]]
8714 !! result
8715 <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>
8716 </p>
8717 !!end
8719 !! test
8720 Short headings with trailing space should match behavior of Parser::doHeadings (bug 19910)
8721 !! input
8722 === 
8723 The line above must have a trailing space!
8724 === <!--
8725 --> <!-- -->
8726 But just in case it doesn't...
8727 !! result
8728 <h1><span class="mw-headline" id=".3D">=</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: =">edit</a>]</span></h1>
8729 <p>The line above must have a trailing space!
8730 </p>
8731 <h1><span class="mw-headline" id=".3D_2">=</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: =">edit</a>]</span></h1>
8732 <p>But just in case it doesn't...
8733 </p>
8734 !! end
8736 !! test
8737 Header with special characters (bug 25462)
8738 !! input
8739 The tooltips shall not show entities to the user (ie. be double escaped)
8741 == text > text ==
8742 section 1
8744 == text < text ==
8745 section 2
8747 == text & text ==
8748 section 3
8750 == text ' text ==
8751 section 4
8753 == text " text ==
8754 section 5
8755 !! result
8756 <p>The tooltips shall not show entities to the user (ie. be double escaped)
8757 </p>
8758 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
8759 <ul>
8760 <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>
8761 <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>
8762 <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>
8763 <li class="toclevel-1 tocsection-4"><a href="#text_.27_text"><span class="tocnumber">4</span> <span class="toctext">text ' text</span></a></li>
8764 <li class="toclevel-1 tocsection-5"><a href="#text_.22_text"><span class="tocnumber">5</span> <span class="toctext">text " text</span></a></li>
8765 </ul>
8766 </td></tr></table>
8767 <h2><span class="mw-headline" id="text_.3E_text">text &gt; text</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: text > text">edit</a>]</span></h2>
8768 <p>section 1
8769 </p>
8770 <h2><span class="mw-headline" id="text_.3C_text">text &lt; text</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: text &lt; text">edit</a>]</span></h2>
8771 <p>section 2
8772 </p>
8773 <h2><span class="mw-headline" id="text_.26_text">text &amp; text</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=3" title="Edit section: text &amp; text">edit</a>]</span></h2>
8774 <p>section 3
8775 </p>
8776 <h2><span class="mw-headline" id="text_.27_text">text ' text</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=4" title="Edit section: text ' text">edit</a>]</span></h2>
8777 <p>section 4
8778 </p>
8779 <h2><span class="mw-headline" id="text_.22_text">text " text</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=5" title="Edit section: text &quot; text">edit</a>]</span></h2>
8780 <p>section 5
8781 </p>
8782 !! end
8784 !! test
8785 Headers with excess '=' characters
8786 (Are similar tests necessary beyond the 1st level?)
8787 !! input
8788 =foo==
8789 ==foo=
8790 =''italic'' heading==
8791 ==''italic'' heading=
8792 !! result
8793 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
8794 <ul>
8795 <li class="toclevel-1 tocsection-1"><a href="#foo.3D"><span class="tocnumber">1</span> <span class="toctext">foo=</span></a></li>
8796 <li class="toclevel-1 tocsection-2"><a href="#.3Dfoo"><span class="tocnumber">2</span> <span class="toctext">=foo</span></a></li>
8797 <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>
8798 <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>
8799 </ul>
8800 </td></tr></table>
8801 <h1><span class="mw-headline" id="foo.3D">foo=</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: foo=">edit</a>]</span></h1>
8802 <h1><span class="mw-headline" id=".3Dfoo">=foo</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: =foo">edit</a>]</span></h1>
8803 <h1><span class="mw-headline" id="italic_heading.3D"><i>italic</i> heading=</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=3" title="Edit section: italic heading=">edit</a>]</span></h1>
8804 <h1><span class="mw-headline" id=".3Ditalic_heading">=<i>italic</i> heading</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=4" title="Edit section: =italic heading">edit</a>]</span></h1>
8806 !! end
8808 !! test
8809 HTML headers vs TOC (bug 23393)
8810 (__NOEDITSECTION__ for clearer output, doesn't matter here)
8811 !! input
8812 <h1>Header 1</h1>
8813 == Header 1.1 ==
8814 == Header 1.2 ==
8816 <h1>Header 2
8817 </h1>
8818 == Header 2.1 ==
8819 == Header 2.2 ==
8820 __NOEDITSECTION__
8821 !! result
8822 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
8823 <ul>
8824 <li class="toclevel-1"><a href="#Header_1"><span class="tocnumber">1</span> <span class="toctext">Header 1</span></a>
8825 <ul>
8826 <li class="toclevel-2 tocsection-1"><a href="#Header_1.1"><span class="tocnumber">1.1</span> <span class="toctext">Header 1.1</span></a></li>
8827 <li class="toclevel-2 tocsection-2"><a href="#Header_1.2"><span class="tocnumber">1.2</span> <span class="toctext">Header 1.2</span></a></li>
8828 </ul>
8829 </li>
8830 <li class="toclevel-1"><a href="#Header_2"><span class="tocnumber">2</span> <span class="toctext">Header 2</span></a>
8831 <ul>
8832 <li class="toclevel-2 tocsection-3"><a href="#Header_2.1"><span class="tocnumber">2.1</span> <span class="toctext">Header 2.1</span></a></li>
8833 <li class="toclevel-2 tocsection-4"><a href="#Header_2.2"><span class="tocnumber">2.2</span> <span class="toctext">Header 2.2</span></a></li>
8834 </ul>
8835 </li>
8836 </ul>
8837 </td></tr></table>
8838 <h1><span class="mw-headline" id="Header_1">Header 1</span></h1>
8839 <h2><span class="mw-headline" id="Header_1.1">Header 1.1</span></h2>
8840 <h2><span class="mw-headline" id="Header_1.2">Header 1.2</span></h2>
8841 <h1><span class="mw-headline" id="Header_2">Header 2</span></h1>
8842 <h2><span class="mw-headline" id="Header_2.1">Header 2.1</span></h2>
8843 <h2><span class="mw-headline" id="Header_2.2">Header 2.2</span></h2>
8845 !! end
8847 !! test
8848 BUG 1219 URL next to image (broken)
8849 !! input
8850 http://example.com[[Image:foobar.jpg]]
8851 !! result
8852 <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>
8853 </p>
8854 !!end
8856 !! test
8857 Bug 1186 news: in the middle of text
8858 !! input
8859 http://en.wikinews.org/wiki/Wikinews:Workplace
8860 !! result
8861 <p><a rel="nofollow" class="external free" href="http://en.wikinews.org/wiki/Wikinews:Workplace">http://en.wikinews.org/wiki/Wikinews:Workplace</a>
8862 </p>
8863 !!end
8866 !! test
8867 Namespaced link must have a title
8868 !! input
8869 [[Project:]]
8870 !! result
8871 <p>[[Project:]]
8872 </p>
8873 !!end
8875 !! test
8876 Namespaced link must have a title (bad fragment version)
8877 !! input
8878 [[Project:#fragment]]
8879 !! result
8880 <p>[[Project:#fragment]]
8881 </p>
8882 !!end
8886 ### HTML tags and HTML attributes
8889 !! test
8890 div with no attributes
8891 !! input
8892 <div>HTML rocks</div>
8893 !! result
8894 <div>HTML rocks</div>
8896 !! end
8898 !! test
8899 div with double-quoted attribute
8900 !! input
8901 <div id="rock">HTML rocks</div>
8902 !! result
8903 <div id="rock">HTML rocks</div>
8905 !! end
8907 !! test
8908 div with single-quoted attribute
8909 !! input
8910 <div id='rock'>HTML rocks</div>
8911 !! result
8912 <div id="rock">HTML rocks</div>
8914 !! end
8916 !! test
8917 div with unquoted attribute
8918 !! input
8919 <div id=rock>HTML rocks</div>
8920 !! result
8921 <div id="rock">HTML rocks</div>
8923 !! end
8925 !! test
8926 div with illegal double attributes
8927 !! input
8928 <div id="a" id="b">HTML rocks</div>
8929 !! result
8930 <div id="b">HTML rocks</div>
8932 !!end
8934 # FIXME: produce empty string instead of "class" in the PHP parser, following
8935 # the HTML5 spec.
8936 !! test
8937 div with empty attribute value, space before equals
8938 !! options
8939 parsoid
8940 !! input
8941 <div class =>HTML rocks</div>
8942 !! result
8943 <div class="">HTML rocks</div>
8945 !! end
8947 # The PHP parser escapes the opening brace to &#123; for some reason, so
8948 # disabled this test for it.
8949 !! test
8950 div with braces in attribute value
8951 !! options
8952 parsoid
8953 !! input
8954 <div title="{}">Foo</div>
8955 !! result
8956 <div title="{}">Foo</div>
8957 !! end
8959 # This it very inconsistent in the PHP parser: it returns 
8960 # class="class" if there is a space between the name and the equal sign (see
8961 # 'div with empty attribute value, space before equals'), but strips the
8962 # attribute completely if the space is missing. We hope that not much content
8963 # depends on this, so are implementing the behavior below in Parsoid for
8964 # consistencies' sake. Disabled for the PHP parser. 
8965 # FIXME: fix this behavior in the PHP parser?
8966 !! test
8967 div with empty attribute value, no space before equals
8968 !! options
8969 parsoid
8970 !! input
8971 <div class=>HTML rocks</div>
8972 !! result
8973 <div class="">HTML rocks</div>
8975 !! end
8977 !! test
8978 HTML multiple attributes correction
8979 !! input
8980 <p class="error" class="awesome">Awesome!</p>
8981 !! result
8982 <p class="awesome">Awesome!</p>
8984 !!end
8986 !! test
8987 Table multiple attributes correction
8988 !! input
8990 !+ class="error" class="awesome"| status
8992 !! result
8993 <table>
8994 <tr>
8995 <th class="awesome"> status
8996 </th></tr></table>
8998 !!end
9000 !! test
9001 DIV IN UPPERCASE
9002 !! input
9003 <DIV ID="x">HTML ROCKS</DIV>
9004 !! result
9005 <div id="x">HTML ROCKS</div>
9007 !!end
9009 !! test
9010 Non-ASCII pseudo-tags are rendered as text
9011 !! input
9012 <khyô>
9013 !! result
9014 <p>&lt;khyô&gt;
9015 </p>
9016 !! end
9018 !! test
9019 Pseudo-tag with URL 'name' renders as url link
9020 !! input
9021 <http://example.com/>
9022 !! result
9023 <p>&lt;<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&gt;
9024 </p>
9025 !! end
9027 !! test
9028 text with amp in the middle of nowhere
9029 !! input
9030 Remember AT&T?
9031 !!result
9032 <p>Remember AT&amp;T?
9033 </p>
9034 !! end
9036 !! test
9037 text with character entity: eacute
9038 !! input
9039 I always thought &eacute; was a cute letter.
9040 !! result
9041 <p>I always thought &#233; was a cute letter.
9042 </p>
9043 !! end
9045 !! test
9046 text with entity-escaped character entity-like string: eacute
9047 !! input
9048 I always thought &amp;eacute; was a cute letter.
9049 !! result
9050 <p>I always thought &amp;eacute; was a cute letter.
9051 </p>
9052 !! end
9054 !! test
9055 text with undefined character entity: xacute
9056 !! input
9057 I always thought &xacute; was a cute letter.
9058 !! result
9059 <p>I always thought &amp;xacute; was a cute letter.
9060 </p>
9061 !! end
9065 ### Media links
9068 !! test
9069 Media link
9070 !! input
9071 [[Media:Foobar.jpg]]
9072 !! result
9073 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Media:Foobar.jpg</a>
9074 </p>
9075 !! end
9077 !! test
9078 Media link with text
9079 !! input
9080 [[Media:Foobar.jpg|A neat file to look at]]
9081 !! result
9082 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">A neat file to look at</a>
9083 </p>
9084 !! end
9086 # FIXME: this is still bad HTML tag nesting
9087 !! test
9088 Media link with nasty text
9089 fixme: doBlockLevels won't wrap this in a paragraph because it contains a div
9090 !! input
9091 [[Media:Foobar.jpg|Safe Link<div style=display:none>" onmouseover="alert(document.cookie)" onfoo="</div>]]
9092 !! result
9093 <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>
9095 !! end
9097 !! test
9098 Media link to nonexistent file (bug 1702)
9099 !! input
9100 [[Media:No such.jpg]]
9101 !! result
9102 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=No_such.jpg" class="new" title="No such.jpg">Media:No such.jpg</a>
9103 </p>
9104 !! end
9106 !! test
9107 Image link to nonexistent file (bug 1850 - good)
9108 !! input
9109 [[Image:No such.jpg]]
9110 !! result
9111 <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>
9112 </p>
9113 !! end
9115 !! test
9116 :Image link to nonexistent file (bug 1850 - bad)
9117 !! input
9118 [[:Image:No such.jpg]]
9119 !! result
9120 <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>
9121 </p>
9122 !! end
9126 !! test
9127 Character reference normalization in link text (bug 1938)
9128 !! input
9129 [[Main Page|this&that]]
9130 !! result
9131 <p><a href="/wiki/Main_Page" title="Main Page">this&amp;that</a>
9132 </p>
9133 !!end
9135 !! article
9136 אַ
9137 !! text
9138 Test for unicode normalization
9140 The page's name is U+05d0 U+05b7, with non-canonical form U+FB2E
9141 !! endarticle
9143 !! test
9144 (bug 19451) Links should refer to the normalized form.
9145 !! input
9146 [[&#xFB2E;]]
9147 [[&#x5d0;&#x5b7;]]
9148 [[&#x5d0;ַ]]
9149 [[א&#x5b7;]]
9150 [[אַ]]
9151 !! result
9152 <p><a href="/wiki/%D7%90%D6%B7" title="אַ">&#xfb2e;</a>
9153 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;&#x5b7;</a>
9154 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;ַ</a>
9155 <a href="/wiki/%D7%90%D6%B7" title="אַ">א&#x5b7;</a>
9156 <a href="/wiki/%D7%90%D6%B7" title="אַ">אַ</a>
9157 </p>
9158 !! end
9160 !! test
9161 Empty attribute crash test (bug 2067)
9162 !! input
9163 <font color="">foo</font>
9164 !! result
9165 <p><font color="">foo</font>
9166 </p>
9167 !! end
9169 !! test
9170 Empty attribute crash test single-quotes (bug 2067)
9171 !! input
9172 <font color=''>foo</font>
9173 !! result
9174 <p><font color="">foo</font>
9175 </p>
9176 !! end
9178 !! test
9179 Attribute test: equals, then nothing
9180 !! input
9181 <font color=>foo</font>
9182 !! result
9183 <p><font>foo</font>
9184 </p>
9185 !! end
9187 !! test
9188 Attribute test: unquoted value
9189 !! input
9190 <font color=x>foo</font>
9191 !! result
9192 <p><font color="x">foo</font>
9193 </p>
9194 !! end
9196 !! test
9197 Attribute test: unquoted but illegal value (hash)
9198 !! input
9199 <font color=#x>foo</font>
9200 !! result
9201 <p><font color="#x">foo</font>
9202 </p>
9203 !! end
9205 !! test
9206 Attribute test: no value
9207 !! input
9208 <font color>foo</font>
9209 !! result
9210 <p><font color="color">foo</font>
9211 </p>
9212 !! end
9214 !! test
9215 Bug 2095: link with three closing brackets
9216 !! input
9217 [[Main Page]]]
9218 !! result
9219 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>]
9220 </p>
9221 !! end
9223 !! test
9224 Bug 2095: link with pipe and three closing brackets
9225 !! input
9226 [[Main Page|link]]]
9227 !! result
9228 <p><a href="/wiki/Main_Page" title="Main Page">link</a>]
9229 </p>
9230 !! end
9232 !! test
9233 Bug 2095: link with pipe and three closing brackets, version 2
9234 !! input
9235 [[Main Page|[http://example.com/]]]
9236 !! result
9237 <p><a href="/wiki/Main_Page" title="Main Page">[http://example.com/]</a>
9238 </p>
9239 !! end
9243 ### Safety
9246 !! article
9247 Template:Dangerous attribute
9248 !! text
9249 " onmouseover="alert(document.cookie)
9250 !! endarticle
9252 !! article
9253 Template:Dangerous style attribute
9254 !! text
9255 border-size: expression(alert(document.cookie))
9256 !! endarticle
9258 !! article
9259 Template:Div style
9260 !! text
9261 <div style="float: right; {{{1}}}">Magic div</div>
9262 !! endarticle
9264 !! test
9265 Bug 2304: HTML attribute safety (safe template; regression bug 2309)
9266 !! input
9267 <div title="{{test}}"></div>
9268 !! result
9269 <div title="This is a test template"></div>
9271 !! end
9273 !! test
9274 Bug 2304: HTML attribute safety (dangerous template; 2309)
9275 !! input
9276 <div title="{{dangerous attribute}}"></div>
9277 !! result
9278 <div title=""></div>
9280 !! end
9282 !! test
9283 Bug 2304: HTML attribute safety (dangerous style template; 2309)
9284 !! input
9285 <div style="{{dangerous style attribute}}"></div>
9286 !! result
9287 <div style="/* insecure input */"></div>
9289 !! end
9291 !! test
9292 Bug 2304: HTML attribute safety (safe parameter; 2309)
9293 !! input
9294 {{div style|width: 200px}}
9295 !! result
9296 <div style="float: right; width: 200px">Magic div</div>
9298 !! end
9300 !! test
9301 Bug 2304: HTML attribute safety (unsafe parameter; 2309)
9302 !! input
9303 {{div style|width: expression(alert(document.cookie))}}
9304 !! result
9305 <div style="/* insecure input */">Magic div</div>
9307 !! end
9309 !! test
9310 Bug 2304: HTML attribute safety (unsafe breakout parameter; 2309)
9311 !! input
9312 {{div style|"><script>alert(document.cookie)</script>}}
9313 !! result
9314 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
9316 !! end
9318 !! test
9319 Bug 2304: HTML attribute safety (unsafe breakout parameter 2; 2309)
9320 !! input
9321 {{div style|" ><script>alert(document.cookie)</script>}}
9322 !! result
9323 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
9325 !! end
9327 !! test
9328 Bug 2304: HTML attribute safety (link)
9329 !! input
9330 <div title="[[Main Page]]"></div>
9331 !! result
9332 <div title="&#91;&#91;Main Page]]"></div>
9334 !! end
9336 !! test
9337 Bug 2304: HTML attribute safety (italics)
9338 !! input
9339 <div title="''foobar''"></div>
9340 !! result
9341 <div title="&#39;&#39;foobar&#39;&#39;"></div>
9343 !! end
9345 !! test
9346 Bug 2304: HTML attribute safety (bold)
9347 !! input
9348 <div title="'''foobar'''"></div>
9349 !! result
9350 <div title="&#39;&#39;&#39;foobar&#39;&#39;&#39;"></div>
9352 !! end
9355 !! test
9356 Bug 2304: HTML attribute safety (ISBN)
9357 !! input
9358 <div title="ISBN 1234567890"></div>
9359 !! result
9360 <div title="&#73;SBN 1234567890"></div>
9362 !! end
9364 !! test
9365 Bug 2304: HTML attribute safety (RFC)
9366 !! input
9367 <div title="RFC 1234"></div>
9368 !! result
9369 <div title="&#82;FC 1234"></div>
9371 !! end
9373 !! test
9374 Bug 2304: HTML attribute safety (PMID)
9375 !! input
9376 <div title="PMID 1234567890"></div>
9377 !! result
9378 <div title="&#80;MID 1234567890"></div>
9380 !! end
9382 !! test
9383 Bug 2304: HTML attribute safety (web link)
9384 !! input
9385 <div title="http://example.com/"></div>
9386 !! result
9387 <div title="http&#58;//example.com/"></div>
9389 !! end
9391 !! test
9392 Bug 2304: HTML attribute safety (named web link)
9393 !! input
9394 <div title="[http://example.com/ link]"></div>
9395 !! result
9396 <div title="&#91;http&#58;//example.com/ link]"></div>
9398 !! end
9400 !! test
9401 Bug 3244: HTML attribute safety (extension; safe)
9402 !! input
9403 <div style="<nowiki>background:blue</nowiki>"></div>
9404 !! result
9405 <div style="background:blue"></div>
9407 !! end
9409 !! test
9410 Bug 3244: HTML attribute safety (extension; unsafe)
9411 !! input
9412 <div style="<nowiki>border-left:expression(alert(document.cookie))</nowiki>"></div>
9413 !! result
9414 <div style="/* insecure input */"></div>
9416 !! end
9418 # More MSIE fun discovered by Tom Gilder
9420 !! test
9421 MSIE CSS safety test: spurious slash
9422 !! input
9423 <div style="background-image:u\rl(javascript:alert('boo'))">evil</div>
9424 !! result
9425 <div style="/* insecure input */">evil</div>
9427 !! end
9429 !! test
9430 MSIE CSS safety test: hex code
9431 !! input
9432 <div style="background-image:u\72l(javascript:alert('boo'))">evil</div>
9433 !! result
9434 <div style="/* insecure input */">evil</div>
9436 !! end
9438 !! test
9439 MSIE CSS safety test: comment in url
9440 !! input
9441 <div style="background-image:u/**/rl(javascript:alert('boo'))">evil</div>
9442 !! result
9443 <div style="background-image:u rl(javascript:alert(&#39;boo&#39;))">evil</div>
9445 !! end
9447 !! test
9448 MSIE CSS safety test: comment in expression
9449 !! input
9450 <div style="background-image:expres/**/sion(alert('boo4'))">evil4</div>
9451 !! result
9452 <div style="background-image:expres sion(alert(&#39;boo4&#39;))">evil4</div>
9454 !! end
9457 !! test
9458 Table attribute legitimate extension
9459 !! input
9461 !+ style="<nowiki>color:blue</nowiki>"| status
9463 !! result
9464 <table>
9465 <tr>
9466 <th style="color:blue"> status
9467 </th></tr></table>
9469 !!end
9471 !! test
9472 Table attribute safety
9473 !! input
9475 !+ style="<nowiki>border-width:expression(0+alert(document.cookie))</nowiki>"| status
9477 !! result
9478 <table>
9479 <tr>
9480 <th style="/* insecure input */"> status
9481 </th></tr></table>
9483 !! end
9485 !! test
9486 CSS line continuation 1
9487 !! input
9488 <div style="background-image: u\&#10;rl(test.jpg);"></div>
9489 !! result
9490 <div style="/* insecure input */"></div>
9492 !! end
9494 !! test
9495 CSS line continuation 2
9496 !! input
9497 <div style="background-image: u\&#13;rl(test.jpg); "></div>
9498 !! result
9499 <div style="/* insecure input */"></div>
9501 !! end
9503 !! article
9504 Template:Identity
9505 !! text
9506 {{{1}}}
9507 !! endarticle
9509 !! test
9510 Expansion of multi-line templates in attribute values (bug 6255)
9511 !! input
9512 <div style="background: {{identity|#00FF00}}">-</div>
9513 !! result
9514 <div style="background: #00FF00">-</div>
9516 !! end
9519 !! test
9520 Expansion of multi-line templates in attribute values (bug 6255 sanity check)
9521 !! input
9522 <div style="background: 
9523 #00FF00">-</div>
9524 !! result
9525 <div style="background: #00FF00">-</div>
9527 !! end
9529 !! test
9530 Expansion of multi-line templates in attribute values (bug 6255 sanity check 2)
9531 !! input
9532 <div style="background: &#10;#00FF00">-</div>
9533 !! result
9534 <div style="background: &#10;#00FF00">-</div>
9536 !! end
9539 ### Parser hooks (see maintenance/parserTestsParserHook.php for the <tag> extension)
9541 !! test
9542 Parser hook: empty input
9543 !! input
9544 <tag></tag>
9545 !! result
9546 <pre>
9548 array (
9550 </pre>
9552 !! end
9554 !! test
9555 Parser hook: empty input using terminated empty elements
9556 !! input
9557 <tag/>
9558 !! result
9559 <pre>
9560 NULL
9561 array (
9563 </pre>
9565 !! end
9567 !! test
9568 Parser hook: empty input using terminated empty elements (space before)
9569 !! input
9570 <tag />
9571 !! result
9572 <pre>
9573 NULL
9574 array (
9576 </pre>
9578 !! end
9580 !! test
9581 Parser hook: basic input
9582 !! input
9583 <tag>input</tag>
9584 !! result
9585 <pre>
9586 'input'
9587 array (
9589 </pre>
9591 !! end
9594 !! test
9595 Parser hook: case insensitive
9596 !! input
9597 <TAG>input</TAG>
9598 !! result
9599 <pre>
9600 'input'
9601 array (
9603 </pre>
9605 !! end
9608 !! test
9609 Parser hook: case insensitive, redux
9610 !! input
9611 <TaG>input</TAg>
9612 !! result
9613 <pre>
9614 'input'
9615 array (
9617 </pre>
9619 !! end
9621 !! test
9622 Parser hook: nested tags
9623 !! options
9624 noxml
9625 !! input
9626 <tag><tag></tag></tag>
9627 !! result
9628 <pre>
9629 '<tag>'
9630 array (
9632 </pre>&lt;/tag&gt;
9634 !! end
9636 !! test
9637 Parser hook: basic arguments
9638 !! input
9639 <tag width=200 height = "100" depth = '50' square></tag>
9640 !! result
9641 <pre>
9643 array (
9644   'width' => '200',
9645   'height' => '100',
9646   'depth' => '50',
9647   'square' => 'square',
9649 </pre>
9651 !! end
9653 !! test
9654 Parser hook: argument containing a forward slash (bug 5344)
9655 !! input
9656 <tag filename='/tmp/bla'></tag>
9657 !! result
9658 <pre>
9660 array (
9661   'filename' => '/tmp/bla',
9663 </pre>
9665 !! end
9667 !! test
9668 Parser hook: empty input using terminated empty elements (bug 2374)
9669 !! input
9670 <tag foo=bar/>text
9671 !! result
9672 <pre>
9673 NULL
9674 array (
9675   'foo' => 'bar',
9677 </pre>text
9679 !! end
9681 # </tag> should be output literally since there is no matching tag that begins it
9682 !! test
9683 Parser hook: basic arguments using terminated empty elements (bug 2374)
9684 !! input
9685 <tag width=200 height = "100" depth = '50' square/>
9686 other stuff
9687 </tag>
9688 !! result
9689 <pre>
9690 NULL
9691 array (
9692   'width' => '200',
9693   'height' => '100',
9694   'depth' => '50',
9695   'square' => 'square',
9697 </pre>
9698 <p>other stuff
9699 &lt;/tag&gt;
9700 </p>
9701 !! end
9704 ### (see maintenance/parserTestsStaticParserHook.php for the <statictag> extension)
9707 !! test
9708 Parser hook: static parser hook not inside a comment
9709 !! input
9710 <statictag>hello, world</statictag>
9711 <statictag action=flush/>
9712 !! result
9713 <p>hello, world
9714 </p>
9715 !! end
9718 !! test
9719 Parser hook: static parser hook inside a comment
9720 !! input
9721 <!-- <statictag>hello, world</statictag> -->
9722 <statictag action=flush/>
9723 !! result
9724 <p><br />
9725 </p>
9726 !! end
9728 # Nested template calls; this case was broken by Parser.php rev 1.506,
9729 # since reverted.
9731 !! article
9732 Template:One-parameter
9733 !! text
9734 (My parameter is: {{{1}}})
9735 !! endarticle
9737 !! article
9738 Template:Map-one-parameter
9739 !! text
9740 {{{{{1}}}|{{{2}}}}}
9741 !! endarticle
9743 !! test
9744 Nested template calls
9745 !! input
9746 {{Map-one-parameter|One-parameter|param}}
9747 !! result
9748 <p>(My parameter is: param)
9749 </p>
9750 !! end
9754 ### Sanitizer
9756 !! test
9757 Sanitizer: Closing of open tags
9758 !! input
9759 <s></s><table></table>
9760 !! result
9761 <s></s><table></table>
9763 !! end
9765 !! test
9766 Sanitizer: Closing of open but not closed tags
9767 !! input
9768 <s>foo
9769 !! result
9770 <p><s>foo</s>
9771 </p>
9772 !! end
9774 !! test
9775 Sanitizer: Closing of closed but not open tags
9776 !! input
9777 </s>
9778 !! result
9779 <p>&lt;/s&gt;
9780 </p>
9781 !! end
9783 !! test
9784 Sanitizer: Closing of closed but not open table tags
9785 !! input
9786 Table not started</td></tr></table>
9787 !! result
9788 <p>Table not started&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
9789 </p>
9790 !! end
9792 !! test
9793 Sanitizer: Escaping of spaces, multibyte characters, colons & other stuff in id=""
9794 !! input
9795 <span id="æ: v">byte</span>[[#æ: v|backlink]]
9796 !! result
9797 <p><span id=".C3.A6:_v">byte</span><a href="#.C3.A6:_v">backlink</a>
9798 </p>
9799 !! end
9801 !! test
9802 Sanitizer: Validating the contents of the id attribute (bug 4515)
9803 !! options
9804 disabled
9805 !! input
9806 <br id=9 />
9807 !! result
9808 Something, but definitely not <br id="9" />...
9809 !! end
9811 !! test
9812 Sanitizer: Validating id attribute uniqueness (bug 4515, bug 6301)
9813 !! options
9814 disabled
9815 !! input
9816 <br id="foo" /><br id="foo" />
9817 !! result
9818 Something need to be done. foo-2 ? 
9819 !! end
9821 !! test
9822 Sanitizer: Validating that <meta> and <link> work, but only for Microdata
9823 !! input
9824 <div itemscope>
9825         <meta itemprop="hello" content="world">
9826         <meta http-equiv="refresh" content="5">
9827         <meta itemprop="hello" http-equiv="refresh" content="5">
9828         <link itemprop="hello" href="{{SERVER}}">
9829         <link rel="stylesheet" href="{{SERVER}}">
9830         <link rel="stylesheet" itemprop="hello" href="{{SERVER}}">
9831 </div>
9832 !! result
9833 <div itemscope="itemscope">
9834 <p>     <meta itemprop="hello" content="world" />
9835         &lt;meta http-equiv="refresh" content="5"&gt;
9836         <meta itemprop="hello" content="5" />
9837 </p>
9838         <link itemprop="hello" href="http&#58;//example.org" />
9839         &lt;link rel="stylesheet" href="<a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>"&gt;
9840         <link itemprop="hello" href="http&#58;//example.org" />
9841 </div>
9843 !! end
9845 !! test
9846 Language converter: output gets cut off unexpectedly (bug 5757)
9847 !! options
9848 language=zh
9849 !! input
9850 this bit is safe: }-
9852 but if we add a conversion instance: -{zh-cn:xxx;zh-tw:yyy}-
9854 then we get cut off here: }-
9856 all additional text is vanished
9857 !! result
9858 <p>this bit is safe: }-
9859 </p><p>but if we add a conversion instance: xxx
9860 </p><p>then we get cut off here: }-
9861 </p><p>all additional text is vanished
9862 </p>
9863 !! end
9865 !! test
9866 Self closed html pairs (bug 5487)
9867 !! options
9868 !! input
9869 <center><font id="bug" />Centered text</center>
9870 <div><font id="bug2" />In div text</div>
9871 !! result
9872 <center>&lt;font id="bug" /&gt;Centered text</center>
9873 <div>&lt;font id="bug2" /&gt;In div text</div>
9875 !! end
9881 !! test
9882 Punctuation: nbsp before exclamation
9883 !! input
9884 C'est grave !
9885 !! result
9886 <p>C'est grave&#160;!
9887 </p>
9888 !! end
9890 !! test
9891 Punctuation: CSS !important (bug 11874)
9892 !! input
9893 <div style="width:50% !important">important</div>
9894 !! result
9895 <div style="width:50% !important">important</div>
9897 !!end
9899 !! test
9900 Punctuation: CSS ! important (bug 11874; with space after)
9901 !! input
9902 <div style="width:50% ! important">important</div>
9903 !! result
9904 <div style="width:50% ! important">important</div>
9906 !!end
9909 !! test
9910 HTML bullet list, closed tags (bug 5497)
9911 !! input
9912 <ul>
9913 <li>One</li>
9914 <li>Two</li>
9915 </ul>
9916 !! result
9917 <ul>
9918 <li>One</li>
9919 <li>Two</li>
9920 </ul>
9922 !! end
9924 !! test
9925 HTML bullet list, unclosed tags (bug 5497)
9926 !! options
9927 disabled
9928 !! input
9929 <ul>
9930 <li>One
9931 <li>Two
9932 </ul>
9933 !! result
9934 <ul>
9935 <li>One
9936 </li><li>Two
9937 </li></ul>
9939 !! end
9941 !! test
9942 HTML ordered list, closed tags (bug 5497)
9943 !! input
9944 <ol>
9945 <li>One</li>
9946 <li>Two</li>
9947 </ol>
9948 !! result
9949 <ol>
9950 <li>One</li>
9951 <li>Two</li>
9952 </ol>
9954 !! end
9956 !! test
9957 HTML ordered list, unclosed tags (bug 5497)
9958 !! options
9959 disabled
9960 !! input
9961 <ol>
9962 <li>One
9963 <li>Two
9964 </ol>
9965 !! result
9966 <ol>
9967 <li>One
9968 </li><li>Two
9969 </li></ol>
9971 !! end
9973 !! test
9974 HTML nested bullet list, closed tags (bug 5497)
9975 !! input
9976 <ul>
9977 <li>One</li>
9978 <li>Two:
9979 <ul>
9980 <li>Sub-one</li>
9981 <li>Sub-two</li>
9982 </ul>
9983 </li>
9984 </ul>
9985 !! result
9986 <ul>
9987 <li>One</li>
9988 <li>Two:
9989 <ul>
9990 <li>Sub-one</li>
9991 <li>Sub-two</li>
9992 </ul>
9993 </li>
9994 </ul>
9996 !! end
9998 !! test
9999 HTML nested bullet list, open tags (bug 5497)
10000 !! options
10001 disabled
10002 !! input
10003 <ul>
10004 <li>One
10005 <li>Two:
10006 <ul>
10007 <li>Sub-one
10008 <li>Sub-two
10009 </ul>
10010 </ul>
10011 !! result
10012 <ul>
10013 <li>One
10014 </li><li>Two:
10015 <ul>
10016 <li>Sub-one
10017 </li><li>Sub-two
10018 </li></ul>
10019 </li></ul>
10021 !! end
10023 !! test
10024 HTML nested ordered list, closed tags (bug 5497)
10025 !! input
10026 <ol>
10027 <li>One</li>
10028 <li>Two:
10029 <ol>
10030 <li>Sub-one</li>
10031 <li>Sub-two</li>
10032 </ol>
10033 </li>
10034 </ol>
10035 !! result
10036 <ol>
10037 <li>One</li>
10038 <li>Two:
10039 <ol>
10040 <li>Sub-one</li>
10041 <li>Sub-two</li>
10042 </ol>
10043 </li>
10044 </ol>
10046 !! end
10048 !! test
10049 HTML nested ordered list, open tags (bug 5497)
10050 !! options
10051 disabled
10052 !! input
10053 <ol>
10054 <li>One
10055 <li>Two:
10056 <ol>
10057 <li>Sub-one
10058 <li>Sub-two
10059 </ol>
10060 </ol>
10061 !! result
10062 <ol>
10063 <li>One
10064 </li><li>Two:
10065 <ol>
10066 <li>Sub-one
10067 </li><li>Sub-two
10068 </li></ol>
10069 </li></ol>
10071 !! end
10073 !! test
10074 HTML ordered list item with parameters oddity
10075 !! input
10076 <ol><li id="fragment">One</li></ol>
10077 !! result
10078 <ol><li id="fragment">One</li></ol>
10080 !! end
10082 !!test
10083 bug 5918: autonumbering
10084 !! input
10085 [http://first/] [http://second] [ftp://ftp]
10087 ftp://inlineftp
10089 [mailto:enclosed@mail.tld With target]
10091 [mailto:enclosed@mail.tld]
10093 mailto:inline@mail.tld
10094 !! result
10095 <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>
10096 </p><p><a rel="nofollow" class="external free" href="ftp://inlineftp">ftp://inlineftp</a>
10097 </p><p><a rel="nofollow" class="external text" href="mailto:enclosed@mail.tld">With target</a>
10098 </p><p><a rel="nofollow" class="external autonumber" href="mailto:enclosed@mail.tld">[4]</a>
10099 </p><p><a rel="nofollow" class="external free" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a>
10100 </p>
10101 !! end
10105 # Security and HTML correctness
10106 # From Nick Jenkins' fuzz testing
10109 !! test
10110 Fuzz testing: Parser13
10111 !! input
10112 {| 
10113 | http://a|
10114 !! result
10115 <table>
10116 <tr>
10117 <td>
10118 </td>
10119 </tr>
10120 </table>
10122 !! end
10124 !! test
10125 Fuzz testing: Parser14
10126 !! input
10127 == onmouseover= ==
10128 http://__TOC__
10129 !! result
10130 <h2><span class="mw-headline" id="onmouseover.3D">onmouseover=</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: onmouseover=">edit</a>]</span></h2>
10131 http://<table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
10132 <ul>
10133 <li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
10134 </ul>
10135 </td></tr></table>
10137 !! end
10139 !! test
10140 Fuzz testing: Parser14-table
10141 !! input
10142 ==a==
10143 {| STYLE=__TOC__
10144 !! result
10145 <h2><span class="mw-headline" id="a">a</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: a">edit</a>]</span></h2>
10146 <table style="&#95;_TOC&#95;_">
10147 <tr><td></td></tr>
10148 </table>
10150 !! end
10152 # Known to produce bogus xml (extra </td>)
10153 !! test
10154 Fuzz testing: Parser16
10155 !! options
10156 noxml
10157 !! input
10159 !https://||||||
10160 !! result
10161 <table>
10162 <tr>
10163 <th>https://</th>
10164 <th></th>
10165 <th></th>
10166 <th>
10167 </td>
10168 </tr>
10169 </table>
10171 !! end
10173 !! test
10174 Fuzz testing: Parser21
10175 !! input
10177 ! irc://{{ftp://a" onmouseover="alert('hello world');"
10179 !! result
10180 <table>
10181 <tr>
10182 <th> <a rel="nofollow" class="external free" href="irc://{{ftp://a">irc://{{ftp://a</a>" onmouseover="alert('hello world');"
10183 </th>
10184 <td>
10185 </td>
10186 </tr>
10187 </table>
10189 !! end
10191 !! test
10192 Fuzz testing: Parser22
10193 !! input
10194 http://===r:::https://b
10197 !!result
10198 <p><a rel="nofollow" class="external free" href="http://===r:::https://b">http://===r:::https://b</a>
10199 </p>
10200 <table>
10201 <tr><td></td></tr>
10202 </table>
10204 !! end
10206 # Known to produce bad XML for now
10207 !! test
10208 Fuzz testing: Parser24
10209 !! options
10210 noxml
10211 !! input
10213 {{{|
10214 <u CLASS=
10215 | {{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx--><noinclude>}}}} >
10216 <br style="onmouseover='alert(document.cookie);' " />
10218 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
10220 !! result
10221 <table>
10222 {{{|
10223 <u class="&#124;">}}}} &gt;
10224 <br style="onmouseover=&#39;alert(document.cookie);&#39;" />
10226 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
10227 <tr>
10228 <td></u>
10229 </td>
10230 </tr>
10231 </table>
10233 !! end
10235 # Note: the current result listed for this is not what the original one was,
10236 # but the original bug was JavaScript injection, which is fixed in any case.
10237 # It's not clear that the original result listed was any more correct than the
10238 # current one.  Original result:
10239 # <p>{{{| 
10240 # </p>
10241 # <li class="&#124;&#124;">
10242 # }}}blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
10243 !!test
10244 Fuzz testing: Parser25 (bug 6055)
10245 !! input
10248 <LI CLASS=||
10250 }}}blah" onmouseover="alert('hello world');" align="left"'''MOVE MOUSE CURSOR OVER HERE
10251 !! result
10252 <p>&lt;LI CLASS=blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
10253 </p>
10254 !! end
10256 !!test
10257 Fuzz testing: URL adjacent extension (with space, clean)
10258 !! options
10259 !! input
10260 http://example.com <nowiki>junk</nowiki>
10261 !! result
10262 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a> junk
10263 </p>
10264 !!end
10266 !!test
10267 Fuzz testing: URL adjacent extension (no space, dirty; nowiki)
10268 !! options
10269 !! input
10270 http://example.com<nowiki>junk</nowiki>
10271 !! result
10272 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>junk
10273 </p>
10274 !!end
10276 !!test
10277 Fuzz testing: URL adjacent extension (no space, dirty; pre)
10278 !! options
10279 !! input
10280 http://example.com<pre>junk</pre>
10281 !! result
10282 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a><pre>junk</pre>
10284 !!end
10286 !!test
10287 Fuzz testing: image with bogus manual thumbnail
10288 !!input
10289 [[Image:foobar.jpg|thumbnail= ]]
10290 !!result
10291 <div class="thumb tright"><div class="thumbinner" style="width:182px;">Error creating thumbnail:   <div class="thumbcaption"></div></div></div>
10293 !!end
10295 !! test
10296 Fuzz testing: encoded newline in generated HTML replacements (bug 6577)
10297 !! input
10298 <pre dir="&#10;"></pre>
10299 !! result
10300 <pre dir="&#10;"></pre>
10302 !! end
10304 !! test
10305 Parsing optional HTML elements (Bug 6171)
10306 !! options
10307 !! input
10308 <table>
10309   <tr>
10310     <td> Some tabular data</td>
10311     <td> More tabular data ...
10312     <td> And yet som tabular data</td>
10313   </tr>
10314 </table>
10315 !! result
10316 <table>
10317   <tr>
10318     <td> Some tabular data</td>
10319     <td> More tabular data ...
10320     </td><td> And yet som tabular data</td>
10321   </tr>
10322 </table>
10324 !! end
10326 !! test
10327 Correct handling of <td>, <tr> (Bug 6171)
10328 !! options
10329 !! input
10330 <table>
10331   <tr>
10332     <td> Some tabular data</td>
10333     <td> More tabular data ...</td>
10334     <td> And yet som tabular data</td>
10335   </tr>
10336 </table>
10337 !! result
10338 <table>
10339   <tr>
10340     <td> Some tabular data</td>
10341     <td> More tabular data ...</td>
10342     <td> And yet som tabular data</td>
10343   </tr>
10344 </table>
10346 !! end
10349 !! test
10350 Parsing crashing regression (fr:JavaScript)
10351 !! input
10352 </body></x>
10353 !! result
10354 <p>&lt;/body&gt;&lt;/x&gt;
10355 </p>
10356 !! end
10358 !! test
10359 Inline wiki vs wiki block nesting
10360 !! input
10361 '''Bold paragraph
10363 New wiki paragraph
10364 !! result
10365 <p><b>Bold paragraph</b>
10366 </p><p>New wiki paragraph
10367 </p>
10368 !! end
10370 !! test
10371 Inline HTML vs wiki block nesting
10372 !! options
10373 disabled
10374 !! input
10375 <b>Bold paragraph
10377 New wiki paragraph
10378 !! result
10379 <p><b>Bold paragraph</b>
10380 </p><p>New wiki paragraph
10381 </p>
10382 !! end
10384 # Original result was this:
10385 # <p><b>bold</b><b>bold<i>bolditalics</i></b>
10386 # </p>
10387 # While that might be marginally more intuitive, maybe, the six-apostrophe
10388 # construct is clearly pathological and the result stated here (which is what
10389 # the parser actually does) is about as reasonable as anything.
10390 !!test
10391 Mixing markup for italics and bold
10392 !! options
10393 !! input
10394 '''bold''''''bold''bolditalics'''''
10395 !! result
10396 <p>'<i>bold'</i><b>bold<i>bolditalics</i></b>
10397 </p>
10398 !! end
10401 !! article
10402 Xyzzyx
10403 !! text
10404 Article for special page transclusion test
10405 !! endarticle
10407 !! test
10408 Special page transclusion
10409 !! options
10410 !! input
10411 {{Special:Prefixindex/Xyzzyx}}
10412 !! result
10413 <table id="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
10415 !! end
10417 !! test
10418 Special page transclusion twice (bug 5021)
10419 !! options
10420 !! input
10421 {{Special:Prefixindex/Xyzzyx}}
10422 {{Special:Prefixindex/Xyzzyx}}
10423 !! result
10424 <table id="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
10425 <table id="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
10427 !! end
10429 !! test
10430 Transclusion of default MediaWiki message
10431 !! input
10432 {{MediaWiki:Mainpage}}
10433 !!result
10434 <p>Main Page
10435 </p>
10436 !! end
10438 !! test
10439 Transclusion of nonexistent MediaWiki message
10440 !! input
10441 {{MediaWiki:Mainpagexxx}}
10442 !!result
10443 <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>
10444 </p>
10445 !! end
10447 !! test
10448 Transclusion of MediaWiki message with underscore
10449 !! input
10450 {{MediaWiki:history_short}}
10451 !! result
10452 <p>History
10453 </p>
10454 !! end
10456 !! test
10457 Transclusion of MediaWiki message with space
10458 !! input
10459 {{MediaWiki:history short}}
10460 !! result
10461 <p>History
10462 </p>
10463 !! end
10465 !! test
10466 Invalid header with following text
10467 !! input
10468 = x = y
10469 !! result
10470 <p>= x = y
10471 </p>
10472 !! end
10475 !! test
10476 Section extraction test (section 0)
10477 !! options
10478 section=0
10479 !! input
10480 start
10481 ==a==
10482 ===aa===
10483 ====aaa====
10484 ==b==
10485 ===ba===
10486 ===bb===
10487 ====bba====
10488 ===bc===
10489 ==c==
10490 ===ca===
10491 !! result
10492 start
10493 !! end
10495 !! test
10496 Section extraction test (section 1)
10497 !! options
10498 section=1
10499 !! input
10500 start
10501 ==a==
10502 ===aa===
10503 ====aaa====
10504 ==b==
10505 ===ba===
10506 ===bb===
10507 ====bba====
10508 ===bc===
10509 ==c==
10510 ===ca===
10511 !! result
10512 ==a==
10513 ===aa===
10514 ====aaa====
10515 !! end
10517 !! test
10518 Section extraction test (section 2)
10519 !! options
10520 section=2
10521 !! input
10522 start
10523 ==a==
10524 ===aa===
10525 ====aaa====
10526 ==b==
10527 ===ba===
10528 ===bb===
10529 ====bba====
10530 ===bc===
10531 ==c==
10532 ===ca===
10533 !! result
10534 ===aa===
10535 ====aaa====
10536 !! end
10538 !! test
10539 Section extraction test (section 3)
10540 !! options
10541 section=3
10542 !! input
10543 start
10544 ==a==
10545 ===aa===
10546 ====aaa====
10547 ==b==
10548 ===ba===
10549 ===bb===
10550 ====bba====
10551 ===bc===
10552 ==c==
10553 ===ca===
10554 !! result
10555 ====aaa====
10556 !! end
10558 !! test
10559 Section extraction test (section 4)
10560 !! options
10561 section=4
10562 !! input
10563 start
10564 ==a==
10565 ===aa===
10566 ====aaa====
10567 ==b==
10568 ===ba===
10569 ===bb===
10570 ====bba====
10571 ===bc===
10572 ==c==
10573 ===ca===
10574 !! result
10575 ==b==
10576 ===ba===
10577 ===bb===
10578 ====bba====
10579 ===bc===
10580 !! end
10582 !! test
10583 Section extraction test (section 5)
10584 !! options
10585 section=5
10586 !! input
10587 start
10588 ==a==
10589 ===aa===
10590 ====aaa====
10591 ==b==
10592 ===ba===
10593 ===bb===
10594 ====bba====
10595 ===bc===
10596 ==c==
10597 ===ca===
10598 !! result
10599 ===ba===
10600 !! end
10602 !! test
10603 Section extraction test (section 6)
10604 !! options
10605 section=6
10606 !! input
10607 start
10608 ==a==
10609 ===aa===
10610 ====aaa====
10611 ==b==
10612 ===ba===
10613 ===bb===
10614 ====bba====
10615 ===bc===
10616 ==c==
10617 ===ca===
10618 !! result
10619 ===bb===
10620 ====bba====
10621 !! end
10623 !! test
10624 Section extraction test (section 7)
10625 !! options
10626 section=7
10627 !! input
10628 start
10629 ==a==
10630 ===aa===
10631 ====aaa====
10632 ==b==
10633 ===ba===
10634 ===bb===
10635 ====bba====
10636 ===bc===
10637 ==c==
10638 ===ca===
10639 !! result
10640 ====bba====
10641 !! end
10643 !! test
10644 Section extraction test (section 8)
10645 !! options
10646 section=8
10647 !! input
10648 start
10649 ==a==
10650 ===aa===
10651 ====aaa====
10652 ==b==
10653 ===ba===
10654 ===bb===
10655 ====bba====
10656 ===bc===
10657 ==c==
10658 ===ca===
10659 !! result
10660 ===bc===
10661 !! end
10663 !! test
10664 Section extraction test (section 9)
10665 !! options
10666 section=9
10667 !! input
10668 start
10669 ==a==
10670 ===aa===
10671 ====aaa====
10672 ==b==
10673 ===ba===
10674 ===bb===
10675 ====bba====
10676 ===bc===
10677 ==c==
10678 ===ca===
10679 !! result
10680 ==c==
10681 ===ca===
10682 !! end
10684 !! test
10685 Section extraction test (section 10)
10686 !! options
10687 section=10
10688 !! input
10689 start
10690 ==a==
10691 ===aa===
10692 ====aaa====
10693 ==b==
10694 ===ba===
10695 ===bb===
10696 ====bba====
10697 ===bc===
10698 ==c==
10699 ===ca===
10700 !! result
10701 ===ca===
10702 !! end
10704 !! test
10705 Section extraction test (nonexistent section 11)
10706 !! options
10707 section=11
10708 !! input
10709 start
10710 ==a==
10711 ===aa===
10712 ====aaa====
10713 ==b==
10714 ===ba===
10715 ===bb===
10716 ====bba====
10717 ===bc===
10718 ==c==
10719 ===ca===
10720 !! result
10721 !! end
10723 !! test
10724 Section extraction test with bogus heading (section 1)
10725 !! options
10726 section=1
10727 !! input
10728 ==a==
10729 ==bogus== not a legal section
10730 ==b==
10731 !! result
10732 ==a==
10733 ==bogus== not a legal section
10734 !! end
10736 !! test
10737 Section extraction test with bogus heading (section 2)
10738 !! options
10739 section=2
10740 !! input
10741 ==a==
10742 ==bogus== not a legal section
10743 ==b==
10744 !! result
10745 ==b==
10746 !! end
10748 !! test
10749 Section extraction test with comment after heading (section 1)
10750 !! options
10751 section=1
10752 !! input
10753 ==a==
10754 ==b== <!-- -->
10755 ==c==
10756 !! result
10757 ==a==
10758 !! end
10760 !! test
10761 Section extraction test with comment after heading (section 2)
10762 !! options
10763 section=2
10764 !! input
10765 ==a==
10766 ==b== <!-- -->
10767 ==c==
10768 !! result
10769 ==b== <!-- -->
10770 !! end
10772 !! test
10773 Section extraction test with bogus <nowiki> heading (section 1)
10774 !! options
10775 section=1
10776 !! input
10777 ==a==
10778 ==bogus== <nowiki>not a legal section</nowiki>
10779 ==b==
10780 !! result
10781 ==a==
10782 ==bogus== <nowiki>not a legal section</nowiki>
10783 !! end
10785 !! test
10786 Section extraction test with bogus <nowiki> heading (section 2)
10787 !! options
10788 section=2
10789 !! input
10790 ==a==
10791 ==bogus== <nowiki>not a legal section</nowiki>
10792 ==b==
10793 !! result
10794 ==b==
10795 !! end
10798 # Formerly testing for bug 2587, now resolved by the use of unmarked sections
10799 # instead of respecting commented sections
10800 !! test
10801 Section extraction prefixed by comment (section 1)
10802 !! options
10803 section=1
10804 !! input
10805 <!-- -->==sec1==
10806 ==sec2==
10807 !!result
10808 ==sec2==
10809 !!end
10811 !! test
10812 Section extraction prefixed by comment (section 2)
10813 !! options
10814 section=2
10815 !! input
10816 <!-- -->==sec1==
10817 ==sec2==
10818 !!result
10820 !!end
10823 # Formerly testing for bug 2607, now resolved by the use of unmarked sections
10824 # instead of respecting HTML-style headings
10825 !! test
10826 Section extraction, mixed wiki and html (section 1)
10827 !! options
10828 section=1
10829 !! input
10830 <h2>unmarked</h2>
10831 unmarked
10832 ==1==
10834 ==2==
10836 !! result
10837 ==1==
10839 !! end
10841 !! test
10842 Section extraction, mixed wiki and html (section 2)
10843 !! options
10844 section=2
10845 !! input
10846 <h2>unmarked</h2>
10847 unmarked
10848 ==1==
10850 ==2==
10852 !! result
10853 ==2==
10855 !! end
10858 # Formerly testing for bug 3342
10859 !! test
10860 Section extraction, heading surrounded by <noinclude>
10861 !! options
10862 section=1
10863 !! input
10864 <noinclude>==unmarked==</noinclude>
10865 ==marked==
10866 !! result
10867 ==marked==
10868 !!end
10870 # Test behavior of bug 19910
10871 !! test
10872 Sectiion with all-equals
10873 !! options
10874 section=2
10875 !! input
10876 === 
10877 The line above must have a trailing space
10878 === <!--
10879 --> <!-- -->
10880 But just in case it doesn't...
10881 !! result
10882 === <!--
10883 --> <!-- -->
10884 But just in case it doesn't...
10885 !! end
10887 !! test
10888 Section replacement test (section 0)
10889 !! options
10890 replace=0,"xxx"
10891 !! input
10892 start
10893 ==a==
10894 ===aa===
10895 ====aaa====
10896 ==b==
10897 ===ba===
10898 ===bb===
10899 ====bba====
10900 ===bc===
10901 ==c==
10902 ===ca===
10903 !! result
10906 ==a==
10907 ===aa===
10908 ====aaa====
10909 ==b==
10910 ===ba===
10911 ===bb===
10912 ====bba====
10913 ===bc===
10914 ==c==
10915 ===ca===
10916 !! end
10918 !! test
10919 Section replacement test (section 1)
10920 !! options
10921 replace=1,"xxx"
10922 !! input
10923 start
10924 ==a==
10925 ===aa===
10926 ====aaa====
10927 ==b==
10928 ===ba===
10929 ===bb===
10930 ====bba====
10931 ===bc===
10932 ==c==
10933 ===ca===
10934 !! result
10935 start
10938 ==b==
10939 ===ba===
10940 ===bb===
10941 ====bba====
10942 ===bc===
10943 ==c==
10944 ===ca===
10945 !! end
10947 !! test
10948 Section replacement test (section 2)
10949 !! options
10950 replace=2,"xxx"
10951 !! input
10952 start
10953 ==a==
10954 ===aa===
10955 ====aaa====
10956 ==b==
10957 ===ba===
10958 ===bb===
10959 ====bba====
10960 ===bc===
10961 ==c==
10962 ===ca===
10963 !! result
10964 start
10965 ==a==
10968 ==b==
10969 ===ba===
10970 ===bb===
10971 ====bba====
10972 ===bc===
10973 ==c==
10974 ===ca===
10975 !! end
10977 !! test
10978 Section replacement test (section 3)
10979 !! options
10980 replace=3,"xxx"
10981 !! input
10982 start
10983 ==a==
10984 ===aa===
10985 ====aaa====
10986 ==b==
10987 ===ba===
10988 ===bb===
10989 ====bba====
10990 ===bc===
10991 ==c==
10992 ===ca===
10993 !! result
10994 start
10995 ==a==
10996 ===aa===
10999 ==b==
11000 ===ba===
11001 ===bb===
11002 ====bba====
11003 ===bc===
11004 ==c==
11005 ===ca===
11006 !! end
11008 !! test
11009 Section replacement test (section 4)
11010 !! options
11011 replace=4,"xxx"
11012 !! input
11013 start
11014 ==a==
11015 ===aa===
11016 ====aaa====
11017 ==b==
11018 ===ba===
11019 ===bb===
11020 ====bba====
11021 ===bc===
11022 ==c==
11023 ===ca===
11024 !! result
11025 start
11026 ==a==
11027 ===aa===
11028 ====aaa====
11031 ==c==
11032 ===ca===
11033 !! end
11035 !! test
11036 Section replacement test (section 5)
11037 !! options
11038 replace=5,"xxx"
11039 !! input
11040 start
11041 ==a==
11042 ===aa===
11043 ====aaa====
11044 ==b==
11045 ===ba===
11046 ===bb===
11047 ====bba====
11048 ===bc===
11049 ==c==
11050 ===ca===
11051 !! result
11052 start
11053 ==a==
11054 ===aa===
11055 ====aaa====
11056 ==b==
11059 ===bb===
11060 ====bba====
11061 ===bc===
11062 ==c==
11063 ===ca===
11064 !! end
11066 !! test
11067 Section replacement test (section 6)
11068 !! options
11069 replace=6,"xxx"
11070 !! input
11071 start
11072 ==a==
11073 ===aa===
11074 ====aaa====
11075 ==b==
11076 ===ba===
11077 ===bb===
11078 ====bba====
11079 ===bc===
11080 ==c==
11081 ===ca===
11082 !! result
11083 start
11084 ==a==
11085 ===aa===
11086 ====aaa====
11087 ==b==
11088 ===ba===
11091 ===bc===
11092 ==c==
11093 ===ca===
11094 !! end
11096 !! test
11097 Section replacement test (section 7)
11098 !! options
11099 replace=7,"xxx"
11100 !! input
11101 start
11102 ==a==
11103 ===aa===
11104 ====aaa====
11105 ==b==
11106 ===ba===
11107 ===bb===
11108 ====bba====
11109 ===bc===
11110 ==c==
11111 ===ca===
11112 !! result
11113 start
11114 ==a==
11115 ===aa===
11116 ====aaa====
11117 ==b==
11118 ===ba===
11119 ===bb===
11122 ===bc===
11123 ==c==
11124 ===ca===
11125 !! end
11127 !! test
11128 Section replacement test (section 8)
11129 !! options
11130 replace=8,"xxx"
11131 !! input
11132 start
11133 ==a==
11134 ===aa===
11135 ====aaa====
11136 ==b==
11137 ===ba===
11138 ===bb===
11139 ====bba====
11140 ===bc===
11141 ==c==
11142 ===ca===
11143 !! result
11144 start
11145 ==a==
11146 ===aa===
11147 ====aaa====
11148 ==b==
11149 ===ba===
11150 ===bb===
11151 ====bba====
11154 ==c==
11155 ===ca===
11156 !!end
11158 !! test
11159 Section replacement test (section 9)
11160 !! options
11161 replace=9,"xxx"
11162 !! input
11163 start
11164 ==a==
11165 ===aa===
11166 ====aaa====
11167 ==b==
11168 ===ba===
11169 ===bb===
11170 ====bba====
11171 ===bc===
11172 ==c==
11173 ===ca===
11174 !! result
11175 start
11176 ==a==
11177 ===aa===
11178 ====aaa====
11179 ==b==
11180 ===ba===
11181 ===bb===
11182 ====bba====
11183 ===bc===
11185 !! end
11187 !! test
11188 Section replacement test (section 10)
11189 !! options
11190 replace=10,"xxx"
11191 !! input
11192 start
11193 ==a==
11194 ===aa===
11195 ====aaa====
11196 ==b==
11197 ===ba===
11198 ===bb===
11199 ====bba====
11200 ===bc===
11201 ==c==
11202 ===ca===
11203 !! result
11204 start
11205 ==a==
11206 ===aa===
11207 ====aaa====
11208 ==b==
11209 ===ba===
11210 ===bb===
11211 ====bba====
11212 ===bc===
11213 ==c==
11215 !! end
11217 !! test
11218 Section replacement test with initial whitespace (bug 13728)
11219 !! options
11220 replace=2,"xxx"
11221 !! input
11222  Preformatted initial line
11223 ==a==
11224 ===a===
11225 !! result
11226  Preformatted initial line
11227 ==a==
11229 !! end
11232 !! test
11233 Section extraction, heading followed by pre with 20 spaces (bug 6398)
11234 !! options
11235 section=1
11236 !! input
11237 ==a==
11238                     a
11239 !! result
11240 ==a==
11241                     a
11242 !! end
11244 !! test
11245 Section extraction, heading followed by pre with 19 spaces (bug 6398 sanity check)
11246 !! options
11247 section=1
11248 !! input
11249 ==a==
11250                    a
11251 !! result
11252 ==a==
11253                    a
11254 !! end
11257 !! test
11258 Section extraction, <pre> around bogus header (bug 10309)
11259 !! options
11260 noxml section=2
11261 !! input
11262 == Section One ==
11263 <pre>
11264 =======
11265 </pre>
11267 == Section Two ==
11268 stuff
11269 !! result
11270 == Section Two ==
11271 stuff
11272 !! end
11274 !! test
11275 Section replacement, <pre> around bogus header (bug 10309)
11276 !! options
11277 noxml replace=2,"xxx"
11278 !! input
11279 == Section One ==
11280 <pre>
11281 =======
11282 </pre>
11284 == Section Two ==
11285 stuff
11286 !! result
11287 == Section One ==
11288 <pre>
11289 =======
11290 </pre>
11293 !! end
11297 !! test
11298 Handling of &#x0A; in URLs
11299 !! input
11300 **irc://&#x0A;a
11301 !! result
11302 <ul><li><ul><li><a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a>
11303 </li></ul>
11304 </li></ul>
11306 !!end
11308 !! test
11309 5 quotes, code coverage +1 line (php)
11310 !! options
11312 !! input
11313 '''''
11314 !! result
11315 !! end
11316 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
11317 !! test
11318 5 quotes, code coverage +1 line (parsoid)
11319 !! options
11320 parsoid
11321 !! input
11322 '''''
11323 !! result
11324 <p><i><b></b></i></p>
11325 !! end
11327 !! test
11328 Special:Search page linking.
11329 !! input
11330 {{Special:search}}
11331 !! result
11332 <p><a href="/wiki/Special:Search" title="Special:Search">Special:Search</a>
11333 </p>
11334 !! end
11336 !! test
11337 Say the magic word
11338 !! input
11339 * {{PAGENAME}}
11340 * {{BASEPAGENAME}}
11341 * {{SUBPAGENAME}}
11342 * {{SUBPAGENAMEE}}
11343 * {{ROOTPAGENAME}}
11344 * {{ROOTPAGENAMEE}}
11345 * {{BASEPAGENAME}}
11346 * {{BASEPAGENAMEE}}
11347 * {{TALKPAGENAME}}
11348 * {{TALKPAGENAMEE}}
11349 * {{SUBJECTPAGENAME}}
11350 * {{SUBJECTPAGENAMEE}}
11351 * {{NAMESPACEE}}
11352 * {{NAMESPACE}}
11353 * {{TALKSPACE}}
11354 * {{TALKSPACEE}}
11355 * {{SUBJECTSPACE}}
11356 * {{SUBJECTSPACEE}}
11357 * {{Dynamic|{{NUMBEROFUSERS}}|{{NUMBEROFPAGES}}|{{CURRENTVERSION}}|{{CONTENTLANGUAGE}}|{{DIRECTIONMARK}}|{{CURRENTTIMESTAMP}}|{{NUMBEROFARTICLES}}}}
11358 !! result
11359 <ul><li> Parser test
11360 </li><li> Parser test
11361 </li><li> Parser test
11362 </li><li> Parser_test
11363 </li><li> Parser test
11364 </li><li> Parser_test
11365 </li><li> Parser test
11366 </li><li> Parser_test
11367 </li><li> Talk:Parser test
11368 </li><li> Talk:Parser_test
11369 </li><li> Parser test
11370 </li><li> Parser_test
11371 </li><li> 
11372 </li><li> 
11373 </li><li> Talk
11374 </li><li> Talk
11375 </li><li> 
11376 </li><li> 
11377 </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>
11378 </li></ul>
11380 !! end
11381 ### Note: Above tests excludes the "{{NUMBEROFADMINS}}" magic word because it generates a MySQL error when included.
11383 !! test
11384 Gallery
11385 !! input
11386 <gallery>
11387 image1.png |
11388 image2.gif|||||
11390 image3|
11391 image4    |300px| centre
11392  image5.svg| http://///////
11393 [[x|xx]]]]
11394 * image6
11395 </gallery>
11396 !! result
11397 <ul class="gallery">
11398                 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
11399                         <div style="height: 150px;">Image1.png</div>
11400                         <div class="gallerytext">
11401                         </div>
11402                 </div></li>
11403                 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
11404                         <div style="height: 150px;">Image2.gif</div>
11405                         <div class="gallerytext">
11406 <p>||||
11407 </p>
11408                         </div>
11409                 </div></li>
11410                 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
11411                         <div style="height: 150px;">Image3</div>
11412                         <div class="gallerytext">
11413                         </div>
11414                 </div></li>
11415                 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
11416                         <div style="height: 150px;">Image4</div>
11417                         <div class="gallerytext">
11418 <p>300px| centre
11419 </p>
11420                         </div>
11421                 </div></li>
11422                 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
11423                         <div style="height: 150px;">Image5.svg</div>
11424                         <div class="gallerytext">
11425 <p><a rel="nofollow" class="external free" href="http://///////">http://///////</a>
11426 </p>
11427                         </div>
11428                 </div></li>
11429                 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
11430                         <div style="height: 150px;">* image6</div>
11431                         <div class="gallerytext">
11432                         </div>
11433                 </div></li>
11434 </ul>
11436 !! end
11438 !! test
11439 Gallery (with options)
11440 !! input
11441 <gallery widths='70px' heights='40px' perrow='2' caption='Foo [[Main Page]]' >
11442 File:Nonexistant.jpg|caption
11443 File:Nonexistant.jpg
11444 image:foobar.jpg|some '''caption''' [[Main Page]]
11445 image:foobar.jpg
11446 image:foobar.jpg|Blabla|alt=This is a foo-bar.|blabla.
11447 </gallery>
11448 !! result
11449 <ul class="gallery" style="max-width: 226px;_width: 226px;">
11450         <li class='gallerycaption'>Foo <a href="/wiki/Main_Page" title="Main Page">Main Page</a></li>
11451                 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
11452                         <div style="height: 70px;">Nonexistant.jpg</div>
11453                         <div class="gallerytext">
11454 <p>caption
11455 </p>
11456                         </div>
11457                 </div></li>
11458                 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
11459                         <div style="height: 70px;">Nonexistant.jpg</div>
11460                         <div class="gallerytext">
11461                         </div>
11462                 </div></li>
11463                 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
11464                         <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/thumb/3/3a/Foobar.jpg/70px-Foobar.jpg" width="70" height="8" /></a></div></div>
11465                         <div class="gallerytext">
11466 <p>some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
11467 </p>
11468                         </div>
11469                 </div></li>
11470                 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
11471                         <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/thumb/3/3a/Foobar.jpg/70px-Foobar.jpg" width="70" height="8" /></a></div></div>
11472                         <div class="gallerytext">
11473                         </div>
11474                 </div></li>
11475                 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
11476                         <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/thumb/3/3a/Foobar.jpg/70px-Foobar.jpg" width="70" height="8" /></a></div></div>
11477                         <div class="gallerytext">
11478 <p>Blabla|blabla.
11479 </p>
11480                         </div>
11481                 </div></li>
11482 </ul>
11484 !! end
11486 !! test
11487 Gallery with wikitext inside caption
11488 !! input
11489 <gallery>
11490 File:foobar.jpg|[[File:foobar.jpg|20px|desc|alt=inneralt]]|alt=galleryalt
11491 File:foobar.jpg|{{Test|unamedParam|alt=param}}|alt=galleryalt
11492 </gallery>
11493 !! result
11494 <ul class="gallery">
11495                 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
11496                         <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/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" width="120" height="14" /></a></div></div>
11497                         <div class="gallerytext">
11498 <p><a href="/wiki/File:Foobar.jpg" class="image" title="desc"><img alt="inneralt" src="http://example.com/images/thumb/3/3a/Foobar.jpg/20px-Foobar.jpg" width="20" height="2" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/30px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/40px-Foobar.jpg 2x" /></a>
11499 </p>
11500                         </div>
11501                 </div></li>
11502                 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
11503                         <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/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" width="120" height="14" /></a></div></div>
11504                         <div class="gallerytext">
11505 <p>This is a test template
11506 </p>
11507                         </div>
11508                 </div></li>
11509 </ul>
11511 !! end
11513 !! test
11514 gallery (with showfilename option)
11515 !! input
11516 <gallery showfilename>
11517 File:Nonexistant.jpg|caption
11518 File:Nonexistant.jpg
11519 image:foobar.jpg|some '''caption''' [[Main Page]]
11520 File:Foobar.jpg
11521 </gallery>
11522 !! result
11523 <ul class="gallery">
11524                 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
11525                         <div style="height: 150px;">Nonexistant.jpg</div>
11526                         <div class="gallerytext">
11527 <p><a href="/wiki/File:Nonexistant.jpg" title="File:Nonexistant.jpg">Nonexistant.jpg</a><br />
11528 caption
11529 </p>
11530                         </div>
11531                 </div></li>
11532                 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
11533                         <div style="height: 150px;">Nonexistant.jpg</div>
11534                         <div class="gallerytext">
11535 <p><a href="/wiki/File:Nonexistant.jpg" title="File:Nonexistant.jpg">Nonexistant.jpg</a><br />
11536 </p>
11537                         </div>
11538                 </div></li>
11539                 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
11540                         <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/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" width="120" height="14" /></a></div></div>
11541                         <div class="gallerytext">
11542 <p><a href="/wiki/File:Foobar.jpg" title="File:Foobar.jpg">Foobar.jpg</a><br />
11543 some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
11544 </p>
11545                         </div>
11546                 </div></li>
11547                 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
11548                         <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/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" width="120" height="14" /></a></div></div>
11549                         <div class="gallerytext">
11550 <p><a href="/wiki/File:Foobar.jpg" title="File:Foobar.jpg">Foobar.jpg</a><br />
11551 </p>
11552                         </div>
11553                 </div></li>
11554 </ul>
11556 !! end
11558 !! test
11559 Gallery (with namespace-less filenames)
11560 !! input
11561 <gallery>
11562 File:Nonexistant.jpg
11563 Nonexistant.jpg
11564 image:foobar.jpg
11565 foobar.jpg
11566 </gallery>
11567 !! result
11568 <ul class="gallery">
11569                 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
11570                         <div style="height: 150px;">Nonexistant.jpg</div>
11571                         <div class="gallerytext">
11572                         </div>
11573                 </div></li>
11574                 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
11575                         <div style="height: 150px;">Nonexistant.jpg</div>
11576                         <div class="gallerytext">
11577                         </div>
11578                 </div></li>
11579                 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
11580                         <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/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" width="120" height="14" /></a></div></div>
11581                         <div class="gallerytext">
11582                         </div>
11583                 </div></li>
11584                 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
11585                         <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/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" width="120" height="14" /></a></div></div>
11586                         <div class="gallerytext">
11587                         </div>
11588                 </div></li>
11589 </ul>
11591 !! end
11593 !! test
11594 HTML Hex character encoding (spells the word "JavaScript")
11595 !! input
11596 &#x4A;&#x061;&#x0076;&#x00061;&#x000053;&#x0000063;&#114;&#x0000069;&#00000112;&#x0000000074;
11597 !! result
11598 <p>&#x4a;&#x61;&#x76;&#x61;&#x53;&#x63;&#114;&#x69;&#112;&#x74;
11599 </p>
11600 !! end
11602 !! test
11603 HTML Hex character encoding bogus encoding (bug 26437 regression check)
11604 !! input
11605 &#xsee;&#XSEE;
11606 !! result
11607 <p>&amp;#xsee;&amp;#XSEE;
11608 </p>
11609 !! end
11611 !! test
11612 HTML Hex character encoding mixed case
11613 !! input
11614 &#xEE;&#Xee;
11615 !! result
11616 <p>&#xee;&#xee;
11617 </p>
11618 !! end
11620 !! test
11621 __FORCETOC__ override
11622 !! input
11623 __NEWSECTIONLINK__
11624 __FORCETOC__
11625 !! result
11626 <p><br />
11627 </p>
11628 !! end
11630 !! test
11631 ISBN code coverage
11632 !! input
11633 ISBN  978-0-1234-56&#x20;789
11634 !! result
11635 <p><a href="/wiki/Special:BookSources/9780123456" class="internal mw-magiclink-isbn">ISBN 978-0-1234-56</a>&#x20;789
11636 </p>
11637 !! end
11639 !! test
11640 ISBN followed by 5 spaces
11641 !! input
11642 ISBN    
11643 !! result
11644 <p>ISBN    
11645 </p>
11646 !! end
11648 !! test
11649 Double ISBN
11650 !! input
11651 ISBN ISBN 1234567890
11652 !! result
11653 <p>ISBN <a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
11654 </p>
11655 !! end
11657 !! test
11658 Bug 22905: <abbr> followed by ISBN followed by </a>
11659 !! input
11660 <abbr>(fr)</abbr> ISBN 2753300917 [http://www.example.com example.com]
11661 !! result
11662 <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>
11663 </p>
11664 !! end
11666 !! test
11667 Double RFC
11668 !! input
11669 RFC RFC 1234
11670 !! result
11671 <p>RFC <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc1234">RFC 1234</a>
11672 </p>
11673 !! end
11675 !! test
11676 Double RFC with a wiki link
11677 !! input
11678 RFC [[RFC 1234]]
11679 !! result
11680 <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>
11681 </p>
11682 !! end
11684 !! test
11685 RFC code coverage
11686 !! input
11687 RFC   983&#x20;987
11688 !! result
11689 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc983">RFC 983</a>&#x20;987
11690 </p>
11691 !! end
11693 !! test
11694 Centre-aligned image
11695 !! input
11696 [[Image:foobar.jpg|centre]]
11697 !! result
11698 <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>
11700 !!end
11702 !! test
11703 None-aligned image
11704 !! input
11705 [[Image:foobar.jpg|none]]
11706 !! result
11707 <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>
11709 !!end
11711 !! test
11712 Width + Height sized image (using px) (height is ignored)
11713 !! input
11714 [[Image:foobar.jpg|640x480px]]
11715 !! result
11716 <p><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/640px-Foobar.jpg" width="640" height="73" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/960px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/1280px-Foobar.jpg 2x" /></a>
11717 </p>
11718 !!end
11720 !! test
11721 Width-sized image (using px, no following whitespace)
11722 !! input
11723 [[Image:foobar.jpg|640px]]
11724 !! result
11725 <p><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/640px-Foobar.jpg" width="640" height="73" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/960px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/1280px-Foobar.jpg 2x" /></a>
11726 </p>
11727 !!end
11729 !! test
11730 Width-sized image (using px, with following whitespace - test regression from r39467)
11731 !! input
11732 [[Image:foobar.jpg|640px ]]
11733 !! result
11734 <p><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/640px-Foobar.jpg" width="640" height="73" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/960px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/1280px-Foobar.jpg 2x" /></a>
11735 </p>
11736 !!end
11738 !! test
11739 Width-sized image (using px, with preceding whitespace - test regression from r39467)
11740 !! input
11741 [[Image:foobar.jpg| 640px]]
11742 !! result
11743 <p><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/640px-Foobar.jpg" width="640" height="73" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/960px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/1280px-Foobar.jpg 2x" /></a>
11744 </p>
11745 !!end
11747 !! test
11748 Another italics / bold test
11749 !! input
11750  ''' ''x'
11751 !! result
11752 <pre>'<i> </i>x'
11753 </pre>
11754 !!end
11756 # Note the results may be incorrect, as parserTest output included this:
11757 # XML error: Mismatched tag at byte 6120:
11758 # ...<dd> </dt></dl> </dd...
11759 !! test
11760 dt/dd/dl test
11761 !! options
11762 disabled
11763 !! input
11764 :;;;::
11765 !! result
11766 <dl><dd><dl><dt><dl><dt><dl><dt><dl><dd><dl><dd>
11767 </dd></dl>
11768 </dd></dl>
11769 </dt></dl>
11770 </dt></dl>
11771 </dt></dl>
11772 </dd></dl>
11774 !!end
11777 # Images with the "|" character in external URLs in comment tags; Eats half the comment, leaves unmatched "</a>" tag.
11778 !! test
11779 Images with the "|" character in the comment
11780 !! input
11781 [[image:Foobar.jpg|thumb|An [http://test/?param1=|left|&param2=|x external] URL]]
11782 !! result
11783 <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/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></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>
11785 !!end
11787 !! test
11788 [Before] HTML without raw HTML enabled ($wgRawHtml==false)
11789 !! input
11790 <html><script>alert(1);</script></html>
11791 !! result
11792 <p>&lt;html&gt;&lt;script&gt;alert(1);&lt;/script&gt;&lt;/html&gt;
11793 </p>
11794 !! end
11796 !! test
11797 HTML with raw HTML ($wgRawHtml==true)
11798 !! options
11799 rawhtml
11800 !! input
11801 <html><script>alert(1);</script></html>
11802 !! result
11803 <p><script>alert(1);</script>
11804 </p>
11805 !! end
11807 !! test
11808 Parents of subpages, one level up
11809 !! options
11810 subpage title=[[Subpage test/L1/L2/L3]]
11811 !! input
11812 [[../|L2]]
11813 !! result
11814 <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>
11815 </p>
11816 !! end
11819 !! test
11820 Parents of subpages, one level up, not named
11821 !! options
11822 subpage title=[[Subpage test/L1/L2/L3]]
11823 !! input
11824 [[../]]
11825 !! result
11826 <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>
11827 </p>
11828 !! end
11832 !! test
11833 Parents of subpages, two levels up
11834 !! options
11835 subpage title=[[Subpage test/L1/L2/L3]]
11836 !! input
11837 [[../../|L1]]2
11839 [[../../|L1]]l
11840 !! result
11841 <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
11842 </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>
11843 </p>
11844 !! end
11846 !! test
11847 Parents of subpages, two levels up, without trailing slash or name.
11848 !! options
11849 subpage title=[[Subpage test/L1/L2/L3]]
11850 !! input
11851 [[../..]]
11852 !! result
11853 <p>[[../..]]
11854 </p>
11855 !! end
11857 !! test
11858 Parents of subpages, two levels up, with lots of extra trailing slashes.
11859 !! options
11860 subpage title=[[Subpage test/L1/L2/L3]]
11861 !! input
11862 [[../../////]]
11863 !! result
11864 <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>
11865 </p>
11866 !! end
11868 !! test
11869 Definition list code coverage
11870 !! input
11871 ; title   : def
11872 ; title : def
11873 ;title: def
11874 !! result
11875 <dl><dt> title  &#160;</dt><dd> def
11876 </dd><dt> title&#160;</dt><dd> def
11877 </dd><dt>title</dt><dd> def
11878 </dd></dl>
11880 !! end
11882 !! test
11883 Don't fall for the self-closing div
11884 !! input
11885 <div>hello world</div/>
11886 !! result
11887 <div>hello world</div>
11889 !! end
11891 !! test
11892 MSGNW magic word
11893 !! input
11894 {{MSGNW:msg}}
11895 !! result
11896 <p>&#91;&#91;:Template:Msg&#93;&#93;
11897 </p>
11898 !! end
11900 !! test
11901 RAW magic word
11902 !! input
11903 {{RAW:QUERTY}}
11904 !! result
11905 <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>
11906 </p>
11907 !! end
11909 # This isn't needed for XHTML conformance, but would be handy as a fallback security measure
11910 !! test
11911 Always escape literal '>' in output, not just after '<'
11912 !! input
11914 !! result
11915 <p>&gt;&lt;&gt;
11916 </p>
11917 !! end
11919 !! test
11920 Template caching
11921 !! input
11922 {{Test}}
11923 {{Test}}
11924 !! result
11925 <p>This is a test template
11926 This is a test template
11927 </p>
11928 !! end
11931 !! article
11932 MediaWiki:Fake
11933 !! text
11934 ==header==
11935 !! endarticle
11937 !! test
11938 Inclusion of !userCanEdit() content
11939 !! input
11940 {{MediaWiki:Fake}}
11941 !! result
11942 <h2><span class="mw-headline" id="header">header</span><span class="mw-editsection">[<a href="/index.php?title=MediaWiki:Fake&amp;action=edit&amp;section=T-1" title="MediaWiki:Fake">edit</a>]</span></h2>
11944 !! end
11947 !! test
11948 Out-of-order TOC heading levels
11949 !! input
11950 ==2==
11951 ======6======
11952 ===3===
11954 =====5=====
11955 ==2==
11956 !! result
11957 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
11958 <ul>
11959 <li class="toclevel-1 tocsection-1"><a href="#2"><span class="tocnumber">1</span> <span class="toctext">2</span></a>
11960 <ul>
11961 <li class="toclevel-2 tocsection-2"><a href="#6"><span class="tocnumber">1.1</span> <span class="toctext">6</span></a></li>
11962 <li class="toclevel-2 tocsection-3"><a href="#3"><span class="tocnumber">1.2</span> <span class="toctext">3</span></a></li>
11963 </ul>
11964 </li>
11965 <li class="toclevel-1 tocsection-4"><a href="#1"><span class="tocnumber">2</span> <span class="toctext">1</span></a>
11966 <ul>
11967 <li class="toclevel-2 tocsection-5"><a href="#5"><span class="tocnumber">2.1</span> <span class="toctext">5</span></a></li>
11968 <li class="toclevel-2 tocsection-6"><a href="#2_2"><span class="tocnumber">2.2</span> <span class="toctext">2</span></a></li>
11969 </ul>
11970 </li>
11971 </ul>
11972 </td></tr></table>
11973 <h2><span class="mw-headline" id="2">2</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: 2">edit</a>]</span></h2>
11974 <h6><span class="mw-headline" id="6">6</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: 6">edit</a>]</span></h6>
11975 <h3><span class="mw-headline" id="3">3</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=3" title="Edit section: 3">edit</a>]</span></h3>
11976 <h1><span class="mw-headline" id="1">1</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=4" title="Edit section: 1">edit</a>]</span></h1>
11977 <h5><span class="mw-headline" id="5">5</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=5" title="Edit section: 5">edit</a>]</span></h5>
11978 <h2><span class="mw-headline" id="2_2">2</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=6" title="Edit section: 2">edit</a>]</span></h2>
11980 !! end
11983 !! test
11984 ISBN with a dummy number
11985 !! input
11986 ISBN ---
11987 !! result
11988 <p>ISBN ---
11989 </p>
11990 !! end
11993 !! test
11994 ISBN with space-delimited number
11995 !! input
11996 ISBN 92 9017 032 8
11997 !! result
11998 <p><a href="/wiki/Special:BookSources/9290170328" class="internal mw-magiclink-isbn">ISBN 92 9017 032 8</a>
11999 </p>
12000 !! end
12003 !! test
12004 ISBN with multiple spaces, no number
12005 !! input
12006 ISBN  foo
12007 !! result
12008 <p>ISBN  foo
12009 </p>
12010 !! end
12013 !! test
12014 ISBN length
12015 !! input
12016 ISBN 123456789
12018 ISBN 1234567890
12020 ISBN 12345678901
12021 !! result
12022 <p>ISBN 123456789
12023 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
12024 </p><p>ISBN 12345678901
12025 </p>
12026 !! end
12029 !! test
12030 ISBN with trailing year (bug 8110)
12031 !! input
12032 ISBN 1-234-56789-0 - 2006
12034 ISBN 1 234 56789 0 - 2006
12035 !! result
12036 <p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1-234-56789-0</a> - 2006
12037 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1 234 56789 0</a> - 2006
12038 </p>
12039 !! end
12042 !! test
12043 anchorencode
12044 !! input
12045 {{anchorencode:foo bar©#%n}}
12046 !! result
12047 <p>foo_bar.C2.A9.23.25n
12048 </p>
12049 !! end
12051 !! test
12052 anchorencode trims spaces
12053 !! input
12054 {{anchorencode: __pretty__please__}}
12055 !! result
12056 <p>pretty_please
12057 </p>
12058 !! end
12060 !! test
12061 anchorencode deals with links
12062 !! input
12063 {{anchorencode: [[hello|world]] [[hi]]}}
12064 !! result
12065 <p>world_hi
12066 </p>
12067 !! end
12069 !! test
12070 anchorencode deals with templates
12071 !! input
12072 {{anchorencode: {{Foo}} }}
12073 !! result
12074 <p>FOO
12075 </p>
12076 !! end
12078 !! test
12079 anchorencode encodes like the TOC generator: (bug 18431)
12080 !! input
12081 === _ +:.3A%3A&&amp;]] ===
12082 {{anchorencode: _ +:.3A%3A&&amp;]] }}
12083 __NOEDITSECTION__
12084 !! result
12085 <h3><span class="mw-headline" id=".2B:.3A.253A.26.26.5D.5D">_ +:.3A%3A&amp;&amp;]]</span></h3>
12086 <p>.2B:.3A.253A.26.26.5D.5D
12087 </p>
12088 !! end
12090 # Expected output in the following test is not necessarily expected (there
12091 # should probably be <p> tags inside the <blockquote> in the output) -- it's
12092 # only testing for well-formedness.
12093 !! test
12094 Bug 6200: blockquotes and paragraph formatting
12095 !! input
12096 <blockquote>
12098 </blockquote>
12102  baz
12103 !! result
12104 <blockquote>
12106 </blockquote>
12107 <p>bar
12108 </p>
12109 <pre>baz
12110 </pre>
12111 !! end
12113 !! test
12114 Bug 8293: Use of center tag ruins paragraph formatting
12115 !! input
12116 <center>
12118 </center>
12122  baz
12123 !! result
12124 <center>
12125 <p>foo
12126 </p>
12127 </center>
12128 <p>bar
12129 </p>
12130 <pre>baz
12131 </pre>
12132 !! end
12134 !!test
12135 Parsing of overlapping (improperly nested) inline html tags (PHP parser)
12136 !!options
12138 !!input
12139 <span><s>x</span></s>
12140 !!result
12141 <p><span><s>x&lt;/span&gt;</s></span>
12142 </p>
12143 !!end
12145 !!test
12146 Parsing of overlapping (improperly nested) inline html tags (Parsoid)
12147 !!options
12148 parsoid
12149 !!input
12150 <span><s>x</span></s>
12151 !!result
12152 <p><span><s>x</s></span><s></s>
12153 </p>
12154 !!end
12157 ### Language variants related tests
12159 !! test
12160 Self-link in language variants
12161 !! options
12162 title=[[Dunav]] language=sr
12163 !! input
12164 Both [[Dunav]] and [[Дунав]] are names for this river.
12165 !! result
12166 <p>Both <strong class="selflink">Dunav</strong> and <strong class="selflink">Дунав</strong> are names for this river.
12167 </p>
12168 !!end
12170 !! article
12171 Дуна
12172 !! text
12173 content
12174 !! endarticle
12176 !! test
12177 Link to another existing title shouldn't be parsed as self-link even if it's a variant of this title
12178 !! options
12179 title=[[Duna]] language=sr
12180 !! input
12181 [[Дуна]] is not a self-link while [[Duna]] and [[Dуна]] are still self-links.
12182 !! result
12183 <p><a href="/wiki/%D0%94%D1%83%D0%BD%D0%B0" title="Дуна">Дуна</a> is not a self-link while <strong class="selflink">Duna</strong> and <strong class="selflink">Dуна</strong> are still self-links.
12184 </p>
12185 !! end
12187 !! test
12188 Link to pages in language variants
12189 !! options
12190 language=sr
12191 !! input
12192 Main Page can be written as [[Маин Паге]]
12193 !! result
12194 <p>Main Page can be written as <a href="/wiki/Main_Page" title="Main Page">Маин Паге</a>
12195 </p>
12196 !!end
12199 !! test
12200 Multiple links to pages in language variants
12201 !! options
12202 language=sr
12203 !! input
12204 [[Main Page]] can be written as [[Маин Паге]] same as [[Маин Паге]].
12205 !! result
12206 <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>.
12207 </p>
12208 !!end
12211 !! test
12212 Simple template in language variants
12213 !! options
12214 language=sr
12215 !! input
12216 {{тест}}
12217 !! result
12218 <p>This is a test template
12219 </p>
12220 !! end
12223 !! test
12224 Template with explicit namespace in language variants
12225 !! options
12226 language=sr
12227 !! input
12228 {{Template:тест}}
12229 !! result
12230 <p>This is a test template
12231 </p>
12232 !! end
12235 !! test
12236 Basic test for template parameter in language variants
12237 !! options
12238 language=sr
12239 !! input
12240 {{парамтест|param=foo}}
12241 !! result
12242 <p>This is a test template with parameter foo
12243 </p>
12244 !! end
12247 !! test
12248 Simple category in language variants
12249 !! options
12250 language=sr cat
12251 !! input
12252 [[Category:МедиаWики Усер'с Гуиде]]
12253 !! result
12254 <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>
12255 !! end
12258 !! article
12259 Category:分类
12260 !! text
12261 blah
12262 !! endarticle
12264 !! article
12265 Category:分類
12266 !! text
12267 blah
12268 !! endarticle
12270 !! test
12271 Don't convert blue categorylinks to another variant (bug 33210)
12272 !! options
12273 language=zh cat
12274 !! input
12275 [[A]][[Category:分类]]
12276 !! result
12277 <a href="/wiki/Category:%E5%88%86%E7%B1%BB" title="Category:分类">分类</a>
12278 !! end
12281 !! test
12282 Stripping -{}- tags (language variants)
12283 !! options
12284 language=sr
12285 !! input
12286 Latin proverb: -{Ne nuntium necare}-
12287 !! result
12288 <p>Latin proverb: Ne nuntium necare
12289 </p>
12290 !! end
12293 !! test
12294 Prevent conversion with -{}- tags (language variants)
12295 !! options
12296 language=sr variant=sr-ec
12297 !! input
12298 Latinski: -{Ne nuntium necare}-
12299 !! result
12300 <p>Латински: Ne nuntium necare
12301 </p>
12302 !! end
12305 !! test
12306 Prevent conversion of text with -{}- tags (language variants)
12307 !! options
12308 language=sr variant=sr-ec
12309 !! input
12310 Latinski: -{Ne nuntium necare}-
12311 !! result
12312 <p>Латински: Ne nuntium necare
12313 </p>
12314 !! end
12317 !! test
12318 Prevent conversion of links with -{}- tags (language variants)
12319 !! options
12320 language=sr variant=sr-ec
12321 !! input
12322 -{[[Main Page]]}-
12323 !! result
12324 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
12325 </p>
12326 !! end
12329 !! test
12330 -{}- tags within headlines (within html for parserConvert())
12331 !! options
12332 language=sr variant=sr-ec
12333 !! input
12334 == -{Naslov}- ==
12335 !! result
12336 <h2><span class="mw-headline" id="-.7BNaslov.7D-">Naslov</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Уредите одељак „Naslov“">уреди</a>]</span></h2>
12338 !! end
12341 !! test
12342 Explicit definition of language variant alternatives
12343 !! options
12344 language=zh variant=zh-tw
12345 !! input
12346 -{zh:China;zh-tw:Taiwan}-, not China
12347 !! result
12348 <p>Taiwan, not China
12349 </p>
12350 !! end
12353 !! test
12354 Conversion around HTML tags
12355 !! options
12356 language=sr variant=sr-ec
12357 !! input
12358 -{H|span=>sr-ec:script;title=>sr-ec:src;}-
12359 <span title="La-{sr-el:L;sr-ec:C;}-tin">ski</span>
12360 !! result
12362 <span title="ЛаCтин">ски</span>
12363 </p>
12364 !! end
12367 !! test
12368 Explicit session-wise language variant mapping (A flag and - flag)
12369 !! options
12370 language=zh variant=zh-tw
12371 !! input
12372 Taiwan is not China.
12373 But -{A|zh:China;zh-tw:Taiwan}- is China,
12374 (This-{-|zh:China;zh-tw:Taiwan}- should be stripped!)
12375 and -{China}- is China.
12376 !! result
12377 <p>Taiwan is not China.
12378 But Taiwan is Taiwan,
12379 (This should be stripped!)
12380 and China is China.
12381 </p>
12382 !! end
12384 !! test
12385 Explicit session-wise language variant mapping (H flag for hide)
12386 !! options
12387 language=zh variant=zh-tw
12388 !! input
12389 (This-{H|zh:China;zh-tw:Taiwan}- should be stripped!)
12390 Taiwan is China.
12391 !! result
12392 <p>(This should be stripped!)
12393 Taiwan is Taiwan.
12394 </p>
12395 !! end
12397 !! test
12398 Adding explicit conversion rule for title (T flag)
12399 !! options
12400 language=zh variant=zh-tw showtitle
12401 !! input
12402 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
12403 !! result
12404 Taiwan
12405 <p>Should be stripped!
12406 </p>
12407 !! end
12409 !! test
12410 Testing that changing the language variant here in the tests actually works
12411 !! options
12412 language=zh variant=zh showtitle
12413 !! input
12414 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
12415 !! result
12416 China
12417 <p>Should be stripped!
12418 </p>
12419 !! end
12421 !! test
12422 Recursive conversion of alt and title attrs shouldn't clear converter state
12423 !! options
12424 language=zh variant=zh-cn showtitle
12425 !! input
12426 -{H|zh-cn:Exclamation;zh-tw:exclamation;}-
12427 Should be stripped-{T|zh-cn:China;zh-tw:Taiwan}-<span title="exclamation">!</span>
12428 !! result
12429 China
12431 Should be stripped<span title="Exclamation">!</span>
12432 </p>
12433 !! end
12435 !! test
12436 Bug 24072: more test on conversion rule for title
12437 !! options
12438 language=zh variant=zh-tw showtitle
12439 !! input
12440 This should be stripped-{T|zh:China;zh-tw:Taiwan}-!
12441 This won't take interferes with the title rule-{H|zh:Beijing;zh-tw:Taipei}-.
12442 !! result
12443 Taiwan
12444 <p>This should be stripped!
12445 This won't take interferes with the title rule.
12446 </p>
12447 !! end
12449 !! test
12450 Partly disable title conversion if variant == main language code
12451 !! options
12452 language=zh variant=zh title=[[ZH]] showtitle
12453 !! input
12454 -{T|zh-cn:CN;zh-tw:TW}-
12455 !! result
12458 </p>
12459 !! end
12461 !! test
12462 Partly disable title conversion if variant == main language code, more
12463 !! options
12464 language=zh variant=zh title=[[ZH]] showtitle
12465 !! input
12466 -{T|TW}-
12467 !! result
12470 </p>
12471 !! end
12473 !! test
12474 Raw output of variant escape tags (R flag)
12475 !! options
12476 language=zh variant=zh-tw
12477 !! input
12478 Raw: -{R|zh:China;zh-tw:Taiwan}-
12479 !! result
12480 <p>Raw: zh:China;zh-tw:Taiwan
12481 </p>
12482 !! end
12484 !! test
12485 Nested using of manual convert syntax
12486 !! options
12487 language=zh variant=zh-hk
12488 !! input
12489 Nested: -{zh-hans:Hi -{zh-cn:China;zh-sg:Singapore;}-;zh-hant:Hello -{zh-tw:Taiwan;zh-hk:H-{ong}- K-{}-ong;}-;}-!
12490 !! result
12491 <p>Nested: Hello Hong Kong!
12492 </p>
12493 !! end
12495 !! test
12496 Proper conversion of text in external links
12497 !! options
12498 language=sr variant=sr-ec
12499 !! input
12500 http://www.google.com
12501 gopher://www.google.com
12502 [http://www.google.com http://www.google.com]
12503 [gopher://www.google.com gopher://www.google.com]
12504 [https://www.google.com irc://www.google.com]
12505 [ftp://www.google.com www.google.com/ftp://dir]
12506 [//www.google.com www.google.com]
12507 !! result
12508 <p><a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
12509 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
12510 <a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
12511 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
12512 <a rel="nofollow" class="external text" href="https://www.google.com">irc://www.google.com</a>
12513 <a rel="nofollow" class="external text" href="ftp://www.google.com">www.гоогле.цом/фтп://дир</a>
12514 <a rel="nofollow" class="external text" href="//www.google.com">www.гоогле.цом</a>
12515 </p>
12516 !! end
12518 !! test
12519 Do not convert roman numbers to language variants
12520 !! options
12521 language=sr variant=sr-ec
12522 !! input
12523 Fridrih IV je car.
12524 !! result
12525 <p>Фридрих IV је цар.
12526 </p>
12527 !! end
12529 !! test
12530 Unclosed language converter markup "-{"
12531 !! options
12532 language=sr
12533 !! input
12534 -{T|hello
12535 !! result
12536 <p>-{T|hello
12537 </p>
12538 !! end
12540 !! test
12541 Don't convert raw rule "-{R|=&gt;}-" to "=>"
12542 !! options
12543 language=sr
12544 !! input
12545 -{R|=&gt;}-
12546 !! result
12547 <p>=&gt;
12548 </p>
12549 !!end
12551 !!article
12552 Template:Bullet
12553 !!text
12554 * Bar
12555 !!endarticle
12557 !! test
12558 Bug 529: Uncovered bullet
12559 !! input
12560 * Foo {{bullet}}
12561 !! result
12562 <ul><li> Foo 
12563 </li><li> Bar
12564 </li></ul>
12566 !! end
12568 # Plain MediaWiki does not remove empty lists, but tidy actually does.
12569 # Templates in Wikipedia rely on this behavior, as tidy has always been
12570 # enabled there. These tests are normally run *without* tidy, so specify the
12571 # full output here. 
12572 # To test realistic parsing behavior, apply a tidy-like transformation to both
12573 # the expected output and your parser's output.
12574 !! test
12575 Bug 529: Uncovered bullet leaving empty list, normally removed by tidy
12576 !! input
12577 ******* Foo {{bullet}}
12578 !! result
12579 <ul><li><ul><li><ul><li><ul><li><ul><li><ul><li><ul><li> Foo 
12580 </li></ul>
12581 </li></ul>
12582 </li></ul>
12583 </li></ul>
12584 </li></ul>
12585 </li></ul>
12586 </li><li> Bar
12587 </li></ul>
12589 !! end
12591 !! test
12592 Bug 529: Uncovered table already at line-start
12593 !! input
12596 {{table}}
12598 !! result
12599 <p>x
12600 </p>
12601 <table>
12602 <tr>
12603 <td> 1 </td>
12604 <td> 2
12605 </td></tr>
12606 <tr>
12607 <td> 3 </td>
12608 <td> 4
12609 </td></tr></table>
12610 <p>y
12611 </p>
12612 !! end
12614 !! test
12615 Bug 529: Uncovered bullet in parser function result
12616 !! input
12617 * Foo {{lc:{{bullet}} }}
12618 !! result
12619 <ul><li> Foo 
12620 </li><li> bar
12621 </li></ul>
12623 !! end
12625 !! test
12626 Bug 5678: Double-parsed template argument
12627 !! input
12628 {{lc:{{{1}}}|hello}}
12629 !! result
12630 <p>{{{1}}}
12631 </p>
12632 !! end
12634 !! test
12635 Bug 5678: Double-parsed template invocation
12636 !! input
12637 {{lc:{{paramtest {{!}} param = hello }} }}
12638 !! result
12639 <p>{{paramtest | param = hello }}
12640 </p>
12641 !! end
12643 !! test
12644 Case insensitivity of parser functions for non-ASCII characters (bug 8143)
12645 !! options
12646 language=cs
12647 title=[[Main Page]]
12648 !! input
12649 {{PRVNÍVELKÉ:ěščř}}
12650 {{prvnívelké:ěščř}}
12651 {{PRVNÍMALÉ:ěščř}}
12652 {{prvnímalé:ěščř}}
12653 {{MALÁ:ěščř}}
12654 {{malá:ěščř}}
12655 {{VELKÁ:ěščř}}
12656 {{velká:ěščř}}
12657 !! result
12658 <p>Ěščř
12659 Ěščř
12660 ěščř
12661 ěščř
12662 ěščř
12663 ěščř
12664 ĚŠČŘ
12665 ĚŠČŘ
12666 </p>
12667 !! end
12669 !! test
12670 Morwen/13: Unclosed link followed by heading
12671 !! input
12672 [[link
12673 ==heading==
12674 !! result
12675 <p>[[link
12676 </p>
12677 <h2><span class="mw-headline" id="heading">heading</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: heading">edit</a>]</span></h2>
12679 !! end
12681 !! test
12682 HHP2.1: Heuristics for headings in preprocessor parenthetical structures
12683 !! input
12684 {{foo|
12685 =heading=
12686 !! result
12687 <p>{{foo|
12688 </p>
12689 <h1><span class="mw-headline" id="heading">heading</span></h1>
12691 !! end
12693 !! test
12694 HHP2.2: Heuristics for headings in preprocessor parenthetical structures
12695 !! input
12696 {{foo|
12697 ==heading==
12698 !! result
12699 <p>{{foo|
12700 </p>
12701 <h2><span class="mw-headline" id="heading">heading</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: heading">edit</a>]</span></h2>
12703 !! end
12705 !! test
12706 Tildes in comments
12707 !! options
12709 !! input
12710 <!-- ~~~~ -->
12711 !! result
12712 <!-- ~~~~ -->
12713 !! end
12715 !! test
12716 Paragraphs inside divs (no extra line breaks)
12717 !! input
12718 <div>Line one
12720 Line two</div>
12721 !! result
12722 <div>Line one
12723 Line two</div>
12725 !! end
12727 !! test
12728 Paragraphs inside divs (extra line break on open)
12729 !! input
12730 <div>
12731 Line one
12733 Line two</div>
12734 !! result
12735 <div>
12736 <p>Line one
12737 </p>
12738 Line two</div>
12740 !! end
12742 !! test
12743 Paragraphs inside divs (extra line break on close)
12744 !! input
12745 <div>Line one
12747 Line two
12748 </div>
12749 !! result
12750 <div>Line one
12751 <p>Line two
12752 </p>
12753 </div>
12755 !! end
12757 !! test
12758 Paragraphs inside divs (extra line break on open and close)
12759 !! input
12760 <div>
12761 Line one
12763 Line two
12764 </div>
12765 !! result
12766 <div>
12767 <p>Line one
12768 </p><p>Line two
12769 </p>
12770 </div>
12772 !! end
12774 !! test
12775 Nesting tags, paragraphs on lines which begin with <div>
12776 !! options
12777 disabled
12778 !! input
12779 <div></div><strong>A
12780 B</strong>
12781 !! result
12782 <div></div>
12783 <p><strong>A
12784 B</strong>
12785 </p>
12786 !! end
12788 # Bug 6200: <blockquote> should behave like <div> with respect to line breaks
12789 !! test
12790 Bug 6200: paragraphs inside blockquotes (no extra line breaks)
12791 !! options
12792 disabled
12793 !! input
12794 <blockquote>Line one
12796 Line two</blockquote>
12797 !! result
12798 <blockquote>Line one
12799 Line two</blockquote>
12801 !! end
12803 !! test
12804 Bug 6200: paragraphs inside blockquotes (extra line break on open)
12805 !! options
12806 disabled
12807 !! input
12808 <blockquote>
12809 Line one
12811 Line two</blockquote>
12812 !! result
12813 <blockquote>
12814 <p>Line one
12815 </p>
12816 Line two</blockquote>
12818 !! end
12820 !! test
12821 Bug 6200: paragraphs inside blockquotes (extra line break on close)
12822 !! options
12823 disabled
12824 !! input
12825 <blockquote>Line one
12827 Line two
12828 </blockquote>
12829 !! result
12830 <blockquote>Line one
12831 <p>Line two
12832 </p>
12833 </blockquote>
12835 !! end
12837 !! test
12838 Bug 6200: paragraphs inside blockquotes (extra line break on open and close)
12839 !! options
12840 disabled
12841 !! input
12842 <blockquote>
12843 Line one
12845 Line two
12846 </blockquote>
12847 !! result
12848 <blockquote>
12849 <p>Line one
12850 </p><p>Line two
12851 </p>
12852 </blockquote>
12854 !! end
12856 !! test
12857 Paragraphs inside blockquotes/divs (no extra line breaks)
12858 !! input
12859 <blockquote><div>Line one
12861 Line two</div></blockquote>
12862 !! result
12863 <blockquote><div>Line one
12864 Line two</div></blockquote>
12866 !! end
12868 !! test
12869 Paragraphs inside blockquotes/divs (extra line break on open)
12870 !! input
12871 <blockquote><div>
12872 Line one
12874 Line two</div></blockquote>
12875 !! result
12876 <blockquote><div>
12877 <p>Line one
12878 </p>
12879 Line two</div></blockquote>
12881 !! end
12883 !! test
12884 Paragraphs inside blockquotes/divs (extra line break on close)
12885 !! input
12886 <blockquote><div>Line one
12888 Line two
12889 </div></blockquote>
12890 !! result
12891 <blockquote><div>Line one
12892 <p>Line two
12893 </p>
12894 </div></blockquote>
12896 !! end
12898 !! test
12899 Paragraphs inside blockquotes/divs (extra line break on open and close)
12900 !! input
12901 <blockquote><div>
12902 Line one
12904 Line two
12905 </div></blockquote>
12906 !! result
12907 <blockquote><div>
12908 <p>Line one
12909 </p><p>Line two
12910 </p>
12911 </div></blockquote>
12913 !! end
12915 !! test
12916 Interwiki links trounced by replaceExternalLinks after early LinkHolderArray expansion
12917 !! options
12918 wgLinkHolderBatchSize=0
12919 !! input
12920 [[meatball:1]]
12921 [[meatball:2]]
12922 [[meatball:3]]
12923 !! result
12924 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?1" class="extiw" title="meatball:1">meatball:1</a>
12925 <a href="http://www.usemod.com/cgi-bin/mb.pl?2" class="extiw" title="meatball:2">meatball:2</a>
12926 <a href="http://www.usemod.com/cgi-bin/mb.pl?3" class="extiw" title="meatball:3">meatball:3</a>
12927 </p>
12928 !! end
12930 !! test
12931 Free external link invading image caption
12932 !! input
12933 [[Image:Foobar.jpg|thumb|http://x|hello]]
12934 !! result
12935 <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/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></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>
12937 !! end
12939 !! test
12940 Bug 15196: localised external link numbers
12941 !! options
12942 language=fa
12943 !! input
12944 [http://en.wikipedia.org/]
12945 !! result
12946 <p><a rel="nofollow" class="external autonumber" href="http://en.wikipedia.org/">[۱]</a>
12947 </p>
12948 !! end
12950 !! test
12951 Multibyte character in padleft
12952 !! input
12953 {{padleft:-Hello|7|Æ}}
12954 !! result
12955 <p>Æ-Hello
12956 </p>
12957 !! end
12959 !! test
12960 Multibyte character in padright
12961 !! input
12962 {{padright:Hello-|7|Æ}}
12963 !! result
12964 <p>Hello-Æ
12965 </p>
12966 !! end
12968 !!test
12969 formatdate parser function
12970 !!input
12971 {{#formatdate:2009-03-24}}
12972 !! result
12973 <p><span class="mw-formatted-date" title="2009-03-24">2009-03-24</span>
12974 </p>
12975 !! end
12977 !!test
12978 formatdate parser function, with default format
12979 !!input
12980 {{#formatdate:2009-03-24|mdy}}
12981 !! result
12982 <p><span class="mw-formatted-date" title="2009-03-24">March 24, 2009</span>
12983 </p>
12984 !! end
12986 !! test
12987 Spacing of numbers in formatted dates
12988 !! input
12989 {{#formatdate:January 15}}
12990 !! result
12991 <p><span class="mw-formatted-date" title="01-15">January 15</span>
12992 </p>
12993 !! end
12995 !! test
12996 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
12997 !! options
12998 language=nl title=[[MediaWiki:Common.css]]
12999 !! input
13000 {{#formatdate:2009-03-24|dmy}}
13001 !! result
13002 <p><span class="mw-formatted-date" title="2009-03-24">24 March 2009</span>
13003 </p>
13004 !! end
13011 # Edit comments
13014 !! test
13015 Edit comment with link
13016 !! options
13017 comment
13018 !! input
13019 I like the [[Main Page]] a lot
13020 !! result
13021 I like the <a href="/wiki/Main_Page" title="Main Page">Main Page</a> a lot
13022 !!end
13024 !! test
13025 Edit comment with link and link text
13026 !! options
13027 comment
13028 !! input
13029 I like the [[Main Page|best pages]] a lot
13030 !! result
13031 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
13032 !!end
13034 !! test
13035 Edit comment with link and link text with suffix
13036 !! options
13037 comment
13038 !! input
13039 I like the [[Main Page|best page]]s a lot
13040 !! result
13041 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
13042 !!end
13044 !! test
13045 Edit comment with section link (non-local, eg in history list)
13046 !! options
13047 comment title=[[Main Page]]
13048 !! input
13049 /* External links */ removed bogus entries
13050 !! result
13051 <a href="/wiki/Main_Page#External_links" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
13052 !!end
13054 !! test
13055 Edit comment with section link and text before it (non-local, eg in history list)
13056 !! options
13057 comment title=[[Main Page]]
13058 !! input
13059 pre-comment text /* External links */ removed bogus entries
13060 !! result
13061 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>
13062 !!end
13064 !! test
13065 Edit comment with section link (local, eg in diff view)
13066 !! options
13067 comment local title=[[Main Page]]
13068 !! input
13069 /* External links */ removed bogus entries
13070 !! result
13071 <a href="#External_links">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
13072 !!end
13074 !! test
13075 Edit comment with subpage link (bug 14080)
13076 !! options
13077 comment
13078 subpage
13079 title=[[Subpage test]]
13080 !! input
13081 Poked at a [[/subpage]] here...
13082 !! result
13083 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a> here...
13084 !!end
13086 !! test
13087 Edit comment with subpage link and link text (bug 14080)
13088 !! options
13089 comment
13090 subpage
13091 title=[[Subpage test]]
13092 !! input
13093 Poked at a [[/subpage|neat little page]] here...
13094 !! result
13095 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">neat little page</a> here...
13096 !!end
13098 !! test
13099 Edit comment with bogus subpage link in non-subpage NS (bug 14080)
13100 !! options
13101 comment
13102 title=[[Subpage test]]
13103 !! input
13104 Poked at a [[/subpage]] here...
13105 !! result
13106 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...
13107 !!end
13109 !! test
13110 Edit comment with bare anchor link (local, as on diff)
13111 !! options
13112 comment
13113 local
13114 title=[[Main Page]]
13115 !!input
13116 [[#section]]
13117 !! result
13118 <a href="#section">#section</a>
13119 !! end
13121 !! test
13122 Edit comment with bare anchor link (non-local, as on history)
13123 !! options
13124 comment
13125 title=[[Main Page]]
13126 !!input
13127 [[#section]]
13128 !! result
13129 <a href="/wiki/Main_Page#section" title="Main Page">#section</a>
13130 !! end
13132 !! test
13133 Anchor starting with underscore
13134 !!input
13135 [[#_ref|One]]
13136 !! result
13137 <p><a href="#_ref">One</a>
13138 </p>
13139 !! end
13141 !! test
13142 Id starting with underscore
13143 !!input
13144 <div id="_ref"></div>
13145 !! result
13146 <div id="_ref"></div>
13148 !! end
13150 !! test
13151 Space normalisation on autocomment (bug 22784)
13152 !! options
13153 comment
13154 title=[[Main Page]]
13155 !!input
13156 /* __hello__world__ */
13157 !! result
13158 <a href="/wiki/Main_Page#hello_world" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">__hello__world__</span></span>
13159 !! end
13161 !! test
13162 percent-encoding and + signs in comments (Bug 26410)
13163 !! options
13164 comment
13165 !!input
13166 [[ABC%33D% ++]] [[ABC%33D% ++|+%20]]
13167 !! result
13168 <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>
13169 !! end
13171 !! test
13172 Bad images - basic functionality
13173 !! options
13174 disabled
13175 !! input
13176 [[File:Bad.jpg]]
13177 !! result
13178 !! end
13180 !! test
13181 Bad images - bug 16039: text after bad image disappears
13182 !! options
13183 disabled
13184 !! input
13185 Foo bar
13186 [[File:Bad.jpg]]
13187 Bar foo
13188 !! result
13189 <p>Foo bar
13190 </p><p>Bar foo
13191 </p>
13192 !! end
13194 !! test
13195 Verify that displaytitle works (bug #22501) no displaytitle
13196 !! options
13197 showtitle
13198 !! config
13199 wgAllowDisplayTitle=true
13200 wgRestrictDisplayTitle=false
13201 !! input
13202 this is not the the title
13203 !! result
13204 Parser test
13205 <p>this is not the the title
13206 </p>
13207 !! end
13209 !! test
13210 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=false
13211 !! options
13212 showtitle
13213 title=[[Screen]]
13214 !! config
13215 wgAllowDisplayTitle=true
13216 wgRestrictDisplayTitle=false
13217 !! input
13218 this is not the the title
13219 {{DISPLAYTITLE:whatever}}
13220 !! result
13221 whatever
13222 <p>this is not the the title
13223 </p>
13224 !! end
13226 !! test
13227 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true mismatch
13228 !! options
13229 showtitle
13230 title=[[Screen]]
13231 !! config
13232 wgAllowDisplayTitle=true
13233 wgRestrictDisplayTitle=true
13234 !! input
13235 this is not the the title
13236 {{DISPLAYTITLE:whatever}}
13237 !! result
13238 Screen
13239 <p>this is not the the title
13240 </p>
13241 !! end
13243 !! test
13244 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true matching
13245 !! options
13246 showtitle
13247 title=[[Screen]]
13248 !! config
13249 wgAllowDisplayTitle=true
13250 wgRestrictDisplayTitle=true
13251 !! input
13252 this is not the the title
13253 {{DISPLAYTITLE:screen}}
13254 !! result
13255 screen
13256 <p>this is not the the title
13257 </p>
13258 !! end
13260 !! test
13261 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false
13262 !! options
13263 showtitle
13264 title=[[Screen]]
13265 !! config
13266 wgAllowDisplayTitle=false
13267 !! input
13268 this is not the the title
13269 {{DISPLAYTITLE:screen}}
13270 !! result
13271 Screen
13272 <p>this is not the the title
13273 <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>
13274 </p>
13275 !! end
13277 !! test
13278 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false no DISPLAYTITLE
13279 !! options
13280 showtitle
13281 title=[[Screen]]
13282 !! config
13283 wgAllowDisplayTitle=false
13284 !! input
13285 this is not the the title
13286 !! result
13287 Screen
13288 <p>this is not the the title
13289 </p>
13290 !! end
13292 !! test
13293 preload: check <noinclude> and <includeonly>
13294 !! options
13295 preload
13296 !! input
13297 Hello <noinclude>cruel</noinclude><includeonly>kind</includeonly> world.
13298 !! result
13299 Hello kind world.
13300 !! end
13302 !! test
13303 preload: check <onlyinclude>
13304 !! options
13305 preload
13306 !! input
13307 Goodbye <onlyinclude>Hello world</onlyinclude>
13308 !! result
13309 Hello world
13310 !! end
13312 !! test
13313 preload: can pass tags through if we want to
13314 !! options
13315 preload
13316 !! input
13317 <includeonly><</includeonly>includeonly>Hello world<includeonly><</includeonly>/includeonly>
13318 !! result
13319 <includeonly>Hello world</includeonly>
13320 !! end
13322 !! test
13323 preload: check that it doesn't try to do tricks
13324 !! options
13325 preload
13326 !! input
13327 * <!-- Hello --> ''{{world}}'' {{<includeonly>subst:</includeonly>How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
13328 !! result
13329 * <!-- Hello --> ''{{world}}'' {{subst:How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
13330 !! end
13332 !! test
13333 Play a bit with r67090 and bug 3158
13334 !! options
13335 disabled
13336 !! input
13337 <div style="width:50% !important">&nbsp;</div>
13338 <div style="width:50%&nbsp;!important">&nbsp;</div>
13339 <div style="width:50%&#160;!important">&nbsp;</div>
13340 <div style="border : solid;">&nbsp;</div>
13341 !! result
13342 <div style="width:50% !important">&nbsp;</div>
13343 <div style="width:50% !important">&nbsp;</div>
13344 <div style="width:50% !important">&nbsp;</div>
13345 <div style="border&#160;: solid;">&nbsp;</div>
13347 !! end
13349 !! test
13350 HTML5 data attributes
13351 !! input
13352 <span data-foo="bar">Baz</span>
13353 <p data-abc-def_hij="">Quuz</p>
13354 !! result
13355 <p><span data-foo="bar">Baz</span>
13356 </p>
13357 <p data-abc-def_hij="">Quuz</p>
13359 !! end
13361 !! test
13362 percent-encoding and + signs in internal links (Bug 26410)
13363 !! input
13364 [[User:+%]] [[Page+title%]]
13365 [[%+]] [[%+|%20]] [[%+ ]] [[%+r]]
13366 [[%]] [[+]] [[image:%+abc%39|foo|[[bar]]]]
13367 [[%33%45]] [[%33%45+]]
13368 !! result
13369 <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>
13370 <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>
13371 <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>
13372 <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>
13373 </p>
13374 !! end
13376 !! test
13377 Special characters in embedded file links (bug 27679)
13378 !! input
13379 [[File:Contains & ampersand.jpg]]
13380 [[File:Does not exist.jpg|Title with & ampersand]]
13381 !! result
13382 <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>
13383 <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>
13384 </p>
13385 !! end
13388 !! test
13389 Confirm that 'apos' named character reference doesn't make it to output (not legal in HTML 4)
13390 !! input
13391 Text&apos;s been normalized?
13392 !! result
13393 <p>Text&#39;s been normalized?
13394 </p>
13395 !! end
13397 !! test
13398 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate free external links
13399 !! input
13400 http://www.example.org/ <-- U+3000 (vim: ^Vu3000)
13401 !! result
13402 <p><a rel="nofollow" class="external free" href="http://www.example.org/">http://www.example.org/</a> &lt;-- U+3000 (vim: ^Vu3000)
13403 </p>
13404 !! end
13406 !! test
13407 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate bracketed external links
13408 !! input
13409 [http://www.example.org/ ideograms]
13410 !! result
13411 <p><a rel="nofollow" class="external text" href="http://www.example.org/">ideograms</a>
13412 </p>
13413 !! end
13415 !! test
13416 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate external images links
13417 !! input
13418 http://www.example.org/pic.png <-- U+3000 (vim: ^Vu3000)
13419 !! result
13420 <p><img src="http://www.example.org/pic.png" alt="pic.png" /> &lt;-- U+3000 (vim: ^Vu3000)
13421 </p>
13422 !! end
13424 !! article
13425 Mediawiki:loop1
13426 !! text
13427 {{Identical|A}}
13428 !! endarticle
13430 !! article
13431 Mediawiki:loop2
13432 !! text
13433 {{Identical|B}}
13434 !! endarticle
13436 !! article
13437 Template:Identical
13438 !! text
13439 {{int:loop1}}
13440 {{int:loop2}}
13441 !! endarticle
13443 !! test
13444 Bug 31098 Template which includes system messages which includes the template
13445 !! input
13446 {{Identical}}
13447 !! result
13448 <p><span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
13449 <span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
13450 </p>
13451 !! end
13453 !! test
13454 Bug31490 Turkish: ucfirst 'blah'
13455 !! options
13456 language=tr
13457 !! input
13458 {{ucfirst:blah}}
13459 !! result
13460 <p>Blah
13461 </p>
13462 !! end
13464 !! test
13465 Bug31490 Turkish: ucfirst 'ix'
13466 !! options
13467 language=tr
13468 !! input
13469 {{ucfirst:ix}}
13470 !! result
13471 <p>İx
13472 </p>
13473 !! end
13475 !! test
13476 Bug31490 Turkish: lcfirst 'BLAH'
13477 !! options
13478 language=tr
13479 !! input
13480 {{lcfirst:BLAH}}
13481 !! result
13482 <p>bLAH
13483 </p>
13484 !! end
13486 !! test
13487 Bug31490 Turkish: ucfırst (with a dotless i)
13488 !! options
13489 language=tr
13490 !! input
13491 {{ucfırst:blah}}
13492 !! result
13493 <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>
13494 </p>
13495 !! end
13497 !! test
13498 Bug31490 ucfırst (with a dotless i) with English language
13499 !! options
13500 language=en
13501 !! input
13502 {{ucfırst:blah}}
13503 !! result
13504 <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>
13505 </p>
13506 !! end
13508 !! test
13509 Bug 26375: TOC with italics
13510 !! options
13511 title=[[Main Page]]
13512 !! input
13513 __TOC__
13514 == ''Lost'' episodes ==
13515 !! result
13516 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
13517 <ul>
13518 <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>
13519 </ul>
13520 </td></tr></table>
13521 <h2><span class="mw-headline" id="Lost_episodes"><i>Lost</i> episodes</span><span class="mw-editsection">[<a href="/index.php?title=Main_Page&amp;action=edit&amp;section=1" title="Edit section: Lost episodes">edit</a>]</span></h2>
13523 !! end
13525 !! test
13526 Bug 26375: TOC with bold
13527 !! options
13528 title=[[Main Page]]
13529 !! input
13530 __TOC__
13531 == '''should be bold''' then normal text ==
13532 !! result
13533 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
13534 <ul>
13535 <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>
13536 </ul>
13537 </td></tr></table>
13538 <h2><span class="mw-headline" id="should_be_bold_then_normal_text"><b>should be bold</b> then normal text</span><span class="mw-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></h2>
13540 !! end
13542 !! test
13543 Bug 33845: Headings become cursive in TOC when they contain an image
13544 !! options
13545 title=[[Main Page]]
13546 !! input
13547 __TOC__
13548 == Image [[Image:foobar.jpg]] ==
13549 !! result
13550 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
13551 <ul>
13552 <li class="toclevel-1 tocsection-1"><a href="#Image"><span class="tocnumber">1</span> <span class="toctext">Image</span></a></li>
13553 </ul>
13554 </td></tr></table>
13555 <h2><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><span class="mw-editsection">[<a href="/index.php?title=Main_Page&amp;action=edit&amp;section=1" title="Edit section: Image">edit</a>]</span></h2>
13557 !! end
13559 !! test
13560 Bug 33845 (2): Headings become bold in TOC when they contain a blockquote
13561 !! options
13562 title=[[Main Page]]
13563 !! input
13564 __TOC__
13565 == <blockquote>Quote</blockquote> ==
13566 !! result
13567 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
13568 <ul>
13569 <li class="toclevel-1 tocsection-1"><a href="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
13570 </ul>
13571 </td></tr></table>
13572 <h2><span class="mw-headline" id="Quote"><blockquote>Quote</blockquote></span><span class="mw-editsection">[<a href="/index.php?title=Main_Page&amp;action=edit&amp;section=1" title="Edit section: Quote">edit</a>]</span></h2>
13574 !! end
13576 !! test
13577 Unclosed tags in TOC
13578 !! options
13579 title=[[Main Page]]
13580 !! input
13581 __TOC__
13582 == Proof: 2 < 3 ==
13583 <small>Hanc marginis exiguitas non caperet.</small>
13585 !! result
13586 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
13587 <ul>
13588 <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>
13589 </ul>
13590 </td></tr></table>
13591 <h2><span class="mw-headline" id="Proof:_2_.3C_3">Proof: 2 &lt; 3</span><span class="mw-editsection">[<a href="/index.php?title=Main_Page&amp;action=edit&amp;section=1" title="Edit section: Proof: 2 &lt; 3">edit</a>]</span></h2>
13592 <p><small>Hanc marginis exiguitas non caperet.</small>
13594 </p>
13595 !! end
13597 !! test
13598 Multiple tags in TOC
13599 !! input
13600 __TOC__
13601 == <i>Foo</i> <b>Bar</b> ==
13603 == <i>Foo</i> <blockquote>Bar</blockquote> ==
13604 !! result
13605 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
13606 <ul>
13607 <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>
13608 <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>
13609 </ul>
13610 </td></tr></table>
13611 <h2><span class="mw-headline" id="Foo_Bar"><i>Foo</i> <b>Bar</b></span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: Foo Bar">edit</a>]</span></h2>
13612 <h2><span class="mw-headline" id="Foo_Bar_2"><i>Foo</i> <blockquote>Bar</blockquote></span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: Foo Bar">edit</a>]</span></h2>
13614 !! end
13616 !! test
13617 Tags with parameters in TOC
13618 !! input
13619 __TOC__
13620 == <sup class="in-h2">Hello</sup> ==
13622 == <sup class="a > b">Evilbye</sup> ==
13623 !! result
13624 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
13625 <ul>
13626 <li class="toclevel-1 tocsection-1"><a href="#Hello"><span class="tocnumber">1</span> <span class="toctext"><sup>Hello</sup></span></a></li>
13627 <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>
13628 </ul>
13629 </td></tr></table>
13630 <h2><span class="mw-headline" id="Hello"><sup class="in-h2">Hello</sup></span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: Hello">edit</a>]</span></h2>
13631 <h2><span class="mw-headline" id="b.22.3EEvilbye"><sup> b"&gt;Evilbye</sup></span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: b&quot;>Evilbye">edit</a>]</span></h2>
13633 !! end
13635 !! test
13636 span tags with directionality in TOC
13637 !! input
13638 __TOC__
13639 == <span dir="ltr">C++</span> ==
13641 == <span dir="rtl">זבנג!</span> ==
13643 == <span style="font-style: italic">The attributes on these span tags must be deleted from the TOC</span> ==
13645 == <span style="font-style: italic" dir="ltr">All attributes on these span tags must be deleted from the TOC</span> ==
13647 == <span dir="ltr" style="font-style: italic">Attributes after dir on these span tags must be deleted from the TOC</span> ==
13648 !! result
13649 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
13650 <ul>
13651 <li class="toclevel-1 tocsection-1"><a href="#C.2B.2B"><span class="tocnumber">1</span> <span class="toctext"><span dir="ltr">C++</span></span></a></li>
13652 <li class="toclevel-1 tocsection-2"><a href="#.D7.96.D7.91.D7.A0.D7.92.21"><span class="tocnumber">2</span> <span class="toctext"><span dir="rtl">זבנג!</span></span></a></li>
13653 <li class="toclevel-1 tocsection-3"><a href="#The_attributes_on_these_span_tags_must_be_deleted_from_the_TOC"><span class="tocnumber">3</span> <span class="toctext"><span>The attributes on these span tags must be deleted from the TOC</span></span></a></li>
13654 <li class="toclevel-1 tocsection-4"><a href="#All_attributes_on_these_span_tags_must_be_deleted_from_the_TOC"><span class="tocnumber">4</span> <span class="toctext"><span>All attributes on these span tags must be deleted from the TOC</span></span></a></li>
13655 <li class="toclevel-1 tocsection-5"><a href="#Attributes_after_dir_on_these_span_tags_must_be_deleted_from_the_TOC"><span class="tocnumber">5</span> <span class="toctext"><span dir="ltr">Attributes after dir on these span tags must be deleted from the TOC</span></span></a></li>
13656 </ul>
13657 </td></tr></table>
13658 <h2><span class="mw-headline" id="C.2B.2B"><span dir="ltr">C++</span></span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: C++">edit</a>]</span></h2>
13659 <h2><span class="mw-headline" id=".D7.96.D7.91.D7.A0.D7.92.21"><span dir="rtl">זבנג!</span></span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: זבנג!">edit</a>]</span></h2>
13660 <h2><span class="mw-headline" id="The_attributes_on_these_span_tags_must_be_deleted_from_the_TOC"><span style="font-style: italic">The attributes on these span tags must be deleted from the TOC</span></span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=3" title="Edit section: The attributes on these span tags must be deleted from the TOC">edit</a>]</span></h2>
13661 <h2><span class="mw-headline" id="All_attributes_on_these_span_tags_must_be_deleted_from_the_TOC"><span style="font-style: italic" dir="ltr">All attributes on these span tags must be deleted from the TOC</span></span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=4" title="Edit section: All attributes on these span tags must be deleted from the TOC">edit</a>]</span></h2>
13662 <h2><span class="mw-headline" id="Attributes_after_dir_on_these_span_tags_must_be_deleted_from_the_TOC"><span dir="ltr" style="font-style: italic">Attributes after dir on these span tags must be deleted from the TOC</span></span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=5" title="Edit section: Attributes after dir on these span tags must be deleted from the TOC">edit</a>]</span></h2>
13664 !! end
13666 !! article
13667 MediaWiki:Bug32057
13668 !! text
13669 == {{int:headline_sample}} ==
13670 !! endarticle
13672 !! test
13673 Bug 32057: Title needed when expanding <h> nodes.
13674 !! options
13675 title=[[Main Page]]
13676 !! input
13677 {{int:Bug32057}}
13678 !! result
13679 <h2><span class="mw-headline" id="Headline_text">Headline text</span><span class="mw-editsection">[<a href="/index.php?title=Main_Page&amp;action=edit&amp;section=1" title="Edit section: Headline text">edit</a>]</span></h2>
13681 !! end
13683 !! test
13684 Strip marker in urlencode
13685 !! input
13686 {{urlencode:x<nowiki/>y}}
13687 {{urlencode:x<nowiki/>y|wiki}}
13688 {{urlencode:x<nowiki/>y|path}}
13689 !! result
13690 <p>xy
13693 </p>
13694 !! end
13696 !! test
13697 Strip marker in lc
13698 !! input
13699 {{lc:x<nowiki/>y}}
13700 !! result
13701 <p>xy
13702 </p>
13703 !! end
13705 !! test
13706 Strip marker in uc
13707 !! input
13708 {{uc:x<nowiki/>y}}
13709 !! result
13710 <p>XY
13711 </p>
13712 !! end
13714 !! test
13715 Strip marker in formatNum
13716 !! input
13717 {{formatnum:1<nowiki/>2}}
13718 {{formatnum:1<nowiki/>2|R}}
13719 !! result
13720 <p>12
13722 </p>
13723 !! end
13725 !! test
13726 Check noCommafy in formatNum
13727 !! options
13728 language=be-tarask
13729 !! input
13730 {{formatnum:123456.78}}
13731 {{formatnum:123456.78|NOSEP}}
13732 !! result
13733 <p>123 456,78
13734 123456.78
13735 </p>
13736 !! end
13738 !! test
13739 Strip marker in grammar
13740 !! options
13741 language=fi
13742 !! input
13743 {{grammar:elative|foo<nowiki/>bar}}
13744 !! result
13745 <p>foobarista
13746 </p>
13747 !! end
13749 !! test
13750 Strip marker in padleft
13751 !! input
13752 {{padleft:|2|x<nowiki/>y}}
13753 !! result
13754 <p>xy
13755 </p>
13756 !! end
13758 !! test
13759 Strip marker in padright
13760 !! input
13761 {{padright:|2|x<nowiki/>y}}
13762 !! result
13763 <p>xy
13764 </p>
13765 !! end
13767 !! test
13768 Strip marker in anchorencode
13769 !! input
13770 {{anchorencode:x<nowiki/>y}}
13771 !! result
13772 <p>xy
13773 </p>
13774 !! end
13776 !! test
13777 nowiki inside link inside heading (bug 18295)
13778 !! input
13779 ==[[foo|x<nowiki>y</nowiki>z]]==
13780 !! result
13781 <h2><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><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: xyz">edit</a>]</span></h2>
13783 !! end
13785 !! test
13786 new support for bdi element (bug 31817)
13787 !! input
13788 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
13789 !! result
13790 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
13792 !!end
13794 !! test
13795 Ignore pipe between table row attributes
13796 !! input
13798 | quux
13799 |- id=foo | style='color: red'
13800 | bar
13802 !! result
13803 <table>
13804 <tr>
13805 <td> quux
13806 </td></tr>
13807 <tr id="foo" style="color: red">
13808 <td> bar
13809 </td></tr></table>
13811 !! end
13813 !!test
13814 Gallery override link with WikiLink (bug 34852)
13815 !! input
13816 <gallery>
13817 File:foobar.jpg|caption|alt=galleryalt|link=InterWikiLink
13818 </gallery>
13819 !! result
13820 <ul class="gallery">
13821                 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
13822                         <div class="thumb" style="width: 150px;"><div style="margin:68px auto;"><a href="/wiki/InterWikiLink"><img alt="galleryalt" src="http://example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" width="120" height="14" /></a></div></div>
13823                         <div class="gallerytext">
13824 <p>caption
13825 </p>
13826                         </div>
13827                 </div></li>
13828 </ul>
13830 !! end
13832 !!test
13833 Gallery override link with absolute external link (bug 34852)
13834 !! input
13835 <gallery>
13836 File:foobar.jpg|caption|alt=galleryalt|link=http://www.example.org
13837 </gallery>
13838 !! result
13839 <ul class="gallery">
13840                 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
13841                         <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/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" width="120" height="14" /></a></div></div>
13842                         <div class="gallerytext">
13843 <p>caption
13844 </p>
13845                         </div>
13846                 </div></li>
13847 </ul>
13849 !! end
13851 !!test
13852 Gallery override link with malicious javascript (bug 34852)
13853 !! input
13854 <gallery>
13855 File:foobar.jpg|caption|alt=galleryalt|link=" onclick="alert('malicious javascript code!');
13856 </gallery>
13857 !! result
13858 <ul class="gallery">
13859                 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
13860                         <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/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" width="120" height="14" /></a></div></div>
13861                         <div class="gallerytext">
13862 <p>caption
13863 </p>
13864                         </div>
13865                 </div></li>
13866 </ul>
13868 !! end
13870 !!test
13871 Gallery with invalid title as link (bug 43964)
13872 !! input
13873 <gallery>
13874 File:foobar.jpg|link=<
13875 </gallery>
13876 !! result
13877 <ul class="gallery">
13878                 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
13879                         <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/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" width="120" height="14" /></a></div></div>
13880                         <div class="gallerytext">
13881                         </div>
13882                 </div></li>
13883 </ul>
13885 !! end
13887 !!test
13888 Language parser function
13889 !! input
13890 {{#language:ar}}
13891 !! result
13892 <p>العربية
13893 </p>
13894 !! end
13896 !!test
13897 Padleft and padright as substr
13898 !! input
13899 {{padleft:|3|abcde}}
13900 {{padright:|3|abcde}}
13901 !! result
13902 <p>abc
13904 </p>
13905 !! end
13907 !!test
13908 Bug 34939 - Case insensitive link parsing ([HttP://])
13909 !! input
13910 [HttP://MediaWiki.Org/]
13911 !! result
13912 <p><a rel="nofollow" class="external autonumber" href="HttP://MediaWiki.Org/">[1]</a>
13913 </p>
13914 !! end
13916 !!test
13917 Bug 34939 - Case insensitive link parsing ([HttP:// title])
13918 !! input
13919 [HttP://MediaWiki.Org/ MediaWiki]
13920 !! result
13921 <p><a rel="nofollow" class="external text" href="HttP://MediaWiki.Org/">MediaWiki</a>
13922 </p>
13923 !! end
13925 !!test
13926 Bug 34939 - Case insensitive link parsing (HttP://)
13927 !! input
13928 HttP://MediaWiki.Org/
13929 !! result
13930 <p><a rel="nofollow" class="external free" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a>
13931 </p>
13932 !! end
13935 ### Parsoids-specific tests
13936 ### Parsoid-PHP parser incompatibilities
13938 !!test
13939 1. SOL-sensitive wikitext tokens as template-args
13940 !!options
13941 parsoid=wt2html,wt2wt
13942 !!input
13943 {{echo|*a}}
13944 {{echo|#a}}
13945 {{echo|:a}}
13946 !!result
13947 <span about="#mwt1" typeof="mw:Object/Template">
13948 </span><ul about="#mwt1"><li>a</li></ul>
13949 <span about="#mwt2" typeof="mw:Object/Template">
13950 </span><ol about="#mwt2"><li>a</li></ol>
13951 <span about="#mwt3" typeof="mw:Object/Template">
13952 </span><dl about="#mwt3"><dd>a</dd></dl>
13953 !!end
13955 #### The following section of tests are primarily to test
13956 #### wikitext escaping capabilities of Parsoid.  Given that
13957 #### escaping can be done any number of ways, the wikitext (input)
13958 #### is always adjusted to reflect how Parsoid adds nowiki
13959 #### escape tags.
13960 ####
13961 #### We are marking several tests as parsoid-only since the
13962 #### HTML in the result section is different from what the
13963 #### PHP parser generates for it.
13966 #### --------------- Headings ---------------
13967 #### 0. Unnested
13968 #### 1. Nested inside html <h1>=foo=</h1>
13969 #### 2. Outside heading nest on a single line <h1>foo</h1>*bar
13970 #### 3. Nested inside html with wikitext split by html tags
13971 #### 4. No escape needed
13972 #### 5. Empty headings <h1></h1>
13973 #### 6. Heading chars in SOL context
13974 #### ----------------------------------------
13975 !! test
13976 Headings: 0. Unnested
13977 !! options
13978 parsoid
13979 !! input
13980 <nowiki>=foo=</nowiki>
13982 <nowiki> =foo= </nowiki>
13983 <!--cmt-->
13984 <nowiki>=foo=</nowiki>
13986 =foo''a''<nowiki>=</nowiki>
13987 !! result
13988 <p><span typeof="mw:Nowiki">=foo=</span></p>
13990 <p><span typeof="mw:Nowiki"> =foo= </span>
13991 <!--cmt-->
13992 <span typeof="mw:Nowiki">=foo=</span></p>
13994 <p>=foo<i>a</i><span typeof="mw:Nowiki">=</span></p>
13995 !!end
13997 !! test
13998 Headings: 1. Nested inside html
13999 !! options
14000 parsoid
14001 !! input
14002 =<nowiki>=foo=</nowiki>=
14003 ==<nowiki>=foo=</nowiki>==
14004 ===<nowiki>=foo=</nowiki>===
14005 ====<nowiki>=foo=</nowiki>====
14006 =====<nowiki>=foo=</nowiki>=====
14007 ======<nowiki>=foo=</nowiki>======
14008 !! result
14009 <h1><span typeof="mw:Nowiki">=foo=</span></h1>
14010 <h2><span typeof="mw:Nowiki">=foo=</span></h2>
14011 <h3><span typeof="mw:Nowiki">=foo=</span></h3>
14012 <h4><span typeof="mw:Nowiki">=foo=</span></h4>
14013 <h5><span typeof="mw:Nowiki">=foo=</span></h5>
14014 <h6><span typeof="mw:Nowiki">=foo=</span></h6>
14015 !!end
14017 !! test
14018 Headings: 2. Outside heading nest on a single line <h1>foo</h1>*bar
14019 !! options
14020 parsoid
14021 !! input
14022 =foo=
14023 <nowiki>*bar</nowiki>
14024 =foo=
14025 =bar
14026 =foo=
14027 <nowiki>=bar=</nowiki>
14028 !! result
14029 <h1>foo</h1>*bar
14030 <h1>foo</h1>=bar
14031 <h1>foo</h1>=bar=
14032 !!end
14034 !! test
14035 Headings: 3. Nested inside html with wikitext split by html tags
14036 !! options
14037 parsoid
14038 !! input
14039 =='''bold'''<nowiki>foo=</nowiki>=
14040 !! result
14041 <h1>=<b>bold</b><span typeof="mw:Nowiki">foo=</span></h1>
14042 !!end
14044 !! test
14045 Headings: 4a. No escaping needed (testing just h1 and h2)
14046 !! options
14047 parsoid
14048 !! input
14049 ==foo=
14050 =foo==
14051 = =foo= =
14052 ==foo= bar=
14053 ===foo==
14054 ==foo===
14055 =''=''foo==
14056 =<nowiki>=</nowiki>=
14057 !! result
14058 <h1>=foo</h1>
14059 <h1>foo=</h1>
14060 <h1> =foo= </h1>
14061 <h1>=foo= bar</h1>
14062 <h2>=foo</h2>
14063 <h2>foo=</h2>
14064 <h1><i>=</i>foo=</h1>
14065 <h1><span typeof="mw:Nowiki">=</span></h1>
14066 !!end
14068 !! test
14069 Headings: 4b. No escaping needed (inside p-tags)
14070 !! options
14071 parsoid
14072 !! input
14074 =foo= x
14075 =foo= <s></s>
14076 !! result
14077 <p>===
14078 =foo= x
14079 =foo= <s></s>
14080 </p>
14081 !!end
14083 !! test
14084 Headings: 5. Empty headings
14085 !! options
14086 parsoid
14087 !! input
14088 =<nowiki/>=
14089 ==<nowiki/>==
14090 ===<nowiki/>===
14091 ====<nowiki/>====
14092 =====<nowiki/>=====
14093 ======<nowiki/>======
14094 !! result
14095 <h1></h1>
14096 <h2></h2>
14097 <h3></h3>
14098 <h4></h4>
14099 <h5></h5>
14100 <h6></h6>
14101 !!end
14103 !! test
14104 Headings: 6. Heading chars in SOL context
14105 !! options
14106 parsoid
14107 !! input
14108 <!--cmt--><nowiki>=h1=</nowiki>
14109 <!--cmt--><nowiki> =h1= </nowiki>
14110 !! result
14111 <p><!--cmt--><span typeof="mw:Nowiki">=h1=</span>
14112 <!--cmt--><span typeof="mw:Nowiki"> =h1= </span></p>
14113 !!end
14115 #### --------------- Lists ---------------
14116 #### 0. Outside nests (*foo, etc.)
14117 #### 1. Nested inside html <ul><li>*foo</li></ul>
14118 #### 2. Inside definition lists
14119 #### 3. Only bullets at start should be escaped
14120 #### 4. No escapes needed
14121 #### 5. No unnecessary escapes
14122 #### 6. Escape bullets in SOL position
14123 #### 7. Escape bullets in a multi-line context
14124 #### ----------------------------------------
14126 !! test
14127 Lists: 0. Outside nests
14128 !! input
14129 <nowiki>*foo</nowiki>
14131 <nowiki>#foo</nowiki>
14132 !! result
14133 <p>*foo
14134 </p><p>#foo
14135 </p>
14136 !!end
14138 !! test
14139 Lists: 1. Nested inside html
14140 !! input
14141 *<nowiki>*foo</nowiki>
14143 *<nowiki>#foo</nowiki>
14145 *<nowiki>:foo</nowiki>
14147 *<nowiki>;foo</nowiki>
14149 #<nowiki>*foo</nowiki>
14151 #<nowiki>#foo</nowiki>
14153 #<nowiki>:foo</nowiki>
14155 #<nowiki>;foo</nowiki>
14156 !! result
14157 <ul><li>*foo
14158 </li></ul>
14159 <ul><li>#foo
14160 </li></ul>
14161 <ul><li>:foo
14162 </li></ul>
14163 <ul><li>;foo
14164 </li></ul>
14165 <ol><li>*foo
14166 </li></ol>
14167 <ol><li>#foo
14168 </li></ol>
14169 <ol><li>:foo
14170 </li></ol>
14171 <ol><li>;foo
14172 </li></ol>
14174 !!end
14176 !! test
14177 Lists: 2. Inside definition lists
14178 !! input
14179 ;<nowiki>;foo</nowiki>
14181 ;<nowiki>:foo</nowiki>
14183 ;<nowiki>:foo</nowiki>
14184 :bar
14186 :<nowiki>:foo</nowiki>
14187 !! result
14188 <dl><dt>;foo
14189 </dt></dl>
14190 <dl><dt>:foo
14191 </dt></dl>
14192 <dl><dt>:foo
14193 </dt><dd>bar
14194 </dd></dl>
14195 <dl><dd>:foo
14196 </dd></dl>
14198 !!end
14200 !! test
14201 Lists: 3. Only bullets at start of text should be escaped
14202 !! input
14203 *<nowiki>*foo*bar</nowiki>
14205 *<nowiki>*foo</nowiki>''it''*bar
14206 !! result
14207 <ul><li>*foo*bar
14208 </li></ul>
14209 <ul><li>*foo<i>it</i>*bar
14210 </li></ul>
14212 !!end
14214 !! test
14215 Lists: 4. No escapes needed
14216 !! options
14217 parsoid
14218 !! input
14219 *foo*bar
14221 *''foo''*bar
14223 *[[Foo]]: bar
14224 !! result
14225 <ul><li>foo*bar
14226 </li></ul>
14227 <ul><li><i>foo</i>*bar
14228 </li></ul>
14229 <ul><li><a rel="mw:WikiLink" href="Foo">Foo</a>: bar
14230 </li></ul>
14231 !!end
14233 !! test
14234 Lists: 5. No unnecessary escapes
14235 !! input
14236 * bar <span><nowiki>[[foo]]</nowiki></span>
14238 *=bar <span><nowiki>[[foo]]</nowiki></span>
14240 *[[bar <span><nowiki>[[foo]]</nowiki></span>
14242 *]]bar <span><nowiki>[[foo]]</nowiki></span>
14244 *=bar <span>foo]]</span>=
14246 * <s></s>: a
14247 !! result
14248 <ul><li> bar <span>[[foo]]</span>
14249 </li></ul>
14250 <ul><li>=bar <span>[[foo]]</span>
14251 </li></ul>
14252 <ul><li>[[bar <span>[[foo]]</span>
14253 </li></ul>
14254 <ul><li>]]bar <span>[[foo]]</span>
14255 </li></ul>
14256 <ul><li>=bar <span>foo]]</span>=
14257 </li></ul>
14258 <ul><li> <s></s>: a
14259 </li></ul>
14261 !!end
14263 !! test
14264 Lists: 6. Escape bullets in SOL position
14265 !! options
14266 parsoid
14267 !! input
14268 <!--cmt--><nowiki>*foo</nowiki>
14269 !! result
14270 <p><!--cmt--><span typeof="mw:Nowiki">*foo</span></p>
14271 !!end
14273 !! test
14274 Lists: 7. Escape bullets in a multi-line context
14275 !! input
14276 <nowiki>a
14277 *b</nowiki>
14278 !! result
14279 <p>a
14281 </p>
14282 !!end
14284 #### --------------- HRs ---------------
14285 #### 1. Single line
14286 #### -----------------------------------
14288 !! test
14289 HRs: 1. Single line
14290 !! options
14291 parsoid
14292 !! input
14293 ----<nowiki>----</nowiki>
14294 ----=foo=
14295 ----*foo
14296 !! result
14297 <hr><span typeof="mw:Nowiki">----</span>
14298 <hr>=foo=
14299 <hr>*foo
14300 !! end
14302 #### --------------- Tables ---------------
14303 #### 1a. Simple example
14304 #### 1b. No escaping needed (!foo)
14305 #### 1c. No escaping needed (|foo)
14306 #### 1d. No escaping needed (|}foo)
14307 ####
14308 #### 2a. Nested in td (<td>foo|bar</td>)
14309 #### 2b. Nested in td (<td>foo||bar</td>)
14310 #### 2c. Nested in td -- no escaping needed(<td>foo!!bar</td>)
14311 ####
14312 #### 3a. Nested in th (<th>foo!bar</th>)
14313 #### 3b. Nested in th (<th>foo!!bar</th>)
14314 #### 3c. Nested in th -- no escaping needed(<th>foo||bar</th>)
14315 ####
14316 #### 4a. Escape -
14317 #### 4b. Escape +
14318 #### 4c. No escaping needed
14319 #### --------------------------------------
14321 !! test
14322 Tables: 1a. Simple example
14323 !! input
14324 <nowiki>{|
14325 |}</nowiki>
14326 !! result
14327 <p>{|
14329 </p>
14330 !! end
14332 !! test
14333 Tables: 1b. No escaping needed
14334 !! input
14335 !foo
14336 !! result
14337 <p>!foo
14338 </p>
14339 !! end
14341 !! test
14342 Tables: 1c. No escaping needed
14343 !! input
14344 |foo
14345 !! result
14346 <p>|foo
14347 </p>
14348 !! end
14350 !! test
14351 Tables: 1d. No escaping needed
14352 !! input
14353 |}foo
14354 !! result
14355 <p>|}foo
14356 </p>
14357 !! end
14359 !! test
14360 Tables: 2a. Nested in td
14361 !! options
14362 parsoid
14363 !! input
14365 |<nowiki>foo|bar</nowiki>
14367 !! result
14368 <table><tbody><tr>
14369 <td><span typeof="mw:Nowiki">foo|bar</span></td></tr></tbody></table>
14370 !! end
14372 !! test
14373 Tables: 2b. Nested in td
14374 !! options
14375 parsoid
14376 !! input
14378 |<nowiki>foo||bar</nowiki>
14379 |''it''<nowiki>foo||bar</nowiki>
14381 !! result
14382 <table><tbody><tr>
14383 <td><span typeof="mw:Nowiki">foo||bar</span></td>
14384 <td><i>it</i><span typeof="mw:Nowiki">foo||bar</span></td></tr></tbody></table>
14385 !! end
14387 !! test
14388 Tables: 2c. Nested in td -- no escaping needed
14389 !! options
14390 parsoid
14391 !! input
14393 |foo!!bar
14395 !! result
14396 <table><tbody><tr><td>foo!!bar
14397 </td></tr></tbody></table>
14399 !! end
14401 !! test
14402 Tables: 3a. Nested in th
14403 !! options
14404 parsoid
14405 !! input
14407 !foo!bar
14409 !! result
14410 <table><tbody><tr><th>foo!bar
14411 </th></tr></tbody></table>
14413 !! end
14415 !! test
14416 Tables: 3b. Nested in th
14417 !! options
14418 parsoid
14419 !! input
14421 !<nowiki>foo!!bar</nowiki>
14423 !! result
14424 <table>
14425 <tbody><tr><th><span typeof="mw:Nowiki">foo!!bar</span></th></tr>
14426 </tbody></table>
14427 !! end
14429 !! test
14430 Tables: 3c. Nested in th -- no escaping needed
14431 !! options
14432 parsoid
14433 !! input
14435 !<nowiki>foo||bar</nowiki>
14437 !! result
14438 <table><tbody><tr>
14439 <th><span typeof="mw:Nowiki">foo||bar</span></th></tr></tbody></table>
14440 !! end
14442 !! test
14443 Tables: 4a. Escape -
14444 !! options
14445 parsoid
14446 !! input
14449 !-bar
14451 |<nowiki>-bar</nowiki>
14453 !! result
14454 <table><tbody>
14455 <tr><th>-bar</th></tr>
14456 <tr>
14457 <td><span typeof="mw:Nowiki">-bar</span></td></tr></tbody></table>
14458 !! end
14460 !! test
14461 Tables: 4b. Escape +
14462 !! options
14463 parsoid
14464 !! input
14467 !+bar
14469 |<nowiki>+bar</nowiki>
14471 !! result
14472 <table><tbody>
14473 <tr><th>+bar</th></tr>
14474 <tr>
14475 <td><span typeof="mw:Nowiki">+bar</span></td></tr></tbody></table>
14476 !! end
14478 !! test
14479 Tables: 4c. No escaping needed
14480 !! options
14481 parsoid
14482 !! input
14485 |foo-bar
14486 |foo+bar
14488 |''foo''-bar
14489 |''foo''+bar
14491 !! result
14492 <table><tbody>
14493 <tr><td>foo-bar</td><td>foo+bar</td></tr>
14494 <tr><td><i>foo</i>-bar</td><td><i>foo</i>+bar</td></tr>
14495 </tbody></table>
14496 !! end
14498 ### SSS FIXME: Disabled right now because accurate html2wt
14499 ### on this snippet requires data-parsoid flags that we've
14500 ### stripped out of these tests.  We should scheme how we
14501 ### we want to handle these kind of tests that require
14502 ### data-parsoid flags for accurate html2wt serialization
14504 !! test
14505 Tables: 4d. No escaping needed
14506 !! options
14507 disabled
14508 !! input
14510 ||+1
14511 ||-2
14513 !! result
14514 <table>
14515 <tr>
14516 <td>+1
14517 </td>
14518 <td>-2
14519 </td></tr></table>
14521 !! end
14523 #### --------------- Links ---------------
14524 #### 1. Quote marks in link text
14525 #### 2. Wikilinks: Escapes needed
14526 #### 3. Wikilinks: No escapes needed
14527 #### 4. Extlinks: Escapes needed
14528 #### 5. Extlinks: No escapes needed
14529 #### --------------------------------------
14530 !! test
14531 Links 1. Quote marks in link text
14532 !! options
14533 parsoid
14534 !! input
14535 [[Foo|<nowiki>Foo''boo''</nowiki>]]
14536 !! result
14537 <a rel="mw:WikiLink" href="Foo">Foo''boo''</a>
14538 !! end
14540 !! test
14541 Links 2. WikiLinks: Escapes needed
14542 !! options
14543 parsoid
14544 !! input
14545 [[Foo|<nowiki>[Foobar]</nowiki>]]
14546 [[Foo|<nowiki>Foobar]</nowiki>]]
14547 [[Foo|x [Foobar] x]]
14548 [[Foo|<nowiki>x [http://google.com g] x</nowiki>]]
14549 [[Foo|<nowiki>[[Bar]]</nowiki>]]
14550 [[Foo|<nowiki>x [[Bar]] x</nowiki>]]
14551 [[Foo|<nowiki>|Bar</nowiki>]]
14552 [[Foo|<nowiki>]]bar</nowiki>]]
14553 [[Foo|<nowiki>[[bar</nowiki>]]
14554 [[Foo|<nowiki>x ]] y [[ z</nowiki>]]
14555 !! result
14556 <a href="Foo" rel="mw:WikiLink">[Foobar]</a>
14557 <a href="Foo" rel="mw:WikiLink">Foobar]</a>
14558 <a href="Foo" rel="mw:WikiLink">x [Foobar] x</a>
14559 <a href="Foo" rel="mw:WikiLink">x [http://google.com g] x</a>
14560 <a href="Foo" rel="mw:WikiLink">[[Bar]]</a>
14561 <a href="Foo" rel="mw:WikiLink">x [[Bar]] x</a>
14562 <a href="Foo" rel="mw:WikiLink">|Bar</a>
14563 <a href="Foo" rel="mw:WikiLink">]]bar</a>
14564 <a href="Foo" rel="mw:WikiLink">[[bar</a>
14565 <a href="Foo" rel="mw:WikiLink">x ]] y [[ z</a>
14566 !! end
14568 !! test
14569 Links 3. WikiLinks: No escapes needed
14570 !! options
14571 parsoid
14572 !! input
14573 [[Foo|[Foobar]]
14574 [[Foo|foo|bar]]
14575 !! result
14576 <a href="Foo" rel="mw:WikiLink">[Foobar</a>
14577 <a href="Foo" rel="mw:WikiLink">foo|bar</a>
14578 !! end
14580 !! test
14581 Links 4. ExtLinks: Escapes needed
14582 !! options
14583 parsoid
14584 !! input
14585 [http://google.com <nowiki>[google]</nowiki>]
14586 [http://google.com <nowiki>google]</nowiki>]
14587 !! result
14588 <a href="http://google.com" rel="mw:ExtLink">[google]</a>
14589 <a href="http://google.com" rel="mw:ExtLink">google]</a>
14590 !! end
14592 !! test
14593 Links 5. ExtLinks: No escapes needed
14594 !! options
14595 parsoid
14596 !! input
14597 [http://google.com [google]
14598 !! result
14599 <a href="http://google.com" rel="mw:ExtLink">[google</a>
14600 !! end
14602 #### --------------- Quotes ---------------
14603 #### 1. Quotes inside <b> and <i>
14604 #### 2. Link fragments separated by <i> and <b> tags
14605 #### 3. Link fragments inside <i> and <b>
14606 #### --------------------------------------
14607 !! test
14608 1. Quotes inside <b> and <i>
14609 !! input
14610 ''<nowiki>'foo'</nowiki>''
14611 ''<nowiki>''foo''</nowiki>''
14612 ''<nowiki>'''foo'''</nowiki>''
14613 '''<nowiki>'foo'</nowiki>'''
14614 '''<nowiki>''foo''</nowiki>'''
14615 '''<nowiki>'''foo'''</nowiki>'''
14616 '''<nowiki>foo'</nowiki>''<nowiki>bar'</nowiki>''baz'''
14617 !! result
14618 <p><i>'foo'</i>
14619 <i>''foo''</i>
14620 <i>'''foo'''</i>
14621 <b>'foo'</b>
14622 <b>''foo''</b>
14623 <b>'''foo'''</b>
14624 <b>foo'<i>bar'</i>baz</b>
14625 </p>
14626 !! end
14628 !! test
14629 2. Link fragments separated by <i> and <b> tags
14630 !! input
14631 [[''foo''<nowiki>hello]]</nowiki>
14633 [['''foo'''<nowiki>hello]]</nowiki>
14634 !! result
14635 <p>[[<i>foo</i>hello]]
14636 </p><p>[[<b>foo</b>hello]]
14637 </p>
14638 !! end
14640 !! test
14641 2. Link fragments inside <i> and <b>
14642 (FIXME: Escaping one or both of [[ and ]] is also acceptable --
14643  this is one of the shortcomings of this format)
14644 !! input
14645 ''[[foo''<nowiki>]]</nowiki>
14647 '''[[foo'''<nowiki>]]</nowiki>
14648 !! result
14649 <p><i>[[foo</i>]]
14650 </p><p><b>[[foo</b>]]
14651 </p>
14652 !! end
14654 #### --------------- Paragraphs ---------------
14655 #### 1. No unnecessary escapes
14656 #### --------------------------------------
14658 !! test
14659 1. No unnecessary escapes
14660 !! input
14661 bar <span><nowiki>[[foo]]</nowiki></span>
14663 =bar <span><nowiki>[[foo]]</nowiki></span>
14665 [[bar <span><nowiki>[[foo]]</nowiki></span>
14667 ]]bar <span><nowiki>[[foo]]</nowiki></span>
14669 =bar <span>foo]]</span><nowiki>=</nowiki>
14670 !! result
14671 <p>bar <span>[[foo]]</span>
14672 </p><p>=bar <span>[[foo]]</span>
14673 </p><p>[[bar <span>[[foo]]</span>
14674 </p><p>]]bar <span>[[foo]]</span>
14675 </p><p>=bar <span>foo]]</span>=
14676 </p>
14677 !!end
14679 #### --------------- PRE ------------------
14680 #### 1. Leading space in SOL context should be escaped
14681 #### --------------------------------------
14682 !! test
14683 1. Leading space in SOL context should be escaped
14684 !! options
14685 parsoid
14686 !! input
14687 <nowiki> foo</nowiki>
14688 <!--cmt--><nowiki> foo</nowiki>
14689 !! result
14690 <p> foo
14691 <!--cmt--> foo
14692 </p>
14693 !! end
14695 #### --------------- HTML tags ---------------
14696 #### 1. a tags
14697 #### 2. other tags
14698 #### 3. multi-line html tag
14699 #### --------------------------------------
14700 !! test
14701 1. a tags
14702 !! options
14703 parsoid
14704 !! input
14705 <a href="http://google.com">google</a>
14706 !! result
14707 &lt;a href=&quot;http://google.com&quot;&gt;google&lt;/a&gt;
14708 !! end
14710 !! test
14711 2. other tags
14712 !! input
14713 <nowiki><div>foo</div>
14714 <div style="color:red">foo</div></nowiki>
14715 !! result
14716 <p>&lt;div&gt;foo&lt;/div&gt;
14717 &lt;div style=&quot;color:red&quot;&gt;foo&lt;/div&gt;
14718 </p>
14719 !! end
14721 !! test
14722 3. multi-line html tag
14723 !! input
14724 <nowiki><div
14725 >foo</div
14726 ></nowiki>
14727 !! result
14728 <p>&lt;div
14729 &gt;foo&lt;/div
14730 &gt;
14731 </p>
14732 !! end
14734 #### --------------- Others ---------------
14735 !! test
14736 Escaping nowikis
14737 !! input
14738 &lt;nowiki&gt;foo&lt;/nowiki&gt;
14739 !! result
14740 <p>&lt;nowiki&gt;foo&lt;/nowiki&gt;
14741 </p>
14742 !! end
14743 !! test
14745 Tag-like HTML structures are passed through as text
14746 !! input
14747 <x y>
14749 <x.y>
14751 <x-y>
14759 1<d e>f
14760 !! result
14761 <p>&lt;x y&gt;
14762 </p><p>&lt;x.y&gt;
14763 </p><p>&lt;x-y&gt;
14764 </p><p>1&gt;2
14765 </p><p>x&lt;y
14766 </p><p>a&gt;b
14767 </p><p>1&lt;d e&gt;f
14768 </p>
14769 !! end
14772 # This fails in the PHP parser (see bug 40670,
14773 # https://bugzilla.wikimedia.org/show_bug.cgi?id=40670), so disabled for it.
14774 !! test
14775 Tag names followed by punctuation should not be recognized as tags
14776 !! options
14777 parsoid
14778 !! input
14779 <s.ome> text
14780 !! result
14781 <p>&lt;s.ome&gt; text
14782 </p>
14783 !! end
14785 !! test
14786 HTML tag with necessary entities in attributes
14787 !! input
14788 <span title="&amp;amp;">foo</span>
14789 !! result
14790 <p><span title="&amp;amp;">foo</span>
14791 </p>
14792 !! end
14794 !! test
14795 HTML tag with 'unnecessary' entity encoding in attributes
14796 !! input
14797 <span title="&amp;">foo</span>
14798 !! result
14799 <p><span title="&amp;">foo</span>
14800 </p>
14801 !! end
14803 !! test
14804 HTML tag with broken attribute value quoting
14805 !! input
14806 <span title="Hello world>Foo</span>
14807 !! result
14808 <p><span>Foo</span>
14809 </p>
14810 !! end
14812 !! test
14813 Parsoid-only: HTML tag with broken attribute value quoting
14814 !! options
14815 parsoid
14816 !! input
14817 <span title="Hello world>Foo</span>
14818 !! result
14819 <p><span title="Hello world">Foo</span>
14820 </p>
14821 !! end
14823 !! test
14824 Table with broken attribute value quoting
14825 !! input
14827 | title="Hello world|Foo
14829 !! result
14830 <table>
14831 <tr>
14832 <td>Foo
14833 </td></tr></table>
14835 !! end
14837 !! test
14838 Table with broken attribute value quoting on consecutive lines
14839 !! input
14841 | title="Hello world|Foo
14842 | style="color:red|Bar
14844 !! result
14845 <table>
14846 <tr>
14847 <td>Foo
14848 </td>
14849 <td>Bar
14850 </td></tr></table>
14852 !! end
14854 !! test
14855 Parsoid-only: Table with broken attribute value quoting on consecutive lines
14856 !! options
14857 parsoid
14858 !! input
14860 | title="Hello world|Foo
14861 | style="color:red|Bar
14863 !! result
14864 <table><tbody>
14865 <tr>
14866 <td title="Hello world">Foo
14867 </td><td style="color: red">Bar
14868 </td></tr></tbody></table>
14870 !! end
14872 !! test
14873 Parsoid-only: Don't wrap broken template tags in <nowiki> on wt2wt (Bug 42353)
14874 !! options
14875 parsoid
14876 !! input
14877 {{}}
14878 !! result
14879 {{}}
14880 !! end
14882 !! test
14883 Parsoid-only: Don't wrap broken template tags in <nowiki> on wt2wt (Bug 42353)
14884 !! options
14885 parsoid
14886 !! input
14887 }}{{
14888 !! result
14889 }}{{
14890 !! end
14892 !!test
14893 Accept empty td cell attribute
14894 !!input
14896 | align="center" | foo ||  |
14898 !!result
14899 <table>
14900 <tr>
14901 <td align="center"> foo </td>
14902 <td>
14903 </td></tr></table>
14905 !!end
14907 !!test
14908 Non-empty attributes in th-cells
14909 !!input
14911 ! Foo !! style="color: red" | Bar
14913 !!result
14914 <table>
14915 <tr>
14916 <th> Foo </th>
14917 <th style="color: red"> Bar
14918 </th></tr></table>
14920 !!end
14922 !!test
14923 Accept empty attributes in th-cells
14924 !!input
14926 !| foo !!| bar
14928 !!result
14929 <table>
14930 <tr>
14931 <th> foo </th>
14932 <th> bar
14933 </th></tr></table>
14935 !!end
14937 !!test
14938 Empty table rows go away
14939 !!input
14941 | Hello
14942 | there
14943 |- class="foo"
14946 !! result
14947 <table>
14948 <tr>
14949 <td> Hello
14950 </td>
14951 <td> there
14952 </td></tr>
14954 </table>
14956 !! end
14959 ### Parsoid-centric tests for testing RTing of inter-element separators
14960 ### Edge cases not tested by existing parser tests and specific to
14961 ### Parsoid-specific serialization strategies.
14964 !!test
14965 RT-ed inter-element separators should be valid separators
14966 !!input
14968 |- [[foo]]
14970 !!result
14971 <table>
14973 </table>
14975 !!end
14977 !!test
14978 Trailing newlines in a deep dom-subtree that ends a wikitext line should be migrated out
14979 (Parsoid-only since PHP parser relies on Tidy for correct output)
14980 !!options
14981 parsoid
14982 !!input
14984 |<small>foo
14989 |<small>foo<small>
14991 !!result
14992 !!end
14994 !!test
14995 Empty TD followed by TD with tpl-generated attribute
14996 !!input
15000 |{{echo|style='color:red'}}|foo
15002 !!result
15003 <table>
15005 <tr>
15006 <td>
15007 </td>
15008 <td>foo
15009 </td></tr></table>
15011 !!end
15013 !!test
15014 Indented table with an empty td
15015 !!input
15016  {|
15017  |-
15019  |foo
15020  |}
15021 !!result
15022 <table>
15024 <tr>
15025 <td>
15026 </td>
15027 <td>foo
15028 </td></tr></table>
15030 !!end
15032 !!test
15033 Empty TR followed by a template-generated TR
15034 (Parsoid-specific since PHP parser doesn't handle this mixed tbl-wikitext)
15035 !!options
15036 parsoid=wt2html,wt2wt
15037 !!input
15040 {{echo|<tr><td>foo</td></tr>}}
15042 !!result
15043 <table>
15044 <tbody>
15045 <tr></tr>
15046 <tr typeof="mw:Object/Template">
15047 <td>foo</td></tr></tbody></table>
15048 !!end
15050 ## PHP and parsoid output differ for this, and since this is primarily
15051 ## for testing Parsoid's serializer, marking this Parsoid only
15052 !!test
15053 Empty TR followed by mixed-ws-comment line should RT correctly
15054 !!options
15055 parsoid
15056 !!input
15059  <!--c-->
15061 <!--c--> <!--d-->
15063 !!result
15064 <table>
15065 <tbody>
15066 <tr>
15067 <td> <!--c--></td></tr>
15068 <tr>
15069 <td><!--c--> <!--d--></td></tr>
15070 </tbody></table>
15072 !!end
15074 !!test
15075 Multi-line image caption generated by templates with/without trailing newlines
15076 !!options
15077 parsoid
15078 !!input
15079 [[File:foo.jpg|thumb|300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}]]
15080 [[File:foo.jpg|thumb|300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}\n\n]]
15081 !!result
15082 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/index.php?title=Special:Upload&amp;wpDestFile=Foo.jpg" class="new" title="File:Foo.jpg">File:Foo.jpg</a>  <div class="thumbcaption">foo\nA\nB\nC</div></div></div>
15083 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/index.php?title=Special:Upload&amp;wpDestFile=Foo.jpg" class="new" title="File:Foo.jpg">File:Foo.jpg</a>  <div class="thumbcaption">foo\nA\nB\nC\n\n</div></div></div>
15085 !!end
15087 ## PHP emits broken html for this, and since this is primarily
15088 ## a Parsoid serializer test, marking this Parsoid only
15089 !!test
15090 Improperly nested inline or quotes tags with whitespace in between
15091 !!options
15092 parsoid
15093 !!input
15094 <span> <s>x</span> </s>
15095 ''' ''x''' ''
15096 !!result
15097 <p><span> <s>x</s></span><s> </s>
15098 <b> <i>x</i></b><i> </i>
15099 </p>
15100 !!end
15103 TODO:
15104 more images
15105 more tables
15106 character entities
15107 and much more
15108 Try for 100% code coverage