Remove superfluous re- from confirmemail_body_set
[mediawiki.git] / tests / parser / parserTests.txt
blobf4a85bc325a3874cdbcdcc6a66a99a83bcb093fa
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 # You can also set the following parser properties via test options:
31 #  wgEnableUploads, wgAllowExternalImages, wgMaxTocLevel,
32 #  wgLinkHolderBatchSize, wgRawHtml
34 # For testing purposes, temporary articles can created:
35 # !!article / NAMESPACE:TITLE / !!text / ARTICLE TEXT / !!endarticle
36 # where '/' denotes a newline.
38 # This is the standard article assumed to exist.
39 !! article
40 Main Page
41 !! text
42 blah blah
43 !! endarticle
45 !!article
46 Template:Foo
47 !!text
48 FOO
49 !!endarticle
51 !! article
52 Template:Blank
53 !! text
54 !! endarticle
56 !! article
57 Template:pipe
58 !! text
60 !! endarticle
62 !!article
63 MediaWiki:bad image list
64 !!text
65 * [[File:Bad.jpg]] except [[Nasty page]]
66 !!endarticle
68 !! article
69 Template:inner list
70 !! text
71 * item 1
72 !! endarticle
74 !! article
75 Template:tbl-start
76 !! text
78 !! endarticle
80 !! article
81 Template:tbl-end
82 !! text
84 !! endarticle
86 !! article
87 Template:!
88 !! text
90 !! endarticle
92 !! article
93 Template:echo
94 !! text
95 {{{1}}}
96 !! endarticle
98 !! article
99 Template:echo_with_span
100 !! text
101 <span>{{{1}}}</span>
102 !! endarticle
104 !! article
105 Template:echo_with_div
106 !! text
107 <div>{{{1}}}</div>
108 !! endarticle
110 !! article
111 Template:attr_str
112 !! text
113 {{{1}}}="{{{2}}}"
114 !! endarticle
116 !! article
117 Template:table_attribs
118 !! text
119 <noinclude>
120 |</noinclude>style="color: red"| Foo
121 !! endarticle
123 !! article
124 Template:table_cells
125 !! text
126 {{table_attribs}} || Bar || Baz
127 !! endarticle
129 !! article
130 Template:image_attribs
131 !! text
132 <noinclude>
133 [[File:foobar.jpg|</noinclude>right|Caption text<noinclude>]]</noinclude>
134 !! endarticle
136 !! article
138 !! text
139 Weirdo titles!
140 !! endarticle
143 ### Basic tests
145 !! test
146 Blank input
147 !! input
148 !! result
149 !! end
152 !! test
153 Simple paragraph
154 !! input
155 This is a simple paragraph.
156 !! result
157 <p>This is a simple paragraph.
158 </p>
159 !! end
161 !! test
162 Paragraphs with extra newline spacing
163 !! input
173 booz
174 !! result
175 <p>foo
176 </p><p>bar
177 </p><p><br />
179 </p><p><br />
180 </p><p>booz
181 </p>
182 !! end
184 !! test
185 Paragraphs with newline spacing with comment lines in between
186 !! input
187 ----
189 <!--foo-->
191 ----
193 <!--foo--><!--More than 1 comment disables stripping of this line!-->
195 ----
197 <!--foo-->
200 ----
203 <!--foo-->
205 ----
207 <!--foo-->
211 ----
215 <!--foo-->
217 ----
218 !! result
219 <hr />
220 <p>a
222 </p>
223 <hr />
224 <p>a
225 </p><p>b
226 </p>
227 <hr />
228 <p>a
229 </p><p>b
230 </p>
231 <hr />
232 <p>a
233 </p><p>b
234 </p>
235 <hr />
236 <p>a
237 </p><p><br />
239 </p>
240 <hr />
241 <p>a
242 </p><p><br />
244 </p>
245 <hr />
247 !! end
249 !! test
250 Paragraphs with newline spacing with non-empty white-space lines in between
251 !! input
252 ----
256 ----
261 ----
262 !! result
263 <hr />
264 <p>a
265 </p><p>b
266 </p>
267 <hr />
268 <p>a
269 </p><p><br /> 
271 </p>
272 <hr />
274 !! end
276 !! test
277 Paragraphs with newline spacing with non-empty mixed comment and white-space lines in between
278 !! input
279 ----
281  <!--foo-->
283 ----
285  <!--foo--><!--More than 1 comment disables stripping of this line!-->
287 ----
290 <!--foo-->
291  <!--bar-->
293 ----
296  <!--foo-->
297  <!--bar-->
300 ----
301 !! result
302 <hr />
303 <p>a
305 </p>
306 <hr />
307 <p>a
308 </p><p>b
309 </p>
310 <hr />
311 <p>a
312 </p><p>b
313 </p>
314 <hr />
315 <p>a
316 </p><p><br /> 
318 </p>
319 <hr />
321 !! end
323 !! test
324 Extra newlines: More paragraphs with indented comment
325 !! input
328    <!--boo-->
331 !!result
332 <p>a
333 </p><p><br />
335 </p>
336 !!end
338 !! test
339 Extra newlines followed by heading
340 !! input
346 [[a]]
350 !! result
351 <p>a
352 </p><p><br />
353 </p>
354 <h1><span class="mw-headline" id="b">b</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: b">edit</a><span class="mw-editsection-bracket">]</span></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><p><br />
357 </p>
358 <h1><span class="mw-headline" id="b_2">b</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: b">edit</a><span class="mw-editsection-bracket">]</span></span></h1>
360 !! end
362 !! test
363 Extra newlines between heading and content are swallowed
364 !! input
369 [[a]]
370 !! result
371 <h1><span class="mw-headline" id="b">b</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: b">edit</a><span class="mw-editsection-bracket">]</span></span></h1>
372 <p><a href="/index.php?title=A&amp;action=edit&amp;redlink=1" class="new" title="A (page does not exist)">a</a>
373 </p>
374 !! end
376 !! test
377 Parsing an URL
378 !! input
379 http://fr.wikipedia.org/wiki/🍺
380 <!-- EasterEgg we love beer, better be able be able to link to it -->
381 !! result
382 <p><a rel="nofollow" class="external free" href="http://fr.wikipedia.org/wiki/🍺">http://fr.wikipedia.org/wiki/🍺</a>
383 </p>
384 !! end
386 !! test
387 Simple list
388 !! input
389 * Item 1
390 * Item 2
391 !! result
392 <ul><li> Item 1
393 </li><li> Item 2
394 </li></ul>
396 !! end
398 !! test
399 Italics and bold
400 !! input
401 * plain
402 * plain''italic''plain
403 * plain''italic''plain''italic''plain
404 * plain'''bold'''plain
405 * plain'''bold'''plain'''bold'''plain
406 * plain''italic''plain'''bold'''plain
407 * plain'''bold'''plain''italic''plain
408 * plain''italic'''bold-italic'''italic''plain
409 * plain'''bold''bold-italic''bold'''plain
410 * plain'''''bold-italic'''italic''plain
411 * plain'''''bold-italic''bold'''plain
412 * plain''italic'''bold-italic'''''plain
413 * plain'''bold''bold-italic'''''plain
414 * plain l'''italic''plain
415 * plain l''''bold''' plain
416 !! result
417 <ul><li> plain
418 </li><li> plain<i>italic</i>plain
419 </li><li> plain<i>italic</i>plain<i>italic</i>plain
420 </li><li> plain<b>bold</b>plain
421 </li><li> plain<b>bold</b>plain<b>bold</b>plain
422 </li><li> plain<i>italic</i>plain<b>bold</b>plain
423 </li><li> plain<b>bold</b>plain<i>italic</i>plain
424 </li><li> plain<i>italic<b>bold-italic</b>italic</i>plain
425 </li><li> plain<b>bold<i>bold-italic</i>bold</b>plain
426 </li><li> plain<i><b>bold-italic</b>italic</i>plain
427 </li><li> plain<b><i>bold-italic</i>bold</b>plain
428 </li><li> plain<i>italic<b>bold-italic</b></i>plain
429 </li><li> plain<b>bold<i>bold-italic</i></b>plain
430 </li><li> plain l'<i>italic</i>plain
431 </li><li> plain l'<b>bold</b> plain
432 </li></ul>
434 !! end
436 # this example taken from the simple/Moon article
437 !! test
438 Italics and possessives
439 !! input
440 obtained by ''[[Lunar Prospector]]'''s gamma-ray spectrometer
441 !! result
442 <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
443 </p>
444 !! end
447 ### 2-quote opening sequence tests
449 !! test
450 Italics and bold: 2-quote opening sequence: (2,2)
451 !! input
452 ''foo''
453 !! result
454 <p><i>foo</i>
455 </p>
456 !!end
459 !! test
460 Italics and bold: 2-quote opening sequence: (2,3)
461 !! input
462 ''foo'''
463 !! result
464 <p><i>foo'</i>
465 </p>
466 !!end
469 !! test
470 Italics and bold: 2-quote opening sequence: (2,4)
471 !! input
472 ''foo''''
473 !! result
474 <p><i>foo''</i>
475 </p>
476 !!end
479 !! test
480 Italics and bold: 2-quote opening sequence: (2,5) (php)
481 !! options
483 !! input
484 ''foo'''''
485 !! result
486 <p><i>foo</i>
487 </p>
488 !!end
489 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
490 !! test
491 Italics and bold: 2-quote opening sequence: (2,5) (parsoid)
492 !! options
493 parsoid
494 !! input
495 ''foo'''''
496 !! result
497 <p><i>foo</i><b></b>
498 </p>
499 !!end
503 ### 3-quote opening sequence tests
506 !! test
507 Italics and bold: 3-quote opening sequence: (3,2)
508 !! input
509 '''foo''
510 !! result
511 <p>'<i>foo</i>
512 </p>
513 !!end
516 !! test
517 Italics and bold: 3-quote opening sequence: (3,3)
518 !! input
519 '''foo'''
520 !! result
521 <p><b>foo</b>
522 </p>
523 !!end
526 !! test
527 Italics and bold: 3-quote opening sequence: (3,4)
528 !! input
529 '''foo''''
530 !! result
531 <p><b>foo'</b>
532 </p>
533 !!end
536 !! test
537 Italics and bold: 3-quote opening sequence: (3,5) (php)
538 !! options
540 !! input
541 '''foo'''''
542 !! result
543 <p><b>foo</b>
544 </p>
545 !!end
546 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
547 !! test
548 Italics and bold: 3-quote opening sequence: (3,5) (parsoid)
549 !! options
550 parsoid
551 !! input
552 '''foo'''''
553 !! result
554 <p><b>foo<i></i></b>
555 </p>
556 !!end
560 ### 4-quote opening sequence tests
563 !! test
564 Italics and bold: 4-quote opening sequence: (4,2)
565 !! input
566 ''''foo''
567 !! result
568 <p>''<i>foo</i>
569 </p>
570 !!end
573 !! test
574 Italics and bold: 4-quote opening sequence: (4,3)
575 !! input
576 ''''foo'''
577 !! result
578 <p>'<b>foo</b>
579 </p>
580 !!end
583 !! test
584 Italics and bold: 4-quote opening sequence: (4,4)
585 !! input
586 ''''foo''''
587 !! result
588 <p>'<b>foo'</b>
589 </p>
590 !!end
593 !! test
594 Italics and bold: 4-quote opening sequence: (4,5) (php)
595 !! options
597 !! input
598 ''''foo'''''
599 !! result
600 <p>'<b>foo</b>
601 </p>
602 !!end
603 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
604 !! test
605 Italics and bold: 4-quote opening sequence: (4,5) (parsoid)
606 !! options
607 parsoid
608 !! input
609 ''''foo'''''
610 !! result
611 <p>'<b>foo<i></i></b>
612 </p>
613 !!end
617 ### 5-quote opening sequence tests
620 !! test
621 Italics and bold: 5-quote opening sequence: (5,2) (php)
622 !! options
624 !! input
625 '''''foo''
626 !! result
627 <p><b><i>foo</i></b>
628 </p>
629 !!end
630 # Parsoid reverses the nesting order, compared to the PHP parser
631 !! test
632 Italics and bold: 5-quote opening sequence: (5,2) (parsoid)
633 !! options
634 parsoid
635 !! input
636 '''''foo''
637 !! result
638 <p><i><b>foo</b></i>
639 </p>
640 !!end
643 !! test
644 Italics and bold: 5-quote opening sequence: (5,3)
645 !! input
646 '''''foo'''
647 !! result
648 <p><i><b>foo</b></i>
649 </p>
650 !!end
653 !! test
654 Italics and bold: 5-quote opening sequence: (5,4)
655 !! input
656 '''''foo''''
657 !! result
658 <p><i><b>foo'</b></i>
659 </p>
660 !!end
663 !! test
664 Italics and bold: 5-quote opening sequence: (5,5)
665 !! input
666 '''''foo'''''
667 !! result
668 <p><i><b>foo</b></i>
669 </p>
670 !!end
673 ### multiple quote sequences in a line
675 !! test
676 Italics and bold: multiple quote sequences: (2,4,2)
677 !! input
678 ''foo''''bar''
679 !! result
680 <p><i>foo'<b>bar</b></i>
681 </p>
682 !!end
685 !! test
686 Italics and bold: multiple quote sequences: (2,4,3)
687 !! input
688 ''foo''''bar'''
689 !! result
690 <p><i>foo'<b>bar</b></i>
691 </p>
692 !!end
695 !! test
696 Italics and bold: multiple quote sequences: (2,4,4)
697 !! input
698 ''foo''''bar''''
699 !! result
700 <p><i>foo'<b>bar'</b></i>
701 </p>
702 !!end
705 !! test
706 Italics and bold: multiple quote sequences: (3,4,2) (php)
707 !! options
709 !! input
710 '''foo''''bar''
711 !! result
712 <p><b>foo'</b>bar
713 </p>
714 !!end
715 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
716 !! test
717 Italics and bold: multiple quote sequences: (3,4,2) (parsoid)
718 !! options
719 parsoid
720 !! input
721 '''foo''''bar''
722 !! result
723 <p><b>foo'</b>bar<i></i>
724 </p>
725 !!end
728 !! test
729 Italics and bold: multiple quote sequences: (3,4,3) (php)
730 !! options
732 !! input
733 '''foo''''bar'''
734 !! result
735 <p><b>foo'</b>bar
736 </p>
737 !!end
738 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
739 !! test
740 Italics and bold: multiple quote sequences: (3,4,3) (parsoid)
741 !! options
742 parsoid
743 !! input
744 '''foo''''bar'''
745 !! result
746 <p><b>foo'</b>bar<b></b>
747 </p>
748 !!end
751 ### other quote tests
753 !! test
754 Italics and bold: other quote tests: (2,3,5)
755 !! input
756 ''this is about '''foo's family'''''
757 !! result
758 <p><i>this is about <b>foo's family</b></i>
759 </p>
760 !!end
763 !! test
764 Italics and bold: other quote tests: (2,(3,3),2)
765 !! input
766 ''this is about '''foo's''' family''
767 !! result
768 <p><i>this is about <b>foo's</b> family</i>
769 </p>
770 !!end
773 !! test
774 Italics and bold: other quote tests: (3,2,3,2)
775 !! input
776 '''this is about ''foo'''s family''
777 !! result
778 <p><b>this is about <i>foo</i></b><i>s family</i>
779 </p>
780 !!end
783 # The Parsoid team believes the PHP parser's output on this test is wrong.
784 # It only checks for convert-to-bold-on-single-character-word when the word
785 # matches with a bold tag ("'''") that is *odd* in the list of quote tokens.
786 # This means that the bold token in position 2 (0-indexed) gets converted by
787 # parsoid, but doesn't get changed by the PHP parser.
788 !! test
789 Italics and bold: other quote tests: (3,2,3,3) (php)
790 !! options
792 !! input
793 '''this is about ''foo'''s family'''
794 !! result
795 <p>'<i>this is about </i>foo<b>s family</b>
796 </p>
797 !!end
798 # This is the output the Parsoid team believes to be correct.
799 !! test
800 Italics and bold: other quote tests: (3,2,3,3) (parsoid)
801 !! options
802 parsoid
803 !! input
804 '''this is about ''foo'''s family'''
805 !! result
806 <p><b>this is about <i>foo'</i>s family</b>
807 </p>
808 !!end
811 !! test
812 Italics and bold: other quote tests: (3,(2,2),3)
813 !! input
814 '''this is about ''foo's'' family'''
815 !! result
816 <p><b>this is about <i>foo's</i> family</b>
817 </p>
818 !!end
821 !! test
822 Italicized possessive
823 !! input
824 The ''[[Main Page]]'''s talk page.
825 !! result
826 <p>The <i><a href="/wiki/Main_Page" title="Main Page">Main Page</a>'</i>s talk page.
827 </p>
828 !! end
830 !! test
831 Parsoid only: Quote balancing context should be restricted to td/th cells on the same wikitext line
832 (Requires tidy for PHP parser output to be fixed up)
833 !! options
834 parsoid=wt2html,wt2wt
835 !! input
837 !''a!!''b
838 |''a||''b
840 !! result
841 <table>
842 <tbody><tr><th><i>a</i></th><th><i>b</i></th>
843 <td><i>a</i></td><td><i>b</i></td></tr>
844 </tbody></table>
845 !! end
848 ### Non-html5 tags
851 !! test
852 Non-html5 tags should be accepted
853 !! input
854 <center>''foo''</center>
855 <big>''foo''</big>
856 <font>''foo''</font>
857 <strike>''foo''</strike>
858 <tt>''foo''</tt>
859 !! result
860 <center><i>foo</i></center>
861 <p><big><i>foo</i></big>
862 <font><i>foo</i></font>
863 <strike><i>foo</i></strike>
864 <tt><i>foo</i></tt>
865 </p>
866 !! end
868 !! test
869 <wbr> isn't (yet) valid wikitext (bug 52468)
870 !! input
871 <wbr>
872 !! result
873 <p>&lt;wbr&gt;
874 </p>
875 !! end
878 ### Special characters
881 !! test
882 Bare pipe character (bug 52363)
883 !! input
885 !! result
886 <p>|
887 </p>
888 !! end
890 !! test
891 Bare pipe character from a template (bug 52363)
892 !! input
893 {{pipe}}
894 !! result
895 <p>|
896 </p>
897 !! end
900 ### <nowiki> test cases
903 !! test
904 <nowiki> unordered list
905 !! input
906 <nowiki>* This is not an unordered list item.</nowiki>
907 !! result
908 <p>* This is not an unordered list item.
909 </p>
910 !! end
912 !! test
913 <nowiki> spacing
914 !! input
915 <nowiki>Lorem ipsum dolor
917 sed abit.
918   sed nullum.
920 :and a colon
921 </nowiki>
922 !! result
923 <p>Lorem ipsum dolor
925 sed abit.
926   sed nullum.
928 :and a colon
930 </p>
931 !! end
933 !! test
934 nowiki 3
935 !! input
936 :There is not nowiki.
937 :There is <nowiki>nowiki</nowiki>.
939 #There is not nowiki.
940 #There is <nowiki>nowiki</nowiki>.
942 *There is not nowiki.
943 *There is <nowiki>nowiki</nowiki>.
944 !! result
945 <dl><dd>There is not nowiki.
946 </dd><dd>There is nowiki.
947 </dd></dl>
948 <ol><li>There is not nowiki.
949 </li><li>There is nowiki.
950 </li></ol>
951 <ul><li>There is not nowiki.
952 </li><li>There is nowiki.
953 </li></ul>
955 !! end
957 !! test
958 Entities inside <nowiki>
959 !! input
960 <nowiki>&lt;</nowiki>
961 !! result
962 <p>&lt;
963 </p>
964 !! end
966 !! test
967 Entities inside template parameters
968 !! options
969 parsoid
970 !! input
971 {{echo|&ndash;}}
972 !! result
973 <p><span typeof="mw:Transclusion mw:Entity" data-mw='{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&amp;ndash;"}},"i":0}'>&ndash;</span>
974 </p>
975 !! end
978 ### Comments
980 !! test
981 Comments and Indent-Pre
982 !! input
983 <!-- comment 1 --> asdf
985 <!-- comment 1 --> asdf
986 <!-- comment 2 -->
988 <!-- comment 1 --> asdf
989 <!-- comment 2 -->xyz
991 <!-- comment 1 --> asdf
992 <!-- comment 2 --> xyz
993 !! result
994 <pre>asdf
995 </pre>
996 <pre>asdf
997 </pre>
998 <pre>asdf
999 </pre>
1000 <p>xyz
1001 </p>
1002 <pre>asdf
1004 </pre>
1005 !! end
1007 !! test
1008 Comment test 2a
1009 !! input
1010 asdf
1011 <!-- comment 1 -->
1013 !! result
1014 <p>asdf
1016 </p>
1017 !! end
1019 !! test
1020 Comment test 2b
1021 !! input
1022 asdf
1023 <!-- comment 1 -->
1026 !! result
1027 <p>asdf
1028 </p><p>jkl
1029 </p>
1030 !! end
1032 !! test
1033 Comment test 3
1034 !! input
1035 asdf
1036 <!-- comment 1 -->
1037 <!-- comment 2 -->
1039 !! result
1040 <p>asdf
1042 </p>
1043 !! end
1045 !! test
1046 Comment test 4
1047 !! input
1048 asdf<!-- comment 1 -->jkl
1049 !! result
1050 <p>asdfjkl
1051 </p>
1052 !! end
1054 !! test
1055 Comment spacing
1056 !! input
1058  <!-- foo --> b <!-- bar -->
1060 !! result
1061 <p>a
1062 </p>
1063 <pre> b 
1064 </pre>
1065 <p>c
1066 </p>
1067 !! end
1069 !! test
1070 Comment whitespace
1071 !! input
1072 <!-- returns a single newline, not nothing, since the newline after > is not stripped -->
1073 !! result
1075 !! end
1077 !! test
1078 Comment semantics and delimiters
1079 !! input
1080 <!-- --><!----><!-----><!------>
1081 !! result
1083 !! end
1085 !! test
1086 Comment semantics and delimiters, redux
1087 !! input
1088 <!-- In SGML every "foo" here would actually show up in the text -- foo -- bar
1089 -- foo -- funky huh? ... -->
1090 !! result
1092 !! end
1094 !! test
1095 Comment semantics and delimiters: directors cut
1096 !! input
1097 <!-- ... However we like to keep things simple and somewhat XML-ish so we eat
1098 everything starting with < followed by !-- until the first -- and > we see,
1099 that wouldn't be valid XML however, since in XML -- has to terminate a comment
1100 -->-->
1101 !! result
1102 <p>--&gt;
1103 </p>
1104 !! end
1106 !! test
1107 Comment semantics: nesting
1108 !! input
1109 <!--<!-- no, we're not going to do anything fancy here -->-->
1110 !! result
1111 <p>--&gt;
1112 </p>
1113 !! end
1115 !! test
1116 Comment semantics: unclosed comment at end
1117 !! input
1118 <!--This comment will run out to the end of the document
1119 !! result
1121 !! end
1123 !! test
1124 Comment in template title
1125 !! input
1126 {{f<!---->oo}}
1127 !! result
1128 <p>FOO
1129 </p>
1130 !! end
1132 !! test
1133 Comment on its own line post-expand
1134 !! input
1136 {{blank}}<!---->
1138 !! result
1139 <p>a
1140 </p><p>b
1141 </p>
1142 !! end
1144 !! test
1145 Comment on its own line post-expand with non-significant whitespace
1146 !! input
1148  {{blank}} <!----> 
1150 !! result
1151 <p>a
1152 </p><p>b
1153 </p>
1154 !! end
1157 ### paragraph wrapping tests
1159 !! test
1160 No block tags
1161 !! input
1165 !! result
1166 <p>a
1167 </p><p>b
1168 </p>
1169 !! end
1170 !! test
1171 Block tag on one line
1172 !! input
1173 a <div>foo</div>
1176 !! result
1177 a <div>foo</div>
1178 <p>b
1179 </p>
1180 !! end
1182 !! test
1183 Block tag on both lines
1184 !! input
1185 a <div>foo</div>
1187 b <div>foo</div>
1188 !! result
1189 a <div>foo</div>
1190 b <div>foo</div>
1192 !! end
1194 !! test
1195 Multiple lines without block tags
1196 !! input
1197 <div>foo</div> a
1200 d<!--foo--> e
1201 x <div>foo</div> z
1202 !! result
1203 <div>foo</div> a
1204 <p>b
1206 d e
1207 </p>
1208 x <div>foo</div> z
1210 !! end
1212 !! test
1213 Empty lines between lines with block tags
1214 !! input
1215 <div></div>
1218 <div></div>a
1221 <div>a</div>b
1223 <div>b</div>d
1226 <div>e</div>
1227 !! result
1228 <div></div>
1229 <p><br />
1230 </p>
1231 <div></div>a
1232 <p>b
1233 </p>
1234 <div>a</div>b
1235 <div>b</div>d
1236 <p><br />
1237 </p>
1238 <div>e</div>
1240 !! end
1243 ### Preformatted text
1245 !! test
1246 Preformatted text
1247 !! input
1248  This is some
1249  Preformatted text
1250  With ''italic''
1251  And '''bold'''
1252  And a [[Main Page|link]]
1253 !! result
1254 <pre>This is some
1255 Preformatted text
1256 With <i>italic</i>
1257 And <b>bold</b>
1258 And a <a href="/wiki/Main_Page" title="Main Page">link</a>
1259 </pre>
1260 !! end
1262 !! test
1263 Ident preformatting with inline content
1264 !! input
1266  ''b''
1267 !! result
1268 <pre>a
1269 <i>b</i>
1270 </pre>
1271 !! end
1273 !! test
1274 <pre> with <nowiki> inside (compatibility with 1.6 and earlier)
1275 !! input
1276 <pre><nowiki>
1278 <cite>
1279 <em>
1280 </nowiki></pre>
1281 !! result
1282 <pre>
1283 &lt;b&gt;
1284 &lt;cite&gt;
1285 &lt;em&gt;
1286 </pre>
1288 !! end
1290 !! test
1291 Regression with preformatted in <center>
1292 !! input
1293 <center>
1294  Blah
1295 </center>
1296 !! result
1297 <center>
1298 <pre>Blah
1299 </pre>
1300 </center>
1302 !! end
1304 # Expected output in the following test is not really expected (there should be
1305 # <pre> in the output) -- it's only testing for well-formedness.
1306 !! test
1307 Bug 6200: Preformatted in <blockquote>
1308 !! input
1309 <blockquote>
1310  Blah
1311 </blockquote>
1312 !! result
1313 <blockquote>
1314  Blah
1315 </blockquote>
1317 !! end
1319 !! test
1320 <pre> with attributes (bug 3202)
1321 !! input
1322 <pre style="background: blue; color:white">Bluescreen of WikiDeath</pre>
1323 !! result
1324 <pre style="background: blue; color:white">Bluescreen of WikiDeath</pre>
1326 !! end
1328 !! test
1329 <pre> with width attribute (bug 3202)
1330 !! input
1331 <pre width="8">Narrow screen goodies</pre>
1332 !! result
1333 <pre width="8">Narrow screen goodies</pre>
1335 !! end
1337 !! test
1338 <pre> with forbidden attribute (bug 3202)
1339 !! input
1340 <pre width="8" onmouseover="alert(document.cookie)">Narrow screen goodies</pre>
1341 !! result
1342 <pre width="8">Narrow screen goodies</pre>
1344 !! end
1346 !! test
1347 Entities inside <pre>
1348 !! input
1349 <pre>&lt;</pre>
1350 !! result
1351 <pre>&lt;</pre>
1353 !! end
1355 !! test
1356 <pre> with forbidden attribute values (bug 3202)
1357 !! input
1358 <pre width="8" style="border-width: expression(alert(document.cookie))">Narrow screen goodies</pre>
1359 !! result
1360 <pre width="8" style="/* insecure input */">Narrow screen goodies</pre>
1362 !! end
1364 !! test
1365 <nowiki> inside <pre> (bug 13238)
1366 !! input
1367 <pre>
1368 <nowiki>
1369 </pre>
1370 <pre>
1371 <nowiki></nowiki>
1372 </pre>
1373 <pre><nowiki><nowiki></nowiki>Foo<nowiki></nowiki></nowiki></pre>
1374 !! result
1375 <pre>
1376 &lt;nowiki&gt;
1377 </pre>
1378 <pre>
1380 </pre>
1381 <pre>&lt;nowiki&gt;Foo&lt;/nowiki&gt;</pre>
1383 !! end
1385 !! test
1386 <nowiki> and <pre> preference (first one wins)
1387 !! input
1388 <pre>
1389 <nowiki>
1390 </pre>
1391 </nowiki>
1392 </pre>
1394 <nowiki>
1395 <pre>
1396 <nowiki>
1397 </pre>
1398 </nowiki>
1399 </pre>
1401 !! result
1402 <pre>
1403 &lt;nowiki&gt;
1404 </pre>
1405 <p>&lt;/nowiki&gt;
1406 &lt;/pre&gt;
1407 </p><p>
1408 &lt;pre&gt;
1409 &lt;nowiki&gt;
1410 &lt;/pre&gt;
1412 &lt;/pre&gt;
1413 </p>
1414 !! end
1416 !! test
1417 </pre> inside nowiki
1418 !! input
1419 <nowiki></pre></nowiki>
1420 !! result
1421 <p>&lt;/pre&gt;
1422 </p>
1423 !! end
1425 !!test
1426 Templates: Indent-Pre: 1a. Templates that break a line should suppress <pre>
1427 !!input
1428  {{echo|}}
1429 !!result
1431 !!end
1433 !!test
1434 Templates: Indent-Pre: 1b. Templates that break a line should suppress <pre>
1435 !!input
1436  {{echo|
1437 foo}}
1438 !!result
1439 <p>foo
1440 </p>
1441 !!end
1443 !! test
1444 Templates: Indent-Pre: 1c: Wrapping should be based on expanded content
1445 !! input
1446  {{echo|a
1448 !!result
1449 <pre>a
1450 </pre>
1451 <p>b
1452 </p>
1453 !!end
1455 !! test
1456 Templates: Indent-Pre: 1d: Wrapping should be based on expanded content
1457 !! input
1458  {{echo|a
1464 !!result
1465 <pre>a
1466 </pre>
1467 <p>b
1469 </p>
1470 <pre>d
1471 </pre>
1472 <p>e
1473 </p>
1474 !!end
1476 !!test
1477 Templates: Indent-Pre: 1e. Wrapping should be based on expanded content
1478 !!input
1479 {{echo| foo}}
1481 {{echo| foo}}{{echo| bar}}
1483 {{echo| foo}}
1484 {{echo| bar}}
1486 {{echo|<!--cmt--> foo}}
1488 <!--cmt-->{{echo| foo}}
1490 {{echo|{{echo| }}bar}}
1491 !!result
1492 <pre>foo
1493 </pre>
1494 <pre>foo bar
1495 </pre>
1496 <pre>foo
1498 </pre>
1499 <pre>foo
1500 </pre>
1501 <pre>foo
1502 </pre>
1503 <pre>bar
1504 </pre>
1505 !!end
1507 !! test
1508 Templates: Indent-Pre: 1f: Wrapping should be based on expanded content
1509 !! input
1510 {{echo| }}a
1512 {{echo|
1513  }}a
1515 {{echo|
1516  b}}
1518 {{echo|a
1519  }}b
1521 {{echo|a
1522 }} b
1523 !!result
1524 <pre>a
1525 </pre>
1526 <p><br />
1527 </p>
1528 <pre>a
1529 </pre>
1530 <p><br />
1531 </p>
1532 <pre>b
1533 </pre>
1534 <p>a
1535 </p>
1536 <pre>b
1537 </pre>
1538 <p>a
1539 </p>
1540 <pre>b
1541 </pre>
1542 !!end
1544 !! test
1545 Templates: Single-line variant of parameter whitespace stripping test
1546 !! input
1547 {{echo| a}}
1549 {{echo|1= a}}
1551 {{echo|{{echo| a}}}}
1553 {{echo|1={{echo| a}}}}
1554 !! result
1555 <pre>a
1556 </pre>
1557 <p>a
1558 </p>
1559 <pre>a
1560 </pre>
1561 <p>a
1562 </p>
1563 !! end
1565 !! test
1566 Templates: Strip whitespace from named parameters, but not positional ones
1567 !! input
1568 {{echo|
1569  foo}}
1571 {{echo|
1572 * foo}}
1574 {{echo| 1 =
1575  foo}}
1577 {{echo| 1 =
1578 * foo}}
1579 !! result
1580 <pre>foo
1581 </pre>
1582 <p><br />
1583 </p>
1584 <ul><li> foo
1585 </li></ul>
1586 <p>foo
1587 </p>
1588 <ul><li> foo
1589 </li></ul>
1591 !! end
1593 !! test
1594 Templates: Dont strip whitespace from whitespace/comment-only arguments
1595 !! input
1596 {{echo| }}
1597 {{echo|<!--cmt-->}}
1598 {{echo| <!--cmt--> }}
1599 !! result
1600 <p><br />
1601 </p>
1602 !! end
1604 !! test
1605 Templates: Parsoid parameter escaping test 1
1606 !! options
1607 parsoid
1608 !! input
1609 {{echo|[foo]|{{echo|[bar]}}}}
1610 !! result
1611 <p about="#mwt1" typeof="mw:Transclusion"
1612 data-mw="{&quot;target&quot;:{&quot;wt&quot;:&quot;echo&quot;,&quot;href&quot;:&quot;./Template:Echo&quot;},&quot;params&quot;:{&quot;1&quot;:{&quot;wt&quot;:&quot;[foo]&quot;},&quot;2&quot;:{&quot;wt&quot;:&quot;{{echo|[bar]}}&quot;}},&quot;i&quot;:0}">[foo]</p>
1613 !! end
1615 !! test
1616 Parsoid: Pipes in external links in template parameter
1617 !! options
1618 parsoid
1619 !! input
1620 {{echo|[{{echo|http://example.com}} link]}}
1621 !! result
1622 <p><a rel="mw:ExtLink" href="http://example.com" about="#mwt31" typeof="mw:Transclusion" data-mw="{&quot;target&quot;:{&quot;wt&quot;:&quot;echo&quot;,&quot;href&quot;:&quot;./Template:Echo&quot;},&quot;params&quot;:{&quot;1&quot;:{&quot;wt&quot;:&quot;[{{echo|http://example.com}} link]&quot;}},&quot;i&quot;:0}">link</a></p>
1623 !! end
1625 !! test
1626 Parsoid: pipe in transclusion parameter
1627 !! options
1628 parsoid
1629 !! input
1630 {{echo|http://foo.com/a&#124;b}}
1631 !! result
1632 <p><a rel="mw:ExtLink" href="http://foo.com/a|b" about="#mwt1"
1633 typeof="mw:Transclusion"
1634 data-mw='{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"http://foo.com/a|b"}},"i":0}'>http://foo.com/a|b</a></p>
1635 !! end
1637 !! test
1638 Parsoid: Pipe in external link target and content in template parameter
1639 !! options
1640 parsoid=html2wt,wt2wt
1641 !! input
1642 {{echo|[http://foo.com/a&#124;b a&#124;b]}}
1643 !! result
1644 <p><a rel="mw:ExtLink" href="http://foo.com/a|b" about="#mwt1"
1645 typeof="mw:Transclusion"
1646 data-mw='{"target":{"wt":"echo","href":"./Template:Echo"},
1647 "params":{"1":{"wt":"[http://foo.com/a|b a|b]"}},"i":0}'>a|b</a></p>
1648 !! end
1650 !! test
1651 Templates: Dont escape already nowiki-escaped text in template parameters
1652 !! options
1653 parsoid=html2wt,wt2wt
1654 !! input
1655 {{echo|foo<nowiki>|</nowiki>bar}}
1656 {{echo|<nowiki>&lt;div&gt;</nowiki>}}
1657 {{echo|<nowiki></nowiki>}}
1658 !! result
1659 <p><span about="#mwt1" typeof="mw:Transclusion" data-mw='{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo<nowiki>|</nowiki>bar"}},"i":0}'}'>foo</span><span typeof="mw:Nowiki" about="#mwt1">|</span><span about="#mwt1">bar</span>
1660 <span typeof="mw:Transclusion mw:Nowiki" about="#mwt2" data-mw='{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"<nowiki>&amp;lt;div&amp;gt;</nowiki>"}},"i":0}'><span typeof="mw:Entity">&lt;</span>div<span typeof="mw:Entity">&gt;</span></span>
1661 <span typeof="mw:Transclusion mw:Nowiki" about="#mwt3" data-mw='{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"<nowiki></nowiki>"}},"i":0}'></span>
1662 </p>
1663 !! end
1666 ### Parsoid-centric tests for testing RT edge cases for pre
1669 !!test
1670 1a. Indent-Pre and Comments
1671 !!input
1673 <!--a-->
1675 !!result
1676 <pre>a
1677 </pre>
1678 <p>c
1679 </p>
1680 !!end
1682 !!test
1683 1b. Indent-Pre and Comments
1684 !!input
1686  <!--a-->
1688 !!result
1689 <pre>a
1690 </pre>
1691 <p>c
1692 </p>
1693 !!end
1695 !!test
1696 1c. Indent-Pre and Comments
1697 !!input
1698 <!--a-->  a
1700  <!--a--> a
1701 !!result
1702 <pre> a
1703 </pre>
1704 <pre> a
1705 </pre>
1706 !!end
1708 !!test
1709 2a. Indent-Pre and tables
1710 !!input
1711  {|
1712  |-
1713  !h1!!h2
1714  |foo||bar
1715  |}
1716 !!result
1717 <table>
1719 <tr>
1720 <th>h1</th>
1721 <th>h2
1722 </th>
1723 <td>foo</td>
1724 <td>bar
1725 </td></tr></table>
1727 !!end
1729 !!test
1730 2b. Indent-Pre and tables
1731 !!input
1732   {|
1733  |-
1734 |foo
1736 !!result
1737 <table>
1739 <tr>
1740 <td>foo
1741 </td></tr></table>
1743 !!end
1745 !!test
1746 2c. Indent-Pre and tables (bug 42252)
1747 !!input
1749  |+ foo
1750  !  | bar
1752 !!result
1753 <table>
1754 <caption> foo
1755 </caption>
1756 <tr>
1757 <th> bar
1758 </th></tr></table>
1760 !!end
1762 !!test
1763 3a. Indent-Pre and block tags (single-line html)
1764 !!input
1765  <p> foo </p>
1766  <div> foo </div>
1767  <span> foo </span>
1768 !!result
1769  <p> foo </p>
1770  <div> foo </div>
1771 <pre><span> foo </span>
1772 </pre>
1773 !!end
1775 !!test
1776 3b. Indent-Pre and block tags (pre-content on separate line)
1777 !!input
1779  foo
1780 </p>
1782 <div>
1783  foo
1784 </div>
1786 <center>
1787  foo
1788 </center>
1790 <blockquote>
1791  foo
1792 </blockquote>
1794 <table><tr><td>
1795  foo
1796 </td></tr></table>
1798 <ul><li>
1799   foo
1800 </li></ul>
1802 !!result
1804  foo
1805 </p>
1806 <div>
1807 <pre>foo
1808 </pre>
1809 </div>
1810 <center>
1811 <pre>foo
1812 </pre>
1813 </center>
1814 <blockquote>
1815  foo
1816 </blockquote>
1817 <table><tr><td>
1818 <pre>foo
1819 </pre>
1820 </td></tr></table>
1821 <ul><li>
1822   foo
1823 </li></ul>
1825 !!end
1827 !!test
1828 4. Multiple spaces at start-of-line
1829 !!input
1830     <p> foo </p>
1831     foo
1832         {|
1833 |foo
1835 !!result
1836     <p> foo </p>
1837 <pre>   foo
1838 </pre>
1839 <table>
1840 <tr>
1841 <td>foo
1842 </td></tr></table>
1844 !!end
1846 !! test
1847 5. White-space in indent-pre
1848 NOTE: the white-space char on 2nd line is significant
1849 !! input
1850  a<br/>
1853 !! result
1854 <pre>a<br />
1857 </pre>
1858 !! end
1861 ### HTML-pre (some to spec PHP parser behavior and some Parsoid-RT-centric)
1864 !!test
1865 HTML-pre: 1. embedded newlines
1866 !!input
1867 <pre>foo</pre>
1869 <pre>
1871 </pre>
1873 <pre>
1876 </pre>
1878 <pre>
1882 </pre>
1883 !!result
1884 <pre>foo</pre>
1885 <pre>
1887 </pre>
1888 <pre>
1891 </pre>
1892 <pre>
1896 </pre>
1898 !!end
1900 !!test
1901 HTML-pre: 2: indented text
1902 !!input
1903 <pre>
1904  foo
1905 </pre>
1906 !!result
1907 <pre>
1908  foo
1909 </pre>
1911 !!end
1913 !!test
1914 HTML-pre: 3: other wikitext
1915 !!input
1916 <pre>
1917 * foo
1918 # bar
1919 = no-h =
1920 '' no-italic ''
1921 [[ NoLink ]]
1922 </pre>
1923 !!result
1924 <pre>
1925 * foo
1926 # bar
1927 = no-h =
1928 '' no-italic ''
1929 [[ NoLink ]]
1930 </pre>
1932 !!end
1935 ### Definition lists
1937 !! test
1938 Simple definition
1939 !! input
1940 ; name : Definition
1941 !! result
1942 <dl><dt> name&#160;</dt><dd> Definition
1943 </dd></dl>
1945 !! end
1947 !! test
1948 Definition list for indentation only
1949 !! input
1950 : Indented text
1951 !! result
1952 <dl><dd> Indented text
1953 </dd></dl>
1955 !! end
1957 !! test
1958 Definition list with no space
1959 !! input
1960 ;name:Definition
1961 !! result
1962 <dl><dt>name</dt><dd>Definition
1963 </dd></dl>
1965 !!end
1967 !! test
1968 Definition list with URL link
1969 !! input
1970 ; http://example.com/ : definition
1971 !! result
1972 <dl><dt> <a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&#160;</dt><dd> definition
1973 </dd></dl>
1975 !! end
1977 !! test
1978 Definition list with bracketed URL link
1979 !! input
1980 ;[http://www.example.com/ Example]:Something about it
1981 !! result
1982 <dl><dt><a rel="nofollow" class="external text" href="http://www.example.com/">Example</a></dt><dd>Something about it
1983 </dd></dl>
1985 !! end
1987 !! test
1988 Definition list with wikilink containing colon
1989 !! input
1990 ; [[Help:FAQ]]: The least-read page on Wikipedia
1991 !! result
1992 <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
1993 </dd></dl>
1995 !! end
1997 # At Brion's and JeLuF's insistence... :)
1998 !! test
1999 Definition list with news link containing colon
2000 !! input
2001 ;  news:alt.wikipedia.rox: This isn't even a real newsgroup!
2002 !! result
2003 <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!
2004 </dd></dl>
2006 !! end
2008 !! test
2009 Malformed definition list with colon
2010 !! input
2011 ;  news:alt.wikipedia.rox -- don't crash or enter an infinite loop
2012 !! result
2013 <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
2014 </dt></dl>
2016 !! end
2018 !! test
2019 Definition lists: colon in external link text
2020 !! input
2021 ; [http://www.wikipedia2.org/ Wikipedia : The Next Generation]: OK, I made that up
2022 !! result
2023 <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
2024 </dd></dl>
2026 !! end
2028 !! test
2029 Definition lists: colon in HTML attribute
2030 !! input
2031 ;<b style="display: inline">bold</b>
2032 !! result
2033 <dl><dt><b style="display: inline">bold</b>
2034 </dt></dl>
2036 !! end
2038 !! test
2039 Definition lists: self-closed tag
2040 !! input
2041 ;one<br/>two : two-line fun
2042 !! result
2043 <dl><dt>one<br />two&#160;</dt><dd> two-line fun
2044 </dd></dl>
2046 !! end
2048 !! test
2049 Bug 11748: Literal closing tags
2050 !! input
2051 <dl>
2052 <dt>test 1</dt>
2053 <dd>test test test test test</dd>
2054 <dt>test 2</dt>
2055 <dd>test test test test test</dd>
2056 </dl>
2057 !! result
2058 <dl>
2059 <dt>test 1</dt>
2060 <dd>test test test test test</dd>
2061 <dt>test 2</dt>
2062 <dd>test test test test test</dd>
2063 </dl>
2065 !! end
2067 !! test
2068 Definition and unordered list using wiki syntax nested in unordered list using html tags.
2069 !! input
2070 <ul><li>
2071 ; term : description
2072 * unordered
2073 </li>
2074 </ul>
2075 !! result
2076 <ul><li>
2077 <dl><dt> term&#160;</dt><dd> description
2078 </dd></dl>
2079 <ul><li> unordered
2080 </li></ul>
2081 </li>
2082 </ul>
2084 !! end
2086 !! test
2088 Definition list with empty definition and following paragraph
2089 !! input
2090 ; term:
2091 Paragraph text
2092 !! result
2093 <dl><dt> term</dt><dd>
2094 </dd></dl>
2095 <p>Paragraph text
2096 </p>
2097 !! end
2099 !! test
2100 Nested definition lists using html syntax
2101 !! input
2102 <dl><dd>
2103 <dl>
2104 <dd>Foo</dd>
2105 </dl>
2106 </dd></dl>
2107 !! result
2108 <dl><dd>
2109 <dl>
2110 <dd>Foo</dd>
2111 </dl>
2112 </dd></dl>
2114 !! end
2116 !! test
2117 Definition Lists: No nesting: Multiple dd's
2118 !! input
2122 !! result
2123 <dl><dt>x
2124 </dt><dd>a
2125 </dd><dd>b
2126 </dd></dl>
2128 !! end
2130 !! test
2131 Definition Lists: Indentation: Regular
2132 !! input
2134 ::i2
2135 :::i3
2136 !! result
2137 <dl><dd>i1
2138 <dl><dd>i2
2139 <dl><dd>i3
2140 </dd></dl>
2141 </dd></dl>
2142 </dd></dl>
2144 !! end
2146 !! test
2147 Definition Lists: Indentation: Missing 1st level
2148 !! input
2149 ::i2
2150 :::i3
2151 !! result
2152 <dl><dd><dl><dd>i2
2153 <dl><dd>i3
2154 </dd></dl>
2155 </dd></dl>
2156 </dd></dl>
2158 !! end
2160 !! test
2161 Definition Lists: Indentation: Multi-level indent
2162 !! input
2163 :::i3
2164 !! result
2165 <dl><dd><dl><dd><dl><dd>i3
2166 </dd></dl>
2167 </dd></dl>
2168 </dd></dl>
2170 !! end
2172 !! test
2173 Definition Lists: Hacky use to indent tables
2174 !! input
2175 ::{|
2176 |foo
2177 |bar
2179 this text
2180 should be left alone
2181 !! result
2182 <dl><dd><dl><dd><table>
2183 <tr>
2184 <td>foo
2185 </td>
2186 <td>bar
2187 </td></tr></table></dd></dl></dd></dl>
2188 <p>this text
2189 should be left alone
2190 </p>
2191 !! end
2192 ## The PHP parser treats : items (dd) without a corresponding ; item (dt)
2193 ## as an empty dt item.  It also ignores all but the last ";" when followed
2194 ## by ":" later on.  So, ";" are not ignored in ";;;t3" but are ignored  in
2195 ## ";;;t3 :d1".  So, PHP parser behavior is a little inconsistent wrt multiple
2196 ## ";"s.
2198 ## Ex: ";;t2 ::d2" is transformed into:
2200 ## <dl>
2201 ##   <dt>t2 </dt>
2202 ##   <dd>
2203 ##     <dl>
2204 ##       <dt></dt>
2205 ##       <dd>d2</dd>
2206 ##     </dl>
2207 ##   </dd>
2208 ## </dl>
2210 ## But, Parsoid treats "; :" as a tight atomic unit and excess ":" as plain text
2211 ## So, the same wikitext above (;;t2 ::d2) is transformed into:
2213 ## <dl>
2214 ##   <dt>
2215 ##     <dl>
2216 ##       <dt>t2 </dt>
2217 ##       <dd>:d2</dd>
2218 ##     </dl>
2219 ##    </dt>
2220 ## </dl>
2222 ## All Parsoid only definition list tests have this difference.
2224 ## See also: https://bugzilla.wikimedia.org/show_bug.cgi?id=6569
2225 ## and http://lists.wikimedia.org/pipermail/wikitext-l/2011-November/000483.html
2227 !! test
2228 Table / list interaction: indented table with lists in table contents
2229 !! input
2232 | a
2233 * b
2235 | c
2236 * d
2238 !! result
2239 <dl><dd><table>
2241 <tr>
2242 <td> a
2243 <ul><li> b
2244 </li></ul>
2245 </td></tr>
2246 <tr>
2247 <td> c
2248 <ul><li> d
2249 </li></ul>
2250 </td></tr></table></dd></dl>
2252 !! end
2254 !!test
2255 Table / list interaction: lists nested in tables nested in indented lists
2256 !!input
2268 !!result
2269 <dl><dd><table>
2270 <tr>
2271 <td>
2272 <dl><dd>a
2273 </dd><dd>b
2274 </dd></dl>
2275 </td>
2276 <td>
2277 <ul><li>c
2278 </li><li>d
2279 </li></ul>
2280 </td></tr></table></dd></dl>
2281 <ul><li>e
2282 </li><li>f
2283 </li></ul>
2285 !!end
2287 !! test
2288 Definition Lists: Nesting: Multi-level (Parsoid only)
2289 !! options
2290 parsoid
2291 !! input
2292 ;t1 :d1
2293 ;;t2 ::d2
2294 ;;;t3 :::d3
2295 !! result
2296 <dl>
2297   <dt>t1 </dt>
2298   <dd>d1</dd>
2299   <dt>
2300     <dl>
2301       <dt>t2 </dt>
2302       <dd>:d2</dd>
2303       <dt>
2304         <dl>
2305           <dt>t3 </dt>
2306           <dd>::d3</dd>
2307         </dl>
2308       </dt>
2309     </dl>
2310   </dt>
2311 </dl>
2314 !! end
2317 !! test
2318 Definition Lists: Nesting: Test 2 (Parsoid only)
2319 !! options
2320 parsoid
2321 !! input
2323 ::d2
2324 !! result
2325 <dl>
2326   <dt>t1</dt>
2327   <dd>
2328     <dl>
2329       <dd>d2</dd>
2330     </dl>
2331   </dd>
2332 </dl>
2334 !! end
2337 !! test
2338 Definition Lists: Nesting: Test 3 (Parsoid only)
2339 !! options
2340 parsoid
2341 !! input
2342 :;t1
2343 ::::d2
2344 !! result
2345 <dl>
2346   <dd>
2347     <dl>
2348       <dt>t1</dt>
2349       <dd>
2350         <dl>
2351           <dd>
2352             <dl>
2353               <dd>d2</dd>
2354             </dl>
2355           </dd>
2356         </dl>
2357       </dd>
2358     </dl>
2359   </dd>
2360 </dl>
2362 !! end
2365 !! test
2366 Definition Lists: Nesting: Test 4
2367 !! input
2368 ::;t3
2369 :::d3
2370 !! result
2371 <dl><dd><dl><dd><dl><dt>t3
2372 </dt><dd>d3
2373 </dd></dl>
2374 </dd></dl>
2375 </dd></dl>
2377 !! end
2380 ## The Parsoid team believes the following three test exposes a
2381 ## bug in the PHP parser.  (Parsoid team thinks the PHP parser is
2382 ## wrong to close the <dl> after the <dt> containing the <ul>.)
2383 !! test
2384 Definition Lists: Mixed Lists: Test 1 (php)
2385 !! options
2387 !! input
2388 :;* foo
2389 ::* bar
2390 :; baz
2391 !! result
2392 <dl><dd><dl><dt><ul><li> foo
2393 </li><li> bar
2394 </li></ul>
2395 </dt></dl>
2396 <dl><dt> baz
2397 </dt></dl>
2398 </dd></dl>
2400 !! end
2401 !! test
2402 Definition Lists: Mixed Lists: Test 1 (parsoid)
2403 !! options
2404 parsoid
2405 !! input
2406 :;* foo
2407 ::* bar
2408 :; baz
2409 !! result
2410 <dl><dd><dl><dt><ul><li> foo
2411 </li></ul></dt><dd><ul><li> bar
2412 </li></ul></dd><dt> baz</dt></dl></dd></dl>
2413 !! end
2415 !! test
2416 Definition Lists: Mixed Lists: Test 2
2417 !! input
2418 *: d1
2419 *: d2
2420 !! result
2421 <ul><li><dl><dd> d1
2422 </dd><dd> d2
2423 </dd></dl>
2424 </li></ul>
2426 !! end
2429 !! test
2430 Definition Lists: Mixed Lists: Test 3
2431 !! input
2432 *::: d1
2433 *::: d2
2434 !! result
2435 <ul><li><dl><dd><dl><dd><dl><dd> d1
2436 </dd><dd> d2
2437 </dd></dl>
2438 </dd></dl>
2439 </dd></dl>
2440 </li></ul>
2442 !! end
2445 !! test
2446 Definition Lists: Mixed Lists: Test 4
2447 !! input
2448 *;d1 :d2
2449 *;d3 :d4
2450 !! result
2451 <ul><li><dl><dt>d1&#160;</dt><dd>d2
2452 </dd><dt>d3&#160;</dt><dd>d4
2453 </dd></dl>
2454 </li></ul>
2456 !! end
2459 !! test
2460 Definition Lists: Mixed Lists: Test 5
2461 !! input
2462 *:d1
2463 *:: d2
2464 !! result
2465 <ul><li><dl><dd>d1
2466 <dl><dd> d2
2467 </dd></dl>
2468 </dd></dl>
2469 </li></ul>
2471 !! end
2474 !! test
2475 Definition Lists: Mixed Lists: Test 6
2476 !! input
2477 #*:d1
2478 #*::: d3
2479 !! result
2480 <ol><li><ul><li><dl><dd>d1
2481 <dl><dd><dl><dd> d3
2482 </dd></dl>
2483 </dd></dl>
2484 </dd></dl>
2485 </li></ul>
2486 </li></ol>
2488 !! end
2491 !! test
2492 Definition Lists: Mixed Lists: Test 7
2493 !! input
2494 :* d1
2495 :* d2
2496 !! result
2497 <dl><dd><ul><li> d1
2498 </li><li> d2
2499 </li></ul>
2500 </dd></dl>
2502 !! end
2505 !! test
2506 Definition Lists: Mixed Lists: Test 8
2507 !! input
2508 :* d1
2509 ::* d2
2510 !! result
2511 <dl><dd><ul><li> d1
2512 </li></ul>
2513 <dl><dd><ul><li> d2
2514 </li></ul>
2515 </dd></dl>
2516 </dd></dl>
2518 !! end
2521 !! test
2522 Definition Lists: Mixed Lists: Test 9
2523 !! input
2524 *;foo :bar
2525 !! result
2526 <ul><li><dl><dt>foo&#160;</dt><dd>bar
2527 </dd></dl>
2528 </li></ul>
2530 !! end
2533 !! test
2534 Definition Lists: Mixed Lists: Test 10
2535 !! input
2536 *#;foo :bar
2537 !! result
2538 <ul><li><ol><li><dl><dt>foo&#160;</dt><dd>bar
2539 </dd></dl>
2540 </li></ol>
2541 </li></ul>
2543 !! end
2545 # The Parsoid team disagrees with the PHP parser's seemingly-random
2546 # rules regarding dd/dt on the next two tests.  Parsoid is more
2547 # consistent, and recognizes the shared nesting and keeps the
2548 # still-open tags around until the nesting is complete.
2550 !! test
2551 Definition Lists: Mixed Lists: Test 11 (php)
2552 !! options
2554 !! input
2555 *#*#;*;;foo :bar
2556 *#*#;boo :baz
2557 !! result
2558 <ul><li><ol><li><ul><li><ol><li><dl><dt>foo&#160;</dt><dd><ul><li><dl><dt><dl><dt>bar
2559 </dt></dl>
2560 </dd></dl>
2561 </li></ul>
2562 </dd></dl>
2563 <dl><dt>boo&#160;</dt><dd>baz
2564 </dd></dl>
2565 </li></ol>
2566 </li></ul>
2567 </li></ol>
2568 </li></ul>
2570 !! end
2571 !! test
2572 Definition Lists: Mixed Lists: Test 11 (parsoid)
2573 !! options
2574 parsoid
2575 !! input
2576 *#*#;*;;foo :bar
2577 *#*#;boo :baz
2578 !! result
2579 <ul>
2580 <li>
2581 <ol>
2582 <li>
2583 <ul>
2584 <li>
2585 <ol>
2586 <li>
2587 <dl>
2588 <dt>
2589 <ul>
2590 <li>
2591 <dl>
2592 <dt>
2593 <dl>
2594 <dt>foo<span typeof="mw:Placeholder" data-parsoid='{"src":" "}'>&nbsp;</span></dt>
2595 <dd data-parsoid='{"stx":"row"}'>bar</dd></dl></dt></dl></li></ul></dt>
2596 <dt>boo<span typeof="mw:Placeholder" data-parsoid='{"src":" "}'>&nbsp;</span></dt>
2597 <dd data-parsoid='{"stx":"row"}'>baz</dd></dl></li></ol></li></ul></li></ol></li></ul>
2598 !! end
2601 !! test
2602 Definition Lists: Weird Ones: Test 1 (php)
2603 !! options
2605 !! input
2606 *#;*::;; foo : bar (who uses this?)
2607 !! result
2608 <ul><li><ol><li><dl><dt> foo&#160;</dt><dd><ul><li><dl><dd><dl><dd><dl><dt><dl><dt> bar (who uses this?)
2609 </dt></dl>
2610 </dd></dl>
2611 </dd></dl>
2612 </dd></dl>
2613 </li></ul>
2614 </dd></dl>
2615 </li></ol>
2616 </li></ul>
2618 !! end
2619 !! test
2620 Definition Lists: Weird Ones: Test 1 (parsoid)
2621 !! options
2622 parsoid
2623 !! input
2624 *#;*::;; foo : bar (who uses this?)
2625 !! result
2626 <ul>
2627 <li>
2628 <ol>
2629 <li>
2630 <dl>
2631 <dt>
2632 <ul>
2633 <li>
2634 <dl>
2635 <dd>
2636 <dl>
2637 <dd>
2638 <dl>
2639 <dt>
2640 <dl>
2641 <dt> foo<span typeof="mw:Placeholder" data-parsoid='{"src":" "}'>&nbsp;</span></dt>
2642 <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>
2643 !! end
2646 ### External links
2648 !! test
2649 External links: non-bracketed
2650 !! input
2651 Non-bracketed: http://example.com
2652 !! result
2653 <p>Non-bracketed: <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
2654 </p>
2655 !! end
2657 !! test
2658 External links: numbered
2659 !! input
2660 Numbered: [http://example.com]
2661 Numbered: [http://example.net]
2662 Numbered: [http://example.com]
2663 !! result
2664 <p>Numbered: <a rel="nofollow" class="external autonumber" href="http://example.com">[1]</a>
2665 Numbered: <a rel="nofollow" class="external autonumber" href="http://example.net">[2]</a>
2666 Numbered: <a rel="nofollow" class="external autonumber" href="http://example.com">[3]</a>
2667 </p>
2668 !!end
2670 !! test
2671 External links: specified text
2672 !! input
2673 Specified text: [http://example.com link]
2674 !! result
2675 <p>Specified text: <a rel="nofollow" class="external text" href="http://example.com">link</a>
2676 </p>
2677 !!end
2679 !! test
2680 External links: trail
2681 !! input
2682 Linktrails should not work for external links: [http://example.com link]s
2683 !! result
2684 <p>Linktrails should not work for external links: <a rel="nofollow" class="external text" href="http://example.com">link</a>s
2685 </p>
2686 !! end
2688 !! test
2689 External links: dollar sign in URL
2690 !! input
2691 http://example.com/1$2345
2692 !! result
2693 <p><a rel="nofollow" class="external free" href="http://example.com/1$2345">http://example.com/1$2345</a>
2694 </p>
2695 !! end
2697 !! test
2698 External links: dollar sign in URL (named)
2699 !! input
2700 [http://example.com/1$2345]
2701 !! result
2702 <p><a rel="nofollow" class="external autonumber" href="http://example.com/1$2345">[1]</a>
2703 </p>
2704 !!end
2706 !! test
2707 External links: open square bracket forbidden in URL (bug 4377)
2708 !! input
2709 http://example.com/1[2345
2710 !! result
2711 <p><a rel="nofollow" class="external free" href="http://example.com/1">http://example.com/1</a>[2345
2712 </p>
2713 !! end
2715 !! test
2716 External links: open square bracket forbidden in URL (named) (bug 4377)
2717 !! input
2718 [http://example.com/1[2345]
2719 !! result
2720 <p><a rel="nofollow" class="external text" href="http://example.com/1">[2345</a>
2721 </p>
2722 !!end
2724 !! test
2725 External links: nowiki in URL link text (bug 6230)
2726 !!input
2727 [http://example.com/ <nowiki>''example site''</nowiki>]
2728 !! result
2729 <p><a rel="nofollow" class="external text" href="http://example.com/">''example site''</a>
2730 </p>
2731 !! end
2733 !! test
2734 External links: newline forbidden in text (bug 6230 regression check)
2735 !! input
2736 [http://example.com/ first
2737 second]
2738 !! result
2739 <p>[<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a> first
2740 second]
2741 </p>
2742 !!end
2744 !! test
2745 External links: Pipe char between url and text
2746 !! input
2747 [http://example.com | link]
2748 !! result
2749 <p><a rel="nofollow" class="external text" href="http://example.com">| link</a>
2750 </p>
2751 !!end
2753 !! test
2754 External links: protocol-relative URL in brackets
2755 !! input
2756 [//example.com/ Test]
2757 !! result
2758 <p><a rel="nofollow" class="external text" href="//example.com/">Test</a>
2759 </p>
2760 !! end
2762 !! test
2763 External links: protocol-relative URL in brackets without text
2764 !! input
2765 [//example.com]
2766 !! result
2767 <p><a rel="nofollow" class="external autonumber" href="//example.com">[1]</a>
2768 </p>
2769 !! end
2771 !! test
2772 External links: protocol-relative URL in free text is left alone
2773 !! input
2774 //example.com/Foo
2775 !! result
2776 <p>//example.com/Foo
2777 </p>
2778 !!end
2780 !! test
2781 External links: protocol-relative URL in the middle of a word is left alone (bug 30269)
2782 !! input
2783 foo//example.com/Foo
2784 !! result
2785 <p>foo//example.com/Foo
2786 </p>
2787 !! end
2789 !! test
2790 External image
2791 !! input
2792 External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
2793 !! result
2794 <p>External image: <img src="http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" />
2795 </p>
2796 !! end
2798 !! test
2799 External image from https
2800 !! input
2801 External image from https: https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
2802 !! result
2803 <p>External image from https: <img src="https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" />
2804 </p>
2805 !! end
2807 !! test
2808 External image (when not allowed)
2809 !! options
2810 wgAllowExternalImages=0
2811 !! input
2812 External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
2813 !! result
2814 <p>External image: <a rel="nofollow" class="external free" href="http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png">http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png</a>
2815 </p>
2816 !! end
2818 !! test
2819 Link to non-http image, no img tag
2820 !! input
2821 Link to non-http image, no img tag: ftp://example.com/test.jpg
2822 !! result
2823 <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>
2824 </p>
2825 !! end
2827 !! test
2828 External links: terminating separator
2829 !! input
2830 Terminating separator: http://example.com/thing,
2831 !! result
2832 <p>Terminating separator: <a rel="nofollow" class="external free" href="http://example.com/thing">http://example.com/thing</a>,
2833 </p>
2834 !! end
2836 !! test
2837 External links: intervening separator
2838 !! input
2839 Intervening separator: http://example.com/1,2,3
2840 !! result
2841 <p>Intervening separator: <a rel="nofollow" class="external free" href="http://example.com/1,2,3">http://example.com/1,2,3</a>
2842 </p>
2843 !! end
2845 !! test
2846 External links: old bug with URL in query
2847 !! input
2848 Old bug with URL in query: [http://example.com/thing?url=http://example.com link]
2849 !! result
2850 <p>Old bug with URL in query: <a rel="nofollow" class="external text" href="http://example.com/thing?url=http://example.com">link</a>
2851 </p>
2852 !! end
2854 !! test
2855 External links: old URL-in-URL bug, mixed protocols
2856 !! input
2857 And again with mixed protocols: [ftp://example.com?url=http://example.com link]
2858 !! result
2859 <p>And again with mixed protocols: <a rel="nofollow" class="external text" href="ftp://example.com?url=http://example.com">link</a>
2860 </p>
2861 !!end
2863 !! test
2864 External links: URL in text
2865 !! input
2866 URL in text: [http://example.com http://example.com]
2867 !! result
2868 <p>URL in text: <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
2869 </p>
2870 !! end
2872 !! test
2873 External links: Clickable images
2874 !! input
2875 ja-style clickable images: [http://example.com http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png]
2876 !! result
2877 <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>
2878 </p>
2879 !!end
2881 !! test
2882 External links: raw ampersand
2883 !! input
2884 Old &amp; use: http://x&y
2885 !! result
2886 <p>Old &amp; use: <a rel="nofollow" class="external free" href="http://x&amp;y">http://x&amp;y</a>
2887 </p>
2888 !! end
2890 !! test
2891 External links: encoded ampersand
2892 !! input
2893 Old &amp; use: http://x&amp;y
2894 !! result
2895 <p>Old &amp; use: <a rel="nofollow" class="external free" href="http://x&amp;y">http://x&amp;y</a>
2896 </p>
2897 !! end
2899 !! test
2900 External links: encoded equals (bug 6102)
2901 !! input
2902 http://example.com/?foo&#61;bar
2903 !! result
2904 <p><a rel="nofollow" class="external free" href="http://example.com/?foo=bar">http://example.com/?foo=bar</a>
2905 </p>
2906 !! end
2908 !! test
2909 External links: [raw ampersand]
2910 !! input
2911 Old &amp; use: [http://x&y]
2912 !! result
2913 <p>Old &amp; use: <a rel="nofollow" class="external autonumber" href="http://x&amp;y">[1]</a>
2914 </p>
2915 !! end
2917 !! test
2918 External links: [encoded ampersand]
2919 !! input
2920 Old &amp; use: [http://x&amp;y]
2921 !! result
2922 <p>Old &amp; use: <a rel="nofollow" class="external autonumber" href="http://x&amp;y">[1]</a>
2923 </p>
2924 !! end
2926 !! test
2927 External links: [encoded equals] (bug 6102)
2928 !! input
2929 [http://example.com/?foo&#61;bar]
2930 !! result
2931 <p><a rel="nofollow" class="external autonumber" href="http://example.com/?foo=bar">[1]</a>
2932 </p>
2933 !! end
2935 !! test
2936 External links: [IDN ignored character reference in hostname; strip it right off]
2937 !! input
2938 [http://e&zwnj;xample.com/]
2939 !! result
2940 <p><a rel="nofollow" class="external autonumber" href="http://example.com/">[1]</a>
2941 </p>
2942 !! end
2944 # FIXME: This test (the IDN characters in the text of a link) is an inconsistency.
2945 # Where an external link could easily circumvent the sanitization of the text of
2946 # a link like this (where an IDN-ignore character is in the URL somewhere), this
2947 # test demands a higher standard. That's a bit strange.
2949 # Example:
2951 # http://e‌xample.com -> [http://example.com|http://example.com]
2952 # [http://example.com|http://e‌xample.com] -> [http://example.com|http://e‌xample.com]
2954 # The first example is sanitized, but the second is not. Any security benefits
2955 # from this production are trivial to circumvent. Either remove this test and
2956 # let the parser(s) do their thing unaccosted, or fix the inconsistency and change
2957 # the test accordingly.
2959 # All our love,
2960 # The Parsoid team.
2961 !! test
2962 External links: IDN ignored character reference in hostname; strip it right off
2963 !! input
2964 http://e&zwnj;xample.com/
2965 !! result
2966 <p><a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>
2967 </p>
2968 !! end
2970 !! test
2971 External links: www.jpeg.org (bug 554)
2972 !! input
2973 http://www.jpeg.org
2974 !!result
2975 <p><a rel="nofollow" class="external free" href="http://www.jpeg.org">http://www.jpeg.org</a>
2976 </p>
2977 !! end
2979 !! test
2980 External links: URL within URL (original bug 2)
2981 !! input
2982 [http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp]
2983 !! result
2984 <p><a rel="nofollow" class="external autonumber" href="http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp">[1]</a>
2985 </p>
2986 !! end
2988 !! test
2989 BUG 361: URL inside bracketed URL
2990 !! input
2991 [http://www.example.com/foo http://www.example.com/bar]
2992 !! result
2993 <p><a rel="nofollow" class="external text" href="http://www.example.com/foo">http://www.example.com/bar</a>
2994 </p>
2995 !! end
2997 !! test
2998 BUG 361: URL within URL, not bracketed
2999 !! input
3000 http://www.example.com/foo?=http://www.example.com/bar
3001 !! result
3002 <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>
3003 </p>
3004 !! end
3006 !! test
3007 BUG 289: ">"-token in URL-tail
3008 !! input
3009 http://www.example.com/<hello>
3010 !! result
3011 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a>&lt;hello&gt;
3012 </p>
3013 !!end
3015 !! test
3016 BUG 289: literal ">"-token in URL-tail
3017 !! input
3018 http://www.example.com/<b>html</b>
3019 !! result
3020 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a><b>html</b>
3021 </p>
3022 !!end
3024 !! test
3025 BUG 289: ">"-token in bracketed URL
3026 !! input
3027 [http://www.example.com/<hello> stuff]
3028 !! result
3029 <p><a rel="nofollow" class="external text" href="http://www.example.com/">&lt;hello&gt; stuff</a>
3030 </p>
3031 !!end
3033 !! test
3034 BUG 289: literal ">"-token in bracketed URL
3035 !! input
3036 [http://www.example.com/<b>html</b> stuff]
3037 !! result
3038 <p><a rel="nofollow" class="external text" href="http://www.example.com/"><b>html</b> stuff</a>
3039 </p>
3040 !!end
3042 !! test
3043 BUG 289: literal double quote at end of URL
3044 !! input
3045 http://www.example.com/"hello"
3046 !! result
3047 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a>"hello"
3048 </p>
3049 !!end
3051 !! test
3052 BUG 289: literal double quote in bracketed URL
3053 !! input
3054 [http://www.example.com/"hello" stuff]
3055 !! result
3056 <p><a rel="nofollow" class="external text" href="http://www.example.com/">"hello" stuff</a>
3057 </p>
3058 !!end
3060 !! test
3061 External links: multiple legal whitespace is fine, Magnus. Don't break it please. (bug 5081)
3062 !! input
3063 [http://www.example.com  test]
3064 !! result
3065 <p><a rel="nofollow" class="external text" href="http://www.example.com">test</a>
3066 </p>
3067 !! end
3069 !! test
3070 External links: link text with spaces
3071 !! input
3072 [http://www.example.com a b c]
3073 [http://www.example.com ''a'' ''b'']
3074 !! result
3075 <p><a rel="nofollow" class="external text" href="http://www.example.com">a b c</a>
3076 <a rel="nofollow" class="external text" href="http://www.example.com"><i>a</i> <i>b</i></a>
3077 </p>
3078 !! end
3080 !! test
3081 External links: wiki links within external link (Bug 3695)
3082 !! input
3083 [http://example.com [[wikilink]] embedded in ext link]
3084 !! result
3085 <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>
3086 </p>
3087 !! end
3089 !! test
3090 BUG 787: Links with one slash after the url protocol are invalid
3091 !! input
3092 http:/example.com
3094 [http:/example.com title]
3095 !! result
3096 <p>http:/example.com
3097 </p><p>[http:/example.com title]
3098 </p>
3099 !! end
3101 !! test
3102 Bracketed external links with template-generated invalid target
3103 !! input
3104 [{{echo|http:/example.com}} title]
3105 !! result
3106 <p>[http:/example.com title]
3107 </p>
3108 !! end
3110 !! test
3111 Bug 2702: Mismatched <i>, <b> and <a> tags are invalid
3112 !! input
3113 ''[http://example.com text'']
3114 [http://example.com '''text]'''
3115 ''Something [http://example.com in italic'']
3116 ''Something [http://example.com mixed''''', even bold]'''
3117 '''''Now [http://example.com both''''']
3118 !! result
3119 <p><a rel="nofollow" class="external text" href="http://example.com"><i>text</i></a>
3120 <a rel="nofollow" class="external text" href="http://example.com"><b>text</b></a>
3121 <i>Something </i><a rel="nofollow" class="external text" href="http://example.com"><i>in italic</i></a>
3122 <i>Something </i><a rel="nofollow" class="external text" href="http://example.com"><i>mixed</i><b>, even bold</b></a>
3123 <i><b>Now </b></i><a rel="nofollow" class="external text" href="http://example.com"><i><b>both</b></i></a>
3124 </p>
3125 !! end
3128 !! test
3129 Bug 4781: %26 in URL
3130 !! input
3131 http://www.example.com/?title=AT%26T
3132 !! result
3133 <p><a rel="nofollow" class="external free" href="http://www.example.com/?title=AT%26T">http://www.example.com/?title=AT%26T</a>
3134 </p>
3135 !! end
3137 # According to http://dev.w3.org/html5/spec/Overview.html#parsing-urls a plain
3138 # % is actually legal in HTML5. Any change in output would need testing though.
3139 !! test
3140 Bug 4781, 5267: %25 in URL
3141 !! input
3142 http://www.example.com/?title=100%25_Bran
3143 !! result
3144 <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>
3145 </p>
3146 !! end
3148 !! test
3149 Bug 4781, 5267: %28, %29 in URL
3150 !! input
3151 http://www.example.com/?title=Ben-Hur_%281959_film%29
3152 !! result
3153 <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>
3154 </p>
3155 !! end
3158 !! test
3159 Bug 4781: %26 in autonumber URL
3160 !! input
3161 [http://www.example.com/?title=AT%26T]
3162 !! result
3163 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=AT%26T">[1]</a>
3164 </p>
3165 !! end
3167 !! test
3168 Bug 4781, 5267: %26 in autonumber URL
3169 !! input
3170 [http://www.example.com/?title=100%25_Bran]
3171 !! result
3172 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=100%25_Bran">[1]</a>
3173 </p>
3174 !! end
3176 !! test
3177 Bug 4781, 5267: %28, %29 in autonumber URL
3178 !! input
3179 [http://www.example.com/?title=Ben-Hur_%281959_film%29]
3180 !! result
3181 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">[1]</a>
3182 </p>
3183 !! end
3186 !! test
3187 Bug 4781: %26 in bracketed URL
3188 !! input
3189 [http://www.example.com/?title=AT%26T link]
3190 !! result
3191 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=AT%26T">link</a>
3192 </p>
3193 !! end
3195 !! test
3196 Bug 4781, 5267: %26 in bracketed URL
3197 !! input
3198 [http://www.example.com/?title=100%25_Bran link]
3199 !! result
3200 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=100%25_Bran">link</a>
3201 </p>
3202 !! end
3204 !! test
3205 Bug 4781, 5267: %28, %29 in bracketed URL
3206 !! input
3207 [http://www.example.com/?title=Ben-Hur_%281959_film%29 link]
3208 !! result
3209 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">link</a>
3210 </p>
3211 !! end
3213 !! test
3214 External link containing double-single-quotes in text '' (bug 4598 sanity check)
3215 !! input
3216 Some [http://example.com/ pretty ''italics'' and stuff]!
3217 !! result
3218 <p>Some <a rel="nofollow" class="external text" href="http://example.com/">pretty <i>italics</i> and stuff</a>!
3219 </p>
3220 !! end
3222 !! test
3223 External link containing double-single-quotes in text embedded in italics (bug 4598 sanity check)
3224 !! input
3225 ''Some [http://example.com/ pretty ''italics'' and stuff]!''
3226 !! result
3227 <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>
3228 </p>
3229 !! end
3231 !! test
3232 External link containing double-single-quotes with no space separating the url from text in italics
3233 !! input
3234 [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]].]
3235 !! result
3236 <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>
3237 </p>
3238 !! end
3240 !! test
3241 External link with comments in link text
3242 !! input
3243 [http://www.google.com Google <!-- comment -->]
3244 !! result
3245 <p><a rel="nofollow" class="external text" href="http://www.google.com">Google </a>
3246 </p>
3247 !! end
3249 !! test
3250 URL-encoding in URL functions (single parameter)
3251 !! input
3252 {{localurl:Some page|amp=&}}
3253 !! result
3254 <p>/index.php?title=Some_page&amp;amp=&amp;
3255 </p>
3256 !! end
3258 !! test
3259 URL-encoding in URL functions (multiple parameters)
3260 !! input
3261 {{localurl:Some page|q=?&amp=&}}
3262 !! result
3263 <p>/index.php?title=Some_page&amp;q=?&amp;amp=&amp;
3264 </p>
3265 !! end
3267 !! test
3268 Brackets in urls
3269 !! input
3270 http://example.com/index.php?foozoid%5B%5D=bar
3272 http://example.com/index.php?foozoid&#x5B;&#x5D;=bar
3273 !! result
3274 <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>
3275 </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>
3276 </p>
3277 !! end
3279 !! test
3280 IPv6 urls (bug 21261)
3281 !! options
3282 disabled
3283 !! input
3284 http://[2404:130:0:1000::187:2]/index.php
3285 !! result
3286 <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>
3287 </p>
3288 !! end
3290 !! test
3291 Non-extlinks in brackets
3292 !! input
3293 [foo]
3294 [foo bar]
3295 [foo ''bar'']
3296 [fool's] errand
3297 [fool's errand]
3298 [{{echo|foo}}]
3299 [{{echo|foo}} bar]
3300 [{{echo|foo}} ''bar'']
3301 [{{echo|foo}}l's] errand
3302 [{{echo|foo}}l's errand]
3303 [url={{echo|foo}}]
3304 [url=http://example.com]
3305 !! result
3306 <p>[foo]
3307 [foo bar]
3308 [foo <i>bar</i>]
3309 [fool's] errand
3310 [fool's errand]
3311 [foo]
3312 [foo bar]
3313 [foo <i>bar</i>]
3314 [fool's] errand
3315 [fool's errand]
3316 [url=foo]
3317 [url=<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>]
3318 </p>
3319 !! end
3321 !! test
3322 Parsoid: Percent encoding in external links
3323 !! options
3324 parsoid
3325 !! input
3326 [https://github.com/search?l=&q=ResourceLoader+%40wikimedia Search]
3327 !! result
3328 <p><a rel="mw:ExtLink"
3329 href="https://github.com/search?l=&amp;q=ResourceLoader+%40wikimedia">Search</a></p>
3330 !! end
3332 !! test
3333 Parsoid: use url link syntax for links where the content is equal the link
3334 target
3335 !! options
3336 parsoid
3337 !! input
3338 http://example.com
3339 !! result
3340 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a></p>
3341 !! end
3344 ### Quotes
3347 !! test
3348 Quotes
3349 !! input
3350 Normal text. '''Bold text.''' Normal text. ''Italic text.''
3352 Normal text. '''''Bold italic text.''''' Normal text.
3353 !!result
3354 <p>Normal text. <b>Bold text.</b> Normal text. <i>Italic text.</i>
3355 </p><p>Normal text. <i><b>Bold italic text.</b></i> Normal text.
3356 </p>
3357 !! end
3360 !! test
3361 Unclosed and unmatched quotes (php)
3362 !! options
3364 !! input
3365 '''''Bold italic text '''with bold deactivated''' in between.'''''
3367 '''''Bold italic text ''with italic deactivated'' in between.'''''
3369 '''Bold text..
3371 ..spanning two paragraphs (should not work).'''
3373 '''Bold tag left open
3375 ''Italic tag left open
3377 Normal text.
3379 <!-- Unmatching number of opening, closing tags: -->
3380 '''This year''''s election ''should'' beat '''last year''''s.
3382 ''Tom'''s car is bigger than ''Susan'''s.
3384 Plain ''italic'''s plain
3385 !! result
3386 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
3387 </p><p><b><i>Bold italic text </i>with italic deactivated<i> in between.</i></b>
3388 </p><p><b>Bold text..</b>
3389 </p><p>..spanning two paragraphs (should not work).
3390 </p><p><b>Bold tag left open</b>
3391 </p><p><i>Italic tag left open</i>
3392 </p><p>Normal text.
3393 </p><p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
3394 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
3395 </p><p>Plain <i>italic'</i>s plain
3396 </p>
3397 !! end
3398 # Parsoid inserts an empty bold tag pair at the end of the line, that the PHP
3399 # parser strips. The wikitext contains just the first half of the bold
3400 # quote pair. (There's also a case where Parsoid nests <b> and <i>
3401 # differently than the PHP parser.)
3402 !! test
3403 Unclosed and unmatched quotes (parsoid)
3404 !! options
3405 parsoid
3406 !! input
3407 '''''Bold italic text '''with bold deactivated''' in between.'''''
3409 '''''Bold italic text ''with italic deactivated'' in between.'''''
3411 '''Bold text..
3413 ..spanning two paragraphs (should not work).'''
3415 '''Bold tag left open
3417 ''Italic tag left open
3419 Normal text.
3421 <!-- Unmatching number of opening, closing tags: -->
3422 '''This year''''s election ''should'' beat '''last year''''s.
3424 ''Tom'''s car is bigger than ''Susan'''s.
3426 Plain ''italic'''s plain
3427 !! result
3428 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
3429 </p><p><i><b>Bold italic text </b></i><b>with italic deactivated<i> in between.</i></b>
3430 </p><p><b>Bold text..</b>
3431 </p><p>..spanning two paragraphs (should not work).<b></b>
3432 </p><p><b>Bold tag left open</b>
3433 </p><p><i>Italic tag left open</i>
3434 </p><p>Normal text.
3435 </p><p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
3436 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
3437 </p><p>Plain <i>italic'</i>s plain
3438 </p>
3439 !! end
3442 ### Tables
3444 ### some content taken from http://meta.wikimedia.org/wiki/MediaWiki_User%27s_Guide:_Using_tables
3447 # This should not produce <table></table> as <table><tr><td></td></tr></table>
3448 # is the bare minimum required by the spec, see:
3449 # http://www.w3.org/TR/xhtml-modularization/dtd_module_defs.html#a_module_Basic_Tables
3450 !! test
3451 A table with no data. (php)
3452 !! options
3454 !! input
3455 {||}
3456 !! result
3457 !! end
3458 # Parsoid team replies: empty table tags are legal in HTML5
3459 !! test
3460 A table with no data. (parsoid)
3461 !! options
3462 parsoid
3463 !! input
3464 {||}
3465 !! result
3466 <table></table>
3467 !! end
3469 # A table with nothing but a caption is invalid XHTML, we might want to render
3470 # this as <p>caption</p>
3471 !! test
3472 A table with nothing but a caption (php)
3473 !! options
3475 !! input
3477 |+ caption
3479 !! result
3480 <table>
3481 <caption> caption
3482 </caption><tr><td></td></tr></table>
3484 !! end
3485 # Parsoid team replies: table with only a caption is legal in HTML5
3486 !! test
3487 A table with nothing but a caption (parsoid)
3488 !! options
3489 parsoid
3490 !! input
3492 |+ caption
3494 !! result
3495 <table><caption> caption</caption></table>
3496 !! end
3498 !! test
3499 A table with caption with default-spaced attributes and a table row
3500 !! input
3502 |+ style="color: red;" | caption1
3504 | foo
3506 !! result
3507 <table>
3508 <caption style="color: red;"> caption1
3509 </caption>
3510 <tr>
3511 <td> foo
3512 </td></tr></table>
3514 !! end
3516 !! test
3517 A table with captions with non-default spaced attributes and a table row
3518 !! input
3520 |+style="color: red;"|caption2
3521 |+ style="color: red;"| caption3
3523 | foo
3525 !! result
3526 <table>
3527 <caption style="color: red;">caption2
3528 </caption>
3529 <caption style="color: red;"> caption3
3530 </caption>
3531 <tr>
3532 <td> foo
3533 </td></tr></table>
3535 !! end
3537 !! test
3538 Table td-cell syntax variations
3539 !! input
3541 | foo bar foo | baz
3542 | foo bar foo || baz
3543 | style='color:red;' | baz
3544 | style='color:red;' || baz
3546 !! result
3547 <table>
3548 <tr>
3549 <td> baz
3550 </td>
3551 <td> foo bar foo </td>
3552 <td> baz
3553 </td>
3554 <td style="color:red;"> baz
3555 </td>
3556 <td> style='color:red;' </td>
3557 <td> baz
3558 </td></tr></table>
3560 !! end
3562 !! test
3563 Simple table
3564 !! input
3566 | 1 || 2
3568 | 3 || 4
3570 !! result
3571 <table>
3572 <tr>
3573 <td> 1 </td>
3574 <td> 2
3575 </td></tr>
3576 <tr>
3577 <td> 3 </td>
3578 <td> 4
3579 </td></tr></table>
3581 !! end
3583 !! test
3584 Simple table but with multiple dashes for row wikitext
3585 !! input
3587 | foo
3588 |-----
3589 | bar
3591 !! result
3592 <table>
3593 <tr>
3594 <td> foo
3595 </td></tr>
3596 <tr>
3597 <td> bar
3598 </td></tr></table>
3600 !! end
3601 !! test
3602 Multiplication table
3603 !! input
3604 {| border="1" cellpadding="2"
3605 |+Multiplication table
3607 ! &times; !! 1 !! 2 !! 3
3609 ! 1
3610 | 1 || 2 || 3
3612 ! 2
3613 | 2 || 4 || 6
3615 ! 3
3616 | 3 || 6 || 9
3618 ! 4
3619 | 4 || 8 || 12
3621 ! 5
3622 | 5 || 10 || 15
3624 !! result
3625 <table border="1" cellpadding="2">
3626 <caption>Multiplication table
3627 </caption>
3628 <tr>
3629 <th> &#215; </th>
3630 <th> 1 </th>
3631 <th> 2 </th>
3632 <th> 3
3633 </th></tr>
3634 <tr>
3635 <th> 1
3636 </th>
3637 <td> 1 </td>
3638 <td> 2 </td>
3639 <td> 3
3640 </td></tr>
3641 <tr>
3642 <th> 2
3643 </th>
3644 <td> 2 </td>
3645 <td> 4 </td>
3646 <td> 6
3647 </td></tr>
3648 <tr>
3649 <th> 3
3650 </th>
3651 <td> 3 </td>
3652 <td> 6 </td>
3653 <td> 9
3654 </td></tr>
3655 <tr>
3656 <th> 4
3657 </th>
3658 <td> 4 </td>
3659 <td> 8 </td>
3660 <td> 12
3661 </td></tr>
3662 <tr>
3663 <th> 5
3664 </th>
3665 <td> 5 </td>
3666 <td> 10 </td>
3667 <td> 15
3668 </td></tr></table>
3670 !! end
3672 !! test
3673 Accept "||" in table headings
3674 !! input
3676 !h1 || h2
3678 !! result
3679 <table>
3680 <tr>
3681 <th>h1 </th>
3682 <th> h2
3683 </th></tr></table>
3685 !! end
3687 !! test
3688 Accept "||" in indented table headings
3689 !! input
3691 !h1 || h2
3693 !! result
3694 <dl><dd><table>
3695 <tr>
3696 <th>h1 </th>
3697 <th> h2
3698 </th></tr></table></dd></dl>
3700 !! end
3702 !! test
3703 Accept empty attributes in td/th cells (td/th cells starting with leading ||)
3704 !! input
3706 !| h1
3707 || a
3709 !! result
3710 <table>
3711 <tr>
3712 <th> h1
3713 </th>
3714 <td> a
3715 </td></tr></table>
3717 !! end
3719 !!test
3720 Accept "| !" at start of line in tables (ignore !-attribute)
3721 !!input
3724 | !style="color:red" | bar
3726 !!result
3727 <table>
3729 <tr>
3730 <td> bar
3731 </td></tr></table>
3733 !!end
3735 !!test
3736 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 +/- 
3737 !!input
3740 |style='color:red;'|+1
3741 |style='color:blue;'|-1
3743 | 1 || 2 || 3
3744 | 1 ||+2 ||-3
3746 | +1
3747 | -1
3749 !!result
3750 <table>
3752 <tr>
3753 <td style="color:red;">+1
3754 </td>
3755 <td style="color:blue;">-1
3756 </td></tr>
3757 <tr>
3758 <td> 1 </td>
3759 <td> 2 </td>
3760 <td> 3
3761 </td>
3762 <td> 1 </td>
3763 <td>+2 </td>
3764 <td>-3
3765 </td></tr>
3766 <tr>
3767 <td> +1
3768 </td>
3769 <td> -1
3770 </td></tr></table>
3772 !!end
3774 !! test
3775 Table rowspan
3776 !! input
3777 {| border=1
3778 | Cell 1, row 1
3779 |rowspan=2| Cell 2, row 1 (and 2)
3780 | Cell 3, row 1
3782 | Cell 1, row 2
3783 | Cell 3, row 2
3785 !! result
3786 <table border="1">
3787 <tr>
3788 <td> Cell 1, row 1
3789 </td>
3790 <td rowspan="2"> Cell 2, row 1 (and 2)
3791 </td>
3792 <td> Cell 3, row 1
3793 </td></tr>
3794 <tr>
3795 <td> Cell 1, row 2
3796 </td>
3797 <td> Cell 3, row 2
3798 </td></tr></table>
3800 !! end
3802 !! test
3803 Nested table
3804 !! input
3805 {| border=1
3806 | &alpha;
3808 {| bgcolor=#ABCDEF border=2
3809 |nested
3811 |table
3813 |the original table again
3815 !! result
3816 <table border="1">
3817 <tr>
3818 <td> &#945;
3819 </td>
3820 <td>
3821 <table bgcolor="#ABCDEF" border="2">
3822 <tr>
3823 <td>nested
3824 </td></tr>
3825 <tr>
3826 <td>table
3827 </td></tr></table>
3828 </td>
3829 <td>the original table again
3830 </td></tr></table>
3832 !! end
3834 !! test
3835 Invalid attributes in table cell (bug 1830)
3836 !! input
3838 |Cell:|broken
3840 !! result
3841 <table>
3842 <tr>
3843 <td>broken
3844 </td></tr></table>
3846 !! end
3849 !! test
3850 Table security: embedded pipes (http://lists.wikimedia.org/mailman/htdig/wikitech-l/2006-April/022293.html)
3851 !! input
3853 | |[ftp://|x||]" onmouseover="alert(document.cookie)">test
3854 !! result
3855 <table>
3856 <tr>
3857 <td>[<a rel="nofollow" class="external free" href="ftp://%7Cx">ftp://%7Cx</a></td>
3858 <td>]" onmouseover="alert(document.cookie)"&gt;test
3859 </td>
3860 </tr>
3861 </table>
3863 !! end
3866 !! test
3867 Indented table markup mixed with indented pre content (proposed in bug 6200)
3868 !! input
3869  <table>
3870  <tr>
3871  <td>
3872  Text that should be rendered preformatted
3873  </td>
3874  </tr>
3875  </table>
3876 !! result
3877  <table>
3878  <tr>
3879  <td>
3880 <pre>Text that should be rendered preformatted
3881 </pre>
3882  </td>
3883  </tr>
3884  </table>
3886 !! end
3888 !! test
3889 Template-generated table cell attributes and cell content
3890 !! input
3892 |{{table_attribs}}
3894 !! result
3895 <table>
3896 <tr>
3897 <td style="color: red"> Foo
3898 </td></tr></table>
3900 !! end
3902 !! test
3903 Template-generated table cell attributes and cell content (2)
3904 !! input
3906 |align=center {{table_attribs}}
3908 !! result
3909 <table>
3910 <tr>
3911 <td align="center" style="color: red"> Foo
3912 </td></tr></table>
3914 !! end
3916 !! test
3917 Template-generated table cell attributes and cell content (3)
3918 !! input
3920 |align=center {{table_cells}}
3922 !! result
3923 <table>
3924 <tr>
3925 <td align="center" style="color: red"> Foo </td>
3926 <td> Bar </td>
3927 <td> Baz
3928 </td></tr></table>
3930 !! end
3932 !! test
3933 Table with row followed by newlines and table heading
3934 !! input
3938 ! foo
3940 !! result
3941 <table>
3944 <tr>
3945 <th> foo
3946 </th></tr></table>
3948 !! end
3950 !! test
3951 Table with empty line following the start tag
3952 !! input
3956 | foo
3958 !! result
3959 <table>
3962 <tr>
3963 <td> foo
3964 </td></tr></table>
3966 !! end
3968 # FIXME: Preserve the attribute properly (with an empty string as value) in
3969 # the PHP parser. Parsoid implements the behavior below.
3970 !! test
3971 Table attributes with empty value
3972 !! options
3973 parsoid
3974 !! input
3976 | style=| hello
3978 !! result
3979 <table>
3980 <tbody>
3981 <tr>
3982 <td style=""> hello
3983 </td></tr></tbody></table>
3985 !! end
3987 !! test
3988 Wikitext table with a lot of comments
3989 !! input
3991 <!-- c0 -->
3992 | foo
3993 <!-- c1 -->
3994 |- <!-- c2 -->
3995 <!-- c3 -->
3996 |<!-- c4 -->
3997 <!-- c5 -->
3999 !! result
4000 <table>
4001 <tr>
4002 <td> foo
4003 </td></tr>
4004 <tr>
4005 <td>
4006 </td></tr></table>
4008 !! end
4010 !! test
4011 Wikitext table with double-line table cell
4012 !! input
4017 !! result
4018 <table>
4019 <tr>
4020 <td>a
4021 <p>b
4022 </p>
4023 </td></tr></table>
4025 !! end
4027 !! test
4028 Table cell with a single comment
4029 !! input
4031 | <!-- c1 -->
4032 | a
4034 !! result
4035 <table>
4036 <tr>
4037 <td>
4038 </td>
4039 <td> a
4040 </td></tr></table>
4042 !! end
4044 # The expected HTML structure in this test is debatable. The PHP parser does
4045 # not parse this kind of table at all. The main focus for Parsoid is on
4046 # round-tripping, so this output is ok for now. TODO: revisit!
4047 !! test
4048 Wikitext table with html-syntax row (Parsoid)
4049 !! options
4050 parsoid
4051 !! input
4054 <td>foo</td>
4056 !! result
4057 <table>
4058 <tbody>
4059 <tr>
4060 <td>foo</td></tr></tbody></table>
4061 !! end
4063 !! test
4064 Implicit <td> after a |-
4065 (PHP parser relies on Tidy to add the missing <td> tags)
4066 !! options
4067 parsoid=wt2html,wt2wt
4068 !! input
4073 !! result
4074 <table>
4075 <tr><td>a</td></tr>
4076 </table>
4077 !! end
4079 !! test
4080 Pres should be recognized in an explicit <td> context, but not in an implicit <td> context
4081 (PHP parser relies on Tidy to add the missing <td> tags)
4082 !! options
4083 parsoid=wt2html,wt2wt
4084 !! input
4092 !! result
4093 <table>
4094 <tbody>
4095 <tr><td><pre>a</pre></td></tr>
4096 <tr><td> b</td></tr>
4097 </tbody>
4098 </table>
4099 !! end
4101 !! test
4102 Lists should be recognized in an implicit <td> context
4103 (PHP parser relies on Tidy to add the missing <td> tags)
4104 !! options
4105 parsoid=wt2html,wt2wt
4106 !! input
4111 !! result
4112 <table>
4113 <tr>
4114 <td><ul><li>a</li></ul></td>
4115 </tr>
4116 </table>
4117 !! end
4120 ### Internal links
4122 !! test
4123 Plain link, capitalized
4124 !! input
4125 [[Main Page]]
4126 !! result
4127 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
4128 </p>
4129 !! end
4131 !! test
4132 Plain link, uncapitalized
4133 !! input
4134 [[main Page]]
4135 !! result
4136 <p><a href="/wiki/Main_Page" title="Main Page">main Page</a>
4137 </p>
4138 !! end
4140 !! test
4141 Piped link
4142 !! input
4143 [[Main Page|The Main Page]]
4144 !! result
4145 <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
4146 </p>
4147 !! end
4149 !! test
4150 Piped link with comment in link text
4151 !! input
4152 [[Main Page|The Main<!--front--> Page]]
4153 !! result
4154 <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
4155 </p>
4156 !! end
4158 !! test
4159 Broken link
4160 !! input
4161 [[Zigzagzogzagzig]]
4162 !! result
4163 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig</a>
4164 </p>
4165 !! end
4167 !! test
4168 Broken link with fragment
4169 !! input
4170 [[Zigzagzogzagzig#zug]]
4171 !! result
4172 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig#zug</a>
4173 </p>
4174 !! end
4176 !! test
4177 Special page link with fragment
4178 !! input
4179 [[Special:Version#anchor]]
4180 !! result
4181 <p><a href="/wiki/Special:Version#anchor" title="Special:Version">Special:Version#anchor</a>
4182 </p>
4183 !! end
4185 !! test
4186 Nonexistent special page link with fragment
4187 !! input
4188 [[Special:ThisNameWillHopefullyNeverBeUsed#anchor]]
4189 !! result
4190 <p><a href="/wiki/Special:ThisNameWillHopefullyNeverBeUsed" class="new" title="Special:ThisNameWillHopefullyNeverBeUsed (page does not exist)">Special:ThisNameWillHopefullyNeverBeUsed#anchor</a>
4191 </p>
4192 !! end
4194 !! test
4195 Link with prefix
4196 !! input
4197 xxx[[main Page]], xxx[[Main Page]], Xxx[[main Page]] XXX[[main Page]], XXX[[Main Page]]
4198 !! result
4199 <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>
4200 </p>
4201 !! end
4203 !! test
4204 Link with suffix
4205 !! input
4206 [[Main Page]]xxx, [[Main Page]]XXX, [[Main Page]]!!!
4207 !! result
4208 <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>!!!
4209 </p>
4210 !! end
4212 !! article
4213 prefixed article
4214 !! text
4215 Some text
4216 !! endarticle
4218 !! test
4219 Bug 43661: Piped links with identical prefixes
4220 !! input
4221 [[prefixed article|prefixed articles with spaces]]
4223 [[prefixed article|prefixed articlesaoeu]]
4225 [[Main Page|Main Page test]]
4226 !! result
4227 <p><a href="/wiki/Prefixed_article" title="Prefixed article">prefixed articles with spaces</a>
4228 </p><p><a href="/wiki/Prefixed_article" title="Prefixed article">prefixed articlesaoeu</a>
4229 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page test</a>
4230 </p>
4231 !! end
4234 !! test
4235 Link with HTML entity in suffix / tail
4236 !! input
4237 [[Main Page]]&quot;, [[Main Page]]&#97;
4238 !! result
4239 <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;
4240 </p>
4241 !! end
4243 !! test
4244 Link with 3 brackets
4245 !! input
4246 [[[main page]]]
4247 !! result
4248 <p>[[[main page]]]
4249 </p>
4250 !! end
4252 !! test
4253 Piped link with 3 brackets
4254 !! input
4255 [[[main page|the main page]]]
4256 !! result
4257 <p>[[[main page|the main page]]]
4258 </p>
4259 !! end
4261 !! test
4262 Link with multiple pipes
4263 !! input
4264 [[Main Page|The|Main|Page]]
4265 !! result
4266 <p><a href="/wiki/Main_Page" title="Main Page">The|Main|Page</a>
4267 </p>
4268 !! end
4270 !! test
4271 Link to namespaces
4272 !! input
4273 [[Talk:Parser testing]], [[Meta:Disclaimers]]
4274 !! result
4275 <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>
4276 </p>
4277 !! end
4279 !! test
4280 Piped link to namespace
4281 !! input
4282 [[Meta:Disclaimers|The disclaimers]]
4283 !! result
4284 <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>
4285 </p>
4286 !! end
4288 !! test
4289 Link containing }
4290 !! input
4291 [[Usually caused by a typo (oops}]]
4292 !! result
4293 <p>[[Usually caused by a typo (oops}]]
4294 </p>
4295 !! end
4297 !! test
4298 Link containing % (not as a hex sequence)
4299 !! input
4300 [[7% Solution]]
4301 !! result
4302 <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>
4303 </p>
4304 !! end
4306 !! test
4307 Link containing % as a single hex sequence interpreted to char
4308 !! input
4309 [[7%25 Solution]]
4310 !! result
4311 <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>
4312 </p>
4313 !!end
4315 !! test
4316 Link containing % as a double hex sequence interpreted to hex sequence
4317 !! input
4318 [[7%2525 Solution]]
4319 !! result
4320 <p>[[7%2525 Solution]]
4321 </p>
4322 !!end
4324 !! test
4325 Link containing "#<" and "#>" % as a hex sequences- these are valid section anchors
4326 Example for such a section: == < ==
4327 !! input
4328 [[%23%3c]][[%23%3e]]
4329 !! result
4330 <p><a href="#.3C">#&lt;</a><a href="#.3E">#&gt;</a>
4331 </p>
4332 !! end
4334 !! test
4335 Link containing "<#" and ">#" as a hex sequences
4336 !! input
4337 [[%3c%23]][[%3e%23]]
4338 !! result
4339 <p>[[%3c%23]][[%3e%23]]
4340 </p>
4341 !! end
4343 !! test
4344 Link containing an equals sign
4345 !! input
4346 [[Special:BookSources/isbn=4-00-026157-6]]
4347 !! result
4348 <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>
4349 </p>
4350 !! end
4352 !! article
4353 Foo~bar
4354 !! text
4355 Just a test of an article title containing a tilde.
4356 !! endarticle
4358 # note that links containing signatures, like [[Foo~~~~]], are
4359 # massaged by the pre-save transform (PST) and so the tildes are never
4360 # seen by the parser.
4361 !! test
4362 Link containing a tilde
4363 !! input
4364 [[Foo~bar]]
4365 !! result
4366 <p><a href="/wiki/Foo%7Ebar" title="Foo~bar">Foo~bar</a>
4367 </p>
4368 !! end
4370 !! test
4371 Link containing double-single-quotes '' (bug 4598)
4372 !! input
4373 [[Lista d''e paise d''o munno]]
4374 !! result
4375 <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>
4376 </p>
4377 !! end
4379 !! test
4380 Link containing double-single-quotes '' in text (bug 4598 sanity check)
4381 !! input
4382 Some [[Link|pretty ''italics'' and stuff]]!
4383 !! result
4384 <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>!
4385 </p>
4386 !! end
4388 !! test
4389 Link containing double-single-quotes '' in text embedded in italics (bug 4598 sanity check)
4390 !! input
4391 ''Some [[Link|pretty ''italics'' and stuff]]!
4392 !! result
4393 <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>
4394 </p>
4395 !! end
4397 !! test
4398 Link with double quotes in title part (literal) and alternate part (interpreted)
4399 !! input
4400 [[File:Denys Savchenko ''Pentecoste''.jpg]]
4402 [[''Pentecoste'']]
4404 [[''Pentecoste''|Pentecoste]]
4406 [[''Pentecoste''|''Pentecoste'']]
4407 !! result
4408 <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>
4409 </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>
4410 </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>
4411 </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>
4412 </p>
4413 !! end
4415 !! test
4416 Broken image links with HTML captions (bug 39700)
4417 !! input
4418 [[File:Nonexistent|<script></script>]]
4419 [[File:Nonexistent|100px|<script></script>]]
4420 [[File:Nonexistent|&lt;]]
4421 [[File:Nonexistent|a<i>b</i>c]]
4422 !! result
4423 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script&gt;&lt;/script&gt;</a>
4424 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script&gt;&lt;/script&gt;</a>
4425 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;</a>
4426 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">abc</a>
4427 </p>
4428 !! end
4430 !! test
4431 Plain link to URL
4432 !! input
4433 [[http://www.example.com]]
4434 !! result
4435 <p>[<a rel="nofollow" class="external autonumber" href="http://www.example.com">[1]</a>]
4436 </p>
4437 !! end
4439 !! test
4440 Plain link to URL with link text
4441 !! input
4442 [[http://www.example.com Link text]]
4443 !! result
4444 <p>[<a rel="nofollow" class="external text" href="http://www.example.com">Link text</a>]
4445 </p>
4446 !! end
4448 !! test
4449 Plain link to protocol-relative URL
4450 !! input
4451 [[//www.example.com]]
4452 !! result
4453 <p>[<a rel="nofollow" class="external autonumber" href="//www.example.com">[1]</a>]
4454 </p>
4455 !! end
4457 !! test
4458 Plain link to protocol-relative URL with link text
4459 !! input
4460 [[//www.example.com Link text]]
4461 !! result
4462 <p>[<a rel="nofollow" class="external text" href="//www.example.com">Link text</a>]
4463 </p>
4464 !! end
4466 !! test
4467 Plain link to page with question mark in title
4468 !! input
4469 [[A?b]]
4471 [[A?b|Baz]]
4472 !! result
4473 <p><a href="/wiki/A%3Fb" title="A?b">A?b</a>
4474 </p><p><a href="/wiki/A%3Fb" title="A?b">Baz</a>
4475 </p>
4476 !! end
4479 # I'm fairly sure the expected result here is wrong.
4480 # We want these to be URL links, not pseudo-pages with URLs for titles....
4481 # However the current output is also pretty screwy.
4483 # ----
4484 # I'm changing it to match the current output--it arguably makes more
4485 # sense in the light of the test above. Old expected result was:
4486 #<p>Piped link to URL: <a href="/index.php?title=Http://www.example.com&amp;action=edit" class="new">an example URL</a>
4487 #</p>
4488 # But I think this test is bordering on "garbage in, garbage out" anyway.
4489 # -- wtm
4490 !! test
4491 Piped link to URL
4492 !! input
4493 Piped link to URL: [[http://www.example.com|an example URL]]
4494 !! result
4495 <p>Piped link to URL: [<a rel="nofollow" class="external text" href="http://www.example.com%7Can">example URL</a>]
4496 </p>
4497 !! end
4499 !! test
4500 BUG 2: [[page|http://url/]] should link to page, not http://url/
4501 !! input
4502 [[Main Page|http://url/]]
4503 !! result
4504 <p><a href="/wiki/Main_Page" title="Main Page">http://url/</a>
4505 </p>
4506 !! end
4508 !! test
4509 BUG 337: Escaped self-links should be bold
4510 !! options
4511 title=[[Bug462]]
4512 !! input
4513 [[Bu&#103;462]] [[Bug462]]
4514 !! result
4515 <p><strong class="selflink">Bu&#103;462</strong> <strong class="selflink">Bug462</strong>
4516 </p>
4517 !! end
4519 !! test
4520 Self-link to section should not be bold
4521 !! options
4522 title=[[Main Page]]
4523 !! input
4524 [[Main Page#section]]
4525 !! result
4526 <p><a href="/wiki/Main_Page#section" title="Main Page">Main Page#section</a>
4527 </p>
4528 !! end
4530 !! article
4532 !! text
4533 This is 00.
4534 !! endarticle
4536 !!test
4537 Self-link to numeric title
4538 !!options
4539 title=[[0]]
4540 !!input
4541 [[0]]
4542 !!result
4543 <p><strong class="selflink">0</strong>
4544 </p>
4545 !!end
4547 !!test
4548 Link to numeric-equivalent title
4549 !!options
4550 title=[[0]]
4551 !!input
4552 [[00]]
4553 !!result
4554 <p><a href="/wiki/00" title="00">00</a>
4555 </p>
4556 !!end
4558 !! test
4559 <nowiki> inside a link
4560 !! input
4561 [[Main<nowiki> Page</nowiki>]] [[Main Page|the main page <nowiki>[it's not very good]</nowiki>]]
4562 !! result
4563 <p>[[Main Page]] <a href="/wiki/Main_Page" title="Main Page">the main page [it's not very good]</a>
4564 </p>
4565 !! end
4567 !! test
4568 Non-breaking spaces in title
4569 !! input
4570 [[&nbsp; Main &nbsp; Page &nbsp;]]
4571 !! result
4572 <p><a href="/wiki/Main_Page" title="Main Page">&#160; Main &#160; Page &#160;</a>
4573 </p>
4574 !!end
4576 !! test
4577 Internal link with ca linktrail, surrounded by bold apostrophes (bug 27473 primary issue)
4578 !! options
4579 language=ca
4580 !! input
4581 '''[[Main Page]]'''
4582 !! result
4583 <p><b><a href="/wiki/Main_Page" title="Main Page">Main Page</a></b>
4584 </p>
4585 !! end
4587 !! test
4588 Internal link with ca linktrail, surrounded by italic apostrophes (bug 27473 primary issue)
4589 !! options
4590 language=ca
4591 !! input
4592 ''[[Main Page]]''
4593 !! result
4594 <p><i><a href="/wiki/Main_Page" title="Main Page">Main Page</a></i>
4595 </p>
4596 !! end
4598 !! test
4599 Internal link with en linktrail: no apostrophes (bug 27473)
4600 !! options
4601 language=en
4602 !! input
4603 [[Something]]'nice
4604 !! result
4605 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (page does not exist)">Something</a>'nice
4606 </p>
4607 !! end
4609 !! test
4610 Internal link with ca linktrail with apostrophes (bug 27473)
4611 !! options
4612 language=ca
4613 !! input
4614 [[Something]]'nice
4615 !! result
4616 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (encara no existeix)">Something'nice</a>
4617 </p>
4618 !! end
4620 !! test
4621 Internal link with kaa linktrail with apostrophes (bug 27473)
4622 !! options
4623 language=kaa
4624 !! input
4625 [[Something]]'nice
4626 !! result
4627 <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>
4628 </p>
4629 !! end
4631 !! article
4632 Söfnuður
4633 !! text
4634 Test.
4635 !! endarticle
4637 !! test
4638 Internal link with is link prefix
4639 !! options
4640 language=is
4641 !! input
4642 Aðrir mótmælenda[[söfnuður|söfnuðir]] og
4643 !! result
4644 <p>Aðrir <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðir</a> og
4645 </p>
4646 !! end
4648 !! article
4649 Mótmælendatrú
4650 !! text
4651 Test.
4652 !! endarticle
4654 !! test
4655 Internal link with is link trail and link prefix
4656 !! options
4657 language=is
4658 !! input
4659 [[mótmælendatrú|xxx]]ar
4660 [[mótmælendatrú]]ar
4661 mótmælenda[[söfnuður]]
4662 mótmælenda[[söfnuður|söfnuðir]]
4663 mótmælenda[[söfnuður|söfnuðir]]xxx
4664 !! result
4665 <p><a href="/wiki/M%C3%B3tm%C3%A6lendatr%C3%BA" title="Mótmælendatrú">xxxar</a>
4666 <a href="/wiki/M%C3%B3tm%C3%A6lendatr%C3%BA" title="Mótmælendatrú">mótmælendatrúar</a>
4667 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuður</a>
4668 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðir</a>
4669 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðirxxx</a>
4670 </p>
4671 !! end
4673 !! test
4674 Parsoid link trail escaping
4675 !! options
4676 parsoid=html2wt,html2html
4677 !! input
4678 [[apple]]<nowiki/>s
4679 !! result
4680 <p><a rel="mw:WikiLink" href="Apple">apple</a>s</p>
4681 !! end
4683 !! test
4684 Parsoid link prefix escaping
4685 !! options
4686 language=is
4687 parsoid=html2wt,html2html
4688 !! input
4689 Aðrir mótmælenda<nowiki/>[[söfnuður]]
4690 !! result
4691 <p>Aðrir mótmælenda<a rel="mw:WikiLink" href="Söfnuður">söfnuður</a></p>
4692 !! end
4694 !! test
4695 Parsoid-centric test: Whitespace in ext- and wiki-links should be preserved
4696 !! input
4697 [[Foo|  bar]]
4699 [[Foo|  ''bar'']]
4701 [http://wp.org   foo]
4703 [http://wp.org   ''foo'']
4704 !! result
4705 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">  bar</a>
4706 </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>
4707 </p><p><a rel="nofollow" class="external text" href="http://wp.org">foo</a>
4708 </p><p><a rel="nofollow" class="external text" href="http://wp.org"><i>foo</i></a>
4709 </p>
4710 !! end
4713 ### Interwiki links (see maintenance/interwiki.sql)
4716 !! test
4717 Inline interwiki link
4718 !! input
4719 [[MeatBall:SoftSecurity]]
4720 !! result
4721 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity</a>
4722 </p>
4723 !! end
4725 !! test
4726 Inline interwiki link with empty title (bug 2372)
4727 !! input
4728 [[MeatBall:]]
4729 !! result
4730 <p><a href="http://www.usemod.com/cgi-bin/mb.pl" class="extiw" title="meatball:">MeatBall:</a>
4731 </p>
4732 !! end
4734 !! test
4735 Interwiki link encoding conversion (bug 1636)
4736 !! input
4737 *[[Wikipedia:ro:Olteni&#0355;a]]
4738 *[[Wikipedia:ro:Olteni&#355;a]]
4739 !! result
4740 <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>
4741 </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>
4742 </li></ul>
4744 !! end
4746 !! test
4747 Interwiki link with fragment (bug 2130)
4748 !! input
4749 [[MeatBall:SoftSecurity#foo]]
4750 !! result
4751 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity#foo" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity#foo</a>
4752 </p>
4753 !! end
4755 !! test
4756 Interlanguage link
4757 !! input
4758 Blah blah blah
4759 [[zh:Chinese]]
4760 !!result
4761 <p>Blah blah blah
4762 </p>
4763 !! end
4765 !! test
4766 Double interlanguage link
4767 !! input
4768 Blah blah blah
4769 [[es:Spanish]]
4770 [[zh:Chinese]]
4771 !!result
4772 <p>Blah blah blah
4773 </p>
4774 !! end
4776 !! test
4777 Interlanguage link, with prefix links
4778 !! options
4779 language=ln
4780 !! input
4781 Blah blah blah
4782 [[zh:Chinese]]
4783 !!result
4784 <p>Blah blah blah
4785 </p>
4786 !! end
4788 !! test
4789 Double interlanguage link, with prefix links (bug 8897)
4790 !! options
4791 language=ln
4792 !! input
4793 Blah blah blah
4794 [[es:Spanish]]
4795 [[zh:Chinese]]
4796 !!result
4797 <p>Blah blah blah
4798 </p>
4799 !! end
4801 !! test
4802 Parsoid-specific test: Wikilinks with &nbsp; should RT properly
4803 !! options
4804 language=ln
4805 !! input
4806 [[WW&nbsp;II]]
4807 !!result
4808 <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>
4809 </p>
4810 !! end
4812 !! test
4813 Parsoid: handle constructor well
4814 !! options
4815 parsoid
4816 !! input
4817 [[constructor]]
4819 [[constructor:foo]]
4820 !! result
4821 <p data-parsoid="{&quot;dsr&quot;:[0,15,0,0]}"><a rel="mw:WikiLink" href="./Constructor" data-parsoid="{&quot;stx&quot;:&quot;simple&quot;,&quot;a&quot;:{&quot;href&quot;:&quot;./Constructor&quot;},&quot;sa&quot;:{&quot;href&quot;:&quot;constructor&quot;},&quot;dsr&quot;:[0,15,2,2]}">constructor</a></p>
4824 <p data-parsoid="{&quot;dsr&quot;:[17,36,0,0]}"><a rel="mw:WikiLink" href="./Foo" data-parsoid="{&quot;stx&quot;:&quot;simple&quot;,&quot;a&quot;:{&quot;href&quot;:&quot;./Foo&quot;},&quot;sa&quot;:{&quot;href&quot;:&quot;constructor:foo&quot;},&quot;dsr&quot;:[17,36,2,2]}">constructor:foo</a></p>
4825 !! end
4828 ## Redirects, Parsoid-only
4830 !! test
4831 Simple redirect to page
4832 !! options
4833 parsoid
4834 !! input
4835 #REDIRECT [[Main Page]]
4836 !! result
4837 <link rel="mw:PageProp/redirect" href="./Main_Page">
4838 !! end
4840 !! test
4841 Redirect to category
4842 !! options
4843 parsoid=wt2html
4844 !! input
4845 #REDIRECT [[Category:Foo]]
4846 !! result
4847 <link rel="mw:PageProp/redirect" href="./Category:Foo"><link rel="mw:WikiLink/Category" href="./Category:Foo">
4848 !! end
4850 !! test
4851 Redirect to category page
4852 !! options
4853 parsoid=wt2html,html2html
4854 !! input
4855 #REDIRECT [[:Category:Foo]]
4856 !! result
4857 <p><a rel="mw:WikiLink" href="Category:Foo">Category:Foo</a></p>
4858 !! end
4860 !! test
4861 Redirect to image page
4862 !! options
4863 parsoid
4864 !! input
4865 #REDIRECT [[File:Wiki.png]]
4866 !! result
4867 <link rel="mw:PageProp/redirect" href="./File:Wiki.png">
4868 !! end
4870 !! test
4871 Redirect to language
4872 !! options
4873 parsoid
4874 !! input
4875 #REDIRECT [[en:File:Wiki.png]]
4876 !! result
4877 <link rel="mw:PageProp/redirect" href="File:Wiki.png">
4878 !! end
4880 !! test
4881 Redirect to interwiki
4882 !! options
4883 parsoid
4884 !! input
4885 #REDIRECT [[meatball:File:Wiki.png]]
4886 !! result
4887 <link rel="mw:PageProp/redirect" href="File:Wiki.png">
4888 !! end
4891 ## XHTML tidiness
4894 !! test
4895 <br> to <br />
4896 !! input
4897 1<br>2<br />3
4898 !! result
4899 <p>1<br />2<br />3
4900 </p>
4901 !! end
4903 !! test
4904 Broken br tag sanitization
4905 !! options
4907 !! input
4908 </br>
4909 !! result
4910 <p>&lt;/br&gt;
4911 </p>
4912 !! end
4914 # TODO: Fix html2html mode (bug 51055)!
4915 !! test
4916 Parsoid: Broken br tag recognition
4917 !! options
4918 parsoid=wt2html
4919 !! input
4920 </br>
4921 !! result
4922 <p><br></p>
4923 !! end
4925 !! test
4926 Incorrecly removing closing slashes from correctly formed XHTML
4927 !! input
4928 <br style="clear:both;" />
4929 !! result
4930 <p><br style="clear:both;" />
4931 </p>
4932 !! end
4934 !! test
4935 Failing to transform badly formed HTML into correct XHTML
4936 !! input
4937 <br style="clear: left;">
4938 <br style="clear: right;">
4939 <br style="clear: both;">
4940 !! result
4941 <p><br style="clear: left;" />
4942 <br style="clear: right;" />
4943 <br style="clear: both;" />
4944 </p>
4945 !!end
4947 !! test
4948 Handling html with a div self-closing tag
4949 !! input
4950 <div title />
4951 <div title/>
4952 <div title/ >
4953 <div title=bar />
4954 <div title=bar/>
4955 <div title=bar/ >
4956 !! result
4957 <p>&lt;div title /&gt;
4958 &lt;div title/&gt;
4959 </p>
4960 <div>
4961 <p>&lt;div title=bar /&gt;
4962 &lt;div title=bar/&gt;
4963 </p>
4964 <div title="bar/"></div>
4965 </div>
4967 !! end
4969 !! test
4970 Handling html with a br self-closing tag
4971 !! input
4972 <br title />
4973 <br title/>
4974 <br title/ >
4975 <br title=bar />
4976 <br title=bar/>
4977 <br title=bar/ >
4978 !! result
4979 <p><br title="title" />
4980 <br title="title" />
4981 <br />
4982 <br title="bar" />
4983 <br title="bar" />
4984 <br title="bar/" />
4985 </p>
4986 !! end
4988 !! test
4989 Horizontal ruler (should it add that extra space?)
4990 !! input
4991 <hr>
4992 <hr >
4993 foo <hr
4994 > bar
4995 !! result
4996 <hr />
4997 <hr />
4998 foo <hr /> bar
5000 !! end
5002 !! test
5003 Horizontal ruler -- 4+ dashes render hr
5004 !! input
5005 ----
5006 !! result
5007 <hr />
5009 !! end
5011 !! test
5012 Horizontal ruler -- eats additional dashes on the same line
5013 !! input
5014 ---------
5015 !! result
5016 <hr />
5018 !! end
5020 !! test
5021 Horizontal ruler -- does not collapse dashes on consecutive lines
5022 !! input
5023 ----
5024 ----
5025 !! result
5026 <hr />
5027 <hr />
5029 !! end
5031 !! test
5032 Horizontal ruler -- <4 dashes render as plain text
5033 !! input
5035 !! result
5036 <p>---
5037 </p>
5038 !! end
5040 !! test
5041 Horizontal ruler -- Supports content following dashes on same line
5042 !! input
5043 ---- Foo
5044 !! result
5045 <hr /> Foo
5047 !! end
5050 ### Block-level elements
5052 !! test
5053 Common list
5054 !! input
5055 *Common list
5056 * item 2
5057 *item 3
5058 !! result
5059 <ul><li>Common list
5060 </li><li> item 2
5061 </li><li>item 3
5062 </li></ul>
5064 !! end
5066 !! test
5067 Numbered list
5068 !! input
5069 #Numbered list
5070 #item 2
5071 # item 3
5072 !! result
5073 <ol><li>Numbered list
5074 </li><li>item 2
5075 </li><li> item 3
5076 </li></ol>
5078 !! end
5080 !! test
5081 Mixed list
5082 !! input
5083 *Mixed list
5084 *# with numbers
5085 ** and bullets
5086 *# and numbers
5087 *bullets again
5088 **bullet level 2
5089 ***bullet level 3
5090 ***#Number on level 4
5091 **bullet level 2
5092 **#Number on level 3
5093 **#Number on level 3
5094 *#number level 2
5095 *Level 1
5096 *** Level 3
5097 #** Level 3, but ordered
5098 !! result
5099 <ul><li>Mixed list
5100 <ol><li> with numbers
5101 </li></ol>
5102 <ul><li> and bullets
5103 </li></ul>
5104 <ol><li> and numbers
5105 </li></ol>
5106 </li><li>bullets again
5107 <ul><li>bullet level 2
5108 <ul><li>bullet level 3
5109 <ol><li>Number on level 4
5110 </li></ol>
5111 </li></ul>
5112 </li><li>bullet level 2
5113 <ol><li>Number on level 3
5114 </li><li>Number on level 3
5115 </li></ol>
5116 </li></ul>
5117 <ol><li>number level 2
5118 </li></ol>
5119 </li><li>Level 1
5120 <ul><li><ul><li> Level 3
5121 </li></ul>
5122 </li></ul>
5123 </li></ul>
5124 <ol><li><ul><li><ul><li> Level 3, but ordered
5125 </li></ul>
5126 </li></ul>
5127 </li></ol>
5129 !! end
5131 !! test
5132 Nested lists 1
5133 !! input
5134 *foo
5135 **bar
5136 !! result
5137 <ul><li>foo
5138 <ul><li>bar
5139 </li></ul>
5140 </li></ul>
5142 !! end
5144 !! test
5145 Nested lists 2
5146 !! input
5147 **foo
5148 *bar
5149 !! result
5150 <ul><li><ul><li>foo
5151 </li></ul>
5152 </li><li>bar
5153 </li></ul>
5155 !! end
5157 !! test
5158 Nested lists 3 (first element empty)
5159 !! input
5161 **bar
5162 !! result
5163 <ul><li>
5164 <ul><li>bar
5165 </li></ul>
5166 </li></ul>
5168 !! end
5170 !! test
5171 Nested lists 4 (first element empty)
5172 !! input
5174 *bar
5175 !! result
5176 <ul><li><ul><li>
5177 </li></ul>
5178 </li><li>bar
5179 </li></ul>
5181 !! end
5183 !! test
5184 Nested lists 5 (both elements empty)
5185 !! input
5188 !! result
5189 <ul><li><ul><li>
5190 </li></ul>
5191 </li><li>
5192 </li></ul>
5194 !! end
5196 !! test
5197 Nested lists 6 (both elements empty)
5198 !! input
5201 !! result
5202 <ul><li>
5203 <ul><li>
5204 </li></ul>
5205 </li></ul>
5207 !! end
5209 !! test
5210 Nested lists 7 (skip initial nesting levels)
5211 !! input
5212 *** foo
5213 !! result
5214 <ul><li><ul><li><ul><li> foo
5215 </li></ul>
5216 </li></ul>
5217 </li></ul>
5219 !! end
5221 !! test
5222 Nested lists 8 (multiple nesting transitions)
5223 !! input
5224 * foo
5225 *** bar
5226 ** baz
5227 * boo
5228 !! result
5229 <ul><li> foo
5230 <ul><li><ul><li> bar
5231 </li></ul>
5232 </li><li> baz
5233 </li></ul>
5234 </li><li> boo
5235 </li></ul>
5237 !! end
5239 !! test
5240 1. Lists with start-of-line-transparent tokens before bullets: Comments
5241 !! input
5242 *foo
5243 *<!--cmt-->bar
5244 <!--cmt-->*baz
5245 !! result
5246 <ul><li>foo
5247 </li><li>bar
5248 </li><li>baz
5249 </li></ul>
5251 !! end
5253 !! test
5254 2. Lists with start-of-line-transparent tokens before bullets: Template close
5255 !! input
5256 *foo {{echo|bar
5257 }}*baz
5258 !! result
5259 <ul><li>foo bar
5260 </li><li>baz
5261 </li></ul>
5263 !! end
5265 !! test
5266 List items are not parsed correctly following a <pre> block (bug 785)
5267 !! input
5268 * <pre>foo</pre>
5269 * <pre>bar</pre>
5270 * zar
5271 !! result
5272 <ul><li> <pre>foo</pre>
5273 </li><li> <pre>bar</pre>
5274 </li><li> zar
5275 </li></ul>
5277 !! end
5279 !! test
5280 List items from template
5281 !! input
5283 {{inner list}}
5284 * item 2
5286 * item 0
5287 {{inner list}}
5288 * item 2
5290 * item 0
5291 * notSOL{{inner list}}
5292 * item 2
5293 !! result
5294 <ul><li> item 1
5295 </li><li> item 2
5296 </li></ul>
5297 <ul><li> item 0
5298 </li><li> item 1
5299 </li><li> item 2
5300 </li></ul>
5301 <ul><li> item 0
5302 </li><li> notSOL
5303 </li><li> item 1
5304 </li><li> item 2
5305 </li></ul>
5307 !! end
5309 !! test
5310 List interrupted by empty line or heading
5311 !! input
5312 * foo
5314 ** bar
5315 == A heading ==
5316 * Another list item
5317 !! result
5318 <ul><li> foo
5319 </li></ul>
5320 <ul><li><ul><li> bar
5321 </li></ul>
5322 </li></ul>
5323 <h2><span class="mw-headline" id="A_heading">A heading</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: A heading">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
5324 <ul><li> Another list item
5325 </li></ul>
5327 !!end
5329 !!test
5330 Multiple list tags generated by templates
5331 !!input
5332 {{echo|<li>}}a
5333 {{echo|<li>}}b
5334 {{echo|<li>}}c
5335 !!result
5336 <li>a
5337 <li>b
5338 <li>c</li>
5339 </li>
5340 </li>
5342 !!end
5344 !!test
5345 Single-comment whitespace lines dont break lists, but multi-comment whitespace lines do
5346 !!input
5348 <!--This line will NOT split the list-->
5350  <!--This line will NOT split the list either-->
5352  <!--foo--> <!--This line with more than 1 comment will split the list-->
5354 !!result
5355 <ul><li>a
5356 </li><li>b
5357 </li><li>c
5358 </li></ul>
5359 <ul><li>d
5360 </li></ul>
5362 !!end
5364 !!test
5365 Test the li-hack
5366 (Cannot test this with PHP parser since it relies on Tidy for the hack)
5367 !!options
5368 parsoid=wt2html,wt2wt
5369 !!input
5370 * foo
5371 * <li>li-hack
5372 * {{echo|<li>templated li-hack}}
5373 * <!--foo--> <li> unsupported li-hack with preceding comments
5375 <ul>
5376 <li><li>not a li-hack
5377 </li>
5378 </ul>
5379 !!result
5380 <ul><li> foo</li>
5381 <li>li-hack</li>
5382 <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>
5383 <li> <!--foo--> </li><li> li-hack with preceding comments</li></ul>
5385 <ul>
5386 <li></li><li>not a li-hack
5387 </li>
5388 </ul>
5389 !!end
5391 !! test
5392 Parsoid: Make sure nested lists are serialized on their own line even if HTML contains no newlines
5393 !! options
5394 parsoid
5395 !! input
5396 # foo
5397 ## bar
5398 * foo
5399 ** bar
5400 : foo
5401 :: bar
5402 !! result
5403 <ol><li> foo<ol><li> bar</li></ol></li></ol><ul><li> foo<ul><li> bar</li></ul></li></ul><dl><dd> foo<dl><dd> bar</dd></dl></dd></dl>
5404 !! end
5406 # ------------------------------------------------------------------------
5407 # The next set of tests are about Parsoid's ability to handle badly nested
5408 # tags (parse, minimize scope of fixup, and roundtrip back)
5409 # ------------------------------------------------------------------------
5411 !! test
5412 Unbalanced closing block tags break a list
5413 (Parsoid-only since php parser generates broken html -- relies on Tidy to fix up)
5414 !! options
5415 parsoid
5416 !! input
5417 <div>
5418 *a</div><div>
5419 *b</div>
5420 !! result
5421 <div>
5422 <ul><li>a
5423 </li></ul></div><div>
5424 <ul><li>b
5425 </li></ul></div>
5426 !! end
5428 !! test
5429 Unbalanced closing non-block tags don't break a list
5430 (Parsoid-only since php parser generates broken html -- relies on Tidy to fix up)
5431 !! options
5432 parsoid
5433 !! input
5434 <span>
5435 *a</span><span>
5436 *b</span>
5437 !! result
5438 <p><span></span>
5439 </p>
5440 <ul><li>a<span></span>
5441 </li><li>b
5442 </li></ul>
5443 !! end
5445 !! test
5446 Unclosed formatting tags that straddle lists are closed and reopened
5447 (Parsoid-only since php parser generates broken html -- relies on Tidy to fix up)
5448 !! options
5449 parsoid
5450 !! input
5451 # <s> a
5452 # b </s>
5453 !! result
5454 <ol><li> <s> a </s>
5455 </li><li> <s> b </s>
5456 </li></ol>
5457 !! end
5459 !!test
5460 List embedded in a non-block tag
5461 (Ugly Parsoid output -- worth fixing; Disabled for PHP parser since it relies on Tidy)
5462 !! options
5463 parsoid
5464 !!input
5465 <small>
5466 * foo
5467 </small>
5468 !!result
5469 <p><small></small></p>
5470 <small>
5471 <ul>
5472 <li> foo</li>
5473 </ul>
5474 </small>
5475 <p><small></small></p>
5476 !!end
5479 ### Magic Words
5482 !! test
5483 Magic Word: {{CURRENTDAY}}
5484 !! input
5485 {{CURRENTDAY}}
5486 !! result
5487 <p>1
5488 </p>
5489 !! end
5491 !! test
5492 Magic Word: {{CURRENTDAY2}}
5493 !! input
5494 {{CURRENTDAY2}}
5495 !! result
5496 <p>01
5497 </p>
5498 !! end
5500 !! test
5501 Magic Word: {{CURRENTDAYNAME}}
5502 !! input
5503 {{CURRENTDAYNAME}}
5504 !! result
5505 <p>Thursday
5506 </p>
5507 !! end
5509 !! test
5510 Magic Word: {{CURRENTDOW}}
5511 !! input
5512 {{CURRENTDOW}}
5513 !! result
5514 <p>4
5515 </p>
5516 !! end
5518 !! test
5519 Magic Word: {{CURRENTMONTH}}
5520 !! input
5521 {{CURRENTMONTH}}
5522 !! result
5523 <p>01
5524 </p>
5525 !! end
5527 !! test
5528 Magic Word: {{CURRENTMONTHABBREV}}
5529 !! input
5530 {{CURRENTMONTHABBREV}}
5531 !! result
5532 <p>Jan
5533 </p>
5534 !! end
5536 !! test
5537 Magic Word: {{CURRENTMONTHNAME}}
5538 !! input
5539 {{CURRENTMONTHNAME}}
5540 !! result
5541 <p>January
5542 </p>
5543 !! end
5545 !! test
5546 Magic Word: {{CURRENTMONTHNAMEGEN}}
5547 !! input
5548 {{CURRENTMONTHNAMEGEN}}
5549 !! result
5550 <p>January
5551 </p>
5552 !! end
5554 !! test
5555 Magic Word: {{CURRENTTIME}}
5556 !! input
5557 {{CURRENTTIME}}
5558 !! result
5559 <p>00:02
5560 </p>
5561 !! end
5563 !! test
5564 Magic Word: {{CURRENTWEEK}} (@bug 4594)
5565 !! input
5566 {{CURRENTWEEK}}
5567 !! result
5568 <p>1
5569 </p>
5570 !! end
5572 !! test
5573 Magic Word: {{CURRENTYEAR}}
5574 !! input
5575 {{CURRENTYEAR}}
5576 !! result
5577 <p>1970
5578 </p>
5579 !! end
5581 !! test
5582 Magic Word: {{FULLPAGENAME}}
5583 !! options
5584 title=[[User:Ævar Arnfjörð Bjarmason]]
5585 !! input
5586 {{FULLPAGENAME}}
5587 !! result
5588 <p>User:Ævar Arnfjörð Bjarmason
5589 </p>
5590 !! end
5592 !! test
5593 Magic Word: {{FULLPAGENAMEE}}
5594 !! options
5595 title=[[User:Ævar Arnfjörð Bjarmason]]
5596 !! input
5597 {{FULLPAGENAMEE}}
5598 !! result
5599 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
5600 </p>
5601 !! end
5603 !! test
5604 Magic Word: {{NAMESPACE}}
5605 !! options
5606 title=[[User:Ævar Arnfjörð Bjarmason]]
5607 !! input
5608 {{NAMESPACE}}
5609 !! result
5610 <p>User
5611 </p>
5612 !! end
5614 !! test
5615 Magic Word: {{NAMESPACEE}}
5616 !! options
5617 title=[[User:Ævar Arnfjörð Bjarmason]]
5618 !! input
5619 {{NAMESPACEE}}
5620 !! result
5621 <p>User
5622 </p>
5623 !! end
5625 !! test
5626 Magic Word: {{NAMESPACENUMBER}}
5627 !! options
5628 title=[[User:Ævar Arnfjörð Bjarmason]]
5629 !! input
5630 {{NAMESPACENUMBER}}
5631 !! result
5632 <p>2
5633 </p>
5634 !! end
5636 !! test
5637 Magic Word: {{NUMBEROFFILES}}
5638 !! input
5639 {{NUMBEROFFILES}}
5640 !! result
5641 <p>4
5642 </p>
5643 !! end
5645 !! test
5646 Magic Word: {{PAGENAME}}
5647 !! options
5648 title=[[User:Ævar Arnfjörð Bjarmason]]
5649 !! input
5650 {{PAGENAME}}
5651 !! result
5652 <p>Ævar Arnfjörð Bjarmason
5653 </p>
5654 !! end
5656 !! test
5657 Magic Word: {{PAGENAME}} with metacharacters
5658 !! options
5659 title=[['foo & bar = baz']]
5660 !! input
5661 ''{{PAGENAME}}''
5662 !! result
5663 <p><i>&#39;foo &#38; bar &#61; baz&#39;</i>
5664 </p>
5665 !! end
5667 !! test
5668 Magic Word: {{PAGENAME}} with metacharacters (bug 26781)
5669 !! options
5670 title=[[*RFC 1234 http://example.com/]]
5671 !! input
5672 {{PAGENAME}}
5673 !! result
5674 <p>&#42;RFC&#32;1234 http&#58;//example.com/
5675 </p>
5676 !! end
5678 !! test
5679 Magic Word: {{PAGENAMEE}}
5680 !! options
5681 title=[[User:Ævar Arnfjörð Bjarmason]]
5682 !! input
5683 {{PAGENAMEE}}
5684 !! result
5685 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
5686 </p>
5687 !! end
5689 !! test
5690 Magic Word: {{PAGENAMEE}} with metacharacters (bug 26781)
5691 !! options
5692 title=[[*RFC 1234 http://example.com/]]
5693 !! input
5694 {{PAGENAMEE}}
5695 !! result
5696 <p>&#42;RFC_1234_http&#58;//example.com/
5697 </p>
5698 !! end
5700 !! test
5701 Magic Word: {{REVISIONID}}
5702 !! input
5703 {{REVISIONID}}
5704 !! result
5705 <p>1337
5706 </p>
5707 !! end
5709 !! test
5710 Magic Word: {{SCRIPTPATH}}
5711 !! input
5712 {{SCRIPTPATH}}
5713 !! result
5714 <p>/
5715 </p>
5716 !! end
5718 !! test
5719 Magic Word: {{SERVER}}
5720 !! input
5721 {{SERVER}}
5722 !! result
5723 <p><a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
5724 </p>
5725 !! end
5727 !! test
5728 Magic Word: {{SERVERNAME}}
5729 !! input
5730 {{SERVERNAME}}
5731 !! result
5732 <p>example.org
5733 </p>
5734 !! end
5736 !! test
5737 Magic Word: {{SITENAME}}
5738 !! input
5739 {{SITENAME}}
5740 !! result
5741 <p>MediaWiki
5742 </p>
5743 !! end
5745 !! test
5746 Case-sensitive magic words, when cased differently, should just be template transclusions
5747 !! input
5748 {{CurrentMonth}}
5749 {{currentday}}
5750 {{cURreNTweEK}}
5751 {{currentHour}}
5752 !! result
5753 <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>
5754 <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>
5755 <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>
5756 <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>
5757 </p>
5758 !! end
5760 !! test
5761 Case-insensitive magic words should still work with weird casing.
5762 !! input
5763 {{sErVeRNaMe}}
5764 {{LCFirst:AOEU}}
5765 {{ucFIRST:aoeu}}
5766 {{SERver}}
5767 !! result
5768 <p>example.org
5769 aOEU
5770 Aoeu
5771 <a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
5772 </p>
5773 !! end
5775 !! test
5776 Namespace 1 {{ns:1}}
5777 !! input
5778 {{ns:1}}
5779 !! result
5780 <p>Talk
5781 </p>
5782 !! end
5784 !! test
5785 Namespace 1 {{ns:01}}
5786 !! input
5787 {{ns:01}}
5788 !! result
5789 <p>Talk
5790 </p>
5791 !! end
5793 !! test
5794 Namespace 0 {{ns:0}} (bug 4783)
5795 !! input
5796 {{ns:0}}
5797 !! result
5799 !! end
5801 !! test
5802 Namespace 0 {{ns:00}} (bug 4783)
5803 !! input
5804 {{ns:00}}
5805 !! result
5807 !! end
5809 !! test
5810 Namespace -1 {{ns:-1}}
5811 !! input
5812 {{ns:-1}}
5813 !! result
5814 <p>Special
5815 </p>
5816 !! end
5818 !! test
5819 Namespace User {{ns:User}}
5820 !! input
5821 {{ns:User}}
5822 !! result
5823 <p>User
5824 </p>
5825 !! end
5827 !! test
5828 Namespace User talk {{ns:User_talk}}
5829 !! input
5830 {{ns:User_talk}}
5831 !! result
5832 <p>User talk
5833 </p>
5834 !! end
5836 !! test
5837 Namespace User talk {{ns:uSeR tAlK}}
5838 !! input
5839 {{ns:uSeR tAlK}}
5840 !! result
5841 <p>User talk
5842 </p>
5843 !! end
5845 !! test
5846 Namespace File {{ns:File}}
5847 !! input
5848 {{ns:File}}
5849 !! result
5850 <p>File
5851 </p>
5852 !! end
5854 !! test
5855 Namespace File {{ns:Image}}
5856 !! input
5857 {{ns:Image}}
5858 !! result
5859 <p>File
5860 </p>
5861 !! end
5863 !! test
5864 Namespace (lang=de) Benutzer {{ns:User}}
5865 !! options
5866 language=de
5867 !! input
5868 {{ns:User}}
5869 !! result
5870 <p>Benutzer
5871 </p>
5872 !! end
5874 !! test
5875 Namespace (lang=de) Benutzer Diskussion {{ns:3}}
5876 !! options
5877 language=de
5878 !! input
5879 {{ns:3}}
5880 !! result
5881 <p>Benutzer Diskussion
5882 </p>
5883 !! end
5886 !! test
5887 Urlencode
5888 !! input
5889 {{urlencode:hi world?!}}
5890 {{urlencode:hi world?!|WIKI}}
5891 {{urlencode:hi world?!|PATH}}
5892 {{urlencode:hi world?!|QUERY}}
5893 !! result
5894 <p>hi+world%3F%21
5895 hi_world%3F!
5896 hi%20world%3F%21
5897 hi+world%3F%21
5898 </p>
5899 !! end
5902 ### Magic links
5904 !! test
5905 Magic links: internal link to RFC (bug 479)
5906 !! input
5907 [[RFC 123]]
5908 !! result
5909 <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>
5910 </p>
5911 !! end
5913 !! test
5914 Magic links: RFC (bug 479)
5915 !! input
5916 RFC 822
5917 !! result
5918 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc822">RFC 822</a>
5919 </p>
5920 !! end
5922 !! test
5923 Magic links: ISBN (bug 1937)
5924 !! input
5925 ISBN 0-306-40615-2
5926 !! result
5927 <p><a href="/wiki/Special:BookSources/0306406152" class="internal mw-magiclink-isbn">ISBN 0-306-40615-2</a>
5928 </p>
5929 !! end
5931 !! test
5932 Magic links: PMID incorrectly converts space to underscore
5933 !! input
5934 PMID 1234
5935 !! result
5936 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a>
5937 </p>
5938 !! end
5941 ### Templates
5942 ####
5944 !! test
5945 Nonexistent template
5946 !! input
5947 {{thistemplatedoesnotexist}}
5948 !! result
5949 <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>
5950 </p>
5951 !! end
5953 !! test
5954 Template with invalid target containing tags
5955 !! input
5956 {{a<b>b</b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
5957 !! result
5958 <p>{{a<b>b</b>|foo|a=b|a = b}}
5959 </p>
5960 !! end
5962 !! test
5963 Template with invalid target containing unclosed tag
5964 !! input
5965 {{a<b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
5966 !! result
5967 <p>{{a<b>|foo|a=b|a = b}}</b>
5968 </p>
5969 !! end
5971 !! article
5972 Template:test
5973 !! text
5974 This is a test template
5975 !! endarticle
5977 !! test
5978 Simple template
5979 !! input
5980 {{test}}
5981 !! result
5982 <p>This is a test template
5983 </p>
5984 !! end
5986 !! test
5987 Template with explicit namespace
5988 !! input
5989 {{Template:test}}
5990 !! result
5991 <p>This is a test template
5992 </p>
5993 !! end
5996 !! article
5997 Template:paramtest
5998 !! text
5999 This is a test template with parameter {{{param}}}
6000 !! endarticle
6002 !! test
6003 Template parameter
6004 !! input
6005 {{paramtest|param=foo}}
6006 !! result
6007 <p>This is a test template with parameter foo
6008 </p>
6009 !! end
6011 !! article
6012 Template:paramtestnum
6013 !! text
6014 [[{{{1}}}|{{{2}}}]]
6015 !! endarticle
6017 !! test
6018 Template unnamed parameter
6019 !! input
6020 {{paramtestnum|Main Page|the main page}}
6021 !! result
6022 <p><a href="/wiki/Main_Page" title="Main Page">the main page</a>
6023 </p>
6024 !! end
6026 !! article
6027 Template:templatesimple
6028 !! text
6029 (test)
6030 !! endarticle
6032 !! article
6033 Template:templateredirect
6034 !! text
6035 #redirect [[Template:templatesimple]]
6036 !! endarticle
6038 !! article
6039 Template:templateasargtestnum
6040 !! text
6041 {{{{{1}}}}}
6042 !! endarticle
6044 !! article
6045 Template:templateasargtest
6046 !! text
6047 {{template{{{templ}}}}}
6048 !! endarticle
6050 !! article
6051 Template:templateasargtest2
6052 !! text
6053 {{{{{templ}}}}}
6054 !! endarticle
6056 !! test
6057 Template with template name as unnamed argument
6058 !! input
6059 {{templateasargtestnum|templatesimple}}
6060 !! result
6061 <p>(test)
6062 </p>
6063 !! end
6065 !! test
6066 Template with template name as argument
6067 !! input
6068 {{templateasargtest|templ=simple}}
6069 !! result
6070 <p>(test)
6071 </p>
6072 !! end
6074 !! test
6075 Template with template name as argument (2)
6076 !! input
6077 {{templateasargtest2|templ=templatesimple}}
6078 !! result
6079 <p>(test)
6080 </p>
6081 !! end
6083 !! article
6084 Template:templateasargtestdefault
6085 !! text
6086 {{{{{templ|templatesimple}}}}}
6087 !! endarticle
6089 !! article
6090 Template:templa
6091 !! text
6092 '''templ'''
6093 !! endarticle
6095 !! test
6096 Template with default value
6097 !! input
6098 {{templateasargtestdefault}}
6099 !! result
6100 <p>(test)
6101 </p>
6102 !! end
6104 !! test
6105 Template with default value (value set)
6106 !! input
6107 {{templateasargtestdefault|templ=templa}}
6108 !! result
6109 <p><b>templ</b>
6110 </p>
6111 !! end
6113 !! test
6114 Template redirect
6115 !! input
6116 {{templateredirect}}
6117 !! result
6118 <p>(test)
6119 </p>
6120 !! end
6122 !! test
6123 Template with argument in separate line
6124 !! input
6125 {{ templateasargtest  |
6126  templ = simple }}
6127 !! result
6128 <p>(test)
6129 </p>
6130 !! end
6132 !! test
6133 Template with complex template as argument
6134 !! input
6135 {{paramtest|
6136   param ={{ templateasargtest  |
6137  templ = simple }}}}
6138 !! result
6139 <p>This is a test template with parameter (test)
6140 </p>
6141 !! end
6143 !! test
6144 Template with thumb image (with link in description)
6145 !! input
6146 {{paramtest|
6147   param =[[Image:noimage.png|thumb|[[no link|link]] [[no link|caption]]]]}}
6148 !! result
6149 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>
6151 !! end
6153 !! article
6154 Template:complextemplate
6155 !! text
6156 {{{1}}} {{paramtest|
6157   param ={{{param}}}}}
6158 !! endarticle
6160 !! test
6161 Template with complex arguments
6162 !! input
6163 {{complextemplate|
6164   param ={{ templateasargtest  |
6165  templ = simple }}|[[Template:complextemplate|link]]}}
6166 !! result
6167 <p><a href="/wiki/Template:Complextemplate" title="Template:Complextemplate">link</a> This is a test template with parameter (test)
6168 </p>
6169 !! end
6171 !! test
6172 BUG 553: link with two variables in a piped link
6173 !! input
6175 |[[{{{1}}}|{{{2}}}]]
6177 !! result
6178 <table>
6179 <tr>
6180 <td>[[{{{1}}}|{{{2}}}]]
6181 </td></tr></table>
6183 !! end
6185 !! test
6186 Magic variable as template parameter
6187 !! input
6188 {{paramtest|param={{SITENAME}}}}
6189 !! result
6190 <p>This is a test template with parameter MediaWiki
6191 </p>
6192 !! end
6194 !! article
6195 Template:linktest
6196 !! text
6197 [[{{{param}}}|link]]
6198 !! endarticle
6200 !! test
6201 Template parameter as link source
6202 !! input
6203 {{linktest|param=Main Page}}
6204 !! result
6205 <p><a href="/wiki/Main_Page" title="Main Page">link</a>
6206 </p>
6207 !! end
6209 !!test
6210 Template-generated attribute string (k='v')
6211 !!input
6212 <span {{attr_str|id|v1}}>bar</span>
6213 !!result
6214 <p><span id="v1">bar</span>
6215 </p>
6216 !!end
6218 !!article
6219 Template:paramtest2
6220 !! text
6221 including another template, {{paramtest|param={{{arg}}}}}
6222 !! endarticle
6224 !! test
6225 Template passing argument to another template
6226 !! input
6227 {{paramtest2|arg='hmm'}}
6228 !! result
6229 <p>including another template, This is a test template with parameter 'hmm'
6230 </p>
6231 !! end
6233 !! article
6234 Template:Linktest2
6235 !! text
6236 Main Page
6237 !! endarticle
6239 !! test
6240 Template as link source
6241 !! input
6242 [[{{linktest2}}]]
6244 [[{{linktest2}}|Main Page]]
6246 [[{{linktest2}}]]Page
6247 !! result
6248 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
6249 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
6250 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>Page
6251 </p>
6252 !! end
6255 !! article
6256 Template:loop1
6257 !! text
6258 {{loop2}}
6259 !! endarticle
6261 !! article
6262 Template:loop2
6263 !! text
6264 {{loop1}}
6265 !! endarticle
6267 !! test
6268 Template infinite loop
6269 !! input
6270 {{loop1}}
6271 !! result
6272 <p><span class="error">Template loop detected: <a href="/wiki/Template:Loop1" title="Template:Loop1">Template:Loop1</a></span>
6273 </p>
6274 !! end
6276 !! test
6277 Template from main namespace
6278 !! input
6279 {{:Main Page}}
6280 !! result
6281 <p>blah blah
6282 </p>
6283 !! end
6285 !! article
6286 Template:table
6287 !! text
6289 | 1 || 2
6291 | 3 || 4
6293 !! endarticle
6295 !! test
6296 BUG 529: Template with table, not included at beginning of line
6297 !! input
6298 foo {{table}}
6299 !! result
6300 <p>foo 
6301 </p>
6302 <table>
6303 <tr>
6304 <td> 1 </td>
6305 <td> 2
6306 </td></tr>
6307 <tr>
6308 <td> 3 </td>
6309 <td> 4
6310 </td></tr></table>
6312 !! end
6314 !! test
6315 BUG 523: Template shouldn't eat newline (or add an extra one before table)
6316 !! input
6318 {{table}}
6319 !! result
6320 <p>foo
6321 </p>
6322 <table>
6323 <tr>
6324 <td> 1 </td>
6325 <td> 2
6326 </td></tr>
6327 <tr>
6328 <td> 3 </td>
6329 <td> 4
6330 </td></tr></table>
6332 !! end
6334 !! test
6335 BUG 41: Template parameters shown as broken links
6336 !! input
6337 {{{parameter}}}
6338 !! result
6339 <p>{{{parameter}}}
6340 </p>
6341 !! end
6343 !! test
6344 Template with targets containing wikilinks
6345 !! input
6346 {{[[foo]]}}
6348 {{[[{{echo|foo}}]]}}
6350 {{{{echo|[[foo}}]]}}
6351 !! result
6352 <p>{{<a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">foo</a>}}
6353 </p><p>{{<a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">foo</a>}}
6354 </p><p>{{[[foo}}]]
6355 </p>
6356 !! end
6358 !! article
6359 Template:MSGNW test
6360 !! text
6361 ''None'' of '''this''' should be 
6362 * interpreted
6363  but rather passed unmodified
6364 {{test}}
6365 !! endarticle
6367 # hmm, fix this or just deprecate msgnw and document its behavior?
6368 !! test
6369 msgnw keyword
6370 !! options
6371 disabled
6372 !! input
6373 {{msgnw:MSGNW test}}
6374 !! result
6375 <p>''None'' of '''this''' should be 
6376 * interpreted
6377  but rather passed unmodified
6378 {{test}}
6379 </p>
6380 !! end
6382 !! test
6383 int keyword
6384 !! input
6385 {{int:youhavenewmessages|lots of money|not!}}
6386 !! result
6387 <p>You have lots of money (not!).
6388 </p>
6389 !! end
6391 !! article
6392 Template:Includes
6393 !! text
6394 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
6395 !! endarticle
6397 !! test
6398 <includeonly> and <noinclude> being included
6399 !! input
6400 {{Includes}}
6401 !! result
6402 <p>Foobar
6403 </p>
6404 !! end
6406 !! article
6407 Template:Includes2
6408 !! text
6409 <onlyinclude>Foo</onlyinclude>bar
6410 !! endarticle
6412 !! test
6413 <onlyinclude> being included
6414 !! input
6415 {{Includes2}}
6416 !! result
6417 <p>Foo
6418 </p>
6419 !! end
6422 !! article
6423 Template:Includes3
6424 !! text
6425 <onlyinclude>Foo</onlyinclude>bar<includeonly>zar</includeonly>
6426 !! endarticle
6428 !! test
6429 <onlyinclude> and <includeonly> being included
6430 !! input
6431 {{Includes3}}
6432 !! result
6433 <p>Foo
6434 </p>
6435 !! end
6437 !! test
6438 <includeonly> and <noinclude> on a page
6439 !! input
6440 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
6441 !! result
6442 <p>Foozar
6443 </p>
6444 !! end
6446 !! test
6447 Un-closed <noinclude>
6448 !! input
6449 <noinclude>
6450 !! result
6451 !! end
6453 !! test
6454 <onlyinclude> on a page
6455 !! input
6456 <onlyinclude>Foo</onlyinclude>bar
6457 !! result
6458 <p>Foobar
6459 </p>
6460 !! end
6462 !! test
6463 Un-closed <onlyinclude>
6464 !! input
6465 <onlyinclude>
6466 !! result
6467 !! end
6469 !!test
6470 Self-closed noinclude, includeonly, onlyinclude tags
6471 !!input
6472 <noinclude />
6473 <includeonly />
6474 <onlyinclude />
6475 !!result
6476 <p><br />
6477 </p>
6478 !!end
6480 !!test
6481 Unbalanced includeonly and noinclude tags
6482 !!input
6484 |a</noinclude>
6485 |b</noinclude></noinclude>
6486 |c</noinclude></includeonly>
6487 |d</includeonly></includeonly>
6489 !!result
6490 <table>
6491 <tr>
6492 <td>a
6493 </td>
6494 <td>b
6495 </td>
6496 <td>c&lt;/includeonly&gt;
6497 </td>
6498 <td>d&lt;/includeonly&gt;&lt;/includeonly&gt;
6499 </td></tr></table>
6501 !!end
6503 !! article
6504 Template:Includeonly section
6505 !! text
6506 <includeonly>
6507 ==Includeonly section==
6508 </includeonly>
6509 ==Section T-1==
6510 !!endarticle
6512 !! test
6513 Bug 6563: Edit link generation for section shown by <includeonly>
6514 !! input
6515 {{includeonly section}}
6516 !! result
6517 <h2><span class="mw-headline" id="Includeonly_section">Includeonly section</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Template:Includeonly_section&amp;action=edit&amp;section=T-1" title="Template:Includeonly section">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
6518 <h2><span class="mw-headline" id="Section_T-1">Section T-1</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Template:Includeonly_section&amp;action=edit&amp;section=T-2" title="Template:Includeonly section">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
6520 !! end
6522 # Uses same input as the contents of [[Template:Includeonly section]]
6523 !! test
6524 Bug 6563: Section extraction for section shown by <includeonly>
6525 !! options
6526 section=T-2
6527 !! input
6528 <includeonly>
6529 ==Includeonly section==
6530 </includeonly>
6531 ==Section T-2==
6532 !! result
6533 ==Section T-2==
6534 !! end
6536 !! test
6537 Bug 6563: Edit link generation for section suppressed by <includeonly>
6538 !! input
6539 <includeonly>
6540 ==Includeonly section==
6541 </includeonly>
6542 ==Section 1==
6543 !! result
6544 <h2><span class="mw-headline" id="Section_1">Section 1</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: Section 1">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
6546 !! end
6548 !! test
6549 Bug 6563: Section extraction for section suppressed by <includeonly>
6550 !! options
6551 section=1
6552 !! input
6553 <includeonly>
6554 ==Includeonly section==
6555 </includeonly>
6556 ==Section 1==
6557 !! result
6558 ==Section 1==
6559 !! end
6561 !! test
6562 Un-closed <includeonly>
6563 !! input
6564 <includeonly>
6565 !! result
6566 !! end
6568 # TODO: test with DOM fragment reuse!
6569 !! test
6570 Parsoid: DOM fragment reuse
6571 !! options
6572 parsoid=wt2wt,wt2html
6573 !! input
6574 a{{echo|b<table></table>c}}d
6576 a{{echo|b
6577 <table></table>
6578 c}}d
6580 {{echo|a
6582 <table></table>
6585 !! result
6586 a<span typeof="mw:Transclusion">b</span>
6587 <table></table><span>c</span>d
6588 <p typeof="mw:Transclusion">ab</p>
6589 <table></table>
6590 <p>cd</p>
6591 <p typeof="mw:Transclusion">a</p>
6592 <table></table>
6593 <p>b</p>
6594 !! end
6597 ### <includeonly> and <noinclude> in attributes
6599 !!test
6600 0. includeonly around the entire attribute
6601 !!input
6602 <span <includeonly>id="v1"</includeonly><noinclude>id="v2"</noinclude>>bar</span>
6603 !!result
6604 <p><span id="v2">bar</span>
6605 </p>
6606 !!end
6608 !!test
6609 1. includeonly in html attr key
6610 !!input
6611 <span <noinclude>id</noinclude><includeonly>about</includeonly>="foo">bar</span>
6612 !!result
6613 <p><span id="foo">bar</span>
6614 </p>
6615 !!end
6617 !!test
6618 2. includeonly in html attr value
6619 !!input
6620 <span id="<noinclude>v1</noinclude><includeonly>v2</includeonly>">bar</span>
6621 <span id=<noinclude>"v1"</noinclude><includeonly>"v2"</includeonly>>bar</span>
6622 !!result
6623 <p><span id="v1">bar</span>
6624 <span id="v1">bar</span>
6625 </p>
6626 !!end
6628 !!test
6629 3. includeonly in part of an attr value
6630 !!input
6631 <span style="color:<noinclude>red</noinclude><includeonly>blue</includeonly>;">bar</span>
6632 !!result
6633 <p><span style="color:red;">bar</span>
6634 </p>
6635 !!end
6638 ### Testing parsing of templates where a template arg
6639 ### has the same name as the template itself.
6642 !! article
6643 Template:quote
6644 !! text
6645 {{{quote|{{{1}}}}}}
6646 !! endarticle
6648 !!test
6649 Templates: Template Name/Arg clash: 1. Use of positional param
6650 !!input
6651 {{quote|foo}}
6652 !!result
6653 <p>foo
6654 </p>
6655 !!end
6657 !!test
6658 Templates: Template Name/Arg clash: 2. Use of named param
6659 !!input
6660 {{quote|quote=foo}}
6661 !!result
6662 <p>foo
6663 </p>
6664 !!end
6666 !!test
6667 Templates: Template Name/Arg clash: 3. Use of named param with empty input
6668 !!input
6669 {{quote|quote}}
6670 !!result
6671 <p>quote
6672 </p>
6673 !!end
6676 ### Parsoid-centric tests to stress Parsoid's ability to RT them unchanged
6679 !!test
6680 Templates: 1. Simple use
6681 !!input
6682 {{echo|Foo}}
6683 !!result
6684 <p>Foo
6685 </p>
6686 !!end
6688 !!test
6689 Templates: 2. Inside a block tag
6690 !!input
6691 <div>{{echo|Foo}}</div>
6692 !!result
6693 <div>Foo</div>
6695 !!end
6697 !!test
6698 Templates: P-wrapping: 1a. Templates on consecutive lines
6699 !!input
6700 {{echo|Foo}}
6701 {{echo|bar}}
6702 !!result
6703 <p>Foo
6705 </p>
6706 !!end
6708 !!test
6709 Templates: P-wrapping: 1b. Templates on consecutive lines
6710 !!input
6713 {{echo|bar}}
6714 {{echo|baz}}
6715 !!result
6716 <p>Foo
6717 </p><p>bar
6719 </p>
6720 !!end
6722 !!test
6723 Templates: P-wrapping: 1c. Templates on consecutive lines
6724 !!input
6725 {{echo|Foo}}
6726 {{echo|bar}} <div>baz</div>
6727 !!result
6728 <p>Foo
6729 </p>
6730 bar <div>baz</div>
6732 !!end
6734 !!test
6735 Templates: P-wrapping: 1d. Template preceded by comment-only line
6736 !!options
6737 parsoid=wt2html,wt2wt
6738 !!input
6739 <!-- foo -->
6740 {{echo|Bar}}
6741 !!result
6742 <!-- foo -->
6743 <p typeof="mw:Transclusion">Bar
6744 </p>
6745 !!end
6747 !!test
6748 Templates: Inline Text: 1. Multiple tmeplate uses
6749 !!input
6750 {{echo|Foo}}bar{{echo|baz}}
6751 !!result
6752 <p>Foobarbaz
6753 </p>
6754 !!end
6756 !!test
6757 Templates: Inline Text: 2. Back-to-back template uses
6758 !!input
6759 {{echo|Foo}}{{echo|bar}}
6760 !!result
6761 <p>Foobar
6762 </p>
6763 !!end
6765 !!test
6766 Templates: Block Tags: 1. Multiple template uses
6767 !!input
6768 {{echo|<div>Foo</div>}}<div>bar</div>{{echo|<div>baz</div>}}
6769 !!result
6770 <div>Foo</div><div>bar</div><div>baz</div>
6772 !!end
6774 !!test
6775 Templates: Block Tags: 2. Back-to-back template uses
6776 !!input
6777 {{echo|<div>Foo</div>}}{{echo|<div>bar</div>}}
6778 !!result
6779 <div>Foo</div><div>bar</div>
6781 !!end
6783 !!test
6784 Templates: Links: 1. Simple example
6785 !!input
6786 {{echo|[[Foo|bar]]}}
6787 !!result
6788 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
6789 </p>
6790 !!end
6792 !!test
6793 Templates: Links: 2. Generation of link href
6794 !!input
6795 [[{{echo|Foo}}|bar]]
6796 !!result
6797 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
6798 </p>
6799 !!end
6801 !!test
6802 Templates: Links: 3. Generation of part of a link href
6803 !!input
6804 [[Fo{{echo|o}}|bar]]
6806 [[Foo{{echo|bar}}]]
6808 [[Foo{{echo|bar}}baz]]
6810 [[Foo{{echo|bar}}|bar]]
6812 [[:Foo{{echo|bar}}]]
6814 [[:Foo{{echo|bar}}|bar]]
6815 !!result
6816 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
6817 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
6818 </p><p><a href="/index.php?title=Foobarbaz&amp;action=edit&amp;redlink=1" class="new" title="Foobarbaz (page does not exist)">Foobarbaz</a>
6819 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
6820 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
6821 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
6822 </p>
6823 !!end
6825 !!test
6826 Templates: Links: 4. Multiple templates generating link href
6827 !!input
6828 [[{{echo|F}}{{echo|o}}ob{{echo|ar}}]]
6829 !!result
6830 <p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
6831 </p>
6832 !!end
6834 !!test
6835 Templates: Links: 5. Generation of link text
6836 !!input
6837 [[Foo|{{echo|bar}}]]
6838 !!result
6839 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
6840 </p>
6841 !!end
6843 !!test
6844 Templates: Links: 5. Nested templates (only outermost template should be marked)
6845 !!input
6846 {{echo|[[{{echo|Foo}}|bar]]}}
6847 !!result
6848 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
6849 </p>
6850 !!end
6852 !!test
6853 Templates: HTML Tag: 1. Generation of HTML attr. key
6854 !!input
6855 <div {{echo|style}}="color:red;">foo</div>
6856 !!result
6857 <div style="color:red;">foo</div>
6859 !!end
6861 !!test
6862 Templates: HTML Tag: 2. Generation of HTML attr. value
6863 !!input
6864 <div style={{echo|'color:red;'}}>foo</div>
6865 !!result
6866 <div style="color:red;">foo</div>
6868 !!end
6870 !!test
6871 Templates: HTML Tag: 3. Generation of HTML attr key and value
6872 !!input
6873 <div {{echo|style}}={{echo|'color:red;'}}>foo</div>
6874 !!result
6875 <div style="color:red;">foo</div>
6877 !!end
6879 !!test
6880 Templates: HTML Tag: 4. Generation of starting piece of HTML attr value
6881 !!input
6882 <div title="{{echo|This is a long title}} with just one piece templated">foo</div>
6883 !!result
6884 <div title="This is a long title with just one piece templated">foo</div>
6886 !!end
6888 !!test
6889 Templates: HTML Tag: 5. Generation of middle piece of HTML attr value
6890 !!input
6891 <div title="This is a long title with just {{echo|one piece}} templated">foo</div>
6892 !!result
6893 <div title="This is a long title with just one piece templated">foo</div>
6895 !!end
6897 !!test
6898 Templates: HTML Tag: 6. Generation of end piece of HTML attr value
6899 !!input
6900 <div title="This is a long title with just one piece {{echo|templated}}">foo</div>
6901 !!result
6902 <div title="This is a long title with just one piece templated">foo</div>
6904 !!end
6906 !!test
6907 Templates: HTML Tag: 7. Generation of partial attribute key string
6908 !!input
6909 <div st{{echo|yle}}="color:red;">foo</div>
6910 !!result
6911 <div style="color:red;">foo</div>
6913 !!end
6915 !!test
6916 Templates: HTML Tables: 1. Generating start of a HTML table
6917 !!input
6918 {{echo|<table><tr><td>foo</td>}}</tr></table>
6919 !!result
6920 <table><tr><td>foo</td></tr></table>
6922 !!end
6924 !!test
6925 Templates: HTML Tables: 2a. Generating middle of a HTML table
6926 !!input
6927 <table><tr>{{echo|<td>foo</td>}}</tr></table>
6928 !!result
6929 <table><tr><td>foo</td></tr></table>
6931 !!end
6933 !!test
6934 Templates: HTML Tables: 2b. Generating middle of a HTML table
6935 !!input
6936 <table>{{echo|<tr><td>foo</td></tr>}}</table>
6937 !!result
6938 <table><tr><td>foo</td></tr></table>
6940 !!end
6942 !!test
6943 Templates: HTML Tables: 3. Generating end of a HTML table
6944 !!input
6945 <table><tr>{{echo|<td>foo</td></tr></table>}}
6946 !!result
6947 <table><tr><td>foo</td></tr></table>
6949 !!end
6951 !!test
6952 Templates: HTML Tables: 4a. Generating a single tag of a HTML table
6953 !!input
6954 {{echo|<table>}}<tr><td>foo</td></tr></table>
6955 !!result
6956 <table><tr><td>foo</td></tr></table>
6958 !!end
6960 !!test
6961 Templates: HTML Tables: 4b. Generating a single tag of a HTML table
6962 !!input
6963 <table>{{echo|<tr>}}<td>foo</td></tr></table>
6964 !!result
6965 <table><tr><td>foo</td></tr></table>
6967 !!end
6969 !!test
6970 Templates: HTML Tables: 4c. Generating a single tag of a HTML table
6971 !!input
6972 <table><tr>{{echo|<td>}}foo</td></tr></table>
6973 !!result
6974 <table><tr><td>foo</td></tr></table>
6976 !!end
6978 !!test
6979 Templates: HTML Tables: 4d. Generating a single tag of a HTML table
6980 !!input
6981 <table><tr><td>foo{{echo|</td>}}</tr></table>
6982 !!result
6983 <table><tr><td>foo</td></tr></table>
6985 !!end
6987 !!test
6988 Templates: HTML Tables: 4e. Generating a single tag of a HTML table
6989 !!input
6990 <table><tr><td>foo</td>{{echo|</tr>}}</table>
6991 !!result
6992 <table><tr><td>foo</td></tr></table>
6994 !!end
6996 !!test
6997 Templates: HTML Tables: 4f. Generating a single tag of a HTML table
6998 !!input
6999 <table><tr><td>foo</td></tr>{{echo|</table>}}
7000 !!result
7001 <table><tr><td>foo</td></tr></table>
7003 !!end
7005 !!test
7006 Templates: HTML Tables: 5. Proper fostering of categories from inside
7007 !!options
7008 parsoid=wt2html,wt2wt
7009 !!input
7010 <table>[[Category:foo1]]<tr><td>foo</td></tr></table>
7011 <!--Two categories (Bug 50330)-->
7012 <table>[[Category:bar1]][[Category:bar2]]<tr><td>foo</td></tr></table>
7013 !!result
7014 <link rel="mw:WikiLink/Category" href="./Category:Foo1"><table><tbody><tr><td>foo</td></tr></tbody></table>
7015 <!--Two categories (Bug 50330)-->
7016 <link rel="mw:WikiLink/Category" href="./Category:Bar1"><link rel="mw:WikiLink/Category" href="./Category:Bar2"><table><tbody><tr><td>foo</td></tr></tbody></table>
7017 !!end
7019 !!test
7020 Templates: Wiki Tables: 1a. Fostering of entire template content
7021 !!input
7023 {{echo|a}}
7025 !!result
7026 <table>
7028 <tr><td></td></tr></table>
7030 !!end
7032 !!test
7033 Templates: Wiki Tables: 1b. Fostering of entire template content
7034 !!input
7036 {{echo|<div>}}
7038 {{echo|</div>}}
7040 !!result
7041 <table>
7042 <div>
7043 <p>foo
7044 </p>
7045 </div>
7046 <tr><td></td></tr></table>
7048 !!end
7050 !!test
7051 Templates: Wiki Tables: 2. Fostering of partial template content
7052 !!input
7054 {{echo|a
7055 <div>b</div>}}
7057 !!result
7058 <table>
7060 <div>b</div>
7061 <tr><td></td></tr></table>
7063 !!end
7065 !!test
7066 Templates: Wiki Tables: 3. td-content via multiple templates
7067 !!input
7069 {{echo|{{pipe}}a}}{{echo|b}}
7071 !!result
7072 <table>
7073 <tr>
7074 <td>ab
7075 </td></tr></table>
7077 !!end
7079 !!test
7080 Templates: Wiki Tables: 4. Templated tags, no content
7081 !!input
7082 {{tbl-start}}
7083 {{tbl-end}}
7084 !!result
7085 <table>
7086 <tr><td></td></tr></table>
7088 !!end
7090 !!test
7091 Templates: Wiki Tables: 5. Templated tags, regular td-tags
7092 !!input
7093 {{tbl-start}}
7094 |foo
7095 {{tbl-end}}
7096 !!result
7097 <table>
7098 <tr>
7099 <td>foo
7100 </td></tr></table>
7102 !!end
7104 !!test
7105 Templates: Wiki Tables: 6. Templated tags, templated td-tags
7106 !!input
7107 {{tbl-start}}
7108 {{!}}foo
7109 {{tbl-end}}
7110 !!result
7111 <table>
7112 <tr>
7113 <td>foo
7114 </td></tr></table>
7116 !!end
7118 !!test
7119 Templates: Lists: Multi-line list-items via templates
7120 !!input
7121 *{{echo|a {{nonexistent|
7122 unused}}}}
7123 *{{echo|b {{nonexistent|
7124 unused}}}}
7125 !!result
7126 <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>
7127 </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>
7128 </li></ul>
7130 !!end
7132 !!test
7133 Templates: Ugly nesting: 1. Quotes opened/closed across templates (echo)
7134 !!input
7135 {{echo|''a}}{{echo|b''c''d}}{{echo|''e}}
7136 !!result
7137 <p><i>ab</i>c<i>d</i>e
7138 </p>
7139 !!end
7141 !!test
7142 Templates: Ugly nesting: 2. Quotes opened/closed across templates (echo_with_span)
7143 (PHP parser generates misnested html)
7144 !! options
7145 parsoid=wt2html,wt2wt
7146 !!input
7147 {{echo_with_span|''a}}{{echo_with_span|b''c''d}}{{echo_with_span|''e}}
7148 !!result
7149 <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>
7150 !!end
7152 !!test
7153 Templates: Ugly nesting: 3. Quotes opened/closed across templates (echo_with_div)
7154 (PHP parser generates misnested html)
7155 !! options
7156 parsoid=wt2html,wt2wt
7157 !!input
7158 {{echo_with_div|''a}}{{echo_with_div|b''c''d}}{{echo_with_div|''e}}
7159 !!result
7160 <div typeof="mw:Transclusion"><i>a</i></div>
7161 <div typeof="mw:Transclusion"><i>b</i>c<i>d</i></div>
7162 <div typeof="mw:Transclusion">e</div>
7163 !!end
7165 !!test
7166 Templates: Ugly nesting: 4. Divs opened/closed across templates
7167 !!input
7168 a<div>b{{echo|c</div>d}}e
7169 !!result
7170 a<div>bc</div>de
7172 !!end
7174 !!test
7175 Templates: Ugly templates: 1. Navbox template parses badly leading to table misnesting
7176 (Parsoid-centric)
7177 !! options
7178 parsoid
7179 !!input
7181 |{{echo|foo</table>}}
7182 |bar
7184 !!result
7185 <table typeof="mw:Transclusion">
7186 <tbody>
7187 <tr>
7188 <td>foo</td></tr></tbody></table><span>bar</span>
7189 !!end
7191 !!test
7192 Templates: Ugly templates: 2. Navbox template parses badly leading to table misnesting
7193 (Parsoid-centric)
7194 !! options
7195 parsoid
7196 !!input
7197 <table>
7198   <tr>
7199     <td>
7200     <table>
7201       <tr>
7202         <td>1. {{echo|foo </table>}}</td>
7203         <td> bar </td>
7204         <td>2. {{echo|baz </table>}}</td>
7205       </tr>
7206       <tr>
7207         <td>abc</td>
7208       </tr>
7209     </table>
7210     </td>
7211   </tr>
7212   <tr>
7213     <td>xyz</td>
7214   </tr>
7215 </table>
7216 !!result
7217 <table  about="#mwt1" typeof="mw:Transclusion">
7218   <tbody><tr >
7219     <td >
7220     <table >
7221       <tbody><tr >
7222         <td >1. foo </td></tr></tbody></table></td>
7223         <td > bar </td>
7224         <td >2. baz </td></tr></tbody></table><span about="#mwt1">
7225       </span><span about="#mwt1">
7226       
7227         abc</span><span about="#mwt1">
7228       </span><span about="#mwt1">
7229     </span><span about="#mwt1">
7230     </span><span about="#mwt1">
7231   </span><span about="#mwt1">
7232   
7233     xyz</span><span about="#mwt1">
7234   </span><span about="#mwt1">
7235 </span>
7236 !!end
7238 !! test
7239 Templates: Ugly templates: 3. newline-only template parameter
7240 !! input
7241 foo {{echo|
7243 !! result
7244 <p>foo 
7245 </p>
7246 !! end
7248 # This looks like a bug: a single newline triggers p/br for some reason.
7249 !! test
7250 Templates: Ugly templates: 4. newline-only template parameter inconsistency
7251 !! input
7252 {{echo|
7254 !! result
7255 <p><br />
7256 </p>
7257 !! end
7260 !!test
7261 Parser Functions: 1. Simple example
7262 !!input
7263 {{uc:foo}}
7264 !!result
7265 <p>FOO
7266 </p>
7267 !!end
7269 !!test
7270 Parser Functions: 2. Nested use (only outermost should be marked up)
7271 !!input
7272 {{uc:{{lc:FOO}}}}
7273 !!result
7274 <p>FOO
7275 </p>
7276 !!end
7279 ### Pre-save transform tests
7281 !! test
7282 pre-save transform: subst:
7283 !! options
7285 !! input
7286 {{subst:test}}
7287 !! result
7288 This is a test template
7289 !! end
7291 !! test
7292 pre-save transform: normal template
7293 !! options
7295 !! input
7296 {{test}}
7297 !! result
7298 {{test}}
7299 !! end
7301 !! test
7302 pre-save transform: nonexistent template
7303 !! options
7305 !! input
7306 {{thistemplatedoesnotexist}}
7307 !! result
7308 {{thistemplatedoesnotexist}}
7309 !! end
7312 !! test
7313 pre-save transform: subst magic variables
7314 !! options
7316 !! input
7317 {{subst:SITENAME}}
7318 !! result
7319 MediaWiki
7320 !! end
7322 # This is bug 89, which I fixed. -- wtm
7323 !! test
7324 pre-save transform: subst: templates with parameters
7325 !! options
7327 !! input
7328 {{subst:paramtest|param="something else"}}
7329 !! result
7330 This is a test template with parameter "something else"
7331 !! end
7333 !! article
7334 Template:nowikitest
7335 !! text
7336 <nowiki>'''not wiki'''</nowiki>
7337 !! endarticle
7339 !! test
7340 pre-save transform: nowiki in subst (bug 1188)
7341 !! options
7343 !! input
7344 {{subst:nowikitest}}
7345 !! result
7346 <nowiki>'''not wiki'''</nowiki>
7347 !! end
7350 !! article
7351 Template:commenttest
7352 !! text
7353 This template has <!-- a comment --> in it.
7354 !! endarticle
7356 !! test
7357 pre-save transform: comment in subst (bug 1936)
7358 !! options
7360 !! input
7361 {{subst:commenttest}}
7362 !! result
7363 This template has <!-- a comment --> in it.
7364 !! end
7366 !! test
7367 pre-save transform: unclosed tag
7368 !! options
7369 pst noxml
7370 !! input
7371 <nowiki>'''not wiki'''
7372 !! result
7373 <nowiki>'''not wiki'''
7374 !! end
7376 !! test
7377 pre-save transform: mixed tag case
7378 !! options
7379 pst noxml
7380 !! input
7381 <NOwiki>'''not wiki'''</noWIKI>
7382 !! result
7383 <NOwiki>'''not wiki'''</noWIKI>
7384 !! end
7386 !! test
7387 pre-save transform: unclosed comment in <nowiki>
7388 !! options
7389 pst noxml
7390 !! input
7391 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
7392 !! result
7393 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
7394 !!end
7396 # Leading @ in this template definition works around a limitation
7397 # in parsoid's parserTests which otherwise strips the <span> from the
7398 # result (confusing it for a template wrapper)
7399 !! article
7400 Template:dangerous
7401 !!text
7402 @<span onmouseover="alert('crap')">Oh no</span>
7403 !!endarticle
7405 !!test
7406 (confirming safety of fix for subst bug 1936)
7407 !! input
7408 {{Template:dangerous}}
7409 !! result
7410 <p>@<span>Oh no</span>
7411 </p>
7412 !! end
7414 !! test
7415 pre-save transform: comment containing gallery (bug 5024)
7416 !! options
7418 !! input
7419 <!-- <gallery>data</gallery> -->
7420 !!result
7421 <!-- <gallery>data</gallery> -->
7422 !!end
7424 !! test
7425 pre-save transform: comment containing extension
7426 !! options
7428 !! input
7429 <!-- <tag>data</tag> -->
7430 !!result
7431 <!-- <tag>data</tag> -->
7432 !!end
7434 !! test
7435 pre-save transform: comment containing nowiki
7436 !! options
7438 !! input
7439 <!-- <nowiki>data</nowiki> -->
7440 !!result
7441 <!-- <nowiki>data</nowiki> -->
7442 !!end
7444 !! test
7445 pre-save transform: <noinclude> in subst (bug 3298)
7446 !! options
7448 !! input
7449 {{subst:Includes}}
7450 !! result
7451 Foobar
7452 !! end
7454 !! test
7455 pre-save transform: <onlyinclude> in subst (bug 3298)
7456 !! options
7458 !! input
7459 {{subst:Includes2}}
7460 !! result
7462 !! end
7464 !! article
7465 Template:SubstTest
7466 !!text
7467 {{<includeonly>subst:</includeonly>Includes}}
7468 !! endarticle
7470 !! article
7471 Template:SafeSubstTest
7472 !! text
7473 {{<includeonly>safesubst:</includeonly>Includes}}
7474 !! endarticle
7476 !! test
7477 bug 22297: safesubst: works during PST
7478 !! options
7480 !! input
7481 {{subst:SafeSubstTest}}{{safesubst:SubstTest}}
7482 !! result
7483 FoobarFoobar
7484 !! end
7486 !! test
7487 bug 22297: safesubst: works during normal parse
7488 !! input
7489 {{SafeSubstTest}}
7490 !! result
7491 <p>Foobar
7492 </p>
7493 !! end
7495 !! test:
7496 subst: does not work during normal parse
7497 !! input
7498 {{SubstTest}}
7499 !! result
7500 <p>{{subst:Includes}}
7501 </p>
7502 !! end
7504 !! test
7505 pre-save transform: context links ("pipe trick")
7506 !! options
7508 !! input
7509 [[Article (context)|]]
7510 [[Bar:Article|]]
7511 [[:Bar:Article|]]
7512 [[Bar:Article (context)|]]
7513 [[:Bar:Article (context)|]]
7514 [[|Article]]
7515 [[|Article (context)]]
7516 [[Bar:X (Y) Z|]]
7517 [[:Bar:X (Y) Z|]]
7518 !! result
7519 [[Article (context)|Article]]
7520 [[Bar:Article|Article]]
7521 [[:Bar:Article|Article]]
7522 [[Bar:Article (context)|Article]]
7523 [[:Bar:Article (context)|Article]]
7524 [[Article]]
7525 [[Article (context)]]
7526 [[Bar:X (Y) Z|X (Y) Z]]
7527 [[:Bar:X (Y) Z|X (Y) Z]]
7528 !! end
7530 !! test
7531 pre-save transform: context links ("pipe trick") with interwiki prefix
7532 !! options
7534 !! input
7535 [[interwiki:Article|]]
7536 [[:interwiki:Article|]]
7537 [[interwiki:Bar:Article|]]
7538 [[:interwiki:Bar:Article|]]
7539 !! result
7540 [[interwiki:Article|Article]]
7541 [[:interwiki:Article|Article]]
7542 [[interwiki:Bar:Article|Bar:Article]]
7543 [[:interwiki:Bar:Article|Bar:Article]]
7544 !! end
7546 !! test
7547 pre-save transform: context links ("pipe trick") with parens in title
7548 !! options
7549 pst title=[[Somearticle (context)]]
7550 !! input
7551 [[|Article]]
7552 !! result
7553 [[Article (context)|Article]]
7554 !! end
7556 !! test
7557 pre-save transform: context links ("pipe trick") with comma in title
7558 !! options
7559 pst title=[[Someplace, Somewhere]]
7560 !! input
7561 [[|Otherplace]]
7562 [[Otherplace, Elsewhere|]]
7563 [[Otherplace, Elsewhere, Anywhere|]]
7564 !! result
7565 [[Otherplace, Somewhere|Otherplace]]
7566 [[Otherplace, Elsewhere|Otherplace]]
7567 [[Otherplace, Elsewhere, Anywhere|Otherplace]]
7568 !! end
7570 !! test
7571 pre-save transform: context links ("pipe trick") with parens and comma
7572 !! options
7573 pst title=[[Someplace (IGNORED), Somewhere]]
7574 !! input
7575 [[|Otherplace]]
7576 [[Otherplace (place), Elsewhere|]]
7577 !! result
7578 [[Otherplace, Somewhere|Otherplace]]
7579 [[Otherplace (place), Elsewhere|Otherplace]]
7580 !! end
7582 !! test
7583 pre-save transform: context links ("pipe trick") with comma and parens
7584 !! options
7585 pst title=[[Who, me? (context)]]
7586 !! input
7587 [[|Yes, you.]]
7588 [[Me, Myself, and I (1937 song)|]]
7589 !! result
7590 [[Yes, you. (context)|Yes, you.]]
7591 [[Me, Myself, and I (1937 song)|Me, Myself, and I]]
7592 !! end
7594 !! test
7595 pre-save transform: context links ("pipe trick") with namespace
7596 !! options
7597 pst title=[[Ns:Somearticle]]
7598 !! input
7599 [[|Article]]
7600 !! result
7601 [[Ns:Article|Article]]
7602 !! end
7604 !! test
7605 pre-save transform: context links ("pipe trick") with namespace and parens
7606 !! options
7607 pst title=[[Ns:Somearticle (context)]]
7608 !! input
7609 [[|Article]]
7610 !! result
7611 [[Ns:Article (context)|Article]]
7612 !! end
7614 !! test
7615 pre-save transform: context links ("pipe trick") with namespace and comma
7616 !! options
7617 pst title=[[Ns:Somearticle, Context, Whatever]]
7618 !! input
7619 [[|Article]]
7620 !! result
7621 [[Ns:Article, Context, Whatever|Article]]
7622 !! end
7624 !! test
7625 pre-save transform: context links ("pipe trick") with namespace, comma and parens
7626 !! options
7627 pst title=[[Ns:Somearticle, Context (context)]]
7628 !! input
7629 [[|Article]]
7630 !! result
7631 [[Ns:Article (context)|Article]]
7632 !! end
7634 !! test
7635 pre-save transform: context links ("pipe trick") with namespace, parens and comma
7636 !! options
7637 pst title=[[Ns:Somearticle (IGNORED), Context]]
7638 !! input
7639 [[|Article]]
7640 !! result
7641 [[Ns:Article, Context|Article]]
7642 !! end
7644 !! test
7645 pre-save transform: context links ("pipe trick") with full-width parens and no space (Japanese and Chinese style, bug 30149)
7646 !! options
7648 !! input
7649 [[Article(context)|]]
7650 [[Bar:Article(context)|]]
7651 [[:Bar:Article(context)|]]
7652 [[|Article(context)]]
7653 [[Bar:X(Y)Z|]]
7654 [[:Bar:X(Y)Z|]]
7655 !! result
7656 [[Article(context)|Article]]
7657 [[Bar:Article(context)|Article]]
7658 [[:Bar:Article(context)|Article]]
7659 [[Article(context)]]
7660 [[Bar:X(Y)Z|X(Y)Z]]
7661 [[:Bar:X(Y)Z|X(Y)Z]]
7662 !! end
7664 !! test
7665 pre-save transform: context links ("pipe trick") with full-width parens and space (Japanese and Chinese style, bug 30149)
7666 !! options
7668 !! input
7669 [[Article (context)|]]
7670 [[Bar:Article (context)|]]
7671 [[:Bar:Article (context)|]]
7672 [[|Article (context)]]
7673 [[Bar:X (Y) Z|]]
7674 [[:Bar:X (Y) Z|]]
7675 !! result
7676 [[Article (context)|Article]]
7677 [[Bar:Article (context)|Article]]
7678 [[:Bar:Article (context)|Article]]
7679 [[Article (context)]]
7680 [[Bar:X (Y) Z|X (Y) Z]]
7681 [[:Bar:X (Y) Z|X (Y) Z]]
7682 !! end
7684 !! test
7685 pre-save transform: context links ("pipe trick") with parens and no space (Korean style, bug 30149)
7686 !! options
7688 !! input
7689 [[Article(context)|]]
7690 [[Bar:Article(context)|]]
7691 [[:Bar:Article(context)|]]
7692 [[|Article(context)]]
7693 [[Bar:X(Y)Z|]]
7694 [[:Bar:X(Y)Z|]]
7695 !! result
7696 [[Article(context)|Article]]
7697 [[Bar:Article(context)|Article]]
7698 [[:Bar:Article(context)|Article]]
7699 [[Article(context)]]
7700 [[Bar:X(Y)Z|X(Y)Z]]
7701 [[:Bar:X(Y)Z|X(Y)Z]]
7702 !! end
7704 !! test
7705 pre-save transform: context links ("pipe trick") with commas (bug 21660)
7706 !! options
7708 !! input
7709 [[Article (context), context|]]
7710 [[Article (context),context|]]
7711 [[Bar:Article (context), context|]]
7712 [[Bar:Article (context),context|]]
7713 [[:Bar:Article (context), context|]]
7714 [[:Bar:Article (context),context|]]
7715 !! result
7716 [[Article (context), context|Article]]
7717 [[Article (context),context|Article]]
7718 [[Bar:Article (context), context|Article]]
7719 [[Bar:Article (context),context|Article]]
7720 [[:Bar:Article (context), context|Article]]
7721 [[:Bar:Article (context),context|Article]]
7722 !! end
7724 !! test
7725 pre-save transform: trim trailing empty lines
7726 !! options
7728 !! input
7729 Empty lines are trimmed
7734 !! result
7735 Empty lines are trimmed
7736 !! end
7738 !! test
7739 pre-save transform: Signature expansion
7740 !! options
7742 !! input
7743 * ~~~
7744 * <noinclude>~~~</noinclude>
7745 * <includeonly>~~~</includeonly>
7746 * <onlyinclude>~~~</onlyinclude>
7747 !! result
7748 * [[Special:Contributions/127.0.0.1|127.0.0.1]]
7749 * <noinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</noinclude>
7750 * <includeonly>[[Special:Contributions/127.0.0.1|127.0.0.1]]</includeonly>
7751 * <onlyinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</onlyinclude>
7752 !! end
7755 !! test
7756 pre-save transform: Signature expansion in nowiki tags (bug 93)
7757 !! options
7758 pst disabled
7759 !! input
7760 Shall not expand:
7762 <nowiki>~~~~</nowiki>
7764 <includeonly><nowiki>~~~~</nowiki></includeonly>
7766 <noinclude><nowiki>~~~~</nowiki></noinclude>
7768 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
7770 {{subst:Foo}} shall be converted to FOO
7772 As well as inside noinclude/onlyinclude
7773 <noinclude>{{subst:Foo}}</noinclude>
7774 <onlyinclude>{{subst:Foo}}</onlyinclude>
7776 But not inside includeonly
7777 <includeonly>{{subst:Foo}}</includeonly>
7778 !! result
7779 Shall not expand:
7781 <nowiki>~~~~</nowiki>
7783 <includeonly><nowiki>~~~~</nowiki></includeonly>
7785 <noinclude><nowiki>~~~~</nowiki></noinclude>
7787 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
7789 FOO shall be converted to FOO
7791 As well as inside noinclude/onlyinclude
7792 <noinclude>FOO</noinclude>
7793 <onlyinclude>FOO</onlyinclude>
7795 But not inside includeonly
7796 <includeonly>{{subst:Foo}}</includeonly>
7797 !! end
7799 !! test
7800 Parsoid: Recognize nowiki with trailing space in tags
7801 !! options
7802 parsoid=wt2html
7803 !! input
7804 <nowiki ><div>[[foo]]</nowiki >
7806 a<nowiki / >b
7808 c<nowiki />d
7810 e<nowiki/ >f
7811 !! result
7812 <p><span typeof="mw:Nowiki">&lt;div&gt;[[foo]]</span></p>
7813 <p>ab</p>
7814 <p>cd</p>
7815 <p>ef</p>
7816 !! end
7818 !! test
7819 Parsoid: Recognize nowiki with odd capitalization
7820 !! options
7821 parsoid=wt2html
7822 !! input
7823 <noWikI ><div>[[foo]]</Nowiki >
7824 !! result
7825 <p><span typeof="mw:Nowiki">&lt;div&gt;[[foo]]</span></p>
7826 !! end
7829 !! test
7830 Parsoid: Escape nowiki with trailing space in tags
7831 !! options
7832 parsoid=html2wt
7833 !! input
7834 &lt;nowiki &gt; foo &lt;/nowiki &gt;
7836 a&lt;nowiki /&gt;b
7838 c&lt;nowiki/ &gt;d
7839 !! result
7840 <p>&lt;nowiki &gt; foo &lt/nowiki ></p>
7841 <p>a&lt;nowiki /&gt;b</p>
7842 <p>c&lt;nowiki/ &gt;d</p>
7843 !! end
7845 !! test
7846 Parsoid: Escape weird noWikI capitalizations
7847 !! options
7848 parsoid=html2wt
7849 !! input
7850 &lt;noWikI &gt; foo &lt;/NoWikI &gt;
7851 !! result
7852 <p>&lt;noWikI &gt; foo &lt/NoWikI ></p>
7853 !! end
7856 ### Message transform tests
7858 !! test
7859 message transform: magic variables
7860 !! options
7862 !! input
7863 {{SITENAME}}
7864 !! result
7865 MediaWiki
7866 !! end
7868 !! test
7869 message transform: should not transform wiki markup
7870 !! options
7872 !! input
7873 ''test''
7874 !! result
7875 ''test''
7876 !! end
7878 !! test
7879 message transform: <noinclude> in transcluded template (bug 4926)
7880 !! options
7882 !! input
7883 {{Includes}}
7884 !! result
7885 Foobar
7886 !! end
7888 !! test
7889 message transform: <onlyinclude> in transcluded template (bug 4926)
7890 !! options
7892 !! input
7893 {{Includes2}}
7894 !! result
7896 !! end
7898 !! test
7899 {{#special:}} page name, known
7900 !! options
7902 !! input
7903 {{#special:Recentchanges}}
7904 !! result
7905 Special:RecentChanges
7906 !! end
7908 !! test
7909 {{#special:}} page name with subpage, known
7910 !! options
7912 !! input
7913 {{#special:Recentchanges/param}}
7914 !! result
7915 Special:RecentChanges/param
7916 !! end
7918 !! test
7919 {{#special:}} page name, unknown
7920 !! options
7922 !! input
7923 {{#special:foobar nonexistent}}
7924 !! result
7925 Special:Foobar nonexistent
7926 !! end
7928 !! test
7929 {{#speciale:}} page name, known
7930 !! options
7932 !! input
7933 {{#speciale:Recentchanges}}
7934 !! result
7935 Special:RecentChanges
7936 !! end
7938 !! test
7939 {{#speciale:}} page name with subpage, known
7940 !! options
7942 !! input
7943 {{#speciale:Recentchanges/param}}
7944 !! result
7945 Special:RecentChanges/param
7946 !! end
7948 !! test
7949 {{#speciale:}} page name, unknown
7950 !! options
7952 !! input
7953 {{#speciale:foobar nonexistent}}
7954 !! result
7955 Special:Foobar_nonexistent
7956 !! end
7959 ### Images
7961 !! test
7962 Simple image
7963 !! input
7964 [[Image:foobar.jpg]]
7965 !! result
7966 <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>
7967 </p>
7968 !! end
7970 !! test
7971 Right-aligned image
7972 !! input
7973 [[Image:foobar.jpg|right]]
7974 !! result
7975 <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>
7977 !! end
7979 !! test
7980 Simple image (using File: namespace, now canonical)
7981 !! input
7982 [[File:foobar.jpg]]
7983 !! result
7984 <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>
7985 </p>
7986 !! end
7988 !! test
7989 Image with caption
7990 !! input
7991 [[Image:foobar.jpg|right|Caption text]]
7992 !! result
7993 <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>
7995 !! end
7997 !! test
7998 Image with empty attribute
7999 !! input
8000 [[Image:foobar.jpg|right||Caption text]]
8001 !! result
8002 <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>
8004 !! end
8006 !! test
8007 Image with attributes from template.
8008 !! input
8009 [[Image:foobar.jpg|{{image_attribs}}]]
8010 !! result
8011 <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>
8013 !! end
8015 !! test
8016 Image with link tails
8017 !! input
8018 123[[Image:foobar.jpg]]456
8019 123[[Image:foobar.jpg|right]]456
8020 123[[Image:foobar.jpg|thumb]]456
8021 !! result
8022 <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
8023 </p>
8024 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
8025 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
8027 !! end
8029 !! test
8030 Image with multiple captions -- only last one is accepted
8031 !! input
8032 [[Image:foobar.jpg|right|Caption1 - ignored|[[Caption2]] - ignored|Caption3 - accepted]]
8033 !! result
8034 <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>
8036 !! end
8038 !! test
8039 Image with width attribute at different positions
8040 !! input
8041 [[Image:foobar.jpg|200px|right|Caption]]
8042 [[Image:foobar.jpg|right|200px|Caption]]
8043 [[Image:foobar.jpg|right|Caption|200px]]
8044 !! result
8045 <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>
8046 <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>
8047 <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>
8049 !! end
8051 !! test
8052 Image with link parameter, wiki target
8053 !! input
8054 [[Image:foobar.jpg|link=Target page]]
8055 !! result
8056 <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>
8057 </p>
8058 !! end
8060 !! test
8061 Image with link parameter, URL target
8062 !! input
8063 [[Image:foobar.jpg|link=http://example.com/]]
8064 !! result
8065 <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>
8066 </p>
8067 !! end
8069 !! test
8070 Image with link parameter, wgExternalLinkTarget
8071 !! input
8072 [[Image:foobar.jpg|link=http://example.com/]]
8073 !! config
8074 wgExternalLinkTarget='foobar'
8075 !! result
8076 <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>
8077 </p>
8078 !! end
8080 !! test
8081 Image with link parameter, wgNoFollowLinks set to false
8082 !! input
8083 [[Image:foobar.jpg|link=http://example.com/]]
8084 !! config
8085 wgNoFollowLinks=false
8086 !! result
8087 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
8088 </p>
8089 !! end
8091 !! test
8092 Image with link parameter, wgNoFollowDomainExceptions
8093 !! input
8094 [[Image:foobar.jpg|link=http://example.com/]]
8095 !! config
8096 wgNoFollowDomainExceptions='example.com'
8097 !! result
8098 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
8099 </p>
8100 !! end
8102 !! test
8103 Image with link parameter, wgExternalLinkTarget, unnamed parameter
8104 !! input
8105 [[Image:foobar.jpg|link=http://example.com/|Title]]
8106 !! config
8107 wgExternalLinkTarget='foobar'
8108 !! result
8109 <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>
8110 </p>
8111 !! end
8113 !! test
8114 Image with empty link parameter
8115 !! input
8116 [[Image:foobar.jpg|link=]]
8117 !! result
8118 <p><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" />
8119 </p>
8120 !! end
8122 !! test
8123 Image with link parameter (wiki target) and unnamed parameter
8124 !! input
8125 [[Image:foobar.jpg|link=Target page|Title]]
8126 !! result
8127 <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>
8128 </p>
8129 !! end
8131 !! test
8132 Image with link parameter (URL target) and unnamed parameter
8133 !! input
8134 [[Image:foobar.jpg|link=http://example.com/|Title]]
8135 !! result
8136 <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>
8137 </p>
8138 !! end
8140 !! test
8141 Thumbnail image with link parameter
8142 !! options
8144 !! input
8145 [[Image:foobar.jpg|thumb|link=http://example.com/|Title]]
8146 !! result
8147 <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>
8149 !! end
8151 !! test
8152 Manually-specified thumbnail image
8153 !! options
8155 !! input
8156 [[Image:Foobar.jpg|thumb=Thumb.png|Title]]
8157 !! result
8158 <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>
8160 !! end
8162 !! test
8163 Manually-specified thumbnail image with explicit link to wiki page
8164 !! options
8166 !! input
8167 [[Image:Foobar.jpg|thumb=Thumb.png|link=Main Page|Title]]
8168 !! result
8169 <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>
8171 !! end
8173 !! test
8174 Manually-specified thumbnail image with explicit link to url
8175 !! options
8177 !! input
8178 [[Image:Foobar.jpg|thumb=Thumb.png|link=http://example.com|Title]]
8179 !! result
8180 <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>
8182 !! end
8184 !! test
8185 Manually-specified thumbnail image with explicit no link
8186 !! options
8188 !! input
8189 [[Image:Foobar.jpg|thumb=Thumb.png|link=|Title]]
8190 !! result
8191 <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>
8193 !! end
8195 !! test
8196 Manually-specified thumbnail image with explicit link and alt text
8197 !! options
8199 !! input
8200 [[Image:Foobar.jpg|thumb=Thumb.png|link=Main Page|alt=alttext|Title]]
8201 !! result
8202 <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>
8204 !! end
8206 !! test
8207 Image with frame and link
8208 !! input
8209 [[Image:Foobar.jpg|frame|left|This is a test image [[Main Page]]]]
8210 !! result
8211 <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>
8213 !! end
8215 !! test
8216 Image with frame and link and explicit alt
8217 !! input
8218 [[Image:Foobar.jpg|frame|left|This is a test image [[Main Page]]|alt=Altitude]]
8219 !! result
8220 <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>
8222 !! end
8224 !! test
8225 Image with wiki markup in implicit alt
8226 !! input
8227 [[Image:Foobar.jpg|testing '''bold''' in alt]]
8228 !! result
8229 <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>
8230 </p>
8231 !! end
8233 !! test
8234 Image with wiki markup in explicit alt
8235 !! input
8236 [[Image:Foobar.jpg|alt=testing '''bold''' in alt]]
8237 !! result
8238 <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>
8239 </p>
8240 !! end
8242 !! test
8243 Link to image page- image page normally doesn't exists, hence edit link
8244 Add test with existing image page
8245 #<p><a href="/wiki/File:Test" title="Image:Test">Image:test</a>
8246 !! input
8247 [[:Image:test]]
8248 !! result
8249 <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>
8250 </p>
8251 !! end
8253 !! test
8254 bug 18784  Link to non-existent image page with caption should use caption as link text
8255 !! input
8256 [[:Image:test|caption]]
8257 !! result
8258 <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>
8259 </p>
8260 !! end
8262 !! test
8263 Frameless image caption with a free URL
8264 !! input
8265 [[Image:foobar.jpg|http://example.com]]
8266 !! result
8267 <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>
8268 </p>
8269 !! end
8271 !! test
8272 Thumbnail image caption with a free URL
8273 !! input
8274 [[Image:foobar.jpg|thumb|http://example.com]]
8275 !! result
8276 <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>
8278 !! end
8280 !! test
8281 Thumbnail image caption with a free URL and explicit alt
8282 !! input
8283 [[Image:foobar.jpg|thumb|http://example.com|alt=Alteration]]
8284 !! result
8285 <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>
8287 !! end
8289 !! test
8290 SVG thumbnails with no language set
8291 !! options
8292 !! input
8293 [[File:Foobar.svg|thumb|width=200]]
8294 !! result
8295 <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>
8297 !! end
8299 !! test
8300 SVG thumbnails with language de
8301 !! options
8302 !! input
8303 [[File:Foobar.svg|thumb|width=200|lang=de]]
8304 !! result
8305 <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>
8307 !! end
8309 !! test
8310 SVG thumbnails with invalid language code
8311 !! options
8312 !! input
8313 [[File:Foobar.svg|thumb|width=200|lang=invalid.language.code]]
8314 !! result
8315 <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>
8317 !! end
8319 !! test
8320 BUG 1887: A ISBN with a thumbnail
8321 !! input
8322 [[Image:foobar.jpg|thumb|ISBN 1235467890]]
8323 !! result
8324 <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>
8326 !! end
8328 !! test
8329 BUG 1887: A RFC with a thumbnail
8330 !! input
8331 [[Image:foobar.jpg|thumb|This is RFC 12354]]
8332 !! result
8333 <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>
8335 !! end
8337 !! test
8338 BUG 1887: A mailto link with a thumbnail
8339 !! input
8340 [[Image:foobar.jpg|thumb|Please mailto:nobody@example.com]]
8341 !! result
8342 <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>
8344 !! end
8346 # Pending resolution to bug 368
8347 !! test
8348 BUG 648: Frameless image caption with a link
8349 !! input
8350 [[Image:foobar.jpg|text with a [[link]] in it]]
8351 !! result
8352 <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>
8353 </p>
8354 !! end
8356 !! test
8357 BUG 648: Frameless image caption with a link (suffix)
8358 !! input
8359 [[Image:foobar.jpg|text with a [[link]]foo in it]]
8360 !! result
8361 <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>
8362 </p>
8363 !! end
8365 !! test
8366 BUG 648: Frameless image caption with an interwiki link
8367 !! input
8368 [[Image:foobar.jpg|text with a [[MeatBall:Link]] in it]]
8369 !! result
8370 <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>
8371 </p>
8372 !! end
8374 !! test
8375 BUG 648: Frameless image caption with a piped interwiki link
8376 !! input
8377 [[Image:foobar.jpg|text with a [[MeatBall:Link|link]] in it]]
8378 !! result
8379 <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>
8380 </p>
8381 !! end
8383 !! test
8384 Escape HTML special chars in image alt text
8385 !! input
8386 [[Image:foobar.jpg|& < > "]]
8387 !! result
8388 <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>
8389 </p>
8390 !! end
8392 !! test
8393 BUG 499: Alt text should have &#1234;, not &amp;1234;
8394 !! input
8395 [[Image:foobar.jpg|&#9792;]]
8396 !! result
8397 <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>
8398 </p>
8399 !! end
8401 !! test
8402 Broken image caption with link
8403 !! input
8404 [[Image:Foobar.jpg|thumb|This is a broken caption. But [[Main Page|this]] is just an ordinary link.
8405 !! result
8406 <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.
8407 </p>
8408 !! end
8410 !! test
8411 Image caption containing another image
8412 !! input
8413 [[Image:Foobar.jpg|thumb|This is a caption with another [[Image:icon.png|image]] inside it!]]
8414 !! result
8415 <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>
8417 !! end
8419 !! test
8420 Image caption containing a newline
8421 !! input
8422 [[Image:Foobar.jpg|This
8423 *is some text]]
8424 !! result
8425 <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>
8426 </p>
8427 !!end
8429 !!test
8430 Parsoid: Image caption containing leading space
8431 (The leading space should not trigger nowiki escaping in wt2wt mode)
8432 !! input
8433 [[Image:Foobar.jpg|thumb| bar]]
8434 !! result
8435 <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>
8437 !!end
8439 !! test
8440 Bug 3090: External links other than http: in image captions
8441 !! input
8442 [[Image:Foobar.jpg|thumb|200px|This caption has [irc://example.net irc] and [https://example.com Secure] ext links in it.]]
8443 !! result
8444 <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>
8446 !! end
8448 !! test
8449 Custom class
8450 !! input
8451 [[Image:foobar.jpg|a|class=b]]
8452 !! result
8453 <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>
8454 </p>
8455 !! end
8457 !! test
8458 Localized image handling (1).
8459 !! options
8460 language=es
8461 !! input
8462 [[Archivo:Foobar.jpg|izquierda|enlace=foo|caption]]
8463 !! result
8464 <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>
8466 !! end
8468 !! test
8469 Localized image handling (2).
8470 !! options
8471 language=es
8472 !! input
8473 [[Archivo:Foobar.jpg|miniatura|izquierda|enlace=foo|caption]]
8474 !! result
8475 <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>
8477 !! end
8479 !! test
8480 "border", "frameless" and "class" attributes on an image.
8481 !! input
8482 [[File:Foobar.jpg|frameless|border|class=extra|caption]]
8483 !! result
8484 <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>
8485 </p>
8486 !! end
8488 !! article
8489 File:Barfoo.jpg
8490 !! text
8491 #REDIRECT [[File:Barfoo.jpg]]
8492 !! endarticle
8494 !! test
8495 Redirected image
8496 !! input
8497 [[Image:Barfoo.jpg]]
8498 !! result
8499 <p><a href="/wiki/File:Barfoo.jpg" title="File:Barfoo.jpg">File:Barfoo.jpg</a>
8500 </p>
8501 !! end
8503 !! test
8504 Missing image with uploads disabled
8505 !! options
8506 wgEnableUploads=0
8507 !! input
8508 [[Image:Foobaz.jpg]]
8509 !! result
8510 <p><a href="/wiki/File:Foobaz.jpg" title="File:Foobaz.jpg">File:Foobaz.jpg</a>
8511 </p>
8512 !! end
8514 # Parsoid-specific testing for images
8515 # http://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec#Images
8516 # Currently imperfect due to a flaw in the Parsoid testrunner
8517 # Work in progress
8519 !! test
8520 Parsoid-specific image handling - simple image
8521 !! options
8522 parsoid
8523 !! input
8524 [[Image:Foobar.jpg]]
8525 !! result
8527 <span class="mw-default-size" typeof="mw:Image">
8528 <a href="File:Foobar.jpg">
8529 <img resource="./File:Foobar.jpg" src="//upload.wikimedia.org/wikipedia/commons/3/3a/Foobar.jpg" height="220" width="1941">
8530 </a>
8531 </span>
8532 </p>
8533 !! end
8535 !! test
8536 Parsoid-specific image handling - simple image without link
8537 !! options
8538 parsoid
8539 !! input
8540 [[Image:Foobar.jpg|link=]]
8541 !! result
8543 <span class="mw-default-size" typeof="mw:Image">
8544 <span>
8545 <img resource="./File:Foobar.jpg" src="//upload.wikimedia.org/wikipedia/commons/3/3a/Foobar.jpg" height="220" width="1941">
8546 </span>
8547 </span>
8548 </p>
8549 !! end
8551 !! test
8552 Parsoid-specific image handling - simple image with specific link
8553 !! options
8554 parsoid
8555 !! input
8556 [[Image:Foobar.jpg|link=Main Page]]
8557 !! result
8559 <span class="mw-default-size" typeof="mw:Image">
8560 <a href="Main_Page">
8561 <img resource="./File:Foobar.jpg" src="//upload.wikimedia.org/wikipedia/commons/3/3a/Foobar.jpg" height="220" width="1941">
8562 </a>
8563 </span>
8564 </p>
8565 !! end
8567 !! test
8568 Parsoid-specific image handling - simple image with size and middle alignment
8569 !! options
8570 parsoid
8571 !! input
8572 [[Image:Foobar.jpg|50px|middle]]
8573 !! result
8575 <span class="mw-valign-middle" typeof="mw:Image">
8576 <a href="File:Foobar.jpg">
8577 <img resource="./File:Foobar.jpg" src="//upload.wikimedia.org/wikipedia/commons/3/3a/Foobar.jpg/50px-Foobar.jpg" height="6" width="50">
8578 </a>
8579 </span>
8580 </p>
8581 !! end
8583 !! test
8584 Parsoid-specific image handling - simple image with both sizes, a baseline alignment, and a caption
8585 !! options
8586 parsoid
8587 !! input
8588 [[Image:Foobar.jpg|500x10px|baseline|caption]]
8589 !! result
8591 <span class="mw-valign-baseline" typeof="mw:Image" data-mw="{&quot;caption&quot;:&quot;caption&quot;}">
8592 <a href="File:Foobar.jpg">
8593 <img resource="./File:Foobar.jpg" src="//upload.wikimedia.org/wikipedia/commons/3/3a/Foobar.jpg/89px-Foobar.jpg" height="10" width="89">
8594 </a>
8595 </span>
8596 </p>
8597 !! end
8599 !! test
8600 Parsoid-specific image handling - simple image with border and size spec
8601 !! options
8602 parsoid
8603 !! input
8604 [[Image:Foobar.jpg|50px|border|caption]]
8605 !! result
8607 <span class="mw-image-border" typeof="mw:Image" data-mw="{&quot;caption&quot;:&quot;caption&quot;}">
8608 <a href="File:Foobar.jpg">
8609 <img resource="./File:Foobar.jpg" src="//upload.wikimedia.org/wikipedia/commons/3/3a/Foobar.jpg/50px-Foobar.jpg" height="6" width="50">
8610 </a>
8611 </span>
8612 </p>
8613 !! end
8615 !! test
8616 Parsoid-specific image handling - thumbnail with halign, valign, and caption
8617 !! options
8618 parsoid
8619 !! input
8620 [[Image:Foobar.jpg|thumb|left|baseline|caption content]]
8621 !! result
8622 <figure class="mw-default-size mw-halign-left mw-valign-baseline" typeof="mw:Image/Thumb">
8623 <a href="File:Foobar.jpg">
8624 <img resource="./File:Foobar.jpg" src="//upload.wikimedia.org/wikipedia/commons/3/3a/Foobar.jpg/180px-Foobar.jpg" height="21" width="180" />
8625 </a>
8626 <figcaption>caption content</figcaption>
8627 </figure>
8628 !! end
8630 !! test
8631 Parsoid-specific image handling - thumbnail with specific size, halign, valign, and caption
8632 !! options
8633 parsoid
8634 !! input
8635 [[Image:Foobar.jpg|thumb|50x50px|right|middle|caption]]
8636 !! result
8637 <figure class="mw-halign-right mw-valign-middle" typeof="mw:Image/Thumb">
8638 <a href="File:Foobar.jpg">
8639 <img resource="./File:Foobar.jpg" src="//upload.wikimedia.org/wikipedia/commons/3/3a/Foobar.jpg/50px-Foobar.jpg" height="6" width="50" />
8640 </a>
8641 <figcaption>caption</figcaption>
8642 </figure>
8643 !! end
8645 !! test
8646 Parsoid-specific image handling - framed image with specific size and caption
8647 !! options
8648 parsoid
8649 !! input
8650 [[Image:Foobar.jpg|500x50px|frame|caption]]
8651 !! result
8652 <figure typeof="mw:Image/Frame">
8653 <a href="File:Foobar.jpg">
8654 <img resource="./File:Foobar.jpg" src="//upload.wikimedia.org/wikipedia/commons/3/3a/Foobar.jpg/442px-Foobar.jpg" height="50" width="442" />
8655 </a>
8656 <figcaption>caption</figcaption>
8657 </figure>
8658 !! end
8660 !! test
8661 Parsoid-specific image handling - framed image with specific size, halign, valign, and caption
8662 !! options
8663 parsoid
8664 !! input
8665 [[Image:Foobar.jpg|500x50px|frame|left|baseline|caption]]
8666 !! result
8667 <figure class="mw-halign-left mw-valign-baseline" typeof="mw:Image/Frame">
8668 <a href="File:Foobar.jpg">
8669 <img resource="./File:Foobar.jpg" src="//upload.wikimedia.org/wikipedia/commons/3/3a/Foobar.jpg/442px-Foobar.jpg" height="50" width="442" />
8670 </a>
8671 <figcaption>caption</figcaption>
8672 </figure>
8673 !! end
8675 !! test
8676 Parsoid-specific image handling - frameless image with specific size, border, and caption
8677 !! options
8678 parsoid
8679 !! input
8680 [[Image:Foobar.jpg|frameless|500x50px|border|caption]]
8681 !! result
8683 <span class="mw-image-border" typeof="mw:Image/Frameless" data-mw="{&quot;caption&quot;:&quot;caption&quot;}">
8684 <a href="File:Foobar.jpg">
8685 <img resource="./File:Foobar.jpg" src="//upload.wikimedia.org/wikipedia/commons/3/3a/Foobar.jpg/442px-Foobar.jpg" height="50" width="442" />
8686 </a>
8687 </p>
8688 !! end
8690 #!! test
8691 #Parsoid-specific image handling - simple image with a formatted caption
8692 #!! options
8693 #parsoid
8694 #!! input
8695 #[[Image:Foobar.jpg|<table><tr><td>a</td><td>b</td></tr><tr><td>c</td></tr></table>]]
8696 #!! result
8697 #<p>
8698 #<span typeof="mw:Image">
8699 #<a class="mw-default-size" href="Image:Foobar.jpg">
8700 #<img alt="Foobar.jpg" class="mw-default-size" src="http://upload.wikimedia.org/wikipedia/commons/3/3a/Foobar.jpg" height="220" width="1941">
8701 #</a>
8702 #<span>abc</span>
8703 #</span>
8704 #</p>
8708 ### Subpages
8710 !! article
8711 Subpage test/subpage
8712 !! text
8714 !! endarticle
8716 !! test
8717 Subpage link
8718 !! options
8719 subpage title=[[Subpage test]]
8720 !! input
8721 [[/subpage]]
8722 !! result
8723 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a>
8724 </p>
8725 !! end
8727 !! test
8728 Subpage noslash link
8729 !! options
8730 subpage title=[[Subpage test]]
8731 !!input
8732 [[/subpage/]]
8733 !! result
8734 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">subpage</a>
8735 </p>
8736 !! end
8738 # TODO: make this PHP-parser compatible!
8739 !! test
8740 Relative subpage noslash link
8741 !! options
8742 parsoid=wt2wt,wt2html,html2html
8743 subpage title=[[Subpage test/1/2/3/4]]
8744 !!input
8745 [[../../subpage/]]
8747 [[../../subpage]]
8748 !! result
8749 <p><a rel="mw:WikiLink" href="Subpage_test/1/2/subpage/">subpage</a></p>
8750 <p><a rel="mw:WikiLink" href="Subpage_test/1/2/subpage">Subpage_test/1/2/subpage</a></p>
8751 !! end
8753 # TODO: make this PHP-parser compatible!
8754 !! test
8755 Parsoid: dot-slash prefixed wikilinks
8756 !! options
8757 parsoid=wt2wt,wt2html,html2html
8758 !!input
8759 [[./foo]]
8761 [[././bar]]
8763 [[././baz/]]
8764 !! result
8765 <p><a rel="mw:WikiLink" href="./Foo">foo</a></p>
8766 <p><a rel="mw:WikiLink" href="./Bar">bar</a></p>
8767 <p><a rel="mw:WikiLink" href="./Baz/">baz/</a></p>
8768 !! end
8770 !! test
8771 Disabled subpages
8772 !! input
8773 [[/subpage]]
8774 !! result
8775 <p><a href="/index.php?title=/subpage&amp;action=edit&amp;redlink=1" class="new" title="/subpage (page does not exist)">/subpage</a>
8776 </p>
8777 !! end
8779 !! test
8780 BUG 561: {{/Subpage}}
8781 !! options
8782 subpage title=[[Page]]
8783 !! input
8784 {{/Subpage}}
8785 !! result
8786 <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>
8787 </p>
8788 !! end
8791 ### Categories
8793 !! article
8794 Category:MediaWiki User's Guide
8795 !! text
8796 blah
8797 !! endarticle
8799 !! test
8800 Link to category
8801 !! input
8802 [[:Category:MediaWiki User's Guide]]
8803 !! result
8804 <p><a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">Category:MediaWiki User's Guide</a>
8805 </p>
8806 !! end
8808 !! test
8809 Simple category
8810 !! options
8812 !! input
8813 [[Category:MediaWiki User's Guide]]
8814 !! result
8815 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
8816 !! end
8818 !! test
8819 PAGESINCATEGORY invalid title fatal (r33546 fix)
8820 !! input
8821 {{PAGESINCATEGORY:<bogus>}}
8822 !! result
8823 <p>0
8824 </p>
8825 !! end
8827 !! test
8828 Category with different sort key
8829 !! options
8831 !! input
8832 [[Category:MediaWiki User's Guide|Foo]]
8833 !! result
8834 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
8835 !! end
8837 !! test
8838 Category with identical sort key
8839 !! options
8841 !! input
8842 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
8843 !! result
8844 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
8845 !! end
8847 !! test
8848 Category with empty sort key
8849 !! options
8852 !! input
8853 [[Category:MediaWiki User's Guide|]]
8854 !! result
8855 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
8856 !! end
8858 !! test
8859 Category with empty sort key and parentheses
8860 !! options
8863 !! input
8864 [[Category:Foo (bar)|]]
8865 !! result
8866 [[Category:Foo (bar)|Foo]]
8867 !! end
8869 !! test
8870 Category with link tail
8871 !! options
8874 !! input
8875 123[[Category:Foo]]456
8876 !! result
8877 123[[Category:Foo]]456
8878 !! end
8880 !! test
8881 Category with template
8882 !! options
8885 !! input
8886 [[Category:{{echo|Foo}}]]
8887 !! result
8888 [[Category:{{echo|Foo}}]]
8889 !! end
8891 !! test
8892 Category with template in sort key
8893 !! options
8896 !! input
8897 [[Category:Foo|{{echo|Bar}}]]
8898 !! result
8899 [[Category:Foo|{{echo|Bar}}]]
8900 !! end
8902 !! test
8903 Category with template in sort key and title
8904 !! options
8907 !! input
8908 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
8909 !! result
8910 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
8911 !! end
8913 !! test
8914 Category / paragraph interactions
8915 !! input
8916 Foo [[Category:Baz]] Bar
8918 Foo [[Category:Baz]]
8922 [[Category:Baz]]
8926 [[Category:Baz]] Bar
8929 [[Category:Baz]]
8930  [[Category:Baz]]
8931 [[Category:Baz]]
8934 [[Category:Baz]]
8935  [[Category:Baz]]
8936 [[Category:Baz]]
8938 [[Category:Baz]]
8939  {{echo|[[Category:Baz]]}}
8940 [[Category:Baz]]
8941 !! result
8942 <p>Foo Bar
8943 </p><p>Foo
8945 </p><p>Foo
8947 </p><p>Foo Bar
8948 </p><p>Foo
8950 </p>
8951 !! end
8953 !! test
8954 Parsoid: Serialize link to category page with colon escape
8955 !! options
8956 parsoid
8957 !! input
8959 [[:Category:Foo]]
8960 [[:Category:Foo|Bar]]
8961 !! result
8963 <a rel="mw:WikiLink" href="Category:Foo">Category:Foo</a>
8964 <a rel="mw:WikiLink" href="Category:Foo">Bar</a>
8965 </p>
8966 !! end
8968 !! test
8969 Parsoid: Link prefix/suffixes aren't applied to category links
8970 !! options
8971 parsoid=wt2html,wt2wt,html2html
8972 language=is
8973 !! input
8974 x[[Category:Foo]]y
8975 !! result
8976 <p>x<link rel="mw:WikiLink/Category" href="Category:Foo">y</p>
8977 !! end
8979 !! test
8980 Parsoid: Serialize link to file page with colon escape
8981 !! options
8982 parsoid
8983 !! input
8985 [[:File:Foo.png]]
8986 [[:File:Foo.png|Bar]]
8987 !! result
8989 <a rel="mw:WikiLink" href="File:Foo.png">File:Foo.png</a>
8990 <a rel="mw:WikiLink" href="File:Foo.png">Bar</a>
8991 </p>
8992 !! end
8994 !! test
8995 Parsoid: Serialize a genuine category link without colon escape
8996 !! options
8997 parsoid
8998 !! input
8999 [[Category:Foo]]
9000 [[Category:Foo|Bar]]
9001 !! result
9002 <link rel="mw:WikiLink/Category" href="Category:Foo">
9003 <link rel="mw:WikiLink/Category" href="Category:Foo#Bar">
9004 !! end
9007 ### Inter-language links
9009 !! test
9010 Inter-language links
9011 !! options
9013 !! input
9014 [[es:Alimento]]
9015 [[fr:Nourriture]]
9016 [[zh:&#39135;&#21697;]]
9017 !! result
9018 es:Alimento fr:Nourriture zh:食品
9019 !! end
9021 !! test
9022 Duplicate interlanguage links (bug 24502)
9023 !! options
9025 !! input
9026 [[es:1]]
9027 [[es:2]]
9028 [[fr:1]]
9029 [[fr:2]]
9030 !! result
9031 es:1 fr:1
9032 !! end
9035 ### Sections
9037 !! test
9038 Basic section headings
9039 !! input
9040 == Headline 1 ==
9041 Some text
9043 ==Headline 2==
9044 More
9045 ===Smaller headline===
9046 Blah blah
9047 !! result
9048 <h2><span class="mw-headline" id="Headline_1">Headline 1</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: Headline 1">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
9049 <p>Some text
9050 </p>
9051 <h2><span class="mw-headline" id="Headline_2">Headline 2</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: Headline 2">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
9052 <p>More
9053 </p>
9054 <h3><span class="mw-headline" id="Smaller_headline">Smaller headline</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=3" title="Edit section: Smaller headline">edit</a><span class="mw-editsection-bracket">]</span></span></h3>
9055 <p>Blah blah
9056 </p>
9057 !! end
9059 !! test
9060 Section headings with TOC
9061 !! input
9062 == Headline 1 ==
9063 === Subheadline 1 ===
9064 ===== Skipping a level =====
9065 ====== Skipping a level ======
9067 == Headline 2 ==
9068 Some text
9069 ===Another headline===
9070 !! result
9071 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
9072 <ul>
9073 <li class="toclevel-1 tocsection-1"><a href="#Headline_1"><span class="tocnumber">1</span> <span class="toctext">Headline 1</span></a>
9074 <ul>
9075 <li class="toclevel-2 tocsection-2"><a href="#Subheadline_1"><span class="tocnumber">1.1</span> <span class="toctext">Subheadline 1</span></a>
9076 <ul>
9077 <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>
9078 <ul>
9079 <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>
9080 </ul>
9081 </li>
9082 </ul>
9083 </li>
9084 </ul>
9085 </li>
9086 <li class="toclevel-1 tocsection-5"><a href="#Headline_2"><span class="tocnumber">2</span> <span class="toctext">Headline 2</span></a>
9087 <ul>
9088 <li class="toclevel-2 tocsection-6"><a href="#Another_headline"><span class="tocnumber">2.1</span> <span class="toctext">Another headline</span></a></li>
9089 </ul>
9090 </li>
9091 </ul>
9092 </div>
9093 <h2><span class="mw-headline" id="Headline_1">Headline 1</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: Headline 1">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
9094 <h3><span class="mw-headline" id="Subheadline_1">Subheadline 1</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: Subheadline 1">edit</a><span class="mw-editsection-bracket">]</span></span></h3>
9095 <h5><span class="mw-headline" id="Skipping_a_level">Skipping a level</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=3" title="Edit section: Skipping a level">edit</a><span class="mw-editsection-bracket">]</span></span></h5>
9096 <h6><span class="mw-headline" id="Skipping_a_level_2">Skipping a level</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=4" title="Edit section: Skipping a level">edit</a><span class="mw-editsection-bracket">]</span></span></h6>
9097 <h2><span class="mw-headline" id="Headline_2">Headline 2</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=5" title="Edit section: Headline 2">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
9098 <p>Some text
9099 </p>
9100 <h3><span class="mw-headline" id="Another_headline">Another headline</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=6" title="Edit section: Another headline">edit</a><span class="mw-editsection-bracket">]</span></span></h3>
9102 !! end
9104 # perl -e 'print "="x$_," Level $_ heading","="x$_,"\n" for 1..10'
9105 !! test
9106 Handling of sections up to level 6 and beyond
9107 !! input
9108 = Level 1 Heading=
9109 == Level 2 Heading==
9110 === Level 3 Heading===
9111 ==== Level 4 Heading====
9112 ===== Level 5 Heading=====
9113 ====== Level 6 Heading======
9114 ======= Level 7 Heading=======
9115 ======== Level 8 Heading========
9116 ========= Level 9 Heading=========
9117 ========== Level 10 Heading==========
9118 !! result
9119 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
9120 <ul>
9121 <li class="toclevel-1 tocsection-1"><a href="#Level_1_Heading"><span class="tocnumber">1</span> <span class="toctext">Level 1 Heading</span></a>
9122 <ul>
9123 <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>
9124 <ul>
9125 <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>
9126 <ul>
9127 <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>
9128 <ul>
9129 <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>
9130 <ul>
9131 <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>
9132 <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>
9133 <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>
9134 <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>
9135 <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>
9136 </ul>
9137 </li>
9138 </ul>
9139 </li>
9140 </ul>
9141 </li>
9142 </ul>
9143 </li>
9144 </ul>
9145 </li>
9146 </ul>
9147 </div>
9148 <h1><span class="mw-headline" id="Level_1_Heading">Level 1 Heading</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: Level 1 Heading">edit</a><span class="mw-editsection-bracket">]</span></span></h1>
9149 <h2><span class="mw-headline" id="Level_2_Heading">Level 2 Heading</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: Level 2 Heading">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
9150 <h3><span class="mw-headline" id="Level_3_Heading">Level 3 Heading</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=3" title="Edit section: Level 3 Heading">edit</a><span class="mw-editsection-bracket">]</span></span></h3>
9151 <h4><span class="mw-headline" id="Level_4_Heading">Level 4 Heading</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=4" title="Edit section: Level 4 Heading">edit</a><span class="mw-editsection-bracket">]</span></span></h4>
9152 <h5><span class="mw-headline" id="Level_5_Heading">Level 5 Heading</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=5" title="Edit section: Level 5 Heading">edit</a><span class="mw-editsection-bracket">]</span></span></h5>
9153 <h6><span class="mw-headline" id="Level_6_Heading">Level 6 Heading</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=6" title="Edit section: Level 6 Heading">edit</a><span class="mw-editsection-bracket">]</span></span></h6>
9154 <h6><span class="mw-headline" id=".3D_Level_7_Heading.3D">= Level 7 Heading=</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=7" title="Edit section: = Level 7 Heading=">edit</a><span class="mw-editsection-bracket">]</span></span></h6>
9155 <h6><span class="mw-headline" id=".3D.3D_Level_8_Heading.3D.3D">== Level 8 Heading==</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=8" title="Edit section: == Level 8 Heading==">edit</a><span class="mw-editsection-bracket">]</span></span></h6>
9156 <h6><span class="mw-headline" id=".3D.3D.3D_Level_9_Heading.3D.3D.3D">=== Level 9 Heading===</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=9" title="Edit section: === Level 9 Heading===">edit</a><span class="mw-editsection-bracket">]</span></span></h6>
9157 <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"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=10" title="Edit section: ==== Level 10 Heading====">edit</a><span class="mw-editsection-bracket">]</span></span></h6>
9159 !! end
9161 !! test
9162 TOC regression (bug 9764)
9163 !! input
9164 == title 1 ==
9165 === title 1.1 ===
9166 ==== title 1.1.1 ====
9167 === title 1.2 ===
9168 == title 2 ==
9169 === title 2.1 ===
9170 !! result
9171 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
9172 <ul>
9173 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
9174 <ul>
9175 <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>
9176 <ul>
9177 <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>
9178 </ul>
9179 </li>
9180 <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>
9181 </ul>
9182 </li>
9183 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
9184 <ul>
9185 <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>
9186 </ul>
9187 </li>
9188 </ul>
9189 </div>
9190 <h2><span class="mw-headline" id="title_1">title 1</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: title 1">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
9191 <h3><span class="mw-headline" id="title_1.1">title 1.1</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: title 1.1">edit</a><span class="mw-editsection-bracket">]</span></span></h3>
9192 <h4><span class="mw-headline" id="title_1.1.1">title 1.1.1</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=3" title="Edit section: title 1.1.1">edit</a><span class="mw-editsection-bracket">]</span></span></h4>
9193 <h3><span class="mw-headline" id="title_1.2">title 1.2</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=4" title="Edit section: title 1.2">edit</a><span class="mw-editsection-bracket">]</span></span></h3>
9194 <h2><span class="mw-headline" id="title_2">title 2</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=5" title="Edit section: title 2">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
9195 <h3><span class="mw-headline" id="title_2.1">title 2.1</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=6" title="Edit section: title 2.1">edit</a><span class="mw-editsection-bracket">]</span></span></h3>
9197 !! end
9199 !! test
9200 TOC with wgMaxTocLevel=3 (bug 6204)
9201 !! options
9202 wgMaxTocLevel=3
9203 !! input
9204 == title 1 ==
9205 === title 1.1 ===
9206 ==== title 1.1.1 ====
9207 === title 1.2 ===
9208 == title 2 ==
9209 === title 2.1 ===
9210 !! result
9211 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
9212 <ul>
9213 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
9214 <ul>
9215 <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>
9216 <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>
9217 </ul>
9218 </li>
9219 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
9220 <ul>
9221 <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>
9222 </ul>
9223 </li>
9224 </ul>
9225 </div>
9226 <h2><span class="mw-headline" id="title_1">title 1</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: title 1">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
9227 <h3><span class="mw-headline" id="title_1.1">title 1.1</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: title 1.1">edit</a><span class="mw-editsection-bracket">]</span></span></h3>
9228 <h4><span class="mw-headline" id="title_1.1.1">title 1.1.1</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=3" title="Edit section: title 1.1.1">edit</a><span class="mw-editsection-bracket">]</span></span></h4>
9229 <h3><span class="mw-headline" id="title_1.2">title 1.2</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=4" title="Edit section: title 1.2">edit</a><span class="mw-editsection-bracket">]</span></span></h3>
9230 <h2><span class="mw-headline" id="title_2">title 2</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=5" title="Edit section: title 2">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
9231 <h3><span class="mw-headline" id="title_2.1">title 2.1</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=6" title="Edit section: title 2.1">edit</a><span class="mw-editsection-bracket">]</span></span></h3>
9233 !! end
9235 !! test
9236 TOC with wgMaxTocLevel=3 and two level four headings (bug 6204)
9237 !! options
9238 wgMaxTocLevel=3
9239 !! input
9240 ==Section 1==
9241 ===Section 1.1===
9242 ====Section 1.1.1====
9243 ====Section 1.1.1.1====
9244 ==Section 2==
9245 !! result
9246 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
9247 <ul>
9248 <li class="toclevel-1 tocsection-1"><a href="#Section_1"><span class="tocnumber">1</span> <span class="toctext">Section 1</span></a>
9249 <ul>
9250 <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>
9251 </ul>
9252 </li>
9253 <li class="toclevel-1 tocsection-5"><a href="#Section_2"><span class="tocnumber">2</span> <span class="toctext">Section 2</span></a></li>
9254 </ul>
9255 </div>
9256 <h2><span class="mw-headline" id="Section_1">Section 1</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: Section 1">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
9257 <h3><span class="mw-headline" id="Section_1.1">Section 1.1</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: Section 1.1">edit</a><span class="mw-editsection-bracket">]</span></span></h3>
9258 <h4><span class="mw-headline" id="Section_1.1.1">Section 1.1.1</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=3" title="Edit section: Section 1.1.1">edit</a><span class="mw-editsection-bracket">]</span></span></h4>
9259 <h4><span class="mw-headline" id="Section_1.1.1.1">Section 1.1.1.1</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=4" title="Edit section: Section 1.1.1.1">edit</a><span class="mw-editsection-bracket">]</span></span></h4>
9260 <h2><span class="mw-headline" id="Section_2">Section 2</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=5" title="Edit section: Section 2">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
9262 !! end
9265 !! test
9266 Resolving duplicate section names
9267 !! input
9268 == Foo bar ==
9269 == Foo bar ==
9270 !! result
9271 <h2><span class="mw-headline" id="Foo_bar">Foo bar</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: Foo bar">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
9272 <h2><span class="mw-headline" id="Foo_bar_2">Foo bar</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: Foo bar">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
9274 !! end
9276 !! test
9277 Resolving duplicate section names with differing case (bug 10721)
9278 !! input
9279 == Foo bar ==
9280 == Foo Bar ==
9281 !! result
9282 <h2><span class="mw-headline" id="Foo_bar">Foo bar</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: Foo bar">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
9283 <h2><span class="mw-headline" id="Foo_Bar_2">Foo Bar</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: Foo Bar">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
9285 !! end
9287 !! article
9288 Template:sections
9289 !! text
9290 ===Section 1===
9291 ==Section 2==
9292 !! endarticle
9294 !! test
9295 Template with sections, __NOTOC__
9296 !! input
9297 __NOTOC__
9298 ==Section 0==
9299 {{sections}}
9300 ==Section 4==
9301 !! result
9302 <h2><span class="mw-headline" id="Section_0">Section 0</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: Section 0">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
9303 <h3><span class="mw-headline" id="Section_1">Section 1</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Template:Sections&amp;action=edit&amp;section=T-1" title="Template:Sections">edit</a><span class="mw-editsection-bracket">]</span></span></h3>
9304 <h2><span class="mw-headline" id="Section_2">Section 2</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Template:Sections&amp;action=edit&amp;section=T-2" title="Template:Sections">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
9305 <h2><span class="mw-headline" id="Section_4">Section 4</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: Section 4">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
9307 !! end
9309 !! test
9310 __NOEDITSECTION__ keyword
9311 !! input
9312 __NOEDITSECTION__
9313 ==Section 1==
9314 ==Section 2==
9315 !! result
9316 <h2><span class="mw-headline" id="Section_1">Section 1</span></h2>
9317 <h2><span class="mw-headline" id="Section_2">Section 2</span></h2>
9319 !! end
9321 !! test
9322 Link inside a section heading
9323 !! input
9324 ==Section with a [[Main Page|link]] in it==
9325 !! result
9326 <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"><span class="mw-editsection-bracket">[</span><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 class="mw-editsection-bracket">]</span></span></h2>
9328 !! end
9330 !! test
9331 TOC regression (bug 12077)
9332 !! input
9333 __TOC__
9334 == title 1 ==
9335 === title 1.1 ===
9336 == title 2 ==
9337 !! result
9338 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
9339 <ul>
9340 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
9341 <ul>
9342 <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>
9343 </ul>
9344 </li>
9345 <li class="toclevel-1 tocsection-3"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a></li>
9346 </ul>
9347 </div>
9348 <h2><span class="mw-headline" id="title_1">title 1</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: title 1">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
9349 <h3><span class="mw-headline" id="title_1.1">title 1.1</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: title 1.1">edit</a><span class="mw-editsection-bracket">]</span></span></h3>
9350 <h2><span class="mw-headline" id="title_2">title 2</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=3" title="Edit section: title 2">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
9352 !! end
9354 !! test
9355 BUG 1219 URL next to image (good)
9356 !! input
9357 http://example.com [[Image:foobar.jpg]]
9358 !! result
9359 <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>
9360 </p>
9361 !!end
9363 !! test
9364 Short headings with trailing space should match behavior of Parser::doHeadings (bug 19910)
9365 !! input
9366 === 
9367 The line above must have a trailing space!
9368 === <!--
9369 --> <!-- -->
9370 But just in case it doesn't...
9371 !! result
9372 <h1><span class="mw-headline" id=".3D">=</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: =">edit</a><span class="mw-editsection-bracket">]</span></span></h1>
9373 <p>The line above must have a trailing space!
9374 </p>
9375 <h1><span class="mw-headline" id=".3D_2">=</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: =">edit</a><span class="mw-editsection-bracket">]</span></span></h1>
9376 <p>But just in case it doesn't...
9377 </p>
9378 !! end
9380 !! test
9381 Header with special characters (bug 25462)
9382 !! input
9383 The tooltips shall not show entities to the user (ie. be double escaped)
9385 == text > text ==
9386 section 1
9388 == text < text ==
9389 section 2
9391 == text & text ==
9392 section 3
9394 == text ' text ==
9395 section 4
9397 == text " text ==
9398 section 5
9399 !! result
9400 <p>The tooltips shall not show entities to the user (ie. be double escaped)
9401 </p>
9402 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
9403 <ul>
9404 <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>
9405 <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>
9406 <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>
9407 <li class="toclevel-1 tocsection-4"><a href="#text_.27_text"><span class="tocnumber">4</span> <span class="toctext">text ' text</span></a></li>
9408 <li class="toclevel-1 tocsection-5"><a href="#text_.22_text"><span class="tocnumber">5</span> <span class="toctext">text " text</span></a></li>
9409 </ul>
9410 </div>
9411 <h2><span class="mw-headline" id="text_.3E_text">text &gt; text</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: text > text">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
9412 <p>section 1
9413 </p>
9414 <h2><span class="mw-headline" id="text_.3C_text">text &lt; text</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: text &lt; text">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
9415 <p>section 2
9416 </p>
9417 <h2><span class="mw-headline" id="text_.26_text">text &amp; text</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=3" title="Edit section: text &amp; text">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
9418 <p>section 3
9419 </p>
9420 <h2><span class="mw-headline" id="text_.27_text">text ' text</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=4" title="Edit section: text ' text">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
9421 <p>section 4
9422 </p>
9423 <h2><span class="mw-headline" id="text_.22_text">text " text</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=5" title="Edit section: text &quot; text">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
9424 <p>section 5
9425 </p>
9426 !! end
9428 !! test
9429 Headers with excess '=' characters
9430 (Are similar tests necessary beyond the 1st level?)
9431 !! input
9432 =foo==
9433 ==foo=
9434 =''italic'' heading==
9435 ==''italic'' heading=
9436 !! result
9437 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
9438 <ul>
9439 <li class="toclevel-1 tocsection-1"><a href="#foo.3D"><span class="tocnumber">1</span> <span class="toctext">foo=</span></a></li>
9440 <li class="toclevel-1 tocsection-2"><a href="#.3Dfoo"><span class="tocnumber">2</span> <span class="toctext">=foo</span></a></li>
9441 <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>
9442 <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>
9443 </ul>
9444 </div>
9445 <h1><span class="mw-headline" id="foo.3D">foo=</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: foo=">edit</a><span class="mw-editsection-bracket">]</span></span></h1>
9446 <h1><span class="mw-headline" id=".3Dfoo">=foo</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: =foo">edit</a><span class="mw-editsection-bracket">]</span></span></h1>
9447 <h1><span class="mw-headline" id="italic_heading.3D"><i>italic</i> heading=</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=3" title="Edit section: italic heading=">edit</a><span class="mw-editsection-bracket">]</span></span></h1>
9448 <h1><span class="mw-headline" id=".3Ditalic_heading">=<i>italic</i> heading</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=4" title="Edit section: =italic heading">edit</a><span class="mw-editsection-bracket">]</span></span></h1>
9450 !! end
9452 !! test
9453 HTML headers vs TOC (bug 23393)
9454 (__NOEDITSECTION__ for clearer output, doesn't matter here)
9455 !! input
9456 <h1>Header 1</h1>
9457 == Header 1.1 ==
9458 == Header 1.2 ==
9460 <h1>Header 2
9461 </h1>
9462 == Header 2.1 ==
9463 == Header 2.2 ==
9464 __NOEDITSECTION__
9465 !! result
9466 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
9467 <ul>
9468 <li class="toclevel-1"><a href="#Header_1"><span class="tocnumber">1</span> <span class="toctext">Header 1</span></a>
9469 <ul>
9470 <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>
9471 <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>
9472 </ul>
9473 </li>
9474 <li class="toclevel-1"><a href="#Header_2"><span class="tocnumber">2</span> <span class="toctext">Header 2</span></a>
9475 <ul>
9476 <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>
9477 <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>
9478 </ul>
9479 </li>
9480 </ul>
9481 </div>
9482 <h1><span class="mw-headline" id="Header_1">Header 1</span></h1>
9483 <h2><span class="mw-headline" id="Header_1.1">Header 1.1</span></h2>
9484 <h2><span class="mw-headline" id="Header_1.2">Header 1.2</span></h2>
9485 <h1><span class="mw-headline" id="Header_2">Header 2</span></h1>
9486 <h2><span class="mw-headline" id="Header_2.1">Header 2.1</span></h2>
9487 <h2><span class="mw-headline" id="Header_2.2">Header 2.2</span></h2>
9489 !! end
9491 !! test
9492 BUG 1219 URL next to image (broken)
9493 !! input
9494 http://example.com[[Image:foobar.jpg]]
9495 !! result
9496 <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>
9497 </p>
9498 !!end
9500 !! test
9501 Bug 1186 news: in the middle of text
9502 !! input
9503 http://en.wikinews.org/wiki/Wikinews:Workplace
9504 !! result
9505 <p><a rel="nofollow" class="external free" href="http://en.wikinews.org/wiki/Wikinews:Workplace">http://en.wikinews.org/wiki/Wikinews:Workplace</a>
9506 </p>
9507 !!end
9510 !! test
9511 Namespaced link must have a title
9512 !! input
9513 [[Project:]]
9514 !! result
9515 <p>[[Project:]]
9516 </p>
9517 !!end
9519 !! test
9520 Namespaced link must have a title (bad fragment version)
9521 !! input
9522 [[Project:#fragment]]
9523 !! result
9524 <p>[[Project:#fragment]]
9525 </p>
9526 !!end
9530 ### HTML tags and HTML attributes
9533 !! test
9534 div with no attributes
9535 !! input
9536 <div>HTML rocks</div>
9537 !! result
9538 <div>HTML rocks</div>
9540 !! end
9542 !! test
9543 div with double-quoted attribute
9544 !! input
9545 <div id="rock">HTML rocks</div>
9546 !! result
9547 <div id="rock">HTML rocks</div>
9549 !! end
9551 !! test
9552 div with single-quoted attribute
9553 !! input
9554 <div id='rock'>HTML rocks</div>
9555 !! result
9556 <div id="rock">HTML rocks</div>
9558 !! end
9560 !! test
9561 div with unquoted attribute
9562 !! input
9563 <div id=rock>HTML rocks</div>
9564 !! result
9565 <div id="rock">HTML rocks</div>
9567 !! end
9569 !! test
9570 div with illegal double attributes
9571 !! input
9572 <div id="a" id="b">HTML rocks</div>
9573 !! result
9574 <div id="b">HTML rocks</div>
9576 !!end
9578 # FIXME: produce empty string instead of "class" in the PHP parser, following
9579 # the HTML5 spec.
9580 !! test
9581 div with empty attribute value, space before equals
9582 !! options
9583 parsoid
9584 !! input
9585 <div class =>HTML rocks</div>
9586 !! result
9587 <div class="">HTML rocks</div>
9589 !! end
9591 # The PHP parser escapes the opening brace to &#123; for some reason, so
9592 # disabled this test for it.
9593 !! test
9594 div with braces in attribute value
9595 !! options
9596 parsoid
9597 !! input
9598 <div title="{}">Foo</div>
9599 !! result
9600 <div title="{}">Foo</div>
9601 !! end
9603 # This it very inconsistent in the PHP parser: it returns 
9604 # class="class" if there is a space between the name and the equal sign (see
9605 # 'div with empty attribute value, space before equals'), but strips the
9606 # attribute completely if the space is missing. We hope that not much content
9607 # depends on this, so are implementing the behavior below in Parsoid for
9608 # consistencies' sake. Disabled for the PHP parser. 
9609 # FIXME: fix this behavior in the PHP parser?
9610 !! test
9611 div with empty attribute value, no space before equals
9612 !! options
9613 parsoid
9614 !! input
9615 <div class=>HTML rocks</div>
9616 !! result
9617 <div class="">HTML rocks</div>
9619 !! end
9621 !! test
9622 HTML multiple attributes correction
9623 !! input
9624 <p class="error" class="awesome">Awesome!</p>
9625 !! result
9626 <p class="awesome">Awesome!</p>
9628 !!end
9630 !! test
9631 Table multiple attributes correction
9632 !! input
9634 !+ class="error" class="awesome"| status
9636 !! result
9637 <table>
9638 <tr>
9639 <th class="awesome"> status
9640 </th></tr></table>
9642 !!end
9644 !! test
9645 DIV IN UPPERCASE
9646 !! input
9647 <DIV ID="x">HTML ROCKS</DIV>
9648 !! result
9649 <div id="x">HTML ROCKS</div>
9651 !!end
9653 !! test
9654 Non-ASCII pseudo-tags are rendered as text
9655 !! input
9656 <khyô>
9657 !! result
9658 <p>&lt;khyô&gt;
9659 </p>
9660 !! end
9662 !! test
9663 Pseudo-tag with URL 'name' renders as url link
9664 !! input
9665 <http://example.com/>
9666 !! result
9667 <p>&lt;<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&gt;
9668 </p>
9669 !! end
9671 !! test
9672 text with amp in the middle of nowhere
9673 !! input
9674 Remember AT&T?
9675 !!result
9676 <p>Remember AT&amp;T?
9677 </p>
9678 !! end
9680 !! test
9681 text with character entity: eacute
9682 !! input
9683 I always thought &eacute; was a cute letter.
9684 !! result
9685 <p>I always thought &#233; was a cute letter.
9686 </p>
9687 !! end
9689 !! test
9690 text with entity-escaped character entity-like string: eacute
9691 !! input
9692 I always thought &amp;eacute; was a cute letter.
9693 !! result
9694 <p>I always thought &amp;eacute; was a cute letter.
9695 </p>
9696 !! end
9698 !! test
9699 text with undefined character entity: xacute
9700 !! input
9701 I always thought &xacute; was a cute letter.
9702 !! result
9703 <p>I always thought &amp;xacute; was a cute letter.
9704 </p>
9705 !! end
9709 ### Nesting tests (see bug 41545, 50604, 51081)
9712 # This test case is fixed in Parsoid by domino 1.0.12. (bug 50604)
9713 # Note that html2wt is considerably more difficult if we use <b> in
9714 # the test case, instead of <big>
9715 !! test
9716 Ensure that HTML adoption agency algorithm is properly implemented.
9717 !! input
9718 <big>X<big>Y</big>Z</big>
9719 !! result
9720 <p><big>X<big>Y</big>Z</big>
9721 </p>
9722 !! end
9724 # This was bug 41545 in the PHP parser.
9725 !! test
9726 Nesting of <kbd>
9727 !! input
9728 <kbd>X<kbd>Y</kbd>Z</kbd>
9729 !! result
9730 <p><kbd>X<kbd>Y</kbd>Z</kbd>
9731 </p>
9732 !! end
9734 # The following cases were bug 51081 in the PHP parser.
9735 # Note that there are some other nestable tags (b, i, etc) which are
9736 # not covered; see bug 51081 for discussion.
9737 !! test
9738 Nesting of <em>
9739 !! input
9740 <em>X<em>Y</em>Z</em>
9741 !! result
9742 <p><em>X<em>Y</em>Z</em>
9743 </p>
9744 !! end
9746 !! test
9747 Nesting of <strong>
9748 !! input
9749 <strong>X<strong>Y</strong>Z</strong>
9750 !! result
9751 <p><strong>X<strong>Y</strong>Z</strong>
9752 </p>
9753 !! end
9755 !! test
9756 Nesting of <q>
9757 !! input
9758 <q>X<q>Y</q>Z</q>
9759 !! result
9760 <p><q>X<q>Y</q>Z</q>
9761 </p>
9762 !! end
9764 !! test
9765 Nesting of <ruby>
9766 !! input
9767 <ruby>X<ruby>Y</ruby>Z</ruby>
9768 !! result
9769 <p><ruby>X<ruby>Y</ruby>Z</ruby>
9770 </p>
9771 !! end
9773 !! test
9774 Nesting of <bdo>
9775 !! input
9776 <bdo>X<bdo>Y</bdo>Z</bdo>
9777 !! result
9778 <p><bdo>X<bdo>Y</bdo>Z</bdo>
9779 </p>
9780 !! end
9784 ### Media links
9787 !! test
9788 Media link
9789 !! input
9790 [[Media:Foobar.jpg]]
9791 !! result
9792 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Media:Foobar.jpg</a>
9793 </p>
9794 !! end
9796 !! test
9797 Media link with text
9798 !! input
9799 [[Media:Foobar.jpg|A neat file to look at]]
9800 !! result
9801 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">A neat file to look at</a>
9802 </p>
9803 !! end
9805 # FIXME: this is still bad HTML tag nesting
9806 !! test
9807 Media link with nasty text
9808 fixme: doBlockLevels won't wrap this in a paragraph because it contains a div
9809 !! input
9810 [[Media:Foobar.jpg|Safe Link<div style=display:none>" onmouseover="alert(document.cookie)" onfoo="</div>]]
9811 !! result
9812 <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>
9814 !! end
9816 !! test
9817 Media link to nonexistent file (bug 1702)
9818 !! input
9819 [[Media:No such.jpg]]
9820 !! result
9821 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=No_such.jpg" class="new" title="No such.jpg">Media:No such.jpg</a>
9822 </p>
9823 !! end
9825 !! test
9826 Image link to nonexistent file (bug 1850 - good)
9827 !! input
9828 [[Image:No such.jpg]]
9829 !! result
9830 <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>
9831 </p>
9832 !! end
9834 !! test
9835 :Image link to nonexistent file (bug 1850 - bad)
9836 !! input
9837 [[:Image:No such.jpg]]
9838 !! result
9839 <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>
9840 </p>
9841 !! end
9845 !! test
9846 Character reference normalization in link text (bug 1938)
9847 !! input
9848 [[Main Page|this&that]]
9849 !! result
9850 <p><a href="/wiki/Main_Page" title="Main Page">this&amp;that</a>
9851 </p>
9852 !!end
9854 !! article
9855 אַ
9856 !! text
9857 Test for unicode normalization
9859 The page's name is U+05d0 U+05b7, with non-canonical form U+FB2E
9860 !! endarticle
9862 !! test
9863 (bug 19451) Links should refer to the normalized form.
9864 !! input
9865 [[&#xFB2E;]]
9866 [[&#x5d0;&#x5b7;]]
9867 [[&#x5d0;ַ]]
9868 [[א&#x5b7;]]
9869 [[אַ]]
9870 !! result
9871 <p><a href="/wiki/%D7%90%D6%B7" title="אַ">&#xfb2e;</a>
9872 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;&#x5b7;</a>
9873 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;ַ</a>
9874 <a href="/wiki/%D7%90%D6%B7" title="אַ">א&#x5b7;</a>
9875 <a href="/wiki/%D7%90%D6%B7" title="אַ">אַ</a>
9876 </p>
9877 !! end
9879 !! test
9880 Empty attribute crash test (bug 2067)
9881 !! input
9882 <font color="">foo</font>
9883 !! result
9884 <p><font color="">foo</font>
9885 </p>
9886 !! end
9888 !! test
9889 Empty attribute crash test single-quotes (bug 2067)
9890 !! input
9891 <font color=''>foo</font>
9892 !! result
9893 <p><font color="">foo</font>
9894 </p>
9895 !! end
9897 !! test
9898 Attribute test: equals, then nothing
9899 !! input
9900 <font color=>foo</font>
9901 !! result
9902 <p><font>foo</font>
9903 </p>
9904 !! end
9906 !! test
9907 Attribute test: unquoted value
9908 !! input
9909 <font color=x>foo</font>
9910 !! result
9911 <p><font color="x">foo</font>
9912 </p>
9913 !! end
9915 !! test
9916 Attribute test: unquoted but illegal value (hash)
9917 !! input
9918 <font color=#x>foo</font>
9919 !! result
9920 <p><font color="#x">foo</font>
9921 </p>
9922 !! end
9924 !! test
9925 Attribute test: no value
9926 !! input
9927 <font color>foo</font>
9928 !! result
9929 <p><font color="color">foo</font>
9930 </p>
9931 !! end
9933 !! test
9934 Bug 2095: link with three closing brackets
9935 !! input
9936 [[Main Page]]]
9937 !! result
9938 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>]
9939 </p>
9940 !! end
9942 !! test
9943 Bug 2095: link with pipe and three closing brackets
9944 !! input
9945 [[Main Page|link]]]
9946 !! result
9947 <p><a href="/wiki/Main_Page" title="Main Page">link</a>]
9948 </p>
9949 !! end
9951 !! test
9952 Bug 2095: link with pipe and three closing brackets, version 2
9953 !! input
9954 [[Main Page|[http://example.com/]]]
9955 !! result
9956 <p><a href="/wiki/Main_Page" title="Main Page">[http://example.com/]</a>
9957 </p>
9958 !! end
9962 ### Safety
9965 !! article
9966 Template:Dangerous attribute
9967 !! text
9968 " onmouseover="alert(document.cookie)
9969 !! endarticle
9971 !! article
9972 Template:Dangerous style attribute
9973 !! text
9974 border-size: expression(alert(document.cookie))
9975 !! endarticle
9977 !! article
9978 Template:Div style
9979 !! text
9980 <div style="float: right; {{{1}}}">Magic div</div>
9981 !! endarticle
9983 !! test
9984 Bug 2304: HTML attribute safety (safe template; regression bug 2309)
9985 !! input
9986 <div title="{{test}}"></div>
9987 !! result
9988 <div title="This is a test template"></div>
9990 !! end
9992 !! test
9993 Bug 2304: HTML attribute safety (dangerous template; 2309)
9994 !! input
9995 <div title="{{dangerous attribute}}"></div>
9996 !! result
9997 <div title=""></div>
9999 !! end
10001 !! test
10002 Bug 2304: HTML attribute safety (dangerous style template; 2309)
10003 !! input
10004 <div style="{{dangerous style attribute}}"></div>
10005 !! result
10006 <div style="/* insecure input */"></div>
10008 !! end
10010 !! test
10011 Bug 2304: HTML attribute safety (safe parameter; 2309)
10012 !! input
10013 {{div style|width: 200px}}
10014 !! result
10015 <div style="float: right; width: 200px">Magic div</div>
10017 !! end
10019 !! test
10020 Bug 2304: HTML attribute safety (unsafe parameter; 2309)
10021 !! input
10022 {{div style|width: expression(alert(document.cookie))}}
10023 !! result
10024 <div style="/* insecure input */">Magic div</div>
10026 !! end
10028 !! test
10029 Bug 2304: HTML attribute safety (unsafe breakout parameter; 2309)
10030 !! input
10031 {{div style|"><script>alert(document.cookie)</script>}}
10032 !! result
10033 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
10035 !! end
10037 !! test
10038 Bug 2304: HTML attribute safety (unsafe breakout parameter 2; 2309)
10039 !! input
10040 {{div style|" ><script>alert(document.cookie)</script>}}
10041 !! result
10042 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
10044 !! end
10046 !! test
10047 Bug 2304: HTML attribute safety (link)
10048 !! input
10049 <div title="[[Main Page]]"></div>
10050 !! result
10051 <div title="&#91;&#91;Main Page]]"></div>
10053 !! end
10055 !! test
10056 Bug 2304: HTML attribute safety (italics)
10057 !! input
10058 <div title="''foobar''"></div>
10059 !! result
10060 <div title="&#39;&#39;foobar&#39;&#39;"></div>
10062 !! end
10064 !! test
10065 Bug 2304: HTML attribute safety (bold)
10066 !! input
10067 <div title="'''foobar'''"></div>
10068 !! result
10069 <div title="&#39;&#39;&#39;foobar&#39;&#39;&#39;"></div>
10071 !! end
10074 !! test
10075 Bug 2304: HTML attribute safety (ISBN)
10076 !! input
10077 <div title="ISBN 1234567890"></div>
10078 !! result
10079 <div title="&#73;SBN 1234567890"></div>
10081 !! end
10083 !! test
10084 Bug 2304: HTML attribute safety (RFC)
10085 !! input
10086 <div title="RFC 1234"></div>
10087 !! result
10088 <div title="&#82;FC 1234"></div>
10090 !! end
10092 !! test
10093 Bug 2304: HTML attribute safety (PMID)
10094 !! input
10095 <div title="PMID 1234567890"></div>
10096 !! result
10097 <div title="&#80;MID 1234567890"></div>
10099 !! end
10101 !! test
10102 Bug 2304: HTML attribute safety (web link)
10103 !! input
10104 <div title="http://example.com/"></div>
10105 !! result
10106 <div title="http&#58;//example.com/"></div>
10108 !! end
10110 !! test
10111 Bug 2304: HTML attribute safety (named web link)
10112 !! input
10113 <div title="[http://example.com/ link]"></div>
10114 !! result
10115 <div title="&#91;http&#58;//example.com/ link]"></div>
10117 !! end
10119 !! test
10120 Bug 3244: HTML attribute safety (extension; safe)
10121 !! input
10122 <div style="<nowiki>background:blue</nowiki>"></div>
10123 !! result
10124 <div style="background:blue"></div>
10126 !! end
10128 !! test
10129 Bug 3244: HTML attribute safety (extension; unsafe)
10130 !! input
10131 <div style="<nowiki>border-left:expression(alert(document.cookie))</nowiki>"></div>
10132 !! result
10133 <div style="/* insecure input */"></div>
10135 !! end
10137 # More MSIE fun discovered by Tom Gilder
10139 !! test
10140 MSIE CSS safety test: spurious slash
10141 !! input
10142 <div style="background-image:u\rl(javascript:alert('boo'))">evil</div>
10143 !! result
10144 <div style="/* insecure input */">evil</div>
10146 !! end
10148 !! test
10149 MSIE CSS safety test: hex code
10150 !! input
10151 <div style="background-image:u\72l(javascript:alert('boo'))">evil</div>
10152 !! result
10153 <div style="/* insecure input */">evil</div>
10155 !! end
10157 !! test
10158 MSIE CSS safety test: comment in url
10159 !! input
10160 <div style="background-image:u/**/rl(javascript:alert('boo'))">evil</div>
10161 !! result
10162 <div style="background-image:u rl(javascript:alert(&#39;boo&#39;))">evil</div>
10164 !! end
10166 !! test
10167 MSIE CSS safety test: comment in expression
10168 !! input
10169 <div style="background-image:expres/**/sion(alert('boo4'))">evil4</div>
10170 !! result
10171 <div style="background-image:expres sion(alert(&#39;boo4&#39;))">evil4</div>
10173 !! end
10176 !! test
10177 Table attribute legitimate extension
10178 !! input
10180 !+ style="<nowiki>color:blue</nowiki>"| status
10182 !! result
10183 <table>
10184 <tr>
10185 <th style="color:blue"> status
10186 </th></tr></table>
10188 !!end
10190 !! test
10191 Table attribute safety
10192 !! input
10194 !+ style="<nowiki>border-width:expression(0+alert(document.cookie))</nowiki>"| status
10196 !! result
10197 <table>
10198 <tr>
10199 <th style="/* insecure input */"> status
10200 </th></tr></table>
10202 !! end
10204 !! test
10205 CSS line continuation 1
10206 !! input
10207 <div style="background-image: u\&#10;rl(test.jpg);"></div>
10208 !! result
10209 <div style="/* insecure input */"></div>
10211 !! end
10213 !! test
10214 CSS line continuation 2
10215 !! input
10216 <div style="background-image: u\&#13;rl(test.jpg); "></div>
10217 !! result
10218 <div style="/* insecure input */"></div>
10220 !! end
10222 !! article
10223 Template:Identity
10224 !! text
10225 {{{1}}}
10226 !! endarticle
10228 !! test
10229 Expansion of multi-line templates in attribute values (bug 6255)
10230 !! input
10231 <div style="background: {{identity|#00FF00}}">-</div>
10232 !! result
10233 <div style="background: #00FF00">-</div>
10235 !! end
10238 !! test
10239 Expansion of multi-line templates in attribute values (bug 6255 sanity check)
10240 !! input
10241 <div style="background: 
10242 #00FF00">-</div>
10243 !! result
10244 <div style="background: #00FF00">-</div>
10246 !! end
10248 !! test
10249 Expansion of multi-line templates in attribute values (bug 6255 sanity check 2)
10250 !! input
10251 <div style="background: &#10;#00FF00">-</div>
10252 !! result
10253 <div style="background: &#10;#00FF00">-</div>
10255 !! end
10258 ### Parser hooks (see maintenance/parserTestsParserHook.php for the <tag> extension)
10260 !! test
10261 Parser hook: empty input
10262 !! input
10263 <tag></tag>
10264 !! result
10265 <pre>
10267 array (
10269 </pre>
10271 !! end
10273 !! test
10274 Parser hook: empty input using terminated empty elements
10275 !! input
10276 <tag/>
10277 !! result
10278 <pre>
10279 NULL
10280 array (
10282 </pre>
10284 !! end
10286 !! test
10287 Parser hook: empty input using terminated empty elements (space before)
10288 !! input
10289 <tag />
10290 !! result
10291 <pre>
10292 NULL
10293 array (
10295 </pre>
10297 !! end
10299 !! test
10300 Parser hook: basic input
10301 !! input
10302 <tag>input</tag>
10303 !! result
10304 <pre>
10305 'input'
10306 array (
10308 </pre>
10310 !! end
10313 !! test
10314 Parser hook: case insensitive
10315 !! input
10316 <TAG>input</TAG>
10317 !! result
10318 <pre>
10319 'input'
10320 array (
10322 </pre>
10324 !! end
10327 !! test
10328 Parser hook: case insensitive, redux
10329 !! input
10330 <TaG>input</TAg>
10331 !! result
10332 <pre>
10333 'input'
10334 array (
10336 </pre>
10338 !! end
10340 !! test
10341 Parser hook: nested tags
10342 !! options
10343 noxml
10344 !! input
10345 <tag><tag></tag></tag>
10346 !! result
10347 <pre>
10348 '<tag>'
10349 array (
10351 </pre>&lt;/tag&gt;
10353 !! end
10355 !! test
10356 Parser hook: basic arguments
10357 !! input
10358 <tag width=200 height = "100" depth = '50' square></tag>
10359 !! result
10360 <pre>
10362 array (
10363   'width' => '200',
10364   'height' => '100',
10365   'depth' => '50',
10366   'square' => 'square',
10368 </pre>
10370 !! end
10372 !! test
10373 Parser hook: argument containing a forward slash (bug 5344)
10374 !! input
10375 <tag filename='/tmp/bla'></tag>
10376 !! result
10377 <pre>
10379 array (
10380   'filename' => '/tmp/bla',
10382 </pre>
10384 !! end
10386 !! test
10387 Parser hook: empty input using terminated empty elements (bug 2374)
10388 !! input
10389 <tag foo=bar/>text
10390 !! result
10391 <pre>
10392 NULL
10393 array (
10394   'foo' => 'bar',
10396 </pre>text
10398 !! end
10400 # </tag> should be output literally since there is no matching tag that begins it
10401 !! test
10402 Parser hook: basic arguments using terminated empty elements (bug 2374)
10403 !! input
10404 <tag width=200 height = "100" depth = '50' square/>
10405 other stuff
10406 </tag>
10407 !! result
10408 <pre>
10409 NULL
10410 array (
10411   'width' => '200',
10412   'height' => '100',
10413   'depth' => '50',
10414   'square' => 'square',
10416 </pre>
10417 <p>other stuff
10418 &lt;/tag&gt;
10419 </p>
10420 !! end
10423 ### (see maintenance/parserTestsStaticParserHook.php for the <statictag> extension)
10426 !! test
10427 Parser hook: static parser hook not inside a comment
10428 !! input
10429 <statictag>hello, world</statictag>
10430 <statictag action=flush/>
10431 !! result
10432 <p>hello, world
10433 </p>
10434 !! end
10437 !! test
10438 Parser hook: static parser hook inside a comment
10439 !! input
10440 <!-- <statictag>hello, world</statictag> -->
10441 <statictag action=flush/>
10442 !! result
10443 <p><br />
10444 </p>
10445 !! end
10447 # Nested template calls; this case was broken by Parser.php rev 1.506,
10448 # since reverted.
10450 !! article
10451 Template:One-parameter
10452 !! text
10453 (My parameter is: {{{1}}})
10454 !! endarticle
10456 !! article
10457 Template:Map-one-parameter
10458 !! text
10459 {{{{{1}}}|{{{2}}}}}
10460 !! endarticle
10462 !! test
10463 Nested template calls
10464 !! input
10465 {{Map-one-parameter|One-parameter|param}}
10466 !! result
10467 <p>(My parameter is: param)
10468 </p>
10469 !! end
10473 ### Sanitizer
10475 !! test
10476 Sanitizer: Closing of open tags
10477 !! input
10478 <s></s><table></table>
10479 !! result
10480 <s></s><table></table>
10482 !! end
10484 !! test
10485 Sanitizer: Closing of open but not closed tags
10486 !! input
10487 <s>foo
10488 !! result
10489 <p><s>foo</s>
10490 </p>
10491 !! end
10493 !! test
10494 Sanitizer: Closing of closed but not open tags
10495 !! input
10496 </s>
10497 !! result
10498 <p>&lt;/s&gt;
10499 </p>
10500 !! end
10502 !! test
10503 Sanitizer: Closing of closed but not open table tags
10504 !! input
10505 Table not started</td></tr></table>
10506 !! result
10507 <p>Table not started&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
10508 </p>
10509 !! end
10511 !! test
10512 Sanitizer: Escaping of spaces, multibyte characters, colons & other stuff in id=""
10513 !! input
10514 <span id="æ: v">byte</span>[[#æ: v|backlink]]
10515 !! result
10516 <p><span id=".C3.A6:_v">byte</span><a href="#.C3.A6:_v">backlink</a>
10517 </p>
10518 !! end
10520 !! test
10521 Sanitizer: Validating the contents of the id attribute (bug 4515)
10522 !! options
10523 disabled
10524 !! input
10525 <br id=9 />
10526 !! result
10527 Something, but definitely not <br id="9" />...
10528 !! end
10530 !! test
10531 Sanitizer: Validating id attribute uniqueness (bug 4515, bug 6301)
10532 !! options
10533 disabled
10534 !! input
10535 <br id="foo" /><br id="foo" />
10536 !! result
10537 Something need to be done. foo-2 ? 
10538 !! end
10540 !! test
10541 Sanitizer: Validating that <meta> and <link> work, but only for Microdata
10542 !! input
10543 <div itemscope>
10544         <meta itemprop="hello" content="world">
10545         <meta http-equiv="refresh" content="5">
10546         <meta itemprop="hello" http-equiv="refresh" content="5">
10547         <link itemprop="hello" href="{{SERVER}}">
10548         <link rel="stylesheet" href="{{SERVER}}">
10549         <link rel="stylesheet" itemprop="hello" href="{{SERVER}}">
10550 </div>
10551 !! result
10552 <div itemscope="itemscope">
10553 <p>     <meta itemprop="hello" content="world" />
10554         &lt;meta http-equiv="refresh" content="5"&gt;
10555         <meta itemprop="hello" content="5" />
10556 </p>
10557         <link itemprop="hello" href="http&#58;//example.org" />
10558         &lt;link rel="stylesheet" href="<a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>"&gt;
10559         <link itemprop="hello" href="http&#58;//example.org" />
10560 </div>
10562 !! end
10564 !! test
10565 Language converter: output gets cut off unexpectedly (bug 5757)
10566 !! options
10567 language=zh
10568 !! input
10569 this bit is safe: }-
10571 but if we add a conversion instance: -{zh-cn:xxx;zh-tw:yyy}-
10573 then we get cut off here: }-
10575 all additional text is vanished
10576 !! result
10577 <p>this bit is safe: }-
10578 </p><p>but if we add a conversion instance: xxx
10579 </p><p>then we get cut off here: }-
10580 </p><p>all additional text is vanished
10581 </p>
10582 !! end
10584 !! test
10585 Self closed html pairs (bug 5487)
10586 !! options
10587 !! input
10588 <center><font id="bug" />Centered text</center>
10589 <div><font id="bug2" />In div text</div>
10590 !! result
10591 <center>&lt;font id="bug" /&gt;Centered text</center>
10592 <div>&lt;font id="bug2" /&gt;In div text</div>
10594 !! end
10600 !! test
10601 Punctuation: nbsp before exclamation
10602 !! input
10603 C'est grave !
10604 !! result
10605 <p>C'est grave&#160;!
10606 </p>
10607 !! end
10609 !! test
10610 Punctuation: CSS !important (bug 11874)
10611 !! input
10612 <div style="width:50% !important">important</div>
10613 !! result
10614 <div style="width:50% !important">important</div>
10616 !!end
10618 !! test
10619 Punctuation: CSS ! important (bug 11874; with space after)
10620 !! input
10621 <div style="width:50% ! important">important</div>
10622 !! result
10623 <div style="width:50% ! important">important</div>
10625 !!end
10628 !! test
10629 HTML bullet list, closed tags (bug 5497)
10630 !! input
10631 <ul>
10632 <li>One</li>
10633 <li>Two</li>
10634 </ul>
10635 !! result
10636 <ul>
10637 <li>One</li>
10638 <li>Two</li>
10639 </ul>
10641 !! end
10643 !! test
10644 HTML bullet list, unclosed tags (bug 5497)
10645 !! options
10646 disabled
10647 !! input
10648 <ul>
10649 <li>One
10650 <li>Two
10651 </ul>
10652 !! result
10653 <ul>
10654 <li>One
10655 </li><li>Two
10656 </li></ul>
10658 !! end
10660 !! test
10661 HTML ordered list, closed tags (bug 5497)
10662 !! input
10663 <ol>
10664 <li>One</li>
10665 <li>Two</li>
10666 </ol>
10667 !! result
10668 <ol>
10669 <li>One</li>
10670 <li>Two</li>
10671 </ol>
10673 !! end
10675 !! test
10676 HTML ordered list, unclosed tags (bug 5497)
10677 !! options
10678 disabled
10679 !! input
10680 <ol>
10681 <li>One
10682 <li>Two
10683 </ol>
10684 !! result
10685 <ol>
10686 <li>One
10687 </li><li>Two
10688 </li></ol>
10690 !! end
10692 !! test
10693 HTML nested bullet list, closed tags (bug 5497)
10694 !! input
10695 <ul>
10696 <li>One</li>
10697 <li>Two:
10698 <ul>
10699 <li>Sub-one</li>
10700 <li>Sub-two</li>
10701 </ul>
10702 </li>
10703 </ul>
10704 !! result
10705 <ul>
10706 <li>One</li>
10707 <li>Two:
10708 <ul>
10709 <li>Sub-one</li>
10710 <li>Sub-two</li>
10711 </ul>
10712 </li>
10713 </ul>
10715 !! end
10717 !! test
10718 HTML nested bullet list, open tags (bug 5497)
10719 !! options
10720 disabled
10721 !! input
10722 <ul>
10723 <li>One
10724 <li>Two:
10725 <ul>
10726 <li>Sub-one
10727 <li>Sub-two
10728 </ul>
10729 </ul>
10730 !! result
10731 <ul>
10732 <li>One
10733 </li><li>Two:
10734 <ul>
10735 <li>Sub-one
10736 </li><li>Sub-two
10737 </li></ul>
10738 </li></ul>
10740 !! end
10742 !! test
10743 HTML nested ordered list, closed tags (bug 5497)
10744 !! input
10745 <ol>
10746 <li>One</li>
10747 <li>Two:
10748 <ol>
10749 <li>Sub-one</li>
10750 <li>Sub-two</li>
10751 </ol>
10752 </li>
10753 </ol>
10754 !! result
10755 <ol>
10756 <li>One</li>
10757 <li>Two:
10758 <ol>
10759 <li>Sub-one</li>
10760 <li>Sub-two</li>
10761 </ol>
10762 </li>
10763 </ol>
10765 !! end
10767 !! test
10768 HTML nested ordered list, open tags (bug 5497)
10769 !! options
10770 disabled
10771 !! input
10772 <ol>
10773 <li>One
10774 <li>Two:
10775 <ol>
10776 <li>Sub-one
10777 <li>Sub-two
10778 </ol>
10779 </ol>
10780 !! result
10781 <ol>
10782 <li>One
10783 </li><li>Two:
10784 <ol>
10785 <li>Sub-one
10786 </li><li>Sub-two
10787 </li></ol>
10788 </li></ol>
10790 !! end
10792 !! test
10793 HTML ordered list item with parameters oddity
10794 !! input
10795 <ol><li id="fragment">One</li></ol>
10796 !! result
10797 <ol><li id="fragment">One</li></ol>
10799 !! end
10801 !!test
10802 bug 5918: autonumbering
10803 !! input
10804 [http://first/] [http://second] [ftp://ftp]
10806 ftp://inlineftp
10808 [mailto:enclosed@mail.tld With target]
10810 [mailto:enclosed@mail.tld]
10812 mailto:inline@mail.tld
10813 !! result
10814 <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>
10815 </p><p><a rel="nofollow" class="external free" href="ftp://inlineftp">ftp://inlineftp</a>
10816 </p><p><a rel="nofollow" class="external text" href="mailto:enclosed@mail.tld">With target</a>
10817 </p><p><a rel="nofollow" class="external autonumber" href="mailto:enclosed@mail.tld">[4]</a>
10818 </p><p><a rel="nofollow" class="external free" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a>
10819 </p>
10820 !! end
10824 # Security and HTML correctness
10825 # From Nick Jenkins' fuzz testing
10828 !! test
10829 Fuzz testing: Parser13
10830 !! input
10831 {| 
10832 | http://a|
10833 !! result
10834 <table>
10835 <tr>
10836 <td>
10837 </td>
10838 </tr>
10839 </table>
10841 !! end
10843 !! test
10844 Fuzz testing: Parser14
10845 !! input
10846 == onmouseover= ==
10847 http://__TOC__
10848 !! result
10849 <h2><span class="mw-headline" id="onmouseover.3D">onmouseover=</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: onmouseover=">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
10850 http://<div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
10851 <ul>
10852 <li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
10853 </ul>
10854 </div>
10856 !! end
10858 !! test
10859 Fuzz testing: Parser14-table
10860 !! input
10861 ==a==
10862 {| STYLE=__TOC__
10863 !! result
10864 <h2><span class="mw-headline" id="a">a</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: a">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
10865 <table style="&#95;_TOC&#95;_">
10866 <tr><td></td></tr>
10867 </table>
10869 !! end
10871 # Known to produce bogus xml (extra </td>)
10872 !! test
10873 Fuzz testing: Parser16
10874 !! options
10875 noxml
10876 !! input
10878 !https://||||||
10879 !! result
10880 <table>
10881 <tr>
10882 <th>https://</th>
10883 <th></th>
10884 <th></th>
10885 <th>
10886 </td>
10887 </tr>
10888 </table>
10890 !! end
10892 !! test
10893 Fuzz testing: Parser21
10894 !! input
10896 ! irc://{{ftp://a" onmouseover="alert('hello world');"
10898 !! result
10899 <table>
10900 <tr>
10901 <th> <a rel="nofollow" class="external free" href="irc://{{ftp://a">irc://{{ftp://a</a>" onmouseover="alert('hello world');"
10902 </th>
10903 <td>
10904 </td>
10905 </tr>
10906 </table>
10908 !! end
10910 !! test
10911 Fuzz testing: Parser22
10912 !! input
10913 http://===r:::https://b
10916 !!result
10917 <p><a rel="nofollow" class="external free" href="http://===r:::https://b">http://===r:::https://b</a>
10918 </p>
10919 <table>
10920 <tr><td></td></tr>
10921 </table>
10923 !! end
10925 # Known to produce bad XML for now
10926 !! test
10927 Fuzz testing: Parser24
10928 !! options
10929 noxml
10930 !! input
10932 {{{|
10933 <u CLASS=
10934 | {{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx--><noinclude>}}}} >
10935 <br style="onmouseover='alert(document.cookie);' " />
10937 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
10939 !! result
10940 <table>
10941 {{{|
10942 <u class="&#124;">}}}} &gt;
10943 <br style="onmouseover=&#39;alert(document.cookie);&#39;" />
10945 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
10946 <tr>
10947 <td></u>
10948 </td>
10949 </tr>
10950 </table>
10952 !! end
10954 # Note: the current result listed for this is not what the original one was,
10955 # but the original bug was JavaScript injection, which is fixed in any case.
10956 # It's not clear that the original result listed was any more correct than the
10957 # current one.  Original result:
10958 # <p>{{{| 
10959 # </p>
10960 # <li class="&#124;&#124;">
10961 # }}}blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
10962 !!test
10963 Fuzz testing: Parser25 (bug 6055)
10964 !! input
10967 <LI CLASS=||
10969 }}}blah" onmouseover="alert('hello world');" align="left"'''MOVE MOUSE CURSOR OVER HERE
10970 !! result
10971 <p>&lt;LI CLASS=blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
10972 </p>
10973 !! end
10975 !!test
10976 Fuzz testing: URL adjacent extension (with space, clean)
10977 !! options
10978 !! input
10979 http://example.com <nowiki>junk</nowiki>
10980 !! result
10981 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a> junk
10982 </p>
10983 !!end
10985 !!test
10986 Fuzz testing: URL adjacent extension (no space, dirty; nowiki)
10987 !! options
10988 !! input
10989 http://example.com<nowiki>junk</nowiki>
10990 !! result
10991 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>junk
10992 </p>
10993 !!end
10995 !!test
10996 Fuzz testing: URL adjacent extension (no space, dirty; pre)
10997 !! options
10998 !! input
10999 http://example.com<pre>junk</pre>
11000 !! result
11001 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a><pre>junk</pre>
11003 !!end
11005 !!test
11006 Fuzz testing: image with bogus manual thumbnail
11007 !!input
11008 [[Image:foobar.jpg|thumbnail= ]]
11009 !!result
11010 <div class="thumb tright"><div class="thumbinner" style="width:182px;">Error creating thumbnail:   <div class="thumbcaption"></div></div></div>
11012 !!end
11014 !! test
11015 Fuzz testing: encoded newline in generated HTML replacements (bug 6577)
11016 !! input
11017 <pre dir="&#10;"></pre>
11018 !! result
11019 <pre dir="&#10;"></pre>
11021 !! end
11023 !! test
11024 Parsing optional HTML elements (Bug 6171)
11025 !! options
11026 !! input
11027 <table>
11028   <tr>
11029     <td> Some tabular data</td>
11030     <td> More tabular data ...
11031     <td> And yet som tabular data</td>
11032   </tr>
11033 </table>
11034 !! result
11035 <table>
11036   <tr>
11037     <td> Some tabular data</td>
11038     <td> More tabular data ...
11039     </td><td> And yet som tabular data</td>
11040   </tr>
11041 </table>
11043 !! end
11045 !! test
11046 Correct handling of <td>, <tr> (Bug 6171)
11047 !! options
11048 !! input
11049 <table>
11050   <tr>
11051     <td> Some tabular data</td>
11052     <td> More tabular data ...</td>
11053     <td> And yet som tabular data</td>
11054   </tr>
11055 </table>
11056 !! result
11057 <table>
11058   <tr>
11059     <td> Some tabular data</td>
11060     <td> More tabular data ...</td>
11061     <td> And yet som tabular data</td>
11062   </tr>
11063 </table>
11065 !! end
11068 !! test
11069 Parsing crashing regression (fr:JavaScript)
11070 !! input
11071 </body></x>
11072 !! result
11073 <p>&lt;/body&gt;&lt;/x&gt;
11074 </p>
11075 !! end
11077 !! test
11078 Inline wiki vs wiki block nesting
11079 !! input
11080 '''Bold paragraph
11082 New wiki paragraph
11083 !! result
11084 <p><b>Bold paragraph</b>
11085 </p><p>New wiki paragraph
11086 </p>
11087 !! end
11089 !! test
11090 Inline HTML vs wiki block nesting
11091 !! options
11092 disabled
11093 !! input
11094 <b>Bold paragraph
11096 New wiki paragraph
11097 !! result
11098 <p><b>Bold paragraph</b>
11099 </p><p>New wiki paragraph
11100 </p>
11101 !! end
11103 # Original result was this:
11104 # <p><b>bold</b><b>bold<i>bolditalics</i></b>
11105 # </p>
11106 # While that might be marginally more intuitive, maybe, the six-apostrophe
11107 # construct is clearly pathological and the result stated here (which is what
11108 # the parser actually does) is about as reasonable as anything.
11109 !!test
11110 Mixing markup for italics and bold
11111 !! options
11112 !! input
11113 '''bold''''''bold''bolditalics'''''
11114 !! result
11115 <p>'<i>bold'</i><b>bold<i>bolditalics</i></b>
11116 </p>
11117 !! end
11120 !! article
11121 Xyzzyx
11122 !! text
11123 Article for special page transclusion test
11124 !! endarticle
11126 !! test
11127 Special page transclusion
11128 !! options
11129 !! input
11130 {{Special:Prefixindex/Xyzzyx}}
11131 !! result
11132 <table id="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
11134 !! end
11136 !! test
11137 Special page transclusion twice (bug 5021)
11138 !! options
11139 !! input
11140 {{Special:Prefixindex/Xyzzyx}}
11141 {{Special:Prefixindex/Xyzzyx}}
11142 !! result
11143 <table id="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
11144 <table id="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
11146 !! end
11148 !! test
11149 Transclusion of default MediaWiki message
11150 !! input
11151 {{MediaWiki:Mainpage}}
11152 !!result
11153 <p>Main Page
11154 </p>
11155 !! end
11157 !! test
11158 Transclusion of nonexistent MediaWiki message
11159 !! input
11160 {{MediaWiki:Mainpagexxx}}
11161 !!result
11162 <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>
11163 </p>
11164 !! end
11166 !! test
11167 Transclusion of MediaWiki message with underscore
11168 !! input
11169 {{MediaWiki:history_short}}
11170 !! result
11171 <p>History
11172 </p>
11173 !! end
11175 !! test
11176 Transclusion of MediaWiki message with space
11177 !! input
11178 {{MediaWiki:history short}}
11179 !! result
11180 <p>History
11181 </p>
11182 !! end
11184 !! test
11185 Invalid header with following text
11186 !! input
11187 = x = y
11188 !! result
11189 <p>= x = y
11190 </p>
11191 !! end
11194 !! test
11195 Section extraction test (section 0)
11196 !! options
11197 section=0
11198 !! input
11199 start
11200 ==a==
11201 ===aa===
11202 ====aaa====
11203 ==b==
11204 ===ba===
11205 ===bb===
11206 ====bba====
11207 ===bc===
11208 ==c==
11209 ===ca===
11210 !! result
11211 start
11212 !! end
11214 !! test
11215 Section extraction test (section 1)
11216 !! options
11217 section=1
11218 !! input
11219 start
11220 ==a==
11221 ===aa===
11222 ====aaa====
11223 ==b==
11224 ===ba===
11225 ===bb===
11226 ====bba====
11227 ===bc===
11228 ==c==
11229 ===ca===
11230 !! result
11231 ==a==
11232 ===aa===
11233 ====aaa====
11234 !! end
11236 !! test
11237 Section extraction test (section 2)
11238 !! options
11239 section=2
11240 !! input
11241 start
11242 ==a==
11243 ===aa===
11244 ====aaa====
11245 ==b==
11246 ===ba===
11247 ===bb===
11248 ====bba====
11249 ===bc===
11250 ==c==
11251 ===ca===
11252 !! result
11253 ===aa===
11254 ====aaa====
11255 !! end
11257 !! test
11258 Section extraction test (section 3)
11259 !! options
11260 section=3
11261 !! input
11262 start
11263 ==a==
11264 ===aa===
11265 ====aaa====
11266 ==b==
11267 ===ba===
11268 ===bb===
11269 ====bba====
11270 ===bc===
11271 ==c==
11272 ===ca===
11273 !! result
11274 ====aaa====
11275 !! end
11277 !! test
11278 Section extraction test (section 4)
11279 !! options
11280 section=4
11281 !! input
11282 start
11283 ==a==
11284 ===aa===
11285 ====aaa====
11286 ==b==
11287 ===ba===
11288 ===bb===
11289 ====bba====
11290 ===bc===
11291 ==c==
11292 ===ca===
11293 !! result
11294 ==b==
11295 ===ba===
11296 ===bb===
11297 ====bba====
11298 ===bc===
11299 !! end
11301 !! test
11302 Section extraction test (section 5)
11303 !! options
11304 section=5
11305 !! input
11306 start
11307 ==a==
11308 ===aa===
11309 ====aaa====
11310 ==b==
11311 ===ba===
11312 ===bb===
11313 ====bba====
11314 ===bc===
11315 ==c==
11316 ===ca===
11317 !! result
11318 ===ba===
11319 !! end
11321 !! test
11322 Section extraction test (section 6)
11323 !! options
11324 section=6
11325 !! input
11326 start
11327 ==a==
11328 ===aa===
11329 ====aaa====
11330 ==b==
11331 ===ba===
11332 ===bb===
11333 ====bba====
11334 ===bc===
11335 ==c==
11336 ===ca===
11337 !! result
11338 ===bb===
11339 ====bba====
11340 !! end
11342 !! test
11343 Section extraction test (section 7)
11344 !! options
11345 section=7
11346 !! input
11347 start
11348 ==a==
11349 ===aa===
11350 ====aaa====
11351 ==b==
11352 ===ba===
11353 ===bb===
11354 ====bba====
11355 ===bc===
11356 ==c==
11357 ===ca===
11358 !! result
11359 ====bba====
11360 !! end
11362 !! test
11363 Section extraction test (section 8)
11364 !! options
11365 section=8
11366 !! input
11367 start
11368 ==a==
11369 ===aa===
11370 ====aaa====
11371 ==b==
11372 ===ba===
11373 ===bb===
11374 ====bba====
11375 ===bc===
11376 ==c==
11377 ===ca===
11378 !! result
11379 ===bc===
11380 !! end
11382 !! test
11383 Section extraction test (section 9)
11384 !! options
11385 section=9
11386 !! input
11387 start
11388 ==a==
11389 ===aa===
11390 ====aaa====
11391 ==b==
11392 ===ba===
11393 ===bb===
11394 ====bba====
11395 ===bc===
11396 ==c==
11397 ===ca===
11398 !! result
11399 ==c==
11400 ===ca===
11401 !! end
11403 !! test
11404 Section extraction test (section 10)
11405 !! options
11406 section=10
11407 !! input
11408 start
11409 ==a==
11410 ===aa===
11411 ====aaa====
11412 ==b==
11413 ===ba===
11414 ===bb===
11415 ====bba====
11416 ===bc===
11417 ==c==
11418 ===ca===
11419 !! result
11420 ===ca===
11421 !! end
11423 !! test
11424 Section extraction test (nonexistent section 11)
11425 !! options
11426 section=11
11427 !! input
11428 start
11429 ==a==
11430 ===aa===
11431 ====aaa====
11432 ==b==
11433 ===ba===
11434 ===bb===
11435 ====bba====
11436 ===bc===
11437 ==c==
11438 ===ca===
11439 !! result
11440 !! end
11442 !! test
11443 Section extraction test with bogus heading (section 1)
11444 !! options
11445 section=1
11446 !! input
11447 ==a==
11448 ==bogus== not a legal section
11449 ==b==
11450 !! result
11451 ==a==
11452 ==bogus== not a legal section
11453 !! end
11455 !! test
11456 Section extraction test with bogus heading (section 2)
11457 !! options
11458 section=2
11459 !! input
11460 ==a==
11461 ==bogus== not a legal section
11462 ==b==
11463 !! result
11464 ==b==
11465 !! end
11467 !! test
11468 Section extraction test with comment after heading (section 1)
11469 !! options
11470 section=1
11471 !! input
11472 ==a==
11473 ==b== <!-- -->
11474 ==c==
11475 !! result
11476 ==a==
11477 !! end
11479 !! test
11480 Section extraction test with comment after heading (section 2)
11481 !! options
11482 section=2
11483 !! input
11484 ==a==
11485 ==b== <!-- -->
11486 ==c==
11487 !! result
11488 ==b== <!-- -->
11489 !! end
11491 !! test
11492 Section extraction test with bogus <nowiki> heading (section 1)
11493 !! options
11494 section=1
11495 !! input
11496 ==a==
11497 ==bogus== <nowiki>not a legal section</nowiki>
11498 ==b==
11499 !! result
11500 ==a==
11501 ==bogus== <nowiki>not a legal section</nowiki>
11502 !! end
11504 !! test
11505 Section extraction test with bogus <nowiki> heading (section 2)
11506 !! options
11507 section=2
11508 !! input
11509 ==a==
11510 ==bogus== <nowiki>not a legal section</nowiki>
11511 ==b==
11512 !! result
11513 ==b==
11514 !! end
11517 # Formerly testing for bug 2587, now resolved by the use of unmarked sections
11518 # instead of respecting commented sections
11519 !! test
11520 Section extraction prefixed by comment (section 1)
11521 !! options
11522 section=1
11523 !! input
11524 <!-- -->==sec1==
11525 ==sec2==
11526 !!result
11527 ==sec2==
11528 !!end
11530 !! test
11531 Section extraction prefixed by comment (section 2)
11532 !! options
11533 section=2
11534 !! input
11535 <!-- -->==sec1==
11536 ==sec2==
11537 !!result
11539 !!end
11542 # Formerly testing for bug 2607, now resolved by the use of unmarked sections
11543 # instead of respecting HTML-style headings
11544 !! test
11545 Section extraction, mixed wiki and html (section 1)
11546 !! options
11547 section=1
11548 !! input
11549 <h2>unmarked</h2>
11550 unmarked
11551 ==1==
11553 ==2==
11555 !! result
11556 ==1==
11558 !! end
11560 !! test
11561 Section extraction, mixed wiki and html (section 2)
11562 !! options
11563 section=2
11564 !! input
11565 <h2>unmarked</h2>
11566 unmarked
11567 ==1==
11569 ==2==
11571 !! result
11572 ==2==
11574 !! end
11577 # Formerly testing for bug 3342
11578 !! test
11579 Section extraction, heading surrounded by <noinclude>
11580 !! options
11581 section=1
11582 !! input
11583 <noinclude>==unmarked==</noinclude>
11584 ==marked==
11585 !! result
11586 ==marked==
11587 !!end
11589 # Test behavior of bug 19910
11590 !! test
11591 Sectiion with all-equals
11592 !! options
11593 section=2
11594 !! input
11595 === 
11596 The line above must have a trailing space
11597 === <!--
11598 --> <!-- -->
11599 But just in case it doesn't...
11600 !! result
11601 === <!--
11602 --> <!-- -->
11603 But just in case it doesn't...
11604 !! end
11606 !! test
11607 Section replacement test (section 0)
11608 !! options
11609 replace=0,"xxx"
11610 !! input
11611 start
11612 ==a==
11613 ===aa===
11614 ====aaa====
11615 ==b==
11616 ===ba===
11617 ===bb===
11618 ====bba====
11619 ===bc===
11620 ==c==
11621 ===ca===
11622 !! result
11625 ==a==
11626 ===aa===
11627 ====aaa====
11628 ==b==
11629 ===ba===
11630 ===bb===
11631 ====bba====
11632 ===bc===
11633 ==c==
11634 ===ca===
11635 !! end
11637 !! test
11638 Section replacement test (section 1)
11639 !! options
11640 replace=1,"xxx"
11641 !! input
11642 start
11643 ==a==
11644 ===aa===
11645 ====aaa====
11646 ==b==
11647 ===ba===
11648 ===bb===
11649 ====bba====
11650 ===bc===
11651 ==c==
11652 ===ca===
11653 !! result
11654 start
11657 ==b==
11658 ===ba===
11659 ===bb===
11660 ====bba====
11661 ===bc===
11662 ==c==
11663 ===ca===
11664 !! end
11666 !! test
11667 Section replacement test (section 2)
11668 !! options
11669 replace=2,"xxx"
11670 !! input
11671 start
11672 ==a==
11673 ===aa===
11674 ====aaa====
11675 ==b==
11676 ===ba===
11677 ===bb===
11678 ====bba====
11679 ===bc===
11680 ==c==
11681 ===ca===
11682 !! result
11683 start
11684 ==a==
11687 ==b==
11688 ===ba===
11689 ===bb===
11690 ====bba====
11691 ===bc===
11692 ==c==
11693 ===ca===
11694 !! end
11696 !! test
11697 Section replacement test (section 3)
11698 !! options
11699 replace=3,"xxx"
11700 !! input
11701 start
11702 ==a==
11703 ===aa===
11704 ====aaa====
11705 ==b==
11706 ===ba===
11707 ===bb===
11708 ====bba====
11709 ===bc===
11710 ==c==
11711 ===ca===
11712 !! result
11713 start
11714 ==a==
11715 ===aa===
11718 ==b==
11719 ===ba===
11720 ===bb===
11721 ====bba====
11722 ===bc===
11723 ==c==
11724 ===ca===
11725 !! end
11727 !! test
11728 Section replacement test (section 4)
11729 !! options
11730 replace=4,"xxx"
11731 !! input
11732 start
11733 ==a==
11734 ===aa===
11735 ====aaa====
11736 ==b==
11737 ===ba===
11738 ===bb===
11739 ====bba====
11740 ===bc===
11741 ==c==
11742 ===ca===
11743 !! result
11744 start
11745 ==a==
11746 ===aa===
11747 ====aaa====
11750 ==c==
11751 ===ca===
11752 !! end
11754 !! test
11755 Section replacement test (section 5)
11756 !! options
11757 replace=5,"xxx"
11758 !! input
11759 start
11760 ==a==
11761 ===aa===
11762 ====aaa====
11763 ==b==
11764 ===ba===
11765 ===bb===
11766 ====bba====
11767 ===bc===
11768 ==c==
11769 ===ca===
11770 !! result
11771 start
11772 ==a==
11773 ===aa===
11774 ====aaa====
11775 ==b==
11778 ===bb===
11779 ====bba====
11780 ===bc===
11781 ==c==
11782 ===ca===
11783 !! end
11785 !! test
11786 Section replacement test (section 6)
11787 !! options
11788 replace=6,"xxx"
11789 !! input
11790 start
11791 ==a==
11792 ===aa===
11793 ====aaa====
11794 ==b==
11795 ===ba===
11796 ===bb===
11797 ====bba====
11798 ===bc===
11799 ==c==
11800 ===ca===
11801 !! result
11802 start
11803 ==a==
11804 ===aa===
11805 ====aaa====
11806 ==b==
11807 ===ba===
11810 ===bc===
11811 ==c==
11812 ===ca===
11813 !! end
11815 !! test
11816 Section replacement test (section 7)
11817 !! options
11818 replace=7,"xxx"
11819 !! input
11820 start
11821 ==a==
11822 ===aa===
11823 ====aaa====
11824 ==b==
11825 ===ba===
11826 ===bb===
11827 ====bba====
11828 ===bc===
11829 ==c==
11830 ===ca===
11831 !! result
11832 start
11833 ==a==
11834 ===aa===
11835 ====aaa====
11836 ==b==
11837 ===ba===
11838 ===bb===
11841 ===bc===
11842 ==c==
11843 ===ca===
11844 !! end
11846 !! test
11847 Section replacement test (section 8)
11848 !! options
11849 replace=8,"xxx"
11850 !! input
11851 start
11852 ==a==
11853 ===aa===
11854 ====aaa====
11855 ==b==
11856 ===ba===
11857 ===bb===
11858 ====bba====
11859 ===bc===
11860 ==c==
11861 ===ca===
11862 !! result
11863 start
11864 ==a==
11865 ===aa===
11866 ====aaa====
11867 ==b==
11868 ===ba===
11869 ===bb===
11870 ====bba====
11873 ==c==
11874 ===ca===
11875 !!end
11877 !! test
11878 Section replacement test (section 9)
11879 !! options
11880 replace=9,"xxx"
11881 !! input
11882 start
11883 ==a==
11884 ===aa===
11885 ====aaa====
11886 ==b==
11887 ===ba===
11888 ===bb===
11889 ====bba====
11890 ===bc===
11891 ==c==
11892 ===ca===
11893 !! result
11894 start
11895 ==a==
11896 ===aa===
11897 ====aaa====
11898 ==b==
11899 ===ba===
11900 ===bb===
11901 ====bba====
11902 ===bc===
11904 !! end
11906 !! test
11907 Section replacement test (section 10)
11908 !! options
11909 replace=10,"xxx"
11910 !! input
11911 start
11912 ==a==
11913 ===aa===
11914 ====aaa====
11915 ==b==
11916 ===ba===
11917 ===bb===
11918 ====bba====
11919 ===bc===
11920 ==c==
11921 ===ca===
11922 !! result
11923 start
11924 ==a==
11925 ===aa===
11926 ====aaa====
11927 ==b==
11928 ===ba===
11929 ===bb===
11930 ====bba====
11931 ===bc===
11932 ==c==
11934 !! end
11936 !! test
11937 Section replacement test with initial whitespace (bug 13728)
11938 !! options
11939 replace=2,"xxx"
11940 !! input
11941  Preformatted initial line
11942 ==a==
11943 ===a===
11944 !! result
11945  Preformatted initial line
11946 ==a==
11948 !! end
11951 !! test
11952 Section extraction, heading followed by pre with 20 spaces (bug 6398)
11953 !! options
11954 section=1
11955 !! input
11956 ==a==
11957                     a
11958 !! result
11959 ==a==
11960                     a
11961 !! end
11963 !! test
11964 Section extraction, heading followed by pre with 19 spaces (bug 6398 sanity check)
11965 !! options
11966 section=1
11967 !! input
11968 ==a==
11969                    a
11970 !! result
11971 ==a==
11972                    a
11973 !! end
11976 !! test
11977 Section extraction, <pre> around bogus header (bug 10309)
11978 !! options
11979 noxml section=2
11980 !! input
11981 == Section One ==
11982 <pre>
11983 =======
11984 </pre>
11986 == Section Two ==
11987 stuff
11988 !! result
11989 == Section Two ==
11990 stuff
11991 !! end
11993 !! test
11994 Section replacement, <pre> around bogus header (bug 10309)
11995 !! options
11996 noxml replace=2,"xxx"
11997 !! input
11998 == Section One ==
11999 <pre>
12000 =======
12001 </pre>
12003 == Section Two ==
12004 stuff
12005 !! result
12006 == Section One ==
12007 <pre>
12008 =======
12009 </pre>
12012 !! end
12016 !! test
12017 Handling of &#x0A; in URLs
12018 !! input
12019 **irc://&#x0A;a
12020 !! result
12021 <ul><li><ul><li><a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a>
12022 </li></ul>
12023 </li></ul>
12025 !!end
12027 !! test
12028 5 quotes, code coverage +1 line (php)
12029 !! options
12031 !! input
12032 '''''
12033 !! result
12034 !! end
12035 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
12036 !! test
12037 5 quotes, code coverage +1 line (parsoid)
12038 !! options
12039 parsoid
12040 !! input
12041 '''''
12042 !! result
12043 <p><i><b></b></i></p>
12044 !! end
12046 !! test
12047 Special:Search page linking.
12048 !! input
12049 {{Special:search}}
12050 !! result
12051 <p><a href="/wiki/Special:Search" title="Special:Search">Special:Search</a>
12052 </p>
12053 !! end
12055 !! test
12056 Say the magic word
12057 !! input
12058 * {{PAGENAME}}
12059 * {{BASEPAGENAME}}
12060 * {{SUBPAGENAME}}
12061 * {{SUBPAGENAMEE}}
12062 * {{ROOTPAGENAME}}
12063 * {{ROOTPAGENAMEE}}
12064 * {{BASEPAGENAME}}
12065 * {{BASEPAGENAMEE}}
12066 * {{TALKPAGENAME}}
12067 * {{TALKPAGENAMEE}}
12068 * {{SUBJECTPAGENAME}}
12069 * {{SUBJECTPAGENAMEE}}
12070 * {{NAMESPACEE}}
12071 * {{NAMESPACE}}
12072 * {{TALKSPACE}}
12073 * {{TALKSPACEE}}
12074 * {{SUBJECTSPACE}}
12075 * {{SUBJECTSPACEE}}
12076 * {{Dynamic|{{NUMBEROFUSERS}}|{{NUMBEROFPAGES}}|{{CURRENTVERSION}}|{{CONTENTLANGUAGE}}|{{DIRECTIONMARK}}|{{CURRENTTIMESTAMP}}|{{NUMBEROFARTICLES}}}}
12077 !! result
12078 <ul><li> Parser test
12079 </li><li> Parser test
12080 </li><li> Parser test
12081 </li><li> Parser_test
12082 </li><li> Parser test
12083 </li><li> Parser_test
12084 </li><li> Parser test
12085 </li><li> Parser_test
12086 </li><li> Talk:Parser test
12087 </li><li> Talk:Parser_test
12088 </li><li> Parser test
12089 </li><li> Parser_test
12090 </li><li> 
12091 </li><li> 
12092 </li><li> Talk
12093 </li><li> Talk
12094 </li><li> 
12095 </li><li> 
12096 </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>
12097 </li></ul>
12099 !! end
12100 ### Note: Above tests excludes the "{{NUMBEROFADMINS}}" magic word because it generates a MySQL error when included.
12102 !! test
12103 Gallery
12104 !! input
12105 <gallery>
12106 image1.png |
12107 image2.gif|||||
12109 image3|
12110 image4    |300px| centre
12111  image5.svg| http://///////
12112 [[x|xx]]]]
12113 * image6
12114 </gallery>
12115 !! result
12116 <ul class="gallery">
12117                 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
12118                         <div style="height: 150px;">Image1.png</div>
12119                         <div class="gallerytext">
12120                         </div>
12121                 </div></li>
12122                 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
12123                         <div style="height: 150px;">Image2.gif</div>
12124                         <div class="gallerytext">
12125 <p>||||
12126 </p>
12127                         </div>
12128                 </div></li>
12129                 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
12130                         <div style="height: 150px;">Image3</div>
12131                         <div class="gallerytext">
12132                         </div>
12133                 </div></li>
12134                 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
12135                         <div style="height: 150px;">Image4</div>
12136                         <div class="gallerytext">
12137 <p>300px| centre
12138 </p>
12139                         </div>
12140                 </div></li>
12141                 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
12142                         <div style="height: 150px;">Image5.svg</div>
12143                         <div class="gallerytext">
12144 <p><a rel="nofollow" class="external free" href="http://///////">http://///////</a>
12145 </p>
12146                         </div>
12147                 </div></li>
12148                 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
12149                         <div style="height: 150px;">* image6</div>
12150                         <div class="gallerytext">
12151                         </div>
12152                 </div></li>
12153 </ul>
12155 !! end
12157 !! test
12158 Gallery (with options)
12159 !! input
12160 <gallery widths='70px' heights='40px' perrow='2' caption='Foo [[Main Page]]' >
12161 File:Nonexistant.jpg|caption
12162 File:Nonexistant.jpg
12163 image:foobar.jpg|some '''caption''' [[Main Page]]
12164 image:foobar.jpg
12165 image:foobar.jpg|Blabla|alt=This is a foo-bar.|blabla.
12166 </gallery>
12167 !! result
12168 <ul class="gallery" style="max-width: 226px;_width: 226px;">
12169         <li class='gallerycaption'>Foo <a href="/wiki/Main_Page" title="Main Page">Main Page</a></li>
12170                 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
12171                         <div style="height: 70px;">Nonexistant.jpg</div>
12172                         <div class="gallerytext">
12173 <p>caption
12174 </p>
12175                         </div>
12176                 </div></li>
12177                 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
12178                         <div style="height: 70px;">Nonexistant.jpg</div>
12179                         <div class="gallerytext">
12180                         </div>
12181                 </div></li>
12182                 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
12183                         <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>
12184                         <div class="gallerytext">
12185 <p>some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
12186 </p>
12187                         </div>
12188                 </div></li>
12189                 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
12190                         <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>
12191                         <div class="gallerytext">
12192                         </div>
12193                 </div></li>
12194                 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
12195                         <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>
12196                         <div class="gallerytext">
12197 <p>Blabla|blabla.
12198 </p>
12199                         </div>
12200                 </div></li>
12201 </ul>
12203 !! end
12205 !! test
12206 Gallery with wikitext inside caption
12207 !! input
12208 <gallery>
12209 File:foobar.jpg|[[File:foobar.jpg|20px|desc|alt=inneralt]]|alt=galleryalt
12210 File:foobar.jpg|{{Test|unamedParam|alt=param}}|alt=galleryalt
12211 </gallery>
12212 !! result
12213 <ul class="gallery">
12214                 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
12215                         <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>
12216                         <div class="gallerytext">
12217 <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>
12218 </p>
12219                         </div>
12220                 </div></li>
12221                 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
12222                         <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>
12223                         <div class="gallerytext">
12224 <p>This is a test template
12225 </p>
12226                         </div>
12227                 </div></li>
12228 </ul>
12230 !! end
12232 !! test
12233 gallery (with showfilename option)
12234 !! input
12235 <gallery showfilename>
12236 File:Nonexistant.jpg|caption
12237 File:Nonexistant.jpg
12238 image:foobar.jpg|some '''caption''' [[Main Page]]
12239 File:Foobar.jpg
12240 </gallery>
12241 !! result
12242 <ul class="gallery">
12243                 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
12244                         <div style="height: 150px;">Nonexistant.jpg</div>
12245                         <div class="gallerytext">
12246 <p><a href="/wiki/File:Nonexistant.jpg" title="File:Nonexistant.jpg">Nonexistant.jpg</a><br />
12247 caption
12248 </p>
12249                         </div>
12250                 </div></li>
12251                 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
12252                         <div style="height: 150px;">Nonexistant.jpg</div>
12253                         <div class="gallerytext">
12254 <p><a href="/wiki/File:Nonexistant.jpg" title="File:Nonexistant.jpg">Nonexistant.jpg</a><br />
12255 </p>
12256                         </div>
12257                 </div></li>
12258                 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
12259                         <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>
12260                         <div class="gallerytext">
12261 <p><a href="/wiki/File:Foobar.jpg" title="File:Foobar.jpg">Foobar.jpg</a><br />
12262 some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
12263 </p>
12264                         </div>
12265                 </div></li>
12266                 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
12267                         <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>
12268                         <div class="gallerytext">
12269 <p><a href="/wiki/File:Foobar.jpg" title="File:Foobar.jpg">Foobar.jpg</a><br />
12270 </p>
12271                         </div>
12272                 </div></li>
12273 </ul>
12275 !! end
12277 !! test
12278 Gallery (with namespace-less filenames)
12279 !! input
12280 <gallery>
12281 File:Nonexistant.jpg
12282 Nonexistant.jpg
12283 image:foobar.jpg
12284 foobar.jpg
12285 </gallery>
12286 !! result
12287 <ul class="gallery">
12288                 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
12289                         <div style="height: 150px;">Nonexistant.jpg</div>
12290                         <div class="gallerytext">
12291                         </div>
12292                 </div></li>
12293                 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
12294                         <div style="height: 150px;">Nonexistant.jpg</div>
12295                         <div class="gallerytext">
12296                         </div>
12297                 </div></li>
12298                 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
12299                         <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>
12300                         <div class="gallerytext">
12301                         </div>
12302                 </div></li>
12303                 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
12304                         <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>
12305                         <div class="gallerytext">
12306                         </div>
12307                 </div></li>
12308 </ul>
12310 !! end
12312 !! test
12313 HTML Hex character encoding (spells the word "JavaScript")
12314 !! input
12315 &#x4A;&#x061;&#x0076;&#x00061;&#x000053;&#x0000063;&#114;&#x0000069;&#00000112;&#x0000000074;
12316 !! result
12317 <p>&#x4a;&#x61;&#x76;&#x61;&#x53;&#x63;&#114;&#x69;&#112;&#x74;
12318 </p>
12319 !! end
12321 !! test
12322 HTML Hex character encoding bogus encoding (bug 26437 regression check)
12323 !! input
12324 &#xsee;&#XSEE;
12325 !! result
12326 <p>&amp;#xsee;&amp;#XSEE;
12327 </p>
12328 !! end
12330 !! test
12331 HTML Hex character encoding mixed case
12332 !! input
12333 &#xEE;&#Xee;
12334 !! result
12335 <p>&#xee;&#xee;
12336 </p>
12337 !! end
12339 !! test
12340 __FORCETOC__ override
12341 !! input
12342 __NEWSECTIONLINK__
12343 __FORCETOC__
12344 !! result
12345 <p><br />
12346 </p>
12347 !! end
12349 !! test
12350 ISBN code coverage
12351 !! input
12352 ISBN  978-0-1234-56&#x20;789
12353 !! result
12354 <p><a href="/wiki/Special:BookSources/9780123456" class="internal mw-magiclink-isbn">ISBN 978-0-1234-56</a>&#x20;789
12355 </p>
12356 !! end
12358 !! test
12359 ISBN followed by 5 spaces
12360 !! input
12361 ISBN    
12362 !! result
12363 <p>ISBN    
12364 </p>
12365 !! end
12367 !! test
12368 Double ISBN
12369 !! input
12370 ISBN ISBN 1234567890
12371 !! result
12372 <p>ISBN <a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
12373 </p>
12374 !! end
12376 !! test
12377 Bug 22905: <abbr> followed by ISBN followed by </a>
12378 !! input
12379 <abbr>(fr)</abbr> ISBN 2753300917 [http://www.example.com example.com]
12380 !! result
12381 <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>
12382 </p>
12383 !! end
12385 !! test
12386 Double RFC
12387 !! input
12388 RFC RFC 1234
12389 !! result
12390 <p>RFC <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc1234">RFC 1234</a>
12391 </p>
12392 !! end
12394 !! test
12395 Double RFC with a wiki link
12396 !! input
12397 RFC [[RFC 1234]]
12398 !! result
12399 <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>
12400 </p>
12401 !! end
12403 !! test
12404 RFC code coverage
12405 !! input
12406 RFC   983&#x20;987
12407 !! result
12408 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc983">RFC 983</a>&#x20;987
12409 </p>
12410 !! end
12412 !! test
12413 Centre-aligned image
12414 !! input
12415 [[Image:foobar.jpg|centre]]
12416 !! result
12417 <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>
12419 !!end
12421 !! test
12422 None-aligned image
12423 !! input
12424 [[Image:foobar.jpg|none]]
12425 !! result
12426 <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>
12428 !!end
12430 !! test
12431 Width + Height sized image (using px) (height is ignored)
12432 !! input
12433 [[Image:foobar.jpg|640x480px]]
12434 !! result
12435 <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>
12436 </p>
12437 !!end
12439 !! test
12440 Width-sized image (using px, no following whitespace)
12441 !! input
12442 [[Image:foobar.jpg|640px]]
12443 !! result
12444 <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>
12445 </p>
12446 !!end
12448 !! test
12449 Width-sized image (using px, with following whitespace - test regression from r39467)
12450 !! input
12451 [[Image:foobar.jpg|640px ]]
12452 !! result
12453 <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>
12454 </p>
12455 !!end
12457 !! test
12458 Width-sized image (using px, with preceding whitespace - test regression from r39467)
12459 !! input
12460 [[Image:foobar.jpg| 640px]]
12461 !! result
12462 <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>
12463 </p>
12464 !!end
12466 !! test
12467 Another italics / bold test
12468 !! input
12469  ''' ''x'
12470 !! result
12471 <pre>'<i> </i>x'
12472 </pre>
12473 !!end
12475 # Note the results may be incorrect, as parserTest output included this:
12476 # XML error: Mismatched tag at byte 6120:
12477 # ...<dd> </dt></dl> </dd...
12478 !! test
12479 dt/dd/dl test
12480 !! options
12481 disabled
12482 !! input
12483 :;;;::
12484 !! result
12485 <dl><dd><dl><dt><dl><dt><dl><dt><dl><dd><dl><dd>
12486 </dd></dl>
12487 </dd></dl>
12488 </dt></dl>
12489 </dt></dl>
12490 </dt></dl>
12491 </dd></dl>
12493 !!end
12496 # Images with the "|" character in external URLs in comment tags; Eats half the comment, leaves unmatched "</a>" tag.
12497 !! test
12498 Images with the "|" character in the comment
12499 !! input
12500 [[image:Foobar.jpg|thumb|An [http://test/?param1=|left|&param2=|x external] URL]]
12501 !! result
12502 <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>
12504 !!end
12506 !! test
12507 [Before] HTML without raw HTML enabled ($wgRawHtml==false)
12508 !! input
12509 <html><script>alert(1);</script></html>
12510 !! result
12511 <p>&lt;html&gt;&lt;script&gt;alert(1);&lt;/script&gt;&lt;/html&gt;
12512 </p>
12513 !! end
12515 !! test
12516 HTML with raw HTML ($wgRawHtml==true)
12517 !! options
12518 wgRawHtml=1
12519 !! input
12520 <html><script>alert(1);</script></html>
12521 !! result
12522 <p><script>alert(1);</script>
12523 </p>
12524 !! end
12526 !! test
12527 Parents of subpages, one level up
12528 !! options
12529 subpage title=[[Subpage test/L1/L2/L3]]
12530 !! input
12531 [[../|L2]]
12532 !! result
12533 <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>
12534 </p>
12535 !! end
12538 !! test
12539 Parents of subpages, one level up, not named
12540 !! options
12541 subpage title=[[Subpage test/L1/L2/L3]]
12542 !! input
12543 [[../]]
12544 !! result
12545 <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>
12546 </p>
12547 !! end
12551 !! test
12552 Parents of subpages, two levels up
12553 !! options
12554 subpage title=[[Subpage test/L1/L2/L3]]
12555 !! input
12556 [[../../|L1]]2
12558 [[../../|L1]]l
12559 !! result
12560 <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
12561 </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>
12562 </p>
12563 !! end
12565 !! test
12566 Parents of subpages, two levels up, without trailing slash or name.
12567 !! options
12568 subpage title=[[Subpage test/L1/L2/L3]]
12569 !! input
12570 [[../..]]
12571 !! result
12572 <p>[[../..]]
12573 </p>
12574 !! end
12576 !! test
12577 Parents of subpages, two levels up, with lots of extra trailing slashes.
12578 !! options
12579 subpage title=[[Subpage test/L1/L2/L3]]
12580 !! input
12581 [[../../////]]
12582 !! result
12583 <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>
12584 </p>
12585 !! end
12587 !! article
12588 Subpage test/L1/L2/L3Sibling
12589 !! text
12590 Sibling article
12591 !! endarticle
12593 !! test
12594 Transclusion of a sibling page (one level up)
12595 !! options
12596 subpage title=[[Subpage test/L1/L2/L3]]
12597 !! input
12598 {{../L3Sibling}}
12599 !! result
12600 <p>Sibling article
12601 </p>
12602 !! end
12604 !! test
12605 Transclusion of a child page
12606 !! options
12607 subpage title=[[Subpage test/L1/L2]]
12608 !! input
12609 {{/L3Sibling}}
12610 !! result
12611 <p>Sibling article
12612 </p>
12613 !! end
12615 !! test
12616 Non-transclusion because of too many up levels
12617 !! options
12618 subpage title=[[Subpage test/L1/L2/L3]]
12619 !! input
12620 {{../../../../More than parent}}
12621 !! result
12622 <p>{{../../../../More than parent}}
12623 </p>
12624 !! end
12626 !! test
12627 Definition list code coverage
12628 !! input
12629 ; title   : def
12630 ; title : def
12631 ;title: def
12632 !! result
12633 <dl><dt> title  &#160;</dt><dd> def
12634 </dd><dt> title&#160;</dt><dd> def
12635 </dd><dt>title</dt><dd> def
12636 </dd></dl>
12638 !! end
12640 !! test
12641 Don't fall for the self-closing div
12642 !! input
12643 <div>hello world</div/>
12644 !! result
12645 <div>hello world</div>
12647 !! end
12649 !! test
12650 MSGNW magic word
12651 !! input
12652 {{MSGNW:msg}}
12653 !! result
12654 <p>&#91;&#91;:Template:Msg&#93;&#93;
12655 </p>
12656 !! end
12658 !! test
12659 RAW magic word
12660 !! input
12661 {{RAW:QUERTY}}
12662 !! result
12663 <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>
12664 </p>
12665 !! end
12667 # This isn't needed for XHTML conformance, but would be handy as a fallback security measure
12668 !! test
12669 Always escape literal '>' in output, not just after '<'
12670 !! input
12672 !! result
12673 <p>&gt;&lt;&gt;
12674 </p>
12675 !! end
12677 !! test
12678 Template caching
12679 !! input
12680 {{Test}}
12681 {{Test}}
12682 !! result
12683 <p>This is a test template
12684 This is a test template
12685 </p>
12686 !! end
12689 !! article
12690 MediaWiki:Fake
12691 !! text
12692 ==header==
12693 !! endarticle
12695 !! test
12696 Inclusion of !userCanEdit() content
12697 !! input
12698 {{MediaWiki:Fake}}
12699 !! result
12700 <h2><span class="mw-headline" id="header">header</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=MediaWiki:Fake&amp;action=edit&amp;section=T-1" title="MediaWiki:Fake">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
12702 !! end
12705 !! test
12706 Out-of-order TOC heading levels
12707 !! input
12708 ==2==
12709 ======6======
12710 ===3===
12712 =====5=====
12713 ==2==
12714 !! result
12715 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
12716 <ul>
12717 <li class="toclevel-1 tocsection-1"><a href="#2"><span class="tocnumber">1</span> <span class="toctext">2</span></a>
12718 <ul>
12719 <li class="toclevel-2 tocsection-2"><a href="#6"><span class="tocnumber">1.1</span> <span class="toctext">6</span></a></li>
12720 <li class="toclevel-2 tocsection-3"><a href="#3"><span class="tocnumber">1.2</span> <span class="toctext">3</span></a></li>
12721 </ul>
12722 </li>
12723 <li class="toclevel-1 tocsection-4"><a href="#1"><span class="tocnumber">2</span> <span class="toctext">1</span></a>
12724 <ul>
12725 <li class="toclevel-2 tocsection-5"><a href="#5"><span class="tocnumber">2.1</span> <span class="toctext">5</span></a></li>
12726 <li class="toclevel-2 tocsection-6"><a href="#2_2"><span class="tocnumber">2.2</span> <span class="toctext">2</span></a></li>
12727 </ul>
12728 </li>
12729 </ul>
12730 </div>
12731 <h2><span class="mw-headline" id="2">2</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: 2">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
12732 <h6><span class="mw-headline" id="6">6</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: 6">edit</a><span class="mw-editsection-bracket">]</span></span></h6>
12733 <h3><span class="mw-headline" id="3">3</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=3" title="Edit section: 3">edit</a><span class="mw-editsection-bracket">]</span></span></h3>
12734 <h1><span class="mw-headline" id="1">1</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=4" title="Edit section: 1">edit</a><span class="mw-editsection-bracket">]</span></span></h1>
12735 <h5><span class="mw-headline" id="5">5</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=5" title="Edit section: 5">edit</a><span class="mw-editsection-bracket">]</span></span></h5>
12736 <h2><span class="mw-headline" id="2_2">2</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=6" title="Edit section: 2">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
12738 !! end
12741 !! test
12742 ISBN with a dummy number
12743 !! input
12744 ISBN ---
12745 !! result
12746 <p>ISBN ---
12747 </p>
12748 !! end
12751 !! test
12752 ISBN with space-delimited number
12753 !! input
12754 ISBN 92 9017 032 8
12755 !! result
12756 <p><a href="/wiki/Special:BookSources/9290170328" class="internal mw-magiclink-isbn">ISBN 92 9017 032 8</a>
12757 </p>
12758 !! end
12761 !! test
12762 ISBN with multiple spaces, no number
12763 !! input
12764 ISBN  foo
12765 !! result
12766 <p>ISBN  foo
12767 </p>
12768 !! end
12771 !! test
12772 ISBN length
12773 !! input
12774 ISBN 123456789
12776 ISBN 1234567890
12778 ISBN 12345678901
12779 !! result
12780 <p>ISBN 123456789
12781 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
12782 </p><p>ISBN 12345678901
12783 </p>
12784 !! end
12787 !! test
12788 ISBN with trailing year (bug 8110)
12789 !! input
12790 ISBN 1-234-56789-0 - 2006
12792 ISBN 1 234 56789 0 - 2006
12793 !! result
12794 <p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1-234-56789-0</a> - 2006
12795 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1 234 56789 0</a> - 2006
12796 </p>
12797 !! end
12800 !! test
12801 anchorencode
12802 !! input
12803 {{anchorencode:foo bar©#%n}}
12804 !! result
12805 <p>foo_bar.C2.A9.23.25n
12806 </p>
12807 !! end
12809 !! test
12810 anchorencode trims spaces
12811 !! input
12812 {{anchorencode: __pretty__please__}}
12813 !! result
12814 <p>pretty_please
12815 </p>
12816 !! end
12818 !! test
12819 anchorencode deals with links
12820 !! input
12821 {{anchorencode: [[hello|world]] [[hi]]}}
12822 !! result
12823 <p>world_hi
12824 </p>
12825 !! end
12827 !! test
12828 anchorencode deals with templates
12829 !! input
12830 {{anchorencode: {{Foo}} }}
12831 !! result
12832 <p>FOO
12833 </p>
12834 !! end
12836 !! test
12837 anchorencode encodes like the TOC generator: (bug 18431)
12838 !! input
12839 === _ +:.3A%3A&&amp;]] ===
12840 {{anchorencode: _ +:.3A%3A&&amp;]] }}
12841 __NOEDITSECTION__
12842 !! result
12843 <h3><span class="mw-headline" id=".2B:.3A.253A.26.26.5D.5D">_ +:.3A%3A&amp;&amp;]]</span></h3>
12844 <p>.2B:.3A.253A.26.26.5D.5D
12845 </p>
12846 !! end
12848 # Expected output in the following test is not necessarily expected (there
12849 # should probably be <p> tags inside the <blockquote> in the output) -- it's
12850 # only testing for well-formedness.
12851 !! test
12852 Bug 6200: blockquotes and paragraph formatting
12853 !! input
12854 <blockquote>
12856 </blockquote>
12860  baz
12861 !! result
12862 <blockquote>
12864 </blockquote>
12865 <p>bar
12866 </p>
12867 <pre>baz
12868 </pre>
12869 !! end
12871 !! test
12872 Bug 8293: Use of center tag ruins paragraph formatting
12873 !! input
12874 <center>
12876 </center>
12880  baz
12881 !! result
12882 <center>
12883 <p>foo
12884 </p>
12885 </center>
12886 <p>bar
12887 </p>
12888 <pre>baz
12889 </pre>
12890 !! end
12892 !!test
12893 Parsing of overlapping (improperly nested) inline html tags (PHP parser)
12894 !!options
12896 !!input
12897 <span><s>x</span></s>
12898 !!result
12899 <p><span><s>x&lt;/span&gt;</s></span>
12900 </p>
12901 !!end
12903 !!test
12904 Parsing of overlapping (improperly nested) inline html tags (Parsoid)
12905 !!options
12906 parsoid
12907 !!input
12908 <span><s>x</span></s>
12909 !!result
12910 <p><span><s>x</s></span><s></s>
12911 </p>
12912 !!end
12915 ### Language variants related tests
12917 !! test
12918 Self-link in language variants
12919 !! options
12920 title=[[Dunav]] language=sr
12921 !! input
12922 Both [[Dunav]] and [[Дунав]] are names for this river.
12923 !! result
12924 <p>Both <strong class="selflink">Dunav</strong> and <strong class="selflink">Дунав</strong> are names for this river.
12925 </p>
12926 !!end
12928 !! article
12929 Дуна
12930 !! text
12931 content
12932 !! endarticle
12934 !! test
12935 Link to another existing title shouldn't be parsed as self-link even if it's a variant of this title
12936 !! options
12937 title=[[Duna]] language=sr
12938 !! input
12939 [[Дуна]] is not a self-link while [[Duna]] and [[Dуна]] are still self-links.
12940 !! result
12941 <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.
12942 </p>
12943 !! end
12945 !! test
12946 Link to pages in language variants
12947 !! options
12948 language=sr
12949 !! input
12950 Main Page can be written as [[Маин Паге]]
12951 !! result
12952 <p>Main Page can be written as <a href="/wiki/Main_Page" title="Main Page">Маин Паге</a>
12953 </p>
12954 !!end
12957 !! test
12958 Multiple links to pages in language variants
12959 !! options
12960 language=sr
12961 !! input
12962 [[Main Page]] can be written as [[Маин Паге]] same as [[Маин Паге]].
12963 !! result
12964 <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>.
12965 </p>
12966 !!end
12969 !! test
12970 Simple template in language variants
12971 !! options
12972 language=sr
12973 !! input
12974 {{тест}}
12975 !! result
12976 <p>This is a test template
12977 </p>
12978 !! end
12981 !! test
12982 Template with explicit namespace in language variants
12983 !! options
12984 language=sr
12985 !! input
12986 {{Template:тест}}
12987 !! result
12988 <p>This is a test template
12989 </p>
12990 !! end
12993 !! test
12994 Basic test for template parameter in language variants
12995 !! options
12996 language=sr
12997 !! input
12998 {{парамтест|param=foo}}
12999 !! result
13000 <p>This is a test template with parameter foo
13001 </p>
13002 !! end
13005 !! test
13006 Simple category in language variants
13007 !! options
13008 language=sr cat
13009 !! input
13010 [[Category:МедиаWики Усер'с Гуиде]]
13011 !! result
13012 <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>
13013 !! end
13016 !! article
13017 Category:分类
13018 !! text
13019 blah
13020 !! endarticle
13022 !! article
13023 Category:分類
13024 !! text
13025 blah
13026 !! endarticle
13028 !! test
13029 Don't convert blue categorylinks to another variant (bug 33210)
13030 !! options
13031 language=zh cat
13032 !! input
13033 [[A]][[Category:分类]]
13034 !! result
13035 <a href="/wiki/Category:%E5%88%86%E7%B1%BB" title="Category:分类">分类</a>
13036 !! end
13039 !! test
13040 Stripping -{}- tags (language variants)
13041 !! options
13042 language=sr
13043 !! input
13044 Latin proverb: -{Ne nuntium necare}-
13045 !! result
13046 <p>Latin proverb: Ne nuntium necare
13047 </p>
13048 !! end
13051 !! test
13052 Prevent conversion with -{}- tags (language variants)
13053 !! options
13054 language=sr variant=sr-ec
13055 !! input
13056 Latinski: -{Ne nuntium necare}-
13057 !! result
13058 <p>Латински: Ne nuntium necare
13059 </p>
13060 !! end
13063 !! test
13064 Prevent conversion of text with -{}- tags (language variants)
13065 !! options
13066 language=sr variant=sr-ec
13067 !! input
13068 Latinski: -{Ne nuntium necare}-
13069 !! result
13070 <p>Латински: Ne nuntium necare
13071 </p>
13072 !! end
13075 !! test
13076 Prevent conversion of links with -{}- tags (language variants)
13077 !! options
13078 language=sr variant=sr-ec
13079 !! input
13080 -{[[Main Page]]}-
13081 !! result
13082 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
13083 </p>
13084 !! end
13087 !! test
13088 -{}- tags within headlines (within html for parserConvert())
13089 !! options
13090 language=sr variant=sr-ec
13091 !! input
13092 == -{Naslov}- ==
13093 !! result
13094 <h2><span class="mw-headline" id="-.7BNaslov.7D-">Naslov</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Уредите одељак „Naslov“">уреди</a><span class="mw-editsection-bracket">]</span></span></h2>
13096 !! end
13099 !! test
13100 Explicit definition of language variant alternatives
13101 !! options
13102 language=zh variant=zh-tw
13103 !! input
13104 -{zh:China;zh-tw:Taiwan}-, not China
13105 !! result
13106 <p>Taiwan, not China
13107 </p>
13108 !! end
13111 !! test
13112 Conversion around HTML tags
13113 !! options
13114 language=sr variant=sr-ec
13115 !! input
13116 -{H|span=>sr-ec:script;title=>sr-ec:src;}-
13117 <span title="La-{sr-el:L;sr-ec:C;}-tin">ski</span>
13118 !! result
13120 <span title="ЛаCтин">ски</span>
13121 </p>
13122 !! end
13125 !! test
13126 Explicit session-wise language variant mapping (A flag and - flag)
13127 !! options
13128 language=zh variant=zh-tw
13129 !! input
13130 Taiwan is not China.
13131 But -{A|zh:China;zh-tw:Taiwan}- is China,
13132 (This-{-|zh:China;zh-tw:Taiwan}- should be stripped!)
13133 and -{China}- is China.
13134 !! result
13135 <p>Taiwan is not China.
13136 But Taiwan is Taiwan,
13137 (This should be stripped!)
13138 and China is China.
13139 </p>
13140 !! end
13142 !! test
13143 Explicit session-wise language variant mapping (H flag for hide)
13144 !! options
13145 language=zh variant=zh-tw
13146 !! input
13147 (This-{H|zh:China;zh-tw:Taiwan}- should be stripped!)
13148 Taiwan is China.
13149 !! result
13150 <p>(This should be stripped!)
13151 Taiwan is Taiwan.
13152 </p>
13153 !! end
13155 !! test
13156 Adding explicit conversion rule for title (T flag)
13157 !! options
13158 language=zh variant=zh-tw showtitle
13159 !! input
13160 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
13161 !! result
13162 Taiwan
13163 <p>Should be stripped!
13164 </p>
13165 !! end
13167 !! test
13168 Testing that changing the language variant here in the tests actually works
13169 !! options
13170 language=zh variant=zh showtitle
13171 !! input
13172 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
13173 !! result
13174 China
13175 <p>Should be stripped!
13176 </p>
13177 !! end
13179 !! test
13180 Recursive conversion of alt and title attrs shouldn't clear converter state
13181 !! options
13182 language=zh variant=zh-cn showtitle
13183 !! input
13184 -{H|zh-cn:Exclamation;zh-tw:exclamation;}-
13185 Should be stripped-{T|zh-cn:China;zh-tw:Taiwan}-<span title="exclamation">!</span>
13186 !! result
13187 China
13189 Should be stripped<span title="Exclamation">!</span>
13190 </p>
13191 !! end
13193 !! test
13194 Bug 24072: more test on conversion rule for title
13195 !! options
13196 language=zh variant=zh-tw showtitle
13197 !! input
13198 This should be stripped-{T|zh:China;zh-tw:Taiwan}-!
13199 This won't take interferes with the title rule-{H|zh:Beijing;zh-tw:Taipei}-.
13200 !! result
13201 Taiwan
13202 <p>This should be stripped!
13203 This won't take interferes with the title rule.
13204 </p>
13205 !! end
13207 !! test
13208 Partly disable title conversion if variant == main language code
13209 !! options
13210 language=zh variant=zh title=[[ZH]] showtitle
13211 !! input
13212 -{T|zh-cn:CN;zh-tw:TW}-
13213 !! result
13216 </p>
13217 !! end
13219 !! test
13220 Partly disable title conversion if variant == main language code, more
13221 !! options
13222 language=zh variant=zh title=[[ZH]] showtitle
13223 !! input
13224 -{T|TW}-
13225 !! result
13228 </p>
13229 !! end
13231 !! test
13232 Raw output of variant escape tags (R flag)
13233 !! options
13234 language=zh variant=zh-tw
13235 !! input
13236 Raw: -{R|zh:China;zh-tw:Taiwan}-
13237 !! result
13238 <p>Raw: zh:China;zh-tw:Taiwan
13239 </p>
13240 !! end
13242 !! test
13243 Nested using of manual convert syntax
13244 !! options
13245 language=zh variant=zh-hk
13246 !! input
13247 Nested: -{zh-hans:Hi -{zh-cn:China;zh-sg:Singapore;}-;zh-hant:Hello -{zh-tw:Taiwan;zh-hk:H-{ong}- K-{}-ong;}-;}-!
13248 !! result
13249 <p>Nested: Hello Hong Kong!
13250 </p>
13251 !! end
13253 !! test
13254 Proper conversion of text in external links
13255 !! options
13256 language=sr variant=sr-ec
13257 !! input
13258 http://www.google.com
13259 gopher://www.google.com
13260 [http://www.google.com http://www.google.com]
13261 [gopher://www.google.com gopher://www.google.com]
13262 [https://www.google.com irc://www.google.com]
13263 [ftp://www.google.com www.google.com/ftp://dir]
13264 [//www.google.com www.google.com]
13265 !! result
13266 <p><a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
13267 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
13268 <a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
13269 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
13270 <a rel="nofollow" class="external text" href="https://www.google.com">irc://www.google.com</a>
13271 <a rel="nofollow" class="external text" href="ftp://www.google.com">www.гоогле.цом/фтп://дир</a>
13272 <a rel="nofollow" class="external text" href="//www.google.com">www.гоогле.цом</a>
13273 </p>
13274 !! end
13276 !! test
13277 Do not convert roman numbers to language variants
13278 !! options
13279 language=sr variant=sr-ec
13280 !! input
13281 Fridrih IV je car.
13282 !! result
13283 <p>Фридрих IV је цар.
13284 </p>
13285 !! end
13287 !! test
13288 Unclosed language converter markup "-{"
13289 !! options
13290 language=sr
13291 !! input
13292 -{T|hello
13293 !! result
13294 <p>-{T|hello
13295 </p>
13296 !! end
13298 !! test
13299 Don't convert raw rule "-{R|=&gt;}-" to "=>"
13300 !! options
13301 language=sr
13302 !! input
13303 -{R|=&gt;}-
13304 !! result
13305 <p>=&gt;
13306 </p>
13307 !!end
13309 !!article
13310 Template:Bullet
13311 !!text
13312 * Bar
13313 !!endarticle
13315 !! test
13316 Bug 529: Uncovered bullet
13317 !! input
13318 * Foo {{bullet}}
13319 !! result
13320 <ul><li> Foo 
13321 </li><li> Bar
13322 </li></ul>
13324 !! end
13326 # Plain MediaWiki does not remove empty lists, but tidy actually does.
13327 # Templates in Wikipedia rely on this behavior, as tidy has always been
13328 # enabled there. These tests are normally run *without* tidy, so specify the
13329 # full output here. 
13330 # To test realistic parsing behavior, apply a tidy-like transformation to both
13331 # the expected output and your parser's output.
13332 !! test
13333 Bug 529: Uncovered bullet leaving empty list, normally removed by tidy
13334 !! input
13335 ******* Foo {{bullet}}
13336 !! result
13337 <ul><li><ul><li><ul><li><ul><li><ul><li><ul><li><ul><li> Foo 
13338 </li></ul>
13339 </li></ul>
13340 </li></ul>
13341 </li></ul>
13342 </li></ul>
13343 </li></ul>
13344 </li><li> Bar
13345 </li></ul>
13347 !! end
13349 !! test
13350 Bug 529: Uncovered table already at line-start
13351 !! input
13354 {{table}}
13356 !! result
13357 <p>x
13358 </p>
13359 <table>
13360 <tr>
13361 <td> 1 </td>
13362 <td> 2
13363 </td></tr>
13364 <tr>
13365 <td> 3 </td>
13366 <td> 4
13367 </td></tr></table>
13368 <p>y
13369 </p>
13370 !! end
13372 !! test
13373 Bug 529: Uncovered bullet in parser function result
13374 !! input
13375 * Foo {{lc:{{bullet}} }}
13376 !! result
13377 <ul><li> Foo 
13378 </li><li> bar
13379 </li></ul>
13381 !! end
13383 !! test
13384 Bug 5678: Double-parsed template argument
13385 !! input
13386 {{lc:{{{1}}}|hello}}
13387 !! result
13388 <p>{{{1}}}
13389 </p>
13390 !! end
13392 !! test
13393 Bug 5678: Double-parsed template invocation
13394 !! input
13395 {{lc:{{paramtest {{!}} param = hello }} }}
13396 !! result
13397 <p>{{paramtest | param = hello }}
13398 </p>
13399 !! end
13401 !! test
13402 Case insensitivity of parser functions for non-ASCII characters (bug 8143)
13403 !! options
13404 language=cs
13405 title=[[Main Page]]
13406 !! input
13407 {{PRVNÍVELKÉ:ěščř}}
13408 {{prvnívelké:ěščř}}
13409 {{PRVNÍMALÉ:ěščř}}
13410 {{prvnímalé:ěščř}}
13411 {{MALÁ:ěščř}}
13412 {{malá:ěščř}}
13413 {{VELKÁ:ěščř}}
13414 {{velká:ěščř}}
13415 !! result
13416 <p>Ěščř
13417 Ěščř
13418 ěščř
13419 ěščř
13420 ěščř
13421 ěščř
13422 ĚŠČŘ
13423 ĚŠČŘ
13424 </p>
13425 !! end
13427 !! test
13428 Morwen/13: Unclosed link followed by heading
13429 !! input
13430 [[link
13431 ==heading==
13432 !! result
13433 <p>[[link
13434 </p>
13435 <h2><span class="mw-headline" id="heading">heading</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: heading">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
13437 !! end
13439 !! test
13440 HHP2.1: Heuristics for headings in preprocessor parenthetical structures
13441 !! input
13442 {{foo|
13443 =heading=
13444 !! result
13445 <p>{{foo|
13446 </p>
13447 <h1><span class="mw-headline" id="heading">heading</span></h1>
13449 !! end
13451 !! test
13452 HHP2.2: Heuristics for headings in preprocessor parenthetical structures
13453 !! input
13454 {{foo|
13455 ==heading==
13456 !! result
13457 <p>{{foo|
13458 </p>
13459 <h2><span class="mw-headline" id="heading">heading</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: heading">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
13461 !! end
13463 !! test
13464 Tildes in comments
13465 !! options
13467 !! input
13468 <!-- ~~~~ -->
13469 !! result
13470 <!-- ~~~~ -->
13471 !! end
13473 !! test
13474 Paragraphs inside divs (no extra line breaks)
13475 !! input
13476 <div>Line one
13478 Line two</div>
13479 !! result
13480 <div>Line one
13481 Line two</div>
13483 !! end
13485 !! test
13486 Paragraphs inside divs (extra line break on open)
13487 !! input
13488 <div>
13489 Line one
13491 Line two</div>
13492 !! result
13493 <div>
13494 <p>Line one
13495 </p>
13496 Line two</div>
13498 !! end
13500 !! test
13501 Paragraphs inside divs (extra line break on close)
13502 !! input
13503 <div>Line one
13505 Line two
13506 </div>
13507 !! result
13508 <div>Line one
13509 <p>Line two
13510 </p>
13511 </div>
13513 !! end
13515 !! test
13516 Paragraphs inside divs (extra line break on open and close)
13517 !! input
13518 <div>
13519 Line one
13521 Line two
13522 </div>
13523 !! result
13524 <div>
13525 <p>Line one
13526 </p><p>Line two
13527 </p>
13528 </div>
13530 !! end
13532 !! test
13533 Nesting tags, paragraphs on lines which begin with <div>
13534 !! options
13535 disabled
13536 !! input
13537 <div></div><strong>A
13538 B</strong>
13539 !! result
13540 <div></div>
13541 <p><strong>A
13542 B</strong>
13543 </p>
13544 !! end
13546 # Bug 6200: <blockquote> should behave like <div> with respect to line breaks
13547 !! test
13548 Bug 6200: paragraphs inside blockquotes (no extra line breaks)
13549 !! options
13550 disabled
13551 !! input
13552 <blockquote>Line one
13554 Line two</blockquote>
13555 !! result
13556 <blockquote>Line one
13557 Line two</blockquote>
13559 !! end
13561 !! test
13562 Bug 6200: paragraphs inside blockquotes (extra line break on open)
13563 !! options
13564 disabled
13565 !! input
13566 <blockquote>
13567 Line one
13569 Line two</blockquote>
13570 !! result
13571 <blockquote>
13572 <p>Line one
13573 </p>
13574 Line two</blockquote>
13576 !! end
13578 !! test
13579 Bug 6200: paragraphs inside blockquotes (extra line break on close)
13580 !! options
13581 disabled
13582 !! input
13583 <blockquote>Line one
13585 Line two
13586 </blockquote>
13587 !! result
13588 <blockquote>Line one
13589 <p>Line two
13590 </p>
13591 </blockquote>
13593 !! end
13595 !! test
13596 Bug 6200: paragraphs inside blockquotes (extra line break on open and close)
13597 !! options
13598 disabled
13599 !! input
13600 <blockquote>
13601 Line one
13603 Line two
13604 </blockquote>
13605 !! result
13606 <blockquote>
13607 <p>Line one
13608 </p><p>Line two
13609 </p>
13610 </blockquote>
13612 !! end
13614 !! test
13615 Paragraphs inside blockquotes/divs (no extra line breaks)
13616 !! input
13617 <blockquote><div>Line one
13619 Line two</div></blockquote>
13620 !! result
13621 <blockquote><div>Line one
13622 Line two</div></blockquote>
13624 !! end
13626 !! test
13627 Paragraphs inside blockquotes/divs (extra line break on open)
13628 !! input
13629 <blockquote><div>
13630 Line one
13632 Line two</div></blockquote>
13633 !! result
13634 <blockquote><div>
13635 <p>Line one
13636 </p>
13637 Line two</div></blockquote>
13639 !! end
13641 !! test
13642 Paragraphs inside blockquotes/divs (extra line break on close)
13643 !! input
13644 <blockquote><div>Line one
13646 Line two
13647 </div></blockquote>
13648 !! result
13649 <blockquote><div>Line one
13650 <p>Line two
13651 </p>
13652 </div></blockquote>
13654 !! end
13656 !! test
13657 Paragraphs inside blockquotes/divs (extra line break on open and close)
13658 !! input
13659 <blockquote><div>
13660 Line one
13662 Line two
13663 </div></blockquote>
13664 !! result
13665 <blockquote><div>
13666 <p>Line one
13667 </p><p>Line two
13668 </p>
13669 </div></blockquote>
13671 !! end
13673 !! test
13674 Interwiki links trounced by replaceExternalLinks after early LinkHolderArray expansion
13675 !! options
13676 wgLinkHolderBatchSize=0
13677 !! input
13678 [[meatball:1]]
13679 [[meatball:2]]
13680 [[meatball:3]]
13681 !! result
13682 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?1" class="extiw" title="meatball:1">meatball:1</a>
13683 <a href="http://www.usemod.com/cgi-bin/mb.pl?2" class="extiw" title="meatball:2">meatball:2</a>
13684 <a href="http://www.usemod.com/cgi-bin/mb.pl?3" class="extiw" title="meatball:3">meatball:3</a>
13685 </p>
13686 !! end
13688 !! test
13689 Free external link invading image caption
13690 !! input
13691 [[Image:Foobar.jpg|thumb|http://x|hello]]
13692 !! result
13693 <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>
13695 !! end
13697 !! test
13698 Bug 15196: localised external link numbers
13699 !! options
13700 language=fa
13701 !! input
13702 [http://en.wikipedia.org/]
13703 !! result
13704 <p><a rel="nofollow" class="external autonumber" href="http://en.wikipedia.org/">[۱]</a>
13705 </p>
13706 !! end
13708 !! test
13709 Multibyte character in padleft
13710 !! input
13711 {{padleft:-Hello|7|Æ}}
13712 !! result
13713 <p>Æ-Hello
13714 </p>
13715 !! end
13717 !! test
13718 Multibyte character in padright
13719 !! input
13720 {{padright:Hello-|7|Æ}}
13721 !! result
13722 <p>Hello-Æ
13723 </p>
13724 !! end
13726 !!test
13727 formatdate parser function
13728 !!input
13729 {{#formatdate:2009-03-24}}
13730 !! result
13731 <p><span class="mw-formatted-date" title="2009-03-24">2009-03-24</span>
13732 </p>
13733 !! end
13735 !!test
13736 formatdate parser function, with default format
13737 !!input
13738 {{#formatdate:2009-03-24|mdy}}
13739 !! result
13740 <p><span class="mw-formatted-date" title="2009-03-24">March 24, 2009</span>
13741 </p>
13742 !! end
13744 !! test
13745 Spacing of numbers in formatted dates
13746 !! input
13747 {{#formatdate:January 15}}
13748 !! result
13749 <p><span class="mw-formatted-date" title="01-15">January 15</span>
13750 </p>
13751 !! end
13753 !! test
13754 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
13755 !! options
13756 language=nl title=[[MediaWiki:Common.css]]
13757 !! input
13758 {{#formatdate:2009-03-24|dmy}}
13759 !! result
13760 <p><span class="mw-formatted-date" title="2009-03-24">24 March 2009</span>
13761 </p>
13762 !! end
13769 # Edit comments
13772 !! test
13773 Edit comment with link
13774 !! options
13775 comment
13776 !! input
13777 I like the [[Main Page]] a lot
13778 !! result
13779 I like the <a href="/wiki/Main_Page" title="Main Page">Main Page</a> a lot
13780 !!end
13782 !! test
13783 Edit comment with link and link text
13784 !! options
13785 comment
13786 !! input
13787 I like the [[Main Page|best pages]] a lot
13788 !! result
13789 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
13790 !!end
13792 !! test
13793 Edit comment with link and link text with suffix
13794 !! options
13795 comment
13796 !! input
13797 I like the [[Main Page|best page]]s a lot
13798 !! result
13799 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
13800 !!end
13802 !! test
13803 Edit comment with section link (non-local, eg in history list)
13804 !! options
13805 comment title=[[Main Page]]
13806 !! input
13807 /* External links */ removed bogus entries
13808 !! result
13809 <a href="/wiki/Main_Page#External_links" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
13810 !!end
13812 !! test
13813 Edit comment with section link and text before it (non-local, eg in history list)
13814 !! options
13815 comment title=[[Main Page]]
13816 !! input
13817 pre-comment text /* External links */ removed bogus entries
13818 !! result
13819 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>
13820 !!end
13822 !! test
13823 Edit comment with section link (local, eg in diff view)
13824 !! options
13825 comment local title=[[Main Page]]
13826 !! input
13827 /* External links */ removed bogus entries
13828 !! result
13829 <a href="#External_links">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
13830 !!end
13832 !! test
13833 Edit comment with subpage link (bug 14080)
13834 !! options
13835 comment
13836 subpage
13837 title=[[Subpage test]]
13838 !! input
13839 Poked at a [[/subpage]] here...
13840 !! result
13841 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a> here...
13842 !!end
13844 !! test
13845 Edit comment with subpage link and link text (bug 14080)
13846 !! options
13847 comment
13848 subpage
13849 title=[[Subpage test]]
13850 !! input
13851 Poked at a [[/subpage|neat little page]] here...
13852 !! result
13853 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">neat little page</a> here...
13854 !!end
13856 !! test
13857 Edit comment with bogus subpage link in non-subpage NS (bug 14080)
13858 !! options
13859 comment
13860 title=[[Subpage test]]
13861 !! input
13862 Poked at a [[/subpage]] here...
13863 !! result
13864 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...
13865 !!end
13867 !! test
13868 Edit comment with bare anchor link (local, as on diff)
13869 !! options
13870 comment
13871 local
13872 title=[[Main Page]]
13873 !!input
13874 [[#section]]
13875 !! result
13876 <a href="#section">#section</a>
13877 !! end
13879 !! test
13880 Edit comment with bare anchor link (non-local, as on history)
13881 !! options
13882 comment
13883 title=[[Main Page]]
13884 !!input
13885 [[#section]]
13886 !! result
13887 <a href="/wiki/Main_Page#section" title="Main Page">#section</a>
13888 !! end
13890 !! test
13891 Anchor starting with underscore
13892 !!input
13893 [[#_ref|One]]
13894 !! result
13895 <p><a href="#_ref">One</a>
13896 </p>
13897 !! end
13899 !! test
13900 Id starting with underscore
13901 !!input
13902 <div id="_ref"></div>
13903 !! result
13904 <div id="_ref"></div>
13906 !! end
13908 !! test
13909 Space normalisation on autocomment (bug 22784)
13910 !! options
13911 comment
13912 title=[[Main Page]]
13913 !!input
13914 /* __hello__world__ */
13915 !! result
13916 <a href="/wiki/Main_Page#hello_world" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">__hello__world__</span></span>
13917 !! end
13919 !! test
13920 percent-encoding and + signs in comments (Bug 26410)
13921 !! options
13922 comment
13923 !!input
13924 [[ABC%33D% ++]] [[ABC%33D% ++|+%20]]
13925 !! result
13926 <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>
13927 !! end
13929 !! test
13930 Bad images - basic functionality
13931 !! options
13932 disabled
13933 !! input
13934 [[File:Bad.jpg]]
13935 !! result
13936 !! end
13938 !! test
13939 Bad images - bug 16039: text after bad image disappears
13940 !! options
13941 disabled
13942 !! input
13943 Foo bar
13944 [[File:Bad.jpg]]
13945 Bar foo
13946 !! result
13947 <p>Foo bar
13948 </p><p>Bar foo
13949 </p>
13950 !! end
13952 !! test
13953 Verify that displaytitle works (bug #22501) no displaytitle
13954 !! options
13955 showtitle
13956 !! config
13957 wgAllowDisplayTitle=true
13958 wgRestrictDisplayTitle=false
13959 !! input
13960 this is not the the title
13961 !! result
13962 Parser test
13963 <p>this is not the the title
13964 </p>
13965 !! end
13967 !! test
13968 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=false
13969 !! options
13970 showtitle
13971 title=[[Screen]]
13972 !! config
13973 wgAllowDisplayTitle=true
13974 wgRestrictDisplayTitle=false
13975 !! input
13976 this is not the the title
13977 {{DISPLAYTITLE:whatever}}
13978 !! result
13979 whatever
13980 <p>this is not the the title
13981 </p>
13982 !! end
13984 !! test
13985 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true mismatch
13986 !! options
13987 showtitle
13988 title=[[Screen]]
13989 !! config
13990 wgAllowDisplayTitle=true
13991 wgRestrictDisplayTitle=true
13992 !! input
13993 this is not the the title
13994 {{DISPLAYTITLE:whatever}}
13995 !! result
13996 Screen
13997 <p>this is not the the title
13998 </p>
13999 !! end
14001 !! test
14002 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true matching
14003 !! options
14004 showtitle
14005 title=[[Screen]]
14006 !! config
14007 wgAllowDisplayTitle=true
14008 wgRestrictDisplayTitle=true
14009 !! input
14010 this is not the the title
14011 {{DISPLAYTITLE:screen}}
14012 !! result
14013 screen
14014 <p>this is not the the title
14015 </p>
14016 !! end
14018 !! test
14019 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false
14020 !! options
14021 showtitle
14022 title=[[Screen]]
14023 !! config
14024 wgAllowDisplayTitle=false
14025 !! input
14026 this is not the the title
14027 {{DISPLAYTITLE:screen}}
14028 !! result
14029 Screen
14030 <p>this is not the the title
14031 <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>
14032 </p>
14033 !! end
14035 !! test
14036 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false no DISPLAYTITLE
14037 !! options
14038 showtitle
14039 title=[[Screen]]
14040 !! config
14041 wgAllowDisplayTitle=false
14042 !! input
14043 this is not the the title
14044 !! result
14045 Screen
14046 <p>this is not the the title
14047 </p>
14048 !! end
14050 !! test
14051 Verify that displaytitle handles inline CSS styles (bug 26547) - rejected value
14052 !! options
14053 showtitle
14054 title=[[Screen]]
14055 !! config
14056 wgAllowDisplayTitle=true
14057 wgRestrictDisplayTitle=true
14058 !! input
14059 this is not the the title
14060 {{DISPLAYTITLE:<span style="display: none;">s</span>creen}}
14061 !! result
14062 <span style="/* attempt to bypass $wgRestrictDisplayTitle */">s</span>creen
14063 <p>this is not the the title
14064 </p>
14065 !! end
14067 !! test
14068 Verify that displaytitle handles inline CSS styles (bug 26547) - accepted value
14069 !! options
14070 showtitle
14071 title=[[Screen]]
14072 !! config
14073 wgAllowDisplayTitle=true
14074 wgRestrictDisplayTitle=true
14075 !! input
14076 this is not the the title
14077 {{DISPLAYTITLE:<span style="color: red;">s</span>creen}}
14078 !! result
14079 <span style="color: red;">s</span>creen
14080 <p>this is not the the title
14081 </p>
14082 !! end
14084 !! test
14085 preload: check <noinclude> and <includeonly>
14086 !! options
14087 preload
14088 !! input
14089 Hello <noinclude>cruel</noinclude><includeonly>kind</includeonly> world.
14090 !! result
14091 Hello kind world.
14092 !! end
14094 !! test
14095 preload: check <onlyinclude>
14096 !! options
14097 preload
14098 !! input
14099 Goodbye <onlyinclude>Hello world</onlyinclude>
14100 !! result
14101 Hello world
14102 !! end
14104 !! test
14105 preload: can pass tags through if we want to
14106 !! options
14107 preload
14108 !! input
14109 <includeonly><</includeonly>includeonly>Hello world<includeonly><</includeonly>/includeonly>
14110 !! result
14111 <includeonly>Hello world</includeonly>
14112 !! end
14114 !! test
14115 preload: check that it doesn't try to do tricks
14116 !! options
14117 preload
14118 !! input
14119 * <!-- Hello --> ''{{world}}'' {{<includeonly>subst:</includeonly>How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
14120 !! result
14121 * <!-- Hello --> ''{{world}}'' {{subst:How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
14122 !! end
14124 !! test
14125 Play a bit with r67090 and bug 3158
14126 !! options
14127 disabled
14128 !! input
14129 <div style="width:50% !important">&nbsp;</div>
14130 <div style="width:50%&nbsp;!important">&nbsp;</div>
14131 <div style="width:50%&#160;!important">&nbsp;</div>
14132 <div style="border : solid;">&nbsp;</div>
14133 !! result
14134 <div style="width:50% !important">&nbsp;</div>
14135 <div style="width:50% !important">&nbsp;</div>
14136 <div style="width:50% !important">&nbsp;</div>
14137 <div style="border&#160;: solid;">&nbsp;</div>
14139 !! end
14141 !! test
14142 HTML5 data attributes
14143 !! input
14144 <span data-foo="bar">Baz</span>
14145 <p data-abc-def_hij="">Quuz</p>
14146 !! result
14147 <p><span data-foo="bar">Baz</span>
14148 </p>
14149 <p data-abc-def_hij="">Quuz</p>
14151 !! end
14153 !! test
14154 percent-encoding and + signs in internal links (Bug 26410)
14155 !! input
14156 [[User:+%]] [[Page+title%]]
14157 [[%+]] [[%+|%20]] [[%+ ]] [[%+r]]
14158 [[%]] [[+]] [[image:%+abc%39|foo|[[bar]]]]
14159 [[%33%45]] [[%33%45+]]
14160 !! result
14161 <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>
14162 <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>
14163 <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>
14164 <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>
14165 </p>
14166 !! end
14168 !! test
14169 Special characters in embedded file links (bug 27679)
14170 !! input
14171 [[File:Contains & ampersand.jpg]]
14172 [[File:Does not exist.jpg|Title with & ampersand]]
14173 !! result
14174 <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>
14175 <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>
14176 </p>
14177 !! end
14180 !! test
14181 Confirm that 'apos' named character reference doesn't make it to output (not legal in HTML 4)
14182 !! input
14183 Text&apos;s been normalized?
14184 !! result
14185 <p>Text&#39;s been normalized?
14186 </p>
14187 !! end
14189 !! test
14190 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate free external links
14191 !! input
14192 http://www.example.org/ <-- U+3000 (vim: ^Vu3000)
14193 !! result
14194 <p><a rel="nofollow" class="external free" href="http://www.example.org/">http://www.example.org/</a> &lt;-- U+3000 (vim: ^Vu3000)
14195 </p>
14196 !! end
14198 !! test
14199 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate bracketed external links
14200 !! input
14201 [http://www.example.org/ ideograms]
14202 !! result
14203 <p><a rel="nofollow" class="external text" href="http://www.example.org/">ideograms</a>
14204 </p>
14205 !! end
14207 !! test
14208 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate external images links
14209 !! input
14210 http://www.example.org/pic.png <-- U+3000 (vim: ^Vu3000)
14211 !! result
14212 <p><img src="http://www.example.org/pic.png" alt="pic.png" /> &lt;-- U+3000 (vim: ^Vu3000)
14213 </p>
14214 !! end
14216 !! article
14217 Mediawiki:loop1
14218 !! text
14219 {{Identical|A}}
14220 !! endarticle
14222 !! article
14223 Mediawiki:loop2
14224 !! text
14225 {{Identical|B}}
14226 !! endarticle
14228 !! article
14229 Template:Identical
14230 !! text
14231 {{int:loop1}}
14232 {{int:loop2}}
14233 !! endarticle
14235 !! test
14236 Bug 31098 Template which includes system messages which includes the template
14237 !! input
14238 {{Identical}}
14239 !! result
14240 <p><span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
14241 <span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
14242 </p>
14243 !! end
14245 !! test
14246 Bug31490 Turkish: ucfirst 'blah'
14247 !! options
14248 language=tr
14249 !! input
14250 {{ucfirst:blah}}
14251 !! result
14252 <p>Blah
14253 </p>
14254 !! end
14256 !! test
14257 Bug31490 Turkish: ucfirst 'ix'
14258 !! options
14259 language=tr
14260 !! input
14261 {{ucfirst:ix}}
14262 !! result
14263 <p>İx
14264 </p>
14265 !! end
14267 !! test
14268 Bug31490 Turkish: lcfirst 'BLAH'
14269 !! options
14270 language=tr
14271 !! input
14272 {{lcfirst:BLAH}}
14273 !! result
14274 <p>bLAH
14275 </p>
14276 !! end
14278 !! test
14279 Bug31490 Turkish: ucfırst (with a dotless i)
14280 !! options
14281 language=tr
14282 !! input
14283 {{ucfırst:blah}}
14284 !! result
14285 <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>
14286 </p>
14287 !! end
14289 !! test
14290 Bug31490 ucfırst (with a dotless i) with English language
14291 !! options
14292 language=en
14293 !! input
14294 {{ucfırst:blah}}
14295 !! result
14296 <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>
14297 </p>
14298 !! end
14300 !! test
14301 Bug 26375: TOC with italics
14302 !! options
14303 title=[[Main Page]]
14304 !! input
14305 __TOC__
14306 == ''Lost'' episodes ==
14307 !! result
14308 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14309 <ul>
14310 <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>
14311 </ul>
14312 </div>
14313 <h2><span class="mw-headline" id="Lost_episodes"><i>Lost</i> episodes</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Main_Page&amp;action=edit&amp;section=1" title="Edit section: Lost episodes">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
14315 !! end
14317 !! test
14318 Bug 26375: TOC with bold
14319 !! options
14320 title=[[Main Page]]
14321 !! input
14322 __TOC__
14323 == '''should be bold''' then normal text ==
14324 !! result
14325 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14326 <ul>
14327 <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>
14328 </ul>
14329 </div>
14330 <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"><span class="mw-editsection-bracket">[</span><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 class="mw-editsection-bracket">]</span></span></h2>
14332 !! end
14334 !! test
14335 Bug 33845: Headings become cursive in TOC when they contain an image
14336 !! options
14337 title=[[Main Page]]
14338 !! input
14339 __TOC__
14340 == Image [[Image:foobar.jpg]] ==
14341 !! result
14342 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14343 <ul>
14344 <li class="toclevel-1 tocsection-1"><a href="#Image"><span class="tocnumber">1</span> <span class="toctext">Image</span></a></li>
14345 </ul>
14346 </div>
14347 <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"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Main_Page&amp;action=edit&amp;section=1" title="Edit section: Image">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
14349 !! end
14351 !! test
14352 Bug 33845 (2): Headings become bold in TOC when they contain a blockquote
14353 !! options
14354 title=[[Main Page]]
14355 !! input
14356 __TOC__
14357 == <blockquote>Quote</blockquote> ==
14358 !! result
14359 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14360 <ul>
14361 <li class="toclevel-1 tocsection-1"><a href="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
14362 </ul>
14363 </div>
14364 <h2><span class="mw-headline" id="Quote"><blockquote>Quote</blockquote></span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Main_Page&amp;action=edit&amp;section=1" title="Edit section: Quote">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
14366 !! end
14368 !! test
14369 Unclosed tags in TOC
14370 !! options
14371 title=[[Main Page]]
14372 !! input
14373 __TOC__
14374 == Proof: 2 < 3 ==
14375 <small>Hanc marginis exiguitas non caperet.</small>
14377 !! result
14378 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14379 <ul>
14380 <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>
14381 </ul>
14382 </div>
14383 <h2><span class="mw-headline" id="Proof:_2_.3C_3">Proof: 2 &lt; 3</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Main_Page&amp;action=edit&amp;section=1" title="Edit section: Proof: 2 &lt; 3">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
14384 <p><small>Hanc marginis exiguitas non caperet.</small>
14386 </p>
14387 !! end
14389 !! test
14390 Multiple tags in TOC
14391 !! input
14392 __TOC__
14393 == <i>Foo</i> <b>Bar</b> ==
14395 == <i>Foo</i> <blockquote>Bar</blockquote> ==
14396 !! result
14397 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14398 <ul>
14399 <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>
14400 <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>
14401 </ul>
14402 </div>
14403 <h2><span class="mw-headline" id="Foo_Bar"><i>Foo</i> <b>Bar</b></span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: Foo Bar">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
14404 <h2><span class="mw-headline" id="Foo_Bar_2"><i>Foo</i> <blockquote>Bar</blockquote></span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: Foo Bar">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
14406 !! end
14408 !! test
14409 Tags with parameters in TOC
14410 !! input
14411 __TOC__
14412 == <sup class="in-h2">Hello</sup> ==
14414 == <sup class="a > b">Evilbye</sup> ==
14415 !! result
14416 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14417 <ul>
14418 <li class="toclevel-1 tocsection-1"><a href="#Hello"><span class="tocnumber">1</span> <span class="toctext"><sup>Hello</sup></span></a></li>
14419 <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>
14420 </ul>
14421 </div>
14422 <h2><span class="mw-headline" id="Hello"><sup class="in-h2">Hello</sup></span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: Hello">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
14423 <h2><span class="mw-headline" id="b.22.3EEvilbye"><sup> b"&gt;Evilbye</sup></span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: b&quot;>Evilbye">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
14425 !! end
14427 !! test
14428 span tags with directionality in TOC
14429 !! input
14430 __TOC__
14431 == <span dir="ltr">C++</span> ==
14433 == <span dir="rtl">זבנג!</span> ==
14435 == <span style="font-style: italic">The attributes on these span tags must be deleted from the TOC</span> ==
14437 == <span style="font-style: italic" dir="ltr">All attributes on these span tags must be deleted from the TOC</span> ==
14439 == <span dir="ltr" style="font-style: italic">Attributes after dir on these span tags must be deleted from the TOC</span> ==
14440 !! result
14441 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14442 <ul>
14443 <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>
14444 <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>
14445 <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>
14446 <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>
14447 <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>
14448 </ul>
14449 </div>
14450 <h2><span class="mw-headline" id="C.2B.2B"><span dir="ltr">C++</span></span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: C++">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
14451 <h2><span class="mw-headline" id=".D7.96.D7.91.D7.A0.D7.92.21"><span dir="rtl">זבנג!</span></span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: זבנג!">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
14452 <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"><span class="mw-editsection-bracket">[</span><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 class="mw-editsection-bracket">]</span></span></h2>
14453 <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"><span class="mw-editsection-bracket">[</span><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 class="mw-editsection-bracket">]</span></span></h2>
14454 <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"><span class="mw-editsection-bracket">[</span><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 class="mw-editsection-bracket">]</span></span></h2>
14456 !! end
14458 !! article
14459 MediaWiki:Bug32057
14460 !! text
14461 == {{int:headline_sample}} ==
14462 !! endarticle
14464 !! test
14465 Bug 32057: Title needed when expanding <h> nodes.
14466 !! options
14467 title=[[Main Page]]
14468 !! input
14469 {{int:Bug32057}}
14470 !! result
14471 <h2><span class="mw-headline" id="Headline_text">Headline text</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Main_Page&amp;action=edit&amp;section=1" title="Edit section: Headline text">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
14473 !! end
14475 !! test
14476 Strip marker in urlencode
14477 !! input
14478 {{urlencode:x<nowiki/>y}}
14479 {{urlencode:x<nowiki/>y|wiki}}
14480 {{urlencode:x<nowiki/>y|path}}
14481 !! result
14482 <p>xy
14485 </p>
14486 !! end
14488 !! test
14489 Strip marker in lc
14490 !! input
14491 {{lc:x<nowiki/>y}}
14492 !! result
14493 <p>xy
14494 </p>
14495 !! end
14497 !! test
14498 Strip marker in uc
14499 !! input
14500 {{uc:x<nowiki/>y}}
14501 !! result
14502 <p>XY
14503 </p>
14504 !! end
14506 !! test
14507 Strip marker in formatNum
14508 !! input
14509 {{formatnum:1<nowiki/>2}}
14510 {{formatnum:1<nowiki/>2|R}}
14511 !! result
14512 <p>12
14514 </p>
14515 !! end
14517 !! test
14518 Check noCommafy in formatNum
14519 !! options
14520 language=be-tarask
14521 !! input
14522 {{formatnum:123456.78}}
14523 {{formatnum:123456.78|NOSEP}}
14524 !! result
14525 <p>123 456,78
14526 123456.78
14527 </p>
14528 !! end
14530 !! test
14531 Strip marker in grammar
14532 !! options
14533 language=fi
14534 !! input
14535 {{grammar:elative|foo<nowiki/>bar}}
14536 !! result
14537 <p>foobarista
14538 </p>
14539 !! end
14541 !! test
14542 Strip marker in padleft
14543 !! input
14544 {{padleft:|2|x<nowiki/>y}}
14545 !! result
14546 <p>xy
14547 </p>
14548 !! end
14550 !! test
14551 Strip marker in padright
14552 !! input
14553 {{padright:|2|x<nowiki/>y}}
14554 !! result
14555 <p>xy
14556 </p>
14557 !! end
14559 !! test
14560 Strip marker in anchorencode
14561 !! input
14562 {{anchorencode:x<nowiki/>y}}
14563 !! result
14564 <p>xy
14565 </p>
14566 !! end
14568 !! test
14569 nowiki inside link inside heading (bug 18295)
14570 !! input
14571 ==[[foo|x<nowiki>y</nowiki>z]]==
14572 !! result
14573 <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"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: xyz">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
14575 !! end
14577 !! test
14578 new support for bdi element (bug 31817)
14579 !! input
14580 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
14581 !! result
14582 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
14584 !!end
14586 !! test
14587 Ignore pipe between table row attributes
14588 !! input
14590 | quux
14591 |- id=foo | style='color: red'
14592 | bar
14594 !! result
14595 <table>
14596 <tr>
14597 <td> quux
14598 </td></tr>
14599 <tr id="foo" style="color: red">
14600 <td> bar
14601 </td></tr></table>
14603 !! end
14605 !!test
14606 Gallery override link with WikiLink (bug 34852)
14607 !! input
14608 <gallery>
14609 File:foobar.jpg|caption|alt=galleryalt|link=InterWikiLink
14610 </gallery>
14611 !! result
14612 <ul class="gallery">
14613                 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
14614                         <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>
14615                         <div class="gallerytext">
14616 <p>caption
14617 </p>
14618                         </div>
14619                 </div></li>
14620 </ul>
14622 !! end
14624 !!test
14625 Gallery override link with absolute external link (bug 34852)
14626 !! input
14627 <gallery>
14628 File:foobar.jpg|caption|alt=galleryalt|link=http://www.example.org
14629 </gallery>
14630 !! result
14631 <ul class="gallery">
14632                 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
14633                         <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>
14634                         <div class="gallerytext">
14635 <p>caption
14636 </p>
14637                         </div>
14638                 </div></li>
14639 </ul>
14641 !! end
14643 !!test
14644 Gallery override link with malicious javascript (bug 34852)
14645 !! input
14646 <gallery>
14647 File:foobar.jpg|caption|alt=galleryalt|link=" onclick="alert('malicious javascript code!');
14648 </gallery>
14649 !! result
14650 <ul class="gallery">
14651                 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
14652                         <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>
14653                         <div class="gallerytext">
14654 <p>caption
14655 </p>
14656                         </div>
14657                 </div></li>
14658 </ul>
14660 !! end
14662 !!test
14663 Gallery with invalid title as link (bug 43964)
14664 !! input
14665 <gallery>
14666 File:foobar.jpg|link=<
14667 </gallery>
14668 !! result
14669 <ul class="gallery">
14670                 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
14671                         <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>
14672                         <div class="gallerytext">
14673                         </div>
14674                 </div></li>
14675 </ul>
14677 !! end
14679 !!test
14680 Language parser function
14681 !! input
14682 {{#language:ar}}
14683 !! result
14684 <p>العربية
14685 </p>
14686 !! end
14688 !!test
14689 Padleft and padright as substr
14690 !! input
14691 {{padleft:|3|abcde}}
14692 {{padright:|3|abcde}}
14693 !! result
14694 <p>abc
14696 </p>
14697 !! end
14699 !!test
14700 Special parser function
14701 !! input
14702 {{#special:RandomPage}}
14703 {{#special:BaDtItLe}}
14704 {{#special:Foobar}}
14705 !! result
14706 <p>Special:Random
14707 Special:Badtitle
14708 Special:Foobar
14709 </p>
14710 !! end
14712 !!test
14713 Bug 34939 - Case insensitive link parsing ([HttP://])
14714 !! input
14715 [HttP://MediaWiki.Org/]
14716 !! result
14717 <p><a rel="nofollow" class="external autonumber" href="HttP://MediaWiki.Org/">[1]</a>
14718 </p>
14719 !! end
14721 !!test
14722 Bug 34939 - Case insensitive link parsing ([HttP:// title])
14723 !! input
14724 [HttP://MediaWiki.Org/ MediaWiki]
14725 !! result
14726 <p><a rel="nofollow" class="external text" href="HttP://MediaWiki.Org/">MediaWiki</a>
14727 </p>
14728 !! end
14730 !!test
14731 Bug 34939 - Case insensitive link parsing (HttP://)
14732 !! input
14733 HttP://MediaWiki.Org/
14734 !! result
14735 <p><a rel="nofollow" class="external free" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a>
14736 </p>
14737 !! end
14741 ### Parsoids-specific tests
14742 ### Parsoid-PHP parser incompatibilities
14744 !!test
14745 1. SOL-sensitive wikitext tokens as template-args
14746 !!options
14747 parsoid=wt2html,wt2wt
14748 !!input
14749 {{echo|*a}}
14750 {{echo|#a}}
14751 {{echo|:a}}
14752 !!result
14753 <span about="#mwt1" typeof="mw:Transclusion">
14754 </span><ul about="#mwt1"><li>a</li></ul>
14755 <span about="#mwt2" typeof="mw:Transclusion">
14756 </span><ol about="#mwt2"><li>a</li></ol>
14757 <span about="#mwt3" typeof="mw:Transclusion">
14758 </span><dl about="#mwt3"><dd>a</dd></dl>
14759 !!end
14761 #### ----------------------------------------------------------------
14762 #### Parsoid-only testing of Parsoid's impl of <ref> and <references>
14763 #### tags. Parsoid's output for these tags differs from that of the
14764 #### PHP parser.
14765 #### ----------------------------------------------------------------
14767 !!test
14768 Ref: 1. ref-location should be replaced with an index span
14769 !!options
14770 parsoid
14771 !!input
14772 A <ref>foo</ref>
14773 B <ref name="x">foo</ref>
14774 C <ref name="y" />
14775 !!result
14776 <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>
14777 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>
14778 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>
14779 !!end
14781 !!test
14782 Ref: 2. ref-tags with identical names should all get the same index
14783 !!options
14784 parsoid
14785 !!input
14786 A <ref name="x">foo</ref>
14787 B <ref name="x" />
14788 !!result
14789 <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>
14790 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>
14791 !!end
14793 !!test
14794 Ref: 3. spaces in ref-names should be ignored
14795 !!options
14796 parsoid
14797 !!input
14798 A <ref name="x">foo</ref>
14799 B <ref name=" x " />
14800 C <ref name= x  />
14801 !!result
14802 <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>
14803 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>
14804 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>
14805 !!end
14807 !!test
14808 Ref: 4. 'constructor' should be accepted as a valid ref-name
14809 (NOTE: constructor is a predefined property in JS and constructor as a ref-name can clash with it if not handled properly)
14810 !!options
14811 parsoid
14812 !!input
14813 A <ref name="constructor">foo</ref>
14814 !!result
14815 <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>
14816 !!end
14818 !!test
14819 Ref: 5. body should accept generic wikitext
14820 !!options
14821 parsoid
14822 !!input
14823 A <ref>
14824  This is a '''[[bolded link]]''' and this is a {{echo|transclusion}}
14825 </ref>
14827 <references />
14828 !!result
14829 <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>
14831 <ol about="#mwt2" class="references" data-mw='{"name":"references","attrs":{}}' typeof="mw:Extension/references">
14832 <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>
14833 </li></ol>
14834 !!end
14836 !!test
14837 Ref: 6. indent-pres should not be output in ref-body
14838 !!options
14839 parsoid
14840 !!input
14841 A <ref>
14842  foo
14843  bar
14844  baz
14845 </ref>
14847 <references />
14848 !!result
14849 <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>
14851 <ol about="#mwt2" class="references" data-mw='{"name":"references","attrs":{}}' typeof="mw:Extension/references">
14852 <li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> foo
14853  bar
14854  baz
14855 </li></ol>
14856 !!end
14858 !!test
14859 Ref: 6. No p-wrapping in ref-body
14860 !!options
14861 parsoid
14862 !!input
14863 A <ref>
14873 booz
14874 </ref>
14876 <references />
14877 !!result
14878 <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>
14880 <ol about="#mwt2" class="references" data-mw='{"name":"references","attrs":{}}' typeof="mw:Extension/references">
14881 <li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> foo
14890 booz
14891 </li></ol>
14892 !!end
14894 !!test
14895 Ref: 8. transclusion wikitext has lower precedence
14896 !!options
14897 parsoid
14898 !!input
14899 A <ref> foo {{echo|</ref> B C}}
14901 <references />
14902 !!result
14903 <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>
14905 <ol about="#mwt2" class="references" data-mw='{"name":"references","attrs":{}}' typeof="mw:Extension/references">
14906 <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>
14907 !!end
14909 !!test
14910 Ref: 9. unclosed comments should not leak out of ref-body
14911 !!options
14912 parsoid
14913 !!input
14914 A <ref> foo <!--</ref> B C
14916 <references />
14917 !!result
14918 <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>
14920 <ol about="#mwt2" class="references" data-mw='{"name":"references","attrs":{}}' typeof="mw:Extension/references">
14921 <li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> foo <!----></li></ol>
14922 !!end
14924 !!test
14925 Ref: 10. Unclosed HTML tags should not leak out of ref-body
14926 !!options
14927 parsoid
14928 !!input
14929 A <ref> <b> foo </ref> B C
14931 <references />
14932 !!result
14933 <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>
14935 <ol about="#mwt2" class="references" data-mw='{"name":"references","attrs":{}}' typeof="mw:Extension/references">
14936 <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>
14937 !!end
14939 !!test
14940 Ref: 11. ref-tags acts like an inline element wrt P-wrapping
14941 !!options
14942 parsoid
14943 !!input
14944 A <ref>foo</ref> B
14945 C <ref>bar</ref> D
14946 !!result
14947 <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
14948 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>
14949 !!end
14951 !!test
14952 Ref: 12. ref-tags act as trailing newline migration barrier
14953 !!options
14954 parsoid
14955 !!input
14956 <!--the newline at the end of this line moves out of the p-tag-->a
14958 b<!--the newline at the end of this line stays inside the p-tag--> <ref />
14959 <ref />
14962 !!result
14963 <p><!--the newline at the end of this line moves out of the p-tag-->a</p>
14966 <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>
14967 <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>
14970 <p>c</p>
14971 !!end
14973 !!test
14974 Ref: 13. ref-tags are not SOL-transparent and block indent-pres
14975 !!options
14976 parsoid
14977 !!input
14978 <ref>foo</ref> A
14979 <ref>bar
14980 </ref> B
14981 !!result
14982 <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
14983 <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>
14984 !!end
14986 !!test
14987 Ref: 14. A nested ref-tag should be emitted as plain text
14988 !!options
14989 parsoid
14990 !!input
14991 <ref>foo <ref>bar</ref> baz</ref>
14993 <references />
14994 !!result
14995 <span about="#mwt1" class="reference" data-mw="{&quot;name&quot;:&quot;ref&quot;,&quot;body&quot;:{&quot;html&quot;:&quot;foo &amp;lt;ref&amp;gt;bar&amp;lt;/ref&amp;gt; baz&quot;},&quot;attrs&quot;:{}}" id="cite_ref-1-0" rel="dc:references" typeof="mw:Extension/ref"><a href="#cite_note-1">[1]</a></span>
14997 <ol class="references" typeof="mw:Extension/references" about="#mwt2" data-mw="{&quot;name&quot;:&quot;references&quot;,&quot;attrs&quot;:{}}">
14998 <li about="#cite_note-1" id="cite_note-1" data-parsoid="{}"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> foo &lt;ref&gt;bar&lt;/ref&gt; baz</li></ol>
14999 !!end
15001 !!test
15002 Ref: 15. ref-tags with identical names should get identical indexes
15003 !!options
15004 parsoid
15005 !!input
15006 A1 <ref name="a">foo</ref> A2 <ref name="a" />
15007 B1 <ref name="b" /> B2 <ref name="b">bar</ref>
15009 <references />
15010 !!result
15011 <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>
15012 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>
15014 <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>
15015 !!end
15017 !!test
15018 References: 1. references tag without any refs should be handled properly
15019 !!options
15020 parsoid
15021 !!input
15022 <references />
15023 !!result
15024 <ol about="#mwt2" class="references" data-mw='{"name":"references","attrs":{}}' typeof="mw:Extension/references"></ol>
15025 !!end
15027 !!test
15028 References: 2. references tag with group only outputs references from that group
15029 !!options
15030 parsoid
15031 !!input
15032 A <ref group="a">foo</ref>
15033 B <ref group="b">bar</ref>
15035 <references group='a' />
15036 !!result
15037 <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>
15038 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>
15040 <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>
15041 !!end
15043 !!test
15044 References: 3. ref list should be cleared after processing references
15045 !!options
15046 parsoid
15047 !!input
15048 A <ref>foo</ref>
15050 <references />
15052 B <ref>bar</ref>
15054 <references />
15055 !!result
15056 <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>
15058 <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>
15060 <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>
15062 <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>
15063 !!end
15065 !!test
15066 References: 4. only referenced group should be cleared after processing references
15067 !!options
15068 parsoid
15069 !!input
15070 A <ref group="a">afoo</ref>
15071 B <ref>bfoo</ref>
15073 <references group="a"/>
15075 C <ref>cfoo</ref>
15077 <references />
15078 !!result
15079 <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>
15080 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>
15082 <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>
15084 <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>
15086 <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>
15087 !!end
15089 !!test
15090 References: 5. ref tags in references should be processed while ignoring all other content
15091 !!options
15092 parsoid
15093 !!input
15094 A <ref name="a" />
15095 B <ref name="b">bar</ref>
15097 <references>
15098 <ref name="a">foo</ref>
15099 This should just get lost.
15100 </references>
15101 !!result
15102 <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>
15103 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>
15105 <ol class="references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","body":{"extsrc":"<ref name=\"a\">foo</ref>\nThis should just get lost.","html":"<span about=\"#mwt8\" class=\"reference\" data-mw=\"{&amp;quot;name&amp;quot;:&amp;quot;ref&amp;quot;,&amp;quot;body&amp;quot;:{&amp;quot;html&amp;quot;:&amp;quot;foo&amp;quot;},&amp;quot;attrs&amp;quot;:{&amp;quot;name&amp;quot;:&amp;quot;a&amp;quot;}}\" rel=\"dc:references\" typeof=\"mw:Extension/ref\"><a href=\"#cite_note-a-1\">[1]</a></span>"},"attrs":{}}'><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>
15106 !!end
15108 !!test
15109 References: 6. <references /> from a transclusion
15110 !!options
15111 parsoid
15112 !!input
15113 {{echo|<references />}}
15114 !!result
15115 <ol class="references" about="#mwt2" typeof="mw:Transclusion" data-mw='{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"<references />"}},"i":0}'></ol>
15116 !!end
15118 !! test
15119 References: 7. Multiple references tags (one without and one with nested refs) should be correctly handled
15120 !! options
15121 parsoid
15122 !! input
15123 A <ref>foo bar for a</ref>
15124 B <ref name="b" />
15126 <references />
15128 <references>
15129 <ref name="b">foo</ref>
15130 </references>
15131 !! result
15132 <p>A <span about="#mwt2" class="reference" data-mw='{"name":"ref","body":{"html":"foo bar for a"},"attrs":{}}' id="cite_ref-1-0" rel="dc:references" typeof="mw:Extension/ref"><a href="#cite_note-1">[1]</a></span>
15133 B <span about="#mwt4" 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></p>
15135 <ol class="references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'><li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> foo bar for a</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> </li></ol>
15137 <ol class="references" typeof="mw:Extension/references" about="#mwt8" data-mw='{"name":"references","body":{"extsrc":"<ref name=\"b\">foo</ref>","html":"\n<span about=\"#mwt10\" class=\"reference\" data-mw=\"{&amp;quot;name&amp;quot;:&amp;quot;ref&amp;quot;,&amp;quot;body&amp;quot;:{&amp;quot;html&amp;quot;:&amp;quot;foo&amp;quot;},&amp;quot;attrs&amp;quot;:{&amp;quot;name&amp;quot;:&amp;quot;b&amp;quot;}}\" rel=\"dc:references\" typeof=\"mw:Extension/ref\"><a href=\"#cite_note-b-1\">[1]</a></span>\n"},"attrs":{}}'><li about="#cite_note-b-1" id="cite_note-b-1"><span rel="mw:referencedBy">↑</span> foo</li></ol>
15139 !! end
15141 #### ----------------------------------------------------------------
15142 #### The following section of tests are primarily to test
15143 #### wikitext escaping capabilities of Parsoid.  Given that
15144 #### escaping can be done any number of ways, the wikitext (input)
15145 #### is always adjusted to reflect how Parsoid adds nowiki
15146 #### escape tags.
15147 ####
15148 #### We are marking several tests as parsoid-only since the
15149 #### HTML in the result section is different from what the
15150 #### PHP parser generates for it.
15151 #### ----------------------------------------------------------------
15154 #### --------------- Headings ---------------
15155 #### 0. Unnested
15156 #### 1. Nested inside html <h1>=foo=</h1>
15157 #### 2. Outside heading nest on a single line <h1>foo</h1>*bar
15158 #### 3. Nested inside html with wikitext split by html tags
15159 #### 4. No escape needed
15160 #### 5. Empty headings <h1></h1>
15161 #### 6. Heading chars in SOL context
15162 #### ----------------------------------------
15163 !! test
15164 Headings: 0. Unnested
15165 !! options
15166 parsoid
15167 !! input
15168 <nowiki>=foo=</nowiki>
15170 <nowiki> =foo= </nowiki>
15171 <!--cmt-->
15172 <nowiki>=foo=</nowiki>
15174 =foo''a''<nowiki>=</nowiki>
15175 !! result
15176 <p><span typeof="mw:Nowiki">=foo=</span></p>
15178 <p><span typeof="mw:Nowiki"> =foo= </span>
15179 <!--cmt-->
15180 <span typeof="mw:Nowiki">=foo=</span></p>
15182 <p>=foo<i>a</i><span typeof="mw:Nowiki">=</span></p>
15183 !!end
15185 !! test
15186 Headings: 1. Nested inside html
15187 !! options
15188 parsoid
15189 !! input
15190 =<nowiki>=foo=</nowiki>=
15192 ==<nowiki>=foo=</nowiki>==
15194 ===<nowiki>=foo=</nowiki>===
15196 ====<nowiki>=foo=</nowiki>====
15198 =====<nowiki>=foo=</nowiki>=====
15200 ======<nowiki>=foo=</nowiki>======
15201 !! result
15202 <h1><span typeof="mw:Nowiki">=foo=</span></h1>
15203 <h2><span typeof="mw:Nowiki">=foo=</span></h2>
15204 <h3><span typeof="mw:Nowiki">=foo=</span></h3>
15205 <h4><span typeof="mw:Nowiki">=foo=</span></h4>
15206 <h5><span typeof="mw:Nowiki">=foo=</span></h5>
15207 <h6><span typeof="mw:Nowiki">=foo=</span></h6>
15208 !!end
15210 !! test
15211 Headings: 2. Outside heading nest on a single line <h1>foo</h1>*bar
15212 !! options
15213 parsoid
15214 !! input
15215 =foo=
15216 <nowiki>*</nowiki>bar
15218 =foo=
15219 =bar
15221 =foo=
15222 <nowiki>=bar=</nowiki>
15223 !! result
15224 <h1>foo</h1>*bar
15225 <h1>foo</h1>=bar
15226 <h1>foo</h1>=bar=
15227 !!end
15229 !! test
15230 Headings: 3. Nested inside html with wikitext split by html tags
15231 !! options
15232 parsoid
15233 !! input
15234 =='''bold'''<nowiki>foo=</nowiki>=
15235 !! result
15236 <h1>=<b>bold</b><span typeof="mw:Nowiki">foo=</span></h1>
15237 !!end
15239 !! test
15240 Headings: 4a. No escaping needed (testing just h1 and h2)
15241 !! options
15242 parsoid
15243 !! input
15244 ==foo=
15246 =foo==
15248 = =foo= =
15250 ==foo= bar=
15252 ===foo==
15254 ==foo===
15256 =''=''foo==
15258 =<nowiki>=</nowiki>=
15259 !! result
15260 <h1>=foo</h1>
15261 <h1>foo=</h1>
15262 <h1> =foo= </h1>
15263 <h1>=foo= bar</h1>
15264 <h2>=foo</h2>
15265 <h2>foo=</h2>
15266 <h1><i>=</i>foo=</h1>
15267 <h1><span typeof="mw:Nowiki">=</span></h1>
15268 !!end
15270 !! test
15271 Headings: 4b. No escaping needed (inside p-tags)
15272 !! options
15273 parsoid
15274 !! input
15276 =foo= x
15277 =foo= <s></s>
15278 !! result
15279 <p>===
15280 =foo= x
15281 =foo= <s></s>
15282 </p>
15283 !!end
15285 !! test
15286 Headings: 5. Empty headings
15287 !! options
15288 parsoid
15289 !! input
15290 =<nowiki/>=
15292 ==<nowiki/>==
15294 ===<nowiki/>===
15296 ====<nowiki/>====
15298 =====<nowiki/>=====
15300 ======<nowiki/>======
15301 !! result
15302 <h1></h1>
15303 <h2></h2>
15304 <h3></h3>
15305 <h4></h4>
15306 <h5></h5>
15307 <h6></h6>
15308 !!end
15310 !! test
15311 Headings: 6a. Heading chars in SOL context (with trailing spaces)
15312 !! options
15313 parsoid
15314 !! input
15315 <nowiki>=a=</nowiki>
15317 <nowiki>=a=</nowiki> 
15319 <nowiki>=a=</nowiki>    
15321 <nowiki>=a=</nowiki>    
15322 !! result
15323 <p>=a=</p>
15324 <p>=a= </p>
15325 <p>=a=  </p>
15326 <p>=a=  </p>
15327 !!end
15329 !! test
15330 Headings: 6b. Heading chars in SOL context (with trailing newlines)
15331 !! options
15332 parsoid
15333 !! input
15334 <nowiki>=a=
15335 b</nowiki>
15337 <nowiki>=a= 
15338 b</nowiki>
15340 <nowiki>=a=     
15341 b</nowiki>
15343 <nowiki>=a=      
15344 b</nowiki>
15345 !! result
15346 <p>=a=
15347 b</p>
15348 <p>=a= 
15349 b</p>
15350 <p>=a=  
15351 b</p>
15352 <p>=a=   
15353 b</p>
15354 </p>
15355 !!end
15357 !! test
15358 Headings: 6c. Heading chars in SOL context (leading newline break)
15359 !! options
15360 parsoid
15361 !! input
15363 <nowiki>=b=</nowiki>
15364 !! result
15365 <p>a
15366 =b=</p>
15367 !!end
15369 !! test
15370 Headings: 6d. Heading chars in SOL context (with interspersed comments)
15371 !! options
15372 parsoid
15373 !! input
15374 <!--c0--><nowiki>=a=</nowiki>
15375 <!--c1-->
15376 <nowiki>=a=</nowiki> <!--c2-->   <!--c3-->
15377 !! result
15378 <p><!--c0-->=a=</p>
15379 <p><!--c1-->=a= <!--c2-->        <!--c3--></p>
15380 !!end
15382 !! test
15383 Headings: 6d. Heading chars in SOL context (No escaping needed)
15384 !! options
15385 parsoid=html2wt
15386 !! input
15387 =a=<div>b</div>
15388 !! result
15389 =a=<div>b</div>
15390 !!end
15392 #### --------------- Lists ---------------
15393 #### 0. Outside nests (*foo, etc.)
15394 #### 1. Nested inside html <ul><li>*foo</li></ul>
15395 #### 2. Inside definition lists
15396 #### 3. Only bullets at start should be escaped
15397 #### 4. No escapes needed
15398 #### 5. No unnecessary escapes
15399 #### 6. Escape bullets in SOL position
15400 #### 7. Escape bullets in a multi-line context
15401 #### ----------------------------------------
15403 !! test
15404 Lists: 0. Outside nests
15405 !! input
15406 <nowiki>*</nowiki>foo
15408 <nowiki>#</nowiki>foo
15409 !! result
15410 <p>*foo
15411 </p><p>#foo
15412 </p>
15413 !!end
15415 !! test
15416 Lists: 1. Nested inside html
15417 !! input
15418 *<nowiki>*foo</nowiki>
15420 *<nowiki>#foo</nowiki>
15422 *<nowiki>:foo</nowiki>
15424 *<nowiki>;foo</nowiki>
15426 #<nowiki>*foo</nowiki>
15428 #<nowiki>#foo</nowiki>
15430 #<nowiki>:foo</nowiki>
15432 #<nowiki>;foo</nowiki>
15433 !! result
15434 <ul><li>*foo
15435 </li></ul>
15436 <ul><li>#foo
15437 </li></ul>
15438 <ul><li>:foo
15439 </li></ul>
15440 <ul><li>;foo
15441 </li></ul>
15442 <ol><li>*foo
15443 </li></ol>
15444 <ol><li>#foo
15445 </li></ol>
15446 <ol><li>:foo
15447 </li></ol>
15448 <ol><li>;foo
15449 </li></ol>
15451 !!end
15453 !! test
15454 Lists: 2. Inside definition lists
15455 !! input
15456 ;<nowiki>;foo</nowiki>
15458 ;<nowiki>:foo</nowiki>
15460 ;<nowiki>:foo</nowiki>
15461 :bar
15463 :<nowiki>:foo</nowiki>
15464 !! result
15465 <dl><dt>;foo
15466 </dt></dl>
15467 <dl><dt>:foo
15468 </dt></dl>
15469 <dl><dt>:foo
15470 </dt><dd>bar
15471 </dd></dl>
15472 <dl><dd>:foo
15473 </dd></dl>
15475 !!end
15477 !! test
15478 Lists: 3. Only bullets at start of text should be escaped
15479 !! input
15480 *<nowiki>*foo*bar</nowiki>
15482 *<nowiki>*foo</nowiki>''it''*bar
15483 !! result
15484 <ul><li>*foo*bar
15485 </li></ul>
15486 <ul><li>*foo<i>it</i>*bar
15487 </li></ul>
15489 !!end
15491 !! test
15492 Lists: 4. No escapes needed
15493 !! options
15494 parsoid
15495 !! input
15496 *foo*bar
15498 *''foo''*bar
15500 *[[Foo]]: bar
15501 !! result
15502 <ul><li>foo*bar
15503 </li></ul>
15504 <ul><li><i>foo</i>*bar
15505 </li></ul>
15506 <ul><li><a rel="mw:WikiLink" href="Foo">Foo</a>: bar
15507 </li></ul>
15508 !!end
15510 !! test
15511 Lists: 5. No unnecessary escapes
15512 !! input
15513 * bar <span><nowiki>[[foo]]</nowiki></span>
15515 *=bar <span><nowiki>[[foo]]</nowiki></span>
15517 *[[bar <span><nowiki>[[foo]]</nowiki></span>
15519 *]]bar <span><nowiki>[[foo]]</nowiki></span>
15521 *=bar <span>foo]]</span>=
15523 * <s></s>: a
15524 !! result
15525 <ul><li> bar <span>[[foo]]</span>
15526 </li></ul>
15527 <ul><li>=bar <span>[[foo]]</span>
15528 </li></ul>
15529 <ul><li>[[bar <span>[[foo]]</span>
15530 </li></ul>
15531 <ul><li>]]bar <span>[[foo]]</span>
15532 </li></ul>
15533 <ul><li>=bar <span>foo]]</span>=
15534 </li></ul>
15535 <ul><li> <s></s>: a
15536 </li></ul>
15538 !!end
15540 !! test
15541 Lists: 6. Escape bullets in SOL position
15542 !! options
15543 parsoid
15544 !! input
15545 <!--cmt--><nowiki>*foo</nowiki>
15546 !! result
15547 <p><!--cmt--><span typeof="mw:Nowiki">*foo</span></p>
15548 !!end
15550 !! test
15551 Lists: 7. Escape bullets in a multi-line context
15552 !! input
15554 <nowiki>*</nowiki>b
15555 !! result
15556 <p>a
15558 </p>
15559 !!end
15561 #### --------------- HRs ---------------
15562 #### 1. Single line
15563 #### -----------------------------------
15565 !! test
15566 HRs: 1. Single line
15567 !! options
15568 parsoid
15569 !! input
15570 ----<nowiki>----</nowiki>
15571 ----=foo=
15572 ----*foo
15573 !! result
15574 <hr><span typeof="mw:Nowiki">----</span>
15575 <hr>=foo=
15576 <hr>*foo
15577 !! end
15579 #### --------------- Tables ---------------
15580 #### 1a. Simple example
15581 #### 1b. No escaping needed (!foo)
15582 #### 1c. No escaping needed (|foo)
15583 #### 1d. No escaping needed (|}foo)
15584 ####
15585 #### 2a. Nested in td (<td>foo|bar</td>)
15586 #### 2b. Nested in td (<td>foo||bar</td>)
15587 #### 2c. Nested in td -- no escaping needed(<td>foo!!bar</td>)
15588 ####
15589 #### 3a. Nested in th (<th>foo!bar</th>)
15590 #### 3b. Nested in th (<th>foo!!bar</th>)
15591 #### 3c. Nested in th -- no escaping needed(<th>foo||bar</th>)
15592 ####
15593 #### 4a. Escape -
15594 #### 4b. Escape +
15595 #### 4c. No escaping needed
15596 #### --------------------------------------
15598 !! test
15599 Tables: 1a. Simple example
15600 !! input
15601 <nowiki>{|
15602 |}</nowiki>
15603 !! result
15604 <p>{|
15606 </p>
15607 !! end
15609 !! test
15610 Tables: 1b. No escaping needed
15611 !! input
15612 !foo
15613 !! result
15614 <p>!foo
15615 </p>
15616 !! end
15618 !! test
15619 Tables: 1c. No escaping needed
15620 !! input
15621 |foo
15622 !! result
15623 <p>|foo
15624 </p>
15625 !! end
15627 !! test
15628 Tables: 1d. No escaping needed
15629 !! input
15630 |}foo
15631 !! result
15632 <p>|}foo
15633 </p>
15634 !! end
15636 !! test
15637 Tables: 2a. Nested in td
15638 !! options
15639 parsoid
15640 !! input
15642 |<nowiki>foo|bar</nowiki>
15644 !! result
15645 <table><tbody><tr>
15646 <td><span typeof="mw:Nowiki">foo|bar</span></td></tr></tbody></table>
15647 !! end
15649 !! test
15650 Tables: 2b. Nested in td
15651 !! options
15652 parsoid
15653 !! input
15655 |<nowiki>foo||bar</nowiki>
15656 |''it''<nowiki>foo||bar</nowiki>
15658 !! result
15659 <table><tbody><tr>
15660 <td><span typeof="mw:Nowiki">foo||bar</span></td>
15661 <td><i>it</i><span typeof="mw:Nowiki">foo||bar</span></td></tr></tbody></table>
15662 !! end
15664 !! test
15665 Tables: 2c. Nested in td -- no escaping needed
15666 !! options
15667 parsoid
15668 !! input
15670 |foo!!bar
15672 !! result
15673 <table><tbody><tr><td>foo!!bar
15674 </td></tr></tbody></table>
15676 !! end
15678 !! test
15679 Tables: 3a. Nested in th
15680 !! options
15681 parsoid
15682 !! input
15684 !foo!bar
15686 !! result
15687 <table><tbody><tr><th>foo!bar
15688 </th></tr></tbody></table>
15690 !! end
15692 !! test
15693 Tables: 3b. Nested in th
15694 !! options
15695 parsoid
15696 !! input
15698 !<nowiki>foo!!bar</nowiki>
15700 !! result
15701 <table>
15702 <tbody><tr><th><span typeof="mw:Nowiki">foo!!bar</span></th></tr>
15703 </tbody></table>
15704 !! end
15706 !! test
15707 Tables: 3c. Nested in th -- no escaping needed
15708 !! options
15709 parsoid
15710 !! input
15712 !<nowiki>foo||bar</nowiki>
15714 !! result
15715 <table><tbody><tr>
15716 <th><span typeof="mw:Nowiki">foo||bar</span></th></tr></tbody></table>
15717 !! end
15719 !! test
15720 Tables: 4a. Escape -
15721 !! options
15722 parsoid
15723 !! input
15726 !-bar
15728 |<nowiki>-bar</nowiki>
15730 !! result
15731 <table><tbody>
15732 <tr><th>-bar</th></tr>
15733 <tr>
15734 <td><span typeof="mw:Nowiki">-bar</span></td></tr></tbody></table>
15735 !! end
15737 !! test
15738 Tables: 4b. Escape +
15739 !! options
15740 parsoid
15741 !! input
15744 !+bar
15746 |<nowiki>+bar</nowiki>
15748 !! result
15749 <table><tbody>
15750 <tr><th>+bar</th></tr>
15751 <tr>
15752 <td><span typeof="mw:Nowiki">+bar</span></td></tr></tbody></table>
15753 !! end
15755 !! test
15756 Tables: 4c. No escaping needed
15757 !! options
15758 parsoid
15759 !! input
15762 |foo-bar
15763 |foo+bar
15765 |''foo''-bar
15766 |''foo''+bar
15768 |foo
15769 bar|baz
15770 +bar
15771 -bar
15773 !! result
15774 <table><tbody>
15775 <tr><td>foo-bar</td><td>foo+bar</td></tr>
15776 <tr><td><i>foo</i>-bar</td><td><i>foo</i>+bar</td></tr>
15777 <tr><td>foo
15778 <p>bar|baz
15779 +bar
15780 -bar</p></td></tr>
15781 </tbody></table>
15782 !! end
15784 ### SSS FIXME: Disabled right now because accurate html2wt
15785 ### on this snippet requires data-parsoid flags that we've
15786 ### stripped out of these tests.  We should scheme how we
15787 ### we want to handle these kind of tests that require
15788 ### data-parsoid flags for accurate html2wt serialization
15790 !! test
15791 Tables: 4d. No escaping needed
15792 !! options
15793 disabled
15794 !! input
15796 ||+1
15797 ||-2
15799 !! result
15800 <table>
15801 <tr>
15802 <td>+1
15803 </td>
15804 <td>-2
15805 </td></tr></table>
15807 !! end
15809 #### --------------- Links ----------------
15810 #### 1. Quote marks in link text
15811 #### 2. Wikilinks: Escapes needed
15812 #### 3. Wikilinks: No escapes needed
15813 #### 4. Extlinks: Escapes needed
15814 #### 5. Extlinks: No escapes needed
15815 #### --------------------------------------
15816 !! test
15817 Links 1. Quote marks in link text
15818 !! options
15819 parsoid
15820 !! input
15821 [[Foo|Foo<nowiki>''boo''</nowiki>]]
15822 !! result
15823 <a rel="mw:WikiLink" href="Foo">Foo''boo''</a>
15824 !! end
15826 !! test
15827 Links 2. WikiLinks: Escapes needed
15828 !! options
15829 parsoid
15830 !! input
15831 [[Foo|<nowiki>[Foobar]</nowiki>]]
15832 [[Foo|<nowiki>Foobar]</nowiki>]]
15833 [[Foo|x [Foobar] x]]
15834 [[Foo|<nowiki>x [http://google.com g] x</nowiki>]]
15835 [[Foo|<nowiki>[[Bar]]</nowiki>]]
15836 [[Foo|<nowiki>x [[Bar]] x</nowiki>]]
15837 [[Foo|<nowiki>|Bar</nowiki>]]
15838 [[Foo|<nowiki>]]bar</nowiki>]]
15839 [[Foo|<nowiki>[[bar</nowiki>]]
15840 [[Foo|<nowiki>x ]] y [[ z</nowiki>]]
15841 !! result
15842 <a href="Foo" rel="mw:WikiLink">[Foobar]</a>
15843 <a href="Foo" rel="mw:WikiLink">Foobar]</a>
15844 <a href="Foo" rel="mw:WikiLink">x [Foobar] x</a>
15845 <a href="Foo" rel="mw:WikiLink">x [http://google.com g] x</a>
15846 <a href="Foo" rel="mw:WikiLink">[[Bar]]</a>
15847 <a href="Foo" rel="mw:WikiLink">x [[Bar]] x</a>
15848 <a href="Foo" rel="mw:WikiLink">|Bar</a>
15849 <a href="Foo" rel="mw:WikiLink">]]bar</a>
15850 <a href="Foo" rel="mw:WikiLink">[[bar</a>
15851 <a href="Foo" rel="mw:WikiLink">x ]] y [[ z</a>
15852 !! end
15854 !! test
15855 Links 3. WikiLinks: No escapes needed
15856 !! options
15857 parsoid
15858 !! input
15859 [[Foo|[Foobar]]
15860 [[Foo|foo|bar]]
15861 !! result
15862 <a href="Foo" rel="mw:WikiLink">[Foobar</a>
15863 <a href="Foo" rel="mw:WikiLink">foo|bar</a>
15864 !! end
15866 !! test
15867 Links 4. ExtLinks: Escapes needed
15868 !! options
15869 parsoid
15870 !! input
15871 [http://google.com <nowiki>[google]</nowiki>]
15872 [http://google.com <nowiki>google]</nowiki>]
15873 !! result
15874 <a href="http://google.com" rel="mw:ExtLink">[google]</a>
15875 <a href="http://google.com" rel="mw:ExtLink">google]</a>
15876 !! end
15878 !! test
15879 Links 5. ExtLinks: No escapes needed
15880 !! options
15881 parsoid
15882 !! input
15883 [http://google.com [google]
15884 !! result
15885 <a href="http://google.com" rel="mw:ExtLink">[google</a>
15886 !! end
15888 #### --------------- Quotes ---------------
15889 #### 1. Quotes inside <b> and <i>
15890 #### 2. Link fragments separated by <i> and <b> tags
15891 #### 3. Link fragments inside <i> and <b>
15892 #### 4. No escaping needed
15893 #### --------------------------------------
15894 !! test
15895 1. Quotes inside <b> and <i>
15896 !! options
15897 parsoid=html2wt,wt2wt
15898 !! input
15899 ''<nowiki>'foo'</nowiki>''
15900 ''<nowiki>''foo''</nowiki>''
15901 ''<nowiki>'''foo'''</nowiki>''
15902 ''foo''<nowiki/>'s
15903 '''<nowiki>'foo'</nowiki>'''
15904 '''<nowiki>''foo''</nowiki>'''
15905 '''<nowiki>'''foo'''</nowiki>'''
15906 '''<nowiki>foo'</nowiki>''<nowiki>bar'</nowiki>''baz'''
15907 '''foo'''<nowiki/>'s
15908 '''foo''
15909 ''foo''<nowiki/>'
15910 '<nowiki/>''foo''<nowiki/>'
15911 ''''foo'''
15912 '''foo'''<nowiki/>'
15913 '<nowiki/>'''foo'''<nowiki/>'
15914 !! result
15915 <p><i>'foo'</i>
15916 <i>''foo''</i>
15917 <i>'''foo'''</i>
15918 <i>foo</i>'s
15919 <b>'foo'</b>
15920 <b>''foo''</b>
15921 <b>'''foo'''</b>
15922 <b>foo'<i>bar'</i>baz</b>
15923 <b>foo</b>'s
15924 '<i>foo</i>
15925 <i>foo</i>'
15926 '<i>foo</i>'
15927 '<b>foo</b>
15928 <b>foo</b>'
15929 '<b>foo</b>'</p>
15930 !! end
15932 !! test
15933 2. Link fragments separated by <i> and <b> tags
15934 !! input
15935 [[''foo''<nowiki>hello]]</nowiki>
15937 [['''foo'''<nowiki>hello]]</nowiki>
15938 !! result
15939 <p>[[<i>foo</i>hello]]
15940 </p><p>[[<b>foo</b>hello]]
15941 </p>
15942 !! end
15944 !! test
15945 3. Link fragments inside <i> and <b>
15946 (FIXME: Escaping one or both of [[ and ]] is also acceptable --
15947  this is one of the shortcomings of this format)
15948 !! input
15949 ''[[foo''<nowiki>]]</nowiki>
15951 '''[[foo'''<nowiki>]]</nowiki>
15952 !! result
15953 <p><i>[[foo</i>]]
15954 </p><p><b>[[foo</b>]]
15955 </p>
15956 !! end
15958 !! test
15959 4. No escaping needed
15960 !! input
15961 '<span>''bar''</span>'
15962 '<span>'''bar'''</span>'
15963 !! result
15964 <p>'<span><i>bar</i></span>'
15965 '<span><b>bar</b></span>'
15966 </p>
15967 !! end
15969 #### ----------- Paragraphs ---------------
15970 #### 1. No unnecessary escapes
15971 #### --------------------------------------
15973 !! test
15974 1. No unnecessary escapes
15975 !! input
15976 bar <span><nowiki>[[foo]]</nowiki></span>
15978 =bar <span><nowiki>[[foo]]</nowiki></span>
15980 [[bar <span><nowiki>[[foo]]</nowiki></span>
15982 ]]bar <span><nowiki>[[foo]]</nowiki></span>
15984 =bar <span>foo]]</span><nowiki>=</nowiki>
15985 !! result
15986 <p>bar <span>[[foo]]</span>
15987 </p><p>=bar <span>[[foo]]</span>
15988 </p><p>[[bar <span>[[foo]]</span>
15989 </p><p>]]bar <span>[[foo]]</span>
15990 </p><p>=bar <span>foo]]</span>=
15991 </p>
15992 !!end
15994 #### ----------------------- PRE --------------------------
15995 #### 1. Leading whitespace in SOL context should be escaped
15996 #### ------------------------------------------------------
15997 !! test
15998 1. Leading whitespace in SOL context should be escaped
15999 !! options
16000 parsoid
16001 !! input
16002 <nowiki> </nowiki>a
16004 <nowiki> </nowiki> a
16006 <nowiki>        </nowiki>a(tab)
16008 <nowiki> </nowiki>      a
16009 <!--cmt-->
16010 <nowiki> </nowiki> a
16013 <nowiki> </nowiki>b
16016 <nowiki>        </nowiki>b
16019 <nowiki>        </nowiki> b
16020 !! result
16021 <p> a</p>
16022 <p>  a</p>
16023 <p>     a(tab)</p>
16024 <p>     a</p>
16025 <p><!--cmt-->  a</p>
16026 <p>a
16027  b</p>
16028 <p>a
16029         b</p>
16030 <p>a
16031          b</p>
16032 !! end
16034 #### --------------- HTML tags ---------------
16035 #### 1. a tags
16036 #### 2. other tags
16037 #### 3. multi-line html tag
16038 #### -----------------------------------------
16039 !! test
16040 1. a tags
16041 !! options
16042 parsoid
16043 !! input
16044 <a href="http://google.com">google</a>
16045 !! result
16046 &lt;a href=&quot;http://google.com&quot;&gt;google&lt;/a&gt;
16047 !! end
16049 !! test
16050 2. other tags
16051 !! input
16052 <nowiki><div>foo</div>
16053 <div style="color:red">foo</div></nowiki>
16054 !! result
16055 <p>&lt;div&gt;foo&lt;/div&gt;
16056 &lt;div style=&quot;color:red&quot;&gt;foo&lt;/div&gt;
16057 </p>
16058 !! end
16060 !! test
16061 3. multi-line html tag
16062 !! input
16063 <nowiki><div
16064 >foo</div
16065 ></nowiki>
16066 !! result
16067 <p>&lt;div
16068 &gt;foo&lt;/div
16069 &gt;
16070 </p>
16071 !! end
16073 !! test
16074 4. extension tags
16075 !! input
16076 <nowiki><ref>foo</ref></nowiki>
16077 !! result
16078 <p>&lt;ref&gt;foo&lt;/ref&gt;
16079 </p>
16080 !! end
16082 #### --------------- Others ---------------
16083 !! test
16084 Escaping nowikis
16085 !! input
16086 &lt;nowiki&gt;foo&lt;/nowiki&gt;
16087 !! result
16088 <p>&lt;nowiki&gt;foo&lt;/nowiki&gt;
16089 </p>
16090 !! end
16092 ## The quote-char in the input is necessary for triggering the bug
16093 !! test
16094 (Bug 52035) Nowiki-escaping should not get tripped by " :" in text
16095 !! options
16096 parsoid=wt2wt,html2wt
16097 !! input
16098 foo's bar :
16099 !! result
16100 <p>foo's bar :</p>
16101 !! end
16103 !! test
16105 Tag-like HTML structures are passed through as text
16106 !! input
16107 <x y>
16109 <x.y>
16111 <x-y>
16119 1<d e>f
16120 !! result
16121 <p>&lt;x y&gt;
16122 </p><p>&lt;x.y&gt;
16123 </p><p>&lt;x-y&gt;
16124 </p><p>1&gt;2
16125 </p><p>x&lt;y
16126 </p><p>a&gt;b
16127 </p><p>1&lt;d e&gt;f
16128 </p>
16129 !! end
16132 # This fails in the PHP parser (see bug 40670,
16133 # https://bugzilla.wikimedia.org/show_bug.cgi?id=40670), so disabled for it.
16134 !! test
16135 Tag names followed by punctuation should not be recognized as tags
16136 !! options
16137 parsoid
16138 !! input
16139 <s.ome> text
16140 !! result
16141 <p>&lt;s.ome&gt; text
16142 </p>
16143 !! end
16145 !! test
16146 HTML tag with necessary entities in attributes
16147 !! input
16148 <span title="&amp;amp;">foo</span>
16149 !! result
16150 <p><span title="&amp;amp;">foo</span>
16151 </p>
16152 !! end
16154 !! test
16155 HTML tag with 'unnecessary' entity encoding in attributes
16156 !! input
16157 <span title="&amp;">foo</span>
16158 !! result
16159 <p><span title="&amp;">foo</span>
16160 </p>
16161 !! end
16163 !! test
16164 HTML tag with broken attribute value quoting
16165 !! input
16166 <span title="Hello world>Foo</span>
16167 !! result
16168 <p><span>Foo</span>
16169 </p>
16170 !! end
16172 !! test
16173 Parsoid-only: HTML tag with broken attribute value quoting
16174 !! options
16175 parsoid
16176 !! input
16177 <span title="Hello world>Foo</span>
16178 !! result
16179 <p><span title="Hello world">Foo</span>
16180 </p>
16181 !! end
16183 !! test
16184 Table with broken attribute value quoting
16185 !! input
16187 | title="Hello world|Foo
16189 !! result
16190 <table>
16191 <tr>
16192 <td>Foo
16193 </td></tr></table>
16195 !! end
16197 !! test
16198 Table with broken attribute value quoting on consecutive lines
16199 !! input
16201 | title="Hello world|Foo
16202 | style="color:red|Bar
16204 !! result
16205 <table>
16206 <tr>
16207 <td>Foo
16208 </td>
16209 <td>Bar
16210 </td></tr></table>
16212 !! end
16214 !! test
16215 Parsoid-only: Table with broken attribute value quoting on consecutive lines
16216 !! options
16217 parsoid
16218 !! input
16220 | title="Hello world|Foo
16221 | style="color:red|Bar
16223 !! result
16224 <table><tbody>
16225 <tr>
16226 <td title="Hello world">Foo
16227 </td><td style="color: red">Bar
16228 </td></tr></tbody></table>
16230 !! end
16232 !! test
16233 Parsoid-only: Don't wrap broken template tags in <nowiki> on wt2wt (Bug 42353)
16234 !! options
16235 parsoid
16236 !! input
16237 {{}}
16238 !! result
16239 {{}}
16240 !! end
16242 !! test
16243 Parsoid-only: Don't wrap broken template tags in <nowiki> on wt2wt (Bug 42353)
16244 !! options
16245 parsoid
16246 !! input
16247 }}{{
16248 !! result
16249 }}{{
16250 !! end
16252 !!test
16253 Accept empty td cell attribute
16254 !!input
16256 | align="center" | foo ||  |
16258 !!result
16259 <table>
16260 <tr>
16261 <td align="center"> foo </td>
16262 <td>
16263 </td></tr></table>
16265 !!end
16267 !!test
16268 Non-empty attributes in th-cells
16269 !!input
16271 ! Foo !! style="color: red" | Bar
16273 !!result
16274 <table>
16275 <tr>
16276 <th> Foo </th>
16277 <th style="color: red"> Bar
16278 </th></tr></table>
16280 !!end
16282 !!test
16283 Accept empty attributes in th-cells
16284 !!input
16286 !| foo !!| bar
16288 !!result
16289 <table>
16290 <tr>
16291 <th> foo </th>
16292 <th> bar
16293 </th></tr></table>
16295 !!end
16297 !!test
16298 Empty table rows go away
16299 !!input
16301 | Hello
16302 | there
16303 |- class="foo"
16306 !! result
16307 <table>
16308 <tr>
16309 <td> Hello
16310 </td>
16311 <td> there
16312 </td></tr>
16314 </table>
16316 !! end
16319 ### Parsoid-centric tests for testing RTing of inter-element separators
16320 ### Edge cases not tested by existing parser tests and specific to
16321 ### Parsoid-specific serialization strategies.
16324 !!test
16325 RT-ed inter-element separators should be valid separators
16326 !!input
16328 |- [[foo]]
16330 !!result
16331 <table>
16333 </table>
16335 !!end
16337 !!test
16338 Trailing newlines in a deep dom-subtree that ends a wikitext line should be migrated out
16339 (Parsoid-only since PHP parser relies on Tidy for correct output)
16340 !!options
16341 parsoid
16342 !!input
16344 |<small>foo
16349 |<small>foo<small>
16351 !!result
16352 !!end
16354 !!test
16355 Empty TD followed by TD with tpl-generated attribute
16356 !!input
16360 |{{echo|style='color:red'}}|foo
16362 !!result
16363 <table>
16365 <tr>
16366 <td>
16367 </td>
16368 <td>foo
16369 </td></tr></table>
16371 !!end
16373 !!test
16374 Indented table with an empty td
16375 !!input
16376  {|
16377  |-
16379  |foo
16380  |}
16381 !!result
16382 <table>
16384 <tr>
16385 <td>
16386 </td>
16387 <td>foo
16388 </td></tr></table>
16390 !!end
16392 !!test
16393 Empty TR followed by a template-generated TR
16394 (Parsoid-specific since PHP parser doesn't handle this mixed tbl-wikitext)
16395 !!options
16396 parsoid=wt2html,wt2wt
16397 !!input
16400 {{echo|<tr><td>foo</td></tr>}}
16402 !!result
16403 <table>
16404 <tbody>
16405 <tr></tr>
16406 <tr typeof="mw:Transclusion">
16407 <td>foo</td></tr></tbody></table>
16408 !!end
16410 ## PHP and parsoid output differ for this, and since this is primarily
16411 ## for testing Parsoid's serializer, marking this Parsoid only
16412 !!test
16413 Empty TR followed by mixed-ws-comment line should RT correctly
16414 !!options
16415 parsoid
16416 !!input
16419  <!--c-->
16421 <!--c--> <!--d-->
16423 !!result
16424 <table>
16425 <tbody>
16426 <tr>
16427 <td> <!--c--></td></tr>
16428 <tr>
16429 <td><!--c--> <!--d--></td></tr>
16430 </tbody></table>
16432 !!end
16434 !!test
16435 Multi-line image caption generated by templates with/without trailing newlines
16436 !!options
16437 parsoid
16438 !!input
16439 [[File:foo.jpg|thumb|300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}]]
16440 [[File:foo.jpg|thumb|300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}\n\n]]
16441 !!result
16442 <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>
16443 <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>
16445 !!end
16447 ## PHP emits broken html for this, and since this is primarily
16448 ## a Parsoid serializer test, marking this Parsoid only
16449 !!test
16450 Improperly nested inline or quotes tags with whitespace in between
16451 !!options
16452 parsoid
16453 !!input
16454 <span> <s>x</span> </s>
16455 ''' ''x''' ''
16456 !!result
16457 <p><span> <s>x</s></span><s> </s>
16458 <b> <i>x</i></b><i> </i>
16459 </p>
16460 !!end
16462 !!test
16463 Encapsulate protected attributes from wt
16464 !!options
16465 parsoid
16466 !!input
16467 <div typeof="mw:placeholder stuff" data-parsoid="weird" data-parsoid-other="no" about="time" rel="mw:true">foo</div>
16468 !!result
16469 <body><div data-x-typeof="mw:placeholder stuff" data-x-data-parsoid="weird" data-x-data-parsoid-other="no" data-x-about="time" data-x-rel="mw:true">foo</div>
16470 </body>
16471 !!end
16473 # -----------------------------------------------------------------
16474 # The following section of tests are primarily to spec requirements
16475 # around serialization of new/edited content.
16477 # All these tests are marked Parsoid html2wt and html2html only
16478 # ----------------------------------------------------------------
16480 !! test
16481 Image: Modifying size of an image
16482 !! options
16483 parsoid=html2wt
16484 !! input
16485 [[Image:Wiki.png|230x230px]]
16486 !! result
16487 <p data-parsoid='{"dsr":[0,24,0,0]}'><span typeof="mw:Image" data-parsoid='{"optList":[{"ck":"width","ak":"100px"}],"cacheKey":"[[Image:Wiki.png|100px]]","img":{"h":115,"w":100,"wdset":true},"dsr":[0,24,null,null]}'><a href="./File:Wiki.png" data-parsoid='{"a":{"href":"./File:Wiki.png"}}'><img resource="./File:Wiki.png" src="//upload.wikimedia.org/wikipedia/en/thumb/b/bc/Wiki.png/100px-Wiki.png" height="230" width="200" data-parsoid='{"a":{"resource":"./File:Wiki.png"},"sa":{"resource":"Image:Wiki.png"}}'></a></span></p>
16488 !!end
16490 !! test
16491 Image: New block level image should have \n before and after
16492 !! options
16493 parsoid=html2wt
16494 !! input
16496 [[File:Wiki.png|right|thumb|150x150px]]
16498 !! result
16499 <p>123</p><figure typeof="mw:Image/Thumb" class="mw-halign-right"><a href="./File:Wiki.png"><img src="http://192.168.142.128/mw/images/thumb/b/bc/Wiki.png/131px-Wiki.png" width="131" height="150" resource="./File:Wiki.png"></a></figure><p>456</p>
16500 !!end
16502 !! test
16503 Lists: Add space after bullets
16504 !! options
16505 parsoid=html2wt
16506 !! input
16508 * foo
16509 * bar
16510 * <span> baz</span>
16511 !! result
16512 <ul>
16513 <li>foo</li>
16514 <li> bar</li>
16515 <li><span> baz</span></li>
16516 </ul>
16517 !! end
16519 !! test
16520 Parsoid: Serialize positional parameters with = in them as named parameter
16521 !! options
16522 parsoid=html2wt
16523 !! input
16524 {{echo|1 = f=oo}}
16525 !! result
16526 <p about="#mwt1" typeof="mw:Transclusion"
16527 data-mw='{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"f=oo"}},"i":0}'
16528 >foo</p>
16529 !! end
16531 # -----------------------------------------------------------------
16532 # End of section for Parsoid-only html2wt tests for serialization
16533 # of new content
16534 # -----------------------------------------------------------------
16536 TODO:
16537 more images
16538 more tables
16539 character entities
16540 and much more
16541 Try for 100% code coverage