test: coverage recording now needs to be explicit
[mediawiki.git] / tests / parser / parserTests.txt
blobb720ab28ce717f749f690f4cda2b3d4e6589e824
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 External link with comments in link text
3084 !! input
3085 [http://www.google.com Google <!-- comment -->]
3086 !! result
3087 <p><a rel="nofollow" class="external text" href="http://www.google.com">Google </a>
3088 </p>
3089 !! end
3091 !! test
3092 URL-encoding in URL functions (single parameter)
3093 !! input
3094 {{localurl:Some page|amp=&}}
3095 !! result
3096 <p>/index.php?title=Some_page&amp;amp=&amp;
3097 </p>
3098 !! end
3100 !! test
3101 URL-encoding in URL functions (multiple parameters)
3102 !! input
3103 {{localurl:Some page|q=?&amp=&}}
3104 !! result
3105 <p>/index.php?title=Some_page&amp;q=?&amp;amp=&amp;
3106 </p>
3107 !! end
3109 !! test
3110 Brackets in urls
3111 !! input
3112 http://example.com/index.php?foozoid%5B%5D=bar
3114 http://example.com/index.php?foozoid&#x5B;&#x5D;=bar
3115 !! result
3116 <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>
3117 </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>
3118 </p>
3119 !! end
3121 !! test
3122 IPv6 urls (bug 21261)
3123 !! options
3124 disabled
3125 !! input
3126 http://[2404:130:0:1000::187:2]/index.php
3127 !! result
3128 <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>
3129 </p>
3130 !! end
3132 !! test
3133 Non-extlinks in brackets
3134 !! input
3135 [foo]
3136 [foo bar]
3137 [foo ''bar'']
3138 [fool's] errand
3139 [fool's errand]
3140 [{{echo|foo}}]
3141 [{{echo|foo}} bar]
3142 [{{echo|foo}} ''bar'']
3143 [{{echo|foo}}l's] errand
3144 [{{echo|foo}}l's errand]
3145 [url={{echo|foo}}]
3146 [url=http://example.com]
3147 !! result
3148 <p>[foo]
3149 [foo bar]
3150 [foo <i>bar</i>]
3151 [fool's] errand
3152 [fool's errand]
3153 [foo]
3154 [foo bar]
3155 [foo <i>bar</i>]
3156 [fool's] errand
3157 [fool's errand]
3158 [url=foo]
3159 [url=<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>]
3160 </p>
3161 !! end
3164 ### Quotes
3167 !! test
3168 Quotes
3169 !! input
3170 Normal text. '''Bold text.''' Normal text. ''Italic text.''
3172 Normal text. '''''Bold italic text.''''' Normal text.
3173 !!result
3174 <p>Normal text. <b>Bold text.</b> Normal text. <i>Italic text.</i>
3175 </p><p>Normal text. <i><b>Bold italic text.</b></i> Normal text.
3176 </p>
3177 !! end
3180 !! test
3181 Unclosed and unmatched quotes (php)
3182 !! options
3184 !! input
3185 '''''Bold italic text '''with bold deactivated''' in between.'''''
3187 '''''Bold italic text ''with italic deactivated'' in between.'''''
3189 '''Bold text..
3191 ..spanning two paragraphs (should not work).'''
3193 '''Bold tag left open
3195 ''Italic tag left open
3197 Normal text.
3199 <!-- Unmatching number of opening, closing tags: -->
3200 '''This year''''s election ''should'' beat '''last year''''s.
3202 ''Tom'''s car is bigger than ''Susan'''s.
3204 Plain ''italic'''s plain
3205 !! result
3206 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
3207 </p><p><b><i>Bold italic text </i>with italic deactivated<i> in between.</i></b>
3208 </p><p><b>Bold text..</b>
3209 </p><p>..spanning two paragraphs (should not work).
3210 </p><p><b>Bold tag left open</b>
3211 </p><p><i>Italic tag left open</i>
3212 </p><p>Normal text.
3213 </p><p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
3214 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
3215 </p><p>Plain <i>italic'</i>s plain
3216 </p>
3217 !! end
3218 # Parsoid inserts an empty bold tag pair at the end of the line, that the PHP
3219 # parser strips. The wikitext contains just the first half of the bold
3220 # quote pair. (There's also a case where Parsoid nests <b> and <i>
3221 # differently than the PHP parser.)
3222 !! test
3223 Unclosed and unmatched quotes (parsoid)
3224 !! options
3225 parsoid
3226 !! input
3227 '''''Bold italic text '''with bold deactivated''' in between.'''''
3229 '''''Bold italic text ''with italic deactivated'' in between.'''''
3231 '''Bold text..
3233 ..spanning two paragraphs (should not work).'''
3235 '''Bold tag left open
3237 ''Italic tag left open
3239 Normal text.
3241 <!-- Unmatching number of opening, closing tags: -->
3242 '''This year''''s election ''should'' beat '''last year''''s.
3244 ''Tom'''s car is bigger than ''Susan'''s.
3246 Plain ''italic'''s plain
3247 !! result
3248 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
3249 </p><p><i><b>Bold italic text </b></i><b>with italic deactivated<i> in between.</i></b>
3250 </p><p><b>Bold text..</b>
3251 </p><p>..spanning two paragraphs (should not work).<b></b>
3252 </p><p><b>Bold tag left open</b>
3253 </p><p><i>Italic tag left open</i>
3254 </p><p>Normal text.
3255 </p><p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
3256 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
3257 </p><p>Plain <i>italic'</i>s plain
3258 </p>
3259 !! end
3262 ### Tables
3264 ### some content taken from http://meta.wikimedia.org/wiki/MediaWiki_User%27s_Guide:_Using_tables
3267 # This should not produce <table></table> as <table><tr><td></td></tr></table>
3268 # is the bare minimun required by the spec, see:
3269 # http://www.w3.org/TR/xhtml-modularization/dtd_module_defs.html#a_module_Basic_Tables
3270 !! test
3271 A table with no data. (php)
3272 !! options
3274 !! input
3275 {||}
3276 !! result
3277 !! end
3278 # Parsoid team replies: empty table tags are legal in HTML5
3279 !! test
3280 A table with no data. (parsoid)
3281 !! options
3282 parsoid
3283 !! input
3284 {||}
3285 !! result
3286 <table></table>
3287 !! end
3289 # A table with nothing but a caption is invalid XHTML, we might want to render
3290 # this as <p>caption</p>
3291 !! test
3292 A table with nothing but a caption (php)
3293 !! options
3295 !! input
3297 |+ caption
3299 !! result
3300 <table>
3301 <caption> caption
3302 </caption><tr><td></td></tr></table>
3304 !! end
3305 # Parsoid team replies: table with only a caption is legal in HTML5
3306 !! test
3307 A table with nothing but a caption (parsoid)
3308 !! options
3309 parsoid
3310 !! input
3312 |+ caption
3314 !! result
3315 <table><caption> caption</caption></table>
3316 !! end
3318 !! test
3319 A table with caption with default-spaced attributes and a table row
3320 !! input
3322 |+ style="color: red;" | caption1
3324 | foo
3326 !! result
3327 <table>
3328 <caption style="color: red;"> caption1
3329 </caption>
3330 <tr>
3331 <td> foo
3332 </td></tr></table>
3334 !! end
3336 !! test
3337 A table with captions with non-default spaced attributes and a table row
3338 !! input
3340 |+style="color: red;"|caption2
3341 |+ style="color: red;"| caption3
3343 | foo
3345 !! result
3346 <table>
3347 <caption style="color: red;">caption2
3348 </caption>
3349 <caption style="color: red;"> caption3
3350 </caption>
3351 <tr>
3352 <td> foo
3353 </td></tr></table>
3355 !! end
3357 !! test
3358 Table td-cell syntax variations
3359 !! input
3361 | foo bar foo | baz
3362 | foo bar foo || baz
3363 | style='color:red;' | baz
3364 | style='color:red;' || baz
3366 !! result
3367 <table>
3368 <tr>
3369 <td> baz
3370 </td>
3371 <td> foo bar foo </td>
3372 <td> baz
3373 </td>
3374 <td style="color:red;"> baz
3375 </td>
3376 <td> style='color:red;' </td>
3377 <td> baz
3378 </td></tr></table>
3380 !! end
3382 !! test
3383 Simple table
3384 !! input
3386 | 1 || 2
3388 | 3 || 4
3390 !! result
3391 <table>
3392 <tr>
3393 <td> 1 </td>
3394 <td> 2
3395 </td></tr>
3396 <tr>
3397 <td> 3 </td>
3398 <td> 4
3399 </td></tr></table>
3401 !! end
3403 !! test
3404 Simple table but with multiple dashes for row wikitext
3405 !! input
3407 | foo
3408 |-----
3409 | bar
3411 !! result
3412 <table>
3413 <tr>
3414 <td> foo
3415 </td></tr>
3416 <tr>
3417 <td> bar
3418 </td></tr></table>
3420 !! end
3421 !! test
3422 Multiplication table
3423 !! input
3424 {| border="1" cellpadding="2"
3425 |+Multiplication table
3427 ! &times; !! 1 !! 2 !! 3
3429 ! 1
3430 | 1 || 2 || 3
3432 ! 2
3433 | 2 || 4 || 6
3435 ! 3
3436 | 3 || 6 || 9
3438 ! 4
3439 | 4 || 8 || 12
3441 ! 5
3442 | 5 || 10 || 15
3444 !! result
3445 <table border="1" cellpadding="2">
3446 <caption>Multiplication table
3447 </caption>
3448 <tr>
3449 <th> &#215; </th>
3450 <th> 1 </th>
3451 <th> 2 </th>
3452 <th> 3
3453 </th></tr>
3454 <tr>
3455 <th> 1
3456 </th>
3457 <td> 1 </td>
3458 <td> 2 </td>
3459 <td> 3
3460 </td></tr>
3461 <tr>
3462 <th> 2
3463 </th>
3464 <td> 2 </td>
3465 <td> 4 </td>
3466 <td> 6
3467 </td></tr>
3468 <tr>
3469 <th> 3
3470 </th>
3471 <td> 3 </td>
3472 <td> 6 </td>
3473 <td> 9
3474 </td></tr>
3475 <tr>
3476 <th> 4
3477 </th>
3478 <td> 4 </td>
3479 <td> 8 </td>
3480 <td> 12
3481 </td></tr>
3482 <tr>
3483 <th> 5
3484 </th>
3485 <td> 5 </td>
3486 <td> 10 </td>
3487 <td> 15
3488 </td></tr></table>
3490 !! end
3492 !! test
3493 Accept "||" in table headings
3494 !! input
3496 !h1 || h2
3498 !! result
3499 <table>
3500 <tr>
3501 <th>h1 </th>
3502 <th> h2
3503 </th></tr></table>
3505 !! end
3507 !! test
3508 Accept "||" in indented table headings
3509 !! input
3511 !h1 || h2
3513 !! result
3514 <dl><dd><table>
3515 <tr>
3516 <th>h1 </th>
3517 <th> h2
3518 </th></tr></table></dd></dl>
3520 !! end
3522 !! test
3523 Accept empty attributes in td/th cells (td/th cells starting with leading ||)
3524 !! input
3526 !| h1
3527 || a
3529 !! result
3530 <table>
3531 <tr>
3532 <th> h1
3533 </th>
3534 <td> a
3535 </td></tr></table>
3537 !! end
3539 !!test
3540 Accept "| !" at start of line in tables (ignore !-attribute)
3541 !!input
3544 | !style="color:red" | bar
3546 !!result
3547 <table>
3549 <tr>
3550 <td> bar
3551 </td></tr></table>
3553 !!end
3555 !!test
3556 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 +/- 
3557 !!input
3560 |style='color:red;'|+1
3561 |style='color:blue;'|-1
3563 | 1 || 2 || 3
3564 | 1 ||+2 ||-3
3566 | +1
3567 | -1
3569 !!result
3570 <table>
3572 <tr>
3573 <td style="color:red;">+1
3574 </td>
3575 <td style="color:blue;">-1
3576 </td></tr>
3577 <tr>
3578 <td> 1 </td>
3579 <td> 2 </td>
3580 <td> 3
3581 </td>
3582 <td> 1 </td>
3583 <td>+2 </td>
3584 <td>-3
3585 </td></tr>
3586 <tr>
3587 <td> +1
3588 </td>
3589 <td> -1
3590 </td></tr></table>
3592 !!end
3594 !! test
3595 Table rowspan
3596 !! input
3597 {| border=1
3598 | Cell 1, row 1
3599 |rowspan=2| Cell 2, row 1 (and 2)
3600 | Cell 3, row 1
3602 | Cell 1, row 2
3603 | Cell 3, row 2
3605 !! result
3606 <table border="1">
3607 <tr>
3608 <td> Cell 1, row 1
3609 </td>
3610 <td rowspan="2"> Cell 2, row 1 (and 2)
3611 </td>
3612 <td> Cell 3, row 1
3613 </td></tr>
3614 <tr>
3615 <td> Cell 1, row 2
3616 </td>
3617 <td> Cell 3, row 2
3618 </td></tr></table>
3620 !! end
3622 !! test
3623 Nested table
3624 !! input
3625 {| border=1
3626 | &alpha;
3628 {| bgcolor=#ABCDEF border=2
3629 |nested
3631 |table
3633 |the original table again
3635 !! result
3636 <table border="1">
3637 <tr>
3638 <td> &#945;
3639 </td>
3640 <td>
3641 <table bgcolor="#ABCDEF" border="2">
3642 <tr>
3643 <td>nested
3644 </td></tr>
3645 <tr>
3646 <td>table
3647 </td></tr></table>
3648 </td>
3649 <td>the original table again
3650 </td></tr></table>
3652 !! end
3654 !! test
3655 Invalid attributes in table cell (bug 1830)
3656 !! input
3658 |Cell:|broken
3660 !! result
3661 <table>
3662 <tr>
3663 <td>broken
3664 </td></tr></table>
3666 !! end
3669 !! test
3670 Table security: embedded pipes (http://lists.wikimedia.org/mailman/htdig/wikitech-l/2006-April/022293.html)
3671 !! input
3673 | |[ftp://|x||]" onmouseover="alert(document.cookie)">test
3674 !! result
3675 <table>
3676 <tr>
3677 <td>[<a rel="nofollow" class="external free" href="ftp://%7Cx">ftp://%7Cx</a></td>
3678 <td>]" onmouseover="alert(document.cookie)"&gt;test
3679 </td>
3680 </tr>
3681 </table>
3683 !! end
3686 !! test
3687 Indented table markup mixed with indented pre content (proposed in bug 6200)
3688 !! input
3689  <table>
3690  <tr>
3691  <td>
3692  Text that should be rendered preformatted
3693  </td>
3694  </tr>
3695  </table>
3696 !! result
3697  <table>
3698  <tr>
3699  <td>
3700 <pre>Text that should be rendered preformatted
3701 </pre>
3702  </td>
3703  </tr>
3704  </table>
3706 !! end
3708 !! test
3709 Template-generated table cell attributes and cell content
3710 !! input
3712 |{{table_attribs}}
3714 !! result
3715 <table>
3716 <tr>
3717 <td style="color: red"> Foo
3718 </td></tr></table>
3720 !! end
3722 !! test
3723 Table with row followed by newlines and table heading
3724 !! input
3728 ! foo
3730 !! result
3731 <table>
3734 <tr>
3735 <th> foo
3736 </th></tr></table>
3738 !! end
3740 !! test
3741 Table with empty line following the start tag
3742 !! input
3746 | foo
3748 !! result
3749 <table>
3752 <tr>
3753 <td> foo
3754 </td></tr></table>
3756 !! end
3758 # FIXME: Preserve the attribute properly (with an empty string as value) in
3759 # the PHP parser. Parsoid implements the behavior below.
3760 !! test
3761 Table attributes with empty value
3762 !! options
3763 parsoid
3764 !! input
3766 | style=| hello
3768 !! result
3769 <table>
3770 <tbody>
3771 <tr>
3772 <td style=""> hello
3773 </td></tr></tbody></table>
3775 !! end
3777 !! test
3778 Wikitext table with a lot of comments
3779 !! input
3781 <!-- c0 -->
3782 | foo
3783 <!-- c1 -->
3784 |- <!-- c2 -->
3785 <!-- c3 -->
3786 |<!-- c4 -->
3787 <!-- c5 -->
3789 !! result
3790 <table>
3791 <tr>
3792 <td> foo
3793 </td></tr>
3794 <tr>
3795 <td>
3796 </td></tr></table>
3798 !! end
3800 !! test
3801 Wikitext table with double-line table cell
3802 !! input
3807 !! result
3808 <table>
3809 <tr>
3810 <td>a
3811 <p>b
3812 </p>
3813 </td></tr></table>
3815 !! end
3817 !! test
3818 Table cell with a single comment
3819 !! input
3821 | <!-- c1 -->
3822 | a
3824 !! result
3825 <table>
3826 <tr>
3827 <td>
3828 </td>
3829 <td> a
3830 </td></tr></table>
3832 !! end
3834 # The expected HTML structure in this test is debatable. The PHP parser does
3835 # not parse this kind of table at all. The main focus for Parsoid is on
3836 # round-tripping, so this output is ok for now. TODO: revisit!
3837 !! test
3838 Wikitext table with html-syntax row (Parsoid)
3839 !! options
3840 parsoid
3841 !! input
3844 <td>foo</td>
3846 !! result
3847 <table>
3848 <tbody>
3849 <tr>
3850 <td>foo</td></tr></tbody></table>
3851 !! end
3854 ### Internal links
3856 !! test
3857 Plain link, capitalized
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 Plain link, uncapitalized
3867 !! input
3868 [[main Page]]
3869 !! result
3870 <p><a href="/wiki/Main_Page" title="Main Page">main Page</a>
3871 </p>
3872 !! end
3874 !! test
3875 Piped link
3876 !! input
3877 [[Main Page|The Main Page]]
3878 !! result
3879 <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
3880 </p>
3881 !! end
3883 !! test
3884 Piped link with comment in link text
3885 !! input
3886 [[Main Page|The Main<!--front--> Page]]
3887 !! result
3888 <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
3889 </p>
3890 !! end
3892 !! test
3893 Broken link
3894 !! input
3895 [[Zigzagzogzagzig]]
3896 !! result
3897 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig</a>
3898 </p>
3899 !! end
3901 !! test
3902 Broken link with fragment
3903 !! input
3904 [[Zigzagzogzagzig#zug]]
3905 !! result
3906 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig#zug</a>
3907 </p>
3908 !! end
3910 !! test
3911 Special page link with fragment
3912 !! input
3913 [[Special:Version#anchor]]
3914 !! result
3915 <p><a href="/wiki/Special:Version#anchor" title="Special:Version">Special:Version#anchor</a>
3916 </p>
3917 !! end
3919 !! test
3920 Nonexistent special page link with fragment
3921 !! input
3922 [[Special:ThisNameWillHopefullyNeverBeUsed#anchor]]
3923 !! result
3924 <p><a href="/wiki/Special:ThisNameWillHopefullyNeverBeUsed" class="new" title="Special:ThisNameWillHopefullyNeverBeUsed (page does not exist)">Special:ThisNameWillHopefullyNeverBeUsed#anchor</a>
3925 </p>
3926 !! end
3928 !! test
3929 Link with prefix
3930 !! input
3931 xxx[[main Page]], xxx[[Main Page]], Xxx[[main Page]] XXX[[main Page]], XXX[[Main Page]]
3932 !! result
3933 <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>
3934 </p>
3935 !! end
3937 !! test
3938 Link with suffix
3939 !! input
3940 [[Main Page]]xxx, [[Main Page]]XXX, [[Main Page]]!!!
3941 !! result
3942 <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>!!!
3943 </p>
3944 !! end
3946 !! article
3947 prefixed article
3948 !! text
3949 Some text
3950 !! endarticle
3952 !! test
3953 Bug 43661: Piped links with identical prefixes
3954 !! input
3955 [[prefixed article|prefixed articles with spaces]]
3957 [[prefixed article|prefixed articlesaoeu]]
3959 [[Main Page|Main Page test]]
3960 !! result
3961 <p><a href="/wiki/Prefixed_article" title="Prefixed article">prefixed articles with spaces</a>
3962 </p><p><a href="/wiki/Prefixed_article" title="Prefixed article">prefixed articlesaoeu</a>
3963 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page test</a>
3964 </p>
3965 !! end
3968 !! test
3969 Link with HTML entity in suffix / tail
3970 !! input
3971 [[Main Page]]&quot;, [[Main Page]]&#97;
3972 !! result
3973 <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;
3974 </p>
3975 !! end
3977 !! test
3978 Link with 3 brackets
3979 !! input
3980 [[[main page]]]
3981 !! result
3982 <p>[[[main page]]]
3983 </p>
3984 !! end
3986 !! test
3987 Piped link with 3 brackets
3988 !! input
3989 [[[main page|the main page]]]
3990 !! result
3991 <p>[[[main page|the main page]]]
3992 </p>
3993 !! end
3995 !! test
3996 Link with multiple pipes
3997 !! input
3998 [[Main Page|The|Main|Page]]
3999 !! result
4000 <p><a href="/wiki/Main_Page" title="Main Page">The|Main|Page</a>
4001 </p>
4002 !! end
4004 !! test
4005 Link to namespaces
4006 !! input
4007 [[Talk:Parser testing]], [[Meta:Disclaimers]]
4008 !! result
4009 <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>
4010 </p>
4011 !! end
4013 !! test
4014 Piped link to namespace
4015 !! input
4016 [[Meta:Disclaimers|The disclaimers]]
4017 !! result
4018 <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>
4019 </p>
4020 !! end
4022 !! test
4023 Link containing }
4024 !! input
4025 [[Usually caused by a typo (oops}]]
4026 !! result
4027 <p>[[Usually caused by a typo (oops}]]
4028 </p>
4029 !! end
4031 !! test
4032 Link containing % (not as a hex sequence)
4033 !! input
4034 [[7% Solution]]
4035 !! result
4036 <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>
4037 </p>
4038 !! end
4040 !! test
4041 Link containing % as a single hex sequence interpreted to char
4042 !! input
4043 [[7%25 Solution]]
4044 !! result
4045 <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>
4046 </p>
4047 !!end
4049 !! test
4050 Link containing % as a double hex sequence interpreted to hex sequence
4051 !! input
4052 [[7%2525 Solution]]
4053 !! result
4054 <p>[[7%2525 Solution]]
4055 </p>
4056 !!end
4058 !! test
4059 Link containing "#<" and "#>" % as a hex sequences- these are valid section anchors
4060 Example for such a section: == < ==
4061 !! input
4062 [[%23%3c]][[%23%3e]]
4063 !! result
4064 <p><a href="#.3C">#&lt;</a><a href="#.3E">#&gt;</a>
4065 </p>
4066 !! end
4068 !! test
4069 Link containing "<#" and ">#" as a hex sequences
4070 !! input
4071 [[%3c%23]][[%3e%23]]
4072 !! result
4073 <p>[[%3c%23]][[%3e%23]]
4074 </p>
4075 !! end
4077 !! test
4078 Link containing an equals sign
4079 !! input
4080 [[Special:BookSources/isbn=4-00-026157-6]]
4081 !! result
4082 <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>
4083 </p>
4084 !! end
4086 !! article
4087 Foo~bar
4088 !! text
4089 Just a test of an article title containing a tilde.
4090 !! endarticle
4092 # note that links containing signatures, like [[Foo~~~~]], are
4093 # massaged by the pre-save transform (PST) and so the tildes are never
4094 # seen by the parser.
4095 !! test
4096 Link containing a tilde
4097 !! input
4098 [[Foo~bar]]
4099 !! result
4100 <p><a href="/wiki/Foo%7Ebar" title="Foo~bar">Foo~bar</a>
4101 </p>
4102 !! end
4104 !! test
4105 Link containing double-single-quotes '' (bug 4598)
4106 !! input
4107 [[Lista d''e paise d''o munno]]
4108 !! result
4109 <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>
4110 </p>
4111 !! end
4113 !! test
4114 Link containing double-single-quotes '' in text (bug 4598 sanity check)
4115 !! input
4116 Some [[Link|pretty ''italics'' and stuff]]!
4117 !! result
4118 <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>!
4119 </p>
4120 !! end
4122 !! test
4123 Link containing double-single-quotes '' in text embedded in italics (bug 4598 sanity check)
4124 !! input
4125 ''Some [[Link|pretty ''italics'' and stuff]]!
4126 !! result
4127 <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>
4128 </p>
4129 !! end
4131 !! test
4132 Link with double quotes in title part (literal) and alternate part (interpreted)
4133 !! input
4134 [[File:Denys Savchenko ''Pentecoste''.jpg]]
4136 [[''Pentecoste'']]
4138 [[''Pentecoste''|Pentecoste]]
4140 [[''Pentecoste''|''Pentecoste'']]
4141 !! result
4142 <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>
4143 </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>
4144 </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>
4145 </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>
4146 </p>
4147 !! end
4149 !! test
4150 Broken image links with HTML captions (bug 39700)
4151 !! input
4152 [[File:Nonexistent|<script></script>]]
4153 [[File:Nonexistent|100px|<script></script>]]
4154 [[File:Nonexistent|&lt;]]
4155 [[File:Nonexistent|a<i>b</i>c]]
4156 !! result
4157 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script&gt;&lt;/script&gt;</a>
4158 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script&gt;&lt;/script&gt;</a>
4159 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;</a>
4160 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">abc</a>
4161 </p>
4162 !! end
4164 !! test
4165 Plain link to URL
4166 !! input
4167 [[http://www.example.com]]
4168 !! result
4169 <p>[<a rel="nofollow" class="external autonumber" href="http://www.example.com">[1]</a>]
4170 </p>
4171 !! end
4173 !! test
4174 Plain link to URL with link text
4175 !! input
4176 [[http://www.example.com Link text]]
4177 !! result
4178 <p>[<a rel="nofollow" class="external text" href="http://www.example.com">Link text</a>]
4179 </p>
4180 !! end
4182 !! test
4183 Plain link to protocol-relative URL
4184 !! input
4185 [[//www.example.com]]
4186 !! result
4187 <p>[<a rel="nofollow" class="external autonumber" href="//www.example.com">[1]</a>]
4188 </p>
4189 !! end
4191 !! test
4192 Plain link to protocol-relative URL with link text
4193 !! input
4194 [[//www.example.com Link text]]
4195 !! result
4196 <p>[<a rel="nofollow" class="external text" href="//www.example.com">Link text</a>]
4197 </p>
4198 !! end
4200 !! test
4201 Plain link to page with question mark in title
4202 !! input
4203 [[A?b]]
4205 [[A?b|Baz]]
4206 !! result
4207 <p><a href="/wiki/A%3Fb" title="A?b">A?b</a>
4208 </p><p><a href="/wiki/A%3Fb" title="A?b">Baz</a>
4209 </p>
4210 !! end
4213 # I'm fairly sure the expected result here is wrong.
4214 # We want these to be URL links, not pseudo-pages with URLs for titles....
4215 # However the current output is also pretty screwy.
4217 # ----
4218 # I'm changing it to match the current output--it arguably makes more
4219 # sense in the light of the test above. Old expected result was:
4220 #<p>Piped link to URL: <a href="/index.php?title=Http://www.example.com&amp;action=edit" class="new">an example URL</a>
4221 #</p>
4222 # But I think this test is bordering on "garbage in, garbage out" anyway.
4223 # -- wtm
4224 !! test
4225 Piped link to URL
4226 !! input
4227 Piped link to URL: [[http://www.example.com|an example URL]]
4228 !! result
4229 <p>Piped link to URL: [<a rel="nofollow" class="external text" href="http://www.example.com%7Can">example URL</a>]
4230 </p>
4231 !! end
4233 !! test
4234 BUG 2: [[page|http://url/]] should link to page, not http://url/
4235 !! input
4236 [[Main Page|http://url/]]
4237 !! result
4238 <p><a href="/wiki/Main_Page" title="Main Page">http://url/</a>
4239 </p>
4240 !! end
4242 !! test
4243 BUG 337: Escaped self-links should be bold
4244 !! options
4245 title=[[Bug462]]
4246 !! input
4247 [[Bu&#103;462]] [[Bug462]]
4248 !! result
4249 <p><strong class="selflink">Bu&#103;462</strong> <strong class="selflink">Bug462</strong>
4250 </p>
4251 !! end
4253 !! test
4254 Self-link to section should not be bold
4255 !! options
4256 title=[[Main Page]]
4257 !! input
4258 [[Main Page#section]]
4259 !! result
4260 <p><a href="/wiki/Main_Page#section" title="Main Page">Main Page#section</a>
4261 </p>
4262 !! end
4264 !! article
4266 !! text
4267 This is 00.
4268 !! endarticle
4270 !!test
4271 Self-link to numeric title
4272 !!options
4273 title=[[0]]
4274 !!input
4275 [[0]]
4276 !!result
4277 <p><strong class="selflink">0</strong>
4278 </p>
4279 !!end
4281 !!test
4282 Link to numeric-equivalent title
4283 !!options
4284 title=[[0]]
4285 !!input
4286 [[00]]
4287 !!result
4288 <p><a href="/wiki/00" title="00">00</a>
4289 </p>
4290 !!end
4292 !! test
4293 <nowiki> inside a link
4294 !! input
4295 [[Main<nowiki> Page</nowiki>]] [[Main Page|the main page <nowiki>[it's not very good]</nowiki>]]
4296 !! result
4297 <p>[[Main Page]] <a href="/wiki/Main_Page" title="Main Page">the main page [it's not very good]</a>
4298 </p>
4299 !! end
4301 !! test
4302 Non-breaking spaces in title
4303 !! input
4304 [[&nbsp; Main &nbsp; Page &nbsp;]]
4305 !! result
4306 <p><a href="/wiki/Main_Page" title="Main Page">&#160; Main &#160; Page &#160;</a>
4307 </p>
4308 !!end
4310 !! test
4311 Internal link with ca linktrail, surrounded by bold apostrophes (bug 27473 primary issue)
4312 !! options
4313 language=ca
4314 !! input
4315 '''[[Main Page]]'''
4316 !! result
4317 <p><b><a href="/wiki/Main_Page" title="Main Page">Main Page</a></b>
4318 </p>
4319 !! end
4321 !! test
4322 Internal link with ca linktrail, surrounded by italic apostrophes (bug 27473 primary issue)
4323 !! options
4324 language=ca
4325 !! input
4326 ''[[Main Page]]''
4327 !! result
4328 <p><i><a href="/wiki/Main_Page" title="Main Page">Main Page</a></i>
4329 </p>
4330 !! end
4332 !! test
4333 Internal link with en linktrail: no apostrophes (bug 27473)
4334 !! options
4335 language=en
4336 !! input
4337 [[Something]]'nice
4338 !! result
4339 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (page does not exist)">Something</a>'nice
4340 </p>
4341 !! end
4343 !! test
4344 Internal link with ca linktrail with apostrophes (bug 27473)
4345 !! options
4346 language=ca
4347 !! input
4348 [[Something]]'nice
4349 !! result
4350 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (encara no existeix)">Something'nice</a>
4351 </p>
4352 !! end
4354 !! test
4355 Internal link with kaa linktrail with apostrophes (bug 27473)
4356 !! options
4357 language=kaa
4358 !! input
4359 [[Something]]'nice
4360 !! result
4361 <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>
4362 </p>
4363 !! end
4365 !! article
4366 Söfnuður
4367 !! text
4368 Test.
4369 !! endarticle
4371 !! test
4372 Internal link with is link prefix
4373 !! options
4374 language=is
4375 !! input
4376 Aðrir mótmælenda[[söfnuður|söfnuðir]] og
4377 !! result
4378 <p>Aðrir <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðir</a> og
4379 </p>
4380 !! end
4382 !! article
4383 Mótmælendatrú
4384 !! text
4385 Test.
4386 !! endarticle
4388 !! test
4389 Internal link with is link trail and link prefix
4390 !! options
4391 language=is
4392 !! input
4393 [[mótmælendatrú|xxx]]ar
4394 [[mótmælendatrú]]ar
4395 mótmælenda[[söfnuður]]
4396 mótmælenda[[söfnuður|söfnuðir]]
4397 mótmælenda[[söfnuður|söfnuðir]]xxx
4398 !! result
4399 <p><a href="/wiki/M%C3%B3tm%C3%A6lendatr%C3%BA" title="Mótmælendatrú">xxxar</a>
4400 <a href="/wiki/M%C3%B3tm%C3%A6lendatr%C3%BA" title="Mótmælendatrú">mótmælendatrúar</a>
4401 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuður</a>
4402 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðir</a>
4403 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðirxxx</a>
4404 </p>
4405 !! end
4407 !! test
4408 Parsoid link trail escaping
4409 !! options
4410 parsoid=html2wt,html2html
4411 !! input
4412 [[apple]]<nowiki/>s
4413 !! result
4414 <p><a rel="mw:WikiLink" href="Apple">apple</a>s</p>
4415 !! end
4417 !! test
4418 Parsoid link prefix escaping
4419 !! options
4420 language=is
4421 parsoid=html2wt,html2html
4422 !! input
4423 Aðrir mótmælenda<nowiki/>[[söfnuður]]
4424 !! result
4425 <p>Aðrir mótmælenda<a rel="mw:WikiLink" href="Söfnuður">söfnuður</a></p>
4426 !! end
4428 !! test
4429 Parsoid-centric test: Whitespace in ext- and wiki-links should be preserved
4430 !! input
4431 [[Foo|  bar]]
4433 [[Foo|  ''bar'']]
4435 [http://wp.org   foo]
4437 [http://wp.org   ''foo'']
4438 !! result
4439 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">  bar</a>
4440 </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>
4441 </p><p><a rel="nofollow" class="external text" href="http://wp.org">foo</a>
4442 </p><p><a rel="nofollow" class="external text" href="http://wp.org"><i>foo</i></a>
4443 </p>
4444 !! end
4447 ### Interwiki links (see maintenance/interwiki.sql)
4450 !! test
4451 Inline interwiki link
4452 !! input
4453 [[MeatBall:SoftSecurity]]
4454 !! result
4455 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity</a>
4456 </p>
4457 !! end
4459 !! test
4460 Inline interwiki link with empty title (bug 2372)
4461 !! input
4462 [[MeatBall:]]
4463 !! result
4464 <p><a href="http://www.usemod.com/cgi-bin/mb.pl" class="extiw" title="meatball:">MeatBall:</a>
4465 </p>
4466 !! end
4468 !! test
4469 Interwiki link encoding conversion (bug 1636)
4470 !! input
4471 *[[Wikipedia:ro:Olteni&#0355;a]]
4472 *[[Wikipedia:ro:Olteni&#355;a]]
4473 !! result
4474 <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>
4475 </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>
4476 </li></ul>
4478 !! end
4480 !! test
4481 Interwiki link with fragment (bug 2130)
4482 !! input
4483 [[MeatBall:SoftSecurity#foo]]
4484 !! result
4485 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity#foo" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity#foo</a>
4486 </p>
4487 !! end
4489 !! test
4490 Interlanguage link
4491 !! input
4492 Blah blah blah
4493 [[zh:Chinese]]
4494 !!result
4495 <p>Blah blah blah
4496 </p>
4497 !! end
4499 !! test
4500 Double interlanguage link
4501 !! input
4502 Blah blah blah
4503 [[es:Spanish]]
4504 [[zh:Chinese]]
4505 !!result
4506 <p>Blah blah blah
4507 </p>
4508 !! end
4510 !! test
4511 Interlanguage link, with prefix links
4512 !! options
4513 language=ln
4514 !! input
4515 Blah blah blah
4516 [[zh:Chinese]]
4517 !!result
4518 <p>Blah blah blah
4519 </p>
4520 !! end
4522 !! test
4523 Double interlanguage link, with prefix links (bug 8897)
4524 !! options
4525 language=ln
4526 !! input
4527 Blah blah blah
4528 [[es:Spanish]]
4529 [[zh:Chinese]]
4530 !!result
4531 <p>Blah blah blah
4532 </p>
4533 !! end
4535 !! test
4536 Parsoid-specific test: Wikilinks with &nbsp; should RT properly
4537 !! options
4538 language=ln
4539 !! input
4540 [[WW&nbsp;II]]
4541 !!result
4542 <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>
4543 </p>
4544 !! end
4547 ## XHTML tidiness
4550 !! test
4551 <br> to <br />
4552 !! input
4553 1<br>2<br />3
4554 !! result
4555 <p>1<br />2<br />3
4556 </p>
4557 !! end
4559 !! test
4560 Broken br tag sanitization
4561 !! input
4562 </br>
4563 !! result
4564 <p>&lt;/br&gt;
4565 </p>
4566 !! end
4568 !! test
4569 Incorrecly removing closing slashes from correctly formed XHTML
4570 !! input
4571 <br style="clear:both;" />
4572 !! result
4573 <p><br style="clear:both;" />
4574 </p>
4575 !! end
4577 !! test
4578 Failing to transform badly formed HTML into correct XHTML
4579 !! input
4580 <br style="clear: left;">
4581 <br style="clear: right;">
4582 <br style="clear: both;">
4583 !! result
4584 <p><br style="clear: left;" />
4585 <br style="clear: right;" />
4586 <br style="clear: both;" />
4587 </p>
4588 !!end
4590 !! test
4591 Handling html with a div self-closing tag
4592 !! input
4593 <div title />
4594 <div title/>
4595 <div title/ >
4596 <div title=bar />
4597 <div title=bar/>
4598 <div title=bar/ >
4599 !! result
4600 <p>&lt;div title /&gt;
4601 &lt;div title/&gt;
4602 </p>
4603 <div>
4604 <p>&lt;div title=bar /&gt;
4605 &lt;div title=bar/&gt;
4606 </p>
4607 <div title="bar/"></div>
4608 </div>
4610 !! end
4612 !! test
4613 Handling html with a br self-closing tag
4614 !! input
4615 <br title />
4616 <br title/>
4617 <br title/ >
4618 <br title=bar />
4619 <br title=bar/>
4620 <br title=bar/ >
4621 !! result
4622 <p><br title="title" />
4623 <br title="title" />
4624 <br />
4625 <br title="bar" />
4626 <br title="bar" />
4627 <br title="bar/" />
4628 </p>
4629 !! end
4631 !! test
4632 Horizontal ruler (should it add that extra space?)
4633 !! input
4634 <hr>
4635 <hr >
4636 foo <hr
4637 > bar
4638 !! result
4639 <hr />
4640 <hr />
4641 foo <hr /> bar
4643 !! end
4645 !! test
4646 Horizontal ruler -- 4+ dashes render hr
4647 !! input
4648 ----
4649 !! result
4650 <hr />
4652 !! end
4654 !! test
4655 Horizontal ruler -- eats additional dashes on the same line
4656 !! input
4657 ---------
4658 !! result
4659 <hr />
4661 !! end
4663 !! test
4664 Horizontal ruler -- does not collapse dashes on consecutive lines
4665 !! input
4666 ----
4667 ----
4668 !! result
4669 <hr />
4670 <hr />
4672 !! end
4674 !! test
4675 Horizontal ruler -- <4 dashes render as plain text
4676 !! input
4678 !! result
4679 <p>---
4680 </p>
4681 !! end
4683 !! test
4684 Horizontal ruler -- Supports content following dashes on same line
4685 !! input
4686 ---- Foo
4687 !! result
4688 <hr /> Foo
4690 !! end
4693 ### Block-level elements
4695 !! test
4696 Common list
4697 !! input
4698 *Common list
4699 * item 2
4700 *item 3
4701 !! result
4702 <ul><li>Common list
4703 </li><li> item 2
4704 </li><li>item 3
4705 </li></ul>
4707 !! end
4709 !! test
4710 Numbered list
4711 !! input
4712 #Numbered list
4713 #item 2
4714 # item 3
4715 !! result
4716 <ol><li>Numbered list
4717 </li><li>item 2
4718 </li><li> item 3
4719 </li></ol>
4721 !! end
4723 !! test
4724 Mixed list
4725 !! input
4726 *Mixed list
4727 *# with numbers
4728 ** and bullets
4729 *# and numbers
4730 *bullets again
4731 **bullet level 2
4732 ***bullet level 3
4733 ***#Number on level 4
4734 **bullet level 2
4735 **#Number on level 3
4736 **#Number on level 3
4737 *#number level 2
4738 *Level 1
4739 *** Level 3
4740 #** Level 3, but ordered
4741 !! result
4742 <ul><li>Mixed list
4743 <ol><li> with numbers
4744 </li></ol>
4745 <ul><li> and bullets
4746 </li></ul>
4747 <ol><li> and numbers
4748 </li></ol>
4749 </li><li>bullets again
4750 <ul><li>bullet level 2
4751 <ul><li>bullet level 3
4752 <ol><li>Number on level 4
4753 </li></ol>
4754 </li></ul>
4755 </li><li>bullet level 2
4756 <ol><li>Number on level 3
4757 </li><li>Number on level 3
4758 </li></ol>
4759 </li></ul>
4760 <ol><li>number level 2
4761 </li></ol>
4762 </li><li>Level 1
4763 <ul><li><ul><li> Level 3
4764 </li></ul>
4765 </li></ul>
4766 </li></ul>
4767 <ol><li><ul><li><ul><li> Level 3, but ordered
4768 </li></ul>
4769 </li></ul>
4770 </li></ol>
4772 !! end
4774 !! test
4775 Nested lists 1
4776 !! input
4777 *foo
4778 **bar
4779 !! result
4780 <ul><li>foo
4781 <ul><li>bar
4782 </li></ul>
4783 </li></ul>
4785 !! end
4787 !! test
4788 Nested lists 2
4789 !! input
4790 **foo
4791 *bar
4792 !! result
4793 <ul><li><ul><li>foo
4794 </li></ul>
4795 </li><li>bar
4796 </li></ul>
4798 !! end
4800 !! test
4801 Nested lists 3 (first element empty)
4802 !! input
4804 **bar
4805 !! result
4806 <ul><li>
4807 <ul><li>bar
4808 </li></ul>
4809 </li></ul>
4811 !! end
4813 !! test
4814 Nested lists 4 (first element empty)
4815 !! input
4817 *bar
4818 !! result
4819 <ul><li><ul><li>
4820 </li></ul>
4821 </li><li>bar
4822 </li></ul>
4824 !! end
4826 !! test
4827 Nested lists 5 (both elements empty)
4828 !! input
4831 !! result
4832 <ul><li><ul><li>
4833 </li></ul>
4834 </li><li>
4835 </li></ul>
4837 !! end
4839 !! test
4840 Nested lists 6 (both elements empty)
4841 !! input
4844 !! result
4845 <ul><li>
4846 <ul><li>
4847 </li></ul>
4848 </li></ul>
4850 !! end
4852 !! test
4853 Nested lists 7 (skip initial nesting levels)
4854 !! input
4855 *** foo
4856 !! result
4857 <ul><li><ul><li><ul><li> foo
4858 </li></ul>
4859 </li></ul>
4860 </li></ul>
4862 !! end
4864 !! test
4865 Nested lists 8 (multiple nesting transitions)
4866 !! input
4867 * foo
4868 *** bar
4869 ** baz
4870 * boo
4871 !! result
4872 <ul><li> foo
4873 <ul><li><ul><li> bar
4874 </li></ul>
4875 </li><li> baz
4876 </li></ul>
4877 </li><li> boo
4878 </li></ul>
4880 !! end
4882 !! test
4883 1. Lists with start-of-line-transparent tokens before bullets: Comments
4884 !! input
4885 *foo
4886 *<!--cmt-->bar
4887 <!--cmt-->*baz
4888 !! result
4889 <ul><li>foo
4890 </li><li>bar
4891 </li><li>baz
4892 </li></ul>
4894 !! end
4896 !! test
4897 2. Lists with start-of-line-transparent tokens before bullets: Template close
4898 !! input
4899 *foo {{echo|bar
4900 }}*baz
4901 !! result
4902 <ul><li>foo bar
4903 </li><li>baz
4904 </li></ul>
4906 !! end
4908 !! test
4909 Unbalanced closing block tags break a list
4910 (Parsoid-only since php parser generates broken html -- relies on Tidy to fix up)
4911 !! options
4912 parsoid
4913 !! input
4914 <div>
4915 *a</div><div>
4916 *b</div>
4917 !! result
4918 <div>
4919 <ul><li>a
4920 </li></ul></div><div>
4921 <ul><li>b
4922 </li></ul></div>
4923 !! end
4925 !! test
4926 Unbalanced closing non-block tags don't break a list
4927 (Parsoid-only since php parser generates broken html -- relies on Tidy to fix up)
4928 !! options
4929 parsoid
4930 !! input
4931 <span>
4932 *a</span><span>
4933 *b</span>
4934 !! result
4935 <p><span></span>
4936 </p>
4937 <ul><li>a<span></span>
4938 </li><li>b
4939 </li></ul>
4940 !! end
4942 !! test
4943 Unclosed formatting tags that straddle lists are closed and reopened
4944 (Parsoid-only since php parser generates broken html -- relies on Tidy to fix up)
4945 !! options
4946 parsoid
4947 !! input
4948 # <s> a
4949 # b </s>
4950 !! result
4951 <ol><li> <s> a </s>
4952 </li><li> <s> b </s>
4953 </li></ol>
4954 !! end
4956 !!test
4957 List embedded in a non-block tag
4958 (Ugly Parsoid output -- worth fixing; Disabled for PHP parser since it relies on Tidy)
4959 !! options
4960 parsoid
4961 !!input
4962 <small>
4963 * foo
4964 </small>
4965 !!result
4966 <p><small></small></p>
4967 <small>
4968 <ul>
4969 <li> foo</li>
4970 </ul>
4971 </small>
4972 <p><small></small></p>
4973 !!end
4975 !! test
4976 List items are not parsed correctly following a <pre> block (bug 785)
4977 !! input
4978 * <pre>foo</pre>
4979 * <pre>bar</pre>
4980 * zar
4981 !! result
4982 <ul><li> <pre>foo</pre>
4983 </li><li> <pre>bar</pre>
4984 </li><li> zar
4985 </li></ul>
4987 !! end
4989 !! test
4990 List items from template
4991 !! input
4993 {{inner list}}
4994 * item 2
4996 * item 0
4997 {{inner list}}
4998 * item 2
5000 * item 0
5001 * notSOL{{inner list}}
5002 * item 2
5003 !! result
5004 <ul><li> item 1
5005 </li><li> item 2
5006 </li></ul>
5007 <ul><li> item 0
5008 </li><li> item 1
5009 </li><li> item 2
5010 </li></ul>
5011 <ul><li> item 0
5012 </li><li> notSOL
5013 </li><li> item 1
5014 </li><li> item 2
5015 </li></ul>
5017 !! end
5019 !! test
5020 List interrupted by empty line or heading
5021 !! input
5022 * foo
5024 ** bar
5025 == A heading ==
5026 * Another list item
5027 !! result
5028 <ul><li> foo
5029 </li></ul>
5030 <ul><li><ul><li> bar
5031 </li></ul>
5032 </li></ul>
5033 <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>
5034 <ul><li> Another list item
5035 </li></ul>
5037 !!end
5039 !!test
5040 Multiple list tags generated by templates
5041 !!input
5042 {{echo|<li>}}a
5043 {{echo|<li>}}b
5044 {{echo|<li>}}c
5045 !!result
5046 <li>a
5047 <li>b
5048 <li>c</li>
5049 </li>
5050 </li>
5052 !!end
5054 !!test
5055 Single-comment whitespace lines dont break lists, but multi-comment whitespace lines do
5056 !!input
5058 <!--This line will NOT split the list-->
5060  <!--This line will NOT split the list either-->
5062  <!--foo--> <!--This line with more than 1 comment will split the list-->
5064 !!result
5065 <ul><li>a
5066 </li><li>b
5067 </li><li>c
5068 </li></ul>
5069 <ul><li>d
5070 </li></ul>
5072 !!end
5074 !!test
5075 Test the li-hack
5076 (Cannot test this with PHP parser since it relies on Tidy for the hack)
5077 !!options
5078 parsoid=wt2html,wt2wt
5079 !!input
5080 * foo
5081 * <li>li-hack
5082 * {{echo|<li>templated li-hack}}
5083 * <!--foo--> <li> unsupported li-hack with preceding comments
5085 <ul>
5086 <li><li>not a li-hack
5087 </li>
5088 </ul>
5089 !!result
5090 <ul><li> foo</li>
5091 <li>li-hack</li>
5092 <li about="#mwt1" typeof="mw:Transclusion" data-mw='{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"<li>templated li-hack"}}}'>templated li-hack</li>
5093 <li> <!--foo--> </li><li> li-hack with preceding comments</li></ul>
5095 <ul>
5096 <li></li><li>not a li-hack
5097 </li>
5098 </ul>
5099 !!end
5102 ### Magic Words
5105 !! test
5106 Magic Word: {{CURRENTDAY}}
5107 !! input
5108 {{CURRENTDAY}}
5109 !! result
5110 <p>1
5111 </p>
5112 !! end
5114 !! test
5115 Magic Word: {{CURRENTDAY2}}
5116 !! input
5117 {{CURRENTDAY2}}
5118 !! result
5119 <p>01
5120 </p>
5121 !! end
5123 !! test
5124 Magic Word: {{CURRENTDAYNAME}}
5125 !! input
5126 {{CURRENTDAYNAME}}
5127 !! result
5128 <p>Thursday
5129 </p>
5130 !! end
5132 !! test
5133 Magic Word: {{CURRENTDOW}}
5134 !! input
5135 {{CURRENTDOW}}
5136 !! result
5137 <p>4
5138 </p>
5139 !! end
5141 !! test
5142 Magic Word: {{CURRENTMONTH}}
5143 !! input
5144 {{CURRENTMONTH}}
5145 !! result
5146 <p>01
5147 </p>
5148 !! end
5150 !! test
5151 Magic Word: {{CURRENTMONTHABBREV}}
5152 !! input
5153 {{CURRENTMONTHABBREV}}
5154 !! result
5155 <p>Jan
5156 </p>
5157 !! end
5159 !! test
5160 Magic Word: {{CURRENTMONTHNAME}}
5161 !! input
5162 {{CURRENTMONTHNAME}}
5163 !! result
5164 <p>January
5165 </p>
5166 !! end
5168 !! test
5169 Magic Word: {{CURRENTMONTHNAMEGEN}}
5170 !! input
5171 {{CURRENTMONTHNAMEGEN}}
5172 !! result
5173 <p>January
5174 </p>
5175 !! end
5177 !! test
5178 Magic Word: {{CURRENTTIME}}
5179 !! input
5180 {{CURRENTTIME}}
5181 !! result
5182 <p>00:02
5183 </p>
5184 !! end
5186 !! test
5187 Magic Word: {{CURRENTWEEK}} (@bug 4594)
5188 !! input
5189 {{CURRENTWEEK}}
5190 !! result
5191 <p>1
5192 </p>
5193 !! end
5195 !! test
5196 Magic Word: {{CURRENTYEAR}}
5197 !! input
5198 {{CURRENTYEAR}}
5199 !! result
5200 <p>1970
5201 </p>
5202 !! end
5204 !! test
5205 Magic Word: {{FULLPAGENAME}}
5206 !! options
5207 title=[[User:Ævar Arnfjörð Bjarmason]]
5208 !! input
5209 {{FULLPAGENAME}}
5210 !! result
5211 <p>User:Ævar Arnfjörð Bjarmason
5212 </p>
5213 !! end
5215 !! test
5216 Magic Word: {{FULLPAGENAMEE}}
5217 !! options
5218 title=[[User:Ævar Arnfjörð Bjarmason]]
5219 !! input
5220 {{FULLPAGENAMEE}}
5221 !! result
5222 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
5223 </p>
5224 !! end
5226 !! test
5227 Magic Word: {{NAMESPACE}}
5228 !! options
5229 title=[[User:Ævar Arnfjörð Bjarmason]]
5230 !! input
5231 {{NAMESPACE}}
5232 !! result
5233 <p>User
5234 </p>
5235 !! end
5237 !! test
5238 Magic Word: {{NAMESPACEE}}
5239 !! options
5240 title=[[User:Ævar Arnfjörð Bjarmason]]
5241 !! input
5242 {{NAMESPACEE}}
5243 !! result
5244 <p>User
5245 </p>
5246 !! end
5248 !! test
5249 Magic Word: {{NAMESPACENUMBER}}
5250 !! options
5251 title=[[User:Ævar Arnfjörð Bjarmason]]
5252 !! input
5253 {{NAMESPACENUMBER}}
5254 !! result
5255 <p>2
5256 </p>
5257 !! end
5259 !! test
5260 Magic Word: {{NUMBEROFFILES}}
5261 !! input
5262 {{NUMBEROFFILES}}
5263 !! result
5264 <p>4
5265 </p>
5266 !! end
5268 !! test
5269 Magic Word: {{PAGENAME}}
5270 !! options
5271 title=[[User:Ævar Arnfjörð Bjarmason]]
5272 !! input
5273 {{PAGENAME}}
5274 !! result
5275 <p>Ævar Arnfjörð Bjarmason
5276 </p>
5277 !! end
5279 !! test
5280 Magic Word: {{PAGENAME}} with metacharacters
5281 !! options
5282 title=[['foo & bar = baz']]
5283 !! input
5284 ''{{PAGENAME}}''
5285 !! result
5286 <p><i>&#39;foo &#38; bar &#61; baz&#39;</i>
5287 </p>
5288 !! end
5290 !! test
5291 Magic Word: {{PAGENAME}} with metacharacters (bug 26781)
5292 !! options
5293 title=[[*RFC 1234 http://example.com/]]
5294 !! input
5295 {{PAGENAME}}
5296 !! result
5297 <p>&#42;RFC&#32;1234 http&#58;//example.com/
5298 </p>
5299 !! end
5301 !! test
5302 Magic Word: {{PAGENAMEE}}
5303 !! options
5304 title=[[User:Ævar Arnfjörð Bjarmason]]
5305 !! input
5306 {{PAGENAMEE}}
5307 !! result
5308 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
5309 </p>
5310 !! end
5312 !! test
5313 Magic Word: {{PAGENAMEE}} with metacharacters (bug 26781)
5314 !! options
5315 title=[[*RFC 1234 http://example.com/]]
5316 !! input
5317 {{PAGENAMEE}}
5318 !! result
5319 <p>&#42;RFC_1234_http&#58;//example.com/
5320 </p>
5321 !! end
5323 !! test
5324 Magic Word: {{REVISIONID}}
5325 !! input
5326 {{REVISIONID}}
5327 !! result
5328 <p>1337
5329 </p>
5330 !! end
5332 !! test
5333 Magic Word: {{SCRIPTPATH}}
5334 !! input
5335 {{SCRIPTPATH}}
5336 !! result
5337 <p>/
5338 </p>
5339 !! end
5341 !! test
5342 Magic Word: {{SERVER}}
5343 !! input
5344 {{SERVER}}
5345 !! result
5346 <p><a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
5347 </p>
5348 !! end
5350 !! test
5351 Magic Word: {{SERVERNAME}}
5352 !! input
5353 {{SERVERNAME}}
5354 !! result
5355 <p>example.org
5356 </p>
5357 !! end
5359 !! test
5360 Magic Word: {{SITENAME}}
5361 !! input
5362 {{SITENAME}}
5363 !! result
5364 <p>MediaWiki
5365 </p>
5366 !! end
5368 !! test
5369 Case-sensitive magic words, when cased differently, should just be template transclusions
5370 !! input
5371 {{CurrentMonth}}
5372 {{currentday}}
5373 {{cURreNTweEK}}
5374 {{currentHour}}
5375 !! result
5376 <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>
5377 <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>
5378 <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>
5379 <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>
5380 </p>
5381 !! end
5383 !! test
5384 Case-insensitive magic words should still work with weird casing.
5385 !! input
5386 {{sErVeRNaMe}}
5387 {{LCFirst:AOEU}}
5388 {{ucFIRST:aoeu}}
5389 {{SERver}}
5390 !! result
5391 <p>example.org
5392 aOEU
5393 Aoeu
5394 <a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
5395 </p>
5396 !! end
5398 !! test
5399 Namespace 1 {{ns:1}}
5400 !! input
5401 {{ns:1}}
5402 !! result
5403 <p>Talk
5404 </p>
5405 !! end
5407 !! test
5408 Namespace 1 {{ns:01}}
5409 !! input
5410 {{ns:01}}
5411 !! result
5412 <p>Talk
5413 </p>
5414 !! end
5416 !! test
5417 Namespace 0 {{ns:0}} (bug 4783)
5418 !! input
5419 {{ns:0}}
5420 !! result
5422 !! end
5424 !! test
5425 Namespace 0 {{ns:00}} (bug 4783)
5426 !! input
5427 {{ns:00}}
5428 !! result
5430 !! end
5432 !! test
5433 Namespace -1 {{ns:-1}}
5434 !! input
5435 {{ns:-1}}
5436 !! result
5437 <p>Special
5438 </p>
5439 !! end
5441 !! test
5442 Namespace User {{ns:User}}
5443 !! input
5444 {{ns:User}}
5445 !! result
5446 <p>User
5447 </p>
5448 !! end
5450 !! test
5451 Namespace User talk {{ns:User_talk}}
5452 !! input
5453 {{ns:User_talk}}
5454 !! result
5455 <p>User talk
5456 </p>
5457 !! end
5459 !! test
5460 Namespace User talk {{ns:uSeR tAlK}}
5461 !! input
5462 {{ns:uSeR tAlK}}
5463 !! result
5464 <p>User talk
5465 </p>
5466 !! end
5468 !! test
5469 Namespace File {{ns:File}}
5470 !! input
5471 {{ns:File}}
5472 !! result
5473 <p>File
5474 </p>
5475 !! end
5477 !! test
5478 Namespace File {{ns:Image}}
5479 !! input
5480 {{ns:Image}}
5481 !! result
5482 <p>File
5483 </p>
5484 !! end
5486 !! test
5487 Namespace (lang=de) Benutzer {{ns:User}}
5488 !! options
5489 language=de
5490 !! input
5491 {{ns:User}}
5492 !! result
5493 <p>Benutzer
5494 </p>
5495 !! end
5497 !! test
5498 Namespace (lang=de) Benutzer Diskussion {{ns:3}}
5499 !! options
5500 language=de
5501 !! input
5502 {{ns:3}}
5503 !! result
5504 <p>Benutzer Diskussion
5505 </p>
5506 !! end
5509 !! test
5510 Urlencode
5511 !! input
5512 {{urlencode:hi world?!}}
5513 {{urlencode:hi world?!|WIKI}}
5514 {{urlencode:hi world?!|PATH}}
5515 {{urlencode:hi world?!|QUERY}}
5516 !! result
5517 <p>hi+world%3F%21
5518 hi_world%3F!
5519 hi%20world%3F%21
5520 hi+world%3F%21
5521 </p>
5522 !! end
5525 ### Magic links
5527 !! test
5528 Magic links: internal link to RFC (bug 479)
5529 !! input
5530 [[RFC 123]]
5531 !! result
5532 <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>
5533 </p>
5534 !! end
5536 !! test
5537 Magic links: RFC (bug 479)
5538 !! input
5539 RFC 822
5540 !! result
5541 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc822">RFC 822</a>
5542 </p>
5543 !! end
5545 !! test
5546 Magic links: ISBN (bug 1937)
5547 !! input
5548 ISBN 0-306-40615-2
5549 !! result
5550 <p><a href="/wiki/Special:BookSources/0306406152" class="internal mw-magiclink-isbn">ISBN 0-306-40615-2</a>
5551 </p>
5552 !! end
5554 !! test
5555 Magic links: PMID incorrectly converts space to underscore
5556 !! input
5557 PMID 1234
5558 !! result
5559 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a>
5560 </p>
5561 !! end
5564 ### Templates
5565 ####
5567 !! test
5568 Nonexistent template
5569 !! input
5570 {{thistemplatedoesnotexist}}
5571 !! result
5572 <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>
5573 </p>
5574 !! end
5576 !! test
5577 Template with invalid target containing tags
5578 !! input
5579 {{a<b>b</b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
5580 !! result
5581 <p>{{a<b>b</b>|foo|a=b|a = b}}
5582 </p>
5583 !! end
5585 !! test
5586 Template with invalid target containing unclosed tag
5587 !! input
5588 {{a<b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
5589 !! result
5590 <p>{{a<b>|foo|a=b|a = b}}</b>
5591 </p>
5592 !! end
5594 !! article
5595 Template:test
5596 !! text
5597 This is a test template
5598 !! endarticle
5600 !! test
5601 Simple template
5602 !! input
5603 {{test}}
5604 !! result
5605 <p>This is a test template
5606 </p>
5607 !! end
5609 !! test
5610 Template with explicit namespace
5611 !! input
5612 {{Template:test}}
5613 !! result
5614 <p>This is a test template
5615 </p>
5616 !! end
5619 !! article
5620 Template:paramtest
5621 !! text
5622 This is a test template with parameter {{{param}}}
5623 !! endarticle
5625 !! test
5626 Template parameter
5627 !! input
5628 {{paramtest|param=foo}}
5629 !! result
5630 <p>This is a test template with parameter foo
5631 </p>
5632 !! end
5634 !! article
5635 Template:paramtestnum
5636 !! text
5637 [[{{{1}}}|{{{2}}}]]
5638 !! endarticle
5640 !! test
5641 Template unnamed parameter
5642 !! input
5643 {{paramtestnum|Main Page|the main page}}
5644 !! result
5645 <p><a href="/wiki/Main_Page" title="Main Page">the main page</a>
5646 </p>
5647 !! end
5649 !! article
5650 Template:templatesimple
5651 !! text
5652 (test)
5653 !! endarticle
5655 !! article
5656 Template:templateredirect
5657 !! text
5658 #redirect [[Template:templatesimple]]
5659 !! endarticle
5661 !! article
5662 Template:templateasargtestnum
5663 !! text
5664 {{{{{1}}}}}
5665 !! endarticle
5667 !! article
5668 Template:templateasargtest
5669 !! text
5670 {{template{{{templ}}}}}
5671 !! endarticle
5673 !! article
5674 Template:templateasargtest2
5675 !! text
5676 {{{{{templ}}}}}
5677 !! endarticle
5679 !! test
5680 Template with template name as unnamed argument
5681 !! input
5682 {{templateasargtestnum|templatesimple}}
5683 !! result
5684 <p>(test)
5685 </p>
5686 !! end
5688 !! test
5689 Template with template name as argument
5690 !! input
5691 {{templateasargtest|templ=simple}}
5692 !! result
5693 <p>(test)
5694 </p>
5695 !! end
5697 !! test
5698 Template with template name as argument (2)
5699 !! input
5700 {{templateasargtest2|templ=templatesimple}}
5701 !! result
5702 <p>(test)
5703 </p>
5704 !! end
5706 !! article
5707 Template:templateasargtestdefault
5708 !! text
5709 {{{{{templ|templatesimple}}}}}
5710 !! endarticle
5712 !! article
5713 Template:templa
5714 !! text
5715 '''templ'''
5716 !! endarticle
5718 !! test
5719 Template with default value
5720 !! input
5721 {{templateasargtestdefault}}
5722 !! result
5723 <p>(test)
5724 </p>
5725 !! end
5727 !! test
5728 Template with default value (value set)
5729 !! input
5730 {{templateasargtestdefault|templ=templa}}
5731 !! result
5732 <p><b>templ</b>
5733 </p>
5734 !! end
5736 !! test
5737 Template redirect
5738 !! input
5739 {{templateredirect}}
5740 !! result
5741 <p>(test)
5742 </p>
5743 !! end
5745 !! test
5746 Template with argument in separate line
5747 !! input
5748 {{ templateasargtest  |
5749  templ = simple }}
5750 !! result
5751 <p>(test)
5752 </p>
5753 !! end
5755 !! test
5756 Template with complex template as argument
5757 !! input
5758 {{paramtest|
5759   param ={{ templateasargtest  |
5760  templ = simple }}}}
5761 !! result
5762 <p>This is a test template with parameter (test)
5763 </p>
5764 !! end
5766 !! test
5767 Template with thumb image (with link in description)
5768 !! input
5769 {{paramtest|
5770   param =[[Image:noimage.png|thumb|[[no link|link]] [[no link|caption]]]]}}
5771 !! result
5772 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>
5774 !! end
5776 !! article
5777 Template:complextemplate
5778 !! text
5779 {{{1}}} {{paramtest|
5780   param ={{{param}}}}}
5781 !! endarticle
5783 !! test
5784 Template with complex arguments
5785 !! input
5786 {{complextemplate|
5787   param ={{ templateasargtest  |
5788  templ = simple }}|[[Template:complextemplate|link]]}}
5789 !! result
5790 <p><a href="/wiki/Template:Complextemplate" title="Template:Complextemplate">link</a> This is a test template with parameter (test)
5791 </p>
5792 !! end
5794 !! test
5795 BUG 553: link with two variables in a piped link
5796 !! input
5798 |[[{{{1}}}|{{{2}}}]]
5800 !! result
5801 <table>
5802 <tr>
5803 <td>[[{{{1}}}|{{{2}}}]]
5804 </td></tr></table>
5806 !! end
5808 !! test
5809 Magic variable as template parameter
5810 !! input
5811 {{paramtest|param={{SITENAME}}}}
5812 !! result
5813 <p>This is a test template with parameter MediaWiki
5814 </p>
5815 !! end
5817 !! article
5818 Template:linktest
5819 !! text
5820 [[{{{param}}}|link]]
5821 !! endarticle
5823 !! test
5824 Template parameter as link source
5825 !! input
5826 {{linktest|param=Main Page}}
5827 !! result
5828 <p><a href="/wiki/Main_Page" title="Main Page">link</a>
5829 </p>
5830 !! end
5832 !!test
5833 Template-generated attribute string (k='v')
5834 !!input
5835 <span {{attr_str|id|v1}}>bar</span>
5836 !!result
5837 <p><span id="v1">bar</span>
5838 </p>
5839 !!end
5841 !!article
5842 Template:paramtest2
5843 !! text
5844 including another template, {{paramtest|param={{{arg}}}}}
5845 !! endarticle
5847 !! test
5848 Template passing argument to another template
5849 !! input
5850 {{paramtest2|arg='hmm'}}
5851 !! result
5852 <p>including another template, This is a test template with parameter 'hmm'
5853 </p>
5854 !! end
5856 !! article
5857 Template:Linktest2
5858 !! text
5859 Main Page
5860 !! endarticle
5862 !! test
5863 Template as link source
5864 !! input
5865 [[{{linktest2}}]]
5867 [[{{linktest2}}|Main Page]]
5869 [[{{linktest2}}]]Page
5870 !! result
5871 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
5872 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
5873 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>Page
5874 </p>
5875 !! end
5878 !! article
5879 Template:loop1
5880 !! text
5881 {{loop2}}
5882 !! endarticle
5884 !! article
5885 Template:loop2
5886 !! text
5887 {{loop1}}
5888 !! endarticle
5890 !! test
5891 Template infinite loop
5892 !! input
5893 {{loop1}}
5894 !! result
5895 <p><span class="error">Template loop detected: <a href="/wiki/Template:Loop1" title="Template:Loop1">Template:Loop1</a></span>
5896 </p>
5897 !! end
5899 !! test
5900 Template from main namespace
5901 !! input
5902 {{:Main Page}}
5903 !! result
5904 <p>blah blah
5905 </p>
5906 !! end
5908 !! article
5909 Template:table
5910 !! text
5912 | 1 || 2
5914 | 3 || 4
5916 !! endarticle
5918 !! test
5919 BUG 529: Template with table, not included at beginning of line
5920 !! input
5921 foo {{table}}
5922 !! result
5923 <p>foo 
5924 </p>
5925 <table>
5926 <tr>
5927 <td> 1 </td>
5928 <td> 2
5929 </td></tr>
5930 <tr>
5931 <td> 3 </td>
5932 <td> 4
5933 </td></tr></table>
5935 !! end
5937 !! test
5938 BUG 523: Template shouldn't eat newline (or add an extra one before table)
5939 !! input
5941 {{table}}
5942 !! result
5943 <p>foo
5944 </p>
5945 <table>
5946 <tr>
5947 <td> 1 </td>
5948 <td> 2
5949 </td></tr>
5950 <tr>
5951 <td> 3 </td>
5952 <td> 4
5953 </td></tr></table>
5955 !! end
5957 !! test
5958 BUG 41: Template parameters shown as broken links
5959 !! input
5960 {{{parameter}}}
5961 !! result
5962 <p>{{{parameter}}}
5963 </p>
5964 !! end
5966 !! test
5967 Template with targets containing wikilinks
5968 !! input
5969 {{[[foo]]}}
5971 {{[[{{echo|foo}}]]}}
5973 {{{{echo|[[foo}}]]}}
5974 !! result
5975 <p>{{<a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">foo</a>}}
5976 </p><p>{{<a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">foo</a>}}
5977 </p><p>{{[[foo}}]]
5978 </p>
5979 !! end
5981 !! article
5982 Template:MSGNW test
5983 !! text
5984 ''None'' of '''this''' should be 
5985 * interpreted
5986  but rather passed unmodified
5987 {{test}}
5988 !! endarticle
5990 # hmm, fix this or just deprecate msgnw and document its behavior?
5991 !! test
5992 msgnw keyword
5993 !! options
5994 disabled
5995 !! input
5996 {{msgnw:MSGNW test}}
5997 !! result
5998 <p>''None'' of '''this''' should be 
5999 * interpreted
6000  but rather passed unmodified
6001 {{test}}
6002 </p>
6003 !! end
6005 !! test
6006 int keyword
6007 !! input
6008 {{int:youhavenewmessages|lots of money|not!}}
6009 !! result
6010 <p>You have lots of money (not!).
6011 </p>
6012 !! end
6014 !! article
6015 Template:Includes
6016 !! text
6017 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
6018 !! endarticle
6020 !! test
6021 <includeonly> and <noinclude> being included
6022 !! input
6023 {{Includes}}
6024 !! result
6025 <p>Foobar
6026 </p>
6027 !! end
6029 !! article
6030 Template:Includes2
6031 !! text
6032 <onlyinclude>Foo</onlyinclude>bar
6033 !! endarticle
6035 !! test
6036 <onlyinclude> being included
6037 !! input
6038 {{Includes2}}
6039 !! result
6040 <p>Foo
6041 </p>
6042 !! end
6045 !! article
6046 Template:Includes3
6047 !! text
6048 <onlyinclude>Foo</onlyinclude>bar<includeonly>zar</includeonly>
6049 !! endarticle
6051 !! test
6052 <onlyinclude> and <includeonly> being included
6053 !! input
6054 {{Includes3}}
6055 !! result
6056 <p>Foo
6057 </p>
6058 !! end
6060 !! test
6061 <includeonly> and <noinclude> on a page
6062 !! input
6063 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
6064 !! result
6065 <p>Foozar
6066 </p>
6067 !! end
6069 !! test
6070 Un-closed <noinclude>
6071 !! input
6072 <noinclude>
6073 !! result
6074 !! end
6076 !! test
6077 <onlyinclude> on a page
6078 !! input
6079 <onlyinclude>Foo</onlyinclude>bar
6080 !! result
6081 <p>Foobar
6082 </p>
6083 !! end
6085 !! test
6086 Un-closed <onlyinclude>
6087 !! input
6088 <onlyinclude>
6089 !! result
6090 !! end
6092 !!test
6093 Self-closed noinclude, includeonly, onlyinclude tags
6094 !!input
6095 <noinclude />
6096 <includeonly />
6097 <onlyinclude />
6098 !!result
6099 <p><br />
6100 </p>
6101 !!end
6103 !!test
6104 Unbalanced includeonly and noinclude tags
6105 !!input
6107 |a</noinclude>
6108 |b</noinclude></noinclude>
6109 |c</noinclude></includeonly>
6110 |d</includeonly></includeonly>
6112 !!result
6113 <table>
6114 <tr>
6115 <td>a
6116 </td>
6117 <td>b
6118 </td>
6119 <td>c&lt;/includeonly&gt;
6120 </td>
6121 <td>d&lt;/includeonly&gt;&lt;/includeonly&gt;
6122 </td></tr></table>
6124 !!end
6126 !! article
6127 Template:Includeonly section
6128 !! text
6129 <includeonly>
6130 ==Includeonly section==
6131 </includeonly>
6132 ==Section T-1==
6133 !!endarticle
6135 !! test
6136 Bug 6563: Edit link generation for section shown by <includeonly>
6137 !! input
6138 {{includeonly section}}
6139 !! result
6140 <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>
6141 <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>
6143 !! end
6145 # Uses same input as the contents of [[Template:Includeonly section]]
6146 !! test
6147 Bug 6563: Section extraction for section shown by <includeonly>
6148 !! options
6149 section=T-2
6150 !! input
6151 <includeonly>
6152 ==Includeonly section==
6153 </includeonly>
6154 ==Section T-2==
6155 !! result
6156 ==Section T-2==
6157 !! end
6159 !! test
6160 Bug 6563: Edit link generation for section suppressed by <includeonly>
6161 !! input
6162 <includeonly>
6163 ==Includeonly section==
6164 </includeonly>
6165 ==Section 1==
6166 !! result
6167 <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>
6169 !! end
6171 !! test
6172 Bug 6563: Section extraction for section suppressed by <includeonly>
6173 !! options
6174 section=1
6175 !! input
6176 <includeonly>
6177 ==Includeonly section==
6178 </includeonly>
6179 ==Section 1==
6180 !! result
6181 ==Section 1==
6182 !! end
6184 !! test
6185 Un-closed <includeonly>
6186 !! input
6187 <includeonly>
6188 !! result
6189 !! end
6192 ### <includeonly> and <noinclude> in attributes
6194 !!test
6195 0. includeonly around the entire attribute
6196 !!input
6197 <span <includeonly>id="v1"</includeonly><noinclude>id="v2"</noinclude>>bar</span>
6198 !!result
6199 <p><span id="v2">bar</span>
6200 </p>
6201 !!end
6203 !!test
6204 1. includeonly in html attr key
6205 !!input
6206 <span <noinclude>id</noinclude><includeonly>about</includeonly>="foo">bar</span>
6207 !!result
6208 <p><span id="foo">bar</span>
6209 </p>
6210 !!end
6212 !!test
6213 2. includeonly in html attr value
6214 !!input
6215 <span id="<noinclude>v1</noinclude><includeonly>v2</includeonly>">bar</span>
6216 <span id=<noinclude>"v1"</noinclude><includeonly>"v2"</includeonly>>bar</span>
6217 !!result
6218 <p><span id="v1">bar</span>
6219 <span id="v1">bar</span>
6220 </p>
6221 !!end
6223 !!test
6224 3. includeonly in part of an attr value
6225 !!input
6226 <span style="color:<noinclude>red</noinclude><includeonly>blue</includeonly>;">bar</span>
6227 !!result
6228 <p><span style="color:red;">bar</span>
6229 </p>
6230 !!end
6233 ### Testing parsing of templates where a template arg
6234 ### has the same name as the template itself.
6237 !! article
6238 Template:quote
6239 !! text
6240 {{{quote|{{{1}}}}}}
6241 !! endarticle
6243 !!test
6244 Templates: Template Name/Arg clash: 1. Use of positional param
6245 !!input
6246 {{quote|foo}}
6247 !!result
6248 <p>foo
6249 </p>
6250 !!end
6252 !!test
6253 Templates: Template Name/Arg clash: 2. Use of named param
6254 !!input
6255 {{quote|quote=foo}}
6256 !!result
6257 <p>foo
6258 </p>
6259 !!end
6261 !!test
6262 Templates: Template Name/Arg clash: 3. Use of named param with empty input
6263 !!input
6264 {{quote|quote}}
6265 !!result
6266 <p>quote
6267 </p>
6268 !!end
6271 ### Parsoid-centric tests to stress Parsoid's ability to RT them unchanged
6274 !!test
6275 Templates: 1. Simple use
6276 !!input
6277 {{echo|Foo}}
6278 !!result
6279 <p>Foo
6280 </p>
6281 !!end
6283 !!test
6284 Templates: 2. Inside a block tag
6285 !!input
6286 <div>{{echo|Foo}}</div>
6287 !!result
6288 <div>Foo</div>
6290 !!end
6292 !!test
6293 Templates: P-wrapping: 1a. Templates on consecutive lines
6294 !!input
6295 {{echo|Foo}}
6296 {{echo|bar}}
6297 !!result
6298 <p>Foo
6300 </p>
6301 !!end
6303 !!test
6304 Templates: P-wrapping: 1b. Templates on consecutive lines
6305 !!input
6308 {{echo|bar}}
6309 {{echo|baz}}
6310 !!result
6311 <p>Foo
6312 </p><p>bar
6314 </p>
6315 !!end
6317 !!test
6318 Templates: P-wrapping: 1c. Templates on consecutive lines
6319 !!input
6320 {{echo|Foo}}
6321 {{echo|bar}} <div>baz</div>
6322 !!result
6323 <p>Foo
6324 </p>
6325 bar <div>baz</div>
6327 !!end
6329 !!test
6330 Templates: P-wrapping: 1d. Template preceded by comment-only line
6331 !!options
6332 parsoid=wt2html,wt2wt
6333 !!input
6334 <!-- foo -->
6335 {{echo|Bar}}
6336 !!result
6337 <!-- foo -->
6338 <p typeof="mw:Transclusion">Bar
6339 </p>
6340 !!end
6342 !!test
6343 Templates: Inline Text: 1. Multiple tmeplate uses
6344 !!input
6345 {{echo|Foo}}bar{{echo|baz}}
6346 !!result
6347 <p>Foobarbaz
6348 </p>
6349 !!end
6351 !!test
6352 Templates: Inline Text: 2. Back-to-back template uses
6353 !!input
6354 {{echo|Foo}}{{echo|bar}}
6355 !!result
6356 <p>Foobar
6357 </p>
6358 !!end
6360 !!test
6361 Templates: Block Tags: 1. Multiple template uses
6362 !!input
6363 {{echo|<div>Foo</div>}}<div>bar</div>{{echo|<div>baz</div>}}
6364 !!result
6365 <div>Foo</div><div>bar</div><div>baz</div>
6367 !!end
6369 !!test
6370 Templates: Block Tags: 2. Back-to-back template uses
6371 !!input
6372 {{echo|<div>Foo</div>}}{{echo|<div>bar</div>}}
6373 !!result
6374 <div>Foo</div><div>bar</div>
6376 !!end
6378 !!test
6379 Templates: Links: 1. Simple example
6380 !!input
6381 {{echo|[[Foo|bar]]}}
6382 !!result
6383 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
6384 </p>
6385 !!end
6387 !!test
6388 Templates: Links: 2. Generation of link href
6389 !!input
6390 [[{{echo|Foo}}|bar]]
6391 !!result
6392 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
6393 </p>
6394 !!end
6396 !!test
6397 Templates: Links: 3. Generation of part of a link href
6398 !!input
6399 [[Fo{{echo|o}}|bar]]
6401 [[Foo{{echo|bar}}]]
6403 [[Foo{{echo|bar}}baz]]
6405 [[Foo{{echo|bar}}|bar]]
6407 [[:Foo{{echo|bar}}]]
6409 [[:Foo{{echo|bar}}|bar]]
6410 !!result
6411 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
6412 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
6413 </p><p><a href="/index.php?title=Foobarbaz&amp;action=edit&amp;redlink=1" class="new" title="Foobarbaz (page does not exist)">Foobarbaz</a>
6414 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
6415 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
6416 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
6417 </p>
6418 !!end
6420 !!test
6421 Templates: Links: 4. Multiple templates generating link href
6422 !!input
6423 [[{{echo|F}}{{echo|o}}ob{{echo|ar}}]]
6424 !!result
6425 <p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
6426 </p>
6427 !!end
6429 !!test
6430 Templates: Links: 5. Generation of link text
6431 !!input
6432 [[Foo|{{echo|bar}}]]
6433 !!result
6434 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
6435 </p>
6436 !!end
6438 !!test
6439 Templates: Links: 5. Nested templates (only outermost template should be marked)
6440 !!input
6441 {{echo|[[{{echo|Foo}}|bar]]}}
6442 !!result
6443 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
6444 </p>
6445 !!end
6447 !!test
6448 Templates: HTML Tag: 1. Generation of HTML attr. key
6449 !!input
6450 <div {{echo|style}}="color:red;">foo</div>
6451 !!result
6452 <div style="color:red;">foo</div>
6454 !!end
6456 !!test
6457 Templates: HTML Tag: 2. Generation of HTML attr. value
6458 !!input
6459 <div style={{echo|'color:red;'}}>foo</div>
6460 !!result
6461 <div style="color:red;">foo</div>
6463 !!end
6465 !!test
6466 Templates: HTML Tag: 3. Generation of HTML attr key and value
6467 !!input
6468 <div {{echo|style}}={{echo|'color:red;'}}>foo</div>
6469 !!result
6470 <div style="color:red;">foo</div>
6472 !!end
6474 !!test
6475 Templates: HTML Tag: 4. Generation of starting piece of HTML attr value
6476 !!input
6477 <div title="{{echo|This is a long title}} with just one piece templated">foo</div>
6478 !!result
6479 <div title="This is a long title with just one piece templated">foo</div>
6481 !!end
6483 !!test
6484 Templates: HTML Tag: 5. Generation of middle piece of HTML attr value
6485 !!input
6486 <div title="This is a long title with just {{echo|one piece}} templated">foo</div>
6487 !!result
6488 <div title="This is a long title with just one piece templated">foo</div>
6490 !!end
6492 !!test
6493 Templates: HTML Tag: 6. Generation of end piece of HTML attr value
6494 !!input
6495 <div title="This is a long title with just one piece {{echo|templated}}">foo</div>
6496 !!result
6497 <div title="This is a long title with just one piece templated">foo</div>
6499 !!end
6501 !!test
6502 Templates: HTML Tag: 7. Generation of partial attribute key string
6503 !!input
6504 <div st{{echo|yle}}="color:red;">foo</div>
6505 !!result
6506 <div style="color:red;">foo</div>
6508 !!end
6510 !!test
6511 Templates: HTML Tables: 1. Generating start of a HTML table
6512 !!input
6513 {{echo|<table><tr><td>foo</td>}}</tr></table>
6514 !!result
6515 <table><tr><td>foo</td></tr></table>
6517 !!end
6519 !!test
6520 Templates: HTML Tables: 2a. Generating middle 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: 2b. Generating middle of a HTML table
6530 !!input
6531 <table>{{echo|<tr><td>foo</td></tr>}}</table>
6532 !!result
6533 <table><tr><td>foo</td></tr></table>
6535 !!end
6537 !!test
6538 Templates: HTML Tables: 3. Generating end of a HTML table
6539 !!input
6540 <table><tr>{{echo|<td>foo</td></tr></table>}}
6541 !!result
6542 <table><tr><td>foo</td></tr></table>
6544 !!end
6546 !!test
6547 Templates: HTML Tables: 4a. Generating a single tag of a HTML table
6548 !!input
6549 {{echo|<table>}}<tr><td>foo</td></tr></table>
6550 !!result
6551 <table><tr><td>foo</td></tr></table>
6553 !!end
6555 !!test
6556 Templates: HTML Tables: 4b. Generating a single tag of a HTML table
6557 !!input
6558 <table>{{echo|<tr>}}<td>foo</td></tr></table>
6559 !!result
6560 <table><tr><td>foo</td></tr></table>
6562 !!end
6564 !!test
6565 Templates: HTML Tables: 4c. Generating a single tag of a HTML table
6566 !!input
6567 <table><tr>{{echo|<td>}}foo</td></tr></table>
6568 !!result
6569 <table><tr><td>foo</td></tr></table>
6571 !!end
6573 !!test
6574 Templates: HTML Tables: 4d. Generating a single tag of a HTML table
6575 !!input
6576 <table><tr><td>foo{{echo|</td>}}</tr></table>
6577 !!result
6578 <table><tr><td>foo</td></tr></table>
6580 !!end
6582 !!test
6583 Templates: HTML Tables: 4e. Generating a single tag of a HTML table
6584 !!input
6585 <table><tr><td>foo</td>{{echo|</tr>}}</table>
6586 !!result
6587 <table><tr><td>foo</td></tr></table>
6589 !!end
6591 !!test
6592 Templates: HTML Tables: 4f. Generating a single tag of a HTML table
6593 !!input
6594 <table><tr><td>foo</td></tr>{{echo|</table>}}
6595 !!result
6596 <table><tr><td>foo</td></tr></table>
6598 !!end
6600 !!test
6601 Templates: Wiki Tables: 1a. Fostering of entire template content
6602 !!input
6604 {{echo|a}}
6606 !!result
6607 <table>
6609 <tr><td></td></tr></table>
6611 !!end
6613 !!test
6614 Templates: Wiki Tables: 1b. Fostering of entire template content
6615 !!input
6617 {{echo|<div>}}
6619 {{echo|</div>}}
6621 !!result
6622 <table>
6623 <div>
6624 <p>foo
6625 </p>
6626 </div>
6627 <tr><td></td></tr></table>
6629 !!end
6631 !!test
6632 Templates: Wiki Tables: 2. Fostering of partial template content
6633 !!input
6635 {{echo|a
6636 <div>b</div>}}
6638 !!result
6639 <table>
6641 <div>b</div>
6642 <tr><td></td></tr></table>
6644 !!end
6646 !!test
6647 Templates: Wiki Tables: 3. td-content via multiple templates
6648 !!input
6650 {{echo|{{pipe}}a}}{{echo|b}}
6652 !!result
6653 <table>
6654 <tr>
6655 <td>ab
6656 </td></tr></table>
6658 !!end
6660 !!test
6661 Templates: Wiki Tables: 4. Templated tags, no content
6662 !!input
6663 {{tbl-start}}
6664 {{tbl-end}}
6665 !!result
6666 <table>
6667 <tr><td></td></tr></table>
6669 !!end
6671 !!test
6672 Templates: Wiki Tables: 5. Templated tags, regular td-tags
6673 !!input
6674 {{tbl-start}}
6675 |foo
6676 {{tbl-end}}
6677 !!result
6678 <table>
6679 <tr>
6680 <td>foo
6681 </td></tr></table>
6683 !!end
6685 !!test
6686 Templates: Wiki Tables: 6. Templated tags, templated td-tags
6687 !!input
6688 {{tbl-start}}
6689 {{!}}foo
6690 {{tbl-end}}
6691 !!result
6692 <table>
6693 <tr>
6694 <td>foo
6695 </td></tr></table>
6697 !!end
6699 !!test
6700 Templates: Lists: Multi-line list-items via templates
6701 !!input
6702 *{{echo|a {{nonexistent|
6703 unused}}}}
6704 *{{echo|b {{nonexistent|
6705 unused}}}}
6706 !!result
6707 <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>
6708 </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>
6709 </li></ul>
6711 !!end
6713 !!test
6714 Templates: Ugly nesting: 1. Quotes opened/closed across templates (echo)
6715 !!input
6716 {{echo|''a}}{{echo|b''c''d}}{{echo|''e}}
6717 !!result
6718 <p><i>ab</i>c<i>d</i>e
6719 </p>
6720 !!end
6722 !!test
6723 Templates: Ugly nesting: 2. Quotes opened/closed across templates (echo_with_span)
6724 (PHP parser generates misnested html)
6725 !! options
6726 parsoid=wt2html,wt2wt
6727 !!input
6728 {{echo_with_span|''a}}{{echo_with_span|b''c''d}}{{echo_with_span|''e}}
6729 !!result
6730 <p><span typeof="mw:Transclusion"><i>a</i></span><i typeof="mw:Transclusion"><span>b</span></i><span>c</span><i>d</i><span>e</span></p>
6731 !!end
6733 !!test
6734 Templates: Ugly nesting: 3. Quotes opened/closed across templates (echo_with_div)
6735 (PHP parser generates misnested html)
6736 !! options
6737 parsoid=wt2html,wt2wt
6738 !!input
6739 {{echo_with_div|''a}}{{echo_with_div|b''c''d}}{{echo_with_div|''e}}
6740 !!result
6741 <div typeof="mw:Transclusion"><i>a</i></div>
6742 <div typeof="mw:Transclusion"><i>b</i>c<i>d</i></div>
6743 <div typeof="mw:Transclusion">e</div>
6744 !!end
6746 !!test
6747 Templates: Ugly nesting: 4. Divs opened/closed across templates
6748 !!input
6749 a<div>b{{echo|c</div>d}}e
6750 !!result
6751 a<div>bc</div>de
6753 !!end
6755 !!test
6756 Templates: Ugly templates: 1. Navbox template parses badly leading to table misnesting
6757 (Parsoid-centric)
6758 !! options
6759 parsoid
6760 !!input
6762 |{{echo|foo</table>}}
6763 |bar
6765 !!result
6766 <table typeof="mw:Transclusion">
6767 <tbody>
6768 <tr>
6769 <td>foo</td></tr></tbody></table><span>bar</span>
6770 !!end
6772 !!test
6773 Templates: Ugly templates: 2. Navbox template parses badly leading to table misnesting
6774 (Parsoid-centric)
6775 !! options
6776 parsoid
6777 !!input
6778 <table>
6779   <tr>
6780     <td>
6781     <table>
6782       <tr>
6783         <td>1. {{echo|foo </table>}}</td>
6784         <td> bar </td>
6785         <td>2. {{echo|baz </table>}}</td>
6786       </tr>
6787       <tr>
6788         <td>abc</td>
6789       </tr>
6790     </table>
6791     </td>
6792   </tr>
6793   <tr>
6794     <td>xyz</td>
6795   </tr>
6796 </table>
6797 !!result
6798 <table  about="#mwt1" typeof="mw:Transclusion">
6799   <tbody><tr >
6800     <td >
6801     <table >
6802       <tbody><tr >
6803         <td >1. foo </td></tr></tbody></table></td>
6804         <td > bar </td>
6805         <td >2. baz </td></tr></tbody></table><span about="#mwt1">
6806       </span><span about="#mwt1">
6807       
6808         abc</span><span about="#mwt1">
6809       </span><span about="#mwt1">
6810     </span><span about="#mwt1">
6811     </span><span about="#mwt1">
6812   </span><span about="#mwt1">
6813   
6814     xyz</span><span about="#mwt1">
6815   </span><span about="#mwt1">
6816 </span>
6817 !!end
6819 !! test
6820 Templates: Ugly templates: 3. newline-only template parameter
6821 !! input
6822 foo {{echo|
6824 !! result
6825 <p>foo 
6826 </p>
6827 !! end
6829 # This looks like a bug: a single newline triggers p/br for some reason.
6830 !! test
6831 Templates: Ugly templates: 4. newline-only template parameter inconsistency
6832 !! input
6833 {{echo|
6835 !! result
6836 <p><br />
6837 </p>
6838 !! end
6841 !!test
6842 Parser Functions: 1. Simple example
6843 !!input
6844 {{uc:foo}}
6845 !!result
6846 <p>FOO
6847 </p>
6848 !!end
6850 !!test
6851 Parser Functions: 2. Nested use (only outermost should be marked up)
6852 !!input
6853 {{uc:{{lc:FOO}}}}
6854 !!result
6855 <p>FOO
6856 </p>
6857 !!end
6860 ### Pre-save transform tests
6862 !! test
6863 pre-save transform: subst:
6864 !! options
6866 !! input
6867 {{subst:test}}
6868 !! result
6869 This is a test template
6870 !! end
6872 !! test
6873 pre-save transform: normal template
6874 !! options
6876 !! input
6877 {{test}}
6878 !! result
6879 {{test}}
6880 !! end
6882 !! test
6883 pre-save transform: nonexistent template
6884 !! options
6886 !! input
6887 {{thistemplatedoesnotexist}}
6888 !! result
6889 {{thistemplatedoesnotexist}}
6890 !! end
6893 !! test
6894 pre-save transform: subst magic variables
6895 !! options
6897 !! input
6898 {{subst:SITENAME}}
6899 !! result
6900 MediaWiki
6901 !! end
6903 # This is bug 89, which I fixed. -- wtm
6904 !! test
6905 pre-save transform: subst: templates with parameters
6906 !! options
6908 !! input
6909 {{subst:paramtest|param="something else"}}
6910 !! result
6911 This is a test template with parameter "something else"
6912 !! end
6914 !! article
6915 Template:nowikitest
6916 !! text
6917 <nowiki>'''not wiki'''</nowiki>
6918 !! endarticle
6920 !! test
6921 pre-save transform: nowiki in subst (bug 1188)
6922 !! options
6924 !! input
6925 {{subst:nowikitest}}
6926 !! result
6927 <nowiki>'''not wiki'''</nowiki>
6928 !! end
6931 !! article
6932 Template:commenttest
6933 !! text
6934 This template has <!-- a comment --> in it.
6935 !! endarticle
6937 !! test
6938 pre-save transform: comment in subst (bug 1936)
6939 !! options
6941 !! input
6942 {{subst:commenttest}}
6943 !! result
6944 This template has <!-- a comment --> in it.
6945 !! end
6947 !! test
6948 pre-save transform: unclosed tag
6949 !! options
6950 pst noxml
6951 !! input
6952 <nowiki>'''not wiki'''
6953 !! result
6954 <nowiki>'''not wiki'''
6955 !! end
6957 !! test
6958 pre-save transform: mixed tag case
6959 !! options
6960 pst noxml
6961 !! input
6962 <NOwiki>'''not wiki'''</noWIKI>
6963 !! result
6964 <NOwiki>'''not wiki'''</noWIKI>
6965 !! end
6967 !! test
6968 pre-save transform: unclosed comment in <nowiki>
6969 !! options
6970 pst noxml
6971 !! input
6972 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
6973 !! result
6974 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
6975 !!end
6977 # Leading @ in this template definition works around a limitation
6978 # in parsoid's parserTests which otherwise strips the <span> from the
6979 # result (confusing it for a template wrapper)
6980 !! article
6981 Template:dangerous
6982 !!text
6983 @<span onmouseover="alert('crap')">Oh no</span>
6984 !!endarticle
6986 !!test
6987 (confirming safety of fix for subst bug 1936)
6988 !! input
6989 {{Template:dangerous}}
6990 !! result
6991 <p>@<span>Oh no</span>
6992 </p>
6993 !! end
6995 !! test
6996 pre-save transform: comment containing gallery (bug 5024)
6997 !! options
6999 !! input
7000 <!-- <gallery>data</gallery> -->
7001 !!result
7002 <!-- <gallery>data</gallery> -->
7003 !!end
7005 !! test
7006 pre-save transform: comment containing extension
7007 !! options
7009 !! input
7010 <!-- <tag>data</tag> -->
7011 !!result
7012 <!-- <tag>data</tag> -->
7013 !!end
7015 !! test
7016 pre-save transform: comment containing nowiki
7017 !! options
7019 !! input
7020 <!-- <nowiki>data</nowiki> -->
7021 !!result
7022 <!-- <nowiki>data</nowiki> -->
7023 !!end
7025 !! test
7026 pre-save transform: <noinclude> in subst (bug 3298)
7027 !! options
7029 !! input
7030 {{subst:Includes}}
7031 !! result
7032 Foobar
7033 !! end
7035 !! test
7036 pre-save transform: <onlyinclude> in subst (bug 3298)
7037 !! options
7039 !! input
7040 {{subst:Includes2}}
7041 !! result
7043 !! end
7045 !! article
7046 Template:SubstTest
7047 !!text
7048 {{<includeonly>subst:</includeonly>Includes}}
7049 !! endarticle
7051 !! article
7052 Template:SafeSubstTest
7053 !! text
7054 {{<includeonly>safesubst:</includeonly>Includes}}
7055 !! endarticle
7057 !! test
7058 bug 22297: safesubst: works during PST
7059 !! options
7061 !! input
7062 {{subst:SafeSubstTest}}{{safesubst:SubstTest}}
7063 !! result
7064 FoobarFoobar
7065 !! end
7067 !! test
7068 bug 22297: safesubst: works during normal parse
7069 !! input
7070 {{SafeSubstTest}}
7071 !! result
7072 <p>Foobar
7073 </p>
7074 !! end
7076 !! test:
7077 subst: does not work during normal parse
7078 !! input
7079 {{SubstTest}}
7080 !! result
7081 <p>{{subst:Includes}}
7082 </p>
7083 !! end
7085 !! test
7086 pre-save transform: context links ("pipe trick")
7087 !! options
7089 !! input
7090 [[Article (context)|]]
7091 [[Bar:Article|]]
7092 [[:Bar:Article|]]
7093 [[Bar:Article (context)|]]
7094 [[:Bar:Article (context)|]]
7095 [[|Article]]
7096 [[|Article (context)]]
7097 [[Bar:X (Y) Z|]]
7098 [[:Bar:X (Y) Z|]]
7099 !! result
7100 [[Article (context)|Article]]
7101 [[Bar:Article|Article]]
7102 [[:Bar:Article|Article]]
7103 [[Bar:Article (context)|Article]]
7104 [[:Bar:Article (context)|Article]]
7105 [[Article]]
7106 [[Article (context)]]
7107 [[Bar:X (Y) Z|X (Y) Z]]
7108 [[:Bar:X (Y) Z|X (Y) Z]]
7109 !! end
7111 !! test
7112 pre-save transform: context links ("pipe trick") with interwiki prefix
7113 !! options
7115 !! input
7116 [[interwiki:Article|]]
7117 [[:interwiki:Article|]]
7118 [[interwiki:Bar:Article|]]
7119 [[:interwiki:Bar:Article|]]
7120 !! result
7121 [[interwiki:Article|Article]]
7122 [[:interwiki:Article|Article]]
7123 [[interwiki:Bar:Article|Bar:Article]]
7124 [[:interwiki:Bar:Article|Bar:Article]]
7125 !! end
7127 !! test
7128 pre-save transform: context links ("pipe trick") with parens in title
7129 !! options
7130 pst title=[[Somearticle (context)]]
7131 !! input
7132 [[|Article]]
7133 !! result
7134 [[Article (context)|Article]]
7135 !! end
7137 !! test
7138 pre-save transform: context links ("pipe trick") with comma in title
7139 !! options
7140 pst title=[[Someplace, Somewhere]]
7141 !! input
7142 [[|Otherplace]]
7143 [[Otherplace, Elsewhere|]]
7144 [[Otherplace, Elsewhere, Anywhere|]]
7145 !! result
7146 [[Otherplace, Somewhere|Otherplace]]
7147 [[Otherplace, Elsewhere|Otherplace]]
7148 [[Otherplace, Elsewhere, Anywhere|Otherplace]]
7149 !! end
7151 !! test
7152 pre-save transform: context links ("pipe trick") with parens and comma
7153 !! options
7154 pst title=[[Someplace (IGNORED), Somewhere]]
7155 !! input
7156 [[|Otherplace]]
7157 [[Otherplace (place), Elsewhere|]]
7158 !! result
7159 [[Otherplace, Somewhere|Otherplace]]
7160 [[Otherplace (place), Elsewhere|Otherplace]]
7161 !! end
7163 !! test
7164 pre-save transform: context links ("pipe trick") with comma and parens
7165 !! options
7166 pst title=[[Who, me? (context)]]
7167 !! input
7168 [[|Yes, you.]]
7169 [[Me, Myself, and I (1937 song)|]]
7170 !! result
7171 [[Yes, you. (context)|Yes, you.]]
7172 [[Me, Myself, and I (1937 song)|Me, Myself, and I]]
7173 !! end
7175 !! test
7176 pre-save transform: context links ("pipe trick") with namespace
7177 !! options
7178 pst title=[[Ns:Somearticle]]
7179 !! input
7180 [[|Article]]
7181 !! result
7182 [[Ns:Article|Article]]
7183 !! end
7185 !! test
7186 pre-save transform: context links ("pipe trick") with namespace and parens
7187 !! options
7188 pst title=[[Ns:Somearticle (context)]]
7189 !! input
7190 [[|Article]]
7191 !! result
7192 [[Ns:Article (context)|Article]]
7193 !! end
7195 !! test
7196 pre-save transform: context links ("pipe trick") with namespace and comma
7197 !! options
7198 pst title=[[Ns:Somearticle, Context, Whatever]]
7199 !! input
7200 [[|Article]]
7201 !! result
7202 [[Ns:Article, Context, Whatever|Article]]
7203 !! end
7205 !! test
7206 pre-save transform: context links ("pipe trick") with namespace, comma and parens
7207 !! options
7208 pst title=[[Ns:Somearticle, Context (context)]]
7209 !! input
7210 [[|Article]]
7211 !! result
7212 [[Ns:Article (context)|Article]]
7213 !! end
7215 !! test
7216 pre-save transform: context links ("pipe trick") with namespace, parens and comma
7217 !! options
7218 pst title=[[Ns:Somearticle (IGNORED), Context]]
7219 !! input
7220 [[|Article]]
7221 !! result
7222 [[Ns:Article, Context|Article]]
7223 !! end
7225 !! test
7226 pre-save transform: context links ("pipe trick") with full-width parens and no space (Japanese and Chinese style, bug 30149)
7227 !! options
7229 !! input
7230 [[Article(context)|]]
7231 [[Bar:Article(context)|]]
7232 [[:Bar:Article(context)|]]
7233 [[|Article(context)]]
7234 [[Bar:X(Y)Z|]]
7235 [[:Bar:X(Y)Z|]]
7236 !! result
7237 [[Article(context)|Article]]
7238 [[Bar:Article(context)|Article]]
7239 [[:Bar:Article(context)|Article]]
7240 [[Article(context)]]
7241 [[Bar:X(Y)Z|X(Y)Z]]
7242 [[:Bar:X(Y)Z|X(Y)Z]]
7243 !! end
7245 !! test
7246 pre-save transform: context links ("pipe trick") with full-width parens and space (Japanese and Chinese style, bug 30149)
7247 !! options
7249 !! input
7250 [[Article (context)|]]
7251 [[Bar:Article (context)|]]
7252 [[:Bar:Article (context)|]]
7253 [[|Article (context)]]
7254 [[Bar:X (Y) Z|]]
7255 [[:Bar:X (Y) Z|]]
7256 !! result
7257 [[Article (context)|Article]]
7258 [[Bar:Article (context)|Article]]
7259 [[:Bar:Article (context)|Article]]
7260 [[Article (context)]]
7261 [[Bar:X (Y) Z|X (Y) Z]]
7262 [[:Bar:X (Y) Z|X (Y) Z]]
7263 !! end
7265 !! test
7266 pre-save transform: context links ("pipe trick") with parens and no space (Korean style, bug 30149)
7267 !! options
7269 !! input
7270 [[Article(context)|]]
7271 [[Bar:Article(context)|]]
7272 [[:Bar:Article(context)|]]
7273 [[|Article(context)]]
7274 [[Bar:X(Y)Z|]]
7275 [[:Bar:X(Y)Z|]]
7276 !! result
7277 [[Article(context)|Article]]
7278 [[Bar:Article(context)|Article]]
7279 [[:Bar:Article(context)|Article]]
7280 [[Article(context)]]
7281 [[Bar:X(Y)Z|X(Y)Z]]
7282 [[:Bar:X(Y)Z|X(Y)Z]]
7283 !! end
7285 !! test
7286 pre-save transform: context links ("pipe trick") with commas (bug 21660)
7287 !! options
7289 !! input
7290 [[Article (context), context|]]
7291 [[Article (context),context|]]
7292 [[Bar:Article (context), context|]]
7293 [[Bar:Article (context),context|]]
7294 [[:Bar:Article (context), context|]]
7295 [[:Bar:Article (context),context|]]
7296 !! result
7297 [[Article (context), context|Article]]
7298 [[Article (context),context|Article]]
7299 [[Bar:Article (context), context|Article]]
7300 [[Bar:Article (context),context|Article]]
7301 [[:Bar:Article (context), context|Article]]
7302 [[:Bar:Article (context),context|Article]]
7303 !! end
7305 !! test
7306 pre-save transform: trim trailing empty lines
7307 !! options
7309 !! input
7310 Empty lines are trimmed
7315 !! result
7316 Empty lines are trimmed
7317 !! end
7319 !! test
7320 pre-save transform: Signature expansion
7321 !! options
7323 !! input
7324 * ~~~
7325 * <noinclude>~~~</noinclude>
7326 * <includeonly>~~~</includeonly>
7327 * <onlyinclude>~~~</onlyinclude>
7328 !! result
7329 * [[Special:Contributions/127.0.0.1|127.0.0.1]]
7330 * <noinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</noinclude>
7331 * <includeonly>[[Special:Contributions/127.0.0.1|127.0.0.1]]</includeonly>
7332 * <onlyinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</onlyinclude>
7333 !! end
7336 !! test
7337 pre-save transform: Signature expansion in nowiki tags (bug 93)
7338 !! options
7339 pst disabled
7340 !! input
7341 Shall not expand:
7343 <nowiki>~~~~</nowiki>
7345 <includeonly><nowiki>~~~~</nowiki></includeonly>
7347 <noinclude><nowiki>~~~~</nowiki></noinclude>
7349 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
7351 {{subst:Foo}} shall be converted to FOO
7353 As well as inside noinclude/onlyinclude
7354 <noinclude>{{subst:Foo}}</noinclude>
7355 <onlyinclude>{{subst:Foo}}</onlyinclude>
7357 But not inside includeonly
7358 <includeonly>{{subst:Foo}}</includeonly>
7359 !! result
7360 Shall not expand:
7362 <nowiki>~~~~</nowiki>
7364 <includeonly><nowiki>~~~~</nowiki></includeonly>
7366 <noinclude><nowiki>~~~~</nowiki></noinclude>
7368 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
7370 FOO shall be converted to FOO
7372 As well as inside noinclude/onlyinclude
7373 <noinclude>FOO</noinclude>
7374 <onlyinclude>FOO</onlyinclude>
7376 But not inside includeonly
7377 <includeonly>{{subst:Foo}}</includeonly>
7378 !! end
7381 ### Message transform tests
7383 !! test
7384 message transform: magic variables
7385 !! options
7387 !! input
7388 {{SITENAME}}
7389 !! result
7390 MediaWiki
7391 !! end
7393 !! test
7394 message transform: should not transform wiki markup
7395 !! options
7397 !! input
7398 ''test''
7399 !! result
7400 ''test''
7401 !! end
7403 !! test
7404 message transform: <noinclude> in transcluded template (bug 4926)
7405 !! options
7407 !! input
7408 {{Includes}}
7409 !! result
7410 Foobar
7411 !! end
7413 !! test
7414 message transform: <onlyinclude> in transcluded template (bug 4926)
7415 !! options
7417 !! input
7418 {{Includes2}}
7419 !! result
7421 !! end
7423 !! test
7424 {{#special:}} page name, known
7425 !! options
7427 !! input
7428 {{#special:Recentchanges}}
7429 !! result
7430 Special:RecentChanges
7431 !! end
7433 !! test
7434 {{#special:}} page name with subpage, known
7435 !! options
7437 !! input
7438 {{#special:Recentchanges/param}}
7439 !! result
7440 Special:RecentChanges/param
7441 !! end
7443 !! test
7444 {{#special:}} page name, unknown
7445 !! options
7447 !! input
7448 {{#special:foobar nonexistent}}
7449 !! result
7450 Special:Foobar nonexistent
7451 !! end
7453 !! test
7454 {{#speciale:}} page name, known
7455 !! options
7457 !! input
7458 {{#speciale:Recentchanges}}
7459 !! result
7460 Special:RecentChanges
7461 !! end
7463 !! test
7464 {{#speciale:}} page name with subpage, known
7465 !! options
7467 !! input
7468 {{#speciale:Recentchanges/param}}
7469 !! result
7470 Special:RecentChanges/param
7471 !! end
7473 !! test
7474 {{#speciale:}} page name, unknown
7475 !! options
7477 !! input
7478 {{#speciale:foobar nonexistent}}
7479 !! result
7480 Special:Foobar_nonexistent
7481 !! end
7484 ### Images
7486 !! test
7487 Simple image
7488 !! input
7489 [[Image:foobar.jpg]]
7490 !! result
7491 <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>
7492 </p>
7493 !! end
7495 !! test
7496 Right-aligned image
7497 !! input
7498 [[Image:foobar.jpg|right]]
7499 !! result
7500 <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>
7502 !! end
7504 !! test
7505 Simple image (using File: namespace, now canonical)
7506 !! input
7507 [[File:foobar.jpg]]
7508 !! result
7509 <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>
7510 </p>
7511 !! end
7513 !! test
7514 Image with caption
7515 !! input
7516 [[Image:foobar.jpg|right|Caption text]]
7517 !! result
7518 <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>
7520 !! end
7522 !! test
7523 Image with empty attribute
7524 !! input
7525 [[Image:foobar.jpg|right||Caption text]]
7526 !! result
7527 <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>
7529 !! end
7531 !! test
7532 Image with link tails
7533 !! input
7534 123[[Image:foobar.jpg]]456
7535 123[[Image:foobar.jpg|right]]456
7536 123[[Image:foobar.jpg|thumb]]456
7537 !! result
7538 <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
7539 </p>
7540 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
7541 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
7543 !! end
7545 !! test
7546 Image with multiple captions -- only last one is accepted
7547 !! input
7548 [[Image:foobar.jpg|right|Caption1 - ignored|[[Caption2]] - ignored|Caption3 - accepted]]
7549 !! result
7550 <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>
7552 !! end
7554 !! test
7555 Image with width attribute at different positions
7556 !! input
7557 [[Image:foobar.jpg|200px|right|Caption]]
7558 [[Image:foobar.jpg|right|200px|Caption]]
7559 [[Image:foobar.jpg|right|Caption|200px]]
7560 !! result
7561 <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>
7562 <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>
7563 <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>
7565 !! end
7567 !! test
7568 Image with link parameter, wiki target
7569 !! input
7570 [[Image:foobar.jpg|link=Target page]]
7571 !! result
7572 <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>
7573 </p>
7574 !! end
7576 !! test
7577 Image with link parameter, URL target
7578 !! input
7579 [[Image:foobar.jpg|link=http://example.com/]]
7580 !! result
7581 <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>
7582 </p>
7583 !! end
7585 !! test
7586 Image with link parameter, wgExternalLinkTarget
7587 !! input
7588 [[Image:foobar.jpg|link=http://example.com/]]
7589 !! config
7590 wgExternalLinkTarget='foobar'
7591 !! result
7592 <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>
7593 </p>
7594 !! end
7596 !! test
7597 Image with link parameter, wgNoFollowLinks set to false
7598 !! input
7599 [[Image:foobar.jpg|link=http://example.com/]]
7600 !! config
7601 wgNoFollowLinks=false
7602 !! result
7603 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
7604 </p>
7605 !! end
7607 !! test
7608 Image with link parameter, wgNoFollowDomainExceptions
7609 !! input
7610 [[Image:foobar.jpg|link=http://example.com/]]
7611 !! config
7612 wgNoFollowDomainExceptions='example.com'
7613 !! result
7614 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
7615 </p>
7616 !! end
7618 !! test
7619 Image with link parameter, wgExternalLinkTarget, unnamed parameter
7620 !! input
7621 [[Image:foobar.jpg|link=http://example.com/|Title]]
7622 !! config
7623 wgExternalLinkTarget='foobar'
7624 !! result
7625 <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>
7626 </p>
7627 !! end
7629 !! test
7630 Image with empty link parameter
7631 !! input
7632 [[Image:foobar.jpg|link=]]
7633 !! result
7634 <p><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" />
7635 </p>
7636 !! end
7638 !! test
7639 Image with link parameter (wiki target) and unnamed parameter
7640 !! input
7641 [[Image:foobar.jpg|link=Target page|Title]]
7642 !! result
7643 <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>
7644 </p>
7645 !! end
7647 !! test
7648 Image with link parameter (URL target) and unnamed parameter
7649 !! input
7650 [[Image:foobar.jpg|link=http://example.com/|Title]]
7651 !! result
7652 <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>
7653 </p>
7654 !! end
7656 !! test
7657 Thumbnail image with link parameter
7658 !! options
7660 !! input
7661 [[Image:foobar.jpg|thumb|link=http://example.com/|Title]]
7662 !! result
7663 <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>
7665 !! end
7667 !! test
7668 Manually-specified thumbnail image
7669 !! options
7671 !! input
7672 [[Image:Foobar.jpg|thumb=Thumb.png|Title]]
7673 !! result
7674 <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>
7676 !! end
7678 !! test
7679 Manually-specified thumbnail image with explicit link to wiki page
7680 !! options
7682 !! input
7683 [[Image:Foobar.jpg|thumb=Thumb.png|link=Main Page|Title]]
7684 !! result
7685 <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>
7687 !! end
7689 !! test
7690 Manually-specified thumbnail image with explicit link to url
7691 !! options
7693 !! input
7694 [[Image:Foobar.jpg|thumb=Thumb.png|link=http://example.com|Title]]
7695 !! result
7696 <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>
7698 !! end
7700 !! test
7701 Manually-specified thumbnail image with explicit no link
7702 !! options
7704 !! input
7705 [[Image:Foobar.jpg|thumb=Thumb.png|link=|Title]]
7706 !! result
7707 <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>
7709 !! end
7711 !! test
7712 Manually-specified thumbnail image with explicit link and alt text
7713 !! options
7715 !! input
7716 [[Image:Foobar.jpg|thumb=Thumb.png|link=Main Page|alt=alttext|Title]]
7717 !! result
7718 <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>
7720 !! end
7722 !! test
7723 Image with frame and link
7724 !! input
7725 [[Image:Foobar.jpg|frame|left|This is a test image [[Main Page]]]]
7726 !! result
7727 <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>
7729 !! end
7731 !! test
7732 Image with frame and link and explicit alt
7733 !! input
7734 [[Image:Foobar.jpg|frame|left|This is a test image [[Main Page]]|alt=Altitude]]
7735 !! result
7736 <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>
7738 !! end
7740 !! test
7741 Image with wiki markup in implicit alt
7742 !! input
7743 [[Image:Foobar.jpg|testing '''bold''' in alt]]
7744 !! result
7745 <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>
7746 </p>
7747 !! end
7749 !! test
7750 Image with wiki markup in explicit alt
7751 !! input
7752 [[Image:Foobar.jpg|alt=testing '''bold''' in alt]]
7753 !! result
7754 <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>
7755 </p>
7756 !! end
7758 !! test
7759 Link to image page- image page normally doesn't exists, hence edit link
7760 Add test with existing image page
7761 #<p><a href="/wiki/File:Test" title="Image:Test">Image:test</a>
7762 !! input
7763 [[:Image:test]]
7764 !! result
7765 <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>
7766 </p>
7767 !! end
7769 !! test
7770 bug 18784  Link to non-existent image page with caption should use caption as link text
7771 !! input
7772 [[:Image:test|caption]]
7773 !! result
7774 <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>
7775 </p>
7776 !! end
7778 !! test
7779 Frameless image caption with a free URL
7780 !! input
7781 [[Image:foobar.jpg|http://example.com]]
7782 !! result
7783 <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>
7784 </p>
7785 !! end
7787 !! test
7788 Thumbnail image caption with a free URL
7789 !! input
7790 [[Image:foobar.jpg|thumb|http://example.com]]
7791 !! result
7792 <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>
7794 !! end
7796 !! test
7797 Thumbnail image caption with a free URL and explicit alt
7798 !! input
7799 [[Image:foobar.jpg|thumb|http://example.com|alt=Alteration]]
7800 !! result
7801 <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>
7803 !! end
7806 !! test
7807 SVG thumbnails with no language set
7808 !! options
7809 !! input
7810 [[File:Foobar.svg|thumb|width=200]]
7811 !! result
7812 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/File:Foobar.svg" class="image"><img alt="" src="http://example.com/images/thumb/f/ff/Foobar.svg/180px-Foobar.svg.png" width="180" height="180" class="thumbimage" srcset="http://example.com/images/thumb/f/ff/Foobar.svg/270px-Foobar.svg.png 1.5x, http://example.com/images/thumb/f/ff/Foobar.svg/360px-Foobar.svg.png 2x" /></a>  <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.svg" class="internal" title="Enlarge"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>width=200</div></div></div>
7814 !! end
7816 !! test
7817 SVG thumbnails with language de
7818 !! options
7819 !! input
7820 [[File:Foobar.svg|thumb|width=200|lang=de]]
7821 !! result
7822 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/index.php?title=File:Foobar.svg&amp;lang=de" class="image"><img alt="" src="http://example.com/images/thumb/f/ff/Foobar.svg/langde-180px-Foobar.svg.png" width="180" height="180" class="thumbimage" srcset="http://example.com/images/thumb/f/ff/Foobar.svg/langde-270px-Foobar.svg.png 1.5x, http://example.com/images/thumb/f/ff/Foobar.svg/langde-360px-Foobar.svg.png 2x" /></a>  <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.svg" class="internal" title="Enlarge"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>width=200</div></div></div>
7824 !! end
7826 !! test
7827 SVG thumbnails with invalid language code
7828 !! options
7829 !! input
7830 [[File:Foobar.svg|thumb|width=200|lang=invalid.language.code]]
7831 !! result
7832 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/File:Foobar.svg" class="image"><img alt="" src="http://example.com/images/thumb/f/ff/Foobar.svg/180px-Foobar.svg.png" width="180" height="180" class="thumbimage" srcset="http://example.com/images/thumb/f/ff/Foobar.svg/270px-Foobar.svg.png 1.5x, http://example.com/images/thumb/f/ff/Foobar.svg/360px-Foobar.svg.png 2x" /></a>  <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.svg" class="internal" title="Enlarge"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>lang=invalid.language.code</div></div></div>
7834 !! end
7836 !! test
7837 BUG 1887: A ISBN with a thumbnail
7838 !! input
7839 [[Image:foobar.jpg|thumb|ISBN 1235467890]]
7840 !! result
7841 <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>
7843 !! end
7845 !! test
7846 BUG 1887: A RFC with a thumbnail
7847 !! input
7848 [[Image:foobar.jpg|thumb|This is RFC 12354]]
7849 !! result
7850 <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>
7852 !! end
7854 !! test
7855 BUG 1887: A mailto link with a thumbnail
7856 !! input
7857 [[Image:foobar.jpg|thumb|Please mailto:nobody@example.com]]
7858 !! result
7859 <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>
7861 !! end
7863 # Pending resolution to bug 368
7864 !! test
7865 BUG 648: Frameless image caption with a link
7866 !! input
7867 [[Image:foobar.jpg|text with a [[link]] in it]]
7868 !! result
7869 <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>
7870 </p>
7871 !! end
7873 !! test
7874 BUG 648: Frameless image caption with a link (suffix)
7875 !! input
7876 [[Image:foobar.jpg|text with a [[link]]foo in it]]
7877 !! result
7878 <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>
7879 </p>
7880 !! end
7882 !! test
7883 BUG 648: Frameless image caption with an interwiki link
7884 !! input
7885 [[Image:foobar.jpg|text with a [[MeatBall:Link]] in it]]
7886 !! result
7887 <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>
7888 </p>
7889 !! end
7891 !! test
7892 BUG 648: Frameless image caption with a piped interwiki link
7893 !! input
7894 [[Image:foobar.jpg|text with a [[MeatBall:Link|link]] in it]]
7895 !! result
7896 <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>
7897 </p>
7898 !! end
7900 !! test
7901 Escape HTML special chars in image alt text
7902 !! input
7903 [[Image:foobar.jpg|& < > "]]
7904 !! result
7905 <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>
7906 </p>
7907 !! end
7909 !! test
7910 BUG 499: Alt text should have &#1234;, not &amp;1234;
7911 !! input
7912 [[Image:foobar.jpg|&#9792;]]
7913 !! result
7914 <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>
7915 </p>
7916 !! end
7918 !! test
7919 Broken image caption with link
7920 !! input
7921 [[Image:Foobar.jpg|thumb|This is a broken caption. But [[Main Page|this]] is just an ordinary link.
7922 !! result
7923 <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.
7924 </p>
7925 !! end
7927 !! test
7928 Image caption containing another image
7929 !! input
7930 [[Image:Foobar.jpg|thumb|This is a caption with another [[Image:icon.png|image]] inside it!]]
7931 !! result
7932 <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>
7934 !! end
7936 !! test
7937 Image caption containing a newline
7938 !! input
7939 [[Image:Foobar.jpg|This
7940 *is some text]]
7941 !! result
7942 <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>
7943 </p>
7944 !!end
7946 !!test
7947 Parsoid: Image caption containing leading space
7948 (The leading space should not trigger nowiki escaping in wt2wt mode)
7949 !! input
7950 [[Image:Foobar.jpg|thumb| bar]]
7951 !! result
7952 <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>
7954 !!end
7956 !! test
7957 Bug 3090: External links other than http: in image captions
7958 !! input
7959 [[Image:Foobar.jpg|thumb|200px|This caption has [irc://example.net irc] and [https://example.com Secure] ext links in it.]]
7960 !! result
7961 <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>
7963 !! end
7965 !! test
7966 Custom class
7967 !! input
7968 [[Image:foobar.jpg|a|class=b]]
7969 !! result
7970 <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>
7971 </p>
7972 !! end
7974 !! test
7975 Localized image handling (1).
7976 !! options
7977 language=es
7978 !! input
7979 [[Archivo:Foobar.jpg|izquierda|enlace=foo|caption]]
7980 !! result
7981 <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>
7983 !! end
7985 !! test
7986 Localized image handling (2).
7987 !! options
7988 language=es
7989 !! input
7990 [[Archivo:Foobar.jpg|miniatura|izquierda|enlace=foo|caption]]
7991 !! result
7992 <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>
7994 !! end
7996 !! test
7997 "border", "frameless" and "class" attributes on an image.
7998 !! input
7999 [[File:Foobar.jpg|frameless|border|class=extra|caption]]
8000 !! result
8001 <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>
8002 </p>
8003 !! end
8005 !! article
8006 File:Barfoo.jpg
8007 !! text
8008 #REDIRECT [[File:Barfoo.jpg]]
8009 !! endarticle
8011 !! test
8012 Redirected image
8013 !! input
8014 [[Image:Barfoo.jpg]]
8015 !! result
8016 <p><a href="/wiki/File:Barfoo.jpg" title="File:Barfoo.jpg">File:Barfoo.jpg</a>
8017 </p>
8018 !! end
8020 !! test
8021 Missing image with uploads disabled
8022 !! options
8023 wgEnableUploads=0
8024 !! input
8025 [[Image:Foobaz.jpg]]
8026 !! result
8027 <p><a href="/wiki/File:Foobaz.jpg" title="File:Foobaz.jpg">File:Foobaz.jpg</a>
8028 </p>
8029 !! end
8031 # Parsoid-specific testing for images
8032 # http://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec#Images
8033 # Currently imperfect due to a flaw in the Parsoid testrunner
8034 # Work in progress
8036 !! test
8037 Parsoid-specific image handling - simple image
8038 !! options
8039 parsoid
8040 !! input
8041 [[Image:Foobar.jpg]]
8042 !! result
8044 <span class="mw-default-size" typeof="mw:Image">
8045 <a href="File:Foobar.jpg">
8046 <img resource="./File:Foobar.jpg" src="//upload.wikimedia.org/wikipedia/commons/3/3a/Foobar.jpg" height="220" width="1941">
8047 </a>
8048 </span>
8049 </p>
8050 !! end
8052 !! test
8053 Parsoid-specific image handling - simple image without link
8054 !! options
8055 parsoid
8056 !! input
8057 [[Image:Foobar.jpg|link=]]
8058 !! result
8060 <span class="mw-default-size" typeof="mw:Image">
8061 <span>
8062 <img resource="./File:Foobar.jpg" src="//upload.wikimedia.org/wikipedia/commons/3/3a/Foobar.jpg" height="220" width="1941">
8063 </span>
8064 </span>
8065 </p>
8066 !! end
8068 !! test
8069 Parsoid-specific image handling - simple image with specific link
8070 !! options
8071 parsoid
8072 !! input
8073 [[Image:Foobar.jpg|link=Main Page]]
8074 !! result
8076 <span class="mw-default-size" typeof="mw:Image">
8077 <a href="Main_Page">
8078 <img resource="./File:Foobar.jpg" src="//upload.wikimedia.org/wikipedia/commons/3/3a/Foobar.jpg" height="220" width="1941">
8079 </a>
8080 </span>
8081 </p>
8082 !! end
8084 !! test
8085 Parsoid-specific image handling - simple image with size and middle alignment
8086 !! options
8087 parsoid
8088 !! input
8089 [[Image:Foobar.jpg|50px|middle]]
8090 !! result
8092 <span class="mw-valign-middle" typeof="mw:Image">
8093 <a href="File:Foobar.jpg">
8094 <img resource="./File:Foobar.jpg" src="//upload.wikimedia.org/wikipedia/commons/3/3a/Foobar.jpg/50px-Foobar.jpg" height="6" width="50">
8095 </a>
8096 </span>
8097 </p>
8098 !! end
8100 !! test
8101 Parsoid-specific image handling - simple image with both sizes, a baseline alignment, and a caption
8102 !! options
8103 parsoid
8104 !! input
8105 [[Image:Foobar.jpg|500x10px|baseline|caption]]
8106 !! result
8108 <span class="mw-valign-baseline" typeof="mw:Image" data-mw="{&quot;caption&quot;:&quot;caption&quot;}">
8109 <a href="File:Foobar.jpg">
8110 <img resource="./File:Foobar.jpg" src="//upload.wikimedia.org/wikipedia/commons/3/3a/Foobar.jpg/89px-Foobar.jpg" height="10" width="89">
8111 </a>
8112 </span>
8113 </p>
8114 !! end
8116 !! test
8117 Parsoid-specific image handling - simple image with border and size spec
8118 !! options
8119 parsoid
8120 !! input
8121 [[Image:Foobar.jpg|50px|border|caption]]
8122 !! result
8124 <span class="mw-image-border" typeof="mw:Image" data-mw="{&quot;caption&quot;:&quot;caption&quot;}">
8125 <a href="File:Foobar.jpg">
8126 <img resource="./File:Foobar.jpg" src="//upload.wikimedia.org/wikipedia/commons/3/3a/Foobar.jpg/50px-Foobar.jpg" height="6" width="50">
8127 </a>
8128 </span>
8129 </p>
8130 !! end
8132 !! test
8133 Parsoid-specific image handling - thumbnail with halign, valign, and caption
8134 !! options
8135 parsoid
8136 !! input
8137 [[Image:Foobar.jpg|thumb|left|baseline|caption content]]
8138 !! result
8139 <figure class="mw-default-size mw-halign-left mw-valign-baseline" typeof="mw:Image/Thumb">
8140 <a href="File:Foobar.jpg">
8141 <img resource="./File:Foobar.jpg" src="//upload.wikimedia.org/wikipedia/commons/3/3a/Foobar.jpg/180px-Foobar.jpg" height="21" width="180" />
8142 </a>
8143 <figcaption class="mw-figcaption">caption content</figcaption>
8144 </figure>
8145 !! end
8147 !! test
8148 Parsoid-specific image handling - thumbnail with specific size, halign, valign, and caption
8149 !! options
8150 parsoid
8151 !! input
8152 [[Image:Foobar.jpg|thumb|50x50px|right|middle|caption]]
8153 !! result
8154 <figure class="mw-halign-right mw-valign-middle" typeof="mw:Image/Thumb">
8155 <a href="File:Foobar.jpg">
8156 <img resource="./File:Foobar.jpg" src="//upload.wikimedia.org/wikipedia/commons/3/3a/Foobar.jpg/50px-Foobar.jpg" height="6" width="50" />
8157 </a>
8158 <figcaption class="mw-figcaption">caption</figcaption>
8159 </figure>
8160 !! end
8162 !! test
8163 Parsoid-specific image handling - framed image with specific size and caption
8164 !! options
8165 parsoid
8166 !! input
8167 [[Image:Foobar.jpg|500x50px|frame|caption]]
8168 !! result
8169 <figure typeof="mw:Image/Frame">
8170 <a href="File:Foobar.jpg">
8171 <img resource="./File:Foobar.jpg" src="//upload.wikimedia.org/wikipedia/commons/3/3a/Foobar.jpg/442px-Foobar.jpg" height="50" width="442" />
8172 </a>
8173 <figcaption class="mw-figcaption">caption</figcaption>
8174 </figure>
8175 !! end
8177 !! test
8178 Parsoid-specific image handling - framed image with specific size, halign, valign, and caption
8179 !! options
8180 parsoid
8181 !! input
8182 [[Image:Foobar.jpg|500x50px|frame|left|baseline|caption]]
8183 !! result
8184 <figure class="mw-halign-left mw-valign-baseline" typeof="mw:Image/Frame">
8185 <a href="File:Foobar.jpg">
8186 <img resource="./File:Foobar.jpg" src="//upload.wikimedia.org/wikipedia/commons/3/3a/Foobar.jpg/442px-Foobar.jpg" height="50" width="442" />
8187 </a>
8188 <figcaption class="mw-figcaption">caption</figcaption>
8189 </figure>
8190 !! end
8192 !! test
8193 Parsoid-specific image handling - frameless image with specific size, border, and caption
8194 !! options
8195 parsoid
8196 !! input
8197 [[Image:Foobar.jpg|frameless|500x50px|border|caption]]
8198 !! result
8200 <span class="mw-image-border" typeof="mw:Image/Frameless" data-mw="{&quot;caption&quot;:&quot;caption&quot;}">
8201 <a href="File:Foobar.jpg">
8202 <img resource="./File:Foobar.jpg" src="//upload.wikimedia.org/wikipedia/commons/3/3a/Foobar.jpg/442px-Foobar.jpg" height="50" width="442" />
8203 </a>
8204 </p>
8205 !! end
8207 #!! test
8208 #Parsoid-specific image handling - simple image with a formatted caption
8209 #!! options
8210 #parsoid
8211 #!! input
8212 #[[Image:Foobar.jpg|<table><tr><td>a</td><td>b</td></tr><tr><td>c</td></tr></table>]]
8213 #!! result
8214 #<p>
8215 #<span typeof="mw:Image">
8216 #<a class="mw-default-size" href="Image:Foobar.jpg">
8217 #<img alt="Foobar.jpg" class="mw-default-size" src="http://upload.wikimedia.org/wikipedia/commons/3/3a/Foobar.jpg" height="220" width="1941">
8218 #</a>
8219 #<span>abc</span>
8220 #</span>
8221 #</p>
8225 ### Subpages
8227 !! article
8228 Subpage test/subpage
8229 !! text
8231 !! endarticle
8233 !! test
8234 Subpage link
8235 !! options
8236 subpage title=[[Subpage test]]
8237 !! input
8238 [[/subpage]]
8239 !! result
8240 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a>
8241 </p>
8242 !! end
8244 !! test
8245 Subpage noslash link
8246 !! options
8247 subpage title=[[Subpage test]]
8248 !!input
8249 [[/subpage/]]
8250 !! result
8251 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">subpage</a>
8252 </p>
8253 !! end
8255 !! test
8256 Disabled subpages
8257 !! input
8258 [[/subpage]]
8259 !! result
8260 <p><a href="/index.php?title=/subpage&amp;action=edit&amp;redlink=1" class="new" title="/subpage (page does not exist)">/subpage</a>
8261 </p>
8262 !! end
8264 !! test
8265 BUG 561: {{/Subpage}}
8266 !! options
8267 subpage title=[[Page]]
8268 !! input
8269 {{/Subpage}}
8270 !! result
8271 <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>
8272 </p>
8273 !! end
8276 ### Categories
8278 !! article
8279 Category:MediaWiki User's Guide
8280 !! text
8281 blah
8282 !! endarticle
8284 !! test
8285 Link to category
8286 !! input
8287 [[:Category:MediaWiki User's Guide]]
8288 !! result
8289 <p><a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">Category:MediaWiki User's Guide</a>
8290 </p>
8291 !! end
8293 !! test
8294 Simple category
8295 !! options
8297 !! input
8298 [[Category:MediaWiki User's Guide]]
8299 !! result
8300 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
8301 !! end
8303 !! test
8304 PAGESINCATEGORY invalid title fatal (r33546 fix)
8305 !! input
8306 {{PAGESINCATEGORY:<bogus>}}
8307 !! result
8308 <p>0
8309 </p>
8310 !! end
8312 !! test
8313 Category with different sort key
8314 !! options
8316 !! input
8317 [[Category:MediaWiki User's Guide|Foo]]
8318 !! result
8319 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
8320 !! end
8322 !! test
8323 Category with identical sort key
8324 !! options
8326 !! input
8327 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
8328 !! result
8329 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
8330 !! end
8332 !! test
8333 Category with empty sort key
8334 !! options
8337 !! input
8338 [[Category:MediaWiki User's Guide|]]
8339 !! result
8340 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
8341 !! end
8343 !! test
8344 Category with empty sort key and parentheses
8345 !! options
8348 !! input
8349 [[Category:Foo (bar)|]]
8350 !! result
8351 [[Category:Foo (bar)|Foo]]
8352 !! end
8354 !! test
8355 Category with link tail
8356 !! options
8359 !! input
8360 123[[Category:Foo]]456
8361 !! result
8362 123[[Category:Foo]]456
8363 !! end
8365 !! test
8366 Category with template
8367 !! options
8370 !! input
8371 [[Category:{{echo|Foo}}]]
8372 !! result
8373 [[Category:{{echo|Foo}}]]
8374 !! end
8376 !! test
8377 Category with template in sort key
8378 !! options
8381 !! input
8382 [[Category:Foo|{{echo|Bar}}]]
8383 !! result
8384 [[Category:Foo|{{echo|Bar}}]]
8385 !! end
8387 !! test
8388 Category with template in sort key and title
8389 !! options
8392 !! input
8393 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
8394 !! result
8395 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
8396 !! end
8398 !! test
8399 Category / paragraph interactions
8400 !! input
8401 Foo [[Category:Baz]] Bar
8403 Foo [[Category:Baz]]
8407 [[Category:Baz]]
8411 [[Category:Baz]] Bar
8414 [[Category:Baz]]
8415  [[Category:Baz]]
8416 [[Category:Baz]]
8419 [[Category:Baz]]
8420  [[Category:Baz]]
8421 [[Category:Baz]]
8423 [[Category:Baz]]
8424  {{echo|[[Category:Baz]]}}
8425 [[Category:Baz]]
8426 !! result
8427 <p>Foo Bar
8428 </p><p>Foo
8430 </p><p>Foo
8432 </p><p>Foo Bar
8433 </p><p>Foo
8435 </p>
8436 !! end
8439 ### Inter-language links
8441 !! test
8442 Inter-language links
8443 !! options
8445 !! input
8446 [[es:Alimento]]
8447 [[fr:Nourriture]]
8448 [[zh:&#39135;&#21697;]]
8449 !! result
8450 es:Alimento fr:Nourriture zh:食品
8451 !! end
8453 !! test
8454 Duplicate interlanguage links (bug 24502)
8455 !! options
8457 !! input
8458 [[es:1]]
8459 [[es:2]]
8460 [[fr:1]]
8461 [[fr:2]]
8462 !! result
8463 es:1 fr:1
8464 !! end
8467 ### Sections
8469 !! test
8470 Basic section headings
8471 !! input
8472 == Headline 1 ==
8473 Some text
8475 ==Headline 2==
8476 More
8477 ===Smaller headline===
8478 Blah blah
8479 !! result
8480 <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>
8481 <p>Some text
8482 </p>
8483 <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>
8484 <p>More
8485 </p>
8486 <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>
8487 <p>Blah blah
8488 </p>
8489 !! end
8491 !! test
8492 Section headings with TOC
8493 !! input
8494 == Headline 1 ==
8495 === Subheadline 1 ===
8496 ===== Skipping a level =====
8497 ====== Skipping a level ======
8499 == Headline 2 ==
8500 Some text
8501 ===Another headline===
8502 !! result
8503 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
8504 <ul>
8505 <li class="toclevel-1 tocsection-1"><a href="#Headline_1"><span class="tocnumber">1</span> <span class="toctext">Headline 1</span></a>
8506 <ul>
8507 <li class="toclevel-2 tocsection-2"><a href="#Subheadline_1"><span class="tocnumber">1.1</span> <span class="toctext">Subheadline 1</span></a>
8508 <ul>
8509 <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>
8510 <ul>
8511 <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>
8512 </ul>
8513 </li>
8514 </ul>
8515 </li>
8516 </ul>
8517 </li>
8518 <li class="toclevel-1 tocsection-5"><a href="#Headline_2"><span class="tocnumber">2</span> <span class="toctext">Headline 2</span></a>
8519 <ul>
8520 <li class="toclevel-2 tocsection-6"><a href="#Another_headline"><span class="tocnumber">2.1</span> <span class="toctext">Another headline</span></a></li>
8521 </ul>
8522 </li>
8523 </ul>
8524 </td></tr></table>
8525 <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>
8526 <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>
8527 <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>
8528 <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>
8529 <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>
8530 <p>Some text
8531 </p>
8532 <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>
8534 !! end
8536 # perl -e 'print "="x$_," Level $_ heading","="x$_,"\n" for 1..10'
8537 !! test
8538 Handling of sections up to level 6 and beyond
8539 !! input
8540 = Level 1 Heading=
8541 == Level 2 Heading==
8542 === Level 3 Heading===
8543 ==== Level 4 Heading====
8544 ===== Level 5 Heading=====
8545 ====== Level 6 Heading======
8546 ======= Level 7 Heading=======
8547 ======== Level 8 Heading========
8548 ========= Level 9 Heading=========
8549 ========== Level 10 Heading==========
8550 !! result
8551 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
8552 <ul>
8553 <li class="toclevel-1 tocsection-1"><a href="#Level_1_Heading"><span class="tocnumber">1</span> <span class="toctext">Level 1 Heading</span></a>
8554 <ul>
8555 <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>
8556 <ul>
8557 <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>
8558 <ul>
8559 <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>
8560 <ul>
8561 <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>
8562 <ul>
8563 <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>
8564 <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>
8565 <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>
8566 <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>
8567 <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>
8568 </ul>
8569 </li>
8570 </ul>
8571 </li>
8572 </ul>
8573 </li>
8574 </ul>
8575 </li>
8576 </ul>
8577 </li>
8578 </ul>
8579 </td></tr></table>
8580 <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>
8581 <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>
8582 <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>
8583 <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>
8584 <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>
8585 <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>
8586 <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>
8587 <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>
8588 <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>
8589 <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>
8591 !! end
8593 !! test
8594 TOC regression (bug 9764)
8595 !! input
8596 == title 1 ==
8597 === title 1.1 ===
8598 ==== title 1.1.1 ====
8599 === title 1.2 ===
8600 == title 2 ==
8601 === title 2.1 ===
8602 !! result
8603 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
8604 <ul>
8605 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
8606 <ul>
8607 <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>
8608 <ul>
8609 <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>
8610 </ul>
8611 </li>
8612 <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>
8613 </ul>
8614 </li>
8615 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
8616 <ul>
8617 <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>
8618 </ul>
8619 </li>
8620 </ul>
8621 </td></tr></table>
8622 <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>
8623 <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>
8624 <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>
8625 <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>
8626 <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>
8627 <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>
8629 !! end
8631 !! test
8632 TOC with wgMaxTocLevel=3 (bug 6204)
8633 !! options
8634 wgMaxTocLevel=3
8635 !! input
8636 == title 1 ==
8637 === title 1.1 ===
8638 ==== title 1.1.1 ====
8639 === title 1.2 ===
8640 == title 2 ==
8641 === title 2.1 ===
8642 !! result
8643 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
8644 <ul>
8645 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
8646 <ul>
8647 <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>
8648 <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>
8649 </ul>
8650 </li>
8651 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
8652 <ul>
8653 <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>
8654 </ul>
8655 </li>
8656 </ul>
8657 </td></tr></table>
8658 <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>
8659 <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>
8660 <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>
8661 <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>
8662 <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>
8663 <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>
8665 !! end
8667 !! test
8668 TOC with wgMaxTocLevel=3 and two level four headings (bug 6204)
8669 !! options
8670 wgMaxTocLevel=3
8671 !! input
8672 ==Section 1==
8673 ===Section 1.1===
8674 ====Section 1.1.1====
8675 ====Section 1.1.1.1====
8676 ==Section 2==
8677 !! result
8678 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
8679 <ul>
8680 <li class="toclevel-1 tocsection-1"><a href="#Section_1"><span class="tocnumber">1</span> <span class="toctext">Section 1</span></a>
8681 <ul>
8682 <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>
8683 </ul>
8684 </li>
8685 <li class="toclevel-1 tocsection-5"><a href="#Section_2"><span class="tocnumber">2</span> <span class="toctext">Section 2</span></a></li>
8686 </ul>
8687 </td></tr></table>
8688 <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>
8689 <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>
8690 <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>
8691 <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>
8692 <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>
8694 !! end
8697 !! test
8698 Resolving duplicate section names
8699 !! input
8700 == Foo bar ==
8701 == Foo bar ==
8702 !! result
8703 <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>
8704 <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>
8706 !! end
8708 !! test
8709 Resolving duplicate section names with differing case (bug 10721)
8710 !! input
8711 == Foo bar ==
8712 == Foo Bar ==
8713 !! result
8714 <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>
8715 <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>
8717 !! end
8719 !! article
8720 Template:sections
8721 !! text
8722 ===Section 1===
8723 ==Section 2==
8724 !! endarticle
8726 !! test
8727 Template with sections, __NOTOC__
8728 !! input
8729 __NOTOC__
8730 ==Section 0==
8731 {{sections}}
8732 ==Section 4==
8733 !! result
8734 <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>
8735 <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>
8736 <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>
8737 <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>
8739 !! end
8741 !! test
8742 __NOEDITSECTION__ keyword
8743 !! input
8744 __NOEDITSECTION__
8745 ==Section 1==
8746 ==Section 2==
8747 !! result
8748 <h2><span class="mw-headline" id="Section_1">Section 1</span></h2>
8749 <h2><span class="mw-headline" id="Section_2">Section 2</span></h2>
8751 !! end
8753 !! test
8754 Link inside a section heading
8755 !! input
8756 ==Section with a [[Main Page|link]] in it==
8757 !! result
8758 <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>
8760 !! end
8762 !! test
8763 TOC regression (bug 12077)
8764 !! input
8765 __TOC__
8766 == title 1 ==
8767 === title 1.1 ===
8768 == title 2 ==
8769 !! result
8770 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
8771 <ul>
8772 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
8773 <ul>
8774 <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>
8775 </ul>
8776 </li>
8777 <li class="toclevel-1 tocsection-3"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a></li>
8778 </ul>
8779 </td></tr></table>
8780 <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>
8781 <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>
8782 <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>
8784 !! end
8786 !! test
8787 BUG 1219 URL next to image (good)
8788 !! input
8789 http://example.com [[Image:foobar.jpg]]
8790 !! result
8791 <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>
8792 </p>
8793 !!end
8795 !! test
8796 Short headings with trailing space should match behavior of Parser::doHeadings (bug 19910)
8797 !! input
8798 === 
8799 The line above must have a trailing space!
8800 === <!--
8801 --> <!-- -->
8802 But just in case it doesn't...
8803 !! result
8804 <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>
8805 <p>The line above must have a trailing space!
8806 </p>
8807 <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>
8808 <p>But just in case it doesn't...
8809 </p>
8810 !! end
8812 !! test
8813 Header with special characters (bug 25462)
8814 !! input
8815 The tooltips shall not show entities to the user (ie. be double escaped)
8817 == text > text ==
8818 section 1
8820 == text < text ==
8821 section 2
8823 == text & text ==
8824 section 3
8826 == text ' text ==
8827 section 4
8829 == text " text ==
8830 section 5
8831 !! result
8832 <p>The tooltips shall not show entities to the user (ie. be double escaped)
8833 </p>
8834 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
8835 <ul>
8836 <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>
8837 <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>
8838 <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>
8839 <li class="toclevel-1 tocsection-4"><a href="#text_.27_text"><span class="tocnumber">4</span> <span class="toctext">text ' text</span></a></li>
8840 <li class="toclevel-1 tocsection-5"><a href="#text_.22_text"><span class="tocnumber">5</span> <span class="toctext">text " text</span></a></li>
8841 </ul>
8842 </td></tr></table>
8843 <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>
8844 <p>section 1
8845 </p>
8846 <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>
8847 <p>section 2
8848 </p>
8849 <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>
8850 <p>section 3
8851 </p>
8852 <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>
8853 <p>section 4
8854 </p>
8855 <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>
8856 <p>section 5
8857 </p>
8858 !! end
8860 !! test
8861 Headers with excess '=' characters
8862 (Are similar tests necessary beyond the 1st level?)
8863 !! input
8864 =foo==
8865 ==foo=
8866 =''italic'' heading==
8867 ==''italic'' heading=
8868 !! result
8869 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
8870 <ul>
8871 <li class="toclevel-1 tocsection-1"><a href="#foo.3D"><span class="tocnumber">1</span> <span class="toctext">foo=</span></a></li>
8872 <li class="toclevel-1 tocsection-2"><a href="#.3Dfoo"><span class="tocnumber">2</span> <span class="toctext">=foo</span></a></li>
8873 <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>
8874 <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>
8875 </ul>
8876 </td></tr></table>
8877 <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>
8878 <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>
8879 <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>
8880 <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>
8882 !! end
8884 !! test
8885 HTML headers vs TOC (bug 23393)
8886 (__NOEDITSECTION__ for clearer output, doesn't matter here)
8887 !! input
8888 <h1>Header 1</h1>
8889 == Header 1.1 ==
8890 == Header 1.2 ==
8892 <h1>Header 2
8893 </h1>
8894 == Header 2.1 ==
8895 == Header 2.2 ==
8896 __NOEDITSECTION__
8897 !! result
8898 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
8899 <ul>
8900 <li class="toclevel-1"><a href="#Header_1"><span class="tocnumber">1</span> <span class="toctext">Header 1</span></a>
8901 <ul>
8902 <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>
8903 <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>
8904 </ul>
8905 </li>
8906 <li class="toclevel-1"><a href="#Header_2"><span class="tocnumber">2</span> <span class="toctext">Header 2</span></a>
8907 <ul>
8908 <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>
8909 <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>
8910 </ul>
8911 </li>
8912 </ul>
8913 </td></tr></table>
8914 <h1><span class="mw-headline" id="Header_1">Header 1</span></h1>
8915 <h2><span class="mw-headline" id="Header_1.1">Header 1.1</span></h2>
8916 <h2><span class="mw-headline" id="Header_1.2">Header 1.2</span></h2>
8917 <h1><span class="mw-headline" id="Header_2">Header 2</span></h1>
8918 <h2><span class="mw-headline" id="Header_2.1">Header 2.1</span></h2>
8919 <h2><span class="mw-headline" id="Header_2.2">Header 2.2</span></h2>
8921 !! end
8923 !! test
8924 BUG 1219 URL next to image (broken)
8925 !! input
8926 http://example.com[[Image:foobar.jpg]]
8927 !! result
8928 <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>
8929 </p>
8930 !!end
8932 !! test
8933 Bug 1186 news: in the middle of text
8934 !! input
8935 http://en.wikinews.org/wiki/Wikinews:Workplace
8936 !! result
8937 <p><a rel="nofollow" class="external free" href="http://en.wikinews.org/wiki/Wikinews:Workplace">http://en.wikinews.org/wiki/Wikinews:Workplace</a>
8938 </p>
8939 !!end
8942 !! test
8943 Namespaced link must have a title
8944 !! input
8945 [[Project:]]
8946 !! result
8947 <p>[[Project:]]
8948 </p>
8949 !!end
8951 !! test
8952 Namespaced link must have a title (bad fragment version)
8953 !! input
8954 [[Project:#fragment]]
8955 !! result
8956 <p>[[Project:#fragment]]
8957 </p>
8958 !!end
8962 ### HTML tags and HTML attributes
8965 !! test
8966 div with no attributes
8967 !! input
8968 <div>HTML rocks</div>
8969 !! result
8970 <div>HTML rocks</div>
8972 !! end
8974 !! test
8975 div with double-quoted attribute
8976 !! input
8977 <div id="rock">HTML rocks</div>
8978 !! result
8979 <div id="rock">HTML rocks</div>
8981 !! end
8983 !! test
8984 div with single-quoted attribute
8985 !! input
8986 <div id='rock'>HTML rocks</div>
8987 !! result
8988 <div id="rock">HTML rocks</div>
8990 !! end
8992 !! test
8993 div with unquoted attribute
8994 !! input
8995 <div id=rock>HTML rocks</div>
8996 !! result
8997 <div id="rock">HTML rocks</div>
8999 !! end
9001 !! test
9002 div with illegal double attributes
9003 !! input
9004 <div id="a" id="b">HTML rocks</div>
9005 !! result
9006 <div id="b">HTML rocks</div>
9008 !!end
9010 # FIXME: produce empty string instead of "class" in the PHP parser, following
9011 # the HTML5 spec.
9012 !! test
9013 div with empty attribute value, space before equals
9014 !! options
9015 parsoid
9016 !! input
9017 <div class =>HTML rocks</div>
9018 !! result
9019 <div class="">HTML rocks</div>
9021 !! end
9023 # The PHP parser escapes the opening brace to &#123; for some reason, so
9024 # disabled this test for it.
9025 !! test
9026 div with braces in attribute value
9027 !! options
9028 parsoid
9029 !! input
9030 <div title="{}">Foo</div>
9031 !! result
9032 <div title="{}">Foo</div>
9033 !! end
9035 # This it very inconsistent in the PHP parser: it returns 
9036 # class="class" if there is a space between the name and the equal sign (see
9037 # 'div with empty attribute value, space before equals'), but strips the
9038 # attribute completely if the space is missing. We hope that not much content
9039 # depends on this, so are implementing the behavior below in Parsoid for
9040 # consistencies' sake. Disabled for the PHP parser. 
9041 # FIXME: fix this behavior in the PHP parser?
9042 !! test
9043 div with empty attribute value, no space before equals
9044 !! options
9045 parsoid
9046 !! input
9047 <div class=>HTML rocks</div>
9048 !! result
9049 <div class="">HTML rocks</div>
9051 !! end
9053 !! test
9054 HTML multiple attributes correction
9055 !! input
9056 <p class="error" class="awesome">Awesome!</p>
9057 !! result
9058 <p class="awesome">Awesome!</p>
9060 !!end
9062 !! test
9063 Table multiple attributes correction
9064 !! input
9066 !+ class="error" class="awesome"| status
9068 !! result
9069 <table>
9070 <tr>
9071 <th class="awesome"> status
9072 </th></tr></table>
9074 !!end
9076 !! test
9077 DIV IN UPPERCASE
9078 !! input
9079 <DIV ID="x">HTML ROCKS</DIV>
9080 !! result
9081 <div id="x">HTML ROCKS</div>
9083 !!end
9085 !! test
9086 Non-ASCII pseudo-tags are rendered as text
9087 !! input
9088 <khyô>
9089 !! result
9090 <p>&lt;khyô&gt;
9091 </p>
9092 !! end
9094 !! test
9095 Pseudo-tag with URL 'name' renders as url link
9096 !! input
9097 <http://example.com/>
9098 !! result
9099 <p>&lt;<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&gt;
9100 </p>
9101 !! end
9103 !! test
9104 text with amp in the middle of nowhere
9105 !! input
9106 Remember AT&T?
9107 !!result
9108 <p>Remember AT&amp;T?
9109 </p>
9110 !! end
9112 !! test
9113 text with character entity: eacute
9114 !! input
9115 I always thought &eacute; was a cute letter.
9116 !! result
9117 <p>I always thought &#233; was a cute letter.
9118 </p>
9119 !! end
9121 !! test
9122 text with entity-escaped character entity-like string: eacute
9123 !! input
9124 I always thought &amp;eacute; was a cute letter.
9125 !! result
9126 <p>I always thought &amp;eacute; was a cute letter.
9127 </p>
9128 !! end
9130 !! test
9131 text with undefined character entity: xacute
9132 !! input
9133 I always thought &xacute; was a cute letter.
9134 !! result
9135 <p>I always thought &amp;xacute; was a cute letter.
9136 </p>
9137 !! end
9141 ### Media links
9144 !! test
9145 Media link
9146 !! input
9147 [[Media:Foobar.jpg]]
9148 !! result
9149 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Media:Foobar.jpg</a>
9150 </p>
9151 !! end
9153 !! test
9154 Media link with text
9155 !! input
9156 [[Media:Foobar.jpg|A neat file to look at]]
9157 !! result
9158 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">A neat file to look at</a>
9159 </p>
9160 !! end
9162 # FIXME: this is still bad HTML tag nesting
9163 !! test
9164 Media link with nasty text
9165 fixme: doBlockLevels won't wrap this in a paragraph because it contains a div
9166 !! input
9167 [[Media:Foobar.jpg|Safe Link<div style=display:none>" onmouseover="alert(document.cookie)" onfoo="</div>]]
9168 !! result
9169 <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>
9171 !! end
9173 !! test
9174 Media link to nonexistent file (bug 1702)
9175 !! input
9176 [[Media:No such.jpg]]
9177 !! result
9178 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=No_such.jpg" class="new" title="No such.jpg">Media:No such.jpg</a>
9179 </p>
9180 !! end
9182 !! test
9183 Image link to nonexistent file (bug 1850 - good)
9184 !! input
9185 [[Image:No such.jpg]]
9186 !! result
9187 <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>
9188 </p>
9189 !! end
9191 !! test
9192 :Image link to nonexistent file (bug 1850 - bad)
9193 !! input
9194 [[:Image:No such.jpg]]
9195 !! result
9196 <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>
9197 </p>
9198 !! end
9202 !! test
9203 Character reference normalization in link text (bug 1938)
9204 !! input
9205 [[Main Page|this&that]]
9206 !! result
9207 <p><a href="/wiki/Main_Page" title="Main Page">this&amp;that</a>
9208 </p>
9209 !!end
9211 !! article
9212 אַ
9213 !! text
9214 Test for unicode normalization
9216 The page's name is U+05d0 U+05b7, with non-canonical form U+FB2E
9217 !! endarticle
9219 !! test
9220 (bug 19451) Links should refer to the normalized form.
9221 !! input
9222 [[&#xFB2E;]]
9223 [[&#x5d0;&#x5b7;]]
9224 [[&#x5d0;ַ]]
9225 [[א&#x5b7;]]
9226 [[אַ]]
9227 !! result
9228 <p><a href="/wiki/%D7%90%D6%B7" title="אַ">&#xfb2e;</a>
9229 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;&#x5b7;</a>
9230 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;ַ</a>
9231 <a href="/wiki/%D7%90%D6%B7" title="אַ">א&#x5b7;</a>
9232 <a href="/wiki/%D7%90%D6%B7" title="אַ">אַ</a>
9233 </p>
9234 !! end
9236 !! test
9237 Empty attribute crash test (bug 2067)
9238 !! input
9239 <font color="">foo</font>
9240 !! result
9241 <p><font color="">foo</font>
9242 </p>
9243 !! end
9245 !! test
9246 Empty attribute crash test single-quotes (bug 2067)
9247 !! input
9248 <font color=''>foo</font>
9249 !! result
9250 <p><font color="">foo</font>
9251 </p>
9252 !! end
9254 !! test
9255 Attribute test: equals, then nothing
9256 !! input
9257 <font color=>foo</font>
9258 !! result
9259 <p><font>foo</font>
9260 </p>
9261 !! end
9263 !! test
9264 Attribute test: unquoted value
9265 !! input
9266 <font color=x>foo</font>
9267 !! result
9268 <p><font color="x">foo</font>
9269 </p>
9270 !! end
9272 !! test
9273 Attribute test: unquoted but illegal value (hash)
9274 !! input
9275 <font color=#x>foo</font>
9276 !! result
9277 <p><font color="#x">foo</font>
9278 </p>
9279 !! end
9281 !! test
9282 Attribute test: no value
9283 !! input
9284 <font color>foo</font>
9285 !! result
9286 <p><font color="color">foo</font>
9287 </p>
9288 !! end
9290 !! test
9291 Bug 2095: link with three closing brackets
9292 !! input
9293 [[Main Page]]]
9294 !! result
9295 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>]
9296 </p>
9297 !! end
9299 !! test
9300 Bug 2095: link with pipe and three closing brackets
9301 !! input
9302 [[Main Page|link]]]
9303 !! result
9304 <p><a href="/wiki/Main_Page" title="Main Page">link</a>]
9305 </p>
9306 !! end
9308 !! test
9309 Bug 2095: link with pipe and three closing brackets, version 2
9310 !! input
9311 [[Main Page|[http://example.com/]]]
9312 !! result
9313 <p><a href="/wiki/Main_Page" title="Main Page">[http://example.com/]</a>
9314 </p>
9315 !! end
9319 ### Safety
9322 !! article
9323 Template:Dangerous attribute
9324 !! text
9325 " onmouseover="alert(document.cookie)
9326 !! endarticle
9328 !! article
9329 Template:Dangerous style attribute
9330 !! text
9331 border-size: expression(alert(document.cookie))
9332 !! endarticle
9334 !! article
9335 Template:Div style
9336 !! text
9337 <div style="float: right; {{{1}}}">Magic div</div>
9338 !! endarticle
9340 !! test
9341 Bug 2304: HTML attribute safety (safe template; regression bug 2309)
9342 !! input
9343 <div title="{{test}}"></div>
9344 !! result
9345 <div title="This is a test template"></div>
9347 !! end
9349 !! test
9350 Bug 2304: HTML attribute safety (dangerous template; 2309)
9351 !! input
9352 <div title="{{dangerous attribute}}"></div>
9353 !! result
9354 <div title=""></div>
9356 !! end
9358 !! test
9359 Bug 2304: HTML attribute safety (dangerous style template; 2309)
9360 !! input
9361 <div style="{{dangerous style attribute}}"></div>
9362 !! result
9363 <div style="/* insecure input */"></div>
9365 !! end
9367 !! test
9368 Bug 2304: HTML attribute safety (safe parameter; 2309)
9369 !! input
9370 {{div style|width: 200px}}
9371 !! result
9372 <div style="float: right; width: 200px">Magic div</div>
9374 !! end
9376 !! test
9377 Bug 2304: HTML attribute safety (unsafe parameter; 2309)
9378 !! input
9379 {{div style|width: expression(alert(document.cookie))}}
9380 !! result
9381 <div style="/* insecure input */">Magic div</div>
9383 !! end
9385 !! test
9386 Bug 2304: HTML attribute safety (unsafe breakout parameter; 2309)
9387 !! input
9388 {{div style|"><script>alert(document.cookie)</script>}}
9389 !! result
9390 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
9392 !! end
9394 !! test
9395 Bug 2304: HTML attribute safety (unsafe breakout parameter 2; 2309)
9396 !! input
9397 {{div style|" ><script>alert(document.cookie)</script>}}
9398 !! result
9399 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
9401 !! end
9403 !! test
9404 Bug 2304: HTML attribute safety (link)
9405 !! input
9406 <div title="[[Main Page]]"></div>
9407 !! result
9408 <div title="&#91;&#91;Main Page]]"></div>
9410 !! end
9412 !! test
9413 Bug 2304: HTML attribute safety (italics)
9414 !! input
9415 <div title="''foobar''"></div>
9416 !! result
9417 <div title="&#39;&#39;foobar&#39;&#39;"></div>
9419 !! end
9421 !! test
9422 Bug 2304: HTML attribute safety (bold)
9423 !! input
9424 <div title="'''foobar'''"></div>
9425 !! result
9426 <div title="&#39;&#39;&#39;foobar&#39;&#39;&#39;"></div>
9428 !! end
9431 !! test
9432 Bug 2304: HTML attribute safety (ISBN)
9433 !! input
9434 <div title="ISBN 1234567890"></div>
9435 !! result
9436 <div title="&#73;SBN 1234567890"></div>
9438 !! end
9440 !! test
9441 Bug 2304: HTML attribute safety (RFC)
9442 !! input
9443 <div title="RFC 1234"></div>
9444 !! result
9445 <div title="&#82;FC 1234"></div>
9447 !! end
9449 !! test
9450 Bug 2304: HTML attribute safety (PMID)
9451 !! input
9452 <div title="PMID 1234567890"></div>
9453 !! result
9454 <div title="&#80;MID 1234567890"></div>
9456 !! end
9458 !! test
9459 Bug 2304: HTML attribute safety (web link)
9460 !! input
9461 <div title="http://example.com/"></div>
9462 !! result
9463 <div title="http&#58;//example.com/"></div>
9465 !! end
9467 !! test
9468 Bug 2304: HTML attribute safety (named web link)
9469 !! input
9470 <div title="[http://example.com/ link]"></div>
9471 !! result
9472 <div title="&#91;http&#58;//example.com/ link]"></div>
9474 !! end
9476 !! test
9477 Bug 3244: HTML attribute safety (extension; safe)
9478 !! input
9479 <div style="<nowiki>background:blue</nowiki>"></div>
9480 !! result
9481 <div style="background:blue"></div>
9483 !! end
9485 !! test
9486 Bug 3244: HTML attribute safety (extension; unsafe)
9487 !! input
9488 <div style="<nowiki>border-left:expression(alert(document.cookie))</nowiki>"></div>
9489 !! result
9490 <div style="/* insecure input */"></div>
9492 !! end
9494 # More MSIE fun discovered by Tom Gilder
9496 !! test
9497 MSIE CSS safety test: spurious slash
9498 !! input
9499 <div style="background-image:u\rl(javascript:alert('boo'))">evil</div>
9500 !! result
9501 <div style="/* insecure input */">evil</div>
9503 !! end
9505 !! test
9506 MSIE CSS safety test: hex code
9507 !! input
9508 <div style="background-image:u\72l(javascript:alert('boo'))">evil</div>
9509 !! result
9510 <div style="/* insecure input */">evil</div>
9512 !! end
9514 !! test
9515 MSIE CSS safety test: comment in url
9516 !! input
9517 <div style="background-image:u/**/rl(javascript:alert('boo'))">evil</div>
9518 !! result
9519 <div style="background-image:u rl(javascript:alert(&#39;boo&#39;))">evil</div>
9521 !! end
9523 !! test
9524 MSIE CSS safety test: comment in expression
9525 !! input
9526 <div style="background-image:expres/**/sion(alert('boo4'))">evil4</div>
9527 !! result
9528 <div style="background-image:expres sion(alert(&#39;boo4&#39;))">evil4</div>
9530 !! end
9533 !! test
9534 Table attribute legitimate extension
9535 !! input
9537 !+ style="<nowiki>color:blue</nowiki>"| status
9539 !! result
9540 <table>
9541 <tr>
9542 <th style="color:blue"> status
9543 </th></tr></table>
9545 !!end
9547 !! test
9548 Table attribute safety
9549 !! input
9551 !+ style="<nowiki>border-width:expression(0+alert(document.cookie))</nowiki>"| status
9553 !! result
9554 <table>
9555 <tr>
9556 <th style="/* insecure input */"> status
9557 </th></tr></table>
9559 !! end
9561 !! test
9562 CSS line continuation 1
9563 !! input
9564 <div style="background-image: u\&#10;rl(test.jpg);"></div>
9565 !! result
9566 <div style="/* insecure input */"></div>
9568 !! end
9570 !! test
9571 CSS line continuation 2
9572 !! input
9573 <div style="background-image: u\&#13;rl(test.jpg); "></div>
9574 !! result
9575 <div style="/* insecure input */"></div>
9577 !! end
9579 !! article
9580 Template:Identity
9581 !! text
9582 {{{1}}}
9583 !! endarticle
9585 !! test
9586 Expansion of multi-line templates in attribute values (bug 6255)
9587 !! input
9588 <div style="background: {{identity|#00FF00}}">-</div>
9589 !! result
9590 <div style="background: #00FF00">-</div>
9592 !! end
9595 !! test
9596 Expansion of multi-line templates in attribute values (bug 6255 sanity check)
9597 !! input
9598 <div style="background: 
9599 #00FF00">-</div>
9600 !! result
9601 <div style="background: #00FF00">-</div>
9603 !! end
9605 !! test
9606 Expansion of multi-line templates in attribute values (bug 6255 sanity check 2)
9607 !! input
9608 <div style="background: &#10;#00FF00">-</div>
9609 !! result
9610 <div style="background: &#10;#00FF00">-</div>
9612 !! end
9615 ### Parser hooks (see maintenance/parserTestsParserHook.php for the <tag> extension)
9617 !! test
9618 Parser hook: empty input
9619 !! input
9620 <tag></tag>
9621 !! result
9622 <pre>
9624 array (
9626 </pre>
9628 !! end
9630 !! test
9631 Parser hook: empty input using terminated empty elements
9632 !! input
9633 <tag/>
9634 !! result
9635 <pre>
9636 NULL
9637 array (
9639 </pre>
9641 !! end
9643 !! test
9644 Parser hook: empty input using terminated empty elements (space before)
9645 !! input
9646 <tag />
9647 !! result
9648 <pre>
9649 NULL
9650 array (
9652 </pre>
9654 !! end
9656 !! test
9657 Parser hook: basic input
9658 !! input
9659 <tag>input</tag>
9660 !! result
9661 <pre>
9662 'input'
9663 array (
9665 </pre>
9667 !! end
9670 !! test
9671 Parser hook: case insensitive
9672 !! input
9673 <TAG>input</TAG>
9674 !! result
9675 <pre>
9676 'input'
9677 array (
9679 </pre>
9681 !! end
9684 !! test
9685 Parser hook: case insensitive, redux
9686 !! input
9687 <TaG>input</TAg>
9688 !! result
9689 <pre>
9690 'input'
9691 array (
9693 </pre>
9695 !! end
9697 !! test
9698 Parser hook: nested tags
9699 !! options
9700 noxml
9701 !! input
9702 <tag><tag></tag></tag>
9703 !! result
9704 <pre>
9705 '<tag>'
9706 array (
9708 </pre>&lt;/tag&gt;
9710 !! end
9712 !! test
9713 Parser hook: basic arguments
9714 !! input
9715 <tag width=200 height = "100" depth = '50' square></tag>
9716 !! result
9717 <pre>
9719 array (
9720   'width' => '200',
9721   'height' => '100',
9722   'depth' => '50',
9723   'square' => 'square',
9725 </pre>
9727 !! end
9729 !! test
9730 Parser hook: argument containing a forward slash (bug 5344)
9731 !! input
9732 <tag filename='/tmp/bla'></tag>
9733 !! result
9734 <pre>
9736 array (
9737   'filename' => '/tmp/bla',
9739 </pre>
9741 !! end
9743 !! test
9744 Parser hook: empty input using terminated empty elements (bug 2374)
9745 !! input
9746 <tag foo=bar/>text
9747 !! result
9748 <pre>
9749 NULL
9750 array (
9751   'foo' => 'bar',
9753 </pre>text
9755 !! end
9757 # </tag> should be output literally since there is no matching tag that begins it
9758 !! test
9759 Parser hook: basic arguments using terminated empty elements (bug 2374)
9760 !! input
9761 <tag width=200 height = "100" depth = '50' square/>
9762 other stuff
9763 </tag>
9764 !! result
9765 <pre>
9766 NULL
9767 array (
9768   'width' => '200',
9769   'height' => '100',
9770   'depth' => '50',
9771   'square' => 'square',
9773 </pre>
9774 <p>other stuff
9775 &lt;/tag&gt;
9776 </p>
9777 !! end
9780 ### (see maintenance/parserTestsStaticParserHook.php for the <statictag> extension)
9783 !! test
9784 Parser hook: static parser hook not inside a comment
9785 !! input
9786 <statictag>hello, world</statictag>
9787 <statictag action=flush/>
9788 !! result
9789 <p>hello, world
9790 </p>
9791 !! end
9794 !! test
9795 Parser hook: static parser hook inside a comment
9796 !! input
9797 <!-- <statictag>hello, world</statictag> -->
9798 <statictag action=flush/>
9799 !! result
9800 <p><br />
9801 </p>
9802 !! end
9804 # Nested template calls; this case was broken by Parser.php rev 1.506,
9805 # since reverted.
9807 !! article
9808 Template:One-parameter
9809 !! text
9810 (My parameter is: {{{1}}})
9811 !! endarticle
9813 !! article
9814 Template:Map-one-parameter
9815 !! text
9816 {{{{{1}}}|{{{2}}}}}
9817 !! endarticle
9819 !! test
9820 Nested template calls
9821 !! input
9822 {{Map-one-parameter|One-parameter|param}}
9823 !! result
9824 <p>(My parameter is: param)
9825 </p>
9826 !! end
9830 ### Sanitizer
9832 !! test
9833 Sanitizer: Closing of open tags
9834 !! input
9835 <s></s><table></table>
9836 !! result
9837 <s></s><table></table>
9839 !! end
9841 !! test
9842 Sanitizer: Closing of open but not closed tags
9843 !! input
9844 <s>foo
9845 !! result
9846 <p><s>foo</s>
9847 </p>
9848 !! end
9850 !! test
9851 Sanitizer: Closing of closed but not open tags
9852 !! input
9853 </s>
9854 !! result
9855 <p>&lt;/s&gt;
9856 </p>
9857 !! end
9859 !! test
9860 Sanitizer: Closing of closed but not open table tags
9861 !! input
9862 Table not started</td></tr></table>
9863 !! result
9864 <p>Table not started&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
9865 </p>
9866 !! end
9868 !! test
9869 Sanitizer: Escaping of spaces, multibyte characters, colons & other stuff in id=""
9870 !! input
9871 <span id="æ: v">byte</span>[[#æ: v|backlink]]
9872 !! result
9873 <p><span id=".C3.A6:_v">byte</span><a href="#.C3.A6:_v">backlink</a>
9874 </p>
9875 !! end
9877 !! test
9878 Sanitizer: Validating the contents of the id attribute (bug 4515)
9879 !! options
9880 disabled
9881 !! input
9882 <br id=9 />
9883 !! result
9884 Something, but definitely not <br id="9" />...
9885 !! end
9887 !! test
9888 Sanitizer: Validating id attribute uniqueness (bug 4515, bug 6301)
9889 !! options
9890 disabled
9891 !! input
9892 <br id="foo" /><br id="foo" />
9893 !! result
9894 Something need to be done. foo-2 ? 
9895 !! end
9897 !! test
9898 Sanitizer: Validating that <meta> and <link> work, but only for Microdata
9899 !! input
9900 <div itemscope>
9901         <meta itemprop="hello" content="world">
9902         <meta http-equiv="refresh" content="5">
9903         <meta itemprop="hello" http-equiv="refresh" content="5">
9904         <link itemprop="hello" href="{{SERVER}}">
9905         <link rel="stylesheet" href="{{SERVER}}">
9906         <link rel="stylesheet" itemprop="hello" href="{{SERVER}}">
9907 </div>
9908 !! result
9909 <div itemscope="itemscope">
9910 <p>     <meta itemprop="hello" content="world" />
9911         &lt;meta http-equiv="refresh" content="5"&gt;
9912         <meta itemprop="hello" content="5" />
9913 </p>
9914         <link itemprop="hello" href="http&#58;//example.org" />
9915         &lt;link rel="stylesheet" href="<a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>"&gt;
9916         <link itemprop="hello" href="http&#58;//example.org" />
9917 </div>
9919 !! end
9921 !! test
9922 Language converter: output gets cut off unexpectedly (bug 5757)
9923 !! options
9924 language=zh
9925 !! input
9926 this bit is safe: }-
9928 but if we add a conversion instance: -{zh-cn:xxx;zh-tw:yyy}-
9930 then we get cut off here: }-
9932 all additional text is vanished
9933 !! result
9934 <p>this bit is safe: }-
9935 </p><p>but if we add a conversion instance: xxx
9936 </p><p>then we get cut off here: }-
9937 </p><p>all additional text is vanished
9938 </p>
9939 !! end
9941 !! test
9942 Self closed html pairs (bug 5487)
9943 !! options
9944 !! input
9945 <center><font id="bug" />Centered text</center>
9946 <div><font id="bug2" />In div text</div>
9947 !! result
9948 <center>&lt;font id="bug" /&gt;Centered text</center>
9949 <div>&lt;font id="bug2" /&gt;In div text</div>
9951 !! end
9957 !! test
9958 Punctuation: nbsp before exclamation
9959 !! input
9960 C'est grave !
9961 !! result
9962 <p>C'est grave&#160;!
9963 </p>
9964 !! end
9966 !! test
9967 Punctuation: CSS !important (bug 11874)
9968 !! input
9969 <div style="width:50% !important">important</div>
9970 !! result
9971 <div style="width:50% !important">important</div>
9973 !!end
9975 !! test
9976 Punctuation: CSS ! important (bug 11874; with space after)
9977 !! input
9978 <div style="width:50% ! important">important</div>
9979 !! result
9980 <div style="width:50% ! important">important</div>
9982 !!end
9985 !! test
9986 HTML bullet list, closed tags (bug 5497)
9987 !! input
9988 <ul>
9989 <li>One</li>
9990 <li>Two</li>
9991 </ul>
9992 !! result
9993 <ul>
9994 <li>One</li>
9995 <li>Two</li>
9996 </ul>
9998 !! end
10000 !! test
10001 HTML bullet list, unclosed tags (bug 5497)
10002 !! options
10003 disabled
10004 !! input
10005 <ul>
10006 <li>One
10007 <li>Two
10008 </ul>
10009 !! result
10010 <ul>
10011 <li>One
10012 </li><li>Two
10013 </li></ul>
10015 !! end
10017 !! test
10018 HTML ordered list, closed tags (bug 5497)
10019 !! input
10020 <ol>
10021 <li>One</li>
10022 <li>Two</li>
10023 </ol>
10024 !! result
10025 <ol>
10026 <li>One</li>
10027 <li>Two</li>
10028 </ol>
10030 !! end
10032 !! test
10033 HTML ordered list, unclosed tags (bug 5497)
10034 !! options
10035 disabled
10036 !! input
10037 <ol>
10038 <li>One
10039 <li>Two
10040 </ol>
10041 !! result
10042 <ol>
10043 <li>One
10044 </li><li>Two
10045 </li></ol>
10047 !! end
10049 !! test
10050 HTML nested bullet list, closed tags (bug 5497)
10051 !! input
10052 <ul>
10053 <li>One</li>
10054 <li>Two:
10055 <ul>
10056 <li>Sub-one</li>
10057 <li>Sub-two</li>
10058 </ul>
10059 </li>
10060 </ul>
10061 !! result
10062 <ul>
10063 <li>One</li>
10064 <li>Two:
10065 <ul>
10066 <li>Sub-one</li>
10067 <li>Sub-two</li>
10068 </ul>
10069 </li>
10070 </ul>
10072 !! end
10074 !! test
10075 HTML nested bullet list, open tags (bug 5497)
10076 !! options
10077 disabled
10078 !! input
10079 <ul>
10080 <li>One
10081 <li>Two:
10082 <ul>
10083 <li>Sub-one
10084 <li>Sub-two
10085 </ul>
10086 </ul>
10087 !! result
10088 <ul>
10089 <li>One
10090 </li><li>Two:
10091 <ul>
10092 <li>Sub-one
10093 </li><li>Sub-two
10094 </li></ul>
10095 </li></ul>
10097 !! end
10099 !! test
10100 HTML nested ordered list, closed tags (bug 5497)
10101 !! input
10102 <ol>
10103 <li>One</li>
10104 <li>Two:
10105 <ol>
10106 <li>Sub-one</li>
10107 <li>Sub-two</li>
10108 </ol>
10109 </li>
10110 </ol>
10111 !! result
10112 <ol>
10113 <li>One</li>
10114 <li>Two:
10115 <ol>
10116 <li>Sub-one</li>
10117 <li>Sub-two</li>
10118 </ol>
10119 </li>
10120 </ol>
10122 !! end
10124 !! test
10125 HTML nested ordered list, open tags (bug 5497)
10126 !! options
10127 disabled
10128 !! input
10129 <ol>
10130 <li>One
10131 <li>Two:
10132 <ol>
10133 <li>Sub-one
10134 <li>Sub-two
10135 </ol>
10136 </ol>
10137 !! result
10138 <ol>
10139 <li>One
10140 </li><li>Two:
10141 <ol>
10142 <li>Sub-one
10143 </li><li>Sub-two
10144 </li></ol>
10145 </li></ol>
10147 !! end
10149 !! test
10150 HTML ordered list item with parameters oddity
10151 !! input
10152 <ol><li id="fragment">One</li></ol>
10153 !! result
10154 <ol><li id="fragment">One</li></ol>
10156 !! end
10158 !!test
10159 bug 5918: autonumbering
10160 !! input
10161 [http://first/] [http://second] [ftp://ftp]
10163 ftp://inlineftp
10165 [mailto:enclosed@mail.tld With target]
10167 [mailto:enclosed@mail.tld]
10169 mailto:inline@mail.tld
10170 !! result
10171 <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>
10172 </p><p><a rel="nofollow" class="external free" href="ftp://inlineftp">ftp://inlineftp</a>
10173 </p><p><a rel="nofollow" class="external text" href="mailto:enclosed@mail.tld">With target</a>
10174 </p><p><a rel="nofollow" class="external autonumber" href="mailto:enclosed@mail.tld">[4]</a>
10175 </p><p><a rel="nofollow" class="external free" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a>
10176 </p>
10177 !! end
10181 # Security and HTML correctness
10182 # From Nick Jenkins' fuzz testing
10185 !! test
10186 Fuzz testing: Parser13
10187 !! input
10188 {| 
10189 | http://a|
10190 !! result
10191 <table>
10192 <tr>
10193 <td>
10194 </td>
10195 </tr>
10196 </table>
10198 !! end
10200 !! test
10201 Fuzz testing: Parser14
10202 !! input
10203 == onmouseover= ==
10204 http://__TOC__
10205 !! result
10206 <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>
10207 http://<table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
10208 <ul>
10209 <li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
10210 </ul>
10211 </td></tr></table>
10213 !! end
10215 !! test
10216 Fuzz testing: Parser14-table
10217 !! input
10218 ==a==
10219 {| STYLE=__TOC__
10220 !! result
10221 <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>
10222 <table style="&#95;_TOC&#95;_">
10223 <tr><td></td></tr>
10224 </table>
10226 !! end
10228 # Known to produce bogus xml (extra </td>)
10229 !! test
10230 Fuzz testing: Parser16
10231 !! options
10232 noxml
10233 !! input
10235 !https://||||||
10236 !! result
10237 <table>
10238 <tr>
10239 <th>https://</th>
10240 <th></th>
10241 <th></th>
10242 <th>
10243 </td>
10244 </tr>
10245 </table>
10247 !! end
10249 !! test
10250 Fuzz testing: Parser21
10251 !! input
10253 ! irc://{{ftp://a" onmouseover="alert('hello world');"
10255 !! result
10256 <table>
10257 <tr>
10258 <th> <a rel="nofollow" class="external free" href="irc://{{ftp://a">irc://{{ftp://a</a>" onmouseover="alert('hello world');"
10259 </th>
10260 <td>
10261 </td>
10262 </tr>
10263 </table>
10265 !! end
10267 !! test
10268 Fuzz testing: Parser22
10269 !! input
10270 http://===r:::https://b
10273 !!result
10274 <p><a rel="nofollow" class="external free" href="http://===r:::https://b">http://===r:::https://b</a>
10275 </p>
10276 <table>
10277 <tr><td></td></tr>
10278 </table>
10280 !! end
10282 # Known to produce bad XML for now
10283 !! test
10284 Fuzz testing: Parser24
10285 !! options
10286 noxml
10287 !! input
10289 {{{|
10290 <u CLASS=
10291 | {{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx--><noinclude>}}}} >
10292 <br style="onmouseover='alert(document.cookie);' " />
10294 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
10296 !! result
10297 <table>
10298 {{{|
10299 <u class="&#124;">}}}} &gt;
10300 <br style="onmouseover=&#39;alert(document.cookie);&#39;" />
10302 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
10303 <tr>
10304 <td></u>
10305 </td>
10306 </tr>
10307 </table>
10309 !! end
10311 # Note: the current result listed for this is not what the original one was,
10312 # but the original bug was JavaScript injection, which is fixed in any case.
10313 # It's not clear that the original result listed was any more correct than the
10314 # current one.  Original result:
10315 # <p>{{{| 
10316 # </p>
10317 # <li class="&#124;&#124;">
10318 # }}}blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
10319 !!test
10320 Fuzz testing: Parser25 (bug 6055)
10321 !! input
10324 <LI CLASS=||
10326 }}}blah" onmouseover="alert('hello world');" align="left"'''MOVE MOUSE CURSOR OVER HERE
10327 !! result
10328 <p>&lt;LI CLASS=blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
10329 </p>
10330 !! end
10332 !!test
10333 Fuzz testing: URL adjacent extension (with space, clean)
10334 !! options
10335 !! input
10336 http://example.com <nowiki>junk</nowiki>
10337 !! result
10338 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a> junk
10339 </p>
10340 !!end
10342 !!test
10343 Fuzz testing: URL adjacent extension (no space, dirty; nowiki)
10344 !! options
10345 !! input
10346 http://example.com<nowiki>junk</nowiki>
10347 !! result
10348 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>junk
10349 </p>
10350 !!end
10352 !!test
10353 Fuzz testing: URL adjacent extension (no space, dirty; pre)
10354 !! options
10355 !! input
10356 http://example.com<pre>junk</pre>
10357 !! result
10358 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a><pre>junk</pre>
10360 !!end
10362 !!test
10363 Fuzz testing: image with bogus manual thumbnail
10364 !!input
10365 [[Image:foobar.jpg|thumbnail= ]]
10366 !!result
10367 <div class="thumb tright"><div class="thumbinner" style="width:182px;">Error creating thumbnail:   <div class="thumbcaption"></div></div></div>
10369 !!end
10371 !! test
10372 Fuzz testing: encoded newline in generated HTML replacements (bug 6577)
10373 !! input
10374 <pre dir="&#10;"></pre>
10375 !! result
10376 <pre dir="&#10;"></pre>
10378 !! end
10380 !! test
10381 Parsing optional HTML elements (Bug 6171)
10382 !! options
10383 !! input
10384 <table>
10385   <tr>
10386     <td> Some tabular data</td>
10387     <td> More tabular data ...
10388     <td> And yet som tabular data</td>
10389   </tr>
10390 </table>
10391 !! result
10392 <table>
10393   <tr>
10394     <td> Some tabular data</td>
10395     <td> More tabular data ...
10396     </td><td> And yet som tabular data</td>
10397   </tr>
10398 </table>
10400 !! end
10402 !! test
10403 Correct handling of <td>, <tr> (Bug 6171)
10404 !! options
10405 !! input
10406 <table>
10407   <tr>
10408     <td> Some tabular data</td>
10409     <td> More tabular data ...</td>
10410     <td> And yet som tabular data</td>
10411   </tr>
10412 </table>
10413 !! result
10414 <table>
10415   <tr>
10416     <td> Some tabular data</td>
10417     <td> More tabular data ...</td>
10418     <td> And yet som tabular data</td>
10419   </tr>
10420 </table>
10422 !! end
10425 !! test
10426 Parsing crashing regression (fr:JavaScript)
10427 !! input
10428 </body></x>
10429 !! result
10430 <p>&lt;/body&gt;&lt;/x&gt;
10431 </p>
10432 !! end
10434 !! test
10435 Inline wiki vs wiki block nesting
10436 !! input
10437 '''Bold paragraph
10439 New wiki paragraph
10440 !! result
10441 <p><b>Bold paragraph</b>
10442 </p><p>New wiki paragraph
10443 </p>
10444 !! end
10446 !! test
10447 Inline HTML vs wiki block nesting
10448 !! options
10449 disabled
10450 !! input
10451 <b>Bold paragraph
10453 New wiki paragraph
10454 !! result
10455 <p><b>Bold paragraph</b>
10456 </p><p>New wiki paragraph
10457 </p>
10458 !! end
10460 # Original result was this:
10461 # <p><b>bold</b><b>bold<i>bolditalics</i></b>
10462 # </p>
10463 # While that might be marginally more intuitive, maybe, the six-apostrophe
10464 # construct is clearly pathological and the result stated here (which is what
10465 # the parser actually does) is about as reasonable as anything.
10466 !!test
10467 Mixing markup for italics and bold
10468 !! options
10469 !! input
10470 '''bold''''''bold''bolditalics'''''
10471 !! result
10472 <p>'<i>bold'</i><b>bold<i>bolditalics</i></b>
10473 </p>
10474 !! end
10477 !! article
10478 Xyzzyx
10479 !! text
10480 Article for special page transclusion test
10481 !! endarticle
10483 !! test
10484 Special page transclusion
10485 !! options
10486 !! input
10487 {{Special:Prefixindex/Xyzzyx}}
10488 !! result
10489 <table id="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
10491 !! end
10493 !! test
10494 Special page transclusion twice (bug 5021)
10495 !! options
10496 !! input
10497 {{Special:Prefixindex/Xyzzyx}}
10498 {{Special:Prefixindex/Xyzzyx}}
10499 !! result
10500 <table id="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
10501 <table id="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
10503 !! end
10505 !! test
10506 Transclusion of default MediaWiki message
10507 !! input
10508 {{MediaWiki:Mainpage}}
10509 !!result
10510 <p>Main Page
10511 </p>
10512 !! end
10514 !! test
10515 Transclusion of nonexistent MediaWiki message
10516 !! input
10517 {{MediaWiki:Mainpagexxx}}
10518 !!result
10519 <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>
10520 </p>
10521 !! end
10523 !! test
10524 Transclusion of MediaWiki message with underscore
10525 !! input
10526 {{MediaWiki:history_short}}
10527 !! result
10528 <p>History
10529 </p>
10530 !! end
10532 !! test
10533 Transclusion of MediaWiki message with space
10534 !! input
10535 {{MediaWiki:history short}}
10536 !! result
10537 <p>History
10538 </p>
10539 !! end
10541 !! test
10542 Invalid header with following text
10543 !! input
10544 = x = y
10545 !! result
10546 <p>= x = y
10547 </p>
10548 !! end
10551 !! test
10552 Section extraction test (section 0)
10553 !! options
10554 section=0
10555 !! input
10556 start
10557 ==a==
10558 ===aa===
10559 ====aaa====
10560 ==b==
10561 ===ba===
10562 ===bb===
10563 ====bba====
10564 ===bc===
10565 ==c==
10566 ===ca===
10567 !! result
10568 start
10569 !! end
10571 !! test
10572 Section extraction test (section 1)
10573 !! options
10574 section=1
10575 !! input
10576 start
10577 ==a==
10578 ===aa===
10579 ====aaa====
10580 ==b==
10581 ===ba===
10582 ===bb===
10583 ====bba====
10584 ===bc===
10585 ==c==
10586 ===ca===
10587 !! result
10588 ==a==
10589 ===aa===
10590 ====aaa====
10591 !! end
10593 !! test
10594 Section extraction test (section 2)
10595 !! options
10596 section=2
10597 !! input
10598 start
10599 ==a==
10600 ===aa===
10601 ====aaa====
10602 ==b==
10603 ===ba===
10604 ===bb===
10605 ====bba====
10606 ===bc===
10607 ==c==
10608 ===ca===
10609 !! result
10610 ===aa===
10611 ====aaa====
10612 !! end
10614 !! test
10615 Section extraction test (section 3)
10616 !! options
10617 section=3
10618 !! input
10619 start
10620 ==a==
10621 ===aa===
10622 ====aaa====
10623 ==b==
10624 ===ba===
10625 ===bb===
10626 ====bba====
10627 ===bc===
10628 ==c==
10629 ===ca===
10630 !! result
10631 ====aaa====
10632 !! end
10634 !! test
10635 Section extraction test (section 4)
10636 !! options
10637 section=4
10638 !! input
10639 start
10640 ==a==
10641 ===aa===
10642 ====aaa====
10643 ==b==
10644 ===ba===
10645 ===bb===
10646 ====bba====
10647 ===bc===
10648 ==c==
10649 ===ca===
10650 !! result
10651 ==b==
10652 ===ba===
10653 ===bb===
10654 ====bba====
10655 ===bc===
10656 !! end
10658 !! test
10659 Section extraction test (section 5)
10660 !! options
10661 section=5
10662 !! input
10663 start
10664 ==a==
10665 ===aa===
10666 ====aaa====
10667 ==b==
10668 ===ba===
10669 ===bb===
10670 ====bba====
10671 ===bc===
10672 ==c==
10673 ===ca===
10674 !! result
10675 ===ba===
10676 !! end
10678 !! test
10679 Section extraction test (section 6)
10680 !! options
10681 section=6
10682 !! input
10683 start
10684 ==a==
10685 ===aa===
10686 ====aaa====
10687 ==b==
10688 ===ba===
10689 ===bb===
10690 ====bba====
10691 ===bc===
10692 ==c==
10693 ===ca===
10694 !! result
10695 ===bb===
10696 ====bba====
10697 !! end
10699 !! test
10700 Section extraction test (section 7)
10701 !! options
10702 section=7
10703 !! input
10704 start
10705 ==a==
10706 ===aa===
10707 ====aaa====
10708 ==b==
10709 ===ba===
10710 ===bb===
10711 ====bba====
10712 ===bc===
10713 ==c==
10714 ===ca===
10715 !! result
10716 ====bba====
10717 !! end
10719 !! test
10720 Section extraction test (section 8)
10721 !! options
10722 section=8
10723 !! input
10724 start
10725 ==a==
10726 ===aa===
10727 ====aaa====
10728 ==b==
10729 ===ba===
10730 ===bb===
10731 ====bba====
10732 ===bc===
10733 ==c==
10734 ===ca===
10735 !! result
10736 ===bc===
10737 !! end
10739 !! test
10740 Section extraction test (section 9)
10741 !! options
10742 section=9
10743 !! input
10744 start
10745 ==a==
10746 ===aa===
10747 ====aaa====
10748 ==b==
10749 ===ba===
10750 ===bb===
10751 ====bba====
10752 ===bc===
10753 ==c==
10754 ===ca===
10755 !! result
10756 ==c==
10757 ===ca===
10758 !! end
10760 !! test
10761 Section extraction test (section 10)
10762 !! options
10763 section=10
10764 !! input
10765 start
10766 ==a==
10767 ===aa===
10768 ====aaa====
10769 ==b==
10770 ===ba===
10771 ===bb===
10772 ====bba====
10773 ===bc===
10774 ==c==
10775 ===ca===
10776 !! result
10777 ===ca===
10778 !! end
10780 !! test
10781 Section extraction test (nonexistent section 11)
10782 !! options
10783 section=11
10784 !! input
10785 start
10786 ==a==
10787 ===aa===
10788 ====aaa====
10789 ==b==
10790 ===ba===
10791 ===bb===
10792 ====bba====
10793 ===bc===
10794 ==c==
10795 ===ca===
10796 !! result
10797 !! end
10799 !! test
10800 Section extraction test with bogus heading (section 1)
10801 !! options
10802 section=1
10803 !! input
10804 ==a==
10805 ==bogus== not a legal section
10806 ==b==
10807 !! result
10808 ==a==
10809 ==bogus== not a legal section
10810 !! end
10812 !! test
10813 Section extraction test with bogus heading (section 2)
10814 !! options
10815 section=2
10816 !! input
10817 ==a==
10818 ==bogus== not a legal section
10819 ==b==
10820 !! result
10821 ==b==
10822 !! end
10824 !! test
10825 Section extraction test with comment after heading (section 1)
10826 !! options
10827 section=1
10828 !! input
10829 ==a==
10830 ==b== <!-- -->
10831 ==c==
10832 !! result
10833 ==a==
10834 !! end
10836 !! test
10837 Section extraction test with comment after heading (section 2)
10838 !! options
10839 section=2
10840 !! input
10841 ==a==
10842 ==b== <!-- -->
10843 ==c==
10844 !! result
10845 ==b== <!-- -->
10846 !! end
10848 !! test
10849 Section extraction test with bogus <nowiki> heading (section 1)
10850 !! options
10851 section=1
10852 !! input
10853 ==a==
10854 ==bogus== <nowiki>not a legal section</nowiki>
10855 ==b==
10856 !! result
10857 ==a==
10858 ==bogus== <nowiki>not a legal section</nowiki>
10859 !! end
10861 !! test
10862 Section extraction test with bogus <nowiki> heading (section 2)
10863 !! options
10864 section=2
10865 !! input
10866 ==a==
10867 ==bogus== <nowiki>not a legal section</nowiki>
10868 ==b==
10869 !! result
10870 ==b==
10871 !! end
10874 # Formerly testing for bug 2587, now resolved by the use of unmarked sections
10875 # instead of respecting commented sections
10876 !! test
10877 Section extraction prefixed by comment (section 1)
10878 !! options
10879 section=1
10880 !! input
10881 <!-- -->==sec1==
10882 ==sec2==
10883 !!result
10884 ==sec2==
10885 !!end
10887 !! test
10888 Section extraction prefixed by comment (section 2)
10889 !! options
10890 section=2
10891 !! input
10892 <!-- -->==sec1==
10893 ==sec2==
10894 !!result
10896 !!end
10899 # Formerly testing for bug 2607, now resolved by the use of unmarked sections
10900 # instead of respecting HTML-style headings
10901 !! test
10902 Section extraction, mixed wiki and html (section 1)
10903 !! options
10904 section=1
10905 !! input
10906 <h2>unmarked</h2>
10907 unmarked
10908 ==1==
10910 ==2==
10912 !! result
10913 ==1==
10915 !! end
10917 !! test
10918 Section extraction, mixed wiki and html (section 2)
10919 !! options
10920 section=2
10921 !! input
10922 <h2>unmarked</h2>
10923 unmarked
10924 ==1==
10926 ==2==
10928 !! result
10929 ==2==
10931 !! end
10934 # Formerly testing for bug 3342
10935 !! test
10936 Section extraction, heading surrounded by <noinclude>
10937 !! options
10938 section=1
10939 !! input
10940 <noinclude>==unmarked==</noinclude>
10941 ==marked==
10942 !! result
10943 ==marked==
10944 !!end
10946 # Test behavior of bug 19910
10947 !! test
10948 Sectiion with all-equals
10949 !! options
10950 section=2
10951 !! input
10952 === 
10953 The line above must have a trailing space
10954 === <!--
10955 --> <!-- -->
10956 But just in case it doesn't...
10957 !! result
10958 === <!--
10959 --> <!-- -->
10960 But just in case it doesn't...
10961 !! end
10963 !! test
10964 Section replacement test (section 0)
10965 !! options
10966 replace=0,"xxx"
10967 !! input
10968 start
10969 ==a==
10970 ===aa===
10971 ====aaa====
10972 ==b==
10973 ===ba===
10974 ===bb===
10975 ====bba====
10976 ===bc===
10977 ==c==
10978 ===ca===
10979 !! result
10982 ==a==
10983 ===aa===
10984 ====aaa====
10985 ==b==
10986 ===ba===
10987 ===bb===
10988 ====bba====
10989 ===bc===
10990 ==c==
10991 ===ca===
10992 !! end
10994 !! test
10995 Section replacement test (section 1)
10996 !! options
10997 replace=1,"xxx"
10998 !! input
10999 start
11000 ==a==
11001 ===aa===
11002 ====aaa====
11003 ==b==
11004 ===ba===
11005 ===bb===
11006 ====bba====
11007 ===bc===
11008 ==c==
11009 ===ca===
11010 !! result
11011 start
11014 ==b==
11015 ===ba===
11016 ===bb===
11017 ====bba====
11018 ===bc===
11019 ==c==
11020 ===ca===
11021 !! end
11023 !! test
11024 Section replacement test (section 2)
11025 !! options
11026 replace=2,"xxx"
11027 !! input
11028 start
11029 ==a==
11030 ===aa===
11031 ====aaa====
11032 ==b==
11033 ===ba===
11034 ===bb===
11035 ====bba====
11036 ===bc===
11037 ==c==
11038 ===ca===
11039 !! result
11040 start
11041 ==a==
11044 ==b==
11045 ===ba===
11046 ===bb===
11047 ====bba====
11048 ===bc===
11049 ==c==
11050 ===ca===
11051 !! end
11053 !! test
11054 Section replacement test (section 3)
11055 !! options
11056 replace=3,"xxx"
11057 !! input
11058 start
11059 ==a==
11060 ===aa===
11061 ====aaa====
11062 ==b==
11063 ===ba===
11064 ===bb===
11065 ====bba====
11066 ===bc===
11067 ==c==
11068 ===ca===
11069 !! result
11070 start
11071 ==a==
11072 ===aa===
11075 ==b==
11076 ===ba===
11077 ===bb===
11078 ====bba====
11079 ===bc===
11080 ==c==
11081 ===ca===
11082 !! end
11084 !! test
11085 Section replacement test (section 4)
11086 !! options
11087 replace=4,"xxx"
11088 !! input
11089 start
11090 ==a==
11091 ===aa===
11092 ====aaa====
11093 ==b==
11094 ===ba===
11095 ===bb===
11096 ====bba====
11097 ===bc===
11098 ==c==
11099 ===ca===
11100 !! result
11101 start
11102 ==a==
11103 ===aa===
11104 ====aaa====
11107 ==c==
11108 ===ca===
11109 !! end
11111 !! test
11112 Section replacement test (section 5)
11113 !! options
11114 replace=5,"xxx"
11115 !! input
11116 start
11117 ==a==
11118 ===aa===
11119 ====aaa====
11120 ==b==
11121 ===ba===
11122 ===bb===
11123 ====bba====
11124 ===bc===
11125 ==c==
11126 ===ca===
11127 !! result
11128 start
11129 ==a==
11130 ===aa===
11131 ====aaa====
11132 ==b==
11135 ===bb===
11136 ====bba====
11137 ===bc===
11138 ==c==
11139 ===ca===
11140 !! end
11142 !! test
11143 Section replacement test (section 6)
11144 !! options
11145 replace=6,"xxx"
11146 !! input
11147 start
11148 ==a==
11149 ===aa===
11150 ====aaa====
11151 ==b==
11152 ===ba===
11153 ===bb===
11154 ====bba====
11155 ===bc===
11156 ==c==
11157 ===ca===
11158 !! result
11159 start
11160 ==a==
11161 ===aa===
11162 ====aaa====
11163 ==b==
11164 ===ba===
11167 ===bc===
11168 ==c==
11169 ===ca===
11170 !! end
11172 !! test
11173 Section replacement test (section 7)
11174 !! options
11175 replace=7,"xxx"
11176 !! input
11177 start
11178 ==a==
11179 ===aa===
11180 ====aaa====
11181 ==b==
11182 ===ba===
11183 ===bb===
11184 ====bba====
11185 ===bc===
11186 ==c==
11187 ===ca===
11188 !! result
11189 start
11190 ==a==
11191 ===aa===
11192 ====aaa====
11193 ==b==
11194 ===ba===
11195 ===bb===
11198 ===bc===
11199 ==c==
11200 ===ca===
11201 !! end
11203 !! test
11204 Section replacement test (section 8)
11205 !! options
11206 replace=8,"xxx"
11207 !! input
11208 start
11209 ==a==
11210 ===aa===
11211 ====aaa====
11212 ==b==
11213 ===ba===
11214 ===bb===
11215 ====bba====
11216 ===bc===
11217 ==c==
11218 ===ca===
11219 !! result
11220 start
11221 ==a==
11222 ===aa===
11223 ====aaa====
11224 ==b==
11225 ===ba===
11226 ===bb===
11227 ====bba====
11230 ==c==
11231 ===ca===
11232 !!end
11234 !! test
11235 Section replacement test (section 9)
11236 !! options
11237 replace=9,"xxx"
11238 !! input
11239 start
11240 ==a==
11241 ===aa===
11242 ====aaa====
11243 ==b==
11244 ===ba===
11245 ===bb===
11246 ====bba====
11247 ===bc===
11248 ==c==
11249 ===ca===
11250 !! result
11251 start
11252 ==a==
11253 ===aa===
11254 ====aaa====
11255 ==b==
11256 ===ba===
11257 ===bb===
11258 ====bba====
11259 ===bc===
11261 !! end
11263 !! test
11264 Section replacement test (section 10)
11265 !! options
11266 replace=10,"xxx"
11267 !! input
11268 start
11269 ==a==
11270 ===aa===
11271 ====aaa====
11272 ==b==
11273 ===ba===
11274 ===bb===
11275 ====bba====
11276 ===bc===
11277 ==c==
11278 ===ca===
11279 !! result
11280 start
11281 ==a==
11282 ===aa===
11283 ====aaa====
11284 ==b==
11285 ===ba===
11286 ===bb===
11287 ====bba====
11288 ===bc===
11289 ==c==
11291 !! end
11293 !! test
11294 Section replacement test with initial whitespace (bug 13728)
11295 !! options
11296 replace=2,"xxx"
11297 !! input
11298  Preformatted initial line
11299 ==a==
11300 ===a===
11301 !! result
11302  Preformatted initial line
11303 ==a==
11305 !! end
11308 !! test
11309 Section extraction, heading followed by pre with 20 spaces (bug 6398)
11310 !! options
11311 section=1
11312 !! input
11313 ==a==
11314                     a
11315 !! result
11316 ==a==
11317                     a
11318 !! end
11320 !! test
11321 Section extraction, heading followed by pre with 19 spaces (bug 6398 sanity check)
11322 !! options
11323 section=1
11324 !! input
11325 ==a==
11326                    a
11327 !! result
11328 ==a==
11329                    a
11330 !! end
11333 !! test
11334 Section extraction, <pre> around bogus header (bug 10309)
11335 !! options
11336 noxml section=2
11337 !! input
11338 == Section One ==
11339 <pre>
11340 =======
11341 </pre>
11343 == Section Two ==
11344 stuff
11345 !! result
11346 == Section Two ==
11347 stuff
11348 !! end
11350 !! test
11351 Section replacement, <pre> around bogus header (bug 10309)
11352 !! options
11353 noxml replace=2,"xxx"
11354 !! input
11355 == Section One ==
11356 <pre>
11357 =======
11358 </pre>
11360 == Section Two ==
11361 stuff
11362 !! result
11363 == Section One ==
11364 <pre>
11365 =======
11366 </pre>
11369 !! end
11373 !! test
11374 Handling of &#x0A; in URLs
11375 !! input
11376 **irc://&#x0A;a
11377 !! result
11378 <ul><li><ul><li><a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a>
11379 </li></ul>
11380 </li></ul>
11382 !!end
11384 !! test
11385 5 quotes, code coverage +1 line (php)
11386 !! options
11388 !! input
11389 '''''
11390 !! result
11391 !! end
11392 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
11393 !! test
11394 5 quotes, code coverage +1 line (parsoid)
11395 !! options
11396 parsoid
11397 !! input
11398 '''''
11399 !! result
11400 <p><i><b></b></i></p>
11401 !! end
11403 !! test
11404 Special:Search page linking.
11405 !! input
11406 {{Special:search}}
11407 !! result
11408 <p><a href="/wiki/Special:Search" title="Special:Search">Special:Search</a>
11409 </p>
11410 !! end
11412 !! test
11413 Say the magic word
11414 !! input
11415 * {{PAGENAME}}
11416 * {{BASEPAGENAME}}
11417 * {{SUBPAGENAME}}
11418 * {{SUBPAGENAMEE}}
11419 * {{ROOTPAGENAME}}
11420 * {{ROOTPAGENAMEE}}
11421 * {{BASEPAGENAME}}
11422 * {{BASEPAGENAMEE}}
11423 * {{TALKPAGENAME}}
11424 * {{TALKPAGENAMEE}}
11425 * {{SUBJECTPAGENAME}}
11426 * {{SUBJECTPAGENAMEE}}
11427 * {{NAMESPACEE}}
11428 * {{NAMESPACE}}
11429 * {{TALKSPACE}}
11430 * {{TALKSPACEE}}
11431 * {{SUBJECTSPACE}}
11432 * {{SUBJECTSPACEE}}
11433 * {{Dynamic|{{NUMBEROFUSERS}}|{{NUMBEROFPAGES}}|{{CURRENTVERSION}}|{{CONTENTLANGUAGE}}|{{DIRECTIONMARK}}|{{CURRENTTIMESTAMP}}|{{NUMBEROFARTICLES}}}}
11434 !! result
11435 <ul><li> Parser test
11436 </li><li> Parser test
11437 </li><li> Parser test
11438 </li><li> Parser_test
11439 </li><li> Parser test
11440 </li><li> Parser_test
11441 </li><li> Parser test
11442 </li><li> Parser_test
11443 </li><li> Talk:Parser test
11444 </li><li> Talk:Parser_test
11445 </li><li> Parser test
11446 </li><li> Parser_test
11447 </li><li> 
11448 </li><li> 
11449 </li><li> Talk
11450 </li><li> Talk
11451 </li><li> 
11452 </li><li> 
11453 </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>
11454 </li></ul>
11456 !! end
11457 ### Note: Above tests excludes the "{{NUMBEROFADMINS}}" magic word because it generates a MySQL error when included.
11459 !! test
11460 Gallery
11461 !! input
11462 <gallery>
11463 image1.png |
11464 image2.gif|||||
11466 image3|
11467 image4    |300px| centre
11468  image5.svg| http://///////
11469 [[x|xx]]]]
11470 * image6
11471 </gallery>
11472 !! result
11473 <ul class="gallery">
11474                 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
11475                         <div style="height: 150px;">Image1.png</div>
11476                         <div class="gallerytext">
11477                         </div>
11478                 </div></li>
11479                 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
11480                         <div style="height: 150px;">Image2.gif</div>
11481                         <div class="gallerytext">
11482 <p>||||
11483 </p>
11484                         </div>
11485                 </div></li>
11486                 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
11487                         <div style="height: 150px;">Image3</div>
11488                         <div class="gallerytext">
11489                         </div>
11490                 </div></li>
11491                 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
11492                         <div style="height: 150px;">Image4</div>
11493                         <div class="gallerytext">
11494 <p>300px| centre
11495 </p>
11496                         </div>
11497                 </div></li>
11498                 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
11499                         <div style="height: 150px;">Image5.svg</div>
11500                         <div class="gallerytext">
11501 <p><a rel="nofollow" class="external free" href="http://///////">http://///////</a>
11502 </p>
11503                         </div>
11504                 </div></li>
11505                 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
11506                         <div style="height: 150px;">* image6</div>
11507                         <div class="gallerytext">
11508                         </div>
11509                 </div></li>
11510 </ul>
11512 !! end
11514 !! test
11515 Gallery (with options)
11516 !! input
11517 <gallery widths='70px' heights='40px' perrow='2' caption='Foo [[Main Page]]' >
11518 File:Nonexistant.jpg|caption
11519 File:Nonexistant.jpg
11520 image:foobar.jpg|some '''caption''' [[Main Page]]
11521 image:foobar.jpg
11522 image:foobar.jpg|Blabla|alt=This is a foo-bar.|blabla.
11523 </gallery>
11524 !! result
11525 <ul class="gallery" style="max-width: 226px;_width: 226px;">
11526         <li class='gallerycaption'>Foo <a href="/wiki/Main_Page" title="Main Page">Main Page</a></li>
11527                 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
11528                         <div style="height: 70px;">Nonexistant.jpg</div>
11529                         <div class="gallerytext">
11530 <p>caption
11531 </p>
11532                         </div>
11533                 </div></li>
11534                 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
11535                         <div style="height: 70px;">Nonexistant.jpg</div>
11536                         <div class="gallerytext">
11537                         </div>
11538                 </div></li>
11539                 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
11540                         <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>
11541                         <div class="gallerytext">
11542 <p>some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
11543 </p>
11544                         </div>
11545                 </div></li>
11546                 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
11547                         <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>
11548                         <div class="gallerytext">
11549                         </div>
11550                 </div></li>
11551                 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
11552                         <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>
11553                         <div class="gallerytext">
11554 <p>Blabla|blabla.
11555 </p>
11556                         </div>
11557                 </div></li>
11558 </ul>
11560 !! end
11562 !! test
11563 Gallery with wikitext inside caption
11564 !! input
11565 <gallery>
11566 File:foobar.jpg|[[File:foobar.jpg|20px|desc|alt=inneralt]]|alt=galleryalt
11567 File:foobar.jpg|{{Test|unamedParam|alt=param}}|alt=galleryalt
11568 </gallery>
11569 !! result
11570 <ul class="gallery">
11571                 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
11572                         <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>
11573                         <div class="gallerytext">
11574 <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>
11575 </p>
11576                         </div>
11577                 </div></li>
11578                 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
11579                         <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>
11580                         <div class="gallerytext">
11581 <p>This is a test template
11582 </p>
11583                         </div>
11584                 </div></li>
11585 </ul>
11587 !! end
11589 !! test
11590 gallery (with showfilename option)
11591 !! input
11592 <gallery showfilename>
11593 File:Nonexistant.jpg|caption
11594 File:Nonexistant.jpg
11595 image:foobar.jpg|some '''caption''' [[Main Page]]
11596 File:Foobar.jpg
11597 </gallery>
11598 !! result
11599 <ul class="gallery">
11600                 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
11601                         <div style="height: 150px;">Nonexistant.jpg</div>
11602                         <div class="gallerytext">
11603 <p><a href="/wiki/File:Nonexistant.jpg" title="File:Nonexistant.jpg">Nonexistant.jpg</a><br />
11604 caption
11605 </p>
11606                         </div>
11607                 </div></li>
11608                 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
11609                         <div style="height: 150px;">Nonexistant.jpg</div>
11610                         <div class="gallerytext">
11611 <p><a href="/wiki/File:Nonexistant.jpg" title="File:Nonexistant.jpg">Nonexistant.jpg</a><br />
11612 </p>
11613                         </div>
11614                 </div></li>
11615                 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
11616                         <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>
11617                         <div class="gallerytext">
11618 <p><a href="/wiki/File:Foobar.jpg" title="File:Foobar.jpg">Foobar.jpg</a><br />
11619 some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
11620 </p>
11621                         </div>
11622                 </div></li>
11623                 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
11624                         <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>
11625                         <div class="gallerytext">
11626 <p><a href="/wiki/File:Foobar.jpg" title="File:Foobar.jpg">Foobar.jpg</a><br />
11627 </p>
11628                         </div>
11629                 </div></li>
11630 </ul>
11632 !! end
11634 !! test
11635 Gallery (with namespace-less filenames)
11636 !! input
11637 <gallery>
11638 File:Nonexistant.jpg
11639 Nonexistant.jpg
11640 image:foobar.jpg
11641 foobar.jpg
11642 </gallery>
11643 !! result
11644 <ul class="gallery">
11645                 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
11646                         <div style="height: 150px;">Nonexistant.jpg</div>
11647                         <div class="gallerytext">
11648                         </div>
11649                 </div></li>
11650                 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
11651                         <div style="height: 150px;">Nonexistant.jpg</div>
11652                         <div class="gallerytext">
11653                         </div>
11654                 </div></li>
11655                 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
11656                         <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>
11657                         <div class="gallerytext">
11658                         </div>
11659                 </div></li>
11660                 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
11661                         <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>
11662                         <div class="gallerytext">
11663                         </div>
11664                 </div></li>
11665 </ul>
11667 !! end
11669 !! test
11670 HTML Hex character encoding (spells the word "JavaScript")
11671 !! input
11672 &#x4A;&#x061;&#x0076;&#x00061;&#x000053;&#x0000063;&#114;&#x0000069;&#00000112;&#x0000000074;
11673 !! result
11674 <p>&#x4a;&#x61;&#x76;&#x61;&#x53;&#x63;&#114;&#x69;&#112;&#x74;
11675 </p>
11676 !! end
11678 !! test
11679 HTML Hex character encoding bogus encoding (bug 26437 regression check)
11680 !! input
11681 &#xsee;&#XSEE;
11682 !! result
11683 <p>&amp;#xsee;&amp;#XSEE;
11684 </p>
11685 !! end
11687 !! test
11688 HTML Hex character encoding mixed case
11689 !! input
11690 &#xEE;&#Xee;
11691 !! result
11692 <p>&#xee;&#xee;
11693 </p>
11694 !! end
11696 !! test
11697 __FORCETOC__ override
11698 !! input
11699 __NEWSECTIONLINK__
11700 __FORCETOC__
11701 !! result
11702 <p><br />
11703 </p>
11704 !! end
11706 !! test
11707 ISBN code coverage
11708 !! input
11709 ISBN  978-0-1234-56&#x20;789
11710 !! result
11711 <p><a href="/wiki/Special:BookSources/9780123456" class="internal mw-magiclink-isbn">ISBN 978-0-1234-56</a>&#x20;789
11712 </p>
11713 !! end
11715 !! test
11716 ISBN followed by 5 spaces
11717 !! input
11718 ISBN    
11719 !! result
11720 <p>ISBN    
11721 </p>
11722 !! end
11724 !! test
11725 Double ISBN
11726 !! input
11727 ISBN ISBN 1234567890
11728 !! result
11729 <p>ISBN <a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
11730 </p>
11731 !! end
11733 !! test
11734 Bug 22905: <abbr> followed by ISBN followed by </a>
11735 !! input
11736 <abbr>(fr)</abbr> ISBN 2753300917 [http://www.example.com example.com]
11737 !! result
11738 <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>
11739 </p>
11740 !! end
11742 !! test
11743 Double RFC
11744 !! input
11745 RFC RFC 1234
11746 !! result
11747 <p>RFC <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc1234">RFC 1234</a>
11748 </p>
11749 !! end
11751 !! test
11752 Double RFC with a wiki link
11753 !! input
11754 RFC [[RFC 1234]]
11755 !! result
11756 <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>
11757 </p>
11758 !! end
11760 !! test
11761 RFC code coverage
11762 !! input
11763 RFC   983&#x20;987
11764 !! result
11765 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc983">RFC 983</a>&#x20;987
11766 </p>
11767 !! end
11769 !! test
11770 Centre-aligned image
11771 !! input
11772 [[Image:foobar.jpg|centre]]
11773 !! result
11774 <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>
11776 !!end
11778 !! test
11779 None-aligned image
11780 !! input
11781 [[Image:foobar.jpg|none]]
11782 !! result
11783 <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>
11785 !!end
11787 !! test
11788 Width + Height sized image (using px) (height is ignored)
11789 !! input
11790 [[Image:foobar.jpg|640x480px]]
11791 !! result
11792 <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>
11793 </p>
11794 !!end
11796 !! test
11797 Width-sized image (using px, no following whitespace)
11798 !! input
11799 [[Image:foobar.jpg|640px]]
11800 !! result
11801 <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>
11802 </p>
11803 !!end
11805 !! test
11806 Width-sized image (using px, with following whitespace - test regression from r39467)
11807 !! input
11808 [[Image:foobar.jpg|640px ]]
11809 !! result
11810 <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>
11811 </p>
11812 !!end
11814 !! test
11815 Width-sized image (using px, with preceding whitespace - test regression from r39467)
11816 !! input
11817 [[Image:foobar.jpg| 640px]]
11818 !! result
11819 <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>
11820 </p>
11821 !!end
11823 !! test
11824 Another italics / bold test
11825 !! input
11826  ''' ''x'
11827 !! result
11828 <pre>'<i> </i>x'
11829 </pre>
11830 !!end
11832 # Note the results may be incorrect, as parserTest output included this:
11833 # XML error: Mismatched tag at byte 6120:
11834 # ...<dd> </dt></dl> </dd...
11835 !! test
11836 dt/dd/dl test
11837 !! options
11838 disabled
11839 !! input
11840 :;;;::
11841 !! result
11842 <dl><dd><dl><dt><dl><dt><dl><dt><dl><dd><dl><dd>
11843 </dd></dl>
11844 </dd></dl>
11845 </dt></dl>
11846 </dt></dl>
11847 </dt></dl>
11848 </dd></dl>
11850 !!end
11853 # Images with the "|" character in external URLs in comment tags; Eats half the comment, leaves unmatched "</a>" tag.
11854 !! test
11855 Images with the "|" character in the comment
11856 !! input
11857 [[image:Foobar.jpg|thumb|An [http://test/?param1=|left|&param2=|x external] URL]]
11858 !! result
11859 <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>
11861 !!end
11863 !! test
11864 [Before] HTML without raw HTML enabled ($wgRawHtml==false)
11865 !! input
11866 <html><script>alert(1);</script></html>
11867 !! result
11868 <p>&lt;html&gt;&lt;script&gt;alert(1);&lt;/script&gt;&lt;/html&gt;
11869 </p>
11870 !! end
11872 !! test
11873 HTML with raw HTML ($wgRawHtml==true)
11874 !! options
11875 rawhtml
11876 !! input
11877 <html><script>alert(1);</script></html>
11878 !! result
11879 <p><script>alert(1);</script>
11880 </p>
11881 !! end
11883 !! test
11884 Parents of subpages, one level up
11885 !! options
11886 subpage title=[[Subpage test/L1/L2/L3]]
11887 !! input
11888 [[../|L2]]
11889 !! result
11890 <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>
11891 </p>
11892 !! end
11895 !! test
11896 Parents of subpages, one level up, not named
11897 !! options
11898 subpage title=[[Subpage test/L1/L2/L3]]
11899 !! input
11900 [[../]]
11901 !! result
11902 <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>
11903 </p>
11904 !! end
11908 !! test
11909 Parents of subpages, two levels up
11910 !! options
11911 subpage title=[[Subpage test/L1/L2/L3]]
11912 !! input
11913 [[../../|L1]]2
11915 [[../../|L1]]l
11916 !! result
11917 <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
11918 </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>
11919 </p>
11920 !! end
11922 !! test
11923 Parents of subpages, two levels up, without trailing slash or name.
11924 !! options
11925 subpage title=[[Subpage test/L1/L2/L3]]
11926 !! input
11927 [[../..]]
11928 !! result
11929 <p>[[../..]]
11930 </p>
11931 !! end
11933 !! test
11934 Parents of subpages, two levels up, with lots of extra trailing slashes.
11935 !! options
11936 subpage title=[[Subpage test/L1/L2/L3]]
11937 !! input
11938 [[../../////]]
11939 !! result
11940 <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>
11941 </p>
11942 !! end
11944 !! test
11945 Definition list code coverage
11946 !! input
11947 ; title   : def
11948 ; title : def
11949 ;title: def
11950 !! result
11951 <dl><dt> title  &#160;</dt><dd> def
11952 </dd><dt> title&#160;</dt><dd> def
11953 </dd><dt>title</dt><dd> def
11954 </dd></dl>
11956 !! end
11958 !! test
11959 Don't fall for the self-closing div
11960 !! input
11961 <div>hello world</div/>
11962 !! result
11963 <div>hello world</div>
11965 !! end
11967 !! test
11968 MSGNW magic word
11969 !! input
11970 {{MSGNW:msg}}
11971 !! result
11972 <p>&#91;&#91;:Template:Msg&#93;&#93;
11973 </p>
11974 !! end
11976 !! test
11977 RAW magic word
11978 !! input
11979 {{RAW:QUERTY}}
11980 !! result
11981 <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>
11982 </p>
11983 !! end
11985 # This isn't needed for XHTML conformance, but would be handy as a fallback security measure
11986 !! test
11987 Always escape literal '>' in output, not just after '<'
11988 !! input
11990 !! result
11991 <p>&gt;&lt;&gt;
11992 </p>
11993 !! end
11995 !! test
11996 Template caching
11997 !! input
11998 {{Test}}
11999 {{Test}}
12000 !! result
12001 <p>This is a test template
12002 This is a test template
12003 </p>
12004 !! end
12007 !! article
12008 MediaWiki:Fake
12009 !! text
12010 ==header==
12011 !! endarticle
12013 !! test
12014 Inclusion of !userCanEdit() content
12015 !! input
12016 {{MediaWiki:Fake}}
12017 !! result
12018 <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>
12020 !! end
12023 !! test
12024 Out-of-order TOC heading levels
12025 !! input
12026 ==2==
12027 ======6======
12028 ===3===
12030 =====5=====
12031 ==2==
12032 !! result
12033 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
12034 <ul>
12035 <li class="toclevel-1 tocsection-1"><a href="#2"><span class="tocnumber">1</span> <span class="toctext">2</span></a>
12036 <ul>
12037 <li class="toclevel-2 tocsection-2"><a href="#6"><span class="tocnumber">1.1</span> <span class="toctext">6</span></a></li>
12038 <li class="toclevel-2 tocsection-3"><a href="#3"><span class="tocnumber">1.2</span> <span class="toctext">3</span></a></li>
12039 </ul>
12040 </li>
12041 <li class="toclevel-1 tocsection-4"><a href="#1"><span class="tocnumber">2</span> <span class="toctext">1</span></a>
12042 <ul>
12043 <li class="toclevel-2 tocsection-5"><a href="#5"><span class="tocnumber">2.1</span> <span class="toctext">5</span></a></li>
12044 <li class="toclevel-2 tocsection-6"><a href="#2_2"><span class="tocnumber">2.2</span> <span class="toctext">2</span></a></li>
12045 </ul>
12046 </li>
12047 </ul>
12048 </td></tr></table>
12049 <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>
12050 <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>
12051 <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>
12052 <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>
12053 <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>
12054 <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>
12056 !! end
12059 !! test
12060 ISBN with a dummy number
12061 !! input
12062 ISBN ---
12063 !! result
12064 <p>ISBN ---
12065 </p>
12066 !! end
12069 !! test
12070 ISBN with space-delimited number
12071 !! input
12072 ISBN 92 9017 032 8
12073 !! result
12074 <p><a href="/wiki/Special:BookSources/9290170328" class="internal mw-magiclink-isbn">ISBN 92 9017 032 8</a>
12075 </p>
12076 !! end
12079 !! test
12080 ISBN with multiple spaces, no number
12081 !! input
12082 ISBN  foo
12083 !! result
12084 <p>ISBN  foo
12085 </p>
12086 !! end
12089 !! test
12090 ISBN length
12091 !! input
12092 ISBN 123456789
12094 ISBN 1234567890
12096 ISBN 12345678901
12097 !! result
12098 <p>ISBN 123456789
12099 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
12100 </p><p>ISBN 12345678901
12101 </p>
12102 !! end
12105 !! test
12106 ISBN with trailing year (bug 8110)
12107 !! input
12108 ISBN 1-234-56789-0 - 2006
12110 ISBN 1 234 56789 0 - 2006
12111 !! result
12112 <p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1-234-56789-0</a> - 2006
12113 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1 234 56789 0</a> - 2006
12114 </p>
12115 !! end
12118 !! test
12119 anchorencode
12120 !! input
12121 {{anchorencode:foo bar©#%n}}
12122 !! result
12123 <p>foo_bar.C2.A9.23.25n
12124 </p>
12125 !! end
12127 !! test
12128 anchorencode trims spaces
12129 !! input
12130 {{anchorencode: __pretty__please__}}
12131 !! result
12132 <p>pretty_please
12133 </p>
12134 !! end
12136 !! test
12137 anchorencode deals with links
12138 !! input
12139 {{anchorencode: [[hello|world]] [[hi]]}}
12140 !! result
12141 <p>world_hi
12142 </p>
12143 !! end
12145 !! test
12146 anchorencode deals with templates
12147 !! input
12148 {{anchorencode: {{Foo}} }}
12149 !! result
12150 <p>FOO
12151 </p>
12152 !! end
12154 !! test
12155 anchorencode encodes like the TOC generator: (bug 18431)
12156 !! input
12157 === _ +:.3A%3A&&amp;]] ===
12158 {{anchorencode: _ +:.3A%3A&&amp;]] }}
12159 __NOEDITSECTION__
12160 !! result
12161 <h3><span class="mw-headline" id=".2B:.3A.253A.26.26.5D.5D">_ +:.3A%3A&amp;&amp;]]</span></h3>
12162 <p>.2B:.3A.253A.26.26.5D.5D
12163 </p>
12164 !! end
12166 # Expected output in the following test is not necessarily expected (there
12167 # should probably be <p> tags inside the <blockquote> in the output) -- it's
12168 # only testing for well-formedness.
12169 !! test
12170 Bug 6200: blockquotes and paragraph formatting
12171 !! input
12172 <blockquote>
12174 </blockquote>
12178  baz
12179 !! result
12180 <blockquote>
12182 </blockquote>
12183 <p>bar
12184 </p>
12185 <pre>baz
12186 </pre>
12187 !! end
12189 !! test
12190 Bug 8293: Use of center tag ruins paragraph formatting
12191 !! input
12192 <center>
12194 </center>
12198  baz
12199 !! result
12200 <center>
12201 <p>foo
12202 </p>
12203 </center>
12204 <p>bar
12205 </p>
12206 <pre>baz
12207 </pre>
12208 !! end
12210 !!test
12211 Parsing of overlapping (improperly nested) inline html tags (PHP parser)
12212 !!options
12214 !!input
12215 <span><s>x</span></s>
12216 !!result
12217 <p><span><s>x&lt;/span&gt;</s></span>
12218 </p>
12219 !!end
12221 !!test
12222 Parsing of overlapping (improperly nested) inline html tags (Parsoid)
12223 !!options
12224 parsoid
12225 !!input
12226 <span><s>x</span></s>
12227 !!result
12228 <p><span><s>x</s></span><s></s>
12229 </p>
12230 !!end
12233 ### Language variants related tests
12235 !! test
12236 Self-link in language variants
12237 !! options
12238 title=[[Dunav]] language=sr
12239 !! input
12240 Both [[Dunav]] and [[Дунав]] are names for this river.
12241 !! result
12242 <p>Both <strong class="selflink">Dunav</strong> and <strong class="selflink">Дунав</strong> are names for this river.
12243 </p>
12244 !!end
12246 !! article
12247 Дуна
12248 !! text
12249 content
12250 !! endarticle
12252 !! test
12253 Link to another existing title shouldn't be parsed as self-link even if it's a variant of this title
12254 !! options
12255 title=[[Duna]] language=sr
12256 !! input
12257 [[Дуна]] is not a self-link while [[Duna]] and [[Dуна]] are still self-links.
12258 !! result
12259 <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.
12260 </p>
12261 !! end
12263 !! test
12264 Link to pages in language variants
12265 !! options
12266 language=sr
12267 !! input
12268 Main Page can be written as [[Маин Паге]]
12269 !! result
12270 <p>Main Page can be written as <a href="/wiki/Main_Page" title="Main Page">Маин Паге</a>
12271 </p>
12272 !!end
12275 !! test
12276 Multiple links to pages in language variants
12277 !! options
12278 language=sr
12279 !! input
12280 [[Main Page]] can be written as [[Маин Паге]] same as [[Маин Паге]].
12281 !! result
12282 <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>.
12283 </p>
12284 !!end
12287 !! test
12288 Simple template in language variants
12289 !! options
12290 language=sr
12291 !! input
12292 {{тест}}
12293 !! result
12294 <p>This is a test template
12295 </p>
12296 !! end
12299 !! test
12300 Template with explicit namespace in language variants
12301 !! options
12302 language=sr
12303 !! input
12304 {{Template:тест}}
12305 !! result
12306 <p>This is a test template
12307 </p>
12308 !! end
12311 !! test
12312 Basic test for template parameter in language variants
12313 !! options
12314 language=sr
12315 !! input
12316 {{парамтест|param=foo}}
12317 !! result
12318 <p>This is a test template with parameter foo
12319 </p>
12320 !! end
12323 !! test
12324 Simple category in language variants
12325 !! options
12326 language=sr cat
12327 !! input
12328 [[Category:МедиаWики Усер'с Гуиде]]
12329 !! result
12330 <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>
12331 !! end
12334 !! article
12335 Category:分类
12336 !! text
12337 blah
12338 !! endarticle
12340 !! article
12341 Category:分類
12342 !! text
12343 blah
12344 !! endarticle
12346 !! test
12347 Don't convert blue categorylinks to another variant (bug 33210)
12348 !! options
12349 language=zh cat
12350 !! input
12351 [[A]][[Category:分类]]
12352 !! result
12353 <a href="/wiki/Category:%E5%88%86%E7%B1%BB" title="Category:分类">分类</a>
12354 !! end
12357 !! test
12358 Stripping -{}- tags (language variants)
12359 !! options
12360 language=sr
12361 !! input
12362 Latin proverb: -{Ne nuntium necare}-
12363 !! result
12364 <p>Latin proverb: Ne nuntium necare
12365 </p>
12366 !! end
12369 !! test
12370 Prevent conversion with -{}- tags (language variants)
12371 !! options
12372 language=sr variant=sr-ec
12373 !! input
12374 Latinski: -{Ne nuntium necare}-
12375 !! result
12376 <p>Латински: Ne nuntium necare
12377 </p>
12378 !! end
12381 !! test
12382 Prevent conversion of text with -{}- tags (language variants)
12383 !! options
12384 language=sr variant=sr-ec
12385 !! input
12386 Latinski: -{Ne nuntium necare}-
12387 !! result
12388 <p>Латински: Ne nuntium necare
12389 </p>
12390 !! end
12393 !! test
12394 Prevent conversion of links with -{}- tags (language variants)
12395 !! options
12396 language=sr variant=sr-ec
12397 !! input
12398 -{[[Main Page]]}-
12399 !! result
12400 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
12401 </p>
12402 !! end
12405 !! test
12406 -{}- tags within headlines (within html for parserConvert())
12407 !! options
12408 language=sr variant=sr-ec
12409 !! input
12410 == -{Naslov}- ==
12411 !! result
12412 <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>
12414 !! end
12417 !! test
12418 Explicit definition of language variant alternatives
12419 !! options
12420 language=zh variant=zh-tw
12421 !! input
12422 -{zh:China;zh-tw:Taiwan}-, not China
12423 !! result
12424 <p>Taiwan, not China
12425 </p>
12426 !! end
12429 !! test
12430 Conversion around HTML tags
12431 !! options
12432 language=sr variant=sr-ec
12433 !! input
12434 -{H|span=>sr-ec:script;title=>sr-ec:src;}-
12435 <span title="La-{sr-el:L;sr-ec:C;}-tin">ski</span>
12436 !! result
12438 <span title="ЛаCтин">ски</span>
12439 </p>
12440 !! end
12443 !! test
12444 Explicit session-wise language variant mapping (A flag and - flag)
12445 !! options
12446 language=zh variant=zh-tw
12447 !! input
12448 Taiwan is not China.
12449 But -{A|zh:China;zh-tw:Taiwan}- is China,
12450 (This-{-|zh:China;zh-tw:Taiwan}- should be stripped!)
12451 and -{China}- is China.
12452 !! result
12453 <p>Taiwan is not China.
12454 But Taiwan is Taiwan,
12455 (This should be stripped!)
12456 and China is China.
12457 </p>
12458 !! end
12460 !! test
12461 Explicit session-wise language variant mapping (H flag for hide)
12462 !! options
12463 language=zh variant=zh-tw
12464 !! input
12465 (This-{H|zh:China;zh-tw:Taiwan}- should be stripped!)
12466 Taiwan is China.
12467 !! result
12468 <p>(This should be stripped!)
12469 Taiwan is Taiwan.
12470 </p>
12471 !! end
12473 !! test
12474 Adding explicit conversion rule for title (T flag)
12475 !! options
12476 language=zh variant=zh-tw showtitle
12477 !! input
12478 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
12479 !! result
12480 Taiwan
12481 <p>Should be stripped!
12482 </p>
12483 !! end
12485 !! test
12486 Testing that changing the language variant here in the tests actually works
12487 !! options
12488 language=zh variant=zh showtitle
12489 !! input
12490 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
12491 !! result
12492 China
12493 <p>Should be stripped!
12494 </p>
12495 !! end
12497 !! test
12498 Recursive conversion of alt and title attrs shouldn't clear converter state
12499 !! options
12500 language=zh variant=zh-cn showtitle
12501 !! input
12502 -{H|zh-cn:Exclamation;zh-tw:exclamation;}-
12503 Should be stripped-{T|zh-cn:China;zh-tw:Taiwan}-<span title="exclamation">!</span>
12504 !! result
12505 China
12507 Should be stripped<span title="Exclamation">!</span>
12508 </p>
12509 !! end
12511 !! test
12512 Bug 24072: more test on conversion rule for title
12513 !! options
12514 language=zh variant=zh-tw showtitle
12515 !! input
12516 This should be stripped-{T|zh:China;zh-tw:Taiwan}-!
12517 This won't take interferes with the title rule-{H|zh:Beijing;zh-tw:Taipei}-.
12518 !! result
12519 Taiwan
12520 <p>This should be stripped!
12521 This won't take interferes with the title rule.
12522 </p>
12523 !! end
12525 !! test
12526 Partly disable title conversion if variant == main language code
12527 !! options
12528 language=zh variant=zh title=[[ZH]] showtitle
12529 !! input
12530 -{T|zh-cn:CN;zh-tw:TW}-
12531 !! result
12534 </p>
12535 !! end
12537 !! test
12538 Partly disable title conversion if variant == main language code, more
12539 !! options
12540 language=zh variant=zh title=[[ZH]] showtitle
12541 !! input
12542 -{T|TW}-
12543 !! result
12546 </p>
12547 !! end
12549 !! test
12550 Raw output of variant escape tags (R flag)
12551 !! options
12552 language=zh variant=zh-tw
12553 !! input
12554 Raw: -{R|zh:China;zh-tw:Taiwan}-
12555 !! result
12556 <p>Raw: zh:China;zh-tw:Taiwan
12557 </p>
12558 !! end
12560 !! test
12561 Nested using of manual convert syntax
12562 !! options
12563 language=zh variant=zh-hk
12564 !! input
12565 Nested: -{zh-hans:Hi -{zh-cn:China;zh-sg:Singapore;}-;zh-hant:Hello -{zh-tw:Taiwan;zh-hk:H-{ong}- K-{}-ong;}-;}-!
12566 !! result
12567 <p>Nested: Hello Hong Kong!
12568 </p>
12569 !! end
12571 !! test
12572 Proper conversion of text in external links
12573 !! options
12574 language=sr variant=sr-ec
12575 !! input
12576 http://www.google.com
12577 gopher://www.google.com
12578 [http://www.google.com http://www.google.com]
12579 [gopher://www.google.com gopher://www.google.com]
12580 [https://www.google.com irc://www.google.com]
12581 [ftp://www.google.com www.google.com/ftp://dir]
12582 [//www.google.com www.google.com]
12583 !! result
12584 <p><a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
12585 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
12586 <a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
12587 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
12588 <a rel="nofollow" class="external text" href="https://www.google.com">irc://www.google.com</a>
12589 <a rel="nofollow" class="external text" href="ftp://www.google.com">www.гоогле.цом/фтп://дир</a>
12590 <a rel="nofollow" class="external text" href="//www.google.com">www.гоогле.цом</a>
12591 </p>
12592 !! end
12594 !! test
12595 Do not convert roman numbers to language variants
12596 !! options
12597 language=sr variant=sr-ec
12598 !! input
12599 Fridrih IV je car.
12600 !! result
12601 <p>Фридрих IV је цар.
12602 </p>
12603 !! end
12605 !! test
12606 Unclosed language converter markup "-{"
12607 !! options
12608 language=sr
12609 !! input
12610 -{T|hello
12611 !! result
12612 <p>-{T|hello
12613 </p>
12614 !! end
12616 !! test
12617 Don't convert raw rule "-{R|=&gt;}-" to "=>"
12618 !! options
12619 language=sr
12620 !! input
12621 -{R|=&gt;}-
12622 !! result
12623 <p>=&gt;
12624 </p>
12625 !!end
12627 !!article
12628 Template:Bullet
12629 !!text
12630 * Bar
12631 !!endarticle
12633 !! test
12634 Bug 529: Uncovered bullet
12635 !! input
12636 * Foo {{bullet}}
12637 !! result
12638 <ul><li> Foo 
12639 </li><li> Bar
12640 </li></ul>
12642 !! end
12644 # Plain MediaWiki does not remove empty lists, but tidy actually does.
12645 # Templates in Wikipedia rely on this behavior, as tidy has always been
12646 # enabled there. These tests are normally run *without* tidy, so specify the
12647 # full output here. 
12648 # To test realistic parsing behavior, apply a tidy-like transformation to both
12649 # the expected output and your parser's output.
12650 !! test
12651 Bug 529: Uncovered bullet leaving empty list, normally removed by tidy
12652 !! input
12653 ******* Foo {{bullet}}
12654 !! result
12655 <ul><li><ul><li><ul><li><ul><li><ul><li><ul><li><ul><li> Foo 
12656 </li></ul>
12657 </li></ul>
12658 </li></ul>
12659 </li></ul>
12660 </li></ul>
12661 </li></ul>
12662 </li><li> Bar
12663 </li></ul>
12665 !! end
12667 !! test
12668 Bug 529: Uncovered table already at line-start
12669 !! input
12672 {{table}}
12674 !! result
12675 <p>x
12676 </p>
12677 <table>
12678 <tr>
12679 <td> 1 </td>
12680 <td> 2
12681 </td></tr>
12682 <tr>
12683 <td> 3 </td>
12684 <td> 4
12685 </td></tr></table>
12686 <p>y
12687 </p>
12688 !! end
12690 !! test
12691 Bug 529: Uncovered bullet in parser function result
12692 !! input
12693 * Foo {{lc:{{bullet}} }}
12694 !! result
12695 <ul><li> Foo 
12696 </li><li> bar
12697 </li></ul>
12699 !! end
12701 !! test
12702 Bug 5678: Double-parsed template argument
12703 !! input
12704 {{lc:{{{1}}}|hello}}
12705 !! result
12706 <p>{{{1}}}
12707 </p>
12708 !! end
12710 !! test
12711 Bug 5678: Double-parsed template invocation
12712 !! input
12713 {{lc:{{paramtest {{!}} param = hello }} }}
12714 !! result
12715 <p>{{paramtest | param = hello }}
12716 </p>
12717 !! end
12719 !! test
12720 Case insensitivity of parser functions for non-ASCII characters (bug 8143)
12721 !! options
12722 language=cs
12723 title=[[Main Page]]
12724 !! input
12725 {{PRVNÍVELKÉ:ěščř}}
12726 {{prvnívelké:ěščř}}
12727 {{PRVNÍMALÉ:ěščř}}
12728 {{prvnímalé:ěščř}}
12729 {{MALÁ:ěščř}}
12730 {{malá:ěščř}}
12731 {{VELKÁ:ěščř}}
12732 {{velká:ěščř}}
12733 !! result
12734 <p>Ěščř
12735 Ěščř
12736 ěščř
12737 ěščř
12738 ěščř
12739 ěščř
12740 ĚŠČŘ
12741 ĚŠČŘ
12742 </p>
12743 !! end
12745 !! test
12746 Morwen/13: Unclosed link followed by heading
12747 !! input
12748 [[link
12749 ==heading==
12750 !! result
12751 <p>[[link
12752 </p>
12753 <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>
12755 !! end
12757 !! test
12758 HHP2.1: Heuristics for headings in preprocessor parenthetical structures
12759 !! input
12760 {{foo|
12761 =heading=
12762 !! result
12763 <p>{{foo|
12764 </p>
12765 <h1><span class="mw-headline" id="heading">heading</span></h1>
12767 !! end
12769 !! test
12770 HHP2.2: Heuristics for headings in preprocessor parenthetical structures
12771 !! input
12772 {{foo|
12773 ==heading==
12774 !! result
12775 <p>{{foo|
12776 </p>
12777 <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>
12779 !! end
12781 !! test
12782 Tildes in comments
12783 !! options
12785 !! input
12786 <!-- ~~~~ -->
12787 !! result
12788 <!-- ~~~~ -->
12789 !! end
12791 !! test
12792 Paragraphs inside divs (no extra line breaks)
12793 !! input
12794 <div>Line one
12796 Line two</div>
12797 !! result
12798 <div>Line one
12799 Line two</div>
12801 !! end
12803 !! test
12804 Paragraphs inside divs (extra line break on open)
12805 !! input
12806 <div>
12807 Line one
12809 Line two</div>
12810 !! result
12811 <div>
12812 <p>Line one
12813 </p>
12814 Line two</div>
12816 !! end
12818 !! test
12819 Paragraphs inside divs (extra line break on close)
12820 !! input
12821 <div>Line one
12823 Line two
12824 </div>
12825 !! result
12826 <div>Line one
12827 <p>Line two
12828 </p>
12829 </div>
12831 !! end
12833 !! test
12834 Paragraphs inside divs (extra line break on open and close)
12835 !! input
12836 <div>
12837 Line one
12839 Line two
12840 </div>
12841 !! result
12842 <div>
12843 <p>Line one
12844 </p><p>Line two
12845 </p>
12846 </div>
12848 !! end
12850 !! test
12851 Nesting tags, paragraphs on lines which begin with <div>
12852 !! options
12853 disabled
12854 !! input
12855 <div></div><strong>A
12856 B</strong>
12857 !! result
12858 <div></div>
12859 <p><strong>A
12860 B</strong>
12861 </p>
12862 !! end
12864 # Bug 6200: <blockquote> should behave like <div> with respect to line breaks
12865 !! test
12866 Bug 6200: paragraphs inside blockquotes (no extra line breaks)
12867 !! options
12868 disabled
12869 !! input
12870 <blockquote>Line one
12872 Line two</blockquote>
12873 !! result
12874 <blockquote>Line one
12875 Line two</blockquote>
12877 !! end
12879 !! test
12880 Bug 6200: paragraphs inside blockquotes (extra line break on open)
12881 !! options
12882 disabled
12883 !! input
12884 <blockquote>
12885 Line one
12887 Line two</blockquote>
12888 !! result
12889 <blockquote>
12890 <p>Line one
12891 </p>
12892 Line two</blockquote>
12894 !! end
12896 !! test
12897 Bug 6200: paragraphs inside blockquotes (extra line break on close)
12898 !! options
12899 disabled
12900 !! input
12901 <blockquote>Line one
12903 Line two
12904 </blockquote>
12905 !! result
12906 <blockquote>Line one
12907 <p>Line two
12908 </p>
12909 </blockquote>
12911 !! end
12913 !! test
12914 Bug 6200: paragraphs inside blockquotes (extra line break on open and close)
12915 !! options
12916 disabled
12917 !! input
12918 <blockquote>
12919 Line one
12921 Line two
12922 </blockquote>
12923 !! result
12924 <blockquote>
12925 <p>Line one
12926 </p><p>Line two
12927 </p>
12928 </blockquote>
12930 !! end
12932 !! test
12933 Paragraphs inside blockquotes/divs (no extra line breaks)
12934 !! input
12935 <blockquote><div>Line one
12937 Line two</div></blockquote>
12938 !! result
12939 <blockquote><div>Line one
12940 Line two</div></blockquote>
12942 !! end
12944 !! test
12945 Paragraphs inside blockquotes/divs (extra line break on open)
12946 !! input
12947 <blockquote><div>
12948 Line one
12950 Line two</div></blockquote>
12951 !! result
12952 <blockquote><div>
12953 <p>Line one
12954 </p>
12955 Line two</div></blockquote>
12957 !! end
12959 !! test
12960 Paragraphs inside blockquotes/divs (extra line break on close)
12961 !! input
12962 <blockquote><div>Line one
12964 Line two
12965 </div></blockquote>
12966 !! result
12967 <blockquote><div>Line one
12968 <p>Line two
12969 </p>
12970 </div></blockquote>
12972 !! end
12974 !! test
12975 Paragraphs inside blockquotes/divs (extra line break on open and close)
12976 !! input
12977 <blockquote><div>
12978 Line one
12980 Line two
12981 </div></blockquote>
12982 !! result
12983 <blockquote><div>
12984 <p>Line one
12985 </p><p>Line two
12986 </p>
12987 </div></blockquote>
12989 !! end
12991 !! test
12992 Interwiki links trounced by replaceExternalLinks after early LinkHolderArray expansion
12993 !! options
12994 wgLinkHolderBatchSize=0
12995 !! input
12996 [[meatball:1]]
12997 [[meatball:2]]
12998 [[meatball:3]]
12999 !! result
13000 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?1" class="extiw" title="meatball:1">meatball:1</a>
13001 <a href="http://www.usemod.com/cgi-bin/mb.pl?2" class="extiw" title="meatball:2">meatball:2</a>
13002 <a href="http://www.usemod.com/cgi-bin/mb.pl?3" class="extiw" title="meatball:3">meatball:3</a>
13003 </p>
13004 !! end
13006 !! test
13007 Free external link invading image caption
13008 !! input
13009 [[Image:Foobar.jpg|thumb|http://x|hello]]
13010 !! result
13011 <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>
13013 !! end
13015 !! test
13016 Bug 15196: localised external link numbers
13017 !! options
13018 language=fa
13019 !! input
13020 [http://en.wikipedia.org/]
13021 !! result
13022 <p><a rel="nofollow" class="external autonumber" href="http://en.wikipedia.org/">[۱]</a>
13023 </p>
13024 !! end
13026 !! test
13027 Multibyte character in padleft
13028 !! input
13029 {{padleft:-Hello|7|Æ}}
13030 !! result
13031 <p>Æ-Hello
13032 </p>
13033 !! end
13035 !! test
13036 Multibyte character in padright
13037 !! input
13038 {{padright:Hello-|7|Æ}}
13039 !! result
13040 <p>Hello-Æ
13041 </p>
13042 !! end
13044 !!test
13045 formatdate parser function
13046 !!input
13047 {{#formatdate:2009-03-24}}
13048 !! result
13049 <p><span class="mw-formatted-date" title="2009-03-24">2009-03-24</span>
13050 </p>
13051 !! end
13053 !!test
13054 formatdate parser function, with default format
13055 !!input
13056 {{#formatdate:2009-03-24|mdy}}
13057 !! result
13058 <p><span class="mw-formatted-date" title="2009-03-24">March 24, 2009</span>
13059 </p>
13060 !! end
13062 !! test
13063 Spacing of numbers in formatted dates
13064 !! input
13065 {{#formatdate:January 15}}
13066 !! result
13067 <p><span class="mw-formatted-date" title="01-15">January 15</span>
13068 </p>
13069 !! end
13071 !! test
13072 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
13073 !! options
13074 language=nl title=[[MediaWiki:Common.css]]
13075 !! input
13076 {{#formatdate:2009-03-24|dmy}}
13077 !! result
13078 <p><span class="mw-formatted-date" title="2009-03-24">24 March 2009</span>
13079 </p>
13080 !! end
13087 # Edit comments
13090 !! test
13091 Edit comment with link
13092 !! options
13093 comment
13094 !! input
13095 I like the [[Main Page]] a lot
13096 !! result
13097 I like the <a href="/wiki/Main_Page" title="Main Page">Main Page</a> a lot
13098 !!end
13100 !! test
13101 Edit comment with link and link text
13102 !! options
13103 comment
13104 !! input
13105 I like the [[Main Page|best pages]] a lot
13106 !! result
13107 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
13108 !!end
13110 !! test
13111 Edit comment with link and link text with suffix
13112 !! options
13113 comment
13114 !! input
13115 I like the [[Main Page|best page]]s a lot
13116 !! result
13117 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
13118 !!end
13120 !! test
13121 Edit comment with section link (non-local, eg in history list)
13122 !! options
13123 comment title=[[Main Page]]
13124 !! input
13125 /* External links */ removed bogus entries
13126 !! result
13127 <a href="/wiki/Main_Page#External_links" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
13128 !!end
13130 !! test
13131 Edit comment with section link and text before it (non-local, eg in history list)
13132 !! options
13133 comment title=[[Main Page]]
13134 !! input
13135 pre-comment text /* External links */ removed bogus entries
13136 !! result
13137 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>
13138 !!end
13140 !! test
13141 Edit comment with section link (local, eg in diff view)
13142 !! options
13143 comment local title=[[Main Page]]
13144 !! input
13145 /* External links */ removed bogus entries
13146 !! result
13147 <a href="#External_links">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
13148 !!end
13150 !! test
13151 Edit comment with subpage link (bug 14080)
13152 !! options
13153 comment
13154 subpage
13155 title=[[Subpage test]]
13156 !! input
13157 Poked at a [[/subpage]] here...
13158 !! result
13159 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a> here...
13160 !!end
13162 !! test
13163 Edit comment with subpage link and link text (bug 14080)
13164 !! options
13165 comment
13166 subpage
13167 title=[[Subpage test]]
13168 !! input
13169 Poked at a [[/subpage|neat little page]] here...
13170 !! result
13171 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">neat little page</a> here...
13172 !!end
13174 !! test
13175 Edit comment with bogus subpage link in non-subpage NS (bug 14080)
13176 !! options
13177 comment
13178 title=[[Subpage test]]
13179 !! input
13180 Poked at a [[/subpage]] here...
13181 !! result
13182 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...
13183 !!end
13185 !! test
13186 Edit comment with bare anchor link (local, as on diff)
13187 !! options
13188 comment
13189 local
13190 title=[[Main Page]]
13191 !!input
13192 [[#section]]
13193 !! result
13194 <a href="#section">#section</a>
13195 !! end
13197 !! test
13198 Edit comment with bare anchor link (non-local, as on history)
13199 !! options
13200 comment
13201 title=[[Main Page]]
13202 !!input
13203 [[#section]]
13204 !! result
13205 <a href="/wiki/Main_Page#section" title="Main Page">#section</a>
13206 !! end
13208 !! test
13209 Anchor starting with underscore
13210 !!input
13211 [[#_ref|One]]
13212 !! result
13213 <p><a href="#_ref">One</a>
13214 </p>
13215 !! end
13217 !! test
13218 Id starting with underscore
13219 !!input
13220 <div id="_ref"></div>
13221 !! result
13222 <div id="_ref"></div>
13224 !! end
13226 !! test
13227 Space normalisation on autocomment (bug 22784)
13228 !! options
13229 comment
13230 title=[[Main Page]]
13231 !!input
13232 /* __hello__world__ */
13233 !! result
13234 <a href="/wiki/Main_Page#hello_world" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">__hello__world__</span></span>
13235 !! end
13237 !! test
13238 percent-encoding and + signs in comments (Bug 26410)
13239 !! options
13240 comment
13241 !!input
13242 [[ABC%33D% ++]] [[ABC%33D% ++|+%20]]
13243 !! result
13244 <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>
13245 !! end
13247 !! test
13248 Bad images - basic functionality
13249 !! options
13250 disabled
13251 !! input
13252 [[File:Bad.jpg]]
13253 !! result
13254 !! end
13256 !! test
13257 Bad images - bug 16039: text after bad image disappears
13258 !! options
13259 disabled
13260 !! input
13261 Foo bar
13262 [[File:Bad.jpg]]
13263 Bar foo
13264 !! result
13265 <p>Foo bar
13266 </p><p>Bar foo
13267 </p>
13268 !! end
13270 !! test
13271 Verify that displaytitle works (bug #22501) no displaytitle
13272 !! options
13273 showtitle
13274 !! config
13275 wgAllowDisplayTitle=true
13276 wgRestrictDisplayTitle=false
13277 !! input
13278 this is not the the title
13279 !! result
13280 Parser test
13281 <p>this is not the the title
13282 </p>
13283 !! end
13285 !! test
13286 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=false
13287 !! options
13288 showtitle
13289 title=[[Screen]]
13290 !! config
13291 wgAllowDisplayTitle=true
13292 wgRestrictDisplayTitle=false
13293 !! input
13294 this is not the the title
13295 {{DISPLAYTITLE:whatever}}
13296 !! result
13297 whatever
13298 <p>this is not the the title
13299 </p>
13300 !! end
13302 !! test
13303 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true mismatch
13304 !! options
13305 showtitle
13306 title=[[Screen]]
13307 !! config
13308 wgAllowDisplayTitle=true
13309 wgRestrictDisplayTitle=true
13310 !! input
13311 this is not the the title
13312 {{DISPLAYTITLE:whatever}}
13313 !! result
13314 Screen
13315 <p>this is not the the title
13316 </p>
13317 !! end
13319 !! test
13320 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true matching
13321 !! options
13322 showtitle
13323 title=[[Screen]]
13324 !! config
13325 wgAllowDisplayTitle=true
13326 wgRestrictDisplayTitle=true
13327 !! input
13328 this is not the the title
13329 {{DISPLAYTITLE:screen}}
13330 !! result
13331 screen
13332 <p>this is not the the title
13333 </p>
13334 !! end
13336 !! test
13337 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false
13338 !! options
13339 showtitle
13340 title=[[Screen]]
13341 !! config
13342 wgAllowDisplayTitle=false
13343 !! input
13344 this is not the the title
13345 {{DISPLAYTITLE:screen}}
13346 !! result
13347 Screen
13348 <p>this is not the the title
13349 <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>
13350 </p>
13351 !! end
13353 !! test
13354 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false no DISPLAYTITLE
13355 !! options
13356 showtitle
13357 title=[[Screen]]
13358 !! config
13359 wgAllowDisplayTitle=false
13360 !! input
13361 this is not the the title
13362 !! result
13363 Screen
13364 <p>this is not the the title
13365 </p>
13366 !! end
13368 !! test
13369 Verify that displaytitle handles inline CSS styles (bug 26547) - rejected value
13370 !! options
13371 showtitle
13372 title=[[Screen]]
13373 !! config
13374 wgAllowDisplayTitle=true
13375 wgRestrictDisplayTitle=true
13376 !! input
13377 this is not the the title
13378 {{DISPLAYTITLE:<span style="display: none;">s</span>creen}}
13379 !! result
13380 <span style="/* attempt to bypass $wgRestrictDisplayTitle */">s</span>creen
13381 <p>this is not the the title
13382 </p>
13383 !! end
13385 !! test
13386 Verify that displaytitle handles inline CSS styles (bug 26547) - accepted value
13387 !! options
13388 showtitle
13389 title=[[Screen]]
13390 !! config
13391 wgAllowDisplayTitle=true
13392 wgRestrictDisplayTitle=true
13393 !! input
13394 this is not the the title
13395 {{DISPLAYTITLE:<span style="color: red;">s</span>creen}}
13396 !! result
13397 <span style="color: red;">s</span>creen
13398 <p>this is not the the title
13399 </p>
13400 !! end
13402 !! test
13403 preload: check <noinclude> and <includeonly>
13404 !! options
13405 preload
13406 !! input
13407 Hello <noinclude>cruel</noinclude><includeonly>kind</includeonly> world.
13408 !! result
13409 Hello kind world.
13410 !! end
13412 !! test
13413 preload: check <onlyinclude>
13414 !! options
13415 preload
13416 !! input
13417 Goodbye <onlyinclude>Hello world</onlyinclude>
13418 !! result
13419 Hello world
13420 !! end
13422 !! test
13423 preload: can pass tags through if we want to
13424 !! options
13425 preload
13426 !! input
13427 <includeonly><</includeonly>includeonly>Hello world<includeonly><</includeonly>/includeonly>
13428 !! result
13429 <includeonly>Hello world</includeonly>
13430 !! end
13432 !! test
13433 preload: check that it doesn't try to do tricks
13434 !! options
13435 preload
13436 !! input
13437 * <!-- Hello --> ''{{world}}'' {{<includeonly>subst:</includeonly>How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
13438 !! result
13439 * <!-- Hello --> ''{{world}}'' {{subst:How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
13440 !! end
13442 !! test
13443 Play a bit with r67090 and bug 3158
13444 !! options
13445 disabled
13446 !! input
13447 <div style="width:50% !important">&nbsp;</div>
13448 <div style="width:50%&nbsp;!important">&nbsp;</div>
13449 <div style="width:50%&#160;!important">&nbsp;</div>
13450 <div style="border : solid;">&nbsp;</div>
13451 !! result
13452 <div style="width:50% !important">&nbsp;</div>
13453 <div style="width:50% !important">&nbsp;</div>
13454 <div style="width:50% !important">&nbsp;</div>
13455 <div style="border&#160;: solid;">&nbsp;</div>
13457 !! end
13459 !! test
13460 HTML5 data attributes
13461 !! input
13462 <span data-foo="bar">Baz</span>
13463 <p data-abc-def_hij="">Quuz</p>
13464 !! result
13465 <p><span data-foo="bar">Baz</span>
13466 </p>
13467 <p data-abc-def_hij="">Quuz</p>
13469 !! end
13471 !! test
13472 percent-encoding and + signs in internal links (Bug 26410)
13473 !! input
13474 [[User:+%]] [[Page+title%]]
13475 [[%+]] [[%+|%20]] [[%+ ]] [[%+r]]
13476 [[%]] [[+]] [[image:%+abc%39|foo|[[bar]]]]
13477 [[%33%45]] [[%33%45+]]
13478 !! result
13479 <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>
13480 <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>
13481 <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>
13482 <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>
13483 </p>
13484 !! end
13486 !! test
13487 Special characters in embedded file links (bug 27679)
13488 !! input
13489 [[File:Contains & ampersand.jpg]]
13490 [[File:Does not exist.jpg|Title with & ampersand]]
13491 !! result
13492 <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>
13493 <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>
13494 </p>
13495 !! end
13498 !! test
13499 Confirm that 'apos' named character reference doesn't make it to output (not legal in HTML 4)
13500 !! input
13501 Text&apos;s been normalized?
13502 !! result
13503 <p>Text&#39;s been normalized?
13504 </p>
13505 !! end
13507 !! test
13508 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate free external links
13509 !! input
13510 http://www.example.org/ <-- U+3000 (vim: ^Vu3000)
13511 !! result
13512 <p><a rel="nofollow" class="external free" href="http://www.example.org/">http://www.example.org/</a> &lt;-- U+3000 (vim: ^Vu3000)
13513 </p>
13514 !! end
13516 !! test
13517 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate bracketed external links
13518 !! input
13519 [http://www.example.org/ ideograms]
13520 !! result
13521 <p><a rel="nofollow" class="external text" href="http://www.example.org/">ideograms</a>
13522 </p>
13523 !! end
13525 !! test
13526 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate external images links
13527 !! input
13528 http://www.example.org/pic.png <-- U+3000 (vim: ^Vu3000)
13529 !! result
13530 <p><img src="http://www.example.org/pic.png" alt="pic.png" /> &lt;-- U+3000 (vim: ^Vu3000)
13531 </p>
13532 !! end
13534 !! article
13535 Mediawiki:loop1
13536 !! text
13537 {{Identical|A}}
13538 !! endarticle
13540 !! article
13541 Mediawiki:loop2
13542 !! text
13543 {{Identical|B}}
13544 !! endarticle
13546 !! article
13547 Template:Identical
13548 !! text
13549 {{int:loop1}}
13550 {{int:loop2}}
13551 !! endarticle
13553 !! test
13554 Bug 31098 Template which includes system messages which includes the template
13555 !! input
13556 {{Identical}}
13557 !! result
13558 <p><span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
13559 <span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
13560 </p>
13561 !! end
13563 !! test
13564 Bug31490 Turkish: ucfirst 'blah'
13565 !! options
13566 language=tr
13567 !! input
13568 {{ucfirst:blah}}
13569 !! result
13570 <p>Blah
13571 </p>
13572 !! end
13574 !! test
13575 Bug31490 Turkish: ucfirst 'ix'
13576 !! options
13577 language=tr
13578 !! input
13579 {{ucfirst:ix}}
13580 !! result
13581 <p>İx
13582 </p>
13583 !! end
13585 !! test
13586 Bug31490 Turkish: lcfirst 'BLAH'
13587 !! options
13588 language=tr
13589 !! input
13590 {{lcfirst:BLAH}}
13591 !! result
13592 <p>bLAH
13593 </p>
13594 !! end
13596 !! test
13597 Bug31490 Turkish: ucfırst (with a dotless i)
13598 !! options
13599 language=tr
13600 !! input
13601 {{ucfırst:blah}}
13602 !! result
13603 <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>
13604 </p>
13605 !! end
13607 !! test
13608 Bug31490 ucfırst (with a dotless i) with English language
13609 !! options
13610 language=en
13611 !! input
13612 {{ucfırst:blah}}
13613 !! result
13614 <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>
13615 </p>
13616 !! end
13618 !! test
13619 Bug 26375: TOC with italics
13620 !! options
13621 title=[[Main Page]]
13622 !! input
13623 __TOC__
13624 == ''Lost'' episodes ==
13625 !! result
13626 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
13627 <ul>
13628 <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>
13629 </ul>
13630 </td></tr></table>
13631 <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>
13633 !! end
13635 !! test
13636 Bug 26375: TOC with bold
13637 !! options
13638 title=[[Main Page]]
13639 !! input
13640 __TOC__
13641 == '''should be bold''' then normal text ==
13642 !! result
13643 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
13644 <ul>
13645 <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>
13646 </ul>
13647 </td></tr></table>
13648 <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>
13650 !! end
13652 !! test
13653 Bug 33845: Headings become cursive in TOC when they contain an image
13654 !! options
13655 title=[[Main Page]]
13656 !! input
13657 __TOC__
13658 == Image [[Image:foobar.jpg]] ==
13659 !! result
13660 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
13661 <ul>
13662 <li class="toclevel-1 tocsection-1"><a href="#Image"><span class="tocnumber">1</span> <span class="toctext">Image</span></a></li>
13663 </ul>
13664 </td></tr></table>
13665 <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>
13667 !! end
13669 !! test
13670 Bug 33845 (2): Headings become bold in TOC when they contain a blockquote
13671 !! options
13672 title=[[Main Page]]
13673 !! input
13674 __TOC__
13675 == <blockquote>Quote</blockquote> ==
13676 !! result
13677 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
13678 <ul>
13679 <li class="toclevel-1 tocsection-1"><a href="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
13680 </ul>
13681 </td></tr></table>
13682 <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>
13684 !! end
13686 !! test
13687 Unclosed tags in TOC
13688 !! options
13689 title=[[Main Page]]
13690 !! input
13691 __TOC__
13692 == Proof: 2 < 3 ==
13693 <small>Hanc marginis exiguitas non caperet.</small>
13695 !! result
13696 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
13697 <ul>
13698 <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>
13699 </ul>
13700 </td></tr></table>
13701 <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>
13702 <p><small>Hanc marginis exiguitas non caperet.</small>
13704 </p>
13705 !! end
13707 !! test
13708 Multiple tags in TOC
13709 !! input
13710 __TOC__
13711 == <i>Foo</i> <b>Bar</b> ==
13713 == <i>Foo</i> <blockquote>Bar</blockquote> ==
13714 !! result
13715 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
13716 <ul>
13717 <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>
13718 <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>
13719 </ul>
13720 </td></tr></table>
13721 <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>
13722 <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>
13724 !! end
13726 !! test
13727 Tags with parameters in TOC
13728 !! input
13729 __TOC__
13730 == <sup class="in-h2">Hello</sup> ==
13732 == <sup class="a > b">Evilbye</sup> ==
13733 !! result
13734 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
13735 <ul>
13736 <li class="toclevel-1 tocsection-1"><a href="#Hello"><span class="tocnumber">1</span> <span class="toctext"><sup>Hello</sup></span></a></li>
13737 <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>
13738 </ul>
13739 </td></tr></table>
13740 <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>
13741 <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>
13743 !! end
13745 !! test
13746 span tags with directionality in TOC
13747 !! input
13748 __TOC__
13749 == <span dir="ltr">C++</span> ==
13751 == <span dir="rtl">זבנג!</span> ==
13753 == <span style="font-style: italic">The attributes on these span tags must be deleted from the TOC</span> ==
13755 == <span style="font-style: italic" dir="ltr">All attributes on these span tags must be deleted from the TOC</span> ==
13757 == <span dir="ltr" style="font-style: italic">Attributes after dir on these span tags must be deleted from the TOC</span> ==
13758 !! result
13759 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
13760 <ul>
13761 <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>
13762 <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>
13763 <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>
13764 <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>
13765 <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>
13766 </ul>
13767 </td></tr></table>
13768 <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>
13769 <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>
13770 <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>
13771 <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>
13772 <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>
13774 !! end
13776 !! article
13777 MediaWiki:Bug32057
13778 !! text
13779 == {{int:headline_sample}} ==
13780 !! endarticle
13782 !! test
13783 Bug 32057: Title needed when expanding <h> nodes.
13784 !! options
13785 title=[[Main Page]]
13786 !! input
13787 {{int:Bug32057}}
13788 !! result
13789 <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>
13791 !! end
13793 !! test
13794 Strip marker in urlencode
13795 !! input
13796 {{urlencode:x<nowiki/>y}}
13797 {{urlencode:x<nowiki/>y|wiki}}
13798 {{urlencode:x<nowiki/>y|path}}
13799 !! result
13800 <p>xy
13803 </p>
13804 !! end
13806 !! test
13807 Strip marker in lc
13808 !! input
13809 {{lc:x<nowiki/>y}}
13810 !! result
13811 <p>xy
13812 </p>
13813 !! end
13815 !! test
13816 Strip marker in uc
13817 !! input
13818 {{uc:x<nowiki/>y}}
13819 !! result
13820 <p>XY
13821 </p>
13822 !! end
13824 !! test
13825 Strip marker in formatNum
13826 !! input
13827 {{formatnum:1<nowiki/>2}}
13828 {{formatnum:1<nowiki/>2|R}}
13829 !! result
13830 <p>12
13832 </p>
13833 !! end
13835 !! test
13836 Check noCommafy in formatNum
13837 !! options
13838 language=be-tarask
13839 !! input
13840 {{formatnum:123456.78}}
13841 {{formatnum:123456.78|NOSEP}}
13842 !! result
13843 <p>123 456,78
13844 123456.78
13845 </p>
13846 !! end
13848 !! test
13849 Strip marker in grammar
13850 !! options
13851 language=fi
13852 !! input
13853 {{grammar:elative|foo<nowiki/>bar}}
13854 !! result
13855 <p>foobarista
13856 </p>
13857 !! end
13859 !! test
13860 Strip marker in padleft
13861 !! input
13862 {{padleft:|2|x<nowiki/>y}}
13863 !! result
13864 <p>xy
13865 </p>
13866 !! end
13868 !! test
13869 Strip marker in padright
13870 !! input
13871 {{padright:|2|x<nowiki/>y}}
13872 !! result
13873 <p>xy
13874 </p>
13875 !! end
13877 !! test
13878 Strip marker in anchorencode
13879 !! input
13880 {{anchorencode:x<nowiki/>y}}
13881 !! result
13882 <p>xy
13883 </p>
13884 !! end
13886 !! test
13887 nowiki inside link inside heading (bug 18295)
13888 !! input
13889 ==[[foo|x<nowiki>y</nowiki>z]]==
13890 !! result
13891 <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>
13893 !! end
13895 !! test
13896 new support for bdi element (bug 31817)
13897 !! input
13898 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
13899 !! result
13900 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
13902 !!end
13904 !! test
13905 Ignore pipe between table row attributes
13906 !! input
13908 | quux
13909 |- id=foo | style='color: red'
13910 | bar
13912 !! result
13913 <table>
13914 <tr>
13915 <td> quux
13916 </td></tr>
13917 <tr id="foo" style="color: red">
13918 <td> bar
13919 </td></tr></table>
13921 !! end
13923 !!test
13924 Gallery override link with WikiLink (bug 34852)
13925 !! input
13926 <gallery>
13927 File:foobar.jpg|caption|alt=galleryalt|link=InterWikiLink
13928 </gallery>
13929 !! result
13930 <ul class="gallery">
13931                 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
13932                         <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>
13933                         <div class="gallerytext">
13934 <p>caption
13935 </p>
13936                         </div>
13937                 </div></li>
13938 </ul>
13940 !! end
13942 !!test
13943 Gallery override link with absolute external link (bug 34852)
13944 !! input
13945 <gallery>
13946 File:foobar.jpg|caption|alt=galleryalt|link=http://www.example.org
13947 </gallery>
13948 !! result
13949 <ul class="gallery">
13950                 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
13951                         <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>
13952                         <div class="gallerytext">
13953 <p>caption
13954 </p>
13955                         </div>
13956                 </div></li>
13957 </ul>
13959 !! end
13961 !!test
13962 Gallery override link with malicious javascript (bug 34852)
13963 !! input
13964 <gallery>
13965 File:foobar.jpg|caption|alt=galleryalt|link=" onclick="alert('malicious javascript code!');
13966 </gallery>
13967 !! result
13968 <ul class="gallery">
13969                 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
13970                         <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>
13971                         <div class="gallerytext">
13972 <p>caption
13973 </p>
13974                         </div>
13975                 </div></li>
13976 </ul>
13978 !! end
13980 !!test
13981 Gallery with invalid title as link (bug 43964)
13982 !! input
13983 <gallery>
13984 File:foobar.jpg|link=<
13985 </gallery>
13986 !! result
13987 <ul class="gallery">
13988                 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
13989                         <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>
13990                         <div class="gallerytext">
13991                         </div>
13992                 </div></li>
13993 </ul>
13995 !! end
13997 !!test
13998 Language parser function
13999 !! input
14000 {{#language:ar}}
14001 !! result
14002 <p>العربية
14003 </p>
14004 !! end
14006 !!test
14007 Padleft and padright as substr
14008 !! input
14009 {{padleft:|3|abcde}}
14010 {{padright:|3|abcde}}
14011 !! result
14012 <p>abc
14014 </p>
14015 !! end
14017 !!test
14018 Special parser function
14019 !! input
14020 {{#special:RandomPage}}
14021 {{#special:BaDtItLe}}
14022 {{#special:Foobar}}
14023 !! result
14024 <p>Special:Random
14025 Special:Badtitle
14026 Special:Foobar
14027 </p>
14028 !! end
14030 !!test
14031 Bug 34939 - Case insensitive link parsing ([HttP://])
14032 !! input
14033 [HttP://MediaWiki.Org/]
14034 !! result
14035 <p><a rel="nofollow" class="external autonumber" href="HttP://MediaWiki.Org/">[1]</a>
14036 </p>
14037 !! end
14039 !!test
14040 Bug 34939 - Case insensitive link parsing ([HttP:// title])
14041 !! input
14042 [HttP://MediaWiki.Org/ MediaWiki]
14043 !! result
14044 <p><a rel="nofollow" class="external text" href="HttP://MediaWiki.Org/">MediaWiki</a>
14045 </p>
14046 !! end
14048 !!test
14049 Bug 34939 - Case insensitive link parsing (HttP://)
14050 !! input
14051 HttP://MediaWiki.Org/
14052 !! result
14053 <p><a rel="nofollow" class="external free" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a>
14054 </p>
14055 !! end
14059 ### Parsoids-specific tests
14060 ### Parsoid-PHP parser incompatibilities
14062 !!test
14063 1. SOL-sensitive wikitext tokens as template-args
14064 !!options
14065 parsoid=wt2html,wt2wt
14066 !!input
14067 {{echo|*a}}
14068 {{echo|#a}}
14069 {{echo|:a}}
14070 !!result
14071 <span about="#mwt1" typeof="mw:Transclusion">
14072 </span><ul about="#mwt1"><li>a</li></ul>
14073 <span about="#mwt2" typeof="mw:Transclusion">
14074 </span><ol about="#mwt2"><li>a</li></ol>
14075 <span about="#mwt3" typeof="mw:Transclusion">
14076 </span><dl about="#mwt3"><dd>a</dd></dl>
14077 !!end
14079 #### ----------------------------------------------------------------
14080 #### Parsoid-only testing of Parsoid's impl of <ref> and <references>
14081 #### tags. Parsoid's output for these tags differs from that of the
14082 #### PHP parser.
14083 #### ----------------------------------------------------------------
14085 !!test
14086 Ref: 1. ref-location should be replaced with an index span
14087 !!options
14088 parsoid
14089 !!input
14090 A <ref>foo</ref>
14091 B <ref name="x">foo</ref>
14092 C <ref name="y" />
14093 !!result
14094 <p>A <span about="#mwt1" class="reference" data-mw='{"name":"ref","body":{"html":"foo"},"attrs":{}}' id="cite_ref-1-0" rel="dc:references" typeof="mw:Extension/ref"><a href="#cite_note-1">[1]</a></span>
14095 B <span about="#mwt2" class="reference" data-mw='{"name":"ref","body":{"html":"foo"},"attrs":{"name":"x"}}' id="cite_ref-x-2-0" rel="dc:references" typeof="mw:Extension/ref"><a href="#cite_note-x-2">[2]</a></span>
14096 C <span about="#mwt3" class="reference" data-mw='{"name":"ref","attrs":{"name":"y"}}' id="cite_ref-y-3-0" rel="dc:references" typeof="mw:Extension/ref"><a href="#cite_note-y-3">[3]</a></span></p>
14097 !!end
14099 !!test
14100 Ref: 2. ref-tags with identical names should all get the same index
14101 !!options
14102 parsoid
14103 !!input
14104 A <ref name="x">foo</ref>
14105 B <ref name="x" />
14106 !!result
14107 <p>A <span about="#mwt1" class="reference" data-mw='{"name":"ref","body":{"html":"foo"},"attrs":{"name":"x"}}' id="cite_ref-x-1-0" rel="dc:references" typeof="mw:Extension/ref"><a href="#cite_note-x-1">[1]</a></span>
14108 B <span about="#mwt2" class="reference" data-mw='{"name":"ref","attrs":{"name":"x"}}' id="cite_ref-x-1-1" rel="dc:references" typeof="mw:Extension/ref"><a href="#cite_note-x-1">[1]</a></span></p>
14109 !!end
14111 !!test
14112 Ref: 3. spaces in ref-names should be ignored
14113 !!options
14114 parsoid
14115 !!input
14116 A <ref name="x">foo</ref>
14117 B <ref name=" x " />
14118 C <ref name= x  />
14119 !!result
14120 <p>A <span about="#mwt1" class="reference" data-mw='{"name":"ref","body":{"html":"foo"},"attrs":{"name":"x"}}' id="cite_ref-x-1-0" rel="dc:references" typeof="mw:Extension/ref"><a href="#cite_note-x-1">[1]</a></span>
14121 B <span about="#mwt2" class="reference" data-mw='{"name":"ref","attrs":{"name":"x"}}' id="cite_ref-x-1-1" rel="dc:references" typeof="mw:Extension/ref"><a href="#cite_note-x-1">[1]</a></span>
14122 C <span about="#mwt3" class="reference" data-mw='{"name":"ref","attrs":{"name":"x"}}' id="cite_ref-x-1-2" rel="dc:references" typeof="mw:Extension/ref"><a href="#cite_note-x-1">[1]</a></span></p>
14123 !!end
14125 !!test
14126 Ref: 4. 'constructor' should be accepted as a valid ref-name
14127 (NOTE: constructor is a predefined property in JS and constructor as a ref-name can clash with it if not handled properly)
14128 !!options
14129 parsoid
14130 !!input
14131 A <ref name="constructor">foo</ref>
14132 !!result
14133 <p>A <span about="#mwt1" class="reference" data-mw='{"name":"ref","body":{"html":"foo"},"attrs":{"name":"constructor"}}' id="cite_ref-constructor-1-0" rel="dc:references" typeof="mw:Extension/ref"><a href="#cite_note-constructor-1">[1]</a></span></p>
14134 !!end
14136 !!test
14137 Ref: 5. body should accept generic wikitext
14138 !!options
14139 parsoid
14140 !!input
14141 A <ref>
14142  This is a '''[[bolded link]]''' and this is a {{echo|transclusion}}
14143 </ref>
14145 <references />
14146 !!result
14147 <p>A <span about="#mwt1" class="reference" data-mw='{"name":"ref","body":{"html":"This is a <b data-parsoid=\"{&amp;quot;dsr&amp;quot;:[19,40,3,3]}\"><a rel=\"mw:WikiLink\" href=\"./Bolded_link\" data-parsoid=\"{&amp;quot;a&amp;quot;:{&amp;quot;href&amp;quot;:&amp;quot;./Bolded_link&amp;quot;},&amp;quot;sa&amp;quot;:{&amp;quot;href&amp;quot;:&amp;quot;bolded link&amp;quot;},&amp;quot;stx&amp;quot;:&amp;quot;simple&amp;quot;,&amp;quot;dsr&amp;quot;:[22,37,2,2]}\">bolded link</a></b> and this is a <span about=\"#mwt3\" typeof=\"mw:Transclusion\" data-mw=\"{&amp;quot;target&amp;quot;:{&amp;quot;wt&amp;quot;:&amp;quot;echo&amp;quot;,&amp;quot;href&amp;quot;:&amp;quot;./Template:Echo&amp;quot;},&amp;quot;params&amp;quot;:{&amp;quot;1&amp;quot;:{&amp;quot;wt&amp;quot;:&amp;quot;transclusion&amp;quot;}}}\" data-parsoid=\"{&amp;quot;src&amp;quot;:&amp;quot;{{echo|transclusion}}&amp;quot;,&amp;quot;dsr&amp;quot;:[55,76,null,null]}\">transclusion</span>\n"},"attrs":{}}' id="cite_ref-1-0" rel="dc:references" typeof="mw:Extension/ref"><a href="#cite_note-1">[1]</a></span></p>
14149 <ol about="#mwt2" class="references" data-mw='{"name":"references","attrs":{}}' typeof="mw:Extension/references">
14150 <li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> This is a <b><a rel="mw:WikiLink" href="./Bolded_link">bolded link</a></b> and this is a <span about="#mwt3" typeof="mw:Transclusion" data-mw='{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"transclusion"}}}'>transclusion</span>
14151 </li></ol>
14152 !!end
14154 !!test
14155 Ref: 6. indent-pres should not be output in ref-body
14156 !!options
14157 parsoid
14158 !!input
14159 A <ref>
14160  foo
14161  bar
14162  baz
14163 </ref>
14165 <references />
14166 !!result
14167 <p>A <span about="#mwt1" class="reference" data-mw='{"name":"ref","body":{"html":"foo\n bar\n baz\n"},"attrs":{}}' id="cite_ref-1-0" rel="dc:references" typeof="mw:Extension/ref"><a href="#cite_note-1">[1]</a></span></p>
14169 <ol about="#mwt2" class="references" data-mw='{"name":"references","attrs":{}}' typeof="mw:Extension/references">
14170 <li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> foo
14171  bar
14172  baz
14173 </li></ol>
14174 !!end
14176 !!test
14177 Ref: 6. No p-wrapping in ref-body
14178 !!options
14179 parsoid
14180 !!input
14181 A <ref>
14191 booz
14192 </ref>
14194 <references />
14195 !!result
14196 <p>A <span about="#mwt1" class="reference" data-mw='{"name":"ref","body":{"html":"foo\n\nbar\n\n\nbaz\n\n\n\nbooz\n"},"attrs":{}}' id="cite_ref-1-0" rel="dc:references" typeof="mw:Extension/ref"><a href="#cite_note-1">[1]</a></span></p>
14198 <ol about="#mwt2" class="references" data-mw='{"name":"references","attrs":{}}' typeof="mw:Extension/references">
14199 <li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> foo
14208 booz
14209 </li></ol>
14210 !!end
14212 !!test
14213 Ref: 8. transclusion wikitext has lower precedence
14214 !!options
14215 parsoid
14216 !!input
14217 A <ref> foo {{echo|</ref> B C}}
14219 <references />
14220 !!result
14221 <p>A <span about="#mwt1" class="reference" data-mw='{"name":"ref","body":{"html":"foo <span typeof=\"mw:Nowiki\" data-parsoid=\"{&amp;quot;src&amp;quot;:&amp;quot;{{&amp;quot;,&amp;quot;dsr&amp;quot;:[12,14,2,null]}\">{{</span>echo|"},"attrs":{}}' id="cite_ref-1-0" rel="dc:references" typeof="mw:Extension/ref"><a href="#cite_note-1">[1]</a></span> B C<span typeof="mw:Nowiki">}}</span></p>
14223 <ol about="#mwt2" class="references" data-mw='{"name":"references","attrs":{}}' typeof="mw:Extension/references">
14224 <li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> foo <span typeof="mw:Nowiki">{{</span>echo|</li></ol>
14225 !!end
14227 !!test
14228 Ref: 9. unclosed comments should not leak out of ref-body
14229 !!options
14230 parsoid
14231 !!input
14232 A <ref> foo <!--</ref> B C
14234 <references />
14235 !!result
14236 <p>A <span about="#mwt1" class="reference" data-mw='{"name":"ref","body":{"html":"foo <!---->"},"attrs":{}}' id="cite_ref-1-0" rel="dc:references" typeof="mw:Extension/ref"><a href="#cite_note-1">[1]</a></span> B C</p>
14238 <ol about="#mwt2" class="references" data-mw='{"name":"references","attrs":{}}' typeof="mw:Extension/references">
14239 <li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> foo <!----></li></ol>
14240 !!end
14242 !!test
14243 Ref: 10. Unclosed HTML tags should not leak out of ref-body
14244 !!options
14245 parsoid
14246 !!input
14247 A <ref> <b> foo </ref> B C
14249 <references />
14250 !!result
14251 <p>A <span about="#mwt1" class="reference" data-mw='{"name":"ref","body":{"html":"<b data-parsoid=\"{&amp;quot;stx&amp;quot;:&amp;quot;html&amp;quot;,&amp;quot;autoInsertedEnd&amp;quot;:true,&amp;quot;dsr&amp;quot;:[8,16,3,0]}\"> foo </b>"},"attrs":{}}' id="cite_ref-1-0" rel="dc:references" typeof="mw:Extension/ref"><a href="#cite_note-1">[1]</a></span> B C</p>
14253 <ol about="#mwt2" class="references" data-mw='{"name":"references","attrs":{}}' typeof="mw:Extension/references">
14254 <li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> <b> foo </b></li></ol>
14255 !!end
14257 !!test
14258 Ref: 11. ref-tags acts like an inline element wrt P-wrapping
14259 !!options
14260 parsoid
14261 !!input
14262 A <ref>foo</ref> B
14263 C <ref>bar</ref> D
14264 !!result
14265 <p>A <span about="#mwt1" class="reference" data-mw='{"name":"ref","body":{"html":"foo"},"attrs":{}}' id="cite_ref-1-0" rel="dc:references" typeof="mw:Extension/ref"><a href="#cite_note-1">[1]</a></span> B
14266 C <span about="#mwt2" class="reference" data-mw='{"name":"ref","body":{"html":"bar"},"attrs":{}}' id="cite_ref-2-0" rel="dc:references" typeof="mw:Extension/ref"><a href="#cite_note-2">[2]</a></span> D</p>
14267 !!end
14269 !!test
14270 Ref: 12. ref-tags act as trailing newline migration barrier
14271 !!options
14272 parsoid
14273 !!input
14274 <!--the newline at the end of this line moves out of the p-tag-->a
14276 b<!--the newline at the end of this line stays inside the p-tag--> <ref />
14277 <ref />
14280 !!result
14281 <p><!--the newline at the end of this line moves out of the p-tag-->a</p>
14284 <p>b<!--the newline at the end of this line stays inside the p-tag--> <span about="#mwt1" class="reference" data-mw='{"name":"ref","attrs":{}}' id="cite_ref-1-0" rel="dc:references" typeof="mw:Extension/ref"><a href="#cite_note-1">[1]</a></span>
14285 <span about="#mwt2" class="reference" data-mw='{"name":"ref","attrs":{}}' id="cite_ref-2-0" rel="dc:references" typeof="mw:Extension/ref"><a href="#cite_note-2">[2]</a></span></p>
14288 <p>c</p>
14289 !!end
14291 !!test
14292 Ref: 13. ref-tags are not SOL-transparent and block indent-pres
14293 !!options
14294 parsoid
14295 !!input
14296 <ref>foo</ref> A
14297 <ref>bar
14298 </ref> B
14299 !!result
14300 <p><span about="#mwt1" class="reference" data-mw='{"name":"ref","body":{"html":"foo"},"attrs":{}}' id="cite_ref-1-0" rel="dc:references" typeof="mw:Extension/ref"><a href="#cite_note-1">[1]</a></span> A
14301 <span about="#mwt2" class="reference" data-mw='{"name":"ref","body":{"html":"bar\n"},"attrs":{}}' id="cite_ref-2-0" rel="dc:references" typeof="mw:Extension/ref"><a href="#cite_note-2">[2]</a></span> B</p>
14302 !!end
14304 !!test
14305 Ref: 14. A nested ref-tag should be emitted as plain text
14306 !!options
14307 parsoid
14308 !!input
14309 <ref>foo <ref>bar</ref> baz</ref>
14311 <references />
14312 !!result
14313 <p><span about="#mwt1" class="reference" data-mw='{"name":"ref","body":{"html":"foo &amp;lt;ref&amp;gt;bar"},"attrs":{}}' id="cite_ref-1-0" rel="dc:references" typeof="mw:Extension/ref"><a href="#cite_note-1">[1]</a></span> baz&lt;/ref&gt;</p>
14315 <ol about="#mwt2" class="references" data-mw='{"name":"references","attrs":{}}' typeof="mw:Extension/references"><li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> foo &lt;ref&gt;bar</li></ol>
14316 !!end
14318 !!test
14319 Ref: 15. ref-tags with identical names should get identical indexes
14320 !!options
14321 parsoid
14322 !!input
14323 A1 <ref name="a">foo</ref> A2 <ref name="a" />
14324 B1 <ref name="b" /> B2 <ref name="b">bar</ref>
14326 <references />
14327 !!result
14328 <p>A1 <span about="#mwt3" class="reference" data-mw='{"name":"ref","body":{"html":"foo"},"attrs":{"name":"a"}}' id="cite_ref-a-1-0" rel="dc:references" typeof="mw:Extension/ref"><a href="#cite_note-a-1">[1]</a></span> A2 <span about="#mwt4" class="reference" data-mw='{"name":"ref","attrs":{"name":"a"}}' id="cite_ref-a-1-1" rel="dc:references" typeof="mw:Extension/ref"><a href="#cite_note-a-1">[1]</a></span>
14329 B1 <span about="#mwt7" class="reference" data-mw='{"name":"ref","attrs":{"name":"b"}}' id="cite_ref-b-2-0" rel="dc:references" typeof="mw:Extension/ref"><a href="#cite_note-b-2">[2]</a></span> B2 <span about="#mwt8" class="reference" data-mw='{"name":"ref","body":{"html":"bar"},"attrs":{"name":"b"}}' id="cite_ref-b-2-1" rel="dc:references" typeof="mw:Extension/ref"><a href="#cite_note-b-2">[2]</a></span></p>
14331 <ol about="#mwt10" class="references" data-mw='{"name":"references","attrs":{}}' typeof="mw:Extension/references"><li about="#cite_note-a-1" id="cite_note-a-1"><span rel="mw:referencedBy">↑ <a href="#cite_ref-a-1-0">1.0</a> <a href="#cite_ref-a-1-1">1.1</a></span> foo</li><li about="#cite_note-b-2" id="cite_note-b-2"><span rel="mw:referencedBy">↑ <a href="#cite_ref-b-2-0">2.0</a> <a href="#cite_ref-b-2-1">2.1</a></span> bar</li></ol>
14332 !!end
14334 !!test
14335 References: 1. references tag without any refs should be handled properly
14336 !!options
14337 parsoid
14338 !!input
14339 <references />
14340 !!result
14341 <ol about="#mwt2" class="references" data-mw='{"name":"references","attrs":{}}' typeof="mw:Extension/references"></ol>
14342 !!end
14344 !!test
14345 References: 2. references tag with group only outputs references from that group
14346 !!options
14347 parsoid
14348 !!input
14349 A <ref group="a">foo</ref>
14350 B <ref group="b">bar</ref>
14352 <references group='a' />
14353 !!result
14354 <p>A <span about="#mwt2" class="reference" data-mw='{"name":"ref","body":{"html":"foo"},"attrs":{"group":"a"}}' id="cite_ref-1-0" rel="dc:references" typeof="mw:Extension/ref"><a href="#cite_note-1">[a 1]</a></span>
14355 B <span about="#mwt4" class="reference" data-mw='{"name":"ref","body":{"html":"bar"},"attrs":{"group":"b"}}' id="cite_ref-1-0" rel="dc:references" typeof="mw:Extension/ref"><a href="#cite_note-1">[b 1]</a></span></p>
14357 <ol about="#mwt6" class="references" data-mw='{"name":"references","attrs":{"group":"a"}}' typeof="mw:Extension/references"><li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> foo</li></ol>
14358 !!end
14360 !!test
14361 References: 3. ref list should be cleared after processing references
14362 !!options
14363 parsoid
14364 !!input
14365 A <ref>foo</ref>
14367 <references />
14369 B <ref>bar</ref>
14371 <references />
14372 !!result
14373 <p>A <span about="#mwt2" class="reference" data-mw='{"name":"ref","body":{"html":"foo"},"attrs":{}}' id="cite_ref-1-0" rel="dc:references" typeof="mw:Extension/ref"><a href="#cite_note-1">[1]</a></span></p>
14375 <ol about="#mwt4" class="references" data-mw='{"name":"references","attrs":{}}' typeof="mw:Extension/references"><li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> foo</li></ol>
14377 <p>B <span about="#mwt6" class="reference" data-mw='{"name":"ref","body":{"html":"bar"},"attrs":{}}' id="cite_ref-1-0" rel="dc:references" typeof="mw:Extension/ref"><a href="#cite_note-1">[1]</a></span></p>
14379 <ol about="#mwt8" class="references" data-mw='{"name":"references","attrs":{}}' typeof="mw:Extension/references"><li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> bar</li></ol>
14380 !!end
14382 !!test
14383 References: 4. only referenced group should be cleared after processing references
14384 !!options
14385 parsoid
14386 !!input
14387 A <ref group="a">afoo</ref>
14388 B <ref>bfoo</ref>
14390 <references group="a"/>
14392 C <ref>cfoo</ref>
14394 <references />
14395 !!result
14396 <p>A <span about="#mwt2" class="reference" data-mw='{"name":"ref","body":{"html":"afoo"},"attrs":{"group":"a"}}' id="cite_ref-1-0" rel="dc:references" typeof="mw:Extension/ref"><a href="#cite_note-1">[a 1]</a></span>
14397 B <span about="#mwt4" class="reference" data-mw='{"name":"ref","body":{"html":"bfoo"},"attrs":{}}' id="cite_ref-1-0" rel="dc:references" typeof="mw:Extension/ref" data-parsoid='{"src":"<ref>bfoo</ref>","dsr":[30,45,5,6]}'><a href="#cite_note-1">[1]</a></span></p>
14399 <ol about="#mwt6" class="references" data-mw='{"name":"references","attrs":{"group":"a"}}' typeof="mw:Extension/references"><li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> afoo</li></ol>
14401 <p>C <span about="#mwt8" class="reference" data-mw='{"name":"ref","body":{"html":"cfoo"},"attrs":{}}' id="cite_ref-2-0" rel="dc:references" typeof="mw:Extension/ref"><a href="#cite_note-2">[2]</a></span></p>
14403 <ol about="#mwt10" class="references" data-mw='{"name":"references","attrs":{}}' typeof="mw:Extension/references"><li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> bfoo</li><li about="#cite_note-2" id="cite_note-2"><span rel="mw:referencedBy"><a href="#cite_ref-2-0">↑</a></span> cfoo</li></ol>
14404 !!end
14406 !!test
14407 References: 5. ref tags in references should be processed while ignoring all other content
14408 !!options
14409 parsoid
14410 !!input
14411 A <ref name="a" />
14412 B <ref name="b">bar</ref>
14414 <references>
14415 <ref name="a">foo</ref>
14416 This should just get lost.
14417 </references>
14418 !!result
14419 <p>A <span about="#mwt2" class="reference" data-mw='{"name":"ref","attrs":{"name":"a"}}' id="cite_ref-a-1-0" rel="dc:references" typeof="mw:Extension/ref"><a href="#cite_note-a-1">[1]</a></span>
14420 B <span about="#mwt4" class="reference" data-mw='{"name":"ref","body":{"html":"bar"},"attrs":{"name":"b"}}' id="cite_ref-b-2-0" rel="dc:references" typeof="mw:Extension/ref"><a href="#cite_note-b-2">[2]</a></span></p>
14422 <ol about="#mwt7" class="references" data-mw='{"name":"references","body":{"extsrc":"<ref name=\"a\">foo</ref>\nThis should just get lost."},"attrs":{}}' typeof="mw:Extension/references"><li about="#cite_note-a-1" id="cite_note-a-1"><span rel="mw:referencedBy"><a href="#cite_ref-a-1-0">↑</a></span> foo</li><li about="#cite_note-b-2" id="cite_note-b-2"><span rel="mw:referencedBy"><a href="#cite_ref-b-2-0">↑</a></span> bar</li></ol>
14423 !!end
14425 #### ----------------------------------------------------------------
14426 #### The following section of tests are primarily to test
14427 #### wikitext escaping capabilities of Parsoid.  Given that
14428 #### escaping can be done any number of ways, the wikitext (input)
14429 #### is always adjusted to reflect how Parsoid adds nowiki
14430 #### escape tags.
14431 ####
14432 #### We are marking several tests as parsoid-only since the
14433 #### HTML in the result section is different from what the
14434 #### PHP parser generates for it.
14435 #### ----------------------------------------------------------------
14438 #### --------------- Headings ---------------
14439 #### 0. Unnested
14440 #### 1. Nested inside html <h1>=foo=</h1>
14441 #### 2. Outside heading nest on a single line <h1>foo</h1>*bar
14442 #### 3. Nested inside html with wikitext split by html tags
14443 #### 4. No escape needed
14444 #### 5. Empty headings <h1></h1>
14445 #### 6. Heading chars in SOL context
14446 #### ----------------------------------------
14447 !! test
14448 Headings: 0. Unnested
14449 !! options
14450 parsoid
14451 !! input
14452 <nowiki>=foo=</nowiki>
14454 <nowiki> =foo= </nowiki>
14455 <!--cmt-->
14456 <nowiki>=foo=</nowiki>
14458 =foo''a''<nowiki>=</nowiki>
14459 !! result
14460 <p><span typeof="mw:Nowiki">=foo=</span></p>
14462 <p><span typeof="mw:Nowiki"> =foo= </span>
14463 <!--cmt-->
14464 <span typeof="mw:Nowiki">=foo=</span></p>
14466 <p>=foo<i>a</i><span typeof="mw:Nowiki">=</span></p>
14467 !!end
14469 !! test
14470 Headings: 1. Nested inside html
14471 !! options
14472 parsoid
14473 !! input
14474 =<nowiki>=foo=</nowiki>=
14476 ==<nowiki>=foo=</nowiki>==
14478 ===<nowiki>=foo=</nowiki>===
14480 ====<nowiki>=foo=</nowiki>====
14482 =====<nowiki>=foo=</nowiki>=====
14484 ======<nowiki>=foo=</nowiki>======
14485 !! result
14486 <h1><span typeof="mw:Nowiki">=foo=</span></h1>
14487 <h2><span typeof="mw:Nowiki">=foo=</span></h2>
14488 <h3><span typeof="mw:Nowiki">=foo=</span></h3>
14489 <h4><span typeof="mw:Nowiki">=foo=</span></h4>
14490 <h5><span typeof="mw:Nowiki">=foo=</span></h5>
14491 <h6><span typeof="mw:Nowiki">=foo=</span></h6>
14492 !!end
14494 !! test
14495 Headings: 2. Outside heading nest on a single line <h1>foo</h1>*bar
14496 !! options
14497 parsoid
14498 !! input
14499 =foo=
14500 <nowiki>*bar</nowiki>
14502 =foo=
14503 =bar
14505 =foo=
14506 <nowiki>=bar=</nowiki>
14507 !! result
14508 <h1>foo</h1>*bar
14509 <h1>foo</h1>=bar
14510 <h1>foo</h1>=bar=
14511 !!end
14513 !! test
14514 Headings: 3. Nested inside html with wikitext split by html tags
14515 !! options
14516 parsoid
14517 !! input
14518 =='''bold'''<nowiki>foo=</nowiki>=
14519 !! result
14520 <h1>=<b>bold</b><span typeof="mw:Nowiki">foo=</span></h1>
14521 !!end
14523 !! test
14524 Headings: 4a. No escaping needed (testing just h1 and h2)
14525 !! options
14526 parsoid
14527 !! input
14528 ==foo=
14530 =foo==
14532 = =foo= =
14534 ==foo= bar=
14536 ===foo==
14538 ==foo===
14540 =''=''foo==
14542 =<nowiki>=</nowiki>=
14543 !! result
14544 <h1>=foo</h1>
14545 <h1>foo=</h1>
14546 <h1> =foo= </h1>
14547 <h1>=foo= bar</h1>
14548 <h2>=foo</h2>
14549 <h2>foo=</h2>
14550 <h1><i>=</i>foo=</h1>
14551 <h1><span typeof="mw:Nowiki">=</span></h1>
14552 !!end
14554 !! test
14555 Headings: 4b. No escaping needed (inside p-tags)
14556 !! options
14557 parsoid
14558 !! input
14560 =foo= x
14561 =foo= <s></s>
14562 !! result
14563 <p>===
14564 =foo= x
14565 =foo= <s></s>
14566 </p>
14567 !!end
14569 !! test
14570 Headings: 5. Empty headings
14571 !! options
14572 parsoid
14573 !! input
14574 =<nowiki/>=
14576 ==<nowiki/>==
14578 ===<nowiki/>===
14580 ====<nowiki/>====
14582 =====<nowiki/>=====
14584 ======<nowiki/>======
14585 !! result
14586 <h1></h1>
14587 <h2></h2>
14588 <h3></h3>
14589 <h4></h4>
14590 <h5></h5>
14591 <h6></h6>
14592 !!end
14594 !! test
14595 Headings: 6a. Heading chars in SOL context (with trailing spaces)
14596 !! options
14597 parsoid
14598 !! input
14599 !! result
14600 <p>=a=</p>
14601 <p>=a= </p>
14602 <p>=a=  </p>
14603 <p>=a=  </p>
14604 !!end
14606 !! test
14607 Headings: 6b. Heading chars in SOL context (with trailing newlines)
14608 !! options
14609 parsoid
14610 !! input
14611 <nowiki>=a=
14612 b</nowiki>
14614 <nowiki>=a= 
14615 b</nowiki>
14617 <nowiki>=a=     
14618 b</nowiki>
14620 <nowiki>=a=      
14621 b</nowiki>
14622 !! result
14623 <p>=a=
14624 b</p>
14625 <p>=a= 
14626 b</p>
14627 <p>=a=  
14628 b</p>
14629 <p>=a=   
14630 b</p>
14631 </p>
14632 !!end
14634 !! test
14635 Headings: 6c. Heading chars in SOL context (leading newline break)
14636 !! options
14637 parsoid
14638 !! input
14639 <nowiki>a
14640 =b=</nowiki>
14641 !! result
14642 <p>a
14643 =b=</p>
14644 !!end
14646 !! test
14647 Headings: 6d. Heading chars in SOL context (with interspersed comments)
14648 !! options
14649 parsoid
14650 !! input
14651 <!--c0--><nowiki>=a=</nowiki>
14652 <!--c1-->
14653 <nowiki>=a= </nowiki><!--c2-->   <!--c3-->
14654 !! result
14655 <p><!--c0-->=a=</p>
14656 <p><!--c1-->=a= <!--c2-->        <!--c3--></p>
14657 !!end
14659 !! test
14660 Headings: 6d. Heading chars in SOL context (No escaping needed)
14661 !! options
14662 parsoid=html2wt
14663 !! input
14664 =a=<div>b</div>
14665 !! result
14666 =a=<div>b</div>
14667 !!end
14669 #### --------------- Lists ---------------
14670 #### 0. Outside nests (*foo, etc.)
14671 #### 1. Nested inside html <ul><li>*foo</li></ul>
14672 #### 2. Inside definition lists
14673 #### 3. Only bullets at start should be escaped
14674 #### 4. No escapes needed
14675 #### 5. No unnecessary escapes
14676 #### 6. Escape bullets in SOL position
14677 #### 7. Escape bullets in a multi-line context
14678 #### ----------------------------------------
14680 !! test
14681 Lists: 0. Outside nests
14682 !! input
14683 <nowiki>*foo</nowiki>
14685 <nowiki>#foo</nowiki>
14686 !! result
14687 <p>*foo
14688 </p><p>#foo
14689 </p>
14690 !!end
14692 !! test
14693 Lists: 1. Nested inside html
14694 !! input
14695 *<nowiki>*foo</nowiki>
14697 *<nowiki>#foo</nowiki>
14699 *<nowiki>:foo</nowiki>
14701 *<nowiki>;foo</nowiki>
14703 #<nowiki>*foo</nowiki>
14705 #<nowiki>#foo</nowiki>
14707 #<nowiki>:foo</nowiki>
14709 #<nowiki>;foo</nowiki>
14710 !! result
14711 <ul><li>*foo
14712 </li></ul>
14713 <ul><li>#foo
14714 </li></ul>
14715 <ul><li>:foo
14716 </li></ul>
14717 <ul><li>;foo
14718 </li></ul>
14719 <ol><li>*foo
14720 </li></ol>
14721 <ol><li>#foo
14722 </li></ol>
14723 <ol><li>:foo
14724 </li></ol>
14725 <ol><li>;foo
14726 </li></ol>
14728 !!end
14730 !! test
14731 Lists: 2. Inside definition lists
14732 !! input
14733 ;<nowiki>;foo</nowiki>
14735 ;<nowiki>:foo</nowiki>
14737 ;<nowiki>:foo</nowiki>
14738 :bar
14740 :<nowiki>:foo</nowiki>
14741 !! result
14742 <dl><dt>;foo
14743 </dt></dl>
14744 <dl><dt>:foo
14745 </dt></dl>
14746 <dl><dt>:foo
14747 </dt><dd>bar
14748 </dd></dl>
14749 <dl><dd>:foo
14750 </dd></dl>
14752 !!end
14754 !! test
14755 Lists: 3. Only bullets at start of text should be escaped
14756 !! input
14757 *<nowiki>*foo*bar</nowiki>
14759 *<nowiki>*foo</nowiki>''it''*bar
14760 !! result
14761 <ul><li>*foo*bar
14762 </li></ul>
14763 <ul><li>*foo<i>it</i>*bar
14764 </li></ul>
14766 !!end
14768 !! test
14769 Lists: 4. No escapes needed
14770 !! options
14771 parsoid
14772 !! input
14773 *foo*bar
14775 *''foo''*bar
14777 *[[Foo]]: bar
14778 !! result
14779 <ul><li>foo*bar
14780 </li></ul>
14781 <ul><li><i>foo</i>*bar
14782 </li></ul>
14783 <ul><li><a rel="mw:WikiLink" href="Foo">Foo</a>: bar
14784 </li></ul>
14785 !!end
14787 !! test
14788 Lists: 5. No unnecessary escapes
14789 !! input
14790 * bar <span><nowiki>[[foo]]</nowiki></span>
14792 *=bar <span><nowiki>[[foo]]</nowiki></span>
14794 *[[bar <span><nowiki>[[foo]]</nowiki></span>
14796 *]]bar <span><nowiki>[[foo]]</nowiki></span>
14798 *=bar <span>foo]]</span>=
14800 * <s></s>: a
14801 !! result
14802 <ul><li> bar <span>[[foo]]</span>
14803 </li></ul>
14804 <ul><li>=bar <span>[[foo]]</span>
14805 </li></ul>
14806 <ul><li>[[bar <span>[[foo]]</span>
14807 </li></ul>
14808 <ul><li>]]bar <span>[[foo]]</span>
14809 </li></ul>
14810 <ul><li>=bar <span>foo]]</span>=
14811 </li></ul>
14812 <ul><li> <s></s>: a
14813 </li></ul>
14815 !!end
14817 !! test
14818 Lists: 6. Escape bullets in SOL position
14819 !! options
14820 parsoid
14821 !! input
14822 <!--cmt--><nowiki>*foo</nowiki>
14823 !! result
14824 <p><!--cmt--><span typeof="mw:Nowiki">*foo</span></p>
14825 !!end
14827 !! test
14828 Lists: 7. Escape bullets in a multi-line context
14829 !! input
14830 <nowiki>a
14831 *b</nowiki>
14832 !! result
14833 <p>a
14835 </p>
14836 !!end
14838 #### --------------- HRs ---------------
14839 #### 1. Single line
14840 #### -----------------------------------
14842 !! test
14843 HRs: 1. Single line
14844 !! options
14845 parsoid
14846 !! input
14847 ----<nowiki>----</nowiki>
14848 ----=foo=
14849 ----*foo
14850 !! result
14851 <hr><span typeof="mw:Nowiki">----</span>
14852 <hr>=foo=
14853 <hr>*foo
14854 !! end
14856 #### --------------- Tables ---------------
14857 #### 1a. Simple example
14858 #### 1b. No escaping needed (!foo)
14859 #### 1c. No escaping needed (|foo)
14860 #### 1d. No escaping needed (|}foo)
14861 ####
14862 #### 2a. Nested in td (<td>foo|bar</td>)
14863 #### 2b. Nested in td (<td>foo||bar</td>)
14864 #### 2c. Nested in td -- no escaping needed(<td>foo!!bar</td>)
14865 ####
14866 #### 3a. Nested in th (<th>foo!bar</th>)
14867 #### 3b. Nested in th (<th>foo!!bar</th>)
14868 #### 3c. Nested in th -- no escaping needed(<th>foo||bar</th>)
14869 ####
14870 #### 4a. Escape -
14871 #### 4b. Escape +
14872 #### 4c. No escaping needed
14873 #### --------------------------------------
14875 !! test
14876 Tables: 1a. Simple example
14877 !! input
14878 <nowiki>{|
14879 |}</nowiki>
14880 !! result
14881 <p>{|
14883 </p>
14884 !! end
14886 !! test
14887 Tables: 1b. No escaping needed
14888 !! input
14889 !foo
14890 !! result
14891 <p>!foo
14892 </p>
14893 !! end
14895 !! test
14896 Tables: 1c. No escaping needed
14897 !! input
14898 |foo
14899 !! result
14900 <p>|foo
14901 </p>
14902 !! end
14904 !! test
14905 Tables: 1d. No escaping needed
14906 !! input
14907 |}foo
14908 !! result
14909 <p>|}foo
14910 </p>
14911 !! end
14913 !! test
14914 Tables: 2a. Nested in td
14915 !! options
14916 parsoid
14917 !! input
14919 |<nowiki>foo|bar</nowiki>
14921 !! result
14922 <table><tbody><tr>
14923 <td><span typeof="mw:Nowiki">foo|bar</span></td></tr></tbody></table>
14924 !! end
14926 !! test
14927 Tables: 2b. Nested in td
14928 !! options
14929 parsoid
14930 !! input
14932 |<nowiki>foo||bar</nowiki>
14933 |''it''<nowiki>foo||bar</nowiki>
14935 !! result
14936 <table><tbody><tr>
14937 <td><span typeof="mw:Nowiki">foo||bar</span></td>
14938 <td><i>it</i><span typeof="mw:Nowiki">foo||bar</span></td></tr></tbody></table>
14939 !! end
14941 !! test
14942 Tables: 2c. Nested in td -- no escaping needed
14943 !! options
14944 parsoid
14945 !! input
14947 |foo!!bar
14949 !! result
14950 <table><tbody><tr><td>foo!!bar
14951 </td></tr></tbody></table>
14953 !! end
14955 !! test
14956 Tables: 3a. Nested in th
14957 !! options
14958 parsoid
14959 !! input
14961 !foo!bar
14963 !! result
14964 <table><tbody><tr><th>foo!bar
14965 </th></tr></tbody></table>
14967 !! end
14969 !! test
14970 Tables: 3b. Nested in th
14971 !! options
14972 parsoid
14973 !! input
14975 !<nowiki>foo!!bar</nowiki>
14977 !! result
14978 <table>
14979 <tbody><tr><th><span typeof="mw:Nowiki">foo!!bar</span></th></tr>
14980 </tbody></table>
14981 !! end
14983 !! test
14984 Tables: 3c. Nested in th -- no escaping needed
14985 !! options
14986 parsoid
14987 !! input
14989 !<nowiki>foo||bar</nowiki>
14991 !! result
14992 <table><tbody><tr>
14993 <th><span typeof="mw:Nowiki">foo||bar</span></th></tr></tbody></table>
14994 !! end
14996 !! test
14997 Tables: 4a. Escape -
14998 !! options
14999 parsoid
15000 !! input
15003 !-bar
15005 |<nowiki>-bar</nowiki>
15007 !! result
15008 <table><tbody>
15009 <tr><th>-bar</th></tr>
15010 <tr>
15011 <td><span typeof="mw:Nowiki">-bar</span></td></tr></tbody></table>
15012 !! end
15014 !! test
15015 Tables: 4b. Escape +
15016 !! options
15017 parsoid
15018 !! input
15021 !+bar
15023 |<nowiki>+bar</nowiki>
15025 !! result
15026 <table><tbody>
15027 <tr><th>+bar</th></tr>
15028 <tr>
15029 <td><span typeof="mw:Nowiki">+bar</span></td></tr></tbody></table>
15030 !! end
15032 !! test
15033 Tables: 4c. No escaping needed
15034 !! options
15035 parsoid
15036 !! input
15039 |foo-bar
15040 |foo+bar
15042 |''foo''-bar
15043 |''foo''+bar
15045 !! result
15046 <table><tbody>
15047 <tr><td>foo-bar</td><td>foo+bar</td></tr>
15048 <tr><td><i>foo</i>-bar</td><td><i>foo</i>+bar</td></tr>
15049 </tbody></table>
15050 !! end
15052 ### SSS FIXME: Disabled right now because accurate html2wt
15053 ### on this snippet requires data-parsoid flags that we've
15054 ### stripped out of these tests.  We should scheme how we
15055 ### we want to handle these kind of tests that require
15056 ### data-parsoid flags for accurate html2wt serialization
15058 !! test
15059 Tables: 4d. No escaping needed
15060 !! options
15061 disabled
15062 !! input
15064 ||+1
15065 ||-2
15067 !! result
15068 <table>
15069 <tr>
15070 <td>+1
15071 </td>
15072 <td>-2
15073 </td></tr></table>
15075 !! end
15077 #### --------------- Links ----------------
15078 #### 1. Quote marks in link text
15079 #### 2. Wikilinks: Escapes needed
15080 #### 3. Wikilinks: No escapes needed
15081 #### 4. Extlinks: Escapes needed
15082 #### 5. Extlinks: No escapes needed
15083 #### --------------------------------------
15084 !! test
15085 Links 1. Quote marks in link text
15086 !! options
15087 parsoid
15088 !! input
15089 [[Foo|<nowiki>Foo''boo''</nowiki>]]
15090 !! result
15091 <a rel="mw:WikiLink" href="Foo">Foo''boo''</a>
15092 !! end
15094 !! test
15095 Links 2. WikiLinks: Escapes needed
15096 !! options
15097 parsoid
15098 !! input
15099 [[Foo|<nowiki>[Foobar]</nowiki>]]
15100 [[Foo|<nowiki>Foobar]</nowiki>]]
15101 [[Foo|x [Foobar] x]]
15102 [[Foo|<nowiki>x [http://google.com g] x</nowiki>]]
15103 [[Foo|<nowiki>[[Bar]]</nowiki>]]
15104 [[Foo|<nowiki>x [[Bar]] x</nowiki>]]
15105 [[Foo|<nowiki>|Bar</nowiki>]]
15106 [[Foo|<nowiki>]]bar</nowiki>]]
15107 [[Foo|<nowiki>[[bar</nowiki>]]
15108 [[Foo|<nowiki>x ]] y [[ z</nowiki>]]
15109 !! result
15110 <a href="Foo" rel="mw:WikiLink">[Foobar]</a>
15111 <a href="Foo" rel="mw:WikiLink">Foobar]</a>
15112 <a href="Foo" rel="mw:WikiLink">x [Foobar] x</a>
15113 <a href="Foo" rel="mw:WikiLink">x [http://google.com g] x</a>
15114 <a href="Foo" rel="mw:WikiLink">[[Bar]]</a>
15115 <a href="Foo" rel="mw:WikiLink">x [[Bar]] x</a>
15116 <a href="Foo" rel="mw:WikiLink">|Bar</a>
15117 <a href="Foo" rel="mw:WikiLink">]]bar</a>
15118 <a href="Foo" rel="mw:WikiLink">[[bar</a>
15119 <a href="Foo" rel="mw:WikiLink">x ]] y [[ z</a>
15120 !! end
15122 !! test
15123 Links 3. WikiLinks: No escapes needed
15124 !! options
15125 parsoid
15126 !! input
15127 [[Foo|[Foobar]]
15128 [[Foo|foo|bar]]
15129 !! result
15130 <a href="Foo" rel="mw:WikiLink">[Foobar</a>
15131 <a href="Foo" rel="mw:WikiLink">foo|bar</a>
15132 !! end
15134 !! test
15135 Links 4. ExtLinks: Escapes needed
15136 !! options
15137 parsoid
15138 !! input
15139 [http://google.com <nowiki>[google]</nowiki>]
15140 [http://google.com <nowiki>google]</nowiki>]
15141 !! result
15142 <a href="http://google.com" rel="mw:ExtLink">[google]</a>
15143 <a href="http://google.com" rel="mw:ExtLink">google]</a>
15144 !! end
15146 !! test
15147 Links 5. ExtLinks: No escapes needed
15148 !! options
15149 parsoid
15150 !! input
15151 [http://google.com [google]
15152 !! result
15153 <a href="http://google.com" rel="mw:ExtLink">[google</a>
15154 !! end
15156 #### --------------- Quotes ---------------
15157 #### 1. Quotes inside <b> and <i>
15158 #### 2. Link fragments separated by <i> and <b> tags
15159 #### 3. Link fragments inside <i> and <b>
15160 #### --------------------------------------
15161 !! test
15162 1. Quotes inside <b> and <i>
15163 !! input
15164 ''<nowiki>'foo'</nowiki>''
15165 ''<nowiki>''foo''</nowiki>''
15166 ''<nowiki>'''foo'''</nowiki>''
15167 '''<nowiki>'foo'</nowiki>'''
15168 '''<nowiki>''foo''</nowiki>'''
15169 '''<nowiki>'''foo'''</nowiki>'''
15170 '''<nowiki>foo'</nowiki>''<nowiki>bar'</nowiki>''baz'''
15171 !! result
15172 <p><i>'foo'</i>
15173 <i>''foo''</i>
15174 <i>'''foo'''</i>
15175 <b>'foo'</b>
15176 <b>''foo''</b>
15177 <b>'''foo'''</b>
15178 <b>foo'<i>bar'</i>baz</b>
15179 </p>
15180 !! end
15182 !! test
15183 2. Link fragments separated by <i> and <b> tags
15184 !! input
15185 [[''foo''<nowiki>hello]]</nowiki>
15187 [['''foo'''<nowiki>hello]]</nowiki>
15188 !! result
15189 <p>[[<i>foo</i>hello]]
15190 </p><p>[[<b>foo</b>hello]]
15191 </p>
15192 !! end
15194 !! test
15195 2. Link fragments inside <i> and <b>
15196 (FIXME: Escaping one or both of [[ and ]] is also acceptable --
15197  this is one of the shortcomings of this format)
15198 !! input
15199 ''[[foo''<nowiki>]]</nowiki>
15201 '''[[foo'''<nowiki>]]</nowiki>
15202 !! result
15203 <p><i>[[foo</i>]]
15204 </p><p><b>[[foo</b>]]
15205 </p>
15206 !! end
15208 #### ----------- Paragraphs ---------------
15209 #### 1. No unnecessary escapes
15210 #### --------------------------------------
15212 !! test
15213 1. No unnecessary escapes
15214 !! input
15215 bar <span><nowiki>[[foo]]</nowiki></span>
15217 =bar <span><nowiki>[[foo]]</nowiki></span>
15219 [[bar <span><nowiki>[[foo]]</nowiki></span>
15221 ]]bar <span><nowiki>[[foo]]</nowiki></span>
15223 =bar <span>foo]]</span><nowiki>=</nowiki>
15224 !! result
15225 <p>bar <span>[[foo]]</span>
15226 </p><p>=bar <span>[[foo]]</span>
15227 </p><p>[[bar <span>[[foo]]</span>
15228 </p><p>]]bar <span>[[foo]]</span>
15229 </p><p>=bar <span>foo]]</span>=
15230 </p>
15231 !!end
15233 #### ----------------------- PRE --------------------------
15234 #### 1. Leading whitespace in SOL context should be escaped
15235 #### ------------------------------------------------------
15236 !! test
15237 1. Leading whitespace in SOL context should be escaped
15238 !! options
15239 parsoid
15240 !! input
15241 <nowiki> a</nowiki>
15243 <nowiki>  a</nowiki>
15245 <nowiki>        a(tab)</nowiki>
15247 <nowiki>        a</nowiki>
15248 <!--cmt-->
15249 <nowiki>  a</nowiki>
15251 <nowiki>a
15252  b</nowiki>
15254 <nowiki>a
15255         b</nowiki>
15257 <nowiki>a
15258          b</nowiki>
15259 !! result
15260 <p> a</p>
15261 <p>  a</p>
15262 <p>     a(tab)</p>
15263 <p>     a</p>
15264 <p><!--cmt-->  a</p>
15265 <p>a
15266  b</p>
15267 <p>a
15268         b</p>
15269 <p>a
15270          b</p>
15271 !! end
15273 #### --------------- HTML tags ---------------
15274 #### 1. a tags
15275 #### 2. other tags
15276 #### 3. multi-line html tag
15277 #### -----------------------------------------
15278 !! test
15279 1. a tags
15280 !! options
15281 parsoid
15282 !! input
15283 <a href="http://google.com">google</a>
15284 !! result
15285 &lt;a href=&quot;http://google.com&quot;&gt;google&lt;/a&gt;
15286 !! end
15288 !! test
15289 2. other tags
15290 !! input
15291 <nowiki><div>foo</div>
15292 <div style="color:red">foo</div></nowiki>
15293 !! result
15294 <p>&lt;div&gt;foo&lt;/div&gt;
15295 &lt;div style=&quot;color:red&quot;&gt;foo&lt;/div&gt;
15296 </p>
15297 !! end
15299 !! test
15300 3. multi-line html tag
15301 !! input
15302 <nowiki><div
15303 >foo</div
15304 ></nowiki>
15305 !! result
15306 <p>&lt;div
15307 &gt;foo&lt;/div
15308 &gt;
15309 </p>
15310 !! end
15312 #### --------------- Others ---------------
15313 !! test
15314 Escaping nowikis
15315 !! input
15316 &lt;nowiki&gt;foo&lt;/nowiki&gt;
15317 !! result
15318 <p>&lt;nowiki&gt;foo&lt;/nowiki&gt;
15319 </p>
15320 !! end
15321 !! test
15323 Tag-like HTML structures are passed through as text
15324 !! input
15325 <x y>
15327 <x.y>
15329 <x-y>
15337 1<d e>f
15338 !! result
15339 <p>&lt;x y&gt;
15340 </p><p>&lt;x.y&gt;
15341 </p><p>&lt;x-y&gt;
15342 </p><p>1&gt;2
15343 </p><p>x&lt;y
15344 </p><p>a&gt;b
15345 </p><p>1&lt;d e&gt;f
15346 </p>
15347 !! end
15350 # This fails in the PHP parser (see bug 40670,
15351 # https://bugzilla.wikimedia.org/show_bug.cgi?id=40670), so disabled for it.
15352 !! test
15353 Tag names followed by punctuation should not be recognized as tags
15354 !! options
15355 parsoid
15356 !! input
15357 <s.ome> text
15358 !! result
15359 <p>&lt;s.ome&gt; text
15360 </p>
15361 !! end
15363 !! test
15364 HTML tag with necessary entities in attributes
15365 !! input
15366 <span title="&amp;amp;">foo</span>
15367 !! result
15368 <p><span title="&amp;amp;">foo</span>
15369 </p>
15370 !! end
15372 !! test
15373 HTML tag with 'unnecessary' entity encoding in attributes
15374 !! input
15375 <span title="&amp;">foo</span>
15376 !! result
15377 <p><span title="&amp;">foo</span>
15378 </p>
15379 !! end
15381 !! test
15382 HTML tag with broken attribute value quoting
15383 !! input
15384 <span title="Hello world>Foo</span>
15385 !! result
15386 <p><span>Foo</span>
15387 </p>
15388 !! end
15390 !! test
15391 Parsoid-only: HTML tag with broken attribute value quoting
15392 !! options
15393 parsoid
15394 !! input
15395 <span title="Hello world>Foo</span>
15396 !! result
15397 <p><span title="Hello world">Foo</span>
15398 </p>
15399 !! end
15401 !! test
15402 Table with broken attribute value quoting
15403 !! input
15405 | title="Hello world|Foo
15407 !! result
15408 <table>
15409 <tr>
15410 <td>Foo
15411 </td></tr></table>
15413 !! end
15415 !! test
15416 Table with broken attribute value quoting on consecutive lines
15417 !! input
15419 | title="Hello world|Foo
15420 | style="color:red|Bar
15422 !! result
15423 <table>
15424 <tr>
15425 <td>Foo
15426 </td>
15427 <td>Bar
15428 </td></tr></table>
15430 !! end
15432 !! test
15433 Parsoid-only: Table with broken attribute value quoting on consecutive lines
15434 !! options
15435 parsoid
15436 !! input
15438 | title="Hello world|Foo
15439 | style="color:red|Bar
15441 !! result
15442 <table><tbody>
15443 <tr>
15444 <td title="Hello world">Foo
15445 </td><td style="color: red">Bar
15446 </td></tr></tbody></table>
15448 !! end
15450 !! test
15451 Parsoid-only: Don't wrap broken template tags in <nowiki> on wt2wt (Bug 42353)
15452 !! options
15453 parsoid
15454 !! input
15455 {{}}
15456 !! result
15457 {{}}
15458 !! end
15460 !! test
15461 Parsoid-only: Don't wrap broken template tags in <nowiki> on wt2wt (Bug 42353)
15462 !! options
15463 parsoid
15464 !! input
15465 }}{{
15466 !! result
15467 }}{{
15468 !! end
15470 !!test
15471 Accept empty td cell attribute
15472 !!input
15474 | align="center" | foo ||  |
15476 !!result
15477 <table>
15478 <tr>
15479 <td align="center"> foo </td>
15480 <td>
15481 </td></tr></table>
15483 !!end
15485 !!test
15486 Non-empty attributes in th-cells
15487 !!input
15489 ! Foo !! style="color: red" | Bar
15491 !!result
15492 <table>
15493 <tr>
15494 <th> Foo </th>
15495 <th style="color: red"> Bar
15496 </th></tr></table>
15498 !!end
15500 !!test
15501 Accept empty attributes in th-cells
15502 !!input
15504 !| foo !!| bar
15506 !!result
15507 <table>
15508 <tr>
15509 <th> foo </th>
15510 <th> bar
15511 </th></tr></table>
15513 !!end
15515 !!test
15516 Empty table rows go away
15517 !!input
15519 | Hello
15520 | there
15521 |- class="foo"
15524 !! result
15525 <table>
15526 <tr>
15527 <td> Hello
15528 </td>
15529 <td> there
15530 </td></tr>
15532 </table>
15534 !! end
15537 ### Parsoid-centric tests for testing RTing of inter-element separators
15538 ### Edge cases not tested by existing parser tests and specific to
15539 ### Parsoid-specific serialization strategies.
15542 !!test
15543 RT-ed inter-element separators should be valid separators
15544 !!input
15546 |- [[foo]]
15548 !!result
15549 <table>
15551 </table>
15553 !!end
15555 !!test
15556 Trailing newlines in a deep dom-subtree that ends a wikitext line should be migrated out
15557 (Parsoid-only since PHP parser relies on Tidy for correct output)
15558 !!options
15559 parsoid
15560 !!input
15562 |<small>foo
15567 |<small>foo<small>
15569 !!result
15570 !!end
15572 !!test
15573 Empty TD followed by TD with tpl-generated attribute
15574 !!input
15578 |{{echo|style='color:red'}}|foo
15580 !!result
15581 <table>
15583 <tr>
15584 <td>
15585 </td>
15586 <td>foo
15587 </td></tr></table>
15589 !!end
15591 !!test
15592 Indented table with an empty td
15593 !!input
15594  {|
15595  |-
15597  |foo
15598  |}
15599 !!result
15600 <table>
15602 <tr>
15603 <td>
15604 </td>
15605 <td>foo
15606 </td></tr></table>
15608 !!end
15610 !!test
15611 Empty TR followed by a template-generated TR
15612 (Parsoid-specific since PHP parser doesn't handle this mixed tbl-wikitext)
15613 !!options
15614 parsoid=wt2html,wt2wt
15615 !!input
15618 {{echo|<tr><td>foo</td></tr>}}
15620 !!result
15621 <table>
15622 <tbody>
15623 <tr></tr>
15624 <tr typeof="mw:Transclusion">
15625 <td>foo</td></tr></tbody></table>
15626 !!end
15628 ## PHP and parsoid output differ for this, and since this is primarily
15629 ## for testing Parsoid's serializer, marking this Parsoid only
15630 !!test
15631 Empty TR followed by mixed-ws-comment line should RT correctly
15632 !!options
15633 parsoid
15634 !!input
15637  <!--c-->
15639 <!--c--> <!--d-->
15641 !!result
15642 <table>
15643 <tbody>
15644 <tr>
15645 <td> <!--c--></td></tr>
15646 <tr>
15647 <td><!--c--> <!--d--></td></tr>
15648 </tbody></table>
15650 !!end
15652 !!test
15653 Multi-line image caption generated by templates with/without trailing newlines
15654 !!options
15655 parsoid
15656 !!input
15657 [[File:foo.jpg|thumb|300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}]]
15658 [[File:foo.jpg|thumb|300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}\n\n]]
15659 !!result
15660 <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>
15661 <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>
15663 !!end
15665 ## PHP emits broken html for this, and since this is primarily
15666 ## a Parsoid serializer test, marking this Parsoid only
15667 !!test
15668 Improperly nested inline or quotes tags with whitespace in between
15669 !!options
15670 parsoid
15671 !!input
15672 <span> <s>x</span> </s>
15673 ''' ''x''' ''
15674 !!result
15675 <p><span> <s>x</s></span><s> </s>
15676 <b> <i>x</i></b><i> </i>
15677 </p>
15678 !!end
15681 TODO:
15682 more images
15683 more tables
15684 character entities
15685 and much more
15686 Try for 100% code coverage