Add 'ApiMakeParserOptions' hook
[mediawiki.git] / tests / parser / parserTests.txt
blob2e059d7423b414613761a4f8b9920f19705e109e
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 #               (ignored by Parsoid, since it emits <link>s)
18 # ill           add inter-language links
19 #               (ignored by Parsoid, since it emits <link>s)
20 # subpage       enable subpages (disabled by default)
21 # title=[[XXX]] run test using article title XXX
22 # language=XXX  set content language to XXX for this test
23 # variant=XXX   set the variant of language for this test (eg zh-tw)
24 # disabled      do not run test
25 # parsoid       parsoid-specific options (not run by PHP parser unless
26 #                 the test includes an html/php section)
27 # php           php-only test (not run by the parsoid parser unless
28 #                 the test includes an html/parsoid section)
29 # showtitle     make the first line the title
30 # showindicators make the first lines the page status indicators
31 # comment       run through Linker::formatComment() instead of main parser
32 # local         format section links in edit comment text as local links
33 # notoc         disable table of contents
34 # thumbsize=NNN set the default thumb size to NNNpx for this test
36 # You can also set the following parser properties via test options:
37 #  wgEnableUploads, wgAllowExternalImages, wgMaxTocLevel,
38 #  wgLinkHolderBatchSize, wgRawHtml
40 # For testing purposes, temporary articles can created:
41 # !!article / NAMESPACE:TITLE / !!text / ARTICLE TEXT / !!endarticle
42 # where '/' denotes a newline.
44 # This is the standard article assumed to exist.
45 !! article
46 Main Page
47 !! text
48 blah blah
49 !! endarticle
51 !!article
52 Foo
53 !!text
54 FOO
55 !!endarticle
57 !!article
58 Template:Foo
59 !!text
60 FOO
61 !!endarticle
63 !! article
64 Template:Blank
65 !! text
66 !! endarticle
68 !! article
69 Template:pipe
70 !! text
72 !! endarticle
74 !! article
75 Template:=
76 !! text
77 <nowiki>=</nowiki>
78 !! endarticle
80 !!article
81 MediaWiki:bad image list
82 !!text
83 * [[File:Bad.jpg]] except [[Nasty page]]
84 !!endarticle
86 !! article
87 Template:inner list
88 !! text
89 * item 1
90 !! endarticle
92 !! article
93 Template:tbl-start
94 !! text
96 !! endarticle
98 !! article
99 Template:tbl-end
100 !! text
102 !! endarticle
104 !! article
105 Template:echo
106 !! text
107 {{{1}}}
108 !! endarticle
110 !! article
111 Template:echo_with_span
112 !! text
113 <span>{{{1}}}</span>
114 !! endarticle
116 !! article
117 Template:echo_with_div
118 !! text
119 <div>{{{1}}}</div>
120 !! endarticle
122 !! article
123 Template:blank_param
124 !! text
125 {{{1}}}
126 {{{}}}
127 !! endarticle
129 !! article
130 Template:table_attribs
131 !! text
132 <noinclude>
133 |</noinclude>style="color:red;"|Foo
134 !! endarticle
136 !! article
137 Template:table_attribs_2
138 !! text
139 <noinclude>
140 |</noinclude>style="color:red;"|Foo
141 |Bar||Baz
142 !! endarticle
144 !! article
145 Template:table_attribs_3
146 !! text
147 <noinclude>
148 |</noinclude>style{{=}}"background:&#35;f9f9f9;"|Foo
149 !! endarticle
151 !! article
152 Template:table_attribs_4
153 !! text
154 | style="background-color:#DC241f;" width="10px" |
155 !! endarticle
157 !! article
158 Template:table_attribs_5
159 !! text
160 <noinclude>
161 |</noinclude>style="color:red;"||Bar
162 !! endarticle
164 !! article
165 Template:table_attribs_6
166 !! text
167 style="background: <nowiki>
170 red;</nowiki>" |
171 !! endarticle
173 !! article
174 Template:table_attribs_7
175 !! text
176 <noinclude>
177 |</noinclude>style{{=}}"background:&#35;f9f9f9;"|Foo<ref>foo</ref>
178 !! endarticle
180 !! article
181 Template:table_header_cells
182 !! text
183 {{table_attribs}}!!style='color:red;'|''Bar''||style='color:brown;'|''Foo'' and Baz
184 !! endarticle
186 !! article
187 Template:table_cells
188 !! text
189 {{table_attribs}}||style='color:red;'|''Bar''||style='color:brown;'|''Foo'' and Baz
190 !! endarticle
192 !! article
193 Template:PartialTable
194 !! text
197 !! endarticle
199 !! article
200 Template:image_attribs
201 !! text
202 <noinclude>
203 [[File:foobar.jpg|</noinclude>right|Caption text<noinclude>]]</noinclude>
204 !! endarticle
206 ## See T48811 for details
207 !! article
208 Template:mixed_attr_content_template
209 !! text
210 style="color:red;" title="T48811"
212 |foo
213 !! endarticle
215 !! article
216 Template:definition_list
217 !! text
219 ::two
220 !! endarticle
222 !! article
224 !! text
225 Weirdo titles!
226 !! endarticle
228 !!article
229 Template:Bullet
230 !!text
231 * Bar
232 !!endarticle
234 !!article
235 Template:OpenTable
236 !!text
238 !!endarticle
240 !!article
241 Template:EmptyLITest
242 !!text
247 !!endarticle
249 !!article
250 Template:EmptyTRTest
251 !!text
255 |foo
258 |bar
260 !!endarticle
262 !!article
263 Template:EmptyTRWithHTMLAttrTest
264 !!text
265 <table>
266 <tr align="center"></tr>
267 <tr><td>foo</td></tr>
268 <tr align="center"></tr>
269 <tr><td>bar</td></tr>
270 </table>
271 !!endarticle
274 ### Basic tests
276 !! test
277 Blank input
278 !! wikitext
279 !! html
280 !! end
283 !! test
284 Simple paragraph
285 !! wikitext
286 This is a simple paragraph.
287 !! html
288 <p>This is a simple paragraph.
289 </p>
290 !! end
292 !! test
293 Paragraphs with extra newline spacing
294 !! wikitext
304 booz
305 !! html
306 <p>foo
307 </p><p>bar
308 </p><p><br />
310 </p><p><br />
311 </p><p>booz
312 </p>
313 !! end
315 !! test
316 Paragraphs with newline spacing with comment lines in between
317 !! wikitext
318 ----
320 <!--foo-->
322 ----
324 <!--foo--><!--More than 1 comment, still stripped-->
326 ----
328  <!--foo--> <!----> <!-- bar --> 
330 ----
332 <!--foo-->
335 ----
338 <!--foo-->
340 ----
342 <!--foo-->
346 ----
350 <!--foo-->
352 ----
353 !! html
354 <hr />
355 <p>a
357 </p>
358 <hr />
359 <p>a
361 </p>
362 <hr />
363 <p>a
365 </p>
366 <hr />
367 <p>a
368 </p><p>b
369 </p>
370 <hr />
371 <p>a
372 </p><p>b
373 </p>
374 <hr />
375 <p>a
376 </p><p><br />
378 </p>
379 <hr />
380 <p>a
381 </p><p><br />
383 </p>
384 <hr />
386 !! end
388 !! test
389 Paragraphs with newline spacing with non-empty white-space lines in between
390 !! wikitext
391 ----
395 ----
400 ----
401 !! html
402 <hr />
403 <p>a
404 </p><p>b
405 </p>
406 <hr />
407 <p>a
408 </p><p><br /> 
410 </p>
411 <hr />
413 !! end
415 !! test
416 Paragraphs with newline spacing with non-empty mixed comment and white-space lines in between
417 !! wikitext
418 ----
420  <!--foo-->
422 ----
424  <!--foo--><!--More than 1 comment doesn't disable stripping of this line!-->
426 ----
429 <!--foo-->
430  <!--bar-->
432 ----
435  <!--foo-->
436  <!--bar-->
439 ----
440 !! html
441 <hr />
442 <p>a
444 </p>
445 <hr />
446 <p>a
448 </p>
449 <hr />
450 <p>a
451 </p><p>b
452 </p>
453 <hr />
454 <p>a
455 </p><p><br /> 
457 </p>
458 <hr />
460 !! end
462 !! test
463 Extra newlines: More paragraphs with indented comment
464 !! wikitext
467    <!--boo-->
470 !! html
471 <p>a
472 </p><p><br />
474 </p>
475 !!end
477 !! test
478 Extra newlines followed by heading
479 !! wikitext
485 [[a]]
489 !! html
490 <p>a
491 </p><p><br />
492 </p>
493 <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>
494 <p><a href="/index.php?title=A&amp;action=edit&amp;redlink=1" class="new" title="A (page does not exist)">a</a>
495 </p><p><br />
496 </p>
497 <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>
499 !! end
501 !! test
502 Extra newlines between heading and content are swallowed
503 !! wikitext
508 [[a]]
509 !! html
510 <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>
511 <p><a href="/index.php?title=A&amp;action=edit&amp;redlink=1" class="new" title="A (page does not exist)">a</a>
512 </p>
513 !! end
515 !! test
516 Parsing an URL
517 !! wikitext
518 http://fr.wikipedia.org/wiki/🍺
519 <!-- EasterEgg we love beer, better be able be able to link to it -->
520 !! html
521 <p><a rel="nofollow" class="external free" href="http://fr.wikipedia.org/wiki/🍺">http://fr.wikipedia.org/wiki/🍺</a>
522 </p>
523 !! end
525 # Note that the html+tidy output removes the spaces after the <li>,
526 # which is a bug (http://sourceforge.net/p/tidy/bugs/945/, etc).
527 # This is an issue for all tests with lists.  We intentionally do
528 # *not* add html+tidy clauses for these, as we don't want to
529 # document/test the broken behavior.  (Parsoid matches the non-tidy
530 # output in these cases.)
532 !! test
533 Simple list
534 !! wikitext
535 * Item 1
536 * Item 2
537 !! html
538 <ul><li> Item 1</li>
539 <li> Item 2</li></ul>
541 !! end
543 !! test
544 Italics and bold
545 !! wikitext
546 * plain
547 * plain''italic''plain
548 * plain''italic''plain''italic''plain
549 * plain'''bold'''plain
550 * plain'''bold'''plain'''bold'''plain
551 * plain''italic''plain'''bold'''plain
552 * plain'''bold'''plain''italic''plain
553 * plain''italic'''bold-italic'''italic''plain
554 * plain'''bold''bold-italic''bold'''plain
555 * plain'''''bold-italic'''italic''plain
556 * plain'''''bold-italic''bold'''plain
557 * plain''italic'''bold-italic'''''plain
558 * plain'''bold''bold-italic'''''plain
559 * plain l'''italic''plain
560 * plain l''''bold''' plain
561 !! html
562 <ul><li> plain</li>
563 <li> plain<i>italic</i>plain</li>
564 <li> plain<i>italic</i>plain<i>italic</i>plain</li>
565 <li> plain<b>bold</b>plain</li>
566 <li> plain<b>bold</b>plain<b>bold</b>plain</li>
567 <li> plain<i>italic</i>plain<b>bold</b>plain</li>
568 <li> plain<b>bold</b>plain<i>italic</i>plain</li>
569 <li> plain<i>italic<b>bold-italic</b>italic</i>plain</li>
570 <li> plain<b>bold<i>bold-italic</i>bold</b>plain</li>
571 <li> plain<i><b>bold-italic</b>italic</i>plain</li>
572 <li> plain<b><i>bold-italic</i>bold</b>plain</li>
573 <li> plain<i>italic<b>bold-italic</b></i>plain</li>
574 <li> plain<b>bold<i>bold-italic</i></b>plain</li>
575 <li> plain l'<i>italic</i>plain</li>
576 <li> plain l'<b>bold</b> plain</li></ul>
578 !! end
580 # this example taken from the [[simple:Moon]] article (bug 47326)
581 !! test
582 Italics and possessives (1)
583 !! wikitext
584 obtained by ''[[Lunar Prospector]]'''s gamma-ray spectrometer
585 !! html
586 <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
587 </p>
588 !! end
590 # this example taken from [[en:Flaming Pie]] (bug 49926)
591 !! test
592 Italics and possessives (2)
593 !! wikitext
594 '''''Flaming Pie''''' is ... released in 1997. In ''Flaming Pie'''s liner notes
595 !! html
596 <p><i><b>Flaming Pie</b></i> is ... released in 1997. In <i>Flaming Pie'</i>s liner notes
597 </p>
598 !! end
600 # this example taken from [[en:Dictionary]] (bug 49926)
601 !! test
602 Italics and possessives (3)
603 !! wikitext
604 The first monolingual dictionary written in a Romance language was ''Sebastián Covarrubias''' ''Tesoro de la lengua castellana o española'', published in 1611 in Madrid. In 1612 the first edition of the ''Vocabolario dell'[[Accademia della Crusca]]'', for Italian, was published. In 1690 in Rotterdam was published, posthumously, the ''Dictionnaire Universel''.
605 !! html
606 <p>The first monolingual dictionary written in a Romance language was <i>Sebastián Covarrubias'</i> <i>Tesoro de la lengua castellana o española</i>, published in 1611 in Madrid. In 1612 the first edition of the <i>Vocabolario dell'<a href="/index.php?title=Accademia_della_Crusca&amp;action=edit&amp;redlink=1" class="new" title="Accademia della Crusca (page does not exist)">Accademia della Crusca</a></i>, for Italian, was published. In 1690 in Rotterdam was published, posthumously, the <i>Dictionnaire Universel</i>.
607 </p>
608 !! end
612 ### 2-quote opening sequence tests
614 !! test
615 Italics and bold: 2-quote opening sequence: (2,2)
616 !! wikitext
617 ''foo''
618 !! html
619 <p><i>foo</i>
620 </p>
621 !!end
623 !! test
624 Italics and bold: 2-quote opening sequence: (2,3)
625 !! wikitext
626 ''foo'''
627 !! html/*
628 <p><i>foo'</i>
629 </p>
630 !!end
632 !! test
633 Italics and bold: 2-quote opening sequence: (2,4)
634 !! options
635 parsoid=wt2html
636 !! wikitext
637 ''foo''''
638 !! html/*
639 <p><i>foo''</i>
640 </p>
641 !!end
643 # same html as previous, but wikitext adjusted to match parsoid html2wt
644 !! test
645 Italics and bold: 2-quote opening sequence: (2,4) w/ nowiki
646 !! wikitext
647 ''foo<nowiki>''</nowiki>''
648 !! html
649 <p><i>foo''</i>
650 </p>
651 !! end
653 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
654 !! test
655 Italics and bold: 2-quote opening sequence: (2,5)
656 !! options
657 parsoid=wt2html
658 !! wikitext
659 ''foo'''''
660 !! html/php
661 <p><i>foo</i>
662 </p>
663 !! html/parsoid
664 <p><i>foo</i><b></b>
665 </p>
666 !!end
668 # same html as previous, but wikitext adjusted to match parsoid html2wt
669 !! test
670 Italics and bold: 2-quote opening sequence: (2,5+3) w/ nowiki
671 !! wikitext
672 ''foo'''''<nowiki/>'''
673 !! html/php
674 <p><i>foo</i>
675 </p>
676 !! html/parsoid
677 <p><i>foo</i><b></b>
678 </p>
679 !! end
683 ### 3-quote opening sequence tests
686 !! test
687 Italics and bold: 3-quote opening sequence: (3,2)
688 !! wikitext
689 '''foo''
690 !! html/*
691 <p>'<i>foo</i>
692 </p>
693 !!end
695 !! test
696 Italics and bold: 3-quote opening sequence: (3,3)
697 !! wikitext
698 '''foo'''
699 !! html
700 <p><b>foo</b>
701 </p>
702 !!end
704 !! test
705 Italics and bold: 3-quote opening sequence: (3,4)
706 !! wikitext
707 '''foo''''
708 !! html/*
709 <p><b>foo'</b>
710 </p>
711 !!end
713 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
714 !! test
715 Italics and bold: 3-quote opening sequence: (3,5)
716 !! options
717 parsoid=wt2html
718 !! wikitext
719 '''foo'''''
720 !! html/php
721 <p><b>foo</b>
722 </p>
723 !! html/parsoid
724 <p><b>foo</b><i></i>
725 </p>
726 !!end
728 # same html as previous, but wikitext adjusted to match parsoid html2wt
729 !! test
730 Italics and bold: 3-quote opening sequence: (3,5+2) w/ nowiki
731 !! wikitext
732 '''foo'''''<nowiki/>''
733 !! html/php
734 <p><b>foo</b>
735 </p>
736 !! html/parsoid
737 <p><b>foo</b><i></i>
738 </p>
739 !! end
743 ### 4-quote opening sequence tests
746 !! test
747 Italics and bold: 4-quote opening sequence: (4,2)
748 !! options
749 parsoid=wt2html
750 !! wikitext
751 ''''foo''
752 !! html/*
753 <p>''<i>foo</i>
754 </p>
755 !!end
757 # same html as previous, but wikitext adjusted to match parsoid html2wt
758 !! test
759 Italics and bold: 4-quote opening sequence: (4,2) w/ nowiki
760 !! wikitext
761 <nowiki>''</nowiki>''foo''
762 !! html
763 <p>''<i>foo</i>
764 </p>
765 !! end
767 !! test
768 Italics and bold: 4-quote opening sequence: (4,3)
769 !! wikitext
770 ''''foo'''
771 !! html/*
772 <p>'<b>foo</b>
773 </p>
774 !!end
776 !! test
777 Italics and bold: 4-quote opening sequence: (4,4)
778 !! options
779 parsoid=wt2html
780 !! wikitext
781 ''''foo''''
782 !! html/*
783 <p>'<b>foo'</b>
784 </p>
785 !!end
787 # same html as previous, but wikitext adjusted to match parsoid html2wt
788 !! test
789 Italics and bold: 4-quote opening sequence: (4,4) w/ nowiki
790 !! wikitext
791 '<nowiki/>'''foo''''
792 !! html
793 <p>'<b>foo'</b>
794 </p>
795 !! end
797 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
798 !! test
799 Italics and bold: 4-quote opening sequence: (4,5)
800 !! options
801 parsoid=wt2html
802 !! wikitext
803 ''''foo'''''
804 !! html/php
805 <p>'<b>foo</b>
806 </p>
807 !! html/parsoid
808 <p>'<b>foo</b><i></i>
809 </p>
810 !!end
812 # same html as previous, but wikitext adjusted to match parsoid html2wt
813 !! test
814 Italics and bold: 4-quote opening sequence: (4,5+2) w/ nowiki
815 !! wikitext
816 '<nowiki/>'''foo'''''<nowiki/>''
817 !! html/php
818 <p>'<b>foo</b>
819 </p>
820 !! html/parsoid
821 <p>'<b>foo</b><i></i>
822 </p>
823 !! end
827 ### 5-quote opening sequence tests
830 !! test
831 Italics and bold: 5-quote opening sequence: (5,2)
832 !! options
833 parsoid=wt2html
834 !! wikitext
835 '''''foo''
836 !! html/*
837 <p><b><i>foo</i></b>
838 </p>
839 !!end
841 # same html as previous, but wikitext adjusted to match parsoid html2wt
842 !! test
843 Italics and bold: 5-quote opening sequence: (5,2+3)
844 !! wikitext
845 '''''foo'''''
846 !! html/*
847 <p><i><b>foo</b></i>
848 </p>
849 !! end
851 !! test
852 Italics and bold: 5-quote opening sequence: (5,3)
853 !! options
854 parsoid=wt2html
855 !! wikitext
856 '''''foo'''
857 !! html/*
858 <p><i><b>foo</b></i>
859 </p>
860 !!end
862 # same html as previous, but wikitext adjusted to match parsoid html2wt
863 !! test
864 Italics and bold: 5-quote opening sequence: (5,3+2)
865 !! wikitext
866 '''''foo'''''
867 !! html
868 <p><i><b>foo</b></i>
869 </p>
870 !! end
872 !! test
873 Italics and bold: 5-quote opening sequence: (5,4)
874 !! options
875 parsoid=wt2html
876 !! wikitext
877 '''''foo''''
878 !! html/*
879 <p><i><b>foo'</b></i>
880 </p>
881 !!end
883 !! test
884 Italics and bold: 5-quote opening sequence: (5,5)
885 !! wikitext
886 '''''foo'''''
887 !! html
888 <p><i><b>foo</b></i>
889 </p>
890 !!end
892 !! test
893 Italics and bold: 5-quote opening sequence: (5,6)
894 !! wikitext
895 '''''foo''''''
896 !! html/*
897 <p><i><b>foo'</b></i>
898 </p>
899 !! end
902 ### multiple quote sequences in a line
904 !! test
905 Italics and bold: multiple quote sequences: (2,4,2)
906 !! options
907 parsoid=wt2html
908 !! wikitext
909 ''foo''''bar''
910 !! html/*
911 <p><i>foo'<b>bar</b></i>
912 </p>
913 !!end
916 # same html as previous, but wikitext adjusted to match parsoid html2wt
917 !! test
918 Italics and bold: multiple quote sequences: (2,4,2+3) w/ nowiki
919 !! wikitext
920 ''foo'<nowiki/>'''bar'''''
921 !! html
922 <p><i>foo'<b>bar</b></i>
923 </p>
924 !! end
927 !! test
928 Italics and bold: multiple quote sequences: (2,4,3)
929 !! options
930 parsoid=wt2html
931 !! wikitext
932 ''foo''''bar'''
933 !! html/*
934 <p><i>foo'<b>bar</b></i>
935 </p>
936 !!end
939 # same html as previous, but wikitext adjusted to match parsoid html2wt
940 !! test
941 Italics and bold: multiple quote sequences: (2,4,3+2) w/ nowiki
942 !! wikitext
943 ''foo'<nowiki/>'''bar'''''
944 !! html
945 <p><i>foo'<b>bar</b></i>
946 </p>
947 !! end
950 !! test
951 Italics and bold: multiple quote sequences: (2,4,4)
952 !! options
953 parsoid=wt2html
954 !! wikitext
955 ''foo''''bar''''
956 !! html/*
957 <p><i>foo'<b>bar'</b></i>
958 </p>
959 !!end
962 # same html as previous, but wikitext adjusted to match parsoid html2wt
963 !! test
964 Italics and bold: multiple quote sequences: (2,4,4+2) w/ nowiki
965 !! wikitext
966 ''foo'<nowiki/>'''bar'<nowiki/>'''''
967 !! html
968 <p><i>foo'<b>bar'</b></i>
969 </p>
970 !! end
973 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
974 !! test
975 Italics and bold: multiple quote sequences: (3,4,2)
976 !! options
977 parsoid=wt2html
978 !! wikitext
979 '''foo''''bar''
980 !! html/php
981 <p><b>foo'</b>bar
982 </p>
983 !! html/parsoid
984 <p><b>foo'</b>bar<i></i>
985 </p>
986 !!end
988 # same html as previous, but wikitext adjusted to match parsoid html2wt
989 !! test
990 Italics and bold: multiple quote sequences: (3,4,2+2) w/ nowiki
991 !! options
992 parsoid
993 !! wikitext
994 '''<nowiki>foo'</nowiki>'''bar''<nowiki/>''
995 !! html/php
996 <p><b>foo'</b>bar
997 </p>
998 !! html/parsoid
999 <p><b><span typeof="mw:Nowiki">foo'</span></b>bar<i></i>
1000 </p>
1001 !! end
1004 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
1005 !! test
1006 Italics and bold: multiple quote sequences: (3,4,3)
1007 !! options
1008 parsoid=wt2html
1009 !! wikitext
1010 '''foo''''bar'''
1011 !! html/php
1012 <p><b>foo'</b>bar
1013 </p>
1014 !! html/parsoid
1015 <p><b>foo'</b>bar<b></b>
1016 </p>
1017 !!end
1019 # same html as previous, but wikitext adjusted to match parsoid html2wt
1020 !! test
1021 Italics and bold: multiple quote sequences: (3,4,3+3) w/ nowiki
1022 !! wikitext
1023 '''<nowiki>foo'</nowiki>'''bar'''<nowiki/>'''
1024 !! html/php
1025 <p><b>foo'</b>bar
1026 </p>
1027 !! html/parsoid
1028 <p><b><span typeof="mw:Nowiki">foo'</span></b>bar<b></b>
1029 </p>
1030 !! end
1033 ### other quote tests
1035 !! test
1036 Italics and bold: other quote tests: (2,3,5)
1037 !! wikitext
1038 ''this is about '''foo's family'''''
1039 !! html
1040 <p><i>this is about <b>foo's family</b></i>
1041 </p>
1042 !!end
1045 !! test
1046 Italics and bold: other quote tests: (2,(3,3),2)
1047 !! wikitext
1048 ''this is about '''foo's''' family''
1049 !! html
1050 <p><i>this is about <b>foo's</b> family</i>
1051 </p>
1052 !!end
1055 !! test
1056 Italics and bold: other quote tests: (3,2,3,2)
1057 !! options
1058 parsoid=wt2html
1059 !! wikitext
1060 '''this is about ''foo'''s family''
1061 !! html/*
1062 <p><b>this is about <i>foo</i></b><i>s family</i>
1063 </p>
1064 !!end
1067 # same html as previous, but wikitext adjusted to match parsoid html2wt
1068 !! test
1069 Italics and bold: other quote tests: (3,2,3+2+2,2)
1070 !! wikitext
1071 '''this is about ''foo'''''<nowiki/>''s family''
1072 !! html
1073 <p><b>this is about <i>foo</i></b><i>s family</i>
1074 </p>
1075 !! end
1078 !! test
1079 Italics and bold: other quote tests: (3,2,3,3)
1080 !! wikitext
1081 '''this is about ''foo'''s family'''
1082 !! html/*
1083 <p>'<i>this is about </i>foo<b>s family</b>
1084 </p>
1085 !!end
1088 !! test
1089 Italics and bold: other quote tests: (3,(2,2),3)
1090 !! wikitext
1091 '''this is about ''foo's'' family'''
1092 !! html
1093 <p><b>this is about <i>foo's</i> family</b>
1094 </p>
1095 !!end
1098 !! test
1099 Italicized possessive
1100 !! wikitext
1101 The ''[[Main Page]]'''s talk page.
1102 !! html/php
1103 <p>The <i><a href="/wiki/Main_Page" title="Main Page">Main Page</a>'</i>s talk page.
1104 </p>
1105 !! html/parsoid
1106 <p>The <i><a rel="mw:WikiLink"  href="Main_Page" title="Main Page">Main Page</a>'</i>s talk page.</p>
1107 !! end
1109 !! test
1110 Parsoid only: Quote balancing context should be restricted to td/th cells on the same wikitext line
1111 (Requires tidy for PHP parser output to be fixed up)
1112 !! options
1113 parsoid=wt2html,wt2wt
1114 !! wikitext
1116 !''a!!''b
1117 |''a||''b
1119 !! html/php+tidy
1120 <table>
1121 <tr>
1122 <th><i>a</i></th>
1123 <th><i>b</i></th>
1124 <td><i>a</i></td>
1125 <td><i>b</i></td>
1126 </tr>
1127 </table>
1128 !! html/parsoid
1129 <table>
1130 <tbody><tr><th><i>a</i></th><th><i>b</i></th>
1131 <td><i>a</i></td><td><i>b</i></td></tr>
1132 </tbody></table>
1133 !! end
1136 ### Non-html5 tags
1139 !! test
1140 Non-html5 tags should be accepted
1141 !! wikitext
1142 <center>''foo''</center>
1143 <big>''foo''</big>
1144 <font>''foo''</font>
1145 <strike>''foo''</strike>
1146 <tt>''foo''</tt>
1147 !! html
1148 <center><i>foo</i></center>
1149 <p><big><i>foo</i></big>
1150 <font><i>foo</i></font>
1151 <strike><i>foo</i></strike>
1152 <tt><i>foo</i></tt>
1153 </p>
1154 !! end
1156 !! test
1157 <wbr> is valid wikitext (bug 52468)
1158 !! wikitext
1159 <wbr>
1160 !! html
1161 <p><wbr />
1162 </p>
1163 !! end
1165 # <strike> is HTML4, <s> is HTML4/5.
1166 !! test
1167 <s> or <strike> for strikethrough
1168 !! wikitext
1169 <strike>strike</strike>
1171 <s>s</s>
1172 !! html
1173 <p><strike>strike</strike>
1174 </p><p><s>s</s>
1175 </p>
1176 !! end
1178 ## a not permitted
1179 ## i,b,br omitted
1180 !! test
1181 Text-level semantic html elements in wikitext
1182 !! wikitext
1183 <em>text</em>
1184 <strong>text</strong>
1185 <small>text</small>
1186 <s>text</s>
1187 <cite>text</cite>
1188 <q>text</q>
1189 <dfn>text</dfn>
1190 <abbr>text</abbr>
1191 <data>text</data>
1192 <time>text</time>
1193 <code>text</code>
1194 <var>text</var>
1195 <samp>text</samp>
1196 <kbd>text</kbd>
1197 <sub>text</sub>
1198 <u>text</u>
1199 <mark>text</mark>
1200 <ruby><rb>明日</rb><rp>(</rp><rt>Ashita</rt><rp> </rp><rtc>あした</rtc><rp>)</rp></ruby>
1201 <bdi>text</bdi>
1202 <bdo>text</bdo>
1203 <span>text</span>
1204 <wbr />
1205 !! html
1206 <p><em>text</em>
1207 <strong>text</strong>
1208 <small>text</small>
1209 <s>text</s>
1210 <cite>text</cite>
1211 <q>text</q>
1212 <dfn>text</dfn>
1213 <abbr>text</abbr>
1214 <data>text</data>
1215 <time>text</time>
1216 <code>text</code>
1217 <var>text</var>
1218 <samp>text</samp>
1219 <kbd>text</kbd>
1220 <sub>text</sub>
1221 <u>text</u>
1222 <mark>text</mark>
1223 <ruby><rb>明日</rb><rp>(</rp><rt>Ashita</rt><rp> </rp><rtc>あした</rtc><rp>)</rp></ruby>
1224 <bdi>text</bdi>
1225 <bdo>text</bdo>
1226 <span>text</span>
1227 <wbr />
1228 </p>
1229 !! end
1231 # test cases taken from
1232 # http://www.w3.org/TR/html5/text-level-semantics.html#the-ruby-element
1233 !! test
1234 Ruby markup (W3C-style)
1235 !! wikitext
1236 ; Mono-ruby for individual base characters
1237 : <ruby>日<rt>に</rt>本<rt>ほん</rt>語<rt>ご</rt></ruby>
1238 ; Group ruby
1239 : <ruby>今日<rt>きょう</rt></ruby>
1240 ; Jukugo ruby
1241 : <ruby>法<rb>華</rb><rb>経</rb><rt>ほ</rt><rt>け</rt><rt>きょう</rt></ruby>
1242 ; Inline ruby
1243 : <ruby>東<rb>京</rb><rp>(</rp><rt>とう</rt><rt>きょう</rt><rp>)</rp></ruby>
1244 ; Double-sided ruby
1245 : <ruby><rb>旧</rb><rb>金</rb><rb>山</rb><rt>jiù</rt><rt>jīn</rt><rt>shān</rt><rtc>San Francisco</rtc></ruby>
1246 <ruby>
1247 <rb>♥</rb><rtc><rt>Heart</rt></rtc><rtc lang="fr"><rt>Cœur</rt></rtc>
1248 <rb>☘</rb><rtc><rt>Shamrock</rt></rtc><rtc lang="fr"><rt>Trèfle</rt></rtc>
1249 <rb>✶</rb><rtc><rt>Star</rt></rtc><rtc lang="fr"><rt>Étoile</rt></rtc>
1250 </ruby>
1251 !! html
1252 <dl><dt> Mono-ruby for individual base characters</dt>
1253 <dd> <ruby>日<rt>に</rt>本<rt>ほん</rt>語<rt>ご</rt></ruby></dd>
1254 <dt> Group ruby</dt>
1255 <dd> <ruby>今日<rt>きょう</rt></ruby></dd>
1256 <dt> Jukugo ruby</dt>
1257 <dd> <ruby>法<rb>華</rb><rb>経</rb><rt>ほ</rt><rt>け</rt><rt>きょう</rt></ruby></dd>
1258 <dt> Inline ruby</dt>
1259 <dd> <ruby>東<rb>京</rb><rp>(</rp><rt>とう</rt><rt>きょう</rt><rp>)</rp></ruby></dd>
1260 <dt> Double-sided ruby</dt>
1261 <dd> <ruby><rb>旧</rb><rb>金</rb><rb>山</rb><rt>jiù</rt><rt>jīn</rt><rt>shān</rt><rtc>San Francisco</rtc></ruby></dd></dl>
1262 <p><ruby>
1263 <rb>♥</rb><rtc><rt>Heart</rt></rtc><rtc lang="fr"><rt>Cœur</rt></rtc>
1264 <rb>☘</rb><rtc><rt>Shamrock</rt></rtc><rtc lang="fr"><rt>Trèfle</rt></rtc>
1265 <rb>✶</rb><rtc><rt>Star</rt></rtc><rtc lang="fr"><rt>Étoile</rt></rtc>
1266 </ruby>
1267 </p>
1268 !! end
1270 # The next two test different paths in the sanitizer.
1271 !! test
1272 Non-word characters don't terminate tag names (bug 17663, 40670, 52022)
1273 !! wikitext
1274 <blockquote|>a</blockquote>
1276 <b→> doesn't terminate </b→>
1278 <bä> doesn't terminate </bä>
1280 <boo> doesn't terminate </boo>
1282 <s.foo> doesn't terminate </s.foo>
1284 <sub-ID#1>
1285 !! html
1286 <p>&lt;blockquote|&gt;a&lt;/blockquote&gt;
1287 </p><p>&lt;b→&gt; doesn't terminate &lt;/b→&gt;
1288 </p><p>&lt;bä&gt; doesn't terminate &lt;/bä&gt;
1289 </p><p>&lt;boo&gt; doesn't terminate &lt;/boo&gt;
1290 </p><p>&lt;s.foo&gt; doesn't terminate &lt;/s.foo&gt;
1291 </p><p>&lt;sub-ID#1&gt;
1292 </p>
1293 !! end
1295 # There is a tidy bug here: http://sourceforge.net/p/tidy/bugs/946/
1296 # If the non-word-character tag made it through the sanitizer, tidy
1297 # would munge it up.
1298 !! test
1299 Non-word characters don't terminate tag names + tidy
1300 !! wikitext
1301 <blockquote|>a</blockquote>
1303 <b→> doesn't terminate </b→>
1305 <bä> doesn't terminate </bä>
1307 <boo> doesn't terminate </boo>
1309 <s.foo> doesn't terminate </s.foo>
1311 <sub-ID#1>
1312 !! html+tidy
1313 <p>&lt;blockquote|&gt;a</p>
1314 <p>&lt;b→&gt; doesn't terminate &lt;/b→&gt;</p>
1315 <p>&lt;bä&gt; doesn't terminate &lt;/bä&gt;</p>
1316 <p>&lt;boo&gt; doesn't terminate &lt;/boo&gt;</p>
1317 <p>&lt;s.foo&gt; doesn't terminate &lt;/s.foo&gt;</p>
1318 <p>&lt;sub-ID#1&gt;</p>
1319 !! end
1322 ### See tests/parser/parserTestsParserHook.php for the <tåg> extension)
1323 ### This checks that HTML5 tags (with non-word characters in the tag
1324 ### name) make it safely through the parser -- the Sanitizer will
1325 ### munge them later, as it should.
1327 !! test
1328 Non-word characters are valid in extension tags (T19663)
1329 !! wikitext
1330 <tåg>tåg</tåg>
1331 !! html/php
1332 <pre>
1333 'tåg'
1334 array (
1336 </pre>
1338 !! html/parsoid
1339 <pre typeof="mw:Extension/tåg" data-mw='{"name":"tåg","attrs":{},"body":{"extsrc":"tåg"}}' data-parsoid='{}' about="#mwt2"></pre>
1340 !! end
1342 !! test
1343 Isolated close tags should be treated as literal text (bug 52760)
1344 !! options
1345 parsoid=wt2html
1346 !! wikitext
1347 </b>
1349 <s.foo>s</s>
1350 !! html/php+tidy
1351 <p>&lt;s.foo&gt;s</p>
1352 !! html/parsoid
1353 <p>&lt;s.foo&gt;s</p>
1354 !! end
1357 ### Special characters
1360 !! test
1361 Bare pipe character (bug 52363)
1362 !! wikitext
1364 !! html
1365 <p>|
1366 </p>
1367 !! end
1369 !! test
1370 Bare pipe character from a template (bug 52363)
1371 !! wikitext
1372 {{pipe}}
1373 !! html
1374 <p>|
1375 </p>
1376 !! end
1379 ### <nowiki> test cases
1382 !! test
1383 <nowiki> unordered list
1384 !! wikitext
1385 <nowiki>* This is not an unordered list item.</nowiki>
1386 !! html/php
1387 <p>* This is not an unordered list item.
1388 </p>
1389 !! html/parsoid
1390 <p><span typeof="mw:Nowiki">* This is not an unordered list item.</span></p>
1391 !! end
1393 !! test
1394 <nowiki> spacing
1395 !! wikitext
1396 <nowiki>Lorem ipsum dolor
1398 sed abit.
1399   sed nullum.
1401 :and a colon
1402 </nowiki>
1403 !! html/php
1404 <p>Lorem ipsum dolor
1406 sed abit.
1407   sed nullum.
1409 :and a colon
1411 </p>
1412 !! html/parsoid
1413 <p><span typeof="mw:Nowiki">Lorem ipsum dolor
1415 sed abit.
1416   sed nullum.
1418 :and a colon
1419 </span></p>
1420 !! end
1422 !! test
1423 nowiki 3
1424 !! wikitext
1425 :There is not nowiki.
1426 :There is <nowiki>nowiki</nowiki>.
1428 #There is not nowiki.
1429 #There is <nowiki>nowiki</nowiki>.
1431 *There is not nowiki.
1432 *There is <nowiki>nowiki</nowiki>.
1433 !! html/php
1434 <dl><dd>There is not nowiki.</dd>
1435 <dd>There is nowiki.</dd></dl>
1436 <ol><li>There is not nowiki.</li>
1437 <li>There is nowiki.</li></ol>
1438 <ul><li>There is not nowiki.</li>
1439 <li>There is nowiki.</li></ul>
1441 !! html/parsoid
1442 <dl><dd data-parsoid='{}'>There is not nowiki.</dd>
1443 <dd data-parsoid='{}'>There is <span typeof="mw:Nowiki">nowiki</span>.</dd></dl>
1445 <ol><li data-parsoid='{}'>There is not nowiki.</li>
1446 <li data-parsoid='{}'>There is <span typeof="mw:Nowiki">nowiki</span>.</li></ol>
1448 <ul><li data-parsoid='{}'>There is not nowiki.</li>
1449 <li data-parsoid='{}'>There is <span typeof="mw:Nowiki">nowiki</span>.</li></ul>
1450 !! end
1452 !! test
1453 Entities inside <nowiki>
1454 !! wikitext
1455 <nowiki>&lt;</nowiki>
1456 !! html
1457 <p>&lt;
1458 </p>
1459 !! end
1461 !! test
1462 Entities inside template parameters
1463 !! wikitext
1464 {{echo|&ndash;}}
1465 !! html/php+tidy
1466 <p>–</p>
1467 !! html/parsoid
1468 <p><span typeof="mw:Transclusion mw:Entity" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&amp;ndash;"}},"i":0}}]}'>&ndash;</span></p>
1469 !! end
1471 !! test
1472 Properly escape nowiki when combined with other wiki markup
1473 !! options
1474 parsoid=html2wt
1475 !! html/parsoid
1476 <p>* &lt;/nowiki&gt; tag</p>
1477 !! wikitext
1478 <nowiki>*</nowiki> <nowiki>&lt;/nowiki&gt;</nowiki> tag
1479 !! end
1481 !! test
1482 T93824: Put escaped HTML tags inside nowiki
1483 !! options
1484 parsoid=html2wt
1485 !! html/parsoid
1486 <p>&lt;h2&gt;foo&lt;/h2&gt;</p>
1487 !! wikitext
1488 <nowiki><h2>foo</h2></nowiki>
1489 !! end
1491 !! test
1492 T71950: 1. Put nowiki as close to cause as possible, even with non-quote escapable chars
1493 !! options
1494 parsoid=html2wt
1495 !! html/parsoid
1496 <p>This text: L'<a rel="mw:WikiLink" href="./Foo">Foo</a>
1497 This text: L''<a rel="mw:WikiLink" href="./Foo">Foo</a>
1498 This text: L'''<a rel="mw:WikiLink" href="./Foo">Foo</a>''</p>
1499 !! wikitext
1500 This text: L'[[Foo]]
1501 This text: L<nowiki>''</nowiki>[[Foo]]
1502 This text: L<nowiki>'''</nowiki>[[Foo]]<nowiki>''</nowiki>
1503 !! end
1505 # This test fails because wikitext whitespace is not normalized before comparing.
1506 !! test
1507 T71950: 2. Put nowiki as close to cause as possible, after ' :'
1508 !! options
1509 parsoid=html2wt
1510 !! html/parsoid
1511 <p>This text : L''<a rel="mw:WikiLink" href="./Foo">Foo</a>
1512 </p>
1513 !! wikitext
1514 This text : L<nowiki>''</nowiki>[[Foo]]
1515 !! end
1517 # This test and the next one are html2wt only as they test that incorrect wikitext
1518 # passed in template arguments gets escaped or wrapped in nowikis where required.
1519 !! test
1520 T71482: Use {{!}} instead of nowiki for single pipe in template argument
1521 !! options
1522 parsoid=html2wt
1523 !! html/parsoid
1524 <p><span typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[{&quot;template&quot;:{&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|bar&quot;}},&quot;i&quot;:0}}]}" about="#mwt1"></span>
1525 <span typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[{&quot;template&quot;:{&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|bar |[[&quot;}},&quot;i&quot;:0}}]}" about="#mwt2"></p>
1526 !! wikitext
1527 {{echo|foo{{!}}bar}}
1528 {{echo|<nowiki>foo|bar |[[</nowiki>}}
1529 !! end
1531 !! test
1532 T53961: Output correct nowikis in template arguments
1533 !! options
1534 parsoid=html2wt
1535 !! html/parsoid
1536 <p><span typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[{&quot;template&quot;:{&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;a [ b&quot;}},&quot;i&quot;:0}}]}" about="#mwt1"></span>
1537 <span typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[{&quot;template&quot;:{&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;a }} b&quot;}},&quot;i&quot;:0}}]}" about="#mwt2"></span>
1538 <span typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[{&quot;template&quot;:{&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;a [[ b&quot;}},&quot;i&quot;:0}}]}" about="#mwt3"></span>
1539 <span typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[{&quot;template&quot;:{&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;a | {{ ]]&quot;}},&quot;i&quot;:0}}]}" about="#mwt4"></span>
1540 <span typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[{&quot;template&quot;:{&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;a }&quot;}},&quot;i&quot;:0}}]}" about="#mwt5"></span></p>
1541 !! wikitext
1542 {{echo|a [ b}}
1543 {{echo|<nowiki>a }} b</nowiki>}}
1544 {{echo|<nowiki>a [[ b</nowiki>}}
1545 {{echo|<nowiki>a | {{ ]]</nowiki>}}
1546 {{echo|a <nowiki>}</nowiki>}}
1547 !! end
1549 !! test
1550 Cases where "!!" needs nowiki protection
1551 !! options
1552 parsoid=html2wt
1553 !! html/parsoid
1554 <table>
1555 <tr><th>this needs protection !! here</th></tr>
1556 </table>
1558 <table>
1559 <tr><th>this does not need
1560 protection !! here</th></tr>
1561 </table>
1562 !! wikitext
1564 !<nowiki>this needs protection !! here</nowiki>
1568 !this does not need
1569 protection !! here
1571 !! end
1574 ### Comments
1576 !! test
1577 Comments and Indent-Pre
1578 !! wikitext
1579 <!-- comment 1 --> asdf
1581 <!-- comment 1 --> asdf
1582 <!-- comment 2 -->
1584 <!-- comment 1 --> asdf
1585 <!-- comment 2 -->xyz
1587 <!-- comment 1 --> asdf
1588 <!-- comment 2 --> xyz
1589 !! html
1590 <pre>asdf
1591 </pre>
1592 <pre>asdf
1593 </pre>
1594 <pre>asdf
1595 </pre>
1596 <p>xyz
1597 </p>
1598 <pre>asdf
1600 </pre>
1601 !! end
1603 !! test
1604 Comment test 2a
1605 !! wikitext
1606 asdf
1607 <!-- comment 1 -->
1609 !! html
1610 <p>asdf
1612 </p>
1613 !! end
1615 !! test
1616 Comment test 2b
1617 !! wikitext
1618 asdf
1619 <!-- comment 1 -->
1622 !! html
1623 <p>asdf
1624 </p><p>jkl
1625 </p>
1626 !! end
1628 !! test
1629 Comment test 3
1630 !! wikitext
1631 asdf
1632 <!-- comment 1 -->
1633 <!-- comment 2 -->
1635 !! html
1636 <p>asdf
1638 </p>
1639 !! end
1641 !! test
1642 Comment test 4
1643 !! wikitext
1644 asdf<!-- comment 1 -->jkl
1645 !! html
1646 <p>asdfjkl
1647 </p>
1648 !! end
1650 !! test
1651 Comment spacing
1652 !! wikitext
1654  <!-- foo --> b <!-- bar -->
1656 !! html
1657 <p>a
1658 </p>
1659 <pre> b 
1660 </pre>
1661 <p>c
1662 </p>
1663 !! end
1665 !! test
1666 Comment whitespace
1667 !! wikitext
1668 <!-- returns a single newline, not nothing, since the newline after > is not stripped -->
1669 !! html
1671 !! end
1673 !! test
1674 Comment semantics and delimiters
1675 !! wikitext
1676 <!-- --><!----><!-----><!------>
1677 !! html/php
1679 !! html/parsoid
1680 <!-- --><!----><!--&#x2D;--><!--&#x2D;&#x2D;-->
1681 !! end
1683 !! test
1684 Comment semantics and delimiters, redux
1685 !! wikitext
1686 <!-- In SGML every "foo" here would actually show up in the text -- foo -- bar
1687 -- foo -- funky huh? ... -->
1688 !! html/php
1690 !! html/parsoid
1691 <!-- In SGML every "foo" here would actually show up in the text &#x2D;&#x2D; foo &#x2D;&#x2D; bar
1692 &#x2D;&#x2D; foo &#x2D;&#x2D; funky huh? ... -->
1693 !! end
1695 !! test
1696 Comment semantics and delimiters: directors cut
1697 !! wikitext
1698 <!-- ... However we like to keep things simple and somewhat XML-ish so we eat
1699 everything starting with < followed by !-- until the first -- and > we see,
1700 that wouldn't be valid XML however, since in XML -- has to terminate a comment
1701 -->-->
1702 !! html/php
1703 <p>--&gt;
1704 </p>
1705 !! html/parsoid
1706 <!-- ... However we like to keep things simple and somewhat XML&#x2D;ish so we eat
1707 everything starting with < followed by !&#x2D;&#x2D; until the first &#x2D;&#x2D; and &#x3E; we see,
1708 that wouldn't be valid XML however, since in XML &#x2D;&#x2D; has to terminate a comment
1709 --><p>--></p>
1710 !! end
1712 !! test
1713 Comment semantics: nesting
1714 !! wikitext
1715 <!--<!-- no, we're not going to do anything fancy here -->-->
1716 !! html/php
1717 <p>--&gt;
1718 </p>
1719 !! html/parsoid
1720 <!--<!&#x2D;&#x2D; no, we're not going to do anything fancy here --><p>--></p>
1721 !! end
1723 # Parsoid closes the unclosed comment, even if it means a slight
1724 # round-trip diff.
1725 !! test
1726 Comment semantics: unclosed comment at end
1727 !! options
1728 parsoid=wt2html,html2html
1729 !! wikitext
1730 <!--This comment will run out to the end of the document
1731 !! html/php
1733 !! html/parsoid
1734 <!--This comment will run out to the end of the document-->
1735 !! end
1737 !! test
1738 Comment semantics: normalize comments to play nice with XML and browsers
1739 !! wikitext
1740 <!-- Browsers --!> think this is closed -->
1741 <!--> This would normally be text -->
1742 <!---> As would this -->
1743 <!-- XML doesn't like trailing dashes -------->
1744 <!-- Nor doubled hyphens -- anywhere in the data -->
1745 But this is not a comment.
1746 !! html/php
1747 <p>But this is not a comment.
1748 </p>
1749 !! html/parsoid
1750 <!-- Browsers &#x2D;&#x2D;!&#x3E; think this is closed -->
1751 <!--&#x3E; This would normally be text -->
1752 <!--&#x2D;&#x3E; As would this -->
1753 <!-- XML doesn't like trailing dashes &#x2D;&#x2D;&#x2D;&#x2D;&#x2D;&#x2D;-->
1754 <!-- Nor doubled hyphens &#x2D;&#x2D; anywhere in the data -->
1755 <p>But this is not a comment.</p>
1756 !! end
1758 !! test
1759 Comment semantics: round-trip even text which contains encoded -->
1760 !! wikitext
1761 <!-- hello & goodbye - > --&gt; --&amp;gt; --&xx -->
1762 !! html/parsoid
1763 <!-- hello &#x26; goodbye &#x2D; &#x3E; &#x2D;&#x2D;&#x3E; &#x2D;&#x2D;&#x26;gt; &#x2D;&#x2D;&#x26;xx -->
1764 !! end
1766 !! test
1767 Comment in template title
1768 !! wikitext
1769 {{f<!---->oo}}
1770 !! html
1771 <p>FOO
1772 </p>
1773 !! end
1775 !! test
1776 Comment on its own line post-expand
1777 !! wikitext
1779 {{blank}}<!---->
1781 !! html
1782 <p>a
1783 </p><p>b
1784 </p>
1785 !! end
1787 !! test
1788 Comment on its own line post-expand with non-significant whitespace
1789 !! wikitext
1791  {{blank}} <!----> 
1793 !! html
1794 <p>a
1795 </p><p>b
1796 </p>
1797 !! end
1799 !! test
1800 Multiple comments should still parse as SOL-transparent
1801 !! options
1802 parsoid=wt2html,wt2wt
1803 !! wikitext
1804 <!--c1-->*a
1805 <!--c2--><!--c3--><!--c4-->*b
1806 !! html/php
1807 <ul><li>a</li>
1808 <li>b</li></ul>
1810 !! html/parsoid
1811 <!--c1--><ul>
1812 <li>a
1813 </li>
1814 <!--c2--><!--c3--><!--c4-->
1815 <li>b
1816 </li>
1817 </ul>
1818 !! end
1821 ### paragraph wrapping tests
1823 !! test
1824 No block tags
1825 !! wikitext
1829 !! html
1830 <p>a
1831 </p><p>b
1832 </p>
1833 !! end
1835 !! test
1836 Block tag on one line (<div>)
1837 !! wikitext
1838 a <div>foo</div>
1841 !! html
1842 a <div>foo</div>
1843 <p>b
1844 </p>
1845 !! html+tidy
1846 <p>a</p>
1847 <div>foo</div>
1848 <p>b</p>
1849 !! end
1851 !! test
1852 Block tag on one line (<blockquote>)
1853 !! wikitext
1854 a <blockquote>foo</blockquote>
1857 !! html
1858 a <blockquote>foo</blockquote>
1859 <p>b
1860 </p>
1861 !! html+tidy
1862 <p>a</p>
1863 <blockquote>
1864 <p>foo</p>
1865 </blockquote>
1866 <p>b</p>
1867 !! end
1869 !! test
1870 Block tag on both lines (<div>)
1871 !! wikitext
1872 a <div>foo</div>
1874 b <div>foo</div>
1875 !! html
1876 a <div>foo</div>
1877 b <div>foo</div>
1879 !! html+tidy
1880 <p>a</p>
1881 <div>foo</div>
1882 <p>b</p>
1883 <div>foo</div>
1884 !! end
1886 !! test
1887 Block tag on both lines (<blockquote>)
1888 !! wikitext
1889 a <blockquote>foo</blockquote>
1891 b <blockquote>foo</blockquote>
1892 !! html
1893 a <blockquote>foo</blockquote>
1894 b <blockquote>foo</blockquote>
1896 !! html+tidy
1897 <p>a</p>
1898 <blockquote>
1899 <p>foo</p>
1900 </blockquote>
1901 <p>b</p>
1902 <blockquote>
1903 <p>foo</p>
1904 </blockquote>
1905 !! end
1907 !! test
1908 Multiple lines without block tags
1909 !! wikitext
1910 <div>foo</div> a
1913 d<!--foo--> e
1914 x <div>foo</div> z
1915 !! html
1916 <div>foo</div> a
1917 <p>b
1919 d e
1920 </p>
1921 x <div>foo</div> z
1923 !! html+tidy
1924 <div>foo</div>
1925 <p>a</p>
1926 <p>b c d e</p>
1927 <p>x</p>
1928 <div>foo</div>
1929 <p>z</p>
1930 !! end
1932 # Tidy strips out the empty <div> tags. Parsoid doesn't.
1933 # So, we have a separate section for Parsoid. We don't want
1934 # to mimic this stripping behavior in Parsoid. It affects
1935 # editing experience and also requires us to maintain additional
1936 # info for RT-ing.
1937 !! test
1938 Empty lines between lines with block tags
1939 !! wikitext
1940 <div></div>
1943 <div></div>a
1946 <div>a</div>b
1948 <div>b</div>d
1951 <div>e</div>
1952 !! html
1953 <div></div>
1954 <p><br />
1955 </p>
1956 <div></div>a
1957 <p>b
1958 </p>
1959 <div>a</div>b
1960 <div>b</div>d
1961 <p><br />
1962 </p>
1963 <div>e</div>
1965 !! html+tidy
1966 <p><br /></p>
1967 <p>a</p>
1968 <p>b</p>
1969 <div>a</div>
1970 <p>b</p>
1971 <div>b</div>
1972 <p>d</p>
1973 <p><br /></p>
1974 <div>e</div>
1975 !! html/parsoid
1976 <div data-parsoid='{"stx":"html"}'></div>
1978 <p><br /></p>
1979 <div data-parsoid='{"stx":"html"}'></div><p>a</p>
1981 <p>b</p>
1982 <div data-parsoid='{"stx":"html"}'>a</div><p>b</p>
1984 <div data-parsoid='{"stx":"html"}'>b</div><p>d</p>
1986 <p><br /></p>
1987 <div data-parsoid='{"stx":"html"}'>e</div>
1988 !! end
1990 ## PHP parser emits output which is broken
1991 !! test
1992 Unclosed HTML p-tags should be handled properly
1993 !! wikitext
1994 <div><p>foo</div>
1998 !! html/php+tidy
1999 <div>
2000 <p>foo</p>
2001 </div>
2002 <p>a</p>
2003 <p>b</p>
2004 !! html/parsoid
2005 <div data-parsoid='{"stx":"html"}'><p data-parsoid='{"stx":"html", "autoInsertedEnd":true}'>foo</p></div>
2006 <p>a</p>
2007 <p>b</p>
2008 !! end
2010 ## SSS FIXME: I can come up with other scenarios where this doesn't work because
2011 ## of eager output of buffered tokens in the p-wrapper. But, I'm going to ignore
2012 ## them for now.
2013 !! test
2014 1. P-wrapping should leave sol-transparent tags outside p-tags where possible
2015 !! options
2016 parsoid=wt2html
2017 !! wikitext
2018 a [[Category:A1]] [[Category:A2]]
2019 [[Category:A3]]
2020 [[Category:A4]]
2021 !! html/parsoid
2022 <p>a</p>
2023 <link rel="mw:PageProp/Category" href="./Category:A1"/> <link rel="mw:PageProp/Category" href="./Category:A2"/> <link rel="mw:PageProp/Category" href="./Category:A3"/> <link rel="mw:PageProp/Category" href="./Category:A4"/>
2024 !! end
2026 !! test
2027 2. P-wrapping should leave sol-transparent tags outside p-tags where possible
2028 !! options
2029 parsoid=wt2html
2030 !! wikitext
2031 [[Category:A1]]a
2032 !! html/parsoid
2033 <link rel="mw:PageProp/Category" href="./Category:A1"/><p>a</p>
2034 !! end
2037 ### Preformatted text
2039 !! test
2040 Preformatted text
2041 !! wikitext
2042  This is some
2043  Preformatted text
2044  With ''italic''
2045  And '''bold'''
2046  And a [[Main Page|link]]
2047 !! html
2048 <pre>This is some
2049 Preformatted text
2050 With <i>italic</i>
2051 And <b>bold</b>
2052 And a <a href="/wiki/Main_Page" title="Main Page">link</a>
2053 </pre>
2054 !! end
2056 !! test
2057 Tabs don't trigger preformatted text
2058 !! wikitext
2059         This is not
2060          preformatted text.
2061  This is preformatted text.
2062         So is this.
2063 !! html/php
2064 <p>     This is not
2065          preformatted text.
2066 </p>
2067 <pre>This is preformatted text.
2068         So is this.
2069 </pre>
2070 !! html/parsoid
2071 <p>     This is not
2072          preformatted text.</p>
2073 <pre>This is preformatted text.
2074         So is this.</pre>
2075 !! end
2077 !! test
2078 Space before tab needs nowiki pre protection
2079 !! options
2080 parsoid=html2wt
2081 !! html/parsoid
2082 <p>     a</p>
2083 !! wikitext
2084 <nowiki> </nowiki>      a
2085 !! end
2087 !! test
2088 Ident preformatting with inline content
2089 !! wikitext
2091  ''b''
2092 !! html
2093 <pre>a
2094 <i>b</i>
2095 </pre>
2096 !! end
2098 !! test
2099 <pre> with <nowiki> inside (compatibility with 1.6 and earlier)
2100 !! wikitext
2101 <pre><nowiki>
2103 <cite>
2104 <em>
2105 </nowiki></pre>
2106 !! html
2107 <pre>
2108 &lt;b&gt;
2109 &lt;cite&gt;
2110 &lt;em&gt;
2111 </pre>
2113 !! end
2115 !! test
2116 Regression with preformatted in <center>
2117 !! wikitext
2118 <center>
2119  Blah
2120 </center>
2121 !! html
2122 <center>
2123 <pre>Blah
2124 </pre>
2125 </center>
2127 !! end
2129 !! test
2130 Bug 52763: Preformatted in <blockquote>
2131 !! wikitext
2132 <blockquote>
2133  Blah
2136  indented cell (no pre-wrapping!)
2138 </blockquote>
2139 !! html
2140 <blockquote>
2141 <p> Blah
2142 </p>
2143 <table>
2144 <tr>
2145 <td>
2146 <p> indented cell (no pre-wrapping!)
2147 </p>
2148 </td></tr></table>
2149 </blockquote>
2151 !! end
2153 !! test
2154 Bug 51086: Double newlines in blockquotes should be turned into paragraphs
2155 !! wikitext
2156 <blockquote>
2160 </blockquote>
2161 !! html
2162 <blockquote>
2163 <p>Foo
2164 </p><p>Bar
2165 </p>
2166 </blockquote>
2168 !! end
2170 !! test
2171 Bug 15491: <ins>/<del> in blockquote
2172 !! wikitext
2173 <blockquote>
2174 Foo <del>bar</del> <ins>baz</ins> quux
2175 </blockquote>
2176 !! html
2177 <blockquote>
2178 <p>Foo <del>bar</del> <ins>baz</ins> quux
2179 </p>
2180 </blockquote>
2182 !! end
2184 # Note that the p-wrapping is newline sensitive, which could be
2185 # considered a bug: tidy will wrap only the 'Foo' in the example
2186 # below in a <p> tag. (see comment 23-25 of bug #6200)
2187 !! test
2188 Bug 15491: <ins>/<del> in blockquote (2)
2189 !! wikitext
2190 <blockquote>Foo <del>bar</del> <ins>baz</ins> quux
2191 </blockquote>
2192 !! html
2193 <blockquote>Foo <del>bar</del> <ins>baz</ins> quux
2194 </blockquote>
2196 !! html+tidy
2197 <blockquote>
2198 <p>Foo</p>
2199 <del>bar</del> <ins>baz</ins> quux</blockquote>
2200 !! end
2202 !! test
2203 <pre> with attributes (bug 3202)
2204 !! wikitext
2205 <pre style="background: blue; color:white">Bluescreen of WikiDeath</pre>
2206 !! html
2207 <pre style="background: blue; color:white">Bluescreen of WikiDeath</pre>
2209 !! end
2211 !! test
2212 <pre> with width attribute (bug 3202)
2213 !! wikitext
2214 <pre width="8">Narrow screen goodies</pre>
2215 !! html
2216 <pre width="8">Narrow screen goodies</pre>
2218 !! end
2220 !! test
2221 <pre> with forbidden attribute (bug 3202)
2222 !! wikitext
2223 <pre width="8" onmouseover="alert(document.cookie)">Narrow screen goodies</pre>
2224 !! html
2225 <pre width="8">Narrow screen goodies</pre>
2227 !! end
2229 !! test
2230 Entities inside <pre>
2231 !! wikitext
2232 <pre>&lt;</pre>
2233 !! html
2234 <pre>&lt;</pre>
2236 !! end
2238 !! test
2239 <pre> with forbidden attribute values (bug 3202)
2240 !! wikitext
2241 <pre width="8" style="border-width: expression(alert(document.cookie))">Narrow screen goodies</pre>
2242 !! html
2243 <pre width="8" style="/* insecure input */">Narrow screen goodies</pre>
2245 !! end
2247 !! test
2248 <nowiki> inside <pre> (bug 13238)
2249 !! wikitext
2250 <pre>
2251 <nowiki>
2252 </pre>
2253 <pre>
2254 <nowiki></nowiki>
2255 </pre>
2256 <pre><nowiki><nowiki></nowiki>Foo<nowiki></nowiki></nowiki></pre>
2257 !! html
2258 <pre>
2259 &lt;nowiki&gt;
2260 </pre>
2261 <pre>
2263 </pre>
2264 <pre>&lt;nowiki&gt;Foo&lt;/nowiki&gt;</pre>
2266 !! end
2268 !! test
2269 <nowiki> inside of #tag:pre
2270 !! wikitext
2271 {{#tag:pre|Foo <nowiki>&rarr;bar</nowiki>}}
2272 !! html/php
2273 <pre>Foo &#8594;bar</pre>
2275 !! html/parsoid
2276 <pre about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"pi":[[{"k":"1"}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"#tag:pre","function":"#tag"},"params":{"1":{"wt":"Foo &lt;nowiki>&amp;rarr;bar&lt;/nowiki>"}},"i":0}}]}'>Foo <span typeof="mw:Entity">→</span>bar</pre>
2277 !! end
2279 !! test
2280 <nowiki> and <pre> preference (first one wins)
2281 !! wikitext
2282 <pre>
2283 <nowiki>
2284 </pre>
2285 </nowiki>
2286 </pre>
2288 <nowiki>
2289 <pre>
2290 <nowiki>
2291 </pre>
2292 </nowiki>
2293 </pre>
2295 !! html/php
2296 <pre>
2297 &lt;nowiki&gt;
2298 </pre>
2299 <p>&lt;/nowiki&gt;
2300 &lt;/pre&gt;
2301 </p><p>
2302 &lt;pre&gt;
2303 &lt;nowiki&gt;
2304 &lt;/pre&gt;
2306 &lt;/pre&gt;
2307 </p>
2308 !! html/parsoid
2309 <pre data-parsoid='{"stx":"html","strippedNL":true}'>&lt;nowiki>
2310 </pre>
2311 <p><span typeof="mw:Placeholder" data-parsoid='{"src":"&lt;/nowiki>"}'>&lt;/nowiki></span>
2312 &lt;/pre></p>
2314 <p><span typeof="mw:Nowiki">
2315 &lt;pre>
2316 &lt;nowiki>
2317 &lt;/pre>
2318 </span>
2319 &lt;/pre></p>
2320 !! end
2322 !! test
2323 </pre> inside nowiki
2324 !! wikitext
2325 <nowiki></pre></nowiki>
2326 !! html
2327 <p>&lt;/pre&gt;
2328 </p>
2329 !! end
2331 # Parsoid doesn't strip empty tags, like Tidy does.
2332 !! test
2333 Empty pre; pre inside other HTML tags (bug 54946)
2334 !! options
2335 parsoid=wt2html,wt2wt
2336 !! wikitext
2339 <div><pre>
2341 </pre></div>
2342 <pre></pre>
2343 !! html/php
2344 <p>a
2345 </p>
2346 <div><pre>
2348 </pre></div>
2349 <pre></pre>
2351 !! html/php+tidy
2352 <p>a</p>
2353 <div>
2354 <pre>
2356 </pre></div>
2357 !! html/parsoid
2358 <p>a</p>
2360 <div><pre>foo
2361 </pre></div>
2362 <pre></pre>
2363 !! end
2365 !! test
2366 HTML pre followed by indent-pre
2367 !! wikitext
2368 <pre>foo</pre>
2369  bar
2370 !! html
2371 <pre>foo</pre>
2372 <pre>bar
2373 </pre>
2374 !! end
2376 # Note that tidy removes the empty <p> tags from the start and end.
2377 # Parsoid does not, by design.
2378 !!test
2379 Block tag pre
2380 !! wikitext
2381 <p><pre>foo</pre></p>
2382 !! html/php+tidy
2383 <pre>
2385 </pre>
2386 !! html/parsoid
2387 <p data-parsoid='{"stx":"html","autoInsertedEnd":true}'></p><pre data-parsoid='{"stx":"html"}'>foo</pre><p data-parsoid='{"autoInsertedStart":true,"stx":"html"}'></p>
2388 !!end
2390 !!test
2391 Templates: Indent-Pre: 1a. Templates that break a line should suppress <pre>
2392 !! wikitext
2393  {{echo|}}
2394 !! html
2396 !!end
2398 !!test
2399 Templates: Indent-Pre: 1b. Templates that break a line should suppress <pre>
2400 !! wikitext
2401  {{echo|
2402 foo}}
2403 !! html
2404 <p>foo
2405 </p>
2406 !!end
2408 !! test
2409 Templates: Indent-Pre: 1c: Wrapping should be based on expanded content
2410 !! wikitext
2411  {{echo|a
2413 !! html
2414 <pre>a
2415 </pre>
2416 <p>b
2417 </p>
2418 !!end
2420 !! test
2421 Templates: Indent-Pre: 1d: Wrapping should be based on expanded content
2422 !! wikitext
2423  {{echo|a
2429 !! html
2430 <pre>a
2431 </pre>
2432 <p>b
2434 </p>
2435 <pre>d
2436 </pre>
2437 <p>e
2438 </p>
2439 !!end
2441 !!test
2442 Templates: Indent-Pre: 1e. Wrapping should be based on expanded content
2443 !! wikitext
2444 {{echo| foo}}
2446 {{echo| foo}}{{echo| bar}}
2448 {{echo| foo}}
2449 {{echo| bar}}
2451 {{echo|<!--cmt--> foo}}
2453 <!--cmt-->{{echo| foo}}
2455 {{echo|{{echo| }}bar}}
2456 !! html
2457 <pre>foo
2458 </pre>
2459 <pre>foo bar
2460 </pre>
2461 <pre>foo
2463 </pre>
2464 <pre>foo
2465 </pre>
2466 <pre>foo
2467 </pre>
2468 <pre>bar
2469 </pre>
2470 !!end
2472 !! test
2473 Templates: Indent-Pre: 1f: Wrapping should be based on expanded content
2474 !! wikitext
2475 {{echo| }}a
2477 {{echo|
2478  }}a
2480 {{echo|
2481  b}}
2483 {{echo|a
2484  }}b
2486 {{echo|a
2487 }} b
2488 !! html
2489 <pre>a
2490 </pre>
2491 <p><br />
2492 </p>
2493 <pre>a
2494 </pre>
2495 <p><br />
2496 </p>
2497 <pre>b
2498 </pre>
2499 <p>a
2500 </p>
2501 <pre>b
2502 </pre>
2503 <p>a
2504 </p>
2505 <pre>b
2506 </pre>
2507 !!end
2509 !! test
2510 Pres with newline attributes
2511 !! wikitext
2512 <pre class="one
2513 two">hi</pre>
2514 !! html/php
2515 <pre class="one two">hi</pre>
2517 !! html/parsoid
2518 <pre class="one
2519 two" data-parsoid='{"stx":"html"}'>hi</pre>
2520 !! end
2522 !! test
2523 Things that look like <pre> tags aren't treated as such
2524 !! wikitext
2525 Barack Obama <President> of the United States
2526 <President></President>
2527 !! html
2528 <p>Barack Obama &lt;President&gt; of the United States
2529 &lt;President&gt;&lt;/President&gt;
2530 </p>
2531 !! end
2533 !! test
2534 Handle broken pre-like tags (bug 64025)
2535 !! options
2536 parsoid=wt2html
2537 !! wikitext
2538 {{echo|<pre <pre>x</pre>}}
2540 <table><pre </table>
2541 !! html/php
2542 <pre>x</pre>
2543 <table>&lt;pre </table>
2545 !! html/php+tidy
2546 <pre>
2548 </pre>
2549 <p>&lt;pre</p>
2550 !! html/parsoid
2551 <pre about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"a":{"&lt;pre":null},"sa":{"&lt;pre":""},"stx":"html","pi":[[{"k":"1"}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;pre &lt;pre>x&lt;/pre>"}},"i":0}}]}'>x</pre>
2554 <p>&lt;pre </p>
2556 <table></table>
2557 !! end
2559 !! test
2560 Parsoid: handle pre with space after attribute
2561 !! options
2562 parsoid=wt2html
2563 !! wikitext
2564 <pre style="width:50%;" >{{echo|foo}}</pre>
2565 !! html/php
2566 <pre style="width:50%;">{{echo|foo}}</pre>
2568 !! html/parsoid
2569 <pre style="width:50%;">{{echo|foo}}</pre>
2570 !! end
2572 # TODO / maybe: fix wt2wt for this
2573 !! test
2574 Parsoid: Don't paragraph-wrap fosterable content
2575 !! options
2576 parsoid=wt2html
2577 !! wikitext
2579 <td></td>
2580 <td></td>
2585 !! html
2586 <table>
2588 <tbody>
2589 <tr>
2590 <td></td>
2592 <td></td></tr>
2596 </tbody></table>
2597 !! end
2599 !! test
2600 Parsoid: Don't paragraph-wrap fosterable content even if table syntax is unbalanced
2601 !! options
2602 parsoid=wt2html
2603 !! wikitext
2605 <td>
2606 <td>
2607 </td>
2612 !! html
2613 <table>
2615 <tbody>
2616 <tr>
2617 <td></td>
2619 <td>
2620 </td></tr>
2624 </tbody></table>
2625 !! end
2628 #--------------------------------------------------------------------
2629 # Transclusion parameter whitespace stripping tests
2630 # Behavior is different for positional and named parameters
2631 #--------------------------------------------------------------------
2632 !! test
2633 Templates: Strip leading and trailing whitespace from named-param values
2634 !! wikitext
2635 {{echo|1= a }}
2637 {{echo|1= {{echo|b}} }}
2639 {{echo| 1 =
2640  c }}
2642 {{echo| 1 =
2643 * d
2645 !! html
2646 <p>a
2647 </p><p>b
2648 </p><p>c
2649 </p>
2650 <ul><li> d</li></ul>
2652 !! end
2654 !! test
2655 Templates: Don't strip whitespace from positional-param values
2656 !! wikitext
2657 {{echo|a }}
2659 {{echo|{{echo|b}} }}
2661 {{echo| c 
2664 {{echo| {{echo|d}}
2667 {{echo|
2668  e}}
2670 {{echo|
2671 * f}}
2673 {{echo|
2674  }}g
2675 !! html
2676 <p>a 
2677 </p><p>b 
2678 </p>
2679 <pre>c 
2680 </pre>
2681 <p><br />
2682 </p>
2683 <pre>d
2684 </pre>
2685 <p><br />
2686 </p>
2687 <pre>e
2688 </pre>
2689 <p><br />
2690 </p>
2691 <ul><li> f</li></ul>
2692 <p><br />
2693 </p>
2694 <pre>g
2695 </pre>
2696 !! end
2698 !! test
2699 Templates: Handle empty comment-and-ws-only lines correctly
2700 !! wikitext
2701 {{echo|foo
2702 <!--should be ignored-->
2703  <!--should be ignored as well-->
2704 bar}}
2705 !! html
2706 <p>foo
2708 </p>
2709 !! end
2711 !! test
2712 Templates: Handle comments in the target
2713 !! wikitext
2714 {{echo
2715 <!-- should be ignored -->
2716 |foo}}
2718 {{echo<!-- should be ignored -->
2719 |foo}}
2721 {{echo<!-- should be ignored -->|foo}}
2723 {{<!-- should be ignored -->echo|foo}}
2724 !!html/parsoid
2725 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo\n&lt;!-- should be ignored -->\n","href":"./Template:Echo"},"params":{"1":{"wt":"foo"}},"i":0}}]}'>foo</p>
2727 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo&lt;!-- should be ignored -->\n","href":"./Template:Echo"},"params":{"1":{"wt":"foo"}},"i":0}}]}'>foo</p>
2729 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo&lt;!-- should be ignored -->","href":"./Template:Echo"},"params":{"1":{"wt":"foo"}},"i":0}}]}'>foo</p>
2731 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo"}},"i":0}}]}'>foo</p>
2732 !!end
2734 !! test
2735 Templates: Handle comments in parameter names (bug 67657)
2736 !! wikitext
2737 {{echo|1
2738 <!-- should be ignored -->
2739 =foo}}
2741 {{echo|
2742 <!-- should be ignored -->
2743 1 = foo}}
2745 {{echo|1<!-- should be ignored -->=foo}}
2747 {{echo|<!-- should be ignored -->1=foo}}
2748 !!html/parsoid
2749 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo","key":{"wt":"1\n&lt;!-- should be ignored -->"}}},"i":0}}]}'>foo</p>
2751 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo","key":{"wt":"&lt;!-- should be ignored -->\n1"}}},"i":0}}]}'>foo</p>
2753 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo","key":{"wt":"1&lt;!-- should be ignored -->"}}},"i":0}}]}'>foo</p>
2755 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo","key":{"wt":"&lt;!-- should be ignored -->1"}}},"i":0}}]}'>foo</p>
2756 !!end
2758 !! test
2759 Templates: Other wikitext in parameter names (bug 67657)
2760 !! wikitext
2761 {{echo|''1''=foo}}
2762 !!html/parsoid
2763 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"&#39;&#39;1&#39;&#39;":{"wt":"foo"}},"i":0}}]}'>{{{1}}}</p>
2764 !!html/php
2765 <p>{{{1}}}
2766 </p>
2767 !!end
2769 #--------------------------------------------------------------------
2770 # Transclusion parameter escaping tests
2771 #--------------------------------------------------------------------
2772 !! test
2773 Templates: Parsoid parameter escaping test 1
2774 !! wikitext
2775 {{echo|[foo]|{{echo|[bar]}}}}
2776 !! html/php+tidy
2777 <p>[foo]</p>
2778 !! html/parsoid
2779 <p about="#mwt1" typeof="mw:Transclusion"
2780 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[foo]"},"2":{"wt":"{{echo|[bar]}}"}},"i":0}}]}'>[foo]</p>
2781 !! end
2783 !! test
2784 Parsoid: Pipes in external links in template parameter
2785 !! wikitext
2786 {{echo|[{{echo|http://example.com}} link]}}
2787 !! html/php+tidy
2788 <p><a rel="nofollow" class="external text" href="http://example.com">link</a></p>
2789 !! html/parsoid
2790 <p><a rel="mw:ExtLink" href="http://example.com" about="#mwt31" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[{{echo|http://example.com}} link]"}},"i":0}}]}'>link</a></p>
2791 !! end
2793 !! test
2794 Parsoid: pipe in transclusion parameter
2795 !! wikitext
2796 {{echo|http://foo.com/a&#124;b}}
2797 !! html/php+tidy
2798 <p><a rel="nofollow" class="external free" href="http://foo.com/a%7Cb">http://foo.com/a%7Cb</a></p>
2799 !! html/parsoid
2800 <p><a rel="mw:ExtLink" href="http://foo.com/a|b" about="#mwt1"
2801 typeof="mw:Transclusion"
2802 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"http://foo.com/a&amp;#124;b"}},"i":0}}]}'>http://foo.com/a|b</a></p>
2803 !! end
2805 !! test
2806 Parsoid: Pipe in external link target and content in template parameter
2807 !! options
2808 parsoid=html2wt,wt2wt
2809 !! wikitext
2810 {{echo|[http://foo.com/a&#124;b a&#124;b]}}
2811 !! html/php+tidy
2812 <p><a rel="nofollow" class="external text" href="http://foo.com/a%7Cb">a|b</a></p>
2813 !! html/parsoid
2814 <p><a rel="mw:ExtLink" href="http://foo.com/a|b" about="#mwt1"
2815 typeof="mw:Transclusion"
2816 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},
2817 "params":{"1":{"wt":"[http://foo.com/a|b a|b]"}},"i":0}}]}'>a|b</a></p>
2818 !! end
2820 !! test
2821 Parsoid: Pipe in template with nested template in external link target in template parameter (seriously)
2822 !! options
2823 parsoid
2824 !! wikitext
2825 {{echo|[{{fullurl:{{FULLPAGENAME}}|action=edit}} bar]}}
2826 !! html
2827 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[{{fullurl:{{FULLPAGENAME}}|action=edit}} bar]"}},"i":0}}]}'>[Main_Page bar]</p>
2828 !! end
2830 !! test
2831 Templates: Don't escape already nowiki-escaped text in template parameters
2832 !! options
2833 parsoid=html2wt,wt2wt
2834 !! wikitext
2835 {{echo|foo<nowiki>|</nowiki>bar}}
2836 {{echo|<nowiki>&lt;div&gt;</nowiki>}}
2837 {{echo|<nowiki></nowiki>}}
2838 !! html/php+tidy
2839 <p>foo|bar &lt;div&gt;</p>
2840 !! html/parsoid
2841 <p><span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"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>
2842 <span typeof="mw:Transclusion mw:Nowiki" about="#mwt2" data-mw='{"parts":[{"template":{"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>
2843 <span typeof="mw:Transclusion mw:Nowiki" about="#mwt3" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"<nowiki></nowiki>"}},"i":0}}]}'></span>
2844 </p>
2845 !! end
2847 ## Bug 52824
2848 !! test
2849 Templates: '=' char in nested transclusions should not trigger nowiki escapes or conversion to named param
2850 !! options
2851 parsoid=html2wt,wt2wt
2852 !! wikitext
2853 {{echo|{{echo|1=bar}}}}
2854 !! html/php+tidy
2855 <p>bar</p>
2856 !! html/parsoid
2857 <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"{{echo|1=bar}}"}},"i":0}}]}'>bar</p>
2858 !! end
2860 ## Bug 56733
2861 !! test
2862 Templates parameters with special tokenizing behavior dont get modified because of arg escaping
2863 !! wikitext
2864 {{echo|a : b}}
2865 !! html/php+tidy
2866 <p>a&#160;: b</p>
2867 !! html/parsoid
2868 <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"a : b"}},"i":0}}]}'>a<span typeof="mw:DisplaySpace mw:Placeholder" data-parsoid='{"isDisplayHack":true}'> </span>: b</p>
2869 !! end
2871 ## Bug T73412
2872 !! test
2873 Templates: Preserve blank parameter names
2874 !! wikitext
2875 {{echo|=foo}}
2876 !! html/php+tidy
2877 <p>{{{1}}}</p>
2878 !! html/parsoid
2879 <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"":{"wt":"foo"}},"i":0}}]}'>{{{1}}}</p>
2880 !! end
2882 !! test
2883 Templates: Preserve blank parameter names in other positions
2884 !! wikitext
2885 {{blank_param|bar|=foo}}
2886 !! html/php+tidy
2887 <p>bar foo</p>
2888 !! html/parsoid
2889 <p about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"pi":[[{"k":"1"},{"k":"","named":true}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"blank_param","href":"./Template:Blank_param"},"params":{"1":{"wt":"bar"},"":{"wt":"foo"}},"i":0}}]}'>bar
2890 foo</p>
2891 !! end
2894 ### Parsoid-centric tests for testing RT edge cases for pre
2897 !!test
2898 1a. Indent-Pre and Comments
2899 !! wikitext
2901 <!--a-->
2903 !! html
2904 <pre>a
2905 </pre>
2906 <p>c
2907 </p>
2908 !!end
2910 !!test
2911 1b. Indent-Pre and Comments
2912 !! wikitext
2914  <!--a-->
2916 !! html
2917 <pre>a
2918 </pre>
2919 <p>c
2920 </p>
2921 !!end
2923 !!test
2924 1c. Indent-Pre and Comments
2925 !! wikitext
2926 <!--a-->  a
2928  <!--a--> a
2929 !! html
2930 <pre> a
2931 </pre>
2932 <pre> a
2933 </pre>
2934 !!end
2936 !!test
2937 1d. Indent-Pre and Comments
2938 (Pre-handler currently cannot distinguish between comment/ws order and normalizes them to [comment,ws] order)
2939 !! wikitext
2940 <!--a--> a
2942  <!--b-->b
2943 !! html
2944 <pre>a
2945 </pre>
2946 <pre>b
2947 </pre>
2948 !!end
2950 !!test
2951 2a. Indent-Pre and tables
2952 !! wikitext
2953  {|
2954  |-
2955  !h1!!h2
2956  |foo||bar
2957  |}
2958 !! html
2959 <table>
2961 <tr>
2962 <th>h1</th>
2963 <th>h2
2964 </th>
2965 <td>foo</td>
2966 <td>bar
2967 </td></tr></table>
2969 !!end
2971 !!test
2972 2b. Indent-Pre and tables
2973 !! wikitext
2974   {|
2975  |-
2976 |foo
2978 !! html
2979 <table>
2981 <tr>
2982 <td>foo
2983 </td></tr></table>
2985 !!end
2987 !!test
2988 2c. Indent-Pre and tables (bug 42252)
2989 !! wikitext
2991  |+ foo
2992  !  | bar
2994 !! html
2995 <table>
2996 <caption> foo
2997 </caption>
2998 <tr>
2999 <th> bar
3000 </th></tr></table>
3002 !!end
3004 !!test
3005 2d. Indent-Pre and tables
3006 !! wikitext
3008  {|
3009  | b
3010  |}
3011 !! html/php
3012 <pre>a
3013 </pre>
3014 <table>
3015 <tr>
3016 <td> b
3017 </td></tr></table>
3019 !! html/parsoid
3020 <pre>a</pre>
3021  <table>
3022  <tbody><tr><td> b</td></tr>
3023  </tbody></table>
3024 !!end
3026 !!test
3027 2e. Indent-Pre and table-line syntax
3028 !! wikitext
3030  | b
3031  | c
3032 !! html/php
3033 <pre>a
3034 | b
3035 | c
3036 </pre>
3037 !!end
3039 !!test
3040 2f. Indent-pre started by table-line syntax
3041 !! wikitext
3043  | b
3044  | c
3045 !! html/php
3046 <p>a
3047 </p>
3048 <pre>| b
3049 | c
3050 </pre>
3051 !! html/parsoid
3052 <p>a</p>
3053 <pre>
3054 | b
3055 | c</pre>
3056 !!end
3058 !!test
3059 3a. Indent-Pre and block tags (single-line html)
3060 !! wikitext
3061  a <p> foo </p>
3062  b <div> foo </div>
3063  c <blockquote> foo </blockquote>
3064  <span> foo </span>
3065 !! html
3066  a <p> foo </p>
3067  b <div> foo </div>
3068  c <blockquote> foo </blockquote>
3069 <pre><span> foo </span>
3070 </pre>
3071 !! html/parsoid
3072  <p>a </p><p data-parsoid='{"stx":"html"}'> foo </p>
3073  <p>b </p><div data-parsoid='{"stx":"html"}'> foo </div>
3074  <p>c </p><blockquote data-parsoid='{"stx":"html"}'> foo </blockquote>
3075 <pre><span> foo </span>
3076 </pre>
3077 !! html+tidy
3078 <p>a</p>
3079 <p>foo</p>
3080 <p>b</p>
3081 <div>foo</div>
3082 <p>c</p>
3083 <blockquote>
3084 <p>foo</p>
3085 </blockquote>
3086 <pre>
3087 <span> foo </span>
3088 </pre>
3089 !! end
3091 !!test
3092 3b. Indent-Pre and block tags (multi-line html)
3093 !! wikitext
3094  a <span>foo</span>
3095  b <div> foo </div>
3096 !! html
3097 <pre>a <span>foo</span>
3098 </pre>
3099  b <div> foo </div>
3101 !! html/parsoid
3102 <pre>a <span data-parsoid='{"stx":"html"}'>foo</span></pre>
3103  b <div data-parsoid='{"stx":"html"}'> foo </div>
3104 !! html+tidy
3105 <pre>
3106 a <span>foo</span>
3107 </pre>
3108 <p>b</p>
3109 <div>foo</div>
3110 !!end
3112 !!test
3113 3c. Indent-Pre and block tags (pre-content on separate line)
3114 !! wikitext
3116  foo
3117 </p>
3119 <div>
3120  foo
3121 </div>
3123 <center>
3124  foo
3125 </center>
3127 <blockquote>
3128  foo
3129 </blockquote>
3131 <blockquote>
3132 <pre>
3134 </pre>
3135 </blockquote>
3137 <table><tr><td>
3138  foo
3139 </td></tr></table>
3141 <ul><li>
3142   foo
3143 </li></ul>
3145 !! html
3147  foo
3148 </p>
3149 <div>
3150 <pre>foo
3151 </pre>
3152 </div>
3153 <center>
3154 <pre>foo
3155 </pre>
3156 </center>
3157 <blockquote>
3158 <p> foo
3159 </p>
3160 </blockquote>
3161 <blockquote>
3162 <pre>
3164 </pre>
3165 </blockquote>
3166 <table><tr><td>
3167 <pre>foo
3168 </pre>
3169 </td></tr></table>
3170 <ul><li>
3171   foo
3172 </li></ul>
3174 !!end
3176 !!test
3177 4. Indent-Pre and extension tags
3178 !! wikitext
3179  a <gallery>
3180 File:foobar.jpg
3181 </gallery>
3182 !! html
3183  a <ul class="gallery mw-gallery-traditional">
3184                 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
3185                         <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" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/240px-Foobar.jpg 2x" /></a></div></div>
3186                         <div class="gallerytext">
3187                         </div>
3188                 </div></li>
3189 </ul>
3191 !! html+tidy
3192 <p>a</p>
3193 <ul class="gallery mw-gallery-traditional">
3194 <li class="gallerybox" style="width: 155px">
3195 <div style="width: 155px">
3196 <div class="thumb" style="width: 150px;">
3197 <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" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/240px-Foobar.jpg 2x" /></a></div>
3198 </div>
3199 <div class="gallerytext"></div>
3200 </div>
3201 </li>
3202 </ul>
3203 !!end
3205 !! test
3206 Table wikitext syntax outside wiki-tables
3207 !! wikitext
3209 ! not a table heading
3210 |- not a table row
3211 | not a table cell
3212 | class="foo bar" | baz
3217 !! html
3218 <p>a
3219 ! not a table heading
3220 |- not a table row
3221 | not a table cell
3222 | class="foo bar" | baz
3227 </p>
3228 !! end
3230 !!test
3231 Render paragraphs when indent-pre is suppressed in blocklevels
3232 !! wikitext
3233 <blockquote>
3234  foo
3236  bar
3237 </blockquote>
3238 !! html
3239 <blockquote>
3240 <p> foo
3241 </p><p> bar
3242 </p>
3243 </blockquote>
3245 !!end
3247 !!test
3248 4. Multiple spaces at start-of-line
3249 !! wikitext
3250     <p> foo </p>
3251     foo
3252         {|
3253 |foo
3255 !! html
3256     <p> foo </p>
3257 <pre>   foo
3258 </pre>
3259 <table>
3260 <tr>
3261 <td>foo
3262 </td></tr></table>
3264 !!end
3266 ## NOTE: the leading white-space chars on empty line are significant
3267 !! test
3268 5a. White-space in indent-pre
3269 !! wikitext
3270  a<br />
3273 !! html
3274 <pre>a<br />
3277 </pre>
3278 !! end
3280 ## NOTE: the leading white-space chars on empty line are significant
3281 !! test
3282 5b. White-space in indent-pre
3283 !! wikitext
3290 !! html
3291 <pre>a
3297 </pre>
3298 !! end
3300 !! test
3301 5c. White-space in indent-pre
3302 !! wikitext
3303  ''a''
3304   ''b''
3305    ''c''
3306 !! html
3307 <pre><i>a</i>
3308  <i>b</i>
3309   <i>c</i>
3310 </pre>
3311 !! end
3313 !! test
3314 6. Pre-blocks should extend across lines with leading WS even when there is no wrappable content
3315 !! wikitext
3318  <!-- continue -->
3324 !! html
3325 <pre>a
3328 </pre>
3329 <pre>c
3331 </pre>
3332 <p>d
3333 </p>
3334 !! end
3336 !! test
3337 7a. Indent-pre and category links
3338 !! options
3339 parsoid=wt2html,wt2wt
3340 !! wikitext
3341  [[Category:foo]] <!-- No pre-wrapping -->
3342 {{echo| [[Category:foo]]}} <!-- No pre-wrapping -->
3343 !! html/php+tidy
3344 !! html/parsoid
3345  <link rel="mw:PageProp/Category" href="./Category:Foo"> <!-- No pre&#x2D;wrapping -->
3346 <span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":" [[Category:foo]]"}},"i":0}}]}'> </span><link rel="mw:PageProp/Category" href="./Category:Foo" about="#mwt1"> <!-- No pre&#x2D;wrapping -->
3347 !! end
3349 ## We used to, but no longer wt2wt this test since the default serializer
3350 ## will normalize all categories to serialize on their own line.
3351 ## This wikitext usage is going to be fairly uncommon in production and
3352 ## selser will take care of preserving formatting in those scenarios.
3353 !! test
3354 7b. Indent-pre and category links
3355 !! options
3356 parsoid=wt2html
3357 !! wikitext
3358  [[Category:foo]] a
3359  [[Category:foo]] {{echo|b}}
3360 !! html/parsoid
3361 <pre><link rel="mw:PageProp/Category" href="./Category:Foo"> a
3362  <link rel="mw:PageProp/Category" href="./Category:Foo"> <span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"b"}},"i":0}}]}'>b</span></pre>
3363 !! end
3365 !! test
3366 Indent-Pre: Newlines in comments shouldn't affect sol state
3367 !! wikitext
3368 a <!--
3370 --> b
3371 !! html/php+tidy
3372 <p>a b</p>
3373 !! html/parsoid
3374 <p>a <!--
3376 --> b</p>
3377 !! end
3380 ### HTML-pre (some to spec PHP parser behavior and some Parsoid-RT-centric)
3383 !!test
3384 HTML-pre: 1. embedded newlines
3385 !! wikitext
3386 <pre>foo</pre>
3388 <pre>
3390 </pre>
3392 <pre>
3395 </pre>
3397 <pre>
3401 </pre>
3402 !! html/php+tidy
3403 <pre>
3405 </pre>
3406 <pre>
3408 </pre>
3409 <pre>
3412 </pre>
3413 <pre>
3417 </pre>
3418 !! html/parsoid
3419 <pre data-parsoid='{"stx":"html"}'>foo</pre>
3421 <pre data-parsoid='{"stx":"html","strippedNL":"\n"}'>
3423 </pre>
3425 <pre data-parsoid='{"stx":"html"}'>
3428 </pre>
3430 <pre data-parsoid='{"stx":"html"}'>
3434 </pre>
3435 !!end
3437 !! test
3438 HTML-pre: big spaces
3439 !! wikitext
3440 <pre>
3445 haha
3450 haha
3455 </pre>
3456 !! html/php+tidy
3457 <pre>
3462 haha
3467 haha
3472 </pre>
3473 !! html/parsoid
3474 <pre data-parsoid='{"stx":"html"}'>
3479 haha
3484 haha
3489 </pre>
3490 !! end
3492 !!test
3493 HTML-pre: 2: indented text
3494 !! wikitext
3495 <pre>
3496  foo
3497 </pre>
3498 !! html
3499 <pre>
3500  foo
3501 </pre>
3503 !!end
3505 !!test
3506 HTML-pre: 3: other wikitext
3507 !! wikitext
3508 <pre>
3509 * foo
3510 # bar
3511 = no-h =
3512 '' no-italic ''
3513 [[ NoLink ]]
3514 </pre>
3515 !! html/php
3516 <pre>
3517 * foo
3518 # bar
3519 = no-h =
3520 '' no-italic ''
3521 [[ NoLink ]]
3522 </pre>
3524 !! html/parsoid
3525 <pre data-parsoid='{"stx":"html","strippedNL":true}'>* foo
3526 # bar
3527 = no-h =
3528 '' no-italic ''
3529 [[ NoLink ]]
3530 </pre>
3531 !!end
3534 ### Definition lists
3536 !! test
3537 Simple definition
3538 !! wikitext
3539 ; name : Definition
3540 !! html
3541 <dl><dt> name&#160;</dt>
3542 <dd> Definition</dd></dl>
3544 !! end
3546 !! test
3547 Definition list for indentation only
3548 !! wikitext
3549 : Indented text
3550 !! html
3551 <dl><dd> Indented text</dd></dl>
3553 !! end
3555 !! test
3556 Definition list with no space
3557 !! wikitext
3558 ;name:Definition
3559 !! html
3560 <dl><dt>name</dt>
3561 <dd>Definition</dd></dl>
3563 !!end
3565 !! test
3566 Definition list with URL link
3567 !! wikitext
3568 ; http://example.com/ : definition
3569 !! html
3570 <dl><dt> <a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&#160;</dt>
3571 <dd> definition</dd></dl>
3573 !! end
3575 !! test
3576 Definition list with bracketed URL link
3577 !! wikitext
3578 ;[http://www.example.com/ Example]:Something about it
3579 !! html
3580 <dl><dt><a rel="nofollow" class="external text" href="http://www.example.com/">Example</a></dt>
3581 <dd>Something about it</dd></dl>
3583 !! end
3585 !! test
3586 Definition list with wikilink containing colon
3587 !! wikitext
3588 ; [[Help:FAQ]]: The least-read page on Wikipedia
3589 !! html
3590 <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>
3591 <dd> The least-read page on Wikipedia</dd></dl>
3593 !! end
3595 # At Brion's and JeLuF's insistence... :)
3596 !! test
3597 Definition list with news link containing colon
3598 !! wikitext
3599 ;  news:alt.wikipedia.rox: This isn't even a real newsgroup!
3600 !! html/php
3601 <dl><dt>  <a rel="nofollow" class="external free" href="news:alt.wikipedia.rox">news:alt.wikipedia.rox</a></dt>
3602 <dd> This isn't even a real newsgroup!</dd></dl>
3604 !! html/parsoid
3605 <dl><dt>  <a rel="mw:ExtLink" href="news:alt.wikipedia.rox" data-parsoid='{"stx":"url"}'>news:alt.wikipedia.rox</a></dt><dd data-parsoid='{"stx":"row"}'> This isn't even a real newsgroup!</dd></dl>
3606 !! end
3608 !! test
3609 Malformed definition list with colon
3610 !! wikitext
3611 ;  news:alt.wikipedia.rox -- don't crash or enter an infinite loop
3612 !! html
3613 <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</dt></dl>
3615 !! end
3617 !! test
3618 Definition lists: colon in external link text
3619 !! wikitext
3620 ; [http://www.wikipedia2.org/ Wikipedia : The Next Generation]: OK, I made that up
3621 !! html
3622 <dl><dt> <a rel="nofollow" class="external text" href="http://www.wikipedia2.org/">Wikipedia&#160;: The Next Generation</a></dt>
3623 <dd> OK, I made that up</dd></dl>
3625 !! end
3627 !! test
3628 Definition lists: colon in HTML attribute
3629 !! wikitext
3630 ;<b style="display: inline">bold</b>
3631 !! html
3632 <dl><dt><b style="display: inline">bold</b></dt></dl>
3634 !! end
3636 !! test
3637 Definition lists: self-closed tag
3638 !! wikitext
3639 ;one<br/>two : two-line fun
3640 !! html
3641 <dl><dt>one<br />two&#160;</dt>
3642 <dd> two-line fun</dd></dl>
3644 !! end
3646 !! test
3647 Bug 11748: Literal closing tags
3648 !! wikitext
3649 <dl>
3650 <dt>test 1</dt>
3651 <dd>test test test test test</dd>
3652 <dt>test 2</dt>
3653 <dd>test test test test test</dd>
3654 </dl>
3655 !! html
3656 <dl>
3657 <dt>test 1</dt>
3658 <dd>test test test test test</dd>
3659 <dt>test 2</dt>
3660 <dd>test test test test test</dd>
3661 </dl>
3663 !! end
3665 !! test
3666 Definition and unordered list using wiki syntax nested in unordered list using html tags.
3667 !! wikitext
3668 <ul><li>
3669 ; term : description
3670 * unordered
3671 </li></ul>
3672 !! html
3673 <ul><li>
3674 <dl><dt> term&#160;</dt>
3675 <dd> description</dd></dl>
3676 <ul><li> unordered</li></ul>
3677 </li></ul>
3679 !! end
3681 !! test
3683 Definition list with empty definition and following paragraph
3684 !! wikitext
3685 ; term:
3686 Paragraph text
3687 !! html
3688 <dl><dt> term</dt>
3689 <dd></dd></dl>
3690 <p>Paragraph text
3691 </p>
3692 !! end
3694 !! test
3695 Nested definition lists using html syntax
3696 !! wikitext
3697 <dl><dt>x</dt>
3698 <dd>a</dd>
3699 <dd>b</dd></dl>
3701 !! end
3703 !! test
3704 Definition Lists: No nesting: Multiple dd's
3705 !! wikitext
3709 !! html
3710 <dl><dt>x</dt>
3711 <dd>a</dd>
3712 <dd>b</dd></dl>
3714 !! end
3716 !! test
3717 Definition Lists: Indentation: Regular
3718 !! wikitext
3720 ::i2
3721 :::i3
3722 !! html
3723 <dl><dd>i1
3724 <dl><dd>i2
3725 <dl><dd>i3</dd></dl></dd></dl></dd></dl>
3727 !! end
3729 !! test
3730 Definition Lists: Indentation: Missing 1st level
3731 !! wikitext
3732 ::i2
3733 :::i3
3734 !! html
3735 <dl><dd><dl><dd>i2
3736 <dl><dd>i3</dd></dl></dd></dl></dd></dl>
3738 !! end
3740 !! test
3741 Definition Lists: Indentation: Multi-level indent
3742 !! wikitext
3743 :::i3
3744 !! html
3745 <dl><dd><dl><dd><dl><dd>i3</dd></dl></dd></dl></dd></dl>
3747 !! end
3749 !! test
3750 Definition Lists: Hacky use to indent tables
3751 !! wikitext
3752 ::{|
3753 |foo
3754 |bar
3756 this text
3757 should be left alone
3758 !! html
3759 <dl><dd><dl><dd><table>
3760 <tr>
3761 <td>foo
3762 </td>
3763 <td>bar
3764 </td></tr></table></dd></dl></dd></dl>
3765 <p>this text
3766 should be left alone
3767 </p>
3768 !! end
3770 !! test
3771 Definition Lists: Hacky use to indent tables, with comments (bug 63979)
3772 !! wikitext
3773 <!-- foo -->
3774 ::{|
3775 |foo
3776 |bar
3777 |}<!-- bar -->
3778 this text
3779 should be left alone
3780 !! html/parsoid
3781 <!-- foo -->
3782 <dl><dd><dl><dd><table><tr>
3783 <td>foo</td>
3784 <td>bar</td>
3785 </tr></table><!-- bar --></dd></dl></dd></dl>
3786 <p>this text
3787 should be left alone</p>
3788 !! end
3790 !! test
3791 Definition Lists: Hacky use to indent tables, with comment before table
3792 !! wikitext
3793 ::<!-- foo -->{|
3794 |foo
3796 !! html/parsoid
3797 <dl><dd><dl><dd><!-- foo --><table><tr>
3798 <td>foo</td>
3799 </tr></table></dd></dl></dd></dl>
3800 !! end
3802 # The trailing whitespace in this test is to catch a regression in
3803 # Parsoid after T54473.
3804 !! test
3805 Definition Lists: Hacky use to indent tables (WS-insensitive)
3806 !! wikitext
3807 : {|
3809 |} 
3810 !! html/php
3811 <dl><dd><table>
3812 <tr>
3813 <td>a
3814 </td></tr></table></dd></dl>
3816 !! html/parsoid
3817 <dl><dd> <table>
3818 <tbody><tr><td>a</td></tr>
3819 </tbody></table> </dd></dl>
3820 !! end
3822 ## The PHP parser treats : items (dd) without a corresponding ; item (dt)
3823 ## as an empty dt item.  It also ignores all but the last ";" when followed
3824 ## by ":" later on.  So, ";" are not ignored in ";;;t3" but are ignored  in
3825 ## ";;;t3 :d1".  So, PHP parser behavior is a little inconsistent wrt multiple
3826 ## ";"s.
3828 ## Ex: ";;t2 ::d2" is transformed into:
3830 ## <dl>
3831 ##   <dt>t2 </dt>
3832 ##   <dd>
3833 ##     <dl>
3834 ##       <dt></dt>
3835 ##       <dd>d2</dd>
3836 ##     </dl>
3837 ##   </dd>
3838 ## </dl>
3840 ## But, Parsoid treats "; :" as a tight atomic unit and excess ":" as plain text
3841 ## So, the same wikitext above (;;t2 ::d2) is transformed into:
3843 ## <dl>
3844 ##   <dt>
3845 ##     <dl>
3846 ##       <dt>t2 </dt>
3847 ##       <dd>:d2</dd>
3848 ##     </dl>
3849 ##    </dt>
3850 ## </dl>
3852 ## All Parsoid only definition list tests have this difference.
3854 ## See also: https://phabricator.wikimedia.org/T8569
3855 ## and http://lists.wikimedia.org/pipermail/wikitext-l/2011-November/000483.html
3857 !! test
3858 Table / list interaction: indented table with lists in table contents
3859 !! wikitext
3862 | a
3863 * b
3865 | c
3866 * d
3868 !! html
3869 <dl><dd><table>
3871 <tr>
3872 <td> a
3873 <ul><li> b</li></ul>
3874 </td></tr>
3875 <tr>
3876 <td> c
3877 <ul><li> d</li></ul>
3878 </td></tr></table></dd></dl>
3880 !! end
3882 !!test
3883 Table / list interaction: lists nested in tables nested in indented lists
3884 !! wikitext
3896 !! html
3897 <dl><dd><table>
3898 <tr>
3899 <td>
3900 <dl><dd>a</dd>
3901 <dd>b</dd></dl>
3902 </td>
3903 <td>
3904 <ul><li>c</li>
3905 <li>d</li></ul>
3906 </td></tr></table></dd></dl>
3907 <ul><li>e</li>
3908 <li>f</li></ul>
3910 !!end
3912 !! test
3913 Definition Lists: Nesting: Multi-level (Parsoid only)
3914 !! options
3915 parsoid
3916 !! wikitext
3917 ;t1 :d1
3918 ;;t2 ::d2
3919 ;;;t3 :::d3
3920 !! html
3921 <dl>
3922   <dt>t1 </dt>
3923   <dd>d1</dd>
3924   <dt>
3925     <dl>
3926       <dt>t2 </dt>
3927       <dd>:d2</dd>
3928       <dt>
3929         <dl>
3930           <dt>t3 </dt>
3931           <dd>::d3</dd>
3932         </dl>
3933       </dt>
3934     </dl>
3935   </dt>
3936 </dl>
3939 !! end
3942 !! test
3943 Definition Lists: Nesting: Test 2 (Parsoid only)
3944 !! wikitext
3946 ::d2
3947 !! html/php+tidy
3948 <dl>
3949 <dt>t1</dt>
3950 <dd>
3951 <dl>
3952 <dd>d2</dd>
3953 </dl>
3954 </dd>
3955 </dl>
3956 !! html/parsoid
3957 <dl>
3958   <dt>t1</dt>
3959   <dd>
3960     <dl>
3961       <dd>d2</dd>
3962     </dl>
3963   </dd>
3964 </dl>
3966 !! end
3969 !! test
3970 Definition Lists: Nesting: Test 3 (Parsoid only)
3971 !! wikitext
3972 :;t1
3973 ::::d2
3974 !! html/php+tidy
3975 <dl>
3976 <dd>
3977 <dl>
3978 <dt>t1</dt>
3979 <dd>
3980 <dl>
3981 <dd>
3982 <dl>
3983 <dd>d2</dd>
3984 </dl>
3985 </dd>
3986 </dl>
3987 </dd>
3988 </dl>
3989 </dd>
3990 </dl>
3991 !! html/parsoid
3992 <dl>
3993   <dd>
3994     <dl>
3995       <dt>t1</dt>
3996       <dd>
3997         <dl>
3998           <dd>
3999             <dl>
4000               <dd>d2</dd>
4001             </dl>
4002           </dd>
4003         </dl>
4004       </dd>
4005     </dl>
4006   </dd>
4007 </dl>
4009 !! end
4012 !! test
4013 Definition Lists: Nesting: Test 4
4014 !! wikitext
4015 ::;t3
4016 :::d3
4017 !! html
4018 <dl><dd><dl><dd><dl><dt>t3</dt>
4019 <dd>d3</dd></dl></dd></dl></dd></dl>
4021 !! end
4024 ## The Parsoid team believes the following three test exposes a
4025 ## bug in the PHP parser.  (Parsoid team thinks the PHP parser is
4026 ## wrong to close the <dl> after the <dt> containing the <ul>.)
4027 ## It also exposes a "misfeature" in tidy, which doesn't like
4028 ## <dl> tags with a single <dt> child; it converts the <dt> into
4029 ## a <dd> in that case.  (Parsoid leaves the <dt> alone!)
4030 !! test
4031 Definition Lists: Mixed Lists: Test 1
4032 !! wikitext
4033 :;* foo
4034 ::* bar
4035 :; baz
4036 !! html/php
4037 <dl><dd><dl><dt><ul><li> foo</li>
4038 <li> bar</li></ul></dt></dl>
4039 <dl><dt> baz</dt></dl></dd></dl>
4041 !! html/php+tidy
4042 <dl>
4043 <dd>
4044 <dl>
4045 <dd>
4046 <ul>
4047 <li>foo</li>
4048 <li>bar</li>
4049 </ul>
4050 </dd>
4051 </dl>
4052 <dl>
4053 <dt>baz</dt>
4054 </dl>
4055 </dd>
4056 </dl>
4057 !! html/parsoid
4058 <dl>
4059 <dd><dl>
4060 <dt><ul>
4061 <li> foo
4062 </li>
4063 </ul></dt>
4064 <dd><ul>
4065 <li> bar
4066 </li>
4067 </ul></dd>
4068 <dt> baz</dt>
4069 </dl></dd>
4070 </dl>
4071 !! end
4073 !! test
4074 Definition Lists: Mixed Lists: Test 2
4075 !! wikitext
4076 *: d1
4077 *: d2
4078 !! html
4079 <ul><li><dl><dd> d1</dd>
4080 <dd> d2</dd></dl></li></ul>
4082 !! end
4085 !! test
4086 Definition Lists: Mixed Lists: Test 3
4087 !! wikitext
4088 *::: d1
4089 *::: d2
4090 !! html
4091 <ul><li><dl><dd><dl><dd><dl><dd> d1</dd>
4092 <dd> d2</dd></dl></dd></dl></dd></dl></li></ul>
4094 !! end
4097 !! test
4098 Definition Lists: Mixed Lists: Test 4
4099 !! wikitext
4100 *;d1 :d2
4101 *;d3 :d4
4102 !! html
4103 <ul><li><dl><dt>d1&#160;</dt>
4104 <dd>d2</dd>
4105 <dt>d3&#160;</dt>
4106 <dd>d4</dd></dl></li></ul>
4108 !! end
4111 !! test
4112 Definition Lists: Mixed Lists: Test 5
4113 !! wikitext
4114 *:d1
4115 *:: d2
4116 !! html
4117 <ul><li><dl><dd>d1
4118 <dl><dd> d2</dd></dl></dd></dl></li></ul>
4120 !! end
4123 !! test
4124 Definition Lists: Mixed Lists: Test 6
4125 !! wikitext
4126 #*:d1
4127 #*::: d3
4128 !! html
4129 <ol><li><ul><li><dl><dd>d1
4130 <dl><dd><dl><dd> d3</dd></dl></dd></dl></dd></dl></li></ul></li></ol>
4132 !! end
4135 !! test
4136 Definition Lists: Mixed Lists: Test 7
4137 !! wikitext
4138 :* d1
4139 :* d2
4140 !! html
4141 <dl><dd><ul><li> d1</li>
4142 <li> d2</li></ul></dd></dl>
4144 !! end
4147 !! test
4148 Definition Lists: Mixed Lists: Test 8
4149 !! wikitext
4150 :* d1
4151 ::* d2
4152 !! html
4153 <dl><dd><ul><li> d1</li></ul>
4154 <dl><dd><ul><li> d2</li></ul></dd></dl></dd></dl>
4156 !! end
4159 !! test
4160 Definition Lists: Mixed Lists: Test 9
4161 !! wikitext
4162 *;foo :bar
4163 !! html
4164 <ul><li><dl><dt>foo&#160;</dt>
4165 <dd>bar</dd></dl></li></ul>
4167 !! end
4170 !! test
4171 Definition Lists: Mixed Lists: Test 10
4172 !! wikitext
4173 *#;foo :bar
4174 !! html
4175 <ul><li><ol><li><dl><dt>foo&#160;</dt>
4176 <dd>bar</dd></dl></li></ol></li></ul>
4178 !! end
4180 # The Parsoid team disagrees with the PHP parser's seemingly-random
4181 # rules regarding dd/dt on the next two tests.  Parsoid is more
4182 # consistent, and recognizes the shared nesting and keeps the
4183 # still-open tags around until the nesting is complete.
4184 # (And tidy again converts <dt> to <dd> before 'bar'.)
4186 !! test
4187 Definition Lists: Mixed Lists: Test 11
4188 !! wikitext
4189 *#*#;*;;foo :bar
4190 *#*#;boo :baz
4191 !! html/php
4192 <ul><li><ol><li><ul><li><ol><li><dl><dt>foo&#160;</dt>
4193 <dd><ul><li><dl><dt><dl><dt>bar</dt></dl></dd></dl></li></ul></dd></dl>
4194 <dl><dt>boo&#160;</dt>
4195 <dd>baz</dd></dl></li></ol></li></ul></li></ol></li></ul>
4197 !! html/php+tidy
4198 <ul>
4199 <li>
4200 <ol>
4201 <li>
4202 <ul>
4203 <li>
4204 <ol>
4205 <li>
4206 <dl>
4207 <dt>foo&#160;</dt>
4208 <dd>
4209 <ul>
4210 <li>
4211 <dl>
4212 <dd>
4213 <dl>
4214 <dt>bar</dt>
4215 </dl>
4216 </dd>
4217 </dl>
4218 </li>
4219 </ul>
4220 </dd>
4221 </dl>
4222 <dl>
4223 <dt>boo&#160;</dt>
4224 <dd>baz</dd>
4225 </dl>
4226 </li>
4227 </ol>
4228 </li>
4229 </ul>
4230 </li>
4231 </ol>
4232 </li>
4233 </ul>
4234 !! html/parsoid
4235 <ul>
4236 <li>
4237 <ol>
4238 <li>
4239 <ul>
4240 <li>
4241 <ol>
4242 <li>
4243 <dl>
4244 <dt>
4245 <ul>
4246 <li>
4247 <dl>
4248 <dt>
4249 <dl>
4250 <dt>foo<span typeof="mw:Placeholder" data-parsoid='{"src":" "}'>&nbsp;</span></dt>
4251 <dd data-parsoid='{"stx":"row"}'>bar</dd>
4252 </dl></dt>
4253 </dl></li>
4254 </ul></dt>
4255 <dt>boo<span typeof="mw:Placeholder" data-parsoid='{"src":" "}'>&nbsp;</span></dt>
4256 <dd data-parsoid='{"stx":"row"}'>baz</dd>
4257 </dl></li>
4258 </ol></li>
4259 </ul></li>
4260 </ol></li>
4261 </ul>
4262 !! end
4265 # Another case where tidy converts a <dt> to a <dd> (but Parsoid doesn't).
4266 # From whitelist:
4267 # * The test is wrong, there are two colons where there should be :;
4268 # * The PHP parser is wrong to close the <dl> after the <dt> containing the <ul>.
4269 !! test
4270 Definition Lists: Weird Ones: Test 1
4271 !! wikitext
4272 *#;*::;; foo : bar (who uses this?)
4273 !! html/php
4274 <ul><li><ol><li><dl><dt> foo&#160;</dt>
4275 <dd><ul><li><dl><dd><dl><dd><dl><dt><dl><dt> bar (who uses this?)</dt></dl></dd></dl></dd></dl></dd></dl></li></ul></dd></dl></li></ol></li></ul>
4277 !! html/php+tidy
4278 <ul>
4279 <li>
4280 <ol>
4281 <li>
4282 <dl>
4283 <dt>foo&#160;</dt>
4284 <dd>
4285 <ul>
4286 <li>
4287 <dl>
4288 <dd>
4289 <dl>
4290 <dd>
4291 <dl>
4292 <dd>
4293 <dl>
4294 <dt>bar (who uses this?)</dt>
4295 </dl>
4296 </dd>
4297 </dl>
4298 </dd>
4299 </dl>
4300 </dd>
4301 </dl>
4302 </li>
4303 </ul>
4304 </dd>
4305 </dl>
4306 </li>
4307 </ol>
4308 </li>
4309 </ul>
4310 !! html/parsoid
4311 <ul>
4312 <li>
4313 <ol>
4314 <li>
4315 <dl>
4316 <dt>
4317 <ul>
4318 <li>
4319 <dl>
4320 <dd>
4321 <dl>
4322 <dd>
4323 <dl>
4324 <dt>
4325 <dl>
4326 <dt> foo<span typeof="mw:DisplaySpace mw:Placeholder" data-parsoid='{"src":" ","isDisplayHack":true}'> </span></dt>
4327 <dd data-parsoid='{"stx":"row"}'> bar (who uses this?)</dd>
4328 </dl></dt>
4329 </dl></dd>
4330 </dl></dd>
4331 </dl></li>
4332 </ul></dt>
4333 </dl></li>
4334 </ol></li>
4335 </ul>
4336 !! end
4338 !! test
4339 Definition Lists: colons occurring in tags
4340 !! wikitext
4341 ;a:b
4342 ;'''a:b'''
4343 ;<i>a:b</i>
4344 ;<span>a:b</span>
4345 ;<div>a:b</div>
4346 ;<div>a
4347 :b</div>
4348 ;{{echo|a:b}}
4349 ;{{echo|''a:b''}}
4350 ;;;''a:b''
4351 !! html+tidy
4352 <dl>
4353 <dt>a</dt>
4354 <dd>b</dd>
4355 <dt><b>a:b</b></dt>
4356 <dt><i>a:b</i></dt>
4357 <dt><span>a:b</span></dt>
4358 <dd>
4359 <div>a:b</div>
4360 </dd>
4361 <dd>
4362 <div>a
4363 <dl>
4364 <dd>b</dd>
4365 </dl>
4366 </div>
4367 </dd>
4368 <dt>a</dt>
4369 <dd>b</dd>
4370 <dt><i>a:b</i></dt>
4371 </dl>
4372 <dl>
4373 <dd>
4374 <dl>
4375 <dd>
4376 <dl>
4377 <dt><i>a:b</i></dt>
4378 </dl>
4379 </dd>
4380 </dl>
4381 </dd>
4382 </dl>
4383 !! html/parsoid
4384 <dl><dt>a</dt><dd data-parsoid='{"stx":"row"}'>b</dd>
4385 <dt><b>a:b</b></dt>
4386 <dt><i data-parsoid='{"stx":"html"}'>a:b</i></dt>
4387 <dt><span data-parsoid='{"stx":"html"}'>a:b</span></dt>
4388 <dt><div data-parsoid='{"stx":"html"}'>a:b</div></dt>
4389 <dt><div data-parsoid='{"stx":"html","autoInsertedEnd":true}'>a</div></dt>
4390 <dd>b</dd>
4391 <dt><span about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"pi":[[{"k":"1"}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"a:b"}},"i":0}}]}'>a:b</span></dt>
4392 <dt><i about="#mwt2" typeof="mw:Transclusion" data-parsoid='{"pi":[[{"k":"1"}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&#39;&#39;a:b&#39;&#39;"}},"i":0}}]}'>a:b</i>
4393 <dl><dt><dl><dt><i>a:b</i></dt></dl></dt></dl></dt></dl>
4394 !! end
4396 !! test
4397 Definition Lists: colons and tables 1
4398 !! wikitext
4400 | x
4403 | y
4405 !! html
4406 <dl><dd><table>
4407 <tr>
4408 <td> x
4409 </td></tr></table></dd></dl>
4410 <dl><dd><table>
4411 <tr>
4412 <td> y
4413 </td></tr></table></dd></dl>
4415 !! end
4417 # Parsoid's output (as documented below) differs from php's in this case.
4418 # This is probably a bug. If we fixup parsoid to match php's output, the
4419 # above test should pass and the below test case can be removed. It is
4420 # unclear which output is more desirable.
4422 !! test
4423 Definition Lists: colons and tables 2
4424 !! wikitext
4426 | x
4429 | y
4431 !! html/parsoid
4432 <dl><dd><table>
4433 <tr>
4434 <td> x
4435 </td></tr></table></dd>
4436 <dd><table>
4437 <tr>
4438 <td> y
4439 </td></tr></table></dd></dl>
4440 !! end
4442 !! test
4443 Definition Lists: template interaction
4444 !! wikitext
4445 ::{{definition_list}}
4447 :one
4448 ::{{definition_list}}
4449 :::two
4450 :::three
4451 ::four
4452 !! html/parsoid
4453 <dl><dd><dl data-parsoid='{}'><dd about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"pi":[[]]}' data-mw='{"parts":[":",{"template":{"target":{"wt":"definition_list","href":"./Template:Definition_list"},"params":{},"i":0}}]}'>one</dd><span about="#mwt1">
4454 </span><dd about="#mwt1">two</dd></dl></dd></dl>
4456 <dl><dd data-parsoid='{}'>one
4457 <dl><dd about="#mwt2" typeof="mw:Transclusion" data-parsoid='{"pi":[[]]}' data-mw='{"parts":["::",{"template":{"target":{"wt":"definition_list","href":"./Template:Definition_list"},"params":{},"i":0}},"\n:::two\n:::three"]}'>one</dd><span about="#mwt2">
4458 </span><dd about="#mwt2">two
4459 <dl><dd>two</dd>
4460 <dd>three</dd></dl></dd>
4461 <dd data-parsoid='{}'>four</dd></dl></dd></dl>
4462 !! end
4466 ### External links
4468 !! test
4469 External links: non-bracketed
4470 !! wikitext
4471 Non-bracketed: http://example.com
4472 !! html
4473 <p>Non-bracketed: <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4474 </p>
4475 !! end
4477 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
4478 !! test
4479 External links: numbered
4480 !! wikitext
4481 Numbered: [http://example.com]
4482 Numbered: [http://example.net]
4483 Numbered: [http://example.com]
4484 !! html/php
4485 <p>Numbered: <a rel="nofollow" class="external autonumber" href="http://example.com">[1]</a>
4486 Numbered: <a rel="nofollow" class="external autonumber" href="http://example.net">[2]</a>
4487 Numbered: <a rel="nofollow" class="external autonumber" href="http://example.com">[3]</a>
4488 </p>
4489 !! html/parsoid
4490 <p>Numbered: <a rel="mw:ExtLink" href="http://example.com"></a>
4491 Numbered: <a rel="mw:ExtLink" href="http://example.net"></a>
4492 Numbered: <a rel="mw:ExtLink" href="http://example.com"></a></p>
4493 !!end
4495 !! test
4496 External links: specified text
4497 !! wikitext
4498 Specified text: [http://example.com link]
4499 !! html
4500 <p>Specified text: <a rel="nofollow" class="external text" href="http://example.com">link</a>
4501 </p>
4502 !!end
4504 !! test
4505 External links: trail
4506 !! wikitext
4507 Linktrails should not work for external links: [http://example.com link]s
4508 !! html
4509 <p>Linktrails should not work for external links: <a rel="nofollow" class="external text" href="http://example.com">link</a>s
4510 </p>
4511 !! end
4513 !! test
4514 External links: dollar sign in URL
4515 !! wikitext
4516 http://example.com/1$2345
4517 !! html
4518 <p><a rel="nofollow" class="external free" href="http://example.com/1$2345">http://example.com/1$2345</a>
4519 </p>
4520 !! end
4522 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
4523 !! test
4524 External links: dollar sign in URL (autonumber)
4525 !! wikitext
4526 [http://example.com/1$2345]
4527 !! html/php
4528 <p><a rel="nofollow" class="external autonumber" href="http://example.com/1$2345">[1]</a>
4529 </p>
4530 !! html/parsoid
4531 <p><a rel="mw:ExtLink" href="http://example.com/1$2345"></a></p>
4532 !!end
4534 !! test
4535 External links: open square bracket forbidden in URL (bug 4377)
4536 !! options
4537 parsoid=wt2html,wt2wt,html2html
4538 !! wikitext
4539 http://example.com/1[2345
4540 !! html/php
4541 <p><a rel="nofollow" class="external free" href="http://example.com/1">http://example.com/1</a>[2345
4542 </p>
4543 !! html/parsoid
4544 <p><a rel="mw:ExtLink" href="http://example.com/1">http://example.com/1</a>[2345</p>
4545 !! end
4547 !! test
4548 External links: open square bracket forbidden in URL (named) (bug 4377)
4549 !! options
4550 parsoid=wt2html,html2html
4551 !! wikitext
4552 [http://example.com/1[2345]
4553 !! html/php
4554 <p><a rel="nofollow" class="external text" href="http://example.com/1">[2345</a>
4555 </p>
4556 !! html/parsoid
4557 <p><a rel="mw:ExtLink" href="http://example.com/1">[2345</a></p>
4558 !!end
4560 # parsoid adds a space before the link name
4561 !! test
4562 External links: open square bracket forbidden in URL (named) (bug 4377)
4563 Parsoid variant.
4564 !! wikitext
4565 [http://example.com/1 [2345]
4566 !! html
4567 <p><a rel="nofollow" class="external text" href="http://example.com/1">[2345</a>
4568 </p>
4569 !!end
4571 !! test
4572 External links: nowiki in URL link text (bug 6230)
4573 !! wikitext
4574 [http://example.com/ <nowiki>''example site''</nowiki>]
4575 !! html
4576 <p><a rel="nofollow" class="external text" href="http://example.com/">''example site''</a>
4577 </p>
4578 !! end
4580 !! test
4581 External links: newline forbidden in text (bug 6230 regression check)
4582 !! wikitext
4583 [http://example.com/ first
4584 second]
4585 !! html
4586 <p>[<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a> first
4587 second]
4588 </p>
4589 !!end
4591 !! test
4592 External links: Pipe char between url and text
4593 !! wikitext
4594 [http://example.com | link]
4595 !! html
4596 <p><a rel="nofollow" class="external text" href="http://example.com">| link</a>
4597 </p>
4598 !!end
4600 !! test
4601 External links: protocol-relative URL in brackets
4602 !! wikitext
4603 [//example.com/ Test]
4604 !! html
4605 <p><a rel="nofollow" class="external text" href="//example.com/">Test</a>
4606 </p>
4607 !! end
4609 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
4610 !! test
4611 External links: protocol-relative URL in brackets without text
4612 !! wikitext
4613 [//example.com]
4614 !! html/php
4615 <p><a rel="nofollow" class="external autonumber" href="//example.com">[1]</a>
4616 </p>
4617 !! html/parsoid
4618 <p><a rel="mw:ExtLink" href="//example.com"></a></p>
4619 !! end
4621 !! test
4622 External links: protocol-relative URL in free text is left alone
4623 !! wikitext
4624 //example.com/Foo
4625 !! html
4626 <p>//example.com/Foo
4627 </p>
4628 !!end
4630 !! test
4631 External links: protocol-relative URL in the middle of a word is left alone (bug 30269)
4632 !! wikitext
4633 foo//example.com/Foo
4634 !! html
4635 <p>foo//example.com/Foo
4636 </p>
4637 !! end
4639 !! test
4640 External links: with no contents
4641 !! wikitext
4642 [http://en.wikipedia.org/wiki/Foo]
4644 [[wikipedia:Foo|Bar]]
4646 [[wikipedia:Foo|<span>Bar</span>]]
4647 !! html/php
4648 <p><a rel="nofollow" class="external autonumber" href="http://en.wikipedia.org/wiki/Foo">[1]</a>
4649 </p><p><a href="http://en.wikipedia.org/wiki/Foo" class="extiw" title="wikipedia:Foo">Bar</a>
4650 </p><p><a href="http://en.wikipedia.org/wiki/Foo" class="extiw" title="wikipedia:Foo"><span>Bar</span></a>
4651 </p>
4652 !! html/parsoid
4653 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo"></a></p>
4654 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo" title="wikipedia:Foo">Bar</a></p>
4655 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo" title="wikipedia:Foo"><span>Bar</span></a></p>
4656 !! end
4658 !! test
4659 External links: Free with trailing punctuation
4660 !! wikitext
4661 http://example.com,
4662 http://example.com;
4663 http://example.com\
4664 http://example.com.
4665 http://example.com:
4666 http://example.com!
4667 http://example.com?
4668 http://example.com)
4669 http://example.com/url_with_(brackets)
4670 (http://example.com/url_without_brackets)
4671 http://example.com/url_with_entity&amp;
4672 http://example.com/url_with_entity&#x26;
4673 http://example.com/url_with_entity&#038;
4674 http://example.com/url_with_entity&nbsp;
4675 http://example.com/url_with_entity&#xA0;
4676 http://example.com/url_with_entity&#160;
4677 http://example.com/url_with_entity&lt;
4678 http://example.com/url_with_entity&#x3C;
4679 http://example.com/url_with_entity&#60;
4680 !! html/php
4681 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>,
4682 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>;
4683 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>\
4684 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>.
4685 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>:
4686 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>!
4687 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>?
4688 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
4689 <a rel="nofollow" class="external free" href="http://example.com/url_with_(brackets)">http://example.com/url_with_(brackets)</a>
4690 (<a rel="nofollow" class="external free" href="http://example.com/url_without_brackets">http://example.com/url_without_brackets</a>)
4691 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
4692 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
4693 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
4694 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&#160;
4695 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&#xa0;
4696 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&#160;
4697 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&lt;
4698 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&#x3c;
4699 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&#60;
4700 </p>
4701 !! html/parsoid
4702 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a>,
4703 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>;
4704 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>\
4705 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>.
4706 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>:
4707 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>!
4708 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>?
4709 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>)
4710 <a rel="mw:ExtLink" href="http://example.com/url_with_(brackets)">http://example.com/url_with_(brackets)</a>
4711 (<a rel="mw:ExtLink" href="http://example.com/url_without_brackets">http://example.com/url_without_brackets</a>)
4712 <a rel="mw:ExtLink" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
4713 <a rel="mw:ExtLink" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
4714 <a rel="mw:ExtLink" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
4715 <a rel="mw:ExtLink" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a><span typeof="mw:Entity" data-parsoid='{"src":"&amp;nbsp;","srcContent":" "}'> </span>
4716 <a rel="mw:ExtLink" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#xA0;","srcContent":" "}'> </span>
4717 <a rel="mw:ExtLink" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#160;","srcContent":" "}'> </span>
4718 <a rel="mw:ExtLink" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a><span typeof="mw:Entity" data-parsoid='{"src":"&amp;lt;","srcContent":"&lt;"}'>&lt;</span>
4719 <a rel="mw:ExtLink" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#x3C;","srcContent":"&lt;"}'>&lt;</span>
4720 <a rel="mw:ExtLink" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#60;","srcContent":"&lt;"}'>&lt;</span></p>
4721 !! end
4723 !! test
4724 External links: tricky Parsoid html2html case
4725 !! options
4726 parsoid=wt2html,wt2wt,html2html
4727 !! wikitext
4728 http://example.com/url_with_entity&amp;amp;
4729 !! html/php
4730 <p><a rel="nofollow" class="external free" href="http://example.com/url_with_entity&amp;amp">http://example.com/url_with_entity&amp;amp</a>;
4731 </p>
4732 !! html/parsoid
4733 <p><a rel="mw:ExtLink" href="http://example.com/url_with_entity&amp;amp">http://example.com/url_with_entity&amp;amp</a>;</p>
4734 !! end
4736 !! test
4737 External links: Free with trailing quotes (T113666)
4738 !! wikitext
4739 '''News:''' Stuff here
4741 news:'a'b''c''d e
4742 !! html/php
4743 <p><b>News:</b> Stuff here
4744 </p><p><a rel="nofollow" class="external free" href="news:'a'b">news:'a'b</a><i>c</i>d e
4745 </p>
4746 !! html/parsoid
4747 <p><b>News:</b> Stuff here</p>
4748 <p><a rel="mw:ExtLink" href="news:'a'b">news:'a'b</a><i>c</i>d e</p>
4749 !! end
4751 !! test
4752 External links: Lone protocols are never linked (T105697)
4753 !! wikitext
4754 http://
4755 http://;
4756 (http://)
4757 bitcoin:
4758 bitcoin:;
4759 (bitcoin:)
4760 !! html
4761 <p>http://
4762 http://;
4763 (http://)
4764 bitcoin:
4765 bitcoin:;
4766 (bitcoin:)
4767 </p>
4768 !! end
4770 !! test
4771 External links: No preceding word characters allowed (bug 65278)
4772 !! wikitext
4773 NOPEhttp://example.com
4774 N0http://example.com
4775 ok:http://example.com
4776 ok-http://example.com
4777 !! html
4778 <p>NOPEhttp://example.com
4779 N0http://example.com
4780 ok:<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4781 ok-<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4782 </p>
4783 !! end
4785 !! test
4786 External links: nofollow domain exception
4787 !! wikitext
4788 A [https://no-nofollow.org/foobar link], and another [https://example.org link].
4789 !! html
4790 <p>A <a class="external text" href="https://no-nofollow.org/foobar">link</a>, and another <a rel="nofollow" class="external text" href="https://example.org">link</a>.
4791 </p>
4792 !!end
4794 !! test
4795 External image
4796 !! wikitext
4797 External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
4798 !! html
4799 <p>External image: <img src="http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png"/>
4800 </p>
4801 !! end
4803 !! test
4804 External image from https
4805 !! wikitext
4806 External image from https: https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
4807 !! html
4808 <p>External image from https: <img src="https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png"/>
4809 </p>
4810 !! end
4812 !! test
4813 External image (when not allowed)
4814 !! options
4815 wgAllowExternalImages=0
4816 !! wikitext
4817 External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
4818 !! html
4819 <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>
4820 </p>
4821 !! end
4823 !! test
4824 Link to non-http image, no img tag
4825 !! wikitext
4826 Link to non-http image, no img tag: ftp://example.com/test.jpg
4827 !! html
4828 <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>
4829 </p>
4830 !! end
4832 !! test
4833 External links: terminating separator
4834 !! wikitext
4835 Terminating separator: http://example.com/thing,
4836 !! html
4837 <p>Terminating separator: <a rel="nofollow" class="external free" href="http://example.com/thing">http://example.com/thing</a>,
4838 </p>
4839 !! end
4841 !! test
4842 External links: intervening separator
4843 !! wikitext
4844 Intervening separator: http://example.com/1,2,3
4845 !! html
4846 <p>Intervening separator: <a rel="nofollow" class="external free" href="http://example.com/1,2,3">http://example.com/1,2,3</a>
4847 </p>
4848 !! end
4850 !! test
4851 External links: old bug with URL in query
4852 !! wikitext
4853 Old bug with URL in query: [http://example.com/thing?url=http://example.com link]
4854 !! html
4855 <p>Old bug with URL in query: <a rel="nofollow" class="external text" href="http://example.com/thing?url=http://example.com">link</a>
4856 </p>
4857 !! end
4859 !! test
4860 External links: old URL-in-URL bug, mixed protocols
4861 !! wikitext
4862 And again with mixed protocols: [ftp://example.com?url=http://example.com link]
4863 !! html
4864 <p>And again with mixed protocols: <a rel="nofollow" class="external text" href="ftp://example.com?url=http://example.com">link</a>
4865 </p>
4866 !!end
4868 !! test
4869 External links: URL in text
4870 !! wikitext
4871 URL in text: [http://example.com http://example.com]
4872 !! html
4873 <p>URL in text: <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4874 </p>
4875 !! end
4877 !! test
4878 External links: Clickable images
4879 !! wikitext
4880 ja-style clickable images: [http://example.com http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png]
4881 !! html/php
4882 <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>
4883 </p>
4884 !! html/parsoid
4885 <p>ja-style clickable images: <a rel="mw:ExtLink" href="http://example.com"><img src="http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" data-parsoid='{"type":"extlink"}'/></a></p>
4886 !! end
4888 !! test
4889 External links: raw ampersand
4890 !! wikitext
4891 Old &amp; use: http://x&y
4892 !! html
4893 <p>Old &amp; use: <a rel="nofollow" class="external free" href="http://x&amp;y">http://x&amp;y</a>
4894 </p>
4895 !! end
4897 !! test
4898 External links: encoded ampersand
4899 !! wikitext
4900 Old &amp; use: http://x&amp;y
4901 !! html/php
4902 <p>Old &amp; use: <a rel="nofollow" class="external free" href="http://x&amp;y">http://x&amp;y</a>
4903 </p>
4904 !! html/parsoid
4905 <p>Old <span typeof="mw:Entity">&amp;</span> use: <a rel="mw:ExtLink" href="http://x&amp;y">http://x&amp;y</a></p>
4906 !! end
4908 !! test
4909 External links: encoded equals (bug 6102)
4910 !! wikitext
4911 http://example.com/?foo&#61;bar
4912 !! html/php
4913 <p><a rel="nofollow" class="external free" href="http://example.com/?foo=bar">http://example.com/?foo=bar</a>
4914 </p>
4915 !! html/parsoid
4916 <p><a rel="mw:ExtLink" href="http://example.com/?foo=bar">http://example.com/?foo=bar</a></p>
4917 !! end
4920 ## Note that parsoid doesn't explicit mark autonumbered links, nor
4921 ## does it number them.  As discussed in bug 53505, we can identify
4922 ## autonumbered links via CSS.
4925 !! test
4926 External links: [raw ampersand]
4927 !! wikitext
4928 Old &amp; use: [http://x&y]
4929 !! html/php
4930 <p>Old &amp; use: <a rel="nofollow" class="external autonumber" href="http://x&amp;y">[1]</a>
4931 </p>
4932 !! html/parsoid
4933 <p>Old <span typeof="mw:Entity">&amp;</span> use: <a rel="mw:ExtLink" href="http://x&amp;y"></a></p>
4934 !! end
4936 # note that parsoid html is identical to [raw ampersand] case; so html2wt
4937 # mode will return the [raw ampersand] wikitext
4938 !! test
4939 External links: [encoded ampersand]
4940 !! options
4941 parsoid=wt2html,wt2wt,html2html
4942 !! wikitext
4943 Old &amp; use: [http://x&amp;y]
4944 !! html/php
4945 <p>Old &amp; use: <a rel="nofollow" class="external autonumber" href="http://x&amp;y">[1]</a>
4946 </p>
4947 !! html/parsoid
4948 <p>Old <span typeof="mw:Entity">&amp;</span> use: <a rel="mw:ExtLink" href="http://x&amp;y"></a></p>
4949 !! end
4951 !! test
4952 External links: [raw equals]
4953 !! wikitext
4954 [http://example.com/?foo=bar]
4955 !! html/php
4956 <p><a rel="nofollow" class="external autonumber" href="http://example.com/?foo=bar">[1]</a>
4957 </p>
4958 !! html/parsoid
4959 <p><a rel="mw:ExtLink" href="http://example.com/?foo=bar"></a></p>
4960 !! end
4962 # note that parsoid html is identical to [raw equals] case; so html2wt
4963 # mode will return the [raw equals] wikitext
4964 !! test
4965 External links: [encoded equals] (bug 6102)
4966 !! options
4967 parsoid=wt2html,wt2wt,html2html
4968 !! wikitext
4969 [http://example.com/?foo&#61;bar]
4970 !! html/php
4971 <p><a rel="nofollow" class="external autonumber" href="http://example.com/?foo=bar">[1]</a>
4972 </p>
4973 !! html/parsoid
4974 <p><a rel="mw:ExtLink" href="http://example.com/?foo=bar"></a></p>
4975 !! end
4977 # xxx parsoid strips the IDN character, so the round-trip tests will
4978 #     obviously fail and are disabled. --cscott
4979 !! test
4980 External links: [IDN ignored character reference in hostname; strip it right off]
4981 !! options
4982 parsoid=wt2html,wt2wt,html2html
4983 !! wikitext
4984 [http://e&zwnj;xample.com/]
4985 !! html/php
4986 <p><a rel="nofollow" class="external autonumber" href="http://example.com/">[1]</a>
4987 </p>
4988 !! html/parsoid
4989 <p><a rel="mw:ExtLink" href="http://example.com/"></a></p>
4990 !! end
4992 # FIXME: This test (the IDN characters in the text of a link) is an inconsistency.
4993 # Where an external link could easily circumvent the sanitization of the text of
4994 # a link like this (where an IDN-ignore character is in the URL somewhere), this
4995 # test demands a higher standard. That's a bit strange.
4997 # Example:
4999 # http://e‌xample.com -> [http://example.com|http://example.com]
5000 # [http://example.com|http://e‌xample.com] -> [http://example.com|http://e‌xample.com]
5002 # The first example is sanitized, but the second is not. Any security benefits
5003 # from this production are trivial to circumvent. Either remove this test and
5004 # let the parser(s) do their thing unaccosted, or fix the inconsistency and change
5005 # the test accordingly.
5007 # All our love,
5008 # The Parsoid team.
5009 # xxx parsoid strips the IDN character, so the round-trip tests will
5010 #     obviously fail and are disabled. --cscott
5011 !! test
5012 External links: IDN ignored character reference in hostname; strip it right off
5013 !! options
5014 parsoid=wt2html,html2html
5015 !! wikitext
5016 http://e&zwnj;xample.com/
5017 !! html/php
5018 <p><a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>
5019 </p>
5020 !! html/parsoid
5021 <p><a rel="mw:ExtLink" href="http://example.com/">http://example.com/</a></p>
5022 !! end
5024 !! test
5025 External links: www.jpeg.org (bug 554)
5026 !! wikitext
5027 http://www.jpeg.org
5028 !! html
5029 <p><a rel="nofollow" class="external free" href="http://www.jpeg.org">http://www.jpeg.org</a>
5030 </p>
5031 !! end
5033 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
5034 !! test
5035 External links: URL within URL (original bug 2)
5036 !! wikitext
5037 [http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp]
5038 !! html/php
5039 <p><a rel="nofollow" class="external autonumber" href="http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp">[1]</a>
5040 </p>
5041 !! html/parsoid
5042 <p><a rel="mw:ExtLink" href="http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp"></a></p>
5043 !! end
5045 !! test
5046 BUG 361: URL inside bracketed URL
5047 !! wikitext
5048 [http://www.example.com/foo http://www.example.com/bar]
5049 !! html
5050 <p><a rel="nofollow" class="external text" href="http://www.example.com/foo">http://www.example.com/bar</a>
5051 </p>
5052 !! end
5054 !! test
5055 BUG 361: URL within URL, not bracketed
5056 !! wikitext
5057 http://www.example.com/foo?=http://www.example.com/bar
5058 !! html
5059 <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>
5060 </p>
5061 !! end
5063 !! test
5064 BUG 289: ">"-token in URL-tail
5065 !! wikitext
5066 http://www.example.com/<hello>
5067 !! html
5068 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a>&lt;hello&gt;
5069 </p>
5070 !!end
5072 !! test
5073 BUG 289: literal ">"-token in URL-tail
5074 !! wikitext
5075 http://www.example.com/<b>html</b>
5076 !! html/php
5077 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a><b>html</b>
5078 </p>
5079 !! html/parsoid
5080 <p><a rel="mw:ExtLink" href="http://www.example.com/" data-parsoid='{"stx":"url"}'>http://www.example.com/</a><b data-parsoid='{"stx":"html"}'>html</b></p>
5081 !! end
5083 !! test
5084 BUG 289: ">"-token in bracketed URL
5085 !! wikitext
5086 [http://www.example.com/<hello> stuff]
5087 !! html
5088 <p><a rel="nofollow" class="external text" href="http://www.example.com/">&lt;hello&gt; stuff</a>
5089 </p>
5090 !!end
5092 !! test
5093 BUG 289: literal ">"-token in bracketed URL
5094 !! wikitext
5095 [http://www.example.com/<b>html</b> stuff]
5096 !! html
5097 <p><a rel="nofollow" class="external text" href="http://www.example.com/"><b>html</b> stuff</a>
5098 </p>
5099 !!end
5101 !! test
5102 BUG 289: literal double quote at end of URL
5103 !! wikitext
5104 http://www.example.com/"hello"
5105 !! html
5106 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a>"hello"
5107 </p>
5108 !!end
5110 !! test
5111 BUG 289: literal double quote in bracketed URL
5112 !! wikitext
5113 [http://www.example.com/"hello" stuff]
5114 !! html
5115 <p><a rel="nofollow" class="external text" href="http://www.example.com/">"hello" stuff</a>
5116 </p>
5117 !!end
5119 !! test
5120 External links: multiple legal whitespace is fine, Magnus. Don't break it please. (bug 5081)
5121 !! wikitext
5122 [http://www.example.com  test]
5123 !! html
5124 <p><a rel="nofollow" class="external text" href="http://www.example.com">test</a>
5125 </p>
5126 !! end
5128 !! test
5129 External links: link text with spaces
5130 !! wikitext
5131 [http://www.example.com a b c]
5132 [http://www.example.com ''a'' ''b'']
5133 !! html
5134 <p><a rel="nofollow" class="external text" href="http://www.example.com">a b c</a>
5135 <a rel="nofollow" class="external text" href="http://www.example.com"><i>a</i> <i>b</i></a>
5136 </p>
5137 !! end
5139 !! test
5140 External links: wiki links within external link (Bug 3695)
5141 !! options
5142 parsoid=wt2html,html2html
5143 !! wikitext
5144 [http://example.com [[wikilink]] embedded in ext link]
5145 !! html/php
5146 <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>
5147 </p>
5148 !! html/parsoid
5149 <p><a rel="mw:ExtLink" href="http://example.com"></a><a rel="mw:WikiLink" href="./Wikilink" title="Wikilink">wikilink</a><span> embedded in ext link</span></p>
5150 !! end
5152 !! test
5153 BUG 787: Links with one slash after the url protocol are invalid
5154 !! wikitext
5155 http:/example.com
5157 [http:/example.com title]
5158 !! html
5159 <p>http:/example.com
5160 </p><p>[http:/example.com title]
5161 </p>
5162 !! end
5164 !! test
5165 Bracketed external links with template-generated invalid target
5166 !! wikitext
5167 [{{echo|http:/example.com}} title]
5168 !! html
5169 <p>[http:/example.com title]
5170 </p>
5171 !! end
5173 !! test
5174 Bug 2702: Mismatched <i>, <b> and <a> tags are invalid
5175 !! wikitext
5176 ''[http://example.com text'']
5177 [http://example.com '''text]'''
5178 ''Something [http://example.com in italic'']
5179 ''Something [http://example.com mixed''''', even bold]'''
5180 '''''Now [http://example.com both''''']
5181 !! html
5182 <p><a rel="nofollow" class="external text" href="http://example.com"><i>text</i></a>
5183 <a rel="nofollow" class="external text" href="http://example.com"><b>text</b></a>
5184 <i>Something </i><a rel="nofollow" class="external text" href="http://example.com"><i>in italic</i></a>
5185 <i>Something </i><a rel="nofollow" class="external text" href="http://example.com"><i>mixed</i><b>, even bold</b></a>
5186 <i><b>Now </b></i><a rel="nofollow" class="external text" href="http://example.com"><i><b>both</b></i></a>
5187 </p>
5188 !! end
5191 !! test
5192 Bug 4781: %26 in URL
5193 !! wikitext
5194 http://www.example.com/?title=AT%26T
5195 !! html/php
5196 <p><a rel="nofollow" class="external free" href="http://www.example.com/?title=AT%26T">http://www.example.com/?title=AT%26T</a>
5197 </p>
5198 !! html/parsoid
5199 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=AT%26T">http://www.example.com/?title=AT%26T</a></p>
5200 !! end
5202 # According to http://www.w3.org/TR/2011/WD-html5-20110525/Overview.html#parsing-urls a plain
5203 # % is actually legal in HTML5. Any change in output would need testing though.
5204 !! test
5205 Bug 4781, 5267: %25 in URL
5206 !! wikitext
5207 http://www.example.com/?title=100%25_Bran
5208 !! html/php
5209 <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>
5210 </p>
5211 !! html/parsoid
5212 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=100%25_Bran">http://www.example.com/?title=100%25_Bran</a></p>
5213 !! end
5215 !! test
5216 Bug 4781, 5267: %28, %29 in URL
5217 !! wikitext
5218 http://www.example.com/?title=Ben-Hur_%281959_film%29
5219 !! html/php
5220 <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>
5221 </p>
5222 !! html/parsoid
5223 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">http://www.example.com/?title=Ben-Hur_%281959_film%29</a></p>
5224 !! end
5227 !! test
5228 Bug 4781: %26 in autonumber URL
5229 !! wikitext
5230 [http://www.example.com/?title=AT%26T]
5231 !! html/php
5232 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=AT%26T">[1]</a>
5233 </p>
5234 !! html/parsoid
5235 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=AT%26T"></a></p>
5236 !! end
5238 !! test
5239 Bug 4781, 5267: %26 in autonumber URL
5240 !! wikitext
5241 [http://www.example.com/?title=100%25_Bran]
5242 !! html/php
5243 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=100%25_Bran">[1]</a>
5244 </p>
5245 !! html/parsoid
5246 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=100%25_Bran"></a></p>
5247 !! end
5249 !! test
5250 Bug 4781, 5267: %28, %29 in autonumber URL
5251 !! wikitext
5252 [http://www.example.com/?title=Ben-Hur_%281959_film%29]
5253 !! html/php
5254 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">[1]</a>
5255 </p>
5256 !! html/parsoid
5257 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=Ben-Hur_%281959_film%29"></a></p>
5258 !! end
5261 !! test
5262 Bug 4781: %26 in bracketed URL
5263 !! wikitext
5264 [http://www.example.com/?title=AT%26T link]
5265 !! html/php
5266 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=AT%26T">link</a>
5267 </p>
5268 !! html/parsoid
5269 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=AT%26T">link</a></p>
5270 !! end
5272 !! test
5273 Bug 4781, 5267: %25 in bracketed URL
5274 !! wikitext
5275 [http://www.example.com/?title=100%25_Bran link]
5276 !! html
5277 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=100%25_Bran">link</a>
5278 </p>
5279 !! end
5281 !! test
5282 Bug 4781, 5267: %28, %29 in bracketed URL
5283 !! wikitext
5284 [http://www.example.com/?title=Ben-Hur_%281959_film%29 link]
5285 !! html/php
5286 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">link</a>
5287 </p>
5288 !! html/parsoid
5289 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">link</a></p>
5290 !! end
5292 !! test
5293 External link containing a period in the anchor. (bug 63947)
5294 !! wikitext
5295 [//foo.org/bar#baz. bang]
5297 [//foo.org/bar. bang]
5298 !! html/php
5299 <p><a rel="nofollow" class="external text" href="//foo.org/bar#baz.">bang</a>
5300 </p><p><a rel="nofollow" class="external text" href="//foo.org/bar.">bang</a>
5301 </p>
5302 !! html/parsoid
5303 <p><a rel="mw:ExtLink" href="//foo.org/bar#baz.">bang</a></p>
5304 <p><a rel="mw:ExtLink" href="//foo.org/bar.">bang</a></p>
5305 !! end
5307 !! test
5308 External link containing a single quote. (bug 63947)
5309 !! wikitext
5310 [//foo.org/bar'baz]
5312 [//foo.org/bar'baz bang]
5313 !! html/php
5314 <p><a rel="nofollow" class="external autonumber" href="//foo.org/bar'baz">[1]</a>
5315 </p><p><a rel="nofollow" class="external text" href="//foo.org/bar'baz">bang</a>
5316 </p>
5317 !! html/parsoid
5318 <p><a rel="mw:ExtLink" href="//foo.org/bar'baz"></a></p>
5319 <p><a rel="mw:ExtLink" href="//foo.org/bar'baz">bang</a></p>
5320 !! end
5322 !! test
5323 External link containing double-single-quotes in text '' (bug 4598 sanity check)
5324 !! wikitext
5325 Some [http://example.com/ pretty ''italics'' and stuff]!
5326 !! html
5327 <p>Some <a rel="nofollow" class="external text" href="http://example.com/">pretty <i>italics</i> and stuff</a>!
5328 </p>
5329 !! end
5331 !! test
5332 External link containing double-single-quotes in text embedded in italics (bug 4598 sanity check)
5333 !! wikitext
5334 ''Some [http://example.com/ pretty ''italics'' and stuff]!''
5335 !! html
5336 <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>
5337 </p>
5338 !! end
5340 !! test
5341 External link containing double-single-quotes with no space separating the url from text in italics
5342 !! wikitext
5343 [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]].]
5344 !! html/php
5345 <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>
5346 </p>
5347 !! html/php+tidy
5348 <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> <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>.</p>
5349 !! html/parsoid
5350 <p><a rel="mw:ExtLink" href="http://www.musee-picasso.fr/pages/page_id18528_u1l2.htm"><i>La muerte de Casagemas</i> (1901) en el sitio de </a><a rel="mw:WikiLink" href="./Museo_Picasso_(París)" title="Museo Picasso (París)">Museo Picasso</a><span>.</span></p>
5351 !! end
5353 !! test
5354 External link with comments in link text
5355 !! wikitext
5356 [http://www.google.com Google <!-- comment -->]
5357 !! html/php
5358 <p><a rel="nofollow" class="external text" href="http://www.google.com">Google </a>
5359 </p>
5360 !! html/parsoid
5361 <p><a rel="mw:ExtLink" href="http://www.google.com">Google <!-- comment --></a></p>
5362 !! end
5364 !! test
5365 External link to bare IPv4 address
5366 !! wikitext
5367 [http://192.168.0.1 Link]
5368 !! html/php
5369 <p><a rel="nofollow" class="external text" href="http://192.168.0.1">Link</a>
5370 </p>
5371 !! html/parsoid
5372 <p><a rel="mw:ExtLink" href="http://192.168.0.1">Link</a></p>
5373 !! end
5375 !! test
5376 URL-encoding in URL functions (single parameter)
5377 !! wikitext
5378 {{localurl:Some page|amp=&}}
5379 !! html
5380 <p>/index.php?title=Some_page&amp;amp=&amp;
5381 </p>
5382 !! end
5384 !! test
5385 URL-encoding in URL functions (multiple parameters)
5386 !! wikitext
5387 {{localurl:Some page|q=?&amp=&}}
5388 !! html
5389 <p>/index.php?title=Some_page&amp;q=?&amp;amp=&amp;
5390 </p>
5391 !! end
5393 !! test
5394 Brackets in urls
5395 !! wikitext
5396 http://example.com/index.php?foozoid%5B%5D=bar
5398 http://example.com/index.php?foozoid&#x5B;&#x5D;=bar
5399 !! html/php
5400 <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>
5401 </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>
5402 </p>
5403 !! html/parsoid
5404 <p><a rel="mw:ExtLink" href="http://example.com/index.php?foozoid%5B%5D=bar">http://example.com/index.php?foozoid%5B%5D=bar</a></p>
5406 <p><a rel="mw:ExtLink" href="http://example.com/index.php?foozoid[]=bar">http://example.com/index.php?foozoid[]=bar</a></p>
5407 !! end
5409 !! test
5410 IPv6 urls, autolink format (T23261)
5411 !! wikitext
5412 http://[2404:130:0:1000::187:2]/index.php
5414 Examples from RFC 2373, section 2.2:
5415 * http://[1080::8:800:200C:417A]/unicast
5416 * http://[FF01::101]/multicast
5417 * http://[::1]/loopback
5418 * http://[::]/unspecified
5419 * http://[::13.1.68.3]/ipv4compat
5420 * http://[::FFFF:129.144.52.38]/ipv4compat
5422 Examples from RFC 2732, section 2:
5423 * http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html
5424 * http://[1080:0:0:0:8:800:200C:417A]/index.html
5425 * http://[3ffe:2a00:100:7031::1]
5426 * http://[1080::8:800:200C:417A]/foo
5427 * http://[::192.9.5.5]/ipng
5428 * http://[::FFFF:129.144.52.38]:80/index.html
5429 * http://[2010:836B:4179::836B:4179]
5431 !! html/php
5432 <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>
5433 </p><p>Examples from <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc2373">RFC 2373</a>, section 2.2:
5434 </p>
5435 <ul><li> <a rel="nofollow" class="external free" href="http://[1080::8:800:200C:417A]/unicast">http://[1080::8:800:200C:417A]/unicast</a></li>
5436 <li> <a rel="nofollow" class="external free" href="http://[FF01::101]/multicast">http://[FF01::101]/multicast</a></li>
5437 <li> <a rel="nofollow" class="external free" href="http://[::1]/loopback">http://[::1]/loopback</a></li>
5438 <li> <a rel="nofollow" class="external free" href="http://[::]/unspecified">http://[::]/unspecified</a></li>
5439 <li> <a rel="nofollow" class="external free" href="http://[::13.1.68.3]/ipv4compat">http://[::13.1.68.3]/ipv4compat</a></li>
5440 <li> <a rel="nofollow" class="external free" href="http://[::FFFF:129.144.52.38]/ipv4compat">http://[::FFFF:129.144.52.38]/ipv4compat</a></li></ul>
5441 <p>Examples from <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc2732">RFC 2732</a>, section 2:
5442 </p>
5443 <ul><li> <a rel="nofollow" class="external free" href="http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html">http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html</a></li>
5444 <li> <a rel="nofollow" class="external free" href="http://[1080:0:0:0:8:800:200C:417A]/index.html">http://[1080:0:0:0:8:800:200C:417A]/index.html</a></li>
5445 <li> <a rel="nofollow" class="external free" href="http://[3ffe:2a00:100:7031::1]">http://[3ffe:2a00:100:7031::1]</a></li>
5446 <li> <a rel="nofollow" class="external free" href="http://[1080::8:800:200C:417A]/foo">http://[1080::8:800:200C:417A]/foo</a></li>
5447 <li> <a rel="nofollow" class="external free" href="http://[::192.9.5.5]/ipng">http://[::192.9.5.5]/ipng</a></li>
5448 <li> <a rel="nofollow" class="external free" href="http://[::FFFF:129.144.52.38]:80/index.html">http://[::FFFF:129.144.52.38]:80/index.html</a></li>
5449 <li> <a rel="nofollow" class="external free" href="http://[2010:836B:4179::836B:4179]">http://[2010:836B:4179::836B:4179]</a></li></ul>
5451 !! html/parsoid
5452 <p><a rel="mw:ExtLink" href="http://[2404:130:0:1000::187:2]/index.php">http://[2404:130:0:1000::187:2]/index.php</a></p>
5454 <p>Examples from <a href="//tools.ietf.org/html/rfc2373" rel="mw:ExtLink">RFC 2373</a>, section 2.2:</p>
5455 <ul><li> <a rel="mw:ExtLink" href="http://[1080::8:800:200C:417A]/unicast">http://[1080::8:800:200C:417A]/unicast</a></li>
5456 <li> <a rel="mw:ExtLink" href="http://[FF01::101]/multicast">http://[FF01::101]/multicast</a></li>
5457 <li> <a rel="mw:ExtLink" href="http://[::1]/loopback">http://[::1]/loopback</a></li>
5458 <li> <a rel="mw:ExtLink" href="http://[::]/unspecified">http://[::]/unspecified</a></li>
5459 <li> <a rel="mw:ExtLink" href="http://[::13.1.68.3]/ipv4compat">http://[::13.1.68.3]/ipv4compat</a></li>
5460 <li> <a rel="mw:ExtLink" href="http://[::FFFF:129.144.52.38]/ipv4compat">http://[::FFFF:129.144.52.38]/ipv4compat</a></li></ul>
5462 <p>Examples from <a href="//tools.ietf.org/html/rfc2732" rel="mw:ExtLink">RFC 2732</a>, section 2:</p>
5463 <ul><li> <a rel="mw:ExtLink" href="http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html">http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html</a></li>
5464 <li> <a rel="mw:ExtLink" href="http://[1080:0:0:0:8:800:200C:417A]/index.html">http://[1080:0:0:0:8:800:200C:417A]/index.html</a></li>
5465 <li> <a rel="mw:ExtLink" href="http://[3ffe:2a00:100:7031::1]">http://[3ffe:2a00:100:7031::1]</a></li>
5466 <li> <a rel="mw:ExtLink" href="http://[1080::8:800:200C:417A]/foo">http://[1080::8:800:200C:417A]/foo</a></li>
5467 <li> <a rel="mw:ExtLink" href="http://[::192.9.5.5]/ipng">http://[::192.9.5.5]/ipng</a></li>
5468 <li> <a rel="mw:ExtLink" href="http://[::FFFF:129.144.52.38]:80/index.html">http://[::FFFF:129.144.52.38]:80/index.html</a></li>
5469 <li> <a rel="mw:ExtLink" href="http://[2010:836B:4179::836B:4179]">http://[2010:836B:4179::836B:4179]</a></li></ul>
5470 !! end
5472 !! test
5473 IPv6 urls, bracketed format (T23261)
5474 !! wikitext
5475 [http://[2404:130:0:1000::187:2]/index.php test]
5477 Examples from RFC 2373, section 2.2:
5478 * [http://[1080::8:800:200C:417A] unicast]
5479 * [http://[FF01::101] multicast]
5480 * [http://[::1]/ loopback]
5481 * [http://[::] unspecified]
5482 * [http://[::13.1.68.3] ipv4compat]
5483 * [http://[::FFFF:129.144.52.38] ipv4compat]
5485 Examples from RFC 2732, section 2:
5486 * [http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html 1]
5487 * [http://[1080:0:0:0:8:800:200C:417A]/index.html 2]
5488 * [http://[3ffe:2a00:100:7031::1] 3]
5489 * [http://[1080::8:800:200C:417A]/foo 4]
5490 * [http://[::192.9.5.5]/ipng 5]
5491 * [http://[::FFFF:129.144.52.38]:80/index.html 6]
5492 * [http://[2010:836B:4179::836B:4179] 7]
5494 !! html/php
5495 <p><a rel="nofollow" class="external text" href="http://[2404:130:0:1000::187:2]/index.php">test</a>
5496 </p><p>Examples from <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc2373">RFC 2373</a>, section 2.2:
5497 </p>
5498 <ul><li> <a rel="nofollow" class="external text" href="http://[1080::8:800:200C:417A]">unicast</a></li>
5499 <li> <a rel="nofollow" class="external text" href="http://[FF01::101]">multicast</a></li>
5500 <li> <a rel="nofollow" class="external text" href="http://[::1]/">loopback</a></li>
5501 <li> <a rel="nofollow" class="external text" href="http://[::]">unspecified</a></li>
5502 <li> <a rel="nofollow" class="external text" href="http://[::13.1.68.3]">ipv4compat</a></li>
5503 <li> <a rel="nofollow" class="external text" href="http://[::FFFF:129.144.52.38]">ipv4compat</a></li></ul>
5504 <p>Examples from <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc2732">RFC 2732</a>, section 2:
5505 </p>
5506 <ul><li> <a rel="nofollow" class="external text" href="http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html">1</a></li>
5507 <li> <a rel="nofollow" class="external text" href="http://[1080:0:0:0:8:800:200C:417A]/index.html">2</a></li>
5508 <li> <a rel="nofollow" class="external text" href="http://[3ffe:2a00:100:7031::1]">3</a></li>
5509 <li> <a rel="nofollow" class="external text" href="http://[1080::8:800:200C:417A]/foo">4</a></li>
5510 <li> <a rel="nofollow" class="external text" href="http://[::192.9.5.5]/ipng">5</a></li>
5511 <li> <a rel="nofollow" class="external text" href="http://[::FFFF:129.144.52.38]:80/index.html">6</a></li>
5512 <li> <a rel="nofollow" class="external text" href="http://[2010:836B:4179::836B:4179]">7</a></li></ul>
5514 !! html/parsoid
5515 <p><a rel="mw:ExtLink" href="http://[2404:130:0:1000::187:2]/index.php">test</a></p>
5517 <p>Examples from <a href="//tools.ietf.org/html/rfc2373" rel="mw:ExtLink">RFC 2373</a>, section 2.2:</p>
5518 <ul><li> <a rel="mw:ExtLink" href="http://[1080::8:800:200C:417A]">unicast</a></li>
5519 <li> <a rel="mw:ExtLink" href="http://[FF01::101]">multicast</a></li>
5520 <li> <a rel="mw:ExtLink" href="http://[::1]/">loopback</a></li>
5521 <li> <a rel="mw:ExtLink" href="http://[::]">unspecified</a></li>
5522 <li> <a rel="mw:ExtLink" href="http://[::13.1.68.3]">ipv4compat</a></li>
5523 <li> <a rel="mw:ExtLink" href="http://[::FFFF:129.144.52.38]">ipv4compat</a></li></ul>
5525 <p>Examples from <a href="//tools.ietf.org/html/rfc2732" rel="mw:ExtLink">RFC 2732</a>, section 2:</p>
5526 <ul><li> <a rel="mw:ExtLink" href="http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html">1</a></li>
5527 <li> <a rel="mw:ExtLink" href="http://[1080:0:0:0:8:800:200C:417A]/index.html">2</a></li>
5528 <li> <a rel="mw:ExtLink" href="http://[3ffe:2a00:100:7031::1]">3</a></li>
5529 <li> <a rel="mw:ExtLink" href="http://[1080::8:800:200C:417A]/foo">4</a></li>
5530 <li> <a rel="mw:ExtLink" href="http://[::192.9.5.5]/ipng">5</a></li>
5531 <li> <a rel="mw:ExtLink" href="http://[::FFFF:129.144.52.38]:80/index.html">6</a></li>
5532 <li> <a rel="mw:ExtLink" href="http://[2010:836B:4179::836B:4179]">7</a></li></ul>
5533 !! end
5535 !! test
5536 Non-extlinks in brackets
5537 !! wikitext
5538 [foo]
5539 [foo bar]
5540 [foo ''bar'']
5541 [fool's] errand
5542 [fool's errand]
5543 [{{echo|foo}}]
5544 [{{echo|foo}} bar]
5545 [{{echo|foo}} ''bar'']
5546 [{{echo|foo}}l's] errand
5547 [{{echo|foo}}l's errand]
5548 [url={{echo|foo}}]
5549 [url=http://example.com]
5550 [http:// bare protocols don't count]
5551 !! html/php
5552 <p>[foo]
5553 [foo bar]
5554 [foo <i>bar</i>]
5555 [fool's] errand
5556 [fool's errand]
5557 [foo]
5558 [foo bar]
5559 [foo <i>bar</i>]
5560 [fool's] errand
5561 [fool's errand]
5562 [url=foo]
5563 [url=<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>]
5564 [http:// bare protocols don't count]
5565 </p>
5566 !! html/parsoid
5567 <p>[foo]
5568 [foo bar]
5569 [foo <i>bar</i>]
5570 [fool's] errand
5571 [fool's errand]
5572 [<span typeof="mw:Placeholder" data-parsoid='{"src":"{{echo|foo}}"}'>foo</span>]
5573 [<span typeof="mw:Placeholder" data-parsoid='{"src":"{{echo|foo}}"}'>foo</span> bar]
5574 [<span typeof="mw:Placeholder" data-parsoid='{"src":"{{echo|foo}}"}'>foo</span> <i>bar</i>]
5575 [<span typeof="mw:Placeholder" data-parsoid='{"src":"{{echo|foo}}l&#39;s"}'>fool's</span>] errand
5576 [<span typeof="mw:Placeholder" data-parsoid='{"src":"{{echo|foo}}l&#39;s"}'>fool's</span> errand]
5577 [<span typeof="mw:Placeholder" data-parsoid='{"src":"url={{echo|foo}}"}'>url=foo</span>]
5578 [url=<a rel="mw:ExtLink" href="http://example.com">http://example.com</a>]
5579 [http:// bare protocols don't count]</p>
5580 !! end
5582 !! test
5583 Percent encoding in external links
5584 !! wikitext
5585 [https://github.com/search?l=&q=ResourceLoader+%40wikimedia Search]
5586 !! html/php
5587 <p><a rel="nofollow" class="external text" href="https://github.com/search?l=&amp;q=ResourceLoader+%40wikimedia">Search</a>
5588 </p>
5589 !! html/parsoid
5590 <p><a rel="mw:ExtLink"
5591 href="https://github.com/search?l=&amp;q=ResourceLoader+%40wikimedia">Search</a></p>
5592 !! end
5594 !! test
5595 Use url link syntax for links where the content is equal the link target
5596 !! wikitext
5597 http://example.com
5598 !! html/php
5599 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
5600 </p>
5601 !! html/parsoid
5602 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a></p>
5603 !! end
5605 !! test
5606 Parenthesis in external links, especially URL links
5607 !! wikitext
5608 http://example.com)
5610 http://example.com/test)
5612 http://example.com/(test)
5614 http://example.com/((test)
5616 (http://example.com/(test))
5618 (http://example.com/(test)))))
5620 http://example.com/a)b
5622 [http://example.com) foo]
5623 !! html/php
5624 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
5625 </p><p><a rel="nofollow" class="external free" href="http://example.com/test">http://example.com/test</a>)
5626 </p><p><a rel="nofollow" class="external free" href="http://example.com/(test)">http://example.com/(test)</a>
5627 </p><p><a rel="nofollow" class="external free" href="http://example.com/((test)">http://example.com/((test)</a>
5628 </p><p>(<a rel="nofollow" class="external free" href="http://example.com/(test))">http://example.com/(test))</a>
5629 </p><p>(<a rel="nofollow" class="external free" href="http://example.com/(test)))))">http://example.com/(test)))))</a>
5630 </p><p><a rel="nofollow" class="external free" href="http://example.com/a)b">http://example.com/a)b</a>
5631 </p><p><a rel="nofollow" class="external text" href="http://example.com)">foo</a>
5632 </p>
5633 !! html/parsoid
5634 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a>)</p>
5635 <p><a rel="mw:ExtLink" href="http://example.com/test">http://example.com/test</a>)</p>
5636 <p><a rel="mw:ExtLink" href="http://example.com/(test)">http://example.com/(test)</a></p>
5637 <p><a rel="mw:ExtLink" href="http://example.com/((test)">http://example.com/((test)</a></p>
5638 <p>(<a rel="mw:ExtLink" href="http://example.com/(test))">http://example.com/(test))</a></p>
5639 <p>(<a rel="mw:ExtLink" href="http://example.com/(test)))))">http://example.com/(test)))))</a></p>
5640 <p><a rel="mw:ExtLink" href="http://example.com/a)b">http://example.com/a)b</a></p>
5641 <p><a rel="mw:ExtLink" href="http://example.com)">foo</a></p>
5642 !! end
5644 !! test
5645 Parenthesis in external links, w/ transclusion or comment
5646 !! wikitext
5647 (http://example.com/{{echo|hi}})
5649 (http://example.com<!-- hi -->)
5650 !! html/php
5651 <p>(<a rel="nofollow" class="external free" href="http://example.com/hi">http://example.com/hi</a>)
5652 </p><p>(<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
5653 </p>
5654 !! html/parsoid
5655 <p>(<a typeof="mw:ExpandedAttrs" about="#mwt2" rel="mw:ExtLink" href="http://example.com/hi" data-parsoid='{"stx":"url","a":{"href":"http://example.com/hi"},"sa":{"href":"http://example.com/{{echo|hi}}"}}' data-mw='{"attribs":[[{"txt":"href"},{"html":"http://example.com/&lt;span about=\"#mwt1\" typeof=\"mw:Transclusion\" data-parsoid=&#39;{\"pi\":[[{\"k\":\"1\"}]],\"dsr\":[20,31,null,null]}&#39; data-mw=&#39;{\"parts\":[{\"template\":{\"target\":{\"wt\":\"echo\",\"href\":\"./Template:Echo\"},\"params\":{\"1\":{\"wt\":\"hi\"}},\"i\":0}}]}&#39;>hi&lt;/span>"}]]}'>http://example.com/hi</a>)</p>
5657 <p>(<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url","a":{"href":"http://example.com"},"sa":{"href":"http://example.com&lt;!-- hi -->"}}'>http://example.com</a>)</p>
5658 !! end
5660 !! test
5661 Serialize <a> tags with invalid link targets as plain text
5662 !! options
5663 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
5664 !! html/parsoid
5665 <a rel="mw:WikiLink" href="[[foo]]">text</a>
5666 <a rel="mw:WikiLink" href="[[foo]]">*text</a>
5667 <a rel="mw:WikiLink" href="[[foo]]">[[foo]]</a>
5668 <a rel="mw:WikiLink" href="[[foo]]">*a [[foo]]</a>
5669 !! wikitext
5670 text
5671 <nowiki>*</nowiki>text
5672 <nowiki>[[foo]]</nowiki>
5673 <nowiki>*</nowiki>a <nowiki>[[foo]]</nowiki>
5674 !! end
5676 !! test
5677 mw:ExtLink -vs- mw:WikiLink (T94723)
5678 !! options
5679 parsoid=html2wt
5680 !! html/parsoid
5681 <a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{"stx":"piped","a":{"href":"./Foo"},"sa":{"href":"Foo"}}'>Bar</a>
5682 <a rel="mw:WikiLink" href="./Foo" title="Foo">Bar</a>
5683 <a rel="mw:WikiLink" href="http://en.wikipedia.org/wiki/Foo" title="Foo">Bar</a>
5684 <a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo" title="Foo">Bar</a>
5686 <a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/European_Robin">European Robin</a>
5687 <a rel="mw:WikiLink" href="http://en.wikipedia.org/wiki/European_Robin">European Robin</a>
5688 </p>
5689 !! wikitext
5690 [[Foo|Bar]]
5691 [[Foo|Bar]]
5692 [[wikipedia:Foo|Bar]]
5693 [[wikipedia:Foo|Bar]]
5695 [[wikipedia:European_Robin|European Robin]]
5696 [[wikipedia:European_Robin|European Robin]]
5697 !! end
5699 !! test
5700 mw:ExtLink linking to a interwiki URL can be round-tripped losslessly (T94723)
5701 !! options
5702 parsoid=wt2wt
5703 !! wikitext
5704 [http://en.wikipedia.org/wiki/European_Robin European Robin]
5705 !! html/parsoid
5706 THIS SECTION IS NOT USED (but Parsoid won't run the test without it)
5707 !! end
5711 ### Quotes
5714 !! test
5715 Quotes
5716 !! wikitext
5717 Normal text. '''Bold text.''' Normal text. ''Italic text.''
5719 Normal text. '''''Bold italic text.''''' Normal text.
5720 !! html
5721 <p>Normal text. <b>Bold text.</b> Normal text. <i>Italic text.</i>
5722 </p><p>Normal text. <i><b>Bold italic text.</b></i> Normal text.
5723 </p>
5724 !! end
5727 # Parsoid inserts an empty bold tag pair at the end of the line, that the PHP
5728 # parser strips. The wikitext contains just the first half of the bold
5729 # quote pair.
5730 !! test
5731 Unclosed and unmatched quotes
5732 !! wikitext
5733 '''''Bold italic text '''with bold deactivated''' in between.'''''
5735 '''''Bold italic text ''with italic deactivated'' in between.'''''
5737 '''Bold text..
5739 ..spanning two paragraphs (should not work).'''
5741 '''Bold tag left open
5743 ''Italic tag left open
5745 Normal text.
5747 <!-- Unmatching number of opening, closing tags: -->
5748 '''This year''''s election ''should'' beat '''last year''''s.
5750 ''Tom'''s car is bigger than ''Susan'''s.
5752 Plain ''italic'''s plain
5753 !! html/php
5754 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
5755 </p><p><b><i>Bold italic text </i>with italic deactivated<i> in between.</i></b>
5756 </p><p><b>Bold text..</b>
5757 </p><p>..spanning two paragraphs (should not work).
5758 </p><p><b>Bold tag left open</b>
5759 </p><p><i>Italic tag left open</i>
5760 </p><p>Normal text.
5761 </p><p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
5762 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
5763 </p><p>Plain <i>italic'</i>s plain
5764 </p>
5765 !! html/parsoid
5766 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
5767 </p><p><b><i>Bold italic text </i>with italic deactivated<i> in between.</i></b>
5768 </p><p><b>Bold text..</b>
5769 </p><p>..spanning two paragraphs (should not work).<b></b>
5770 </p><p><b>Bold tag left open</b>
5771 </p><p><i>Italic tag left open</i>
5772 </p><p>Normal text.
5773 </p>
5774 <!-- Unmatching number of opening, closing tags: -->
5775 <p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
5776 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
5777 </p><p>Plain <i>italic'</i>s plain
5778 </p>
5779 !! end
5782 ### Tables
5784 ### some content taken from http://meta.wikimedia.org/wiki/MediaWiki_User%27s_Guide:_Using_tables
5787 # This should not produce <table></table> as <table><tr><td></td></tr></table>
5788 # is the bare minimum required by the spec, see:
5789 # http://www.w3.org/TR/xhtml-modularization/dtd_module_defs.html#a_module_Basic_Tables
5790 # Parsoid team replies: empty table tags are legal in HTML5
5791 !! test
5792 A table with no data.
5793 !! options
5794 parsoid=wt2html
5795 !! wikitext
5796 {||}
5797 !! html/php
5799 !! html/parsoid
5800 <table></table>
5802 !! end
5804 !! test
5805 A table with stray table end tags on start tag line (wt2html)
5806 !! options
5807 parsoid=wt2html
5808 !! wikitext
5809 {|style="color: red;"|}
5811 {|style="color: red;" |}
5812 |foo
5815 {|style="color: red;"|} id="foo"
5816 |foo
5819 {|style="color: red;" |} id="foo"
5820 |foo
5822 !! html
5823 <table style="color: red;"></table>
5825 <table style="color: red;">
5826 <tbody><tr>
5827 <td>foo</td>
5828 </tr></tbody>
5829 </table>
5831 <table style="color: red;" id="foo">
5832 <tbody><tr>
5833 <td>foo</td>
5834 </tr></tbody>
5835 </table>
5837 <table style="color: red;" id="foo">
5838 <tbody><tr>
5839 <td>foo</td>
5840 </tr></tbody>
5841 </table>
5843 !! end
5845 !! test
5846 A table with no data (take 2)
5847 !! wikitext
5850 !! html/parsoid
5851 <table></table>
5852 !! end
5854 # A table with nothing but a caption is invalid XHTML, we might want to render
5855 # this as <p>caption</p>
5856 # Parsoid team replies: table with only a caption is legal in HTML5
5857 !! test
5858 A table with nothing but a caption
5859 !! wikitext
5861 |+ caption
5863 !! html/php
5864 <table>
5865 <caption> caption
5866 </caption><tr><td></td></tr></table>
5868 !! html/parsoid
5869 <table><caption> caption</caption></table>
5870 !! end
5872 !! test
5873 A table with caption with default-spaced attributes and a table row
5874 !! wikitext
5876 |+ style="color: red;" | caption1
5878 | foo
5880 !! html
5881 <table>
5882 <caption style="color: red;"> caption1
5883 </caption>
5884 <tr>
5885 <td> foo
5886 </td></tr></table>
5888 !! end
5890 !! test
5891 A table with captions with non-default spaced attributes and a table row
5892 !! wikitext
5894 |+style="color: red;"|caption2
5895 |+ style="color: red;"| caption3
5897 | foo
5899 !! html
5900 <table>
5901 <caption style="color: red;">caption2
5902 </caption>
5903 <caption style="color: red;"> caption3
5904 </caption>
5905 <tr>
5906 <td> foo
5907 </td></tr></table>
5909 !! end
5911 !! test
5912 Table td-cell syntax variations
5913 !! wikitext
5915 | foo bar foo | baz
5916 | foo bar foo || baz
5917 | style='color:red;' | baz
5918 | style='color:red;' || baz
5920 !! html
5921 <table>
5922 <tr>
5923 <td> baz
5924 </td>
5925 <td> foo bar foo </td>
5926 <td> baz
5927 </td>
5928 <td style="color:red;"> baz
5929 </td>
5930 <td> style='color:red;' </td>
5931 <td> baz
5932 </td></tr></table>
5934 !! end
5936 !! test
5937 Simple table
5938 !! wikitext
5940 | 1 || 2
5942 | 3 || 4
5944 !! html
5945 <table>
5946 <tr>
5947 <td> 1 </td>
5948 <td> 2
5949 </td></tr>
5950 <tr>
5951 <td> 3 </td>
5952 <td> 4
5953 </td></tr></table>
5955 !! end
5957 !! test
5958 Simple table but with multiple dashes for row wikitext
5959 !! wikitext
5961 | foo
5962 |-----
5963 | bar
5965 !! html
5966 <table>
5967 <tr>
5968 <td> foo
5969 </td></tr>
5970 <tr>
5971 <td> bar
5972 </td></tr></table>
5974 !! end
5976 !! test
5977 Multiplication table
5978 !! wikitext
5979 {| border="1" cellpadding="2"
5980 |+Multiplication table
5982 ! &times; !! 1 !! 2 !! 3
5984 ! 1
5985 | 1 || 2 || 3
5987 ! 2
5988 | 2 || 4 || 6
5990 ! 3
5991 | 3 || 6 || 9
5993 ! 4
5994 | 4 || 8 || 12
5996 ! 5
5997 | 5 || 10 || 15
5999 !! html
6000 <table border="1" cellpadding="2">
6001 <caption>Multiplication table
6002 </caption>
6003 <tr>
6004 <th> &#215; </th>
6005 <th> 1 </th>
6006 <th> 2 </th>
6007 <th> 3
6008 </th></tr>
6009 <tr>
6010 <th> 1
6011 </th>
6012 <td> 1 </td>
6013 <td> 2 </td>
6014 <td> 3
6015 </td></tr>
6016 <tr>
6017 <th> 2
6018 </th>
6019 <td> 2 </td>
6020 <td> 4 </td>
6021 <td> 6
6022 </td></tr>
6023 <tr>
6024 <th> 3
6025 </th>
6026 <td> 3 </td>
6027 <td> 6 </td>
6028 <td> 9
6029 </td></tr>
6030 <tr>
6031 <th> 4
6032 </th>
6033 <td> 4 </td>
6034 <td> 8 </td>
6035 <td> 12
6036 </td></tr>
6037 <tr>
6038 <th> 5
6039 </th>
6040 <td> 5 </td>
6041 <td> 10 </td>
6042 <td> 15
6043 </td></tr></table>
6045 !! end
6047 !! test
6048 Accept "||" in table headings
6049 !! wikitext
6051 !h1 || h2
6053 !! html
6054 <table>
6055 <tr>
6056 <th>h1 </th>
6057 <th> h2
6058 </th></tr></table>
6060 !! end
6062 !! test
6063 Accept "!!" in table data
6064 !! wikitext
6066 | Foo!! ||
6068 !! html
6069 <table>
6070 <tr>
6071 <td> Foo!! </td>
6072 <td>
6073 </td></tr></table>
6075 !! html/parsoid
6076 <table>
6077 <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'> Foo!! </td><td data-parsoid='{"stx_v":"row","autoInsertedEnd":true}'></td></tr>
6078 </tbody></table>
6079 !! end
6081 !! test
6082 Accept "||" in indented table headings
6083 !! wikitext
6085 !h1 || h2
6087 !! html
6088 <dl><dd><table>
6089 <tr>
6090 <th>h1 </th>
6091 <th> h2
6092 </th></tr></table></dd></dl>
6094 !! end
6096 !! test
6097 Accept "!!" in templates
6098 !! wikitext
6100 !a {{echo|b!!c}}
6102 !! html/php
6103 <table>
6104 <tr>
6105 <th>a b</th>
6106 <th>c
6107 </th></tr></table>
6109 !! html/parsoid
6110 <table>
6111 <tbody><tr><th typeof="mw:Transclusion" about="#mwt1" data-parsoid='{"autoInsertedEnd":true,"pi":[[{"k":"1"}]]}' data-mw='{"parts":["!a ",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"b!!c"}},"i":0}}]}'>a b</th><th about="#mwt1">c</th></tr>
6112 !! end
6114 !! test
6115 Accept "!!" in table headings after newline
6116 !! wikitext
6119 b!!c
6121 !! html/php
6122 <table>
6123 <tr>
6124 <th>a
6125 <p>b!!c
6126 </p>
6127 </th></tr></table>
6129 !! html/parsoid
6130 <table>
6131 <tbody><tr><th>a
6132 <p>b!!c</p></th></tr>
6133 </tbody></table>
6134 !! end
6136 !! test
6137 Accept "!!" in table data of mixed wikitext / html syntax
6138 !! wikitext
6141 <tr><td>b!!c</td></tr>
6143 !! html+tidy
6144 <table>
6145 <tr>
6146 <th>a</th>
6147 </tr>
6148 <tr>
6149 <td>b!!c</td>
6150 </tr>
6151 </table>
6152 !! html/parsoid
6153 <table>
6154 <tbody><tr><th>a</th></tr>
6155 <tr data-parsoid='{"stx":"html"}'><td data-parsoid='{"stx":"html"}'>b!!c</td></tr>
6156 </tbody></table>
6157 !! end
6159 !! test
6160 Accept empty attributes in td/th cells (td/th cells starting with leading ||)
6161 !! wikitext
6163 !| h1
6164 || a
6166 !! html
6167 <table>
6168 <tr>
6169 <th> h1
6170 </th>
6171 <td> a
6172 </td></tr></table>
6174 !! end
6176 !!test
6177 Accept "| !" at start of line in tables (ignore !-attribute)
6178 !! wikitext
6181 | !style="color:red" | bar
6183 !! html
6184 <table>
6186 <tr>
6187 <td> bar
6188 </td></tr></table>
6190 !!end
6192 !!test
6193 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 +/- 
6194 !! wikitext
6197 |style='color:red;'|+1
6198 |style='color:blue;'|-1
6200 | 1 || 2 || 3
6201 | 1 ||+2 ||-3
6203 | +1
6204 | -1
6206 !! html
6207 <table>
6209 <tr>
6210 <td style="color:red;">+1
6211 </td>
6212 <td style="color:blue;">-1
6213 </td></tr>
6214 <tr>
6215 <td> 1 </td>
6216 <td> 2 </td>
6217 <td> 3
6218 </td>
6219 <td> 1 </td>
6220 <td>+2 </td>
6221 <td>-3
6222 </td></tr>
6223 <tr>
6224 <td> +1
6225 </td>
6226 <td> -1
6227 </td></tr></table>
6229 !!end
6231 !! test
6232 Table rowspan
6233 !! wikitext
6234 {| border=1
6235 | Cell 1, row 1
6236 |rowspan=2| Cell 2, row 1 (and 2)
6237 | Cell 3, row 1
6239 | Cell 1, row 2
6240 | Cell 3, row 2
6242 !! html
6243 <table border="1">
6244 <tr>
6245 <td> Cell 1, row 1
6246 </td>
6247 <td rowspan="2"> Cell 2, row 1 (and 2)
6248 </td>
6249 <td> Cell 3, row 1
6250 </td></tr>
6251 <tr>
6252 <td> Cell 1, row 2
6253 </td>
6254 <td> Cell 3, row 2
6255 </td></tr></table>
6257 !! end
6259 !! test
6260 Nested table
6261 !! wikitext
6262 {| border=1
6263 | &alpha;
6265 {| bgcolor=#ABCDEF border=2
6266 |nested
6268 |table
6270 |the original table again
6272 !! html
6273 <table border="1">
6274 <tr>
6275 <td> &#945;
6276 </td>
6277 <td>
6278 <table bgcolor="#ABCDEF" border="2">
6279 <tr>
6280 <td>nested
6281 </td></tr>
6282 <tr>
6283 <td>table
6284 </td></tr></table>
6285 </td>
6286 <td>the original table again
6287 </td></tr></table>
6289 !! end
6291 !! test
6292 Invalid attributes in table cell (bug 1830)
6293 !! wikitext
6295 |Cell:|broken
6297 !! html
6298 <table>
6299 <tr>
6300 <td>broken
6301 </td></tr></table>
6303 !! end
6305 !! test
6306 Table cell attributes: Pipes protected by nowikis should be treated as a plain character
6307 !! wikitext
6309 | title="foo" |bar
6310 | title="foo<nowiki>|</nowiki>" |bar
6311 | title="foo<nowiki>|</nowiki>" bar
6313 !! html/php
6314 <table>
6315 <tr>
6316 <td title="foo">bar
6317 </td>
6318 <td title="foo&#124;">bar
6319 </td>
6320 <td> title="foo|" bar
6321 </td></tr></table>
6323 !! html/parsoid
6324 <table>
6325 <tbody><tr><td title="foo">bar</td>
6326 <td title="foo|" data-parsoid='{"a":{"title":"foo|"},"sa":{"title":"foo&lt;nowiki>|&lt;/nowiki>"},"autoInsertedEnd":true}'>bar</td>
6327 <td> title="foo<span typeof="mw:Nowiki">|</span>" bar</td></tr>
6328 </tbody></table>
6329 !! end
6331 # See: http://lists.wikimedia.org/mailman/htdig/wikitech-l/2006-April/022293.html
6332 # N.B. The "|}" to close the table is missing from the input, so parsoid's
6333 #      *2wt modes will fail.
6334 !! test
6335 Table security: embedded pipes
6336 !! options
6337 parsoid=wt2html,html2html
6338 !! wikitext
6340 | |[ftp://|x||]" onmouseover="alert(document.cookie)">test
6341 !! html/php
6342 <table>
6343 <tr>
6344 <td>[<a rel="nofollow" class="external free" href="ftp://%7Cx">ftp://%7Cx</a></td>
6345 <td>]" onmouseover="alert(document.cookie)"&gt;test
6346 </td>
6347 </tr>
6348 </table>
6350 !! html/parsoid
6351 <table><tbody>
6352 <tr>
6353 <td data-parsoid='{"startTagSrc":"| ","attrSepSrc":"|","autoInsertedEnd":true}'><a rel="mw:ExtLink" href="ftp://|x||"></a>" onmouseover="alert(document.cookie)">test</td></tr></tbody></table>
6354 !! end
6356 !! test
6357 Element attributes with double ! should not be broken up by <th>
6358 !! wikitext
6360 ! hi <div class="!!">ha</div> ho
6362 !! html/php
6363 <table>
6364 <tr>
6365 <th> hi <div class="!!">ha</div> ho
6366 </th></tr></table>
6368 !! html/parsoid
6369 <table>
6370 <tbody><tr><th> hi <div class="!!" data-parsoid='{"stx":"html"}'>ha</div> ho</th></tr>
6371 </tbody></table>
6372 !! end
6374 !! test
6375 ! and || in element attributes should not be parsed as <th>/<td>
6376 !! wikitext
6378 | <div style="color: red !important;" data-contrived="put this here ||">hi</div>
6380 !! html/php
6381 <table>
6382 <tr>
6383 <td> <div style="color: red !important;" data-contrived="put this here &#124;&#124;">hi</div>
6384 </td></tr></table>
6386 !! html/parsoid
6387 <table>
6388 <tbody><tr><td> <div style="color: red !important;" data-contrived="put this here ||" data-parsoid='{"stx":"html"}'>hi</div></td></tr>
6389 </tbody></table>
6390 !! end
6392 # FIXME: The output seems broken. Filed as T110268.
6393 !! test
6394 ! and || in td attributes should not be parsed as <th>/<td>
6395 !! options
6396 parsoid=wt2html
6397 !! wikitext
6399 | style="color: red !important;" data-contrived="put this here ||" | foo
6401 !! html/php
6402 <table>
6403 <tr>
6404 <td> style="color: red !important;" data-contrived="put this here </td>
6405 <td> foo
6406 </td></tr></table>
6408 !! html/parsoid
6409 <table>
6410 <tbody><tr><td> style="color: red !important;" data-contrived="put this here </td><td data-parsoid='{"stx_v":"row","a":{"\"":null},"sa":{"\"":""},"autoInsertedEnd":true}'> foo</td></tr>
6411 </tbody></table>
6412 !! end
6414 !! test
6415 Break on | in element attribute in template
6416 !! options
6417 parsoid=wt2html,html2html
6418 !! wikitext
6419 {{echo|1=<div class="hi|ho">ha</div>}}
6420 !! html/php
6421 <p>ho"&gt;ha&lt;/div&gt;
6422 </p>
6423 !! html/parsoid
6424 <span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"ho\">ha&lt;/div>"}},"i":0}}]}'>ho">ha</span>
6425 !! end
6427 !! test
6428 Indented table markup mixed with indented pre content (proposed in bug 6200)
6429 !! wikitext
6430  <table>
6431  <tr>
6432  <td>
6433  Text that should be rendered preformatted
6434  </td>
6435  </tr>
6436  </table>
6437 !! html
6438  <table>
6439  <tr>
6440  <td>
6441 <pre>Text that should be rendered preformatted
6442 </pre>
6443  </td>
6444  </tr>
6445  </table>
6447 !! end
6449 !! test
6450 1. Template-generated table cell attributes and cell content
6451 !! wikitext
6453 |{{table_attribs}}
6454 | {{table_attribs}}
6455 || {{table_attribs_5}}
6456 | <!--foo--> <!--bar--> <!--baz--> {{table_attribs}}
6457 |align=center {{table_attribs}}
6458 | <!--foo--> align=center <!--bar--> {{table_attribs}}
6460 !! html
6461 <table>
6462 <tr>
6463 <td style="color:red;">Foo
6464 </td>
6465 <td style="color:red;">Foo
6466 </td>
6467 <td> style="color:red;"</td>
6468 <td>Bar
6469 </td>
6470 <td style="color:red;">Foo
6471 </td>
6472 <td align="center" style="color:red;">Foo
6473 </td>
6474 <td align="center" style="color:red;">Foo
6475 </td></tr></table>
6477 !! end
6479 !! test
6480 2. Template-generated table cell attributes and cell content
6481 !! wikitext
6483 |{{table_attribs_2}}
6485 !! html/php
6486 <table>
6487 <tr>
6488 <td style="color:red;">Foo
6489 </td>
6490 <td>Bar</td>
6491 <td>Baz
6492 </td></tr></table>
6494 !! html/parsoid
6495 <table>
6496 <tbody><tr><td about="#mwt1" typeof="mw:Transclusion" style="color:red;" data-mw='{"parts":["|",{"template":{"target":{"wt":"table_attribs_2","href":"./Template:Table_attribs_2"},"params":{},"i":0}}]}'>Foo</td>
6497 <td about="#mwt1">Bar</td><td about="#mwt1">Baz</td></tr>
6498 </tbody></table>
6499 !! end
6501 !! test
6502 3. Template-generated table cell attributes and cell content
6503 !! wikitext
6505 !align=center {{table_header_cells}}
6507 |align=center {{table_cells}}
6509 !! html/php
6510 <table>
6511 <tr>
6512 <th align="center" style="color:red;">Foo</th>
6513 <th style="color:red;"><i>Bar</i></th>
6514 <th style="color:brown;"><i>Foo</i> and Baz
6515 </th></tr>
6516 <tr>
6517 <td align="center" style="color:red;">Foo</td>
6518 <td style="color:red;"><i>Bar</i></td>
6519 <td style="color:brown;"><i>Foo</i> and Baz
6520 </td></tr></table>
6522 !! html/parsoid
6523 <table>
6524 <tbody><tr><th align="center" style="color:red;" typeof="mw:Transclusion" about="#mwt1" data-mw='{"parts":["!align=center ",{"template":{"target":{"wt":"table_header_cells","href":"./Template:Table_header_cells"},"params":{},"i":0}}]}'>Foo</th><th about="#mwt1" style="color:red;"><i about="#mwt1">Bar</i></th><th about="#mwt1" style="color:brown;"><i about="#mwt1">Foo</i> and Baz</th></tr><tr>
6525 <td align="center" style="color:red;" typeof="mw:Transclusion" about="#mwt1" data-mw='{"parts":["|align=center ",{"template":{"target":{"wt":"table_cells","href":"./Template:Table_cells"},"params":{},"i":0}}]}'>Foo</td><td about="#mwt1" style="color:red;"><i about="#mwt1">Bar</i></td><td about="#mwt1" style="color:brown;"><i about="#mwt1">Foo</i> and Baz</td></tr>
6526 </tbody></table>
6527 !! end
6529 !! test
6530 4. Template-generated table cell attributes and cell content inside a templated table
6531 !! wikitext
6532 {{tbl-start}}
6533 !align=center {{table_header_cells}}
6535 |align=center {{table_cells}}
6536 {{tbl-end}}
6537 !! html/php
6538 <table>
6539 <tr>
6540 <th align="center" style="color:red;">Foo</th>
6541 <th style="color:red;"><i>Bar</i></th>
6542 <th style="color:brown;"><i>Foo</i> and Baz
6543 </th></tr>
6544 <tr>
6545 <td align="center" style="color:red;">Foo</td>
6546 <td style="color:red;"><i>Bar</i></td>
6547 <td style="color:brown;"><i>Foo</i> and Baz
6548 </td></tr></table>
6550 !! html/parsoid
6551 <table about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"pi":[[],[],[],[]]}' data-mw='{"parts":[{"template":{"target":{"wt":"tbl-start","href":"./Template:Tbl-start"},"params":{},"i":0}},"\n!align=center ",{"template":{"target":{"wt":"table_header_cells","href":"./Template:Table_header_cells"},"params":{},"i":1}},"\n|-\n|align=center ",{"template":{"target":{"wt":"table_cells","href":"./Template:Table_cells"},"params":{},"i":2}},"\n",{"template":{"target":{"wt":"tbl-end","href":"./Template:Tbl-end"},"params":{},"i":3}}]}'>
6552 <tbody><tr><th align="center" style="color:red;">Foo</th><th style="color:red;"><i>Bar</i></th><th style="color:brown;"><i>Foo</i> and Baz</th></tr>
6553 <tr>
6554 <td align="center" style="color:red;">Foo</td><td style="color:red;"><i>Bar</i></td><td style="color:brown;"><i>Foo</i> and Baz</td></tr>
6555 </tbody></table>
6556 !! end
6558 ## Edge case fix to prevent future regressions
6559 !! test
6560 T107652: <ref>s in templates that also generate table cell attributes should be rendered properly
6561 !! wikitext
6563 |{{table_attribs_7}}
6565 <references />
6566 !! html/parsoid
6567 <table>
6568 <tbody><tr><td style="background:#f9f9f9;" typeof="mw:Transclusion" about="#mwt1" data-mw='{"parts":["|",{"template":{"target":{"wt":"table_attribs_7","href":"./Template:Table_attribs_7"},"params":{},"i":0}}]}'>Foo<span class="mw-ref" id="cite_ref-1" rel="dc:references" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-1"},"attrs":{}}'><a href="#cite_note-1" style="counter-reset: mw-Ref 1;"><span class="mw-reflink-text">[1]</span></a></span></td></tr>
6569 </tbody></table>
6570 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'><li about="#cite_note-1" id="cite_note-1"><a href="#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text" data-parsoid="{}">foo</span></li></ol>
6571 !! end
6573 !! test
6574 Table with row followed by newlines and table heading
6575 !! wikitext
6579 ! foo
6581 !! html
6582 <table>
6585 <tr>
6586 <th> foo
6587 </th></tr></table>
6589 !! end
6591 !! test
6592 Table with empty line following the start tag
6593 !! wikitext
6597 | foo
6599 !! html
6600 <table>
6603 <tr>
6604 <td> foo
6605 </td></tr></table>
6607 !! end
6609 !! test
6610 Table attributes with empty value
6611 !! options
6612 parsoid=wt2html,html2html
6613 !! wikitext
6615 | style=| hello
6617 !! html/php
6618 <table>
6619 <tr>
6620 <td style=""> hello
6621 </td></tr></table>
6623 !! html/parsoid
6624 <table>
6625 <tbody><tr><td style=""> hello</td></tr>
6626 </tbody></table>
6627 !! end
6629 !! test
6630 Wikitext table with a lot of comments
6631 !! wikitext
6633 <!-- c0 -->
6634 | foo
6635 <!-- c1 -->
6636 |-<!-- c2 -->
6637 <!-- c3 -->
6638 |<!-- c4 -->
6639 <!-- c5 -->
6641 !! html
6642 <table>
6643 <tr>
6644 <td> foo
6645 </td></tr>
6646 <tr>
6647 <td>
6648 </td></tr></table>
6650 !! end
6652 !! test
6653 Wikitext table comments represented in parsoid dom
6654 !! wikitext
6655 {|<!--c1--><!--c2-->
6656 |-<!--c3-->
6657 | x
6659 !! html/php+tidy
6660 <table>
6661 <tr>
6662 <td>x</td>
6663 </tr>
6664 </table>
6665 !! html/parsoid
6666 <table><!--c1--><!--c2-->
6667 <tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'><!--c3-->
6668 <td data-parsoid='{"autoInsertedEnd":true}'> x</td></tr>
6669 </tbody></table>
6670 !! end
6672 !! test
6673 Wikitext table with double-line table cell
6674 !! wikitext
6679 !! html
6680 <table>
6681 <tr>
6682 <td>a
6683 <p>b
6684 </p>
6685 </td></tr></table>
6687 !! end
6689 !! test
6690 Table cell with a single comment
6691 !! wikitext
6693 | <!-- c1 -->
6694 | a
6696 !! html
6697 <table>
6698 <tr>
6699 <td>
6700 </td>
6701 <td> a
6702 </td></tr></table>
6704 !! end
6706 !! test
6707 Table-cell after a comment-only-empty-line
6708 !! wikitext
6711 <!--c1-->
6712 <!--c2-->| b
6714 !! html
6715 <table>
6716 <tr>
6717 <td>a
6718 </td>
6719 <td> b
6720 </td></tr></table>
6722 !! html/parsoid
6723 <table>
6724 <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'>a</td>
6725 <!--c1-->
6726 <!--c2--><td data-parsoid='{"autoInsertedEnd":true}'> b</td></tr>
6727 </tbody></table>
6729 !! end
6731 !! test
6732 Build table with {{!}}
6733 !! wikitext
6734 {{{!}} class="wikitable"
6735 ! header
6736 ! second header
6737 {{!}}- style="color:red;"
6738 {{!}} data {{!}}{{!}} style="color:red;" {{!}} second data
6739 {{!}}}
6740 !! html
6741 <table class="wikitable">
6742 <tr>
6743 <th> header
6744 </th>
6745 <th> second header
6746 </th></tr>
6747 <tr style="color:red;">
6748 <td> data </td>
6749 <td style="color:red;"> second data
6750 </td></tr></table>
6752 !! end
6754 !! test
6755 Build table with pipe as data
6756 !! wikitext
6757 {| class="wikitable"
6758 ! header
6759 ! second header
6760 |- style="color:red;"
6761 | data || style="color:red;" | second data
6763 | style="color:red;" | data with | || style="color:red;" | second data with |
6765 || data with | ||| second data with |
6767 !! html
6768 <table class="wikitable">
6769 <tr>
6770 <th> header
6771 </th>
6772 <th> second header
6773 </th></tr>
6774 <tr style="color:red;">
6775 <td> data </td>
6776 <td style="color:red;"> second data
6777 </td></tr>
6778 <tr>
6779 <td style="color:red;"> data with | </td>
6780 <td style="color:red;"> second data with |
6781 </td></tr>
6782 <tr>
6783 <td> data with | </td>
6784 <td> second data with |
6785 </td></tr></table>
6787 !! end
6789 !! test
6790 Build table with wikilink
6791 !! wikitext
6792 {| class="wikitable"
6793 ! header || second header
6794 |- style="color:red;"
6795 | data [[Main Page|linktext]] || second data [[Main Page|linktext]]
6797 | data || second data [[Main Page|link|text with pipe]]
6799 !! html
6800 <table class="wikitable">
6801 <tr>
6802 <th> header </th>
6803 <th> second header
6804 </th></tr>
6805 <tr style="color:red;">
6806 <td> data <a href="/wiki/Main_Page" title="Main Page">linktext</a> </td>
6807 <td> second data <a href="/wiki/Main_Page" title="Main Page">linktext</a>
6808 </td></tr>
6809 <tr>
6810 <td> data </td>
6811 <td> second data <a href="/wiki/Main_Page" title="Main Page">link|text with pipe</a>
6812 </td></tr></table>
6814 !! end
6816 # The expected HTML structure in this test is debatable. The PHP parser does
6817 # not parse this kind of table at all. The main focus for Parsoid is on
6818 # round-tripping, so this output is ok for now. TODO: revisit!
6819 !! test
6820 Wikitext table with html-syntax row
6821 !! wikitext
6824 <td>foo</td>
6826 !! html/parsoid
6827 <table>
6828 <tbody>
6829 <tr>
6830 <td>foo</td></tr></tbody></table>
6831 !! end
6833 ## Note that Parsoid output differs from PHP and PHP+tidy here.
6834 ## The lack of <tr> tags in the PHP output is arguably a bug in the
6835 ## PHP parser, which tidy then compounds by fostering the content
6836 ## entirely out of the table.  Parsoid recognizes the table context
6837 ## and generates <tr> and <td> wrappers as needed.  Hopefully nobody
6838 ## depends on PHP's treatment of broken table markup!
6839 !! test
6840 Implicit <td> after a |-
6841 !! options
6842 parsoid=wt2html,html2html
6843 !! wikitext
6848 !! html/php
6849 <table>
6852 </table>
6854 !! html/php+tidy
6855 <p>a</p>
6856 !! html/parsoid
6857 <table>
6858 <tr><td>a</td></tr>
6859 </table>
6860 !! end
6862 # Again, Parsoid adds implicit <td>s here, PHP and Tidy strip the b out.
6863 !! test
6864 <pre> tags should be recognized in an explicit <td> context, but not in an implicit <td> context
6865 !! options
6866 parsoid=wt2html,html2html
6867 !! wikitext
6875 !! html/php
6876 <table>
6878 <tr>
6879 <td>
6880 <pre>a
6881 </pre>
6882 </td></tr>
6884 </table>
6886 !! html/php+tidy
6887 <p>b</p>
6888 <table>
6889 <tr>
6890 <td>
6891 <pre>
6893 </pre></td>
6894 </tr>
6895 </table>
6896 !! html/parsoid
6897 <table>
6898 <tbody>
6899 <tr><td><pre>a</pre></td></tr>
6900 <tr><td> b</td></tr>
6901 </tbody>
6902 </table>
6903 !! end
6905 # PHP + Tidy strips the list out of the table; Parsoid wraps it.
6906 # Parsoid generates the missing <td>, so wt2wt won't succeed.
6907 !! test
6908 Lists should be recognized in an implicit <td> context
6909 !! options
6910 parsoid=wt2html,html2html
6911 !! wikitext
6916 !! html/php
6917 <table>
6919 <ul><li>a</li></ul>
6920 </table>
6922 !! html/php+tidy
6923 <ul>
6924 <li>a</li>
6925 </ul>
6926 !! html/parsoid
6927 <table>
6928 <tr>
6929 <td><ul>
6930 <li>a</li>
6931 </ul></td>
6932 </tr>
6933 </table>
6934 !! end
6936 !! test
6937 Table cells not properly parsed in an implicit-td context
6938 !! wikitext
6941 {{table_attribs_4}} || a || b
6943 !! html/php+tidy
6944 <table>
6945 <tr>
6946 <td style="background-color:#DC241f;" width="10px"></td>
6947 <td>a</td>
6948 <td>b</td>
6949 </tr>
6950 </table>
6951 !! html/parsoid
6952 <table>
6953 <tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'>
6954 <td style="background-color:#DC241f;" width="10px" about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"autoInsertedEnd":true,"pi":[[]]}' data-mw='{"parts":["",{"template":{"target":{"wt":"table_attribs_4","href":"./Template:Table_attribs_4"},"params":{},"i":0}}," "]}'> </td><td data-parsoid='{"stx_v":"row","autoInsertedEnd":true}'> a </td><td data-parsoid='{"stx_v":"row","autoInsertedEnd":true}'> b</td></tr>
6955 </tbody></table>
6956 !! end
6958 !! test
6959 Parsoid: Round-trip tables directly followed by content (bug 51219)
6960 !! options
6961 parsoid=wt2html,wt2wt
6962 !! wikitext
6964 |foo
6965 |} bar
6968 |baz
6969 |}<b>quux</b>
6970 !! html+tidy
6971 <table>
6972 <tr>
6973 <td>foo</td>
6974 </tr>
6975 </table>
6976 <p>bar</p>
6977 <table>
6978 <tr>
6979 <td>baz</td>
6980 </tr>
6981 </table>
6982 <p><b>quux</b></p>
6983 !! end
6985 !! test
6986 Parsoid: Default to a newline after tables in new content (bug 51219)
6987 !! options
6988 parsoid=html2wt
6989 !! html/parsoid
6990 <table><tbody>
6991 <tr><td>foo</td></tr></tbody></table> bar
6992 <table><tbody>
6993 <tr><td>baz</td></tr></tbody></table><b>quux</b>
6994 !! wikitext
6996 |foo
6998 <nowiki> </nowiki>bar
7000 |baz
7002 '''quux'''
7003 !! end
7005 !! test
7006 Parsoid: newline inducing block nodes don't suppress <nowiki>
7007 !! options
7008 parsoid=html2wt
7009 !! html/parsoid
7010  a<h1>foo</h1>
7011 !! wikitext
7012 <nowiki> </nowiki>a
7014 = foo =
7015 !! end
7017 !! test
7018 Parsoid: Row-syntax table headings followed by comment & table cells
7019 !! options
7020 parsoid=wt2html,wt2wt
7021 !! wikitext
7023 ! foo || bar
7024 <!-- foo -->  || baz || quux
7026 !! html/php
7027 <table>
7028 <tr>
7029 <th> foo </th>
7030 <th> bar
7031 </th>
7032 <td> baz </td>
7033 <td> quux
7034 </td></tr></table>
7036 !! html/parsoid
7037 <table>
7038 <tbody><tr><th> foo </th><th> bar
7039 <!-- foo -->  </th><td> baz </td><td> quux</td></tr>
7040 </tbody></table>
7041 !! end
7043 !!test
7044 Parsoid: Recover better from broken table attributes
7045 !!options
7046 parsoid=wt2html
7047 !!wikitext
7048 {| class="foo
7049 | class="bar" |
7052 !!html/php+tidy
7053 <table class="foo">
7054 <tr>
7055 <td class="bar">
7056 <p>foo</p>
7057 </td>
7058 </tr>
7059 </table>
7060 !!html/parsoid
7061 <table class="foo">
7062 <tr>
7063 <td class="bar">
7064 <p>foo</p></td></tr>
7065 </tbody></table>
7066 !!end
7068 !! test
7069 Tables: Digest broken attributes on table and tr tag
7070 !! options
7071 parsoid=wt2html
7072 !! wikitext
7073 {| || |} ++
7074 |- || || ++ --
7075 |- > [
7077 !! html
7078 <table>
7079 <tbody>
7080 <tr></tr>
7081 <tr></tr>
7082 </tbody></table>
7083 !! end
7085 !! test
7086 Strip unsupported table tags, but introduce row wikitext as required
7087 !! options
7088 parsoid=html2wt
7089 !! html/parsoid
7090 <table>
7091 <caption>Test</caption>
7092 <thead>
7093 <tr>
7094 <th>Month</th>
7095 <th>Savings</th>
7096 </tr>
7097 </thead>
7098 <tbody>
7099 <tr>
7100 <td>January</td>
7101 <td>$100</td>
7102 </tr>
7103 <tr>
7104 <td>February</td>
7105 <td>$80</td>
7106 </tr>
7107 </tbody>
7108 <tfoot>
7109 <tr>
7110 <td>Sum</td>
7111 <td>$180</td>
7112 </tr>
7113 </tfoot>
7114 </table>
7115 !! wikitext
7117 |+Test
7119 !Month
7120 !Savings
7123 |January
7124 |$100
7127 |February
7128 |$80
7131 |Sum
7132 |$180
7135 !! html/php+tidy
7136 <table>
7137 <caption>Test</caption>
7138 <tr>
7139 <th>Month</th>
7140 <th>Savings</th>
7141 </tr>
7142 <tr>
7143 <td>January</td>
7144 <td>$100</td>
7145 </tr>
7146 <tr>
7147 <td>February</td>
7148 <td>$80</td>
7149 </tr>
7150 <tr>
7151 <td>Sum</td>
7152 <td>$180</td>
7153 </tr>
7154 </table>
7155 !! end
7157 !! test
7158 Testing serialization after deletion in references
7159 !! options
7160 parsoid={
7161   "modes": ["wt2wt"],
7162   "changes": [
7163     ["#x", "remove"]
7164   ]
7166 !! wikitext
7167 hi <ref><div id="x">ho</div></ref>
7169 <references />
7170 !! wikitext/edited
7171 hi <ref></ref>
7173 <references />
7174 !! end
7176 !!test
7177 Testing serialization after deletion of table cells
7178 !!options
7179 parsoid={
7180   "modes": ["wt2wt", "selser"],
7181   "changes": [
7182     ["#x", "remove"]
7183   ]
7185 !!wikitext
7187 !h1 !!h2 !!h3
7188 | id="x" |c1 {{!}}{{!}}{{!}}c2 |||c3
7190 !! wikitext/edited
7192 !h1 !!h2 !!h3
7193 |c2 |||c3
7195 !!end
7197 !! test
7198 Testing selser after addition of new row before first row (T125419)
7199 !! options
7200 parsoid={
7201   "modes": ["wt2wt", "selser"],
7202   "changes": [
7203     [ "tr", "before", "<tr><td>X</td></tr>" ]
7204   ]
7206 !! wikitext
7210 !! wikitext/edited
7216 !! end
7218 !! test
7219 Serialize new table rows in a HTML table using HTML tags
7220 !! options
7221 parsoid={
7222   "modes": ["wt2wt", "selser"],
7223   "changes": [
7224     [ "tr", "before", "<tr><td>X</td></tr>" ]
7225   ]
7227 !! wikitext
7228 <table><tr><td>a</td></tr></table>
7229 !! wikitext/edited
7230 <table><tr><td>X</td></tr><tr><td>a</td></tr></table>
7231 !! end
7233 !! test
7234 Serialize new table cells in a HTML row using HTML tags
7235 !! options
7236 parsoid={
7237   "modes": ["wt2wt", "selser"],
7238   "changes": [
7239     [ "td", "before", "<td>X</td>" ]
7240   ]
7242 !! wikitext
7243 <table><tr><td>a</td></tr></table>
7244 !! wikitext/edited
7245 <table><tr><td>X</td><td>a</td></tr></table>
7246 !! end
7248 !! test
7249 Wikitext tables can be nested inside HTML tables
7250 !! options
7251 parsoid=html2wt
7252 !! html
7253 <table data-parsoid='{"stx":"html"}'>
7254 <tr><td>
7255 <table>
7256 <tr><td>foo</td></tr>
7257 </table>
7258 </td></tr>
7259 </table>
7260 !! wikitext
7261 <table>
7262 <tr><td>
7264 |foo
7266 </td></tr>
7267 </table>
7268 !! end
7270 !! test
7271 Serialize wikitext list items as HTML list items when embedded in a HTML list
7272 !! options
7273 parsoid=html2wt
7274 !! html
7275 <ul data-parsoid='{"stx": "html"}'>
7276 <li data-parsoid='{}'>a</li>
7277 <li>b</li>
7278 </ul>
7279 !! wikitext
7280 <ul>
7281 <li>a</li>
7282 <li>b</li>
7283 </ul>
7284 !! end
7286 # SSS FIXME: Is this actually a good thing given the
7287 # odd nested list output that is generated by MW?
7288 # <ul><li>foo<ul>..</ul></li></ul> instead of
7289 # <ul><li>foo</li><ul>..</ul></ul>
7290 !! test
7291 Wikitext lists can be nested inside HTML lists
7292 !! options
7293 parsoid=html2wt
7294 !! html
7295 <ul data-parsoid='{"stx": "html"}'>
7296 <li data-parsoid='{"stx": "html"}'>a
7297 <ul><li>b</li></ul>
7298 </li>
7299 </ul>
7301 <ul data-parsoid='{"stx": "html"}'>
7302 <li>x
7303 <ul><li>y</li></ul>
7304 </li>
7305 </ul>
7306 !! wikitext
7307 <ul>
7308 <li>a
7309 * b
7310 </li>
7311 </ul>
7313 <ul>
7314 <li>x
7315 * y
7316 </li>
7317 </ul>
7318 !! end
7321 ### Internal links
7323 !! test
7324 Plain link, capitalized
7325 !! wikitext
7326 [[Main Page]]
7327 !! html
7328 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
7329 </p>
7330 !! end
7332 !! test
7333 Plain link, uncapitalized
7334 !! wikitext
7335 [[main Page]]
7336 !! html
7337 <p><a href="/wiki/Main_Page" title="Main Page">main Page</a>
7338 </p>
7339 !! end
7341 !! test
7342 Piped link
7343 !! wikitext
7344 [[Main Page|The Main Page]]
7345 !! html
7346 <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
7347 </p>
7348 !! end
7350 !! test
7351 Piped link with comment in link text
7352 !! wikitext
7353 [[Main Page|The Main<!--front--> Page]]
7354 !! html
7355 <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
7356 </p>
7357 !! end
7359 !! test
7360 Piped link with multiple pipe characters in link text
7361 !! wikitext
7362 [[Main Page||The|Main|Page|]]
7363 !! html/php
7364 <p><a href="/wiki/Main_Page" title="Main Page">|The|Main|Page|</a>
7365 </p>
7366 !! html/parsoid
7367 <p><a rel="mw:WikiLink" href="Main_Page" title="Main Page">|The|Main|Page|</a></p>
7368 !! end
7370 !! test
7371 Piped link with no link text
7372 !! wikitext
7373 [[Thomas Bek (bishop of St David's)|]]
7374 !! html/php
7375 <p>[[Thomas Bek (bishop of St David's)|]]
7376 </p>
7377 !! html/parsoid
7378 <p>[[Thomas Bek (bishop of St David's)|]]</p>
7379 !! end
7381 !! test
7382 Broken link
7383 !! wikitext
7384 [[Zigzagzogzagzig]]
7385 !! html
7386 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig</a>
7387 </p>
7388 !! end
7390 !! test
7391 Broken link with fragment
7392 !! wikitext
7393 [[Zigzagzogzagzig#zug]]
7394 !! html
7395 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig#zug</a>
7396 </p>
7397 !! end
7399 !! test
7400 Special page link with fragment
7401 !! wikitext
7402 [[Special:Version#anchor]]
7403 !! html
7404 <p><a href="/wiki/Special:Version#anchor" title="Special:Version">Special:Version#anchor</a>
7405 </p>
7406 !! end
7408 !! test
7409 Nonexistent special page link with fragment
7410 !! wikitext
7411 [[Special:ThisNameWillHopefullyNeverBeUsed#anchor]]
7412 !! html
7413 <p><a href="/wiki/Special:ThisNameWillHopefullyNeverBeUsed" class="new" title="Special:ThisNameWillHopefullyNeverBeUsed (page does not exist)">Special:ThisNameWillHopefullyNeverBeUsed#anchor</a>
7414 </p>
7415 !! end
7417 !! test
7418 Link with prefix
7419 !! wikitext
7420 xxx[[main Page]], xxx[[Main Page]], Xxx[[main Page]] XXX[[main Page]], XXX[[Main Page]]
7421 !! html
7422 <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>
7423 </p>
7424 !! end
7426 !! test
7427 Link with suffix
7428 !! wikitext
7429 [[Main Page]]xxx, [[Main Page]]XXX, [[Main Page]]!!!
7430 !! html
7431 <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>!!!
7432 </p>
7433 !! end
7435 !! article
7436 prefixed article
7437 !! text
7438 Some text
7439 !! endarticle
7441 !! test
7442 Bug 43661: Piped links with identical prefixes
7443 !! wikitext
7444 [[prefixed article|prefixed articles with spaces]]
7446 [[prefixed article|prefixed articlesaoeu]]
7448 [[Main Page|Main Page test]]
7449 !! html
7450 <p><a href="/wiki/Prefixed_article" title="Prefixed article">prefixed articles with spaces</a>
7451 </p><p><a href="/wiki/Prefixed_article" title="Prefixed article">prefixed articlesaoeu</a>
7452 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page test</a>
7453 </p>
7454 !! end
7457 !! test
7458 Link with HTML entity in suffix / tail
7459 !! wikitext
7460 [[Main Page]]&quot;, [[Main Page]]&#97;
7461 !! html/php
7462 <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;
7463 </p>
7464 !! html/parsoid
7465 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">Main Page</a><span typeof="mw:Entity" data-parsoid='{"src":"&amp;quot;","srcContent":"\""}'>"</span>, <a rel="mw:WikiLink" href="./Main_Page" title="Main Page">Main Page</a><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#97;","srcContent":"a"}'>a</span></p>
7466 !! end
7468 !! test
7469 Link with 3 brackets
7470 !! wikitext
7471 [[[Main Page]]]
7472 Foo [[[Main Page]]]
7473 !! html
7474 <p>[[[Main Page]]]
7475 Foo [[[Main Page]]]
7476 </p>
7477 !! end
7479 !! test
7480 Link with 4 brackets
7481 !! wikitext
7482 [[[[Main Page]]]]
7483 !! html
7484 <p>[[<a href="/wiki/Main_Page" title="Main Page">Main Page</a>]]
7485 </p>
7486 !! end
7488 !! test
7489 Piped link with 3 brackets
7490 !! wikitext
7491 [[[main page|the main page]]]
7492 !! html
7493 <p>[[[main page|the main page]]]
7494 </p>
7495 !! end
7497 !! test
7498 Piped link with extlink-like text
7499 !! wikitext
7500 [[Main Page|[bar]]]
7501 [[Main Page|This is a [bar]]]
7502 !! html/php
7503 <p><a href="/wiki/Main_Page" title="Main Page">[bar]</a>
7504 <a href="/wiki/Main_Page" title="Main Page">This is a [bar]</a>
7505 </p>
7506 !! html/parsoid
7507 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page" data-parsoid='{"stx":"piped"}'>[bar]</a>
7508 <a rel="mw:WikiLink" href="./Main_Page" title="Main Page" data-parsoid='{"stx":"piped"}'>This is a [bar]</a></p>
7509 !! end
7511 !! test
7512 Link with multiple pipes
7513 !! wikitext
7514 [[Main Page|The|Main|Page]]
7515 !! html
7516 <p><a href="/wiki/Main_Page" title="Main Page">The|Main|Page</a>
7517 </p>
7518 !! end
7520 # Note that parsoid does not munge anchor text; all non-space
7521 # characters are valid in HTML5 ids.
7522 !! test
7523 Anchor containing a #. (bug 63430)
7524 !! wikitext
7525 [[Main Page#And#Link]]
7526 !! html/php
7527 <p><a href="/wiki/Main_Page#And.23Link" title="Main Page">Main Page#And#Link</a>
7528 </p>
7529 !! html/parsoid
7530 <p><a rel="mw:WikiLink" href="./Main_Page#And%23Link" title="Main Page">Main Page#And#Link</a></p>
7531 !! end
7533 !! test
7534 Link to namespaces
7535 !! wikitext
7536 [[Talk:Parser testing]], [[Meta:Disclaimers]]
7537 !! html
7538 <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>
7539 </p>
7540 !! end
7542 !! test
7543 Link with space in namespace
7544 !! wikitext
7545 [[User talk:Foo bar]]
7546 !! html
7547 <p><a href="/index.php?title=User_talk:Foo_bar&amp;action=edit&amp;redlink=1" class="new" title="User talk:Foo bar (page does not exist)">User talk:Foo bar</a>
7548 </p>
7549 !! end
7551 !! article
7552 MemoryAlpha:AlphaTest
7553 !! text
7554 This is an article in the MemoryAlpha namespace
7555 (which shadows the memoryalpha interwiki link).
7556 !! endarticle
7558 !! test
7559 Namespace takes precedence over interwiki link (bug 51680)
7560 !! wikitext
7561 [[MemoryAlpha:AlphaTest]]
7562 !! html
7563 <p><a href="/wiki/MemoryAlpha:AlphaTest" title="MemoryAlpha:AlphaTest">MemoryAlpha:AlphaTest</a>
7564 </p>
7565 !! end
7567 # The previous test doesn't work correctly in html2*, due to not recognizing the
7568 # link as an internal one. This one checks for the correct behavior.
7569 !! test
7570 Link to namespace preferred over interwiki with correct rel attribute
7571 !! options
7572 parsoid=html2wt,html2html
7573 !! html/parsoid
7574 <p><a rel="mw:WikiLink" href="./MemoryAlpha:AlphaTest" title="MemoryAlpha:AlphaTest">MemoryAlpha:AlphaTest</a></p>
7575 !! wikitext
7576 [[MemoryAlpha:AlphaTest]]
7577 !! end
7579 !! test
7580 Piped link to namespace
7581 !! wikitext
7582 [[Meta:Disclaimers|The disclaimers]]
7583 !! html
7584 <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>
7585 </p>
7586 !! end
7588 !! test
7589 Link containing }
7590 !! wikitext
7591 [[Usually caused by a typo (oops}]]
7592 !! html
7593 <p>[[Usually caused by a typo (oops}]]
7594 </p>
7595 !! end
7597 !! article
7598 7% Solution
7599 !! text
7600 Just a test of an article title containing a percent.
7601 !! endarticle
7603 !! test
7604 Link containing % (not as a hex sequence)
7605 !! wikitext
7606 [[7% Solution]]
7607 !! html/php
7608 <p><a href="/wiki/7%25_Solution" title="7% Solution">7% Solution</a>
7609 </p>
7610 !! html/parsoid
7611 <p><a rel="mw:WikiLink" href="./7%25_Solution" title="7% Solution">7% Solution</a></p>
7612 !! end
7614 # note that the parsoid HTML is identical to the previous test output,
7615 # so the previous test ensures that the html2wt mode will generate the
7616 # "not as a hex sequence" wikitext.
7617 !! test
7618 Link containing % as a single hex sequence interpreted to char
7619 !! options
7620 parsoid=wt2wt,wt2html,html2html
7621 !! wikitext
7622 [[7%25 Solution]]
7623 !! html/php
7624 <p><a href="/wiki/7%25_Solution" title="7% Solution">7% Solution</a>
7625 </p>
7626 !! html/parsoid
7627 <p><a rel="mw:WikiLink" href="./7%25_Solution" title="7% Solution">7% Solution</a></p>
7628 !!end
7630 !! test
7631 Link containing % as a double hex sequence interpreted to hex sequence
7632 !! wikitext
7633 [[7%2525 Solution]]
7634 !! html
7635 <p>[[7%2525 Solution]]
7636 </p>
7637 !!end
7639 # note that parsoid does not munge anchor text; all non-space
7640 # characters are valid in HTML5 anchors.
7641 !! test
7642 Link containing "#<" and "#>" % as a hex sequences- these are valid section anchors
7643 Example for such a section: == < ==
7644 !! wikitext
7645 [[%23%3c]][[%23%3e]]
7646 !! html/php
7647 <p><a href="#.3C">#&lt;</a><a href="#.3E">#&gt;</a>
7648 </p>
7649 !! html/parsoid
7650 <p><a rel="mw:WikiLink" href="./Main_Page#%3C" title="Main Page">#&lt;</a><a rel="mw:WikiLink" href="./Main_Page#%3E" title="Main Page">#></a></p>
7651 !! end
7653 !! test
7654 Link containing "<#" and ">#" as a hex sequences
7655 !! wikitext
7656 [[%3c%23]][[%3e%23]]
7657 !! html
7658 <p>[[%3c%23]][[%3e%23]]
7659 </p>
7660 !! end
7662 !! test
7663 Link containing an equals sign
7664 !! wikitext
7665 [[Special:BookSources/isbn=4-00-026157-6]]
7666 !! html/php
7667 <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>
7668 </p>
7669 !! html/parsoid
7670 <p><a rel="mw:WikiLink" href="./Special:BookSources/isbn=4-00-026157-6" title="Special:BookSources/isbn=4-00-026157-6">Special:BookSources/isbn=4-00-026157-6</a></p>
7671 !! end
7673 !! article
7674 Foo~bar
7675 !! text
7676 Just a test of an article title containing a tilde.
7677 !! endarticle
7679 # note that links containing signatures, like [[Foo~~~~]], are
7680 # massaged by the pre-save transform (PST) and so the tildes are never
7681 # seen by the parser.
7682 !! test
7683 Link containing a tilde
7684 !! wikitext
7685 [[Foo~bar]]
7686 !! html/php
7687 <p><a href="/wiki/Foo~bar" title="Foo~bar">Foo~bar</a>
7688 </p>
7689 !! html/parsoid
7690 <p><a rel="mw:WikiLink" href="./Foo~bar" title="Foo~bar">Foo~bar</a></p>
7691 !! end
7693 !! test
7694 Link containing double-single-quotes '' (bug 4598)
7695 !! wikitext
7696 [[Lista d''e paise d''o munno]]
7697 !! html/php
7698 <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>
7699 </p>
7700 !! html/parsoid
7701 <p><a rel="mw:WikiLink" href="./Lista_d''e_paise_d''o_munno" title="Lista d''e paise d''o munno">Lista d''e paise d''o munno</a></p>
7702 !! end
7704 !! test
7705 Link containing double-single-quotes '' in text (bug 4598 sanity check)
7706 !! wikitext
7707 Some [[Link|pretty ''italics'' and stuff]]!
7708 !! html/php
7709 <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>!
7710 </p>
7711 !! html/parsoid
7712 <p>Some <a rel="mw:WikiLink" href="Link" title="Link">pretty <i>italics</i> and stuff</a>!</p>
7713 !! end
7715 !! test
7716 Link containing double-single-quotes '' in text embedded in italics (bug 4598 sanity check)
7717 !! wikitext
7718 ''Some [[Link|pretty ''italics'' and stuff]]!''
7719 !! html
7720 <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>
7721 </p>
7722 !! end
7724 !! test
7725 Link with double quotes in title part (literal) and alternate part (interpreted)
7726 !! wikitext
7727 [[File:Denys_Savchenko_''Pentecoste''.jpg]]
7729 [[''Pentecoste'']]
7731 [[''Pentecoste''|Pentecoste]]
7733 [[''Pentecoste''|''Pentecoste'']]
7734 !! html/php
7735 <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>
7736 </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>
7737 </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>
7738 </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>
7739 </p>
7740 !! html/parsoid
7741 <p><span class="mw-default-size" typeof="mw:Error mw:Image" data-mw='{"errors":[{"key":"missing-image","message":"This image does not exist."}]}'><a href="./File:Denys_Savchenko_''Pentecoste''.jpg"><img resource="./File:Denys_Savchenko_''Pentecoste''.jpg" src="./Special:FilePath/Denys_Savchenko_''Pentecoste''.jpg" height="220" width="220"/></a></span></p>
7742 <p><a rel="mw:WikiLink" href="''Pentecoste''" title="''Pentecoste''">''Pentecoste''</a></p>
7743 <p><a rel="mw:WikiLink" href="''Pentecoste''" title="''Pentecoste''">Pentecoste</a></p>
7744 <p><a rel="mw:WikiLink" href="''Pentecoste''" title="''Pentecoste''"><i>Pentecoste</i></a></p>
7745 !! end
7747 !! test
7748 Broken image links with HTML captions (bug 39700)
7749 !! wikitext
7750 [[File:Nonexistent|<script></script>]]
7751 [[File:Nonexistent|100x100px|<script></script>]]
7752 [[File:Nonexistent|&lt;]]
7753 [[File:Nonexistent|a<i>b</i>c]]
7754 !! html/php
7755 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script&gt;&lt;/script&gt;</a>
7756 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script&gt;&lt;/script&gt;</a>
7757 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;</a>
7758 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">abc</a>
7759 </p>
7760 !! html/parsoid
7761 <p><span class="mw-default-size" typeof="mw:Error mw:Image" data-parsoid='{"optList":[{"ck":"caption","ak":"&lt;script>&lt;/script>"}]}' data-mw='{"errors":[{"key":"missing-image","message":"This image does not exist."}],"caption":"&amp;lt;script>&amp;lt;/script>"}'><a href="./File:Nonexistent" data-parsoid='{"a":{"href":"./File:Nonexistent"},"sa":{}}'><img resource="./File:Nonexistent" src="./Special:FilePath/Nonexistent" height="220" width="220" data-parsoid='{"a":{"resource":"./File:Nonexistent","height":"220","width":"220"},"sa":{"resource":"File:Nonexistent"}}'/></a></span>
7762 <span typeof="mw:Error mw:Image" data-parsoid='{"optList":[{"ck":"width","ak":"100x100px"},{"ck":"caption","ak":"&lt;script>&lt;/script>"}]}' data-mw='{"errors":[{"key":"missing-image","message":"This image does not exist."}],"caption":"&amp;lt;script>&amp;lt;/script>"}'><a href="./File:Nonexistent" data-parsoid='{"a":{"href":"./File:Nonexistent"},"sa":{}}'><img resource="./File:Nonexistent" src="./Special:FilePath/Nonexistent" height="100" width="100" data-parsoid='{"a":{"resource":"./File:Nonexistent","height":"100","width":"100"},"sa":{"resource":"File:Nonexistent"}}'/></a></span>
7763 <span class="mw-default-size" typeof="mw:Error mw:Image" data-parsoid='{"optList":[{"ck":"caption","ak":"&amp;lt;"}]}' data-mw='{"errors":[{"key":"missing-image","message":"This image does not exist."}],"caption":"&lt;span typeof=\"mw:Entity\" data-parsoid=&#39;{\"src\":\"&amp;amp;lt;\",\"srcContent\":\"&amp;lt;\",\"dsr\":[107,111,null,null]}&#39;>&amp;lt;&lt;/span>"}'><a href="./File:Nonexistent" data-parsoid='{"a":{"href":"./File:Nonexistent"},"sa":{}}'><img resource="./File:Nonexistent" src="./Special:FilePath/Nonexistent" height="220" width="220" data-parsoid='{"a":{"resource":"./File:Nonexistent","height":"220","width":"220"},"sa":{"resource":"File:Nonexistent"}}'/></a></span>
7764 <span class="mw-default-size" typeof="mw:Error mw:Image" data-parsoid='{"optList":[{"ck":"caption","ak":"a&lt;i>b&lt;/i>c"}]}' data-mw='{"errors":[{"key":"missing-image","message":"This image does not exist."}],"caption":"a&lt;i data-parsoid=&#39;{\"stx\":\"html\",\"dsr\":[134,142,3,4]}&#39;>b&lt;/i>c"}'><a href="./File:Nonexistent" data-parsoid='{"a":{"href":"./File:Nonexistent"},"sa":{}}'><img resource="./File:Nonexistent" src="./Special:FilePath/Nonexistent" height="220" width="220" data-parsoid='{"a":{"resource":"./File:Nonexistent","height":"220","width":"220"},"sa":{"resource":"File:Nonexistent"}}'/></a></span></p>
7765 !! end
7767 !! test
7768 Plain link to URL
7769 !! wikitext
7770 [[http://www.example.com]]
7771 !! html/php
7772 <p>[<a rel="nofollow" class="external autonumber" href="http://www.example.com">[1]</a>]
7773 </p>
7774 !! html/parsoid
7775 <p>[<a rel="mw:ExtLink" href="http://www.example.com"></a>]</p>
7776 !! end
7778 !! test
7779 Plain link to URL with link text
7780 !! wikitext
7781 [[http://www.example.com Link text]]
7782 !! html
7783 <p>[<a rel="nofollow" class="external text" href="http://www.example.com">Link text</a>]
7784 </p>
7785 !! end
7787 !! test
7788 Plain link to protocol-relative URL
7789 !! wikitext
7790 [[//www.example.com]]
7791 !! html/php
7792 <p>[<a rel="nofollow" class="external autonumber" href="//www.example.com">[1]</a>]
7793 </p>
7794 !! html/parsoid
7795 <p>[<a rel="mw:ExtLink" href="//www.example.com"></a>]</p>
7796 !! end
7798 !! test
7799 Plain link to protocol-relative URL with link text
7800 !! wikitext
7801 [[//www.example.com Link text]]
7802 !! html
7803 <p>[<a rel="nofollow" class="external text" href="//www.example.com">Link text</a>]
7804 </p>
7805 !! end
7807 !! test
7808 Plain link to page with question mark in title
7809 !! wikitext
7810 [[A?b]]
7812 [[A?b|Baz]]
7813 !! html
7814 <p><a href="/wiki/A%3Fb" title="A?b">A?b</a>
7815 </p><p><a href="/wiki/A%3Fb" title="A?b">Baz</a>
7816 </p>
7817 !! end
7820 # I'm fairly sure the expected result here is wrong.
7821 # We want these to be URL links, not pseudo-pages with URLs for titles....
7822 # However the current output is also pretty screwy.
7824 # ----
7825 # I'm changing it to match the current output--it arguably makes more
7826 # sense in the light of the test above. Old expected result was:
7827 #<p>Piped link to URL: <a href="/index.php?title=Http://www.example.com&amp;action=edit" class="new">an example URL</a>
7828 #</p>
7829 # But I think this test is bordering on "garbage in, garbage out" anyway.
7830 # -- wtm
7831 !! test
7832 Piped link to URL
7833 !! wikitext
7834 Piped link to URL: [[http://www.example.com|an example URL]]
7835 !! html/php
7836 <p>Piped link to URL: [<a rel="nofollow" class="external text" href="http://www.example.com%7Can">example URL</a>]
7837 </p>
7838 !! html/parsoid
7839 <p>Piped link to URL: [<a rel="mw:ExtLink" href="http://www.example.com|an">example URL</a>]</p>
7840 !! end
7842 !! test
7843 BUG 2: [[page|http://url/]] should link to page, not http://url/
7844 !! wikitext
7845 [[Main Page|http://url/]]
7846 !! html/php
7847 <p><a href="/wiki/Main_Page" title="Main Page">http://url/</a>
7848 </p>
7849 !! html/parsoid
7850 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">http://url/</a></p>
7851 !! end
7853 # Parsoid does not mark self-links, by design.
7854 !! test
7855 BUG 337: Escaped self-links should be bold
7856 !! options
7857 title=[[Bug462]]
7858 !! wikitext
7859 [[Bu&#103;462]] [[Bug462]]
7860 !! html/php
7861 <p><strong class="selflink">Bu&#103;462</strong> <strong class="selflink">Bug462</strong>
7862 </p>
7863 !! html/php+tidy
7864 <p><strong class="selflink">Bug462</strong> <strong class="selflink">Bug462</strong></p>
7865 !! html/parsoid
7866 <p><a rel="mw:WikiLink" href="./Bug462" title="Bug462">Bug462</a> <a rel="mw:WikiLink" href="./Bug462" title="Bug462">Bug462</a></p>
7867 !! end
7869 !! test
7870 Self-link to section should not be bold
7871 !! options
7872 title=[[Main Page]]
7873 !! wikitext
7874 [[Main Page#section]]
7875 !! html
7876 <p><a href="/wiki/Main_Page#section" title="Main Page">Main Page#section</a>
7877 </p>
7878 !! end
7880 !! article
7882 !! text
7883 This is 00.
7884 !! endarticle
7886 !!test
7887 Self-link to numeric title
7888 !!options
7889 title=[[0]]
7890 !! wikitext
7891 [[0]]
7892 !! html
7893 <p><strong class="selflink">0</strong>
7894 </p>
7895 !!end
7897 !!test
7898 Link to numeric-equivalent title
7899 !!options
7900 title=[[0]]
7901 !! wikitext
7902 [[00]]
7903 !! html
7904 <p><a href="/wiki/00" title="00">00</a>
7905 </p>
7906 !!end
7908 !! test
7909 <nowiki> inside a link
7910 !! wikitext
7911 [[Main<nowiki> Page</nowiki>]] [[Main Page|the main page <nowiki>[it's not very good]</nowiki>]]
7912 !! html
7913 <p>[[Main Page]] <a href="/wiki/Main_Page" title="Main Page">the main page [it's not very good]</a>
7914 </p>
7915 !! end
7917 !! test
7918 Non-breaking spaces in title
7919 !! wikitext
7920 [[&nbsp; Main &nbsp; Page &nbsp;]]
7921 !! html
7922 <p><a href="/wiki/Main_Page" title="Main Page">&#160; Main &#160; Page &#160;</a>
7923 </p>
7924 !!end
7926 !! test
7927 Internal link with ca linktrail, surrounded by bold apostrophes (bug 27473 primary issue)
7928 !! options
7929 language=ca
7930 !! wikitext
7931 '''[[Main Page]]'''
7932 !! html
7933 <p><b><a href="/wiki/Main_Page" title="Main Page">Main Page</a></b>
7934 </p>
7935 !! end
7937 !! test
7938 Internal link with ca linktrail, surrounded by italic apostrophes (bug 27473 primary issue)
7939 !! options
7940 language=ca
7941 !! wikitext
7942 ''[[Main Page]]''
7943 !! html
7944 <p><i><a href="/wiki/Main_Page" title="Main Page">Main Page</a></i>
7945 </p>
7946 !! end
7948 !! test
7949 Internal link with en linktrail: no apostrophes (bug 27473)
7950 !! options
7951 language=en
7952 !! wikitext
7953 [[Something]]'nice
7954 !! html
7955 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (page does not exist)">Something</a>'nice
7956 </p>
7957 !! end
7959 !! test
7960 Internal link with ca linktrail with apostrophes (bug 27473)
7961 !! options
7962 language=ca
7963 !! wikitext
7964 [[Something]]'nice
7965 !! html
7966 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (encara no existeix)">Something'nice</a>
7967 </p>
7968 !! end
7970 !! test
7971 Internal link with kaa linktrail with apostrophes (bug 27473)
7972 !! options
7973 language=kaa
7974 !! wikitext
7975 [[Something]]'nice
7976 !! html
7977 <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>
7978 </p>
7979 !! end
7981 !! test
7982 Link with multiple ":" in a subpage-supporting namespace (bug 63636)
7983 !! wikitext
7984 [[User:Foo/Test/63636:Bar|Test]]
7985 !! html/php
7986 <p><a href="/index.php?title=User:Foo/Test/63636:Bar&amp;action=edit&amp;redlink=1" class="new" title="User:Foo/Test/63636:Bar (page does not exist)">Test</a>
7987 </p>
7988 !! html/parsoid
7989 <p><a rel="mw:WikiLink" href="./User:Foo/Test/63636:Bar" title="User:Foo/Test/63636:Bar">Test</a></p>
7990 !! end
7992 !! test
7993 Purely hash wikilink
7994 !! options
7995 title=[[User:test/123]]
7996 !! wikitext
7997 [[#a|b]]
7998 !! html/php
7999 <p><a href="#a">b</a>
8000 </p>
8001 !! html/parsoid
8002 <p><a rel="mw:WikiLink" href="./User:Test/123#a" data-parsoid='{"stx":"piped","a":{"href":"./User:Test/123#a"},"sa":{"href":"#a"}}'>b</a></p>
8003 !! end
8005 !! test
8006 1. Interaction of linktrail and template encapsulation
8007 !! options
8008 parsoid
8009 !! wikitext
8010 {{echo|[[Foo]]}}l
8011 !! html
8012 <p><a rel="mw:WikiLink" href="Foo" title="Foo" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[[Foo]]"}},"i":0}},"l"]}'>Fool</a></p>
8013 !! end
8015 !! test
8016 2. Interaction of linktrail and template encapsulation
8017 !! options
8018 parsoid
8019 !! wikitext
8020 {{echo|Some [[Fool]]}}s
8021 !! html
8022 <p><span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"Some [[Fool]]"}},"i":0}},"s"]}' data-parsoid='{"pi":[[{"k":"1"}]]}'>Some </span><a rel="mw:WikiLink" href="./Fool" title="Fool" about="#mwt1" data-parsoid='{"stx":"simple","a":{"href":"./Fool"},"sa":{"href":"Fool"},"tail":"s"}'>Fools</a></p>
8023 !! end
8025 !! test
8026 3. Interaction of linktrail and template encapsulation
8027 !! options
8028 parsoid
8029 !! wikitext
8030 {{echo|Some [[Fool]]s are '''bold and foolish'''}}
8031 !! html
8032 <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"Some [[Fool]]s are &#39;&#39;&#39;bold and foolish&#39;&#39;&#39;"}},"i":0}}]}' data-parsoid='{"pi":[[{"k":"1"}]]}'>Some <a rel="mw:WikiLink" href="./Fool" title="Fool" data-parsoid='{"stx":"simple","a":{"href":"./Fool"},"sa":{"href":"Fool"},"tail":"s"}'>Fools</a> are <b>bold and foolish</b></p>
8033 !! end
8035 !! article
8036 Söfnuður
8037 !! text
8038 Test.
8039 !! endarticle
8041 !! test
8042 Internal link with is link prefix
8043 !! options
8044 language=is
8045 !! wikitext
8046 Aðrir mótmælenda[[söfnuður|söfnuðir]] og
8047 !! html
8048 <p>Aðrir <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðir</a> og
8049 </p>
8050 !! end
8052 !! article
8053 Mótmælendatrú
8054 !! text
8055 Test.
8056 !! endarticle
8058 !! test
8059 Internal link with is link trail and link prefix
8060 !! options
8061 language=is
8062 !! wikitext
8063 [[mótmælendatrú|xxx]]ar
8064 [[mótmælendatrú]]ar
8065 mótmælenda[[söfnuður]]
8066 mótmælenda[[söfnuður|söfnuðir]]
8067 mótmælenda[[söfnuður|söfnuðir]]xxx
8068 !! html
8069 <p><a href="/wiki/M%C3%B3tm%C3%A6lendatr%C3%BA" title="Mótmælendatrú">xxxar</a>
8070 <a href="/wiki/M%C3%B3tm%C3%A6lendatr%C3%BA" title="Mótmælendatrú">mótmælendatrúar</a>
8071 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuður</a>
8072 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðir</a>
8073 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðirxxx</a>
8074 </p>
8075 !! end
8077 !! test
8078 Parsoid link trail escaping
8079 !! options
8080 parsoid=html2wt,html2html
8081 !! html/parsoid
8082 <p><a rel="mw:WikiLink" href="Apple" title="Apple">apple</a>s</p>
8083 !! wikitext
8084 [[apple]]<nowiki/>s
8085 !! end
8087 !! test
8088 Parsoid link prefix escaping
8089 !! options
8090 language=is
8091 parsoid=html2wt,html2html
8092 !! html/parsoid
8093 <p>Aðrir mótmælenda<a rel="mw:WikiLink" href="Söfnuður" title="Söfnuður">söfnuður</a></p>
8094 !! wikitext
8095 Aðrir mótmælenda<nowiki/>[[söfnuður]]
8096 !! end
8098 !! test
8099 Parsoid-centric test: Whitespace in ext- and wiki-links should be preserved
8100 !! wikitext
8101 [[Foo|  bar]]
8103 [[Foo|  ''bar'']]
8105 [http://wp.org   foo]
8107 [http://wp.org   ''foo'']
8108 !! html
8109 <p><a href="/wiki/Foo" title="Foo">  bar</a>
8110 </p><p><a href="/wiki/Foo" title="Foo">  <i>bar</i></a>
8111 </p><p><a rel="nofollow" class="external text" href="http://wp.org">foo</a>
8112 </p><p><a rel="nofollow" class="external text" href="http://wp.org"><i>foo</i></a>
8113 </p>
8114 !! end
8116 !! test
8117 Parsoid: Scoped parsing should handle mixed transclusions and plain text
8118 !! options
8119 parsoid
8120 !! wikitext
8121 [[Foo|{{echo|a}} b {{echo|c}}]]
8122 !! html
8123 <p><a rel="mw:WikiLink" href="Foo" title="Foo"><span about="#mwt2" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"a"}},"i":0}}]}'>a</span> b <span about="#mwt3" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"c"}},"i":0}}]}'>c</span></a></p>
8124 !! end
8126 !! test
8127 Link with angle bracket after anchor
8128 !! wikitext
8129 [[Foo#<bar>]]
8130 !! html/php
8131 <p><a href="/wiki/Foo#.3Cbar.3E" title="Foo">Foo#&lt;bar&gt;</a>
8132 </p>
8133 !! html/parsoid
8134 <p><a rel="mw:WikiLink" href="./Foo#%3Cbar%3E" title="Foo" data-parsoid='{"stx":"simple","a":{"href":"./Foo#%3Cbar%3E"},"sa":{"href":"Foo#&lt;bar>"}}'>Foo#&lt;bar></a></p>
8135 !! end
8138 ### Interwiki links (see maintenance/interwiki.sql)
8141 !! test
8142 Inline interwiki link
8143 !! options
8144 parsoid=wt2html,wt2wt,html2html
8145 !! wikitext
8146 [[MeatBall:SoftSecurity]]
8147 !! html/php
8148 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity</a>
8149 </p>
8150 !! html/parsoid
8151 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity" title="meatball:SoftSecurity">MeatBall:SoftSecurity</a></p>
8152 !! end
8154 !! test
8155 Inline interwiki link with empty title (bug 2372)
8156 !! options
8157 parsoid=wt2html,wt2wt,html2html
8158 !! wikitext
8159 [[MeatBall:]]
8160 !! html/php
8161 <p><a href="http://www.usemod.com/cgi-bin/mb.pl" class="extiw" title="meatball:">MeatBall:</a>
8162 </p>
8163 !! html/parsoid
8164 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?" title="meatball:">MeatBall:</a></p>
8165 !! end
8167 !! test
8168 Interwiki link encoding conversion (bug 1636)
8169 !! wikitext
8170 *[[Wikipedia:ro:Olteni&#0355;a]]
8171 *[[Wikipedia:ro:Olteni&#355;a]]
8172 !! html
8173 <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></li>
8174 <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></li></ul>
8176 !! html+tidy
8177 <ul>
8178 <li><a href="http://en.wikipedia.org/wiki/ro:Olteni%C5%A3a" class="extiw" title="wikipedia:ro:Olteniţa">Wikipedia:ro:Olteniţa</a></li>
8179 <li><a href="http://en.wikipedia.org/wiki/ro:Olteni%C5%A3a" class="extiw" title="wikipedia:ro:Olteniţa">Wikipedia:ro:Olteniţa</a></li>
8180 </ul>
8181 !! end
8183 !! test
8184 Interwiki link with fragment (bug 2130)
8185 !! wikitext
8186 [[MeatBall:SoftSecurity#foo]]
8187 !! html
8188 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity#foo" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity#foo</a>
8189 </p>
8190 !! end
8192 # Ideally the wikipedia: prefix here should be proto-relative too
8193 # [CSA]: this is kind of a bogus test, as the PHP parser test doesn't
8194 # define the 'en' prefix, and originally the test used 'wikipedia',
8195 # which isn't a localinterwiki prefix hence the links to the 'en:Foo'
8196 # article.
8197 !! test
8198 Different interwiki prefixes mapping to the same URL
8199 !! wikitext
8200 [[:en:Foo]]
8202 [[:en:Foo|Foo]]
8204 [[wikipedia:Foo]]
8206 [[:wikipedia:Foo|Foo]]
8208 [[wikipedia:en:Foo]]
8210 [[:wikipedia:en:Foo]]
8212 [[  wikiPEdia :Foo]]
8213 !! html/parsoid
8214 <p><a rel="mw:ExtLink" href="//en.wikipedia.org/wiki/Foo" data-parsoid='{"stx":"simple","a":{"href":"//en.wikipedia.org/wiki/Foo"},"sa":{"href":":en:Foo"},"isIW":true}' title="en:Foo">en:Foo</a></p>
8216 <p><a rel="mw:ExtLink" href="//en.wikipedia.org/wiki/Foo" data-parsoid='{"stx":"piped","a":{"href":"//en.wikipedia.org/wiki/Foo"},"sa":{"href":":en:Foo"},"isIW":true}' title="en:Foo">Foo</a></p>
8218 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo" data-parsoid='{"stx":"simple","a":{"href":"http://en.wikipedia.org/wiki/Foo"},"sa":{"href":"wikipedia:Foo"},"isIW":true}' title="wikipedia:Foo">wikipedia:Foo</a></p>
8220 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo" data-parsoid='{"stx":"piped","a":{"href":"http://en.wikipedia.org/wiki/Foo"},"sa":{"href":":wikipedia:Foo"},"isIW":true}' title="wikipedia:Foo">Foo</a></p>
8222 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/en:Foo" data-parsoid='{"stx":"simple","a":{"href":"http://en.wikipedia.org/wiki/en:Foo"},"sa":{"href":"wikipedia:en:Foo"},"isIW":true}' title="wikipedia:en:Foo">wikipedia:en:Foo</a></p>
8224 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/en:Foo" data-parsoid='{"stx":"simple","a":{"href":"http://en.wikipedia.org/wiki/en:Foo"},"sa":{"href":":wikipedia:en:Foo"},"isIW":true}' title="wikipedia:en:Foo">wikipedia:en:Foo</a></p>
8226 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo" data-parsoid='{"stx":"simple","a":{"href":"http://en.wikipedia.org/wiki/Foo"},"sa":{"href":"  wikiPEdia :Foo"},"isIW":true}' title="wikipedia:Foo">  wikiPEdia :Foo</a></p>
8227 !! end
8229 !! test
8230 Interwiki links that cannot be represented in wiki syntax
8231 !! wikitext
8232 [[meatball:ok]]
8233 [[meatball:ok#foo|ok with fragment]]
8234 [[meatball:ok_as_well?|ok ending with ? mark]]
8235 [http://de.wikipedia.org/wiki/Foo?action=history has query]
8236 [http://de.wikipedia.org/wiki/#foo is just fragment]
8238 !! html/php
8239 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?ok" class="extiw" title="meatball:ok">meatball:ok</a>
8240 <a href="http://www.usemod.com/cgi-bin/mb.pl?ok#foo" class="extiw" title="meatball:ok">ok with fragment</a>
8241 <a href="http://www.usemod.com/cgi-bin/mb.pl?ok_as_well%3F" class="extiw" title="meatball:ok as well?">ok ending with ? mark</a>
8242 <a rel="nofollow" class="external text" href="http://de.wikipedia.org/wiki/Foo?action=history">has query</a>
8243 <a rel="nofollow" class="external text" href="http://de.wikipedia.org/wiki/#foo">is just fragment</a>
8244 </p>
8245 !! html/parsoid
8246 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?ok" title="meatball:ok">meatball:ok</a>
8247 <a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?ok#foo" title="meatball:ok">ok with fragment</a>
8248 <a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?ok_as_well?" title="meatball:ok as well?">ok ending with ? mark</a>
8249 <a rel="mw:ExtLink" href="http://de.wikipedia.org/wiki/Foo?action=history">has query</a>
8250 <a rel="mw:ExtLink" href="http://de.wikipedia.org/wiki/#foo">is just fragment</a></p>
8251 !! end
8253 !! test
8254 Interwiki links: trail
8255 !! wikitext
8256 [[wikipedia:Foo|Ba]]r
8257 !! html/php
8258 <p><a href="http://en.wikipedia.org/wiki/Foo" class="extiw" title="wikipedia:Foo">Bar</a>
8259 </p>
8260 !! html/parsoid
8261 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo" data-parsoid='{"stx":"piped","a":{"href":"http://en.wikipedia.org/wiki/Foo"},"sa":{"href":"wikipedia:Foo"},"isIW":true,"tail":"r"}' title="wikipedia:Foo">Bar</a></p>
8262 !! end
8264 !! test
8265 Local interwiki link
8266 !! options
8267 parsoid=wt2html,wt2wt,html2html
8268 !! wikitext
8269 [[local:Template:Foo]]
8270 !! html/php
8271 <p><a href="/wiki/Template:Foo" title="Template:Foo">local:Template:Foo</a>
8272 </p>
8273 !! html/parsoid
8274 <p><a rel="mw:WikiLink" href="./Template:Foo" title="Template:Foo">local:Template:Foo</a></p>
8275 !! end
8277 # Parsoid does not mark self-links, by design.
8278 !! test
8279 Local interwiki link: self-link to current page
8280 !! options
8281 title=[[Main Page]]
8282 parsoid=wt2html,wt2wt,html2html
8283 !! wikitext
8284 [[local:Main Page]]
8285 !! html/php
8286 <p><strong class="selflink">local:Main Page</strong>
8287 </p>
8288 !! html/parsoid
8289 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">local:Main Page</a></p>
8290 !! end
8292 !! test
8293 Local interwiki link: prefix only (bug 64167)
8294 !! options
8295 parsoid=wt2html,wt2wt,html2html
8296 !! wikitext
8297 [[local:]]
8298 !! html/php
8299 <p><a href="/wiki/Main_Page" title="Main Page">local:</a>
8300 </p>
8301 !! html/parsoid
8302 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">local:</a></p>
8303 !! end
8305 !! test
8306 Local interwiki link: with additional interwiki prefix (bug 61357)
8307 !! options
8308 parsoid=wt2html,wt2wt,html2html
8309 !! wikitext
8310 [[local:meatball:Hello]]
8311 !! html/php
8312 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?Hello" class="extiw" title="meatball:Hello">local:meatball:Hello</a>
8313 </p>
8314 !! html/parsoid
8315 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?Hello" title="meatball:Hello">local:meatball:Hello</a></p>
8316 !! end
8318 !! test
8319 Multiple local interwiki link prefixes
8320 !! wikitext
8321 [[local:local:local:local:mi:local:Foo]]
8322 !! options
8323 parsoid=wt2html,wt2wt,html2html
8324 !! html/php
8325 <p><a href="/wiki/Foo" title="Foo">local:local:local:local:mi:local:Foo</a>
8326 </p>
8327 !! html/parsoid
8328 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">local:local:local:local:mi:local:Foo</a></p>
8329 !! end
8332 ### Interlanguage links
8333 ### Language links (so that searching for '### language' matches..)
8336 !! test
8337 Interlanguage link
8338 !! options
8339 parsoid=wt2html,wt2wt,html2html
8340 !! wikitext
8341 Blah blah blah
8342 [[zh:Chinese]]
8343 !! html/php
8344 <p>Blah blah blah
8345 </p>
8346 !! html/parsoid
8347 <p>Blah blah blah</p>
8348 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
8349 !! end
8351 !! test
8352 Interlanguage link with spacing
8353 !! options
8354 parsoid=wt2html,wt2wt,html2html
8355 !! wikitext
8356 Blah blah blah
8357 [[   zh  :    Chinese     ]]
8358 !! html/php
8359 <p>Blah blah blah
8360 </p>
8361 !! html/parsoid
8362 <p>Blah blah blah</p>
8363 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
8364 !! end
8366 !! test
8367 Double interlanguage link
8368 !! options
8369 parsoid=wt2html,wt2wt,html2html
8370 !! wikitext
8371 Blah blah blah
8372 [[es:Spanish]]
8373 [[zh:Chinese]]
8374 !! html/php
8375 <p>Blah blah blah
8376 </p>
8377 !! html/parsoid
8378 <p>Blah blah blah</p>
8379 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Spanish"/>
8380 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
8381 !! end
8383 !! test
8384 Interlanguage link variations
8385 !! options
8386 parsoid=wt2html,wt2wt,html2html
8387 !! wikitext
8388 Blah blah blah
8389 [[   es :Spanish]]
8390 [[ ZH :Chinese]]
8391 [[es:Foo_bar]]
8392 !! html/php
8393 <p>Blah blah blah
8394 </p>
8395 !! html/parsoid
8396 <p>Blah blah blah</p>
8397 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Spanish" />
8398 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese" />
8399 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Foo_bar" />
8400 !! end
8402 !! test
8403 Space and question mark encoding in interlanguage links (T95473)
8404 !! options
8405 parsoid=wt2html,wt2wt,html2html
8406 !! wikitext
8407 Blah blah blah
8408 [[es:Foo bar?]]
8409 !! html/php
8410 <p>Blah blah blah
8411 </p>
8412 !! html/parsoid
8413 <p>Blah blah blah</p>
8414 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Foo_bar%3F" />
8415 !! end
8417 !! test
8418 Interlanguage link, with prefix links
8419 !! options
8420 language=ln
8421 !! wikitext
8422 Blah blah blah
8423 [[zh:Chinese]]
8424 !! html/php
8425 <p>Blah blah blah
8426 </p>
8427 !! html/parsoid
8428 <p>Blah blah blah</p>
8429 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
8430 !! end
8432 !! test
8433 Double interlanguage link, with prefix links (bug 8897)
8434 !! options
8435 language=ln
8436 !! wikitext
8437 Blah blah blah
8438 [[es:Spanish]]
8439 [[zh:Chinese]]
8440 !! html/php
8441 <p>Blah blah blah
8442 </p>
8443 !! html/parsoid
8444 <p>Blah blah blah</p>
8445 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Spanish"/>
8446 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
8447 !! end
8449 !! test
8450 "Extra" interlanguage links (bug 32189 / gerrit 111390)
8451 !! wikitext
8452 Blah blah blah
8453 [[mul:Article]]
8454 !! html/php
8455 <p>Blah blah blah
8456 </p>
8457 !! html/parsoid
8458 <p>Blah blah blah</p>
8459 <link rel="mw:PageProp/Language" title="Multilingual" href="http://wikisource.org/wiki/Article"/>
8460 !! end
8462 !! test
8463 Parsoid-specific test: Wikilinks with &nbsp; should RT properly
8464 !! options
8465 language=ln
8466 !! wikitext
8467 [[WW&nbsp;II]]
8468 !! html
8469 <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>
8470 </p>
8471 !! end
8473 !! test
8474 Parsoid bug 53221: Wikilinks should be properly entity-escaped
8475 !! options
8476 parsoid=html2wt
8477 !! html/parsoid
8478 <p>He&amp;nbsp;llo <a href="Foo" rel="mw:WikiLink">He&amp;nbsp;llo</a></p>
8479 <p>He&amp;nbsp;llo <a href="He&amp;nbsp;llo" rel="mw:WikiLink">He&amp;nbsp;llo</a></p>
8480 !! wikitext
8481 He&amp;nbsp;llo [[Foo|He&amp;nbsp;llo]]
8483 He&amp;nbsp;llo [[He&amp;nbsp;llo]]
8484 !! end
8486 !! test
8487 Parsoid: handle constructor well
8488 !! wikitext
8489 [[constructor]]
8491 [[constructor:foo]]
8492 !! html/php
8493 <p><a href="/index.php?title=Constructor&amp;action=edit&amp;redlink=1" class="new" title="Constructor (page does not exist)">constructor</a>
8494 </p><p><a href="/index.php?title=Constructor:foo&amp;action=edit&amp;redlink=1" class="new" title="Constructor:foo (page does not exist)">constructor:foo</a>
8495 </p>
8496 !! html/parsoid
8497 <p><a rel="mw:WikiLink" href="./Constructor" title="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;}}">constructor</a></p>
8499 <p><a rel="mw:WikiLink" href="./Foo" title="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;}}">constructor:foo</a></p>
8500 !! end
8502 !! article
8504 !! text
8505 Test.
8506 !! endarticle
8508 # Note that `ko` isn't a known interlanguage prefix
8509 !! test
8510 Parsoid: recognize interlanguage links without a target page
8511 !! options
8513 !! wikitext
8514 [[es:]]
8516 [[ko:]]
8517 !! html/php
8519 !! html/parsoid
8520 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/"/>
8522 <p><a rel="mw:WikiLink" href="./Ko:" title="Ko:">ko:</a></p>
8523 !! end
8525 # Note that `ko` isn't a known interwiki prefix
8526 !! test
8527 Parsoid: recognize interwiki links without a target page
8528 !! options
8529 parsoid=wt2html,wt2wt,html2html
8530 !! wikitext
8531 [[:es:]]
8533 [[:ko:]]
8534 !! html/php
8535 <p><a href="http://es.wikipedia.org/wiki/" class="extiw" title="es:">es:</a>
8536 </p><p><a href="/wiki/Ko:" title="Ko:">ko:</a>
8537 </p>
8538 !! html/parsoid
8539 <p><a rel="mw:ExtLink" href="http://es.wikipedia.org/wiki/" title="es:">es:</a></p>
8540 <p><a rel="mw:WikiLink" href="./Ko:" title="Ko:">ko:</a></p>
8541 !! end
8543 !! test
8544 Handle interwiki links pointing to the current wiki as plain wiki links (bug 45209)
8545 !! wikitext
8546 [[mi:Foo]]
8547 !! html/php
8548 <p><a href="/wiki/Foo" title="Foo">mi:Foo</a>
8549 </p>
8550 !! html/parsoid
8551 <p><a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{"stx":"simple","a":{"href":"./Foo"},"sa":{"href":"mi:Foo"}}'>mi:Foo</a></p>
8552 !! end
8554 !! test
8555 Interlanguage link with preceding local interwiki link (bug 68085)
8556 !! options
8557 parsoid=wt2html,wt2wt,html2html
8558 !! wikitext
8559 Blah blah blah
8560 [[local:es:Spanish]]
8561 !! html/php
8562 <p>Blah blah blah
8563 <a href="http://es.wikipedia.org/wiki/Spanish" class="extiw" title="es:Spanish">local:es:Spanish</a>
8564 </p>
8565 !! html/parsoid
8566 <p>Blah blah blah
8567 <a rel="mw:ExtLink" href="http://es.wikipedia.org/wiki/Spanish" title="es:Spanish">local:es:Spanish</a></p>
8568 !! end
8570 !! test
8571 Looks like an interlanguage link, but is actually a local interwiki
8572 !! options
8573 parsoid=wt2html,wt2wt,html2html
8574 !! wikitext
8575 Blah blah blah
8576 [[mi:Template:Foo]]
8577 !! html/php
8578 <p>Blah blah blah
8579 <a href="/wiki/Template:Foo" title="Template:Foo">mi:Template:Foo</a>
8580 </p>
8581 !! html/parsoid
8582 <p>Blah blah blah
8583 <a rel="mw:WikiLink" href="./Template:Foo" title="Template:Foo">mi:Template:Foo</a></p>
8584 !! end
8587 ### Redirects, Parsoid-only
8590 !! test
8591 1. Simple redirect to page
8592 !! wikitext
8593 #REDIRECT [[Main Page]]
8594 !! html/parsoid
8595 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
8596 !! end
8598 !! test
8599 2. Other redirect variants
8600 !! wikitext
8601 #REDIRECT [[Main_Page]]
8602 !! html/parsoid
8603 <link rel="mw:PageProp/redirect" href="./Main_Page" data-parsoid='{"src":"#REDIRECT ","a":{"href":"./Main_Page"},"sa":{"href":"Main_Page"}}'/>
8604 !! end
8606 # Not a valid redirect in PHP (although perhaps it was, once upon a time)
8607 # This tests the Parsoid bail-out code.
8608 !! test
8609 3. Other redirect variants
8610 !! wikitext
8611 #REDIRECT [[<nowiki>[[Bar]]</nowiki>]]
8612 !! html/parsoid
8613 <ol><li data-parsoid>REDIRECT [[[[Bar]]]]</li></ol>
8614 !! end
8616 !! test
8617 4. Redirect to a templated destination
8618 !! wikitext
8619 #REDIRECT [[{{echo|Foo}}bar]]
8620 !! html/parsoid
8621 <link about="#mwt2" typeof="mw:ExpandedAttrs" rel="mw:PageProp/redirect" href="./Foobar" data-parsoid='{"a":{"href":"./Foobar"},"sa":{"href":"{{echo|Foo}}bar"}}' data-mw='{"attribs":[[{"txt":"href"},{"html":"&lt;span about=\"#mwt1\" typeof=\"mw:Transclusion\" data-parsoid=&#39;{\"pi\":[[{\"k\":\"1\"}]],\"dsr\":[12,24,null,null]}&#39; data-mw=&#39;{\"parts\":[{\"template\":{\"target\":{\"wt\":\"echo\",\"href\":\"./Template:Echo\"},\"params\":{\"1\":{\"wt\":\"Foo\"}},\"i\":0}}]}&#39;>Foo&lt;/span>bar"}]]}'/>
8622 !! end
8624 !! test
8625 Empty redirect
8626 !! options
8627 parsoid=wt2html,wt2wt
8628 !! wikitext
8629 #REDIRECT [[]]
8630 !! html/parsoid
8631 <ol>
8632 <li>REDIRECT [[]]</li></ol>
8633 !! end
8635 !! test
8636 Optional colon in #REDIRECT
8637 !! options
8638 # the colon is archaic syntax.  we support it for wt2html, but we
8639 # don't care that it roundtrips back to the modern syntax.
8640 parsoid=wt2html,html2html
8641 !! wikitext
8642 #REDIRECT:[[Main Page]]
8643 !! html/parsoid
8644 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
8645 !! end
8647 !! test
8648 Whitespace in #REDIRECT with optional colon
8649 !! options
8650 # the colon and gratuitous whitespace is archaic syntax.  we support
8651 # it for wt2html, but we don't care that it roundtrips back to the
8652 # modern syntax (without extra whitespace)
8653 parsoid=wt2html,html2html
8654 !! wikitext
8656  #REDIRECT 
8658 [[Main Page]]
8659 !! html/parsoid
8660 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
8661 !! end
8663 !! test
8664 Piped link in #REDIRECT
8665 !! options
8666 # content after piped link is ignored.  we support this syntax,
8667 # but don't care that the piped link is lost when we roundtrip this.
8668 parsoid=wt2html
8669 !! wikitext
8670 #REDIRECT [[Main Page|bar]]
8671 !! html/parsoid
8672 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
8673 !! end
8675 !! test
8676 Redirect to category (T104502)
8677 !! options
8678 parsoid=wt2html,wt2wt
8679 !! wikitext
8680 #REDIRECT [[Category:Foo]]
8681 !! html/parsoid
8682 <link rel="mw:PageProp/redirect" href="./Category:Foo"/>
8683 !! end
8685 !! test
8686 Redirect to category with URL encoding (T104502)
8687 !! options
8688 parsoid=wt2html
8689 !! wikitext
8690 #REDIRECT [[Category%3AFoo]]
8691 !! html/parsoid
8692 <link rel="mw:PageProp/redirect" href="./Category:Foo"/>
8693 !! end
8695 !! test
8696 Redirect to category page
8697 !! wikitext
8698 #REDIRECT [[:Category:Foo]]
8699 !! html/parsoid
8700 <link rel="mw:PageProp/redirect" href="./Category:Foo"/>
8701 !! end
8703 !! test
8704 Redirect to image page (1)
8705 !! wikitext
8706 #REDIRECT [[File:Wiki.png]]
8707 !! html/parsoid
8708 <link rel="mw:PageProp/redirect" href="./File:Wiki.png"/>
8709 !! end
8711 !! test
8712 Redirect to image page (2)
8713 !! wikitext
8714 #REDIRECT [[Image:Wiki.png]]
8715 !! html/parsoid
8716 <link rel="mw:PageProp/redirect" href="./File:Wiki.png"  data-parsoid='{"src":"#REDIRECT ","a":{"href":"./File:Wiki.png"},"sa":{"href":"Image:Wiki.png"}}'/>
8717 !! end
8719 # html2wt disabled because wts serializes as "#REDIRECT [[:en:File:Wiki.png]]"
8720 # Next test confirms this.
8721 !! test
8722 Redirect to language (1) (T104918)
8723 !! options
8724 parsoid=wt2html,wt2wt,html2html
8725 !! wikitext
8726 #REDIRECT [[en:File:Wiki.png]]
8727 !! html/parsoid
8728 <link rel="mw:PageProp/redirect" href="//en.wikipedia.org/wiki/File:Wiki.png"/>
8729 !! end
8731 !! test
8732 Redirect to language (2) (T104918)
8733 !! wikitext
8734 #REDIRECT [[:en:File:Wiki.png]]
8735 !! html/parsoid
8736 <link rel="mw:PageProp/redirect" href="//en.wikipedia.org/wiki/File:Wiki.png"/>
8737 !! end
8739 !! test
8740 Redirect to interwiki (T104918)
8741 !! wikitext
8742 #REDIRECT [[meatball:File:Wiki.png]]
8743 !! html/parsoid
8744 <link rel="mw:PageProp/redirect" href="http://www.usemod.com/cgi-bin/mb.pl?File:Wiki.png"/>
8745 !! end
8747 !! test
8748 Non-English #REDIRECT
8749 !! options
8750 language=is
8751 !! wikitext
8752 #TILVÍSUN [[Main Page]]
8753 !! html/parsoid
8754 <link rel="mw:PageProp/redirect" href="./Main_Page" data-parsoid='{"src":"#TILVÍSUN ","a":{"href":"./Main_Page"},"sa":{"href":"Main Page"}}'/>
8755 !! end
8757 !! test
8758 Redirect syntax under text isn't considered a redirect
8759 !! wikitext
8760 some text
8761 #redirect [[Main Page]]
8762 !! html/parsoid
8763 <p>some text</p>
8764 <ol data-parsoid='{}'><li data-parsoid='{}'>redirect <a rel="mw:WikiLink" href="./Main_Page" title="Main Page" data-parsoid='{"stx":"simple","a":{"href":"./Main_Page"},"sa":{"href":"Main Page"}}'>Main Page</a></li></ol>
8765 !! end
8767 # FIXME: Should hoist the redirect to the top of the page and ensure there
8768 # is only one.
8769 !! test
8770 New redirect
8771 !! options
8772 parsoid=html2wt
8773 !! html/parsoid
8774 <p>Foo<link rel="mw:PageProp/redirect" href="./Foo"/></p>
8775 !! wikitext
8777 #REDIRECT [[Foo]]
8778 !! end
8781 ## XHTML tidiness
8784 !! test
8785 <br> to <br />
8786 !! wikitext
8787 1<br>2<br />3
8788 !! html
8789 <p>1<br />2<br />3
8790 </p>
8791 !! end
8793 !! test
8794 Broken br tag sanitization
8795 !! wikitext
8796 </br>
8797 !! html/php
8798 <p>&lt;/br&gt;
8799 </p>
8800 !! end
8802 # TODO: Fix html2html mode (bug 51055)!
8803 !! test
8804 Parsoid: Broken br tag recognition
8805 !! options
8806 parsoid=wt2html
8807 !! wikitext
8808 </br>
8810 <br/ >
8811 !! html+tidy
8812 <p><br /></p>
8813 <p><br /></p>
8814 !! end
8816 !! test
8817 Incorrecly removing closing slashes from correctly formed XHTML
8818 !! wikitext
8819 <br style="clear:both;" />
8820 !! html
8821 <p><br style="clear:both;" />
8822 </p>
8823 !! end
8825 !! test
8826 Failing to transform badly formed HTML into correct XHTML
8827 !! wikitext
8828 <br style="clear: left;">
8829 <br style="clear: right;">
8830 <br style="clear: both;">
8831 !! html
8832 <p><br style="clear: left;" />
8833 <br style="clear: right;" />
8834 <br style="clear: both;" />
8835 </p>
8836 !!end
8838 ## FIXME: Is Parsoid's acceptance of self-closing html-tags
8839 ## a feature or a bug? See https://phabricator.wikimedia.org/T76962
8840 !! test
8841 Handling html with a div self-closing tag
8842 !! wikitext
8843 <div title />
8844 <div title/>
8845 <div title/ >
8846 <div title=bar />
8847 <div title=bar/>
8848 <div title=bar/ >
8849 !! html/php
8850 <p>&lt;div title /&gt;
8851 &lt;div title/&gt;
8852 </p>
8853 <div>
8854 <p>&lt;div title=bar /&gt;
8855 &lt;div title=bar/&gt;
8856 </p>
8857 <div title="bar/"></div>
8858 </div>
8860 !! html/parsoid
8861 <div title="" data-parsoid='{"stx":"html","selfClose":true}'></div>
8862 <div title="" data-parsoid='{"stx":"html","selfClose":true}'></div>
8863 <div title="" data-parsoid='{"stx":"html","selfClose":true,"brokenHTMLTag":true}'></div>
8864 <div title="bar" data-parsoid='{"stx":"html","selfClose":true}'></div>
8865 <div title="bar" data-parsoid='{"stx":"html","selfClose":true}'></div>
8866 <div title="bar/" data-parsoid='{"stx":"html","autoInsertedEnd":true}'></div>
8867 !! end
8869 !! test
8870 Handling html with a br self-closing tag
8871 !! wikitext
8872 <br title />
8873 <br title/>
8874 <br title/ >
8875 <br title=bar />
8876 <br title=bar/>
8877 <br title=bar/ >
8878 !! html/php
8879 <p><br title="" />
8880 <br title="" />
8881 <br />
8882 <br title="bar" />
8883 <br title="bar" />
8884 <br title="bar/" />
8885 </p>
8886 !! html/parsoid
8887 <p><br title="" />
8888 <br title="" />
8889 <br title="" />
8890 <br title="bar" />
8891 <br title="bar" />
8892 <br title="bar/" />
8893 </p>
8894 !! end
8896 !! test
8897 Horizontal ruler (should it add that extra space?)
8898 !! wikitext
8899 <hr>
8900 <hr >
8901 foo <hr
8902 > bar
8903 !! html+tidy
8904 <hr />
8905 <hr />
8906 <p>foo</p>
8907 <hr />
8908 <p>bar</p>
8909 !! end
8911 !! test
8912 Horizontal ruler -- 4+ dashes render hr
8913 !! wikitext
8914 ----
8915 !! html
8916 <hr />
8918 !! end
8920 !! test
8921 Horizontal ruler -- eats additional dashes on the same line
8922 !! wikitext
8923 ---------
8924 !! html
8925 <hr />
8927 !! end
8929 !! test
8930 Horizontal ruler -- does not collapse dashes on consecutive lines
8931 !! wikitext
8932 ----
8933 ----
8934 !! html
8935 <hr />
8936 <hr />
8938 !! end
8940 !! test
8941 Horizontal ruler -- <4 dashes render as plain text
8942 !! wikitext
8944 !! html
8945 <p>---
8946 </p>
8947 !! end
8949 !! test
8950 Horizontal ruler -- Supports content following dashes on same line
8951 !! wikitext
8952 ---- Foo
8953 !! html
8954 <hr /> Foo
8956 !! html+tidy
8957 <hr />
8958 <p>Foo</p>
8959 !! end
8962 ### Block-level elements
8964 !! test
8965 Common list
8966 !! wikitext
8967 *Common list
8968 * item 2
8969 *item 3
8970 !! html
8971 <ul><li>Common list</li>
8972 <li> item 2</li>
8973 <li>item 3</li></ul>
8975 !! end
8977 !! test
8978 Numbered list
8979 !! wikitext
8980 #Numbered list
8981 #item 2
8982 # item 3
8983 !! html
8984 <ol><li>Numbered list</li>
8985 <li>item 2</li>
8986 <li> item 3</li></ol>
8988 !! end
8990 !! test
8991 Mixed list
8992 !! wikitext
8993 *Mixed list
8994 *# with numbers
8995 ** and bullets
8996 *# and numbers
8997 *bullets again
8998 **bullet level 2
8999 ***bullet level 3
9000 ***#Number on level 4
9001 **bullet level 2
9002 **#Number on level 3
9003 **#Number on level 3
9004 *#number level 2
9005 *Level 1
9006 *** Level 3
9007 #** Level 3, but ordered
9008 !! html
9009 <ul><li>Mixed list
9010 <ol><li> with numbers</li></ol>
9011 <ul><li> and bullets</li></ul>
9012 <ol><li> and numbers</li></ol></li>
9013 <li>bullets again
9014 <ul><li>bullet level 2
9015 <ul><li>bullet level 3
9016 <ol><li>Number on level 4</li></ol></li></ul></li>
9017 <li>bullet level 2
9018 <ol><li>Number on level 3</li>
9019 <li>Number on level 3</li></ol></li></ul>
9020 <ol><li>number level 2</li></ol></li>
9021 <li>Level 1
9022 <ul><li><ul><li> Level 3</li></ul></li></ul></li></ul>
9023 <ol><li><ul><li><ul><li> Level 3, but ordered</li></ul></li></ul></li></ol>
9025 !! end
9027 !! test
9028 1. Nested mixed wikitext and html list
9029 !! wikitext
9030 * hi
9031 * <ul><li>ho</li></ul>
9032 * hi
9033 ** ho
9034 !! html/php
9035 <ul><li> hi</li>
9036 <li> <ul><li>ho</li></ul></li>
9037 <li> hi
9038 <ul><li> ho</li></ul></li></ul>
9040 !! html/parsoid
9041 <ul><li> hi</li>
9042 <li> <ul data-parsoid='{"stx":"html"}'><li data-parsoid='{"stx":"html"}'>ho</li></ul></li>
9043 <li> hi
9044 <ul><li> ho</li></ul></li></ul>
9045 !! end
9047 !! test
9048 2. Nested mixed wikitext and html list (incompatible)
9049 !! wikitext
9050 ; hi
9051 : {{echo|<li>ho</li>}}
9052 !! html/php
9053 <dl><dt> hi</dt>
9054 <dd> <li>ho</li></dd></dl>
9056 !! html/parsoid
9057 <dl><dt> hi</dt>
9058 <dd> <li about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"stx":"html","pi":[[{"k":"1"}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;li>ho&lt;/li>"}},"i":0}}]}'>ho</li></dd></dl>
9059 !! end
9061 !! test
9062 Nested lists 1
9063 !! wikitext
9064 *foo
9065 **bar
9066 !! html
9067 <ul><li>foo
9068 <ul><li>bar</li></ul></li></ul>
9070 !! end
9072 !! test
9073 Nested lists 2
9074 !! wikitext
9075 **foo
9076 *bar
9077 !! html
9078 <ul><li><ul><li>foo</li></ul></li>
9079 <li>bar</li></ul>
9081 !! end
9083 !! test
9084 Nested lists 3 (first element empty)
9085 !! wikitext
9087 **bar
9088 !! html
9089 <ul><li>
9090 <ul><li>bar</li></ul></li></ul>
9092 !! end
9094 !! test
9095 Nested lists 4 (first element empty)
9096 !! wikitext
9098 *bar
9099 !! html
9100 <ul><li><ul><li></li></ul></li>
9101 <li>bar</li></ul>
9103 !! end
9105 !! test
9106 Nested lists 5 (both elements empty)
9107 !! wikitext
9110 !! html
9111 <ul><li><ul><li></li></ul></li>
9112 <li></li></ul>
9114 !! end
9116 !! test
9117 Nested lists 6 (both elements empty)
9118 !! wikitext
9121 !! html
9122 <ul><li>
9123 <ul><li></li></ul></li></ul>
9125 !! end
9127 !! test
9128 Nested lists 7 (skip initial nesting levels)
9129 !! wikitext
9130 *** foo
9131 !! html
9132 <ul><li><ul><li><ul><li> foo</li></ul></li></ul></li></ul>
9134 !! end
9136 !! test
9137 Nested lists 8 (multiple nesting transitions)
9138 !! wikitext
9139 * foo
9140 *** bar
9141 ** baz
9142 * boo
9143 !! html
9144 <ul><li> foo
9145 <ul><li><ul><li> bar</li></ul></li>
9146 <li> baz</li></ul></li>
9147 <li> boo</li></ul>
9149 !! end
9151 !! test
9152 Nested lists 9 (extension interaction)
9153 !! options
9154 parsoid
9155 !! wikitext
9156 *<references />
9157 !! html/parsoid
9158 <ul><li data-parsoid='{}'><ol class="mw-references" typeof="mw:Extension/references" about="#mwt2" data-parsoid='{}' data-mw='{"name":"references","attrs":{}}'></ol></li></ul>
9159 !! end
9161 !! test
9162 1. Lists with start-of-line-transparent tokens before bullets: Comments
9163 !! wikitext
9164 *foo
9165 *<!--cmt-->bar
9166 <!--cmt-->*baz
9167 !! html
9168 <ul><li>foo</li>
9169 <li>bar</li>
9170 <li>baz</li></ul>
9172 !! end
9174 !! test
9175 2. Lists with start-of-line-transparent tokens before bullets: Template close
9176 !! wikitext
9177 *foo {{echo|bar
9178 }}*baz
9179 !! html
9180 <ul><li>foo bar</li>
9181 <li>baz</li></ul>
9183 !! end
9185 !! test
9186 List items are not parsed correctly following a <pre> block (bug 785)
9187 !! wikitext
9188 * <pre>foo</pre>
9189 * <pre>bar</pre>
9190 * zar
9191 !! html/php
9192 <ul><li> <pre>foo</pre></li>
9193 <li> <pre>bar</pre></li>
9194 <li> zar</li></ul>
9196 !! html/parsoid
9197 <ul><li> <pre data-parsoid='{"stx":"html"}'>foo</pre></li>
9198 <li> <pre data-parsoid='{"stx":"html"}'>bar</pre></li>
9199 <li> zar</li></ul>
9200 !! end
9202 !! test
9203 List items from template
9204 !! wikitext
9206 {{inner list}}
9207 * item 2
9209 * item 0
9210 {{inner list}}
9211 * item 2
9213 * item 0
9214 * notSOL{{inner list}}
9215 * item 2
9216 !! html
9217 <ul><li> item 1</li>
9218 <li> item 2</li></ul>
9219 <ul><li> item 0</li>
9220 <li> item 1</li>
9221 <li> item 2</li></ul>
9222 <ul><li> item 0</li>
9223 <li> notSOL</li>
9224 <li> item 1</li>
9225 <li> item 2</li></ul>
9227 !! end
9229 !! test
9230 List interrupted by empty line or heading
9231 !! wikitext
9232 * foo
9234 ** bar
9235 == A heading ==
9236 * Another list item
9237 !! html
9238 <ul><li> foo</li></ul>
9239 <ul><li><ul><li> bar</li></ul></li></ul>
9240 <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>
9241 <ul><li> Another list item</li></ul>
9243 !!end
9245 !!test
9246 Multiple list tags generated by templates
9247 !! wikitext
9248 {{echo|<li>}}a
9249 {{echo|<li>}}b
9250 {{echo|<li>}}c
9251 !! html
9252 <li>a
9253 <li>b
9254 <li>c</li>
9255 </li>
9256 </li>
9258 !! html+tidy
9259 <ul>
9260 <li>a</li>
9261 <li>b</li>
9262 <li>c</li>
9263 </ul>
9264 !!end
9266 !!test
9267 Single-comment whitespace lines dont break lists, and neither do multi-comment whitespace lines
9268 !! wikitext
9270 <!--This line will NOT split the list-->
9272  <!--This line will NOT split the list either-->
9274  <!--foo--> <!----> <!--This line NOT split the list either--> 
9276 !! html
9277 <ul><li>a</li>
9278 <li>b</li>
9279 <li>c</li>
9280 <li>d</li></ul>
9282 !!end
9284 !!test
9285 Replacing whitespace with tabs still doesn't break the list (gerrit 78327)
9286 !! wikitext
9288 <!--This line will NOT split the list-->        
9290         <!--This line will NOT split the list either-->         
9292         <!--foo--> <!---->      <!--This line NOT split the list
9293         either-->        
9295 !! html
9296 <ul><li>a</li>
9297 <li>b</li>
9298 <li>c</li>
9299 <li>d</li></ul>
9301 !!end
9303 !!test
9304 Test the li-hack
9305 (The PHP parser relies on Tidy for the hack)
9306 !!options
9307 parsoid=wt2html,wt2wt
9308 !! wikitext
9309 * foo
9310 * <li>li-hack
9311 * {{echo|<li>templated li-hack}}
9312 * <!--foo--> <li> unsupported li-hack with preceding comments
9314 <ul>
9315 <li><li>not a li-hack
9316 </li>
9317 </ul>
9318 !! html+tidy
9319 <ul>
9320 <li>foo</li>
9321 <li>li-hack</li>
9322 <li>templated li-hack</li>
9323 <li>unsupported li-hack with preceding comments</li>
9324 </ul>
9325 <ul>
9326 <li>not a li-hack</li>
9327 </ul>
9328 !!end
9330 !! test
9331 Parsoid: Make sure nested lists are serialized on their own line even if HTML contains no newlines
9332 !! options
9333 parsoid
9334 !! wikitext
9335 # foo
9336 ## bar
9337 * foo
9338 ** bar
9339 : foo
9340 :: bar
9341 !! html
9342 <ol>
9343 <li> foo<ol>
9344 <li> bar</li>
9345 </ol></li>
9346 </ol><ul>
9347 <li> foo<ul>
9348 <li> bar</li>
9349 </ul></li>
9350 </ul><dl>
9351 <dd> foo<dl>
9352 <dd> bar</dd>
9353 </dl></dd>
9354 </dl>
9355 !! end
9357 !! test
9358 Parsoid: Test of whitespace serialization with Templated bullets
9359 !! options
9360 parsoid
9361 !! wikitext
9362 * {{bullet}}
9363 !! html
9364 <ul>
9365 <li> </li><li about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"bullet","href":"./Template:Bullet"},"params":{},"i":0}}]}'> Bar</li>
9366 </ul>
9367 !! end
9369 # ------------------------------------------------------------------------
9370 # The next set of tests are about Parsoid's ability to handle badly nested
9371 # tags (parse, minimize scope of fixup, and roundtrip back)
9372 # ------------------------------------------------------------------------
9374 !! test
9375 Unbalanced closing block tags break a list
9376 (php parser relies on Tidy to fix up)
9377 !! wikitext
9378 <div>
9379 *a</div><div>
9380 *b</div>
9381 !! html+tidy
9382 <div>
9383 <ul>
9384 <li>a</li>
9385 </ul>
9386 </div>
9387 <div>
9388 <ul>
9389 <li>b</li>
9390 </ul>
9391 </div>
9392 !! end
9394 # Parsoid fails this test, but it might be tricky to support properly.
9395 # See bug 68395.
9396 !! test
9397 Unbalanced closing non-block tags don't break a list
9398 (php parser relies on Tidy to fix up)
9399 !! wikitext
9400 <span>
9401 *a</span><span>
9402 *b</span>
9403 !! html/php+tidy
9404 <ul>
9405 <li><span>a</span></li>
9406 <li><span>b</span></li>
9407 </ul>
9408 !! html/parsoid
9409 <span>
9410 <ul>
9411 <li>a<span></span>
9412 </li>
9413 <li>b
9414 </li>
9415 </ul>
9416 </span>
9417 !! end
9419 !! test
9420 Unclosed formatting tags that straddle lists are closed and reopened
9421 (php parser relies on Tidy to fix up)
9422 !! options
9423 parsoid=wt2html,wt2wt,html2html
9424 !! wikitext
9425 # <s> a
9426 # b </s>
9427 !! html/php+tidy
9428 <ol>
9429 <li><s>a</s></li>
9430 <li><s>b</s></li>
9431 </ol>
9432 !! html/parsoid
9433 <ol><li> <s> a</s></li>
9434 <li><s> b </s></li></ol>
9435 !! end
9437 # See bug 68395.
9438 !!test
9439 1. List embedded in a formatting tag
9440 !! wikitext
9441 <small>
9442 * foo
9443 </small>
9444 !! html/php+tidy
9445 <ul>
9446 <li><small>foo</small></li>
9447 </ul>
9448 !! html/parsoid
9449 <small>
9450 <ul>
9451 <li> foo</li>
9452 </ul>
9453 </small>
9454 !!end
9456 ## Ugly Parsoid output here
9457 ## Not sure what the right output is.
9458 !!test
9459 2. List embedded in a formatting tag
9460 !! wikitext
9461 <small>
9463 *b</small>
9464 !! html/php+tidy
9465 <ul>
9466 <li><small>a</small></li>
9467 <li><small>b</small></li>
9468 </ul>
9469 !! html/parsoid
9470 <small></small>
9471 <ul><small>
9472 <li>a</li>
9473 </small>
9474 <li><small>b</small></li>
9475 </ul>
9476 !!end
9478 # Ugly Parsoid and PHP parser output here
9479 # Not sure if we want to make this a test!
9481 ## !!test
9482 ## 3. Unclosed formatting tags in list elements
9483 ## !! wikitext
9484 ## *<small>a
9485 ## *<small>b
9486 ## !! html/php+tidy
9487 ## <ul>
9488 ## <li><small>a</small></li>
9489 ## <li><small><small>b</small></small></li>
9490 ## </ul>
9491 ## !! html/parsoid
9492 ## <ul>
9493 ## <li><small>a</small></li>
9494 ## <small>
9495 ## <li><small>b</small></li>
9496 ## </small></ul>
9497 ## !!end
9499 # This is a bug in the PHP parser + tidy combination.
9500 # (The </tr> tag gets parsed as text and html-escaped by PHP,
9501 # and then fostered out of the table by tidy.)
9502 # We believe the Parsoid output to be correct.
9503 !! test
9504 Table with missing opening <tr> tag
9505 !! options
9506 parsoid=wt2html,wt2wt
9507 !! wikitext
9508 <table>
9509 <td>foo</td>
9510 </tr>
9511 </table>
9512 !! html+tidy
9513 <table>
9514 <tr>
9515 <td>foo</td>
9516 </tr>
9517 </table>
9518 !! end
9521 ### Magic Words
9524 # Note that the current date is hard-coded as
9525 #   1970-01-01T00:02:03Z (a Thursday)
9526 # when running parser tests.  The timezone is also fixed to GMT, so
9527 # local date will be identical to current date.
9529 !! test
9530 Magic Word: {{CURRENTDAY}}
9531 !! wikitext
9532 {{CURRENTDAY}}
9533 !! html
9534 <p>1
9535 </p>
9536 !! end
9538 !! test
9539 Magic Word: {{CURRENTDAY2}}
9540 !! wikitext
9541 {{CURRENTDAY2}}
9542 !! html
9543 <p>01
9544 </p>
9545 !! end
9547 !! test
9548 Magic Word: {{CURRENTDAYNAME}}
9549 !! wikitext
9550 {{CURRENTDAYNAME}}
9551 !! html
9552 <p>Thursday
9553 </p>
9554 !! end
9556 !! test
9557 Magic Word: {{CURRENTDOW}}
9558 !! wikitext
9559 {{CURRENTDOW}}
9560 !! html
9561 <p>4
9562 </p>
9563 !! end
9565 !! test
9566 Magic Word: {{CURRENTMONTH}}
9567 !! wikitext
9568 {{CURRENTMONTH}}
9569 !! html
9570 <p>01
9571 </p>
9572 !! end
9574 !! test
9575 Magic Word: {{CURRENTMONTH1}}
9576 !! wikitext
9577 {{CURRENTMONTH1}}
9578 !! html
9579 <p>1
9580 </p>
9581 !! end
9583 !! test
9584 Magic Word: {{CURRENTMONTHABBREV}}
9585 !! wikitext
9586 {{CURRENTMONTHABBREV}}
9587 !! html
9588 <p>Jan
9589 </p>
9590 !! end
9592 !! test
9593 Magic Word: {{CURRENTMONTHNAME}}
9594 !! wikitext
9595 {{CURRENTMONTHNAME}}
9596 !! html
9597 <p>January
9598 </p>
9599 !! end
9601 !! test
9602 Magic Word: {{CURRENTMONTHNAMEGEN}}
9603 !! wikitext
9604 {{CURRENTMONTHNAMEGEN}}
9605 !! html
9606 <p>January
9607 </p>
9608 !! end
9610 !! test
9611 Magic Word: {{CURRENTTIME}}
9612 !! wikitext
9613 {{CURRENTTIME}}
9614 !! html
9615 <p>00:02
9616 </p>
9617 !! end
9619 !! test
9620 Magic Word: {{CURRENTHOUR}}
9621 !! wikitext
9622 {{CURRENTHOUR}}
9623 !! html
9624 <p>00
9625 </p>
9626 !! end
9628 !! test
9629 Magic Word: {{CURRENTWEEK}} (@bug 4594)
9630 !! wikitext
9631 {{CURRENTWEEK}}
9632 !! html
9633 <p>1
9634 </p>
9635 !! end
9637 !! test
9638 Magic Word: {{CURRENTYEAR}}
9639 !! wikitext
9640 {{CURRENTYEAR}}
9641 !! html
9642 <p>1970
9643 </p>
9644 !! end
9646 !! test
9647 Magic Word: {{CURRENTTIMESTAMP}}
9648 !! wikitext
9649 {{CURRENTTIMESTAMP}}
9650 !! html
9651 <p>19700101000203
9652 </p>
9653 !! end
9655 !! test
9656 Magic Words LOCAL (UTC)
9657 !! wikitext
9658 * {{LOCALMONTH}}
9659 * {{LOCALMONTH1}}
9660 * {{LOCALMONTHNAME}}
9661 * {{LOCALMONTHNAMEGEN}}
9662 * {{LOCALMONTHABBREV}}
9663 * {{LOCALDAY}}
9664 * {{LOCALDAY2}}
9665 * {{LOCALDAYNAME}}
9666 * {{LOCALYEAR}}
9667 * {{LOCALTIME}}
9668 * {{LOCALHOUR}}
9669 * {{LOCALWEEK}}
9670 * {{LOCALDOW}}
9671 * {{LOCALTIMESTAMP}}
9672 !! html
9673 <ul><li> 01</li>
9674 <li> 1</li>
9675 <li> January</li>
9676 <li> January</li>
9677 <li> Jan</li>
9678 <li> 1</li>
9679 <li> 01</li>
9680 <li> Thursday</li>
9681 <li> 1970</li>
9682 <li> 00:02</li>
9683 <li> 00</li>
9684 <li> 1</li>
9685 <li> 4</li>
9686 <li> 19700101000203</li></ul>
9688 !! end
9690 !! test
9691 Magic Word: {{FULLPAGENAME}}
9692 !! options
9693 title=[[User:Ævar Arnfjörð Bjarmason]]
9694 !! wikitext
9695 {{FULLPAGENAME}}
9696 !! html
9697 <p>User:Ævar Arnfjörð Bjarmason
9698 </p>
9699 !! end
9701 !! test
9702 Magic Word: {{FULLPAGENAMEE}}
9703 !! options
9704 title=[[User:Ævar Arnfjörð Bjarmason]]
9705 !! wikitext
9706 {{FULLPAGENAMEE}}
9707 !! html
9708 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
9709 </p>
9710 !! end
9712 !! test
9713 Magic Word: {{TALKSPACE}}
9714 !! options
9715 title=[[User:Ævar Arnfjörð Bjarmason]]
9716 !! wikitext
9717 {{TALKSPACE}}
9718 !! html
9719 <p>User talk
9720 </p>
9721 !! end
9723 !! test
9724 Magic Word: {{TALKSPACE}}, same namespace
9725 !! options
9726 title=[[User talk:Ævar Arnfjörð Bjarmason]]
9727 !! wikitext
9728 {{TALKSPACE}}
9729 !! html
9730 <p>User talk
9731 </p>
9732 !! end
9734 !! test
9735 Magic Word: {{TALKSPACE}}, main namespace
9736 !! options
9737 title=[[Parser Test]]
9738 !! wikitext
9739 {{TALKSPACE}}
9740 !! html
9741 <p>Talk
9742 </p>
9743 !! end
9745 !! test
9746 Magic Word: {{TALKSPACEE}}
9747 !! options
9748 title=[[User:Ævar Arnfjörð Bjarmason]]
9749 !! wikitext
9750 {{TALKSPACEE}}
9751 !! html
9752 <p>User_talk
9753 </p>
9754 !! end
9756 !! test
9757 Magic Word: {{SUBJECTSPACE}}
9758 !! options
9759 title=[[User talk:Ævar Arnfjörð Bjarmason]]
9760 !! wikitext
9761 {{SUBJECTSPACE}}
9762 !! html
9763 <p>User
9764 </p>
9765 !! end
9767 !! test
9768 Magic Word: {{SUBJECTSPACE}}, same namespace
9769 !! options
9770 title=[[User:Ævar Arnfjörð Bjarmason]]
9771 !! wikitext
9772 {{SUBJECTSPACE}}
9773 !! html
9774 <p>User
9775 </p>
9776 !! end
9778 !! test
9779 Magic Word: {{SUBJECTSPACE}}, main namespace
9780 !! options
9781 title=[[Parser Test]]
9782 !! wikitext
9783 {{SUBJECTSPACE}}
9784 !! html
9786 !! end
9788 !! test
9789 Magic Word: {{SUBJECTSPACEE}}
9790 !! options
9791 title=[[User talk:Ævar Arnfjörð Bjarmason]]
9792 !! wikitext
9793 {{SUBJECTSPACEE}}
9794 !! html
9795 <p>User
9796 </p>
9797 !! end
9799 !! test
9800 Magic Word: {{NAMESPACE}}
9801 !! options
9802 title=[[User:Ævar Arnfjörð Bjarmason]]
9803 !! wikitext
9804 {{NAMESPACE}}
9805 !! html
9806 <p>User
9807 </p>
9808 !! end
9810 !! test
9811 Magic Word: {{NAMESPACEE}}
9812 !! options
9813 title=[[User:Ævar Arnfjörð Bjarmason]]
9814 !! wikitext
9815 {{NAMESPACEE}}
9816 !! html
9817 <p>User
9818 </p>
9819 !! end
9821 !! test
9822 Magic Word: {{NAMESPACENUMBER}}
9823 !! options
9824 title=[[User:Ævar Arnfjörð Bjarmason]]
9825 !! wikitext
9826 {{NAMESPACENUMBER}}
9827 !! html
9828 <p>2
9829 </p>
9830 !! end
9832 !! test
9833 Magic Word: {{SUBPAGENAME}}
9834 !! options
9835 title=[[Ævar Arnfjörð Bjarmason/sub ö]] subpage
9836 !! wikitext
9837 {{SUBPAGENAME}}
9838 !! html
9839 <p>sub ö
9840 </p>
9841 !! end
9843 !! test
9844 Magic Word: {{SUBPAGENAMEE}}
9845 !! options
9846 title=[[Ævar Arnfjörð Bjarmason/sub ö]] subpage
9847 !! wikitext
9848 {{SUBPAGENAMEE}}
9849 !! html
9850 <p>sub_%C3%B6
9851 </p>
9852 !! end
9854 !! test
9855 Magic Word: {{ROOTPAGENAME}}
9856 !! options
9857 title=[[Ævar Arnfjörð Bjarmason/sub/sub2]] subpage
9858 !! wikitext
9859 {{ROOTPAGENAME}}
9860 !! html
9861 <p>Ævar Arnfjörð Bjarmason
9862 </p>
9863 !! end
9865 !! test
9866 Magic Word: {{ROOTPAGENAMEE}}
9867 !! options
9868 title=[[Ævar Arnfjörð Bjarmason/sub/sub2]] subpage
9869 !! wikitext
9870 {{ROOTPAGENAMEE}}
9871 !! html
9872 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
9873 </p>
9874 !! end
9876 !! test
9877 Magic Word: {{BASEPAGENAME}}
9878 !! options
9879 title=[[Ævar Arnfjörð Bjarmason/sub]] subpage
9880 !! wikitext
9881 {{BASEPAGENAME}}
9882 !! html
9883 <p>Ævar Arnfjörð Bjarmason
9884 </p>
9885 !! end
9887 !! test
9888 Magic Word: {{BASEPAGENAMEE}}
9889 !! options
9890 title=[[Ævar Arnfjörð Bjarmason/sub]] subpage
9891 !! wikitext
9892 {{BASEPAGENAMEE}}
9893 !! html
9894 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
9895 </p>
9896 !! end
9898 !! test
9899 Magic Word: {{TALKPAGENAME}}
9900 !! options
9901 title=[[User:Ævar Arnfjörð Bjarmason]]
9902 !! wikitext
9903 {{TALKPAGENAME}}
9904 !! html
9905 <p>User talk:Ævar Arnfjörð Bjarmason
9906 </p>
9907 !! end
9909 !! test
9910 Magic Word: {{TALKPAGENAMEE}}
9911 !! options
9912 title=[[User:Ævar Arnfjörð Bjarmason]]
9913 !! wikitext
9914 {{TALKPAGENAMEE}}
9915 !! html
9916 <p>User_talk:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
9917 </p>
9918 !! end
9920 !! test
9921 Magic Word: {{SUBJECTPAGENAME}}
9922 !! options
9923 title=[[User talk:Ævar Arnfjörð Bjarmason]]
9924 !! wikitext
9925 {{SUBJECTPAGENAME}}
9926 !! html
9927 <p>User:Ævar Arnfjörð Bjarmason
9928 </p>
9929 !! end
9931 !! test
9932 Magic Word: {{SUBJECTPAGENAMEE}}
9933 !! options
9934 title=[[User talk:Ævar Arnfjörð Bjarmason]]
9935 !! wikitext
9936 {{SUBJECTPAGENAMEE}}
9937 !! html
9938 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
9939 </p>
9940 !! end
9942 !! test
9943 Magic Word: {{NUMBEROFFILES}}
9944 !! wikitext
9945 {{NUMBEROFFILES}}
9946 !! html
9947 <p>7
9948 </p>
9949 !! end
9951 !! test
9952 Magic Word: {{PAGENAME}}
9953 !! options
9954 title=[[User:Ævar Arnfjörð Bjarmason]]
9955 !! wikitext
9956 {{PAGENAME}}
9957 !! html
9958 <p>Ævar Arnfjörð Bjarmason
9959 </p>
9960 !! end
9962 !! test
9963 Magic Word: {{PAGENAME}} with metacharacters
9964 !! options
9965 title=[['foo & bar = baz']]
9966 !! wikitext
9967 ''{{PAGENAME}}''
9968 !! html/php
9969 <p><i>&#39;foo &#38; bar &#61; baz&#39;</i>
9970 </p>
9971 !! html+tidy
9972 <p><i>'foo &amp; bar = baz'</i></p>
9973 !! end
9975 !! test
9976 Magic Word: {{PAGENAME}} with metacharacters (bug 26781)
9977 !! options
9978 title=[[*RFC 1234 http://example.com/]]
9979 !! wikitext
9980 {{PAGENAME}}
9981 !! html/php
9982 <p>&#42;RFC&#32;1234 http&#58;//example.com/
9983 </p>
9984 !! html+tidy
9985 <p>*RFC 1234 http://example.com/</p>
9986 !! end
9988 !! test
9989 Magic Word: {{PAGENAMEE}}
9990 !! options
9991 title=[[User:Ævar Arnfjörð Bjarmason]]
9992 !! wikitext
9993 {{PAGENAMEE}}
9994 !! html
9995 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
9996 </p>
9997 !! end
9999 !! test
10000 Magic Word: {{PAGENAMEE}} with metacharacters (bug 26781)
10001 !! options
10002 title=[[*RFC 1234 http://example.com/]]
10003 !! wikitext
10004 {{PAGENAMEE}}
10005 !! html/php
10006 <p>&#42;RFC_1234_http&#58;//example.com/
10007 </p>
10008 !! html+tidy
10009 <p>*RFC_1234_http://example.com/</p>
10010 !! end
10012 !! test
10013 Magic Word: {{REVISIONID}}
10014 !! wikitext
10015 {{REVISIONID}}
10016 !! html
10017 <p>1337
10018 </p>
10019 !! end
10021 !! test
10022 Magic Word: {{SCRIPTPATH}}
10023 !! wikitext
10024 {{SCRIPTPATH}}
10025 !! html
10027 !! end
10029 !! test
10030 Magic Word: {{STYLEPATH}}
10031 !! wikitext
10032 {{STYLEPATH}}
10033 !! html
10034 <p>/skins
10035 </p>
10036 !! end
10038 !! test
10039 Magic Word: {{SERVER}}
10040 !! wikitext
10041 {{SERVER}}
10042 !! html
10043 <p><a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
10044 </p>
10045 !! end
10047 !! test
10048 Magic Word: {{SERVERNAME}}
10049 !! wikitext
10050 {{SERVERNAME}}
10051 !! html
10052 <p>example.org
10053 </p>
10054 !! end
10056 !! test
10057 Magic Word: {{SITENAME}}
10058 !! wikitext
10059 {{SITENAME}}
10060 !! html
10061 <p>MediaWiki
10062 </p>
10063 !! end
10065 !! test
10066 Case-sensitive magic words, when cased differently, should just be template transclusions
10067 !! wikitext
10068 {{CurrentMonth}}
10069 {{currentday}}
10070 {{cURreNTweEK}}
10071 {{currentHour}}
10072 !! html
10073 <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>
10074 <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>
10075 <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>
10076 <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>
10077 </p>
10078 !! end
10080 !! test
10081 Case-insensitive magic words should still work with weird casing.
10082 !! wikitext
10083 {{sErVeRNaMe}}
10084 {{LCFirst:AOEU}}
10085 {{ucFIRST:aoeu}}
10086 {{SERver}}
10087 !! html
10088 <p>example.org
10089 aOEU
10090 Aoeu
10091 <a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
10092 </p>
10093 !! end
10095 # From plwiki:PLOS_ONE
10096 !! test
10097 Parsoid: Page property magic word with magic word contents
10098 !! wikitext
10099 {{DISPLAYTITLE:''{{PAGENAME}}''}}
10100 !! html/parsoid
10101 <meta property="mw:PageProp/displaytitle" content="Main_Page" about="#mwt2" typeof="mw:ExpandedAttrs" data-parsoid='{"src":"{{DISPLAYTITLE:&#39;&#39;{{PAGENAME}}&#39;&#39;}}"}' data-mw='{"attribs":[[{"txt":"content"},{"html":"&lt;i data-parsoid=&#39;{\"dsr\":[15,31,2,2]}&#39;>&lt;span about=\"#mwt1\" typeof=\"mw:Transclusion\" data-parsoid=&#39;{\"pi\":[[]],\"dsr\":[17,29,null,null]}&#39; data-mw=&#39;{\"parts\":[{\"template\":{\"target\":{\"wt\":\"PAGENAME\",\"function\":\"pagename\"},\"params\":{},\"i\":0}}]}&#39;>Main_Page&lt;/span>&lt;/i>"}]]}'/>
10102 !! end
10104 !! test
10105 Parsoid: Template-generated DISPLAYTITLE
10106 !! wikitext
10107 {{{{echo|DISPLAYTITLE}}:Foo}}
10108 !! html/parsoid
10109 <meta property="mw:PageProp/displaytitle" content="Foo" about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"pi":[[]]}' data-mw='{"parts":[{"template":{"target":{"wt":"{{echo|DISPLAYTITLE}}:Foo"},"params":{},"i":0}}]}'/>
10110 !! end
10112 !! test
10113 Namespace 1 {{ns:1}}
10114 !! wikitext
10115 {{ns:1}}
10116 !! html
10117 <p>Talk
10118 </p>
10119 !! end
10121 !! test
10122 Namespace 1 {{ns:01}}
10123 !! wikitext
10124 {{ns:01}}
10125 !! html
10126 <p>Talk
10127 </p>
10128 !! end
10130 !! test
10131 Namespace 0 {{ns:0}} (bug 4783)
10132 !! wikitext
10133 {{ns:0}}
10134 !! html
10136 !! end
10138 !! test
10139 Namespace 0 {{ns:00}} (bug 4783)
10140 !! wikitext
10141 {{ns:00}}
10142 !! html
10144 !! end
10146 !! test
10147 Namespace -1 {{ns:-1}}
10148 !! wikitext
10149 {{ns:-1}}
10150 !! html
10151 <p>Special
10152 </p>
10153 !! end
10155 !! test
10156 Namespace User {{ns:User}}
10157 !! wikitext
10158 {{ns:User}}
10159 !! html
10160 <p>User
10161 </p>
10162 !! end
10164 !! test
10165 Namespace User talk {{ns:User_talk}}
10166 !! wikitext
10167 {{ns:User_talk}}
10168 !! html
10169 <p>User talk
10170 </p>
10171 !! end
10173 !! test
10174 Namespace User talk {{ns:uSeR tAlK}}
10175 !! wikitext
10176 {{ns:uSeR tAlK}}
10177 !! html
10178 <p>User talk
10179 </p>
10180 !! end
10182 !! test
10183 Namespace File {{ns:File}}
10184 !! wikitext
10185 {{ns:File}}
10186 !! html
10187 <p>File
10188 </p>
10189 !! end
10191 !! test
10192 Namespace File {{ns:Image}}
10193 !! wikitext
10194 {{ns:Image}}
10195 !! html
10196 <p>File
10197 </p>
10198 !! end
10200 !! test
10201 Namespace (lang=de) Benutzer {{ns:User}}
10202 !! options
10203 language=de
10204 !! wikitext
10205 {{ns:User}}
10206 !! html
10207 <p>Benutzer
10208 </p>
10209 !! end
10211 !! test
10212 Namespace (lang=de) Benutzer Diskussion {{ns:3}}
10213 !! options
10214 language=de
10215 !! wikitext
10216 {{ns:3}}
10217 !! html
10218 <p>Benutzer Diskussion
10219 </p>
10220 !! end
10223 !! test
10224 Urlencode
10225 !! wikitext
10226 {{urlencode:hi world?!}}
10227 {{urlencode:hi world?!|WIKI}}
10228 {{urlencode:hi world?!|PATH}}
10229 {{urlencode:hi world?!|QUERY}}
10230 !! html
10231 <p>hi+world%3F%21
10232 hi_world%3F!
10233 hi%20world%3F%21
10234 hi+world%3F%21
10235 </p>
10236 !! end
10238 !! test
10239 Magic Word: prioritize type info over data-parsoid
10240 !! options
10241 parsoid=html2wt
10242 !! html/parsoid
10243 <meta property="mw:PageProp/forcetoc" data-parsoid='{"magicSrc":"__NOTOC__"}'/>
10244 !! wikitext
10245 __FORCETOC__
10246 !! end
10248 !! test
10249 Magic Word: serialize on separate line (parsoid)
10250 !! options
10251 parsoid=wt2wt,html2wt
10252 !! wikitext
10254 __NOTOC__
10256 !! html/parsoid
10257 foo<meta property="mw:PageProp/notoc"/>bar
10258 !! end
10260 !! test
10261 Magic Word: rt non-english wikis
10262 !! options
10263 parsoid=wt2wt
10264 language=de
10265 !! wikitext
10266 __NOEDITSECTION__
10267 !! html/parsoid
10268 <meta property="mw:PageProp/noeditsection" data-parsoid='{"magicSrc":"__NOEDITSECTION__"}'/>
10269 !! end
10271 !!test
10272 __proto__ is treated as normal wikitext (T105997)
10273 !!wikitext
10274 __proto__
10275 !!html
10276 <p>__proto__
10277 </p>
10278 !!end
10281 ### Magic links
10283 !! test
10284 Magic links: internal link to RFC (bug 479)
10285 !! wikitext
10286 [[RFC 123]]
10287 !! html/php
10288 <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>
10289 </p>
10290 !! html/parsoid
10291 <p><a rel="mw:WikiLink" href="./RFC_123" title="RFC 123">RFC 123</a></p>
10292 !! end
10294 !! test
10295 Magic links: RFC (bug 479)
10296 !! wikitext
10297 RFC 822
10298 !! html/php
10299 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc822">RFC 822</a>
10300 </p>
10301 !! html/parsoid
10302 <p><a href="//tools.ietf.org/html/rfc822" rel="mw:ExtLink">RFC 822</a></p>
10303 !! end
10305 !! test
10306 Magic links: RFC (bug 65278)
10307 !! wikitext
10308 This is RFC 822 but thisRFC 822 is not RFC 822linked.
10309 !! html/php
10310 <p>This is <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc822">RFC 822</a> but thisRFC 822 is not RFC 822linked.
10311 </p>
10312 !! html/parsoid
10313 <p>This is <a href="//tools.ietf.org/html/rfc822" rel="mw:ExtLink">RFC 822</a> but thisRFC 822 is not RFC 822linked.</p>
10314 !! end
10316 !! test
10317 Magic links: RFC (w/ non-newline whitespace, bug 28950/29025)
10318 !! wikitext
10319 RFC &nbsp;&#160;&#0160;&#xA0;&#Xa0; 822
10322 !! html/php
10323 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc822">RFC 822</a>
10326 </p>
10327 !! html/parsoid
10328 <p><a href="//tools.ietf.org/html/rfc822" rel="mw:ExtLink">RFC <span typeof="mw:Entity" data-parsoid='{"src":"&amp;nbsp;","srcContent":" "}'> </span><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#160;","srcContent":" "}'> </span><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#0160;","srcContent":" "}'> </span><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#xA0;","srcContent":" "}'> </span><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#Xa0;","srcContent":" "}'> </span> 822</a>
10330 822</p>
10331 !! end
10333 !! test
10334 Magic links: ISBN (bug 1937)
10335 !! wikitext
10336 ISBN 0-306-40615-2
10337 !! html/php
10338 <p><a href="/wiki/Special:BookSources/0306406152" class="internal mw-magiclink-isbn">ISBN 0-306-40615-2</a>
10339 </p>
10340 !! html/parsoid
10341 <p><a href="./Special:BookSources/0306406152" rel="mw:WikiLink">ISBN 0-306-40615-2</a></p>
10342 !! end
10344 !! test
10345 Magic links: ISBN (bug 65278)
10346 !! wikitext
10347 This is ISBN 978-0-316-09811-3 but thisISBN 978-0-316-09811-3 is not ISBN 978-0-316-09811-3linked.
10348 !! html/php
10349 <p>This is <a href="/wiki/Special:BookSources/9780316098113" class="internal mw-magiclink-isbn">ISBN 978-0-316-09811-3</a> but thisISBN 978-0-316-09811-3 is not ISBN 978-0-316-09811-3linked.
10350 </p>
10351 !! html/parsoid
10352 <p>This is <a href="./Special:BookSources/9780316098113" rel="mw:WikiLink">ISBN 978-0-316-09811-3</a> but thisISBN 978-0-316-09811-3 is not ISBN 978-0-316-09811-3linked.</p>
10353 !! end
10355 !! test
10356 Magic links: ISBN (w/ non-newline whitespace, bug 28950/29025)
10357 !! wikitext
10358 ISBN &nbsp;&#160;&#0160;&#xA0;&#Xa0; 978&nbsp;0&#160;316&#0160;09811&#xA0;3
10359 ISBN
10360 9780316098113
10361 ISBN 978
10362 0316098113
10363 !! html/php
10364 <p><a href="/wiki/Special:BookSources/9780316098113" class="internal mw-magiclink-isbn">ISBN 978 0 316 09811 3</a>
10365 ISBN
10366 9780316098113
10367 ISBN 978
10368 0316098113
10369 </p>
10370 !! html/parsoid
10371 <p><a href="./Special:BookSources/9780316098113" rel="mw:WikiLink">ISBN <span typeof="mw:Entity" data-parsoid='{"src":"&amp;nbsp;","srcContent":" "}'> </span><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#160;","srcContent":" "}'> </span><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#0160;","srcContent":" "}'> </span><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#xA0;","srcContent":" "}'> </span><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#Xa0;","srcContent":" "}'> </span> 978<span typeof="mw:Entity" data-parsoid='{"src":"&amp;nbsp;","srcContent":" "}'> </span>0<span typeof="mw:Entity" data-parsoid='{"src":"&amp;#160;","srcContent":" "}'> </span>316<span typeof="mw:Entity" data-parsoid='{"src":"&amp;#0160;","srcContent":" "}'> </span>09811<span typeof="mw:Entity" data-parsoid='{"src":"&amp;#xA0;","srcContent":" "}'> </span>3</a>
10372 ISBN
10373 9780316098113
10374 ISBN 978
10375 0316098113</p>
10376 !! end
10378 !! test
10379 Magic links: PMID incorrectly converts space to underscore
10380 !! wikitext
10381 PMID 1234
10382 !! html/php
10383 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a>
10384 </p>
10385 !! html/parsoid
10386 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract" rel="mw:ExtLink">PMID 1234</a></p>
10387 !! end
10389 !! test
10390 Magic links: PMID (bug 65278)
10391 !! wikitext
10392 This is PMID 1234 but thisPMID 1234 is not PMID 1234linked.
10393 !! html/php
10394 <p>This is <a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a> but thisPMID 1234 is not PMID 1234linked.
10395 </p>
10396 !! html/parsoid
10397 <p>This is <a href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract" rel="mw:ExtLink">PMID 1234</a> but thisPMID 1234 is not PMID 1234linked.</p>
10398 !! end
10400 !! test
10401 Magic links: PMID (w/ non-newline whitespace, bug 28950/29025)
10402 !! wikitext
10403 PMID &nbsp;&#160;&#0160;&#xA0;&#Xa0; 1234
10404 PMID
10405 1234
10406 !! html/php
10407 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a>
10408 PMID
10409 1234
10410 </p>
10411 !! html/parsoid
10412 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract" rel="mw:ExtLink">PMID <span typeof="mw:Entity" data-parsoid='{"src":"&amp;nbsp;","srcContent":" "}'> </span><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#160;","srcContent":" "}'> </span><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#0160;","srcContent":" "}'> </span><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#xA0;","srcContent":" "}'> </span><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#Xa0;","srcContent":" "}'> </span> 1234</a>
10413 PMID
10414 1234</p>
10415 !! end
10417 # <nowiki> nodes shouldn't be inserted during html2wt by Parsoid,
10418 # since these are ExtLinkText, not MagicLinkText
10419 !! test
10420 Magic links: use appropriate serialization for "almost" magic links.
10421 !! wikitext
10422 X[[Special:BookSources/0978739256|foo]]
10424 X[//tools.ietf.org/html/rfc1234 foo]
10425 !! html/php
10426 <p>X<a href="/wiki/Special:BookSources/0978739256" title="Special:BookSources/0978739256">foo</a>
10427 </p><p>X<a rel="nofollow" class="external text" href="//tools.ietf.org/html/rfc1234">foo</a>
10428 </p>
10429 !! html/parsoid
10430 <p>X<a rel="mw:WikiLink" href="./Special:BookSources/0978739256" title="Special:BookSources/0978739256">foo</a></p>
10431 <p>X<a rel="mw:ExtLink" href="//tools.ietf.org/html/rfc1234">foo</a></p>
10432 !! end
10435 ### Templates
10436 ####
10438 !! test
10439 Nonexistent template
10440 !! wikitext
10441 {{thistemplatedoesnotexist}}
10442 !! html
10443 <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>
10444 </p>
10445 !! end
10447 !! test
10448 Template with invalid target containing tags
10449 !! wikitext
10450 {{a<b>b</b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
10451 !! html
10452 <p>{{a<b>b</b>|foo|a=b|a = b}}
10453 </p>
10454 !! end
10456 !! test
10457 Template with invalid target containing unclosed tag
10458 !! wikitext
10459 {{a<b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
10460 !! html
10461 <p>{{a<b>|foo|a=b|a = b}}</b>
10462 </p>
10463 !! end
10465 !! test
10466 Template with invalid target containing wikilink
10467 !! wikitext
10468 {{[[Main Page]]}}
10469 !! html/php
10470 <p>{{<a href="/wiki/Main_Page" title="Main Page">Main Page</a>}}
10471 </p>
10472 !! html/parsoid
10473 <p><span typeof="mw:Transclusion" about="#mwt1" data-mw='{"parts":[{"template":{"target":{"wt":"[[Main Page]]"},"params":{},"i":0}}]}'>{{</span><a rel="mw:WikiLink" href="./Main_Page" about="#mwt1">Main Page</a><span about="#mwt1">}}</span></p>
10474 !! end
10476 !! test
10477 Template with just whitespace in it, bug #68421
10478 !! wikitext
10479 {{echo|{{ }}}}
10480 !! html/parsoid
10481 <p about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"pi":[[{"k":"1"}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"{{ }}"}},"i":0}}]}'>{{ }}</p>
10482 !! end
10484 !! article
10485 Template:test
10486 !! text
10487 This is a test template
10488 !! endarticle
10490 !! test
10491 Simple template
10492 !! wikitext
10493 {{test}}
10494 !! html
10495 <p>This is a test template
10496 </p>
10497 !! end
10499 !! test
10500 Template with explicit namespace
10501 !! wikitext
10502 {{Template:test}}
10503 !! html
10504 <p>This is a test template
10505 </p>
10506 !! end
10509 !! article
10510 Template:paramtest
10511 !! text
10512 This is a test template with parameter {{{param}}}
10513 !! endarticle
10515 !! test
10516 Template parameter
10517 !! wikitext
10518 {{paramtest|param=foo}}
10519 !! html
10520 <p>This is a test template with parameter foo
10521 </p>
10522 !! end
10524 !! article
10525 Template:paramtestnum
10526 !! text
10527 [[{{{1}}}|{{{2}}}]]
10528 !! endarticle
10530 !! test
10531 Template unnamed parameter
10532 !! wikitext
10533 {{paramtestnum|Main Page|the main page}}
10534 !! html
10535 <p><a href="/wiki/Main_Page" title="Main Page">the main page</a>
10536 </p>
10537 !! end
10539 !! article
10540 Template:templatesimple
10541 !! text
10542 (test)
10543 !! endarticle
10545 !! article
10546 Template:templateredirect
10547 !! text
10548 #redirect [[Template:templatesimple]]
10549 !! endarticle
10551 !! article
10552 Template:templateasargtestnum
10553 !! text
10554 {{{{{1}}}}}
10555 !! endarticle
10557 !! article
10558 Template:templateasargtest
10559 !! text
10560 {{template{{{templ}}}}}
10561 !! endarticle
10563 !! article
10564 Template:templateasargtest2
10565 !! text
10566 {{{{{templ}}}}}
10567 !! endarticle
10569 !! test
10570 Template with template name as unnamed argument
10571 !! wikitext
10572 {{templateasargtestnum|templatesimple}}
10573 !! html
10574 <p>(test)
10575 </p>
10576 !! end
10578 !! test
10579 Template with template name as argument
10580 !! wikitext
10581 {{templateasargtest|templ=simple}}
10582 !! html
10583 <p>(test)
10584 </p>
10585 !! end
10587 !! test
10588 Template with template name as argument (2)
10589 !! wikitext
10590 {{templateasargtest2|templ=templatesimple}}
10591 !! html
10592 <p>(test)
10593 </p>
10594 !! end
10596 !! article
10597 Template:templateasargtestdefault
10598 !! text
10599 {{{{{templ|templatesimple}}}}}
10600 !! endarticle
10602 !! article
10603 Template:templa
10604 !! text
10605 '''templ'''
10606 !! endarticle
10608 !! test
10609 Template with default value
10610 !! wikitext
10611 {{templateasargtestdefault}}
10612 !! html
10613 <p>(test)
10614 </p>
10615 !! end
10617 !! test
10618 Template with default value (value set)
10619 !! wikitext
10620 {{templateasargtestdefault|templ=templa}}
10621 !! html
10622 <p><b>templ</b>
10623 </p>
10624 !! end
10626 !! test
10627 Template redirect
10628 !! wikitext
10629 {{templateredirect}}
10630 !! html/php
10631 <p>(test)
10632 </p>
10633 !! html/parsoid
10634 <link rel="mw:PageProp/redirect" href="./Template:Templatesimple" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"templateredirect","href":"./Template:Templateredirect"},"params":{},"i":0}}]}'/>
10635 !! end
10637 !! test
10638 Template with argument in separate line
10639 !! wikitext
10640 {{ templateasargtest  |
10641  templ = simple }}
10642 !! html
10643 <p>(test)
10644 </p>
10645 !! end
10647 !! test
10648 Template with complex template as argument
10649 !! wikitext
10650 {{paramtest|
10651   param ={{ templateasargtest  |
10652  templ = simple }}}}
10653 !! html
10654 <p>This is a test template with parameter (test)
10655 </p>
10656 !! end
10658 !! test
10659 Template with thumb image (with link in description)
10660 !! wikitext
10661 {{paramtest|param=[[Image:noimage.png|thumb|[[no link|link]] [[no link|caption]]]]}}
10662 !! html/php
10663 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>
10665 !! html+tidy
10666 <p>This is a test template with parameter</p>
10667 <div class="thumb tright">
10668 <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>
10669 <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>
10670 </div>
10671 </div>
10672 !! html/parsoid
10673 <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"paramtest","href":"./Template:Paramtest"},"params":{"param":{"wt":"[[Image:noimage.png|thumb|[[no link|link]] [[no link|caption]]]]"}},"i":0}}]}'>This is a test template with parameter </p><figure class="mw-default-size" typeof="mw:Error mw:Image/Thumb" about="#mwt1" data-mw='{"errors":[{"key":"missing-image","message":"This image does not exist."}]}'><a href="./File:Noimage.png" ><img resource="./File:Noimage.png" src="./Special:FilePath/Noimage.png" height="220" width="220"/></a><figcaption><a rel="mw:WikiLink" href="./No_link" title="No link">link</a> <a rel="mw:WikiLink" href="./No_link" title="No link">caption</a></figcaption></figure>
10674 !! end
10676 !! article
10677 Template:complextemplate
10678 !! text
10679 {{{1}}} {{paramtest|
10680   param ={{{param}}}}}
10681 !! endarticle
10683 !! test
10684 Template with complex arguments
10685 !! wikitext
10686 {{complextemplate|
10687   param ={{ templateasargtest  |
10688  templ = simple }}|[[Template:complextemplate|link]]}}
10689 !! html
10690 <p><a href="/wiki/Template:Complextemplate" title="Template:Complextemplate">link</a> This is a test template with parameter (test)
10691 </p>
10692 !! end
10694 !! test
10695 BUG 553: link with two variables in a piped link
10696 !! wikitext
10698 |[[{{{1}}}|{{{2}}}]]
10700 !! html/php
10701 <table>
10702 <tr>
10703 <td>[[{{{1}}}|{{{2}}}]]
10704 </td></tr></table>
10706 !! html/parsoid
10707 <table>
10708 <tbody><tr><td>[[<span about="#mwt5" typeof="mw:Param" data-parsoid='{"src":"{{{1}}}"}'>{{{1}}}</span>|<span about="#mwt2" typeof="mw:Param" data-parsoid='{"src":"{{{2}}}"}'>{{{2}}}</span>]]</td></tr>
10709 !! end
10711 # See: T2553
10712 !! test
10713 Abort table cell attribute parsing on wikilink
10714 !! wikitext
10716 | testing [[one|two]] | three || four
10717 | testing one two | three || four
10718 | testing="[[one|two]]" | three || four
10720 !! html/php
10721 <table>
10722 <tr>
10723 <td> testing <a href="/index.php?title=One&amp;action=edit&amp;redlink=1" class="new" title="One (page does not exist)">two</a> | three </td>
10724 <td> four
10725 </td>
10726 <td> three </td>
10727 <td> four
10728 </td>
10729 <td> testing="<a href="/index.php?title=One&amp;action=edit&amp;redlink=1" class="new" title="One (page does not exist)">two</a>" | three </td>
10730 <td> four
10731 </td></tr></table>
10733 !! html/parsoid
10734 <table>
10735 <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'> testing <a rel="mw:WikiLink" href="./One" title="One" data-parsoid='{"stx":"piped","a":{"href":"./One"},"sa":{"href":"one"}}'>two</a> | three </td><td data-parsoid='{"stx_v":"row","autoInsertedEnd":true}'> four</td>
10736 <td data-parsoid='{"a":{"testing":null,"one":null,"two":null},"sa":{"testing":"","one":"","two":""},"autoInsertedEnd":true}'> three </td><td data-parsoid='{"stx_v":"row","autoInsertedEnd":true}'> four</td>
10737 <td> testing="<a rel="mw:WikiLink" href="./One" title="One" data-parsoid='{"stx":"piped","a":{"href":"./One"},"sa":{"href":"one"}}'>two</a>" | three </td><td data-parsoid='{"stx_v":"row","autoInsertedEnd":true}'> four</td></tr>
10738 </tbody></table>
10739 !! end
10741 !! test
10742 Don't abort table cell attribute parsing if wikilink is found in template arg
10743 !! wikitext
10745 | Test {{#tag:ref|One two "[[three]]" four}}
10747 !! html/parsoid
10748 <table>
10749 <tbody><tr><td> Test <ref about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"pi":[[{"k":"1"}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"#tag:ref","function":"#tag"},"params":{"1":{"wt":"One two \"[[three]]\" four"}},"i":0}}]}'>One two "<a rel="mw:WikiLink" href="./Three" title="Three">three</a>" four</ref></td></tr>
10750 </tbody></table>
10751 !! end
10753 !! test
10754 Magic variable as template parameter
10755 !! wikitext
10756 {{paramtest|param={{SITENAME}}}}
10757 !! html
10758 <p>This is a test template with parameter MediaWiki
10759 </p>
10760 !! end
10762 !! article
10763 Template:linktest
10764 !! text
10765 [[{{{param}}}|link]]
10766 !! endarticle
10768 !! test
10769 Template parameter as link source
10770 !! wikitext
10771 {{linktest|param=Main Page}}
10772 !! html
10773 <p><a href="/wiki/Main_Page" title="Main Page">link</a>
10774 </p>
10775 !! end
10777 !!article
10778 Template:paramtest2
10779 !! text
10780 including another template, {{paramtest|param={{{arg}}}}}
10781 !! endarticle
10783 !! test
10784 Template passing argument to another template
10785 !! wikitext
10786 {{paramtest2|arg='hmm'}}
10787 !! html
10788 <p>including another template, This is a test template with parameter 'hmm'
10789 </p>
10790 !! end
10792 !! article
10793 Template:Linktest2
10794 !! text
10795 Main Page
10796 !! endarticle
10798 !! test
10799 Template as link source
10800 !! wikitext
10801 [[{{linktest2}}]]
10803 [[{{linktest2}}|Main Page]]
10805 [[{{linktest2}}]]Page
10806 !! html
10807 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
10808 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
10809 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>Page
10810 </p>
10811 !! end
10814 !! article
10815 Template:loop1
10816 !! text
10817 {{loop2}}
10818 !! endarticle
10820 !! article
10821 Template:loop2
10822 !! text
10823 {{loop1}}
10824 !! endarticle
10826 !! test
10827 Template infinite loop
10828 !! wikitext
10829 {{loop1}}
10830 !! html
10831 <p><span class="error">Template loop detected: <a href="/wiki/Template:Loop1" title="Template:Loop1">Template:Loop1</a></span>
10832 </p>
10833 !! end
10835 !! test
10836 Template from main namespace
10837 !! wikitext
10838 {{:Main Page}}
10839 !! html
10840 <p>blah blah
10841 </p>
10842 !! end
10844 !! article
10845 Template:table
10846 !! text
10848 | 1 || 2
10850 | 3 || 4
10852 !! endarticle
10854 !! test
10855 BUG 529: Template with table, not included at beginning of line
10856 !! wikitext
10857 foo {{table}}
10858 !! html
10859 <p>foo 
10860 </p>
10861 <table>
10862 <tr>
10863 <td> 1 </td>
10864 <td> 2
10865 </td></tr>
10866 <tr>
10867 <td> 3 </td>
10868 <td> 4
10869 </td></tr></table>
10871 !! end
10873 !! test
10874 BUG 523: Template shouldn't eat newline (or add an extra one before table)
10875 !! wikitext
10877 {{table}}
10878 !! html
10879 <p>foo
10880 </p>
10881 <table>
10882 <tr>
10883 <td> 1 </td>
10884 <td> 2
10885 </td></tr>
10886 <tr>
10887 <td> 3 </td>
10888 <td> 4
10889 </td></tr></table>
10891 !! end
10893 !! test
10894 BUG 41: Template parameters shown as broken links
10895 !! wikitext
10896 {{{parameter}}}
10897 !! html
10898 <p>{{{parameter}}}
10899 </p>
10900 !! end
10902 !! test
10903 Template with targets containing wikilinks
10904 !! wikitext
10905 {{[[foo]]}}
10907 {{[[{{echo|foo}}]]}}
10909 {{{{echo|[[foo}}]]}}
10910 !! html
10911 <p>{{<a href="/wiki/Foo" title="Foo">foo</a>}}
10912 </p><p>{{<a href="/wiki/Foo" title="Foo">foo</a>}}
10913 </p><p>{{[[foo}}]]
10914 </p>
10915 !! end
10917 !! article
10918 Template:''
10919 !! text
10921 !! endarticle
10923 !! test
10924 Templates: Double quotes as template target
10925 !! wikitext
10926 foo {{''}} baz
10927 !! html/php
10928 <p>foo bar baz
10929 </p>
10930 !! html/parsoid
10931 <p>foo <span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"&#39;&#39;"},"params":{},"i":0}}]}'>bar</span> baz
10932 </p>
10933 !! end
10935 ## This test is about making sure Parsoid's data-mw is well formed in the
10936 ## face of multiple templates with intersecting and overlapping ranges.  The
10937 ## wikitext itself is wretched.
10938 !! test
10939 Templates with intersecting and overlapping ranges
10940 !! wikitext
10941 {|{{echo|
10942 <p>ha</p>}}
10943 {|{{echo|
10944 <p>ho</p>}}
10945 {{echo|{{!}}hi}}
10947 !! html/php+tidy
10948 <p>ha</p>
10949 <p>ho</p>
10950 <table>
10951 <tr>
10952 <td></td>
10953 </tr>
10954 <tr>
10955 <td>hi</td>
10956 </tr>
10957 </table>
10958 <table>
10959 <tr>
10960 <td></td>
10961 </tr>
10962 </table>
10963 !! html/parsoid
10964 <p about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"stx":"html","autoInsertedEnd":true,"pi":[[{"k":"1"}],[{"k":"1"}],[{"k":"1"}]],"firstWikitextNode":"table"}' data-mw='{"parts":["{|",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"\n&lt;p>ha&lt;/p>"}},"i":0}},"\n","{|",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"\n&lt;p>ho&lt;/p>"}},"i":1}},"\n",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"{{!}}hi"}},"i":2}},"\n|}"]}'>ha</p><table about="#mwt1" typeof="mw:ExpandedAttrs" data-mw='{"attribs":[[{"txt":"","html":""},{"html":""}]]}'>
10966 </table><p about="#mwt1">ho</p><table about="#mwt1" typeof="mw:ExpandedAttrs" data-mw='{"attribs":[[{"txt":"","html":""},{"html":""}]]}'>
10968 <tbody><tr><td>hi</td></tr>
10969 </tbody></table>
10970 !! end
10972 !! article
10973 Template:MSGNW test
10974 !! text
10975 ''None'' of '''this''' should be 
10976 * interpreted
10977  but rather passed unmodified
10978 {{test}}
10979 <gallery>
10980 File:Foobar.jpg
10981 </gallery>
10982 <!-- comment -->
10983 !! endarticle
10985 # hmm, fix this or just deprecate msgnw and document its behavior?
10986 !! test
10987 msgnw keyword
10988 !! wikitext
10989 {{msgnw:MSGNW test}}
10990 !! html/php
10991 <p>&#39;&#39;None&#39;&#39; of &#39;&#39;&#39;this&#39;&#39;&#39; should be 
10992 &#42; interpreted
10993 &#32;but rather passed unmodified
10994 &#123;&#123;test&#125;&#125;
10995 &#60;gallery&#62;
10996 File:Foobar.jpg
10997 &#60;/gallery&#62;
10998 &#60;!-- comment --&#62;
10999 </p>
11000 !! end
11002 !! test
11003 int keyword
11004 !! wikitext
11005 {{int:youhavenewmessages|lots of money|not!}}
11006 !! html
11007 <p>You have lots of money (not!).
11008 </p>
11009 !! end
11011 !! test
11012 int keyword - non-existing message
11013 !! wikitext
11014 {{int:var}}
11015 !! html
11016 <p>&lt;var&gt;
11017 </p>
11018 !! end
11020 !! article
11021 Template:Includes
11022 !! text
11023 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
11024 !! endarticle
11026 !! test
11027 <includeonly> and <noinclude> being included
11028 !! wikitext
11029 {{Includes}}
11030 !! html
11031 <p>Foobar
11032 </p>
11033 !! end
11035 !! article
11036 Template:Includes2
11037 !! text
11038 <onlyinclude>Foo</onlyinclude>bar
11039 !! endarticle
11041 !! test
11042 <onlyinclude> being included
11043 !! wikitext
11044 {{Includes2}}
11045 !! html
11046 <p>Foo
11047 </p>
11048 !! end
11051 !! article
11052 Template:Includes3
11053 !! text
11054 <onlyinclude>Foo</onlyinclude>bar<includeonly>zar</includeonly>
11055 !! endarticle
11057 !! test
11058 <onlyinclude> and <includeonly> being included
11059 !! wikitext
11060 {{Includes3}}
11061 !! html
11062 <p>Foo
11063 </p>
11064 !! end
11066 !! test
11067 <includeonly> and <noinclude> on a page
11068 !! wikitext
11069 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
11070 !! html
11071 <p>Foozar
11072 </p>
11073 !! end
11075 !! test
11076 Un-closed <noinclude>
11077 !! wikitext
11078 <noinclude>
11079 !! html
11080 !! end
11082 !! test
11083 <onlyinclude> on a page
11084 !! wikitext
11085 <onlyinclude>Foo</onlyinclude>bar
11086 !! html
11087 <p>Foobar
11088 </p>
11089 !! end
11091 !! test
11092 Un-closed <onlyinclude>
11093 !! wikitext
11094 <onlyinclude>
11095 !! html
11096 !! end
11098 !!test
11099 Self-closed noinclude, includeonly, onlyinclude tags
11100 !! wikitext
11101 <noinclude />
11102 <includeonly />
11103 <onlyinclude />
11104 !! html
11105 <p><br />
11106 </p>
11107 !!end
11109 !!test
11110 Unbalanced includeonly and noinclude tags
11111 !! wikitext
11113 |a</noinclude>
11114 |b</noinclude></noinclude>
11115 |c</noinclude></includeonly>
11116 |d</includeonly></includeonly>
11118 !! html
11119 <table>
11120 <tr>
11121 <td>a
11122 </td>
11123 <td>b
11124 </td>
11125 <td>c&lt;/includeonly&gt;
11126 </td>
11127 <td>d&lt;/includeonly&gt;&lt;/includeonly&gt;
11128 </td></tr></table>
11130 !!end
11132 !! article
11133 Template:Includeonly section
11134 !! text
11135 <includeonly>
11136 ==Includeonly section==
11137 </includeonly>
11138 ==Section T-1==
11139 !!endarticle
11141 !! test
11142 Bug 6563: Edit link generation for section shown by <includeonly>
11143 !! wikitext
11144 {{includeonly section}}
11145 !! html
11146 <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>
11147 <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>
11149 !! end
11151 # Uses same input as the contents of [[Template:Includeonly section]]
11152 !! test
11153 Bug 6563: Section extraction for section shown by <includeonly>
11154 !! options
11155 section=T-2
11156 !! wikitext
11157 <includeonly>
11158 ==Includeonly section==
11159 </includeonly>
11160 ==Section T-2==
11161 !! html
11162 ==Section T-2==
11163 !! end
11165 !! test
11166 Bug 6563: Edit link generation for section suppressed by <includeonly>
11167 !! wikitext
11168 <includeonly>
11169 ==Includeonly section==
11170 </includeonly>
11171 ==Section 1==
11172 !! html
11173 <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>
11175 !! end
11177 !! test
11178 Bug 6563: Section extraction for section suppressed by <includeonly>
11179 !! options
11180 section=1
11181 !! wikitext
11182 <includeonly>
11183 ==Includeonly section==
11184 </includeonly>
11185 ==Section 1==
11186 !! html
11187 ==Section 1==
11188 !! end
11190 !! test
11191 Un-closed <includeonly>
11192 !! wikitext
11193 <includeonly>
11194 !! html/php
11195 !! html/parsoid
11196 <meta typeof="mw:Includes/IncludeOnly" data-parsoid='{"src":"&lt;includeonly>"}'/>
11197 !! end
11199 ## We used to, but no longer wt2wt this test since the default serializer
11200 ## will normalize the include directives to serialize on their own line.
11201 ## Selser will take care of preserving formatting in scenarios where they
11202 ## intermingled with other wikitext.
11203 !! test
11204 Includes and comments at SOL
11205 !! options
11206 parsoid=wt2html,html2html
11207 !! wikitext
11208 <!-- comment --><noinclude><!-- comment --></noinclude><!-- comment -->== hu ==
11210 <noinclude>
11211 some
11212 </noinclude>* stuff
11213 * here
11215 <includeonly>can have stuff</includeonly>=== here ===
11217 !! html/php
11218 <h2><span class="mw-headline" id="hu">hu</span></h2>
11219 <p>some
11220 </p>
11221 <ul><li> stuff</li>
11222 <li> here</li></ul>
11223 <h3><span class="mw-headline" id="here">here</span></h3>
11225 !! html/parsoid
11226 <!-- comment --><meta typeof="mw:Includes/NoInclude" data-parsoid='{"src":"&lt;noinclude>"}'/><!-- comment --><meta typeof="mw:Includes/NoInclude/End" data-parsoid='{"src":"&lt;/noinclude>"}'/><!-- comment --><h2> hu </h2>
11228 <meta typeof="mw:Includes/NoInclude" data-parsoid='{"src":"&lt;noinclude>"}'/>
11229 <p>some</p>
11230 <meta typeof="mw:Includes/NoInclude/End" data-parsoid='{"src":"&lt;/noinclude>"}'/><ul><li> stuff</li>
11231 <li> here</li></ul>
11233 <meta typeof="mw:Includes/IncludeOnly" data-parsoid='{"src":"&lt;includeonly>can have stuff&lt;/includeonly>"}'/><meta typeof="mw:Includes/IncludeOnly/End" data-parsoid='{"src":""}'/><h3> here </h3>
11235 !! end
11237 # TODO: test with DOM fragment reuse!
11238 !! test
11239 Parsoid: DOM fragment reuse
11240 !! options
11241 parsoid=wt2wt,wt2html
11242 !! wikitext
11243 a{{echo|b<table></table>c}}d
11245 a{{echo|b
11246 <table></table>
11247 c}}d
11249 {{echo|a
11251 <table></table>
11254 !! html
11255 <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":["a",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"b&lt;table>&lt;/table>c"}},"i":0}},"d"]}' data-parsoid='{"pi":[[{"k":"1"}]]}'>ab</p><table about="#mwt1" data-parsoid='{"stx":"html"}'></table><p about="#mwt1">cd</p>
11257 <p about="#mwt2" typeof="mw:Transclusion" data-mw='{"parts":["a",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"b\n&lt;table>&lt;/table>\nc"}},"i":0}},"d"]}' data-parsoid='{"pi":[[{"k":"1"}]]}'>ab</p><span about="#mwt2">
11258 </span><table about="#mwt2" data-parsoid='{"stx":"html"}'></table><span about="#mwt2">
11259 </span><p about="#mwt2">cd</p>
11261 <p about="#mwt3" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"a\n\n&lt;table>&lt;/table>\n\nb"}},"i":0}}]}' data-parsoid='{"pi":[[{"k":"1"}]]}'>a</p><span about="#mwt3">
11263 </span><table about="#mwt3" data-parsoid='{"stx":"html"}'></table><span about="#mwt3">
11265 </span><p about="#mwt3">b</p>
11266 !! end
11268 !! test
11269 Parsoid: Merge double tds (T52603)
11270 !! options
11271 parsoid
11272 !! wikitext
11274 |{{echo|{{!}} foo}}
11276 !! html
11277 <table><tbody>
11278 <tr><td about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":["|",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"{{!}} foo"}},"i":0}}]}'> foo</td></tr>
11279 </tbody></table>
11280 !! end
11282 !! test
11283 Parsoid: Merge double tds in nested transclusion content (T52603)
11284 !! options
11285 parsoid
11286 !! wikitext
11287 {{echo|<div>}}
11289 |{{echo|{{!}} foo}}
11291 {{echo|</div>}}
11292 !! html
11293 <div about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"<div>"}},"i":0}},"\n{|\n|",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"{{!}} foo"}},"i":1}},"\n|}\n",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"</div>"}},"i":2}}]}'>
11294 <table><tbody>
11295 <tr><td data-mw='{"parts":["|"]}'> foo</td></tr>
11296 </tbody></table>
11297 </div>
11298 !! end
11301 ### <includeonly> and <noinclude> in attributes
11303 !!test
11304 0. includeonly around the entire attribute
11305 !! wikitext
11306 <span <includeonly>id="v1"</includeonly><noinclude>id="v2"</noinclude>>bar</span>
11307 !! html
11308 <p><span id="v2">bar</span>
11309 </p>
11310 !!end
11312 !!test
11313 1. includeonly in html attr key
11314 !! wikitext
11315 <span <noinclude>id</noinclude><includeonly>about</includeonly>="foo">bar</span>
11316 !! html
11317 <p><span id="foo">bar</span>
11318 </p>
11319 !!end
11321 !!test
11322 2. includeonly in html attr value
11323 !! wikitext
11324 <span id="<noinclude>v1</noinclude><includeonly>v2</includeonly>">bar</span>
11325 <span id=<noinclude>"v1"</noinclude><includeonly>"v2"</includeonly>>bar</span>
11326 !! html
11327 <p><span id="v1">bar</span>
11328 <span id="v1">bar</span>
11329 </p>
11330 !!end
11332 !!test
11333 3. includeonly in part of an attr value
11334 !! wikitext
11335 <span style="color:<noinclude>red</noinclude><includeonly>blue</includeonly>;">bar</span>
11336 !! html
11337 <p><span style="color:red;">bar</span>
11338 </p>
11339 !!end
11341 !!test
11342 4. includeonly in table attributes
11343 !! wikitext
11345 |- <noinclude>
11348 </noinclude>
11349 |- <includeonly>
11352 </includeonly>
11354 !! html
11355 <table>
11358 <tr>
11359 <td>a
11360 </td></tr>
11361 </table>
11363 !!end
11366 ### Token Stream Patcher tests
11368 ### These tests won't always pass wt2wt and other modes because
11369 ### on serialization, the table will be output on a new line.
11370 ### For now, we are blacklisting them, and using this to test selser.
11373 !!test
11374 1. Table tag in SOL posn. should get reparsed correctly with valid TSR
11375 !!options
11376 parsoid=wt2html,wt2wt
11377 !!wikitext
11378 {{echo|}}{| width = '100%'
11379 |foo
11381 !!html/parsoid
11382 <span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":""}},"i":0}}]}'></span><table width="100%">
11383 <tbody><tr><td>foo</td></tr>
11384 </tbody></table>
11385 !!end
11387 ## We used to, but no longer wt2wt this test since the default serializer
11388 ## will normalize the include directives to serialize on their own line.
11389 ## Selser will take care of preserving formatting in scenarios where they
11390 ## intermingled with other wikitext.
11391 !!test
11392 2. Table tag in SOL posn. should get reparsed correctly with valid TSR
11393 !!options
11394 parsoid=wt2html
11395 !!wikitext
11396 <includeonly>a</includeonly>{| {{{b}}}
11399 !!html/parsoid
11400 <meta typeof="mw:Includes/IncludeOnly" data-parsoid='{"src":"&lt;includeonly>a&lt;/includeonly>"}'/><meta typeof="mw:Includes/IncludeOnly/End" data-parsoid='{"src":""}'/><table about="#mwt2" typeof="mw:ExpandedAttrs" data-parsoid='{"a":{"{{{b}}}":null},"sa":{"{{{b}}}":""}}' data-mw='{"attribs":[[{"txt":"{{{b}}}","html":"&lt;span about=\"#mwt1\" typeof=\"mw:Param\" data-parsoid=&#39;{\"dsr\":[31,38,null,null],\"src\":\"{{{b}}}\"}&#39;>{{{b}}}&lt;/span>"},{"html":""}]]}'>
11401 <tbody><tr><td>c</td></tr>
11402 </tbody></table>
11403 !!end
11406 ### Testing parsing of templates where a template arg
11407 ### has the same name as the template itself.
11410 !! article
11411 Template:quote
11412 !! text
11413 {{{quote|{{{1}}}}}}
11414 !! endarticle
11416 !!test
11417 Templates: Template Name/Arg clash: 1. Use of positional param
11418 !! wikitext
11419 {{quote|foo}}
11420 !! html
11421 <p>foo
11422 </p>
11423 !!end
11425 !!test
11426 Templates: Template Name/Arg clash: 2. Use of named param
11427 !! wikitext
11428 {{quote|quote=foo}}
11429 !! html
11430 <p>foo
11431 </p>
11432 !!end
11434 !!test
11435 Templates: Template Name/Arg clash: 3. Use of named param with empty input
11436 !! wikitext
11437 {{quote|quote}}
11438 !! html
11439 <p>quote
11440 </p>
11441 !!end
11444 ### Parsoid-centric tests to stress Parsoid's ability to RT them unchanged
11447 !!test
11448 Templates: 1. Simple use
11449 !! wikitext
11450 {{echo|Foo}}
11451 !! html
11452 <p>Foo
11453 </p>
11454 !!end
11456 !!test
11457 Templates: 2. Inside a block tag
11458 !! wikitext
11459 <div>{{echo|Foo}}</div>
11460 <blockquote>{{echo|Foo}}</blockquote>
11461 !! html
11462 <div>Foo</div>
11463 <blockquote>Foo</blockquote>
11465 !! html+tidy
11466 <div>Foo</div>
11467 <blockquote>
11468 <p>Foo</p>
11469 </blockquote>
11470 !!end
11472 !!test
11473 Templates: P-wrapping: 1a. Templates on consecutive lines
11474 !! wikitext
11475 {{echo|Foo}}
11476 {{echo|bar}}
11477 !! html
11478 <p>Foo
11480 </p>
11481 !!end
11483 !!test
11484 Templates: P-wrapping: 1b. Templates on consecutive lines
11485 !! wikitext
11488 {{echo|bar}}
11489 {{echo|baz}}
11490 !! html
11491 <p>Foo
11492 </p><p>bar
11494 </p>
11495 !!end
11497 !!test
11498 Templates: P-wrapping: 1c. Templates on consecutive lines
11499 !! wikitext
11500 {{echo|Foo}}
11501 {{echo|bar}} <div>baz</div>
11502 !! html
11503 <p>Foo
11504 </p>
11505 bar <div>baz</div>
11507 !! html+tidy
11508 <p>Foo</p>
11509 <p>bar</p>
11510 <div>baz</div>
11511 !! end
11513 !!test
11514 Templates: P-wrapping: 1d. Template preceded by comment-only line
11515 !!options
11516 parsoid
11517 !! wikitext
11518 <!-- foo -->
11519 {{echo|Bar}}
11520 !! html
11521 <!-- foo -->
11523 <p about="#mwt223" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"Bar"}},"i":0}}]}'>Bar</p>
11524 !!end
11526 !!test
11527 Templates: Inline Text: 1. Multiple template uses
11528 !! wikitext
11529 {{echo|Foo}}bar{{echo|baz}}
11530 !! html
11531 <p>Foobarbaz
11532 </p>
11533 !!end
11535 !!test
11536 Templates: Inline Text: 2. Back-to-back template uses
11537 !! wikitext
11538 {{echo|Foo}}{{echo|bar}}
11539 !! html
11540 <p>Foobar
11541 </p>
11542 !!end
11544 !!test
11545 Templates: Block Tags: 1. Multiple template uses
11546 !! wikitext
11547 {{echo|<div>Foo</div>}}<div>bar</div>{{echo|<div>baz</div>}}
11548 !! html
11549 <div>Foo</div><div>bar</div><div>baz</div>
11551 !!end
11553 !!test
11554 Templates: Block Tags: 2. Back-to-back template uses
11555 !! wikitext
11556 {{echo|<div>Foo</div>}}{{echo|<div>bar</div>}}
11557 !! html
11558 <div>Foo</div><div>bar</div>
11560 !!end
11562 # This is an edge case relating to paragraph wrapping.
11563 !!test
11564 Templates: Correctly encapsulate templates producing </p> tag without a corresponding <p> tag
11565 !! wikitext
11566 {{echo|a
11567 b</p>}}
11568 !! html/parsoid
11569 <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"a\nb&lt;/p>"}},"i":0}}]}'>a
11570 b</p>
11571 !!end
11573 !!test
11574 Templates: Links: 1. Simple example
11575 !! wikitext
11576 {{echo|[[Foo|bar]]}}
11577 !! html
11578 <p><a href="/wiki/Foo" title="Foo">bar</a>
11579 </p>
11580 !!end
11582 !!test
11583 Templates: Links: 2. Generation of link href
11584 !! wikitext
11585 [[{{echo|Foo}}|bar]]
11586 !! html
11587 <p><a href="/wiki/Foo" title="Foo">bar</a>
11588 </p>
11589 !!end
11591 !!test
11592 Templates: Links: 3. Generation of part of a link href
11593 !! wikitext
11594 [[Fo{{echo|o}}|bar]]
11596 [[Foo{{echo|bar}}]]
11598 [[Foo{{echo|bar}}baz]]
11600 [[Foo{{echo|bar}}|bar]]
11602 [[:Foo{{echo|bar}}]]
11604 [[:Foo{{echo|bar}}|bar]]
11605 !! html
11606 <p><a href="/wiki/Foo" title="Foo">bar</a>
11607 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
11608 </p><p><a href="/index.php?title=Foobarbaz&amp;action=edit&amp;redlink=1" class="new" title="Foobarbaz (page does not exist)">Foobarbaz</a>
11609 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
11610 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
11611 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
11612 </p>
11613 !!end
11615 !!test
11616 Templates: Links: 4. Multiple templates generating link href
11617 !! wikitext
11618 [[{{echo|F}}{{echo|o}}ob{{echo|ar}}]]
11619 !! html
11620 <p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
11621 </p>
11622 !!end
11624 !!test
11625 Templates: Links: 5. Generation of link text
11626 !! wikitext
11627 [[Foo|{{echo|bar}}]]
11628 !! html
11629 <p><a href="/wiki/Foo" title="Foo">bar</a>
11630 </p>
11631 !!end
11633 !!test
11634 Templates: Links: 5. Nested templates (only outermost template should be marked)
11635 !! wikitext
11636 {{echo|[[{{echo|Foo}}|bar]]}}
11637 !! html
11638 <p><a href="/wiki/Foo" title="Foo">bar</a>
11639 </p>
11640 !!end
11642 !!test
11643 Templates: HTML Tag: 1. Generation of HTML attr. key
11644 !! wikitext
11645 <div {{echo|style}}="color:red;">foo</div>
11646 !! html
11647 <div style="color:red;">foo</div>
11649 !!end
11651 !!test
11652 Templates: HTML Tag: 2. Generation of HTML attr. value
11653 !! wikitext
11654 <div style={{echo|'color:red;'}}>foo</div>
11655 !! html
11656 <div style="color:red;">foo</div>
11658 !!end
11660 !!test
11661 Templates: HTML Tag: 3. Generation of HTML attr key and value
11662 !! wikitext
11663 <div {{echo|style}}={{echo|'color:red;'}}>foo</div>
11664 !! html
11665 <div style="color:red;">foo</div>
11667 !!end
11669 !!test
11670 Templates: HTML Tag: 4. Generation of starting piece of HTML attr value
11671 !! wikitext
11672 <div title="{{echo|This is a long title}} with just one piece templated">foo</div>
11673 !! html
11674 <div title="This is a long title with just one piece templated">foo</div>
11676 !!end
11678 !!test
11679 Templates: HTML Tag: 5. Generation of middle piece of HTML attr value
11680 !! wikitext
11681 <div title="This is a long title with just {{echo|one piece}} templated">foo</div>
11682 !! html
11683 <div title="This is a long title with just one piece templated">foo</div>
11685 !!end
11687 !!test
11688 Templates: HTML Tag: 6. Generation of end piece of HTML attr value
11689 !! wikitext
11690 <div title="This is a long title with just one piece {{echo|templated}}">foo</div>
11691 !! html
11692 <div title="This is a long title with just one piece templated">foo</div>
11694 !!end
11696 # SSS FIXME: While it is great we added support for all this,
11697 # do we want to make this part of the spec? Maybe we want to
11698 # deprecate this kind of usage in the future?
11699 !!test
11700 Templates: HTML Tag: 7. Generation of partial attribute key string
11701 !! wikitext
11702 <div st{{echo|yle}}="color:red;">foo</div>
11703 !! html
11704 <div style="color:red;">foo</div>
11706 !!end
11708 !! test
11709 Templates: HTML Tag: 8. Template-generated attribute (k=v)
11710 !! wikitext
11711 <div {{echo|1=id="v1"}}>bar</div>
11712 !! html
11713 <div id="v1">bar</div>
11715 !!end
11717 !! test
11718 Templates: HTML Tag: 9. Multiple template-generated attributes
11719 !! wikitext
11720 <div {{echo|1=id="v1" title="foo"}}>bar</div>
11721 !! html
11722 <div id="v1" title="foo">bar</div>
11724 !!end
11726 !! test
11727 Templates: Support for templates generating attributes and content
11728 !! wikitext
11729 {| {{mixed_attr_content_template}}
11731 |bar
11733 !! html/php
11734 <table style="color:red;" title="T48811">
11736 <tr>
11737 <td>foo
11738 </td></tr>
11739 <tr>
11740 <td>bar
11741 </td></tr></table>
11743 !! html/parsoid
11744 <table style="color:red;" title="T48811" about="#mwt1" typeof="mw:Transclusion mw:ExpandedAttrs" data-mw='{"parts":["{| ",{"template":{"target":{"wt":"mixed_attr_content_template","href":"./Template:Mixed_attr_content_template"},"params":{},"i":0}},"\n|-\n|bar\n|}"]}'>
11745 <tbody><tr>
11746 <td>foo</td></tr>
11747 <tr>
11748 <td>bar</td></tr>
11749 </tbody></table>
11750 !!end
11752 !! test
11753 1. Entities and nowikis inside templated attributes should be handled correctly
11754 !! wikitext
11755 <div {{echo|style{{=}}"background:&#35;f9f9f9;"}}>foo</div>
11756 !! html/php
11757 <div style="background:#f9f9f9;">foo</div>
11759 !! html/parsoid
11760 <div style="background:#f9f9f9;" about="#mwt3" typeof="mw:ExpandedAttrs" data-parsoid='{"stx":"html"}' data-mw='{"attribs":[[{"txt":"style","html":"&lt;span about=\"#mwt1\" typeof=\"mw:Transclusion\" data-parsoid=&#39;{\"pi\":[[{\"k\":\"1\"}]],\"dsr\":[5,49,null,null]}&#39; data-mw=&#39;{\"parts\":[{\"template\":{\"target\":{\"wt\":\"echo\",\"href\":\"./Template:Echo\"},\"params\":{\"1\":{\"wt\":\"style{{=}}\\\"background:&amp;amp;#35;f9f9f9;\\\"\"}},\"i\":0}}]}&#39;>style&lt;/span>&lt;span typeof=\"mw:Nowiki\" about=\"#mwt1\" data-parsoid=\"{}\">=&lt;/span>&lt;span about=\"#mwt1\" data-parsoid=\"{}\">\"background:&lt;/span>&lt;span typeof=\"mw:Entity\" about=\"#mwt1\" data-parsoid=&#39;{\"src\":\"&amp;amp;#35;\",\"srcContent\":\"#\"}&#39;>#&lt;/span>&lt;span about=\"#mwt1\" data-parsoid=\"{}\">f9f9f9;\"&lt;/span>"},{"html":""}]]}'>foo</div>
11761 !! end
11763 !! test
11764 2. Entities and nowikis inside templated attributes should be handled correctly
11765 !! wikitext
11767 |{{table_attribs_3}}
11769 !! html/php
11770 <table>
11771 <tr>
11772 <td style="background:#f9f9f9;">Foo
11773 </td></tr></table>
11775 !! html/parsoid
11776 <table>
11777 <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td style="background:#f9f9f9;" typeof="mw:Transclusion" about="#mwt1" data-parsoid='{"autoInsertedEnd":true,"pi":[[]]}' data-mw='{"parts":["|",{"template":{"target":{"wt":"table_attribs_3","href":"./Template:Table_attribs_3"},"params":{},"i":0}}]}'>Foo</td></tr>
11778 </tbody></table>
11779 !! end
11781 !! test
11782 3. Entities and nowikis inside templated attributes should be handled correctly inside templated tables
11783 !! wikitext
11784 {{tbl-start}}
11785 |{{table_attribs_3}}
11786 {{tbl-end}}
11787 !! html/php
11788 <table>
11789 <tr>
11790 <td style="background:#f9f9f9;">Foo
11791 </td></tr></table>
11793 !! html/parsoid
11794 <table about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"pi":[[],[],[]]}' data-mw='{"parts":[{"template":{"target":{"wt":"tbl-start","href":"./Template:Tbl-start"},"params":{},"i":0}},"\n|",{"template":{"target":{"wt":"table_attribs_3","href":"./Template:Table_attribs_3"},"params":{},"i":1}},"\n",{"template":{"target":{"wt":"tbl-end","href":"./Template:Tbl-end"},"params":{},"i":2}}]}'>
11795 <tbody><tr><td style="background:#f9f9f9;">Foo</td></tr>
11796 </tbody></table>
11797 !! end
11799 # T107622
11800 !! test
11801 4. Entities and nowikis inside templated attributes should be handled correctly inside templated tables
11802 !! wikitext
11804 | {{table_attribs_6}} hi
11806 !! html/php
11807 <table>
11808 <tr>
11809 <td style="background: red;"> hi
11810 </td></tr></table>
11812 !! html/parsoid
11813 <table>
11814 <tbody><tr><td style="background:  red;" typeof="mw:Transclusion" about="#mwt1" data-parsoid='{"autoInsertedEnd":true,"pi":[[]]}' data-mw='{"parts":["| ",{"template":{"target":{"wt":"table_attribs_6","href":"./Template:Table_attribs_6"},"params":{},"i":0}}," hi"]}'> hi</td></tr>
11815 </tbody></table>
11816 !! end
11818 !!test
11819 Templates: HTML Tables: 1. Generating start of a HTML table
11820 !! wikitext
11821 {{echo|<table><tr><td>foo</td>}}</tr></table>
11822 !! html
11823 <table><tr><td>foo</td></tr></table>
11825 !!end
11827 !!test
11828 Templates: HTML Tables: 2a. Generating middle of a HTML table
11829 !! wikitext
11830 <table><tr>{{echo|<td>foo</td>}}</tr></table>
11831 !! html
11832 <table><tr><td>foo</td></tr></table>
11834 !!end
11836 !!test
11837 Templates: HTML Tables: 2b. Generating middle of a HTML table
11838 !! wikitext
11839 <table>{{echo|<tr><td>foo</td></tr>}}</table>
11840 !! html
11841 <table><tr><td>foo</td></tr></table>
11843 !!end
11845 !!test
11846 Templates: HTML Tables: 3. Generating end of a HTML table
11847 !! wikitext
11848 <table><tr>{{echo|<td>foo</td></tr></table>}}
11849 !! html
11850 <table><tr><td>foo</td></tr></table>
11852 !!end
11854 !!test
11855 Templates: HTML Tables: 4a. Generating a single tag of a HTML table
11856 !! wikitext
11857 {{echo|<table>}}<tr><td>foo</td></tr></table>
11858 !! html
11859 <table><tr><td>foo</td></tr></table>
11861 !!end
11863 !!test
11864 Templates: HTML Tables: 4b. Generating a single tag of a HTML table
11865 !! wikitext
11866 <table>{{echo|<tr>}}<td>foo</td></tr></table>
11867 !! html
11868 <table><tr><td>foo</td></tr></table>
11870 !!end
11872 !!test
11873 Templates: HTML Tables: 4c. Generating a single tag of a HTML table
11874 !! wikitext
11875 <table><tr>{{echo|<td>}}foo</td></tr></table>
11876 !! html
11877 <table><tr><td>foo</td></tr></table>
11879 !!end
11881 !!test
11882 Templates: HTML Tables: 4d. Generating a single tag of a HTML table
11883 !! wikitext
11884 <table><tr><td>foo{{echo|</td>}}</tr></table>
11885 !! html
11886 <table><tr><td>foo</td></tr></table>
11888 !!end
11890 !!test
11891 Templates: HTML Tables: 4e. Generating a single tag of a HTML table
11892 !! wikitext
11893 <table><tr><td>foo</td>{{echo|</tr>}}</table>
11894 !! html
11895 <table><tr><td>foo</td></tr></table>
11897 !!end
11899 !!test
11900 Templates: HTML Tables: 4f. Generating a single tag of a HTML table
11901 !! wikitext
11902 <table><tr><td>foo</td></tr>{{echo|</table>}}
11903 !! html
11904 <table><tr><td>foo</td></tr></table>
11906 !!end
11908 !!test
11909 Templates: HTML Tables: 5. Proper fostering of categories from inside
11910 !!options
11911 parsoid=wt2html,wt2wt
11912 !! wikitext
11913 <table>[[Category:foo1]]<tr><td>foo</td></tr></table>
11914 <!--Two categories (Bug 50330)-->
11915 <table>[[Category:bar1]][[Category:bar2]]<tr><td>foo</td></tr></table>
11916 !! html
11917 <link rel="mw:PageProp/Category" href="./Category:Foo1"><table><tbody><tr><td>foo</td></tr></tbody></table>
11918 <!--Two categories (Bug 50330)-->
11919 <link rel="mw:PageProp/Category" href="./Category:Bar1"><link rel="mw:PageProp/Category" href="./Category:Bar2"><table><tbody><tr><td>foo</td></tr></tbody></table>
11920 !!end
11922 !!test
11923 Templates: Wiki Tables: 1a. Fostering of entire template content
11924 !! wikitext
11926 {{echo|a}}
11928 !! html
11929 <table>
11931 <tr><td></td></tr></table>
11933 !! html+tidy
11934 <p>a</p>
11935 <table>
11936 <tr>
11937 <td></td>
11938 </tr>
11939 </table>
11940 !! end
11942 !!test
11943 Templates: Wiki Tables: 1b. Fostering of entire template content
11944 !! wikitext
11946 {{echo|<div>}}
11948 {{echo|</div>}}
11950 !! html
11951 <table>
11952 <div>
11953 <p>foo
11954 </p>
11955 </div>
11956 <tr><td></td></tr></table>
11958 !! html+tidy
11959 <div>
11960 <p>foo</p>
11961 </div>
11962 <table>
11963 <tr>
11964 <td></td>
11965 </tr>
11966 </table>
11967 !! end
11969 !!test
11970 Templates: Wiki Tables: 2. Fostering of partial template content
11971 !! wikitext
11973 {{echo|a
11974 <div>b</div>}}
11976 !! html
11977 <table>
11979 <div>b</div>
11980 <tr><td></td></tr></table>
11982 !! html+tidy
11983 <p>a</p>
11984 <div>b</div>
11985 <table>
11986 <tr>
11987 <td></td>
11988 </tr>
11989 </table>
11990 !! end
11992 !!test
11993 Templates: Wiki Tables: 3. td-content via multiple templates
11994 !! wikitext
11996 {{echo|{{pipe}}a}}{{echo|b}}
11998 !! html
11999 <table>
12000 <tr>
12001 <td>ab
12002 </td></tr></table>
12004 !!end
12006 !!test
12007 Templates: Wiki Tables: 4. Templated tags, no content
12008 !! wikitext
12009 {{tbl-start}}
12010 {{tbl-end}}
12011 !! html
12012 <table>
12013 <tr><td></td></tr></table>
12015 !!end
12017 !!test
12018 Templates: Wiki Tables: 5. Templated tags, regular td-tags
12019 !! wikitext
12020 {{tbl-start}}
12021 |foo
12022 {{tbl-end}}
12023 !! html
12024 <table>
12025 <tr>
12026 <td>foo
12027 </td></tr></table>
12029 !!end
12031 !!test
12032 Templates: Wiki Tables: 6. Templated tags, templated td-tags
12033 !! wikitext
12034 {{tbl-start}}
12035 {{!}}foo
12036 {{tbl-end}}
12037 !! html
12038 <table>
12039 <tr>
12040 <td>foo
12041 </td></tr></table>
12043 !!end
12045 ## This test case is very specific to Parsoid's internals
12046 ## and is hence only tested for Parsoid's code. Parsoid uses
12047 ## a <meta> marker tag for <ref> tags and they are expanded
12048 ## much later. We are verifying that this <meta> tag usage
12049 ## doesn't prevent foster parenting.
12050 !!test
12051 Templates: Wiki Tables: 7. Fosterable <ref>s should get fostered
12052 !!wikitext
12053 {{PartialTable}}<ref>foo</ref>
12056 <references />
12057 !!html/parsoid
12058 <span about="#mwt2" class="mw-ref" id="cite_ref-1" rel="dc:references" typeof="mw:Transclusion  mw:Extension/ref" data-mw='{"parts":[{"template":{"target":{"wt":"PartialTable","href":"./Template:PartialTable"},"params":{},"i":0}},"&lt;ref>foo&lt;/ref>\n|}"]}'><a href="#cite_note-1"><span class="mw-reflink-text">[1]</span></a></span><table about="#mwt2">
12059 <tbody>
12060 </tbody></table>
12062 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'><li about="#cite_note-1" id="cite_note-1"><a href="#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text">foo</span></li></ol>
12063 !!end
12065 !! test
12066 Templates: Wiki Tables: 8. Fosterable meta-tags should get fostered
12067 !! wikitext
12068 {{echo|
12069 {{{!}}
12070 {{!}}-}}
12071 <onlyinclude>
12072 |foo
12073 </onlyinclude>
12074 {{!}}}
12075 !! html/parsoid
12076 <span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"\n{{{!}}\n{{!}}-"}},"i":0}},"\n&lt;onlyinclude>\n|foo\n&lt;/onlyinclude>\n{{!}}}"]}'>
12077 </span><meta typeof="mw:Includes/OnlyInclude" about="#mwt1"/><table about="#mwt1">
12078 <tbody><tr>
12080 <td>foo
12081 <meta typeof="mw:Includes/OnlyInclude/End"/></td></tr>
12082 </tbody></table>
12083 !! end
12085 !!test
12086 Templates: Lists: Multi-line list-items via templates
12087 !! wikitext
12088 *{{echo|a {{nonexistent|
12089 unused}}}}
12090 *{{echo|b {{nonexistent|
12091 unused}}}}
12092 !! html
12093 <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></li>
12094 <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></li></ul>
12096 !!end
12098 !!test
12099 Templates: Ugly nesting: 1. Quotes opened/closed across templates (echo)
12100 !! wikitext
12101 {{echo|''a}}{{echo|b''c''d}}{{echo|''e}}
12102 !! html
12103 <p><i>ab</i>c<i>d</i>e
12104 </p>
12105 !!end
12107 !!test
12108 Templates: Ugly nesting: 2. Quotes opened/closed across templates (echo_with_span)
12109 (PHP parser generates misnested html)
12110 !! wikitext
12111 {{echo_with_span|''a}}{{echo_with_span|b''c''d}}{{echo_with_span|''e}}
12112 !! html/parsoid
12113 <p><span about="#mwt1" typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;echo_with_span&quot;,&quot;href&quot;:&quot;./Template:Echo_with_span&quot;},&quot;params&quot;:{&quot;1&quot;:{&quot;wt&quot;:&quot;''a&quot;}},&quot;i&quot;:0}}]}"><i>a</i></span><i about="#mwt2" typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;echo_with_span&quot;,&quot;href&quot;:&quot;./Template:Echo_with_span&quot;},&quot;params&quot;:{&quot;1&quot;:{&quot;wt&quot;:&quot;b''c''d&quot;}},&quot;i&quot;:0}},{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;echo_with_span&quot;,&quot;href&quot;:&quot;./Template:Echo_with_span&quot;},&quot;params&quot;:{&quot;1&quot;:{&quot;wt&quot;:&quot;''e&quot;}},&quot;i&quot;:1}}]}"><span>b</span></i><span about="#mwt2">c</span><i about="#mwt2">d<span></span></i><span about="#mwt2">e</span></p>
12114 !!end
12116 !!test
12117 Templates: Ugly nesting: 3. Quotes opened/closed across templates (echo_with_div)
12118 (PHP parser generates misnested html; Parsoid html2wt mode adds newlines between {{echo}}s)
12119 !! options
12120 parsoid=wt2html,wt2wt
12121 !! wikitext
12122 {{echo_with_div|''a}}{{echo_with_div|b''c''d}}{{echo_with_div|''e}}
12123 !! html
12124 <div about="#mwt1" typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;echo_with_div&quot;,&quot;href&quot;:&quot;./Template:Echo_with_div&quot;},&quot;params&quot;:{&quot;1&quot;:{&quot;wt&quot;:&quot;''a&quot;}},&quot;i&quot;:0}}]}"><i>a</i></div>
12125 <div about="#mwt2" typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;echo_with_div&quot;,&quot;href&quot;:&quot;./Template:Echo_with_div&quot;},&quot;params&quot;:{&quot;1&quot;:{&quot;wt&quot;:&quot;b''c''d&quot;}},&quot;i&quot;:0}}]}"><i>b</i>c<i>d</i></div>
12126 <div about="#mwt3" typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;echo_with_div&quot;,&quot;href&quot;:&quot;./Template:Echo_with_div&quot;},&quot;params&quot;:{&quot;1&quot;:{&quot;wt&quot;:&quot;''e&quot;}},&quot;i&quot;:0}}]}">e</div>
12127 !!end
12129 !!test
12130 Templates: Ugly nesting: 4. Divs opened/closed across templates
12131 !! wikitext
12132 a<div>b{{echo|c</div>d}}e
12133 !! html
12134 a<div>bc</div>de
12136 !! html+tidy
12137 <p>a</p>
12138 <div>bc</div>
12139 <p>de</p>
12140 !! end
12142 !!test
12143 Templates: Ugly templates: 1. Navbox template parses badly leading to table misnesting
12144 (Parsoid-centric)
12145 !! options
12146 parsoid
12147 !! wikitext
12149 |{{echo|foo</table>}}
12150 |bar
12152 !! html
12153 <table about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":["{|\n|",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo</table>"}},"i":0}},"\n|bar\n|}"]}'>
12155 <tbody>
12156 <tr>
12157 <td>foo</td></tr></tbody></table><span about="#mwt1">
12158 </span><span about="#mwt1">|bar</span><span about="#mwt1">
12159 |}</span>
12160 !!end
12162 !!test
12163 Templates: Ugly templates: 2. Navbox template parses badly leading to table misnesting
12164 (Parsoid-centric)
12165 !! options
12166 parsoid
12167 !! wikitext
12168 <table>
12169   <tr>
12170     <td>
12171     <table>
12172       <tr>
12173         <td>1. {{echo|foo </table>}}</td>
12174         <td> bar </td>
12175         <td>2. {{echo|baz </table>}}</td>
12176       </tr>
12177       <tr>
12178         <td>abc</td>
12179       </tr>
12180     </table>
12181     </td>
12182   </tr>
12183   <tr>
12184     <td>xyz</td>
12185   </tr>
12186 </table>
12187 !! html
12188 <table about="#mwt2" typeof="mw:Transclusion" data-mw='{"parts":["<table>\n  <tr>\n    <td>\n    <table>\n      <tr>\n        <td>1. ",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo </table>"}},"i":0}},"</td>\n        <td> bar </td>\n        <td>2. ",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"baz </table>"}},"i":1}},"</td>\n      </tr>\n      <tr>\n        <td>abc</td>\n      </tr>\n    </table>\n    </td>\n  </tr>\n  <tr>\n    <td>xyz</td>\n  </tr>\n</table>"]}'>
12189   <tbody><tr>
12190     <td>
12191     <table>
12192       <tbody><tr>
12193         <td>1. foo </td></tr></tbody></table></td>
12194         <td> bar </td>
12195         <td>2. baz </td></tr></tbody></table><span about="#mwt2">
12196       </span><span about="#mwt2">
12197       </span><span about="#mwt2">
12198         </span><span about="#mwt2">abc</span><span about="#mwt2">
12199       </span><span about="#mwt2">
12200     </span><span about="#mwt2">
12201     </span><span about="#mwt2">
12202   </span><span about="#mwt2">
12203   </span><span about="#mwt2">
12204     </span><span about="#mwt2">xyz</span><span about="#mwt2">
12205   </span><span about="#mwt2">
12206 </span>
12207 !!end
12209 !! test
12210 Templates: Ugly templates: 3. newline-only template parameter
12211 !! wikitext
12212 foo {{echo|
12214 !! html
12215 <p>foo 
12216 </p>
12217 !! end
12219 # This looks like a bug: a single newline triggers p/br for some reason.
12220 !! test
12221 Templates: Ugly templates: 4. newline-only template parameter inconsistency
12222 !! wikitext
12223 {{echo|
12225 !! html
12226 <p><br />
12227 </p>
12228 !! end
12230 # Bug 64017 -- ugly wikitext with fostered content generates two template ranges that
12231 # have a true overlap (T1-start - T2-start - T1-end - T2-end).
12232 !! test
12233 Templates: Ugly templates: 5. Template encapsulation test: Non-trivial overlap of template ranges is properly handled
12234 !! wikitext
12235 {{echo|<table>}}
12236 {{echo|<div>foo}}
12237 {{echo|</table>}}
12238 !! html/parsoid
12239 <div about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;table>"}},"i":0}},"\n",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;div>foo"}},"i":1}},"\n",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;/table>"}},"i":2}}]}' data-parsoid='{"stx":"html","autoInsertedEnd":true,"pi":[[{"k":"1"}],[{"k":"1"}],[{"k":"1"}]]}'>foo
12240 </div><table about="#mwt1" data-parsoid='{"stx":"html"}'>
12241 </table>
12242 !! end
12244 # Bug 64017 -- ugly wikitext with fostered content generates two template ranges
12245 # that are "identical" and generate nesting cycles in the algorithm
12246 !! test
12247 Templates: Ugly templates: 6. Template encapsulation test: Cyclical nesting of template ranges is properly handled
12248 !! wikitext
12249 {{echo|<table><tr><td><table>}}
12250 {{echo|<div>}}
12251 {{echo|</div>}}
12252 !! html/parsoid
12253 <table about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;table>&lt;tr>&lt;td>&lt;table>"}},"i":0}},"\n",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;div>"}},"i":1}},"\n",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;/div>"}},"i":2}}]}' data-parsoid='{"stx":"html","autoInsertedEnd":true,"pi":[[{"k":"1"}],[{"k":"1"}],[{"k":"1"}]]}'><tbody><tr data-parsoid='{"stx":"html"}'><td data-parsoid='{"stx":"html"}'><div data-parsoid='{"stx":"html"}'>
12254 </div><table about="#mwt1" data-parsoid='{"stx":"html"}'>
12255 </table></td></tr></tbody></table>
12256 !! end
12258 !! test
12259 Templates: Parameters substituted at the top-level
12260 !! wikitext
12261 {{{foo|''who'' {{echo|me}}? '''never!'''}}}
12262 !! html/php
12263 <p><i>who</i> me? <b>never!</b>
12264 </p>
12265 !! html/parsoid
12266 <p about="#mwt2" typeof="mw:Param" data-parsoid="{&quot;src&quot;:&quot;{{{foo|''who'' {{echo|me}}? '''never!'''}}}&quot;}"><i>who</i> me? <b>never!</b></p>
12267 !! end
12269 !!test
12270 Parser Functions: 1. Simple example
12271 !! wikitext
12272 {{uc:foo}}
12273 !! html
12274 <p>FOO
12275 </p>
12276 !!end
12278 !!test
12279 Parser Functions: 2. Nested use (only outermost should be marked up)
12280 !! wikitext
12281 {{uc:{{lc:FOO}}}}
12282 !! html
12283 <p>FOO
12284 </p>
12285 !!end
12288 ### Pre-save transform tests
12290 !! test
12291 pre-save transform: subst:
12292 !! options
12294 !! wikitext
12295 {{subst:test}}
12296 !! html/php
12297 This is a test template
12298 !! end
12300 !! test
12301 pre-save transform: normal template
12302 !! options
12304 !! wikitext
12305 {{test}}
12306 !! html/php
12307 {{test}}
12308 !! end
12310 !! test
12311 pre-save transform: nonexistent template
12312 !! options
12314 !! wikitext
12315 {{thistemplatedoesnotexist}}
12316 !! html/php
12317 {{thistemplatedoesnotexist}}
12318 !! end
12320 !! test
12321 pre-save transform: subst magic variables
12322 !! options
12324 !! wikitext
12325 {{subst:SITENAME}}
12326 !! html/php
12327 MediaWiki
12328 !! end
12330 # This is bug 89, which I fixed. -- wtm
12331 !! test
12332 pre-save transform: subst: templates with parameters
12333 !! options
12335 !! wikitext
12336 {{subst:paramtest|param="something else"}}
12337 !! html/php
12338 This is a test template with parameter "something else"
12339 !! end
12341 !! article
12342 Template:nowikitest
12343 !! text
12344 <nowiki>'''not wiki'''</nowiki>
12345 !! endarticle
12347 !! test
12348 pre-save transform: nowiki in subst (bug 1188)
12349 !! options
12351 !! wikitext
12352 {{subst:nowikitest}}
12353 !! html/php
12354 <nowiki>'''not wiki'''</nowiki>
12355 !! end
12357 !! article
12358 Template:commenttest
12359 !! text
12360 This template has <!-- a comment --> in it.
12361 !! endarticle
12363 !! test
12364 pre-save transform: comment in subst (bug 1936)
12365 !! options
12367 !! wikitext
12368 {{subst:commenttest}}
12369 !! html/php
12370 This template has <!-- a comment --> in it.
12371 !! end
12373 !! test
12374 pre-save transform: unclosed tag
12375 !! options
12377 !! wikitext
12378 <nowiki>'''not wiki'''
12379 !! html/php
12380 <nowiki>'''not wiki'''
12381 !! end
12383 !! test
12384 pre-save transform: mixed tag case
12385 !! options
12387 !! wikitext
12388 <NOwiki>'''not wiki'''</noWIKI>
12389 !! html/php
12390 <NOwiki>'''not wiki'''</noWIKI>
12391 !! end
12393 !! test
12394 pre-save transform: unclosed comment in <nowiki>
12395 !! options
12397 !! wikitext
12398 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
12399 !! html/php
12400 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
12401 !!end
12403 # Leading @ in this template definition works around a limitation
12404 # in parsoid's parserTests which otherwise strips the <span> from the
12405 # result (confusing it for a template wrapper)
12406 !! article
12407 Template:dangerous
12408 !!text
12409 @<span onmouseover="alert('crap')">Oh no</span>
12410 !!endarticle
12412 !!test
12413 (confirming safety of fix for subst bug 1936)
12414 !! wikitext
12415 {{Template:dangerous}}
12416 !! html
12417 <p>@<span>Oh no</span>
12418 </p>
12419 !! end
12421 !! test
12422 pre-save transform: comment containing gallery (bug 5024)
12423 !! options
12425 !! wikitext
12426 <!-- <gallery>data</gallery> -->
12427 !! html/php
12428 <!-- <gallery>data</gallery> -->
12429 !!end
12431 !! test
12432 pre-save transform: comment containing extension
12433 !! options
12435 !! wikitext
12436 <!-- <tag>data</tag> -->
12437 !! html/php
12438 <!-- <tag>data</tag> -->
12439 !!end
12441 !! test
12442 pre-save transform: comment containing nowiki
12443 !! options
12445 !! wikitext
12446 <!-- <nowiki>data</nowiki> -->
12447 !! html/php
12448 <!-- <nowiki>data</nowiki> -->
12449 !!end
12451 !! test
12452 pre-save transform: <noinclude> in subst (bug 3298)
12453 !! options
12455 !! wikitext
12456 {{subst:Includes}}
12457 !! html/php
12458 Foobar
12459 !! end
12461 !! test
12462 pre-save transform: <onlyinclude> in subst (bug 3298)
12463 !! options
12465 !! wikitext
12466 {{subst:Includes2}}
12467 !! html/php
12469 !! end
12471 !! article
12472 Template:SubstTest
12473 !!text
12474 {{<includeonly>subst:</includeonly>Includes}}
12475 !! endarticle
12477 !! article
12478 Template:SafeSubstTest
12479 !! text
12480 {{<includeonly>safesubst:</includeonly>Includes}}
12481 !! endarticle
12483 !! test
12484 bug 22297: safesubst: works during PST
12485 !! options
12487 !! wikitext
12488 {{subst:SafeSubstTest}}{{safesubst:SubstTest}}
12489 !! html/php
12490 FoobarFoobar
12491 !! end
12493 !! test
12494 bug 22297: safesubst: works during normal parse
12495 !! wikitext
12496 {{SafeSubstTest}}
12497 !! html
12498 <p>Foobar
12499 </p>
12500 !! end
12502 !! test
12503 subst: does not work during normal parse
12504 !! wikitext
12505 {{SubstTest}}
12506 !! html
12507 <p>{{subst:Includes}}
12508 </p>
12509 !! end
12511 !! test
12512 pre-save transform: context links ("pipe trick")
12513 !! options
12515 !! wikitext
12516 [[Article (context)|]]
12517 [[Bar:Article|]]
12518 [[:Bar:Article|]]
12519 [[Bar:Article (context)|]]
12520 [[:Bar:Article (context)|]]
12521 [[|Article]]
12522 [[|Article (context)]]
12523 [[Bar:X (Y) Z|]]
12524 [[:Bar:X (Y) Z|]]
12525 !! html/php
12526 [[Article (context)|Article]]
12527 [[Bar:Article|Article]]
12528 [[:Bar:Article|Article]]
12529 [[Bar:Article (context)|Article]]
12530 [[:Bar:Article (context)|Article]]
12531 [[Article]]
12532 [[Article (context)]]
12533 [[Bar:X (Y) Z|X (Y) Z]]
12534 [[:Bar:X (Y) Z|X (Y) Z]]
12535 !! end
12537 !! test
12538 pre-save transform: context links ("pipe trick") with interwiki prefix
12539 !! options
12541 !! wikitext
12542 [[interwiki:Article|]]
12543 [[:interwiki:Article|]]
12544 [[interwiki:Bar:Article|]]
12545 [[:interwiki:Bar:Article|]]
12546 !! html/php
12547 [[interwiki:Article|Article]]
12548 [[:interwiki:Article|Article]]
12549 [[interwiki:Bar:Article|Bar:Article]]
12550 [[:interwiki:Bar:Article|Bar:Article]]
12551 !! end
12553 !! test
12554 pre-save transform: context links ("pipe trick") with parens in title
12555 !! options
12556 pst title=[[Somearticle (context)]]
12557 !! wikitext
12558 [[|Article]]
12559 !! html/php
12560 [[Article (context)|Article]]
12561 !! end
12563 !! test
12564 pre-save transform: context links ("pipe trick") with comma in title
12565 !! options
12566 pst title=[[Someplace, Somewhere]]
12567 !! wikitext
12568 [[|Otherplace]]
12569 [[Otherplace, Elsewhere|]]
12570 [[Otherplace, Elsewhere, Anywhere|]]
12571 !! html/php
12572 [[Otherplace, Somewhere|Otherplace]]
12573 [[Otherplace, Elsewhere|Otherplace]]
12574 [[Otherplace, Elsewhere, Anywhere|Otherplace]]
12575 !! end
12577 !! test
12578 pre-save transform: context links ("pipe trick") with parens and comma
12579 !! options
12580 pst title=[[Someplace (IGNORED), Somewhere]]
12581 !! wikitext
12582 [[|Otherplace]]
12583 [[Otherplace (place), Elsewhere|]]
12584 !! html/php
12585 [[Otherplace, Somewhere|Otherplace]]
12586 [[Otherplace (place), Elsewhere|Otherplace]]
12587 !! end
12589 !! test
12590 pre-save transform: context links ("pipe trick") with comma and parens
12591 !! options
12592 pst title=[[Who, me? (context)]]
12593 !! wikitext
12594 [[|Yes, you.]]
12595 [[Me, Myself, and I (1937 song)|]]
12596 !! html/php
12597 [[Yes, you. (context)|Yes, you.]]
12598 [[Me, Myself, and I (1937 song)|Me, Myself, and I]]
12599 !! end
12601 !! test
12602 pre-save transform: context links ("pipe trick") with namespace
12603 !! options
12604 pst title=[[Ns:Somearticle]]
12605 !! wikitext
12606 [[|Article]]
12607 !! html/php
12608 [[Ns:Article|Article]]
12609 !! end
12611 !! test
12612 pre-save transform: context links ("pipe trick") with namespace and parens
12613 !! options
12614 pst title=[[Ns:Somearticle (context)]]
12615 !! wikitext
12616 [[|Article]]
12617 !! html/php
12618 [[Ns:Article (context)|Article]]
12619 !! end
12621 !! test
12622 pre-save transform: context links ("pipe trick") with namespace and comma
12623 !! options
12624 pst title=[[Ns:Somearticle, Context, Whatever]]
12625 !! wikitext
12626 [[|Article]]
12627 !! html/php
12628 [[Ns:Article, Context, Whatever|Article]]
12629 !! end
12631 !! test
12632 pre-save transform: context links ("pipe trick") with namespace, comma and parens
12633 !! options
12634 pst title=[[Ns:Somearticle, Context (context)]]
12635 !! wikitext
12636 [[|Article]]
12637 !! html/php
12638 [[Ns:Article (context)|Article]]
12639 !! end
12641 !! test
12642 pre-save transform: context links ("pipe trick") with namespace, parens and comma
12643 !! options
12644 pst title=[[Ns:Somearticle (IGNORED), Context]]
12645 !! wikitext
12646 [[|Article]]
12647 !! html/php
12648 [[Ns:Article, Context|Article]]
12649 !! end
12651 !! test
12652 pre-save transform: context links ("pipe trick") with full-width parens and no space (Japanese and Chinese style, bug 30149)
12653 !! options
12655 !! wikitext
12656 [[Article(context)|]]
12657 [[Bar:Article(context)|]]
12658 [[:Bar:Article(context)|]]
12659 [[|Article(context)]]
12660 [[Bar:X(Y)Z|]]
12661 [[:Bar:X(Y)Z|]]
12662 !! html/php
12663 [[Article(context)|Article]]
12664 [[Bar:Article(context)|Article]]
12665 [[:Bar:Article(context)|Article]]
12666 [[Article(context)]]
12667 [[Bar:X(Y)Z|X(Y)Z]]
12668 [[:Bar:X(Y)Z|X(Y)Z]]
12669 !! end
12671 !! test
12672 pre-save transform: context links ("pipe trick") with full-width parens and space (Japanese and Chinese style, bug 30149)
12673 !! options
12675 !! wikitext
12676 [[Article (context)|]]
12677 [[Bar:Article (context)|]]
12678 [[:Bar:Article (context)|]]
12679 [[|Article (context)]]
12680 [[Bar:X (Y) Z|]]
12681 [[:Bar:X (Y) Z|]]
12682 !! html/php
12683 [[Article (context)|Article]]
12684 [[Bar:Article (context)|Article]]
12685 [[:Bar:Article (context)|Article]]
12686 [[Article (context)]]
12687 [[Bar:X (Y) Z|X (Y) Z]]
12688 [[:Bar:X (Y) Z|X (Y) Z]]
12689 !! end
12691 !! test
12692 pre-save transform: context links ("pipe trick") with parens and no space (Korean style, bug 30149)
12693 !! options
12695 !! wikitext
12696 [[Article(context)|]]
12697 [[Bar:Article(context)|]]
12698 [[:Bar:Article(context)|]]
12699 [[|Article(context)]]
12700 [[Bar:X(Y)Z|]]
12701 [[:Bar:X(Y)Z|]]
12702 !! html/php
12703 [[Article(context)|Article]]
12704 [[Bar:Article(context)|Article]]
12705 [[:Bar:Article(context)|Article]]
12706 [[Article(context)]]
12707 [[Bar:X(Y)Z|X(Y)Z]]
12708 [[:Bar:X(Y)Z|X(Y)Z]]
12709 !! end
12711 !! test
12712 pre-save transform: context links ("pipe trick") with commas (bug 21660)
12713 !! options
12715 !! wikitext
12716 [[Article (context), context|]]
12717 [[Article (context),context|]]
12718 [[Bar:Article (context), context|]]
12719 [[Bar:Article (context),context|]]
12720 [[:Bar:Article (context), context|]]
12721 [[:Bar:Article (context),context|]]
12722 !! html/php
12723 [[Article (context), context|Article]]
12724 [[Article (context),context|Article]]
12725 [[Bar:Article (context), context|Article]]
12726 [[Bar:Article (context),context|Article]]
12727 [[:Bar:Article (context), context|Article]]
12728 [[:Bar:Article (context),context|Article]]
12729 !! end
12731 !! test
12732 pre-save transform: trim trailing empty lines
12733 !! options
12735 !! wikitext
12736 Empty lines are trimmed
12741 !! html/php
12742 Empty lines are trimmed
12743 !! end
12745 !! test
12746 pre-save transform: Signature expansion
12747 !! options
12749 !! wikitext
12750 * ~~~
12751 * <noinclude>~~~</noinclude>
12752 * <includeonly>~~~</includeonly>
12753 * <onlyinclude>~~~</onlyinclude>
12754 !! html/php
12755 * [[Special:Contributions/127.0.0.1|127.0.0.1]]
12756 * <noinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</noinclude>
12757 * <includeonly>[[Special:Contributions/127.0.0.1|127.0.0.1]]</includeonly>
12758 * <onlyinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</onlyinclude>
12759 !! end
12762 !! test
12763 pre-save transform: Signature expansion in nowiki tags (bug 93)
12764 !! options
12765 pst disabled
12766 !! wikitext
12767 Shall not expand:
12769 <nowiki>~~~~</nowiki>
12771 <includeonly><nowiki>~~~~</nowiki></includeonly>
12773 <noinclude><nowiki>~~~~</nowiki></noinclude>
12775 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
12777 {{subst:Foo}} shall be converted to FOO
12779 As well as inside noinclude/onlyinclude
12780 <noinclude>{{subst:Foo}}</noinclude>
12781 <onlyinclude>{{subst:Foo}}</onlyinclude>
12783 But not inside includeonly
12784 <includeonly>{{subst:Foo}}</includeonly>
12785 !! html/php
12786 Shall not expand:
12788 <nowiki>~~~~</nowiki>
12790 <includeonly><nowiki>~~~~</nowiki></includeonly>
12792 <noinclude><nowiki>~~~~</nowiki></noinclude>
12794 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
12796 FOO shall be converted to FOO
12798 As well as inside noinclude/onlyinclude
12799 <noinclude>FOO</noinclude>
12800 <onlyinclude>FOO</onlyinclude>
12802 But not inside includeonly
12803 <includeonly>{{subst:Foo}}</includeonly>
12804 !! end
12806 !! test
12807 Parsoid: Recognize nowiki with trailing space in tags
12808 !! options
12809 parsoid=wt2html
12810 !! wikitext
12811 <nowiki ><div>[[foo]]</nowiki >
12813 a<nowiki / >b
12815 c<nowiki />d
12817 e<nowiki/ >f
12818 !! html
12819 <p><span typeof="mw:Nowiki">&lt;div&gt;[[foo]]</span></p>
12820 <p>ab</p>
12821 <p>cd</p>
12822 <p>ef</p>
12823 !! end
12825 !! test
12826 Parsoid: Recognize nowiki with odd capitalization
12827 !! options
12828 parsoid=wt2html
12829 !! wikitext
12830 <noWikI ><div>[[foo]]</Nowiki >
12831 !! html
12832 <p><span typeof="mw:Nowiki">&lt;div&gt;[[foo]]</span></p>
12833 !! end
12836 !! test
12837 Parsoid: Escape nowiki with trailing space in tags
12838 !! options
12839 parsoid=html2wt
12840 !! html/parsoid
12841 <p>&lt;nowiki &gt; foo &lt/nowiki ></p>
12842 <p>a&lt;nowiki /&gt;b</p>
12843 <p>c&lt;nowiki/ &gt;d</p>
12844 !! wikitext
12845 &lt;nowiki &gt; foo &lt;/nowiki &gt;
12847 a&lt;nowiki /&gt;b
12849 c&lt;nowiki/ &gt;d
12850 !! end
12852 !! test
12853 Parsoid: Escape weird noWikI capitalizations
12854 !! options
12855 parsoid=html2wt
12856 !! html/parsoid
12857 <p>&lt;noWikI &gt; foo &lt/NoWikI ></p>
12858 !! wikitext
12859 &lt;noWikI &gt; foo &lt;/NoWikI &gt;
12860 !! end
12863 ### Message transform tests
12865 !! test
12866 message transform: magic variables
12867 !! options
12869 !! wikitext
12870 {{SITENAME}}
12871 !! html
12872 MediaWiki
12873 !! end
12875 !! test
12876 message transform: should not transform wiki markup
12877 !! options
12879 !! wikitext
12880 ''test''
12881 !! html
12882 ''test''
12883 !! end
12885 !! test
12886 message transform: <noinclude> in transcluded template (bug 4926)
12887 !! options
12889 !! wikitext
12890 {{Includes}}
12891 !! html
12892 Foobar
12893 !! end
12895 !! test
12896 message transform: <onlyinclude> in transcluded template (bug 4926)
12897 !! options
12899 !! wikitext
12900 {{Includes2}}
12901 !! html
12903 !! end
12905 !! test
12906 {{#special:}} page name, known
12907 !! options
12909 !! wikitext
12910 {{#special:Recentchanges}}
12911 !! html
12912 Special:RecentChanges
12913 !! end
12915 !! test
12916 {{#special:}} page name with subpage, known
12917 !! options
12919 !! wikitext
12920 {{#special:Recentchanges/param}}
12921 !! html
12922 Special:RecentChanges/param
12923 !! end
12925 !! test
12926 {{#special:}} page name, unknown
12927 !! options
12929 !! wikitext
12930 {{#special:foobar nonexistent}}
12931 !! html
12932 Special:Foobar nonexistent
12933 !! end
12935 !! test
12936 {{#speciale:}} page name, known
12937 !! options
12939 !! wikitext
12940 {{#speciale:Recentchanges}}
12941 !! html
12942 Special:RecentChanges
12943 !! end
12945 !! test
12946 {{#speciale:}} page name with subpage, known
12947 !! options
12949 !! wikitext
12950 {{#speciale:Recentchanges/param}}
12951 !! html
12952 Special:RecentChanges/param
12953 !! end
12955 !! test
12956 {{#speciale:}} page name, unknown
12957 !! options
12959 !! wikitext
12960 {{#speciale:foobar nonexistent}}
12961 !! html
12962 Special:Foobar_nonexistent
12963 !! end
12966 ### Images
12968 ### For Parsoid-specific tests, see
12969 #### https://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec#Images
12971 !! test
12972 Simple image
12973 !! options
12974 parsoid=wt2html,wt2wt,html2html
12975 !! wikitext
12976 [[Image:foobar.jpg]]
12977 !! html/php
12978 <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>
12979 </p>
12980 !! html/parsoid
12981 <p><span class="mw-default-size" typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></span></p>
12982 !! end
12984 !! test
12985 Simple image (using File: namespace, now canonical)
12986 !! wikitext
12987 [[File:Foobar.jpg]]
12988 !! html/php
12989 <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>
12990 </p>
12991 !! html/parsoid
12992 <p><span class="mw-default-size" typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></span></p>
12993 !! end
12995 !! test
12996 Right-aligned image
12997 !! wikitext
12998 [[File:Foobar.jpg|right]]
12999 !! html/php
13000 <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>
13002 !! html/parsoid
13003 <figure class="mw-default-size mw-halign-right" typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></figure>
13004 !! end
13006 !! test
13007 Image with caption
13008 !! wikitext
13009 [[File:Foobar.jpg|right|Caption text]]
13010 !! html/php
13011 <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>
13013 !! html/parsoid
13014 <figure class="mw-default-size mw-halign-right" typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a><figcaption>Caption text</figcaption></figure>
13015 !! end
13017 !! test
13018 Image with caption, bug 53312 #1
13019 !! wikitext
13020 [[File:Foobar.jpg|right|Caption page stuff]]
13021 !! html/php
13022 <div class="floatright"><a href="/wiki/File:Foobar.jpg" class="image" title="Caption page stuff"><img alt="Caption page stuff" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a></div>
13024 !! html/parsoid
13025 <figure class="mw-default-size mw-halign-right" typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a><figcaption>Caption page stuff</figcaption></figure>
13026 !! end
13028 !! test
13029 Image with caption, bug 53312 #2
13030 !! wikitext
13031 [[File:Foobar.jpg|right|Caption page=]]
13032 !! html/php
13033 <div class="floatright"><a href="/wiki/File:Foobar.jpg" class="image" title="Caption page="><img alt="Caption page=" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a></div>
13035 !! html/parsoid
13036 <figure class="mw-default-size mw-halign-right" typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a><figcaption>Caption page=</figcaption></figure>
13037 !! end
13039 !! test
13040 Image with caption, bug 53312 #3
13041 !! wikitext
13042 [[File:Foobar.jpg|right|Caption page=stuff]]
13043 !! html/php
13044 <div class="floatright"><a href="/wiki/File:Foobar.jpg" class="image" title="Caption page=stuff"><img alt="Caption page=stuff" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a></div>
13046 !! html/parsoid
13047 <figure class="mw-default-size mw-halign-right" typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a><figcaption>Caption page=stuff</figcaption></figure>
13048 !! end
13050 !! test
13051 Allow empty links in image captions (Bug 60753)
13052 !! options
13053 thumbsize=220
13054 !! wikitext
13055 [[File:Foobar.jpg|thumb|Caption [[Link1]]
13056 [[]]
13057 [[Link2]]
13059 !! html/php
13060 <div class="thumb tright"><div class="thumbinner" style="width:222px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" width="220" height="25" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/330px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/440px-Foobar.jpg 2x" /></a>  <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>Caption <a href="/index.php?title=Link1&amp;action=edit&amp;redlink=1" class="new" title="Link1 (page does not exist)">Link1</a> [[]] <a href="/index.php?title=Link2&amp;action=edit&amp;redlink=1" class="new" title="Link2 (page does not exist)">Link2</a></div></div></div>
13062 !! html/parsoid
13063 <figure class="mw-default-size" typeof="mw:Image/Thumb" data-parsoid='{"optList":[{"ck":"thumbnail","ak":"thumb"},{"ck":"caption","ak":"Caption [[Link1]]\n[[]]\n[[Link2]]\n"}]}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"}}'><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"25","width":"220"},"sa":{"resource":"File:Foobar.jpg"}}'/></a><figcaption>Caption <a rel="mw:WikiLink" href="./Link1" title="Link1" data-parsoid='{"stx":"simple","a":{"href":"./Link1"},"sa":{"href":"Link1"}}'>Link1</a>
13064 [[]]
13065 <a rel="mw:WikiLink" href="./Link2" title="Link2" data-parsoid='{"stx":"simple","a":{"href":"./Link2"},"sa":{"href":"Link2"}}'>Link2</a>
13066 </figcaption></figure>
13067 !! end
13069 !! test
13070 Titles in unlinked images (T23454)
13071 !! wikitext
13072 [[File:Foobar.jpg|link=|stuff]]
13073 !! html/php
13074 <p><img alt="stuff" src="http://example.com/images/3/3a/Foobar.jpg" title="stuff" width="1941" height="220" />
13075 </p>
13076 !! end
13078 !! test
13079 Link with empty target
13080 !! wikitext
13081 [[]]
13082 !! html
13083 <p>[[]]
13084 </p>
13085 !! end
13087 !! test
13088 Image with link trail
13089 !! wikitext
13090 Linktrails should not work for images: [[File:Foobar.jpg]]s
13091 !! html/php
13092 <p>Linktrails should not work for images: <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>s
13093 </p>
13094 !! html/parsoid
13095 <p>Linktrails should not work for images: <span class="mw-default-size" typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></span>s</p>
13096 !! end
13098 !! test
13099 Image with empty attribute
13100 !! options
13101 parsoid=wt2html,wt2wt,html2html
13102 !! wikitext
13103 [[File:Foobar.jpg|right||Caption text]]
13104 !! html/php
13105 <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>
13107 !! html/parsoid
13108 <figure class="mw-default-size mw-halign-right" typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a><figcaption>Caption text</figcaption></figure>
13109 !! end
13111 !! test
13112 1. Block image with individual attributes from templates
13113 !! wikitext
13114 [[File:Foobar.jpg|thumb|{{echo|137px}}|This is a caption]]
13115 !! html/php
13116 <div class="thumb tright"><div class="thumbinner" style="width:139px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/137px-Foobar.jpg" width="137" height="16" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/206px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/274px-Foobar.jpg 2x" /></a>  <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>This is a caption</div></div></div>
13118 !! html/parsoid
13119 <figure typeof="mw:Image/Thumb mw:ExpandedAttrs" about="#mwt2" data-parsoid='{"optList":[{"ck":"thumbnail","ak":"thumb"},{"ck":"width","ak":"{{echo|137px}}"},{"ck":"caption","ak":"This is a caption"}]}' data-mw='{"attribs":[["thumbnail",{"html":"thumb"}],["width",{"html":"&lt;span about=\"#mwt1\" typeof=\"mw:Transclusion\" data-parsoid=&#39;{\"pi\":[[{\"k\":\"1\"}]],\"dsr\":[24,38,null,null]}&#39; data-mw=&#39;{\"parts\":[{\"template\":{\"target\":{\"wt\":\"echo\",\"href\":\"./Template:Echo\"},\"params\":{\"1\":{\"wt\":\"137px\"}},\"i\":0}}]}&#39;>137px&lt;/span>"}]]}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"},"sa":{}}'><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/137px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="16" width="137" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"16","width":"137"},"sa":{"resource":"File:Foobar.jpg"}}'/></a><figcaption>This is a caption</figcaption></figure>
13120 !! end
13122 !! test
13123 2. Block Image with individual attributes from templates
13124 !! wikitext
13125 [[File:Foobar.jpg|{{echo|thumb}}|{{echo|137px}}|This is a caption]]
13126 !! html/php
13127 <div class="thumb tright"><div class="thumbinner" style="width:139px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/137px-Foobar.jpg" width="137" height="16" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/206px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/274px-Foobar.jpg 2x" /></a>  <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>This is a caption</div></div></div>
13129 !! html/parsoid
13130 <figure typeof="mw:Image/Thumb mw:ExpandedAttrs" about="#mwt3" data-parsoid='{"optList":[{"ck":"thumbnail","ak":"{{echo|thumb}}"},{"ck":"width","ak":"{{echo|137px}}"},{"ck":"caption","ak":"This is a caption"}]}' data-mw='{"attribs":[["thumbnail",{"html":"&lt;span about=\"#mwt1\" typeof=\"mw:Transclusion\" data-parsoid=&#39;{\"pi\":[[{\"k\":\"1\"}]],\"dsr\":[18,32,null,null]}&#39; data-mw=&#39;{\"parts\":[{\"template\":{\"target\":{\"wt\":\"echo\",\"href\":\"./Template:Echo\"},\"params\":{\"1\":{\"wt\":\"thumb\"}},\"i\":0}}]}&#39;>thumb&lt;/span>"}],["width",{"html":"&lt;span about=\"#mwt2\" typeof=\"mw:Transclusion\" data-parsoid=&#39;{\"pi\":[[{\"k\":\"1\"}]],\"dsr\":[33,47,null,null]}&#39; data-mw=&#39;{\"parts\":[{\"template\":{\"target\":{\"wt\":\"echo\",\"href\":\"./Template:Echo\"},\"params\":{\"1\":{\"wt\":\"137px\"}},\"i\":0}}]}&#39;>137px&lt;/span>"}]]}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"},"sa":{}}'><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/137px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="16" width="137" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"16","width":"137"},"sa":{"resource":"File:Foobar.jpg"}}'/></a><figcaption>This is a caption</figcaption></figure>
13131 !! end
13133 !! test
13134 3. Inline image with individual attributes from templates
13135 !! wikitext
13136 [[File:Foobar.jpg|{{echo|50px}}]]
13137 !! html/php
13138 <p><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/50px-Foobar.jpg" width="50" height="6" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/75px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/100px-Foobar.jpg 2x" /></a>
13139 </p>
13140 !! html/parsoid
13141 <p><span typeof="mw:Image mw:ExpandedAttrs" about="#mwt2" data-parsoid='{"optList":[{"ck":"width","ak":"{{echo|50px}}"}]}' data-mw='{"attribs":[["width",{"html":"&lt;span about=\"#mwt1\" typeof=\"mw:Transclusion\" data-parsoid=&#39;{\"pi\":[[{\"k\":\"1\"}]],\"dsr\":[18,31,null,null]}&#39; data-mw=&#39;{\"parts\":[{\"template\":{\"target\":{\"wt\":\"echo\",\"href\":\"./Template:Echo\"},\"params\":{\"1\":{\"wt\":\"50px\"}},\"i\":0}}]}&#39;>50px&lt;/span>"}]]}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"},"sa":{}}'><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/50px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="6" width="50" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"6","width":"50"},"sa":{"resource":"File:Foobar.jpg"}}'/></a></span></p>
13142 !! end
13144 ## Parsoid does not provide editing support for images where templates produce multiple image attributes.
13145 ## To signal this, we add a 'mw:Placeholder' type to such images. This could change in the future.
13146 !! test
13147 Image with multiple attributes from the same template
13148 !! wikitext
13149 [[File:Foobar.jpg|{{image_attribs}}]]
13150 !! html/php
13151 <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>
13153 !! html/parsoid
13154 <figure class="mw-default-size mw-halign-right" typeof="mw:Image mw:Placeholder"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a><figcaption>Caption text</figcaption></figure>
13155 !! end
13157 !! test
13158 Image with link tails
13159 !! options
13160 thumbsize=220
13161 !! wikitext
13162 123[[File:Foobar.jpg]]456
13163 123[[File:Foobar.jpg|right]]456
13164 123[[File:Foobar.jpg|thumb]]456
13165 !! html/php
13166 <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
13167 </p>
13168 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
13169 123<div class="thumb tright"><div class="thumbinner" style="width:222px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" width="220" height="25" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/330px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/440px-Foobar.jpg 2x" /></a>  <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div></div></div></div>456
13171 !! html/php+tidy
13172 <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</p>
13173 <p>123</p>
13174 <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>
13175 <p>456 123</p>
13176 <div class="thumb tright">
13177 <div class="thumbinner" style="width:222px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" width="220" height="25" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/330px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/440px-Foobar.jpg 2x" /></a>
13178 <div class="thumbcaption">
13179 <div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>
13180 </div>
13181 </div>
13182 </div>
13183 <p>456</p>
13184 !! html/parsoid
13185 <p>123<span class="mw-default-size" typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></span>456</p>
13186 <p>123</p><figure class="mw-default-size mw-halign-right" typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></figure><p>456</p>
13187 <p>123</p><figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a></figure><p>456</p>
13188 !! end
13190 !! test
13191 Image with multiple captions -- only last one is accepted
13192 !! wikitext
13193 [[File:Foobar.jpg|right|Caption1 - ignored|[[Caption2]] - ignored|Caption3 - accepted]]
13194 !! html/php
13195 <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>
13197 !! html/parsoid
13198 <figure class="mw-default-size mw-halign-right" typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a><figcaption>Caption3 - accepted</figcaption></figure>
13199 !! end
13201 !! test
13202 Image with multiple widths -- use last
13203 !! wikitext
13204 [[File:Foobar.jpg|200px|300px|caption]]
13205 !! html/php
13206 <p><a href="/wiki/File:Foobar.jpg" class="image" title="caption"><img alt="caption" src="http://example.com/images/thumb/3/3a/Foobar.jpg/300px-Foobar.jpg" width="300" height="34" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/450px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/600px-Foobar.jpg 2x" /></a>
13207 </p>
13208 !! html/parsoid
13209 <p><span typeof="mw:Image" data-mw='{"caption":"caption"}'><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/300px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="34" width="300"/></a></span></p>
13210 !! end
13212 !! test
13213 Image with multiple alignments -- use first (bug 48664)
13214 !! options
13215 thumbsize=220
13216 !! wikitext
13217 [[File:Foobar.jpg|thumb|left|right|center|caption]]
13219 [[File:Foobar.jpg|middle|text-top|caption]]
13220 !! html/php
13221 <div class="thumb tleft"><div class="thumbinner" style="width:222px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" width="220" height="25" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/330px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/440px-Foobar.jpg 2x" /></a>  <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>caption</div></div></div>
13222 <p><a href="/wiki/File:Foobar.jpg" class="image" title="caption"><img alt="caption" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" style="vertical-align: middle" /></a>
13223 </p>
13224 !! html/parsoid
13225 <figure class="mw-default-size mw-halign-left" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption>caption</figcaption></figure>
13226 <p><span class="mw-default-size mw-valign-middle" typeof="mw:Image" data-mw='{"caption":"caption"}'><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></span></p>
13227 !! end
13229 !! test
13230 Image with width attribute at different positions
13231 !! wikitext
13232 [[File:Foobar.jpg|200px|right|Caption]]
13233 [[File:Foobar.jpg|right|200px|Caption]]
13234 [[File:Foobar.jpg|right|Caption|200px]]
13235 !! html/php
13236 <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>
13237 <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>
13238 <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>
13240 !! html/parsoid
13241 <figure class="mw-halign-right" typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/200px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="23" width="200"/></a><figcaption>Caption</figcaption></figure>
13242 <figure class="mw-halign-right" typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/200px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="23" width="200"/></a><figcaption>Caption</figcaption></figure>
13243 <figure class="mw-halign-right" typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/200px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="23" width="200"/></a><figcaption>Caption</figcaption></figure>
13244 !! end
13246 # a sad bit of backward-compatibility
13247 !! test
13248 Image with size specified with pxpx (bug 13500, 51628)
13249 !! options
13250 parsoid=wt2html,wt2wt,html2html
13251 !! wikitext
13252 [[File:Foobar.jpg|20pxpx]]
13253 [[File:Foobar.jpg|200x20pxpx]]
13254 !! html/php
13255 <p><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" 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>
13256 <a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/177px-Foobar.jpg" width="177" height="20" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/265px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/353px-Foobar.jpg 2x" /></a>
13257 </p>
13258 !! html/parsoid
13259 <p><span typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/20px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="2" width="20"/></a></span> <span typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/177px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="20" width="177"/></a></span></p>
13260 !! end
13262 !! test
13263 Image with link parameter, wiki target
13264 !! wikitext
13265 [[File:Foobar.jpg|link=Main Page]]
13266 !! html/php
13267 <p><a href="/wiki/Main_Page" title="Main Page"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
13268 </p>
13269 !! html/parsoid
13270 <p><span class="mw-default-size" typeof="mw:Image"><a href="Main_Page"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></span></p>
13271 !! end
13273 # parsoid bug 49293 (part 1)
13274 !! test
13275 Image with link parameter, URL target
13276 !! wikitext
13277 [[File:Foobar.jpg|link=http://example.com/]]
13278 !! html/php
13279 <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>
13280 </p>
13281 !! html/parsoid
13282 <p><span class="mw-default-size" typeof="mw:Image"><a href="http://example.com/"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></span></p>
13283 !! end
13285 # parsoid bug 49293 (part 2)
13286 !! test
13287 Image with link parameter, protocol-less URL target
13288 !! wikitext
13289 [[File:Foobar.jpg|link=//example.com/]]
13290 !! html/php
13291 <p><a href="//example.com/" rel="nofollow"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
13292 </p>
13293 !! html/parsoid
13294 <p><span class="mw-default-size" typeof="mw:Image"><a href="//example.com/"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></span></p>
13295 !! end
13297 !! test
13298 Escaping non-block captions (T107435)
13299 !! options
13300 parsoid={
13301   "modes": ["wt2wt"],
13302   "changes": [
13303     ["[typeof~='mw:Image']", "attr", "data-mw", "{\"caption\": \"|\"}"]
13304   ]
13306 !! wikitext
13307 [[Image:Foobar.jpg|caption]]
13308 !! wikitext/edited
13309 [[Image:Foobar.jpg|<nowiki>|</nowiki>]]
13310 !! end
13312 # wgExternalLinkTarget not supported by Parsoid
13313 !! test
13314 Image with link parameter, wgExternalLinkTarget
13315 !! wikitext
13316 [[Image:foobar.jpg|link=http://example.com/]]
13317 !! config
13318 wgExternalLinkTarget='foobar'
13319 !! html/php
13320 <p><a href="http://example.com/" target="foobar" rel="nofollow noreferrer noopener"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
13321 </p>
13322 !! end
13324 !! test
13325 Image with link parameter, wgNoFollowLinks set to false
13326 !! wikitext
13327 [[Image:foobar.jpg|link=http://example.com/]]
13328 !! config
13329 wgNoFollowLinks=false
13330 !! html
13331 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
13332 </p>
13333 !! end
13335 !! test
13336 Image with link parameter, wgNoFollowDomainExceptions
13337 !! wikitext
13338 [[Image:foobar.jpg|link=http://example.com/]]
13339 !! config
13340 wgNoFollowDomainExceptions='example.com'
13341 !! html
13342 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
13343 </p>
13344 !! end
13346 # wgExternalLinkTarget not supported by Parsoid
13347 !! test
13348 Image with link parameter, wgExternalLinkTarget, unnamed parameter
13349 !! wikitext
13350 [[Image:foobar.jpg|link=http://example.com/|Title]]
13351 !! config
13352 wgExternalLinkTarget='foobar'
13353 !! html/php
13354 <p><a href="http://example.com/" title="Title" target="foobar" rel="nofollow noreferrer noopener"><img alt="Title" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
13355 </p>
13356 !! end
13358 !! test
13359 Image with empty link parameter
13360 !! wikitext
13361 [[File:Foobar.jpg|link=]]
13362 !! html/php
13363 <p><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" />
13364 </p>
13365 !! html/parsoid
13366 <p><span class="mw-default-size" typeof="mw:Image"><span><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></span></span></p>
13367 !! end
13369 !! test
13370 Image with link parameter (wiki target) and unnamed parameter
13371 !! wikitext
13372 [[File:Foobar.jpg|link=Main_Page|Title]]
13373 !! html/php
13374 <p><a href="/wiki/Main_Page" title="Title"><img alt="Title" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
13375 </p>
13376 !! html/parsoid
13377 <p><span class="mw-default-size" typeof="mw:Image" data-mw='{"caption":"Title"}'><a href="Main_Page"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></span></p>
13378 !! end
13380 !! test
13381 Image with link parameter (URL target) and unnamed parameter
13382 !! wikitext
13383 [[File:Foobar.jpg|link=http://example.com/|Title]]
13384 !! html/php
13385 <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>
13386 </p>
13387 !! html/parsoid
13388 <p><span class="mw-default-size" typeof="mw:Image" data-mw='{"caption":"Title"}'><a href="http://example.com/"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></span></p>
13389 !! end
13391 !! test
13392 Thumbnail image with link parameter
13393 !! options
13394 thumbsize=220
13395 parsoid=wt2html,wt2wt,html2html
13396 !! wikitext
13397 [[File:Foobar.jpg|thumb|link=http://example.com/|Title]]
13398 !! html/php
13399 <div class="thumb tright"><div class="thumbinner" style="width:222px;"><a href="http://example.com/"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" width="220" height="25" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/330px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/440px-Foobar.jpg 2x" /></a>  <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>Title</div></div></div>
13401 !! html/parsoid
13402 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="http://example.com/"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption>Title</figcaption></figure>
13403 !! end
13405 !! test
13406 Manually-specified thumbnail image
13407 !! options
13408 thumbsize=220
13409 !! wikitext
13410 [[File:Foobar.jpg|thumb=Thumb.png|Title]]
13411 !! html/php
13412 <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"></a></div>Title</div></div></div>
13414 !! html/parsoid
13415 <figure class="mw-default-size" typeof="mw:Image/Thumb" data-mw='{"thumb":"Thumb.png"}'><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/e/ea/Thumb.png" data-file-width="135" data-file-height="135" data-file-type="bitmap" height="135" width="135"/></a><figcaption>Title</figcaption></figure>
13416 !! end
13418 !! test
13419 Manually-specified thumbnail image with explicit link to wiki page
13420 !! options
13421 thumbsize=220
13422 parsoid=wt2html,wt2wt,html2html
13423 !! wikitext
13424 [[File:Foobar.jpg|thumb=Thumb.png|link=Main_Page|Title]]
13425 !! html/php
13426 <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"></a></div>Title</div></div></div>
13428 !! html/parsoid
13429 <figure class="mw-default-size" typeof="mw:Image/Thumb" data-mw='{"thumb":"Thumb.png"}'><a href="Main_Page"><img resource="./File:Foobar.jpg" src="//example.com/images/e/ea/Thumb.png" data-file-width="135" data-file-height="135" data-file-type="bitmap" height="135" width="135"/></a><figcaption>Title</figcaption></figure>
13430 !! end
13432 !! test
13433 Manually-specified thumbnail image with explicit link to url
13434 !! options
13435 thumbsize=220
13436 parsoid=wt2html,wt2wt,html2html
13437 !! wikitext
13438 [[File:Foobar.jpg|thumb=Thumb.png|link=http://example.com|Title]]
13439 !! html/php
13440 <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"></a></div>Title</div></div></div>
13442 !! html/parsoid
13443 <figure class="mw-default-size" typeof="mw:Image/Thumb" data-mw='{"thumb":"Thumb.png"}'><a href="http://example.com"><img resource="./File:Foobar.jpg" src="//example.com/images/e/ea/Thumb.png" data-file-width="135" data-file-height="135" data-file-type="bitmap" height="135" width="135"/></a><figcaption>Title</figcaption></figure>
13444 !! end
13446 !! test
13447 Manually-specified thumbnail image with explicit no link
13448 !! options
13449 thumbsize=220
13450 parsoid=wt2html,wt2wt,html2html
13451 !! wikitext
13452 [[File:Foobar.jpg|thumb=Thumb.png|link=|Title]]
13453 !! html/php
13454 <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"></a></div>Title</div></div></div>
13456 !! html/parsoid
13457 <figure class="mw-default-size" typeof="mw:Image/Thumb" data-mw='{"thumb":"Thumb.png"}'><span><img resource="./File:Foobar.jpg" src="//example.com/images/e/ea/Thumb.png" data-file-width="135" data-file-height="135" data-file-type="bitmap" height="135" width="135"/></span><figcaption>Title</figcaption></figure>
13458 !! end
13460 !! test
13461 Manually-specified thumbnail image with explicit link and alt text
13462 !! options
13463 thumbsize=220
13464 parsoid=wt2html,wt2wt,html2html
13465 !! wikitext
13466 [[File:Foobar.jpg|thumb=Thumb.png|link=Main_Page|alt=alttext|Title]]
13467 !! html/php
13468 <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"></a></div>Title</div></div></div>
13470 !! html/parsoid
13471 <figure class="mw-default-size" typeof="mw:Image/Thumb" data-mw='{"thumb":"Thumb.png"}'><a href="Main_Page"><img alt="alttext" resource="./File:Foobar.jpg" src="//example.com/images/e/ea/Thumb.png" data-file-width="135" data-file-height="135" data-file-type="bitmap" height="135" width="135"/></a><figcaption>Title</figcaption></figure>
13472 !! end
13474 !! test
13475 Image with frame and link
13476 !! options
13477 parsoid=wt2html,wt2wt,html2html
13478 !! wikitext
13479 [[File:Foobar.jpg|frame|left|This is a test image [[Main Page]]]]
13480 !! html/php
13481 <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>
13483 !! html/parsoid
13484 <figure class="mw-default-size mw-halign-left" typeof="mw:Image/Frame"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a><figcaption>This is a test image <a rel="mw:WikiLink" href="Main_Page" title="Main Page">Main Page</a></figcaption></figure>
13485 !! end
13487 !! test
13488 Image with frame and link and explicit alt
13489 !! options
13490 parsoid=wt2html,wt2wt,html2html
13491 !! wikitext
13492 [[Image:Foobar.jpg|frame|left|This is a test image [[Main Page]]|alt=Altitude]]
13493 !! html/php
13494 <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>
13496 !! html/parsoid
13497 <figure class="mw-default-size mw-halign-left" typeof="mw:Image/Frame"><a href="./File:Foobar.jpg"><img alt="Altitude" resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a><figcaption>This is a test image <a rel="mw:WikiLink" href="Main_Page" title="Main Page">Main Page</a></figcaption></figure>
13498 !! end
13500 !! test
13501 Image with wiki markup in implicit alt
13502 !! wikitext
13503 [[Image:Foobar.jpg|testing '''bold''' in alt]]
13505 [[Image:Foobar.jpg|alt=testing '''bold''' in alt]]
13506 !! html/php
13507 <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>
13508 </p><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>
13509 </p>
13510 !! html/parsoid
13511 <p><span class="mw-default-size" typeof="mw:Image" data-parsoid='{"optList":[{"ck":"caption","ak":"testing &#39;&#39;&#39;bold&#39;&#39;&#39; in alt"}]}' data-mw='{"caption":"testing &lt;b data-parsoid=&#39;{\"dsr\":[27,37,3,3]}&#39;>bold&lt;/b> in alt"}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"},"sa":{}}'><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"220","width":"1941"},"sa":{"resource":"Image:Foobar.jpg"}}'/></a></span></p>
13513 <p><span class="mw-default-size" typeof="mw:Image" data-parsoid='{"optList":[{"ck":"alt","ak":"alt=testing &#39;&#39;&#39;bold&#39;&#39;&#39; in alt"}]}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"},"sa":{}}'><img alt="testing bold in alt" resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941" data-parsoid='{"a":{"alt":"testing bold in alt","resource":"./File:Foobar.jpg","height":"220","width":"1941"},"sa":{"alt":"alt=testing &#39;&#39;&#39;bold&#39;&#39;&#39; in alt","resource":"Image:Foobar.jpg"}}'/></a></span></p>
13514 !! end
13516 !! test
13517 Alt image option should handle most kinds of wikitext without barfing
13518 !! wikitext
13519 [[Image:Foobar.jpg|thumb|This is the image caption|alt=This is a [[link]] and a {{echo|''bold template''}}.]]
13520 !! html/php
13521 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="This is a link and a bold template." 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"></a></div>This is the image caption</div></div></div>
13523 !! html/parsoid
13524 <figure class="mw-default-size" typeof="mw:Image/Thumb mw:ExpandedAttrs" about="#mwt2" data-parsoid='{"optList":[{"ck":"thumbnail","ak":"thumb"},{"ck":"caption","ak":"This is the image caption"},{"ck":"alt","ak":"alt=This is a [[link]] and a {{echo|&#39;&#39;bold template&#39;&#39;}}."}]}' data-mw='{"attribs":[["thumbnail",{"html":"thumb"}],["alt",{"html":"alt=This is a &lt;a rel=\"mw:WikiLink\" href=\"./Link\" title=\"Link\" data-parsoid=&#39;{\"stx\":\"simple\",\"a\":{\"href\":\"./Link\"},\"sa\":{\"href\":\"link\"},\"dsr\":[65,73,2,2]}&#39;>link&lt;/a> and a &lt;i about=\"#mwt1\" typeof=\"mw:Transclusion\" data-parsoid=&#39;{\"dsr\":[80,106,null,null],\"pi\":[[{\"k\":\"1\"}]]}&#39; data-mw=&#39;{\"parts\":[{\"template\":{\"target\":{\"wt\":\"echo\",\"href\":\"./Template:Echo\"},\"params\":{\"1\":{\"wt\":\"&amp;#39;&amp;#39;bold template&amp;#39;&amp;#39;\"}},\"i\":0}}]}&#39;>bold template&lt;/i>."}]]}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"},"sa":{}}'><img alt="This is a link and a bold template." resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220" data-parsoid='{"a":{"alt":"This is a link and a bold template.","resource":"./File:Foobar.jpg","height":"25","width":"220"},"sa":{"alt":"alt=This is a [[link]] and a {{echo|&#39;&#39;bold template&#39;&#39;}}.","resource":"Image:Foobar.jpg"}}'/></a><figcaption>This is the image caption</figcaption></figure>
13525 !! end
13527 ###################
13528 # Conflicting image format options.
13529 # First option specified should 'win'.
13530 # All three cases in each test should be identical.
13532 !! test
13533 Image with 'frameless' first.
13534 !! options
13535 parsoid=wt2html,wt2wt,html2html
13536 !! wikitext
13537 [[File:Foobar.jpg|frameless|caption]]
13539 [[File:Foobar.jpg|frameless|frame|caption]]
13541 [[File:Foobar.jpg|frameless|thumb|caption]]
13542 !! html/php
13543 <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" 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>
13544 </p><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" 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>
13545 </p><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" 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>
13546 </p>
13547 !! html/parsoid
13548 <p><span class="mw-default-size" typeof="mw:Image/Frameless" data-mw='{"caption":"caption"}'><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a></span></p>
13549 <p><span class="mw-default-size" typeof="mw:Image/Frameless" data-mw='{"caption":"caption"}'><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a></span></p>
13550 <p><span class="mw-default-size" typeof="mw:Image/Frameless" data-mw='{"caption":"caption"}'><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a></span></p>
13551 !! end
13553 !! test
13554 Image with 'frame' first.
13555 !! options
13556 parsoid=wt2html,wt2wt,html2html
13557 !! wikitext
13558 [[File:Foobar.jpg|frame|caption]]
13559 [[File:Foobar.jpg|frame|frameless|caption]]
13560 [[File:Foobar.jpg|frame|thumb|caption]]
13561 !! html/php
13562 <div class="thumb tright"><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">caption</div></div></div>
13563 <div class="thumb tright"><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">caption</div></div></div>
13564 <div class="thumb tright"><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">caption</div></div></div>
13566 !! html/parsoid
13567 <figure class="mw-default-size" typeof="mw:Image/Frame"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a><figcaption>caption</figcaption></figure>
13568 <figure class="mw-default-size" typeof="mw:Image/Frame"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a><figcaption>caption</figcaption></figure>
13569 <figure class="mw-default-size" typeof="mw:Image/Frame"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a><figcaption>caption</figcaption></figure>
13570 !! end
13572 !! test
13573 Image with 'thumb' first.
13574 !! options
13575 parsoid=wt2html,wt2wt,html2html
13576 !! wikitext
13577 [[File:Foobar.jpg|thumb|caption]]
13578 [[File:Foobar.jpg|thumb|frameless|caption]]
13579 [[File:Foobar.jpg|thumb|frame|caption]]
13580 !! html/php
13581 <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"></a></div>caption</div></div></div>
13582 <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"></a></div>caption</div></div></div>
13583 <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"></a></div>caption</div></div></div>
13585 !! html/parsoid
13586 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption>caption</figcaption></figure>
13587 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption>caption</figcaption></figure>
13588 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption>caption</figcaption></figure>
13589 !! end
13591 ###################
13592 # Image sizing.
13593 # See https://www.mediawiki.org/wiki/Help:Images#Size_and_frame
13594 # and https://phabricator.wikimedia.org/T64258
13595 # Foobar has actual size of 1941x220
13596 # 1. Thumbs & frameless always reduce, can't be enlarged unless it's
13597 #    a scalable format.
13598 # 2. Framed images always ignore size options; always render at default size.
13599 # 3. "Unspecified format" and border are the only types which can be
13600 #    enlarged.
13602 !! test
13603 Image: "unspecified format" and border enlarge
13604 !! options
13605 parsoid=wt2html,wt2wt,html2html
13606 !! wikitext
13607 [[File:Foobar.jpg|2000px]]
13609 [[File:Foobar.jpg|border|2000px]]
13610 !! html/php
13611 <p><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="2000" height="227" /></a>
13612 </p><p><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="2000" height="227" class="thumbborder" /></a>
13613 </p>
13614 !! html/parsoid
13615 <p><span typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/1941px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="227" width="2000"/></a></span></p>
13616 <p><span class="mw-image-border" typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/1941px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="227" width="2000"/></a></span></p>
13617 !! end
13619 !! test
13620 Image: "unspecified format" and border reduce
13621 !! options
13622 parsoid=wt2html,wt2wt,html2html
13623 !! wikitext
13624 [[File:Foobar.jpg|1000px]]
13626 [[File:Foobar.jpg|border|1000px]]
13627 !! html/php
13628 <p><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/1000px-Foobar.jpg" width="1000" height="113" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/1500px-Foobar.jpg 1.5x, http://example.com/images/3/3a/Foobar.jpg 2x" /></a>
13629 </p><p><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/1000px-Foobar.jpg" width="1000" height="113" class="thumbborder" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/1500px-Foobar.jpg 1.5x, http://example.com/images/3/3a/Foobar.jpg 2x" /></a>
13630 </p>
13631 !! html/parsoid
13632 <p><span typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/1000px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="113" width="1000"/></a></span></p>
13633 <p><span class="mw-image-border" typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/1000px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="113" width="1000"/></a></span></p>
13634 !! end
13636 !! test
13637 Image: thumbs reduce
13638 !! options
13639 parsoid=wt2html,wt2wt,html2html
13640 !! wikitext
13641 [[File:Foobar.jpg|thumb|50px]]
13642 !! html/php
13643 <div class="thumb tright"><div class="thumbinner" style="width:52px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/50px-Foobar.jpg" width="50" height="6" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/75px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/100px-Foobar.jpg 2x" /></a>  <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div></div></div></div>
13645 !! html/parsoid
13646 <figure typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/50px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="6" width="50"/></a></figure>
13647 !! end
13649 !! test
13650 Image: bitmap thumbs can't be enlarged past original size, but vector can.
13651 !! options
13652 parsoid=wt2html,wt2wt,html2html
13653 !! wikitext
13654 [[File:Foobar.jpg|thumb|2000px]]
13656 [[File:Foobar.svg|thumb|2000px]]
13657 !! html/php
13658 <div class="thumb tright"><div class="thumbinner" style="width:1943px;"><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" class="thumbimage" /></a>  <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div></div></div></div>
13659 <div class="thumb tright"><div class="thumbinner" style="width:2002px;"><a href="/wiki/File:Foobar.svg" class="image"><img alt="Foobar.svg" src="http://example.com/images/thumb/f/ff/Foobar.svg/2000px-Foobar.svg.png" width="2000" height="1500" class="thumbimage" srcset="http://example.com/images/thumb/f/ff/Foobar.svg/3000px-Foobar.svg.png 1.5x, http://example.com/images/thumb/f/ff/Foobar.svg/4000px-Foobar.svg.png 2x" /></a>  <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.svg" class="internal" title="Enlarge"></a></div></div></div></div>
13661 !! html/parsoid
13662 <figure typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/1941px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></figure>
13663 <figure typeof="mw:Image/Thumb"><a href="./File:Foobar.svg"><img resource="./File:Foobar.svg" src="//example.com/images/thumb/f/ff/Foobar.svg/240px-Foobar.svg" data-file-width="240" data-file-height="180" data-file-type="drawing" height="1500" width="2000"/></a></figure>
13664 !! end
13666 !! test
13667 Image: frameless can reduce in size
13668 !! options
13669 parsoid=wt2html,wt2wt,html2html
13670 !! wikitext
13671 [[File:Foobar.jpg|frameless|50px]]
13672 !! html/php
13673 <p><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/50px-Foobar.jpg" width="50" height="6" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/75px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/100px-Foobar.jpg 2x" /></a>
13674 </p>
13675 !! html/parsoid
13676 <p><span typeof="mw:Image/Frameless"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/50px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="6" width="50"/></a></span></p>
13677 !! end
13679 !! test
13680 Image: bitmap frameless can't be enlarged past original size, but vector can
13681 !! options
13682 parsoid=wt2html,wt2wt,html2html
13683 !! wikitext
13684 [[File:Foobar.jpg|frameless|2000px]]
13686 [[File:Foobar.svg|frameless|2000px]]
13687 !! html/php
13688 <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>
13689 </p><p><a href="/wiki/File:Foobar.svg" class="image"><img alt="Foobar.svg" src="http://example.com/images/thumb/f/ff/Foobar.svg/2000px-Foobar.svg.png" width="2000" height="1500" srcset="http://example.com/images/thumb/f/ff/Foobar.svg/3000px-Foobar.svg.png 1.5x, http://example.com/images/thumb/f/ff/Foobar.svg/4000px-Foobar.svg.png 2x" /></a>
13690 </p>
13691 !! html/parsoid
13692 <p><span typeof="mw:Image/Frameless"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/1941px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></span></p>
13693 <p><span typeof="mw:Image/Frameless"><a href="./File:Foobar.svg"><img resource="./File:Foobar.svg" src="//example.com/images/thumb/f/ff/Foobar.svg/240px-Foobar.svg" data-file-width="240" data-file-height="180" data-file-type="drawing" height="1500" width="2000"/></a></span></p>
13694 !! end
13696 !! test
13697 Image: framed images are always unscaled.
13698 !! options
13699 parsoid=wt2html,wt2wt,html2html
13700 !! wikitext
13701 [[File:Foobar.jpg|frame]]
13703 [[File:Foobar.jpg|frame|50px]]
13705 [[File:Foobar.jpg|frame|50x50px]]
13707 [[File:Foobar.jpg|frame|2000px]]
13708 !! html/php
13709 <div class="thumb tright"><div class="thumbinner" style="width:1943px;"><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" class="thumbimage" /></a>  <div class="thumbcaption"></div></div></div>
13710 <div class="thumb tright"><div class="thumbinner" style="width:1943px;"><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" class="thumbimage" /></a>  <div class="thumbcaption"></div></div></div>
13711 <div class="thumb tright"><div class="thumbinner" style="width:1943px;"><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" class="thumbimage" /></a>  <div class="thumbcaption"></div></div></div>
13712 <div class="thumb tright"><div class="thumbinner" style="width:1943px;"><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" class="thumbimage" /></a>  <div class="thumbcaption"></div></div></div>
13714 !! html/parsoid
13715 <figure class="mw-default-size" typeof="mw:Image/Frame"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></figure>
13716 <figure typeof="mw:Image/Frame"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></figure>
13717 <figure typeof="mw:Image/Frame"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></figure>
13718 <figure typeof="mw:Image/Frame"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></figure>
13719 !! end
13721 ###################
13723 !! test
13724 Link to image page- image page normally doesn't exists, hence edit link
13725 Add test with existing image page
13726 #<p><a href="/wiki/File:Test" title="Image:Test">Image:test</a>
13727 !! wikitext
13728 [[:Image:test]]
13729 !! html
13730 <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>
13731 </p>
13732 !! end
13734 !! test
13735 bug 18784  Link to non-existent image page with caption should use caption as link text
13736 !! wikitext
13737 [[:Image:test|caption]]
13738 !! html
13739 <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>
13740 </p>
13741 !! end
13743 !! test
13744 Frameless image caption with a free URL
13745 !! wikitext
13746 [[File:Foobar.jpg|http://example.com]]
13747 !! html/php
13748 <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>
13749 </p>
13750 !! html/parsoid
13751 <p><span class="mw-default-size" typeof="mw:Image" data-parsoid='{"optList":[{"ck":"caption","ak":"http://example.com"}]}' data-mw='{"caption":"&lt;a rel=\"mw:ExtLink\" href=\"http://example.com\" data-parsoid=&#39;{\"stx\":\"url\",\"dsr\":[18,36,0,0]}&#39;>http://example.com&lt;/a>"}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"},"sa":{}}'><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"220","width":"1941"},"sa":{"resource":"File:Foobar.jpg"}}'/></a></span></p>
13752 !! end
13754 !! test
13755 Thumbnail image caption with a free URL
13756 !! options
13757 thumbsize=220
13758 !! wikitext
13759 [[File:Foobar.jpg|thumb|http://example.com]]
13760 !! html/php
13761 <div class="thumb tright"><div class="thumbinner" style="width:222px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" width="220" height="25" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/330px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/440px-Foobar.jpg 2x" /></a>  <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a></div></div></div>
13763 !! html/parsoid
13764 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption><a rel="mw:ExtLink" href="http://example.com">http://example.com</a></figcaption></figure>
13765 !! end
13767 !! test
13768 Thumbnail image caption with a free URL and explicit alt
13769 !! options
13770 thumbsize=220
13771 parsoid=wt2html,wt2wt,html2html
13772 !! wikitext
13773 [[File:Foobar.jpg|thumb|http://example.com|alt=Alteration]]
13774 !! html/php
13775 <div class="thumb tright"><div class="thumbinner" style="width:222px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Alteration" src="http://example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" width="220" height="25" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/330px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/440px-Foobar.jpg 2x" /></a>  <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a></div></div></div>
13777 !! html/parsoid
13778 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img alt="Alteration" resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption><a rel="mw:ExtLink" href="http://example.com">http://example.com</a></figcaption></figure>
13779 !! end
13781 !! test
13782 SVG thumbnails with no language set
13783 !! options
13784 !! wikitext
13785 [[File:Foobar.svg|thumb|caption]]
13786 !! html/php
13787 <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="135" 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"></a></div>caption</div></div></div>
13789 !! html/parsoid
13790 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="./File:Foobar.svg"><img resource="./File:Foobar.svg" src="//example.com/images/thumb/f/ff/Foobar.svg/220px-Foobar.svg" data-file-width="240" data-file-height="180" data-file-type="drawing" height="165" width="220"/></a><figcaption>caption</figcaption></figure>
13791 !! end
13793 !! test
13794 SVG thumbnails with language de
13795 !! options
13796 parsoid=wt2html,wt2wt,html2html
13797 !! wikitext
13798 [[File:Foobar.svg|thumb|caption|lang=de]]
13799 !! html/php
13800 <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="135" 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"></a></div>caption</div></div></div>
13802 !! html/parsoid
13803 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="./File:Foobar.svg"><img resource="./File:Foobar.svg" src="//example.com/images/thumb/f/ff/Foobar.svg/220px-Foobar.svg" lang="de" data-file-width="240" data-file-height="180" data-file-type="drawing" height="165" width="220"/></a><figcaption>caption</figcaption></figure>
13804 !! end
13806 !! test
13807 SVG thumbnails with invalid language code
13808 !! options
13809 parsoid=wt2html,wt2wt,html2html
13810 !! wikitext
13811 [[File:Foobar.svg|thumb|caption|lang=invalid.language.code]]
13812 !! html/php
13813 <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="135" 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"></a></div>lang=invalid.language.code</div></div></div>
13815 !! html/parsoid
13816 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="./File:Foobar.svg"><img resource="./File:Foobar.svg" src="//example.com/images/f/ff/Foobar.svg" data-file-width="240" data-file-height="180" data-file-type="drawing" height="165" width="220"/></a><figcaption>lang=invalid.language.code</figcaption></figure>
13817 !! end
13819 !! test
13820 BUG 1887: A ISBN with a thumbnail
13821 !! wikitext
13822 [[File:Foobar.jpg|thumb|ISBN 1235467890]]
13823 !! html/php
13824 <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"></a></div><a href="/wiki/Special:BookSources/1235467890" class="internal mw-magiclink-isbn">ISBN 1235467890</a></div></div></div>
13826 !! html/parsoid
13827 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption><a href="./Special:BookSources/1235467890" rel="mw:WikiLink">ISBN 1235467890</a></figcaption></figure>
13828 !! end
13830 !! test
13831 BUG 1887: A RFC with a thumbnail
13832 !! wikitext
13833 [[File:Foobar.jpg|thumb|This is RFC 12354]]
13834 !! html/php
13835 <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"></a></div>This is <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc12354">RFC 12354</a></div></div></div>
13837 !! html/parsoid
13838 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption>This is <a href="//tools.ietf.org/html/rfc12354" rel="mw:ExtLink">RFC 12354</a></figcaption></figure>
13839 !! end
13841 !! test
13842 BUG 1887: A mailto link with a thumbnail
13843 !! wikitext
13844 [[File:Foobar.jpg|thumb|Please mailto:nobody@example.com]]
13845 !! html/php
13846 <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"></a></div>Please <a rel="nofollow" class="external free" href="mailto:nobody@example.com">mailto:nobody@example.com</a></div></div></div>
13848 !! html/parsoid
13849 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption>Please <a rel="mw:ExtLink" href="mailto:nobody@example.com">mailto:nobody@example.com</a></figcaption></figure>
13850 !! end
13852 # Pending resolution to bug 368
13853 !! test
13854 BUG 648: Frameless image caption with a link
13855 !! wikitext
13856 [[File:Foobar.jpg|text with a [[link]] in it]]
13857 !! html/php
13858 <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>
13859 </p>
13860 !! html/parsoid
13861 <p><span class="mw-default-size" typeof="mw:Image" data-parsoid='{"optList":[{"ck":"caption","ak":"text with a [[link]] in it"}]}' data-mw='{"caption":"text with a &lt;a rel=\"mw:WikiLink\" href=\"./Link\" title=\"Link\" data-parsoid=&#39;{\"stx\":\"simple\",\"a\":{\"href\":\"./Link\"},\"sa\":{\"href\":\"link\"},\"dsr\":[30,38,2,2]}&#39;>link&lt;/a> in it"}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"},"sa":{}}'><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"220","width":"1941"},"sa":{"resource":"File:Foobar.jpg"}}'/></a></span></p>
13862 !! end
13864 !! test
13865 BUG 648: Frameless image caption with a link (suffix)
13866 !! wikitext
13867 [[File:Foobar.jpg|text with a [[link]]foo in it]]
13868 !! html/php
13869 <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>
13870 </p>
13871 !! html/parsoid
13872 <p><span class="mw-default-size" typeof="mw:Image" data-parsoid='{"optList":[{"ck":"caption","ak":"text with a [[link]]foo in it"}]}' data-mw='{"caption":"text with a &lt;a rel=\"mw:WikiLink\" href=\"./Link\" title=\"Link\" data-parsoid=&#39;{\"stx\":\"simple\",\"a\":{\"href\":\"./Link\"},\"sa\":{\"href\":\"link\"},\"dsr\":[30,41,2,5],\"tail\":\"foo\"}&#39;>linkfoo&lt;/a> in it"}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"},"sa":{}}'><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"220","width":"1941"},"sa":{"resource":"File:Foobar.jpg"}}'/></a></span></p>
13873 !! end
13875 !! test
13876 BUG 648: Frameless image caption with an interwiki link
13877 !! wikitext
13878 [[File:Foobar.jpg|text with a [[MeatBall:Link]] in it]]
13879 !! html/php
13880 <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>
13881 </p>
13882 !! html/parsoid
13883 <p><span class="mw-default-size" typeof="mw:Image" data-parsoid='{"optList":[{"ck":"caption","ak":"text with a [[MeatBall:Link]] in it"}]}' data-mw='{"caption":"text with a &lt;a rel=\"mw:ExtLink\" href=\"http://www.usemod.com/cgi-bin/mb.pl?Link\" title=\"meatball:Link\" data-parsoid=&#39;{\"stx\":\"simple\",\"a\":{\"href\":\"http://www.usemod.com/cgi-bin/mb.pl?Link\"},\"sa\":{\"href\":\"MeatBall:Link\"},\"isIW\":true,\"dsr\":[30,47,2,2]}&#39;>MeatBall:Link&lt;/a> in it"}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"},"sa":{}}'><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"220","width":"1941"},"sa":{"resource":"File:Foobar.jpg"}}'/></a></span></p>
13884 !! end
13886 !! test
13887 BUG 648: Frameless image caption with a piped interwiki link
13888 !! wikitext
13889 [[File:Foobar.jpg|text with a [[MeatBall:Link|link]] in it]]
13890 !! html/php
13891 <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>
13892 </p>
13893 !! html/parsoid
13894 <p><span class="mw-default-size" typeof="mw:Image" data-parsoid='{"optList":[{"ck":"caption","ak":"text with a [[MeatBall:Link|link]] in it"}]}' data-mw='{"caption":"text with a &lt;a rel=\"mw:ExtLink\" href=\"http://www.usemod.com/cgi-bin/mb.pl?Link\" title=\"meatball:Link\" data-parsoid=&#39;{\"stx\":\"piped\",\"a\":{\"href\":\"http://www.usemod.com/cgi-bin/mb.pl?Link\"},\"sa\":{\"href\":\"MeatBall:Link\"},\"isIW\":true,\"dsr\":[30,52,16,2]}&#39;>link&lt;/a> in it"}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"},"sa":{}}'><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"220","width":"1941"},"sa":{"resource":"File:Foobar.jpg"}}'/></a></span></p>
13895 !! end
13897 !! test
13898 T107474: Frameless image caption with <nowiki>
13899 !! wikitext
13900 [[File:Foobar.jpg|<nowiki>text with a [[MeatBall:Link|link]] in it</nowiki>]]
13901 !! html/parsoid
13902 <p><span class="mw-default-size" typeof="mw:Image" data-parsoid='{"optList":[{"ck":"caption","ak":"&lt;nowiki>text with a [[MeatBall:Link|link]] in it&lt;/nowiki>"}]}' data-mw='{"caption":"&lt;span typeof=\"mw:Nowiki\" data-parsoid=&#39;{\"dsr\":[18,75,8,9]}&#39;>text with a [[MeatBall:Link|link]] in it&lt;/span>"}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"},"sa":{}}'><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"220","width":"1941"},"sa":{"resource":"File:Foobar.jpg"}}'/></a></span></p>
13903 !! end
13905 !! test
13906 Escape HTML special chars in image alt text
13907 !! wikitext
13908 [[File:Foobar.jpg|& < > "]]
13909 !! html/php
13910 <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>
13911 </p>
13912 !! html/parsoid
13913 <p><span class="mw-default-size" typeof="mw:Image" data-parsoid='{"optList":[{"ck":"caption","ak":"&amp; &lt; > \""}]}' data-mw='{"caption":"&amp;amp; &amp;lt; > \""}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"},"sa":{}}'><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"220","width":"1941"},"sa":{"resource":"File:Foobar.jpg"}}'/></a></span></p>
13914 !! end
13916 !! test
13917 BUG 499: Alt text should have &#1234;, not &amp;1234;
13918 !! wikitext
13919 [[File:Foobar.jpg|&#9792;]]
13920 !! html/php
13921 <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>
13922 </p>
13923 !! html/parsoid
13924 <p><span class="mw-default-size" typeof="mw:Image" data-parsoid='{"optList":[{"ck":"caption","ak":"&amp;#9792;"}]}' data-mw='{"caption":"&lt;span typeof=\"mw:Entity\" data-parsoid=&#39;{\"src\":\"&amp;amp;#9792;\",\"srcContent\":\"♀\",\"dsr\":[18,25,null,null]}&#39;>♀&lt;/span>"}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"},"sa":{}}'><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"220","width":"1941"},"sa":{"resource":"File:Foobar.jpg"}}'/></a></span></p>
13925 !! end
13927 !! test
13928 Broken image caption with link
13929 !! options
13930 parsoid=wt2html,wt2wt,html2html
13931 !! wikitext
13932 [[Image:Foobar.jpg|thumb|This is a broken caption. But [[Main Page|this]] is just an ordinary link.
13933 !! html/php
13934 <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.
13935 </p>
13936 !! html/parsoid
13937 <p>[[Image:Foobar.jpg|thumb|This is a broken caption. But <a rel="mw:WikiLink" href="Main_Page" title="Main Page">this</a> is just an ordinary link.</p>
13938 !! end
13940 !! test
13941 Image caption containing another image
13942 !! wikitext
13943 [[File:Foobar.jpg|thumb|This is a caption with another [[File:Thumb.png|image]] inside it!]]
13944 !! html/php
13945 <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"></a></div>This is a caption with another <a href="/wiki/File:Thumb.png" class="image" title="image"><img alt="image" src="http://example.com/images/e/ea/Thumb.png" width="135" height="135" /></a> inside it!</div></div></div>
13947 !! html/parsoid
13948 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption>This is a caption with another <span class="mw-default-size" typeof="mw:Image" data-mw='{"caption":"image"}'><a href="./File:Thumb.png"><img resource="./File:Thumb.png" src="//example.com/images/e/ea/Thumb.png" data-file-width="135" data-file-height="135" data-file-type="bitmap" height="135" width="135"/></a></span> inside it!</figcaption></figure>
13949 !! end
13951 !! test
13952 Image: caption containing a newline
13953 !! wikitext
13954 [[File:Foobar.jpg|This
13955 *is some text]]
13956 !! html/php
13957 <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>
13958 </p>
13959 !! html/parsoid
13960 <p><span class="mw-default-size" typeof="mw:Image" data-mw='{"caption":"This\n*is some text"}'><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></span></p>
13961 !!end
13963 !!test
13964 Image: caption containing leading space
13965 (The leading space should not trigger nowiki escaping in wt2wt mode)
13966 !! wikitext
13967 [[File:Foobar.jpg|thumb| bar]]
13968 !! html/php
13969 <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"></a></div>bar</div></div></div>
13971 !! html/parsoid
13972 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption> bar</figcaption></figure>
13973 !!end
13975 !! test
13976 Image: caption containing a table
13977 !! options
13978 parsoid=wt2html,wt2wt,html2html
13979 !! wikitext
13980 [[Image:Foobar.jpg|thumb|200px|This is an example image thumbnail caption with a table
13982 ! Foo !! Bar
13984 | Foo1 || Bar1
13986 and some more text.]]
13987 !! html/php
13988 <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"></a></div>This is an example image thumbnail caption with a table <table> <tr> <th> Foo </th> <th> Bar </th></tr> <tr> <td> Foo1 </td> <td> Bar1 </td></tr></table> and some more text.</div></div></div>
13990 !! html/parsoid
13991 <figure typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/200px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="23" width="200"/></a><figcaption>This is an example image thumbnail caption with a table
13992 <table>
13993 <tbody>
13994 <tr><th>Foo </th><th>Bar</th></tr>
13995 <tr>
13996 <td>Foo1 </td>
13997 <td>Bar1</td></tr></tbody></table>and some more text.</figcaption></figure>
13998 !! end
14000 !! test
14001 Bug 3090: External links other than http: in image captions
14002 !! wikitext
14003 [[File:Foobar.jpg|thumb|200x200px|This caption has [irc://example.net irc] and [https://example.com Secure] ext links in it.]]
14004 !! html/php
14005 <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"></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>
14007 !! html/parsoid
14008 <figure typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/200px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="23" width="200"/></a><figcaption>This caption has <a rel="mw:ExtLink" href="irc://example.net">irc</a> and <a rel="mw:ExtLink" href="https://example.com">Secure</a> ext links in it.</figcaption></figure>
14009 !! end
14011 !! test
14012 Custom class
14013 !! options
14014 parsoid=wt2html,wt2wt,html2html
14015 !! wikitext
14016 [[Image:foobar.jpg|a|class=b]]
14017 !! html/php
14018 <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>
14019 </p>
14020 !! html/parsoid
14021 <p><span class="mw-default-size b" typeof="mw:Image" data-mw='{"caption":"a"}'><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></span></p>
14022 !! end
14024 !! test
14025 Localized image handling (1).
14026 !! options
14027 parsoid=wt2html,wt2wt,html2html
14028 language=es
14029 !! wikitext
14030 [[Archivo:Foobar.jpg|izquierda|enlace=foo|caption]]
14031 !! html/php
14032 <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>
14034 !! html/parsoid
14035 <figure class="mw-default-size mw-halign-left" typeof="mw:Image"><a href="./Foo"><img resource="./Archivo:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a><figcaption>caption</figcaption></figure>
14036 !! end
14038 !! test
14039 Localized image handling (2).
14040 !! options
14041 thumbsize=220
14042 parsoid=wt2html,wt2wt,html2html
14043 language=es
14044 !! wikitext
14045 [[Archivo:Foobar.jpg|miniatura|izquierda|enlace=foo|caption]]
14046 !! html/php
14047 <div class="thumb tleft"><div class="thumbinner" style="width:222px;"><a href="/wiki/Foo" title="Foo"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" width="220" height="25" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/330px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/440px-Foobar.jpg 2x" /></a>  <div class="thumbcaption"><div class="magnify"><a href="/wiki/Archivo:Foobar.jpg" class="internal" title="Aumentar"></a></div>caption</div></div></div>
14049 !! html/parsoid
14050 <figure class="mw-default-size mw-halign-left" typeof="mw:Image/Thumb"><a href="Foo"><img resource="./Archivo:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption>caption</figcaption></figure>
14051 !! end
14053 !! test
14054 Localized image handling (3).
14055 !! options
14056 language=fa
14057 parsoid=html2wt
14058 !! html/parsoid
14059 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a></figure>
14060 !! wikitext
14061 [[File:Foobar.jpg|بندانگشتی]]
14062 !! end
14064 !! test
14065 "border", "frameless" and "class" attributes on an image.
14066 !! options
14067 thumbsize=220
14068 parsoid=wt2html,wt2wt,html2html
14069 !! wikitext
14070 [[File:Foobar.jpg|frameless|border|class=extra|caption]]
14071 !! html/php
14072 <p><a href="/wiki/File:Foobar.jpg" class="image" title="caption"><img alt="caption" src="http://example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" width="220" height="25" class="extra thumbborder" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/330px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/440px-Foobar.jpg 2x" /></a>
14073 </p>
14074 !! html/parsoid
14075 <p><span class="mw-default-size mw-image-border extra" typeof="mw:Image/Frameless" data-mw='{"caption":"caption"}'><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a></span></p>
14076 !! end
14078 # Note that 'right' is the default alignment, despite the misspelled 'righ' below
14079 !! test
14080 Invalid image attributes (bug 62500)
14081 !! options
14082 thumbsize=220
14083 parsoid=wt2html,wt2wt,html2html
14084 !! wikitext
14085 [[File:Foobar.jpg|thumb|float|left|caption]]
14087 [[File:Foobar.jpg|thumb|righ|caption]]
14089 [[File:Foobar.jpg|bogus1|thumb|bogus2|left|bogus3|caption]]
14090 !! html/php
14091 <div class="thumb tleft"><div class="thumbinner" style="width:222px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" width="220" height="25" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/330px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/440px-Foobar.jpg 2x" /></a>  <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>caption</div></div></div>
14092 <div class="thumb tright"><div class="thumbinner" style="width:222px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" width="220" height="25" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/330px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/440px-Foobar.jpg 2x" /></a>  <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>caption</div></div></div>
14093 <div class="thumb tleft"><div class="thumbinner" style="width:222px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" width="220" height="25" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/330px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/440px-Foobar.jpg 2x" /></a>  <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>caption</div></div></div>
14095 !! html/parsoid
14096 <figure class="mw-default-size mw-halign-left" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption>caption</figcaption></figure>
14097 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption>caption</figcaption></figure>
14098 <figure class="mw-default-size mw-halign-left" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption>caption</figcaption></figure>
14099 !! end
14101 !! article
14102 File:Barfoo.jpg
14103 !! text
14104 #REDIRECT [[File:Barfoo.jpg]]
14105 !! endarticle
14107 # FIXME: Parsoid should run this test -- but we'd need to teach the
14108 # mockAPI about the redirected Barfoo.jpg image.
14109 !! test
14110 Redirected image
14111 !! wikitext
14112 [[Image:Barfoo.jpg]]
14113 !! html/php
14114 <p><a href="/wiki/File:Barfoo.jpg" class="mw-redirect" title="File:Barfoo.jpg">File:Barfoo.jpg</a>
14115 </p>
14116 !! end
14118 !! test
14119 Missing image with uploads disabled
14120 !! options
14121 wgEnableUploads=0
14122 !! wikitext
14123 [[File:Foobaz.jpg]]
14124 !! html/php
14125 <p><a href="/wiki/File:Foobaz.jpg" title="File:Foobaz.jpg">File:Foobaz.jpg</a>
14126 </p>
14127 !! html/parsoid
14128 <p><span class="mw-default-size" typeof="mw:Error mw:Image" data-mw='{"errors":[{"key":"missing-image","message":"This image does not exist."}]}'><a href="./File:Foobaz.jpg"><img resource="./File:Foobaz.jpg" src="./Special:FilePath/Foobaz.jpg" height="220" width="220"/></a></span></p>
14129 !! end
14131 # Parsoid-specific testing for images
14132 # https://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec#Images
14133 # Currently imperfect due to a flaw in the Parsoid testrunner
14134 # Work in progress
14135 # THESE TESTS SHOULD BE MOVED UP and merged with the php-specific
14136 # image tests.
14138 !! test
14139 Parsoid-specific image handling - simple image with size and middle alignment
14140 !! wikitext
14141 [[File:Foobar.jpg|middle|50px]]
14142 !! html/parsoid
14143 <p><span class="mw-valign-middle" typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/50px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="6" width="50"/></a></span></p>
14144 !! end
14146 !! test
14147 Parsoid-specific image handling - simple image with size, middle alignment,
14148 non-standard namespace alias
14149 !! options
14150 parsoid=wt2wt,wt2html,html2html
14151 !! wikitext
14152 [[Image:Foobar.jpg|middle|50px]]
14153 !! html/parsoid
14154 <p><span class="mw-valign-middle" typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/50px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="6" width="50"/></a></span></p>
14155 !! end
14157 !! test
14158 Parsoid-specific image handling - simple image with size and middle alignment
14159 (existing content)
14160 !! wikitext
14161 [[File:Foobar.jpg|50px|middle]]
14162 !! html/parsoid
14163 <p><span class="mw-valign-middle" typeof="mw:Image" data-parsoid='{"optList":[{"ck":"width","ak":"50px"},{"ck":"middle","ak":"middle"}]}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"}}'><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/50px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="6" width="50" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"6","width":"50"},"sa":{"resource":"File:Foobar.jpg"}}'/></a></span></p>
14164 !! end
14166 !! test
14167 Parsoid-specific image handling - simple image with size and middle alignment
14168 and non-standard namespace name
14169 !! options
14170 parsoid=wt2html,wt2wt,html2html
14171 !! wikitext
14172 [[Image:Foobar.jpg|50px|middle]]
14173 !! html/parsoid
14174 <p><span class="mw-valign-middle" typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/50px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="6" width="50"/></a></span></p>
14175 !! end
14177 !! test
14178 Parsoid-specific image handling - simple image with both sizes, a baseline alignment, and a caption
14179 !! wikitext
14180 [[File:Foobar.jpg|500x10px|baseline|caption]]
14181 !! html/parsoid
14182 <p><span class="mw-valign-baseline" typeof="mw:Image" data-mw='{"caption":"caption"}' data-parsoid='{"optList":[{"ck":"width","ak":"500x10px"},{"ck":"baseline","ak":"baseline"},{"ck":"caption","ak":"caption"}],"size":"500x10"}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"}}'><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/89px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="10" width="89" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"10","width":"89"},"sa":{"resource":"File:Foobar.jpg"}}'/></a></span></p>
14183 !! end
14185 !! test
14186 Parsoid-specific image handling - simple image with border and size spec
14187 !! wikitext
14188 [[File:Foobar.jpg|50px|border|caption]]
14189 !! html/parsoid
14190 <p><span class="mw-image-border" typeof="mw:Image" data-mw='{"caption":"caption"}' data-parsoid='{"optList":[{"ck":"width","ak":"50px"},{"ck":"border","ak":"border"},{"ck":"caption","ak":"caption"}]}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"}}'><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/50px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="6" width="50" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"6","width":"50"},"sa":{"resource":"File:Foobar.jpg"}}'/></a></span></p>
14191 !! end
14193 !! test
14194 Parsoid-specific image handling - thumbnail with halign, valign, and caption
14195 !! wikitext
14196 [[File:Foobar.jpg|left|baseline|thumb|caption content]]
14197 !! html/parsoid
14198 <figure class="mw-default-size mw-halign-left mw-valign-baseline" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption>caption content</figcaption></figure>
14199 !! end
14201 !! test
14202 Parsoid-specific image handling - thumbnail with halign, valign, and caption
14203 (existing content)
14204 !! wikitext
14205 [[File:Foobar.jpg|thumb|left|baseline|caption content]]
14206 !! html/parsoid
14207 <figure class="mw-default-size mw-halign-left mw-valign-baseline" typeof="mw:Image/Thumb" data-parsoid='{"optList":[{"ck":"thumbnail","ak":"thumb"},{"ck":"left","ak":"left"},{"ck":"baseline","ak":"baseline"},{"ck":"caption","ak":"caption content"}]}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"}}'><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"25","width":"220"},"sa":{"resource":"File:Foobar.jpg"}}'/></a><figcaption>caption content</figcaption></figure>
14208 !! end
14210 !! test
14211 Parsoid-specific image handling - thumbnail with specific size, halign, valign, and caption
14212 !! wikitext
14213 [[Image:Foobar.jpg|right|middle|thumb|50x50px|caption]]
14214 !! html/parsoid
14215 <figure class="mw-halign-right mw-valign-middle" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/50px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="6" width="50"/></a><figcaption>caption</figcaption></figure>
14216 !! end
14218 !! test
14219 Parsoid-specific image handling - thumbnail with specific size, halign,
14220 valign, and caption (existing content)
14221 !! wikitext
14222 [[File:Foobar.jpg|thumb|50x50px|right|middle|caption]]
14223 !! html/parsoid
14224 <figure class="mw-halign-right mw-valign-middle" typeof="mw:Image/Thumb" data-parsoid='{"optList":[{"ck":"thumbnail","ak":"thumb"},{"ck":"width","ak":"50x50px"},{"ck":"right","ak":"right"},{"ck":"middle","ak":"middle"},{"ck":"caption","ak":"caption"}],"size":"50x50"}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"}}'><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/50px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="6" width="50" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"6","width":"50"},"sa":{"resource":"File:Foobar.jpg"}}'/></a><figcaption>caption</figcaption></figure>
14225 !! end
14227 !! test
14228 Parsoid-specific image handling - framed image with specific size and caption
14229 (size is ignored)
14230 !! options
14231 parsoid=wt2html,wt2wt,html2html
14232 !! wikitext
14233 [[File:Foobar.jpg|frame|500x50px|caption]]
14234 !! html/parsoid
14235 <figure typeof="mw:Image/Frame"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a><figcaption>caption</figcaption></figure>
14236 !! end
14238 !! test
14239 Parsoid-specific image handling - framed image with specific size, halign, valign, and caption
14240 (size is ignored)
14241 !! options
14242 parsoid=wt2html,wt2wt,html2html
14243 !! wikitext
14244 [[File:Foobar.jpg|left|baseline|frame|500x50px|caption]]
14245 !! html/parsoid
14246 <figure class="mw-halign-left mw-valign-baseline" typeof="mw:Image/Frame"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a><figcaption>caption</figcaption></figure>
14247 !! end
14249 !! test
14250 Parsoid-specific image handling - frameless image with specific size, border, and caption
14251 !! wikitext
14252 [[File:Foobar.jpg|frameless|442x50px|border|caption]]
14253 !! html/parsoid
14254 <p><span class="mw-image-border" typeof="mw:Image/Frameless" data-mw='{"caption":"caption"}' data-parsoid='{"optList":[{"ck":"frameless","ak":"frameless"},{"ck":"width","ak":"442x50px"},{"ck":"border","ak":"border"},{"ck":"caption","ak":"caption"}],"size":"442x50"}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"}}'><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/442px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="50" width="442" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"50","width":"442"},"sa":{"resource":"File:Foobar.jpg"}}'/></a></span></p>
14255 !! end
14257 !! test
14258 Parsoid-specific image handling - simple image with a formatted caption
14259 !! wikitext
14260 [[File:Foobar.jpg|<table><tr><td>a</td><td>b</td></tr><tr><td>c</td></tr></table>]]
14261 !! html/parsoid
14262 <p><span class="mw-default-size" typeof="mw:Image" data-parsoid='{"optList":[{"ck":"caption","ak":"&lt;table>&lt;tr>&lt;td>a&lt;/td>&lt;td>b&lt;/td>&lt;/tr>&lt;tr>&lt;td>c&lt;/td>&lt;/tr>&lt;/table>"}]}' data-mw='{"caption":"&lt;table data-parsoid=&#39;{\"stx\":\"html\",\"dsr\":[18,81,7,8]}&#39;>&lt;tbody data-parsoid=&#39;{\"dsr\":[25,73,0,0]}&#39;>&lt;tr data-parsoid=&#39;{\"stx\":\"html\",\"dsr\":[25,54,4,5]}&#39;>&lt;td data-parsoid=&#39;{\"stx\":\"html\",\"dsr\":[29,39,4,5]}&#39;>a&lt;/td>&lt;td data-parsoid=&#39;{\"stx\":\"html\",\"dsr\":[39,49,4,5]}&#39;>b&lt;/td>&lt;/tr>&lt;tr data-parsoid=&#39;{\"stx\":\"html\",\"dsr\":[54,73,4,5]}&#39;>&lt;td data-parsoid=&#39;{\"stx\":\"html\",\"dsr\":[58,68,4,5]}&#39;>c&lt;/td>&lt;/tr>&lt;/tbody>&lt;/table>"}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"},"sa":{}}'><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"220","width":"1941"},"sa":{"resource":"File:Foobar.jpg"}}'/></a></span></p>
14263 !! end
14265 !! test
14266 Parsoid-specific image handling - caption with a template in it
14267 !! wikitext
14268 [[File:Foobar.jpg|thumb|200x23px|This caption has a {{echo|transclusion}} in it.]]
14269 !! html/parsoid
14270 <figure typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/200px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="23" width="200"></a><figcaption>This caption has a <span about="#mwt1" typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[{&quot;template&quot;:{&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;transclusion&quot;}},&quot;i&quot;:0}}]}">transclusion</span> in it.</figcaption></figure>
14271 !! end
14273 !! test
14274 Parsoid-specific image handling - caption with unbalanced tags in it
14275 !! options
14276 parsoid=wt2html,wt2wt,html2html
14277 !! wikitext
14279 [[File:Foobar.jpg|thumb|200x200px|This caption has a <center>unbalanced tag in it.]]
14281 !! html/parsoid
14282 <p>foo</p>
14283 <figure typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/200px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="23" width="200"/></a><figcaption>This caption has a <center>unbalanced tag in it.</center></figcaption></figure>
14284 <p>bar</p>
14285 !! end
14287 !! test
14288 Parsoid-specific image handling - empty caption (1)
14289 !! options
14290 parsoid=wt2html,wt2wt
14291 !! wikitext
14292 [[File:Foobar.jpg|thumb|]]
14293 !! html/parsoid
14294 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption></figcaption></figure>
14295 !! end
14297 # empty captions don't get serialized unless we're in the "round trip" case
14298 !! test
14299 Parsoid-specific image handling - empty caption (2)
14300 !! options
14301 parsoid=html2wt
14302 !! html/parsoid
14303 <figure class="mw-default-size" typeof="mw:Image/Thumb">
14304   <a href="./File:Foobar.jpg">
14305     <img resource="./File:Foobar.jpg"
14306          src="//example.com/images/3/3a/Foobar.jpg"
14307          data-file-width="1941" data-file-height="220" data-file-type="bitmap"
14308          height="25" width="220"/>
14309   </a>
14310   <figcaption></figcaption>
14311 </figure>
14312 !! wikitext
14313 [[File:Foobar.jpg|thumb]]
14314 !! end
14316 !! test
14317 Parsoid-specific image handling - whitespace caption
14318 !! wikitext
14319 [[File:Foobar.jpg|thumb| ]]
14320 !! html/parsoid
14321 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption> </figcaption></figure>
14322 !! end
14324 !! test
14325 Parsoid-specific image handling - lang option
14326 !! wikitext
14328 [[File:Foobar.svg|lang=de|caption]]
14330 !! html/parsoid
14331 <p>foo
14332 <span class="mw-default-size" typeof="mw:Image" data-mw='{"caption":"caption"}'><a href="./File:Foobar.svg"><img resource="./File:Foobar.svg" src="//example.com/images/f/ff/Foobar.svg" lang="de" data-file-width="240" data-file-height="180" data-file-type="drawing" height="180" width="240"/></a></span>
14333 bar</p>
14334 !! end
14336 ## Edge case bugs in Parsoid from T93580
14337 !! test
14338 T93580: 1. Templated <ref> inside block images
14339 !! wikitext
14340 [[File:Foobar.jpg|thumb|Caption with templated ref: {{echo|<ref>foo</ref>}}]]
14342 <references />
14343 !! html/parsoid
14344 <figure class="mw-default-size" typeof="mw:Image/Thumb" data-parsoid='{"optList":[{"ck":"thumbnail","ak":"thumb"},{"ck":"caption","ak":"Caption with templated ref: {{echo|&lt;ref>foo&lt;/ref>}}"}]}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"},"sa":{}}'><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"25","width":"220"},"sa":{"resource":"File:Foobar.jpg"}}'/></a><figcaption>Caption with templated ref: <span about="#mwt5" class="mw-ref" id="cite_ref-1" rel="dc:references" typeof="mw:Transclusion  mw:Extension/ref" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;ref>foo&lt;/ref>"}},"i":0}}]}'><a href="#cite_note-1" style="counter-reset: mw-Ref 1;"><span class="mw-reflink-text">[1]</span></a></span></figcaption></figure>
14346 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'><li about="#cite_note-1" id="cite_note-1"><a href="#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text" data-parsoid="{}">foo</span></li></ol>
14347 !! end
14349 !! test
14350 T93580: 2. <ref> inside inline images
14351 !! wikitext
14352 [[File:Foobar.jpg|Undisplayed caption in inline image with ref: <ref>foo</ref>]]
14354 <references />
14355 !! html/parsoid
14356 <p><span class="mw-default-size" typeof="mw:Image" data-parsoid='{"optList":[{"ck":"caption","ak":"Undisplayed caption in inline image with ref: &lt;ref>foo&lt;/ref>"}]}' data-mw='{"caption":"Undisplayed caption in inline image with ref: &lt;span about=\"#mwt2\" class=\"mw-ref\" id=\"cite_ref-1\" rel=\"dc:references\" typeof=\"mw:Extension/ref\" data-parsoid=&#39;{\"dsr\":[64,78,5,6]}&#39; data-mw=&#39;{\"name\":\"ref\",\"body\":{\"id\":\"mw-reference-text-cite_note-1\"},\"attrs\":{}}&#39;>&lt;a href=\"#cite_note-1\" style=\"counter-reset: mw-Ref 1;\" data-parsoid=\"{}\">&lt;span class=\"mw-reflink-text\" data-parsoid=\"{}\">[1]&lt;/span>&lt;/a>&lt;/span>&lt;meta typeof=\"mw:Extension/ref/Marker\" about=\"#mwt2\" data-parsoid=&#39;{\"group\":\"\",\"name\":\"\",\"content\":\"foo\",\"hasRefInRef\":false,\"dsr\":[64,78,5,6]}&#39;/>"}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"},"sa":{}}'><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"220","width":"1941"},"sa":{"resource":"File:Foobar.jpg"}}'/></a></span></p>
14358 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'><li about="#cite_note-1" id="cite_note-1"><a href="#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text" data-parsoid="{}">foo</span></li></ol>
14359 !! end
14361 !! test
14362 T93580: 3. Templated <ref> inside inline images
14363 !! wikitext
14364 [[File:Foobar.jpg|Undisplayed caption in inline image with ref: {{echo|<ref>{{echo|foo}}</ref>}}]]
14366 <references />
14367 !! html/parsoid
14368 <p><span class="mw-default-size" typeof="mw:Image" data-parsoid='{"optList":[{"ck":"caption","ak":"Undisplayed caption in inline image with ref: {{echo|&lt;ref>{{echo|foo}}&lt;/ref>}}"}]}' data-mw='{"caption":"Undisplayed caption in inline image with ref: &lt;span about=\"#mwt2\" class=\"mw-ref\" id=\"cite_ref-1\" rel=\"dc:references\" typeof=\"mw:Transclusion  mw:Extension/ref\" data-parsoid=&#39;{\"dsr\":[64,96,null,null],\"pi\":[[{\"k\":\"1\"}]]}&#39; data-mw=&#39;{\"parts\":[{\"template\":{\"target\":{\"wt\":\"echo\",\"href\":\"./Template:Echo\"},\"params\":{\"1\":{\"wt\":\"&amp;lt;ref>{{echo|foo}}&amp;lt;/ref>\"}},\"i\":0}}]}&#39;>&lt;a href=\"#cite_note-1\" style=\"counter-reset: mw-Ref 1;\" data-parsoid=\"{}\">&lt;span class=\"mw-reflink-text\" data-parsoid=\"{}\">[1]&lt;/span>&lt;/a>&lt;/span>&lt;meta typeof=\"mw:Transclusion mw:Extension/ref/Marker\" about=\"#mwt2\" data-parsoid=&#39;{\"group\":\"\",\"name\":\"\",\"content\":\"foo\",\"hasRefInRef\":false,\"dsr\":[64,96,null,null],\"pi\":[[{\"k\":\"1\"}]]}&#39; data-mw=&#39;{\"parts\":[{\"template\":{\"target\":{\"wt\":\"echo\",\"href\":\"./Template:Echo\"},\"params\":{\"1\":{\"wt\":\"&amp;lt;ref>{{echo|foo}}&amp;lt;/ref>\"}},\"i\":0}}]}&#39;/>"}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"},"sa":{}}'><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"220","width":"1941"},"sa":{"resource":"File:Foobar.jpg"}}'/></a></span></p>
14370 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'><li about="#cite_note-1" id="cite_note-1"><a href="#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text" data-parsoid="{}">foo</span></li></ol>
14371 !! end
14374 ### Subpages
14376 !! article
14377 Subpage test/subpage
14378 !! text
14380 !! endarticle
14382 !! test
14383 Subpage link
14384 !! options
14385 subpage title=[[Subpage test]]
14386 !! wikitext
14387 [[/subpage]]
14388 !! html
14389 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a>
14390 </p>
14391 !! end
14393 !! test
14394 Subpage noslash link
14395 !! options
14396 subpage title=[[Subpage test]]
14397 !! wikitext
14398 [[/subpage/]]
14399 !! html
14400 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">subpage</a>
14401 </p>
14402 !! end
14404 !! article
14405 Subpage test/1/2/subpage
14406 !! text
14407 blah
14408 !! endarticle
14410 !! test
14411 Relative subpage noslash link
14412 !! options
14413 parsoid=wt2wt,wt2html,html2html
14414 subpage title=[[Subpage test/1/2/3/4]]
14415 !! wikitext
14416 [[../../subpage/]]
14418 [[../../subpage]]
14419 !! html/php
14420 <p><a href="/wiki/Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">subpage</a>
14421 </p><p><a href="/wiki/Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">Subpage test/1/2/subpage</a>
14422 </p>
14423 !! html/parsoid
14424 <p><a rel="mw:WikiLink" href="Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">subpage</a></p>
14425 <p><a rel="mw:WikiLink" href="Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">Subpage_test/1/2/subpage</a></p>
14426 !! end
14428 !! test
14429 Parsoid: dot-slash prefixed wikilinks
14430 !! wikitext
14431 [[./foo]]
14433 [[././bar]]
14435 [[././baz/]]
14436 !! html/php
14437 <p>[[./foo]]
14438 </p><p>[[././bar]]
14439 </p><p>[[././baz/]]
14440 </p>
14441 !! html/parsoid
14442 <p>[[./foo]]
14443 </p><p>[[././bar]]
14444 </p><p>[[././baz/]]
14445 </p>
14446 !! end
14448 !! test
14449 Render invalid page names as plain text (bug 51090)
14450 !! wikitext
14451 [[./../foo|bar]]
14452 [[foo�|bar]]
14453 [[foo/.|bar]]
14454 [[foo/..|bar]]
14455 [[foo~~~bar]]
14456 [[foo>bar]]
14457 [[foo[bar]]
14458 [[.]]
14459 [[..]]
14460 [[foo././bar]]
14462 [[{{echo|./../foo}}|bar]]
14463 [[{{echo|foo/.}}|bar]]
14464 [[{{echo|foo/..}}|bar]]
14465 [[{{echo|foo~~~~bar}}]]
14466 [[{{echo|foo>bar}}]]
14467 [[{{echo|foo././bar}}]]
14468 [[{{echo|foo{bar}}]]
14469 [[{{echo|foo}bar}}]]
14470 [[{{echo|foo[bar}}]]
14471 [[{{echo|foo]bar}}]]
14472 [[{{echo|foo<bar}}]]
14473 !!html/php
14474 <p>[[./../foo|bar]]
14475 [[foo�|bar]]
14476 [[foo/.|bar]]
14477 [[foo/..|bar]]
14478 [[foo~~~bar]]
14479 [[foo&gt;bar]]
14480 [[foo[bar]]
14481 [[.]]
14482 [[..]]
14483 [[foo././bar]]
14484 </p><p>[[./../foo|bar]]
14485 [[foo/.|bar]]
14486 [[foo/..|bar]]
14487 [[foo~~~~bar]]
14488 [[foo&gt;bar]]
14489 [[foo././bar]]
14490 [[foo{bar]]
14491 [[foo}bar]]
14492 [[foo[bar]]
14493 [[foo]bar]]
14494 [[foo&lt;bar]]
14495 </p>
14496 !!html/parsoid
14497 <p>[[./../foo|bar]]
14498 [[foo�|bar]]
14499 [[foo/.|bar]]
14500 [[foo/..|bar]]
14501 [[foo~~~bar]]
14502 [[foo>bar]]
14503 [[foo[bar]]
14504 [[.]]
14505 [[..]]
14506 [[foo././bar]]</p>
14508 <p>[[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"./../foo"}},"i":0}}]}'>./../foo</span>|bar]]
14509 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo/."}},"i":0}}]}'>foo/.</span>|bar]]
14510 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo/.."}},"i":0}}]}'>foo/..</span>|bar]]
14511 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo~~~~bar"}},"i":0}}]}'>foo~~~~bar</span>]]
14512 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo>bar"}},"i":0}}]}'>foo>bar</span>]]
14513 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo././bar"}},"i":0}}]}'>foo././bar</span>]]
14514 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo{bar"}},"i":0}}]}'>foo{bar</span>]]
14515 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo}bar"}},"i":0}}]}'>foo}bar</span>]]
14516 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo[bar"}},"i":0}}]}'>foo[bar</span>]]
14517 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo]bar"}},"i":0}}]}'>foo]bar</span>]]
14518 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo&lt;bar"}},"i":0}}]}'>foo&lt;bar</span>]]</p>
14519 !!end
14521 !! test
14522 Disabled subpages
14523 !! wikitext
14524 [[/subpage]]
14525 !! html
14526 <p><a href="/index.php?title=/subpage&amp;action=edit&amp;redlink=1" class="new" title="/subpage (page does not exist)">/subpage</a>
14527 </p>
14528 !! end
14530 !! test
14531 BUG 561: {{/Subpage}}
14532 !! options
14533 subpage title=[[Page]]
14534 !! wikitext
14535 {{/Subpage}}
14536 !! html
14537 <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>
14538 </p>
14539 !! end
14542 ### Categories
14544 !! article
14545 Category:MediaWiki User's Guide
14546 !! text
14547 blah
14548 !! endarticle
14550 !! test
14551 Link to category
14552 !! wikitext
14553 [[:Category:MediaWiki User's Guide]]
14554 !! html
14555 <p><a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">Category:MediaWiki User's Guide</a>
14556 </p>
14557 !! end
14559 !! test
14560 Simple category
14561 !! options
14563 !! wikitext
14564 [[Category:MediaWiki User's Guide]]
14565 !! html
14566 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
14567 !! end
14569 !! test
14570 PAGESINCATEGORY invalid title fatal (r33546 fix)
14571 !! wikitext
14572 {{PAGESINCATEGORY:<bogus>}}
14573 !! html
14574 <p>0
14575 </p>
14576 !! end
14578 !! test
14579 Category with different sort key
14580 !! options
14582 !! wikitext
14583 [[Category:MediaWiki User's Guide|Foo]]
14584 !! html
14585 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
14586 !! end
14588 !! test
14589 Category with identical sort key
14590 !! options
14592 !! wikitext
14593 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
14594 !! html
14595 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
14596 !! end
14598 !! test
14599 Category with empty sort key
14600 !! options
14603 !! wikitext
14604 [[Category:MediaWiki User's Guide|]]
14605 !! html/php
14606 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
14607 !! end
14609 !! test
14610 Category with empty sort key and parentheses
14611 !! options
14614 !! wikitext
14615 [[Category:Foo (bar)|]]
14616 !! html/php
14617 [[Category:Foo (bar)|Foo]]
14618 !! end
14620 ## We used to, but no longer wt2wt this test since the default serializer
14621 ## will normalize all categories to serialize on their own line.
14622 ## This wikitext usage is going to be fairly uncommon in production and
14623 ## selser will take care of preserving formatting in those scenarios.
14624 !! test
14625 Category with link tail
14626 !! options
14629 parsoid=wt2html
14630 !! wikitext
14631 123[[Category:Foo]]456
14632 !! html/php
14633 123[[Category:Foo]]456
14634 !! html/parsoid
14635 <p>123<link rel="mw:PageProp/Category" href="Category:Foo"/>456</p>
14636 !! end
14638 !! test
14639 Category with template
14640 !! options
14643 !! wikitext
14644 [[Category:{{echo|Foo}}]]
14645 !! html/php
14646 [[Category:{{echo|Foo}}]]
14647 !! end
14649 !! test
14650 Category with template in sort key
14651 !! options
14654 !! wikitext
14655 [[Category:Foo|{{echo|Bar}}]]
14656 !! html/php
14657 [[Category:Foo|{{echo|Bar}}]]
14658 !! end
14660 !! test
14661 Category with template in sort key and title
14662 !! options
14665 !! wikitext
14666 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
14667 !! html/php
14668 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
14669 !! end
14671 ## We used to, but no longer wt2wt this test since the default serializer
14672 ## will normalize all categories to serialize on their own line.
14673 ## This wikitext usage is going to be fairly uncommon in production and
14674 ## selser will take care of preserving formatting in those scenarios.
14675 !! test
14676 Category / paragraph interactions
14677 !! options
14678 parsoid=wt2html
14679 !! wikitext
14680 Foo [[Category:Baz]] Bar
14682 Foo [[Category:Baz]]
14686 [[Category:Baz]]
14690 [[Category:Baz]] Bar
14693 [[Category:Baz]]
14694  [[Category:Baz]]
14695 [[Category:Baz]]
14698 [[Category:Baz]]
14699  [[Category:Baz]]
14700 [[Category:Baz]]
14702 [[Category:Baz]]
14703  {{echo|[[Category:Baz]]}}
14704 [[Category:Baz]]
14705 !! html/php
14706 <p>Foo Bar
14707 </p><p>Foo
14709 </p><p>Foo
14711 </p><p>Foo Bar
14712 </p><p>Foo
14714 </p>
14715 !! html/parsoid
14716 <p>Foo <link rel="mw:PageProp/Category" href="Category:Baz"/> Bar</p>
14717 <p>Foo <link rel="mw:PageProp/Category" href="Category:Baz"/> Bar</p>
14718 <p>Foo <link rel="mw:PageProp/Category" href="Category:Baz"/> Bar</p>
14719 <p>Foo <link rel="mw:PageProp/Category" href="Category:Baz"/> Bar</p>
14720 <p>Foo <link rel="mw:PageProp/Category" href="Category:Baz"/> <link rel="mw:PageProp/Category" href="Category:Baz"/> <link rel="mw:PageProp/Category" href="Category:Baz"/> Bar <link rel="mw:PageProp/Category" href="Category:Baz"/> <link rel="mw:PageProp/Category" href="Category:Baz"/> <link rel="mw:PageProp/Category" href="Category:Baz"/> <link rel="mw:PageProp/Category" href="Category:Baz"/> <link rel="mw:PageProp/Category" href="Category:Baz" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[[Category:Baz]]"}},"i":0}}]}'/></p>
14721 <link rel="mw:PageProp/Category" href="Category:Baz"/>
14722 !! end
14724 ## We used to, but no longer wt2wt this test since the default serializer
14725 ## will normalize all categories to serialize on their own line.
14726 ## This wikitext usage is going to be fairly uncommon in production and
14727 ## selser will take care of preserving formatting in those scenarios.
14729 ## The whitespace on the empty line is part of the test. Please do not delete
14730 !! test
14731 1. Categories and newlines: All preceding newlines should be suppressed (courtesy bug 87)
14732 !! options
14733 parsoid=wt2html
14734 !! wikitext
14735 This
14736    
14737 [[Category:Foo]] and this should be part of same paragraph (not an indent-pre)
14738    
14739 {{echo|[[Category:Foo]] and so should this!}}
14740 !! html/php
14741 <p>This and this should be part of same paragraph (not an indent-pre) and so should this!
14742 </p>
14743 !! html/parsoid
14744 <p>This
14745    
14746 <link rel="mw:PageProp/Category" href="./Category:Foo"/> and this should be part of same paragraph (not an indent-pre)
14747    
14748 <link rel="mw:PageProp/Category" href="./Category:Foo" about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[[Category:Foo]] and so should this!"}},"i":0}}]}'/><span about="#mwt1"> and so should this!</span></p>
14749 !! end
14751 ## Parsoid will not try to wt2wt this while preserving newlines because
14752 ## it suppresses excess newlines within list items -- and we don't want to
14753 ## introduce a special case just for categories, which is, in reality somewhat
14754 ## odd behavior -- categories are unlikely to be used in list items like this
14755 ## in top-level pages and are only likely to show up in template-generated
14756 ## list items where this RT-ing is a non-issue.
14758 ## The whitespace on the empty line is part of the test. Please do not delete
14759 !! test
14760 2. Categories and newlines: All preceding newlines should be suppressed (courtesy bug 87)
14761 !! options
14762 parsoid=wt2html
14763 !! wikitext
14764 * This
14765    
14766 [[Category:Foo]] and this should be part of the same list item
14767 * So should this
14769 {{echo|[[Category:Foo]] and this should be part of the same list item}}
14770 !! html
14771 <ul><li>This and this should be part of the same list item</li>
14772 <li>So should this and this should be part of the same list item</li></ul>
14773 !! html/parsoid
14774 <ul>
14775 <li>This <link rel="mw:PageProp/Category" href="./Category:Foo"/> and this should be part of the same list item</li>
14776 <li>So should this <link rel="mw:PageProp/Category" href="./Category:Foo" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[[Category:Foo]] and this should be part of the same list item"}},"i":0}}]}'/><span> and this should be part of the same list item</span></li>
14777 </ul>
14778 !! end
14780 ## Newlines and categories that follow the last item of a list
14781 ## are treated differently because this (list followed by categories)
14782 ## is an extremely common pattern on wikis.
14783 !! test
14784 3. Categories and newlines: newline suppression for last list item should RT properly
14785 !! wikitext
14786 * a
14787 * b 
14788    
14789 [[Category:Foo]]
14790    
14791 [[Category:Bar]]
14792 [[Category:Baz]]
14793 !! html/parsoid
14794 <ul><li> a</li>
14795 <li> b</li></ul> 
14796    
14797 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/>
14798    
14799 <link rel="mw:PageProp/Category" href="./Category:Bar" data-parsoid='{"stx":"simple","a":{"href":"./Category:Bar"},"sa":{"href":"Category:Bar"}}'/>
14800 <link rel="mw:PageProp/Category" href="./Category:Baz" data-parsoid='{"stx":"simple","a":{"href":"./Category:Baz"},"sa":{"href":"Category:Baz"}}'/>
14801 !! end
14803 !! test
14804 4. Categories and newlines: newline suppression for last list item should RT properly
14805 !! wikitext
14806 * a
14807 **** b
14809 [[Category:Foo]]
14810 !! html/parsoid
14811 <ul><li> a
14812 <ul><li><ul><li><ul><li> b</li></ul></li></ul></li></ul></li></ul>
14814 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/>
14815 !! end
14817 ## only wt2html for this to make sure the algo only applies to the rightmost path
14818 !! test
14819 5. Categories and newlines: migrateTrailingCategories dom pass should only run on the rightmost path of nested lists
14820 !! options
14821 parsoid=wt2html
14822 !! wikitext
14823 * a
14824 ** b
14825 [[Category:Foo]]
14826 * c
14827 ** d
14828 [[Category:Foo]]
14829 !! html/parsoid
14830 <ul><li> a
14831 <ul><li> b
14832 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/></li></ul></li>
14833 <li> c
14834 <ul><li> d</li></ul></li></ul>
14835 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/>
14836 !! end
14838 ## We used to, but no longer wt2wt this test since the default serializer
14839 ## will normalize all categories to serialize on their own line.
14840 ## This wikitext usage is going to be fairly uncommon in production and
14841 ## selser will take care of preserving formatting in those scenarios.
14842 !! test
14843 6. Categories and newlines: migrateTrailingCategories dom pass should not migrate categories not preceded by newlines
14844 !! options
14845 parsoid=wt2html
14846 !! wikitext
14847 * a [[Category:Foo]]
14848 !! html/parsoid
14849 <ul><li>a <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/></li></ul>
14850 !! end
14852 # This test also demonstrates because of newline+category tunneling
14853 # through the list hander, template wrapping doesn't expand to the
14854 # containing list when the list item swallows the category.
14855 !! test
14856 7. Categories and newlines: migrateTrailingCategories dom pass should leave template content alone
14857 !! wikitext
14858 * {{echo|a
14859 [[Category:Foo]]}}
14860 !! html/parsoid
14861 <ul><li> <span about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"pi":[[{"k":"1"}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"a\n[[Category:Foo]]"}},"i":0}}]}'>a
14862 </span><link rel="mw:PageProp/Category" href="./Category:Foo" about="#mwt1" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/></li></ul>
14863 !! end
14865 !! test
14866 8. Categories and newlines: migrateTrailingCategories dom pass should not get tripped by intervening templates
14867 !! wikitext
14868 * a
14870 {{echo|[[Category:Foo]]
14871 [[Category:Bar]]}}
14872 [[Category:Baz]]
14873 !! html/parsoid
14874 <ul><li> a</li></ul>
14876 <link rel="mw:PageProp/Category" href="./Category:Foo" about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"},"pi":[[{"k":"1"}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[[Category:Foo]]\n[[Category:Bar]]"}},"i":0}}]}'/><span about="#mwt1">
14877 </span><link rel="mw:PageProp/Category" href="./Category:Bar" about="#mwt1" data-parsoid='{"stx":"simple","a":{"href":"./Category:Bar"},"sa":{"href":"Category:Bar"}}'/>
14878 <link rel="mw:PageProp/Category" href="./Category:Baz" data-parsoid='{"stx":"simple","a":{"href":"./Category:Baz"},"sa":{"href":"Category:Baz"}}'/>
14879 !! end
14881 !! test
14882 Parsoid: Serialize link to category page with colon escape
14883 !! options
14884 parsoid
14885 !! wikitext
14887 [[:Category:Foo]]
14888 [[:Category:Foo|Bar]]
14889 !! html
14891 <a rel="mw:WikiLink" href="./Category:Foo" title="Category:Foo">Category:Foo</a>
14892 <a rel="mw:WikiLink" href="./Category:Foo" title="Category:Foo">Bar</a>
14893 </p>
14894 !! end
14896 # We used to, but no longer wt2wt this test since the default serializer
14897 # will normalize all categories to serialize on their own line.
14898 # This wikitext usage is going to be fairly uncommon in production and
14899 # selser will take care of preventing whitespace insertion if this
14900 # occurs in an article.
14902 # html2html disabled for the same reason (whitespace insertion between
14903 # x and y).
14905 # html2wt disabled because it localizes the "Category" namespace.
14906 !! test
14907 Link prefix/suffixes aren't applied to category links
14908 !! options
14909 parsoid=wt2html
14910 language=is
14911 !! wikitext
14912 x[[Category:Foo]]y
14913 !! html/php
14914 <p>xy
14915 </p>
14916 !! html/parsoid
14917 <p>x<link rel="mw:PageProp/Category" href="./Flokkur:Foo" data-parsoid=""/>y</p>
14918 !! end
14920 !! test
14921 Parsoid: Serialize link to file page with colon escape
14922 !! options
14923 parsoid
14924 !! wikitext
14926 [[:File:Foo.png]]
14927 [[:File:Foo.png|Bar]]
14928 !! html
14930 <a rel="mw:WikiLink" href="./File:Foo.png" title="File:Foo.png">File:Foo.png</a>
14931 <a rel="mw:WikiLink" href="./File:Foo.png" title="File:Foo.png">Bar</a>
14932 </p>
14933 !! end
14935 !! test
14936 Parsoid: Serialize a genuine category link without colon escape
14937 !! options
14938 parsoid
14939 !! wikitext
14940 [[Category:Foo]]
14941 [[Category:Foo|Bar]]
14942 !! html
14943 <link rel="mw:PageProp/Category" href="./Category:Foo">
14944 <link rel="mw:PageProp/Category" href="./Category:Foo#Bar">
14945 !! end
14947 !! test
14948 Normalize hrefs properly before testing for invalid link targets (bug 70894)
14949 !! options
14950 parsoid=html2wt
14951 !! html/parsoid
14952 <link rel="mw:PageProp/Category" href="./Category:Toxine_bactérienne"/>
14953 !! wikitext
14954 [[Category:Toxine bactérienne]]
14955 !! end
14957 !! test
14958 Parsoid: Defaultsort
14959 !! wikitext
14960 {{DEFAULTSORT:Foo}}
14961 !! html/parsoid
14962 <meta property="mw:PageProp/categorydefaultsort" content="Foo"/>
14963 !! end
14965 !! test
14966 Parsoid: Defaultsort (template-generated)
14967 !! wikitext
14968 {{{{echo|DEFAULTSORT}}:Foo}}
14969 !! html/parsoid
14970 <meta property="mw:PageProp/categorydefaultsort" content="Foo" about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"pi":[[]]}' data-mw='{"parts":[{"template":{"target":{"wt":"{{echo|DEFAULTSORT}}:Foo"},"params":{},"i":0}}]}'/>
14971 !! end
14974 ### Inter-language links
14976 !! test
14977 Interlanguage links
14978 !! options
14980 !! wikitext
14981 [[es:Alimento]]
14982 [[fr:Nourriture]]
14983 [[zh:食品]]
14984 !! html/php
14985 es:Alimento fr:Nourriture zh:食品
14986 !! html/parsoid
14987 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Alimento"/>
14988 <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/Nourriture"/>
14989 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/食品"/>
14990 !! end
14992 !! test
14993 Duplicate interlanguage links (bug 24502)
14994 !! options
14996 !! wikitext
14997 [[es:1]]
14998 [[es:2]]
14999 [[fr:1]]
15000 [[fr:2]]
15001 !! html/php
15002 es:1 fr:1
15003 !! html/parsoid
15004 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/1"/>
15005 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/2"/>
15006 <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/1"/>
15007 <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/2"/>
15008 !! end
15011 ### Sections
15013 !! test
15014 Basic section headings
15015 !! wikitext
15016 == Headline 1 ==
15017 Some text
15019 ==Headline 2==
15020 More
15021 ===Smaller headline===
15022 Blah blah
15023 !! html
15024 <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>
15025 <p>Some text
15026 </p>
15027 <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>
15028 <p>More
15029 </p>
15030 <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>
15031 <p>Blah blah
15032 </p>
15033 !! end
15035 !! test
15036 Section headings with TOC
15037 !! wikitext
15038 == Headline 1 ==
15039 === Subheadline 1 ===
15040 ===== Skipping a level =====
15041 ====== Skipping a level ======
15043 == Headline 2 ==
15044 Some text
15045 ===Another headline===
15046 !! html
15047 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15048 <ul>
15049 <li class="toclevel-1 tocsection-1"><a href="#Headline_1"><span class="tocnumber">1</span> <span class="toctext">Headline 1</span></a>
15050 <ul>
15051 <li class="toclevel-2 tocsection-2"><a href="#Subheadline_1"><span class="tocnumber">1.1</span> <span class="toctext">Subheadline 1</span></a>
15052 <ul>
15053 <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>
15054 <ul>
15055 <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>
15056 </ul>
15057 </li>
15058 </ul>
15059 </li>
15060 </ul>
15061 </li>
15062 <li class="toclevel-1 tocsection-5"><a href="#Headline_2"><span class="tocnumber">2</span> <span class="toctext">Headline 2</span></a>
15063 <ul>
15064 <li class="toclevel-2 tocsection-6"><a href="#Another_headline"><span class="tocnumber">2.1</span> <span class="toctext">Another headline</span></a></li>
15065 </ul>
15066 </li>
15067 </ul>
15068 </div>
15070 <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>
15071 <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>
15072 <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>
15073 <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>
15074 <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>
15075 <p>Some text
15076 </p>
15077 <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>
15079 !! end
15081 !! test
15082 TOC anchors don't collide
15083 !! wikitext
15084 __FORCETOC__
15085 == Headline 2 ==
15086 == Headline ==
15087 == Headline 2 ==
15088 == Headline ==
15089 !! html/php
15090 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15091 <ul>
15092 <li class="toclevel-1 tocsection-1"><a href="#Headline_2"><span class="tocnumber">1</span> <span class="toctext">Headline 2</span></a></li>
15093 <li class="toclevel-1 tocsection-2"><a href="#Headline"><span class="tocnumber">2</span> <span class="toctext">Headline</span></a></li>
15094 <li class="toclevel-1 tocsection-3"><a href="#Headline_2_2"><span class="tocnumber">3</span> <span class="toctext">Headline 2</span></a></li>
15095 <li class="toclevel-1 tocsection-4"><a href="#Headline_3"><span class="tocnumber">4</span> <span class="toctext">Headline</span></a></li>
15096 </ul>
15097 </div>
15099 <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=1" title="Edit section: Headline 2">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
15100 <h2><span class="mw-headline" id="Headline">Headline</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">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
15101 <h2><span class="mw-headline" id="Headline_2_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=3" title="Edit section: Headline 2">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
15102 <h2><span class="mw-headline" id="Headline_3">Headline</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: Headline">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
15104 !! end
15106 # perl -e 'print "="x$_," Level $_ heading","="x$_,"\n" for 1..10'
15107 !! test
15108 Handling of sections up to level 6 and beyond
15109 !! wikitext
15110 = Level 1 Heading=
15111 == Level 2 Heading==
15112 === Level 3 Heading===
15113 ==== Level 4 Heading====
15114 ===== Level 5 Heading=====
15115 ====== Level 6 Heading======
15116 ======= Level 7 Heading=======
15117 ======== Level 8 Heading========
15118 ========= Level 9 Heading=========
15119 ========== Level 10 Heading==========
15120 !! html
15121 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15122 <ul>
15123 <li class="toclevel-1 tocsection-1"><a href="#Level_1_Heading"><span class="tocnumber">1</span> <span class="toctext">Level 1 Heading</span></a>
15124 <ul>
15125 <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>
15126 <ul>
15127 <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>
15128 <ul>
15129 <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>
15130 <ul>
15131 <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>
15132 <ul>
15133 <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>
15134 <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>
15135 <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>
15136 <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>
15137 <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>
15138 </ul>
15139 </li>
15140 </ul>
15141 </li>
15142 </ul>
15143 </li>
15144 </ul>
15145 </li>
15146 </ul>
15147 </li>
15148 </ul>
15149 </div>
15151 <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>
15152 <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>
15153 <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>
15154 <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>
15155 <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>
15156 <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>
15157 <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>
15158 <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>
15159 <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>
15160 <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>
15162 !! end
15164 !! test
15165 TOC regression (T11764)
15166 !! wikitext
15167 == title 1 ==
15168 === title 1.1 ===
15169 ==== title 1.1.1 ====
15170 === title 1.2 ===
15171 == title 2 ==
15172 === title 2.1 ===
15173 !! html
15174 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15175 <ul>
15176 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
15177 <ul>
15178 <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>
15179 <ul>
15180 <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>
15181 </ul>
15182 </li>
15183 <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>
15184 </ul>
15185 </li>
15186 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
15187 <ul>
15188 <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>
15189 </ul>
15190 </li>
15191 </ul>
15192 </div>
15194 <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>
15195 <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>
15196 <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>
15197 <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>
15198 <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>
15199 <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>
15201 !! end
15203 !! test
15204 TOC for heading containing <span id="..."></span> (T96153)
15205 !! wikitext
15206 __FORCETOC__
15207 ==<span id="old-anchor"></span>New title==
15208 !! html/php
15209 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15210 <ul>
15211 <li class="toclevel-1 tocsection-1"><a href="#New_title"><span class="tocnumber">1</span> <span class="toctext">New title</span></a></li>
15212 </ul>
15213 </div>
15215 <h2><span class="mw-headline" id="New_title"><span id="old-anchor"></span>New title</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: New title">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
15217 !! end
15219 !! test
15220 TOC with wgMaxTocLevel=3 (bug 6204)
15221 !! options
15222 wgMaxTocLevel=3
15223 !! wikitext
15224 == title 1 ==
15225 === title 1.1 ===
15226 ==== title 1.1.1 ====
15227 === title 1.2 ===
15228 == title 2 ==
15229 === title 2.1 ===
15230 !! html
15231 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15232 <ul>
15233 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
15234 <ul>
15235 <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>
15236 <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>
15237 </ul>
15238 </li>
15239 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
15240 <ul>
15241 <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>
15242 </ul>
15243 </li>
15244 </ul>
15245 </div>
15247 <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>
15248 <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>
15249 <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>
15250 <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>
15251 <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>
15252 <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>
15254 !! end
15256 !! test
15257 TOC with wgMaxTocLevel=3 and two level four headings (bug 6204)
15258 !! options
15259 wgMaxTocLevel=3
15260 !! wikitext
15261 ==Section 1==
15262 ===Section 1.1===
15263 ====Section 1.1.1====
15264 ====Section 1.1.1.1====
15265 ==Section 2==
15266 !! html
15267 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15268 <ul>
15269 <li class="toclevel-1 tocsection-1"><a href="#Section_1"><span class="tocnumber">1</span> <span class="toctext">Section 1</span></a>
15270 <ul>
15271 <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>
15272 </ul>
15273 </li>
15274 <li class="toclevel-1 tocsection-5"><a href="#Section_2"><span class="tocnumber">2</span> <span class="toctext">Section 2</span></a></li>
15275 </ul>
15276 </div>
15278 <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>
15279 <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>
15280 <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>
15281 <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>
15282 <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>
15284 !! end
15287 !! test
15288 Resolving duplicate section names
15289 !! wikitext
15290 == Foo bar ==
15291 == Foo bar ==
15292 !! html
15293 <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>
15294 <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>
15296 !! end
15298 !! test
15299 Resolving duplicate section names with differing case (bug 10721)
15300 !! wikitext
15301 == Foo bar ==
15302 == Foo Bar ==
15303 !! html
15304 <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>
15305 <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>
15307 !! end
15309 !! article
15310 Template:sections
15311 !! text
15312 ===Section 1===
15313 ==Section 2==
15314 !! endarticle
15316 !! test
15317 Template with sections, __NOTOC__
15318 !! wikitext
15319 __NOTOC__
15320 ==Section 0==
15321 {{sections}}
15322 ==Section 4==
15323 !! html
15324 <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>
15325 <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>
15326 <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>
15327 <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>
15329 !! end
15331 !! test
15332 __NOEDITSECTION__ keyword
15333 !! wikitext
15334 __NOEDITSECTION__
15335 ==Section 1==
15336 ==Section 2==
15337 !! html
15338 <h2><span class="mw-headline" id="Section_1">Section 1</span></h2>
15339 <h2><span class="mw-headline" id="Section_2">Section 2</span></h2>
15341 !! end
15343 !! test
15344 Link inside a section heading
15345 !! wikitext
15346 ==Section with a [[Main Page|link]] in it==
15347 !! html
15348 <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>
15350 !! end
15352 !! test
15353 TOC regression (T14077)
15354 !! wikitext
15355 __TOC__
15356 == title 1 ==
15357 === title 1.1 ===
15358 == title 2 ==
15359 !! html
15360 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15361 <ul>
15362 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
15363 <ul>
15364 <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>
15365 </ul>
15366 </li>
15367 <li class="toclevel-1 tocsection-3"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a></li>
15368 </ul>
15369 </div>
15371 <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>
15372 <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>
15373 <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>
15375 !! end
15377 !! test
15378 BUG 1219 URL next to image (good)
15379 !! wikitext
15380 http://example.com [[File:Foobar.jpg]]
15381 !! html/php
15382 <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>
15383 </p>
15384 !! html/parsoid
15385 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a> <span class="mw-default-size" typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></span></p>
15386 !!end
15388 !! test
15389 Short headings with trailing space should match behavior of Parser::doHeadings (bug 19910)
15390 !! wikitext
15391 === 
15392 The line above must have a trailing space!
15393 === <!--
15394 --> <!-- -->
15395 But just in case it doesn't...
15396 !! html
15397 <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>
15398 <p>The line above must have a trailing space!
15399 </p>
15400 <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>
15401 <p>But just in case it doesn't...
15402 </p>
15403 !! end
15405 !! test
15406 Header with special characters (bug 25462)
15407 !! wikitext
15408 The tooltips shall not show entities to the user (ie. be double escaped)
15410 == text > text ==
15411 section 1
15413 == text < text ==
15414 section 2
15416 == text & text ==
15417 section 3
15419 == text ' text ==
15420 section 4
15422 == text " text ==
15423 section 5
15424 !! html
15425 <p>The tooltips shall not show entities to the user (ie. be double escaped)
15426 </p>
15427 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15428 <ul>
15429 <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>
15430 <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>
15431 <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>
15432 <li class="toclevel-1 tocsection-4"><a href="#text_.27_text"><span class="tocnumber">4</span> <span class="toctext">text ' text</span></a></li>
15433 <li class="toclevel-1 tocsection-5"><a href="#text_.22_text"><span class="tocnumber">5</span> <span class="toctext">text " text</span></a></li>
15434 </ul>
15435 </div>
15437 <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 &gt; text">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
15438 <p>section 1
15439 </p>
15440 <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>
15441 <p>section 2
15442 </p>
15443 <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>
15444 <p>section 3
15445 </p>
15446 <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>
15447 <p>section 4
15448 </p>
15449 <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>
15450 <p>section 5
15451 </p>
15452 !! end
15454 !! test
15455 Header with space, plus and underscore as entity
15456 !! wikitext
15457 Id should not contain + for spaces
15459 == Space between Text ==
15460 section 1
15462 == Space-Entity&#32;between&#32;Text ==
15463 section 2
15465 == Plus+between+Text ==
15466 section 3
15468 == Plus-Entity&#43;between&#43;Text ==
15469 section 4
15471 == Underscore_between_Text ==
15472 section 5
15474 == Underscore-Entity&#95;between&#95;Text ==
15475 section 6
15477 [[#Space between Text]]
15478 [[#Space-Entity&#32;between&#32;Text]]
15479 [[#Plus+between+Text]]
15480 [[#Plus-Entity&#43;between&#43;Text]]
15481 [[#Underscore_between_Text]]
15482 [[#Underscore-Entity&#95;between&#95;Text]]
15483 !! html
15484 <p>Id should not contain + for spaces
15485 </p>
15486 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15487 <ul>
15488 <li class="toclevel-1 tocsection-1"><a href="#Space_between_Text"><span class="tocnumber">1</span> <span class="toctext">Space between Text</span></a></li>
15489 <li class="toclevel-1 tocsection-2"><a href="#Space-Entity_between_Text"><span class="tocnumber">2</span> <span class="toctext">Space-Entity&#32;between&#32;Text</span></a></li>
15490 <li class="toclevel-1 tocsection-3"><a href="#Plus.2Bbetween.2BText"><span class="tocnumber">3</span> <span class="toctext">Plus+between+Text</span></a></li>
15491 <li class="toclevel-1 tocsection-4"><a href="#Plus-Entity.2Bbetween.2BText"><span class="tocnumber">4</span> <span class="toctext">Plus-Entity&#43;between&#43;Text</span></a></li>
15492 <li class="toclevel-1 tocsection-5"><a href="#Underscore_between_Text"><span class="tocnumber">5</span> <span class="toctext">Underscore_between_Text</span></a></li>
15493 <li class="toclevel-1 tocsection-6"><a href="#Underscore-Entity_between_Text"><span class="tocnumber">6</span> <span class="toctext">Underscore-Entity&#95;between&#95;Text</span></a></li>
15494 </ul>
15495 </div>
15497 <h2><span class="mw-headline" id="Space_between_Text">Space between 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: Space between Text">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
15498 <p>section 1
15499 </p>
15500 <h2><span class="mw-headline" id="Space-Entity_between_Text">Space-Entity&#32;between&#32;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: Space-Entity between Text">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
15501 <p>section 2
15502 </p>
15503 <h2><span class="mw-headline" id="Plus.2Bbetween.2BText">Plus+between+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: Plus+between+Text">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
15504 <p>section 3
15505 </p>
15506 <h2><span class="mw-headline" id="Plus-Entity.2Bbetween.2BText">Plus-Entity&#43;between&#43;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: Plus-Entity+between+Text">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
15507 <p>section 4
15508 </p>
15509 <h2><span class="mw-headline" id="Underscore_between_Text">Underscore_between_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: Underscore between Text">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
15510 <p>section 5
15511 </p>
15512 <h2><span class="mw-headline" id="Underscore-Entity_between_Text">Underscore-Entity&#95;between&#95;Text</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: Underscore-Entity_between_Text">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
15513 <p>section 6
15514 </p><p><a href="#Space_between_Text">#Space between Text</a>
15515 <a href="#Space-Entity_between_Text">#Space-Entity&#32;between&#32;Text</a>
15516 <a href="#Plus.2Bbetween.2BText">#Plus+between+Text</a>
15517 <a href="#Plus-Entity.2Bbetween.2BText">#Plus-Entity&#43;between&#43;Text</a>
15518 <a href="#Underscore_between_Text">#Underscore_between_Text</a>
15519 <a href="#Underscore-Entity_between_Text">#Underscore-Entity&#95;between&#95;Text</a>
15520 </p>
15521 !! end
15523 !! test
15524 Headers with excess '=' characters
15525 (Are similar tests necessary beyond the 1st level?)
15526 !! wikitext
15527 =foo==
15528 ==foo=
15529 =''italic'' heading==
15530 ==''italic'' heading=
15531 !! html
15532 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15533 <ul>
15534 <li class="toclevel-1 tocsection-1"><a href="#foo.3D"><span class="tocnumber">1</span> <span class="toctext">foo=</span></a></li>
15535 <li class="toclevel-1 tocsection-2"><a href="#.3Dfoo"><span class="tocnumber">2</span> <span class="toctext">=foo</span></a></li>
15536 <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>
15537 <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>
15538 </ul>
15539 </div>
15541 <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>
15542 <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>
15543 <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>
15544 <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>
15546 !! end
15548 !! test
15549 HTML headers vs TOC (bug 23393)
15550 (__NOEDITSECTION__ for clearer output, doesn't matter here)
15551 !! wikitext
15552 <h1>Header 1</h1>
15553 == Header 1.1 ==
15554 == Header 1.2 ==
15556 <h1>Header 2
15557 </h1>
15558 == Header 2.1 ==
15559 == Header 2.2 ==
15560 __NOEDITSECTION__
15561 !! html
15562 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15563 <ul>
15564 <li class="toclevel-1"><a href="#Header_1"><span class="tocnumber">1</span> <span class="toctext">Header 1</span></a>
15565 <ul>
15566 <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>
15567 <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>
15568 </ul>
15569 </li>
15570 <li class="toclevel-1"><a href="#Header_2"><span class="tocnumber">2</span> <span class="toctext">Header 2</span></a>
15571 <ul>
15572 <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>
15573 <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>
15574 </ul>
15575 </li>
15576 </ul>
15577 </div>
15579 <h1><span class="mw-headline" id="Header_1">Header 1</span></h1>
15580 <h2><span class="mw-headline" id="Header_1.1">Header 1.1</span></h2>
15581 <h2><span class="mw-headline" id="Header_1.2">Header 1.2</span></h2>
15582 <h1><span class="mw-headline" id="Header_2">Header 2</span></h1>
15583 <h2><span class="mw-headline" id="Header_2.1">Header 2.1</span></h2>
15584 <h2><span class="mw-headline" id="Header_2.2">Header 2.2</span></h2>
15586 !! end
15588 !! test
15589 Single-line or multiline-comments can follow headings
15590 !! options
15591 parsoid=wt2html,wt2wt
15592 !! wikitext
15593 ==foo==<!---->
15594 ==bar==<!--c1-->
15595 ==baz==<!--
15597 c3-->
15598 !! html
15599 <h2><span class="mw-headline" id="foo">foo</span></h2>
15600 <h2><span class="mw-headline" id="bar">bar</span></h2>
15601 <h2><span class="mw-headline" id="baz">baz</span></h2>
15603 !! end
15605 !! test
15606 BUG 1219 URL next to image (broken)
15607 !! wikitext
15608 http://example.com[[File:Foobar.jpg]]
15609 !! html/php
15610 <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>
15611 </p>
15612 !! html/parsoid
15613 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a><span class="mw-default-size" typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></span></p>
15614 !!end
15616 !! test
15617 Bug 1186 news: in the middle of text
15618 !! wikitext
15619 http://en.wikinews.org/wiki/Wikinews:Workplace
15620 !! html
15621 <p><a rel="nofollow" class="external free" href="http://en.wikinews.org/wiki/Wikinews:Workplace">http://en.wikinews.org/wiki/Wikinews:Workplace</a>
15622 </p>
15623 !!end
15626 !! test
15627 Namespaced link must have a title
15628 !! wikitext
15629 [[Project:]]
15630 !! html
15631 <p>[[Project:]]
15632 </p>
15633 !!end
15635 !! test
15636 Namespaced link must have a title (bad fragment version)
15637 !! wikitext
15638 [[Project:#fragment]]
15639 !! html
15640 <p>[[Project:#fragment]]
15641 </p>
15642 !!end
15646 ### HTML tags and HTML attributes
15649 !! test
15650 div with no attributes
15651 !! wikitext
15652 <div>HTML rocks</div>
15653 !! html
15654 <div>HTML rocks</div>
15656 !! end
15658 !! test
15659 div with double-quoted attribute
15660 !! wikitext
15661 <div id="rock">HTML rocks</div>
15662 !! html
15663 <div id="rock">HTML rocks</div>
15665 !! end
15667 !! test
15668 div with single-quoted attribute
15669 !! wikitext
15670 <div id='rock'>HTML rocks</div>
15671 !! html
15672 <div id="rock">HTML rocks</div>
15674 !! end
15676 !! test
15677 div with unquoted attribute
15678 !! wikitext
15679 <div id=rock>HTML rocks</div>
15680 !! html
15681 <div id="rock">HTML rocks</div>
15683 !! end
15685 !! test
15686 div with illegal double attributes
15687 !! wikitext
15688 <div id="a" id="b">HTML rocks</div>
15689 !! html
15690 <div id="b">HTML rocks</div>
15692 !!end
15694 !! test
15695 div with empty attribute value, space before equals
15696 !! options
15697 parsoid=wt2html,html2html
15698 !! wikitext
15699 <div class =>HTML rocks</div>
15700 !! html/php
15701 <div class="">HTML rocks</div>
15703 !! html/parsoid
15704 <div class="" data-parsoid='{"stx":"html"}'>HTML rocks</div>
15705 !! end
15707 !! test
15708 div with multiple empty attribute values
15709 !! options
15710 parsoid=wt2html,html2html
15711 !! wikitext
15712 <div id= title=>HTML rocks</div>
15713 !! html/php
15714 <div id="title.3D">HTML rocks</div>
15716 !! html/parsoid
15717 <div id="title=" data-parsoid='{"stx":"html"}'>HTML rocks</div>
15718 !! end
15720 !! test
15721 table with multiple empty attribute values
15722 !! options
15723 parsoid=wt2html,html2html
15724 !! wikitext
15725 {| title= id=
15726 | hi
15728 !! html/php
15729 <table title="id=">
15730 <tr>
15731 <td> hi
15732 </td></tr></table>
15734 !! html/parsoid
15735 <table title="id=">
15736 <tbody><tr><td> hi</td></tr>
15737 </tbody></table>
15738 !! end
15740 !! test
15741 div with braces in attribute value
15742 !! wikitext
15743 <div title="{}">Foo</div>
15744 !! html/php
15745 <div title="&#123;}">Foo</div>
15747 !! html/parsoid
15748 <div title="{}">Foo</div>
15749 !! end
15751 !! test
15752 div with empty attribute value, no space before equals
15753 !! options
15754 parsoid=wt2html,html2html
15755 !! wikitext
15756 <div class=>HTML rocks</div>
15757 !! html/php
15758 <div class="">HTML rocks</div>
15760 !! html/parsoid
15761 <div class="">HTML rocks</div>
15762 !! end
15764 !! test
15765 HTML multiple attributes correction
15766 !! wikitext
15767 <p class="error" class="awesome">Awesome!</p>
15768 !! html
15769 <p class="awesome">Awesome!</p>
15771 !!end
15773 !! test
15774 Table multiple attributes correction
15775 !! wikitext
15777 !+ class="error" class="awesome"| status
15779 !! html
15780 <table>
15781 <tr>
15782 <th class="awesome"> status
15783 </th></tr></table>
15785 !!end
15787 !! test
15788 DIV IN UPPERCASE
15789 !! wikitext
15790 <DIV ID="x">HTML ROCKS</DIV>
15791 !! html
15792 <div id="x">HTML ROCKS</div>
15794 !!end
15796 !! test
15797 Non-ASCII pseudo-tags are rendered as text
15798 !! wikitext
15799 <khyô>
15800 !! html
15801 <p>&lt;khyô&gt;
15802 </p>
15803 !! end
15805 !! test
15806 Pseudo-tag with URL 'name' renders as url link
15807 !! wikitext
15808 <http://example.com/>
15809 !! html
15810 <p>&lt;<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&gt;
15811 </p>
15812 !! end
15814 !! test
15815 text with amp in the middle of nowhere
15816 !! wikitext
15817 Remember AT&T?
15818 !! html
15819 <p>Remember AT&amp;T?
15820 </p>
15821 !! end
15823 !! test
15824 text with character entity: eacute
15825 !! wikitext
15826 I always thought &eacute; was a cute letter.
15827 !! html
15828 <p>I always thought &#233; was a cute letter.
15829 </p>
15830 !! html+tidy
15831 <p>I always thought é was a cute letter.</p>
15832 !! end
15834 !! test
15835 text with entity-escaped character entity-like string: eacute
15836 !! wikitext
15837 I always thought &amp;eacute; was a cute letter.
15838 !! html
15839 <p>I always thought &amp;eacute; was a cute letter.
15840 </p>
15841 !! end
15843 !! test
15844 text with undefined character entity: xacute
15845 !! wikitext
15846 I always thought &xacute; was a cute letter.
15847 !! html
15848 <p>I always thought &amp;xacute; was a cute letter.
15849 </p>
15850 !! end
15852 !! test
15853 HTML5 tags
15854 !! wikitext
15855 <data value="5">five</data>
15856 <time datetime="2000-01-01T00:00Z">The new millenium started</time>
15857 <mark>This highlighted text</mark>
15858 !! html
15859 <p><data value="5">five</data>
15860 <time datetime="2000-01-01T00:00Z">The new millenium started</time>
15861 <mark>This highlighted text</mark>
15862 </p>
15863 !! end
15865 !! test
15866 HTML tag with leading space is parsed as text
15867 !! wikitext
15868 < div>foo< /div>
15869 !! html
15870 <p>&lt; div&gt;foo&lt; /div&gt;
15871 </p>
15872 !! end
15875 ### Nesting tests (see bug 41545, 50604, 51081)
15878 # This test case is fixed in Parsoid by domino 1.0.12. (bug 50604)
15879 # Note that html2wt is considerably more difficult if we use <b> in
15880 # the test case, instead of <big>
15881 !! test
15882 Ensure that HTML adoption agency algorithm is properly implemented.
15883 !! wikitext
15884 <big>X<big>Y</big>Z</big>
15885 !! html
15886 <p><big>X<big>Y</big>Z</big>
15887 </p>
15888 !! end
15890 # This was bug 41545 in the PHP parser.
15891 # Note that tidy doesn't handle this correctly.
15892 !! test
15893 Nesting of <kbd>
15894 !! wikitext
15895 <kbd>X<kbd>Y</kbd>Z</kbd>
15896 !! html
15897 <p><kbd>X<kbd>Y</kbd>Z</kbd>
15898 </p>
15899 !! end
15901 # The following cases were bug 51081 in the PHP parser.
15902 # Note that there are some other nestable tags (b, i, etc) which are
15903 # not covered; see bug 51081 for discussion.
15905 # Note that tidy doesn't handle this correctly.
15906 !! test
15907 Nesting of <em>
15908 !! wikitext
15909 <em>X<em>Y</em>Z</em>
15910 !! html
15911 <p><em>X<em>Y</em>Z</em>
15912 </p>
15913 !! end
15915 # Note that tidy doesn't handle this correctly.
15916 !! test
15917 Nesting of <strong>
15918 !! wikitext
15919 <strong>X<strong>Y</strong>Z</strong>
15920 !! html
15921 <p><strong>X<strong>Y</strong>Z</strong>
15922 </p>
15923 !! end
15925 !! test
15926 Nesting of <q>
15927 !! wikitext
15928 <q>X<q>Y</q>Z</q>
15929 !! html+tidy
15930 <p><q>X<q>Y</q>Z</q></p>
15931 !! end
15933 # Note that tidy doesn't handle this correctly.
15934 !! test
15935 Nesting of <ruby>
15936 !! wikitext
15937 <ruby>X<ruby>Y</ruby>Z</ruby>
15938 !! html
15939 <p><ruby>X<ruby>Y</ruby>Z</ruby>
15940 </p>
15941 !! end
15943 # Note that tidy doesn't handle this correctly.
15944 !! test
15945 Nesting of <bdo>
15946 !! wikitext
15947 <bdo>X<bdo>Y</bdo>Z</bdo>
15948 !! html
15949 <p><bdo>X<bdo>Y</bdo>Z</bdo>
15950 </p>
15951 !! end
15955 ### Media links
15958 !! test
15959 Media link
15960 !! wikitext
15961 [[Media:Foobar.jpg]]
15962 !! html
15963 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Media:Foobar.jpg</a>
15964 </p>
15965 !! end
15967 !! test
15968 Media link with text
15969 !! wikitext
15970 [[Media:Foobar.jpg|A neat file to look at]]
15971 !! html
15972 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">A neat file to look at</a>
15973 </p>
15974 !! end
15976 # FIXME: this is still bad HTML tag nesting
15977 # FIXME: doBlockLevels won't wrap this in a paragraph because it contains a div
15978 !! test
15979 Media link with nasty text
15980 !! wikitext
15981 [[Media:Foobar.jpg|Safe Link<div style=display:none>" onmouseover="alert(document.cookie)" onfoo="</div>]]
15982 !! html
15983 <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>
15985 !! html+tidy
15986 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Safe Link</a></p>
15987 <div style="display:none">" onmouseover="alert(document.cookie)" onfoo="</div>
15988 !! end
15990 !! test
15991 Media link to nonexistent file (bug 1702)
15992 !! wikitext
15993 [[Media:No such.jpg]]
15994 !! html
15995 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=No_such.jpg" class="new" title="No such.jpg">Media:No such.jpg</a>
15996 </p>
15997 !! end
15999 !! test
16000 Image link to nonexistent file (bug 1850 - good)
16001 !! wikitext
16002 [[File:No_such.jpg]]
16003 !! html/php
16004 <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>
16005 </p>
16006 !! html/parsoid
16007 <p><span class="mw-default-size" typeof="mw:Error mw:Image" data-mw='{"errors":[{"key":"missing-image","message":"This image does not exist."}]}'><a href="./File:No_such.jpg"><img resource="./File:No_such.jpg" src="./Special:FilePath/No_such.jpg" height="220" width="220"/></a></span></p>
16008 !! end
16010 !! test
16011 :Image link to nonexistent file (bug 1850 - bad)
16012 !! wikitext
16013 [[:Image:No such.jpg]]
16014 !! html/php
16015 <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>
16016 </p>
16017 !! html/parsoid
16018 <p><a rel="mw:WikiLink" href="./File:No_such.jpg" title="File:No such.jpg">Image:No such.jpg</a></p>
16019 !! end
16023 !! test
16024 Character reference normalization in link text (bug 1938)
16025 !! wikitext
16026 [[Main Page|this&that]]
16027 !! html
16028 <p><a href="/wiki/Main_Page" title="Main Page">this&amp;that</a>
16029 </p>
16030 !!end
16032 !! article
16033 אַ
16034 !! text
16035 Test for unicode normalization
16037 The page's name is U+05d0 U+05b7, with non-canonical form U+FB2E
16038 !! endarticle
16040 !! test
16041 (bug 19451) Links should refer to the normalized form.
16042 !! wikitext
16043 [[&#xFB2E;]]
16044 [[&#x5d0;&#x5b7;]]
16045 [[&#x5d0;ַ]]
16046 [[א&#x5b7;]]
16047 [[אַ]]
16048 !! html
16049 <p><a href="/wiki/%D7%90%D6%B7" title="אַ">&#xfb2e;</a>
16050 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;&#x5b7;</a>
16051 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;ַ</a>
16052 <a href="/wiki/%D7%90%D6%B7" title="אַ">א&#x5b7;</a>
16053 <a href="/wiki/%D7%90%D6%B7" title="אַ">אַ</a>
16054 </p>
16055 !! end
16057 !! test
16058 Empty attribute crash test (bug 2067)
16059 !! wikitext
16060 <font color="">foo</font>
16061 !! html
16062 <p><font color="">foo</font>
16063 </p>
16064 !! end
16066 !! test
16067 Empty attribute crash test single-quotes (bug 2067)
16068 !! wikitext
16069 <font color=''>foo</font>
16070 !! html
16071 <p><font color="">foo</font>
16072 </p>
16073 !! end
16075 !! test
16076 Attribute test: equals, then nothing
16077 !! options
16078 parsoid=wt2html,html2html
16079 !! wikitext
16080 <font color=>foo</font>
16081 !! html/php
16082 <p><font color="">foo</font>
16083 </p>
16084 !! html/parsoid
16085 <p><font color="" data-parsoid='{"stx":"html"}'>foo</font></p>
16086 !! end
16088 !! test
16089 Attribute test: unquoted value
16090 !! options
16091 parsoid=wt2html,html2html
16092 !! wikitext
16093 <font color=x>foo</font>
16094 !! html/php
16095 <p><font color="x">foo</font>
16096 </p>
16097 !! html/parsoid
16098 <p><font color="x" data-parsoid='{"stx":"html"}'>foo</font></p>
16099 !! end
16101 !! test
16102 Attribute test: unquoted but illegal value (hash)
16103 !! wikitext
16104 <font color=#x>foo</font>
16105 !! html
16106 <p><font color="#x">foo</font>
16107 </p>
16108 !! end
16110 # Parsoid does not serialize to empty attribute syntax,
16111 # so wt2wt and html2wt cases are skipped
16112 !! test
16113 Attribute test: no value (T54330)
16114 !! options
16115 parsoid=wt2html,html2html
16116 !! wikitext
16117 <font color>foo</font>
16118 !! html/php
16119 <p><font color="">foo</font>
16120 </p>
16121 !! html/parsoid
16122 <p><font color="">foo</font></p>
16123 !! end
16125 !! test
16126 Bug 2095: link with three closing brackets
16127 !! wikitext
16128 [[Main Page]]]
16129 !! html/php
16130 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>]
16131 </p>
16132 !! html/parsoid
16133 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">Main Page</a>]</p>
16134 !! end
16136 !! test
16137 Bug 2095: link with pipe and three closing brackets
16138 !! wikitext
16139 [[Main Page|link]]]
16140 !! html/php
16141 <p><a href="/wiki/Main_Page" title="Main Page">link</a>]
16142 </p>
16143 !! html/parsoid
16144 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">link</a>]</p>
16145 !! end
16147 !! test
16148 Bug 2095: link with pipe and three closing brackets, version 2
16149 !! wikitext
16150 [[Main Page|[http://example.com/]]]
16151 !! html/php
16152 <p><a href="/wiki/Main_Page" title="Main Page">[http://example.com/]</a>
16153 </p>
16154 !! html/parsoid
16155 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">[http://example.com/]</a></p>
16156 !! end
16160 ### Safety
16163 !! article
16164 Template:Dangerous attribute
16165 !! text
16166 " onmouseover="alert(document.cookie)
16167 !! endarticle
16169 !! article
16170 Template:Dangerous style attribute
16171 !! text
16172 border-size: expression(alert(document.cookie))
16173 !! endarticle
16175 !! article
16176 Template:Div style
16177 !! text
16178 <div style="float: right; {{{1}}}">Magic div</div>
16179 !! endarticle
16181 !! test
16182 Bug 2304: HTML attribute safety (safe template; regression bug 2309)
16183 !! wikitext
16184 <div title="{{test}}"></div>
16185 !! html
16186 <div title="This is a test template"></div>
16188 !! end
16190 # Parsoid has enough context to handle this case
16191 !! test
16192 Bug 2304: HTML attribute safety (dangerous template; 2309)
16193 !! wikitext
16194 <div title="{{dangerous attribute}}"></div>
16195 !! html/php
16196 <div title=""></div>
16198 !! html/parsoid
16199 <div title='" onmouseover="alert(document.cookie)' about="#mwt2" typeof="mw:ExpandedAttrs" data-parsoid='{"stx":"html","a":{"title":"\" onmouseover=\"alert(document.cookie)"},"sa":{"title":"{{dangerous attribute}}"}}' data-mw='{"attribs":[[{"txt":"title"},{"html":"&lt;span about=\"#mwt1\" typeof=\"mw:Transclusion\" data-parsoid=&#39;{\"pi\":[[]],\"dsr\":[12,35,null,null]}&#39; data-mw=&#39;{\"parts\":[{\"template\":{\"target\":{\"wt\":\"dangerous attribute\",\"href\":\"./Template:Dangerous_attribute\"},\"params\":{},\"i\":0}}]}&#39;>\" onmouseover=\"alert(document.cookie)&lt;/span>"}]]}'></div>
16200 !! end
16202 !! test
16203 Bug 2304: HTML attribute safety (dangerous style template; 2309)
16204 !! wikitext
16205 <div style="{{dangerous style attribute}}"></div>
16206 !! html
16207 <div style="/* insecure input */"></div>
16209 !! end
16211 !! test
16212 Bug 2304: HTML attribute safety (safe parameter; 2309)
16213 !! wikitext
16214 {{div style|width: 200px}}
16215 !! html
16216 <div style="float: right; width: 200px">Magic div</div>
16218 !! end
16220 !! test
16221 Bug 2304: HTML attribute safety (unsafe parameter; 2309)
16222 !! wikitext
16223 {{div style|width: expression(alert(document.cookie))}}
16224 !! html
16225 <div style="/* insecure input */">Magic div</div>
16227 !! end
16229 !! test
16230 Bug 2304: HTML attribute safety (unsafe breakout parameter; 2309)
16231 !! wikitext
16232 {{div style|"><script>alert(document.cookie)</script>}}
16233 !! html
16234 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
16236 !! end
16238 !! test
16239 Bug 2304: HTML attribute safety (unsafe breakout parameter 2; 2309)
16240 !! wikitext
16241 {{div style|" ><script>alert(document.cookie)</script>}}
16242 !! html
16243 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
16245 !! end
16247 !! test
16248 Bug 2304: HTML attribute safety (link)
16249 !! wikitext
16250 <div title="[[Main Page]]"></div>
16251 !! html
16252 <div title="&#91;&#91;Main Page]]"></div>
16254 !! end
16256 !! test
16257 Bug 2304: HTML attribute safety (italics)
16258 !! wikitext
16259 <div title="''foobar''"></div>
16260 !! html
16261 <div title="&#39;&#39;foobar&#39;&#39;"></div>
16263 !! end
16265 !! test
16266 Bug 2304: HTML attribute safety (bold)
16267 !! wikitext
16268 <div title="'''foobar'''"></div>
16269 !! html
16270 <div title="&#39;&#39;&#39;foobar&#39;&#39;&#39;"></div>
16272 !! end
16275 !! test
16276 Bug 2304: HTML attribute safety (ISBN)
16277 !! wikitext
16278 <div title="ISBN 1234567890"></div>
16279 !! html
16280 <div title="&#73;SBN 1234567890"></div>
16282 !! end
16284 !! test
16285 Bug 2304: HTML attribute safety (RFC)
16286 !! wikitext
16287 <div title="RFC 1234"></div>
16288 !! html
16289 <div title="&#82;FC 1234"></div>
16291 !! end
16293 !! test
16294 Bug 2304: HTML attribute safety (PMID)
16295 !! wikitext
16296 <div title="PMID 1234567890"></div>
16297 !! html
16298 <div title="&#80;MID 1234567890"></div>
16300 !! end
16302 !! test
16303 Bug 2304: HTML attribute safety (web link)
16304 !! wikitext
16305 <div title="http://example.com/"></div>
16306 !! html
16307 <div title="http&#58;//example.com/"></div>
16309 !! end
16311 !! test
16312 Bug 2304: HTML attribute safety (named web link)
16313 !! wikitext
16314 <div title="[http://example.com/ link]"></div>
16315 !! html
16316 <div title="&#91;http&#58;//example.com/ link]"></div>
16318 !! end
16320 !! test
16321 Bug 3244: HTML attribute safety (extension; safe)
16322 !! wikitext
16323 <div style="<nowiki>background:blue</nowiki>"></div>
16324 !! html
16325 <div style="background:blue"></div>
16327 !! end
16329 !! test
16330 Bug 3244: HTML attribute safety (extension; unsafe)
16331 !! wikitext
16332 <div style="<nowiki>border-left:expression(alert(document.cookie))</nowiki>"></div>
16333 !! html
16334 <div style="/* insecure input */"></div>
16336 !! end
16338 # More MSIE fun discovered by Tom Gilder
16340 !! test
16341 MSIE CSS safety test: spurious slash
16342 !! wikitext
16343 <div style="background-image:u\rl(javascript:alert('boo'))">evil</div>
16344 !! html
16345 <div style="/* insecure input */">evil</div>
16347 !! end
16349 !! test
16350 MSIE CSS safety test: hex code
16351 !! wikitext
16352 <div style="background-image:u\72l(javascript:alert('boo'))">evil</div>
16353 !! html
16354 <div style="/* insecure input */">evil</div>
16356 !! end
16358 !! test
16359 MSIE CSS safety test: comment in url
16360 !! wikitext
16361 <div style="background-image:u/**/rl(javascript:alert('boo'))">evil</div>
16362 !! html
16363 <div style="background-image:u rl(javascript:alert(&#39;boo&#39;))">evil</div>
16365 !! end
16367 !! test
16368 MSIE CSS safety test: comment in expression
16369 !! wikitext
16370 <div style="background-image:expres/**/sion(alert('boo4'))">evil4</div>
16371 !! html
16372 <div style="background-image:expres sion(alert(&#39;boo4&#39;))">evil4</div>
16374 !! end
16376 !! test
16377 CSS safety test (all browsers): vertical tab (bug 55332 / CVE-2013-4567)
16378 !! wikitext
16379 <p style="font-size: 100px; background-image:url\b(https://www.google.com/images/srpr/logo6w.png)">A</p>
16380 !! html
16381 <p style="/* invalid control char */">A</p>
16383 !! end
16385 !! test
16386 MSIE 6 CSS safety test: Fullwidth (bug 55332)
16387 !! wikitext
16388 <p style="font-size: 100px; color: expression((title='XSSed'),'red')">A</p>
16389 <div style="top:EXPRESSION(alert())">B</div>
16390 !! html
16391 <p style="/* insecure input */">A</p>
16392 <div style="/* insecure input */">B</div>
16394 !! end
16396 !! test
16397 MSIE 6 CSS safety test: IPA extensions (bug 55332)
16398 !! wikitext
16399 <div style="background-image:uʀʟ(javascript:alert())">A</div>
16400 <p style="font-size: 100px; color: expʀessɪoɴ((title='XSSed'),'red')">B</p>
16401 !! html
16402 <div style="/* insecure input */">A</div>
16403 <p style="/* insecure input */">B</p>
16405 !! end
16407 !! test
16408 MSIE 6 CSS safety test: sup/sub script (bug 55332)
16409 !! wikitext
16410 <div style="background-image:url⁽javascript:alert())">A</div>
16411 <div style="background-image:url₍javascript:alert())">B</div>
16412 <p style="font-size: 100px; color: expressioⁿ((title='XSSed'),'red')">C</p>
16413 !! html
16414 <div style="/* insecure input */">A</div>
16415 <div style="/* insecure input */">B</div>
16416 <p style="/* insecure input */">C</p>
16418 !! end
16420 # FIXME: Parsoid fails to sanitize this! See T58846.
16421 !! test
16422 Opera -o-link CSS
16423 !! wikitext
16424 <div
16425 title="&#100;&#97;&#116;&#97;&#58;&#116;&#101;&#120;&#116;&#47;&#104;&#116;&#109;&#108;&#44;&#60;&#105;&#109;&#103;&#32;&#115;&#114;&#99;&#61;&#49;&#32;&#111;&#110;&#101;&#114;&#114;&#111;&#114;&#61;&#97;&#108;&#101;&#114;&#116;&#40;&#49;&#41;&#62;"
16426 style="-o-link:attr(title);-o-link-source:current">X</div>
16427 !! html
16428 <div title="data:text/html,&lt;img src=1 onerror=alert(1)&gt;" style="/* insecure input */">X</div>
16430 !! end
16432 !! test
16433 MSIE 6 CSS safety test: Repetition markers (bug 55332)
16434 !! wikitext
16435 <p style="font-size: 100px; color: expres〱ion((title='XSSed'),'red')">A</p>
16436 <p style="font-size: 100px; color: expresゝion((title='XSSed'),'red')">B</p>
16437 <p style="font-size: 100px; color: expresーion((title='XSSed'),'red')">C</p>
16438 <p style="font-size: 100px; color: expresヽion((title='XSSed'),'red')">D</p>
16439 <p style="font-size: 100px; color: expresﹽion((title='XSSed'),'red')">E</p>
16440 <p style="font-size: 100px; color: expresﹼion((title='XSSed'),'red')">F</p>
16441 <p style="font-size: 100px; color: expresーion((title='XSSed'),'red')">G</p>
16442 !! html
16443 <p style="/* insecure input */">A</p>
16444 <p style="/* insecure input */">B</p>
16445 <p style="/* insecure input */">C</p>
16446 <p style="/* insecure input */">D</p>
16447 <p style="/* insecure input */">E</p>
16448 <p style="/* insecure input */">F</p>
16449 <p style="/* insecure input */">G</p>
16451 !! end
16453 !! test
16454 Table attribute legitimate extension
16455 !! wikitext
16457 !+ style="<nowiki>color:blue</nowiki>"| status
16459 !! html
16460 <table>
16461 <tr>
16462 <th style="color:blue"> status
16463 </th></tr></table>
16465 !!end
16467 !! test
16468 Table attribute safety
16469 !! wikitext
16471 !+ style="<nowiki>border-width:expression(0+alert(document.cookie))</nowiki>"| status
16473 !! html
16474 <table>
16475 <tr>
16476 <th style="/* insecure input */"> status
16477 </th></tr></table>
16479 !! end
16481 !! test
16482 CSS line continuation 1
16483 !! wikitext
16484 <div style="background-image: u\&#10;rl(test.jpg);"></div>
16485 !! html
16486 <div style="/* insecure input */"></div>
16488 !! end
16490 !! test
16491 CSS line continuation 2
16492 !! wikitext
16493 <div style="background-image: u\&#13;rl(test.jpg); "></div>
16494 !! html
16495 <div style="/* invalid control char */"></div>
16497 !! end
16499 !! article
16500 Template:Identity
16501 !! text
16502 {{{1}}}
16503 !! endarticle
16505 !! test
16506 Expansion of multi-line templates in attribute values (bug 6255)
16507 !! wikitext
16508 <div style="background: {{identity|#00FF00}}">-</div>
16509 !! html
16510 <div style="background: #00FF00">-</div>
16512 !! end
16515 !! test
16516 Expansion of multi-line templates in attribute values (bug 6255 sanity check)
16517 !! wikitext
16518 <div style="background: 
16519 #00FF00">-</div>
16520 !! html/php
16521 <div style="background: #00FF00">-</div>
16523 !! html/parsoid
16524 <div style="background: 
16525 #00FF00">-</div>
16526 !! end
16528 !! test
16529 Expansion of multi-line templates in attribute values (bug 6255 sanity check 2)
16530 !! wikitext
16531 <div style="background: &#10;#00FF00">-</div>
16532 !! html
16533 <div style="background: &#10;#00FF00">-</div>
16535 !! end
16537 !! test
16538 evil <math>-wiki-tags without Extension:Math enabled
16539 !! wikitext
16540 <math><img src="some evil external link"><script>some_evil_javascript();</script></math>
16541 !! html+tidy
16542 <p>&lt;math&gt;&lt;img src="some evil external link"&gt;&lt;script&gt;some_evil_javascript();&lt;/script&gt;&lt;/math&gt;</p>
16543 !! end
16546 ### Parser hooks (see tests/parser/parserTestsParserHook.php for the <tag> extension)
16548 !! test
16549 Parser hook: empty input
16550 !! wikitext
16551 <tag></tag>
16552 !! html/php
16553 <pre>
16555 array (
16557 </pre>
16559 !! html/parsoid
16560 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":""}}' data-parsoid='{}' about="#mwt2"></pre>
16561 !! end
16563 ## Don't expect parsoid to rt this form.
16564 !! test
16565 Parser hook: empty input using terminated empty elements
16566 !! options
16567 parsoid=wt2html,html2html
16568 !! wikitext
16569 <tag/>
16570 !! html/php
16571 <pre>
16572 NULL
16573 array (
16575 </pre>
16577 !! html/parsoid
16578 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":null}' data-parsoid='{}' about="#mwt2"></pre>
16579 !! end
16581 !! test
16582 Parser hook: empty input using terminated empty elements (space before)
16583 !! wikitext
16584 <tag />
16585 !! html/php
16586 <pre>
16587 NULL
16588 array (
16590 </pre>
16592 !! html/parsoid
16593 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":null}' data-parsoid='{}' about="#mwt2"></pre>
16594 !! end
16596 !! test
16597 Parser hook: basic input
16598 !! wikitext
16599 <tag>input</tag>
16600 !! html/php
16601 <pre>
16602 'input'
16603 array (
16605 </pre>
16607 !! html/parsoid
16608 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":"input"}}' data-parsoid='{}' about="#mwt2"></pre>
16609 !! end
16611 ## Don't expect parsoid to rt this form.
16612 !! test
16613 Parser hook: case insensitive
16614 !! options
16615 parsoid=wt2html,html2html
16616 !! wikitext
16617 <TAG>input</TAG>
16618 !! html/php
16619 <pre>
16620 'input'
16621 array (
16623 </pre>
16625 !! html/parsoid
16626 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":"input"}}' data-parsoid='{}' about="#mwt2"></pre>
16627 !! end
16629 ## Don't expect parsoid to rt this form.
16630 !! test
16631 Parser hook: case insensitive, redux
16632 !! options
16633 parsoid=wt2html,html2html
16634 !! wikitext
16635 <TaG>input</TAg>
16636 !! html/php
16637 <pre>
16638 'input'
16639 array (
16641 </pre>
16643 !! html/parsoid
16644 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":"input"}}' data-parsoid='{}' about="#mwt2"></pre>
16645 !! end
16647 !! test
16648 Parser hook: nested tags
16649 !! wikitext
16650 <tag><tag></tag></tag>
16651 !! html/php
16652 <pre>
16653 '<tag>'
16654 array (
16656 </pre>&lt;/tag&gt;
16658 !! html/parsoid
16659 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":"&lt;tag>"}}' data-parsoid='{}' about="#mwt2"></pre>&lt;/tag>
16660 !! end
16662 !! test
16663 Parser hook: basic arguments
16664 !! wikitext
16665 <tag width="200" height="100" depth="50" square=""></tag>
16666 !! html/php
16667 <pre>
16669 array (
16670   'width' => '200',
16671   'height' => '100',
16672   'depth' => '50',
16673   'square' => '',
16675 </pre>
16677 !! html/parsoid
16678 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{"width":"200","height":"100","depth":"50","square":""},"body":{"extsrc":""}}' data-parsoid='{}' about="#mwt2"></pre>
16679 !! end
16681 ## Don't expect parsoid to rt this form.
16682 !! test
16683 Parser hook: basic arguments, variations
16684 !! options
16685 parsoid=wt2html,html2html
16686 !! wikitext
16687 <tag width=200 height = "100" depth = '50' square></tag>
16688 !! html/php
16689 <pre>
16691 array (
16692   'width' => '200',
16693   'height' => '100',
16694   'depth' => '50',
16695   'square' => '',
16697 </pre>
16699 !! html/parsoid
16700 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{"width":"200","height":"100","depth":"50","square":""},"body":{"extsrc":""}}' data-parsoid='{}' about="#mwt2"></pre>
16701 !! end
16703 !! test
16704 Parser hook: argument containing a forward slash (bug 5344)
16705 !! wikitext
16706 <tag filename="/tmp/bla"></tag>
16707 !! html/php
16708 <pre>
16710 array (
16711   'filename' => '/tmp/bla',
16713 </pre>
16715 !! html/parsoid
16716 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{"filename":"/tmp/bla"},"body":{"extsrc":""}}' data-parsoid='{}' about="#mwt2"></pre>
16717 !! end
16719 ## Don't expect parsoid to rt this form.
16720 !! test
16721 Parser hook: empty input using terminated empty elements (bug 2374)
16722 !! options
16723 parsoid=wt2html,html2html
16724 !! wikitext
16725 <tag foo=bar/>text
16726 !! html/php
16727 <pre>
16728 NULL
16729 array (
16730   'foo' => 'bar',
16732 </pre>text
16734 !! html/parsoid
16735 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{"foo":"bar"},"body":null}' data-parsoid='{}' about="#mwt2"></pre>text
16736 !! end
16738 ## </tag> should be output literally since there is no matching tag that begins it
16739 ## Don't expect parsoid to rt this form.
16740 !! test
16741 Parser hook: basic arguments using terminated empty elements (bug 2374)
16742 !! options
16743 parsoid=wt2html
16744 !! wikitext
16745 <tag width=200 height = "100" depth = '50' square/>
16746 other stuff
16747 </tag>
16748 !! html/php
16749 <pre>
16750 NULL
16751 array (
16752   'width' => '200',
16753   'height' => '100',
16754   'depth' => '50',
16755   'square' => '',
16757 </pre>
16758 <p>other stuff
16759 &lt;/tag&gt;
16760 </p>
16761 !! html/parsoid
16762 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{"width":"200","height":"100","depth":"50","square":""},"body":null}' about="#mwt2"></pre><p>other stuff
16763 &lt;/tag></p>
16764 !! end
16766 ## Don't expect parsoid to rt this form.
16767 !! test
16768 Parser hook: Don't allow unclosed extension tags
16769 !! options
16770 parsoid=wt2html
16771 !! wikitext
16772 test <tag>123
16774 this is a '''test'''
16775 !! html/php
16776 <p>test &lt;tag&gt;123
16777 </p><p>this is a <b>test</b>
16778 </p>
16779 !! html/parsoid
16780 <p>test &lt;tag>123</p>
16782 <p>this is a <b>test</b></p>
16783 !! end
16786 ### (see tests/parser/parserTestsParserHook.php for the <statictag> extension)
16789 !! test
16790 Parser hook: static parser hook not inside a comment
16791 !! wikitext
16792 <statictag>hello, world</statictag>
16794 <statictag action="flush" />
16795 !! html/php
16796 <p><br />
16797 hello, world
16798 </p>
16799 !! html/parsoid
16800 <p><span typeof="mw:Extension/statictag" data-mw='{"name":"statictag","attrs":{},"body":{"extsrc":"hello, world"}}' data-parsoid='{}' about="#mwt2"></span></p>
16801 <p typeof="mw:Extension/statictag" data-mw='{"name":"statictag","attrs":{"action":"flush"},"body":null}' data-parsoid='{}' about="#mwt4">hello, world</p>
16802 !! end
16804 !! test
16805 Parser hook: static parser hook inside a comment
16806 !! wikitext
16807 <!-- <statictag>hello, world</statictag> -->
16808 <statictag action="flush" />
16809 !! html/php
16810 <p><br />
16811 </p>
16812 !! html/parsoid
16813 <!-- <statictag&#x3E;hello, world</statictag&#x3E; -->
16814 <p typeof="mw:Extension/statictag" data-mw='{"name":"statictag","attrs":{"action":"flush"},"body":null}' data-parsoid='{}' about="#mwt2"></p>
16815 !! end
16817 # Nested template calls; this case was broken by Parser.php rev 1.506,
16818 # since reverted.
16820 !! article
16821 Template:One-parameter
16822 !! text
16823 (My parameter is: {{{1}}})
16824 !! endarticle
16826 !! article
16827 Template:Map-one-parameter
16828 !! text
16829 {{{{{1}}}|{{{2}}}}}
16830 !! endarticle
16832 !! test
16833 Nested template calls
16834 !! wikitext
16835 {{Map-one-parameter|One-parameter|param}}
16836 !! html
16837 <p>(My parameter is: param)
16838 </p>
16839 !! end
16843 ### Sanitizer
16846 # HTML+Tidy effectively strips out the empty tags completely
16847 # But since Parsoid doesn't it wraps the <s></s> tags in p-tags
16848 # which Tidy would have done for the PHP parser had there been content inside it.
16849 !! test
16850 Sanitizer: Closing of open tags
16851 !! wikitext
16852 <s></s><table></table>
16853 !! html
16854 <s></s><table></table>
16856 !! html/parsoid
16857 <p><s></s></p><table></table>
16858 !! end
16860 !! test
16861 Sanitizer: Closing of open but not closed tags
16862 !! wikitext
16863 <s>foo
16864 !! html
16865 <p><s>foo</s>
16866 </p>
16867 !! end
16869 !! test
16870 Sanitizer: Closing of closed but not open tags
16871 !! options
16872 parsoid=wt2html
16873 !! wikitext
16874 </s>
16875 !! html/php+tidy
16876 !! html/parsoid
16877 !! end
16879 !! test
16880 Sanitizer: Closing of closed but not open table tags
16881 !! options
16882 parsoid=wt2html
16883 !! wikitext
16884 Table not started</td></tr></table>
16885 !! html/php+tidy
16886 <p>Table not started</p>
16887 !! html/parsoid
16888 <p>Table not started</p>
16889 !! end
16891 !! test
16892 Sanitizer: Escaping of spaces, multibyte characters, colons & other stuff in id=""
16893 !! wikitext
16894 <span id="æ: v">byte</span>[[#æ: v|backlink]]
16895 !! html
16896 <p><span id=".C3.A6:_v">byte</span><a href="#.C3.A6:_v">backlink</a>
16897 </p>
16898 !! end
16900 # In HTML5, the restrictions are that id must contain at least one character,
16901 # and must not contain any space characters.
16902 !! test
16903 Sanitizer: Validating the contents of the id attribute (bug 4515)
16904 !! options
16905 disabled
16906 !! wikitext
16907 <br id="" /><br id="a space" />
16908 !! html
16909 Something ...
16910 !! end
16912 # In HTML5, id must be unique amongst all the ids in the element's home subtree.
16913 !! test
16914 Sanitizer: Validating id attribute uniqueness (bug 4515, bug 6301)
16915 !! options
16916 disabled
16917 !! wikitext
16918 <br id="foo" /><br id="foo" />
16919 !! html
16920 Something need to be done. foo-2 ? 
16921 !! end
16923 !! test
16924 Sanitizer: Validating that <meta> and <link> work, but only for Microdata
16925 !! wikitext
16926 <div itemscope>
16927         <meta itemprop="hello" content="world">
16928         <meta http-equiv="refresh" content="5">
16929         <meta itemprop="hello" http-equiv="refresh" content="5">
16930         <link itemprop="hello" href="{{SERVER}}">
16931         <link rel="stylesheet" href="{{SERVER}}">
16932         <link rel="stylesheet" itemprop="hello" href="{{SERVER}}">
16933 </div>
16934 !! html
16935 <div itemscope="">
16936 <p>     <meta itemprop="hello" content="world" />
16937         &lt;meta http-equiv="refresh" content="5"&gt;
16938         <meta itemprop="hello" content="5" />
16939 </p>
16940         <link itemprop="hello" href="http&#58;//example.org" />
16941         &lt;link rel="stylesheet" href="<a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>"&gt;
16942         <link itemprop="hello" href="http&#58;//example.org" />
16943 </div>
16945 !! end
16947 !! test
16948 Language converter: output gets cut off unexpectedly (bug 5757)
16949 !! options
16950 language=zh
16951 !! wikitext
16952 this bit is safe: }-
16954 but if we add a conversion instance: -{zh-cn:xxx;zh-tw:yyy}-
16956 then we get cut off here: }-
16958 all additional text is vanished
16959 !! html
16960 <p>this bit is safe: }-
16961 </p><p>but if we add a conversion instance: xxx
16962 </p><p>then we get cut off here: }-
16963 </p><p>all additional text is vanished
16964 </p>
16965 !! end
16967 !! test
16968 Self closed html pairs (bug 5487)
16969 !! options
16970 !! wikitext
16971 <center><font id="bug" />Centered text</center>
16972 <div><font id="bug2" />In div text</div>
16973 !! html
16974 <center>&lt;font id="bug" /&gt;Centered text</center>
16975 <div>&lt;font id="bug2" /&gt;In div text</div>
16977 !! end
16983 !! test
16984 Punctuation: nbsp before exclamation
16985 !! wikitext
16986 C'est grave !
16987 !! html
16988 <p>C'est grave&#160;!
16989 </p>
16990 !! end
16992 !! test
16993 Punctuation: CSS !important (bug 11874)
16994 !! wikitext
16995 <div style="width:50% !important">important</div>
16996 !! html
16997 <div style="width:50% !important">important</div>
16999 !!end
17001 !! test
17002 Punctuation: CSS ! important (bug 11874; with space after)
17003 !! wikitext
17004 <div style="width:50% ! important">important</div>
17005 !! html
17006 <div style="width:50% ! important">important</div>
17008 !!end
17010 !! test
17011 HTML bullet list, closed tags (bug 5497)
17012 !! wikitext
17013 <ul>
17014 <li>One</li>
17015 <li>Two</li>
17016 </ul>
17017 !! html/php
17018 <ul>
17019 <li>One</li>
17020 <li>Two</li>
17021 </ul>
17023 !! html/parsoid
17024 <ul data-parsoid='{"stx":"html"}'>
17025 <li data-parsoid='{"stx":"html"}'>One</li>
17026 <li data-parsoid='{"stx":"html"}'>Two</li>
17027 </ul>
17029 !! end
17031 !! test
17032 HTML bullet list, unclosed tags (bug 5497)
17033 !! wikitext
17034 <ul>
17035 <li>One
17036 <li>Two
17037 </ul>
17038 !! html/php+tidy
17039 <ul>
17040 <li>One</li>
17041 <li>Two</li>
17042 </ul>
17043 !! html/parsoid
17044 <ul data-parsoid='{"stx":"html"}'>
17045 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>One</li>
17046 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>Two</li>
17047 </ul>
17049 !! end
17051 !! test
17052 HTML ordered list, closed tags (bug 5497)
17053 !! wikitext
17054 <ol>
17055 <li>One</li>
17056 <li>Two</li>
17057 </ol>
17058 !! html/php
17059 <ol>
17060 <li>One</li>
17061 <li>Two</li>
17062 </ol>
17064 !! html/parsoid
17065 <ol data-parsoid='{"stx":"html"}'>
17066 <li data-parsoid='{"stx":"html"}'>One</li>
17067 <li data-parsoid='{"stx":"html"}'>Two</li>
17068 </ol>
17070 !! end
17072 !! test
17073 HTML ordered list, unclosed tags (bug 5497)
17074 !! options
17075 !! wikitext
17076 <ol>
17077 <li>One
17078 <li>Two
17079 </ol>
17080 !! html/php+tidy
17081 <ol>
17082 <li>One</li>
17083 <li>Two</li>
17084 </ol>
17085 !! html/parsoid
17086 <ol data-parsoid='{"stx":"html"}'>
17087 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>One</li>
17088 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>Two</li>
17089 </ol>
17091 !! end
17093 !! test
17094 HTML nested bullet list, closed tags (bug 5497)
17095 !! wikitext
17096 <ul>
17097 <li>One</li>
17098 <li>Two:
17099 <ul>
17100 <li>Sub-one</li>
17101 <li>Sub-two</li>
17102 </ul>
17103 </li>
17104 </ul>
17105 !! html/php
17106 <ul>
17107 <li>One</li>
17108 <li>Two:
17109 <ul>
17110 <li>Sub-one</li>
17111 <li>Sub-two</li>
17112 </ul>
17113 </li>
17114 </ul>
17116 !! html/parsoid
17117 <ul data-parsoid='{"stx":"html"}'>
17118 <li data-parsoid='{"stx":"html"}'>One</li>
17119 <li data-parsoid='{"stx":"html"}'>Two:
17120 <ul data-parsoid='{"stx":"html"}'>
17121 <li data-parsoid='{"stx":"html"}'>Sub-one</li>
17122 <li data-parsoid='{"stx":"html"}'>Sub-two</li>
17123 </ul>
17124 </li>
17125 </ul>
17126 !! end
17128 !! test
17129 HTML nested bullet list, open tags (bug 5497)
17130 !! wikitext
17131 <ul>
17132 <li>One
17133 <li>Two:
17134 <ul>
17135 <li>Sub-one
17136 <li>Sub-two
17137 </ul>
17138 </ul>
17139 !! html/php+tidy
17140 <ul>
17141 <li>One</li>
17142 <li>Two:
17143 <ul>
17144 <li>Sub-one</li>
17145 <li>Sub-two</li>
17146 </ul>
17147 </li>
17148 </ul>
17149 !! html/parsoid
17150 <ul>
17151 <li>One
17152 </li>
17153 <li>Two:
17154 <ul>
17155 <li>Sub-one
17156 </li>
17157 <li>Sub-two
17158 </li>
17159 </ul>
17160 </li>
17161 </ul>
17163 !! end
17165 !! test
17166 HTML nested ordered list, closed tags (bug 5497)
17167 !! wikitext
17168 <ol>
17169 <li>One</li>
17170 <li>Two:
17171 <ol>
17172 <li>Sub-one</li>
17173 <li>Sub-two</li>
17174 </ol>
17175 </li>
17176 </ol>
17177 !! html
17178 <ol>
17179 <li>One</li>
17180 <li>Two:
17181 <ol>
17182 <li>Sub-one</li>
17183 <li>Sub-two</li>
17184 </ol>
17185 </li>
17186 </ol>
17188 !! end
17190 !! test
17191 HTML nested ordered list, open tags (bug 5497)
17192 !! wikitext
17193 <ol>
17194 <li>One
17195 <li>Two:
17196 <ol>
17197 <li>Sub-one
17198 <li>Sub-two
17199 </ol>
17200 </ol>
17201 !! html/php
17202 <ol>
17203 <li>One
17204 <li>Two:
17205 <ol>
17206 <li>Sub-one
17207 <li>Sub-two
17208 </ol>
17209 </ol>
17211 !! html/parsoid
17212 <ol>
17213 <li>One
17214 </li>
17215 <li>Two:
17216 <ol>
17217 <li>Sub-one
17218 </li>
17219 <li>Sub-two
17220 </li>
17221 </ol>
17222 </li>
17223 </ol>
17225 !! end
17227 !! test
17228 HTML ordered list item with parameters oddity
17229 !! wikitext
17230 <ol><li id="fragment">One</li>
17231 </ol>
17232 !! html
17233 <ol><li id="fragment">One</li>
17234 </ol>
17236 !! end
17238 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
17239 !!test
17240 bug 5918: autonumbering
17241 !! wikitext
17242 [http://first/] [http://second] [ftp://ftp]
17244 ftp://inlineftp
17246 [mailto:enclosed@mail.tld With target]
17248 [mailto:enclosed@mail.tld]
17250 mailto:inline@mail.tld
17251 !! html/php
17252 <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>
17253 </p><p><a rel="nofollow" class="external free" href="ftp://inlineftp">ftp://inlineftp</a>
17254 </p><p><a rel="nofollow" class="external text" href="mailto:enclosed@mail.tld">With target</a>
17255 </p><p><a rel="nofollow" class="external autonumber" href="mailto:enclosed@mail.tld">[4]</a>
17256 </p><p><a rel="nofollow" class="external free" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a>
17257 </p>
17258 !! html/parsoid
17259 <p><a rel="mw:ExtLink" href="http://first/"></a> <a rel="mw:ExtLink" href="http://second"></a> <a rel="mw:ExtLink" href="ftp://ftp"></a></p>
17260 <p><a rel="mw:ExtLink" href="ftp://inlineftp">ftp://inlineftp</a></p>
17261 <p><a rel="mw:ExtLink" href="mailto:enclosed@mail.tld">With target</a></p>
17262 <p><a rel="mw:ExtLink" href="mailto:enclosed@mail.tld"></a></p>
17263 <p><a rel="mw:ExtLink" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a></p>
17264 !! end
17268 # Security and HTML correctness
17269 # From Nick Jenkins' fuzz testing
17272 !! test
17273 Fuzz testing: Parser13
17274 !! wikitext
17275 {| 
17276 | http://a|
17277 !! html
17278 <table>
17279 <tr>
17280 <td>
17281 </td>
17282 </tr>
17283 </table>
17285 !! end
17287 !! test
17288 Fuzz testing: Parser14
17289 !! wikitext
17290 == onmouseover= ==
17291 http://__TOC__
17292 !! html
17293 <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>
17294 http://<div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
17295 <ul>
17296 <li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
17297 </ul>
17298 </div>
17301 !! html+tidy
17302 <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>
17303 <p>http://</p>
17304 <div id="toc" class="toc">
17305 <div id="toctitle">
17306 <h2>Contents</h2>
17307 </div>
17308 <ul>
17309 <li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
17310 </ul>
17311 </div>
17312 <p></p>
17313 !! end
17315 !! test
17316 Fuzz testing: Parser14-table
17317 !! options
17318 parsoid=wt2html,html2html
17319 !! wikitext
17320 ==a==
17321 {| STYLE=__TOC__
17322 !! html
17323 <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>
17324 <table style="&#95;_TOC&#95;_">
17325 <tr><td></td></tr>
17326 </table>
17328 !! html+tidy
17329 <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>
17330 <table style="__TOC__">
17331 <tr>
17332 <td></td>
17333 </tr>
17334 </table>
17335 !! html/parsoid
17336 <h2>a</h2>
17337 <table style="__TOC__"></table>
17338 !! end
17340 # Known to produce bogus xml (extra </td>)
17341 !! test
17342 Fuzz testing: Parser16
17343 !! wikitext
17345 !https://||||||
17346 !! html
17347 <table>
17348 <tr>
17349 <th>https://</th>
17350 <th></th>
17351 <th></th>
17352 <th>
17353 </td>
17354 </tr>
17355 </table>
17357 !! html+tidy
17358 <table>
17359 <tr>
17360 <th>https://</th>
17361 <th></th>
17362 <th></th>
17363 <th></th>
17364 </tr>
17365 </table>
17366 !! end
17368 !! test
17369 Fuzz testing: Parser21
17370 !! wikitext
17372 ! irc://{{ftp://a" onmouseover="alert('hello world');"
17374 !! html
17375 <table>
17376 <tr>
17377 <th> <a rel="nofollow" class="external free" href="irc://{{ftp://a">irc://{{ftp://a</a>" onmouseover="alert('hello world');"
17378 </th>
17379 <td>
17380 </td>
17381 </tr>
17382 </table>
17384 !! end
17386 !! test
17387 Fuzz testing: Parser22
17388 !! wikitext
17389 http://===r:::https://b
17392 !! html
17393 <p><a rel="nofollow" class="external free" href="http://===r:::https://b">http://===r:::https://b</a>
17394 </p>
17395 <table>
17396 <tr><td></td></tr>
17397 </table>
17399 !! end
17401 # Known to produce bad XML for now
17402 !! test
17403 Fuzz testing: Parser24
17404 !! wikitext
17406 {{{|
17407 <u CLASS=
17408 | {{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx--><noinclude>}}}} >
17409 <br style="onmouseover='alert(document.cookie);' " />
17411 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
17413 !! html
17414 <table>
17415 {{{|
17416 <u class="&#124;">}}}} &gt;
17417 <br style="onmouseover=&#39;alert(document.cookie);&#39;" />
17419 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
17420 <tr>
17421 <td></u>
17422 </td>
17423 </tr>
17424 </table>
17426 !! end
17428 # Note: the current result listed for this is not what the original one was,
17429 # but the original bug was JavaScript injection, which is fixed in any case.
17430 # It's not clear that the original result listed was any more correct than the
17431 # current one.  Original result:
17432 # <p>{{{| 
17433 # </p>
17434 # <li class="&#124;&#124;">
17435 # }}}blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
17436 !!test
17437 Fuzz testing: Parser25 (bug 6055)
17438 !! wikitext
17441 <LI CLASS=||
17443 }}}blah" onmouseover="alert('hello world');" align="left"'''MOVE MOUSE CURSOR OVER HERE
17444 !! html
17445 <p>&lt;LI CLASS=blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
17446 </p>
17447 !! end
17449 !!test
17450 Fuzz testing: URL adjacent extension (with space, clean)
17451 !! wikitext
17452 http://example.com <nowiki>junk</nowiki>
17453 !! html/php
17454 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a> junk
17455 </p>
17456 !! html/parsoid
17457 <p><a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a> <span typeof="mw:Nowiki">junk</span></p>
17458 !! end
17460 !!test
17461 Fuzz testing: URL adjacent extension (no space, dirty; nowiki)
17462 !! wikitext
17463 http://example.com<nowiki>junk</nowiki>
17464 !! html/php
17465 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>junk
17466 </p>
17467 !! html/parsoid
17468 <p><a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a><span typeof="mw:Nowiki">junk</span></p>
17469 !! end
17471 !!test
17472 Fuzz testing: URL adjacent extension (no space, dirty; pre)
17473 !! wikitext
17474 http://example.com<pre>junk</pre>
17475 !! html/php
17476 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a><pre>junk</pre>
17478 !! html/php+tidy
17479 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a></p>
17480 <pre>
17481 junk
17482 </pre>
17483 !! html/parsoid
17484 <p><a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a></p><pre data-parsoid='{"stx":"html"}'>junk</pre>
17485 !!end
17487 !!test
17488 Fuzz testing: image with bogus manual thumbnail
17489 !! wikitext
17490 [[Image:foobar.jpg|thumbnail= ]]
17491 !! html/php
17492 <div class="thumb tright"><div class="thumbinner" style="width:182px;">Error creating thumbnail:   <div class="thumbcaption"></div></div></div>
17494 !! html/parsoid
17495 <figure class="mw-default-size" typeof="mw:Error mw:Image/Thumb" data-parsoid='{"optList":[{"ck":"manualthumb","ak":"thumbnail= "}]}' data-mw='{"errors":[{"key":"missing-thumbnail","message":"This thumbnail does not exist.","params":{"name":""}}],"thumb":""}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"},"sa":{}}'><img resource="./File:Foobar.jpg" src="./Special:FilePath/" height="220" width="220" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"220","width":"220"},"sa":{"resource":"Image:foobar.jpg"}}'/></a></figure>
17496 !!end
17498 !! test
17499 Fuzz testing: encoded newline in generated HTML replacements (bug 6577)
17500 !! wikitext
17501 <pre dir="&#10;"></pre>
17502 !! html
17503 <pre dir="&#10;"></pre>
17505 !! end
17507 !! test
17508 Parsing optional HTML elements (Bug 6171)
17509 !! options
17510 !! wikitext
17511 <table>
17512   <tr>
17513     <td> Some tabular data</td>
17514     <td> More tabular data ...
17515     <td> And yet som tabular data</td>
17516   </tr>
17517 </table>
17518 !! html
17519 <table>
17520   <tr>
17521     <td> Some tabular data</td>
17522     <td> More tabular data ...
17523     </td><td> And yet som tabular data</td>
17524   </tr>
17525 </table>
17527 !! end
17529 !! test
17530 Correct handling of <td>, <tr> (Bug 6171)
17531 !! options
17532 !! wikitext
17533 <table>
17534   <tr>
17535     <td> Some tabular data</td>
17536     <td> More tabular data ...</td>
17537     <td> And yet som tabular data</td>
17538   </tr>
17539 </table>
17540 !! html
17541 <table>
17542   <tr>
17543     <td> Some tabular data</td>
17544     <td> More tabular data ...</td>
17545     <td> And yet som tabular data</td>
17546   </tr>
17547 </table>
17549 !! end
17552 !! test
17553 Parsing crashing regression (fr:JavaScript)
17554 !! wikitext
17555 </body></x>
17556 !! html
17557 <p>&lt;/body&gt;&lt;/x&gt;
17558 </p>
17559 !! end
17561 !! test
17562 Inline wiki vs wiki block nesting
17563 !! wikitext
17564 '''Bold paragraph
17566 New wiki paragraph
17567 !! html
17568 <p><b>Bold paragraph</b>
17569 </p><p>New wiki paragraph
17570 </p>
17571 !! end
17573 # FIXME: The current php output is documented
17574 # and desired output is the parsoid target.
17575 !! test
17576 Inline HTML vs wiki block nesting
17577 !! wikitext
17578 <b>Bold paragraph
17580 New wiki paragraph
17581 !! html/php
17582 <p><b>Bold paragraph
17583 </p><p>New wiki paragraph</b>
17584 </p>
17585 !! html/parsoid
17586 <p><b>Bold paragraph</b>
17587 </p><p>New wiki paragraph
17588 </p>
17589 !! end
17591 # Original result was this:
17592 # <p><b>bold</b><b>bold<i>bolditalics</i></b>
17593 # </p>
17594 # While that might be marginally more intuitive, maybe, the six-apostrophe
17595 # construct is clearly pathological and the result stated here (which is what
17596 # the parser actually does) is about as reasonable as anything.
17597 !!test
17598 Mixing markup for italics and bold
17599 !! options
17600 !! wikitext
17601 '''bold''''''bold''bolditalics'''''
17602 !! html
17603 <p>'<i>bold'</i><b>bold<i>bolditalics</i></b>
17604 </p>
17605 !! end
17608 !! article
17609 Xyzzyx
17610 !! text
17611 Article for special page transclusion test
17612 !! endarticle
17614 !! test
17615 Special page transclusion
17616 !! options
17617 !! wikitext
17618 {{Special:Prefixindex/Xyzzyx}}
17619 !! html
17620 <ul class="mw-prefixindex-list"><li><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></li>
17621 </ul>
17623 !! end
17625 !! test
17626 Special page transclusion twice (bug 5021)
17627 !! options
17628 !! wikitext
17629 {{Special:Prefixindex/Xyzzyx}}
17630 {{Special:Prefixindex/Xyzzyx}}
17631 !! html
17632 <ul class="mw-prefixindex-list"><li><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></li>
17633 </ul>
17634 <ul class="mw-prefixindex-list"><li><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></li>
17635 </ul>
17637 !! end
17639 !! test
17640 Transclusion of default MediaWiki message
17641 !! wikitext
17642 {{MediaWiki:Mainpage}}
17643 !! html
17644 <p>Main Page
17645 </p>
17646 !! end
17648 !! test
17649 Transclusion of nonexistent MediaWiki message
17650 !! wikitext
17651 {{MediaWiki:Mainpagexxx}}
17652 !! html
17653 <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>
17654 </p>
17655 !! end
17657 !! test
17658 Transclusion of MediaWiki message with underscore
17659 !! wikitext
17660 {{MediaWiki:history_short}}
17661 !! html
17662 <p>History
17663 </p>
17664 !! end
17666 !! test
17667 Transclusion of MediaWiki message with space
17668 !! wikitext
17669 {{MediaWiki:history short}}
17670 !! html
17671 <p>History
17672 </p>
17673 !! end
17675 !! test
17676 Invalid header with following text
17677 !! wikitext
17678 = x = y
17679 !! html
17680 <p>= x = y
17681 </p>
17682 !! end
17685 !! test
17686 Section extraction test (section 0)
17687 !! options
17688 section=0
17689 !! wikitext
17690 start
17691 ==a==
17692 ===aa===
17693 ====aaa====
17694 ==b==
17695 ===ba===
17696 ===bb===
17697 ====bba====
17698 ===bc===
17699 ==c==
17700 ===ca===
17701 !! html/php
17702 start
17703 !! end
17705 !! test
17706 Section extraction test (section 1)
17707 !! options
17708 section=1
17709 !! wikitext
17710 start
17711 ==a==
17712 ===aa===
17713 ====aaa====
17714 ==b==
17715 ===ba===
17716 ===bb===
17717 ====bba====
17718 ===bc===
17719 ==c==
17720 ===ca===
17721 !! html/php
17722 ==a==
17723 ===aa===
17724 ====aaa====
17725 !! end
17727 !! test
17728 Section extraction test (section 2)
17729 !! options
17730 section=2
17731 !! wikitext
17732 start
17733 ==a==
17734 ===aa===
17735 ====aaa====
17736 ==b==
17737 ===ba===
17738 ===bb===
17739 ====bba====
17740 ===bc===
17741 ==c==
17742 ===ca===
17743 !! html/php
17744 ===aa===
17745 ====aaa====
17746 !! end
17748 !! test
17749 Section extraction test (section 3)
17750 !! options
17751 section=3
17752 !! wikitext
17753 start
17754 ==a==
17755 ===aa===
17756 ====aaa====
17757 ==b==
17758 ===ba===
17759 ===bb===
17760 ====bba====
17761 ===bc===
17762 ==c==
17763 ===ca===
17764 !! html/php
17765 ====aaa====
17766 !! end
17768 !! test
17769 Section extraction test (section 4)
17770 !! options
17771 section=4
17772 !! wikitext
17773 start
17774 ==a==
17775 ===aa===
17776 ====aaa====
17777 ==b==
17778 ===ba===
17779 ===bb===
17780 ====bba====
17781 ===bc===
17782 ==c==
17783 ===ca===
17784 !! html/php
17785 ==b==
17786 ===ba===
17787 ===bb===
17788 ====bba====
17789 ===bc===
17790 !! end
17792 !! test
17793 Section extraction test (section 5)
17794 !! options
17795 section=5
17796 !! wikitext
17797 start
17798 ==a==
17799 ===aa===
17800 ====aaa====
17801 ==b==
17802 ===ba===
17803 ===bb===
17804 ====bba====
17805 ===bc===
17806 ==c==
17807 ===ca===
17808 !! html/php
17809 ===ba===
17810 !! end
17812 !! test
17813 Section extraction test (section 6)
17814 !! options
17815 section=6
17816 !! wikitext
17817 start
17818 ==a==
17819 ===aa===
17820 ====aaa====
17821 ==b==
17822 ===ba===
17823 ===bb===
17824 ====bba====
17825 ===bc===
17826 ==c==
17827 ===ca===
17828 !! html/php
17829 ===bb===
17830 ====bba====
17831 !! end
17833 !! test
17834 Section extraction test (section 7)
17835 !! options
17836 section=7
17837 !! wikitext
17838 start
17839 ==a==
17840 ===aa===
17841 ====aaa====
17842 ==b==
17843 ===ba===
17844 ===bb===
17845 ====bba====
17846 ===bc===
17847 ==c==
17848 ===ca===
17849 !! html/php
17850 ====bba====
17851 !! end
17853 !! test
17854 Section extraction test (section 8)
17855 !! options
17856 section=8
17857 !! wikitext
17858 start
17859 ==a==
17860 ===aa===
17861 ====aaa====
17862 ==b==
17863 ===ba===
17864 ===bb===
17865 ====bba====
17866 ===bc===
17867 ==c==
17868 ===ca===
17869 !! html/php
17870 ===bc===
17871 !! end
17873 !! test
17874 Section extraction test (section 9)
17875 !! options
17876 section=9
17877 !! wikitext
17878 start
17879 ==a==
17880 ===aa===
17881 ====aaa====
17882 ==b==
17883 ===ba===
17884 ===bb===
17885 ====bba====
17886 ===bc===
17887 ==c==
17888 ===ca===
17889 !! html/php
17890 ==c==
17891 ===ca===
17892 !! end
17894 !! test
17895 Section extraction test (section 10)
17896 !! options
17897 section=10
17898 !! wikitext
17899 start
17900 ==a==
17901 ===aa===
17902 ====aaa====
17903 ==b==
17904 ===ba===
17905 ===bb===
17906 ====bba====
17907 ===bc===
17908 ==c==
17909 ===ca===
17910 !! html/php
17911 ===ca===
17912 !! end
17914 !! test
17915 Section extraction test (nonexistent section 11)
17916 !! options
17917 section=11
17918 !! wikitext
17919 start
17920 ==a==
17921 ===aa===
17922 ====aaa====
17923 ==b==
17924 ===ba===
17925 ===bb===
17926 ====bba====
17927 ===bc===
17928 ==c==
17929 ===ca===
17930 !! html/php
17931 !! end
17933 !! test
17934 Section extraction test with bogus heading (section 1)
17935 !! options
17936 section=1
17937 !! wikitext
17938 ==a==
17939 ==bogus== not a legal section
17940 ==b==
17941 !! html/php
17942 ==a==
17943 ==bogus== not a legal section
17944 !! end
17946 !! test
17947 Section extraction test with bogus heading (section 2)
17948 !! options
17949 section=2
17950 !! wikitext
17951 ==a==
17952 ==bogus== not a legal section
17953 ==b==
17954 !! html/php
17955 ==b==
17956 !! end
17958 !! test
17959 Section extraction test with comment after heading (section 1)
17960 !! options
17961 section=1
17962 !! wikitext
17963 ==a==
17964 ==b== <!-- -->
17965 ==c==
17966 !! html/php
17967 ==a==
17968 !! end
17970 !! test
17971 Section extraction test with comment after heading (section 2)
17972 !! options
17973 section=2
17974 !! wikitext
17975 ==a==
17976 ==b== <!-- -->
17977 ==c==
17978 !! html/php
17979 ==b== <!-- -->
17980 !! end
17982 !! test
17983 Section extraction test with bogus <nowiki> heading (section 1)
17984 !! options
17985 section=1
17986 !! wikitext
17987 ==a==
17988 ==bogus== <nowiki>not a legal section</nowiki>
17989 ==b==
17990 !! html/php
17991 ==a==
17992 ==bogus== <nowiki>not a legal section</nowiki>
17993 !! end
17995 !! test
17996 Section extraction test with bogus <nowiki> heading (section 2)
17997 !! options
17998 section=2
17999 !! wikitext
18000 ==a==
18001 ==bogus== <nowiki>not a legal section</nowiki>
18002 ==b==
18003 !! html/php
18004 ==b==
18005 !! end
18007 # Formerly testing for bug 2587, now resolved by the use of unmarked sections
18008 # instead of respecting commented sections
18009 !! test
18010 Section extraction prefixed by comment (section 1)
18011 !! options
18012 section=1
18013 !! wikitext
18014 <!-- -->==sec1==
18015 ==sec2==
18016 !! html/php
18017 ==sec2==
18018 !!end
18020 !! test
18021 Section extraction prefixed by comment (section 2)
18022 !! options
18023 section=2
18024 !! wikitext
18025 <!-- -->==sec1==
18026 ==sec2==
18027 !! html/php
18029 !!end
18031 # Formerly testing for bug 2607, now resolved by the use of unmarked sections
18032 # instead of respecting HTML-style headings
18033 !! test
18034 Section extraction, mixed wiki and html (section 1)
18035 !! options
18036 section=1
18037 !! wikitext
18038 <h2>unmarked</h2>
18039 unmarked
18040 ==1==
18042 ==2==
18044 !! html/php
18045 ==1==
18047 !! end
18049 !! test
18050 Section extraction, mixed wiki and html (section 2)
18051 !! options
18052 section=2
18053 !! wikitext
18054 <h2>unmarked</h2>
18055 unmarked
18056 ==1==
18058 ==2==
18060 !! html/php
18061 ==2==
18063 !! end
18066 # Formerly testing for bug 3342
18067 !! test
18068 Section extraction, heading surrounded by <noinclude>
18069 !! options
18070 section=1
18071 !! wikitext
18072 <noinclude>==unmarked==</noinclude>
18073 ==marked==
18074 !! html/php
18075 ==marked==
18076 !!end
18078 # Test behavior of bug 19910
18079 !! test
18080 Sectiion with all-equals
18081 !! options
18082 section=2
18083 !! wikitext
18084 === 
18085 The line above must have a trailing space
18086 === <!--
18087 --> <!-- -->
18088 But just in case it doesn't...
18089 !! html/php
18090 === <!--
18091 --> <!-- -->
18092 But just in case it doesn't...
18093 !! end
18095 !! test
18096 Section replacement test (section 0)
18097 !! options
18098 replace=0,"xxx"
18099 !! wikitext
18100 start
18101 ==a==
18102 ===aa===
18103 ====aaa====
18104 ==b==
18105 ===ba===
18106 ===bb===
18107 ====bba====
18108 ===bc===
18109 ==c==
18110 ===ca===
18111 !! html/php
18114 ==a==
18115 ===aa===
18116 ====aaa====
18117 ==b==
18118 ===ba===
18119 ===bb===
18120 ====bba====
18121 ===bc===
18122 ==c==
18123 ===ca===
18124 !! end
18126 !! test
18127 Section replacement test (section 1)
18128 !! options
18129 replace=1,"xxx"
18130 !! wikitext
18131 start
18132 ==a==
18133 ===aa===
18134 ====aaa====
18135 ==b==
18136 ===ba===
18137 ===bb===
18138 ====bba====
18139 ===bc===
18140 ==c==
18141 ===ca===
18142 !! html/php
18143 start
18146 ==b==
18147 ===ba===
18148 ===bb===
18149 ====bba====
18150 ===bc===
18151 ==c==
18152 ===ca===
18153 !! end
18155 !! test
18156 Section replacement test (section 2)
18157 !! options
18158 replace=2,"xxx"
18159 !! wikitext
18160 start
18161 ==a==
18162 ===aa===
18163 ====aaa====
18164 ==b==
18165 ===ba===
18166 ===bb===
18167 ====bba====
18168 ===bc===
18169 ==c==
18170 ===ca===
18171 !! html/php
18172 start
18173 ==a==
18176 ==b==
18177 ===ba===
18178 ===bb===
18179 ====bba====
18180 ===bc===
18181 ==c==
18182 ===ca===
18183 !! end
18185 !! test
18186 Section replacement test (section 3)
18187 !! options
18188 replace=3,"xxx"
18189 !! wikitext
18190 start
18191 ==a==
18192 ===aa===
18193 ====aaa====
18194 ==b==
18195 ===ba===
18196 ===bb===
18197 ====bba====
18198 ===bc===
18199 ==c==
18200 ===ca===
18201 !! html/php
18202 start
18203 ==a==
18204 ===aa===
18207 ==b==
18208 ===ba===
18209 ===bb===
18210 ====bba====
18211 ===bc===
18212 ==c==
18213 ===ca===
18214 !! end
18216 !! test
18217 Section replacement test (section 4)
18218 !! options
18219 replace=4,"xxx"
18220 !! wikitext
18221 start
18222 ==a==
18223 ===aa===
18224 ====aaa====
18225 ==b==
18226 ===ba===
18227 ===bb===
18228 ====bba====
18229 ===bc===
18230 ==c==
18231 ===ca===
18232 !! html/php
18233 start
18234 ==a==
18235 ===aa===
18236 ====aaa====
18239 ==c==
18240 ===ca===
18241 !! end
18243 !! test
18244 Section replacement test (section 5)
18245 !! options
18246 replace=5,"xxx"
18247 !! wikitext
18248 start
18249 ==a==
18250 ===aa===
18251 ====aaa====
18252 ==b==
18253 ===ba===
18254 ===bb===
18255 ====bba====
18256 ===bc===
18257 ==c==
18258 ===ca===
18259 !! html/php
18260 start
18261 ==a==
18262 ===aa===
18263 ====aaa====
18264 ==b==
18267 ===bb===
18268 ====bba====
18269 ===bc===
18270 ==c==
18271 ===ca===
18272 !! end
18274 !! test
18275 Section replacement test (section 6)
18276 !! options
18277 replace=6,"xxx"
18278 !! wikitext
18279 start
18280 ==a==
18281 ===aa===
18282 ====aaa====
18283 ==b==
18284 ===ba===
18285 ===bb===
18286 ====bba====
18287 ===bc===
18288 ==c==
18289 ===ca===
18290 !! html/php
18291 start
18292 ==a==
18293 ===aa===
18294 ====aaa====
18295 ==b==
18296 ===ba===
18299 ===bc===
18300 ==c==
18301 ===ca===
18302 !! end
18304 !! test
18305 Section replacement test (section 7)
18306 !! options
18307 replace=7,"xxx"
18308 !! wikitext
18309 start
18310 ==a==
18311 ===aa===
18312 ====aaa====
18313 ==b==
18314 ===ba===
18315 ===bb===
18316 ====bba====
18317 ===bc===
18318 ==c==
18319 ===ca===
18320 !! html/php
18321 start
18322 ==a==
18323 ===aa===
18324 ====aaa====
18325 ==b==
18326 ===ba===
18327 ===bb===
18330 ===bc===
18331 ==c==
18332 ===ca===
18333 !! end
18335 !! test
18336 Section replacement test (section 8)
18337 !! options
18338 replace=8,"xxx"
18339 !! wikitext
18340 start
18341 ==a==
18342 ===aa===
18343 ====aaa====
18344 ==b==
18345 ===ba===
18346 ===bb===
18347 ====bba====
18348 ===bc===
18349 ==c==
18350 ===ca===
18351 !! html/php
18352 start
18353 ==a==
18354 ===aa===
18355 ====aaa====
18356 ==b==
18357 ===ba===
18358 ===bb===
18359 ====bba====
18362 ==c==
18363 ===ca===
18364 !!end
18366 !! test
18367 Section replacement test (section 9)
18368 !! options
18369 replace=9,"xxx"
18370 !! wikitext
18371 start
18372 ==a==
18373 ===aa===
18374 ====aaa====
18375 ==b==
18376 ===ba===
18377 ===bb===
18378 ====bba====
18379 ===bc===
18380 ==c==
18381 ===ca===
18382 !! html/php
18383 start
18384 ==a==
18385 ===aa===
18386 ====aaa====
18387 ==b==
18388 ===ba===
18389 ===bb===
18390 ====bba====
18391 ===bc===
18393 !! end
18395 !! test
18396 Section replacement test (section 10)
18397 !! options
18398 replace=10,"xxx"
18399 !! wikitext
18400 start
18401 ==a==
18402 ===aa===
18403 ====aaa====
18404 ==b==
18405 ===ba===
18406 ===bb===
18407 ====bba====
18408 ===bc===
18409 ==c==
18410 ===ca===
18411 !! html/php
18412 start
18413 ==a==
18414 ===aa===
18415 ====aaa====
18416 ==b==
18417 ===ba===
18418 ===bb===
18419 ====bba====
18420 ===bc===
18421 ==c==
18423 !! end
18425 !! test
18426 Section replacement test with initial whitespace (bug 13728)
18427 !! options
18428 replace=2,"xxx"
18429 !! wikitext
18430  Preformatted initial line
18431 ==a==
18432 ===a===
18433 !! html/php
18434  Preformatted initial line
18435 ==a==
18437 !! end
18440 !! test
18441 Section extraction, heading followed by pre with 20 spaces (bug 6398)
18442 !! options
18443 section=1
18444 !! wikitext
18445 ==a==
18446                     a
18447 !! html/php
18448 ==a==
18449                     a
18450 !! end
18452 !! test
18453 Section extraction, heading followed by pre with 19 spaces (bug 6398 sanity check)
18454 !! options
18455 section=1
18456 !! wikitext
18457 ==a==
18458                    a
18459 !! html/php
18460 ==a==
18461                    a
18462 !! end
18465 !! test
18466 Section extraction, <pre> around bogus header (bug 10309)
18467 !! options
18468 section=2
18469 !! wikitext
18470 == Section One ==
18471 <pre>
18472 =======
18473 </pre>
18475 == Section Two ==
18476 stuff
18477 !! html/php
18478 == Section Two ==
18479 stuff
18480 !! end
18482 !! test
18483 Section replacement, <pre> around bogus header (bug 10309)
18484 !! options
18485 replace=2,"xxx"
18486 !! wikitext
18487 == Section One ==
18488 <pre>
18489 =======
18490 </pre>
18492 == Section Two ==
18493 stuff
18494 !! html/php
18495 == Section One ==
18496 <pre>
18497 =======
18498 </pre>
18501 !! end
18504 !! test
18505 Handling of &#x0A; in URLs
18506 !! wikitext
18507 ** irc://&#x0A;a
18508 !! html/php
18509 <ul><li><ul><li> <a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a></li></ul></li></ul>
18511 !! html/parsoid
18512 <ul><li><ul><li> <a rel="mw:ExtLink" href="irc://
18513 a">irc://
18514 a</a></li></ul></li></ul>
18515 !! end
18517 !! test
18518 Handling of %0A in URLs
18519 !! wikitext
18520 ** irc://%0Aa
18521 !! html/php
18522 <ul><li><ul><li> <a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a></li></ul></li></ul>
18524 !! html/parsoid
18525 <ul><li><ul><li> <a rel="mw:ExtLink" href="irc://%0Aa">irc://%0Aa</a></li></ul></li></ul>
18526 !! end
18529 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
18530 !! test
18531 5 quotes, code coverage +1 line
18532 !! options
18533 parsoid=wt2html
18534 !! wikitext
18535 '''''
18536 !! html/php
18537 !! html/parsoid
18538 <p><b><i></i></b></p>
18539 !! end
18541 # same html as previous, but wikitext adjusted to match parsoid html2wt
18542 # note that wt2html and html2html will put the <i> before the <b>
18543 !! test
18544 5 quotes, code coverage +1 line w/ nowiki (1)
18545 !! options
18546 parsoid=wt2wt,html2wt
18547 !! wikitext
18548 '''''<nowiki/>'''''
18549 !! html/php
18550 <p><i></i>
18551 </p>
18552 !! html/parsoid
18553 <p><b><i></i></b></p>
18554 !! end
18556 # same as previous, just swapping the <i> and <b>
18557 !! test
18558 5 quotes, code coverage +1 line w/ nowiki (2)
18559 !! wikitext
18560 '''''<nowiki/>'''''
18561 !! html/php
18562 <p><i></i>
18563 </p>
18564 !! html/parsoid
18565 <p><i><b></b></i></p>
18566 !! end
18568 !! test
18569 Special:Search page linking.
18570 !! wikitext
18571 {{Special:search}}
18572 !! html
18573 <p><a href="/wiki/Special:Search" title="Special:Search">Special:Search</a>
18574 </p>
18575 !! end
18577 !! test
18578 {{!}} is a magic word
18579 !! wikitext
18580 {{!}} is a magic word there and {{!}} is still a magic word here
18581 | is not a magic word here but {{!}} is still a magic word here
18582 !! html/php
18583 <p>| is a magic word there and | is still a magic word here
18584 | is not a magic word here but | is still a magic word here
18585 </p>
18586 !! html/parsoid
18587 <p><span about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"pi":[[]]}' data-mw='{"parts":[{"template":{"target":{"wt":"!","href":"./Template:!"},"params":{},"i":0}}]}'>|</span> is a magic word there and <span about="#mwt2" typeof="mw:Transclusion" data-parsoid='{"pi":[[]]}' data-mw='{"parts":[{"template":{"target":{"wt":"!","href":"./Template:!"},"params":{},"i":0}}]}'>|</span> is still a magic word here
18588 | is not a magic word here but <span about="#mwt3" typeof="mw:Transclusion" data-parsoid='{"pi":[[]]}' data-mw='{"parts":[{"template":{"target":{"wt":"!","href":"./Template:!"},"params":{},"i":0}}]}'>|</span> is still a magic word here</p>
18590 !! end
18592 !! test
18593 Say the magic word
18594 !! options
18595 title=[[Parser test]]
18596 !! wikitext
18597 * {{PAGENAME}}
18598 * {{PAGENAMEE}}
18599 * {{FULLPAGENAME}}
18600 * {{FULLPAGENAMEE}}
18601 * {{BASEPAGENAME}}
18602 * {{BASEPAGENAMEE}}
18603 * {{SUBPAGENAME}}
18604 * {{SUBPAGENAMEE}}
18605 * {{ROOTPAGENAME}}
18606 * {{ROOTPAGENAMEE}}
18607 * {{TALKPAGENAME}}
18608 * {{TALKPAGENAMEE}}
18609 * {{SUBJECTPAGENAME}}
18610 * {{SUBJECTPAGENAMEE}}
18611 * {{NAMESPACEE}}
18612 * {{NAMESPACE}}
18613 * {{NAMESPACENUMBER}}
18614 * {{TALKSPACE}}
18615 * {{TALKSPACEE}}
18616 * {{SUBJECTSPACE}}
18617 * {{SUBJECTSPACEE}}
18618 * {{Dynamic|{{NUMBEROFUSERS}}|{{NUMBEROFPAGES}}|{{CURRENTVERSION}}|{{CONTENTLANGUAGE}}|{{DIRECTIONMARK}}|{{CURRENTTIMESTAMP}}|{{NUMBEROFARTICLES}}}}
18619 !! html
18620 <ul><li> Parser test</li>
18621 <li> Parser_test</li>
18622 <li> Parser test</li>
18623 <li> Parser_test</li>
18624 <li> Parser test</li>
18625 <li> Parser_test</li>
18626 <li> Parser test</li>
18627 <li> Parser_test</li>
18628 <li> Parser test</li>
18629 <li> Parser_test</li>
18630 <li> Talk:Parser test</li>
18631 <li> Talk:Parser_test</li>
18632 <li> Parser test</li>
18633 <li> Parser_test</li>
18634 <li> </li>
18635 <li> </li>
18636 <li> 0</li>
18637 <li> Talk</li>
18638 <li> Talk</li>
18639 <li> </li>
18640 <li> </li>
18641 <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></li></ul>
18643 !! end
18644 ### Note: Above tests excludes the "{{NUMBEROFADMINS}}" magic word because it generates a MySQL error when included.
18646 !! test
18647 Gallery
18648 !! wikitext
18649 <gallery>
18650 image1.png |
18651 image2.gif|||||
18653 image3|
18654 image4    |300px| centre
18655  image5.svg| http://///////
18656 [[x|xx]]]]
18657 * image6
18658 </gallery>
18659 !! html
18660 <ul class="gallery mw-gallery-traditional">
18661                 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18662                         <div class="thumb" style="height: 150px;">Image1.png</div>
18663                         <div class="gallerytext">
18664                         </div>
18665                 </div></li>
18666                 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18667                         <div class="thumb" style="height: 150px;">Image2.gif</div>
18668                         <div class="gallerytext">
18669                         </div>
18670                 </div></li>
18671                 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18672                         <div class="thumb" style="height: 150px;">Image3</div>
18673                         <div class="gallerytext">
18674                         </div>
18675                 </div></li>
18676                 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18677                         <div class="thumb" style="height: 150px;">Image4</div>
18678                         <div class="gallerytext">
18679 <pre>centre
18680 </pre>
18681                         </div>
18682                 </div></li>
18683                 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18684                         <div class="thumb" style="height: 150px;">Image5.svg</div>
18685                         <div class="gallerytext">
18686 <p><a rel="nofollow" class="external free" href="http://///////">http://///////</a>
18687 </p>
18688                         </div>
18689                 </div></li>
18690                 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18691                         <div class="thumb" style="height: 150px;">* image6</div>
18692                         <div class="gallerytext">
18693                         </div>
18694                 </div></li>
18695 </ul>
18697 !! end
18699 !! test
18700 Gallery (with options)
18701 !! wikitext
18702 <gallery widths='70px' heights='40px' perrow='2' caption='Foo [[Main Page]]' >
18703 File:Nonexistent.jpg|caption
18704 File:Nonexistent.jpg
18705 image:foobar.jpg|some '''caption''' [[Main Page]]
18706 image:foobar.jpg
18707 image:foobar.jpg|Blabla|alt=This is a foo-bar.|blabla.
18708 </gallery>
18709 !! html
18710 <ul class="gallery mw-gallery-traditional" style="max-width: 226px;_width: 226px;">
18711         <li class='gallerycaption'>Foo <a href="/wiki/Main_Page" title="Main Page">Main Page</a></li>
18712                 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
18713                         <div class="thumb" style="height: 70px;">Nonexistent.jpg</div>
18714                         <div class="gallerytext">
18715 <p>caption
18716 </p>
18717                         </div>
18718                 </div></li>
18719                 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
18720                         <div class="thumb" style="height: 70px;">Nonexistent.jpg</div>
18721                         <div class="gallerytext">
18722                         </div>
18723                 </div></li>
18724                 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
18725                         <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" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/105px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/140px-Foobar.jpg 2x" /></a></div></div>
18726                         <div class="gallerytext">
18727 <p>some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
18728 </p>
18729                         </div>
18730                 </div></li>
18731                 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
18732                         <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" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/105px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/140px-Foobar.jpg 2x" /></a></div></div>
18733                         <div class="gallerytext">
18734                         </div>
18735                 </div></li>
18736                 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
18737                         <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" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/105px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/140px-Foobar.jpg 2x" /></a></div></div>
18738                         <div class="gallerytext">
18739 <p>blabla.
18740 </p>
18741                         </div>
18742                 </div></li>
18743 </ul>
18745 !! end
18747 !! test
18748 Gallery with link that has fragment
18749 !! wikitext
18750 <gallery>
18751 image:foobar.jpg|link=Main_Page
18752 image:foobar.jpg|link=Main_Page#section
18753 image:foobar.jpg|link=Main Page#section|caption
18754 </gallery>
18755 !! html
18756 <ul class="gallery mw-gallery-traditional">
18757                 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18758                         <div class="thumb" style="width: 150px;"><div style="margin:68px auto;"><a href="/wiki/Main_Page"><img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" width="120" height="14" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/240px-Foobar.jpg 2x" /></a></div></div>
18759                         <div class="gallerytext">
18760                         </div>
18761                 </div></li>
18762                 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18763                         <div class="thumb" style="width: 150px;"><div style="margin:68px auto;"><a href="/wiki/Main_Page#section"><img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" width="120" height="14" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/240px-Foobar.jpg 2x" /></a></div></div>
18764                         <div class="gallerytext">
18765                         </div>
18766                 </div></li>
18767                 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18768                         <div class="thumb" style="width: 150px;"><div style="margin:68px auto;"><a href="/wiki/Main_Page#section"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" width="120" height="14" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/240px-Foobar.jpg 2x" /></a></div></div>
18769                         <div class="gallerytext">
18770 <p>caption
18771 </p>
18772                         </div>
18773                 </div></li>
18774 </ul>
18776 !! end
18778 !! test
18779 Gallery with wikitext inside caption
18780 !! wikitext
18781 <gallery>
18782 File:foobar.jpg|[[File:foobar.jpg|20px|desc|alt=inneralt]]|alt=galleryalt
18783 File:foobar.jpg|{{Test|unamedParam|alt=param}}|alt=galleryalt
18784 </gallery>
18785 !! html
18786 <ul class="gallery mw-gallery-traditional">
18787                 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18788                         <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" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/240px-Foobar.jpg 2x" /></a></div></div>
18789                         <div class="gallerytext">
18790 <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>
18791 </p>
18792                         </div>
18793                 </div></li>
18794                 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18795                         <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" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/240px-Foobar.jpg 2x" /></a></div></div>
18796                         <div class="gallerytext">
18797 <p>This is a test template
18798 </p>
18799                         </div>
18800                 </div></li>
18801 </ul>
18803 !! end
18805 !! test
18806 gallery (with showfilename option)
18807 !! wikitext
18808 <gallery showfilename>
18809 File:Nonexistent.jpg|caption
18810 File:Nonexistent.jpg
18811 image:foobar.jpg|some '''caption''' [[Main Page]]
18812 File:Foobar.jpg
18813 </gallery>
18814 !! html
18815 <ul class="gallery mw-gallery-traditional">
18816                 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18817                         <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
18818                         <div class="gallerytext">
18819 <p><a href="/wiki/File:Nonexistent.jpg" title="File:Nonexistent.jpg">Nonexistent.jpg</a><br />
18820 caption
18821 </p>
18822                         </div>
18823                 </div></li>
18824                 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18825                         <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
18826                         <div class="gallerytext">
18827 <p><a href="/wiki/File:Nonexistent.jpg" title="File:Nonexistent.jpg">Nonexistent.jpg</a><br />
18828 </p>
18829                         </div>
18830                 </div></li>
18831                 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18832                         <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" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/240px-Foobar.jpg 2x" /></a></div></div>
18833                         <div class="gallerytext">
18834 <p><a href="/wiki/File:Foobar.jpg" title="File:Foobar.jpg">Foobar.jpg</a><br />
18835 some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
18836 </p>
18837                         </div>
18838                 </div></li>
18839                 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18840                         <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" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/240px-Foobar.jpg 2x" /></a></div></div>
18841                         <div class="gallerytext">
18842 <p><a href="/wiki/File:Foobar.jpg" title="File:Foobar.jpg">Foobar.jpg</a><br />
18843 </p>
18844                         </div>
18845                 </div></li>
18846 </ul>
18848 !! end
18850 !! test
18851 Gallery (with namespace-less filenames)
18852 !! wikitext
18853 <gallery>
18854 File:Nonexistent.jpg
18855 Nonexistent.jpg
18856 image:foobar.jpg
18857 foobar.jpg
18858 </gallery>
18859 !! html
18860 <ul class="gallery mw-gallery-traditional">
18861                 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18862                         <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
18863                         <div class="gallerytext">
18864                         </div>
18865                 </div></li>
18866                 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18867                         <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
18868                         <div class="gallerytext">
18869                         </div>
18870                 </div></li>
18871                 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18872                         <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" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/240px-Foobar.jpg 2x" /></a></div></div>
18873                         <div class="gallerytext">
18874                         </div>
18875                 </div></li>
18876                 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18877                         <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" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/240px-Foobar.jpg 2x" /></a></div></div>
18878                         <div class="gallerytext">
18879                         </div>
18880                 </div></li>
18881 </ul>
18883 !! end
18885 !! test
18886 HTML Hex character encoding (spells the word "JavaScript")
18887 !! options
18888 parsoid=wt2html,wt2wt,html2html
18889 !! wikitext
18890 &#x4A;&#x061;&#x0076;&#x00061;&#x000053;&#x0000063;&#114;&#x0000069;&#00000112;&#x0000000074;
18891 !! html/php
18892 <p>&#x4a;&#x61;&#x76;&#x61;&#x53;&#x63;&#114;&#x69;&#112;&#x74;
18893 </p>
18894 !! html/php+tidy
18895 <p>JavaScript</p>
18896 !! html/parsoid
18897 <p><span typeof="mw:Entity">J</span><span typeof="mw:Entity">a</span><span typeof="mw:Entity">v</span><span typeof="mw:Entity">a</span><span typeof="mw:Entity">S</span><span typeof="mw:Entity">c</span><span typeof="mw:Entity">r</span><span typeof="mw:Entity">i</span><span typeof="mw:Entity">p</span><span typeof="mw:Entity">t</span></p>
18898 !! end
18900 !! test
18901 HTML Hex character encoding bogus encoding (bug 26437 regression check)
18902 !! wikitext
18903 &#xsee;&#XSEE;
18904 !! html/php
18905 <p>&amp;#xsee;&amp;#XSEE;
18906 </p>
18907 !! html/parsoid
18908 <p>&amp;#xsee;&amp;#XSEE;</p>
18909 !! end
18911 !! test
18912 HTML Hex character encoding mixed case
18913 !! options
18914 parsoid=wt2html,wt2wt,html2html
18915 !! wikitext
18916 &#xEE;&#Xee;
18917 !! html/php
18918 <p>&#xee;&#xee;
18919 </p>
18920 !! html/php+tidy
18921 <p>îî</p>
18922 !! html/parsoid
18923 <p><span typeof="mw:Entity">î</span><span typeof="mw:Entity">î</span></p>
18924 !! end
18926 # See: http://www.w3.org/TR/html5/syntax.html#character-references
18927 # Note that U+000C (form feed) is not a valid XML character, so
18928 # it is banned even though allowed in HTML5.
18929 !! test
18930 Illegal character references (T106578)
18931 !! wikitext
18932 ; Null: &#00;
18933 ; FF: &#xC;
18934 ; CR: &#xD;
18935 ; Control (low): &#8;
18936 ; Control (high): &#x7F; &#x9F;
18937 ; Surrogate: &#xD83D;&#xDCA9;
18938 ; This is an okay astral character: &#x1F4A9;
18939 !! html+tidy
18940 <dl>
18941 <dt>Null</dt>
18942 <dd>&amp;#00;</dd>
18943 <dt>FF</dt>
18944 <dd>&amp;#xC;</dd>
18945 <dt>CR</dt>
18946 <dd>&amp;#xD;</dd>
18947 <dt>Control (low)</dt>
18948 <dd>&amp;#8;</dd>
18949 <dt>Control (high)</dt>
18950 <dd>&amp;#x7F; &amp;#x9F;</dd>
18951 <dt>Surrogate</dt>
18952 <dd>&amp;#xD83D;&amp;#xDCA9;</dd>
18953 <dt>This is an okay astral character</dt>
18954 <dd>💩</dd>
18955 </dl>
18956 !! end
18958 !! test
18959 __FORCETOC__ override
18960 !! wikitext
18961 __NEWSECTIONLINK__
18962 __FORCETOC__
18963 !! html/php
18964 <p><br />
18965 </p>
18966 !! end
18968 !! test
18969 ISBN code coverage
18970 !! wikitext
18971 ISBN  978-0-1234-56&#x20;789
18972 !! html
18973 <p><a href="/wiki/Special:BookSources/9780123456" class="internal mw-magiclink-isbn">ISBN 978-0-1234-56</a>&#x20;789
18974 </p>
18975 !! html+tidy
18976 <p><a href="/wiki/Special:BookSources/9780123456" class="internal mw-magiclink-isbn">ISBN 978-0-1234-56</a> 789</p>
18977 !! html/parsoid
18978 <p><a href="./Special:BookSources/9780123456" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 978-0-1234-56</a><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#x20;","srcContent":" "}'> </span>789</p>
18979 !! end
18981 !! test
18982 ISBN followed by 5 spaces
18983 !! wikitext
18984 ISBN    
18985 !! html
18986 <p>ISBN    
18987 </p>
18988 !! end
18990 !! test
18991 Double ISBN
18992 !! wikitext
18993 ISBN ISBN 1234567890
18994 !! html/php
18995 <p>ISBN <a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
18996 </p>
18997 !! html/parsoid
18998 <p>ISBN <a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a></p>
18999 !! end
19001 # Uppercase X and lowercase x as well
19002 !! test
19003 ISBN with an X
19004 !! wikitext
19005 ISBN 3-462-04561-X
19006 ISBN 3-462-04561-x
19007 ISBN 080442957X
19008 ISBN 080442957x
19009 ISBN 978080442957X
19010 ISBN 978080442957x
19011 !! html/php
19012 <p><a href="/wiki/Special:BookSources/346204561X" class="internal mw-magiclink-isbn">ISBN 3-462-04561-X</a>
19013 <a href="/wiki/Special:BookSources/346204561X" class="internal mw-magiclink-isbn">ISBN 3-462-04561-x</a>
19014 <a href="/wiki/Special:BookSources/080442957X" class="internal mw-magiclink-isbn">ISBN 080442957X</a>
19015 <a href="/wiki/Special:BookSources/080442957X" class="internal mw-magiclink-isbn">ISBN 080442957x</a>
19016 <a href="/wiki/Special:BookSources/978080442957X" class="internal mw-magiclink-isbn">ISBN 978080442957X</a>
19017 <a href="/wiki/Special:BookSources/978080442957X" class="internal mw-magiclink-isbn">ISBN 978080442957x</a>
19018 </p>
19019 !! html/parsoid
19020 <p><a href="./Special:BookSources/346204561X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 3-462-04561-X</a>
19021 <a href="./Special:BookSources/346204561X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 3-462-04561-x</a>
19022 <a href="./Special:BookSources/080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 080442957X</a>
19023 <a href="./Special:BookSources/080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 080442957x</a>
19024 <a href="./Special:BookSources/978080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 978080442957X</a>
19025 <a href="./Special:BookSources/978080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 978080442957x</a></p>
19026 !! end
19028 !! test
19029 ISBN with empty prefix (parsoid test)
19030 !! wikitext
19031 ISBN 1234567890
19032 !! html/php
19033 <p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
19034 </p>
19035 !! html/parsoid
19036 <p><a href="./Special:BookSources/1234567890" rel="mw:WikiLink">ISBN 1234567890</a></p>
19037 !! end
19039 !! test
19040 Bug 22905: <abbr> followed by ISBN followed by </a>
19041 !! wikitext
19042 <abbr>(fr)</abbr> ISBN 2753300917 [http://www.example.com example.com]
19043 !! html/php
19044 <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>
19045 </p>
19046 !! html/parsoid
19047 <p><abbr data-parsoid='{"stx":"html"}'>(fr)</abbr> <a href="./Special:BookSources/2753300917" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 2753300917</a> <a rel="mw:ExtLink" href="http://www.example.com">example.com</a></p>
19048 !! end
19050 !! test
19051 Double RFC
19052 !! wikitext
19053 RFC RFC 1234
19054 !! html
19055 <p>RFC <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc1234">RFC 1234</a>
19056 </p>
19057 !! end
19059 !! test
19060 Double RFC with a wiki link
19061 !! wikitext
19062 RFC [[RFC 1234]]
19063 !! html
19064 <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>
19065 </p>
19066 !! end
19068 !! test
19069 RFC code coverage
19070 !! wikitext
19071 RFC   983&#x20;987
19072 !! html
19073 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc983">RFC 983</a>&#x20;987
19074 </p>
19075 !! html+tidy
19076 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc983">RFC 983</a> 987</p>
19077 !! end
19079 !! test
19080 Centre-aligned image
19081 !! wikitext
19082 [[Image:foobar.jpg|centre]]
19083 !! html
19084 <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>
19086 !!end
19088 !! test
19089 None-aligned image
19090 !! wikitext
19091 [[Image:foobar.jpg|none]]
19092 !! html
19093 <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>
19095 !!end
19097 !! test
19098 Width + Height sized image (using px) (height is ignored)
19099 !! wikitext
19100 [[Image:foobar.jpg|640x480px]]
19101 !! html
19102 <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>
19103 </p>
19104 !!end
19106 !! test
19107 Width-sized image (using px, no following whitespace)
19108 !! wikitext
19109 [[Image:foobar.jpg|640px]]
19110 !! html
19111 <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>
19112 </p>
19113 !!end
19115 !! test
19116 Width-sized image (using px, with following whitespace - test regression from r39467)
19117 !! wikitext
19118 [[Image:foobar.jpg|640px ]]
19119 !! html
19120 <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>
19121 </p>
19122 !!end
19124 !! test
19125 Width-sized image (using px, with preceding whitespace - test regression from r39467)
19126 !! wikitext
19127 [[Image:foobar.jpg| 640px]]
19128 !! html
19129 <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>
19130 </p>
19131 !!end
19133 !! test
19134 Image with page parameter
19135 !! options
19136 djvu
19137 !! wikitext
19138 [[File:LoremIpsum.djvu|page=2]]
19139 !! html/php
19140 <p><a href="/index.php?title=File:LoremIpsum.djvu&amp;page=2" class="image"><img alt="LoremIpsum.djvu" src="http://example.com/images/thumb/5/5f/LoremIpsum.djvu/page2-2480px-LoremIpsum.djvu.jpg" width="2480" height="3508" srcset="http://example.com/images/thumb/5/5f/LoremIpsum.djvu/page2-3720px-LoremIpsum.djvu.jpg 1.5x, http://example.com/images/thumb/5/5f/LoremIpsum.djvu/page2-4960px-LoremIpsum.djvu.jpg 2x" /></a>
19141 </p>
19142 !! html/parsoid
19143 <p><span class="mw-default-size" typeof="mw:Image" data-parsoid='{"optList":[{"ck":"page","ak":"page=2"}]}'><a href="./File:LoremIpsum.djvu" data-parsoid='{"a":{"href":"./File:LoremIpsum.djvu"},"sa":{}}'><img resource="./File:LoremIpsum.djvu" src="//example.com/images/5/5f/LoremIpsum.djvu" data-file-width="2480" data-file-height="3508" data-file-type="bitmap" height="3508" width="2480" data-parsoid='{"a":{"resource":"./File:LoremIpsum.djvu","height":"3508","width":"2480"},"sa":{"resource":"File:LoremIpsum.djvu"}}'/></a></span></p>
19144 !! end
19146 !! test
19147 Another italics / bold test
19148 !! wikitext
19149  ''' ''x'
19150 !! html
19151 <pre>'<i> </i>x'
19152 </pre>
19153 !!end
19155 # FIXME: The php output seems broken. It's interleaving some open/close tags.
19156 !! test
19157 dt/dd/dl test
19158 !! wikitext
19159 :;;;::
19160 !! html/php
19161 <dl><dd><dl><dt><dl><dt><dl><dt><dl><dd><dl><dd></dt></dl></dd></dl></dd></dl></dd></dl></dd></dl></dd></dl>
19163 !! html/parsoid
19164 <dl><dd><dl><dt><dl><dt><dl><dt><dl><dd><dl><dd></dd></dl></dd></dl></dt></dl></dt></dl></dt></dl></dd></dl>
19166 !!end
19169 # Images with the "|" character in external URLs in comment tags; Eats half the comment, leaves unmatched "</a>" tag.
19170 !! test
19171 Images with the "|" character in the comment
19172 !! wikitext
19173 [[File:Foobar.jpg|thumb|An [http://test/?param1=|left|&param2=|x external] URL]]
19174 !! html/php
19175 <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"></a></div>An <a rel="nofollow" class="external text" href="http://test/?param1=%7Cleft%7C&amp;param2=%7Cx">external</a> URL</div></div></div>
19177 !! html/parsoid
19178 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption>An <a rel="mw:ExtLink" href="http://test/?param1=|left|&amp;param2=|x">external</a> URL</figcaption></figure>
19179 !! end
19181 !! test
19182 [Before] HTML without raw HTML enabled ($wgRawHtml==false)
19183 !! wikitext
19184 <html><script>alert(1);</script></html>
19185 !! html
19186 <p>&lt;html&gt;&lt;script&gt;alert(1);&lt;/script&gt;&lt;/html&gt;
19187 </p>
19188 !! end
19190 !! test
19191 HTML with raw HTML ($wgRawHtml==true)
19192 !! options
19193 wgRawHtml=1
19194 !! wikitext
19195 <html><script>alert(1);</script></html>
19196 !! html
19197 <p><script>alert(1);</script>
19198 </p>
19199 !! end
19201 !! test
19202 Parents of subpages, one level up
19203 !! options
19204 subpage title=[[Subpage test/L1/L2/L3]]
19205 !! wikitext
19206 [[../|L2]]
19207 !! html
19208 <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>
19209 </p>
19210 !! end
19213 !! test
19214 Parents of subpages, one level up, not named
19215 !! options
19216 subpage title=[[Subpage test/L1/L2/L3]]
19217 !! wikitext
19218 [[../]]
19219 !! html
19220 <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>
19221 </p>
19222 !! end
19226 !! test
19227 Parents of subpages, two levels up
19228 !! options
19229 subpage title=[[Subpage test/L1/L2/L3]]
19230 !! wikitext
19231 [[../../|L1]]2
19233 [[../../|L1]]l
19234 !! html
19235 <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
19236 </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>
19237 </p>
19238 !! end
19240 !! test
19241 Parents of subpages, two levels up, without trailing slash or name.
19242 !! options
19243 subpage title=[[Subpage test/L1/L2/L3]]
19244 !! wikitext
19245 [[../..]]
19246 !! html
19247 <p>[[../..]]
19248 </p>
19249 !! end
19251 !! test
19252 Parents of subpages, two levels up, with lots of extra trailing slashes.
19253 !! options
19254 subpage title=[[Subpage test/L1/L2/L3]]
19255 !! wikitext
19256 [[../../////]]
19257 !! html
19258 <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)">Subpage test/L1</a>
19259 </p>
19260 !! end
19262 !! article
19263 Subpage test/L1/L2/L3Sibling
19264 !! text
19265 Sibling article
19266 !! endarticle
19268 !! test
19269 Transclusion of a sibling page (one level up)
19270 !! options
19271 subpage title=[[Subpage test/L1/L2/L3]]
19272 !! wikitext
19273 {{../L3Sibling}}
19274 !! html
19275 <p>Sibling article
19276 </p>
19277 !! end
19279 !! test
19280 Transclusion of a child page
19281 !! options
19282 subpage title=[[Subpage test/L1/L2]]
19283 !! wikitext
19284 {{/L3Sibling}}
19285 !! html
19286 <p>Sibling article
19287 </p>
19288 !! end
19290 !! test
19291 Non-transclusion because of too many up levels
19292 !! options
19293 subpage title=[[Subpage test/L1/L2/L3]]
19294 !! wikitext
19295 {{../../../../More than parent}}
19296 !! html
19297 <p>{{../../../../More than parent}}
19298 </p>
19299 !! end
19301 !! test
19302 Definition list code coverage
19303 !! wikitext
19304 ; title   : def
19305 ; title : def
19306 ;title: def
19307 !! html/php
19308 <dl><dt> title  &#160;</dt>
19309 <dd> def</dd>
19310 <dt> title&#160;</dt>
19311 <dd> def</dd>
19312 <dt>title</dt>
19313 <dd> def</dd></dl>
19315 !! html/parsoid
19316 <dl><dt> title  <span typeof="mw:Placeholder"> </span></dt><dd> def</dd>
19317 <dt> title<span typeof="mw:Placeholder"> </span></dt><dd> def</dd>
19318 <dt>title</dt><dd> def</dd></dl>
19319 !! end
19321 !! test
19322 Don't fall for the self-closing div
19323 !! wikitext
19324 <div>hello world</div/>
19325 !! html
19326 <div>hello world</div>
19328 !! end
19330 !! test
19331 MSGNW magic word
19332 !! wikitext
19333 {{MSGNW:msg}}
19334 !! html/php
19335 <p>&#91;&#91;:Template:Msg&#93;&#93;
19336 </p>
19337 !! end
19339 !! test
19340 RAW magic word
19341 !! wikitext
19342 {{RAW:QUERTY}}
19343 !! html
19344 <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>
19345 </p>
19346 !! end
19348 # This isn't needed for XHTML conformance, but would be handy as a fallback security measure
19349 !! test
19350 Always escape literal '>' in output, not just after '<'
19351 !! wikitext
19353 !! html
19354 <p>&gt;&lt;&gt;
19355 </p>
19356 !! end
19358 !! test
19359 Template caching
19360 !! wikitext
19361 {{Test}}
19362 {{Test}}
19363 !! html
19364 <p>This is a test template
19365 This is a test template
19366 </p>
19367 !! end
19370 !! article
19371 MediaWiki:Fake
19372 !! text
19373 ==header==
19374 !! endarticle
19376 !! test
19377 Inclusion of !userCanEdit() content
19378 !! wikitext
19379 {{MediaWiki:Fake}}
19380 !! html
19381 <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>
19383 !! end
19386 !! test
19387 Out-of-order TOC heading levels
19388 !! wikitext
19389 ==2==
19390 ======6======
19391 ===3===
19393 =====5=====
19394 ==2==
19395 !! html
19396 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
19397 <ul>
19398 <li class="toclevel-1 tocsection-1"><a href="#2"><span class="tocnumber">1</span> <span class="toctext">2</span></a>
19399 <ul>
19400 <li class="toclevel-2 tocsection-2"><a href="#6"><span class="tocnumber">1.1</span> <span class="toctext">6</span></a></li>
19401 <li class="toclevel-2 tocsection-3"><a href="#3"><span class="tocnumber">1.2</span> <span class="toctext">3</span></a></li>
19402 </ul>
19403 </li>
19404 <li class="toclevel-1 tocsection-4"><a href="#1"><span class="tocnumber">2</span> <span class="toctext">1</span></a>
19405 <ul>
19406 <li class="toclevel-2 tocsection-5"><a href="#5"><span class="tocnumber">2.1</span> <span class="toctext">5</span></a></li>
19407 <li class="toclevel-2 tocsection-6"><a href="#2_2"><span class="tocnumber">2.2</span> <span class="toctext">2</span></a></li>
19408 </ul>
19409 </li>
19410 </ul>
19411 </div>
19413 <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>
19414 <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>
19415 <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>
19416 <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>
19417 <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>
19418 <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>
19420 !! end
19423 !! test
19424 ISBN with a dummy number
19425 !! wikitext
19426 ISBN ---
19427 !! html
19428 <p>ISBN ---
19429 </p>
19430 !! end
19433 !! test
19434 ISBN with space-delimited number
19435 !! wikitext
19436 ISBN 92 9017 032 8
19437 !! html
19438 <p><a href="/wiki/Special:BookSources/9290170328" class="internal mw-magiclink-isbn">ISBN 92 9017 032 8</a>
19439 </p>
19440 !! end
19443 !! test
19444 ISBN with multiple spaces, no number
19445 !! wikitext
19446 ISBN  foo
19447 !! html
19448 <p>ISBN  foo
19449 </p>
19450 !! end
19453 !! test
19454 ISBN length
19455 !! wikitext
19456 ISBN 123456789
19458 ISBN 1234567890
19460 ISBN 12345678901
19461 !! html
19462 <p>ISBN 123456789
19463 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
19464 </p><p>ISBN 12345678901
19465 </p>
19466 !! end
19469 !! test
19470 ISBN with trailing year (bug 8110)
19471 !! wikitext
19472 ISBN 1-234-56789-0 - 2006
19474 ISBN 1 234 56789 0 - 2006
19475 !! html
19476 <p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1-234-56789-0</a> - 2006
19477 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1 234 56789 0</a> - 2006
19478 </p>
19479 !! end
19482 !! test
19483 anchorencode
19484 !! wikitext
19485 {{anchorencode:foo bar©#%n}}
19486 !! html
19487 <p>foo_bar.C2.A9.23.25n
19488 </p>
19489 !! end
19491 !! test
19492 anchorencode trims spaces
19493 !! wikitext
19494 {{anchorencode: __pretty__please__}}
19495 !! html
19496 <p>pretty_please
19497 </p>
19498 !! end
19500 !! test
19501 anchorencode deals with links
19502 !! wikitext
19503 {{anchorencode: [[hello|world]] [[hi]]}}
19504 !! html
19505 <p>world_hi
19506 </p>
19507 !! end
19509 !! test
19510 anchorencode deals with templates
19511 !! wikitext
19512 {{anchorencode: {{Foo}} }}
19513 !! html
19514 <p>FOO
19515 </p>
19516 !! end
19518 !! test
19519 anchorencode encodes like the TOC generator: (bug 18431)
19520 !! wikitext
19521 === _ +:.3A%3A&&amp;]] ===
19522 {{anchorencode: _ +:.3A%3A&&amp;]] }}
19523 __NOEDITSECTION__
19524 !! html
19525 <h3><span class="mw-headline" id=".2B:.3A.253A.26.26.5D.5D">_ +:.3A%3A&amp;&amp;]]</span></h3>
19526 <p>.2B:.3A.253A.26.26.5D.5D
19527 </p>
19528 !! end
19530 !! test
19531 Bug 6200: blockquotes and paragraph formatting
19532 !! wikitext
19533 <blockquote>
19535 </blockquote>
19539  baz
19540 !! html
19541 <blockquote>
19542 <p>foo
19543 </p>
19544 </blockquote>
19545 <p>bar
19546 </p>
19547 <pre>baz
19548 </pre>
19549 !! end
19551 !! test
19552 Bug 8293: Use of center tag ruins paragraph formatting
19553 !! wikitext
19554 <center>
19556 </center>
19560  baz
19561 !! html
19562 <center>
19563 <p>foo
19564 </p>
19565 </center>
19566 <p>bar
19567 </p>
19568 <pre>baz
19569 </pre>
19570 !! end
19572 !!test
19573 Parsing of overlapping (improperly nested) inline html tags
19574 !! wikitext
19575 <span><s>x</span></s>
19576 !! html/php
19577 <p><span><s>x&lt;/span&gt;</s></span>
19578 </p>
19579 !! html/parsoid
19580 <p><span><s>x</s></span>
19581 </p>
19582 !!end
19585 ### Language variants related tests
19587 !! test
19588 Self-link in language variants
19589 !! options
19590 title=[[Dunav]] language=sr
19591 !! wikitext
19592 Both [[Dunav]] and [[Дунав]] are names for this river.
19593 !! html
19594 <p>Both <strong class="selflink">Dunav</strong> and <strong class="selflink">Дунав</strong> are names for this river.
19595 </p>
19596 !!end
19598 !! article
19599 Дуна
19600 !! text
19601 content
19602 !! endarticle
19604 !! test
19605 Link to another existing title shouldn't be parsed as self-link even if it's a variant of this title
19606 !! options
19607 title=[[Duna]] language=sr
19608 !! wikitext
19609 [[Дуна]] is not a self-link while [[Duna]] and [[Dуна]] are still self-links.
19610 !! html
19611 <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.
19612 </p>
19613 !! end
19615 !! test
19616 Link to a section of a variant of this title shouldn't be parsed as self-link
19617 !! options
19618 title=[[Duna]] language=sr
19619 !! wikitext
19620 [[Dуна]] is a self-link while [[Dunа#Foo]] and [[Dуна#Foo]] are not self-links.
19621 !! html
19622 <p><strong class="selflink">Dуна</strong> is a self-link while <a href="/wiki/%D0%94%D1%83%D0%BD%D0%B0" title="Дуна">Dunа#Foo</a> and <a href="/wiki/%D0%94%D1%83%D0%BD%D0%B0" title="Дуна">Dуна#Foo</a> are not self-links.
19623 </p>
19624 !! end
19626 !! test
19627 Link to pages in language variants
19628 !! options
19629 language=sr
19630 !! wikitext
19631 Main Page can be written as [[Маин Паге]]
19632 !! html
19633 <p>Main Page can be written as <a href="/wiki/Main_Page" title="Main Page">Маин Паге</a>
19634 </p>
19635 !!end
19638 !! test
19639 Multiple links to pages in language variants
19640 !! options
19641 language=sr
19642 !! wikitext
19643 [[Main Page]] can be written as [[Маин Паге]] same as [[Маин Паге]].
19644 !! html
19645 <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>.
19646 </p>
19647 !!end
19650 !! test
19651 Simple template in language variants
19652 !! options
19653 language=sr
19654 !! wikitext
19655 {{тест}}
19656 !! html
19657 <p>This is a test template
19658 </p>
19659 !! end
19662 !! test
19663 Template with explicit namespace in language variants
19664 !! options
19665 language=sr
19666 !! wikitext
19667 {{Template:тест}}
19668 !! html
19669 <p>This is a test template
19670 </p>
19671 !! end
19674 !! test
19675 Basic test for template parameter in language variants
19676 !! options
19677 language=sr
19678 !! wikitext
19679 {{парамтест|param=foo}}
19680 !! html
19681 <p>This is a test template with parameter foo
19682 </p>
19683 !! end
19686 !! test
19687 Simple category in language variants
19688 !! options
19689 language=sr cat
19690 !! wikitext
19691 [[Category:МедиаWики Усер'с Гуиде]]
19692 !! html
19693 <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>
19694 !! end
19697 !! article
19698 Category:分类
19699 !! text
19700 blah
19701 !! endarticle
19703 !! article
19704 Category:分類
19705 !! text
19706 blah
19707 !! endarticle
19709 ## We used to, but no longer wt2wt this test since the default serializer
19710 ## will normalize all categories to serialize on their own line.
19711 ## This wikitext usage is going to be fairly uncommon in production and
19712 ## selser will take care of preserving formatting in those scenarios.
19713 !! test
19714 Don't convert blue categorylinks to another variant (bug 33210)
19715 !! options
19717 language=zh
19718 parsoid=wt2html
19719 !! wikitext
19720 [[A]][[Category:分类]]
19721 !! html/php
19722 <a href="/wiki/Category:%E5%88%86%E7%B1%BB" title="Category:分类">分类</a>
19723 !! html/parsoid
19724 <p><a rel="mw:WikiLink" href="A" title="A">A</a></p>
19725 <link rel="mw:PageProp/Category" href="Category:分类"/>
19726 !! end
19728 !! test
19729 Stripping -{}- tags (language variants)
19730 !! options
19731 language=sr
19732 !! wikitext
19733 Latin proverb: -{Ne nuntium necare}-
19734 !! html
19735 <p>Latin proverb: Ne nuntium necare
19736 </p>
19737 !! end
19740 !! test
19741 Prevent conversion with -{}- tags (language variants)
19742 !! options
19743 language=sr variant=sr-ec
19744 !! wikitext
19745 Latinski: -{Ne nuntium necare}-
19746 !! html
19747 <p>Латински: Ne nuntium necare
19748 </p>
19749 !! end
19752 !! test
19753 Prevent conversion of text with -{}- tags (language variants)
19754 !! options
19755 language=sr variant=sr-ec
19756 !! wikitext
19757 Latinski: -{Ne nuntium necare}-
19758 !! html
19759 <p>Латински: Ne nuntium necare
19760 </p>
19761 !! end
19764 !! test
19765 Prevent conversion of links with -{}- tags (language variants)
19766 !! options
19767 language=sr variant=sr-ec
19768 !! wikitext
19769 -{[[Main Page]]}-
19770 !! html
19771 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
19772 </p>
19773 !! end
19776 !! test
19777 -{}- tags within headlines (within html for parserConvert())
19778 !! options
19779 language=sr variant=sr-ec
19780 !! wikitext
19781 == -{Naslov}- ==
19782 !! html
19783 <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>
19785 !! end
19788 !! test
19789 Explicit definition of language variant alternatives
19790 !! options
19791 language=zh variant=zh-tw
19792 !! wikitext
19793 -{zh:China;zh-tw:Taiwan}-, not China
19794 !! html
19795 <p>Taiwan, not China
19796 </p>
19797 !! end
19800 !! test
19801 Conversion around HTML tags
19802 !! options
19803 language=sr variant=sr-ec
19804 !! wikitext
19805 -{H|span=>sr-ec:script;title=>sr-ec:src;}-
19806 <span title="La-{sr-el:L;sr-ec:C;}-tin">ski</span>
19807 !! html
19809 <span title="ЛаCтин">ски</span>
19810 </p>
19811 !! end
19814 !! test
19815 Explicit session-wise language variant mapping (A flag and - flag)
19816 !! options
19817 language=zh variant=zh-tw
19818 !! wikitext
19819 Taiwan is not China.
19820 But -{A|zh:China;zh-tw:Taiwan}- is China,
19821 (This-{-|zh:China;zh-tw:Taiwan}- should be stripped!)
19822 and -{China}- is China.
19823 !! html
19824 <p>Taiwan is not China.
19825 But Taiwan is Taiwan,
19826 (This should be stripped!)
19827 and China is China.
19828 </p>
19829 !! end
19831 !! test
19832 Explicit session-wise language variant mapping (H flag for hide)
19833 !! options
19834 language=zh variant=zh-tw
19835 !! wikitext
19836 (This-{H|zh:China;zh-tw:Taiwan}- should be stripped!)
19837 Taiwan is China.
19838 !! html
19839 <p>(This should be stripped!)
19840 Taiwan is Taiwan.
19841 </p>
19842 !! end
19844 !! test
19845 Adding explicit conversion rule for title (T flag)
19846 !! options
19847 language=zh variant=zh-tw showtitle
19848 !! wikitext
19849 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
19850 !! html
19851 Taiwan
19852 <p>Should be stripped!
19853 </p>
19854 !! end
19856 !! test
19857 Testing that changing the language variant here in the tests actually works
19858 !! options
19859 language=zh variant=zh showtitle
19860 !! wikitext
19861 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
19862 !! html
19863 China
19864 <p>Should be stripped!
19865 </p>
19866 !! end
19868 !! test
19869 Recursive conversion of alt and title attrs shouldn't clear converter state
19870 !! options
19871 language=zh variant=zh-cn showtitle
19872 !! wikitext
19873 -{H|zh-cn:Exclamation;zh-tw:exclamation;}-
19874 Should be stripped-{T|zh-cn:China;zh-tw:Taiwan}-<span title="exclamation">!</span>
19875 !! html
19876 China
19878 Should be stripped<span title="Exclamation">!</span>
19879 </p>
19880 !! end
19882 !! test
19883 Bug 24072: more test on conversion rule for title
19884 !! options
19885 language=zh variant=zh-tw showtitle
19886 !! wikitext
19887 This should be stripped-{T|zh:China;zh-tw:Taiwan}-!
19888 This won't take interferes with the title rule-{H|zh:Beijing;zh-tw:Taipei}-.
19889 !! html
19890 Taiwan
19891 <p>This should be stripped!
19892 This won't take interferes with the title rule.
19893 </p>
19894 !! end
19896 !! test
19897 Partly disable title conversion if variant == main language code
19898 !! options
19899 language=zh variant=zh title=[[ZH]] showtitle
19900 !! wikitext
19901 -{T|zh-cn:CN;zh-tw:TW}-
19902 !! html
19905 </p>
19906 !! end
19908 !! test
19909 Partly disable title conversion if variant == main language code, more
19910 !! options
19911 language=zh variant=zh title=[[ZH]] showtitle
19912 !! wikitext
19913 -{T|TW}-
19914 !! html
19917 </p>
19918 !! end
19920 !! test
19921 Raw output of variant escape tags (R flag)
19922 !! options
19923 language=zh variant=zh-tw
19924 !! wikitext
19925 Raw: -{R|zh:China;zh-tw:Taiwan}-
19926 !! html
19927 <p>Raw: zh:China;zh-tw:Taiwan
19928 </p>
19929 !! end
19931 !! test
19932 Strings evaluating false shouldn't be ignored by Language converter (T51072)
19933 !! options
19934 language=zh variant=zh-cn
19935 !! input
19936 -{zh-cn:0;zh-sg:1;zh-tw:2;zh-hk:3}-
19937 !! result
19938 <p>0
19939 </p>
19940 !! end
19942 !! test
19943 Conversion rules from [numeric-only string] to [something else] (T48634)
19944 !! options
19945 language=zh variant=zh-cn
19946 !! input
19947 -{H|0=>zh-cn:B}--{H|0=>zh-cn:C;0=>zh-cn:D}--{H|0=>zh-hans:A}-012345-{A|zh-tw:0;zh-cn:E;}-012345
19948 !! result
19949 <p>D12345EE12345
19950 </p>
19951 !! end
19953 !! test
19954 Bidirectional converter rule entries with an empty value should be ignored (T53551)
19955 !! options
19956 language=zh variant=zh-cn
19957 !! input
19958 -{H|zh-cn:foo;zh-tw:;}-foobar
19959 !! result
19960 <p>foobar
19961 </p>
19962 !! end
19964 !! test
19965 Unidirectional converter rule entries with an empty "from" string should be ignored (T53551)
19966 !! options
19967 language=zh variant=zh-cn
19968 !! input
19969 -{H|=>zh-cn:foo;}-foobar
19970 !! result
19971 <p>foobar
19972 </p>
19973 !! end
19975 !! test
19976 Empty converter rule entries shouldn't be inserted into the conversion table (T53551)
19977 !! options
19978 language=zh variant=zh-cn
19979 !! input
19980 -{H|}-foobar
19981 !! result
19982 <p>foobar
19983 </p>
19984 !! end
19986 !! test
19987 Nested using of manual convert syntax
19988 !! options
19989 language=zh variant=zh-hk
19990 !! wikitext
19991 Nested: -{zh-hans:Hi -{zh-cn:China;zh-sg:Singapore;}-;zh-hant:Hello -{zh-tw:Taiwan;zh-hk:H-{ong}- K-{}-ong;}-;}-!
19992 !! html
19993 <p>Nested: Hello Hong Kong!
19994 </p>
19995 !! end
19997 !! test
19998 Proper conversion of text in external links
19999 !! options
20000 language=sr variant=sr-ec
20001 !! wikitext
20002 http://www.google.com
20003 gopher://www.google.com
20004 [http://www.google.com http://www.google.com]
20005 [gopher://www.google.com gopher://www.google.com]
20006 [https://www.google.com irc://www.google.com]
20007 [ftp://www.google.com www.google.com/ftp://dir]
20008 [//www.google.com www.google.com]
20009 !! html
20010 <p><a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
20011 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
20012 <a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
20013 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
20014 <a rel="nofollow" class="external text" href="https://www.google.com">irc://www.google.com</a>
20015 <a rel="nofollow" class="external text" href="ftp://www.google.com">www.гоогле.цом/фтп://дир</a>
20016 <a rel="nofollow" class="external text" href="//www.google.com">www.гоогле.цом</a>
20017 </p>
20018 !! end
20020 !! test
20021 Do not convert roman numbers to language variants
20022 !! options
20023 language=sr variant=sr-ec
20024 !! wikitext
20025 Fridrih IV je car.
20026 !! html
20027 <p>Фридрих IV је цар.
20028 </p>
20029 !! end
20031 !! test
20032 Unclosed language converter markup "-{"
20033 !! options
20034 language=sr
20035 !! wikitext
20036 -{T|hello
20037 !! html
20038 <p>-{T|hello
20039 </p>
20040 !! end
20042 !! test
20043 Don't convert raw rule "-{R|=&gt;}-" to "=>"
20044 !! options
20045 language=sr
20046 !! wikitext
20047 -{R|=&gt;}-
20048 !! html
20049 <p>=&gt;
20050 </p>
20051 !!end
20053 !! test
20054 Don't break link parsing if language converter markup is in the caption.
20055 !! options
20056 language=sr variant=sr-ec
20057 !! wikitext
20058 [[Main Page|-{R|main page}-]]
20059 !! html
20060 <p><a href="/wiki/Main_Page" title="Маин Паге">main page</a>
20061 </p>
20062 !! end
20064 # FIXME: This test is currently broken in the PHP parser (bug 52661)
20065 !! test
20066 Don't break image parsing if language converter markup is in the caption.
20067 !! options
20068 language=sr
20069 !! wikitext
20070 [[File:Foobar.jpg|-{R|caption}-]]
20071 !! html/parsoid
20072 <p><a href="/wiki/File:Foobar.jpg" class="image" title="caption"><img alt="caption" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
20073 </p>
20074 !! end
20076 # FIXME: This test is currently broken in the PHP parser (bug 52661)
20077 !! test
20078 Don't break list handling if language converter markup is in the item.
20079 !! options
20080 language=zh variant=zh-cn
20081 !! wikitext
20082 ;-{zh-cn:AAA;zh-tw:BBB}-
20083 !! html/php
20084 <dl><dt><span class="error">在手动语言转换规则中检测到错误</span></dd></dl>
20086 !! html/parsoid
20087 <dl><dt>AAA
20088 </dt></dl>
20089 !! end
20091 # FIXME: This test is currently broken in the PHP parser (bug 52661)
20092 !! test
20093 Don't break table handling if language converter markup is in the cell.
20094 !! options
20095 language=sr variant=sr-ec
20096 !! wikitext
20099 | -{R|B}-
20101 !! html/php
20102 <table>
20104 <tr>
20105 <td>Б}-
20106 </td></tr></table>
20108 !! html/parsoid
20109 <table>
20111 <tr>
20112 <td> B
20113 </td></tr></table>
20115 !! end
20117 !! test
20118 Bug 529: Uncovered bullet
20119 !! wikitext
20120 * Foo {{bullet}}
20121 !! html
20122 <ul><li> Foo </li>
20123 <li> Bar</li></ul>
20125 !! end
20127 # Plain MediaWiki does not remove empty lists, but tidy actually does.
20128 # Templates in Wikipedia rely on this behavior, as tidy has always been
20129 # enabled there. These tests are normally run *without* tidy, so specify the
20130 # full output here. 
20131 # To test realistic parsing behavior, apply a tidy-like transformation to both
20132 # the expected output and your parser's output.
20133 !! test
20134 Bug 529: Uncovered bullet leaving empty list, normally removed by tidy
20135 !! wikitext
20136 ******* Foo {{bullet}}
20137 !! html
20138 <ul><li><ul><li><ul><li><ul><li><ul><li><ul><li><ul><li> Foo </li></ul></li></ul></li></ul></li></ul></li></ul></li></ul></li>
20139 <li> Bar</li></ul>
20141 !! end
20143 !! test
20144 Bug 529: Uncovered table already at line-start
20145 !! wikitext
20148 {{table}}
20150 !! html
20151 <p>x
20152 </p>
20153 <table>
20154 <tr>
20155 <td> 1 </td>
20156 <td> 2
20157 </td></tr>
20158 <tr>
20159 <td> 3 </td>
20160 <td> 4
20161 </td></tr></table>
20162 <p>y
20163 </p>
20164 !! end
20166 !! test
20167 Bug 529: Uncovered bullet in parser function result
20168 !! wikitext
20169 * Foo {{lc:{{bullet}} }}
20170 !! html
20171 <ul><li> Foo </li>
20172 <li> bar</li></ul>
20174 !! end
20176 !! test
20177 Bug 5678: Double-parsed template argument
20178 !! wikitext
20179 {{lc:{{{1}}}|hello}}
20180 !! html
20181 <p>{{{1}}}
20182 </p>
20183 !! end
20185 !! test
20186 Bug 5678: Double-parsed template invocation
20187 !! wikitext
20188 {{lc:{{paramtest {{!}} param = hello }} }}
20189 !! html
20190 <p>{{paramtest | param = hello }}
20191 </p>
20192 !! end
20194 !! test
20195 Case insensitivity of parser functions for non-ASCII characters (bug 8143)
20196 !! options
20197 language=cs
20198 title=[[Main Page]]
20199 !! wikitext
20200 {{PRVNÍVELKÉ:ěščř}}
20201 {{prvnívelké:ěščř}}
20202 {{PRVNÍMALÉ:ěščř}}
20203 {{prvnímalé:ěščř}}
20204 {{MALÁ:ěščř}}
20205 {{malá:ěščř}}
20206 {{VELKÁ:ěščř}}
20207 {{velká:ěščř}}
20208 !! html
20209 <p>Ěščř
20210 Ěščř
20211 ěščř
20212 ěščř
20213 ěščř
20214 ěščř
20215 ĚŠČŘ
20216 ĚŠČŘ
20217 </p>
20218 !! end
20220 !! test
20221 Morwen/13: Unclosed link followed by heading
20222 !! wikitext
20223 [[link
20224 ==heading==
20225 !! html
20226 <p>[[link
20227 </p>
20228 <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>
20230 !! end
20232 !! test
20233 HHP2.1: Heuristics for headings in preprocessor parenthetical structures
20234 !! wikitext
20235 {{foo|
20236 =heading=
20237 !! html
20238 <p>{{foo|
20239 </p>
20240 <h1><span class="mw-headline" id="heading">heading</span></h1>
20242 !! end
20244 !! test
20245 HHP2.2: Heuristics for headings in preprocessor parenthetical structures
20246 !! wikitext
20247 {{foo|
20248 ==heading==
20249 !! html
20250 <p>{{foo|
20251 </p>
20252 <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>
20254 !! end
20256 !! test
20257 Tildes in comments
20258 !! options
20260 !! wikitext
20261 <!-- ~~~~ -->
20262 !! html/php
20263 <!-- ~~~~ -->
20264 !! end
20266 !! test
20267 Paragraphs inside divs (no extra line breaks)
20268 !! wikitext
20269 <div>Line one
20271 Line two</div>
20272 !! html
20273 <div>Line one
20274 Line two</div>
20276 !! end
20278 !! test
20279 Paragraphs inside divs (extra line break on open)
20280 !! wikitext
20281 <div>
20282 Line one
20284 Line two</div>
20285 !! html
20286 <div>
20287 <p>Line one
20288 </p>
20289 Line two</div>
20291 !! end
20293 !! test
20294 Paragraphs inside divs (extra line break on close)
20295 !! wikitext
20296 <div>Line one
20298 Line two
20299 </div>
20300 !! html
20301 <div>Line one
20302 <p>Line two
20303 </p>
20304 </div>
20306 !! end
20308 !! test
20309 Paragraphs inside divs (extra line break on open and close)
20310 !! wikitext
20311 <div>
20312 Line one
20314 Line two
20315 </div>
20316 !! html
20317 <div>
20318 <p>Line one
20319 </p><p>Line two
20320 </p>
20321 </div>
20323 !! end
20325 !! test
20326 Nesting tags, paragraphs on lines which begin with <div>
20327 !! wikitext
20328 <div></div><strong>A
20329 B</strong>
20330 !! html/php+tidy
20331 <p><strong>A</strong></p>
20332 <p><strong>B</strong></p>
20333 !! html/parsoid
20334 <div></div>
20335 <p><strong>A
20336 B</strong>
20337 </p>
20338 !! end
20340 # Bug 6200: <blockquote> should behave like <div> with respect to line breaks
20341 !! test
20342 Bug 6200: paragraphs inside blockquotes (no extra line breaks)
20343 !! wikitext
20344 <blockquote>Line one
20346 Line two</blockquote>
20347 !! html
20348 <blockquote>Line one
20349 Line two</blockquote>
20351 !! html+tidy
20352 <blockquote>
20353 <p>Line one Line two</p>
20354 </blockquote>
20355 !! end
20357 !! test
20358 Bug 6200: paragraphs inside blockquotes (extra line break on open)
20359 !! wikitext
20360 <blockquote>
20361 Line one
20363 Line two</blockquote>
20364 !! html
20365 <blockquote>
20366 <p>Line one
20367 </p>
20368 Line two</blockquote>
20370 !! html+tidy
20371 <blockquote>
20372 <p>Line one</p>
20373 Line two</blockquote>
20374 !! end
20376 !! test
20377 Bug 6200: paragraphs inside blockquotes (extra line break on close)
20378 !! wikitext
20379 <blockquote>Line one
20381 Line two
20382 </blockquote>
20383 !! html
20384 <blockquote>Line one
20385 <p>Line two
20386 </p>
20387 </blockquote>
20389 !! html+tidy
20390 <blockquote>
20391 <p>Line one</p>
20392 <p>Line two</p>
20393 </blockquote>
20394 !! end
20396 !! test
20397 Bug 6200: paragraphs inside blockquotes (extra line break on open and close)
20398 !! wikitext
20399 <blockquote>
20400 Line one
20402 Line two
20403 </blockquote>
20404 !! html
20405 <blockquote>
20406 <p>Line one
20407 </p><p>Line two
20408 </p>
20409 </blockquote>
20411 !! html+tidy
20412 <blockquote>
20413 <p>Line one</p>
20414 <p>Line two</p>
20415 </blockquote>
20416 !! end
20418 !! test
20419 Paragraphs inside blockquotes/divs (no extra line breaks)
20420 !! wikitext
20421 <blockquote><div>Line one
20423 Line two</div></blockquote>
20424 !! html
20425 <blockquote><div>Line one
20426 Line two</div></blockquote>
20428 !! end
20430 !! test
20431 Paragraphs inside blockquotes/divs (extra line break on open)
20432 !! wikitext
20433 <blockquote><div>
20434 Line one
20436 Line two</div></blockquote>
20437 !! html
20438 <blockquote><div>
20439 <p>Line one
20440 </p>
20441 Line two</div></blockquote>
20443 !! end
20445 !! test
20446 Paragraphs inside blockquotes/divs (extra line break on close)
20447 !! wikitext
20448 <blockquote><div>Line one
20450 Line two
20451 </div></blockquote>
20452 !! html
20453 <blockquote><div>Line one
20454 <p>Line two
20455 </p>
20456 </div></blockquote>
20458 !! end
20460 !! test
20461 Paragraphs inside blockquotes/divs (extra line break on open and close)
20462 !! wikitext
20463 <blockquote><div>
20464 Line one
20466 Line two
20467 </div></blockquote>
20468 !! html
20469 <blockquote><div>
20470 <p>Line one
20471 </p><p>Line two
20472 </p>
20473 </div></blockquote>
20475 !! end
20477 !! test
20478 Interwiki links trounced by replaceExternalLinks after early LinkHolderArray expansion
20479 !! options
20480 wgLinkHolderBatchSize=0
20481 !! wikitext
20482 [[meatball:1]]
20483 [[meatball:2]]
20484 [[meatball:3]]
20485 !! html
20486 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?1" class="extiw" title="meatball:1">meatball:1</a>
20487 <a href="http://www.usemod.com/cgi-bin/mb.pl?2" class="extiw" title="meatball:2">meatball:2</a>
20488 <a href="http://www.usemod.com/cgi-bin/mb.pl?3" class="extiw" title="meatball:3">meatball:3</a>
20489 </p>
20490 !! end
20492 !! test
20493 Free external link invading image caption
20494 !! wikitext
20495 [[Image:Foobar.jpg|thumb|http://x|hello]]
20496 !! html
20497 <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"></a></div>hello</div></div></div>
20499 !! end
20501 !! test
20502 Bug 15196: localised external link numbers
20503 !! options
20504 language=fa
20505 !! wikitext
20506 [http://en.wikipedia.org/]
20507 !! html/php
20508 <p><a rel="nofollow" class="external autonumber" href="http://en.wikipedia.org/">[۱]</a>
20509 </p>
20510 !! html/parsoid
20511 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/"></a></p>
20512 !! end
20514 !! test
20515 Multibyte character in padleft
20516 !! wikitext
20517 {{padleft:-Hello|7|Æ}}
20518 !! html
20519 <p>Æ-Hello
20520 </p>
20521 !! end
20523 !! test
20524 Multibyte character in padright
20525 !! wikitext
20526 {{padright:Hello-|7|Æ}}
20527 !! html
20528 <p>Hello-Æ
20529 </p>
20530 !! end
20532 !!test
20533 formatdate parser function
20534 !! wikitext
20535 {{#formatdate:2009-03-24}}
20536 !! html
20537 <p><span class="mw-formatted-date" title="2009-03-24">2009-03-24</span>
20538 </p>
20539 !! end
20541 !!test
20542 formatdate parser function, with default format
20543 !! wikitext
20544 {{#formatdate:2009-03-24|mdy}}
20545 !! html
20546 <p><span class="mw-formatted-date" title="2009-03-24">March 24, 2009</span>
20547 </p>
20548 !! end
20550 !! test
20551 Spacing of numbers in formatted dates
20552 !! wikitext
20553 {{#formatdate:January 15}}
20554 !! html
20555 <p><span class="mw-formatted-date" title="01-15">January 15</span>
20556 </p>
20557 !! end
20559 !! test
20560 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
20561 !! options
20562 language=nl title=[[MediaWiki:Common.css]]
20563 !! wikitext
20564 {{#formatdate:2009-03-24|dmy}}
20565 !! html
20566 <p><span class="mw-formatted-date" title="2009-03-24">24 March 2009</span>
20567 </p>
20568 !! end
20575 # Edit comments
20578 !! test
20579 Edit comment with link
20580 !! options
20581 comment
20582 !! wikitext
20583 I like the [[Main Page]] a lot
20584 !! html/php
20585 I like the <a href="/wiki/Main_Page" title="Main Page">Main Page</a> a lot
20586 !!end
20588 !! test
20589 Edit comment with link and link text
20590 !! options
20591 comment
20592 !! wikitext
20593 I like the [[Main Page|best pages]] a lot
20594 !! html/php
20595 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
20596 !!end
20598 !! test
20599 Edit comment with link and link text with suffix
20600 !! options
20601 comment
20602 !! wikitext
20603 I like the [[Main Page|best page]]s a lot
20604 !! html/php
20605 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
20606 !!end
20608 !! test
20609 Edit comment with section link (non-local, eg in history list)
20610 !! options
20611 comment title=[[Main Page]]
20612 !! wikitext
20613 /* External links */ removed bogus entries
20614 !! html/php
20615 <a href="/wiki/Main_Page#External_links" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
20616 !!end
20618 !! test
20619 Edit comment with section link and text before it (non-local, eg in history list)
20620 !! options
20621 comment title=[[Main Page]]
20622 !! wikitext
20623 pre-comment text /* External links */ removed bogus entries
20624 !! html/php
20625 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>
20626 !!end
20628 !! test
20629 Edit comment with section link (local, eg in diff view)
20630 !! options
20631 comment local title=[[Main Page]]
20632 !! wikitext
20633 /* External links */ removed bogus entries
20634 !! html/php
20635 <a href="#External_links">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
20636 !!end
20638 !! test
20639 Edit comment with subpage link (bug 14080)
20640 !! options
20641 comment
20642 subpage
20643 title=[[Subpage test]]
20644 !! wikitext
20645 Poked at a [[/subpage]] here...
20646 !! html/php
20647 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a> here...
20648 !!end
20650 !! test
20651 Edit comment with subpage link and link text (bug 14080)
20652 !! options
20653 comment
20654 subpage
20655 title=[[Subpage test]]
20656 !! wikitext
20657 Poked at a [[/subpage|neat little page]] here...
20658 !! html/php
20659 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">neat little page</a> here...
20660 !!end
20662 !! test
20663 Edit comment with bogus subpage link in non-subpage NS (bug 14080)
20664 !! options
20665 comment
20666 title=[[Subpage test]]
20667 !! wikitext
20668 Poked at a [[/subpage]] here...
20669 !! html/php
20670 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...
20671 !!end
20673 !! test
20674 Edit comment with bare anchor link (local, as on diff)
20675 !! options
20676 comment
20677 local
20678 title=[[Main Page]]
20679 !! wikitext
20680 [[#section]]
20681 !! html/php
20682 <a href="#section">#section</a>
20683 !! end
20685 !! test
20686 Edit comment with bare anchor link (non-local, as on history)
20687 !! options
20688 comment
20689 title=[[Main Page]]
20690 !! wikitext
20691 [[#section]]
20692 !! html/php
20693 <a href="/wiki/Main_Page#section" title="Main Page">#section</a>
20694 !! end
20696 !! test
20697 Anchor starting with underscore
20698 !! options
20699 title=[[Foo]]
20700 !! wikitext
20701 [[#_ref|One]]
20702 !! html/php
20703 <p><a href="#_ref">One</a>
20704 </p>
20705 !! html/parsoid
20706 <p><a rel="mw:WikiLink" href="./Foo#_ref" data-parsoid='{"stx":"piped","a":{"href":"./Foo#_ref"},"sa":{"href":"#_ref"}}'>One</a></p>
20707 !! end
20709 !! test
20710 Id starting with underscore
20711 !! wikitext
20712 <div id="_ref"></div>
20713 !! html/*
20714 <div id="_ref"></div>
20716 !! end
20718 !! test
20719 Space normalisation on autocomment (bug 22784)
20720 !! options
20721 comment
20722 title=[[Main Page]]
20723 !! wikitext
20724 /* __hello__world__ */
20725 !! html/php
20726 <a href="/wiki/Main_Page#hello_world" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">__hello__world__</span></span>
20727 !! end
20729 !! test
20730 percent-encoding and + signs in comments (Bug 26410)
20731 !! options
20732 comment
20733 !! wikitext
20734 [[ABC%33D% ++]] [[ABC%33D% ++|+%20]]
20735 !! html/php
20736 <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>
20737 !! end
20739 # Parsoid doesn't support this yet: see bug 73581
20740 # but it *should* omit the 'src' attribute if the image is bad.
20741 # PHP side of tests was disabled in
20742 # mediawiki/core:6bd31e7d95161a6e88fa86df60871051da997c3c
20743 # because of issues in the PHP parserTests infrastructure
20744 # (but the output below is indeed what the PHP side emits)
20745 !! test
20746 Bad images - basic functionality
20747 !! wikitext
20748 [[File:Bad.jpg]]
20749 !! DISABLED/html/php
20750 !! html/parsoid
20751 <p><span class="mw-default-size" typeof="mw:Error mw:Image" data-mw='{"errors":[{"key":"bad-image","message":"This image is blacklisted in this context."}]}'><a href="./File:Bad.jpg"><img resource="./File:Bad.jpg" height="220" width="220"/></a></span></p>
20752 !! end
20754 !! test
20755 Bad images - bug 16039: text after bad image disappears
20756 !! wikitext
20757 Foo bar
20758 [[File:Bad.jpg]]
20759 Bar foo
20760 !! DISABLED/html/php
20761 <p>Foo bar
20762 </p><p>Bar foo
20763 </p>
20764 !! html/parsoid
20765 <p>Foo bar
20766 <span class="mw-default-size" typeof="mw:Error mw:Image" data-mw='{"errors":[{"key":"bad-image","message":"This image is blacklisted in this context."}]}'><a href="./File:Bad.jpg"><img resource="./File:Bad.jpg" height="220" width="220"/></a></span>
20767 Bar foo</p>
20768 !! end
20770 !! test
20771 Verify that displaytitle works (bug #22501) no displaytitle
20772 !! options
20773 showtitle
20774 !! config
20775 wgAllowDisplayTitle=true
20776 wgRestrictDisplayTitle=false
20777 !! wikitext
20778 this is not the the title
20779 !! html/php
20780 Parser test
20781 <p>this is not the the title
20782 </p>
20783 !! end
20785 !! test
20786 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=false
20787 !! options
20788 showtitle
20789 title=[[Screen]]
20790 !! config
20791 wgAllowDisplayTitle=true
20792 wgRestrictDisplayTitle=false
20793 !! wikitext
20794 this is not the the title
20795 {{DISPLAYTITLE:whatever}}
20796 !! html/php
20797 whatever
20798 <p>this is not the the title
20799 </p>
20800 !! end
20802 !! test
20803 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true mismatch
20804 !! options
20805 showtitle
20806 title=[[Screen]]
20807 !! config
20808 wgAllowDisplayTitle=true
20809 wgRestrictDisplayTitle=true
20810 !! wikitext
20811 this is not the the title
20812 {{DISPLAYTITLE:whatever}}
20813 !! html/php
20814 Screen
20815 <p>this is not the the title
20816 </p>
20817 !! end
20819 !! test
20820 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true matching
20821 !! options
20822 showtitle
20823 title=[[Screen]]
20824 !! config
20825 wgAllowDisplayTitle=true
20826 wgRestrictDisplayTitle=true
20827 !! wikitext
20828 this is not the the title
20829 {{DISPLAYTITLE:screen}}
20830 !! html/php
20831 screen
20832 <p>this is not the the title
20833 </p>
20834 !! end
20836 !! test
20837 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false
20838 !! options
20839 showtitle
20840 title=[[Screen]]
20841 !! config
20842 wgAllowDisplayTitle=false
20843 !! wikitext
20844 this is not the the title
20845 {{DISPLAYTITLE:screen}}
20846 !! html/php
20847 Screen
20848 <p>this is not the the title
20849 <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>
20850 </p>
20851 !! end
20853 !! test
20854 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false no DISPLAYTITLE
20855 !! options
20856 showtitle
20857 title=[[Screen]]
20858 !! config
20859 wgAllowDisplayTitle=false
20860 !! wikitext
20861 this is not the the title
20862 !! html/php
20863 Screen
20864 <p>this is not the the title
20865 </p>
20866 !! end
20868 !! test
20869 Verify that displaytitle handles inline CSS styles (bug 26547) - rejected value
20870 !! options
20871 showtitle
20872 title=[[Screen]]
20873 !! config
20874 wgAllowDisplayTitle=true
20875 wgRestrictDisplayTitle=true
20876 !! wikitext
20877 this is not the the title
20878 {{DISPLAYTITLE:<span style="display: none;">s</span>creen}}
20879 !! html/php
20880 <span style="/* attempt to bypass $wgRestrictDisplayTitle */">s</span>creen
20881 <p>this is not the the title
20882 </p>
20883 !! end
20885 !! test
20886 Verify that displaytitle handles inline CSS styles (bug 26547) - accepted value
20887 !! options
20888 showtitle
20889 title=[[Screen]]
20890 !! config
20891 wgAllowDisplayTitle=true
20892 wgRestrictDisplayTitle=true
20893 !! wikitext
20894 this is not the the title
20895 {{DISPLAYTITLE:<span style="color: red;">s</span>creen}}
20896 !! html/php
20897 <span style="color: red;">s</span>creen
20898 <p>this is not the the title
20899 </p>
20900 !! end
20902 !! test
20903 Page status indicators: Empty name is invalid
20904 !! options
20905 showindicators
20906 !! wikitext
20907 <indicator name=" "></indicator>
20908 <indicator></indicator>
20909 !! html
20910 <p><span class="error"><strong>Error:</strong> Page status indicators' <code>name</code> attribute must not be empty.</span>
20911 <span class="error"><strong>Error:</strong> Page status indicators' <code>name</code> attribute must not be empty.</span>
20912 </p>
20913 !! end
20915 !! test
20916 Page status indicators: Weird syntaxes that are okay
20917 !! options
20918 showindicators
20919 !! wikitext
20920 <indicator name="empty" />
20921 <indicator name="name"></indicator>
20922 !! html
20923 empty=
20924 name=
20925 <p><br />
20926 </p>
20927 !! end
20929 !! test
20930 Page status indicators: Torture test
20931 !! options
20932 showindicators
20933 !! wikitext
20934 <indicator name="01">hello world</indicator>
20935 <indicator name="02">[[Main Page]]</indicator>
20936 <indicator name="03">[[File:Foobar.jpg|25px|link=]]</indicator>
20937 <indicator name="04">[[File:Foobar.jpg|25px]]</indicator>
20938 <indicator name="05">* foo
20939 * bar</indicator>
20940 <indicator name="06"><nowiki>foo</nowiki></indicator>
20941 <indicator name="07"> Preformatted</indicator>
20942 <indicator name="08"><div>Broken tag</indicator>
20943 <indicator name="09">{| class=wikitable
20944 | cell
20945 |}</indicator>
20946 <indicator name="10">Two
20948 paragraphs</indicator>
20949 !! html
20950 01=hello world
20951 02=<a href="/wiki/Main_Page" title="Main Page">Main Page</a>
20952 03=<img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/25px-Foobar.jpg" width="25" height="3" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/38px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/50px-Foobar.jpg 2x" />
20953 04=<a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/25px-Foobar.jpg" width="25" height="3" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/38px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/50px-Foobar.jpg 2x" /></a>
20954 05=<ul><li> foo</li>
20955 <li> bar</li></ul>
20957 06=foo
20958 07=<pre>Preformatted
20959 </pre>
20960 08=<div>Broken tag</div>
20962 09=<table class="wikitable">
20963 <tr>
20964 <td> cell
20965 </td></tr></table>
20967 10=<p>Two
20968 </p><p>paragraphs
20969 </p>
20970 <p><br />
20971 </p><p><br />
20972 </p><p><br />
20973 </p><p><br />
20974 </p><p><br />
20975 </p>
20976 !! end
20978 !! test
20979 preload: check <noinclude> and <includeonly>
20980 !! options
20981 preload
20982 !! wikitext
20983 Hello <noinclude>cruel</noinclude><includeonly>kind</includeonly> world.
20984 !! html/php
20985 Hello kind world.
20986 !! end
20988 !! test
20989 preload: check <onlyinclude>
20990 !! options
20991 preload
20992 !! wikitext
20993 Goodbye <onlyinclude>Hello world</onlyinclude>
20994 !! html/php
20995 Hello world
20996 !! end
20998 !! test
20999 preload: can pass tags through if we want to
21000 !! options
21001 preload
21002 !! wikitext
21003 <includeonly><</includeonly>includeonly>Hello world<includeonly><</includeonly>/includeonly>
21004 !! html/php
21005 <includeonly>Hello world</includeonly>
21006 !! end
21008 !! test
21009 preload: check that it doesn't try to do tricks
21010 !! options
21011 preload
21012 !! wikitext
21013 * <!-- Hello --> ''{{world}}'' {{<includeonly>subst:</includeonly>How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
21014 !! html/php
21015 * <!-- Hello --> ''{{world}}'' {{subst:How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
21016 !! end
21018 !! test
21019 Play a bit with r67090 and bug 3158
21020 !! wikitext
21021 <div style="width:50% !important">&nbsp;</div>
21022 <div style="width:50%&nbsp;!important">&nbsp;</div>
21023 <div style="width:50%&#160;!important">&nbsp;</div>
21024 <div style="border : solid;">&nbsp;</div>
21025 !! html/php
21026 <div style="width:50% !important">&#160;</div>
21027 <div style="width:50% !important">&#160;</div>
21028 <div style="width:50% !important">&#160;</div>
21029 <div style="border&#160;: solid;">&#160;</div>
21031 !! html/parsoid
21032 <div style="width:50% !important" data-parsoid='{"stx":"html"}'><span typeof="mw:Entity" data-parsoid='{"srcContent":" "}'> </span></div>
21033 <div style="width:50% !important" data-parsoid='{"stx":"html","a":{"style":"width:50% !important"},"sa":{"style":"width:50%&amp;nbsp;!important"}}'><span typeof="mw:Entity" data-parsoid='{"srcContent":" "}'> </span></div>
21034 <div style="width:50% !important" data-parsoid='{"stx":"html","a":{"style":"width:50% !important"},"sa":{"style":"width:50%&amp;#160;!important"}}'><span typeof="mw:Entity" data-parsoid='{"srcContent":" "}'> </span></div>
21035 <div style="border : solid;" data-parsoid='{"stx":"html"}'><span typeof="mw:Entity" data-parsoid='{"srcContent":" "}'> </span></div>
21037 !! end
21039 !! test
21040 HTML5 data attributes
21041 !! wikitext
21042 <span data-foo="bar">Baz</span>
21043 <p data-abc-def_hij="">Quuz</p>
21044 !! html/php
21045 <p><span data-foo="bar">Baz</span>
21046 </p>
21047 <p data-abc-def_hij="">Quuz</p>
21049 !! html/parsoid
21050 <p><span data-foo="bar" data-parsoid='{"stx":"html"}'>Baz</span></p>
21051 <p data-abc-def_hij="" data-parsoid='{"stx":"html"}'>Quuz</p>
21052 !! end
21054 !! test
21055 Strip reserved data attributes
21056 !! wikitext
21057 <div data-mw="foo" data-parsoid="bar" data-mw-someext="baz" data-ok="fred" data-ooui="xyzzy" data-bad:ns="ns">d</div>
21058 !! html/php
21059 <div data-ok="fred">d</div>
21061 !! html/parsoid
21062 <div data-x-data-mw="foo" data-x-data-parsoid="bar" data-x-data-mw-someext="baz" data-ok="fred" data-parsoid='{"stx":"html","a":{"data-ooui":null,"data-bad:ns":null},"sa":{"data-ooui":"xyzzy","data-bad:ns":"ns"}}'>d</div>
21063 !! end
21065 !! test
21066 percent-encoding and + signs in internal links (Bug 26410)
21067 !! wikitext
21068 [[User:+%]] [[Page+title%]]
21069 [[%+]] [[%+|%20]] [[%+ ]] [[%+r]]
21070 [[%]] [[+]] [[File:%+abc%39|foo|[[bar]]]]
21071 [[%33%45]] [[%33%45+]]
21072 !! html/php
21073 <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>
21074 <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>
21075 <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>
21076 <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>
21077 </p>
21078 !! html/parsoid
21079 <p><a rel="mw:WikiLink" href="./User:+%25" title="User:+%" data-parsoid='{"stx":"simple","a":{"href":"./User:+%25"},"sa":{"href":"User:+%"}}'>User:+%</a> <a rel="mw:WikiLink" href="./Page+title%25" title="Page+title%" data-parsoid='{"stx":"simple","a":{"href":"./Page+title%25"},"sa":{"href":"Page+title%"}}'>Page+title%</a>
21080 <a rel="mw:WikiLink" href="./%25+" title="%+" data-parsoid='{"stx":"simple","a":{"href":"./%25+"},"sa":{"href":"%+"}}'>%+</a> <a rel="mw:WikiLink" href="./%25+" title="%+" data-parsoid='{"stx":"piped","a":{"href":"./%25+"},"sa":{"href":"%+"}}'>%20</a> <a rel="mw:WikiLink" href="./%25+" title="%+" data-parsoid='{"stx":"simple","a":{"href":"./%25+"},"sa":{"href":"%+ "}}'>%+ </a> <a rel="mw:WikiLink" href="./%25+r" title="%+r" data-parsoid='{"stx":"simple","a":{"href":"./%25+r"},"sa":{"href":"%+r"}}'>%+r</a>
21081 <a rel="mw:WikiLink" href="./%25" title="%" data-parsoid='{"stx":"simple","a":{"href":"./%25"},"sa":{"href":"%"}}'>%</a> <a rel="mw:WikiLink" href="./+" title="+" data-parsoid='{"stx":"simple","a":{"href":"./+"},"sa":{"href":"+"}}'>+</a> <span class="mw-default-size" typeof="mw:Error mw:Image" data-parsoid='{"optList":[{"ck":"bogus","ak":"foo"},{"ck":"caption","ak":"[[bar]]"}]}' data-mw='{"errors":[{"key":"missing-image","message":"This image does not exist."}],"caption":"&lt;a rel=\"mw:WikiLink\" href=\"./Bar\" title=\"Bar\" data-parsoid=&#39;{\"stx\":\"simple\",\"a\":{\"href\":\"./Bar\"},\"sa\":{\"href\":\"bar\"},\"dsr\":[94,101,2,2]}&#39;>bar&lt;/a>"}'><a href="./File:%25+abc9" data-parsoid='{"a":{"href":"./File:%25+abc9"},"sa":{}}'><img resource="./File:%25+abc9" src="./Special:FilePath/%25+abc9" height="220" width="220" data-parsoid='{"a":{"resource":"./File:%25+abc9","height":"220","width":"220"},"sa":{"resource":"File:%+abc%39"}}'/></a></span>
21082 <a rel="mw:WikiLink" href="./3E" title="3E" data-parsoid='{"stx":"simple","a":{"href":"./3E"},"sa":{"href":"%33%45"}}'>3E</a> <a rel="mw:WikiLink" href="./3E+" title="3E+" data-parsoid='{"stx":"simple","a":{"href":"./3E+"},"sa":{"href":"%33%45+"}}'>3E+</a></p>
21083 !! end
21085 !! test
21086 Special characters in embedded file links (bug 27679)
21087 !! wikitext
21088 [[File:Contains & ampersand.jpg]]
21089 [[File:Does not exist.jpg|Title with & ampersand]]
21090 !! html/php
21091 <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>
21092 <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>
21093 </p>
21094 !! html/parsoid
21095 <p><span class="mw-default-size" typeof="mw:Error mw:Image" data-mw='{"errors":[{"key":"missing-image","message":"This image does not exist."}]}'><a href="./File:Contains_&amp;_ampersand.jpg"><img resource="./File:Contains_&amp;_ampersand.jpg" src="./Special:FilePath/Contains_&amp;_ampersand.jpg" height="220" width="220"/></a></span>
21096 <span class="mw-default-size" typeof="mw:Error mw:Image" data-mw='{"errors":[{"key":"missing-image","message":"This image does not exist."}],"caption":"Title with &amp;amp; ampersand"}'><a href="./File:Does_not_exist.jpg"><img resource="./File:Does_not_exist.jpg" src="./Special:FilePath/Does_not_exist.jpg" height="220" width="220"/></a></span></p>
21097 !! end
21099 !! test
21100 Confirm that 'apos' named character reference doesn't make it to output (not legal in HTML 4)
21101 !! wikitext
21102 Text&apos;s been normalized?
21103 !! html
21104 <p>Text&#39;s been normalized?
21105 </p>
21106 !! end
21108 !! test
21109 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate free external links
21110 !! wikitext
21111 http://www.example.org/ <-- U+3000 (vim: ^Vu3000)
21112 !! html
21113 <p><a rel="nofollow" class="external free" href="http://www.example.org/">http://www.example.org/</a> &lt;-- U+3000 (vim: ^Vu3000)
21114 </p>
21115 !! end
21117 !! test
21118 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate bracketed external links
21119 !! wikitext
21120 [http://www.example.org/ ideograms]
21121 !! html
21122 <p><a rel="nofollow" class="external text" href="http://www.example.org/">ideograms</a>
21123 </p>
21124 !! end
21126 !! test
21127 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate external images links
21128 !! wikitext
21129 http://www.example.org/pic.png <-- U+3000 (vim: ^Vu3000)
21130 !! html
21131 <p><img src="http://www.example.org/pic.png" alt="pic.png"/> &lt;-- U+3000 (vim: ^Vu3000)
21132 </p>
21133 !! end
21135 !! article
21136 Mediawiki:loop1
21137 !! text
21138 {{Identical|A}}
21139 !! endarticle
21141 !! article
21142 Mediawiki:loop2
21143 !! text
21144 {{Identical|B}}
21145 !! endarticle
21147 !! article
21148 Template:Identical
21149 !! text
21150 {{int:loop1}}
21151 {{int:loop2}}
21152 !! endarticle
21154 !! test
21155 Bug 31098 Template which includes system messages which includes the template
21156 !! wikitext
21157 {{Identical}}
21158 !! html
21159 <p><span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
21160 <span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
21161 </p>
21162 !! end
21164 !! test
21165 Bug31490 Turkish: ucfirst 'blah'
21166 !! options
21167 language=tr
21168 !! wikitext
21169 {{ucfirst:blah}}
21170 !! html
21171 <p>Blah
21172 </p>
21173 !! end
21175 !! test
21176 Bug31490 Turkish: ucfirst 'ix'
21177 !! options
21178 language=tr
21179 !! wikitext
21180 {{ucfirst:ix}}
21181 !! html
21182 <p>İx
21183 </p>
21184 !! end
21186 !! test
21187 Bug31490 Turkish: lcfirst 'BLAH'
21188 !! options
21189 language=tr
21190 !! wikitext
21191 {{lcfirst:BLAH}}
21192 !! html
21193 <p>bLAH
21194 </p>
21195 !! end
21197 !! test
21198 Bug31490 Turkish: ucfırst (with a dotless i)
21199 !! options
21200 language=tr
21201 !! wikitext
21202 {{ucfırst:blah}}
21203 !! html
21204 <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>
21205 </p>
21206 !! end
21208 !! test
21209 Bug31490 ucfırst (with a dotless i) with English language
21210 !! options
21211 language=en
21212 !! wikitext
21213 {{ucfırst:blah}}
21214 !! html
21215 <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>
21216 </p>
21217 !! end
21219 !! test
21220 Bug 26375: TOC with italics
21221 !! options
21222 title=[[Main Page]]
21223 !! wikitext
21224 __TOC__
21225 == ''Lost'' episodes ==
21226 !! html
21227 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
21228 <ul>
21229 <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>
21230 </ul>
21231 </div>
21233 <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>
21235 !! end
21237 !! test
21238 Bug 26375: TOC with bold
21239 !! options
21240 title=[[Main Page]]
21241 !! wikitext
21242 __TOC__
21243 == '''should be bold''' then normal text ==
21244 !! html
21245 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
21246 <ul>
21247 <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>
21248 </ul>
21249 </div>
21251 <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>
21253 !! end
21255 !! test
21256 Bug 33845: Headings become cursive in TOC when they contain an image
21257 !! options
21258 title=[[Main Page]]
21259 !! wikitext
21260 __TOC__
21261 == Image [[Image:foobar.jpg]] ==
21262 !! html
21263 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
21264 <ul>
21265 <li class="toclevel-1 tocsection-1"><a href="#Image"><span class="tocnumber">1</span> <span class="toctext">Image</span></a></li>
21266 </ul>
21267 </div>
21269 <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>
21271 !! end
21273 !! test
21274 Bug 33845 (2): Headings become bold in TOC when they contain a blockquote
21275 !! options
21276 title=[[Main Page]]
21277 !! wikitext
21278 __TOC__
21279 == <blockquote>Quote</blockquote> ==
21280 !! html
21281 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
21282 <ul>
21283 <li class="toclevel-1 tocsection-1"><a href="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
21284 </ul>
21285 </div>
21287 <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>
21289 !! html+tidy
21290 <p></p>
21291 <div id="toc" class="toc">
21292 <div id="toctitle">
21293 <h2>Contents</h2>
21294 </div>
21295 <ul>
21296 <li class="toclevel-1 tocsection-1"><a href="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
21297 </ul>
21298 </div>
21299 <p></p>
21300 <h2><span class="mw-headline" id="Quote"></span></h2>
21301 <blockquote>
21302 <p><span class="mw-headline" id="Quote">Quote</span></p>
21303 </blockquote>
21304 <p><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></p>
21305 !! end
21307 !! test
21308 Unclosed tags in TOC
21309 !! options
21310 title=[[Main Page]]
21311 !! wikitext
21312 __TOC__
21313 == Proof: 2 < 3 ==
21314 <small>Hanc marginis exiguitas non caperet.</small>
21316 !! html
21317 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
21318 <ul>
21319 <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>
21320 </ul>
21321 </div>
21323 <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>
21324 <p><small>Hanc marginis exiguitas non caperet.</small>
21326 </p>
21327 !! end
21329 !! test
21330 Multiple tags in TOC
21331 !! wikitext
21332 __TOC__
21333 == <i>Foo</i> <b>Bar</b> ==
21335 == <i>Foo</i> <blockquote>Bar</blockquote> ==
21336 !! html
21337 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
21338 <ul>
21339 <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>
21340 <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>
21341 </ul>
21342 </div>
21344 <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>
21345 <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>
21347 !! html+tidy
21348 <p></p>
21349 <div id="toc" class="toc">
21350 <div id="toctitle">
21351 <h2>Contents</h2>
21352 </div>
21353 <ul>
21354 <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>
21355 <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>
21356 </ul>
21357 </div>
21358 <p></p>
21359 <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>
21360 <h2><span class="mw-headline" id="Foo_Bar_2"><i>Foo</i></span></h2>
21361 <blockquote>
21362 <p><span class="mw-headline" id="Foo_Bar_2">Bar</span></p>
21363 </blockquote>
21364 <p><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></p>
21365 !! end
21367 # Don't expect Parsoid to roundtrip this until the php parser comes closer to
21368 # html5 tag parsing.
21369 !! test
21370 Tags with parameters in TOC
21371 !! options
21372 parsoid=wt2html
21373 !! wikitext
21374 __TOC__
21375 == <sup class="in-h2">Hello</sup> ==
21377 == <sup class="a > b">Evilbye</sup> ==
21378 !! html/php
21379 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
21380 <ul>
21381 <li class="toclevel-1 tocsection-1"><a href="#Hello"><span class="tocnumber">1</span> <span class="toctext"><sup>Hello</sup></span></a></li>
21382 <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>
21383 </ul>
21384 </div>
21386 <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>
21387 <h2><span class="mw-headline" id="b.22.3EEvilbye"><sup class="a"> 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;&gt;Evilbye">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
21389 !! html/parsoid
21390 <meta property="mw:PageProp/toc" />
21391 <h2> <sup class="in-h2" data-parsoid='{"stx":"html"}'>Hello</sup> </h2>
21393 <h2> <sup class="a " data-parsoid='{"stx":"html"}'> b">Evilbye</sup> </h2>
21394 !! end
21396 !! test
21397 span tags with directionality in TOC
21398 !! wikitext
21399 __TOC__
21400 == <span dir="ltr">C++</span> ==
21402 == <span dir="rtl">זבנג!</span> ==
21404 == <span style="font-style: italic">The attributes on these span tags must be deleted from the TOC</span> ==
21406 == <span style="font-style: italic" dir="ltr">All attributes on these span tags must be deleted from the TOC</span> ==
21408 == <span dir="ltr" style="font-style: italic">Attributes after dir on these span tags must be deleted from the TOC</span> ==
21409 !! html
21410 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
21411 <ul>
21412 <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>
21413 <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>
21414 <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>
21415 <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>
21416 <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>
21417 </ul>
21418 </div>
21420 <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>
21421 <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>
21422 <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>
21423 <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>
21424 <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>
21426 !! end
21428 !! test
21429 Bug 72884: bdi element in ToC
21430 !! wikitext
21431 __TOC__
21432 == <bdi>test</bdi> ==
21433 !! html
21434 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
21435 <ul>
21436 <li class="toclevel-1 tocsection-1"><a href="#test"><span class="tocnumber">1</span> <span class="toctext"><bdi>test</bdi></span></a></li>
21437 </ul>
21438 </div>
21440 <h2><span class="mw-headline" id="test"><bdi>test</bdi></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: test">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
21442 !! end
21444 # Note that the html output does not have the <p></p>, but the
21445 # html+tidy output *does*.  This is because the empty <p></p> is
21446 # removed by the sanitizer, but only when tidy is *not* enabled (!).
21447 !! test
21448 Empty <p> tag in TOC, removed by Sanitizer (T92892)
21449 !! wikitext
21450 __TOC__
21451 == x ==
21452 !! html
21453 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
21454 <ul>
21455 <li class="toclevel-1 tocsection-1"><a href="#x"><span class="tocnumber">1</span> <span class="toctext">x</span></a></li>
21456 </ul>
21457 </div>
21459 <h2><span class="mw-headline" id="x">x</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: x">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
21461 !! html+tidy
21462 <p></p>
21463 <div id="toc" class="toc">
21464 <div id="toctitle">
21465 <h2>Contents</h2>
21466 </div>
21467 <ul>
21468 <li class="toclevel-1 tocsection-1"><a href="#x"><span class="tocnumber">1</span> <span class="toctext">x</span></a></li>
21469 </ul>
21470 </div>
21471 <p></p>
21472 <h2><span class="mw-headline" id="x">x</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: x">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
21473 !! end
21475 !! article
21476 MediaWiki:Bug32057
21477 !! text
21478 == {{int:headline_sample}} ==
21479 !! endarticle
21481 !! test
21482 Bug 32057: Title needed when expanding <h> nodes.
21483 !! options
21484 title=[[Main Page]]
21485 !! wikitext
21486 {{int:Bug32057}}
21487 !! html
21488 <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>
21490 !! end
21492 !! test
21493 Strip marker in urlencode
21494 !! wikitext
21495 {{urlencode:x<nowiki/>y}}
21496 {{urlencode:x<nowiki/>y|wiki}}
21497 {{urlencode:x<nowiki/>y|path}}
21498 {{urlencode:x<pre id="one">two</pre>y}}
21499 !! html
21500 <p>xy
21504 </p>
21505 !! end
21507 !! test
21508 Strip marker in lc
21509 !! wikitext
21510 {{lc:x<nowiki/>y}}
21511 !! html
21512 <p>xy
21513 </p>
21514 !! end
21516 !! test
21517 Strip marker in uc
21518 !! wikitext
21519 {{uc:x<nowiki/>y}}
21520 !! html
21521 <p>XY
21522 </p>
21523 !! end
21525 !! test
21526 Strip marker in formatNum
21527 !! wikitext
21528 {{formatnum:1<nowiki/>2}}
21529 {{formatnum:1<nowiki/>2|R}}
21530 !! html
21531 <p>12
21533 </p>
21534 !! end
21536 !! test
21537 Check noCommafy in formatNum
21538 !! options
21539 language=be-tarask
21540 !! wikitext
21541 {{formatnum:123456.78}}
21542 {{formatnum:123456.78|NOSEP}}
21543 !! html
21544 <p>123 456,78
21545 123456.78
21546 </p>
21547 !! end
21549 !! test
21550 Wrong option for formatNum (bug 56199)
21551 !! wikitext
21552 {{formatnum:1,234.56|Random}}
21553 {{formatnum:1,234.56|EVERYTHING}}
21554 {{formatnum:1234.56|any argument that has the string 'NOSEP'}}
21555 !! html
21556 <p>1,234.56
21557 1,234.56
21558 1,234.56
21559 </p>
21560 !! end
21562 !! test
21563 Strip marker in grammar
21564 !! options
21565 language=fi
21566 !! wikitext
21567 {{grammar:elative|foo<nowiki/>bar}}
21568 !! html
21569 <p>foobarista
21570 </p>
21571 !! end
21573 !! test
21574 Strip marker in padleft
21575 !! wikitext
21576 {{padleft:|2|x<nowiki/>y}}
21577 !! html
21578 <p>xy
21579 </p>
21580 !! end
21582 !! test
21583 Strip marker in padright
21584 !! wikitext
21585 {{padright:|2|x<nowiki/>y}}
21586 !! html
21587 <p>xy
21588 </p>
21589 !! end
21591 !! test
21592 Strip marker in anchorencode
21593 !! wikitext
21594 {{anchorencode:x<nowiki/>y}}
21595 !! html
21596 <p>xy
21597 </p>
21598 !! end
21600 !! test
21601 nowiki inside link inside heading (bug 18295)
21602 !! wikitext
21603 ==[[foo|x<nowiki>y</nowiki>z]]==
21604 !! html
21605 <h2><span class="mw-headline" id="xyz"><a href="/wiki/Foo" title="Foo">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>
21607 !! end
21609 !! test
21610 new support for bdi element (bug 31817)
21611 !! wikitext
21612 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
21613 !! html
21614 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
21616 !!end
21618 !! test
21619 Ignore pipe between table row attributes
21620 !! wikitext
21622 | quux
21623 |- id=foo | style='color: red'
21624 | bar
21626 !! html
21627 <table>
21628 <tr>
21629 <td> quux
21630 </td></tr>
21631 <tr id="foo" style="color: red">
21632 <td> bar
21633 </td></tr></table>
21635 !! end
21637 !!test
21638 Gallery override link with WikiLink (bug 34852)
21639 !! wikitext
21640 <gallery>
21641 File:foobar.jpg|caption|alt=galleryalt|link=InterWikiLink
21642 </gallery>
21643 !! html
21644 <ul class="gallery mw-gallery-traditional">
21645                 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21646                         <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" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/240px-Foobar.jpg 2x" /></a></div></div>
21647                         <div class="gallerytext">
21648 <p>caption
21649 </p>
21650                         </div>
21651                 </div></li>
21652 </ul>
21654 !! end
21656 !!test
21657 Gallery override link with absolute external link (bug 34852)
21658 !! wikitext
21659 <gallery>
21660 File:foobar.jpg|caption|alt=galleryalt|link=http://www.example.org
21661 </gallery>
21662 !! html
21663 <ul class="gallery mw-gallery-traditional">
21664                 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21665                         <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" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/240px-Foobar.jpg 2x" /></a></div></div>
21666                         <div class="gallerytext">
21667 <p>caption
21668 </p>
21669                         </div>
21670                 </div></li>
21671 </ul>
21673 !! end
21675 !!test
21676 Gallery override link with malicious javascript (bug 34852)
21677 !! wikitext
21678 <gallery>
21679 File:foobar.jpg|caption|alt=galleryalt|link=" onclick="alert('malicious javascript code!');
21680 </gallery>
21681 !! html
21682 <ul class="gallery mw-gallery-traditional">
21683                 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21684                         <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" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/240px-Foobar.jpg 2x" /></a></div></div>
21685                         <div class="gallerytext">
21686 <p>caption
21687 </p>
21688                         </div>
21689                 </div></li>
21690 </ul>
21692 !! end
21694 !!test
21695 Gallery with invalid title as link (bug 43964)
21696 !! wikitext
21697 <gallery>
21698 File:foobar.jpg|link=<
21699 </gallery>
21700 !! html
21701 <ul class="gallery mw-gallery-traditional">
21702                 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21703                         <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" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/240px-Foobar.jpg 2x" /></a></div></div>
21704                         <div class="gallerytext">
21705                         </div>
21706                 </div></li>
21707 </ul>
21709 !! end
21711 !!test
21712 Language parser function
21713 !! wikitext
21714 {{#language:ar}}
21715 !! html
21716 <p>العربية
21717 </p>
21718 !! end
21720 !!test
21721 Padleft and padright as substr
21722 !! wikitext
21723 {{padleft:|3|abcde}}
21724 {{padright:|3|abcde}}
21725 !! html
21726 <p>abc
21728 </p>
21729 !! end
21731 !!test
21732 Special parser function
21733 !! wikitext
21734 {{#special:RandomPage}}
21735 {{#special:BaDtItLe}}
21736 {{#special:Foobar}}
21737 !! html
21738 <p>Special:Random
21739 Special:Badtitle
21740 Special:Foobar
21741 </p>
21742 !! end
21744 !!test
21745 Bug 34939 - Case insensitive link parsing ([HttP://])
21746 !! wikitext
21747 [HttP://MediaWiki.Org/]
21748 !! html/php
21749 <p><a rel="nofollow" class="external autonumber" href="HttP://MediaWiki.Org/">[1]</a>
21750 </p>
21751 !! html/parsoid
21752 <p><a rel="mw:ExtLink" href="HttP://MediaWiki.Org/"></a></p>
21753 !! end
21755 !!test
21756 Bug 34939 - Case insensitive link parsing ([HttP:// title])
21757 !! wikitext
21758 [HttP://MediaWiki.Org/ MediaWiki]
21759 !! html
21760 <p><a rel="nofollow" class="external text" href="HttP://MediaWiki.Org/">MediaWiki</a>
21761 </p>
21762 !! end
21764 !!test
21765 Bug 34939 - Case insensitive link parsing (HttP://)
21766 !! wikitext
21767 HttP://MediaWiki.Org/
21768 !! html/php
21769 <p><a rel="nofollow" class="external free" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a>
21770 </p>
21771 !! html/parsoid
21772 <p><a rel="mw:ExtLink" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a></p>
21773 !! end
21775 !!test
21776 Disable TOC
21777 !! options
21778 notoc
21779 !! wikitext
21780 Lead
21781 == Section 1 ==
21782 == Section 2 ==
21783 == Section 3 ==
21784 == Section 4 ==
21785 == Section 5 ==
21786 !! html
21787 <p>Lead
21788 </p>
21790 <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>
21791 <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=2" title="Edit section: Section 2">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
21792 <h2><span class="mw-headline" id="Section_3">Section 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: Section 3">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
21793 <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=4" title="Edit section: Section 4">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
21794 <h2><span class="mw-headline" id="Section_5">Section 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: Section 5">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
21796 !! end
21800 ### Parsoid-specific tests
21801 ### Parsoid-PHP parser incompatibilities
21803 !!test
21804 1. SOL-sensitive wikitext tokens as template-args
21805 !!options
21806 parsoid=wt2html,wt2wt
21807 !! wikitext
21808 {{echo|*a}}
21809 {{echo|#a}}
21810 {{echo|:a}}
21811 !! html
21812 <span about="#mwt1" typeof="mw:Transclusion">
21813 </span><ul about="#mwt1"><li>a</li>
21814 </ul>
21815 <span about="#mwt2" typeof="mw:Transclusion">
21816 </span><ol about="#mwt2"><li>a</li>
21817 </ol>
21818 <span about="#mwt3" typeof="mw:Transclusion">
21819 </span><dl about="#mwt3"><dd>a</dd>
21820 </dl>
21821 !!end
21823 #### -----------------------------------------------------------------
21824 #### Parsoid-specific functionality tests
21825 #### -----------------------------------------------------------------
21827 # Bug 63642/66749: Formatting elt fixup around images is cleaned up.
21828 # We know wt2wt will fail, but we expect selser to pass.
21829 # Due to the nature of our testing, wt2wt and selser tests will enter the
21830 # blacklist and we'll catch selser regressions based on changes to the
21831 # blacklist entries for selser tests.
21832 !! test
21833 1. Bad treebuilder fixup of formatting elt is cleaned up
21834 !! options
21835 parsoid=wt2html,wt2wt
21836 !! wikitext
21839 <small>
21840 [[Image:Foobar.jpg|right|Test]]
21841 </small>
21843 !! html/parsoid
21844 <table>
21845 <tbody><tr><td>
21846 <small>
21847 <figure class="mw-default-size mw-halign-right" typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a><figcaption>Test</figcaption></figure>
21848 </small>
21849 </td></tr>
21850 </tbody></table>
21851 !! end
21853 !! test
21854 2. Bad treebuilder fixup of formatting elt is cleaned up
21855 !! options
21856 parsoid=wt2html,wt2wt
21857 !! wikitext
21858 '''foo[[File:Foobar.jpg|thumb|caption]]bar'''
21860 <small>[[Image:Foobar.jpg|right|300px]]</small>
21861 !! html/parsoid
21863 <p><b>foo</b></p>
21864 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption><b>caption</b></figcaption></figure>
21865 <p><b>bar</b></p>
21866 <small><figure class="mw-halign-right" typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/300px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="34" width="300"/></a></figure></small>
21867 !! end
21869 !! test
21870 3. Bad treebuilder fixup of formatting elt is cleaned up
21871 !! options
21872 parsoid=wt2html,wt2wt
21873 !! wikitext
21874 <small>'''foo[[File:Foobar.jpg|thumb|caption]]bar'''</small>
21875 !! html/parsoid
21876 <p><small><b>foo</b></small></p>
21877 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption><small><b>caption</b></small></figcaption></figure>
21878 <p><small><b>bar</b></small></p>
21879 !! end
21881 !! test
21882 4. Bad treebuilder fixup of formatting elt is cleaned up: formatting tags around captionless images are ignored
21883 !! options
21884 parsoid=wt2html,wt2wt
21885 !! wikitext
21886 '''<small>[[Image:Foobar.jpg|right|300px]]</small>'''
21887 !! html/parsoid
21888 <p><b><small></small></b></p>
21889 <figure class="mw-halign-right" typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/300px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="34" width="300"/></a></figure>
21890 <p></p>
21891 !! end
21893 #### ----------------------------------------------------------------
21894 #### Parsoid-only testing of Parsoid's impl of <ref> and <references>
21895 #### tags. Parsoid's output for these tags differs from that of the
21896 #### PHP parser.
21897 #### ----------------------------------------------------------------
21899 !!test
21900 Ref: 1. ref-location should be replaced with an index span
21901 !! wikitext
21902 A <ref>foo</ref>
21903 B <ref name="x">foo</ref>
21904 C <ref name="y" />
21905 <references />
21906 !! html/parsoid
21907 <p>A <span about="#mwt2" class="mw-ref" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-1"},"attrs":{}}'><a href="#cite_note-1"><span class="mw-reflink-text">[1]</span></a></span>
21908 B <span about="#mwt4" class="mw-ref" id="cite_ref-x_2-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-x-2"},"attrs":{"name":"x"}}'><a href="#cite_note-x-2"><span class="mw-reflink-text">[2]</span></a></span>
21909 C <span about="#mwt6" class="mw-ref" id="cite_ref-y_3-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{"name":"y"}}'><a href="#cite_note-y-3"><span class="mw-reflink-text">[3]</span></a></span></p>
21910 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt8" data-mw='{"name":"references","attrs":{}}'>
21911 <li about="#cite_note-1" id="cite_note-1"><a href="#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text">foo</span></li>
21912 <li about="#cite_note-x-2" id="cite_note-x-2"><a href="#cite_ref-x_2-0" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-x-2" class="mw-reference-text">foo</span></li>
21913 <li about="#cite_note-y-3" id="cite_note-y-3"><a href="#cite_ref-y_3-0" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-y-3" class="mw-reference-text"></span></li>
21914 </ol>
21915 !!end
21917 !!test
21918 Ref: 2. ref-tags with identical names should all get the same index
21919 !! wikitext
21920 A <ref name="x">foo</ref>
21921 B <ref name="x" />
21922 <references />
21923 !! html/parsoid
21924 <p>A <span about="#mwt2" class="mw-ref" id="cite_ref-x_1-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-x-1"},"attrs":{"name":"x"}}'><a href="#cite_note-x-1"><span class="mw-reflink-text">[1]</span></a></span>
21925 B <span about="#mwt4" class="mw-ref" id="cite_ref-x_1-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{"name":"x"}}'><a href="#cite_note-x-1"><span class="mw-reflink-text">[1]</span></a></span></p>
21926 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
21927 <li about="#cite_note-x-1" id="cite_note-x-1"><span rel="mw:referencedBy"><a href="#cite_ref-x_1-0"><span class="mw-linkback-text">1 </span></a><a href="#cite_ref-x_1-1"><span class="mw-linkback-text">2 </span></a></span> <span id="mw-reference-text-cite_note-x-1" class="mw-reference-text">foo</span></li>
21928 </ol>
21929 !!end
21931 !!test
21932 Ref: 3. spaces in ref-names should be ignored
21933 !! wikitext
21934 A <ref name="x">foo</ref>
21935 B <ref name=" x " />
21936 C <ref name= x  />
21937 <references />
21938 !! html/parsoid
21939 <p>A <span about="#mwt2" class="mw-ref" id="cite_ref-x_1-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-x-1"},"attrs":{"name":"x"}}'><a href="#cite_note-x-1"><span class="mw-reflink-text">[1]</span></a></span>
21940 B <span about="#mwt4" class="mw-ref" id="cite_ref-x_1-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{"name":"x"}}'><a href="#cite_note-x-1"><span class="mw-reflink-text">[1]</span></a></span>
21941 C <span about="#mwt6" class="mw-ref" id="cite_ref-x_1-2" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{"name":"x"}}'><a href="#cite_note-x-1"><span class="mw-reflink-text">[1]</span></a></span></p>
21942 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt8" data-mw='{"name":"references","attrs":{}}'>
21943 <li about="#cite_note-x-1" id="cite_note-x-1"><span rel="mw:referencedBy"><a href="#cite_ref-x_1-0"><span class="mw-linkback-text">1 </span></a><a href="#cite_ref-x_1-1"><span class="mw-linkback-text">2 </span></a><a href="#cite_ref-x_1-2"><span class="mw-linkback-text">3 </span></a></span> <span id="mw-reference-text-cite_note-x-1" class="mw-reference-text">foo</span></li>
21944 </ol>
21945 !!end
21947 # NOTE: constructor is a predefined property in JS and constructor as a ref-name can clash with it if not handled properly)
21948 !!test
21949 Ref: 4. 'constructor' should be accepted as a valid ref-name
21950 !! wikitext
21951 A <ref name="constructor">foo</ref>
21952 <references />
21953 !! html/parsoid
21954 <p>A <span about="#mwt2" class="mw-ref" id="cite_ref-constructor_1-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-constructor-1"},"attrs":{"name":"constructor"}}'><a href="#cite_note-constructor-1"><span class="mw-reflink-text">[1]</span></a></span></p>
21955 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
21956 <li about="#cite_note-constructor-1" id="cite_note-constructor-1"><a href="#cite_ref-constructor_1-0" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-constructor-1" class="mw-reference-text">foo</span></li>
21957 </ol>
21958 !!end
21960 !!test
21961 Ref: 5. body should accept generic wikitext
21962 !! wikitext
21963 A <ref>
21964  This is a '''[[bolded link]]''' and this is a {{echo|transclusion}}
21965 </ref>
21967 <references />
21968 !! html/parsoid
21969 <p>A <span about="#mwt2" class="mw-ref" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-1"},"attrs":{}}'><a href="#cite_note-1"><span class="mw-reflink-text">[1]</span></a></span></p>
21971 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'>
21972 <li about="#cite_note-1" id="cite_note-1"><a href="#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text">This is a <b><a rel="mw:WikiLink" href="Bolded_link" title="Bolded link">bolded link</a></b> and this is a <span about="#mwt3" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"transclusion"}},"i":0}}]}'>transclusion</span>
21973 </span></li>
21974 </ol>
21975 !!end
21977 !!test
21978 Ref: 6. indent-pres should not be output in ref-body
21979 !! wikitext
21980 A <ref>
21981  foo
21982  bar
21983  baz
21984 </ref>
21986 <references />
21987 !! html/parsoid
21988 <p>A <span about="#mwt2" class="mw-ref" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-1"},"attrs":{}}'><a href="#cite_note-1"><span class="mw-reflink-text">[1]</span></a></span></p>
21990 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
21991 <li about="#cite_note-1" id="cite_note-1"><a href="#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text">foo
21992  bar
21993  baz
21994 </span></li>
21995 </ol>
21996 !!end
21998 !!test
21999 Ref: 7. No p-wrapping in ref-body
22000 !! wikitext
22001 A <ref>
22011 booz
22012 </ref>
22014 <references />
22015 !! html/parsoid
22016 <p>A <span about="#mwt2" class="mw-ref" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-1"},"attrs":{}}'><a href="#cite_note-1"><span class="mw-reflink-text">[1]</span></a></span></p>
22018 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
22019 <li about="#cite_note-1" id="cite_note-1"><a href="#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text">foo
22028 booz
22029 </span></li>
22030 </ol>
22031 !!end
22033 !!test
22034 Ref: 8. transclusion wikitext has lower precedence
22035 !! wikitext
22036 A <ref> foo {{echo|</ref> B C}}
22038 <references />
22039 !! html/parsoid
22040 <p>A <span about="#mwt2" class="mw-ref" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-1"},"attrs":{}}'><a href="#cite_note-1"><span class="mw-reflink-text">[1]</span></a></span> B C}}</p>
22041 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
22042 <li about="#cite_note-1" id="cite_note-1"><a href="#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text">foo {{echo|</span></li>
22043 </ol>
22044 !!end
22046 !!test
22047 Ref: 9. unclosed comments should not leak out of ref-body
22048 !! wikitext
22049 A <ref> foo <!--</ref> B C
22050 <references />
22051 !! html/parsoid
22052 <p>A <span about="#mwt2" class="mw-ref" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-1"},"attrs":{}}'><a href="#cite_note-1"><span class="mw-reflink-text">[1]</span></a></span> B C</p>
22053 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
22054 <li about="#cite_note-1" id="cite_note-1"><a href="#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text">foo <!----></span></li>
22055 </ol>
22056 !!end
22058 !!test
22059 Ref: 10. Unclosed HTML tags should not leak out of ref-body
22060 !! wikitext
22061 A <ref> <b> foo </ref> B C
22063 <references />
22064 !! html/parsoid
22065 <p>A <span about="#mwt2" class="mw-ref" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-1"},"attrs":{}}'><a href="#cite_note-1"><span class="mw-reflink-text">[1]</span></a></span> B C</p>
22068 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
22069 <li about="#cite_note-1" id="cite_note-1"><a href="#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text"><b data-parsoid='{"stx":"html","autoInsertedEnd":true}'> foo </b></span></li>
22070 </ol>
22071 !!end
22073 !!test
22074 Ref: 11. ref-tags acts like an inline element wrt P-wrapping
22075 !! wikitext
22076 A <ref>foo</ref> B
22077 C <ref>bar</ref> D
22078 <references />
22079 !! html/parsoid
22080 <p>A <span about="#mwt2" class="mw-ref" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-1"},"attrs":{}}'><a href="#cite_note-1"><span class="mw-reflink-text">[1]</span></a></span> B
22081 C <span about="#mwt4" class="mw-ref" id="cite_ref-2" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-2"},"attrs":{}}'><a href="#cite_note-2"><span class="mw-reflink-text">[2]</span></a></span> D</p>
22082 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
22083 <li about="#cite_note-1" id="cite_note-1"><a href="#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text">foo</span></li>
22084 <li about="#cite_note-2" id="cite_note-2"><a href="#cite_ref-2" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-2" class="mw-reference-text">bar</span></li>
22085 </ol>
22086 !!end
22088 !!test
22089 Ref: 12. ref-tags act as trailing newline migration barrier
22090 !! wikitext
22091 <!--the newline at the end of this line moves out of the p tag-->a
22093 b<!--the newline at the end of this line stays inside the p tag--> <ref />
22094 <ref />
22097 <references />
22098 !! html/parsoid
22099 <!--the newline at the end of this line moves out of the p tag--><p>a</p>
22102 <p>b<!--the newline at the end of this line stays inside the p tag--> <span about="#mwt2" class="mw-ref" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{}}'><a href="#cite_note-1"><span class="mw-reflink-text">[1]</span></a></span>
22103 <span about="#mwt4" class="mw-ref" id="cite_ref-2" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{}}'><a href="#cite_note-2"><span class="mw-reflink-text">[2]</span></a></span></p>
22105 <p>c</p>
22106 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
22107 <li about="#cite_note-1" id="cite_note-1"><a href="#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text"></span></li>
22108 <li about="#cite_note-2" id="cite_note-2"><a href="#cite_ref-2" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-2" class="mw-reference-text"></span></li></ol>
22109 !!end
22111 !!test
22112 Ref: 13. ref-tags are not SOL-transparent and block indent-pres
22113 !! wikitext
22114 <ref>foo</ref> A
22115 <ref>bar
22116 </ref> B
22117 <references />
22118 !! html/parsoid
22119 <p><span about="#mwt2" class="mw-ref" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-1"},"attrs":{}}'><a href="#cite_note-1"><span class="mw-reflink-text">[1]</span></a></span> A
22120 <span about="#mwt4" class="mw-ref" id="cite_ref-2" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-2"},"attrs":{}}'><a href="#cite_note-2"><span class="mw-reflink-text">[2]</span></a></span> B</p>
22121 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
22122 <li about="#cite_note-1" id="cite_note-1"><a href="#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text">foo</span></li>
22123 <li about="#cite_note-2" id="cite_note-2"><a href="#cite_ref-2" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-2" class="mw-reference-text">bar
22124 </span></li>
22125 </ol>
22126 !!end
22128 !!test
22129 Ref: 14. A nested ref-tag should be emitted as plain text
22130 !! wikitext
22131 <ref>foo <ref>bar</ref> baz</ref>
22133 <references />
22134 !! html/parsoid
22135 <p><span about="#mwt2" class="mw-ref" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-1"},"attrs":{}}'><a href="#cite_note-1"><span class="mw-reflink-text">[1]</span></a></span>
22136 </p>
22137 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'>
22138 <li about="#cite_note-1" id="cite_note-1"><a href="#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text">foo &lt;ref>bar&lt;/ref> baz</span></li>
22139 </ol>
22140 !!end
22142 !!test
22143 Ref: 15. ref-tags with identical names should get identical indexes
22144 !! wikitext
22145 A1 <ref name="a">foo</ref> A2 <ref name="a" />
22146 B1 <ref name="b" /> B2 <ref name="b">bar</ref>
22148 <references />
22149 !! html/parsoid
22150 <p>A1 <span about="#mwt3" class="mw-ref" id="cite_ref-a_1-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-a-1"},"attrs":{"name":"a"}}'><a href="#cite_note-a-1"><span class="mw-reflink-text">[1]</span></a></span> A2 <span about="#mwt4" class="mw-ref" id="cite_ref-a_1-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{"name":"a"}}'><a href="#cite_note-a-1"><span class="mw-reflink-text">[1]</span></a></span>
22151 B1 <span about="#mwt7" class="mw-ref" id="cite_ref-b_2-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{"name":"b"}}'><a href="#cite_note-b-2"><span class="mw-reflink-text">[2]</span></a></span> B2 <span about="#mwt8" class="mw-ref" id="cite_ref-b_2-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-b-2"},"attrs":{"name":"b"}}'><a href="#cite_note-b-2"><span class="mw-reflink-text">[2]</span></a></span></p>
22153 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt10" data-mw='{"name":"references","attrs":{}}'><li about="#cite_note-a-1" id="cite_note-a-1"><span rel="mw:referencedBy"><a href="#cite_ref-a_1-0"><span class="mw-linkback-text">1 </span></a><a href="#cite_ref-a_1-1"><span class="mw-linkback-text">2 </span></a></span> <span id="mw-reference-text-cite_note-a-1" class="mw-reference-text">foo</span></li><li about="#cite_note-b-2" id="cite_note-b-2"><span rel="mw:referencedBy"><a href="#cite_ref-b_2-0"><span class="mw-linkback-text">1 </span></a><a href="#cite_ref-b_2-1"><span class="mw-linkback-text">2 </span></a></span> <span id="mw-reference-text-cite_note-b-2" class="mw-reference-text">bar</span></li>
22154 </ol>
22155 !!end
22157 ## We don't bother wt2wt-ing non-standard whitespace
22158 !!test
22159 Ref: 16. Tokenizer should accept non-standard whitespace in <ref> and </ref> tags
22160 !!options
22161 parsoid=wt2html
22162 !! wikitext
22163 A <ref >foo</ref >
22165 <references />
22166 !! html/parsoid
22167 <p>A <span about="#mwt2" class="mw-ref" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-1"},"attrs":{}}'><a href="#cite_note-1"><span class="mw-reflink-text">[1]</span></a></span></p>
22168 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
22169 <li about="#cite_note-1" id="cite_note-1"><a href="#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text">foo</span></li></ol>
22170 !!end
22172 !!test
22173 Ref: 17. Generate valid HTML5 id/about attributes
22174 !!wikitext
22175 <ref name="a b">foo</ref>
22177 <references />
22178 !!html/parsoid
22179 <p><span class="mw-ref" id="cite_ref-a_b_1-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-a_b-1"},"attrs":{"name":"a b"}}'><a href="#cite_note-a_b-1"><span class="mw-reflink-text">[1]</span></a></span>
22180 </p>
22182 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
22183 <li about="#cite_note-a_b-1" id="cite_note-a_b-1"><a href="#cite_ref-a_b_1-0" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-a_b-1" class="mw-reference-text">foo</span></li>
22184 </ol>
22185 !!end
22187 !!test
22188 Ref: 18. T58916: Extension attributes should be parsed as plain text
22189 !!wikitext
22190 <ref name="{{echo|a}}">foo</ref>
22192 <references />
22193 !!html/parsoid
22194 <p><span class="mw-ref" id="cite_ref-.7B.7Becho.7Ca.7D.7D_1-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-.7B.7Becho.7Ca.7D.7D-1"},"attrs":{"name":"{{echo|a}}"}}'><a href="#cite_note-.7B.7Becho.7Ca.7D.7D-1"><span class="mw-reflink-text">[1]</span></a></span>
22195 </p>
22197 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
22198 <li about="#cite_note-.7B.7Becho.7Ca.7D.7D-1" id="cite_note-.7B.7Becho.7Ca.7D.7D-1"><a href="#cite_ref-.7B.7Becho.7Ca.7D.7D_1-0" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-.7B.7Becho.7Ca.7D.7D-1" class="mw-reference-text">foo</span></li>
22199 </ol>
22200 !!end
22202 !!test
22203 Ref: 19. ref-tags with identical name encodings should get identical indexes
22204 !! wikitext
22205 1 <ref name="a & b">foo</ref> 2 <ref name="a &amp; b" />
22207 <references />
22208 !! html/parsoid
22209 <p>1 <span about="#mwt3" class="mw-ref" id="cite_ref-a_.26_b_1-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-a_.26_b-1"},"attrs":{"name":"a &amp; b"}}'><a href="#cite_note-a_.26_b-1"><span class="mw-reflink-text">[1]</span></a></span> 2 <span about="#mwt4" class="mw-ref" id="cite_ref-a_.26_b_1-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{"name":"a &amp;amp; b"}}'><a href="#cite_note-a_.26_b-1"><span class="mw-reflink-text">[1]</span></a></span>
22210 </p>
22211 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
22212 <li about="#cite_note-a_.26_b-1" id="cite_note-a_.26_b-1"><span rel="mw:referencedBy"><a href="#cite_ref-a_.26_b_1-0"><span class="mw-linkback-text">1 </span></a><a href="#cite_ref-a_.26_b_1-1"><span class="mw-linkback-text">2 </span></a></span> <span id="mw-reference-text-cite_note-a_.26_b-1" class="mw-reference-text">foo</span></li>
22213 </ol>
22214 !!end
22216 !!test
22217 Ref: 20. ref-tags with identical names but different content should keep it
22218 !! wikitext
22219 A <ref name="foo">Foo one</ref>
22220 B <ref name="foo">Foo two</ref>
22221 C <ref name="foo" />
22223 <references />
22224 !! html/parsoid
22225 <p>A <span about="#mwt2" class="mw-ref" id="cite_ref-foo_1-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-foo-1"},"attrs":{"name":"foo"}}'><a href="#cite_note-foo-1"><span class="mw-reflink-text">[1]</span></a></span>
22226 B <span about="#mwt4" class="mw-ref" id="cite_ref-foo_1-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"html":"Foo two"},"attrs":{"name":"foo"}}'><a href="#cite_note-foo-1"><span class="mw-reflink-text">[1]</span></a></span>
22227 C <span about="#mwt6" class="mw-ref" id="cite_ref-foo_1-2" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{"name":"foo"}}'><a href="#cite_note-foo-1"><span class="mw-reflink-text">[1]</span></a></span></p>
22229 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt8" data-mw='{"name":"references","attrs":{}}'><li about="#cite_note-foo-1" id="cite_note-foo-1"><span rel="mw:referencedBy"><a href="#cite_ref-foo_1-0"><span class="mw-linkback-text">1 </span></a><a href="#cite_ref-foo_1-1"><span class="mw-linkback-text">2 </span></a><a href="#cite_ref-foo_1-2"><span class="mw-linkback-text">3 </span></a></span> <span id="mw-reference-text-cite_note-foo-1" class="mw-reference-text">Foo one</span></li>
22230 </ol>
22231 !!end
22233 !!test
22234 References: 1. references tag without any refs should be handled properly
22235 !! wikitext
22236 <references />
22237 !! html/parsoid
22238 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt2" data-mw='{"name":"references","attrs":{}}'></ol>
22239 !!end
22241 !!test
22242 References: 2. references tag with group only outputs references from that group
22243 !! wikitext
22244 A <ref group="a">foo</ref>
22245 B <ref group="b">bar</ref>
22246 C <ref>baz</ref>
22248 <references group="a" />
22249 <references />
22250 <references group="b" />
22251 !! html/parsoid
22252 <p>A <span about="#mwt2" class="mw-ref" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-1"},"attrs":{"group":"a"}}'><a href="#cite_note-1" data-mw-group="a"><span class="mw-reflink-text">[a 1]</span></a></span>
22253 B <span about="#mwt4" class="mw-ref" id="cite_ref-2" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-2"},"attrs":{"group":"b"}}'><a href="#cite_note-2" data-mw-group="b"><span class="mw-reflink-text">[b 1]</span></a></span>
22254 C <span class="mw-ref" id="cite_ref-3" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-3"},"attrs":{}}'><a href="#cite_note-3"><span class="mw-reflink-text">[1]</span></a></span></p>
22256 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt8" data-mw-group="a" data-mw='{"name":"references","attrs":{"group":"a"}}'>
22257 <li about="#cite_note-1" id="cite_note-1"><a href="#cite_ref-1" data-mw-group="a" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text">foo</span></li>
22258 </ol>
22259 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt10" data-mw='{"name":"references","attrs":{}}'>
22260 <li about="#cite_note-3" id="cite_note-3"><a href="#cite_ref-3" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-3" class="mw-reference-text">baz</span></li>
22261 </ol>
22262 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt12" data-mw-group="b" data-mw='{"name":"references","attrs":{"group":"b"}}'>
22263 <li about="#cite_note-2" id="cite_note-2"><a href="#cite_ref-2" data-mw-group="b" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-2" class="mw-reference-text">bar</span></li>
22264 </ol>
22265 !!end
22267 !!test
22268 References: 3. ref list should be cleared after processing references
22269 !! wikitext
22270 A <ref>foo</ref>
22272 <references />
22274 B <ref>bar</ref>
22276 <references />
22277 !! html/parsoid
22278 <p>A <span about="#mwt2" class="mw-ref" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-1"},"attrs":{}}'><a href="#cite_note-1"><span class="mw-reflink-text">[1]</span></a></span></p>
22280 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'><li about="#cite_note-1" id="cite_note-1"><a href="#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text">foo</span></li>
22281 </ol>
22283 <p>B <span about="#mwt6" class="mw-ref" id="cite_ref-2" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-2"},"attrs":{}}'><a href="#cite_note-2"><span class="mw-reflink-text">[1]</span></a></span></p>
22285 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt8" data-mw='{"name":"references","attrs":{}}'>
22286 <li about="#cite_note-2" id="cite_note-2"><a href="#cite_ref-2" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-2" class="mw-reference-text">bar</span></li>
22287 </ol>
22288 !!end
22290 !!test
22291 References: 4. only referenced group should be cleared after processing references
22292 !! wikitext
22293 A <ref group="a">afoo</ref>
22294 B <ref>bfoo</ref>
22296 <references group="a" />
22298 C <ref>cfoo</ref>
22300 <references />
22301 !! html/parsoid
22302 <p>A <span about="#mwt2" class="mw-ref" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-1"},"attrs":{"group":"a"}}'><a href="#cite_note-1" data-mw-group="a"><span class="mw-reflink-text">[a 1]</span></a></span>
22303 B <span about="#mwt4" class="mw-ref" id="cite_ref-2" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-2"},"attrs":{}}'><a href="#cite_note-2"><span class="mw-reflink-text">[1]</span></a></span></p>
22305 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw-group="a" data-mw='{"name":"references","attrs":{"group":"a"}}'><li about="#cite_note-1" id="cite_note-1"><a href="#cite_ref-1" data-mw-group="a" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text">afoo</span></li>
22306 </ol>
22308 <p>C <span about="#mwt8" class="mw-ref" id="cite_ref-3" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-3"},"attrs":{}}'><a href="#cite_note-3"><span class="mw-reflink-text">[2]</span></a></span></p>
22310 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt10" data-mw='{"name":"references","attrs":{}}'><li about="#cite_note-2" id="cite_note-2"><a href="#cite_ref-2" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-2" class="mw-reference-text">bfoo</span></li><li about="#cite_note-3" id="cite_note-3"><a href="#cite_ref-3" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-3" class="mw-reference-text">cfoo</span></li>
22311 </ol>
22312 !!end
22314 ## Don't expect this to rt since we're dropping content
22315 !! test
22316 References: 5. ref tags in references should be processed while ignoring all other content
22317 !! options
22318 parsoid=wt2html,html2html
22319 !! wikitext
22320 A <ref name="a" />
22321 B <ref name="b">bar</ref>
22323 <references>
22324 <ref name="a">foo</ref>
22325 This should just get lost.
22326 </references>
22327 !! html/parsoid
22328 <p>A <span about="#mwt2" class="mw-ref" id="cite_ref-a_1-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{"name":"a"}}'><a href="#cite_note-a-1"><span class="mw-reflink-text">[1]</span></a></span>
22329 B <span about="#mwt4" class="mw-ref" id="cite_ref-b_2-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-b-2"},"attrs":{"name":"b"}}'><a href="#cite_note-b-2"><span class="mw-reflink-text">[2]</span></a></span></p>
22332 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{},"body":{"html":"\n&lt;span about=\"#mwt8\" class=\"mw-ref\" rel=\"dc:references\" typeof=\"mw:Extension/ref\" data-parsoid=&#39;{\"dsr\":[59,82,14,6]}&#39; data-mw=&#39;{\"name\":\"ref\",\"body\":{\"id\":\"mw-reference-text-cite_note-a-1\"},\"attrs\":{\"name\":\"a\"}}&#39;>&lt;a href=\"#cite_note-a-1\" style=\"counter-reset: mw-Ref 1;\" data-parsoid=\"{}\">&lt;span class=\"mw-reflink-text\" data-parsoid=\"{}\">[1]&lt;/span>&lt;/a>&lt;/span>\n"}}'><li about="#cite_note-a-1" id="cite_note-a-1"><a href="#cite_ref-a_1-0" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-a-1" class="mw-reference-text">foo</span></li><li about="#cite_note-b-2" id="cite_note-b-2"><a href="#cite_ref-b_2-0" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-b-2" class="mw-reference-text">bar</span></li>
22333 </ol>
22334 !! end
22336 !! test
22337 References: 6. <references /> from a transclusion
22338 !! wikitext
22339 <ref>Foo</ref> {{echo|<references />}}
22340 !! html/parsoid
22341 <p><span about="#mwt3" class="mw-ref" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-1"},"attrs":{}}'><a href="#cite_note-1"><span class="mw-reflink-text">[1]</span></a></span></p> <ol class="mw-references" typeof="mw:Extension/references mw:Transclusion" about="#mwt4" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;references />"}},"i":0}}]}'><li about="#cite_note-1" id="cite_note-1"><a href="#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text">Foo</span></li>
22342 </ol>
22343 !! end
22345 !! test
22346 References: 7. Multiple references tags (one without and one with nested refs) should be correctly handled
22347 !! wikitext
22348 A <ref>foo bar for a</ref>
22349 B <ref group="X" name="b" />
22351 <references />
22353 <references group="X">
22354 <ref name="b">foo</ref>
22355 </references>
22356 !! html/parsoid
22357 <p>A <span about="#mwt2" class="mw-ref" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-1"},"attrs":{}}'><a href="#cite_note-1"><span class="mw-reflink-text">[1]</span></a></span>
22358 B <span about="#mwt4" class="mw-ref" id="cite_ref-b_2-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{"group":"X","name":"b"}}'><a href="#cite_note-b-2" data-mw-group="X"><span class="mw-reflink-text">[X 1]</span></a></span>
22359 </p>
22361 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
22362 <li about="#cite_note-1" id="cite_note-1"><a href="#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text">foo bar for a</span></li>
22363 </ol>
22365 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt8" data-mw-group="X" data-mw='{"name":"references","attrs":{"group":"X"},"body":{"html":"\n&lt;span about=\"#mwt10\" class=\"mw-ref\" rel=\"dc:references\" typeof=\"mw:Extension/ref\" data-parsoid=&#39;{\"dsr\":[96,119,14,6]}&#39; data-mw=&#39;{\"name\":\"ref\",\"body\":{\"id\":\"mw-reference-text-cite_note-b-2\"},\"attrs\":{\"name\":\"b\"}}&#39;>&lt;a href=\"#cite_note-b-2\" style=\"counter-reset: mw-Ref 1;\" data-mw-group=\"X\" data-parsoid=\"{}\">&lt;span class=\"mw-reflink-text\" data-parsoid=\"{}\">[X 1]&lt;/span>&lt;/a>&lt;/span>\n"}}'>
22366 <li about="#cite_note-b-2" id="cite_note-b-2"><a href="#cite_ref-b_2-0" data-mw-group="X" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-b-2" class="mw-reference-text">foo</span></li>
22367 </ol>
22368 !! end
22370 !! test
22371 References: 8. T88019: Remove <meta>s from templates inside <ref> that's itself inside a template
22372 !! wikitext
22373 X{{echo|<ref>foo {{echo|<b>bar</b>}} and {{echo|baz}} boo</ref>}}
22374 <references />
22375 !! html/parsoid
22376 <p>X<span about="#mwt2" class="mw-ref" id="cite_ref-1" rel="dc:references" typeof="mw:Transclusion  mw:Extension/ref" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;ref>foo {{echo|&lt;b>bar&lt;/b>}} and {{echo|baz}} boo&lt;/ref>"}},"i":0}}]}'><a href="#cite_note-1"><span class="mw-reflink-text">[1]</span></a></span></p>
22377 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt7" data-mw='{"name":"references","attrs":{}}'><li about="#cite_note-1" id="cite_note-1"><a href="#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text">foo <b data-parsoid='{"stx":"html"}'>bar</b> and baz boo</span></li>
22378 </ol>
22379 !!end
22381 # This test only works in wt2html now as the <references /> are always generated
22382 # unless selser is active. Once T72722 is fixed, we should add a changes test
22383 # here to ensure that unrelated changes don't add the new <references />
22384 # when selser is active.
22385 !! test
22386 References: 9. Generate missing references list at the end
22387 !! wikitext
22388 A <ref>foo</ref>
22389 B <ref group="inexistent">bar</ref>
22390 !! html/parsoid
22391 <p>A <span class="mw-ref" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-1"},"attrs":{}}'><a href="#cite_note-1"><span class="mw-reflink-text">[1]</span></a></span> B <span class="mw-ref" id="cite_ref-2" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-2"},"attrs":{"group":"inexistent"}}'><a href="#cite_note-2" data-mw-group="inexistent"><span class="mw-reflink-text">[inexistent 1]</span></a></span></p>
22392 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{},"autoGenerated":true}'>
22393 <li about="#cite_note-1" id="cite_note-1"><a href="#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text">foo</span></li>
22394 </ol>
22395 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw-group="inexistent" data-mw='{"name":"references","attrs":{"group":"inexistent"},"autoGenerated":true}'>
22396 <li about="#cite_note-2" id="cite_note-2"><a href="#cite_ref-2" data-mw-group="inexistent" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-2" class="mw-reference-text">bar</span></li>
22397 </ol>
22398 !! end
22400 !! test
22401 References: 10. New <references/> shouldn't be added for unrelated edits.
22402 !! options
22403 parsoid={
22404   "modes": ["selser"],
22405   "changes": [["#x", "remove"]],
22406   "selser": "noauto"
22408 !! wikitext
22409 Unrelated text<span id="x"> that's going to disappear</span>.
22410 A <ref>foo</ref>
22411 !! wikitext/edited
22412 Unrelated text.
22413 A <ref>foo</ref>
22414 !!end
22416 !! test
22417 Entities in ref name
22418 !! wikitext
22419 <ref name="test &amp; me">hi</ref>
22420 <references />
22421 !! html/parsoid
22422 <p><span about="#mwt2" class="mw-ref" id="cite_ref-test_.26_me_1-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-test_.26_me-1"},"attrs":{"name":"test &amp;amp; me"}}'><a href="#cite_note-test_.26_me-1"><span class="mw-reflink-text">[1]</span></a></span></p>
22423 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
22424 <li about="#cite_note-test_.26_me-1" id="cite_note-test_.26_me-1"><a href="#cite_ref-test_.26_me_1-0" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-test_.26_me-1" class="mw-reference-text">hi</span></li>
22425 </ol>
22426 !! end
22428 ## The output here may look funny, but it's what the php parser will do.  The
22429 ## unclosed references tag becomes escaped text, and then a new references
22430 ## tag is auto-generated.  The test is wt2html only because it roundtrips with
22431 ## nowiki tags, and the auto-generated references tag is only dropped in
22432 ## rtTestMode.
22433 !! test
22434 Generate references for unclosed references tag
22435 !! options
22436 parsoid=wt2html
22437 !! wikitext
22438 a<ref>foo</ref>
22440 <references>
22441 !! html/parsoid
22442 <p>a<span about="#mwt2" class="mw-ref" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-1"},"attrs":{}}'><a href="#cite_note-1" style="counter-reset: mw-Ref 1;"><span class="mw-reflink-text">[1]</span></a></span></p>
22444 <p>&lt;references></p>
22445 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt3" data-mw='{"name":"references","attrs":{},"autoGenerated":true}'><li about="#cite_note-1" id="cite_note-1"><a href="#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text">foo</span></li></ol>
22446 !! end
22448 !! test
22449 New reference serializes on its own line
22450 !! options
22451 parsoid=wt2wt,html2wt
22452 !! wikitext
22454 <references />
22455 !! html/parsoid
22456 foo<ol class="mw-references" typeof="mw:Extension/references" about="#mwt2" data-mw='{"name":"references","attrs":{}}'></ol>
22457 !! end
22459 #### ----------------------------------------------------------------
22460 #### Parsoid-only testing of Parsoid's impl of LST
22461 #### Not implemented yet, see
22462 #### https://www.mediawiki.org/wiki/Parsoid/HTML_based_LST
22463 #### ----------------------------------------------------------------
22465 !! test
22466 LST Sections: 1. Simple section start and end
22467 !! options
22468 parsoid={ "suppressErrors": true }
22469 !! wikitext
22470 <section begin="2011-05-16" />
22471 <section end="2014-04-10 (MW 1.23wmf22)" />
22472 !! html/parsoid
22473 <p><meta typeof="mw:Extension/LabeledSectionTransclusion/begin" content="2011-05-16"/>
22474 <meta typeof="mw:Extension/LabeledSectionTransclusion/end" content="2014-04-10 (MW 1.23wmf22)"/></p>
22475 !! end
22477 #--------- Test stripping of empty nodes in template content ----------
22478 !!test
22479 Empty LI and TR nodes should be stripped from template content
22480 !!wikitext
22481 {{EmptyLITest}}
22482 {{EmptyTRTest}}
22483 !!html/parsoid
22484 <ul about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyLITest","href":"./Template:EmptyLITest"},"params":{},"i":0}}]}'>
22485 <li>a</li>
22486 <li>b</li>
22487 </ul>
22488 <table about="#mwt2" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyTRTest","href":"./Template:EmptyTRTest"},"params":{},"i":0}}]}'>
22489 <tbody>
22490 <tr>
22491 <td>foo</td>
22492 </tr>
22493 <tr>
22494 <td>bar</td>
22495 </tr>
22496 </tbody>
22497 </table>
22498 !!end
22500 !!test
22501 Empty LI and TR nodes should not be stripped from top-level content
22502 !!wikitext
22503 * a
22505 * b
22509 |foo
22511 !!html/parsoid
22512 <ul>
22513 <li> a</li>
22514 <li></li>
22515 <li> b</li>
22516 </ul>
22517 <table>
22518 <tbody>
22519 <tr></tr>
22520 <tr>
22521 <td>foo</td>
22522 </tr>
22523 </tbody>
22524 </table>
22525 !!end
22527 !!test
22528 Empty TR nodes should not be stripped if they have any attributes set
22529 !!wikitext
22530 {{EmptyTRWithHTMLAttrTest}}
22531 !!html/parsoid
22532 <table about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyTRWithHTMLAttrTest","href":"./Template:EmptyTRWithHTMLAttrTest"},"params":{},"i":0}}]}'>
22533 <tr align="center"></tr>
22534 <tr><td>foo</td></tr>
22535 <tr align="center"></tr>
22536 <tr><td>bar</td></tr>
22537 </table>
22538 !!end
22540 #### ----------------------------------------------------------------
22541 #### The following section of tests are primarily to test
22542 #### wikitext escaping capabilities of Parsoid.  Given that
22543 #### escaping can be done any number of ways, the wikitext (input)
22544 #### is always adjusted to reflect how Parsoid adds nowiki
22545 #### escape tags.
22546 ####
22547 #### We are marking several tests as parsoid-only since the
22548 #### HTML in the result section is different from what the
22549 #### PHP parser generates for it.
22550 #### ----------------------------------------------------------------
22553 #### --------------- Headings ---------------
22554 #### 0. Unnested
22555 #### 1. Nested inside html <h1>=foo=</h1>
22556 #### 2. Outside heading nest on a single line <h1>foo</h1>*bar
22557 #### 3. Nested inside html with wikitext split by html tags
22558 #### 4. No escape needed
22559 #### 5. Empty headings <h1></h1>
22560 #### 6. Heading chars in SOL context
22561 #### ----------------------------------------
22562 !! test
22563 Headings: 0. Unnested
22564 !! options
22565 parsoid=html2wt
22566 !! html/parsoid
22567 <p>=foo=</p>
22569 <p> =foo=
22570 <!--cmt-->
22571 =foo=</p>
22573 <p>=foo<i>a</i>=</p>
22574 !! wikitext
22575 <nowiki>=foo=</nowiki>
22577 <nowiki> </nowiki>=foo=
22578 <!--cmt-->
22579 <nowiki>=foo=</nowiki>
22581 =foo''a''<nowiki>=</nowiki>
22582 !!end
22584 # New headings and existing headings are handled differently
22585 !! test
22586 Headings: 1. Nested inside html
22587 !! options
22588 parsoid=html2wt
22589 !! html/parsoid
22590 <h1>=foo=</h1>
22591 <h2>=foo=</h2>
22592 <h3>=foo=</h3>
22594 <h1 data-parsoid=''>=foo=</h1>
22595 <h2 data-parsoid=''>=foo=</h2>
22596 <h3 data-parsoid=''>=foo=</h3>
22597 <h4 data-parsoid=''>=foo=</h4>
22598 <h5 data-parsoid=''>=foo=</h5>
22599 <h6 data-parsoid=''>=foo=</h6>
22600 !! wikitext
22601 = =foo= =
22603 == =foo= ==
22605 === =foo= ===
22607 =<nowiki>=foo=</nowiki>=
22608 ==<nowiki>=foo=</nowiki>==
22609 ===<nowiki>=foo=</nowiki>===
22610 ====<nowiki>=foo=</nowiki>====
22611 =====<nowiki>=foo=</nowiki>=====
22612 ======<nowiki>=foo=</nowiki>======
22614 !!end
22616 !! test
22617 Headings: 2. Outside heading nest on a single line <h1>foo</h1>*bar
22618 !! options
22619 parsoid=html2wt
22620 !! html/parsoid
22621 <h1>foo</h1>*bar
22622 <h1>foo</h1>=bar
22623 <h1>foo</h1>=bar=
22624 !! wikitext
22625 = foo =
22626 <nowiki>*</nowiki>bar
22628 = foo =
22629 =bar
22631 = foo =
22632 <nowiki>=bar=</nowiki>
22633 !!end
22635 !! test
22636 Headings: 3. Nested inside html with wikitext split by html tags
22637 !! options
22638 parsoid=html2wt
22639 !! html/parsoid
22640 <h1>=<b>bold</b>foo=</h1>
22641 !! wikitext
22642 = ='''bold'''foo= =
22643 !!end
22645 !! test
22646 Headings: 4a. No escaping needed (testing just h1 and h2)
22647 !! options
22648 parsoid=html2wt
22649 !! html/parsoid
22650 <h1>=foo</h1>
22651 <h1>foo=</h1>
22652 <h1> =foo= </h1>
22653 <h1>=foo= bar</h1>
22654 <h2>=foo</h2>
22655 <h2>foo=</h2>
22656 <h1>=</h1>
22657 <h1><i>=</i>foo=</h1>
22658 !! wikitext
22659 = =foo =
22661 = foo= =
22663 = =foo= =
22665 = =foo= bar =
22667 == =foo ==
22669 == foo= ==
22671 = = =
22673 = ''=''foo= =
22674 !!end
22676 !! test
22677 Headings: 4b. No escaping needed (inside p-tags)
22678 !! options
22679 parsoid=html2wt
22680 !! html/parsoid
22681 <p>===
22682 =foo= x
22683 =foo= <s></s>
22684 </p>
22685 !! wikitext
22687 =foo= x
22688 =foo= <s></s>
22689 !!end
22691 !! test
22692 Headings: 5. Empty headings
22693 !! options
22694 parsoid=html2wt
22695 !! html/parsoid
22696 <h1 data-parsoid='{}'></h1>
22698 <h2 data-parsoid='{}'></h2>
22700 <h3 data-parsoid='{}'></h3>
22702 <h4 data-parsoid='{}'></h4>
22704 <h5 data-parsoid='{}'></h5>
22706 <h6 data-parsoid='{}'></h6>
22707 !! wikitext
22708 =<nowiki/>=
22710 ==<nowiki/>==
22712 ===<nowiki/>===
22714 ====<nowiki/>====
22716 =====<nowiki/>=====
22718 ======<nowiki/>======
22719 !!end
22721 !! test
22722 Headings: 6a. Heading chars in SOL context (with trailing spaces)
22723 !! options
22724 parsoid=html2wt
22725 !! html/parsoid
22726 <p>=a=</p>
22728 <p>=a=</p> 
22730 <p>=a=</p>      
22731 !! wikitext
22732 <nowiki>=a=</nowiki>
22734 <nowiki>=a=</nowiki> 
22736 <nowiki>=a=</nowiki>    
22737 !!end
22739 !! test
22740 Headings: 6b. Heading chars in SOL context (with trailing newlines)
22741 !! options
22742 parsoid=html2wt
22743 !! html/parsoid
22744 <p>=a=
22745 b</p>
22747 <p>=a= 
22748 b</p>
22750 <p>=a=  
22751 b</p>
22752 !! wikitext
22753 <nowiki>=a=</nowiki>
22756 <nowiki>=a=</nowiki> 
22759 <nowiki>=a=</nowiki>    
22761 !!end
22763 !! test
22764 Headings: 6c. Heading chars in SOL context (leading newline break)
22765 !! options
22766 parsoid=html2wt
22767 !! html/parsoid
22768 <p>a
22769 =b=</p>
22770 !! wikitext
22772 <nowiki>=b=</nowiki>
22773 !!end
22775 !! test
22776 Headings: 6d. Heading chars in SOL context (with interspersed comments)
22777 !! options
22778 parsoid=html2wt
22779 !! html/parsoid
22780 <!--c0--><p>=a=</p>
22782 <!--c1--><p>=a=</p> <!--c2-->    <!--c3-->
22783 !! wikitext
22784 <!--c0--><nowiki>=a=</nowiki>
22786 <!--c1--><nowiki>=a=</nowiki> <!--c2-->  <!--c3-->
22787 !!end
22789 !! test
22790 Headings: 6d. Heading chars in SOL context (No escaping needed)
22791 !! options
22792 parsoid=html2wt
22793 !! html/parsoid
22794 =a=<div>b</div>
22795 !! wikitext
22796 =a=<div>b</div>
22797 !!end
22799 !! test
22800 Headings: 7. Insert a newline between new content and headings
22801 !! options
22802 parsoid=html2wt
22803 !! html/parsoid
22804 <h2>NEW</h2>
22805 <p>new</p>
22806 <h2 data-parsoid='{}'>A</h2>
22807 <p data-parsoid='{}'>a</p>
22808 !! wikitext
22809 == NEW ==
22812 ==A==
22815 !! end
22817 #### --------------- Lists ---------------
22818 #### 0. Outside nests (*foo, etc.)
22819 #### 1. Nested inside html <ul><li>*foo</li></ul>
22820 #### 2. Inside definition lists
22821 #### 3. Only bullets at start should be escaped
22822 #### 4. No escapes needed
22823 #### 5. No unnecessary escapes
22824 #### 6. Escape bullets in SOL position
22825 #### 7. Escape bullets in a multi-line context
22826 #### ----------------------------------------
22828 !! test
22829 Lists: 0. Outside nests
22830 !! options
22831 parsoid=html2wt
22832 !! html/parsoid
22833 <p>*foo</p>
22835 <p>#foo</p>
22837 <p>;Foo:bar</p>
22838 !! wikitext
22839 <nowiki>*</nowiki>foo
22841 <nowiki>#</nowiki>foo
22843 <nowiki>;</nowiki>Foo<nowiki>:</nowiki>bar
22844 !!end
22846 ## Making these next 3 tests Parsoid-only since they are html2wt tests
22847 ## to test wikitext escaping, and insignificant whitespace diffs
22848 ## cause PHP parser tests to barf
22849 !! test
22850 Lists: 1. Nested inside html (No unnecessary escapes)
22851 !! options
22852 parsoid=html2wt
22853 !! html/parsoid
22854 <ul>
22855 <li>*foo</li>
22856 <li>#foo</li>
22857 <li>:foo</li>
22858 <li>;foo</li>
22859 <li data-parsoid='{}'>*foo</li>
22860 <li data-parsoid='{}'>#foo</li>
22861 <li data-parsoid='{}'>:foo</li>
22862 <li data-parsoid='{}'>;foo</li>
22863 </ul>
22865 <ol>
22866 <li>*foo</li>
22867 <li>#foo</li>
22868 <li>:foo</li>
22869 <li>;foo</li>
22870 <li data-parsoid='{}'>*foo</li>
22871 <li data-parsoid='{}'>#foo</li>
22872 <li data-parsoid='{}'>:foo</li>
22873 <li data-parsoid='{}'>;foo</li>
22874 </ol>
22875 !! wikitext
22876 * *foo
22877 * #foo
22878 * :foo
22879 * ;foo
22880 *<nowiki>*foo</nowiki>
22881 *<nowiki>#foo</nowiki>
22882 *<nowiki>:foo</nowiki>
22883 *<nowiki>;foo</nowiki>
22885 # *foo
22886 # #foo
22887 # :foo
22888 # ;foo
22889 #<nowiki>*foo</nowiki>
22890 #<nowiki>#foo</nowiki>
22891 #<nowiki>:foo</nowiki>
22892 #<nowiki>;foo</nowiki>
22893 !!end
22895 !! test
22896 Lists: 2. Inside definition lists
22897 !! options
22898 parsoid=html2wt
22899 !! html/parsoid
22900 <dl><dt>;foo</dt></dl>
22901 <dl><dt>:foo</dt></dl>
22902 <dl><dt>:foo</dt>
22903 <dd>bar</dd></dl>
22904 <dl><dd>:foo</dd></dl>
22905 !! wikitext
22906 ; ;foo
22908 ; <nowiki>:foo</nowiki>
22910 ; <nowiki>:foo</nowiki>
22911 : bar
22913 : :foo
22914 !!end
22916 !! test
22917 Lists: 3. Only bullets at start of text in wikitext-generated HTML should be escaped
22918 !! options
22919 parsoid=html2wt
22920 !! html/parsoid
22921 <ul>
22922 <li>*foo*bar</li>
22923 <li data-parsoid='{}'>*foo<i>it</i>*bar</li>
22924 </ul>
22925 !! wikitext
22926 * *foo*bar
22927 *<nowiki>*foo</nowiki>''it''*bar
22928 !!end
22930 !! test
22931 Lists: 4. No escapes needed
22932 !! options
22933 parsoid=html2wt
22934 !! html/parsoid
22935 <ul>
22936 <li>foo*bar
22937 </li>
22938 </ul>
22939 <ul>
22940 <li><i>foo</i>*bar
22941 </li>
22942 </ul>
22943 <ul>
22944 <li><a rel="mw:WikiLink" href="Foo" title="Foo">Foo</a>: bar
22945 </li>
22946 </ul>
22947 <ul>
22948 <li><a rel="mw:WikiLink" href="Foo" title="Foo">Foo</a>*bar
22949 </li>
22950 </ul>
22951 !! wikitext
22952 *foo*bar
22954 *''foo''*bar
22956 *[[Foo]]: bar
22958 *[[Foo]]*bar
22959 !!end
22961 !! test
22962 Lists: 5. No unnecessary escapes
22963 !! options
22964 parsoid=html2wt
22965 !! html/parsoid
22966 <ul><li> bar <span>[[foo]]</span></li></ul>
22967 <ul><li> =bar <span>[[foo]]</span></li></ul>
22968 <ul><li> [[bar <span>[[foo]]</span></li></ul>
22969 <ul><li> ]]bar <span>[[foo]]</span></li></ul>
22970 <ul><li> =bar <span>foo]]</span>=</li></ul>
22971 <ul><li> <s></s>: a</li></ul>
22972 <ul><li> <i>* foo</i></li></ul>
22974 !! wikitext
22975 * bar <span><nowiki>[[foo]]</nowiki></span>
22977 * =bar <span><nowiki>[[foo]]</nowiki></span>
22979 * [[bar <span><nowiki>[[foo]]</nowiki></span>
22981 * ]]bar <span><nowiki>[[foo]]</nowiki></span>
22983 * =bar <span>foo]]</span>=
22985 * <s></s>: a
22987 * ''* foo''
22988 !!end
22990 !! test
22991 Lists: 6. Escape bullets in SOL position
22992 !! options
22993 parsoid=html2wt
22994 !! html/parsoid
22995 <p><!--cmt-->*foo</p>
22996 !! wikitext
22997 <!--cmt--><nowiki>*</nowiki>foo
22998 !!end
23000 !! test
23001 Lists: 7. Escape bullets in a multi-line context
23002 !! options
23003 parsoid=html2wt
23004 !! html/parsoid
23005 <p>a
23007 </p>
23008 !! wikitext
23010 <nowiki>*</nowiki>b
23011 !!end
23013 !! test
23014 Lists: 8. Escape colons only if not present in tags
23015 !! options
23016 parsoid=html2wt
23017 !! html/parsoid
23018 <dl><dt>a:b<i>c:d</i></dt></dl>
23019 !! wikitext
23020 ; <nowiki>a:b</nowiki>''c:d''
23021 !! end
23023 #### --------------- HRs ---------------
23024 #### 1. Single line
23025 #### -----------------------------------
23027 !! test
23028 HRs: 1. Single line
23029 !! options
23030 parsoid=html2wt
23031 !! html/parsoid
23032 <hr />----
23033 <hr />=foo=
23034 <hr />*foo
23035 !! wikitext
23036 ----<nowiki>----</nowiki>
23037 ----=foo=
23038 ----*foo
23039 !! end
23041 #### --------------- Tables ---------------
23042 #### 1a. Simple example
23043 #### 1b. No escaping needed (!foo)
23044 #### 1c. No escaping needed (|foo)
23045 #### 1d. No escaping needed (|}foo)
23046 ####
23047 #### 2a. Nested in td (<td>foo|bar</td>)
23048 #### 2b. Nested in td (<td>foo||bar</td>)
23049 #### 2c. Nested in td -- no escaping needed(<td>foo!!bar</td>)
23050 ####
23051 #### 3a. Nested in th (<th>foo!bar</th>)
23052 #### 3b. Nested in th (<th>foo!!bar</th>)
23053 #### 3c. Nested in th -- no escaping needed(<th>foo||bar</th>)
23054 ####
23055 #### 4a. Escape -
23056 #### 4b. Escape +
23057 #### 4c. No escaping needed
23058 #### --------------------------------------
23060 !! test
23061 Tables: 1a. Simple example
23062 !! options
23063 parsoid=html2wt
23064 !! html/parsoid
23065 <p>{|
23067 </p>
23068 !! wikitext
23069 <nowiki>{|</nowiki>
23071 !! end
23073 !! test
23074 Tables: 1b. No escaping needed
23075 !! options
23076 parsoid=html2wt
23077 !! html/parsoid
23078 <p>!foo
23079 </p>
23080 !! wikitext
23081 !foo
23082 !! end
23084 !! test
23085 Tables: 1c. No escaping needed
23086 !! options
23087 parsoid=html2wt
23088 !! html/parsoid
23089 <p>|foo
23090 </p>
23091 !! wikitext
23092 |foo
23093 !! end
23095 !! test
23096 Tables: 1d. No escaping needed
23097 !! options
23098 parsoid=html2wt
23099 !! html/parsoid
23100 <p>|}foo
23101 </p>
23102 !! wikitext
23103 |}foo
23104 !! end
23106 !! test
23107 Tables: 2a. Nested in td
23108 !! options
23109 parsoid=html2wt
23110 !! html/parsoid
23111 <table><tbody><tr>
23112 <td>foo|bar</td></tr>
23113 <tr><td>x<div>a|b</div></td>
23114 </tbody></table>
23115 !! wikitext
23117 |<nowiki>foo|bar</nowiki>
23119 |x<div><nowiki>a|b</nowiki></div>
23121 !! html/php+tidy
23122 <table>
23123 <tr>
23124 <td>foo|bar</td>
23125 </tr>
23126 <tr>
23127 <td>x
23128 <div>a|b</div>
23129 </td>
23130 </tr>
23131 </table>
23132 !! end
23134 !! test
23135 Tables: 2b. Nested in td
23136 !! options
23137 parsoid=html2wt
23138 !! html/parsoid
23139 <table><tbody><tr>
23140 <td>foo||bar</td>
23141 <td>a<i>b||c</i></td>
23142 <td>a<i><div>b||c</div></i></td>
23143 </tr></tbody></table>
23144 !! wikitext
23146 |<nowiki>foo||bar</nowiki>
23147 |a''<nowiki>b||c</nowiki>''
23148 |a''<div><nowiki>b||c</nowiki></div>''
23150 !! html/php
23151 <table>
23152 <tr>
23153 <td>foo||bar
23154 </td>
23155 <td>a<i>b||c</i>
23156 </td>
23157 <td>a<i><div>b||c</div></i>
23158 </td></tr></table>
23160 !! end
23162 !! test
23163 Tables: 2c. Nested in td -- no escaping needed
23164 !! options
23165 parsoid=html2wt
23166 !! html/*
23167 <table>
23169 <tr>
23170 <td>foo!!bar
23171 </td></tr></table>
23173 !! wikitext
23176 |foo!!bar
23178 !! end
23180 !! test
23181 Tables: 3a. Nested in th
23182 !! options
23183 parsoid=html2wt
23184 !! html/*
23185 <table>
23187 <tr>
23188 <th>foo!bar
23189 </th></tr></table>
23191 !! wikitext
23194 !foo!bar
23196 !! end
23198 !! test
23199 Tables: 3b. Nested in th
23200 !! options
23201 parsoid=html2wt
23202 !! html/parsoid
23203 <table><tbody>
23204 <tr><th>foo!!bar</th>
23205 <th><i>foo|bar</i></th>
23206 <th><i>foo!!bar</i></th>
23207 <th><i><span>foo!!bar</span></i></th>
23208 </tr></tbody></table>
23209 !! wikitext
23211 !<nowiki>foo!!bar</nowiki>
23212 !''<nowiki>foo|bar</nowiki>''
23213 !''<nowiki>foo!!bar</nowiki>''
23214 !''<span><nowiki>foo!!bar</nowiki></span>''
23216 !! html/php
23217 <table>
23218 <tr>
23219 <th>foo!!bar
23220 </th>
23221 <th><i>foo|bar</i>
23222 </th>
23223 <th><i>foo!!bar</i>
23224 </th>
23225 <th><i><span>foo!!bar</span></i>
23226 </th></tr></table>
23228 !! end
23230 !! test
23231 Tables: 3c. Nested in th
23232 !! options
23233 parsoid=html2wt
23234 !! html/parsoid
23235 <table><tbody>
23236 <tr><th>foo||bar</th>
23237 <th><span typeof="mw:Nowiki">foo||bar</span></th>
23238 </tr></tbody></table>
23239 !! wikitext
23241 !<nowiki>foo||bar</nowiki>
23242 !<nowiki>foo||bar</nowiki>
23244 !! html/php
23245 <table>
23246 <tr>
23247 <th>foo||bar
23248 </th>
23249 <th>foo||bar
23250 </th></tr></table>
23252 !! end
23254 !! test
23255 Tables: 4a. Escape -
23256 !! options
23257 parsoid=html2wt
23258 !! html/*
23259 <table>
23261 <tr>
23262 <th>-bar
23263 </th></tr>
23264 <tr>
23265 <td>-bar
23266 </td></tr></table>
23268 !! wikitext
23271 !-bar
23274 |<nowiki>-bar</nowiki>
23276 !! end
23278 !! test
23279 Tables: 4b. Escape +
23280 !! options
23281 parsoid=html2wt
23282 !! html/*
23283 <table>
23285 <tr>
23286 <th>+bar
23287 </th></tr>
23288 <tr>
23289 <td>+bar
23290 </td></tr></table>
23292 !! wikitext
23295 !+bar
23298 |<nowiki>+bar</nowiki>
23300 !! end
23302 !! test
23303 Tables: 4c. No escaping needed
23304 !! options
23305 parsoid=html2wt
23306 !! html/parsoid
23307 <table><tbody>
23308 <tr><td>foo-bar</td><td>foo+bar</td></tr>
23309 <tr><td><i>foo</i>-bar</td><td><i>foo</i>+bar</td></tr>
23310 <tr><td>foo
23311 <p>bar|baz
23312 +bar
23313 -bar</p></td></tr>
23314 <tr><td>x
23315 <div>a|b</div></td>
23316 </tbody></table>
23317 !! wikitext
23319 |foo-bar
23320 |foo+bar
23322 |''foo''-bar
23323 |''foo''+bar
23325 |foo
23326 bar|baz
23327 +bar
23328 -bar
23331 <div>a|b</div>
23333 !! html/php
23334 <table>
23335 <tr>
23336 <td>foo-bar
23337 </td>
23338 <td>foo+bar
23339 </td></tr>
23340 <tr>
23341 <td><i>foo</i>-bar
23342 </td>
23343 <td><i>foo</i>+bar
23344 </td></tr>
23345 <tr>
23346 <td>foo
23347 <p>bar|baz
23348 +bar
23349 -bar
23350 </p>
23351 </td></tr>
23352 <tr>
23353 <td>x
23354 <div>a|b</div>
23355 </td></tr></table>
23357 !! end
23359 !! test
23360 Tables: 4d. No escaping needed
23361 !! options
23362 parsoid=html2wt
23363 !! html/parsoid
23364 <table>
23365 <tbody><tr><td><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo</a>-bar</td>
23366 <td data-parsoid='{"startTagSrc":"|","attrSepSrc":"|"}'>+1</td>
23367 <td data-parsoid='{"startTagSrc":"|","attrSepSrc":"|"}'>-2</td></tr>
23368 </tbody></table>
23369 !! wikitext
23371 |[[Foo]]-bar
23372 ||+1
23373 ||-2
23375 !! html/php
23376 <table>
23377 <tr>
23378 <td><a href="/wiki/Foo" title="Foo">Foo</a>-bar
23379 </td>
23380 <td>+1
23381 </td>
23382 <td>-2
23383 </td></tr></table>
23385 !! end
23387 !! test
23388 T97430: Don't emit empty nowiki pairs around marker meta tags
23389 !! options
23390 parsoid=html2wt
23391 !! html/parsoid
23392 <p>*This is a long sentence here that will make the nowiki algo split up the nowikis into multiple pairs
23393 |** Make this another long long long sentence forcing the nowiki algo to split up the nowikis.</p>
23394 !! wikitext
23395 <nowiki>*</nowiki>This is a long sentence here that will make the nowiki algo split up the nowikis into multiple pairs
23396 |** Make this another long long long sentence forcing the nowiki algo to split up the nowikis.
23397 !! end
23399 !! test
23400 Unclosed xmlish element in table line shouldn't eat end delimiters
23401 !! options
23402 parsoid=html2wt
23403 !! html/parsoid
23404 <table>
23405 <tbody><tr><td> &lt;foo</td>
23406 <td> bar></td></tr>
23407 </tbody></table>
23408 !! wikitext
23410 | <foo
23411 | bar>
23413 !! html/php
23414 <table>
23415 <tr>
23416 <td> &lt;foo
23417 </td>
23418 <td> bar&gt;
23419 </td></tr></table>
23421 !! end
23423 #### --------------- Links ----------------
23424 #### 1. Quote marks in link text
23425 #### 2. Wikilinks: Escapes needed
23426 #### 3. Wikilinks: No escapes needed
23427 #### 4. Extlinks: Escapes needed
23428 #### 5. Extlinks: No escapes needed
23429 #### --------------------------------------
23430 !! test
23431 Links 1. WikiLinks: No escapes needed
23432 !! options
23433 parsoid=html2wt
23434 !! html/parsoid
23435 <p><a rel="mw:WikiLink" href="Foo" title="Foo">Foo<i>boo</i></a>
23436 <a rel="mw:WikiLink" href="Foo" title="Foo">[Foobar]</a>
23437 <a rel="mw:WikiLink" href="Foo" title="Foo">x [Foobar] x</a></p>
23438 !! wikitext
23439 [[Foo|Foo''boo'']]
23440 [[Foo|[Foobar]]]
23441 [[Foo|x [Foobar] x]]
23442 !! html/php
23443 <p><a href="/wiki/Foo" title="Foo">Foo<i>boo</i></a>
23444 <a href="/wiki/Foo" title="Foo">[Foobar]</a>
23445 <a href="/wiki/Foo" title="Foo">x [Foobar] x</a>
23446 </p>
23447 !! end
23449 !! test
23450 Links 2. WikiLinks: Escapes needed
23451 !! options
23452 parsoid=html2wt
23453 !! html/parsoid
23454 <a href="Foo" rel="mw:WikiLink">Foobar]</a>
23455 <a href="Foo" rel="mw:WikiLink">x [http://google.com g] x</a>
23456 <a href="Foo" rel="mw:WikiLink">[[Bar]]</a>
23457 <a href="Foo" rel="mw:WikiLink">x [[Bar]] x</a>
23458 <a href="Foo" rel="mw:WikiLink">|Bar</a>
23459 <a href="Foo" rel="mw:WikiLink">]]bar</a>
23460 <a href="Foo" rel="mw:WikiLink">[[bar</a>
23461 <a href="Foo" rel="mw:WikiLink">x [[ y</a>
23462 <a href="Foo" rel="mw:WikiLink">x ]] y</a>
23463 <a href="Foo" rel="mw:WikiLink">x ]] y [[ z</a>
23464 !! wikitext
23465 [[Foo|<nowiki>Foobar]</nowiki>]]
23466 [[Foo|x <nowiki>[http://google.com g]</nowiki> x]]
23467 [[Foo|<nowiki>[[Bar]]</nowiki>]]
23468 [[Foo|<nowiki>x [[Bar]] x</nowiki>]]
23469 [[Foo|<nowiki>|Bar</nowiki>]]
23470 [[Foo|<nowiki>]]bar</nowiki>]]
23471 [[Foo|<nowiki>[[bar</nowiki>]]
23472 [[Foo|<nowiki>x [[ y</nowiki>]]
23473 [[Foo|<nowiki>x ]] y</nowiki>]]
23474 [[Foo|<nowiki>x ]] y [[ z</nowiki>]]
23475 !! html/php
23476 <p><a href="/wiki/Foo" title="Foo">Foobar]</a>
23477 <a href="/wiki/Foo" title="Foo">x [http://google.com g] x</a>
23478 <a href="/wiki/Foo" title="Foo">[[Bar]]</a>
23479 <a href="/wiki/Foo" title="Foo">x [[Bar]] x</a>
23480 <a href="/wiki/Foo" title="Foo">|Bar</a>
23481 <a href="/wiki/Foo" title="Foo">]]bar</a>
23482 <a href="/wiki/Foo" title="Foo">[[bar</a>
23483 <a href="/wiki/Foo" title="Foo">x [[ y</a>
23484 <a href="/wiki/Foo" title="Foo">x ]] y</a>
23485 <a href="/wiki/Foo" title="Foo">x ]] y [[ z</a>
23486 </p>
23487 !! end
23489 !! test
23490 Links 3. WikiLinks: No escapes needed
23491 !! options
23492 parsoid=html2wt
23493 !! html/parsoid
23494 <p><a rel="mw:WikiLink" href="Foo">[Foobar</a>
23495 <a rel="mw:WikiLink" href="Foo" title="Foo">foo|bar</a></p>
23496 !! wikitext
23497 [[Foo|[Foobar]]
23498 [[Foo|foo|bar]]
23499 !! html/php
23500 <p><a href="/wiki/Foo" title="Foo">[Foobar</a>
23501 <a href="/wiki/Foo" title="Foo">foo|bar</a>
23502 </p>
23503 !! end
23505 !! test
23506 Links 4. ExtLinks: Escapes needed
23507 !! options
23508 parsoid=html2wt
23509 !! html/parsoid
23510 <p><a rel="mw:ExtLink" href="http://google.com">[google]</a>
23511 <a rel="mw:ExtLink" href="http://google.com">google]</a></p>
23512 <p>[http://google.com]</p>
23513 <p>[http://google.com google]</p>
23514 <p>[<a rel="mw:ExtLink" href="http://google.com">http://google.com</a>]</p>
23515 <p>[<a rel="mw:ExtLink" href="http://google.com" about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"http://google.com"}},"i":0}}]}'>http://google.com</a>]</p>
23516 !! wikitext
23517 [http://google.com <nowiki>[google]</nowiki>]
23518 [http://google.com <nowiki>google]</nowiki>]
23520 <nowiki>[http://google.com]</nowiki>
23522 <nowiki>[http://google.com google]</nowiki>
23524 [http://google.com<nowiki>]</nowiki>
23526 [{{echo|http://google.com}}<nowiki>]</nowiki>
23527 !! html/php
23528 <p><a rel="nofollow" class="external text" href="http://google.com">[google]</a>
23529 <a rel="nofollow" class="external text" href="http://google.com">google]</a>
23530 </p><p>[http://google.com]
23531 </p><p>[http://google.com google]
23532 </p><p>[<a rel="nofollow" class="external free" href="http://google.com">http://google.com</a>]
23533 </p><p>[<a rel="nofollow" class="external free" href="http://google.com">http://google.com</a>]
23534 </p>
23535 !! end
23537 !! test
23538 Links 5. ExtLinks: No escapes needed
23539 !! options
23540 parsoid=html2wt
23541 !! html/parsoid
23542 <p><a rel="mw:ExtLink" href="http://google.com">[google</a></p>
23543 <p>[<a ref="mw:ExtLink" href="http://google.com"></a>]</p>
23544 !! wikitext
23545 [http://google.com [google]
23547 [[http://google.com]]
23548 !! html/php
23549 <p><a rel="nofollow" class="external text" href="http://google.com">[google</a>
23550 </p><p>[<a rel="nofollow" class="external autonumber" href="http://google.com">[1]</a>]
23551 </p>
23552 !! end
23554 !! test
23555 Links 6. Add <nowiki/>s between text-nodes and url-links when required (bug 64300)
23556 !! options
23557 parsoid=html2wt
23558 !! html/parsoid
23559 <p>x<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>y
23560 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>?x
23561 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>&amp;x
23562 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>'x
23563 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>,x
23564 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>.x
23565 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>;x
23566 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>:x
23567 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>;x
23568 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>!x
23569 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>=x
23570 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>(x)
23571 <a rel="mw:ExtLink" href="http://example.com(x" data-parsoid='{"stx":"url"}'>http://example.com(x</a>)
23572 </p>
23573 !! wikitext
23574 x<nowiki/>http://example.com<nowiki/>y
23575 http://example.com<nowiki/>?x
23576 http://example.com<nowiki/>&x
23577 http://example.com<nowiki/>'x
23578 http://example.com<nowiki/>,x
23579 http://example.com<nowiki/>.x
23580 http://example.com<nowiki/>;x
23581 http://example.com<nowiki/>:x
23582 http://example.com<nowiki/>;x
23583 http://example.com<nowiki/>!x
23584 http://example.com<nowiki/>=x
23585 http://example.com<nowiki/>(x)
23586 http://example.com(x<nowiki/>)
23587 !! end
23589 !! test
23590 Links 7a. Don't add spurious <nowiki/>s between text-nodes and url-links (bug 64300)
23591 !! options
23592 parsoid=html2wt
23593 !! html/parsoid
23594 <p>x
23595 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>
23597 "<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>"
23598 (<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>)
23599 (<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>) foo
23600 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>,
23601 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>, foo
23602 </p>
23603 !! wikitext
23605 http://example.com
23607 "http://example.com"
23608 (http://example.com)
23609 (http://example.com) foo
23610 http://example.com,
23611 http://example.com, foo
23612 !! html/php
23613 <p>x
23614 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
23616 "<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>"
23617 (<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
23618 (<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>) foo
23619 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>,
23620 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>, foo
23621 </p>
23622 !! end
23624 !! test
23625 Links 7b. Don't add spurious <nowiki/>s between text-nodes and url-links (bug 64300)
23626 !! options
23627 parsoid=html2wt
23628 !! html/parsoid
23629 <p><a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>.,;:!?\
23630 -<a rel="mw:ExtLink" href="http://example.com">http://example.com</a>:</p>
23631 !! wikitext
23632 http://example.com.,;:!?\
23633 -http://example.com:
23634 !! html/php
23635 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>.,;:!?\
23636 -<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>:
23637 </p>
23638 !! end
23640 !! test
23641 Links 8. Add <nowiki/>s between text-nodes and RFC-links when required (bug 64300)
23642 !! options
23643 parsoid=html2wt
23644 !! html/parsoid
23645 <p><a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>4
23646 <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>y
23647 X<a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>y</p>
23648 !! wikitext
23649 RFC 123<nowiki/>4
23650 RFC 123<nowiki/>y
23651 X<nowiki/>RFC 123<nowiki/>y
23652 !! end
23654 !! test
23655 Links 9. Don't add spurious <nowiki/>s between text-nodes and RFC-links (bug 64300)
23656 !! options
23657 parsoid=html2wt
23658 !! html/parsoid
23659 <p><a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>?foo
23660 <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>&amp;foo
23661 -<a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>-
23662 </p>
23663 !! wikitext
23664 RFC 123?foo
23665 RFC 123&foo
23666 -RFC 123-
23667 !! html/php
23668 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc123">RFC 123</a>?foo
23669 <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc123">RFC 123</a>&amp;foo
23670 -<a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc123">RFC 123</a>-
23671 </p>
23672 !! end
23674 !! test
23675 Links 10. Add <nowiki/>s between text-nodes and PMID-links when required (bug 64300)
23676 !! options
23677 parsoid=html2wt
23678 !! html/parsoid
23679 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>4
23680 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>y
23681 X<a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>y
23682 !! wikitext
23683 PMID 123<nowiki/>4
23684 PMID 123<nowiki/>y
23685 X<nowiki/>PMID 123<nowiki/>y
23686 !! end
23688 !! test
23689 Links 11. Don't add spurious <nowiki/>s between text-nodes and PMID-links (bug 64300)
23690 !! options
23691 parsoid=html2wt
23692 !! html/parsoid
23693 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>?foo
23694 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>&foo
23695 -<a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>-
23696 </p>
23697 !! wikitext
23698 PMID 123?foo
23699 PMID 123&foo
23700 -PMID 123-
23701 !! html/php
23702 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>?foo
23703 <a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>&amp;foo
23704 -<a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>-
23705 </p>
23706 !! end
23708 !! test
23709 Links 12. Add <nowiki/>s between text-nodes and ISBN-links when required (bug 64300)
23710 !! options
23711 parsoid=html2wt
23712 !! html/parsoid
23713 <p><a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>1
23714 <a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>x
23715 a<a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>b
23716 </p>
23717 !! wikitext
23718 ISBN 1234567890<nowiki/>1
23719 ISBN 1234567890<nowiki/>x
23720 a<nowiki/>ISBN 1234567890<nowiki/>b
23721 !! end
23723 !! test
23724 Links 13. Don't add spurious <nowiki/>s between text-nodes and ISBN-links (bug 64300)
23725 !! options
23726 parsoid=html2wt
23727 !! html/parsoid
23728 <p>-<a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>'s
23729 !! wikitext
23730 -ISBN 1234567890's
23731 !! html/php
23732 <p>-<a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>'s
23733 </p>
23734 !! end
23736 !! test
23737 Links 14. Protect link-like plain text. (Parsoid bug T78425)
23738 !! options
23739 parsoid=html2wt
23740 !! html/*
23741 <p>this is not a link: http://example.com
23742 </p>
23743 !! wikitext
23744 this is not a link: <nowiki>http://example.com</nowiki>
23745 !! end
23747 !! test
23748 Links 15. Link trails can't become link prefixes.
23749 !! options
23750 language=is
23751 parsoid=html2wt
23752 !! html/parsoid
23753 <p><a rel="mw:WikiLink" href="Söfnuður" title="Söfnuður" data-parsoid='{"stx":"simple","tail":"-"}'>Söfnuður-</a><a rel="mw:WikiLink" href="00" title="00">00</a></p>
23754 !! wikitext
23755 [[Söfnuður]]-[[00]]
23756 !! html/php
23757 <p><a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">Söfnuður-</a><a href="/wiki/00" title="00">00</a>
23758 </p>
23759 !! end
23761 #### --------------- Quotes ---------------
23762 #### 1. Quotes inside <b> and <i>
23763 #### 2. Link fragments separated by <i> and <b> tags
23764 #### 3. Link fragments inside <i> and <b>
23765 #### 4. No escaping needed
23766 #### --------------------------------------
23767 !! test
23768 1a. Quotes inside <b> and <i>
23769 !! options
23770 parsoid=html2wt
23771 !! html/*
23772 <p><i>'foo'</i>
23773 <i>''foo''</i>
23774 <i>'''foo'''</i>
23775 <i>foo</i>'s
23776 <b>'foo'</b>
23777 <b>''foo''</b>
23778 <b>'''foo'''</b>
23779 <b>foo'<i>bar'</i>baz</b>
23780 <b>foo</b>'s
23781 '<i>foo</i>
23782 <i>foo</i>'
23783 <i>foo'</i>'
23784 '<i>foo</i>'
23785 '<b>foo</b>
23786 <b>foo</b>'
23787 '<b>foo</b>'
23788 <i>fools'<span> errand</span></i>
23789 <i><span>fool</span>'s errand</i>
23790 '<i>foo</i> bar '<i>baz</i>
23791 a|!*#-:;+-~[]{}b'<i>x</i>
23792 </p>
23793 !! wikitext
23794 ''<nowiki/>'foo'''
23795 ''<nowiki>''foo''</nowiki>''
23796 ''<nowiki>'''foo'''</nowiki>''
23797 ''foo''<nowiki/>'s
23798 '''<nowiki/>'foo''''
23799 '''<nowiki>''foo''</nowiki>'''
23800 '''<nowiki>'''foo'''</nowiki>'''
23801 '''foo'<nowiki/>''bar'<nowiki/>''baz'''
23802 '''foo'''<nowiki/>'s
23803 '''foo''
23804 ''foo''<nowiki/>'
23805 ''foo'''<nowiki/>'
23806 '''foo''<nowiki/>'
23807 ''''foo'''
23808 '''foo'''<nowiki/>'
23809 ''''foo'''<nowiki/>'
23810 ''fools'<span> errand</span>''
23811 ''<span>fool</span>'s errand''
23812 '<nowiki/>''foo'' bar '''baz''
23813 a|!*#-:;+-~[]{}b'''x''
23814 !! end
23816 !! test
23817 1b. Quotes inside <b> and <i> with other tags on same line
23818 !! options
23819 parsoid=html2wt
23820 !! html/parsoid
23821 '<i>a</i> foo <i><a rel="mw:WikiLink" href="Bar" title="Bar">bar</a></i>
23822 <i>a'</i> foo <i><a rel="mw:WikiLink" href="Bar" title="Bar">bar</a></i>
23823 <i>a'</i> foo <b><a rel="mw:WikiLink" href="Bar" title="Bar" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[[bar]]"}},"i":0}}]}'>bar</a></b>
23824 <a rel="mw:WikiLink" href="Foo" title="Foo">foo</a> x'<i><a href="Bar" rel="mw:WikiLink" title="Bar">bar</a></i>
23825 '<i>foo</i> <span class="mw-ref" id="cite_ref-1-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-1"},"attrs":{}}'><a href="#cite_note-1"><span class="mw-reflink-text">[1]</span></a></span>
23826 '<i>foo</i> <div title="name">test</div>
23827 '<i>foo</i> and <br data-parsoid='{"stx":"html","noClose":true}'/> bar
23828 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'>
23829 <li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1">↑</a></span> <span id="mw-reference-text-cite_note-1" class="mw-reference-text" data-parsoid="{}">test</span></li>
23830 </ol>
23831 !! wikitext
23832 '''a'' foo ''[[bar]]''
23833 ''a''' foo ''[[bar]]''
23834 ''a''' foo '''{{echo|[[bar]]}}'''
23835 [[foo]] x'''[[bar]]''
23836 '''foo'' <ref>test</ref>
23837 '''foo'' <div title="name">test</div>
23838 '''foo'' and <br> bar
23839 <references />
23840 !! end
23842 !! test
23843 2. Link fragments separated by <i> and <b> tags
23844 !! options
23845 parsoid=html2wt
23846 !! html/parsoid
23847 <p>[[<i>foo</i>hello]]</p>
23848 <p>[[<b>foo</b>hello]]</p>
23849 !! wikitext
23850 [[''foo''<nowiki>hello]]</nowiki>
23852 [['''foo'''<nowiki>hello]]</nowiki>
23853 !! end
23855 # FIXME: Escaping one or both of [[ and ]] is also acceptable --
23856 #        this is one of the shortcomings of this format
23857 !! test
23858 3. Link fragments inside <i> and <b>
23859 !! options
23860 parsoid=html2wt
23861 !! html/parsoid
23862 <p><i>[[foo</i>]]</p>
23863 <p><b>[[foo</b>]]</p>
23864 !! wikitext
23865 ''[[foo''<nowiki>]]</nowiki>
23867 '''[[foo'''<nowiki>]]</nowiki>
23868 !! end
23870 !! test
23871 4. No escaping needed
23872 !! options
23873 options=html2wt
23874 !! html/parsoid
23875 <p>'<span><i>bar</i></span>'
23876 '<span><b>bar</b></span>'
23877 'a:b'foo
23878 </p>
23879 !! wikitext
23880 '<span>''bar''</span>'
23881 '<span>'''bar'''</span>'
23882 'a:b'foo
23883 !! end
23885 #### ----------- Paragraphs ---------------
23886 #### 1. No unnecessary escapes
23887 #### --------------------------------------
23889 !! test
23890 1. No unnecessary escapes
23891 !! options
23892 parsoid=html2wt
23893 !! html/parsoid
23894 <p>bar <span>[[foo]]</span>
23895 </p><p>=bar <span>[[foo]]</span>
23896 </p><p>[[bar <span>[[foo]]</span>
23897 </p><p>]]bar <span>[[foo]]</span>
23898 </p><p>=bar <span>foo]]</span>=
23899 </p>
23900 !! wikitext
23901 bar <span><nowiki>[[foo]]</nowiki></span>
23903 =bar <span><nowiki>[[foo]]</nowiki></span>
23905 [[bar <span><nowiki>[[foo]]</nowiki></span>
23907 ]]bar <span><nowiki>[[foo]]</nowiki></span>
23909 =bar <span>foo]]</span><nowiki>=</nowiki>
23910 !!end
23912 #### ----------------------- PRE --------------------------
23913 #### 1. Leading whitespace in SOL context should be escaped
23914 #### ------------------------------------------------------
23915 !! test
23916 1. Leading whitespace in SOL context should be escaped
23917 !! options
23918 parsoid=html2wt
23919 !! html/parsoid
23920 <p> a</p>
23922 <p>  a</p>
23924 <p>     a(tab)</p>
23926 <p>     a
23927 <!--cmt-->
23928   a</p>
23930 <p>a
23931  b</p>
23933 <p>a
23934         b</p>
23936 <p>a
23937          b</p>
23938 !! wikitext
23939 <nowiki> </nowiki>a
23941 <nowiki> </nowiki> a
23943         a(tab)
23945 <nowiki> </nowiki>      a
23946 <!--cmt-->
23947 <nowiki>  </nowiki>a
23950 <nowiki> </nowiki>b
23953         b
23956          b
23957 !! html/php
23958 <p> a
23959 </p><p>  a
23960 </p><p> a(tab)
23961 </p><p>         a
23962   a
23963 </p><p>a
23965 </p><p>a
23966         b
23967 </p><p>a
23968          b
23969 </p>
23970 !! end
23972 !! test
23973 2. Leading whitespace in non-indent-pre contexts should not be escaped
23974 !! options
23975 parsoid=html2wt
23976 !! html/parsoid
23977 <p>foo <span about="#mwt2" class="mw-ref" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-1"},"attrs":{}}'><a href="#cite_note-1"><span class="mw-reflink-text">[1]</span></a></span></p>
23978 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
23979 <li about="#cite_note-1" id="cite_note-1"><a href="#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text"><i>a</i>
23980  b</span></li>
23981 </ol>
23982 !! wikitext
23983 foo <ref>''a''
23984  b</ref>
23985 <references />
23986 !! end
23988 !! test
23989 3. Leading whitespace in indent-pre suppressing contexts should not be escaped
23990 !! options
23991 parsoid=html2wt
23992 !! html/parsoid
23993 <blockquote>
23996  <span>b</span>
23997  c</p>
23998 </blockquote>
23999 !! wikitext
24000 <blockquote>
24002  <span>b</span>
24004 </blockquote>
24005 !! end
24007 !! test
24008 4. Leading whitespace in indent-pre suppressing contexts should not be escaped
24009 !! options
24010 options=html2wt
24011 !! html/parsoid
24012  <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption>caption</figcaption></figure>
24013 !! wikitext
24014  [[File:Foobar.jpg|thumb|caption]]
24015 !! end
24017 !! test
24018 5. Nowiki escaping should account for indent-pres
24019 !! options
24020 parsoid=html2wt
24021 !! html/parsoid
24022 <pre>==foo==</pre>
24023 !! wikitext
24024  ==foo==
24025 !! end
24027 !!test
24028 T95794: nowiki escaping should account for leading space at start-of-line in an indent-pre block
24029 !! options
24030 parsoid=html2wt
24031 !! html/parsoid
24032 <pre>
24033 * foo
24034 * bar
24035 </pre>
24036 !! wikitext
24037  * foo
24038  * bar
24039 !! end
24041 #### --------------- Behavior Switches --------------------
24043 !! test
24044 1. Valid behavior switches should be escaped
24045 !! options
24046 parsoid=html2wt
24047 !! html/parsoid
24048 __TOC__
24049 <i>__TOC__</i>
24050 !! wikitext
24051 <nowiki>__TOC__</nowiki>
24052 ''<nowiki>__TOC__</nowiki>''
24053 !! end
24055 !! test
24056 2. Invalid behavior switches should not be escaped
24057 !! options
24058 parsoid=html2wt
24059 !! html/parsoid
24060 __TOO__
24061 __|__
24062 !! wikitext
24063 __TOO__
24064 __|__
24065 !! end
24067 # We use indent-pre as an indirect way to test for sol-transparent behavior.
24068 !! test
24069 Behavior switches should be SOL-transparent
24070 !! options
24071 parsoid=html2wt
24072 !! html/parsoid
24073  <meta property="mw:PageProp/toc" />
24075  <!-- this one's bogus -->
24076 <pre>__TOO__</pre>
24078 <pre data-parsoid='{}'><meta property="mw:PageProp/toc" data-parsoid='{"src":"__TOC__","magicSrc":"__TOC__"}'/> foo</pre>
24080 <meta property="mw:PageProp/toc" data-parsoid='{"src":"__TOC__","magicSrc":"__TOC__"}'/><pre data-parsoid='{}'>bar</pre>
24081 !! wikitext
24082  __TOC__
24084  <!-- this one's bogus -->
24085  __TOO__
24087  __TOC__ foo
24089 __TOC__
24090  bar
24091 !! end
24093 #### --------------- HTML tags ---------------
24094 #### 1. a tags
24095 #### 2. other tags
24096 #### 3. multi-line html tag
24097 #### 4. extension tags
24098 #### -----------------------------------------
24099 !! test
24100 1. a tags
24101 !! options
24102 parsoid=html2wt
24103 !! html/parsoid
24104 &lt;a href=&quot;http://google.com&quot;&gt;google&lt;/a&gt;
24105 !! wikitext
24106 <a href="http://google.com">google</a>
24107 !! end
24109 !! test
24110 2. other tags
24111 !! options
24112 parsoid=html2wt
24113 !! html/parsoid
24114 <ul><li> &lt;div&gt;foo&lt;/div&gt;</li>
24115 <li> &lt;div style=&quot;color:red&quot;&gt;foo&lt;/div&gt;</li>
24116 <li> &lt;td&gt;</li></ul>
24118 !! wikitext
24119 * <nowiki><div>foo</div></nowiki>
24120 * <nowiki><div style="color:red">foo</div></nowiki>
24121 * <nowiki><td></nowiki>
24122 !! end
24124 !! test
24125 3. multi-line html tag
24126 !! options
24127 parsoid=html2wt
24128 !! html/parsoid
24129 <p>&lt;div
24130 &gt;foo&lt;/div
24131 &gt;
24132 </p>
24133 !! wikitext
24134 <nowiki><div
24135 >foo</div
24136 ></nowiki>
24137 !! end
24139 !! test
24140 4. extension tags
24141 !! options
24142 parsoid=html2wt
24143 !! html/parsoid
24144 <p>&lt;ref&gt;foo&lt;/ref&gt;
24145 </p><p>&lt;ref&gt;bar
24146 </p><p>baz&lt;/ref&gt;
24147 </p>
24148 !! wikitext
24149 <nowiki><ref>foo</ref></nowiki>
24151 <nowiki><ref>bar</nowiki>
24153 baz<nowiki></ref></nowiki>
24154 !! end
24156 #### --------------- Others ---------------
24157 !! test
24158 Escaping nowikis
24159 !! options
24160 parsoid=html2wt
24161 !! html/parsoid
24162 <p>&lt;nowiki&gt;foo&lt;/nowiki&gt;
24163 </p>
24164 !! wikitext
24165 &lt;nowiki&gt;foo&lt;/nowiki&gt;
24166 !! end
24168 ## The quote-char in the input is necessary for triggering the bug
24169 !! test
24170 (Bug 52035) Nowiki-escaping should not get tripped by " :" in text
24171 !! options
24172 parsoid=html2wt
24173 !! html/parsoid
24174 <p>foo's bar :</p>
24175 !! wikitext
24176 foo's bar :
24177 !! end
24179 #----------- End of wikitext escaping tests --------------
24181 !! test
24183 Tag-like HTML structures are passed through as text
24184 !! wikitext
24185 <x y>
24187 <x.y>
24189 <x-y>
24197 1<d e>f
24198 !! html
24199 <p>&lt;x y&gt;
24200 </p><p>&lt;x.y&gt;
24201 </p><p>&lt;x-y&gt;
24202 </p><p>1&gt;2
24203 </p><p>x&lt;y
24204 </p><p>a&gt;b
24205 </p><p>1&lt;d e&gt;f
24206 </p>
24207 !! end
24209 !! test
24210 HTML tag with necessary entities in attributes
24211 !! wikitext
24212 <span title="&amp;amp;">foo</span>
24213 !! html
24214 <p><span title="&amp;amp;">foo</span>
24215 </p>
24216 !! end
24218 !! test
24219 HTML tag with 'unnecessary' entity encoding in attributes
24220 !! wikitext
24221 <span title="&amp;">foo</span>
24222 !! html
24223 <p><span title="&amp;">foo</span>
24224 </p>
24225 !! end
24227 !! test
24228 HTML tag with broken attribute value quoting
24229 !! options
24230 parsoid=wt2html,html2html
24231 !! wikitext
24232 <span title="Hello world>Foo</span>
24233 !! html/php
24234 <p><span title="Hello world">Foo</span>
24235 </p>
24236 !! html/parsoid
24237 <p><span title="Hello world">Foo</span></p>
24238 !! end
24240 !! test
24241 Self-closed tag with broken attribute value quoting
24242 !! options
24243 parsoid=wt2html,html2html
24244 !! wikitext
24245 <div title="Hello world />Foo
24246 !! html/php+tidy
24247 <div title="Hello world"></div>
24248 <p>Foo</p>
24249 !! html/parsoid
24250 <div title="Hello world " data-parsoid='{"stx":"html","selfClose":true}'></div><p>Foo</p>
24251 !! end
24253 !! test
24254 Table with broken attribute value quoting
24255 !! options
24256 parsoid=wt2html,html2html
24257 !! wikitext
24259 | title="Hello world|Foo
24261 !! html/php
24262 <table>
24263 <tr>
24264 <td title="Hello world">Foo
24265 </td></tr></table>
24267 !! html/parsoid
24268 <table>
24269 <tr>
24270 <td title="Hello world">Foo
24271 </td></tr></table>
24273 !! end
24275 !! test
24276 Table with broken attribute value quoting on consecutive lines
24277 !! options
24278 parsoid=wt2html,html2html
24279 !! wikitext
24281 | title="Hello world|Foo
24282 | style="color:red|Bar
24284 !! html/php
24285 <table>
24286 <tr>
24287 <td title="Hello world">Foo
24288 </td>
24289 <td style="color:red">Bar
24290 </td></tr></table>
24292 !! html/parsoid
24293 <table><tbody>
24294 <tr>
24295 <td title="Hello world">Foo
24296 </td><td style="color: red">Bar
24297 </td></tr></tbody></table>
24299 !! end
24301 !!test
24302 Accept empty td cell attribute
24303 !! wikitext
24305 | align="center" | foo ||  |
24307 !! html
24308 <table>
24309 <tr>
24310 <td align="center"> foo </td>
24311 <td>
24312 </td></tr></table>
24314 !!end
24316 !!test
24317 Non-empty attributes in th-cells
24318 !! wikitext
24320 ! Foo !! style="color: red" | Bar
24322 !! html
24323 <table>
24324 <tr>
24325 <th> Foo </th>
24326 <th style="color: red"> Bar
24327 </th></tr></table>
24329 !!end
24331 !!test
24332 Accept empty attributes in th-cells
24333 !! wikitext
24335 !| foo !!| bar
24337 !! html
24338 <table>
24339 <tr>
24340 <th> foo </th>
24341 <th> bar
24342 </th></tr></table>
24344 !!end
24346 !!test
24347 Empty table rows go away
24348 !! wikitext
24350 | Hello
24351 | there
24352 |- class="foo"
24355 !! html
24356 <table>
24357 <tr>
24358 <td> Hello
24359 </td>
24360 <td> there
24361 </td></tr>
24363 </table>
24365 !! end
24368 ### Parsoid-centric tests for testing RTing of inter-element separators
24369 ### Edge cases not tested by existing parser tests and specific to
24370 ### Parsoid-specific serialization strategies.
24373 !!test
24374 RT-ed inter-element separators should be valid separators
24375 !! wikitext
24377 |- [[foo]]
24379 !! html/php
24380 <table>
24382 </table>
24384 !! html/parsoid
24385 <table>
24386 <tbody><tr data-parsoid='{"startTagSrc":"|-","a":{"[[foo]]":null},"sa":{"[[foo]]":""},"autoInsertedEnd":true}'></tr>
24387 </tbody></table>
24388 !!end
24390 # Parsoid-only since PHP parser relies on Tidy for correct output
24391 !!test
24392 Trailing newlines in a deep dom-subtree that ends a wikitext line should be migrated out
24393 !!options
24394 parsoid
24395 !! wikitext
24397 |<small>foo
24402 |<small>foo<small>
24404 !! html
24405 <table>
24406 <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'><small data-parsoid='{"stx":"html","autoInsertedEnd":true}'>foo
24407 <p>bar</p></small></td></tr>
24408 </tbody></table>
24410 <table>
24411 <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'><small data-parsoid='{"stx":"html","autoInsertedEnd":true}'>foo<small data-parsoid='{"stx":"html","autoInsertedEnd":true}'></small></small></td></tr>
24412 </tbody></table>
24413 !!end
24415 # Note that the "style" attribute is really a template parameter here.
24416 # The = would have to be {{=}} if you wanted the literal.
24417 !!test
24418 Empty TD followed by TD with tpl-generated attribute
24419 !! wikitext
24423 |{{echo|style='color:red'}}|foo
24425 !! html
24426 <table>
24428 <tr>
24429 <td>
24430 </td>
24431 <td>foo
24432 </td></tr></table>
24434 !!end
24436 !!test
24437 Indented table with an empty td
24438 !! wikitext
24439  {|
24440  |-
24442  |foo
24443  |}
24444 !! html
24445 <table>
24447 <tr>
24448 <td>
24449 </td>
24450 <td>foo
24451 </td></tr></table>
24453 !!end
24455 ## We have some newline diffs RT-ing this edge case
24456 ## and it is not important enough -- we seem to be emitting
24457 ## at most 2 newlines after a </tr> and this is unrelated to
24458 ## the issue from T85627 that this is testing.
24459 !!test
24460 Indented table with blank lines in between (T85627)
24461 !! options
24462 parsoid=wt2html
24463 !! wikitext
24464  {|
24465  |foo
24468  |}
24469 !! html
24470 <table>
24472 <tr>
24473 <td>foo
24474 </td></tr></table>
24476 !!end
24478 !!test
24479 Indented block & table
24480 !! wikitext
24481  <div>foo</div>
24482  {|
24483  |foo
24484  |}
24485 !! html/php
24486  <div>foo</div>
24487 <table>
24488 <tr>
24489 <td>foo
24490 </td></tr></table>
24492 !! html/parsoid
24493  <div data-parsoid='{"stx":"html"}'>foo</div>
24494  <table><tbody>
24495  <tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'>foo</td></tr>
24496  </tbody></table>
24497 !!end
24499 !! test
24500 Indent and comment before table row
24501 !! wikitext
24503  <!--hi-->|-
24504  | there
24506 !! html/php
24507 <table>
24509 <tr>
24510 <td> there
24511 </td></tr></table>
24513 !! html/parsoid
24514 <table>
24515  <!--hi--><tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'>
24516  <td data-parsoid='{"autoInsertedEnd":true}'> there</td></tr>
24517 </tbody></table>
24518 !! end
24520 # Parsoid-specific since PHP parser doesn't handle this mixed tbl-wikitext
24521 !!test
24522 Empty TR followed by a template-generated TR
24523 !!options
24524 parsoid
24525 !! wikitext
24528 {{echo|<tr><td>foo</td></tr>}}
24530 !! html
24531 <table>
24532 <tbody>
24533 <tr></tr>
24534 <tr about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"<tr><td>foo</td></tr>"}},"i":0}}]}'>
24535 <td>foo</td></tr>
24536 </tbody></table>
24537 !!end
24539 ## PHP and parsoid output differ for this, and since this is primarily
24540 ## for testing Parsoid's serializer, marking this Parsoid only
24541 !!test
24542 Empty TR followed by mixed-ws-comment line should RT correctly
24543 !!options
24544 parsoid
24545 !! wikitext
24548  <!--c-->
24550 <!--c--> <!--d-->
24552 !! html
24553 <table>
24554 <tbody>
24555 <tr></tr>
24556  <!--c-->
24557 <tr>
24558 <!--c--> </tr><!--d-->
24559 </tbody></table>
24561 !!end
24563 !!test
24564 Multi-line image caption generated by templates with/without trailing newlines
24565 !! wikitext
24566 [[File:Foobar.jpg|thumb|300x300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}]]
24567 [[File:Foobar.jpg|thumb|300x300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}\n\n]]
24568 !! html/parsoid
24569 <figure typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/300px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="34" width="300"/></a><figcaption>foo\n<span about="#mwt9" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"A"}},"i":0}}]}'>A</span>\n<span about="#mwt10" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"B"}},"i":0}}]}'>B</span>\n<span about="#mwt11" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"C"}},"i":0}}]}'>C</span></figcaption></figure>
24570 <figure typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/300px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="34" width="300"/></a><figcaption>foo\n<span about="#mwt12" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"A"}},"i":0}}]}'>A</span>\n<span about="#mwt13" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"B"}},"i":0}}]}'>B</span>\n<span about="#mwt14" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"C"}},"i":0}}]}'>C</span>\n\n</figcaption></figure>
24571 !!end
24573 !! test
24574 New element inserted (without intervening newlines) after an old sol-transparent node should serialize correctly
24575 !! options
24576 parsoid=html2wt
24577 !! html/parsoid
24578 <meta typeof="mw:Includes/IncludeOnly" data-parsoid='{"src":"&lt;includeonly>foo&lt;/includeonly>"}'/><meta typeof="mw:Includes/IncludeOnly/End" data-parsoid='{"src":""}'/><p>new para</p>
24580 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{}'/><h1>new heading</h1>
24581 !! wikitext
24582 <includeonly>foo</includeonly>
24583 new para
24585 [[Category:Foo]]
24587 = new heading =
24588 !! end
24590 ## PHP emits broken html for this, and since this is primarily
24591 ## a Parsoid serializer test, marking this Parsoid only
24592 !!test
24593 Improperly nested inline or quotes tags with whitespace in between
24594 !! wikitext
24595 <span> <s>x</span> </s>
24596 ''' ''x''' ''
24597 !! html/parsoid
24598 <p><span> <s>x</s></span><s> </s>
24599 <b> <i>x</i></b><i> </i>
24600 </p>
24601 !!end
24603 !!test
24604 Encapsulate protected attributes from wt
24605 !! wikitext
24606 <div typeof="mw:placeholder stuff" data-mw="whoo" data-parsoid="weird" data-parsoid-other="no" about="time" rel="mw:true">foo</div>
24607 !! html/parsoid
24608 <body><div data-x-typeof="mw:placeholder stuff" data-x-data-mw="whoo" data-x-data-parsoid="weird" data-x-data-parsoid-other="no" data-x-about="time" data-x-rel="mw:true">foo</div>
24609 </body>
24610 !!end
24612 ## Currently the p-wrapper is fragile in how it adds / removes transformations.
24613 ## Having nested or stray pre tags results in the attempt to add duplicates,
24614 ## causing an assertion fail. This test tries to prevent that situation.
24615 !!test
24616 Ensure ParagraphWrapper can deal with stray closing pre tags
24617 !!options
24618 parsoid=wt2html
24619 !! wikitext
24620 plain text</pre>
24621 !! html/parsoid
24622 plain text
24623 !!end
24625 !!test
24626 1. Ensure fostered text content is wrapped in element nodes
24627 !!options
24628 parsoid=wt2html
24629 !! wikitext
24630 <table>hi</table><table>ho</table>
24631 !! html/parsoid
24632 <p>hi</p>
24633 <table></table>
24634 <p>ho</p>
24635 <table></table>
24636 !!end
24638 !!test
24639 2. Ensure fostered text content is wrapped in element nodes (traps regressions around fostered marker on the element getting lost)
24640 !!options
24641 parsoid=wt2html,wt2wt
24642 !! wikitext
24643 <table>
24644 <tr> || ||
24645 <td> a
24646 </table>
24647 !! html/parsoid
24648 <p> || ||
24649 </p><table>
24650 <tbody><tr><td> a</td></tr>
24651 </tbody></table>
24652 !!end
24654 !!test
24655 Encapsulation properly handles null DSR information from foster box
24656 !!options
24657 parsoid=wt2html,wt2wt
24658 !! wikitext
24659 {{echo|<table>foo<tr><td>bar</td></tr></table>}}
24660 !! html/parsoid
24661 <span typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[{&quot;template&quot;:{&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;<table>foo<tr><td>bar</td></tr></table>&quot;}},&quot;i&quot;:0}}]}">foo</span><table><tbody><tr><td>bar</td></tr></tbody></table>
24662 !!end
24664 !!test
24665 1. Encapsulate foster-parented transclusion content
24666 !!options
24667 parsoid=wt2wt,wt2html
24668 !! wikitext
24669 <table>{{echo|foo<tr><td>bar</td></tr>}}</table>
24670 !! html/parsoid
24671 <p typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[&quot;<table>&quot;,{&quot;template&quot;:{&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<tr><td>bar</td></tr>&quot;}},&quot;i&quot;:0}},&quot;</table>&quot;]}">foo</p><table>
24672 <tbody>
24673 <tr>
24674 <td>bar</td>
24675 </tr>
24676 </tbody>
24677 </table>
24678 !!end
24680 !!test
24681 2. Encapsulate foster-parented transclusion content
24682 !!options
24683 parsoid=wt2wt,wt2html
24684 !! wikitext
24685 <table><div>{{echo|foo}}</div><tr><td>bar</td></tr></table>
24686 !! html/parsoid
24687 <div typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[&quot;<table><div>&quot;,{&quot;template&quot;:{&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;i&quot;:0}},&quot;</div><tr><td>bar</td></tr></table>&quot;]}">foo</div>
24688 <table>
24689 <tbody>
24690 <tr>
24691 <td>bar</td>
24692 </tr>
24693 </tbody>
24694 </table>
24695 !!end
24697 !!test
24698 3. Encapsulate foster-parented transclusion content
24699 !!options
24700 parsoid=wt2wt,wt2html
24701 !! wikitext
24702 <table><div><p>{{echo|foo</p></div><tr><td>}}bar</td></tr></table>
24703 !! html/parsoid
24704 <div typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[&quot;<table><div><p>&quot;,{&quot;template&quot;:{&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</p></div><tr><td>&quot;}},&quot;i&quot;:0}},&quot;bar</td></tr></table>&quot;]}">
24705 <p>foo</p>
24706 </div>
24707 <table>
24708 <tbody>
24709 <tr>
24710 <td>bar</td>
24711 </tr>
24712 </tbody>
24713 </table>
24714 !!end
24716 !!test
24717 4. Encapsulate foster-parented transclusion content
24718 !!options
24719 parsoid=wt2wt,wt2html
24720 !! wikitext
24721 <table><div><p>{{echo|foo</p></div><tr><td>}}bar</td></tr></table>
24722 !! html/parsoid
24723 <div typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[&quot;<table><div><p>&quot;,{&quot;template&quot;:{&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</p></div><tr><td>&quot;}},&quot;i&quot;:0}},&quot;bar</td></tr></table>&quot;]}">
24724 <p>foo</p>
24725 </div>
24726 <table>
24727 <tbody>
24728 <tr>
24729 <td>bar</td>
24730 </tr>
24731 </tbody>
24732 </table>
24733 !!end
24735 !!test
24736 5. Encapsulate foster-parented transclusion content
24737 !!options
24738 parsoid=wt2wt,wt2html
24739 !! wikitext
24740 <table><tr><td><div><p>{{echo|foo</p></div></td>foo}}</tr></table>
24741 !! html/parsoid
24742 <p typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[&quot;<table><tr><td><div><p>&quot;,{&quot;template&quot;:{&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</p></div></td>foo&quot;}},&quot;i&quot;:0}},&quot;</tr></table>&quot;]}">foo</p>
24743 <table>
24744 <tbody>
24745 <tr>
24746 <td>
24747 <div>
24748 <p>foo</p>
24749 </div>
24750 </td>
24751 </tr>
24752 </tbody>
24753 </table>
24754 !!end
24756 !!test
24757 6. Encapsulate foster-parented transclusion content
24758 !!options
24759 parsoid=wt2wt,wt2html
24760 !! wikitext
24761 <table><tr><td><div><p>{{echo|foo</p></div></td>foo</tr></table>}}<p>ok</p>
24762 !! html/parsoid
24763 <p typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[&quot;<table><tr><td><div><p>&quot;,{&quot;template&quot;:{&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</p></div></td>foo</tr></table>&quot;}},&quot;i&quot;:0}}]}">foo</p>
24764 <table>
24765 <tbody>
24766 <tr>
24767 <td>
24768 <div>
24769 <p>foo</p>
24770 </div>
24771 </td>
24772 </tr>
24773 </tbody>
24774 </table>
24775 <p>ok</p>
24776 !!end
24778 !!test
24779 7. Encapsulate foster-parented transclusion content
24780 !!options
24781 parsoid=wt2wt,wt2html
24782 !! wikitext
24783 <table>{{echo|<p>foo</p>}}<td>bar</td></table>
24784 !! html/parsoid
24785 <p typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[&quot;<table>&quot;,{&quot;template&quot;:{&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;<p>foo</p>&quot;}},&quot;i&quot;:0}},&quot;<td>bar</td></table>&quot;]}">foo</p>
24786 <table>
24787 <tbody>
24788 <tr>
24789 <td>bar</td>
24790 </tr>
24791 </tbody>
24792 </table>
24793 !!end
24795 # Note that the wt is broken on purpose: the = should be {{=}} if you
24796 # don't want it to be a template parameter key.
24797 !!test
24798 8. Encapsulate foster-parented transclusion content
24799 !!options
24800 parsoid=wt2wt,wt2html
24801 !! wikitext
24802 {{echo|a
24803 }}{|{{echo|style='color:red'}}
24807 !! html/parsoid
24808 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"a\n"}},"i":0}}]}'>a</p>
24809 <span> </span>
24810 <p typeof="mw:Transclusion" data-mw='{"parts":["{|",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"style":{"wt":"&#39;color:red&#39;"}},"i":0}},"\n|-\n|b\n|}"]}'>{{{1}}}</p>
24811 <table>
24812 <tbody>
24813 <tr>
24814 <td>b</td>
24815 </tr>
24816 </tbody>
24817 </table>
24818 !!end
24820 !!test
24821 9. Encapsulate foster-parented transclusion content
24822 !!options
24823 parsoid=wt2wt,wt2html
24824 !! wikitext
24825 <table>{{echo|hi</table>hello}}
24826 !! html/parsoid
24827 <p about="#mwt2" typeof="mw:Transclusion" data-mw='{"parts":["&lt;table>",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"hi&lt;/table>hello"}},"i":0}}]}' data-parsoid='{"fostered":true,"autoInsertedEnd":true,"autoInsertedStart":true,"pi":[[{"k":"1"}]]}'>hi</p><table about="#mwt2" data-parsoid='{"stx":"html"}'></table><p about="#mwt2">hello</p>
24828 !!end
24830 !!test
24831 Table in fosterable position
24832 !!options
24833 parsoid=wt2html
24834 !! wikitext
24835 {{OpenTable}}
24836 <div>
24839 </div>
24841 !! html/parsoid
24842 <div about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"OpenTable","href":"./Template:OpenTable"},"params":{},"i":0}},"\n&lt;div>\n"]}' data-parsoid='{"stx":"html","autoInsertedEnd":true,"pi":[[]]}'></div><span about="#mwt1">
24843 </span>
24844 <table about="#mwt1" data-parsoid='{"autoInsertedEnd":true}'></table>
24846 <table>
24847 </table>
24848 !!end
24850 # Parsoid only for bug 64747
24851 !! test
24852 Properly encapsulate empty-content transclusions in fosterable positions
24853 !! wikitext
24854 <table>
24855 {{#if:|
24856 <td>foo</td>
24858 </table>
24859 !! html/parsoid
24860 <table about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":["&lt;table>\n",{"template":{"target":{"wt":"#if:","function":"#if"},"params":{"1":{"wt":"\n&lt;td>foo&lt;/td>\n"}},"i":0}},"\n&lt;/table>"]}' data-parsoid='{"stx":"html","pi":[[{"k":"1"}]]}'>
24862 </table>
24863 !! end
24865 !! test
24866 Always encapsulate foster box when template range is expanded to table
24867 !! options
24868 parsoid=wt2wt
24869 !! wikitext
24871 hello
24872 {{OpenTable}}
24874 !! html/parsoid
24876 !! end
24878 !! test
24879 T115289: Unclosed table
24880 !! wikitext
24881 {{echo|<table>}}<!--c-->[[Category:Two]]
24882 !! html/parsoid
24883 <link rel="mw:PageProp/Category" href="./Category:Two" about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"stx":"simple","a":{"href":"./Category:Two"},"sa":{"href":"Category:Two"},"pi":[[{"k":"1"}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;table>"}},"i":0}},"&lt;!--c-->[[Category:Two]]"]}'/><table about="#mwt1" data-parsoid='{"stx":"html","autoInsertedEnd":true}'><!--c--></table>
24884 !! end
24886 !! test
24887 T115289: Don't migrate newlines out of tables with fostered content
24888 !! wikitext
24889 <table><td></td>{{echo|<tr>[[Category:One]]}}<!--c-->[[Category:Two]]
24890 !! html/parsoid
24891 <link rel="mw:PageProp/Category" href="./Category:One" about="#mwt2" typeof="mw:Transclusion" data-parsoid='{"stx":"simple","a":{"href":"./Category:One"},"sa":{"href":"Category:One"},"fostered":true,"pi":[[{"k":"1"}]]}' data-mw='{"parts":["&lt;table>&lt;td>&lt;/td>",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;tr>[[Category:One]]"}},"i":0}},"&lt;!--c-->[[Category:Two]]"]}'/><link rel="mw:PageProp/Category" href="./Category:Two" about="#mwt2"/><table about="#mwt2" data-parsoid='{"stx":"html","autoInsertedEnd":true}'><tbody><tr><td></td></tr><tr><!--c--></tr></tbody></table>
24892 !! end
24894 !! test
24895 T73074: More fostering fun
24896 !! wikitext
24897 <table><td></td>{{echo|<tr>}}<!--c-->[[Category:Two]]
24898 !! html/parsoid
24899 <link rel="mw:PageProp/Category" href="./Category:Two" data-parsoid='{"stx":"simple","a":{"href":"./Category:Two"},"sa":{"href":"Category:Two"},"fostered":true}'/><table data-parsoid='{"stx":"html","autoInsertedEnd":true}'><tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"stx":"html"}'></td></tr><tr about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"stx":"html","autoInsertedEnd":true,"pi":[[{"k":"1"}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;tr>"}},"i":0}},"&lt;!--c-->[[Category:Two]]"]}'><!--c--></tr></tbody></table>
24900 !! end
24902 !!test
24903 Support <object> element with .data attribute
24904 !!options
24905 parsoid=html2wt
24906 !! html/parsoid
24907 <object data="test.swf"></object>
24908 !! wikitext
24909 <object data="test.swf"></object>
24910 !!end
24912 !! test
24913 Don't block XML namespace declaration
24914 !! wikitext
24915 <span xmlns:dct="http://purl.org/dc/terms/" property="dct:title">MediaWiki</span>
24916 !! html/php
24917 <p><span xmlns:dct="http&#58;//purl.org/dc/terms/" property="dct:title">MediaWiki</span>
24918 </p>
24919 !! html/parsoid
24920 <p><span xmlns:dct="http://purl.org/dc/terms/" data-x-property="dct:title" data-parsoid='{"stx":"html"}'>MediaWiki</span></p>
24921 !! end
24923 # -----------------------------------------------------------------
24924 # The following section of tests are primarily to spec requirements
24925 # around serialization of new/edited content.
24927 # All these tests are marked Parsoid html2wt and html2html only
24928 # ----------------------------------------------------------------
24930 # 'mi' is a localinterwiki prefix as well as a language
24931 !! test
24932 Serialize interwiki links pointing to the current wiki as plain wiki links (bug 65869)
24933 !! options
24934 parsoid=html2wt
24935 !! html/parsoid
24936 <p><a rel="mw:ExtLink" href="http://mi.wikipedia.org/wiki/Foo">Foo</a></p>
24937 !! wikitext
24938 [[Foo]]
24939 !! end
24941 # See T93839
24942 !! test
24943 New wikilinks should be serialized properly
24944 !! options
24945 parsoid=html2wt
24946 !! html/parsoid
24947 <a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{}'>Foo</a>
24948 <a rel="mw:WikiLink" href="./Foo" title="Foo">Foo</a>
24949 !! wikitext
24950 [[Foo]]
24951 [[Foo]]
24952 !! end
24954 !! test
24955 New wiki links (href variations)
24956 !! options
24957 parsoid=html2wt
24958 !! html/parsoid
24959 <a rel="mw:WikiLink" href="./Foo_bar">Foo_bar</a>
24960 <a rel="mw:WikiLink" href="Foo_bar">Foo_bar</a>
24961 <a rel="mw:WikiLink" href="Foo bar">Foo_bar</a>
24962 <a rel="mw:WikiLink" href="./Toxine_bact%C3%A9rienne">Toxine bactérienne</a>
24963 !! wikitext
24964 [[Foo_bar]]
24965 [[Foo_bar]]
24966 [[Foo_bar]]
24967 [[Toxine bactérienne]]
24968 !! end
24970 !! test
24971 New wiki links (content string variations)
24972 !! options
24973 parsoid=html2wt
24974 !! html/parsoid
24975 <a rel="mw:WikiLink" href="./Foo_bar">Foo_bar</a>
24976 <a rel="mw:WikiLink" href="./Foo_bar">Foo bar</a>
24977 <a rel="mw:WikiLink" href="./Foo_bar">./Foo_bar</a>
24978 !! wikitext
24979 [[Foo_bar]]
24980 [[Foo bar]]
24981 [[Foo_bar|./Foo_bar]]
24982 !! end
24984 !! test
24985 New category links (href variations)
24986 !! options
24987 parsoid=html2wt
24988 !! html/parsoid
24989 <link rel="mw:PageProp/Category" href="./Category:Toxine_bactérienne" />
24990 <link rel="mw:PageProp/Category" href="./Category:Toxine_bact%C3%A9rienne" />
24991 <link rel="mw:PageProp/Category" href="Category:Toxine_bact%C3%A9rienne" />
24992 !! wikitext
24993 [[Category:Toxine bactérienne]]
24994 [[Category:Toxine bactérienne]]
24995 [[Category:Toxine bactérienne]]
24996 !! end
24998 !! test
24999 New sol transparent links don't need indent-pre nowiki protection
25000 !! options
25001 parsoid=html2wt
25002 language=de
25003 !! html/parsoid
25004          <link rel="mw:PageProp/redirect" href="./Main_Page">
25005 <!-- this is good  -->    <link rel="mw:PageProp/Category" href="./Category:Good" />
25006 <!-- this is great -->    <link rel="mw:PageProp/Category" href="./Kategorie:Great" />
25007 !! wikitext
25008          #WEITERLEITUNG [[Main Page]]
25009 <!-- this is good  -->    [[Category:Good]]
25010 <!-- this is great -->    [[Kategorie:Great]]
25011 !! end
25013 !! test
25014 New interlanguage links (href variations)
25015 !! options
25016 parsoid=html2wt
25017 !! html/parsoid
25018 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine bactérienne" />
25019 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine_bactérienne" />
25020 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine_bact%C3%A9rienne" />
25021 !! wikitext
25022 [[es:Toxine bactérienne]]
25023 [[es:Toxine_bactérienne]]
25024 [[es:Toxine_bactérienne]]
25025 !! end
25027 !! test
25028 Image: Modifying size of an image (1)
25029 !! options
25030 parsoid={
25031   "modes": ["wt2wt"],
25032   "changes": [
25033     ["img[height]", "attr", "height", "22"],
25034     ["img[width]", "attr", "width", "200"]
25035   ]
25037 !! wikitext
25038 [[Image:Foobar.jpg|230x230px]]
25039 !! wikitext/edited
25040 [[Image:Foobar.jpg|200x200px]]
25041 !!end
25043 !! test
25044 Image: Modifying size of an image (2)
25045 !! options
25046 parsoid={
25047   "modes": ["wt2wt"],
25048   "changes": [
25049     ["img[height]", "attr", "height", "100"],
25050     ["img[width]", "attr", "width", "500"]
25051   ]
25053 !! wikitext
25054 [[Image:Foobar.jpg|230x230px]]
25055 !! wikitext/edited
25056 [[Image:Foobar.jpg|500x500px]]
25057 !!end
25059 # Change in size is ignored so long as class='mw-default-size'
25060 !! test
25061 Image: Modifying size of an image (3)
25062 !! options
25063 parsoid={
25064   "modes": ["wt2wt"],
25065   "changes": [
25066     ["figure[class]", "removeClass", "mw-default-size"],
25067     ["figure img", "attr", "height", "19"],
25068     ["figure img", "attr", "width", "170"]
25069   ]
25071 !! wikitext
25072 [[Image:Foobar.jpg|thumb]]
25073 !! wikitext/edited
25074 [[Image:Foobar.jpg|thumb|170x170px]]
25075 !!end
25077 !! test
25078 Image: Modifying alignment of an image (bug 48665)
25079 !! options
25080 parsoid={
25081   "modes": ["wt2wt"],
25082   "changes": [
25083     ["figure[class]", "removeClass", "mw-halign-right"],
25084     ["figure[class]", "addClass", "mw-halign-left"]
25085   ]
25087 !! wikitext
25088 [[Image:Foobar.jpg|thumb|caption|right]]
25089 !! wikitext/edited
25090 [[Image:Foobar.jpg|thumb|caption|left]]
25091 !! end
25093 !! test
25094 Image: Modifying mw-default-size of an frameless image (bug 62805)
25095 !! options
25096 parsoid={
25097   "modes": ["wt2wt"],
25098   "changes": [
25099     ["figure.mw-default-size", "removeClass", "mw-default-size"]
25100   ]
25102 !! wikitext
25103 [[Image:Foobar.jpg|frameless|right]]
25104 !! wikitext/edited
25105 [[Image:Foobar.jpg|frameless|right|220x220px]]
25106 !! end
25108 !! test
25109 Image: Modifying valign of an image (bug 49221)
25110 !! options
25111 parsoid={
25112   "modes": ["wt2wt"],
25113   "changes": [
25114     ["*[typeof=\"mw:Image\"]", "removeClass", "mw-valign-middle"],
25115     ["*[typeof=\"mw:Image\"]", "addClass", "mw-valign-text-top"]
25116   ]
25118 !! wikitext
25119 [[File:Foobar.jpg|20px|middle]]
25120 !! wikitext/edited
25121 [[File:Foobar.jpg|20px|text-top]]
25122 !! end
25124 !! test
25125 Image: Modifying alt attribute of an image (bug 56400)
25126 !! options
25127 parsoid={
25128   "modes": ["wt2wt"],
25129   "changes": [
25130     ["img[alt]", "attr", "alt", "some alternate edited text"]
25131   ]
25133 !! wikitext
25134 [[File:Foobar.jpg|thumb|some caption|alt=some alternate text]]
25135 !! wikitext/edited
25136 [[File:Foobar.jpg|thumb|some caption|alt=some alternate edited text]]
25137 !!end
25139 !! test
25140 Image: Modifying caption of an image
25141 !! options
25142 parsoid={
25143   "modes": ["wt2wt"],
25144   "changes": [
25145     ["figcaption", "text", "new caption"]
25146   ]
25148 !! wikitext
25149 [[Image:Foobar.jpg|thumb|original caption]]
25150 !! wikitext/edited
25151 [[Image:Foobar.jpg|thumb|new caption]]
25152 !!end
25154 !! test
25155 Image: empty alt attribute (bug 48924)
25156 !! options
25157 parsoid
25158 !! wikitext
25159 [[File:Foobar.jpg|thumb|alt=|bar]]
25160 !! html
25161 <figure class="mw-default-size" typeof="mw:Image/Thumb" data-parsoid='{"optList":[{"ck":"thumbnail","ak":"thumb"},{"ck":"alt","ak":"alt="},{"ck":"caption","ak":"bar"}]}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"}}'><img alt="" resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220" data-parsoid='{"a":{"alt":"","resource":"./File:Foobar.jpg","height":"25","width":"220"},"sa":{"alt":"alt=","resource":"File:Foobar.jpg"}}'/></a><figcaption>bar</figcaption></figure>
25162 !! end
25164 !! test
25165 Image: new attributes should be serialized in wiki's language for RTL languages (bug 51852)
25166 !! options
25167 parsoid=html2wt
25168 language=ar
25169 disabled
25170 !! html/parsoid
25171 <figure class="mw-default-size mw-halign-right" typeof="mw:Image/Thumb"><a href="./Imagen:Foobar.jpg"><img resource="./Imagen:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="20" width="180"/></a></figure>
25172 !! wikitext
25173 [[Imagen:Foobar.jpg|derecha|miniaturadeimagen]]
25174 !! end
25176 !! test
25177 Image: Block level image should have \n before and after
25178 !! wikitext
25180 [[File:Foobar.jpg|right|thumb|150x150px]]
25182 !! html/parsoid
25183 <p>123</p>
25184 <figure class="mw-halign-right" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/150px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="17" width="150"/></a></figure>
25185 <p>456</p>
25186 !!end
25188 !! test
25189 Image: New block level image should have \n before and after (existing content)
25190 !! wikitext
25192 [[File:Foobar.jpg|right|thumb|150x150px]]
25194 !! html/parsoid
25195 <p>123</p>
25196 <figure class="mw-halign-right" typeof="mw:Image/Thumb" data-parsoid='{"optList":[{"ck":"right","ak":"right"},{"ck":"thumbnail","ak":"thumb"},{"ck":"width","ak":"150x150px"}]}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"}}'><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/150px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="17" width="150" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"17","width":"150"},"sa":{"resource":"File:Foobar.jpg"}}'/></a></figure>
25197 <p>456</p>
25198 !!end
25200 !! test
25201 Image: upright option (parsoid)
25202 !! wikitext
25203 [[File:Foobar.jpg|thumb|upright|caption]]
25204 [[File:Foobar.jpg|thumb|upright=0.5|caption]]
25205 [[File:Foobar.jpg|thumb|500x500px|upright=0.5|caption]]
25206 !! html/parsoid
25207 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/170px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="19" width="170"/></a><figcaption>caption</figcaption></figure>
25208 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/110px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="12" width="110"/></a><figcaption>caption</figcaption></figure>
25209 <figure typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/500px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="57" width="500"/></a><figcaption>caption</figcaption></figure>
25210 !!end
25212 !! test
25213 Image: upright option is ignored on inline and frame images (parsoid)
25214 !! wikitext
25215 [[File:Foobar.jpg|500x500px|upright=0.5|caption]]
25216 !! html/parsoid
25217 <p><span typeof="mw:Image" data-mw='{"caption":"caption"}'><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/500px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="57" width="500"/></a></span></p>
25218 !!end
25220 !! test
25221 Image: from basic HTML (1)
25222 !! options
25223 parsoid=html2wt
25224 !! html/parsoid
25225 <span typeof="mw:Image">
25226   <img src="./File:Foobar.jpg" width=100 height=100 alt="Alt">
25227 </span>
25228 !! wikitext
25229 [[File:Foobar.jpg|link=|alt=Alt|100x100px]]
25230 !! end
25232 !! test
25233 Image: from basic HTML (2)
25234 !! options
25235 parsoid=html2wt
25236 !! html/parsoid
25237 <img src="./File:Foobar.jpg" width=100 height=100 alt="Alt">
25238 !! wikitext
25239 [[File:Foobar.jpg|link=|alt=Alt|100x100px]]
25240 !! end
25242 !! test
25243 Image: from basic HTML (3)
25244 !! options
25245 parsoid=html2wt
25246 !! html/parsoid
25247 <a href="Main"><img src="./File:Foobar.jpg" width=100 height=100 alt="Alt"></a>
25248 !! wikitext
25249 [[File:Foobar.jpg|link=Main|alt=Alt|100x100px]]
25250 !! end
25252 !! test
25253 Image: from basic HTML (4)
25254 !! options
25255 parsoid=html2wt
25256 !! html/parsoid
25257 <img src="./File:Foobar.jpg">
25258 !! wikitext
25259 [[File:Foobar.jpg|link=]]
25260 !! end
25262 !! test
25263 Lists: Serialize correctly even when list content is wrapped in p-tags (like VE does)
25264 !! options
25265 parsoid=html2wt
25266 !! html/parsoid
25267 <ul>
25268 <li><p>foo</p></li>
25269 </ul>
25270 !! wikitext
25271 * foo
25272 !! end
25274 !! test
25275 Lists: Serialize correctly even when list tags has unneeded whitespace between tags
25276 !! options
25277 parsoid=html2wt
25278 !! html/parsoid
25279 <ul> <li>foo</li></ul>
25280 !! wikitext
25281 * foo
25282 !! end
25284 !! test
25285 Don't strip leading whitespace when handling indent-pre suppressing tags
25286 !! options
25287 parsoid=html2wt
25288 !! html/parsoid
25289 <table>
25290   <tr><td> indented row</td></tr>
25291 </table>
25292 <blockquote><p>
25293  <b>This is very bold of you!</b>
25294 </p>
25295 <table><tr><td>
25296  indented cell (no pre-wrapping!)
25297 </td></tr></table>
25298 </blockquote>
25299 <p>foo</p>
25300  <div>bar</div>
25301 !! wikitext
25303   | indented row
25305 <blockquote>
25306  '''This is very bold of you!'''
25310  indented cell (no pre-wrapping!)
25312 </blockquote>
25314  <div>bar</div>
25315 !! end
25317 !! test
25318 Nowiki-wrap leading whitespace when handling indent-pre inducing tags
25319 !! options
25320 parsoid=html2wt
25321 !! html/parsoid
25322 <p>foo</p>
25323  <span>bar</span>
25325 <span>foo2
25326  </span>bar2
25328 <div>foo</div>
25329  <span>bar</span>
25331 <div>
25332  <span>foo</span>
25333 </div>
25334 !! wikitext
25337 <span>bar</span>
25339 <span>foo2
25340 <nowiki> </nowiki></span>bar2
25342 <div>foo</div>
25343 <nowiki> </nowiki><span>bar</span>
25345 <div>
25346 <nowiki> </nowiki><span>foo</span>
25347 </div>
25348 !! end
25350 !! test
25351 Lists: Dont insert newlines in a serialized list item.
25352 !! options
25353 parsoid=html2wt
25354 !! html/parsoid
25355 <ul><li>a<br>b</li><li>c</li></ul>
25356 !! wikitext
25357 * a<br>b
25358 * c
25359 !! end
25361 !! test
25362 1. Headings: Force sol-transparent links and behavior switches to serialize before/after
25363 !! options
25364 parsoid={
25365   "modes": ["html2wt"],
25366   "scrubWikitext": false
25368 !! html/parsoid
25369 <h2>hello there<link href="./Category:A1" rel="mw:PageProp/Category" /></h2>
25370 <h2><link href="./Category:A2" rel="mw:PageProp/Category" />hi pal</h2>
25372 <h2><!--foo-->  <link href="./Category:A3" rel="mw:PageProp/Category" />   how goes it</h2>
25373 <h2>it goes well   <link href="./Category:A4" rel="mw:PageProp/Category" />  <!--bar--></h2>
25375 <h2 data-parsoid='{}'>howdy<link href="./Category:A5" rel="mw:PageProp/Category" /></h2>
25377 <h2><meta property="mw:PageProp/toc" /> ok</h2>
25378 !! wikitext
25379 == hello there [[Category:A1]] ==
25381 == [[Category:A2]] hi pal ==
25383 == <!--foo-->  [[Category:A3]]    how goes it ==
25385 == it goes well    [[Category:A4]]  <!--bar--> ==
25387 ==howdy [[Category:A5]]==
25389 ==  __TOC__  ok ==
25390 !! end
25392 !! test
25393 2. Headings: Force sol-transparent links and behavior switches to serialize before/after
25394 !! options
25395 parsoid={
25396   "modes": ["html2wt"],
25397   "scrubWikitext": true
25399 !! html/parsoid
25400 <h2>hello there<link href="./Category:A1" rel="mw:PageProp/Category" /></h2>
25401 <h2><link href="./Category:A2" rel="mw:PageProp/Category" />hi pal</h2>
25403 <h2><!--foo-->  <link href="./Category:A3" rel="mw:PageProp/Category" />   how goes it</h2>
25404 <h2>it goes well   <link href="./Category:A4" rel="mw:PageProp/Category" />  <!--bar--></h2>
25406 <h2><meta property="mw:PageProp/toc" /> ok</h2>
25407 !! wikitext
25408 == hello there ==
25409 [[Category:A1]]
25410 [[Category:A2]]
25412 == hi pal ==
25414 <!--foo-->  [[Category:A3]]
25416 == how goes it ==
25418 == it goes well ==
25419 [[Category:A4]]  <!--bar-->
25421 __TOC__
25423 == ok ==
25424 !! end
25426 !! test
25427 Headings: Don't hoist metas that come from templates
25428 !! options
25429 parsoid={
25430   "modes": ["html2wt"],
25431   "scrubWikitext": true
25433 !! html/parsoid
25434 <h2><span about="#mwt1" typeof="mw:Transclusion" data-parsoid="{}" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo [[Category:Foo]]"}},"i":0}}]}'>foo </span><link rel="mw:PageProp/Category" href="./Category:Foo" about="#mwt1" data-parsoid="{}" /></h2>
25435 !! wikitext
25436 == {{echo|foo [[Category:Foo]]}} ==
25437 !! end
25439 !! test
25440 Headings: Category in ref isn't hoisted
25441 !! options
25442 parsoid={
25443   "modes": ["html2wt"],
25444   "scrubWikitext": true
25446 !! html/parsoid
25447 <h2> foo <span about="#mwt2" class="mw-ref" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-1"},"attrs":{}}'><a href="#cite_note-1"><span class="mw-reflink-text">[1]</span></a></span> </h2>
25449 <ol class="references" typeof="mw:Extension/references" about="#mwt3" data-mw='{"name":"references","attrs":{}}'><li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1">↑</a></span> <span id="mw-reference-text-cite_note-1" class="mw-reference-text">bar <link rel="mw:PageProp/Category" href="./Category:Baz" /> </span></li></ol>
25450 !! wikitext
25451 == foo <ref>bar 
25452 [[Category:Baz]] </ref> ==
25454 <references />
25455 !! end
25457 !! test
25458 Parsoid: Serialize positional parameters with = in them as named parameter
25459 !! options
25460 parsoid=html2wt
25461 !! html/parsoid
25462 <p about="#mwt1" typeof="mw:Transclusion"
25463 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"f=oo"}},"i":0}}]}'>foo</p>
25465 <p about="#mwt1" typeof="mw:Transclusion"
25466 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"f=oo"}, "2":{"wt":"bar"}},"i":0}}]}'>foo</p>
25468 <!--Orig params with data-parsoid has heuristics for handling = chars-->
25469 <!--FIXME: But maybe the heuristic needs fixing to apply to new params as well-->
25470 <p data-parsoid='{"pi":[[{"k":"1"},{"k":"2"}]]}' about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"f=oo"},"2":{"wt":"bar"}},"i":0}}]}'>foo</p>
25471 !! wikitext
25472 {{echo|1=f=oo}}
25474 {{echo|1=f=oo|2=bar}}
25476 <!--Orig params with data-parsoid has heuristics for handling = chars-->
25477 <!--FIXME: But maybe the heuristic needs fixing to apply to new params as well-->
25478 {{echo|<nowiki>f=oo</nowiki>|bar}}
25479 !! end
25481 !! test
25482 Parsoid: Serialize positional parameters with = in extlink as named parameter
25483 !! options
25484 parsoid=html2wt
25485 !! html/parsoid
25486 <p><a rel="mw:ExtLink" href="http://stuff?is=ok" about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"http://stuff?is=ok"}},"i":0}}]}'>http://stuff?is=ok</a></p>
25487 !! wikitext
25488 {{echo|1=http://stuff?is=ok}}
25489 !! end
25491 !! test
25492 Parsoid: Correctly serialize block-node children when they are a combination of text and p-nodes
25493 !! options
25494 parsoid=html2wt
25495 !! html/parsoid
25496 <div>a<p>b</p></div>
25497 <div>a
25498 <p>b</p></div>
25499 <div>
25501 <p>b</p></div>
25502 !! wikitext
25503 <div>a
25505 </div>
25506 <div>a
25508 </div>
25509 <div>
25513 </div>
25514 !! end
25516 !! test
25517 Substrings resembling wikitext in hrefs should not get nowiki escapes
25518 !! options
25519 parsoid=html2wt
25520 !! html/parsoid
25521 <a rel="mw:WikiLink" href="./Foo''bar''baz">Foo''bar''baz</a>
25522 !! wikitext
25523 [[Foo''bar''baz]]
25524 !! end
25526 !! test
25527 Enforce single-line context in the serializer
25528 !! options
25529 parsoid=html2wt
25530 !! html/parsoid
25531 <h2>testing
25532 123</h2>
25534 <h2> hi <span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"bogus","href":"./Template:Bogus"},"params":{"1":{"wt":"there\nyou"}},"i":0}}]}'>there</span><span about="#mwt1">
25535 </span><span about="#mwt1">you</span> </h2>
25537 <h2> foo <span about="#mwt2" class="mw-ref" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-1"},"attrs":{}}'><a href="#cite_note-1"><span class="mw-reflink-text">[1]</span></a></span> </h2>
25539 <ol class="references" typeof="mw:Extension/references" about="#mwt3" data-mw='{"name":"references","attrs":{}}'><li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1">↑</a></span> <span id="mw-reference-text-cite_note-1" class="mw-reference-text" data-parsoid="{}">hello
25540 there</span></li></ol>
25542 <ul><li>asd
25543 sdf</li></ul>
25545 <ul><li>foo
25547 baz</li>
25548 <li>foo <b>bar</b>
25549 baz</li></ul>
25551 <dl><dt>hi
25552 ho </dt><dd data-parsoid='{"stx":"row"}'> hi
25553 ho</dd></dl>
25555 <dl><dd> <table>
25556 <tbody><tr><td> ha
25558 ha</td></tr>
25559 </tbody></table></dd></dl>
25560 !! wikitext
25561 == testing 123 ==
25563 == hi {{bogus|there
25564 you}} ==
25566 == foo <ref>hello
25567 there</ref> ==
25569 <references />
25571 * asd sdf
25573 * foo bar baz
25574 * foo '''bar''' baz
25576 ; hi ho : hi ho
25578 : {|
25579 | ha
25583 !! end
25585 !! test
25586 Serialize new placeholder space without spans
25587 !! options
25588 parsoid=html2wt
25589 !! html/parsoid
25590 <p>foo<span typeof="mw:Placeholder"> </span>: bar</p>
25592 <p>foo<span typeof="mw:DisplaySpace mw:Placeholder" data-parsoid='{"src":" ","isDisplayHack":true}'> </span>: bar</p>
25594 <span typeof="mw:Extension/ref" data-mw="{&quot;name&quot;:&quot;ref&quot;,&quot;body&quot;:{&quot;html&quot;:&quot;foo<span typeof=\&quot;mw:Placeholder\&quot;>&amp;nbsp;</span>: bar&quot;}}"><sup>[1]</sup></span>ok</p>
25595 !! wikitext
25596 foo : bar
25598 foo : bar
25600 <ref>foo : bar</ref>ok
25601 !! end
25604 #-----------------------
25605 # Tag minimization tests
25606 #-----------------------
25608 !! test
25609 1. I/B quote minimization: wikitext-only tags should be combined
25610 !! options
25611 parsoid=html2wt
25612 !! html/parsoid
25613 <p><i>A</i><i>B</i></p>
25614 <p><b>A</b><b>B</b></p>
25615 <p><i>A</i><b><i>B</i></b></p>
25616 <p><b>A</b><i><b>B</b></i></p>
25617 <p><b>A</b><i><b>B</b><b>C</b></i><b>D</b></p>
25618 <p><i><b>A</b></i><i><b>B</b></i></p>
25619 <p><i><b>A</b></i><b><i>B</i></b></p>
25620 <p><b><i>A</i></b><i><b>B</b></i></p>
25621 !! wikitext
25622 ''AB''
25624 '''AB'''
25626 ''A'''B'''''
25628 '''A''B'''''
25630 '''A''BC''D'''
25632 '''''AB'''''
25634 '''''AB'''''
25636 '''''AB'''''
25637 !! end
25639 !! test
25640 2. I/B quote minimization: wikitext and html tags should not be combined
25641 !! options
25642 parsoid=html2wt
25643 !! html/parsoid
25644 <p><i>A</i><i data-parsoid='{"stx":"html"}'>B</i></p>
25645 <p><i>A</i><b><i data-parsoid='{"stx":"html"}'>B</i></b></p>
25646 !! wikitext
25647 ''A''<i>B</i>
25649 ''A''<nowiki/>'''<i>B</i>'''
25650 !! end
25652 !! test
25653 3. I/B quote minimization: templated content stops minimization
25654 !! options
25655 parsoid=html2wt
25656 !! html/parsoid
25657 <p><i>A</i><i about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&#39;&#39;B&#39;&#39;"}},"i":0}}]}'>B</i>
25658 <p><i>A</i><b about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&#39;&#39;&#39;&#39;&#39;B&#39;&#39;&#39;&#39;&#39;"}},"i":0}}]}'><i>B</i></b>
25659 !! wikitext
25660 ''A''{{echo|''B''}}
25662 ''A''{{echo|'''''B'''''}}
25663 !! end
25665 !! test
25666 4. I/B quote minimization: new content should be mimimized with adjacent old content
25667 !! options
25668 parsoid=html2wt
25669 !! html/parsoid
25670 <p><i>A</i><i>B</i></p>
25671 <p><b>A</b><b>B</b></p>
25672 <p><i>A</i><b><i>B</i></b></p>
25673 !! wikitext
25674 ''AB''
25676 '''AB'''
25678 ''A'''B'''''
25679 !! end
25681 !! test
25682 5a. Merge adjacent quote nodes if they've been edited
25683 !! options
25684 parsoid={
25685   "modes": ["wt2wt", "selser"],
25686   "changes": [
25687     ["p", "contents", "remove", ":contains('b')"]
25688   ]
25690 !! wikitext
25691 ''a''b''c''
25692 !! wikitext/edited
25693 ''ac''
25694 !! end
25696 !! test
25697 5b. Merge adjacent quote nodes if they've been edited
25698 !! options
25699 parsoid={
25700   "modes": ["wt2wt", "selser"],
25701   "changes": [
25702     ["#x", "remove"]
25703   ]
25705 !! wikitext
25706 ''a''<span id="x">b</span>''c''
25707 !! wikitext/edited
25708 ''ac''
25709 !! end
25711 !! test
25712 1. Merge adjacent link nodes as long as at least one element is new
25713 !! options
25714 parsoid={
25715   "modes": ["html2wt"],
25716   "scrubWikitext": true
25718 !! html/parsoid
25719 <a rel="mw:WikiLink" href="./Football">Foot</a><a rel="mw:WikiLink" href="./Football">ball</a>
25720 <a data-parsoid="{}" rel="mw:WikiLink" href="./Football">Foot</a><a rel="mw:WikiLink" href="./Football">ball</a>
25721 <a data-parsoid="{}" rel="mw:WikiLink" href="./Football">Foot</a><a data-parsoid="{}" rel="mw:WikiLink" href="./Football">ball</a>
25722 !! wikitext
25723 [[Football]]
25724 [[Football]]
25725 [[Football|Foot]][[Football|ball]]
25726 !! end
25728 !! test
25729 2. Merge adjacent link nodes and enable additional normalizations
25730 !! options
25731 parsoid={
25732   "modes": ["html2wt"],
25733   "scrubWikitext": true
25735 !! html/parsoid
25736 <a rel="mw:WikiLink" href="./Football"><i>Foot</i></a><a rel="mw:WikiLink" href="./Football"><i>ball</i></a>
25737 !! wikitext
25738 [[Football|''Football'']]
25739 !! end
25741 !! test
25742 3. Don't merge adjacent link nodes if scrubWikitext is false
25743 !! options
25744 parsoid={
25745   "modes": ["html2wt"],
25746   "scrubWikitext": false
25748 !! html/parsoid
25749 <a rel="mw:WikiLink" href="./Football">Foot</a><a rel="mw:WikiLink" href="./Football">ball</a>
25750 !! wikitext
25751 [[Football|Foot]][[Football|ball]]
25752 !! end
25754 #------------------------------
25755 # End of tag minimization tests
25756 #------------------------------
25758 !!test
25759 Bug 54262: New entities
25760 !! options
25761 parsoid=html2wt
25762 !! html/parsoid
25763 <span typeof="mw:Entity">&nbsp;</span>
25764 !! wikitext
25765 &nbsp;
25766 !! end
25768 ## Note that there is no wikitext output for 'unknownproperty' ##
25769 ## Unknown magic words are silently dropped ##
25771 !! test
25772 Magic words
25773 !! options
25774 parsoid=html2wt
25775 !! html/parsoid
25776 <meta property='mw:PageProp/toc' />
25777 <meta property='mw:PageProp/notoc' />
25778 <meta property='mw:PageProp/forcetoc' />
25779 <meta property='mw:PageProp/index' />
25780 <meta property='mw:PageProp/noindex' />
25781 <meta property='mw:PageProp/nogallery' />
25782 <meta property='mw:PageProp/noeditsection' />
25783 <meta property='mw:PageProp/notitleconvert' />
25784 <meta property='mw:PageProp/nocontentconvert' />
25785 <meta property='mw:PageProp/unknownproperty' />
25786 !! wikitext
25787 __TOC__
25788 __NOTOC__
25789 __FORCETOC__
25790 __INDEX__
25791 __NOINDEX__
25792 __NOGALLERY__
25793 __NOEDITSECTION__
25794 __NOTITLECONVERT__
25795 __NOCONTENTCONVERT__
25796 !! end
25798 !! test
25799 Consecutive <pre>s should not get merged
25800 !! options
25801 parsoid=html2wt,html2html
25802 !! html/parsoid
25803 <pre>a</pre><pre>b</pre>
25805 <pre>c
25806 </pre><pre>
25807 d</pre>
25809 <pre>e
25811 </pre><pre>
25813 f</pre>
25814 !! wikitext
25828 !! end
25830 !! test
25831 Edited ISBN links not serializable as ISBN links should serialize as wikilinks
25832 !! options
25833 parsoid=html2wt
25834 !! html/parsoid
25835 <a href="./Special:BookSources/1234567890" rel="mw:ExtLink">ISBN 1234567895</a>
25836 !! wikitext
25837 [[Special:BookSources/1234567890|ISBN 1234567895]]
25838 !! end
25840 !! test
25841 Edited RFC links not serializable as RFC links should serialize as extlinks
25842 !! options
25843 parsoid=html2wt
25844 !! html/parsoid
25845 <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink">New RFC</a>
25846 !! wikitext
25847 [//tools.ietf.org/html/rfc123 New RFC]
25848 !! end
25850 !! test
25851 Edited PMID links not serializable as PMID links should serialize as extlinks
25852 !! options
25853 parsoid=html2wt
25854 !! html/parsoid
25855 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink">New PMID</a>
25856 !! wikitext
25857 [//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract New PMID]
25858 !! end
25860 !! test
25861 WTS of autolinks with trailing/surrounding context
25862 !! options
25863 parsoid=html2wt
25864 !! html/parsoid
25865 <p><a href="http://cscott.net">http://cscott.net</a><b>foo</b></p>
25866 <p><a href="http://cscott.net">http://cscott.net</a><b data-parsoid='{"stx":"html"}'>foo</b></p>
25867 <p><b><a href="http://cscott.net">http://cscott.net</a></b></p>
25868 <p><b><a href="http://cscott.net">http://cscott.net</a> </b></p>
25869 <p><b><a href="http://cscott.net">http://cscott.net</a>x</b></p>
25870 <p><a href="http://cscott.net">http://cscott.net</a>x</p>
25871 !! wikitext
25872 http://cscott.net'''foo'''
25874 http://cscott.net<b>foo</b>
25876 '''http://cscott.net'''
25878 '''http://cscott.net '''
25880 '''http://cscott.net<nowiki/>x'''
25882 http://cscott.net<nowiki/>x
25883 !! end
25885 !! test
25886 WTS of autolinks with nowikis (round-trip)
25887 !! wikitext
25888 x<nowiki/>http://cscott.net<nowiki/>x
25889 !! html/parsoid
25890 <p>x<a rel="mw:ExtLink" href="http://cscott.net">http://cscott.net</a>x</p>
25891 !! end
25893 # this is the "easy" test because it leaves in place all the
25894 # data-parsoid information indicating this is an autolink
25895 !! test
25896 WTS of autolinks with escapes (editing)
25897 !! options
25898 parsoid={
25899   "modes": ["wt2wt"],
25900   "changes": [
25901     [ "meta", "remove" ]
25902   ]
25904 !! wikitext
25905 x<nowiki/>http://cscott.net<nowiki/>x
25906 !! wikitext/edited
25907 x<nowiki/>http://cscott.net<nowiki/>x
25908 !! end
25910 !! test
25911 WTS of edited autolink-like text (T103364)
25912 !! options
25913 parsoid={
25914   "modes": ["wt2wt"],
25915   "changes": [
25916     [ "span[typeof]", "removeAttr", "typeof" ]
25917   ]
25919 !! wikitext
25920 Not a link: <nowiki>http://example.com</nowiki>.
25921 !! wikitext/edited
25922 Not a link: <span><nowiki>http://example.com</nowiki></span>.
25923 !! end
25925 !! test
25926 WTS of newly-authored autolink-like text (T103364)
25927 !! options
25928 parsoid=html2wt
25929 !! html/parsoid
25930 <p>http://example.com is not a link.</p>
25931 !! wikitext
25932 <nowiki>http://example.com</nowiki> is not a link.
25933 !! end
25935 !! test
25936 WTS of autolink-like text after an autolink (T108563)
25937 !! options
25938 parsoid=html2wt
25939 !! html/parsoid
25940 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a> http://example.com is not a link.</p>
25941 !! wikitext
25942 http://example.com <nowiki>http://example.com</nowiki> is not a link.
25943 !! end
25945 !! test
25946 Magic links inside links (not autolinked)
25947 !! wikitext
25948 [[Foo|http://example.com]]
25949 [[Foo|RFC 1234]]
25950 [[Foo|PMID 1234]]
25951 [[Foo|ISBN 123456789x]]
25953 [http://foo.com http://example.com]
25954 [http://foo.com RFC 1234]
25955 [http://foo.com PMID 1234]
25956 [http://foo.com ISBN 123456789x]
25957 !! html+tidy
25958 <p><a href="/wiki/Foo" title="Foo">http://example.com</a> <a href="/wiki/Foo" title="Foo">RFC 1234</a> <a href="/wiki/Foo" title="Foo">PMID 1234</a> <a href="/wiki/Foo" title="Foo">ISBN 123456789x</a></p>
25959 <p><a rel="nofollow" class="external text" href="http://foo.com">http://example.com</a> <a rel="nofollow" class="external text" href="http://foo.com">RFC 1234</a> <a rel="nofollow" class="external text" href="http://foo.com">PMID 1234</a> <a rel="nofollow" class="external text" href="http://foo.com">ISBN 123456789x</a></p>
25960 !! html/parsoid
25961 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">http://example.com</a>
25962 <a rel="mw:WikiLink" href="./Foo" title="Foo">RFC 1234</a>
25963 <a rel="mw:WikiLink" href="./Foo" title="Foo">PMID 1234</a>
25964 <a rel="mw:WikiLink" href="./Foo" title="Foo">ISBN 123456789x</a></p>
25966 <p><a rel="mw:ExtLink" href="http://foo.com">http://example.com</a>
25967 <a rel="mw:ExtLink" href="http://foo.com">RFC 1234</a>
25968 <a rel="mw:ExtLink" href="http://foo.com">PMID 1234</a>
25969 <a rel="mw:ExtLink" href="http://foo.com">ISBN 123456789x</a></p>
25970 !! end
25972 !! test
25973 Magic links inside image captions (autolinked)
25974 !! wikitext
25975 [[File:Foobar.jpg|thumb|http://example.com]]
25976 [[File:Foobar.jpg|thumb|RFC 1234]]
25977 [[File:Foobar.jpg|thumb|PMID 1234]]
25978 [[File:Foobar.jpg|thumb|ISBN 123456789x]]
25979 !! html+tidy
25980 <div class="thumb tright">
25981 <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>
25982 <div class="thumbcaption">
25983 <div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>
25984 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a></div>
25985 </div>
25986 </div>
25987 <div class="thumb tright">
25988 <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>
25989 <div class="thumbcaption">
25990 <div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>
25991 <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc1234">RFC 1234</a></div>
25992 </div>
25993 </div>
25994 <div class="thumb tright">
25995 <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>
25996 <div class="thumbcaption">
25997 <div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>
25998 <a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a></div>
25999 </div>
26000 </div>
26001 <div class="thumb tright">
26002 <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>
26003 <div class="thumbcaption">
26004 <div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>
26005 <a href="/wiki/Special:BookSources/123456789X" class="internal mw-magiclink-isbn">ISBN 123456789x</a></div>
26006 </div>
26007 </div>
26008 !! html/parsoid
26009 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption><a rel="mw:ExtLink" href="http://example.com">http://example.com</a></figcaption></figure>
26010 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption><a href="//tools.ietf.org/html/rfc1234" rel="mw:ExtLink">RFC 1234</a></figcaption></figure>
26011 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption><a href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract" rel="mw:ExtLink">PMID 1234</a></figcaption></figure>
26012 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption><a href="./Special:BookSources/123456789X" rel="mw:WikiLink">ISBN 123456789x</a></figcaption></figure>
26013 !! end
26015 !! test
26016 WTS of magic word text (T109371)
26017 !! options
26018 parsoid=html2wt
26019 !! html/parsoid
26020 <p>RFC 1234</p>
26021 <p><a href="http://foo.com" rel="mw:ExtLink">RFC 1234</a></p>
26022 <p><a href="./Foo" rel="mw:WikiLink">RFC 1234</a></p>
26023 !! wikitext
26024 <nowiki>RFC 1234</nowiki>
26026 [http://foo.com RFC 1234]
26028 [[Foo|RFC 1234]]
26029 !! end
26031 !! test
26032 Edited Redirect link should emit a non-piped wikitext link
26033 !! options
26034 parsoid=html2wt
26035 !! html/parsoid
26036 <link rel="mw:PageProp/redirect" href="Bar" data-parsoid='{"a":{"href":"./Foo"},"sa":{"href":"Foo"}}'>
26037 !! wikitext
26038 #REDIRECT [[Bar]]
26039 !! end
26041 !! test
26042 T75121: Infer extension name from typeOf if data-mw is not present
26043 !! options
26044 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
26045 !! html/parsoid
26046 <div typeOf="mw:Extension/foo"></div>
26047 !! wikitext
26048 <foo />
26049 !! end
26051 # Note that the <p> wrapping isn't present in PHP parser output
26052 # The important thing for this test is that P-wrapping doesn't
26053 # interfere with the <nowiki> protection for leading - in <td>
26054 # (which isn't necessary for <th>).
26055 !! test
26056 T88318: p-wrapped dash in table.
26057 !! options
26058 parsoid=html2wt,wt2wt
26059 !! html/parsoid
26060 <table><tbody>
26061 <tr><th><p>-</p></th><th><p>- </p></th></tr>
26062 <tr><td><p>-</p></td><td><p>- </p></td></tr>
26063 <tr><td><small>-</small></td><td><br/><p>-</p></td><td><br/>-</td></tr>
26064 </tbody></table>
26065 !! wikitext
26068 !- 
26070 |<nowiki>-</nowiki>
26071 |<nowiki>- </nowiki>
26073 |<small>-</small>
26074 |<br>
26076 |<br>
26079 !! html/php+tidy
26080 <table>
26081 <tr>
26082 <th>-</th>
26083 <th>-</th>
26084 </tr>
26085 <tr>
26086 <td>-</td>
26087 <td>-</td>
26088 </tr>
26089 <tr>
26090 <td><small>-</small></td>
26091 <td><br />
26092 <p>-</p>
26093 </td>
26094 <td><br />
26095 <p>-</p>
26096 </td>
26097 </tr>
26098 </table>
26099 !! end
26101 !! test
26102 HTML id attribute with Parsoid-like element ids should not be serialized to wikitext
26103 !! options
26104 parsoid=html2wt
26105 !! html/parsoid
26106 <table id='mwAb'>
26107 <td id='mwAc'>foo</td>
26108 <td id='serialize-this'>bar</td>
26109 </table>
26110 !! wikitext
26112 |foo
26113 | id="serialize-this" |bar
26115 !! end
26117 !! test
26118 Parsoid-like element ids should not be serialized to wikitext unless shadowed
26119 !! options
26120 parsoid=html2wt
26121 !! html/parsoid
26122 <div id="mwAQ" data-parsoid='{"stx":"html","a":{"id":"mwAQ"},"sa":{"id":"hello"}}'>ok</div>
26123 !! wikitext
26124 <div id="hello">ok</div>
26125 !! end
26127 !! test
26128 WTS change modes
26129 !! options
26130 parsoid={
26131   "modes": ["wt2wt"],
26132   "changes": [
26133     [ "#xyz", "before", "<b>before</b> stuff " ],
26134     [ "#xyz", "after", " stuff <i>after</i>" ],
26135     [ "#xyz", "html", "x <b>y</b> z" ]
26136   ]
26138 !! wikitext
26139 <span id="xyz">hello</span>
26140 !! wikitext/edited
26141 '''before''' stuff <span id="xyz">x '''y''' z</span> stuff ''after''
26142 !! end
26144 !! test
26145 Never serialize a-tag as html, regardless of what data-parsoid has to say
26146 !! options
26147 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
26148 !! html/parsoid
26149 <a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{"stx":"html"}'>Foo</a>
26150 !! wikitext
26151 [[Foo]]
26152 !! end
26154 ## SSS FIXME: This is broken output nevertheless.
26155 ## What might be a reasonable non-broken output for this?
26156 ## This is an edge case unlikely to be seen in production
26157 ## that I am not wasting more time on this right now.
26158 !! test
26159 Never serialize a-tag as html, no matter what attributes it has
26160 !! options
26161 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
26162 !! html/parsoid
26163 <a bad='true' href='http://boo.org'><img src='http://boohoo.org' /></a>
26164 !! wikitext
26165 [http://boo.org http://boohoo.org]
26166 !! end
26168 # Misnested is an indication that selser can reuse the source but these have
26169 # shown to sneak through on occasion. See T101768.
26170 # The original wikitext here is: [http://test.com [[one]] two three]
26171 !! test
26172 Strip span tags added to mark misnested links
26173 !! options
26174 parsoid=html2wt
26175 !! html/parsoid
26176 <p data-parsoid='{}'><a rel="mw:ExtLink" href="http://test.com" data-parsoid='{"targetOff":17,"contentOffsets":[17,34]}'></a><a rel="mw:WikiLink" href="./One" title="One" data-parsoid='{"stx":"simple","a":{"href":"./One"},"sa":{"href":"one"},"misnested":true}'>one</a><span data-parsoid='{"misnested":true}'> two three</span></p>
26177 !! wikitext
26178 [http://test.com][[one]] two three
26179 !! end
26181 !! test
26182 Use data-parsoid.firstWikitextNode to compute newline constraints for template content
26183 !! options
26184 parsoid=html2wt
26185 !! html/parsoid
26186 <span about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"pi":[[{"k":"1"}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"a"}},"i":0}}]}'>a</span><table about="#mwt2" typeof="mw:Transclusion mw:ExpandedAttrs" data-parsoid='{"a":{"{{echo|c\n{{!}}d\n}}":null},"sa":{"{{echo|c\n{{!}}d\n}}":""},"firstWikitextNode":"table","pi":[[{"k":"1"}]]}' data-mw='{"parts":["{|",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"c\n{{!}}d\n"}},"i":0}},"\n|}"]}'>
26187 <tbody><tr><td>d
26188 </td></tr>
26189 </tbody></table>
26190 !! wikitext
26191 {{echo|a}}
26192 {|{{echo|c
26193 {{!}}d
26196 !! end
26198 ## This test verifies the presence and computation of this attribute indirectly
26199 ## by making an edit and ensuring that the serialization is correct (which it would be
26200 ## only if firstWikitextNode is properly set).
26201 !! test
26202 data-parsoid.firstWikitextNode should be computed properly in the presence of fostered content
26203 !! options
26204 parsoid= {
26205   "modes": ["wt2wt"],
26206   "changes": [
26207     [ "div#x", "remove" ],
26208     [ "div", "before", "<div>new</div>" ]
26209   ]
26211 !! wikitext
26212 <div id="x">foo</div>
26214 {{echo|<div>boo</div>
26215 {{!}}b}}
26218 !! wikitext/edited
26220 <div>new</div>
26222 {{echo|<div>boo</div>
26223 {{!}}b}}
26226 !! end
26228 # --------------------------------------------
26229 # Tests spec'ing wikitext serialization norms |
26230 # --------------------------------------------
26232 !! test
26233 1. Categories should always be serialized on their own line
26234 !! options
26235 parsoid=html2wt
26236 !! html/parsoid
26237 foo<link rel="mw:PageProp/Category" href="./Category:Foo">bar
26238 !! wikitext
26240 [[Category:Foo]]
26242 !! end
26244 !! test
26245 2. Categories that are part of templates should not introduce a line break
26246 !! wikitext
26247 foo {{echo|<span>bar</span> [[Category:baz]]}} bar
26248 !! html/parsoid
26249 <p>foo <span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;span>bar&lt;/span> [[Category:baz]]"}},"i":0}}]}'>bar</span><span about="#mwt1"> </span><link rel="mw:PageProp/Category" href="./Category:Baz" about="#mwt1" data-parsoid='{"stx":"simple","a":{"href":"./Category:Baz"},"sa":{"href":"Category:baz"}}'/> bar</p>
26250 !! end
26252 # Careful while editing these next 2 tests. There are \u200f characters
26253 # before and after the <link> tags in the HTML and following some
26254 # of the categories in wikitext
26255 # Do not remove these characters in edits.
26257 # As part of the serialization, these bidi characters will get stripped.
26258 !! test
26259 RTL (\u200f) and LTR (\u200e) markers around category tags should be stripped
26260 !! options
26261 parsoid={
26262   "modes": ["html2wt"],
26263   "scrubWikitext": true
26265 !! html/parsoid
26266 <p>‏<link rel="mw:PageProp/Category" href="./קטגוריה:טקסים" />‏
26267 ‏<link rel="mw:PageProp/Category" href="./קטגוריה:_שיטות_משפט" />‏</p>
26268 !! wikitext
26269 [[קטגוריה:טקסים]]
26270 [[קטגוריה: שיטות משפט]]
26271 !! end
26273 !! test
26274 RTL (\u200f) and LTR (\u200e) markers should not be stripped if followed by a text node
26275 !! options
26276 parsoid={
26277   "modes": ["html2wt"],
26278   "scrubWikitext": true
26280 !! html/parsoid
26281 <p>‏<link rel="mw:PageProp/Category" href="./קטגוריה:טקסים" />‏y</p>
26282 !! wikitext
26283 [[קטגוריה:טקסים]]
26284 ‏y
26285 !! end
26287 !! test
26288 Lists: Add space after bullets
26289 !! options
26290 parsoid=html2wt
26291 !! html/parsoid
26292 <ul>
26293 <li>foo</li>
26294 <li> bar</li>
26295 <li><span> baz</span></li>
26296 </ul>
26297 !! wikitext
26298 * foo
26299 * bar
26300 * <span> baz</span>
26301 !! end
26303 !! test
26304 1. Headings: Add space before/after == (T53744)
26305 !! options
26306 parsoid=html2wt
26307 !! html/parsoid
26308 <h2>foo</h2>
26309 <h2> bar</h2>
26310 <h2>baz </h2>
26311 <h2><span> baz</span></h2>
26312 !! wikitext
26313 == foo ==
26315 == bar ==
26317 == baz ==
26319 == <span> baz</span> ==
26320 !! end
26322 !! test
26323 2. Headings: Add space before/after == even after hoisted content
26324 !! options
26325 parsoid={
26326   "modes": ["html2wt"],
26327   "scrubWikitext": true
26329 !! html/parsoid
26330 <h2> <link href="./Category:A2" rel="mw:PageProp/Category" />ok</h2>
26331 !! wikitext
26332  [[Category:A2]]
26334 == ok ==
26335 !! end
26337 !! test
26338 1. Headings: suppress newly created empty headings
26339 !! options
26340 parsoid={
26341   "modes": ["html2wt"],
26342   "scrubWikitext": true
26344 !! html/parsoid
26345 <h2></h2>
26346 !! wikitext
26347 !! end
26349 !! test
26350 2. Headings: don't suppress empty headings if scrubWikitext is false
26351 !! options
26352 parsoid=html2wt
26353 !! html/parsoid
26354 <h2></h2>
26355 !! wikitext
26356 ==<nowiki/>==
26357 !! end
26359 !! test
26360 3. Headings: suppress empty headings on edits
26361 !! options
26362 parsoid={
26363   "modes": ["selser"],
26364   "scrubWikitext": true,
26365   "changes": [
26366     [ "#x", "remove"]
26367   ]
26369 !! wikitext
26370 ==<span id="x">foo</span>==
26371 !! wikitext/edited
26372 !! end
26374 !! test
26375 Headings: Replace <br/> with a single whitespace char (when scrubWikitext = true)
26376 !! options
26377 parsoid={
26378   "modes": ["html2wt"],
26379   "scrubWikitext": true
26381 !! html/parsoid
26382 <h2>foo<br/>bar</h2>
26383 <h2>foo <span><br/>bar</span> baz</h2>
26384 !! wikitext
26385 == foo bar ==
26387 == foo <span> bar</span> baz ==
26388 !! end
26390 !! test
26391 Headings: Replace <br/> with a single whitespace char (when scrubWikitext = false)
26392 !! options
26393 parsoid={
26394   "modes": ["html2wt"],
26395   "scrubWikitext": false
26397 !! html/parsoid
26398 <h2>foo<br/>bar</h2>
26399 !! wikitext
26400 == foo<br> bar ==
26401 !! end
26403 !! test
26404 1. WT Quote Tags: suppress newly created empty style tags
26405 !! options
26406 parsoid={
26407   "modes": ["html2wt"],
26408   "scrubWikitext": true
26410 !! html/parsoid
26411 <i></i><b></b>
26412 !! wikitext
26413 !! end
26415 !! test
26416 2. WT Quote Tags: don't suppress empty style tags if scrubWikitext is false
26417 !! options
26418 parsoid=html2wt
26419 !! html/parsoid
26420 <i></i><b></b>
26421 !! wikitext
26422 ''<nowiki/>'''''<nowiki/>'''
26423 !! end
26425 !! test
26426 3. WT Quote Tags: suppress empty style tags on edits
26427 !! options
26428 parsoid={
26429   "modes": ["selser"],
26430   "scrubWikitext": true,
26431   "changes": [
26432     [ "#x", "remove"]
26433   ]
26435 !! wikitext
26436 '''<span id="x">foo</span>'''
26437 !! wikitext/edited
26438 !! end
26440 !! test
26441 1. Anchors: suppress newly created empty anchors
26442 !! options
26443 parsoid={
26444   "modes": ["html2wt"],
26445   "scrubWikitext": true
26447 !! html/parsoid
26448 <a rel="mw:WikiLink" href="./Test" title="Test"></a>
26449 !! wikitext
26450 !! end
26452 !! test
26453 2. Anchors: don't suppress empty anchors if scrubWikitext is false
26454 !! options
26455 parsoid={
26456   "modes": ["html2wt"],
26457   "scrubWikitext": false
26459 !! html/parsoid
26460 <a rel="mw:WikiLink" href="./Test" title="Test"></a>
26461 !! wikitext
26462 [[Test|<nowiki/>]]
26463 !! end
26465 !! test
26466 3. Anchors: suppress empty anchors on edits
26467 !! options
26468 parsoid={
26469   "modes": ["selser"],
26470   "scrubWikitext": true,
26471   "changes": [
26472     [ "#x", "remove"]
26473   ]
26475 !! wikitext
26476 [[Test|<span id="x">foo</span>]]
26477 !! wikitext/edited
26478 !! end
26480 !! test
26481 3a. Anchors: do not suppress numbered extlinks
26482 !! options
26483 parsoid={
26484   "modes": ["wt2wt"],
26485   "scrubWikitext": true
26487 !! wikitext
26488 [http://foo.com]
26489 !! html/parsoid
26490 <a rel="mw:ExtLink" href="http://foo.com"></a>
26491 !! end
26493 !! test
26494 3b. Anchors: do not suppress numbered extlinks
26495 !! options
26496 parsoid={
26497   "modes": ["wt2wt"],
26498   "scrubWikitext": true,
26499   "changes": [
26500     [ "#x", "remove"]
26501   ]
26503 !! wikitext
26504 [http://foo.com <span id="x">foo</span>]
26505 !! wikitext/edited
26506 [http://foo.com]
26507 !! end
26509 !!test
26510 Normalizations should be restricted to edited content
26511 !!options
26512 parsoid={
26513   "modes": ["selser"],
26514   "scrubWikitext": true,
26515   "changes": [
26516     [ "h1", "before", "<i></i>"]
26517   ]
26519 !!wikitext
26521 = =
26523 !!wikitext/edited
26525 = =
26527 !!end
26529 !! test
26530 1. Multiple normalizations (html2wt)
26531 !! options
26532 parsoid={
26533   "modes": ["html2wt"],
26534   "scrubWikitext": true
26536 !! html
26537 <h2><i></i></h2>
26538 <p><a href='Foo' rel='mw:WikiLink'>foo<i></i>
26539  </a><b><i></i></b>x</p>
26540 !! wikitext
26542 [[foo]]
26545 !! end
26547 !! test
26548 2. Multiple normalizations (selser)
26549 !! options
26550 parsoid={
26551   "modes": ["selser"],
26552   "scrubWikitext": true,
26553   "changes": [
26554     [ "#x", "after", "<h1><i></i></h1>\n<p> x<b></b></p>"]
26555   ]
26557 !! wikitext
26558 <span id="x">foo</span>
26559 !! wikitext/edited
26560 <span id="x">foo</span>
26563 !! end
26565 !! test
26566 1. Indent Pre Nowiki: suppress whitespace at the start of new paragraph
26567 !! options
26568 parsoid={
26569   "modes": ["html2wt"],
26570   "scrubWikitext": true
26572 !! html/parsoid
26573 <p> hi</p>
26574 <p>    hello</p>
26575 !! wikitext
26578 hello
26579 !! end
26581 !! test
26582 2. Indent Pre Nowiki: don't suppress whitespace at the start of new paragraph if scrubWikitext is false
26583 !! options
26584 parsoid=html2wt
26585 !! html/parsoid
26586 <p> hi</p>
26587 <p>    hello</p>
26588 !! wikitext
26589 <nowiki> </nowiki>hi
26591 <nowiki> </nowiki>   hello
26592 !! end
26594 !! test
26595 3. Indent Pre Nowiki: suppress whitespace after newlines in new paragraph or table cell
26596 !! options
26597 parsoid={
26598   "modes": ["html2wt"],
26599   "scrubWikitext": true
26601 !! html/parsoid
26602 <p>Foo
26603  bar
26604 baz</p>
26606 <table><tr><td>Foo
26607  bar
26608  baz bang</td></tr></table>
26610 <p><!--boo--> foo
26611  bar</p>
26613 <p> foo
26614  bar<span>boo</span></p>
26615 !! wikitext
26621 |Foo
26623 baz bang
26626 <!--boo-->foo
26630 bar<span>boo</span>
26631 !! end
26633 !! test
26634 4. Indent Pre Nowiki: suppress leading whitespace in edited paragraphs
26635 !! options
26636 parsoid={
26637   "modes": ["selser"],
26638   "scrubWikitext": true,
26639   "changes": [
26640     [ "p", "html", " a\n b" ]
26641   ]
26643 !! wikitext
26645 !! wikitext/edited
26648 !! end
26650 !! test
26651 1. New links that end in spaces
26652 !! options
26653 parsoid={
26654   "modes": ["html2wt"],
26655   "scrubWikitext": false
26657 !! html/parsoid
26658 <p><a rel="mw:WikiLink" href="./Berlin" title="Berlin">Berlin </a>is the capital of Germany.</p>
26659 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo </a><b>bar</b></p>
26660 <p><a rel="mw:WikiLink" href="./Boston" title="Boston">Boston </a> is a city.</p>
26661 !! wikitext
26662 [[Berlin ]]<nowiki/>is the capital of Germany.
26664 [[Foo ]]'''bar'''
26666 [[Boston ]] is a city.
26667 !! end
26669 !! test
26670 2. New links that end in spaces
26671 !! options
26672 parsoid={
26673   "modes": ["html2wt"],
26674   "scrubWikitext": true
26676 !! html/parsoid
26677 <p><a rel="mw:WikiLink" href="./Berlin" title="Berlin">Berlin </a>is the capital of Germany.</p>
26678 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo </a><b>bar</b></p>
26679 <p><a rel="mw:WikiLink" href="./Boston" title="Boston">Boston </a> is a city.</p>
26680 !! wikitext
26681 [[Berlin]] is the capital of Germany.
26683 [[Foo]] '''bar'''
26685 [[Boston]] is a city.
26686 !! end
26688 !! test
26689 1. Table cells with escapable prefixes
26690 !! options
26691 parsoid={
26692   "modes": ["html2wt"],
26693   "scrubWikitext": false
26695 !! html
26696 <table>
26697 <tr><td>a</td></tr>
26698 <tr><td>-</td></tr>
26699 <tr><td>+</td></tr>
26700 </table>
26701 !! wikitext
26705 |<nowiki>-</nowiki>
26707 |<nowiki>+</nowiki>
26709 !! end
26711 !! test
26712 2. Table cells with escapable prefixes
26713 !! options
26714 parsoid={
26715   "modes": ["html2wt"],
26716   "scrubWikitext": true
26718 !! html
26719 <table>
26720 <tr><td>a</td></tr>
26721 <tr><td>-</td></tr>
26722 <tr><td>+</td></tr>
26723 </table>
26724 !! wikitext
26728 | -
26730 | +
26732 !! end
26734 !! test
26735 3a. Table cells with escapable prefixes after edits
26736 !! options
26737 parsoid={
26738   "modes": ["selser"],
26739   "scrubWikitext": true,
26740   "changes": [
26741     [ "table tbody tr:first-child td:first-child", "remove"]
26742   ]
26744 !! wikitext
26746 |a||-
26748 !! wikitext/edited
26750 | -
26752 !! end
26754 !! test
26755 3b. Table cells with escapable prefixes after edits
26756 !! options
26757 parsoid={
26758   "modes": ["selser"],
26759   "scrubWikitext": true,
26760   "changes": [
26761     [ "table tbody tr:first-child td:first-child", "html", "-" ],
26762     [ "#x", "remove" ]
26763   ]
26765 !! wikitext
26767 |pqr
26768 |<span id="x">foo</span>+
26770 !! wikitext/edited
26772 | -
26773 | +
26775 !! end
26777 # FIXME: This test will fail because
26778 # normalization doesn't realize that the id attribute
26779 # will eliminate the escapable scenario
26780 !! test
26781 4a. Table cells without escapable prefixes after edits
26782 !! options
26783 parsoid={
26784   "modes": ["selser"],
26785   "scrubWikitext": true,
26786   "changes": [
26787     [ "#x", "html", "-" ]
26788   ]
26790 !! wikitext
26792 | id="x" |abcd
26794 !! wikitext/edited
26796 | id="x" |-
26798 !! end
26800 ## This tests normalizer's ability to discriminate between
26801 ## cells having identical content.
26802 !! test
26803 4b. Table cells without escapable prefixes after edits
26804 !! options
26805 parsoid={
26806   "modes": ["selser"],
26807   "scrubWikitext": true,
26808   "changes": [
26809     [ "td", "html", "-" ]
26810   ]
26812 !! wikitext
26814 |a||b
26816 !! wikitext/edited
26818 | -||-
26820 !! end
26822 ## This tests normalizer's ability to not be tripped by
26823 ## comments (and whitespace)
26824 !! test
26825 4c. Table cells without escapable prefixes after edits
26826 !! options
26827 parsoid={
26828   "modes": ["selser"],
26829   "scrubWikitext": true,
26830   "changes": [
26831     [ "table tbody tr td:first-child", "remove" ]
26832   ]
26834 !! wikitext
26837 <!--foo--> |a||-
26839 !! wikitext/edited
26842 <!--foo--> | -
26844 !! end
26846 ## This tests normalizer's ability to handle HTML cells
26847 !! test
26848 4d. Table cells without escapable prefixes after edits
26849 !! options
26850 parsoid={
26851   "modes": ["selser"],
26852   "scrubWikitext": true,
26853   "changes": [
26854     [ "td", "html", "-" ]
26855   ]
26857 !! wikitext
26858 <table>
26859 <tr><td>a</td></tr>
26860 </table>
26861 !! wikitext/edited
26862 <table>
26863 <tr><td>-</td></tr>
26864 </table>
26865 !! end
26867 ## T111151 Remove font elements without attributes
26868 !! test
26869 5a. font tags without attributes should be dropped in scrubWikitext mode
26870 !! options
26871 parsoid={
26872   "modes": ["html2wt"],
26873   "scrubWikitext": true
26875 !! html
26876 <font>foo</font>
26877 <font><font>bar</font></font>
26878 <font class="x">boo</font>
26879 !! wikitext
26882 <font class="x">boo</font>
26883 !! end
26885 !! test
26886 5b. font tags should not be dropped without scrubWikitext being enabled
26887 !! options
26888 parsoid={
26889   "modes": ["html2wt"],
26890   "scrubWikitext": false
26892 !! html
26893 <font>foo</font>
26894 !! wikitext
26895 <font>foo</font>
26896 !! end
26898 !! test
26899 Escape nowiki DOM elements
26900 !! options
26901 parsoid=html2wt
26902 !! html/parsoid
26903 <nowiki><i>foo</i></nowiki>
26904 !! wikitext
26905 &lt;nowiki&gt;''foo''&lt;/nowiki&gt;
26906 !! end
26908 # This is meant to be an interim fix while we go about figuring out
26909 # how to not introduce these trailing <nowiki/>s in the first place.
26910 !! test
26911 T115717: Strip trailing <nowiki/>s (without affecting valid uses)
26912 !! options
26913 parsoid=html2wt
26914 !! html/parsoid
26915 <p>x<meta typeof="mw:Placeholder" data-parsoid='{"src":"&lt;nowiki/>"}'/><meta typeof="mw:Placeholder" data-parsoid='{"src":"&lt;nowiki/>"}'/>
26916 y</p>
26917 <p><span about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"pi":[[{"k":"1","named":true,"spc":["\n"," "," ",""]}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;nowiki/>"}},"i":0}}]}'></span></p>
26918 <p><span about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"pi":[[{"k":"1","named":true,"spc":["\n"," "," ","\n"]}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;nowiki/>"}},"i":0}}]}'></span></p>
26919 !! wikitext
26923 {{echo|
26924 1 = <nowiki/>}}
26926 {{echo|
26927 1 = <nowiki/>
26929 !! end
26931 # ---------------------------------------------------
26932 # End of tests spec'ing wikitext serialization norms |
26933 # ---------------------------------------------------
26935 # T104032
26936 !! test
26937 Bare inline nodes not wrapped inside p-tags should be treated as p-wrapped
26938 !! options
26939 parsoid=html2wt
26940 !! html/parsoid
26941 a<p>b</p>
26942 <b>c</b><p>d</p>
26943 <table><tr>
26944 <td>a<p>b</p></td>
26945 <td><b>c</b><p>d</p></td>
26946 </tr></table>
26947 !! wikitext
26952 '''c'''
26958 |'''c'''
26961 !! end
26963 # -----------------------------------------------------------------
26964 # End of section for Parsoid-only html2wt tests for serialization
26965 # of new content
26966 # -----------------------------------------------------------------
26968 # -----------------------------------------------------------------
26969 # The following section of tests are primarily to spec behavior of
26970 # the selective serializer. All these tests have manual selser
26971 # changes. The automated selser changes for all tests handle the
26972 # wide variation of changes, but these tests here capture specs
26973 # deterministically.
26974 # ----------------------------------------------------------------
26976 ## T90517
26977 !! test
26978 Selser: New comments should not be lost
26979 !! options
26980 parsoid={
26981   "modes": ["selser"],
26982   "changes": [
26983     [ "#a", "after", "<!--c1-->" ],
26984     [ "#b", "before", "<!--c2-->" ]
26985   ]
26987 !! wikitext
26988 <span id="a">a</span>
26990 <span id="b">b</span>
26991 !! wikitext/edited
26992 <span id="a">a</span><!--c1-->
26994 <!--c2--><span id="b">b</span>
26995 !! end
26997 ## T89383
26998 !! test
26999 Selser: Check for validity of DSR before using it
27000 !! options
27001 parsoid={
27002   "modes": ["selser"],
27003   "changes": [
27004     [ "#a", "before", "<meta property='mw:PageProp/displaytitle' content='foo'>" ]
27005   ]
27007 !! wikitext
27008 <span id="a">a</span>
27009 !! wikitext/edited
27010 {{DISPLAYTITLE:foo}}
27011 <span id="a">a</span>
27012 !! end
27014 !! test
27015 1. DOMDiff: Changes to <ref> content should be looked up using id
27016 !! options
27017 parsoid={
27018   "modes": ["selser"],
27019   "changes": [
27020     ["#X", "after", "bar"],
27021     ["#Y", "after", "baz"]
27022   ]
27024 !! wikitext
27025 X <ref><span id="X">foo</span></ref>
27026 Y <ref name="a" />
27027 <references>
27028 <ref name="a"><span id="Y">foo</span></ref>
27029 </references>
27030 !! wikitext/edited
27031 X <ref><span id="X">foo</span>bar</ref>
27032 Y <ref name="a" />
27033 <references>
27034 <ref name="a"><span id="Y">foo</span>baz</ref>
27035 </references>
27036 !! end
27038 !! test
27039 2. DOMDiff: Changes to <ref> content should be looked up using id
27040 !! options
27041 parsoid={
27042   "modes": ["selser"],
27043   "changes": [
27044     ["#Z", "after", "bar"]
27045   ]
27047 !! wikitext
27048 A <ref>foo bar for a</ref>
27049 B <ref group="X" name="b" />
27051 <references />
27053 <references group="X">
27054 <ref name="b"><span id="Z">foo</span></ref>
27055 </references>
27056 !! wikitext/edited
27057 A <ref>foo bar for a</ref>
27058 B <ref group="X" name="b" />
27060 <references />
27062 <references group="X">
27063 <ref name="b"><span id="Z">foo</span>bar</ref>
27064 </references>
27065 !! end
27067 !! test
27068 Empty LI (T49673)
27069 !! wikitext
27070 * a
27073 * b
27074 !! html/php+tidy
27075 <ul>
27076 <li>a</li>
27077 <li class="mw-empty-li"></li>
27078 <li class="mw-empty-li"></li>
27079 <li>b</li>
27080 </ul>
27081 !! end