API: Fixes for AuthManager
[mediawiki.git] / tests / parser / parserTests.txt
blob910e9ae51212e2f06dbda29f6a9da1f0da9f3342
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
2273 <pre>Foo &#8594;bar</pre>
2275 !! end
2277 !! test
2278 <nowiki> and <pre> preference (first one wins)
2279 !! wikitext
2280 <pre>
2281 <nowiki>
2282 </pre>
2283 </nowiki>
2284 </pre>
2286 <nowiki>
2287 <pre>
2288 <nowiki>
2289 </pre>
2290 </nowiki>
2291 </pre>
2293 !! html/php
2294 <pre>
2295 &lt;nowiki&gt;
2296 </pre>
2297 <p>&lt;/nowiki&gt;
2298 &lt;/pre&gt;
2299 </p><p>
2300 &lt;pre&gt;
2301 &lt;nowiki&gt;
2302 &lt;/pre&gt;
2304 &lt;/pre&gt;
2305 </p>
2306 !! html/parsoid
2307 <pre data-parsoid='{"stx":"html","strippedNL":true}'>&lt;nowiki>
2308 </pre>
2309 <p><span typeof="mw:Placeholder" data-parsoid='{"src":"&lt;/nowiki>"}'>&lt;/nowiki></span>
2310 &lt;/pre></p>
2312 <p><span typeof="mw:Nowiki">
2313 &lt;pre>
2314 &lt;nowiki>
2315 &lt;/pre>
2316 </span>
2317 &lt;/pre></p>
2318 !! end
2320 !! test
2321 </pre> inside nowiki
2322 !! wikitext
2323 <nowiki></pre></nowiki>
2324 !! html
2325 <p>&lt;/pre&gt;
2326 </p>
2327 !! end
2329 # Parsoid doesn't strip empty tags, like Tidy does.
2330 !! test
2331 Empty pre; pre inside other HTML tags (bug 54946)
2332 !! options
2333 parsoid=wt2html,wt2wt
2334 !! wikitext
2337 <div><pre>
2339 </pre></div>
2340 <pre></pre>
2341 !! html/php
2342 <p>a
2343 </p>
2344 <div><pre>
2346 </pre></div>
2347 <pre></pre>
2349 !! html/php+tidy
2350 <p>a</p>
2351 <div>
2352 <pre>
2354 </pre></div>
2355 !! html/parsoid
2356 <p>a</p>
2358 <div><pre>foo
2359 </pre></div>
2360 <pre></pre>
2361 !! end
2363 !! test
2364 HTML pre followed by indent-pre
2365 !! wikitext
2366 <pre>foo</pre>
2367  bar
2368 !! html
2369 <pre>foo</pre>
2370 <pre>bar
2371 </pre>
2372 !! end
2374 # Note that tidy removes the empty <p> tags from the start and end.
2375 # Parsoid does not, by design.
2376 !!test
2377 Block tag pre
2378 !! wikitext
2379 <p><pre>foo</pre></p>
2380 !! html/php+tidy
2381 <pre>
2383 </pre>
2384 !! html/parsoid
2385 <p data-parsoid='{"stx":"html","autoInsertedEnd":true}'></p><pre data-parsoid='{"stx":"html"}'>foo</pre><p data-parsoid='{"autoInsertedStart":true,"stx":"html"}'></p>
2386 !!end
2388 !!test
2389 Templates: Indent-Pre: 1a. Templates that break a line should suppress <pre>
2390 !! wikitext
2391  {{echo|}}
2392 !! html
2394 !!end
2396 !!test
2397 Templates: Indent-Pre: 1b. Templates that break a line should suppress <pre>
2398 !! wikitext
2399  {{echo|
2400 foo}}
2401 !! html
2402 <p>foo
2403 </p>
2404 !!end
2406 !! test
2407 Templates: Indent-Pre: 1c: Wrapping should be based on expanded content
2408 !! wikitext
2409  {{echo|a
2411 !! html
2412 <pre>a
2413 </pre>
2414 <p>b
2415 </p>
2416 !!end
2418 !! test
2419 Templates: Indent-Pre: 1d: Wrapping should be based on expanded content
2420 !! wikitext
2421  {{echo|a
2427 !! html
2428 <pre>a
2429 </pre>
2430 <p>b
2432 </p>
2433 <pre>d
2434 </pre>
2435 <p>e
2436 </p>
2437 !!end
2439 !!test
2440 Templates: Indent-Pre: 1e. Wrapping should be based on expanded content
2441 !! wikitext
2442 {{echo| foo}}
2444 {{echo| foo}}{{echo| bar}}
2446 {{echo| foo}}
2447 {{echo| bar}}
2449 {{echo|<!--cmt--> foo}}
2451 <!--cmt-->{{echo| foo}}
2453 {{echo|{{echo| }}bar}}
2454 !! html
2455 <pre>foo
2456 </pre>
2457 <pre>foo bar
2458 </pre>
2459 <pre>foo
2461 </pre>
2462 <pre>foo
2463 </pre>
2464 <pre>foo
2465 </pre>
2466 <pre>bar
2467 </pre>
2468 !!end
2470 !! test
2471 Templates: Indent-Pre: 1f: Wrapping should be based on expanded content
2472 !! wikitext
2473 {{echo| }}a
2475 {{echo|
2476  }}a
2478 {{echo|
2479  b}}
2481 {{echo|a
2482  }}b
2484 {{echo|a
2485 }} b
2486 !! html
2487 <pre>a
2488 </pre>
2489 <p><br />
2490 </p>
2491 <pre>a
2492 </pre>
2493 <p><br />
2494 </p>
2495 <pre>b
2496 </pre>
2497 <p>a
2498 </p>
2499 <pre>b
2500 </pre>
2501 <p>a
2502 </p>
2503 <pre>b
2504 </pre>
2505 !!end
2507 !! test
2508 Pres with newline attributes
2509 !! wikitext
2510 <pre class="one
2511 two">hi</pre>
2512 !! html/php
2513 <pre class="one two">hi</pre>
2515 !! html/parsoid
2516 <pre class="one
2517 two" data-parsoid='{"stx":"html"}'>hi</pre>
2518 !! end
2520 !! test
2521 Things that look like <pre> tags aren't treated as such
2522 !! wikitext
2523 Barack Obama <President> of the United States
2524 <President></President>
2525 !! html
2526 <p>Barack Obama &lt;President&gt; of the United States
2527 &lt;President&gt;&lt;/President&gt;
2528 </p>
2529 !! end
2531 !! test
2532 Handle broken pre-like tags (bug 64025)
2533 !! options
2534 parsoid=wt2html
2535 !! wikitext
2536 {{echo|<pre <pre>x</pre>}}
2538 <table><pre </table>
2539 !! html/php
2540 <pre>x</pre>
2541 <table>&lt;pre </table>
2543 !! html/php+tidy
2544 <pre>
2546 </pre>
2547 <p>&lt;pre</p>
2548 !! html/parsoid
2549 <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>
2552 <p>&lt;pre </p>
2554 <table></table>
2555 !! end
2557 !! test
2558 Parsoid: handle pre with space after attribute
2559 !! options
2560 parsoid=wt2html
2561 !! wikitext
2562 <pre style="width:50%;" >{{echo|foo}}</pre>
2563 !! html/php
2564 <pre style="width:50%;">{{echo|foo}}</pre>
2566 !! html/parsoid
2567 <pre style="width:50%;">{{echo|foo}}</pre>
2568 !! end
2570 # TODO / maybe: fix wt2wt for this
2571 !! test
2572 Parsoid: Don't paragraph-wrap fosterable content
2573 !! options
2574 parsoid=wt2html
2575 !! wikitext
2577 <td></td>
2578 <td></td>
2583 !! html
2584 <table>
2586 <tbody>
2587 <tr>
2588 <td></td>
2590 <td></td></tr>
2594 </tbody></table>
2595 !! end
2597 !! test
2598 Parsoid: Don't paragraph-wrap fosterable content even if table syntax is unbalanced
2599 !! options
2600 parsoid=wt2html
2601 !! wikitext
2603 <td>
2604 <td>
2605 </td>
2610 !! html
2611 <table>
2613 <tbody>
2614 <tr>
2615 <td></td>
2617 <td>
2618 </td></tr>
2622 </tbody></table>
2623 !! end
2626 #--------------------------------------------------------------------
2627 # Transclusion parameter whitespace stripping tests
2628 # Behavior is different for positional and named parameters
2629 #--------------------------------------------------------------------
2630 !! test
2631 Templates: Strip leading and trailing whitespace from named-param values
2632 !! wikitext
2633 {{echo|1= a }}
2635 {{echo|1= {{echo|b}} }}
2637 {{echo| 1 =
2638  c }}
2640 {{echo| 1 =
2641 * d
2643 !! html
2644 <p>a
2645 </p><p>b
2646 </p><p>c
2647 </p>
2648 <ul><li> d</li></ul>
2650 !! end
2652 !! test
2653 Templates: Don't strip whitespace from positional-param values
2654 !! wikitext
2655 {{echo|a }}
2657 {{echo|{{echo|b}} }}
2659 {{echo| c 
2662 {{echo| {{echo|d}}
2665 {{echo|
2666  e}}
2668 {{echo|
2669 * f}}
2671 {{echo|
2672  }}g
2673 !! html
2674 <p>a 
2675 </p><p>b 
2676 </p>
2677 <pre>c 
2678 </pre>
2679 <p><br />
2680 </p>
2681 <pre>d
2682 </pre>
2683 <p><br />
2684 </p>
2685 <pre>e
2686 </pre>
2687 <p><br />
2688 </p>
2689 <ul><li> f</li></ul>
2690 <p><br />
2691 </p>
2692 <pre>g
2693 </pre>
2694 !! end
2696 !! test
2697 Templates: Handle empty comment-and-ws-only lines correctly
2698 !! wikitext
2699 {{echo|foo
2700 <!--should be ignored-->
2701  <!--should be ignored as well-->
2702 bar}}
2703 !! html
2704 <p>foo
2706 </p>
2707 !! end
2709 !! test
2710 Templates: Handle comments in the target
2711 !! wikitext
2712 {{echo
2713 <!-- should be ignored -->
2714 |foo}}
2716 {{echo<!-- should be ignored -->
2717 |foo}}
2719 {{echo<!-- should be ignored -->|foo}}
2721 {{<!-- should be ignored -->echo|foo}}
2722 !!html/parsoid
2723 <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>
2725 <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>
2727 <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>
2729 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo"}},"i":0}}]}'>foo</p>
2730 !!end
2732 !! test
2733 Templates: Handle comments in parameter names (bug 67657)
2734 !! wikitext
2735 {{echo|1
2736 <!-- should be ignored -->
2737 =foo}}
2739 {{echo|
2740 <!-- should be ignored -->
2741 1 = foo}}
2743 {{echo|1<!-- should be ignored -->=foo}}
2745 {{echo|<!-- should be ignored -->1=foo}}
2746 !!html/parsoid
2747 <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>
2749 <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>
2751 <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>
2753 <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>
2754 !!end
2756 !! test
2757 Templates: Other wikitext in parameter names (bug 67657)
2758 !! wikitext
2759 {{echo|''1''=foo}}
2760 !!html/parsoid
2761 <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>
2762 !!html/php
2763 <p>{{{1}}}
2764 </p>
2765 !!end
2767 #--------------------------------------------------------------------
2768 # Transclusion parameter escaping tests
2769 #--------------------------------------------------------------------
2770 !! test
2771 Templates: Parsoid parameter escaping test 1
2772 !! wikitext
2773 {{echo|[foo]|{{echo|[bar]}}}}
2774 !! html/php+tidy
2775 <p>[foo]</p>
2776 !! html/parsoid
2777 <p about="#mwt1" typeof="mw:Transclusion"
2778 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[foo]"},"2":{"wt":"{{echo|[bar]}}"}},"i":0}}]}'>[foo]</p>
2779 !! end
2781 !! test
2782 Parsoid: Pipes in external links in template parameter
2783 !! wikitext
2784 {{echo|[{{echo|http://example.com}} link]}}
2785 !! html/php+tidy
2786 <p><a rel="nofollow" class="external text" href="http://example.com">link</a></p>
2787 !! html/parsoid
2788 <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>
2789 !! end
2791 !! test
2792 Parsoid: pipe in transclusion parameter
2793 !! wikitext
2794 {{echo|http://foo.com/a&#124;b}}
2795 !! html/php+tidy
2796 <p><a rel="nofollow" class="external free" href="http://foo.com/a%7Cb">http://foo.com/a%7Cb</a></p>
2797 !! html/parsoid
2798 <p><a rel="mw:ExtLink" href="http://foo.com/a|b" about="#mwt1"
2799 typeof="mw:Transclusion"
2800 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>
2801 !! end
2803 !! test
2804 Parsoid: Pipe in external link target and content in template parameter
2805 !! options
2806 parsoid=html2wt,wt2wt
2807 !! wikitext
2808 {{echo|[http://foo.com/a&#124;b a&#124;b]}}
2809 !! html/php+tidy
2810 <p><a rel="nofollow" class="external text" href="http://foo.com/a%7Cb">a|b</a></p>
2811 !! html/parsoid
2812 <p><a rel="mw:ExtLink" href="http://foo.com/a|b" about="#mwt1"
2813 typeof="mw:Transclusion"
2814 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},
2815 "params":{"1":{"wt":"[http://foo.com/a|b a|b]"}},"i":0}}]}'>a|b</a></p>
2816 !! end
2818 !! test
2819 Parsoid: Pipe in template with nested template in external link target in template parameter (seriously)
2820 !! options
2821 parsoid
2822 !! wikitext
2823 {{echo|[{{fullurl:{{FULLPAGENAME}}|action=edit}} bar]}}
2824 !! html
2825 <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>
2826 !! end
2828 !! test
2829 Templates: Don't escape already nowiki-escaped text in template parameters
2830 !! options
2831 parsoid=html2wt,wt2wt
2832 !! wikitext
2833 {{echo|foo<nowiki>|</nowiki>bar}}
2834 {{echo|<nowiki>&lt;div&gt;</nowiki>}}
2835 {{echo|<nowiki></nowiki>}}
2836 !! html/php+tidy
2837 <p>foo|bar &lt;div&gt;</p>
2838 !! html/parsoid
2839 <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>
2840 <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>
2841 <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>
2842 </p>
2843 !! end
2845 ## Bug 52824
2846 !! test
2847 Templates: '=' char in nested transclusions should not trigger nowiki escapes or conversion to named param
2848 !! options
2849 parsoid=html2wt,wt2wt
2850 !! wikitext
2851 {{echo|{{echo|1=bar}}}}
2852 !! html/php+tidy
2853 <p>bar</p>
2854 !! html/parsoid
2855 <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>
2856 !! end
2858 ## Bug 56733
2859 !! test
2860 Templates parameters with special tokenizing behavior dont get modified because of arg escaping
2861 !! wikitext
2862 {{echo|a : b}}
2863 !! html/php+tidy
2864 <p>a&#160;: b</p>
2865 !! html/parsoid
2866 <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>
2867 !! end
2869 ## Bug T73412
2870 !! test
2871 Templates: Preserve blank parameter names
2872 !! wikitext
2873 {{echo|=foo}}
2874 !! html/php+tidy
2875 <p>{{{1}}}</p>
2876 !! html/parsoid
2877 <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"":{"wt":"foo"}},"i":0}}]}'>{{{1}}}</p>
2878 !! end
2880 !! test
2881 Templates: Preserve blank parameter names in other positions
2882 !! wikitext
2883 {{blank_param|bar|=foo}}
2884 !! html/php+tidy
2885 <p>bar foo</p>
2886 !! html/parsoid
2887 <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
2888 foo</p>
2889 !! end
2892 ### Parsoid-centric tests for testing RT edge cases for pre
2895 !!test
2896 1a. Indent-Pre and Comments
2897 !! wikitext
2899 <!--a-->
2901 !! html
2902 <pre>a
2903 </pre>
2904 <p>c
2905 </p>
2906 !!end
2908 !!test
2909 1b. Indent-Pre and Comments
2910 !! wikitext
2912  <!--a-->
2914 !! html
2915 <pre>a
2916 </pre>
2917 <p>c
2918 </p>
2919 !!end
2921 !!test
2922 1c. Indent-Pre and Comments
2923 !! wikitext
2924 <!--a-->  a
2926  <!--a--> a
2927 !! html
2928 <pre> a
2929 </pre>
2930 <pre> a
2931 </pre>
2932 !!end
2934 !!test
2935 1d. Indent-Pre and Comments
2936 (Pre-handler currently cannot distinguish between comment/ws order and normalizes them to [comment,ws] order)
2937 !! wikitext
2938 <!--a--> a
2940  <!--b-->b
2941 !! html
2942 <pre>a
2943 </pre>
2944 <pre>b
2945 </pre>
2946 !!end
2948 !!test
2949 2a. Indent-Pre and tables
2950 !! wikitext
2951  {|
2952  |-
2953  !h1!!h2
2954  |foo||bar
2955  |}
2956 !! html
2957 <table>
2959 <tr>
2960 <th>h1</th>
2961 <th>h2
2962 </th>
2963 <td>foo</td>
2964 <td>bar
2965 </td></tr></table>
2967 !!end
2969 !!test
2970 2b. Indent-Pre and tables
2971 !! wikitext
2972   {|
2973  |-
2974 |foo
2976 !! html
2977 <table>
2979 <tr>
2980 <td>foo
2981 </td></tr></table>
2983 !!end
2985 !!test
2986 2c. Indent-Pre and tables (bug 42252)
2987 !! wikitext
2989  |+ foo
2990  !  | bar
2992 !! html
2993 <table>
2994 <caption> foo
2995 </caption>
2996 <tr>
2997 <th> bar
2998 </th></tr></table>
3000 !!end
3002 !!test
3003 2d. Indent-Pre and tables
3004 !! wikitext
3006  {|
3007  | b
3008  |}
3009 !! html/php
3010 <pre>a
3011 </pre>
3012 <table>
3013 <tr>
3014 <td> b
3015 </td></tr></table>
3017 !! html/parsoid
3018 <pre>a</pre>
3019  <table>
3020  <tbody><tr><td> b</td></tr>
3021  </tbody></table>
3022 !!end
3024 !!test
3025 2e. Indent-Pre and table-line syntax
3026 !! wikitext
3028  | b
3029  | c
3030 !! html/php
3031 <pre>a
3032 | b
3033 | c
3034 </pre>
3035 !!end
3037 !!test
3038 2f. Indent-pre started by table-line syntax
3039 !! wikitext
3041  | b
3042  | c
3043 !! html/php
3044 <p>a
3045 </p>
3046 <pre>| b
3047 | c
3048 </pre>
3049 !! html/parsoid
3050 <p>a</p>
3051 <pre>
3052 | b
3053 | c</pre>
3054 !!end
3056 !!test
3057 3a. Indent-Pre and block tags (single-line html)
3058 !! wikitext
3059  a <p> foo </p>
3060  b <div> foo </div>
3061  c <blockquote> foo </blockquote>
3062  <span> foo </span>
3063 !! html
3064  a <p> foo </p>
3065  b <div> foo </div>
3066  c <blockquote> foo </blockquote>
3067 <pre><span> foo </span>
3068 </pre>
3069 !! html/parsoid
3070  <p>a </p><p data-parsoid='{"stx":"html"}'> foo </p>
3071  <p>b </p><div data-parsoid='{"stx":"html"}'> foo </div>
3072  <p>c </p><blockquote data-parsoid='{"stx":"html"}'> foo </blockquote>
3073 <pre><span> foo </span>
3074 </pre>
3075 !! html+tidy
3076 <p>a</p>
3077 <p>foo</p>
3078 <p>b</p>
3079 <div>foo</div>
3080 <p>c</p>
3081 <blockquote>
3082 <p>foo</p>
3083 </blockquote>
3084 <pre>
3085 <span> foo </span>
3086 </pre>
3087 !! end
3089 !!test
3090 3b. Indent-Pre and block tags (multi-line html)
3091 !! wikitext
3092  a <span>foo</span>
3093  b <div> foo </div>
3094 !! html
3095 <pre>a <span>foo</span>
3096 </pre>
3097  b <div> foo </div>
3099 !! html/parsoid
3100 <pre>a <span data-parsoid='{"stx":"html"}'>foo</span></pre>
3101  b <div data-parsoid='{"stx":"html"}'> foo </div>
3102 !! html+tidy
3103 <pre>
3104 a <span>foo</span>
3105 </pre>
3106 <p>b</p>
3107 <div>foo</div>
3108 !!end
3110 !!test
3111 3c. Indent-Pre and block tags (pre-content on separate line)
3112 !! wikitext
3114  foo
3115 </p>
3117 <div>
3118  foo
3119 </div>
3121 <center>
3122  foo
3123 </center>
3125 <blockquote>
3126  foo
3127 </blockquote>
3129 <blockquote>
3130 <pre>
3132 </pre>
3133 </blockquote>
3135 <table><tr><td>
3136  foo
3137 </td></tr></table>
3139 <ul><li>
3140   foo
3141 </li></ul>
3143 !! html
3145  foo
3146 </p>
3147 <div>
3148 <pre>foo
3149 </pre>
3150 </div>
3151 <center>
3152 <pre>foo
3153 </pre>
3154 </center>
3155 <blockquote>
3156 <p> foo
3157 </p>
3158 </blockquote>
3159 <blockquote>
3160 <pre>
3162 </pre>
3163 </blockquote>
3164 <table><tr><td>
3165 <pre>foo
3166 </pre>
3167 </td></tr></table>
3168 <ul><li>
3169   foo
3170 </li></ul>
3172 !!end
3174 !!test
3175 4. Indent-Pre and extension tags
3176 !! wikitext
3177  a <gallery>
3178 File:foobar.jpg
3179 </gallery>
3180 !! html
3181  a <ul class="gallery mw-gallery-traditional">
3182                 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
3183                         <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>
3184                         <div class="gallerytext">
3185                         </div>
3186                 </div></li>
3187 </ul>
3189 !! html+tidy
3190 <p>a</p>
3191 <ul class="gallery mw-gallery-traditional">
3192 <li class="gallerybox" style="width: 155px">
3193 <div style="width: 155px">
3194 <div class="thumb" style="width: 150px;">
3195 <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>
3196 </div>
3197 <div class="gallerytext"></div>
3198 </div>
3199 </li>
3200 </ul>
3201 !!end
3203 !! test
3204 Table wikitext syntax outside wiki-tables
3205 !! wikitext
3207 ! not a table heading
3208 |- not a table row
3209 | not a table cell
3210 | class="foo bar" | baz
3215 !! html
3216 <p>a
3217 ! not a table heading
3218 |- not a table row
3219 | not a table cell
3220 | class="foo bar" | baz
3225 </p>
3226 !! end
3228 !!test
3229 Render paragraphs when indent-pre is suppressed in blocklevels
3230 !! wikitext
3231 <blockquote>
3232  foo
3234  bar
3235 </blockquote>
3236 !! html
3237 <blockquote>
3238 <p> foo
3239 </p><p> bar
3240 </p>
3241 </blockquote>
3243 !!end
3245 !!test
3246 4. Multiple spaces at start-of-line
3247 !! wikitext
3248     <p> foo </p>
3249     foo
3250         {|
3251 |foo
3253 !! html
3254     <p> foo </p>
3255 <pre>   foo
3256 </pre>
3257 <table>
3258 <tr>
3259 <td>foo
3260 </td></tr></table>
3262 !!end
3264 ## NOTE: the leading white-space chars on empty line are significant
3265 !! test
3266 5a. White-space in indent-pre
3267 !! wikitext
3268  a<br />
3271 !! html
3272 <pre>a<br />
3275 </pre>
3276 !! end
3278 ## NOTE: the leading white-space chars on empty line are significant
3279 !! test
3280 5b. White-space in indent-pre
3281 !! wikitext
3288 !! html
3289 <pre>a
3295 </pre>
3296 !! end
3298 !! test
3299 5c. White-space in indent-pre
3300 !! wikitext
3301  ''a''
3302   ''b''
3303    ''c''
3304 !! html
3305 <pre><i>a</i>
3306  <i>b</i>
3307   <i>c</i>
3308 </pre>
3309 !! end
3311 !! test
3312 6. Pre-blocks should extend across lines with leading WS even when there is no wrappable content
3313 !! wikitext
3316  <!-- continue -->
3322 !! html
3323 <pre>a
3326 </pre>
3327 <pre>c
3329 </pre>
3330 <p>d
3331 </p>
3332 !! end
3334 !! test
3335 7a. Indent-pre and category links
3336 !! options
3337 parsoid=wt2html,wt2wt
3338 !! wikitext
3339  [[Category:foo]] <!-- No pre-wrapping -->
3340 {{echo| [[Category:foo]]}} <!-- No pre-wrapping -->
3341 !! html/php+tidy
3342 !! html/parsoid
3343  <link rel="mw:PageProp/Category" href="./Category:Foo"> <!-- No pre&#x2D;wrapping -->
3344 <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 -->
3345 !! end
3347 ## We used to, but no longer wt2wt this test since the default serializer
3348 ## will normalize all categories to serialize on their own line.
3349 ## This wikitext usage is going to be fairly uncommon in production and
3350 ## selser will take care of preserving formatting in those scenarios.
3351 !! test
3352 7b. Indent-pre and category links
3353 !! options
3354 parsoid=wt2html
3355 !! wikitext
3356  [[Category:foo]] a
3357  [[Category:foo]] {{echo|b}}
3358 !! html/parsoid
3359 <pre><link rel="mw:PageProp/Category" href="./Category:Foo"> a
3360  <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>
3361 !! end
3363 !! test
3364 Indent-Pre: Newlines in comments shouldn't affect sol state
3365 !! wikitext
3366 a <!--
3368 --> b
3369 !! html/php+tidy
3370 <p>a b</p>
3371 !! html/parsoid
3372 <p>a <!--
3374 --> b</p>
3375 !! end
3378 ### HTML-pre (some to spec PHP parser behavior and some Parsoid-RT-centric)
3381 !!test
3382 HTML-pre: 1. embedded newlines
3383 !! wikitext
3384 <pre>foo</pre>
3386 <pre>
3388 </pre>
3390 <pre>
3393 </pre>
3395 <pre>
3399 </pre>
3400 !! html/php+tidy
3401 <pre>
3403 </pre>
3404 <pre>
3406 </pre>
3407 <pre>
3410 </pre>
3411 <pre>
3415 </pre>
3416 !! html/parsoid
3417 <pre data-parsoid='{"stx":"html"}'>foo</pre>
3419 <pre data-parsoid='{"stx":"html","strippedNL":"\n"}'>
3421 </pre>
3423 <pre data-parsoid='{"stx":"html"}'>
3426 </pre>
3428 <pre data-parsoid='{"stx":"html"}'>
3432 </pre>
3433 !!end
3435 !! test
3436 HTML-pre: big spaces
3437 !! wikitext
3438 <pre>
3443 haha
3448 haha
3453 </pre>
3454 !! html/php+tidy
3455 <pre>
3460 haha
3465 haha
3470 </pre>
3471 !! html/parsoid
3472 <pre data-parsoid='{"stx":"html"}'>
3477 haha
3482 haha
3487 </pre>
3488 !! end
3490 !!test
3491 HTML-pre: 2: indented text
3492 !! wikitext
3493 <pre>
3494  foo
3495 </pre>
3496 !! html
3497 <pre>
3498  foo
3499 </pre>
3501 !!end
3503 !!test
3504 HTML-pre: 3: other wikitext
3505 !! wikitext
3506 <pre>
3507 * foo
3508 # bar
3509 = no-h =
3510 '' no-italic ''
3511 [[ NoLink ]]
3512 </pre>
3513 !! html/php
3514 <pre>
3515 * foo
3516 # bar
3517 = no-h =
3518 '' no-italic ''
3519 [[ NoLink ]]
3520 </pre>
3522 !! html/parsoid
3523 <pre data-parsoid='{"stx":"html","strippedNL":true}'>* foo
3524 # bar
3525 = no-h =
3526 '' no-italic ''
3527 [[ NoLink ]]
3528 </pre>
3529 !!end
3532 ### Definition lists
3534 !! test
3535 Simple definition
3536 !! wikitext
3537 ; name : Definition
3538 !! html
3539 <dl><dt> name&#160;</dt>
3540 <dd> Definition</dd></dl>
3542 !! end
3544 !! test
3545 Definition list for indentation only
3546 !! wikitext
3547 : Indented text
3548 !! html
3549 <dl><dd> Indented text</dd></dl>
3551 !! end
3553 !! test
3554 Definition list with no space
3555 !! wikitext
3556 ;name:Definition
3557 !! html
3558 <dl><dt>name</dt>
3559 <dd>Definition</dd></dl>
3561 !!end
3563 !! test
3564 Definition list with URL link
3565 !! wikitext
3566 ; http://example.com/ : definition
3567 !! html
3568 <dl><dt> <a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&#160;</dt>
3569 <dd> definition</dd></dl>
3571 !! end
3573 !! test
3574 Definition list with bracketed URL link
3575 !! wikitext
3576 ;[http://www.example.com/ Example]:Something about it
3577 !! html
3578 <dl><dt><a rel="nofollow" class="external text" href="http://www.example.com/">Example</a></dt>
3579 <dd>Something about it</dd></dl>
3581 !! end
3583 !! test
3584 Definition list with wikilink containing colon
3585 !! wikitext
3586 ; [[Help:FAQ]]: The least-read page on Wikipedia
3587 !! html
3588 <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>
3589 <dd> The least-read page on Wikipedia</dd></dl>
3591 !! end
3593 # At Brion's and JeLuF's insistence... :)
3594 !! test
3595 Definition list with news link containing colon
3596 !! wikitext
3597 ;  news:alt.wikipedia.rox: This isn't even a real newsgroup!
3598 !! html/php
3599 <dl><dt>  <a rel="nofollow" class="external free" href="news:alt.wikipedia.rox">news:alt.wikipedia.rox</a></dt>
3600 <dd> This isn't even a real newsgroup!</dd></dl>
3602 !! html/parsoid
3603 <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>
3604 !! end
3606 !! test
3607 Malformed definition list with colon
3608 !! wikitext
3609 ;  news:alt.wikipedia.rox -- don't crash or enter an infinite loop
3610 !! html
3611 <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>
3613 !! end
3615 !! test
3616 Definition lists: colon in external link text
3617 !! wikitext
3618 ; [http://www.wikipedia2.org/ Wikipedia : The Next Generation]: OK, I made that up
3619 !! html
3620 <dl><dt> <a rel="nofollow" class="external text" href="http://www.wikipedia2.org/">Wikipedia&#160;: The Next Generation</a></dt>
3621 <dd> OK, I made that up</dd></dl>
3623 !! end
3625 !! test
3626 Definition lists: colon in HTML attribute
3627 !! wikitext
3628 ;<b style="display: inline">bold</b>
3629 !! html
3630 <dl><dt><b style="display: inline">bold</b></dt></dl>
3632 !! end
3634 !! test
3635 Definition lists: self-closed tag
3636 !! wikitext
3637 ;one<br/>two : two-line fun
3638 !! html
3639 <dl><dt>one<br />two&#160;</dt>
3640 <dd> two-line fun</dd></dl>
3642 !! end
3644 !! test
3645 Bug 11748: Literal closing tags
3646 !! wikitext
3647 <dl>
3648 <dt>test 1</dt>
3649 <dd>test test test test test</dd>
3650 <dt>test 2</dt>
3651 <dd>test test test test test</dd>
3652 </dl>
3653 !! html
3654 <dl>
3655 <dt>test 1</dt>
3656 <dd>test test test test test</dd>
3657 <dt>test 2</dt>
3658 <dd>test test test test test</dd>
3659 </dl>
3661 !! end
3663 !! test
3664 Definition and unordered list using wiki syntax nested in unordered list using html tags.
3665 !! wikitext
3666 <ul><li>
3667 ; term : description
3668 * unordered
3669 </li></ul>
3670 !! html
3671 <ul><li>
3672 <dl><dt> term&#160;</dt>
3673 <dd> description</dd></dl>
3674 <ul><li> unordered</li></ul>
3675 </li></ul>
3677 !! end
3679 !! test
3681 Definition list with empty definition and following paragraph
3682 !! wikitext
3683 ; term:
3684 Paragraph text
3685 !! html
3686 <dl><dt> term</dt>
3687 <dd></dd></dl>
3688 <p>Paragraph text
3689 </p>
3690 !! end
3692 !! test
3693 Nested definition lists using html syntax
3694 !! wikitext
3695 <dl><dt>x</dt>
3696 <dd>a</dd>
3697 <dd>b</dd></dl>
3699 !! end
3701 !! test
3702 Definition Lists: No nesting: Multiple dd's
3703 !! wikitext
3707 !! html
3708 <dl><dt>x</dt>
3709 <dd>a</dd>
3710 <dd>b</dd></dl>
3712 !! end
3714 !! test
3715 Definition Lists: Indentation: Regular
3716 !! wikitext
3718 ::i2
3719 :::i3
3720 !! html
3721 <dl><dd>i1
3722 <dl><dd>i2
3723 <dl><dd>i3</dd></dl></dd></dl></dd></dl>
3725 !! end
3727 !! test
3728 Definition Lists: Indentation: Missing 1st level
3729 !! wikitext
3730 ::i2
3731 :::i3
3732 !! html
3733 <dl><dd><dl><dd>i2
3734 <dl><dd>i3</dd></dl></dd></dl></dd></dl>
3736 !! end
3738 !! test
3739 Definition Lists: Indentation: Multi-level indent
3740 !! wikitext
3741 :::i3
3742 !! html
3743 <dl><dd><dl><dd><dl><dd>i3</dd></dl></dd></dl></dd></dl>
3745 !! end
3747 !! test
3748 Definition Lists: Hacky use to indent tables
3749 !! wikitext
3750 ::{|
3751 |foo
3752 |bar
3754 this text
3755 should be left alone
3756 !! html
3757 <dl><dd><dl><dd><table>
3758 <tr>
3759 <td>foo
3760 </td>
3761 <td>bar
3762 </td></tr></table></dd></dl></dd></dl>
3763 <p>this text
3764 should be left alone
3765 </p>
3766 !! end
3768 !! test
3769 Definition Lists: Hacky use to indent tables, with comments (bug 63979)
3770 !! wikitext
3771 <!-- foo -->
3772 ::{|
3773 |foo
3774 |bar
3775 |}<!-- bar -->
3776 this text
3777 should be left alone
3778 !! html/parsoid
3779 <!-- foo -->
3780 <dl><dd><dl><dd><table><tr>
3781 <td>foo</td>
3782 <td>bar</td>
3783 </tr></table><!-- bar --></dd></dl></dd></dl>
3784 <p>this text
3785 should be left alone</p>
3786 !! end
3788 !! test
3789 Definition Lists: Hacky use to indent tables, with comment before table
3790 !! wikitext
3791 ::<!-- foo -->{|
3792 |foo
3794 !! html/parsoid
3795 <dl><dd><dl><dd><!-- foo --><table><tr>
3796 <td>foo</td>
3797 </tr></table></dd></dl></dd></dl>
3798 !! end
3800 # The trailing whitespace in this test is to catch a regression in
3801 # Parsoid after T54473.
3802 !! test
3803 Definition Lists: Hacky use to indent tables (WS-insensitive)
3804 !! wikitext
3805 : {|
3807 |} 
3808 !! html/php
3809 <dl><dd><table>
3810 <tr>
3811 <td>a
3812 </td></tr></table></dd></dl>
3814 !! html/parsoid
3815 <dl><dd> <table>
3816 <tbody><tr><td>a</td></tr>
3817 </tbody></table> </dd></dl>
3818 !! end
3820 ## The PHP parser treats : items (dd) without a corresponding ; item (dt)
3821 ## as an empty dt item.  It also ignores all but the last ";" when followed
3822 ## by ":" later on.  So, ";" are not ignored in ";;;t3" but are ignored  in
3823 ## ";;;t3 :d1".  So, PHP parser behavior is a little inconsistent wrt multiple
3824 ## ";"s.
3826 ## Ex: ";;t2 ::d2" is transformed into:
3828 ## <dl>
3829 ##   <dt>t2 </dt>
3830 ##   <dd>
3831 ##     <dl>
3832 ##       <dt></dt>
3833 ##       <dd>d2</dd>
3834 ##     </dl>
3835 ##   </dd>
3836 ## </dl>
3838 ## But, Parsoid treats "; :" as a tight atomic unit and excess ":" as plain text
3839 ## So, the same wikitext above (;;t2 ::d2) is transformed into:
3841 ## <dl>
3842 ##   <dt>
3843 ##     <dl>
3844 ##       <dt>t2 </dt>
3845 ##       <dd>:d2</dd>
3846 ##     </dl>
3847 ##    </dt>
3848 ## </dl>
3850 ## All Parsoid only definition list tests have this difference.
3852 ## See also: https://phabricator.wikimedia.org/T8569
3853 ## and http://lists.wikimedia.org/pipermail/wikitext-l/2011-November/000483.html
3855 !! test
3856 Table / list interaction: indented table with lists in table contents
3857 !! wikitext
3860 | a
3861 * b
3863 | c
3864 * d
3866 !! html
3867 <dl><dd><table>
3869 <tr>
3870 <td> a
3871 <ul><li> b</li></ul>
3872 </td></tr>
3873 <tr>
3874 <td> c
3875 <ul><li> d</li></ul>
3876 </td></tr></table></dd></dl>
3878 !! end
3880 !!test
3881 Table / list interaction: lists nested in tables nested in indented lists
3882 !! wikitext
3894 !! html
3895 <dl><dd><table>
3896 <tr>
3897 <td>
3898 <dl><dd>a</dd>
3899 <dd>b</dd></dl>
3900 </td>
3901 <td>
3902 <ul><li>c</li>
3903 <li>d</li></ul>
3904 </td></tr></table></dd></dl>
3905 <ul><li>e</li>
3906 <li>f</li></ul>
3908 !!end
3910 !! test
3911 Definition Lists: Nesting: Multi-level (Parsoid only)
3912 !! options
3913 parsoid
3914 !! wikitext
3915 ;t1 :d1
3916 ;;t2 ::d2
3917 ;;;t3 :::d3
3918 !! html
3919 <dl>
3920   <dt>t1 </dt>
3921   <dd>d1</dd>
3922   <dt>
3923     <dl>
3924       <dt>t2 </dt>
3925       <dd>:d2</dd>
3926       <dt>
3927         <dl>
3928           <dt>t3 </dt>
3929           <dd>::d3</dd>
3930         </dl>
3931       </dt>
3932     </dl>
3933   </dt>
3934 </dl>
3937 !! end
3940 !! test
3941 Definition Lists: Nesting: Test 2 (Parsoid only)
3942 !! wikitext
3944 ::d2
3945 !! html/php+tidy
3946 <dl>
3947 <dt>t1</dt>
3948 <dd>
3949 <dl>
3950 <dd>d2</dd>
3951 </dl>
3952 </dd>
3953 </dl>
3954 !! html/parsoid
3955 <dl>
3956   <dt>t1</dt>
3957   <dd>
3958     <dl>
3959       <dd>d2</dd>
3960     </dl>
3961   </dd>
3962 </dl>
3964 !! end
3967 !! test
3968 Definition Lists: Nesting: Test 3 (Parsoid only)
3969 !! wikitext
3970 :;t1
3971 ::::d2
3972 !! html/php+tidy
3973 <dl>
3974 <dd>
3975 <dl>
3976 <dt>t1</dt>
3977 <dd>
3978 <dl>
3979 <dd>
3980 <dl>
3981 <dd>d2</dd>
3982 </dl>
3983 </dd>
3984 </dl>
3985 </dd>
3986 </dl>
3987 </dd>
3988 </dl>
3989 !! html/parsoid
3990 <dl>
3991   <dd>
3992     <dl>
3993       <dt>t1</dt>
3994       <dd>
3995         <dl>
3996           <dd>
3997             <dl>
3998               <dd>d2</dd>
3999             </dl>
4000           </dd>
4001         </dl>
4002       </dd>
4003     </dl>
4004   </dd>
4005 </dl>
4007 !! end
4010 !! test
4011 Definition Lists: Nesting: Test 4
4012 !! wikitext
4013 ::;t3
4014 :::d3
4015 !! html
4016 <dl><dd><dl><dd><dl><dt>t3</dt>
4017 <dd>d3</dd></dl></dd></dl></dd></dl>
4019 !! end
4022 ## The Parsoid team believes the following three test exposes a
4023 ## bug in the PHP parser.  (Parsoid team thinks the PHP parser is
4024 ## wrong to close the <dl> after the <dt> containing the <ul>.)
4025 ## It also exposes a "misfeature" in tidy, which doesn't like
4026 ## <dl> tags with a single <dt> child; it converts the <dt> into
4027 ## a <dd> in that case.  (Parsoid leaves the <dt> alone!)
4028 !! test
4029 Definition Lists: Mixed Lists: Test 1
4030 !! wikitext
4031 :;* foo
4032 ::* bar
4033 :; baz
4034 !! html/php
4035 <dl><dd><dl><dt><ul><li> foo</li>
4036 <li> bar</li></ul></dt></dl>
4037 <dl><dt> baz</dt></dl></dd></dl>
4039 !! html/php+tidy
4040 <dl>
4041 <dd>
4042 <dl>
4043 <dd>
4044 <ul>
4045 <li>foo</li>
4046 <li>bar</li>
4047 </ul>
4048 </dd>
4049 </dl>
4050 <dl>
4051 <dt>baz</dt>
4052 </dl>
4053 </dd>
4054 </dl>
4055 !! html/parsoid
4056 <dl>
4057 <dd><dl>
4058 <dt><ul>
4059 <li> foo
4060 </li>
4061 </ul></dt>
4062 <dd><ul>
4063 <li> bar
4064 </li>
4065 </ul></dd>
4066 <dt> baz</dt>
4067 </dl></dd>
4068 </dl>
4069 !! end
4071 !! test
4072 Definition Lists: Mixed Lists: Test 2
4073 !! wikitext
4074 *: d1
4075 *: d2
4076 !! html
4077 <ul><li><dl><dd> d1</dd>
4078 <dd> d2</dd></dl></li></ul>
4080 !! end
4083 !! test
4084 Definition Lists: Mixed Lists: Test 3
4085 !! wikitext
4086 *::: d1
4087 *::: d2
4088 !! html
4089 <ul><li><dl><dd><dl><dd><dl><dd> d1</dd>
4090 <dd> d2</dd></dl></dd></dl></dd></dl></li></ul>
4092 !! end
4095 !! test
4096 Definition Lists: Mixed Lists: Test 4
4097 !! wikitext
4098 *;d1 :d2
4099 *;d3 :d4
4100 !! html
4101 <ul><li><dl><dt>d1&#160;</dt>
4102 <dd>d2</dd>
4103 <dt>d3&#160;</dt>
4104 <dd>d4</dd></dl></li></ul>
4106 !! end
4109 !! test
4110 Definition Lists: Mixed Lists: Test 5
4111 !! wikitext
4112 *:d1
4113 *:: d2
4114 !! html
4115 <ul><li><dl><dd>d1
4116 <dl><dd> d2</dd></dl></dd></dl></li></ul>
4118 !! end
4121 !! test
4122 Definition Lists: Mixed Lists: Test 6
4123 !! wikitext
4124 #*:d1
4125 #*::: d3
4126 !! html
4127 <ol><li><ul><li><dl><dd>d1
4128 <dl><dd><dl><dd> d3</dd></dl></dd></dl></dd></dl></li></ul></li></ol>
4130 !! end
4133 !! test
4134 Definition Lists: Mixed Lists: Test 7
4135 !! wikitext
4136 :* d1
4137 :* d2
4138 !! html
4139 <dl><dd><ul><li> d1</li>
4140 <li> d2</li></ul></dd></dl>
4142 !! end
4145 !! test
4146 Definition Lists: Mixed Lists: Test 8
4147 !! wikitext
4148 :* d1
4149 ::* d2
4150 !! html
4151 <dl><dd><ul><li> d1</li></ul>
4152 <dl><dd><ul><li> d2</li></ul></dd></dl></dd></dl>
4154 !! end
4157 !! test
4158 Definition Lists: Mixed Lists: Test 9
4159 !! wikitext
4160 *;foo :bar
4161 !! html
4162 <ul><li><dl><dt>foo&#160;</dt>
4163 <dd>bar</dd></dl></li></ul>
4165 !! end
4168 !! test
4169 Definition Lists: Mixed Lists: Test 10
4170 !! wikitext
4171 *#;foo :bar
4172 !! html
4173 <ul><li><ol><li><dl><dt>foo&#160;</dt>
4174 <dd>bar</dd></dl></li></ol></li></ul>
4176 !! end
4178 # The Parsoid team disagrees with the PHP parser's seemingly-random
4179 # rules regarding dd/dt on the next two tests.  Parsoid is more
4180 # consistent, and recognizes the shared nesting and keeps the
4181 # still-open tags around until the nesting is complete.
4182 # (And tidy again converts <dt> to <dd> before 'bar'.)
4184 !! test
4185 Definition Lists: Mixed Lists: Test 11
4186 !! wikitext
4187 *#*#;*;;foo :bar
4188 *#*#;boo :baz
4189 !! html/php
4190 <ul><li><ol><li><ul><li><ol><li><dl><dt>foo&#160;</dt>
4191 <dd><ul><li><dl><dt><dl><dt>bar</dt></dl></dd></dl></li></ul></dd></dl>
4192 <dl><dt>boo&#160;</dt>
4193 <dd>baz</dd></dl></li></ol></li></ul></li></ol></li></ul>
4195 !! html/php+tidy
4196 <ul>
4197 <li>
4198 <ol>
4199 <li>
4200 <ul>
4201 <li>
4202 <ol>
4203 <li>
4204 <dl>
4205 <dt>foo&#160;</dt>
4206 <dd>
4207 <ul>
4208 <li>
4209 <dl>
4210 <dd>
4211 <dl>
4212 <dt>bar</dt>
4213 </dl>
4214 </dd>
4215 </dl>
4216 </li>
4217 </ul>
4218 </dd>
4219 </dl>
4220 <dl>
4221 <dt>boo&#160;</dt>
4222 <dd>baz</dd>
4223 </dl>
4224 </li>
4225 </ol>
4226 </li>
4227 </ul>
4228 </li>
4229 </ol>
4230 </li>
4231 </ul>
4232 !! html/parsoid
4233 <ul>
4234 <li>
4235 <ol>
4236 <li>
4237 <ul>
4238 <li>
4239 <ol>
4240 <li>
4241 <dl>
4242 <dt>
4243 <ul>
4244 <li>
4245 <dl>
4246 <dt>
4247 <dl>
4248 <dt>foo<span typeof="mw:Placeholder" data-parsoid='{"src":" "}'>&nbsp;</span></dt>
4249 <dd data-parsoid='{"stx":"row"}'>bar</dd>
4250 </dl></dt>
4251 </dl></li>
4252 </ul></dt>
4253 <dt>boo<span typeof="mw:Placeholder" data-parsoid='{"src":" "}'>&nbsp;</span></dt>
4254 <dd data-parsoid='{"stx":"row"}'>baz</dd>
4255 </dl></li>
4256 </ol></li>
4257 </ul></li>
4258 </ol></li>
4259 </ul>
4260 !! end
4263 # Another case where tidy converts a <dt> to a <dd> (but Parsoid doesn't).
4264 # From whitelist:
4265 # * The test is wrong, there are two colons where there should be :;
4266 # * The PHP parser is wrong to close the <dl> after the <dt> containing the <ul>.
4267 !! test
4268 Definition Lists: Weird Ones: Test 1
4269 !! wikitext
4270 *#;*::;; foo : bar (who uses this?)
4271 !! html/php
4272 <ul><li><ol><li><dl><dt> foo&#160;</dt>
4273 <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>
4275 !! html/php+tidy
4276 <ul>
4277 <li>
4278 <ol>
4279 <li>
4280 <dl>
4281 <dt>foo&#160;</dt>
4282 <dd>
4283 <ul>
4284 <li>
4285 <dl>
4286 <dd>
4287 <dl>
4288 <dd>
4289 <dl>
4290 <dd>
4291 <dl>
4292 <dt>bar (who uses this?)</dt>
4293 </dl>
4294 </dd>
4295 </dl>
4296 </dd>
4297 </dl>
4298 </dd>
4299 </dl>
4300 </li>
4301 </ul>
4302 </dd>
4303 </dl>
4304 </li>
4305 </ol>
4306 </li>
4307 </ul>
4308 !! html/parsoid
4309 <ul>
4310 <li>
4311 <ol>
4312 <li>
4313 <dl>
4314 <dt>
4315 <ul>
4316 <li>
4317 <dl>
4318 <dd>
4319 <dl>
4320 <dd>
4321 <dl>
4322 <dt>
4323 <dl>
4324 <dt> foo<span typeof="mw:DisplaySpace mw:Placeholder" data-parsoid='{"src":" ","isDisplayHack":true}'> </span></dt>
4325 <dd data-parsoid='{"stx":"row"}'> bar (who uses this?)</dd>
4326 </dl></dt>
4327 </dl></dd>
4328 </dl></dd>
4329 </dl></li>
4330 </ul></dt>
4331 </dl></li>
4332 </ol></li>
4333 </ul>
4334 !! end
4336 !! test
4337 Definition Lists: colons occurring in tags
4338 !! wikitext
4339 ;a:b
4340 ;'''a:b'''
4341 ;<i>a:b</i>
4342 ;<span>a:b</span>
4343 ;<div>a:b</div>
4344 ;<div>a
4345 :b</div>
4346 ;{{echo|a:b}}
4347 ;{{echo|''a:b''}}
4348 ;;;''a:b''
4349 !! html+tidy
4350 <dl>
4351 <dt>a</dt>
4352 <dd>b</dd>
4353 <dt><b>a:b</b></dt>
4354 <dt><i>a:b</i></dt>
4355 <dt><span>a:b</span></dt>
4356 <dd>
4357 <div>a:b</div>
4358 </dd>
4359 <dd>
4360 <div>a
4361 <dl>
4362 <dd>b</dd>
4363 </dl>
4364 </div>
4365 </dd>
4366 <dt>a</dt>
4367 <dd>b</dd>
4368 <dt><i>a:b</i></dt>
4369 </dl>
4370 <dl>
4371 <dd>
4372 <dl>
4373 <dd>
4374 <dl>
4375 <dt><i>a:b</i></dt>
4376 </dl>
4377 </dd>
4378 </dl>
4379 </dd>
4380 </dl>
4381 !! html/parsoid
4382 <dl><dt>a</dt><dd data-parsoid='{"stx":"row"}'>b</dd>
4383 <dt><b>a:b</b></dt>
4384 <dt><i data-parsoid='{"stx":"html"}'>a:b</i></dt>
4385 <dt><span data-parsoid='{"stx":"html"}'>a:b</span></dt>
4386 <dt><div data-parsoid='{"stx":"html"}'>a:b</div></dt>
4387 <dt><div data-parsoid='{"stx":"html","autoInsertedEnd":true}'>a</div></dt>
4388 <dd>b</dd>
4389 <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>
4390 <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>
4391 <dl><dt><dl><dt><i>a:b</i></dt></dl></dt></dl></dt></dl>
4392 !! end
4394 !! test
4395 Definition Lists: colons and tables 1
4396 !! wikitext
4398 | x
4401 | y
4403 !! html
4404 <dl><dd><table>
4405 <tr>
4406 <td> x
4407 </td></tr></table></dd></dl>
4408 <dl><dd><table>
4409 <tr>
4410 <td> y
4411 </td></tr></table></dd></dl>
4413 !! end
4415 # Parsoid's output (as documented below) differs from php's in this case.
4416 # This is probably a bug. If we fixup parsoid to match php's output, the
4417 # above test should pass and the below test case can be removed. It is
4418 # unclear which output is more desirable.
4420 !! test
4421 Definition Lists: colons and tables 2
4422 !! wikitext
4424 | x
4427 | y
4429 !! html/parsoid
4430 <dl><dd><table>
4431 <tr>
4432 <td> x
4433 </td></tr></table></dd>
4434 <dd><table>
4435 <tr>
4436 <td> y
4437 </td></tr></table></dd></dl>
4438 !! end
4440 !! test
4441 Definition Lists: template interaction
4442 !! wikitext
4443 ::{{definition_list}}
4445 :one
4446 ::{{definition_list}}
4447 :::two
4448 :::three
4449 ::four
4450 !! html/parsoid
4451 <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">
4452 </span><dd about="#mwt1">two</dd></dl></dd></dl>
4454 <dl><dd data-parsoid='{}'>one
4455 <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">
4456 </span><dd about="#mwt2">two
4457 <dl><dd>two</dd>
4458 <dd>three</dd></dl></dd>
4459 <dd data-parsoid='{}'>four</dd></dl></dd></dl>
4460 !! end
4464 ### External links
4466 !! test
4467 External links: non-bracketed
4468 !! wikitext
4469 Non-bracketed: http://example.com
4470 !! html
4471 <p>Non-bracketed: <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4472 </p>
4473 !! end
4475 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
4476 !! test
4477 External links: numbered
4478 !! wikitext
4479 Numbered: [http://example.com]
4480 Numbered: [http://example.net]
4481 Numbered: [http://example.com]
4482 !! html/php
4483 <p>Numbered: <a rel="nofollow" class="external autonumber" href="http://example.com">[1]</a>
4484 Numbered: <a rel="nofollow" class="external autonumber" href="http://example.net">[2]</a>
4485 Numbered: <a rel="nofollow" class="external autonumber" href="http://example.com">[3]</a>
4486 </p>
4487 !! html/parsoid
4488 <p>Numbered: <a rel="mw:ExtLink" href="http://example.com"></a>
4489 Numbered: <a rel="mw:ExtLink" href="http://example.net"></a>
4490 Numbered: <a rel="mw:ExtLink" href="http://example.com"></a></p>
4491 !!end
4493 !! test
4494 External links: specified text
4495 !! wikitext
4496 Specified text: [http://example.com link]
4497 !! html
4498 <p>Specified text: <a rel="nofollow" class="external text" href="http://example.com">link</a>
4499 </p>
4500 !!end
4502 !! test
4503 External links: trail
4504 !! wikitext
4505 Linktrails should not work for external links: [http://example.com link]s
4506 !! html
4507 <p>Linktrails should not work for external links: <a rel="nofollow" class="external text" href="http://example.com">link</a>s
4508 </p>
4509 !! end
4511 !! test
4512 External links: dollar sign in URL
4513 !! wikitext
4514 http://example.com/1$2345
4515 !! html
4516 <p><a rel="nofollow" class="external free" href="http://example.com/1$2345">http://example.com/1$2345</a>
4517 </p>
4518 !! end
4520 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
4521 !! test
4522 External links: dollar sign in URL (autonumber)
4523 !! wikitext
4524 [http://example.com/1$2345]
4525 !! html/php
4526 <p><a rel="nofollow" class="external autonumber" href="http://example.com/1$2345">[1]</a>
4527 </p>
4528 !! html/parsoid
4529 <p><a rel="mw:ExtLink" href="http://example.com/1$2345"></a></p>
4530 !!end
4532 !! test
4533 External links: open square bracket forbidden in URL (bug 4377)
4534 !! options
4535 parsoid=wt2html,wt2wt,html2html
4536 !! wikitext
4537 http://example.com/1[2345
4538 !! html/php
4539 <p><a rel="nofollow" class="external free" href="http://example.com/1">http://example.com/1</a>[2345
4540 </p>
4541 !! html/parsoid
4542 <p><a rel="mw:ExtLink" href="http://example.com/1">http://example.com/1</a>[2345</p>
4543 !! end
4545 !! test
4546 External links: open square bracket forbidden in URL (named) (bug 4377)
4547 !! options
4548 parsoid=wt2html,html2html
4549 !! wikitext
4550 [http://example.com/1[2345]
4551 !! html/php
4552 <p><a rel="nofollow" class="external text" href="http://example.com/1">[2345</a>
4553 </p>
4554 !! html/parsoid
4555 <p><a rel="mw:ExtLink" href="http://example.com/1">[2345</a></p>
4556 !!end
4558 # parsoid adds a space before the link name
4559 !! test
4560 External links: open square bracket forbidden in URL (named) (bug 4377)
4561 Parsoid variant.
4562 !! wikitext
4563 [http://example.com/1 [2345]
4564 !! html
4565 <p><a rel="nofollow" class="external text" href="http://example.com/1">[2345</a>
4566 </p>
4567 !!end
4569 !! test
4570 External links: nowiki in URL link text (bug 6230)
4571 !! wikitext
4572 [http://example.com/ <nowiki>''example site''</nowiki>]
4573 !! html
4574 <p><a rel="nofollow" class="external text" href="http://example.com/">''example site''</a>
4575 </p>
4576 !! end
4578 !! test
4579 External links: newline forbidden in text (bug 6230 regression check)
4580 !! wikitext
4581 [http://example.com/ first
4582 second]
4583 !! html
4584 <p>[<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a> first
4585 second]
4586 </p>
4587 !!end
4589 !! test
4590 External links: Pipe char between url and text
4591 !! wikitext
4592 [http://example.com | link]
4593 !! html
4594 <p><a rel="nofollow" class="external text" href="http://example.com">| link</a>
4595 </p>
4596 !!end
4598 !! test
4599 External links: protocol-relative URL in brackets
4600 !! wikitext
4601 [//example.com/ Test]
4602 !! html
4603 <p><a rel="nofollow" class="external text" href="//example.com/">Test</a>
4604 </p>
4605 !! end
4607 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
4608 !! test
4609 External links: protocol-relative URL in brackets without text
4610 !! wikitext
4611 [//example.com]
4612 !! html/php
4613 <p><a rel="nofollow" class="external autonumber" href="//example.com">[1]</a>
4614 </p>
4615 !! html/parsoid
4616 <p><a rel="mw:ExtLink" href="//example.com"></a></p>
4617 !! end
4619 !! test
4620 External links: protocol-relative URL in free text is left alone
4621 !! wikitext
4622 //example.com/Foo
4623 !! html
4624 <p>//example.com/Foo
4625 </p>
4626 !!end
4628 !! test
4629 External links: protocol-relative URL in the middle of a word is left alone (bug 30269)
4630 !! wikitext
4631 foo//example.com/Foo
4632 !! html
4633 <p>foo//example.com/Foo
4634 </p>
4635 !! end
4637 !! test
4638 External links: with no contents
4639 !! wikitext
4640 [http://en.wikipedia.org/wiki/Foo]
4642 [[wikipedia:Foo|Bar]]
4644 [[wikipedia:Foo|<span>Bar</span>]]
4645 !! html/php
4646 <p><a rel="nofollow" class="external autonumber" href="http://en.wikipedia.org/wiki/Foo">[1]</a>
4647 </p><p><a href="http://en.wikipedia.org/wiki/Foo" class="extiw" title="wikipedia:Foo">Bar</a>
4648 </p><p><a href="http://en.wikipedia.org/wiki/Foo" class="extiw" title="wikipedia:Foo"><span>Bar</span></a>
4649 </p>
4650 !! html/parsoid
4651 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo"></a></p>
4652 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo" title="wikipedia:Foo">Bar</a></p>
4653 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo" title="wikipedia:Foo"><span>Bar</span></a></p>
4654 !! end
4656 !! test
4657 External links: Free with trailing punctuation
4658 !! wikitext
4659 http://example.com,
4660 http://example.com;
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/url_with_(brackets)
4668 (http://example.com/url_without_brackets)
4669 http://example.com/url_with_entity&amp;
4670 http://example.com/url_with_entity&#x26;
4671 http://example.com/url_with_entity&#038;
4672 http://example.com/url_with_entity&nbsp;
4673 http://example.com/url_with_entity&#xA0;
4674 http://example.com/url_with_entity&#160;
4675 http://example.com/url_with_entity&lt;
4676 http://example.com/url_with_entity&#x3C;
4677 http://example.com/url_with_entity&#60;
4678 !! html/php
4679 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>,
4680 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>;
4681 <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/url_with_(brackets)">http://example.com/url_with_(brackets)</a>
4688 (<a rel="nofollow" class="external free" href="http://example.com/url_without_brackets">http://example.com/url_without_brackets</a>)
4689 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
4690 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</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">http://example.com/url_with_entity</a>&#160;
4693 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&#xa0;
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>&lt;
4696 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&#x3c;
4697 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&#60;
4698 </p>
4699 !! html/parsoid
4700 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a>,
4701 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>;
4702 <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/url_with_(brackets)">http://example.com/url_with_(brackets)</a>
4709 (<a rel="mw:ExtLink" href="http://example.com/url_without_brackets">http://example.com/url_without_brackets</a>)
4710 <a rel="mw:ExtLink" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
4711 <a rel="mw:ExtLink" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</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">http://example.com/url_with_entity</a><span typeof="mw:Entity" data-parsoid='{"src":"&amp;nbsp;","srcContent":" "}'> </span>
4714 <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>
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;#160;","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;lt;","srcContent":"&lt;"}'>&lt;</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;#x3C;","srcContent":"&lt;"}'>&lt;</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;#60;","srcContent":"&lt;"}'>&lt;</span></p>
4719 !! end
4721 !! test
4722 External links: tricky Parsoid html2html case
4723 !! options
4724 parsoid=wt2html,wt2wt,html2html
4725 !! wikitext
4726 http://example.com/url_with_entity&amp;amp;
4727 !! html/php
4728 <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>;
4729 </p>
4730 !! html/parsoid
4731 <p><a rel="mw:ExtLink" href="http://example.com/url_with_entity&amp;amp">http://example.com/url_with_entity&amp;amp</a>;</p>
4732 !! end
4734 !! test
4735 External links: Free with trailing quotes (T113666)
4736 !! wikitext
4737 '''News:''' Stuff here
4739 news:'a'b''c''d e
4740 !! html/php
4741 <p><b>News:</b> Stuff here
4742 </p><p><a rel="nofollow" class="external free" href="news:'a'b">news:'a'b</a><i>c</i>d e
4743 </p>
4744 !! html/parsoid
4745 <p><b>News:</b> Stuff here</p>
4746 <p><a rel="mw:ExtLink" href="news:'a'b">news:'a'b</a><i>c</i>d e</p>
4747 !! end
4749 !! test
4750 External links: Lone protocols are never linked (T105697)
4751 !! wikitext
4752 http://
4753 http://;
4754 (http://)
4755 bitcoin:
4756 bitcoin:;
4757 (bitcoin:)
4758 !! html
4759 <p>http://
4760 http://;
4761 (http://)
4762 bitcoin:
4763 bitcoin:;
4764 (bitcoin:)
4765 </p>
4766 !! end
4768 !! test
4769 External links: No preceding word characters allowed (bug 65278)
4770 !! wikitext
4771 NOPEhttp://example.com
4772 N0http://example.com
4773 ok:http://example.com
4774 ok-http://example.com
4775 !! html
4776 <p>NOPEhttp://example.com
4777 N0http://example.com
4778 ok:<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4779 ok-<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4780 </p>
4781 !! end
4783 !! test
4784 External image
4785 !! wikitext
4786 External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
4787 !! html
4788 <p>External image: <img src="http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png"/>
4789 </p>
4790 !! end
4792 !! test
4793 External image from https
4794 !! wikitext
4795 External image from https: https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
4796 !! html
4797 <p>External image from https: <img src="https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png"/>
4798 </p>
4799 !! end
4801 !! test
4802 External image (when not allowed)
4803 !! options
4804 wgAllowExternalImages=0
4805 !! wikitext
4806 External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
4807 !! html
4808 <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>
4809 </p>
4810 !! end
4812 !! test
4813 Link to non-http image, no img tag
4814 !! wikitext
4815 Link to non-http image, no img tag: ftp://example.com/test.jpg
4816 !! html
4817 <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>
4818 </p>
4819 !! end
4821 !! test
4822 External links: terminating separator
4823 !! wikitext
4824 Terminating separator: http://example.com/thing,
4825 !! html
4826 <p>Terminating separator: <a rel="nofollow" class="external free" href="http://example.com/thing">http://example.com/thing</a>,
4827 </p>
4828 !! end
4830 !! test
4831 External links: intervening separator
4832 !! wikitext
4833 Intervening separator: http://example.com/1,2,3
4834 !! html
4835 <p>Intervening separator: <a rel="nofollow" class="external free" href="http://example.com/1,2,3">http://example.com/1,2,3</a>
4836 </p>
4837 !! end
4839 !! test
4840 External links: old bug with URL in query
4841 !! wikitext
4842 Old bug with URL in query: [http://example.com/thing?url=http://example.com link]
4843 !! html
4844 <p>Old bug with URL in query: <a rel="nofollow" class="external text" href="http://example.com/thing?url=http://example.com">link</a>
4845 </p>
4846 !! end
4848 !! test
4849 External links: old URL-in-URL bug, mixed protocols
4850 !! wikitext
4851 And again with mixed protocols: [ftp://example.com?url=http://example.com link]
4852 !! html
4853 <p>And again with mixed protocols: <a rel="nofollow" class="external text" href="ftp://example.com?url=http://example.com">link</a>
4854 </p>
4855 !!end
4857 !! test
4858 External links: URL in text
4859 !! wikitext
4860 URL in text: [http://example.com http://example.com]
4861 !! html
4862 <p>URL in text: <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4863 </p>
4864 !! end
4866 !! test
4867 External links: Clickable images
4868 !! wikitext
4869 ja-style clickable images: [http://example.com http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png]
4870 !! html/php
4871 <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>
4872 </p>
4873 !! html/parsoid
4874 <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>
4875 !! end
4877 !! test
4878 External links: raw ampersand
4879 !! wikitext
4880 Old &amp; use: http://x&y
4881 !! html
4882 <p>Old &amp; use: <a rel="nofollow" class="external free" href="http://x&amp;y">http://x&amp;y</a>
4883 </p>
4884 !! end
4886 !! test
4887 External links: encoded ampersand
4888 !! wikitext
4889 Old &amp; use: http://x&amp;y
4890 !! html/php
4891 <p>Old &amp; use: <a rel="nofollow" class="external free" href="http://x&amp;y">http://x&amp;y</a>
4892 </p>
4893 !! html/parsoid
4894 <p>Old <span typeof="mw:Entity">&amp;</span> use: <a rel="mw:ExtLink" href="http://x&amp;y">http://x&amp;y</a></p>
4895 !! end
4897 !! test
4898 External links: encoded equals (bug 6102)
4899 !! wikitext
4900 http://example.com/?foo&#61;bar
4901 !! html/php
4902 <p><a rel="nofollow" class="external free" href="http://example.com/?foo=bar">http://example.com/?foo=bar</a>
4903 </p>
4904 !! html/parsoid
4905 <p><a rel="mw:ExtLink" href="http://example.com/?foo=bar">http://example.com/?foo=bar</a></p>
4906 !! end
4909 ## Note that parsoid doesn't explicit mark autonumbered links, nor
4910 ## does it number them.  As discussed in bug 53505, we can identify
4911 ## autonumbered links via CSS.
4914 !! test
4915 External links: [raw ampersand]
4916 !! wikitext
4917 Old &amp; use: [http://x&y]
4918 !! html/php
4919 <p>Old &amp; use: <a rel="nofollow" class="external autonumber" href="http://x&amp;y">[1]</a>
4920 </p>
4921 !! html/parsoid
4922 <p>Old <span typeof="mw:Entity">&amp;</span> use: <a rel="mw:ExtLink" href="http://x&amp;y"></a></p>
4923 !! end
4925 # note that parsoid html is identical to [raw ampersand] case; so html2wt
4926 # mode will return the [raw ampersand] wikitext
4927 !! test
4928 External links: [encoded ampersand]
4929 !! options
4930 parsoid=wt2html,wt2wt,html2html
4931 !! wikitext
4932 Old &amp; use: [http://x&amp;y]
4933 !! html/php
4934 <p>Old &amp; use: <a rel="nofollow" class="external autonumber" href="http://x&amp;y">[1]</a>
4935 </p>
4936 !! html/parsoid
4937 <p>Old <span typeof="mw:Entity">&amp;</span> use: <a rel="mw:ExtLink" href="http://x&amp;y"></a></p>
4938 !! end
4940 !! test
4941 External links: [raw equals]
4942 !! wikitext
4943 [http://example.com/?foo=bar]
4944 !! html/php
4945 <p><a rel="nofollow" class="external autonumber" href="http://example.com/?foo=bar">[1]</a>
4946 </p>
4947 !! html/parsoid
4948 <p><a rel="mw:ExtLink" href="http://example.com/?foo=bar"></a></p>
4949 !! end
4951 # note that parsoid html is identical to [raw equals] case; so html2wt
4952 # mode will return the [raw equals] wikitext
4953 !! test
4954 External links: [encoded equals] (bug 6102)
4955 !! options
4956 parsoid=wt2html,wt2wt,html2html
4957 !! wikitext
4958 [http://example.com/?foo&#61;bar]
4959 !! html/php
4960 <p><a rel="nofollow" class="external autonumber" href="http://example.com/?foo=bar">[1]</a>
4961 </p>
4962 !! html/parsoid
4963 <p><a rel="mw:ExtLink" href="http://example.com/?foo=bar"></a></p>
4964 !! end
4966 # xxx parsoid strips the IDN character, so the round-trip tests will
4967 #     obviously fail and are disabled. --cscott
4968 !! test
4969 External links: [IDN ignored character reference in hostname; strip it right off]
4970 !! options
4971 parsoid=wt2html,wt2wt,html2html
4972 !! wikitext
4973 [http://e&zwnj;xample.com/]
4974 !! html/php
4975 <p><a rel="nofollow" class="external autonumber" href="http://example.com/">[1]</a>
4976 </p>
4977 !! html/parsoid
4978 <p><a rel="mw:ExtLink" href="http://example.com/"></a></p>
4979 !! end
4981 # FIXME: This test (the IDN characters in the text of a link) is an inconsistency.
4982 # Where an external link could easily circumvent the sanitization of the text of
4983 # a link like this (where an IDN-ignore character is in the URL somewhere), this
4984 # test demands a higher standard. That's a bit strange.
4986 # Example:
4988 # http://e‌xample.com -> [http://example.com|http://example.com]
4989 # [http://example.com|http://e‌xample.com] -> [http://example.com|http://e‌xample.com]
4991 # The first example is sanitized, but the second is not. Any security benefits
4992 # from this production are trivial to circumvent. Either remove this test and
4993 # let the parser(s) do their thing unaccosted, or fix the inconsistency and change
4994 # the test accordingly.
4996 # All our love,
4997 # The Parsoid team.
4998 # xxx parsoid strips the IDN character, so the round-trip tests will
4999 #     obviously fail and are disabled. --cscott
5000 !! test
5001 External links: IDN ignored character reference in hostname; strip it right off
5002 !! options
5003 parsoid=wt2html,html2html
5004 !! wikitext
5005 http://e&zwnj;xample.com/
5006 !! html/php
5007 <p><a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>
5008 </p>
5009 !! html/parsoid
5010 <p><a rel="mw:ExtLink" href="http://example.com/">http://example.com/</a></p>
5011 !! end
5013 !! test
5014 External links: www.jpeg.org (bug 554)
5015 !! wikitext
5016 http://www.jpeg.org
5017 !! html
5018 <p><a rel="nofollow" class="external free" href="http://www.jpeg.org">http://www.jpeg.org</a>
5019 </p>
5020 !! end
5022 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
5023 !! test
5024 External links: URL within URL (original bug 2)
5025 !! wikitext
5026 [http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp]
5027 !! html/php
5028 <p><a rel="nofollow" class="external autonumber" href="http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp">[1]</a>
5029 </p>
5030 !! html/parsoid
5031 <p><a rel="mw:ExtLink" href="http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp"></a></p>
5032 !! end
5034 !! test
5035 BUG 361: URL inside bracketed URL
5036 !! wikitext
5037 [http://www.example.com/foo http://www.example.com/bar]
5038 !! html
5039 <p><a rel="nofollow" class="external text" href="http://www.example.com/foo">http://www.example.com/bar</a>
5040 </p>
5041 !! end
5043 !! test
5044 BUG 361: URL within URL, not bracketed
5045 !! wikitext
5046 http://www.example.com/foo?=http://www.example.com/bar
5047 !! html
5048 <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>
5049 </p>
5050 !! end
5052 !! test
5053 BUG 289: ">"-token in URL-tail
5054 !! wikitext
5055 http://www.example.com/<hello>
5056 !! html
5057 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a>&lt;hello&gt;
5058 </p>
5059 !!end
5061 !! test
5062 BUG 289: literal ">"-token in URL-tail
5063 !! wikitext
5064 http://www.example.com/<b>html</b>
5065 !! html/php
5066 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a><b>html</b>
5067 </p>
5068 !! html/parsoid
5069 <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>
5070 !! end
5072 !! test
5073 BUG 289: ">"-token in bracketed URL
5074 !! wikitext
5075 [http://www.example.com/<hello> stuff]
5076 !! html
5077 <p><a rel="nofollow" class="external text" href="http://www.example.com/">&lt;hello&gt; stuff</a>
5078 </p>
5079 !!end
5081 !! test
5082 BUG 289: literal ">"-token in bracketed URL
5083 !! wikitext
5084 [http://www.example.com/<b>html</b> stuff]
5085 !! html
5086 <p><a rel="nofollow" class="external text" href="http://www.example.com/"><b>html</b> stuff</a>
5087 </p>
5088 !!end
5090 !! test
5091 BUG 289: literal double quote at end of URL
5092 !! wikitext
5093 http://www.example.com/"hello"
5094 !! html
5095 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a>"hello"
5096 </p>
5097 !!end
5099 !! test
5100 BUG 289: literal double quote in bracketed URL
5101 !! wikitext
5102 [http://www.example.com/"hello" stuff]
5103 !! html
5104 <p><a rel="nofollow" class="external text" href="http://www.example.com/">"hello" stuff</a>
5105 </p>
5106 !!end
5108 !! test
5109 External links: multiple legal whitespace is fine, Magnus. Don't break it please. (bug 5081)
5110 !! wikitext
5111 [http://www.example.com  test]
5112 !! html
5113 <p><a rel="nofollow" class="external text" href="http://www.example.com">test</a>
5114 </p>
5115 !! end
5117 !! test
5118 External links: link text with spaces
5119 !! wikitext
5120 [http://www.example.com a b c]
5121 [http://www.example.com ''a'' ''b'']
5122 !! html
5123 <p><a rel="nofollow" class="external text" href="http://www.example.com">a b c</a>
5124 <a rel="nofollow" class="external text" href="http://www.example.com"><i>a</i> <i>b</i></a>
5125 </p>
5126 !! end
5128 !! test
5129 External links: wiki links within external link (Bug 3695)
5130 !! options
5131 parsoid=wt2html,html2html
5132 !! wikitext
5133 [http://example.com [[wikilink]] embedded in ext link]
5134 !! html/php
5135 <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>
5136 </p>
5137 !! html/parsoid
5138 <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>
5139 !! end
5141 !! test
5142 BUG 787: Links with one slash after the url protocol are invalid
5143 !! wikitext
5144 http:/example.com
5146 [http:/example.com title]
5147 !! html
5148 <p>http:/example.com
5149 </p><p>[http:/example.com title]
5150 </p>
5151 !! end
5153 !! test
5154 Bracketed external links with template-generated invalid target
5155 !! wikitext
5156 [{{echo|http:/example.com}} title]
5157 !! html
5158 <p>[http:/example.com title]
5159 </p>
5160 !! end
5162 !! test
5163 Bug 2702: Mismatched <i>, <b> and <a> tags are invalid
5164 !! wikitext
5165 ''[http://example.com text'']
5166 [http://example.com '''text]'''
5167 ''Something [http://example.com in italic'']
5168 ''Something [http://example.com mixed''''', even bold]'''
5169 '''''Now [http://example.com both''''']
5170 !! html
5171 <p><a rel="nofollow" class="external text" href="http://example.com"><i>text</i></a>
5172 <a rel="nofollow" class="external text" href="http://example.com"><b>text</b></a>
5173 <i>Something </i><a rel="nofollow" class="external text" href="http://example.com"><i>in italic</i></a>
5174 <i>Something </i><a rel="nofollow" class="external text" href="http://example.com"><i>mixed</i><b>, even bold</b></a>
5175 <i><b>Now </b></i><a rel="nofollow" class="external text" href="http://example.com"><i><b>both</b></i></a>
5176 </p>
5177 !! end
5180 !! test
5181 Bug 4781: %26 in URL
5182 !! wikitext
5183 http://www.example.com/?title=AT%26T
5184 !! html/php
5185 <p><a rel="nofollow" class="external free" href="http://www.example.com/?title=AT%26T">http://www.example.com/?title=AT%26T</a>
5186 </p>
5187 !! html/parsoid
5188 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=AT%26T">http://www.example.com/?title=AT%26T</a></p>
5189 !! end
5191 # According to http://www.w3.org/TR/2011/WD-html5-20110525/Overview.html#parsing-urls a plain
5192 # % is actually legal in HTML5. Any change in output would need testing though.
5193 !! test
5194 Bug 4781, 5267: %25 in URL
5195 !! wikitext
5196 http://www.example.com/?title=100%25_Bran
5197 !! html/php
5198 <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>
5199 </p>
5200 !! html/parsoid
5201 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=100%25_Bran">http://www.example.com/?title=100%25_Bran</a></p>
5202 !! end
5204 !! test
5205 Bug 4781, 5267: %28, %29 in URL
5206 !! wikitext
5207 http://www.example.com/?title=Ben-Hur_%281959_film%29
5208 !! html/php
5209 <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>
5210 </p>
5211 !! html/parsoid
5212 <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>
5213 !! end
5216 !! test
5217 Bug 4781: %26 in autonumber URL
5218 !! wikitext
5219 [http://www.example.com/?title=AT%26T]
5220 !! html/php
5221 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=AT%26T">[1]</a>
5222 </p>
5223 !! html/parsoid
5224 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=AT%26T"></a></p>
5225 !! end
5227 !! test
5228 Bug 4781, 5267: %26 in autonumber URL
5229 !! wikitext
5230 [http://www.example.com/?title=100%25_Bran]
5231 !! html/php
5232 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=100%25_Bran">[1]</a>
5233 </p>
5234 !! html/parsoid
5235 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=100%25_Bran"></a></p>
5236 !! end
5238 !! test
5239 Bug 4781, 5267: %28, %29 in autonumber URL
5240 !! wikitext
5241 [http://www.example.com/?title=Ben-Hur_%281959_film%29]
5242 !! html/php
5243 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">[1]</a>
5244 </p>
5245 !! html/parsoid
5246 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=Ben-Hur_%281959_film%29"></a></p>
5247 !! end
5250 !! test
5251 Bug 4781: %26 in bracketed URL
5252 !! wikitext
5253 [http://www.example.com/?title=AT%26T link]
5254 !! html/php
5255 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=AT%26T">link</a>
5256 </p>
5257 !! html/parsoid
5258 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=AT%26T">link</a></p>
5259 !! end
5261 !! test
5262 Bug 4781, 5267: %25 in bracketed URL
5263 !! wikitext
5264 [http://www.example.com/?title=100%25_Bran link]
5265 !! html
5266 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=100%25_Bran">link</a>
5267 </p>
5268 !! end
5270 !! test
5271 Bug 4781, 5267: %28, %29 in bracketed URL
5272 !! wikitext
5273 [http://www.example.com/?title=Ben-Hur_%281959_film%29 link]
5274 !! html/php
5275 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">link</a>
5276 </p>
5277 !! html/parsoid
5278 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">link</a></p>
5279 !! end
5281 !! test
5282 External link containing a period in the anchor. (bug 63947)
5283 !! wikitext
5284 [//foo.org/bar#baz. bang]
5286 [//foo.org/bar. bang]
5287 !! html/php
5288 <p><a rel="nofollow" class="external text" href="//foo.org/bar#baz.">bang</a>
5289 </p><p><a rel="nofollow" class="external text" href="//foo.org/bar.">bang</a>
5290 </p>
5291 !! html/parsoid
5292 <p><a rel="mw:ExtLink" href="//foo.org/bar#baz.">bang</a></p>
5293 <p><a rel="mw:ExtLink" href="//foo.org/bar.">bang</a></p>
5294 !! end
5296 !! test
5297 External link containing a single quote. (bug 63947)
5298 !! wikitext
5299 [//foo.org/bar'baz]
5301 [//foo.org/bar'baz bang]
5302 !! html/php
5303 <p><a rel="nofollow" class="external autonumber" href="//foo.org/bar'baz">[1]</a>
5304 </p><p><a rel="nofollow" class="external text" href="//foo.org/bar'baz">bang</a>
5305 </p>
5306 !! html/parsoid
5307 <p><a rel="mw:ExtLink" href="//foo.org/bar'baz"></a></p>
5308 <p><a rel="mw:ExtLink" href="//foo.org/bar'baz">bang</a></p>
5309 !! end
5311 !! test
5312 External link containing double-single-quotes in text '' (bug 4598 sanity check)
5313 !! wikitext
5314 Some [http://example.com/ pretty ''italics'' and stuff]!
5315 !! html
5316 <p>Some <a rel="nofollow" class="external text" href="http://example.com/">pretty <i>italics</i> and stuff</a>!
5317 </p>
5318 !! end
5320 !! test
5321 External link containing double-single-quotes in text embedded in italics (bug 4598 sanity check)
5322 !! wikitext
5323 ''Some [http://example.com/ pretty ''italics'' and stuff]!''
5324 !! html
5325 <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>
5326 </p>
5327 !! end
5329 !! test
5330 External link containing double-single-quotes with no space separating the url from text in italics
5331 !! wikitext
5332 [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]].]
5333 !! html/php
5334 <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>
5335 </p>
5336 !! html/php+tidy
5337 <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>
5338 !! html/parsoid
5339 <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>
5340 !! end
5342 !! test
5343 External link with comments in link text
5344 !! wikitext
5345 [http://www.google.com Google <!-- comment -->]
5346 !! html/php
5347 <p><a rel="nofollow" class="external text" href="http://www.google.com">Google </a>
5348 </p>
5349 !! html/parsoid
5350 <p><a rel="mw:ExtLink" href="http://www.google.com">Google <!-- comment --></a></p>
5351 !! end
5353 !! test
5354 External link to bare IPv4 address
5355 !! wikitext
5356 [http://192.168.0.1 Link]
5357 !! html/php
5358 <p><a rel="nofollow" class="external text" href="http://192.168.0.1">Link</a>
5359 </p>
5360 !! html/parsoid
5361 <p><a rel="mw:ExtLink" href="http://192.168.0.1">Link</a></p>
5362 !! end
5364 !! test
5365 URL-encoding in URL functions (single parameter)
5366 !! wikitext
5367 {{localurl:Some page|amp=&}}
5368 !! html
5369 <p>/index.php?title=Some_page&amp;amp=&amp;
5370 </p>
5371 !! end
5373 !! test
5374 URL-encoding in URL functions (multiple parameters)
5375 !! wikitext
5376 {{localurl:Some page|q=?&amp=&}}
5377 !! html
5378 <p>/index.php?title=Some_page&amp;q=?&amp;amp=&amp;
5379 </p>
5380 !! end
5382 !! test
5383 Brackets in urls
5384 !! wikitext
5385 http://example.com/index.php?foozoid%5B%5D=bar
5387 http://example.com/index.php?foozoid&#x5B;&#x5D;=bar
5388 !! html/php
5389 <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>
5390 </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>
5391 </p>
5392 !! html/parsoid
5393 <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>
5395 <p><a rel="mw:ExtLink" href="http://example.com/index.php?foozoid[]=bar">http://example.com/index.php?foozoid[]=bar</a></p>
5396 !! end
5398 !! test
5399 IPv6 urls, autolink format (T23261)
5400 !! wikitext
5401 http://[2404:130:0:1000::187:2]/index.php
5403 Examples from RFC 2373, section 2.2:
5404 * http://[1080::8:800:200C:417A]/unicast
5405 * http://[FF01::101]/multicast
5406 * http://[::1]/loopback
5407 * http://[::]/unspecified
5408 * http://[::13.1.68.3]/ipv4compat
5409 * http://[::FFFF:129.144.52.38]/ipv4compat
5411 Examples from RFC 2732, section 2:
5412 * http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html
5413 * http://[1080:0:0:0:8:800:200C:417A]/index.html
5414 * http://[3ffe:2a00:100:7031::1]
5415 * http://[1080::8:800:200C:417A]/foo
5416 * http://[::192.9.5.5]/ipng
5417 * http://[::FFFF:129.144.52.38]:80/index.html
5418 * http://[2010:836B:4179::836B:4179]
5420 !! html/php
5421 <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>
5422 </p><p>Examples from <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc2373">RFC 2373</a>, section 2.2:
5423 </p>
5424 <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>
5425 <li> <a rel="nofollow" class="external free" href="http://[FF01::101]/multicast">http://[FF01::101]/multicast</a></li>
5426 <li> <a rel="nofollow" class="external free" href="http://[::1]/loopback">http://[::1]/loopback</a></li>
5427 <li> <a rel="nofollow" class="external free" href="http://[::]/unspecified">http://[::]/unspecified</a></li>
5428 <li> <a rel="nofollow" class="external free" href="http://[::13.1.68.3]/ipv4compat">http://[::13.1.68.3]/ipv4compat</a></li>
5429 <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>
5430 <p>Examples from <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc2732">RFC 2732</a>, section 2:
5431 </p>
5432 <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>
5433 <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>
5434 <li> <a rel="nofollow" class="external free" href="http://[3ffe:2a00:100:7031::1]">http://[3ffe:2a00:100:7031::1]</a></li>
5435 <li> <a rel="nofollow" class="external free" href="http://[1080::8:800:200C:417A]/foo">http://[1080::8:800:200C:417A]/foo</a></li>
5436 <li> <a rel="nofollow" class="external free" href="http://[::192.9.5.5]/ipng">http://[::192.9.5.5]/ipng</a></li>
5437 <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>
5438 <li> <a rel="nofollow" class="external free" href="http://[2010:836B:4179::836B:4179]">http://[2010:836B:4179::836B:4179]</a></li></ul>
5440 !! html/parsoid
5441 <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>
5443 <p>Examples from <a href="//tools.ietf.org/html/rfc2373" rel="mw:ExtLink">RFC 2373</a>, section 2.2:</p>
5444 <ul><li> <a rel="mw:ExtLink" href="http://[1080::8:800:200C:417A]/unicast">http://[1080::8:800:200C:417A]/unicast</a></li>
5445 <li> <a rel="mw:ExtLink" href="http://[FF01::101]/multicast">http://[FF01::101]/multicast</a></li>
5446 <li> <a rel="mw:ExtLink" href="http://[::1]/loopback">http://[::1]/loopback</a></li>
5447 <li> <a rel="mw:ExtLink" href="http://[::]/unspecified">http://[::]/unspecified</a></li>
5448 <li> <a rel="mw:ExtLink" href="http://[::13.1.68.3]/ipv4compat">http://[::13.1.68.3]/ipv4compat</a></li>
5449 <li> <a rel="mw:ExtLink" href="http://[::FFFF:129.144.52.38]/ipv4compat">http://[::FFFF:129.144.52.38]/ipv4compat</a></li></ul>
5451 <p>Examples from <a href="//tools.ietf.org/html/rfc2732" rel="mw:ExtLink">RFC 2732</a>, section 2:</p>
5452 <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>
5453 <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>
5454 <li> <a rel="mw:ExtLink" href="http://[3ffe:2a00:100:7031::1]">http://[3ffe:2a00:100:7031::1]</a></li>
5455 <li> <a rel="mw:ExtLink" href="http://[1080::8:800:200C:417A]/foo">http://[1080::8:800:200C:417A]/foo</a></li>
5456 <li> <a rel="mw:ExtLink" href="http://[::192.9.5.5]/ipng">http://[::192.9.5.5]/ipng</a></li>
5457 <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>
5458 <li> <a rel="mw:ExtLink" href="http://[2010:836B:4179::836B:4179]">http://[2010:836B:4179::836B:4179]</a></li></ul>
5459 !! end
5461 !! test
5462 IPv6 urls, bracketed format (T23261)
5463 !! wikitext
5464 [http://[2404:130:0:1000::187:2]/index.php test]
5466 Examples from RFC 2373, section 2.2:
5467 * [http://[1080::8:800:200C:417A] unicast]
5468 * [http://[FF01::101] multicast]
5469 * [http://[::1]/ loopback]
5470 * [http://[::] unspecified]
5471 * [http://[::13.1.68.3] ipv4compat]
5472 * [http://[::FFFF:129.144.52.38] ipv4compat]
5474 Examples from RFC 2732, section 2:
5475 * [http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html 1]
5476 * [http://[1080:0:0:0:8:800:200C:417A]/index.html 2]
5477 * [http://[3ffe:2a00:100:7031::1] 3]
5478 * [http://[1080::8:800:200C:417A]/foo 4]
5479 * [http://[::192.9.5.5]/ipng 5]
5480 * [http://[::FFFF:129.144.52.38]:80/index.html 6]
5481 * [http://[2010:836B:4179::836B:4179] 7]
5483 !! html/php
5484 <p><a rel="nofollow" class="external text" href="http://[2404:130:0:1000::187:2]/index.php">test</a>
5485 </p><p>Examples from <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc2373">RFC 2373</a>, section 2.2:
5486 </p>
5487 <ul><li> <a rel="nofollow" class="external text" href="http://[1080::8:800:200C:417A]">unicast</a></li>
5488 <li> <a rel="nofollow" class="external text" href="http://[FF01::101]">multicast</a></li>
5489 <li> <a rel="nofollow" class="external text" href="http://[::1]/">loopback</a></li>
5490 <li> <a rel="nofollow" class="external text" href="http://[::]">unspecified</a></li>
5491 <li> <a rel="nofollow" class="external text" href="http://[::13.1.68.3]">ipv4compat</a></li>
5492 <li> <a rel="nofollow" class="external text" href="http://[::FFFF:129.144.52.38]">ipv4compat</a></li></ul>
5493 <p>Examples from <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc2732">RFC 2732</a>, section 2:
5494 </p>
5495 <ul><li> <a rel="nofollow" class="external text" href="http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html">1</a></li>
5496 <li> <a rel="nofollow" class="external text" href="http://[1080:0:0:0:8:800:200C:417A]/index.html">2</a></li>
5497 <li> <a rel="nofollow" class="external text" href="http://[3ffe:2a00:100:7031::1]">3</a></li>
5498 <li> <a rel="nofollow" class="external text" href="http://[1080::8:800:200C:417A]/foo">4</a></li>
5499 <li> <a rel="nofollow" class="external text" href="http://[::192.9.5.5]/ipng">5</a></li>
5500 <li> <a rel="nofollow" class="external text" href="http://[::FFFF:129.144.52.38]:80/index.html">6</a></li>
5501 <li> <a rel="nofollow" class="external text" href="http://[2010:836B:4179::836B:4179]">7</a></li></ul>
5503 !! html/parsoid
5504 <p><a rel="mw:ExtLink" href="http://[2404:130:0:1000::187:2]/index.php">test</a></p>
5506 <p>Examples from <a href="//tools.ietf.org/html/rfc2373" rel="mw:ExtLink">RFC 2373</a>, section 2.2:</p>
5507 <ul><li> <a rel="mw:ExtLink" href="http://[1080::8:800:200C:417A]">unicast</a></li>
5508 <li> <a rel="mw:ExtLink" href="http://[FF01::101]">multicast</a></li>
5509 <li> <a rel="mw:ExtLink" href="http://[::1]/">loopback</a></li>
5510 <li> <a rel="mw:ExtLink" href="http://[::]">unspecified</a></li>
5511 <li> <a rel="mw:ExtLink" href="http://[::13.1.68.3]">ipv4compat</a></li>
5512 <li> <a rel="mw:ExtLink" href="http://[::FFFF:129.144.52.38]">ipv4compat</a></li></ul>
5514 <p>Examples from <a href="//tools.ietf.org/html/rfc2732" rel="mw:ExtLink">RFC 2732</a>, section 2:</p>
5515 <ul><li> <a rel="mw:ExtLink" href="http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html">1</a></li>
5516 <li> <a rel="mw:ExtLink" href="http://[1080:0:0:0:8:800:200C:417A]/index.html">2</a></li>
5517 <li> <a rel="mw:ExtLink" href="http://[3ffe:2a00:100:7031::1]">3</a></li>
5518 <li> <a rel="mw:ExtLink" href="http://[1080::8:800:200C:417A]/foo">4</a></li>
5519 <li> <a rel="mw:ExtLink" href="http://[::192.9.5.5]/ipng">5</a></li>
5520 <li> <a rel="mw:ExtLink" href="http://[::FFFF:129.144.52.38]:80/index.html">6</a></li>
5521 <li> <a rel="mw:ExtLink" href="http://[2010:836B:4179::836B:4179]">7</a></li></ul>
5522 !! end
5524 !! test
5525 Non-extlinks in brackets
5526 !! wikitext
5527 [foo]
5528 [foo bar]
5529 [foo ''bar'']
5530 [fool's] errand
5531 [fool's errand]
5532 [{{echo|foo}}]
5533 [{{echo|foo}} bar]
5534 [{{echo|foo}} ''bar'']
5535 [{{echo|foo}}l's] errand
5536 [{{echo|foo}}l's errand]
5537 [url={{echo|foo}}]
5538 [url=http://example.com]
5539 [http:// bare protocols don't count]
5540 !! html/php
5541 <p>[foo]
5542 [foo bar]
5543 [foo <i>bar</i>]
5544 [fool's] errand
5545 [fool's errand]
5546 [foo]
5547 [foo bar]
5548 [foo <i>bar</i>]
5549 [fool's] errand
5550 [fool's errand]
5551 [url=foo]
5552 [url=<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>]
5553 [http:// bare protocols don't count]
5554 </p>
5555 !! html/parsoid
5556 <p>[foo]
5557 [foo bar]
5558 [foo <i>bar</i>]
5559 [fool's] errand
5560 [fool's errand]
5561 [<span typeof="mw:Placeholder" data-parsoid='{"src":"{{echo|foo}}"}'>foo</span>]
5562 [<span typeof="mw:Placeholder" data-parsoid='{"src":"{{echo|foo}}"}'>foo</span> bar]
5563 [<span typeof="mw:Placeholder" data-parsoid='{"src":"{{echo|foo}}"}'>foo</span> <i>bar</i>]
5564 [<span typeof="mw:Placeholder" data-parsoid='{"src":"{{echo|foo}}l&#39;s"}'>fool's</span>] errand
5565 [<span typeof="mw:Placeholder" data-parsoid='{"src":"{{echo|foo}}l&#39;s"}'>fool's</span> errand]
5566 [<span typeof="mw:Placeholder" data-parsoid='{"src":"url={{echo|foo}}"}'>url=foo</span>]
5567 [url=<a rel="mw:ExtLink" href="http://example.com">http://example.com</a>]
5568 [http:// bare protocols don't count]</p>
5569 !! end
5571 !! test
5572 Percent encoding in external links
5573 !! wikitext
5574 [https://github.com/search?l=&q=ResourceLoader+%40wikimedia Search]
5575 !! html/php
5576 <p><a rel="nofollow" class="external text" href="https://github.com/search?l=&amp;q=ResourceLoader+%40wikimedia">Search</a>
5577 </p>
5578 !! html/parsoid
5579 <p><a rel="mw:ExtLink"
5580 href="https://github.com/search?l=&amp;q=ResourceLoader+%40wikimedia">Search</a></p>
5581 !! end
5583 !! test
5584 Use url link syntax for links where the content is equal the link target
5585 !! wikitext
5586 http://example.com
5587 !! html/php
5588 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
5589 </p>
5590 !! html/parsoid
5591 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a></p>
5592 !! end
5594 !! test
5595 Parenthesis in external links, especially URL links
5596 !! wikitext
5597 http://example.com)
5599 http://example.com/test)
5601 http://example.com/(test)
5603 http://example.com/((test)
5605 (http://example.com/(test))
5607 (http://example.com/(test)))))
5609 http://example.com/a)b
5611 [http://example.com) foo]
5612 !! html/php
5613 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
5614 </p><p><a rel="nofollow" class="external free" href="http://example.com/test">http://example.com/test</a>)
5615 </p><p><a rel="nofollow" class="external free" href="http://example.com/(test)">http://example.com/(test)</a>
5616 </p><p><a rel="nofollow" class="external free" href="http://example.com/((test)">http://example.com/((test)</a>
5617 </p><p>(<a rel="nofollow" class="external free" href="http://example.com/(test))">http://example.com/(test))</a>
5618 </p><p>(<a rel="nofollow" class="external free" href="http://example.com/(test)))))">http://example.com/(test)))))</a>
5619 </p><p><a rel="nofollow" class="external free" href="http://example.com/a)b">http://example.com/a)b</a>
5620 </p><p><a rel="nofollow" class="external text" href="http://example.com)">foo</a>
5621 </p>
5622 !! html/parsoid
5623 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a>)</p>
5624 <p><a rel="mw:ExtLink" href="http://example.com/test">http://example.com/test</a>)</p>
5625 <p><a rel="mw:ExtLink" href="http://example.com/(test)">http://example.com/(test)</a></p>
5626 <p><a rel="mw:ExtLink" href="http://example.com/((test)">http://example.com/((test)</a></p>
5627 <p>(<a rel="mw:ExtLink" href="http://example.com/(test))">http://example.com/(test))</a></p>
5628 <p>(<a rel="mw:ExtLink" href="http://example.com/(test)))))">http://example.com/(test)))))</a></p>
5629 <p><a rel="mw:ExtLink" href="http://example.com/a)b">http://example.com/a)b</a></p>
5630 <p><a rel="mw:ExtLink" href="http://example.com)">foo</a></p>
5631 !! end
5633 !! test
5634 Parenthesis in external links, w/ transclusion or comment
5635 !! wikitext
5636 (http://example.com/{{echo|hi}})
5638 (http://example.com<!-- hi -->)
5639 !! html/php
5640 <p>(<a rel="nofollow" class="external free" href="http://example.com/hi">http://example.com/hi</a>)
5641 </p><p>(<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
5642 </p>
5643 !! html/parsoid
5644 <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>
5646 <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>
5647 !! end
5649 !! test
5650 Serialize <a> tags with invalid link targets as plain text
5651 !! options
5652 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
5653 !! html/parsoid
5654 <a rel="mw:WikiLink" href="[[foo]]">text</a>
5655 <a rel="mw:WikiLink" href="[[foo]]">*text</a>
5656 <a rel="mw:WikiLink" href="[[foo]]">[[foo]]</a>
5657 <a rel="mw:WikiLink" href="[[foo]]">*a [[foo]]</a>
5658 !! wikitext
5659 text
5660 <nowiki>*</nowiki>text
5661 <nowiki>[[foo]]</nowiki>
5662 <nowiki>*</nowiki>a <nowiki>[[foo]]</nowiki>
5663 !! end
5665 !! test
5666 mw:ExtLink -vs- mw:WikiLink (T94723)
5667 !! options
5668 parsoid=html2wt
5669 !! html/parsoid
5670 <a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{"stx":"piped","a":{"href":"./Foo"},"sa":{"href":"Foo"}}'>Bar</a>
5671 <a rel="mw:WikiLink" href="./Foo" title="Foo">Bar</a>
5672 <a rel="mw:WikiLink" href="http://en.wikipedia.org/wiki/Foo" title="Foo">Bar</a>
5673 <a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo" title="Foo">Bar</a>
5675 <a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/European_Robin">European Robin</a>
5676 <a rel="mw:WikiLink" href="http://en.wikipedia.org/wiki/European_Robin">European Robin</a>
5677 </p>
5678 !! wikitext
5679 [[Foo|Bar]]
5680 [[Foo|Bar]]
5681 [[wikipedia:Foo|Bar]]
5682 [[wikipedia:Foo|Bar]]
5684 [[wikipedia:European_Robin|European Robin]]
5685 [[wikipedia:European_Robin|European Robin]]
5686 !! end
5688 !! test
5689 mw:ExtLink linking to a interwiki URL can be round-tripped losslessly (T94723)
5690 !! options
5691 parsoid=wt2wt
5692 !! wikitext
5693 [http://en.wikipedia.org/wiki/European_Robin European Robin]
5694 !! html/parsoid
5695 THIS SECTION IS NOT USED (but Parsoid won't run the test without it)
5696 !! end
5700 ### Quotes
5703 !! test
5704 Quotes
5705 !! wikitext
5706 Normal text. '''Bold text.''' Normal text. ''Italic text.''
5708 Normal text. '''''Bold italic text.''''' Normal text.
5709 !! html
5710 <p>Normal text. <b>Bold text.</b> Normal text. <i>Italic text.</i>
5711 </p><p>Normal text. <i><b>Bold italic text.</b></i> Normal text.
5712 </p>
5713 !! end
5716 # Parsoid inserts an empty bold tag pair at the end of the line, that the PHP
5717 # parser strips. The wikitext contains just the first half of the bold
5718 # quote pair.
5719 !! test
5720 Unclosed and unmatched quotes
5721 !! wikitext
5722 '''''Bold italic text '''with bold deactivated''' in between.'''''
5724 '''''Bold italic text ''with italic deactivated'' in between.'''''
5726 '''Bold text..
5728 ..spanning two paragraphs (should not work).'''
5730 '''Bold tag left open
5732 ''Italic tag left open
5734 Normal text.
5736 <!-- Unmatching number of opening, closing tags: -->
5737 '''This year''''s election ''should'' beat '''last year''''s.
5739 ''Tom'''s car is bigger than ''Susan'''s.
5741 Plain ''italic'''s plain
5742 !! html/php
5743 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
5744 </p><p><b><i>Bold italic text </i>with italic deactivated<i> in between.</i></b>
5745 </p><p><b>Bold text..</b>
5746 </p><p>..spanning two paragraphs (should not work).
5747 </p><p><b>Bold tag left open</b>
5748 </p><p><i>Italic tag left open</i>
5749 </p><p>Normal text.
5750 </p><p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
5751 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
5752 </p><p>Plain <i>italic'</i>s plain
5753 </p>
5754 !! html/parsoid
5755 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
5756 </p><p><b><i>Bold italic text </i>with italic deactivated<i> in between.</i></b>
5757 </p><p><b>Bold text..</b>
5758 </p><p>..spanning two paragraphs (should not work).<b></b>
5759 </p><p><b>Bold tag left open</b>
5760 </p><p><i>Italic tag left open</i>
5761 </p><p>Normal text.
5762 </p>
5763 <!-- Unmatching number of opening, closing tags: -->
5764 <p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
5765 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
5766 </p><p>Plain <i>italic'</i>s plain
5767 </p>
5768 !! end
5771 ### Tables
5773 ### some content taken from http://meta.wikimedia.org/wiki/MediaWiki_User%27s_Guide:_Using_tables
5776 # This should not produce <table></table> as <table><tr><td></td></tr></table>
5777 # is the bare minimum required by the spec, see:
5778 # http://www.w3.org/TR/xhtml-modularization/dtd_module_defs.html#a_module_Basic_Tables
5779 # Parsoid team replies: empty table tags are legal in HTML5
5780 !! test
5781 A table with no data.
5782 !! options
5783 parsoid=wt2html
5784 !! wikitext
5785 {||}
5786 !! html/php
5788 !! html/parsoid
5789 <table></table>
5791 !! end
5793 !! test
5794 A table with stray table end tags on start tag line (wt2html)
5795 !! options
5796 parsoid=wt2html
5797 !! wikitext
5798 {|style="color: red;"|}
5800 {|style="color: red;" |}
5801 |foo
5804 {|style="color: red;"|} id="foo"
5805 |foo
5808 {|style="color: red;" |} id="foo"
5809 |foo
5811 !! html
5812 <table style="color: red;"></table>
5814 <table style="color: red;">
5815 <tbody><tr>
5816 <td>foo</td>
5817 </tr></tbody>
5818 </table>
5820 <table style="color: red;" id="foo">
5821 <tbody><tr>
5822 <td>foo</td>
5823 </tr></tbody>
5824 </table>
5826 <table style="color: red;" id="foo">
5827 <tbody><tr>
5828 <td>foo</td>
5829 </tr></tbody>
5830 </table>
5832 !! end
5834 !! test
5835 A table with no data (take 2)
5836 !! wikitext
5839 !! html/parsoid
5840 <table></table>
5841 !! end
5843 # A table with nothing but a caption is invalid XHTML, we might want to render
5844 # this as <p>caption</p>
5845 # Parsoid team replies: table with only a caption is legal in HTML5
5846 !! test
5847 A table with nothing but a caption
5848 !! wikitext
5850 |+ caption
5852 !! html/php
5853 <table>
5854 <caption> caption
5855 </caption><tr><td></td></tr></table>
5857 !! html/parsoid
5858 <table><caption> caption</caption></table>
5859 !! end
5861 !! test
5862 A table with caption with default-spaced attributes and a table row
5863 !! wikitext
5865 |+ style="color: red;" | caption1
5867 | foo
5869 !! html
5870 <table>
5871 <caption style="color: red;"> caption1
5872 </caption>
5873 <tr>
5874 <td> foo
5875 </td></tr></table>
5877 !! end
5879 !! test
5880 A table with captions with non-default spaced attributes and a table row
5881 !! wikitext
5883 |+style="color: red;"|caption2
5884 |+ style="color: red;"| caption3
5886 | foo
5888 !! html
5889 <table>
5890 <caption style="color: red;">caption2
5891 </caption>
5892 <caption style="color: red;"> caption3
5893 </caption>
5894 <tr>
5895 <td> foo
5896 </td></tr></table>
5898 !! end
5900 !! test
5901 Table td-cell syntax variations
5902 !! wikitext
5904 | foo bar foo | baz
5905 | foo bar foo || baz
5906 | style='color:red;' | baz
5907 | style='color:red;' || baz
5909 !! html
5910 <table>
5911 <tr>
5912 <td> baz
5913 </td>
5914 <td> foo bar foo </td>
5915 <td> baz
5916 </td>
5917 <td style="color:red;"> baz
5918 </td>
5919 <td> style='color:red;' </td>
5920 <td> baz
5921 </td></tr></table>
5923 !! end
5925 !! test
5926 Simple table
5927 !! wikitext
5929 | 1 || 2
5931 | 3 || 4
5933 !! html
5934 <table>
5935 <tr>
5936 <td> 1 </td>
5937 <td> 2
5938 </td></tr>
5939 <tr>
5940 <td> 3 </td>
5941 <td> 4
5942 </td></tr></table>
5944 !! end
5946 !! test
5947 Simple table but with multiple dashes for row wikitext
5948 !! wikitext
5950 | foo
5951 |-----
5952 | bar
5954 !! html
5955 <table>
5956 <tr>
5957 <td> foo
5958 </td></tr>
5959 <tr>
5960 <td> bar
5961 </td></tr></table>
5963 !! end
5965 !! test
5966 Multiplication table
5967 !! wikitext
5968 {| border="1" cellpadding="2"
5969 |+Multiplication table
5971 ! &times; !! 1 !! 2 !! 3
5973 ! 1
5974 | 1 || 2 || 3
5976 ! 2
5977 | 2 || 4 || 6
5979 ! 3
5980 | 3 || 6 || 9
5982 ! 4
5983 | 4 || 8 || 12
5985 ! 5
5986 | 5 || 10 || 15
5988 !! html
5989 <table border="1" cellpadding="2">
5990 <caption>Multiplication table
5991 </caption>
5992 <tr>
5993 <th> &#215; </th>
5994 <th> 1 </th>
5995 <th> 2 </th>
5996 <th> 3
5997 </th></tr>
5998 <tr>
5999 <th> 1
6000 </th>
6001 <td> 1 </td>
6002 <td> 2 </td>
6003 <td> 3
6004 </td></tr>
6005 <tr>
6006 <th> 2
6007 </th>
6008 <td> 2 </td>
6009 <td> 4 </td>
6010 <td> 6
6011 </td></tr>
6012 <tr>
6013 <th> 3
6014 </th>
6015 <td> 3 </td>
6016 <td> 6 </td>
6017 <td> 9
6018 </td></tr>
6019 <tr>
6020 <th> 4
6021 </th>
6022 <td> 4 </td>
6023 <td> 8 </td>
6024 <td> 12
6025 </td></tr>
6026 <tr>
6027 <th> 5
6028 </th>
6029 <td> 5 </td>
6030 <td> 10 </td>
6031 <td> 15
6032 </td></tr></table>
6034 !! end
6036 !! test
6037 Accept "||" in table headings
6038 !! wikitext
6040 !h1 || h2
6042 !! html
6043 <table>
6044 <tr>
6045 <th>h1 </th>
6046 <th> h2
6047 </th></tr></table>
6049 !! end
6051 !! test
6052 Accept "!!" in table data
6053 !! wikitext
6055 | Foo!! ||
6057 !! html
6058 <table>
6059 <tr>
6060 <td> Foo!! </td>
6061 <td>
6062 </td></tr></table>
6064 !! html/parsoid
6065 <table>
6066 <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>
6067 </tbody></table>
6068 !! end
6070 !! test
6071 Accept "||" in indented table headings
6072 !! wikitext
6074 !h1 || h2
6076 !! html
6077 <dl><dd><table>
6078 <tr>
6079 <th>h1 </th>
6080 <th> h2
6081 </th></tr></table></dd></dl>
6083 !! end
6085 !! test
6086 Accept "!!" in templates
6087 !! wikitext
6089 !a {{echo|b!!c}}
6091 !! html/php
6092 <table>
6093 <tr>
6094 <th>a b</th>
6095 <th>c
6096 </th></tr></table>
6098 !! html/parsoid
6099 <table>
6100 <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>
6101 !! end
6103 !! test
6104 Accept "!!" in table headings after newline
6105 !! wikitext
6108 b!!c
6110 !! html/php
6111 <table>
6112 <tr>
6113 <th>a
6114 <p>b!!c
6115 </p>
6116 </th></tr></table>
6118 !! html/parsoid
6119 <table>
6120 <tbody><tr><th>a
6121 <p>b!!c</p></th></tr>
6122 </tbody></table>
6123 !! end
6125 !! test
6126 Accept "!!" in table data of mixed wikitext / html syntax
6127 !! wikitext
6130 <tr><td>b!!c</td></tr>
6132 !! html+tidy
6133 <table>
6134 <tr>
6135 <th>a</th>
6136 </tr>
6137 <tr>
6138 <td>b!!c</td>
6139 </tr>
6140 </table>
6141 !! html/parsoid
6142 <table>
6143 <tbody><tr><th>a</th></tr>
6144 <tr data-parsoid='{"stx":"html"}'><td data-parsoid='{"stx":"html"}'>b!!c</td></tr>
6145 </tbody></table>
6146 !! end
6148 !! test
6149 Accept empty attributes in td/th cells (td/th cells starting with leading ||)
6150 !! wikitext
6152 !| h1
6153 || a
6155 !! html
6156 <table>
6157 <tr>
6158 <th> h1
6159 </th>
6160 <td> a
6161 </td></tr></table>
6163 !! end
6165 !!test
6166 Accept "| !" at start of line in tables (ignore !-attribute)
6167 !! wikitext
6170 | !style="color:red" | bar
6172 !! html
6173 <table>
6175 <tr>
6176 <td> bar
6177 </td></tr></table>
6179 !!end
6181 !!test
6182 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 +/- 
6183 !! wikitext
6186 |style='color:red;'|+1
6187 |style='color:blue;'|-1
6189 | 1 || 2 || 3
6190 | 1 ||+2 ||-3
6192 | +1
6193 | -1
6195 !! html
6196 <table>
6198 <tr>
6199 <td style="color:red;">+1
6200 </td>
6201 <td style="color:blue;">-1
6202 </td></tr>
6203 <tr>
6204 <td> 1 </td>
6205 <td> 2 </td>
6206 <td> 3
6207 </td>
6208 <td> 1 </td>
6209 <td>+2 </td>
6210 <td>-3
6211 </td></tr>
6212 <tr>
6213 <td> +1
6214 </td>
6215 <td> -1
6216 </td></tr></table>
6218 !!end
6220 !! test
6221 Table rowspan
6222 !! wikitext
6223 {| border=1
6224 | Cell 1, row 1
6225 |rowspan=2| Cell 2, row 1 (and 2)
6226 | Cell 3, row 1
6228 | Cell 1, row 2
6229 | Cell 3, row 2
6231 !! html
6232 <table border="1">
6233 <tr>
6234 <td> Cell 1, row 1
6235 </td>
6236 <td rowspan="2"> Cell 2, row 1 (and 2)
6237 </td>
6238 <td> Cell 3, row 1
6239 </td></tr>
6240 <tr>
6241 <td> Cell 1, row 2
6242 </td>
6243 <td> Cell 3, row 2
6244 </td></tr></table>
6246 !! end
6248 !! test
6249 Nested table
6250 !! wikitext
6251 {| border=1
6252 | &alpha;
6254 {| bgcolor=#ABCDEF border=2
6255 |nested
6257 |table
6259 |the original table again
6261 !! html
6262 <table border="1">
6263 <tr>
6264 <td> &#945;
6265 </td>
6266 <td>
6267 <table bgcolor="#ABCDEF" border="2">
6268 <tr>
6269 <td>nested
6270 </td></tr>
6271 <tr>
6272 <td>table
6273 </td></tr></table>
6274 </td>
6275 <td>the original table again
6276 </td></tr></table>
6278 !! end
6280 !! test
6281 Invalid attributes in table cell (bug 1830)
6282 !! wikitext
6284 |Cell:|broken
6286 !! html
6287 <table>
6288 <tr>
6289 <td>broken
6290 </td></tr></table>
6292 !! end
6294 !! test
6295 Table cell attributes: Pipes protected by nowikis should be treated as a plain character
6296 !! wikitext
6298 | title="foo" |bar
6299 | title="foo<nowiki>|</nowiki>" |bar
6300 | title="foo<nowiki>|</nowiki>" bar
6302 !! html/php
6303 <table>
6304 <tr>
6305 <td title="foo">bar
6306 </td>
6307 <td title="foo&#124;">bar
6308 </td>
6309 <td> title="foo|" bar
6310 </td></tr></table>
6312 !! html/parsoid
6313 <table>
6314 <tbody><tr><td title="foo">bar</td>
6315 <td title="foo|" data-parsoid='{"a":{"title":"foo|"},"sa":{"title":"foo&lt;nowiki>|&lt;/nowiki>"},"autoInsertedEnd":true}'>bar</td>
6316 <td> title="foo<span typeof="mw:Nowiki">|</span>" bar</td></tr>
6317 </tbody></table>
6318 !! end
6320 # See: http://lists.wikimedia.org/mailman/htdig/wikitech-l/2006-April/022293.html
6321 # N.B. The "|}" to close the table is missing from the input, so parsoid's
6322 #      *2wt modes will fail.
6323 !! test
6324 Table security: embedded pipes
6325 !! options
6326 parsoid=wt2html,html2html
6327 !! wikitext
6329 | |[ftp://|x||]" onmouseover="alert(document.cookie)">test
6330 !! html/php
6331 <table>
6332 <tr>
6333 <td>[<a rel="nofollow" class="external free" href="ftp://%7Cx">ftp://%7Cx</a></td>
6334 <td>]" onmouseover="alert(document.cookie)"&gt;test
6335 </td>
6336 </tr>
6337 </table>
6339 !! html/parsoid
6340 <table><tbody>
6341 <tr>
6342 <td data-parsoid='{"startTagSrc":"| ","attrSepSrc":"|","autoInsertedEnd":true}'><a rel="mw:ExtLink" href="ftp://|x||"></a>" onmouseover="alert(document.cookie)">test</td></tr></tbody></table>
6343 !! end
6345 !! test
6346 Element attributes with double ! should not be broken up by <th>
6347 !! wikitext
6349 ! hi <div class="!!">ha</div> ho
6351 !! html/php
6352 <table>
6353 <tr>
6354 <th> hi <div class="!!">ha</div> ho
6355 </th></tr></table>
6357 !! html/parsoid
6358 <table>
6359 <tbody><tr><th> hi <div class="!!" data-parsoid='{"stx":"html"}'>ha</div> ho</th></tr>
6360 </tbody></table>
6361 !! end
6363 !! test
6364 ! and || in element attributes should not be parsed as <th>/<td>
6365 !! wikitext
6367 | <div style="color: red !important;" data-contrived="put this here ||">hi</div>
6369 !! html/php
6370 <table>
6371 <tr>
6372 <td> <div style="color: red !important;" data-contrived="put this here &#124;&#124;">hi</div>
6373 </td></tr></table>
6375 !! html/parsoid
6376 <table>
6377 <tbody><tr><td> <div style="color: red !important;" data-contrived="put this here ||" data-parsoid='{"stx":"html"}'>hi</div></td></tr>
6378 </tbody></table>
6379 !! end
6381 # FIXME: The output seems broken. Filed as T110268.
6382 !! test
6383 ! and || in td attributes should not be parsed as <th>/<td>
6384 !! options
6385 parsoid=wt2html
6386 !! wikitext
6388 | style="color: red !important;" data-contrived="put this here ||" | foo
6390 !! html/php
6391 <table>
6392 <tr>
6393 <td> style="color: red !important;" data-contrived="put this here </td>
6394 <td> foo
6395 </td></tr></table>
6397 !! html/parsoid
6398 <table>
6399 <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>
6400 </tbody></table>
6401 !! end
6403 !! test
6404 Break on | in element attribute in template
6405 !! options
6406 parsoid=wt2html,html2html
6407 !! wikitext
6408 {{echo|1=<div class="hi|ho">ha</div>}}
6409 !! html/php
6410 <p>ho"&gt;ha&lt;/div&gt;
6411 </p>
6412 !! html/parsoid
6413 <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>
6414 !! end
6416 !! test
6417 Indented table markup mixed with indented pre content (proposed in bug 6200)
6418 !! wikitext
6419  <table>
6420  <tr>
6421  <td>
6422  Text that should be rendered preformatted
6423  </td>
6424  </tr>
6425  </table>
6426 !! html
6427  <table>
6428  <tr>
6429  <td>
6430 <pre>Text that should be rendered preformatted
6431 </pre>
6432  </td>
6433  </tr>
6434  </table>
6436 !! end
6438 !! test
6439 1. Template-generated table cell attributes and cell content
6440 !! wikitext
6442 |{{table_attribs}}
6443 | {{table_attribs}}
6444 || {{table_attribs_5}}
6445 | <!--foo--> <!--bar--> <!--baz--> {{table_attribs}}
6446 |align=center {{table_attribs}}
6447 | <!--foo--> align=center <!--bar--> {{table_attribs}}
6449 !! html
6450 <table>
6451 <tr>
6452 <td style="color:red;">Foo
6453 </td>
6454 <td style="color:red;">Foo
6455 </td>
6456 <td> style="color:red;"</td>
6457 <td>Bar
6458 </td>
6459 <td style="color:red;">Foo
6460 </td>
6461 <td align="center" style="color:red;">Foo
6462 </td>
6463 <td align="center" style="color:red;">Foo
6464 </td></tr></table>
6466 !! end
6468 !! test
6469 2. Template-generated table cell attributes and cell content
6470 !! wikitext
6472 |{{table_attribs_2}}
6474 !! html/php
6475 <table>
6476 <tr>
6477 <td style="color:red;">Foo
6478 </td>
6479 <td>Bar</td>
6480 <td>Baz
6481 </td></tr></table>
6483 !! html/parsoid
6484 <table>
6485 <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>
6486 <td about="#mwt1">Bar</td><td about="#mwt1">Baz</td></tr>
6487 </tbody></table>
6488 !! end
6490 !! test
6491 3. Template-generated table cell attributes and cell content
6492 !! wikitext
6494 !align=center {{table_header_cells}}
6496 |align=center {{table_cells}}
6498 !! html/php
6499 <table>
6500 <tr>
6501 <th align="center" style="color:red;">Foo</th>
6502 <th style="color:red;"><i>Bar</i></th>
6503 <th style="color:brown;"><i>Foo</i> and Baz
6504 </th></tr>
6505 <tr>
6506 <td align="center" style="color:red;">Foo</td>
6507 <td style="color:red;"><i>Bar</i></td>
6508 <td style="color:brown;"><i>Foo</i> and Baz
6509 </td></tr></table>
6511 !! html/parsoid
6512 <table>
6513 <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>
6514 <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>
6515 </tbody></table>
6516 !! end
6518 !! test
6519 4. Template-generated table cell attributes and cell content inside a templated table
6520 !! wikitext
6521 {{tbl-start}}
6522 !align=center {{table_header_cells}}
6524 |align=center {{table_cells}}
6525 {{tbl-end}}
6526 !! html/php
6527 <table>
6528 <tr>
6529 <th align="center" style="color:red;">Foo</th>
6530 <th style="color:red;"><i>Bar</i></th>
6531 <th style="color:brown;"><i>Foo</i> and Baz
6532 </th></tr>
6533 <tr>
6534 <td align="center" style="color:red;">Foo</td>
6535 <td style="color:red;"><i>Bar</i></td>
6536 <td style="color:brown;"><i>Foo</i> and Baz
6537 </td></tr></table>
6539 !! html/parsoid
6540 <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}}]}'>
6541 <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>
6542 <tr>
6543 <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>
6544 </tbody></table>
6545 !! end
6547 ## Edge case fix to prevent future regressions
6548 !! test
6549 T107652: <ref>s in templates that also generate table cell attributes should be rendered properly
6550 !! wikitext
6552 |{{table_attribs_7}}
6554 <references />
6555 !! html/parsoid
6556 <table>
6557 <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>
6558 </tbody></table>
6559 <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>
6560 !! end
6562 !! test
6563 Table with row followed by newlines and table heading
6564 !! wikitext
6568 ! foo
6570 !! html
6571 <table>
6574 <tr>
6575 <th> foo
6576 </th></tr></table>
6578 !! end
6580 !! test
6581 Table with empty line following the start tag
6582 !! wikitext
6586 | foo
6588 !! html
6589 <table>
6592 <tr>
6593 <td> foo
6594 </td></tr></table>
6596 !! end
6598 !! test
6599 Table attributes with empty value
6600 !! options
6601 parsoid=wt2html,html2html
6602 !! wikitext
6604 | style=| hello
6606 !! html/php
6607 <table>
6608 <tr>
6609 <td style=""> hello
6610 </td></tr></table>
6612 !! html/parsoid
6613 <table>
6614 <tbody><tr><td style=""> hello</td></tr>
6615 </tbody></table>
6616 !! end
6618 !! test
6619 Wikitext table with a lot of comments
6620 !! wikitext
6622 <!-- c0 -->
6623 | foo
6624 <!-- c1 -->
6625 |-<!-- c2 -->
6626 <!-- c3 -->
6627 |<!-- c4 -->
6628 <!-- c5 -->
6630 !! html
6631 <table>
6632 <tr>
6633 <td> foo
6634 </td></tr>
6635 <tr>
6636 <td>
6637 </td></tr></table>
6639 !! end
6641 !! test
6642 Wikitext table comments represented in parsoid dom
6643 !! wikitext
6644 {|<!--c1--><!--c2-->
6645 |-<!--c3-->
6646 | x
6648 !! html/php+tidy
6649 <table>
6650 <tr>
6651 <td>x</td>
6652 </tr>
6653 </table>
6654 !! html/parsoid
6655 <table><!--c1--><!--c2-->
6656 <tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'><!--c3-->
6657 <td data-parsoid='{"autoInsertedEnd":true}'> x</td></tr>
6658 </tbody></table>
6659 !! end
6661 !! test
6662 Wikitext table with double-line table cell
6663 !! wikitext
6668 !! html
6669 <table>
6670 <tr>
6671 <td>a
6672 <p>b
6673 </p>
6674 </td></tr></table>
6676 !! end
6678 !! test
6679 Table cell with a single comment
6680 !! wikitext
6682 | <!-- c1 -->
6683 | a
6685 !! html
6686 <table>
6687 <tr>
6688 <td>
6689 </td>
6690 <td> a
6691 </td></tr></table>
6693 !! end
6695 !! test
6696 Table-cell after a comment-only-empty-line
6697 !! wikitext
6700 <!--c1-->
6701 <!--c2-->| b
6703 !! html
6704 <table>
6705 <tr>
6706 <td>a
6707 </td>
6708 <td> b
6709 </td></tr></table>
6711 !! html/parsoid
6712 <table>
6713 <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'>a</td>
6714 <!--c1-->
6715 <!--c2--><td data-parsoid='{"autoInsertedEnd":true}'> b</td></tr>
6716 </tbody></table>
6718 !! end
6720 !! test
6721 Build table with {{!}}
6722 !! wikitext
6723 {{{!}} class="wikitable"
6724 ! header
6725 ! second header
6726 {{!}}- style="color:red;"
6727 {{!}} data {{!}}{{!}} style="color:red;" {{!}} second data
6728 {{!}}}
6729 !! html
6730 <table class="wikitable">
6731 <tr>
6732 <th> header
6733 </th>
6734 <th> second header
6735 </th></tr>
6736 <tr style="color:red;">
6737 <td> data </td>
6738 <td style="color:red;"> second data
6739 </td></tr></table>
6741 !! end
6743 !! test
6744 Build table with pipe as data
6745 !! wikitext
6746 {| class="wikitable"
6747 ! header
6748 ! second header
6749 |- style="color:red;"
6750 | data || style="color:red;" | second data
6752 | style="color:red;" | data with | || style="color:red;" | second data with |
6754 || data with | ||| second data with |
6756 !! html
6757 <table class="wikitable">
6758 <tr>
6759 <th> header
6760 </th>
6761 <th> second header
6762 </th></tr>
6763 <tr style="color:red;">
6764 <td> data </td>
6765 <td style="color:red;"> second data
6766 </td></tr>
6767 <tr>
6768 <td style="color:red;"> data with | </td>
6769 <td style="color:red;"> second data with |
6770 </td></tr>
6771 <tr>
6772 <td> data with | </td>
6773 <td> second data with |
6774 </td></tr></table>
6776 !! end
6778 !! test
6779 Build table with wikilink
6780 !! wikitext
6781 {| class="wikitable"
6782 ! header || second header
6783 |- style="color:red;"
6784 | data [[Main Page|linktext]] || second data [[Main Page|linktext]]
6786 | data || second data [[Main Page|link|text with pipe]]
6788 !! html
6789 <table class="wikitable">
6790 <tr>
6791 <th> header </th>
6792 <th> second header
6793 </th></tr>
6794 <tr style="color:red;">
6795 <td> data <a href="/wiki/Main_Page" title="Main Page">linktext</a> </td>
6796 <td> second data <a href="/wiki/Main_Page" title="Main Page">linktext</a>
6797 </td></tr>
6798 <tr>
6799 <td> data </td>
6800 <td> second data <a href="/wiki/Main_Page" title="Main Page">link|text with pipe</a>
6801 </td></tr></table>
6803 !! end
6805 # The expected HTML structure in this test is debatable. The PHP parser does
6806 # not parse this kind of table at all. The main focus for Parsoid is on
6807 # round-tripping, so this output is ok for now. TODO: revisit!
6808 !! test
6809 Wikitext table with html-syntax row
6810 !! wikitext
6813 <td>foo</td>
6815 !! html/parsoid
6816 <table>
6817 <tbody>
6818 <tr>
6819 <td>foo</td></tr></tbody></table>
6820 !! end
6822 ## Note that Parsoid output differs from PHP and PHP+tidy here.
6823 ## The lack of <tr> tags in the PHP output is arguably a bug in the
6824 ## PHP parser, which tidy then compounds by fostering the content
6825 ## entirely out of the table.  Parsoid recognizes the table context
6826 ## and generates <tr> and <td> wrappers as needed.  Hopefully nobody
6827 ## depends on PHP's treatment of broken table markup!
6828 !! test
6829 Implicit <td> after a |-
6830 !! options
6831 parsoid=wt2html,html2html
6832 !! wikitext
6837 !! html/php
6838 <table>
6841 </table>
6843 !! html/php+tidy
6844 <p>a</p>
6845 !! html/parsoid
6846 <table>
6847 <tr><td>a</td></tr>
6848 </table>
6849 !! end
6851 # Again, Parsoid adds implicit <td>s here, PHP and Tidy strip the b out.
6852 !! test
6853 <pre> tags should be recognized in an explicit <td> context, but not in an implicit <td> context
6854 !! options
6855 parsoid=wt2html,html2html
6856 !! wikitext
6864 !! html/php
6865 <table>
6867 <tr>
6868 <td>
6869 <pre>a
6870 </pre>
6871 </td></tr>
6873 </table>
6875 !! html/php+tidy
6876 <p>b</p>
6877 <table>
6878 <tr>
6879 <td>
6880 <pre>
6882 </pre></td>
6883 </tr>
6884 </table>
6885 !! html/parsoid
6886 <table>
6887 <tbody>
6888 <tr><td><pre>a</pre></td></tr>
6889 <tr><td> b</td></tr>
6890 </tbody>
6891 </table>
6892 !! end
6894 # PHP + Tidy strips the list out of the table; Parsoid wraps it.
6895 # Parsoid generates the missing <td>, so wt2wt won't succeed.
6896 !! test
6897 Lists should be recognized in an implicit <td> context
6898 !! options
6899 parsoid=wt2html,html2html
6900 !! wikitext
6905 !! html/php
6906 <table>
6908 <ul><li>a</li></ul>
6909 </table>
6911 !! html/php+tidy
6912 <ul>
6913 <li>a</li>
6914 </ul>
6915 !! html/parsoid
6916 <table>
6917 <tr>
6918 <td><ul>
6919 <li>a</li>
6920 </ul></td>
6921 </tr>
6922 </table>
6923 !! end
6925 !! test
6926 Table cells not properly parsed in an implicit-td context
6927 !! wikitext
6930 {{table_attribs_4}} || a || b
6932 !! html/php+tidy
6933 <table>
6934 <tr>
6935 <td style="background-color:#DC241f;" width="10px"></td>
6936 <td>a</td>
6937 <td>b</td>
6938 </tr>
6939 </table>
6940 !! html/parsoid
6941 <table>
6942 <tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'>
6943 <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>
6944 </tbody></table>
6945 !! end
6947 !! test
6948 Parsoid: Round-trip tables directly followed by content (bug 51219)
6949 !! options
6950 parsoid=wt2html,wt2wt
6951 !! wikitext
6953 |foo
6954 |} bar
6957 |baz
6958 |}<b>quux</b>
6959 !! html+tidy
6960 <table>
6961 <tr>
6962 <td>foo</td>
6963 </tr>
6964 </table>
6965 <p>bar</p>
6966 <table>
6967 <tr>
6968 <td>baz</td>
6969 </tr>
6970 </table>
6971 <p><b>quux</b></p>
6972 !! end
6974 !! test
6975 Parsoid: Default to a newline after tables in new content (bug 51219)
6976 !! options
6977 parsoid=html2wt
6978 !! html/parsoid
6979 <table><tbody>
6980 <tr><td>foo</td></tr></tbody></table> bar
6981 <table><tbody>
6982 <tr><td>baz</td></tr></tbody></table><b>quux</b>
6983 !! wikitext
6985 |foo
6987 <nowiki> </nowiki>bar
6989 |baz
6991 '''quux'''
6992 !! end
6994 !! test
6995 Parsoid: newline inducing block nodes don't suppress <nowiki>
6996 !! options
6997 parsoid=html2wt
6998 !! html/parsoid
6999  a<h1>foo</h1>
7000 !! wikitext
7001 <nowiki> </nowiki>a
7003 = foo =
7004 !! end
7006 !! test
7007 Parsoid: Row-syntax table headings followed by comment & table cells
7008 !! options
7009 parsoid=wt2html,wt2wt
7010 !! wikitext
7012 ! foo || bar
7013 <!-- foo -->  || baz || quux
7015 !! html/php
7016 <table>
7017 <tr>
7018 <th> foo </th>
7019 <th> bar
7020 </th>
7021 <td> baz </td>
7022 <td> quux
7023 </td></tr></table>
7025 !! html/parsoid
7026 <table>
7027 <tbody><tr><th> foo </th><th> bar
7028 <!-- foo -->  </th><td> baz </td><td> quux</td></tr>
7029 </tbody></table>
7030 !! end
7032 !!test
7033 Parsoid: Recover better from broken table attributes
7034 !!options
7035 parsoid=wt2html
7036 !!wikitext
7037 {| class="foo
7038 | class="bar" |
7041 !!html/php+tidy
7042 <table class="foo">
7043 <tr>
7044 <td class="bar">
7045 <p>foo</p>
7046 </td>
7047 </tr>
7048 </table>
7049 !!html/parsoid
7050 <table class="foo">
7051 <tr>
7052 <td class="bar">
7053 <p>foo</p></td></tr>
7054 </tbody></table>
7055 !!end
7057 !! test
7058 Tables: Digest broken attributes on table and tr tag
7059 !! options
7060 parsoid=wt2html
7061 !! wikitext
7062 {| || |} ++
7063 |- || || ++ --
7064 |- > [
7066 !! html
7067 <table>
7068 <tbody>
7069 <tr></tr>
7070 <tr></tr>
7071 </tbody></table>
7072 !! end
7074 !! test
7075 Strip unsupported table tags
7076 !! options
7077 parsoid=html2wt
7078 !! html/parsoid
7079 <table>
7080 <thead>
7081 <tr>
7082 <th>Month</th>
7083 <th>Savings</th>
7084 </tr>
7085 </thead>
7086 <tbody>
7087 <tr>
7088 <td>January</td>
7089 <td>$100</td>
7090 </tr>
7091 <tr>
7092 <td>February</td>
7093 <td>$80</td>
7094 </tr>
7095 </tbody>
7096 <tfoot>
7097 <tr>
7098 <td>Sum</td>
7099 <td>$180</td>
7100 </tr>
7101 </tfoot>
7102 </table>
7103 !! wikitext
7106 !Month
7107 !Savings
7109 |January
7110 |$100
7113 |February
7114 |$80
7116 |Sum
7117 |$180
7120 !! end
7122 !! test
7123 Testing serialization after deletion in references
7124 !! options
7125 parsoid={
7126   "modes": ["wt2wt"],
7127   "changes": [
7128     ["#x", "remove"]
7129   ]
7131 !! wikitext
7132 hi <ref><div id="x">ho</div></ref>
7134 <references />
7135 !! wikitext/edited
7136 hi <ref></ref>
7138 <references />
7139 !! end
7141 !!test
7142 Testing serialization after deletion of table cells
7143 !!options
7144 parsoid={
7145   "modes": ["wt2wt", "selser"],
7146   "changes": [
7147     ["#x", "remove"]
7148   ]
7150 !!wikitext
7152 !h1 !!h2 !!h3
7153 | id="x" |c1 {{!}}{{!}}{{!}}c2 |||c3
7155 !! wikitext/edited
7157 !h1 !!h2 !!h3
7158 |c2 |||c3
7160 !!end
7163 ### Internal links
7165 !! test
7166 Plain link, capitalized
7167 !! wikitext
7168 [[Main Page]]
7169 !! html
7170 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
7171 </p>
7172 !! end
7174 !! test
7175 Plain link, uncapitalized
7176 !! wikitext
7177 [[main Page]]
7178 !! html
7179 <p><a href="/wiki/Main_Page" title="Main Page">main Page</a>
7180 </p>
7181 !! end
7183 !! test
7184 Piped link
7185 !! wikitext
7186 [[Main Page|The Main Page]]
7187 !! html
7188 <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
7189 </p>
7190 !! end
7192 !! test
7193 Piped link with comment in link text
7194 !! wikitext
7195 [[Main Page|The Main<!--front--> Page]]
7196 !! html
7197 <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
7198 </p>
7199 !! end
7201 !! test
7202 Piped link with multiple pipe characters in link text
7203 !! wikitext
7204 [[Main Page||The|Main|Page|]]
7205 !! html/php
7206 <p><a href="/wiki/Main_Page" title="Main Page">|The|Main|Page|</a>
7207 </p>
7208 !! html/parsoid
7209 <p><a rel="mw:WikiLink" href="Main_Page" title="Main Page">|The|Main|Page|</a></p>
7210 !! end
7212 !! test
7213 Piped link with no link text
7214 !! wikitext
7215 [[Thomas Bek (bishop of St David's)|]]
7216 !! html/php
7217 <p>[[Thomas Bek (bishop of St David's)|]]
7218 </p>
7219 !! html/parsoid
7220 <p>[[Thomas Bek (bishop of St David's)|]]</p>
7221 !! end
7223 !! test
7224 Broken link
7225 !! wikitext
7226 [[Zigzagzogzagzig]]
7227 !! html
7228 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig</a>
7229 </p>
7230 !! end
7232 !! test
7233 Broken link with fragment
7234 !! wikitext
7235 [[Zigzagzogzagzig#zug]]
7236 !! html
7237 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig#zug</a>
7238 </p>
7239 !! end
7241 !! test
7242 Special page link with fragment
7243 !! wikitext
7244 [[Special:Version#anchor]]
7245 !! html
7246 <p><a href="/wiki/Special:Version#anchor" title="Special:Version">Special:Version#anchor</a>
7247 </p>
7248 !! end
7250 !! test
7251 Nonexistent special page link with fragment
7252 !! wikitext
7253 [[Special:ThisNameWillHopefullyNeverBeUsed#anchor]]
7254 !! html
7255 <p><a href="/wiki/Special:ThisNameWillHopefullyNeverBeUsed" class="new" title="Special:ThisNameWillHopefullyNeverBeUsed (page does not exist)">Special:ThisNameWillHopefullyNeverBeUsed#anchor</a>
7256 </p>
7257 !! end
7259 !! test
7260 Link with prefix
7261 !! wikitext
7262 xxx[[main Page]], xxx[[Main Page]], Xxx[[main Page]] XXX[[main Page]], XXX[[Main Page]]
7263 !! html
7264 <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>
7265 </p>
7266 !! end
7268 !! test
7269 Link with suffix
7270 !! wikitext
7271 [[Main Page]]xxx, [[Main Page]]XXX, [[Main Page]]!!!
7272 !! html
7273 <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>!!!
7274 </p>
7275 !! end
7277 !! article
7278 prefixed article
7279 !! text
7280 Some text
7281 !! endarticle
7283 !! test
7284 Bug 43661: Piped links with identical prefixes
7285 !! wikitext
7286 [[prefixed article|prefixed articles with spaces]]
7288 [[prefixed article|prefixed articlesaoeu]]
7290 [[Main Page|Main Page test]]
7291 !! html
7292 <p><a href="/wiki/Prefixed_article" title="Prefixed article">prefixed articles with spaces</a>
7293 </p><p><a href="/wiki/Prefixed_article" title="Prefixed article">prefixed articlesaoeu</a>
7294 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page test</a>
7295 </p>
7296 !! end
7299 !! test
7300 Link with HTML entity in suffix / tail
7301 !! wikitext
7302 [[Main Page]]&quot;, [[Main Page]]&#97;
7303 !! html/php
7304 <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;
7305 </p>
7306 !! html/parsoid
7307 <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>
7308 !! end
7310 !! test
7311 Link with 3 brackets
7312 !! wikitext
7313 [[[Main Page]]]
7314 Foo [[[Main Page]]]
7315 !! html
7316 <p>[[[Main Page]]]
7317 Foo [[[Main Page]]]
7318 </p>
7319 !! end
7321 !! test
7322 Link with 4 brackets
7323 !! wikitext
7324 [[[[Main Page]]]]
7325 !! html
7326 <p>[[<a href="/wiki/Main_Page" title="Main Page">Main Page</a>]]
7327 </p>
7328 !! end
7330 !! test
7331 Piped link with 3 brackets
7332 !! wikitext
7333 [[[main page|the main page]]]
7334 !! html
7335 <p>[[[main page|the main page]]]
7336 </p>
7337 !! end
7339 !! test
7340 Piped link with extlink-like text
7341 !! wikitext
7342 [[Main Page|[bar]]]
7343 [[Main Page|This is a [bar]]]
7344 !! html/php
7345 <p><a href="/wiki/Main_Page" title="Main Page">[bar]</a>
7346 <a href="/wiki/Main_Page" title="Main Page">This is a [bar]</a>
7347 </p>
7348 !! html/parsoid
7349 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page" data-parsoid='{"stx":"piped"}'>[bar]</a>
7350 <a rel="mw:WikiLink" href="./Main_Page" title="Main Page" data-parsoid='{"stx":"piped"}'>This is a [bar]</a></p>
7351 !! end
7353 !! test
7354 Link with multiple pipes
7355 !! wikitext
7356 [[Main Page|The|Main|Page]]
7357 !! html
7358 <p><a href="/wiki/Main_Page" title="Main Page">The|Main|Page</a>
7359 </p>
7360 !! end
7362 # Note that parsoid does not munge anchor text; all non-space
7363 # characters are valid in HTML5 ids.
7364 !! test
7365 Anchor containing a #. (bug 63430)
7366 !! wikitext
7367 [[Main Page#And#Link]]
7368 !! html/php
7369 <p><a href="/wiki/Main_Page#And.23Link" title="Main Page">Main Page#And#Link</a>
7370 </p>
7371 !! html/parsoid
7372 <p><a rel="mw:WikiLink" href="./Main_Page#And%23Link" title="Main Page">Main Page#And#Link</a></p>
7373 !! end
7375 !! test
7376 Link to namespaces
7377 !! wikitext
7378 [[Talk:Parser testing]], [[Meta:Disclaimers]]
7379 !! html
7380 <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>
7381 </p>
7382 !! end
7384 !! test
7385 Link with space in namespace
7386 !! wikitext
7387 [[User talk:Foo bar]]
7388 !! html
7389 <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>
7390 </p>
7391 !! end
7393 !! article
7394 MemoryAlpha:AlphaTest
7395 !! text
7396 This is an article in the MemoryAlpha namespace
7397 (which shadows the memoryalpha interwiki link).
7398 !! endarticle
7400 !! test
7401 Namespace takes precedence over interwiki link (bug 51680)
7402 !! wikitext
7403 [[MemoryAlpha:AlphaTest]]
7404 !! html
7405 <p><a href="/wiki/MemoryAlpha:AlphaTest" title="MemoryAlpha:AlphaTest">MemoryAlpha:AlphaTest</a>
7406 </p>
7407 !! end
7409 # The previous test doesn't work correctly in html2*, due to not recognizing the
7410 # link as an internal one. This one checks for the correct behavior.
7411 !! test
7412 Link to namespace preferred over interwiki with correct rel attribute
7413 !! options
7414 parsoid=html2wt,html2html
7415 !! html/parsoid
7416 <p><a rel="mw:WikiLink" href="./MemoryAlpha:AlphaTest" title="MemoryAlpha:AlphaTest">MemoryAlpha:AlphaTest</a></p>
7417 !! wikitext
7418 [[MemoryAlpha:AlphaTest]]
7419 !! end
7421 !! test
7422 Piped link to namespace
7423 !! wikitext
7424 [[Meta:Disclaimers|The disclaimers]]
7425 !! html
7426 <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>
7427 </p>
7428 !! end
7430 !! test
7431 Link containing }
7432 !! wikitext
7433 [[Usually caused by a typo (oops}]]
7434 !! html
7435 <p>[[Usually caused by a typo (oops}]]
7436 </p>
7437 !! end
7439 !! article
7440 7% Solution
7441 !! text
7442 Just a test of an article title containing a percent.
7443 !! endarticle
7445 !! test
7446 Link containing % (not as a hex sequence)
7447 !! wikitext
7448 [[7% Solution]]
7449 !! html/php
7450 <p><a href="/wiki/7%25_Solution" title="7% Solution">7% Solution</a>
7451 </p>
7452 !! html/parsoid
7453 <p><a rel="mw:WikiLink" href="./7%25_Solution" title="7% Solution">7% Solution</a></p>
7454 !! end
7456 # note that the parsoid HTML is identical to the previous test output,
7457 # so the previous test ensures that the html2wt mode will generate the
7458 # "not as a hex sequence" wikitext.
7459 !! test
7460 Link containing % as a single hex sequence interpreted to char
7461 !! options
7462 parsoid=wt2wt,wt2html,html2html
7463 !! wikitext
7464 [[7%25 Solution]]
7465 !! html/php
7466 <p><a href="/wiki/7%25_Solution" title="7% Solution">7% Solution</a>
7467 </p>
7468 !! html/parsoid
7469 <p><a rel="mw:WikiLink" href="./7%25_Solution" title="7% Solution">7% Solution</a></p>
7470 !!end
7472 !! test
7473 Link containing % as a double hex sequence interpreted to hex sequence
7474 !! wikitext
7475 [[7%2525 Solution]]
7476 !! html
7477 <p>[[7%2525 Solution]]
7478 </p>
7479 !!end
7481 # note that parsoid does not munge anchor text; all non-space
7482 # characters are valid in HTML5 anchors.
7483 !! test
7484 Link containing "#<" and "#>" % as a hex sequences- these are valid section anchors
7485 Example for such a section: == < ==
7486 !! wikitext
7487 [[%23%3c]][[%23%3e]]
7488 !! html/php
7489 <p><a href="#.3C">#&lt;</a><a href="#.3E">#&gt;</a>
7490 </p>
7491 !! html/parsoid
7492 <p><a rel="mw:WikiLink" href="./Main%20Page#%3C" title="Main Page">#&lt;</a><a rel="mw:WikiLink" href="./Main%20Page#%3E" title="Main Page">#></a></p>
7493 !! end
7495 !! test
7496 Link containing "<#" and ">#" as a hex sequences
7497 !! wikitext
7498 [[%3c%23]][[%3e%23]]
7499 !! html
7500 <p>[[%3c%23]][[%3e%23]]
7501 </p>
7502 !! end
7504 !! test
7505 Link containing an equals sign
7506 !! wikitext
7507 [[Special:BookSources/isbn=4-00-026157-6]]
7508 !! html/php
7509 <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>
7510 </p>
7511 !! html/parsoid
7512 <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>
7513 !! end
7515 !! article
7516 Foo~bar
7517 !! text
7518 Just a test of an article title containing a tilde.
7519 !! endarticle
7521 # note that links containing signatures, like [[Foo~~~~]], are
7522 # massaged by the pre-save transform (PST) and so the tildes are never
7523 # seen by the parser.
7524 !! test
7525 Link containing a tilde
7526 !! wikitext
7527 [[Foo~bar]]
7528 !! html/php
7529 <p><a href="/wiki/Foo~bar" title="Foo~bar">Foo~bar</a>
7530 </p>
7531 !! html/parsoid
7532 <p><a rel="mw:WikiLink" href="./Foo~bar" title="Foo~bar">Foo~bar</a></p>
7533 !! end
7535 !! test
7536 Link containing double-single-quotes '' (bug 4598)
7537 !! wikitext
7538 [[Lista d''e paise d''o munno]]
7539 !! html/php
7540 <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>
7541 </p>
7542 !! html/parsoid
7543 <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>
7544 !! end
7546 !! test
7547 Link containing double-single-quotes '' in text (bug 4598 sanity check)
7548 !! wikitext
7549 Some [[Link|pretty ''italics'' and stuff]]!
7550 !! html/php
7551 <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>!
7552 </p>
7553 !! html/parsoid
7554 <p>Some <a rel="mw:WikiLink" href="Link" title="Link">pretty <i>italics</i> and stuff</a>!</p>
7555 !! end
7557 !! test
7558 Link containing double-single-quotes '' in text embedded in italics (bug 4598 sanity check)
7559 !! wikitext
7560 ''Some [[Link|pretty ''italics'' and stuff]]!''
7561 !! html
7562 <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>
7563 </p>
7564 !! end
7566 !! test
7567 Link with double quotes in title part (literal) and alternate part (interpreted)
7568 !! wikitext
7569 [[File:Denys_Savchenko_''Pentecoste''.jpg]]
7571 [[''Pentecoste'']]
7573 [[''Pentecoste''|Pentecoste]]
7575 [[''Pentecoste''|''Pentecoste'']]
7576 !! html/php
7577 <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>
7578 </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>
7579 </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>
7580 </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>
7581 </p>
7582 !! html/parsoid
7583 <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>
7584 <p><a rel="mw:WikiLink" href="''Pentecoste''" title="''Pentecoste''">''Pentecoste''</a></p>
7585 <p><a rel="mw:WikiLink" href="''Pentecoste''" title="''Pentecoste''">Pentecoste</a></p>
7586 <p><a rel="mw:WikiLink" href="''Pentecoste''" title="''Pentecoste''"><i>Pentecoste</i></a></p>
7587 !! end
7589 !! test
7590 Broken image links with HTML captions (bug 39700)
7591 !! wikitext
7592 [[File:Nonexistent|<script></script>]]
7593 [[File:Nonexistent|100x100px|<script></script>]]
7594 [[File:Nonexistent|&lt;]]
7595 [[File:Nonexistent|a<i>b</i>c]]
7596 !! html/php
7597 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script&gt;&lt;/script&gt;</a>
7598 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script&gt;&lt;/script&gt;</a>
7599 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;</a>
7600 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">abc</a>
7601 </p>
7602 !! html/parsoid
7603 <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>
7604 <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>
7605 <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>
7606 <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>
7607 !! end
7609 !! test
7610 Plain link to URL
7611 !! wikitext
7612 [[http://www.example.com]]
7613 !! html/php
7614 <p>[<a rel="nofollow" class="external autonumber" href="http://www.example.com">[1]</a>]
7615 </p>
7616 !! html/parsoid
7617 <p>[<a rel="mw:ExtLink" href="http://www.example.com"></a>]</p>
7618 !! end
7620 !! test
7621 Plain link to URL with link text
7622 !! wikitext
7623 [[http://www.example.com Link text]]
7624 !! html
7625 <p>[<a rel="nofollow" class="external text" href="http://www.example.com">Link text</a>]
7626 </p>
7627 !! end
7629 !! test
7630 Plain link to protocol-relative URL
7631 !! wikitext
7632 [[//www.example.com]]
7633 !! html/php
7634 <p>[<a rel="nofollow" class="external autonumber" href="//www.example.com">[1]</a>]
7635 </p>
7636 !! html/parsoid
7637 <p>[<a rel="mw:ExtLink" href="//www.example.com"></a>]</p>
7638 !! end
7640 !! test
7641 Plain link to protocol-relative URL with link text
7642 !! wikitext
7643 [[//www.example.com Link text]]
7644 !! html
7645 <p>[<a rel="nofollow" class="external text" href="//www.example.com">Link text</a>]
7646 </p>
7647 !! end
7649 !! test
7650 Plain link to page with question mark in title
7651 !! wikitext
7652 [[A?b]]
7654 [[A?b|Baz]]
7655 !! html
7656 <p><a href="/wiki/A%3Fb" title="A?b">A?b</a>
7657 </p><p><a href="/wiki/A%3Fb" title="A?b">Baz</a>
7658 </p>
7659 !! end
7662 # I'm fairly sure the expected result here is wrong.
7663 # We want these to be URL links, not pseudo-pages with URLs for titles....
7664 # However the current output is also pretty screwy.
7666 # ----
7667 # I'm changing it to match the current output--it arguably makes more
7668 # sense in the light of the test above. Old expected result was:
7669 #<p>Piped link to URL: <a href="/index.php?title=Http://www.example.com&amp;action=edit" class="new">an example URL</a>
7670 #</p>
7671 # But I think this test is bordering on "garbage in, garbage out" anyway.
7672 # -- wtm
7673 !! test
7674 Piped link to URL
7675 !! wikitext
7676 Piped link to URL: [[http://www.example.com|an example URL]]
7677 !! html/php
7678 <p>Piped link to URL: [<a rel="nofollow" class="external text" href="http://www.example.com%7Can">example URL</a>]
7679 </p>
7680 !! html/parsoid
7681 <p>Piped link to URL: [<a rel="mw:ExtLink" href="http://www.example.com|an">example URL</a>]</p>
7682 !! end
7684 !! test
7685 BUG 2: [[page|http://url/]] should link to page, not http://url/
7686 !! wikitext
7687 [[Main Page|http://url/]]
7688 !! html/php
7689 <p><a href="/wiki/Main_Page" title="Main Page">http://url/</a>
7690 </p>
7691 !! html/parsoid
7692 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">http://url/</a></p>
7693 !! end
7695 # Parsoid does not mark self-links, by design.
7696 !! test
7697 BUG 337: Escaped self-links should be bold
7698 !! options
7699 title=[[Bug462]]
7700 !! wikitext
7701 [[Bu&#103;462]] [[Bug462]]
7702 !! html/php
7703 <p><strong class="selflink">Bu&#103;462</strong> <strong class="selflink">Bug462</strong>
7704 </p>
7705 !! html/php+tidy
7706 <p><strong class="selflink">Bug462</strong> <strong class="selflink">Bug462</strong></p>
7707 !! html/parsoid
7708 <p><a rel="mw:WikiLink" href="./Bug462" title="Bug462">Bug462</a> <a rel="mw:WikiLink" href="./Bug462" title="Bug462">Bug462</a></p>
7709 !! end
7711 !! test
7712 Self-link to section should not be bold
7713 !! options
7714 title=[[Main Page]]
7715 !! wikitext
7716 [[Main Page#section]]
7717 !! html
7718 <p><a href="/wiki/Main_Page#section" title="Main Page">Main Page#section</a>
7719 </p>
7720 !! end
7722 !! article
7724 !! text
7725 This is 00.
7726 !! endarticle
7728 !!test
7729 Self-link to numeric title
7730 !!options
7731 title=[[0]]
7732 !! wikitext
7733 [[0]]
7734 !! html
7735 <p><strong class="selflink">0</strong>
7736 </p>
7737 !!end
7739 !!test
7740 Link to numeric-equivalent title
7741 !!options
7742 title=[[0]]
7743 !! wikitext
7744 [[00]]
7745 !! html
7746 <p><a href="/wiki/00" title="00">00</a>
7747 </p>
7748 !!end
7750 !! test
7751 <nowiki> inside a link
7752 !! wikitext
7753 [[Main<nowiki> Page</nowiki>]] [[Main Page|the main page <nowiki>[it's not very good]</nowiki>]]
7754 !! html
7755 <p>[[Main Page]] <a href="/wiki/Main_Page" title="Main Page">the main page [it's not very good]</a>
7756 </p>
7757 !! end
7759 !! test
7760 Non-breaking spaces in title
7761 !! wikitext
7762 [[&nbsp; Main &nbsp; Page &nbsp;]]
7763 !! html
7764 <p><a href="/wiki/Main_Page" title="Main Page">&#160; Main &#160; Page &#160;</a>
7765 </p>
7766 !!end
7768 !! test
7769 Internal link with ca linktrail, surrounded by bold apostrophes (bug 27473 primary issue)
7770 !! options
7771 language=ca
7772 !! wikitext
7773 '''[[Main Page]]'''
7774 !! html
7775 <p><b><a href="/wiki/Main_Page" title="Main Page">Main Page</a></b>
7776 </p>
7777 !! end
7779 !! test
7780 Internal link with ca linktrail, surrounded by italic apostrophes (bug 27473 primary issue)
7781 !! options
7782 language=ca
7783 !! wikitext
7784 ''[[Main Page]]''
7785 !! html
7786 <p><i><a href="/wiki/Main_Page" title="Main Page">Main Page</a></i>
7787 </p>
7788 !! end
7790 !! test
7791 Internal link with en linktrail: no apostrophes (bug 27473)
7792 !! options
7793 language=en
7794 !! wikitext
7795 [[Something]]'nice
7796 !! html
7797 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (page does not exist)">Something</a>'nice
7798 </p>
7799 !! end
7801 !! test
7802 Internal link with ca linktrail with apostrophes (bug 27473)
7803 !! options
7804 language=ca
7805 !! wikitext
7806 [[Something]]'nice
7807 !! html
7808 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (encara no existeix)">Something'nice</a>
7809 </p>
7810 !! end
7812 !! test
7813 Internal link with kaa linktrail with apostrophes (bug 27473)
7814 !! options
7815 language=kaa
7816 !! wikitext
7817 [[Something]]'nice
7818 !! html
7819 <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>
7820 </p>
7821 !! end
7823 !! test
7824 Link with multiple ":" in a subpage-supporting namespace (bug 63636)
7825 !! wikitext
7826 [[User:Foo/Test/63636:Bar|Test]]
7827 !! html/php
7828 <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>
7829 </p>
7830 !! html/parsoid
7831 <p><a rel="mw:WikiLink" href="./User:Foo/Test/63636:Bar" title="User:Foo/Test/63636:Bar">Test</a></p>
7832 !! end
7834 !! test
7835 Purely hash wikilink
7836 !! options
7837 title=[[User:test/123]]
7838 !! wikitext
7839 [[#a|b]]
7840 !! html/php
7841 <p><a href="#a">b</a>
7842 </p>
7843 !! html/parsoid
7844 <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>
7845 !! end
7847 !! test
7848 1. Interaction of linktrail and template encapsulation
7849 !! options
7850 parsoid
7851 !! wikitext
7852 {{echo|[[Foo]]}}l
7853 !! html
7854 <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>
7855 !! end
7857 !! test
7858 2. Interaction of linktrail and template encapsulation
7859 !! options
7860 parsoid
7861 !! wikitext
7862 {{echo|Some [[Fool]]}}s
7863 !! html
7864 <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>
7865 !! end
7867 !! test
7868 3. Interaction of linktrail and template encapsulation
7869 !! options
7870 parsoid
7871 !! wikitext
7872 {{echo|Some [[Fool]]s are '''bold and foolish'''}}
7873 !! html
7874 <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>
7875 !! end
7877 !! article
7878 Söfnuður
7879 !! text
7880 Test.
7881 !! endarticle
7883 !! test
7884 Internal link with is link prefix
7885 !! options
7886 language=is
7887 !! wikitext
7888 Aðrir mótmælenda[[söfnuður|söfnuðir]] og
7889 !! html
7890 <p>Aðrir <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðir</a> og
7891 </p>
7892 !! end
7894 !! article
7895 Mótmælendatrú
7896 !! text
7897 Test.
7898 !! endarticle
7900 !! test
7901 Internal link with is link trail and link prefix
7902 !! options
7903 language=is
7904 !! wikitext
7905 [[mótmælendatrú|xxx]]ar
7906 [[mótmælendatrú]]ar
7907 mótmælenda[[söfnuður]]
7908 mótmælenda[[söfnuður|söfnuðir]]
7909 mótmælenda[[söfnuður|söfnuðir]]xxx
7910 !! html
7911 <p><a href="/wiki/M%C3%B3tm%C3%A6lendatr%C3%BA" title="Mótmælendatrú">xxxar</a>
7912 <a href="/wiki/M%C3%B3tm%C3%A6lendatr%C3%BA" title="Mótmælendatrú">mótmælendatrúar</a>
7913 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuður</a>
7914 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðir</a>
7915 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðirxxx</a>
7916 </p>
7917 !! end
7919 !! test
7920 Parsoid link trail escaping
7921 !! options
7922 parsoid=html2wt,html2html
7923 !! html/parsoid
7924 <p><a rel="mw:WikiLink" href="Apple" title="Apple">apple</a>s</p>
7925 !! wikitext
7926 [[apple]]<nowiki/>s
7927 !! end
7929 !! test
7930 Parsoid link prefix escaping
7931 !! options
7932 language=is
7933 parsoid=html2wt,html2html
7934 !! html/parsoid
7935 <p>Aðrir mótmælenda<a rel="mw:WikiLink" href="Söfnuður" title="Söfnuður">söfnuður</a></p>
7936 !! wikitext
7937 Aðrir mótmælenda<nowiki/>[[söfnuður]]
7938 !! end
7940 !! test
7941 Parsoid-centric test: Whitespace in ext- and wiki-links should be preserved
7942 !! wikitext
7943 [[Foo|  bar]]
7945 [[Foo|  ''bar'']]
7947 [http://wp.org   foo]
7949 [http://wp.org   ''foo'']
7950 !! html
7951 <p><a href="/wiki/Foo" title="Foo">  bar</a>
7952 </p><p><a href="/wiki/Foo" title="Foo">  <i>bar</i></a>
7953 </p><p><a rel="nofollow" class="external text" href="http://wp.org">foo</a>
7954 </p><p><a rel="nofollow" class="external text" href="http://wp.org"><i>foo</i></a>
7955 </p>
7956 !! end
7958 !! test
7959 Parsoid: Scoped parsing should handle mixed transclusions and plain text
7960 !! options
7961 parsoid
7962 !! wikitext
7963 [[Foo|{{echo|a}} b {{echo|c}}]]
7964 !! html
7965 <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>
7966 !! end
7968 !! test
7969 Link with angle bracket after anchor
7970 !! wikitext
7971 [[Foo#<bar>]]
7972 !! html/php
7973 <p><a href="/wiki/Foo#.3Cbar.3E" title="Foo">Foo#&lt;bar&gt;</a>
7974 </p>
7975 !! html/parsoid
7976 <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>
7977 !! end
7980 ### Interwiki links (see maintenance/interwiki.sql)
7983 !! test
7984 Inline interwiki link
7985 !! options
7986 parsoid=wt2html,wt2wt,html2html
7987 !! wikitext
7988 [[MeatBall:SoftSecurity]]
7989 !! html/php
7990 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity</a>
7991 </p>
7992 !! html/parsoid
7993 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity" title="meatball:SoftSecurity">MeatBall:SoftSecurity</a></p>
7994 !! end
7996 !! test
7997 Inline interwiki link with empty title (bug 2372)
7998 !! options
7999 parsoid=wt2html,wt2wt,html2html
8000 !! wikitext
8001 [[MeatBall:]]
8002 !! html/php
8003 <p><a href="http://www.usemod.com/cgi-bin/mb.pl" class="extiw" title="meatball:">MeatBall:</a>
8004 </p>
8005 !! html/parsoid
8006 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?" title="meatball:">MeatBall:</a></p>
8007 !! end
8009 !! test
8010 Interwiki link encoding conversion (bug 1636)
8011 !! wikitext
8012 *[[Wikipedia:ro:Olteni&#0355;a]]
8013 *[[Wikipedia:ro:Olteni&#355;a]]
8014 !! html
8015 <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>
8016 <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>
8018 !! html+tidy
8019 <ul>
8020 <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>
8021 <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>
8022 </ul>
8023 !! end
8025 !! test
8026 Interwiki link with fragment (bug 2130)
8027 !! wikitext
8028 [[MeatBall:SoftSecurity#foo]]
8029 !! html
8030 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity#foo" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity#foo</a>
8031 </p>
8032 !! end
8034 # Ideally the wikipedia: prefix here should be proto-relative too
8035 # [CSA]: this is kind of a bogus test, as the PHP parser test doesn't
8036 # define the 'en' prefix, and originally the test used 'wikipedia',
8037 # which isn't a localinterwiki prefix hence the links to the 'en:Foo'
8038 # article.
8039 !! test
8040 Different interwiki prefixes mapping to the same URL
8041 !! wikitext
8042 [[:en:Foo]]
8044 [[:en:Foo|Foo]]
8046 [[wikipedia:Foo]]
8048 [[:wikipedia:Foo|Foo]]
8050 [[wikipedia:en:Foo]]
8052 [[:wikipedia:en:Foo]]
8054 [[  wikiPEdia :Foo]]
8055 !! html/parsoid
8056 <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>
8058 <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>
8060 <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>
8062 <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>
8064 <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>
8066 <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>
8068 <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>
8069 !! end
8071 !! test
8072 Interwiki links that cannot be represented in wiki syntax
8073 !! wikitext
8074 [[meatball:ok]]
8075 [[meatball:ok#foo|ok with fragment]]
8076 [[meatball:ok_as_well?|ok ending with ? mark]]
8077 [http://de.wikipedia.org/wiki/Foo?action=history has query]
8078 [http://de.wikipedia.org/wiki/#foo is just fragment]
8080 !! html/php
8081 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?ok" class="extiw" title="meatball:ok">meatball:ok</a>
8082 <a href="http://www.usemod.com/cgi-bin/mb.pl?ok#foo" class="extiw" title="meatball:ok">ok with fragment</a>
8083 <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>
8084 <a rel="nofollow" class="external text" href="http://de.wikipedia.org/wiki/Foo?action=history">has query</a>
8085 <a rel="nofollow" class="external text" href="http://de.wikipedia.org/wiki/#foo">is just fragment</a>
8086 </p>
8087 !! html/parsoid
8088 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?ok" title="meatball:ok">meatball:ok</a>
8089 <a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?ok#foo" title="meatball:ok">ok with fragment</a>
8090 <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>
8091 <a rel="mw:ExtLink" href="http://de.wikipedia.org/wiki/Foo?action=history">has query</a>
8092 <a rel="mw:ExtLink" href="http://de.wikipedia.org/wiki/#foo">is just fragment</a></p>
8093 !! end
8095 !! test
8096 Interwiki links: trail
8097 !! wikitext
8098 [[wikipedia:Foo|Ba]]r
8099 !! html/php
8100 <p><a href="http://en.wikipedia.org/wiki/Foo" class="extiw" title="wikipedia:Foo">Bar</a>
8101 </p>
8102 !! html/parsoid
8103 <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>
8104 !! end
8106 !! test
8107 Local interwiki link
8108 !! options
8109 parsoid=wt2html,wt2wt,html2html
8110 !! wikitext
8111 [[local:Template:Foo]]
8112 !! html/php
8113 <p><a href="/wiki/Template:Foo" title="Template:Foo">local:Template:Foo</a>
8114 </p>
8115 !! html/parsoid
8116 <p><a rel="mw:WikiLink" href="./Template:Foo" title="Template:Foo">local:Template:Foo</a></p>
8117 !! end
8119 # Parsoid does not mark self-links, by design.
8120 !! test
8121 Local interwiki link: self-link to current page
8122 !! options
8123 title=[[Main Page]]
8124 parsoid=wt2html,wt2wt,html2html
8125 !! wikitext
8126 [[local:Main Page]]
8127 !! html/php
8128 <p><strong class="selflink">local:Main Page</strong>
8129 </p>
8130 !! html/parsoid
8131 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">local:Main Page</a></p>
8132 !! end
8134 !! test
8135 Local interwiki link: prefix only (bug 64167)
8136 !! options
8137 parsoid=wt2html,wt2wt,html2html
8138 !! wikitext
8139 [[local:]]
8140 !! html/php
8141 <p><a href="/wiki/Main_Page" title="Main Page">local:</a>
8142 </p>
8143 !! html/parsoid
8144 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">local:</a></p>
8145 !! end
8147 !! test
8148 Local interwiki link: with additional interwiki prefix (bug 61357)
8149 !! options
8150 parsoid=wt2html,wt2wt,html2html
8151 !! wikitext
8152 [[local:meatball:Hello]]
8153 !! html/php
8154 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?Hello" class="extiw" title="meatball:Hello">local:meatball:Hello</a>
8155 </p>
8156 !! html/parsoid
8157 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?Hello" title="meatball:Hello">local:meatball:Hello</a></p>
8158 !! end
8160 !! test
8161 Multiple local interwiki link prefixes
8162 !! wikitext
8163 [[local:local:local:local:mi:local:Foo]]
8164 !! options
8165 parsoid=wt2html,wt2wt,html2html
8166 !! html/php
8167 <p><a href="/wiki/Foo" title="Foo">local:local:local:local:mi:local:Foo</a>
8168 </p>
8169 !! html/parsoid
8170 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">local:local:local:local:mi:local:Foo</a></p>
8171 !! end
8174 ### Interlanguage links
8175 ### Language links (so that searching for '### language' matches..)
8178 !! test
8179 Interlanguage link
8180 !! options
8181 parsoid=wt2html,wt2wt,html2html
8182 !! wikitext
8183 Blah blah blah
8184 [[zh:Chinese]]
8185 !! html/php
8186 <p>Blah blah blah
8187 </p>
8188 !! html/parsoid
8189 <p>Blah blah blah</p>
8190 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
8191 !! end
8193 !! test
8194 Interlanguage link with spacing
8195 !! options
8196 parsoid=wt2html,wt2wt,html2html
8197 !! wikitext
8198 Blah blah blah
8199 [[   zh  :    Chinese     ]]
8200 !! html/php
8201 <p>Blah blah blah
8202 </p>
8203 !! html/parsoid
8204 <p>Blah blah blah</p>
8205 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
8206 !! end
8208 !! test
8209 Double interlanguage link
8210 !! options
8211 parsoid=wt2html,wt2wt,html2html
8212 !! wikitext
8213 Blah blah blah
8214 [[es:Spanish]]
8215 [[zh:Chinese]]
8216 !! html/php
8217 <p>Blah blah blah
8218 </p>
8219 !! html/parsoid
8220 <p>Blah blah blah</p>
8221 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Spanish"/>
8222 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
8223 !! end
8225 !! test
8226 Interlanguage link variations
8227 !! options
8228 parsoid=wt2html,wt2wt,html2html
8229 !! wikitext
8230 Blah blah blah
8231 [[   es :Spanish]]
8232 [[ ZH :Chinese]]
8233 [[es:Foo_bar]]
8234 !! html/php
8235 <p>Blah blah blah
8236 </p>
8237 !! html/parsoid
8238 <p>Blah blah blah</p>
8239 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Spanish" />
8240 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese" />
8241 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Foo_bar" />
8242 !! end
8244 !! test
8245 Space and question mark encoding in interlanguage links (T95473)
8246 !! options
8247 parsoid=wt2html,wt2wt,html2html
8248 !! wikitext
8249 Blah blah blah
8250 [[es:Foo bar?]]
8251 !! html/php
8252 <p>Blah blah blah
8253 </p>
8254 !! html/parsoid
8255 <p>Blah blah blah</p>
8256 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Foo_bar%3F" />
8257 !! end
8259 !! test
8260 Interlanguage link, with prefix links
8261 !! options
8262 language=ln
8263 !! wikitext
8264 Blah blah blah
8265 [[zh:Chinese]]
8266 !! html/php
8267 <p>Blah blah blah
8268 </p>
8269 !! html/parsoid
8270 <p>Blah blah blah</p>
8271 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
8272 !! end
8274 !! test
8275 Double interlanguage link, with prefix links (bug 8897)
8276 !! options
8277 language=ln
8278 !! wikitext
8279 Blah blah blah
8280 [[es:Spanish]]
8281 [[zh:Chinese]]
8282 !! html/php
8283 <p>Blah blah blah
8284 </p>
8285 !! html/parsoid
8286 <p>Blah blah blah</p>
8287 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Spanish"/>
8288 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
8289 !! end
8291 !! test
8292 "Extra" interlanguage links (bug 32189 / gerrit 111390)
8293 !! wikitext
8294 Blah blah blah
8295 [[mul:Article]]
8296 !! html/php
8297 <p>Blah blah blah
8298 </p>
8299 !! html/parsoid
8300 <p>Blah blah blah</p>
8301 <link rel="mw:PageProp/Language" title="Multilingual" href="http://wikisource.org/wiki/Article"/>
8302 !! end
8304 !! test
8305 Parsoid-specific test: Wikilinks with &nbsp; should RT properly
8306 !! options
8307 language=ln
8308 !! wikitext
8309 [[WW&nbsp;II]]
8310 !! html
8311 <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>
8312 </p>
8313 !! end
8315 !! test
8316 Parsoid bug 53221: Wikilinks should be properly entity-escaped
8317 !! options
8318 parsoid=html2wt
8319 !! html/parsoid
8320 <p>He&amp;nbsp;llo <a href="Foo" rel="mw:WikiLink">He&amp;nbsp;llo</a></p>
8321 <p>He&amp;nbsp;llo <a href="He&amp;nbsp;llo" rel="mw:WikiLink">He&amp;nbsp;llo</a></p>
8322 !! wikitext
8323 He&amp;nbsp;llo [[Foo|He&amp;nbsp;llo]]
8325 He&amp;nbsp;llo [[He&amp;nbsp;llo]]
8326 !! end
8328 !! test
8329 Parsoid: handle constructor well
8330 !! wikitext
8331 [[constructor]]
8333 [[constructor:foo]]
8334 !! html/php
8335 <p><a href="/index.php?title=Constructor&amp;action=edit&amp;redlink=1" class="new" title="Constructor (page does not exist)">constructor</a>
8336 </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>
8337 </p>
8338 !! html/parsoid
8339 <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>
8341 <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>
8342 !! end
8344 !! article
8346 !! text
8347 Test.
8348 !! endarticle
8350 # Note that `ko` isn't a known interlanguage prefix
8351 !! test
8352 Parsoid: recognize interlanguage links without a target page
8353 !! options
8355 !! wikitext
8356 [[es:]]
8358 [[ko:]]
8359 !! html/php
8361 !! html/parsoid
8362 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/"/>
8364 <p><a rel="mw:WikiLink" href="./Ko:" title="Ko:">ko:</a></p>
8365 !! end
8367 # Note that `ko` isn't a known interwiki prefix
8368 !! test
8369 Parsoid: recognize interwiki links without a target page
8370 !! options
8371 parsoid=wt2html,wt2wt,html2html
8372 !! wikitext
8373 [[:es:]]
8375 [[:ko:]]
8376 !! html/php
8377 <p><a href="http://es.wikipedia.org/wiki/" class="extiw" title="es:">es:</a>
8378 </p><p><a href="/wiki/Ko:" title="Ko:">ko:</a>
8379 </p>
8380 !! html/parsoid
8381 <p><a rel="mw:ExtLink" href="http://es.wikipedia.org/wiki/" title="es:">es:</a></p>
8382 <p><a rel="mw:WikiLink" href="./Ko:" title="Ko:">ko:</a></p>
8383 !! end
8385 !! test
8386 Handle interwiki links pointing to the current wiki as plain wiki links (bug 45209)
8387 !! wikitext
8388 [[mi:Foo]]
8389 !! html/php
8390 <p><a href="/wiki/Foo" title="Foo">mi:Foo</a>
8391 </p>
8392 !! html/parsoid
8393 <p><a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{"stx":"simple","a":{"href":"./Foo"},"sa":{"href":"mi:Foo"}}'>mi:Foo</a></p>
8394 !! end
8396 !! test
8397 Interlanguage link with preceding local interwiki link (bug 68085)
8398 !! options
8399 parsoid=wt2html,wt2wt,html2html
8400 !! wikitext
8401 Blah blah blah
8402 [[local:es:Spanish]]
8403 !! html/php
8404 <p>Blah blah blah
8405 <a href="http://es.wikipedia.org/wiki/Spanish" class="extiw" title="es:Spanish">local:es:Spanish</a>
8406 </p>
8407 !! html/parsoid
8408 <p>Blah blah blah
8409 <a rel="mw:ExtLink" href="http://es.wikipedia.org/wiki/Spanish" title="es:Spanish">local:es:Spanish</a></p>
8410 !! end
8412 !! test
8413 Looks like an interlanguage link, but is actually a local interwiki
8414 !! options
8415 parsoid=wt2html,wt2wt,html2html
8416 !! wikitext
8417 Blah blah blah
8418 [[mi:Template:Foo]]
8419 !! html/php
8420 <p>Blah blah blah
8421 <a href="/wiki/Template:Foo" title="Template:Foo">mi:Template:Foo</a>
8422 </p>
8423 !! html/parsoid
8424 <p>Blah blah blah
8425 <a rel="mw:WikiLink" href="./Template:Foo" title="Template:Foo">mi:Template:Foo</a></p>
8426 !! end
8429 ### Redirects, Parsoid-only
8432 !! test
8433 1. Simple redirect to page
8434 !! wikitext
8435 #REDIRECT [[Main Page]]
8436 !! html/parsoid
8437 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
8438 !! end
8440 !! test
8441 2. Other redirect variants
8442 !! wikitext
8443 #REDIRECT [[Main_Page]]
8444 !! html/parsoid
8445 <link rel="mw:PageProp/redirect" href="./Main_Page" data-parsoid='{"src":"#REDIRECT ","a":{"href":"./Main_Page"},"sa":{"href":"Main_Page"}}'/>
8446 !! end
8448 # Not a valid redirect in PHP (although perhaps it was, once upon a time)
8449 # This tests the Parsoid bail-out code.
8450 !! test
8451 3. Other redirect variants
8452 !! wikitext
8453 #REDIRECT [[<nowiki>[[Bar]]</nowiki>]]
8454 !! html/parsoid
8455 <ol><li data-parsoid>REDIRECT [[[[Bar]]]]</li></ol>
8456 !! end
8458 !! test
8459 4. Redirect to a templated destination
8460 !! wikitext
8461 #REDIRECT [[{{echo|Foo}}bar]]
8462 !! html/parsoid
8463 <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"}]]}'/>
8464 !! end
8466 !! test
8467 Empty redirect
8468 !! options
8469 parsoid=wt2html,wt2wt
8470 !! wikitext
8471 #REDIRECT [[]]
8472 !! html/parsoid
8473 <ol>
8474 <li>REDIRECT [[]]</li></ol>
8475 !! end
8477 !! test
8478 Optional colon in #REDIRECT
8479 !! options
8480 # the colon is archaic syntax.  we support it for wt2html, but we
8481 # don't care that it roundtrips back to the modern syntax.
8482 parsoid=wt2html,html2html
8483 !! wikitext
8484 #REDIRECT:[[Main Page]]
8485 !! html/parsoid
8486 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
8487 !! end
8489 !! test
8490 Whitespace in #REDIRECT with optional colon
8491 !! options
8492 # the colon and gratuitous whitespace is archaic syntax.  we support
8493 # it for wt2html, but we don't care that it roundtrips back to the
8494 # modern syntax (without extra whitespace)
8495 parsoid=wt2html,html2html
8496 !! wikitext
8498  #REDIRECT 
8500 [[Main Page]]
8501 !! html/parsoid
8502 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
8503 !! end
8505 !! test
8506 Piped link in #REDIRECT
8507 !! options
8508 # content after piped link is ignored.  we support this syntax,
8509 # but don't care that the piped link is lost when we roundtrip this.
8510 parsoid=wt2html
8511 !! wikitext
8512 #REDIRECT [[Main Page|bar]]
8513 !! html/parsoid
8514 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
8515 !! end
8517 !! test
8518 Redirect to category (T104502)
8519 !! options
8520 parsoid=wt2html,wt2wt
8521 !! wikitext
8522 #REDIRECT [[Category:Foo]]
8523 !! html/parsoid
8524 <link rel="mw:PageProp/redirect" href="./Category:Foo"/>
8525 !! end
8527 !! test
8528 Redirect to category with URL encoding (T104502)
8529 !! options
8530 parsoid=wt2html
8531 !! wikitext
8532 #REDIRECT [[Category%3AFoo]]
8533 !! html/parsoid
8534 <link rel="mw:PageProp/redirect" href="./Category:Foo"/>
8535 !! end
8537 !! test
8538 Redirect to category page
8539 !! wikitext
8540 #REDIRECT [[:Category:Foo]]
8541 !! html/parsoid
8542 <link rel="mw:PageProp/redirect" href="./Category:Foo"/>
8543 !! end
8545 !! test
8546 Redirect to image page (1)
8547 !! wikitext
8548 #REDIRECT [[File:Wiki.png]]
8549 !! html/parsoid
8550 <link rel="mw:PageProp/redirect" href="./File:Wiki.png"/>
8551 !! end
8553 !! test
8554 Redirect to image page (2)
8555 !! wikitext
8556 #REDIRECT [[Image:Wiki.png]]
8557 !! html/parsoid
8558 <link rel="mw:PageProp/redirect" href="./File:Wiki.png"  data-parsoid='{"src":"#REDIRECT ","a":{"href":"./File:Wiki.png"},"sa":{"href":"Image:Wiki.png"}}'/>
8559 !! end
8561 # html2wt disabled because wts serializes as "#REDIRECT [[:en:File:Wiki.png]]"
8562 # Next test confirms this.
8563 !! test
8564 Redirect to language (1) (T104918)
8565 !! options
8566 parsoid=wt2html,wt2wt,html2html
8567 !! wikitext
8568 #REDIRECT [[en:File:Wiki.png]]
8569 !! html/parsoid
8570 <link rel="mw:PageProp/redirect" href="//en.wikipedia.org/wiki/File:Wiki.png"/>
8571 !! end
8573 !! test
8574 Redirect to language (2) (T104918)
8575 !! wikitext
8576 #REDIRECT [[:en:File:Wiki.png]]
8577 !! html/parsoid
8578 <link rel="mw:PageProp/redirect" href="//en.wikipedia.org/wiki/File:Wiki.png"/>
8579 !! end
8581 !! test
8582 Redirect to interwiki (T104918)
8583 !! wikitext
8584 #REDIRECT [[meatball:File:Wiki.png]]
8585 !! html/parsoid
8586 <link rel="mw:PageProp/redirect" href="http://www.usemod.com/cgi-bin/mb.pl?File:Wiki.png"/>
8587 !! end
8589 !! test
8590 Non-English #REDIRECT
8591 !! options
8592 language=is
8593 !! wikitext
8594 #TILVÍSUN [[Main Page]]
8595 !! html/parsoid
8596 <link rel="mw:PageProp/redirect" href="./Main_Page" data-parsoid='{"src":"#TILVÍSUN ","a":{"href":"./Main_Page"},"sa":{"href":"Main Page"}}'/>
8597 !! end
8599 !! test
8600 Redirect syntax under text isn't considered a redirect
8601 !! wikitext
8602 some text
8603 #redirect [[Main Page]]
8604 !! html/parsoid
8605 <p>some text</p>
8606 <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>
8607 !! end
8609 # FIXME: Should hoist the redirect to the top of the page and ensure there
8610 # is only one.
8611 !! test
8612 New redirect
8613 !! options
8614 parsoid=html2wt
8615 !! html/parsoid
8616 <p>Foo<link rel="mw:PageProp/redirect" href="./Foo"/></p>
8617 !! wikitext
8619 #REDIRECT [[Foo]]
8620 !! end
8623 ## XHTML tidiness
8626 !! test
8627 <br> to <br />
8628 !! wikitext
8629 1<br>2<br />3
8630 !! html
8631 <p>1<br />2<br />3
8632 </p>
8633 !! end
8635 !! test
8636 Broken br tag sanitization
8637 !! wikitext
8638 </br>
8639 !! html/php
8640 <p>&lt;/br&gt;
8641 </p>
8642 !! end
8644 # TODO: Fix html2html mode (bug 51055)!
8645 !! test
8646 Parsoid: Broken br tag recognition
8647 !! options
8648 parsoid=wt2html
8649 !! wikitext
8650 </br>
8652 <br/ >
8653 !! html+tidy
8654 <p><br /></p>
8655 <p><br /></p>
8656 !! end
8658 !! test
8659 Incorrecly removing closing slashes from correctly formed XHTML
8660 !! wikitext
8661 <br style="clear:both;" />
8662 !! html
8663 <p><br style="clear:both;" />
8664 </p>
8665 !! end
8667 !! test
8668 Failing to transform badly formed HTML into correct XHTML
8669 !! wikitext
8670 <br style="clear: left;">
8671 <br style="clear: right;">
8672 <br style="clear: both;">
8673 !! html
8674 <p><br style="clear: left;" />
8675 <br style="clear: right;" />
8676 <br style="clear: both;" />
8677 </p>
8678 !!end
8680 ## FIXME: Is Parsoid's acceptance of self-closing html-tags
8681 ## a feature or a bug? See https://phabricator.wikimedia.org/T76962
8682 !! test
8683 Handling html with a div self-closing tag
8684 !! wikitext
8685 <div title />
8686 <div title/>
8687 <div title/ >
8688 <div title=bar />
8689 <div title=bar/>
8690 <div title=bar/ >
8691 !! html/php
8692 <p>&lt;div title /&gt;
8693 &lt;div title/&gt;
8694 </p>
8695 <div>
8696 <p>&lt;div title=bar /&gt;
8697 &lt;div title=bar/&gt;
8698 </p>
8699 <div title="bar/"></div>
8700 </div>
8702 !! html/parsoid
8703 <div title="" data-parsoid='{"stx":"html","selfClose":true}'></div>
8704 <div title="" data-parsoid='{"stx":"html","selfClose":true}'></div>
8705 <div title="" data-parsoid='{"stx":"html","selfClose":true,"brokenHTMLTag":true}'></div>
8706 <div title="bar" data-parsoid='{"stx":"html","selfClose":true}'></div>
8707 <div title="bar" data-parsoid='{"stx":"html","selfClose":true}'></div>
8708 <div title="bar/" data-parsoid='{"stx":"html","autoInsertedEnd":true}'></div>
8709 !! end
8711 !! test
8712 Handling html with a br self-closing tag
8713 !! wikitext
8714 <br title />
8715 <br title/>
8716 <br title/ >
8717 <br title=bar />
8718 <br title=bar/>
8719 <br title=bar/ >
8720 !! html/php
8721 <p><br title="" />
8722 <br title="" />
8723 <br />
8724 <br title="bar" />
8725 <br title="bar" />
8726 <br title="bar/" />
8727 </p>
8728 !! html/parsoid
8729 <p><br title="" />
8730 <br title="" />
8731 <br title="" />
8732 <br title="bar" />
8733 <br title="bar" />
8734 <br title="bar/" />
8735 </p>
8736 !! end
8738 !! test
8739 Horizontal ruler (should it add that extra space?)
8740 !! wikitext
8741 <hr>
8742 <hr >
8743 foo <hr
8744 > bar
8745 !! html+tidy
8746 <hr />
8747 <hr />
8748 <p>foo</p>
8749 <hr />
8750 <p>bar</p>
8751 !! end
8753 !! test
8754 Horizontal ruler -- 4+ dashes render hr
8755 !! wikitext
8756 ----
8757 !! html
8758 <hr />
8760 !! end
8762 !! test
8763 Horizontal ruler -- eats additional dashes on the same line
8764 !! wikitext
8765 ---------
8766 !! html
8767 <hr />
8769 !! end
8771 !! test
8772 Horizontal ruler -- does not collapse dashes on consecutive lines
8773 !! wikitext
8774 ----
8775 ----
8776 !! html
8777 <hr />
8778 <hr />
8780 !! end
8782 !! test
8783 Horizontal ruler -- <4 dashes render as plain text
8784 !! wikitext
8786 !! html
8787 <p>---
8788 </p>
8789 !! end
8791 !! test
8792 Horizontal ruler -- Supports content following dashes on same line
8793 !! wikitext
8794 ---- Foo
8795 !! html
8796 <hr /> Foo
8798 !! html+tidy
8799 <hr />
8800 <p>Foo</p>
8801 !! end
8804 ### Block-level elements
8806 !! test
8807 Common list
8808 !! wikitext
8809 *Common list
8810 * item 2
8811 *item 3
8812 !! html
8813 <ul><li>Common list</li>
8814 <li> item 2</li>
8815 <li>item 3</li></ul>
8817 !! end
8819 !! test
8820 Numbered list
8821 !! wikitext
8822 #Numbered list
8823 #item 2
8824 # item 3
8825 !! html
8826 <ol><li>Numbered list</li>
8827 <li>item 2</li>
8828 <li> item 3</li></ol>
8830 !! end
8832 !! test
8833 Mixed list
8834 !! wikitext
8835 *Mixed list
8836 *# with numbers
8837 ** and bullets
8838 *# and numbers
8839 *bullets again
8840 **bullet level 2
8841 ***bullet level 3
8842 ***#Number on level 4
8843 **bullet level 2
8844 **#Number on level 3
8845 **#Number on level 3
8846 *#number level 2
8847 *Level 1
8848 *** Level 3
8849 #** Level 3, but ordered
8850 !! html
8851 <ul><li>Mixed list
8852 <ol><li> with numbers</li></ol>
8853 <ul><li> and bullets</li></ul>
8854 <ol><li> and numbers</li></ol></li>
8855 <li>bullets again
8856 <ul><li>bullet level 2
8857 <ul><li>bullet level 3
8858 <ol><li>Number on level 4</li></ol></li></ul></li>
8859 <li>bullet level 2
8860 <ol><li>Number on level 3</li>
8861 <li>Number on level 3</li></ol></li></ul>
8862 <ol><li>number level 2</li></ol></li>
8863 <li>Level 1
8864 <ul><li><ul><li> Level 3</li></ul></li></ul></li></ul>
8865 <ol><li><ul><li><ul><li> Level 3, but ordered</li></ul></li></ul></li></ol>
8867 !! end
8869 !! test
8870 1. Nested mixed wikitext and html list
8871 !! wikitext
8872 * hi
8873 * <ul><li>ho</li></ul>
8874 * hi
8875 ** ho
8876 !! html/php
8877 <ul><li> hi</li>
8878 <li> <ul><li>ho</li></ul></li>
8879 <li> hi
8880 <ul><li> ho</li></ul></li></ul>
8882 !! html/parsoid
8883 <ul><li> hi</li>
8884 <li> <ul data-parsoid='{"stx":"html"}'><li data-parsoid='{"stx":"html"}'>ho</li></ul></li>
8885 <li> hi
8886 <ul><li> ho</li></ul></li></ul>
8887 !! end
8889 !! test
8890 2. Nested mixed wikitext and html list (incompatible)
8891 !! wikitext
8892 ; hi
8893 : {{echo|<li>ho</li>}}
8894 !! html/php
8895 <dl><dt> hi</dt>
8896 <dd> <li>ho</li></dd></dl>
8898 !! html/parsoid
8899 <dl><dt> hi</dt>
8900 <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>
8901 !! end
8903 !! test
8904 Nested lists 1
8905 !! wikitext
8906 *foo
8907 **bar
8908 !! html
8909 <ul><li>foo
8910 <ul><li>bar</li></ul></li></ul>
8912 !! end
8914 !! test
8915 Nested lists 2
8916 !! wikitext
8917 **foo
8918 *bar
8919 !! html
8920 <ul><li><ul><li>foo</li></ul></li>
8921 <li>bar</li></ul>
8923 !! end
8925 !! test
8926 Nested lists 3 (first element empty)
8927 !! wikitext
8929 **bar
8930 !! html
8931 <ul><li>
8932 <ul><li>bar</li></ul></li></ul>
8934 !! end
8936 !! test
8937 Nested lists 4 (first element empty)
8938 !! wikitext
8940 *bar
8941 !! html
8942 <ul><li><ul><li></li></ul></li>
8943 <li>bar</li></ul>
8945 !! end
8947 !! test
8948 Nested lists 5 (both elements empty)
8949 !! wikitext
8952 !! html
8953 <ul><li><ul><li></li></ul></li>
8954 <li></li></ul>
8956 !! end
8958 !! test
8959 Nested lists 6 (both elements empty)
8960 !! wikitext
8963 !! html
8964 <ul><li>
8965 <ul><li></li></ul></li></ul>
8967 !! end
8969 !! test
8970 Nested lists 7 (skip initial nesting levels)
8971 !! wikitext
8972 *** foo
8973 !! html
8974 <ul><li><ul><li><ul><li> foo</li></ul></li></ul></li></ul>
8976 !! end
8978 !! test
8979 Nested lists 8 (multiple nesting transitions)
8980 !! wikitext
8981 * foo
8982 *** bar
8983 ** baz
8984 * boo
8985 !! html
8986 <ul><li> foo
8987 <ul><li><ul><li> bar</li></ul></li>
8988 <li> baz</li></ul></li>
8989 <li> boo</li></ul>
8991 !! end
8993 !! test
8994 Nested lists 9 (extension interaction)
8995 !! options
8996 parsoid
8997 !! wikitext
8998 *<references />
8999 !! html/parsoid
9000 <ul><li data-parsoid='{}'><ol class="mw-references" typeof="mw:Extension/references" about="#mwt2" data-parsoid='{}' data-mw='{"name":"references","attrs":{}}'></ol></li></ul>
9001 !! end
9003 !! test
9004 1. Lists with start-of-line-transparent tokens before bullets: Comments
9005 !! wikitext
9006 *foo
9007 *<!--cmt-->bar
9008 <!--cmt-->*baz
9009 !! html
9010 <ul><li>foo</li>
9011 <li>bar</li>
9012 <li>baz</li></ul>
9014 !! end
9016 !! test
9017 2. Lists with start-of-line-transparent tokens before bullets: Template close
9018 !! wikitext
9019 *foo {{echo|bar
9020 }}*baz
9021 !! html
9022 <ul><li>foo bar</li>
9023 <li>baz</li></ul>
9025 !! end
9027 !! test
9028 List items are not parsed correctly following a <pre> block (bug 785)
9029 !! wikitext
9030 * <pre>foo</pre>
9031 * <pre>bar</pre>
9032 * zar
9033 !! html/php
9034 <ul><li> <pre>foo</pre></li>
9035 <li> <pre>bar</pre></li>
9036 <li> zar</li></ul>
9038 !! html/parsoid
9039 <ul><li> <pre data-parsoid='{"stx":"html"}'>foo</pre></li>
9040 <li> <pre data-parsoid='{"stx":"html"}'>bar</pre></li>
9041 <li> zar</li></ul>
9042 !! end
9044 !! test
9045 List items from template
9046 !! wikitext
9048 {{inner list}}
9049 * item 2
9051 * item 0
9052 {{inner list}}
9053 * item 2
9055 * item 0
9056 * notSOL{{inner list}}
9057 * item 2
9058 !! html
9059 <ul><li> item 1</li>
9060 <li> item 2</li></ul>
9061 <ul><li> item 0</li>
9062 <li> item 1</li>
9063 <li> item 2</li></ul>
9064 <ul><li> item 0</li>
9065 <li> notSOL</li>
9066 <li> item 1</li>
9067 <li> item 2</li></ul>
9069 !! end
9071 !! test
9072 List interrupted by empty line or heading
9073 !! wikitext
9074 * foo
9076 ** bar
9077 == A heading ==
9078 * Another list item
9079 !! html
9080 <ul><li> foo</li></ul>
9081 <ul><li><ul><li> bar</li></ul></li></ul>
9082 <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>
9083 <ul><li> Another list item</li></ul>
9085 !!end
9087 !!test
9088 Multiple list tags generated by templates
9089 !! wikitext
9090 {{echo|<li>}}a
9091 {{echo|<li>}}b
9092 {{echo|<li>}}c
9093 !! html
9094 <li>a
9095 <li>b
9096 <li>c</li>
9097 </li>
9098 </li>
9100 !! html+tidy
9101 <ul>
9102 <li>a</li>
9103 <li>b</li>
9104 <li>c</li>
9105 </ul>
9106 !!end
9108 !!test
9109 Single-comment whitespace lines dont break lists, and neither do multi-comment whitespace lines
9110 !! wikitext
9112 <!--This line will NOT split the list-->
9114  <!--This line will NOT split the list either-->
9116  <!--foo--> <!----> <!--This line NOT split the list either--> 
9118 !! html
9119 <ul><li>a</li>
9120 <li>b</li>
9121 <li>c</li>
9122 <li>d</li></ul>
9124 !!end
9126 !!test
9127 Replacing whitespace with tabs still doesn't break the list (gerrit 78327)
9128 !! wikitext
9130 <!--This line will NOT split the list-->        
9132         <!--This line will NOT split the list either-->         
9134         <!--foo--> <!---->      <!--This line NOT split the list
9135         either-->        
9137 !! html
9138 <ul><li>a</li>
9139 <li>b</li>
9140 <li>c</li>
9141 <li>d</li></ul>
9143 !!end
9145 !!test
9146 Test the li-hack
9147 (The PHP parser relies on Tidy for the hack)
9148 !!options
9149 parsoid=wt2html,wt2wt
9150 !! wikitext
9151 * foo
9152 * <li>li-hack
9153 * {{echo|<li>templated li-hack}}
9154 * <!--foo--> <li> unsupported li-hack with preceding comments
9156 <ul>
9157 <li><li>not a li-hack
9158 </li>
9159 </ul>
9160 !! html+tidy
9161 <ul>
9162 <li>foo</li>
9163 <li>li-hack</li>
9164 <li>templated li-hack</li>
9165 <li>unsupported li-hack with preceding comments</li>
9166 </ul>
9167 <ul>
9168 <li>not a li-hack</li>
9169 </ul>
9170 !!end
9172 !! test
9173 Parsoid: Make sure nested lists are serialized on their own line even if HTML contains no newlines
9174 !! options
9175 parsoid
9176 !! wikitext
9177 # foo
9178 ## bar
9179 * foo
9180 ** bar
9181 : foo
9182 :: bar
9183 !! html
9184 <ol>
9185 <li> foo<ol>
9186 <li> bar</li>
9187 </ol></li>
9188 </ol><ul>
9189 <li> foo<ul>
9190 <li> bar</li>
9191 </ul></li>
9192 </ul><dl>
9193 <dd> foo<dl>
9194 <dd> bar</dd>
9195 </dl></dd>
9196 </dl>
9197 !! end
9199 !! test
9200 Parsoid: Test of whitespace serialization with Templated bullets
9201 !! options
9202 parsoid
9203 !! wikitext
9204 * {{bullet}}
9205 !! html
9206 <ul>
9207 <li> </li><li about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"bullet","href":"./Template:Bullet"},"params":{},"i":0}}]}'> Bar</li>
9208 </ul>
9209 !! end
9211 # ------------------------------------------------------------------------
9212 # The next set of tests are about Parsoid's ability to handle badly nested
9213 # tags (parse, minimize scope of fixup, and roundtrip back)
9214 # ------------------------------------------------------------------------
9216 !! test
9217 Unbalanced closing block tags break a list
9218 (php parser relies on Tidy to fix up)
9219 !! wikitext
9220 <div>
9221 *a</div><div>
9222 *b</div>
9223 !! html+tidy
9224 <div>
9225 <ul>
9226 <li>a</li>
9227 </ul>
9228 </div>
9229 <div>
9230 <ul>
9231 <li>b</li>
9232 </ul>
9233 </div>
9234 !! end
9236 # Parsoid fails this test, but it might be tricky to support properly.
9237 # See bug 68395.
9238 !! test
9239 Unbalanced closing non-block tags don't break a list
9240 (php parser relies on Tidy to fix up)
9241 !! wikitext
9242 <span>
9243 *a</span><span>
9244 *b</span>
9245 !! html/php+tidy
9246 <ul>
9247 <li><span>a</span></li>
9248 <li><span>b</span></li>
9249 </ul>
9250 !! html/parsoid
9251 <span>
9252 <ul>
9253 <li>a<span></span>
9254 </li>
9255 <li>b
9256 </li>
9257 </ul>
9258 </span>
9259 !! end
9261 !! test
9262 Unclosed formatting tags that straddle lists are closed and reopened
9263 (php parser relies on Tidy to fix up)
9264 !! options
9265 parsoid=wt2html,wt2wt,html2html
9266 !! wikitext
9267 # <s> a
9268 # b </s>
9269 !! html/php+tidy
9270 <ol>
9271 <li><s>a</s></li>
9272 <li><s>b</s></li>
9273 </ol>
9274 !! html/parsoid
9275 <ol><li> <s> a</s></li>
9276 <li><s> b </s></li></ol>
9277 !! end
9279 # See bug 68395.
9280 !!test
9281 1. List embedded in a formatting tag
9282 !! wikitext
9283 <small>
9284 * foo
9285 </small>
9286 !! html/php+tidy
9287 <ul>
9288 <li><small>foo</small></li>
9289 </ul>
9290 !! html/parsoid
9291 <small>
9292 <ul>
9293 <li> foo</li>
9294 </ul>
9295 </small>
9296 !!end
9298 ## Ugly Parsoid output here
9299 ## Not sure what the right output is.
9300 !!test
9301 2. List embedded in a formatting tag
9302 !! wikitext
9303 <small>
9305 *b</small>
9306 !! html/php+tidy
9307 <ul>
9308 <li><small>a</small></li>
9309 <li><small>b</small></li>
9310 </ul>
9311 !! html/parsoid
9312 <small></small>
9313 <ul><small>
9314 <li>a</li>
9315 </small>
9316 <li><small>b</small></li>
9317 </ul>
9318 !!end
9320 # Ugly Parsoid and PHP parser output here
9321 # Not sure if we want to make this a test!
9323 ## !!test
9324 ## 3. Unclosed formatting tags in list elements
9325 ## !! wikitext
9326 ## *<small>a
9327 ## *<small>b
9328 ## !! html/php+tidy
9329 ## <ul>
9330 ## <li><small>a</small></li>
9331 ## <li><small><small>b</small></small></li>
9332 ## </ul>
9333 ## !! html/parsoid
9334 ## <ul>
9335 ## <li><small>a</small></li>
9336 ## <small>
9337 ## <li><small>b</small></li>
9338 ## </small></ul>
9339 ## !!end
9341 # This is a bug in the PHP parser + tidy combination.
9342 # (The </tr> tag gets parsed as text and html-escaped by PHP,
9343 # and then fostered out of the table by tidy.)
9344 # We believe the Parsoid output to be correct.
9345 !! test
9346 Table with missing opening <tr> tag
9347 !! options
9348 parsoid=wt2html,wt2wt
9349 !! wikitext
9350 <table>
9351 <td>foo</td>
9352 </tr>
9353 </table>
9354 !! html+tidy
9355 <table>
9356 <tr>
9357 <td>foo</td>
9358 </tr>
9359 </table>
9360 !! end
9363 ### Magic Words
9366 # Note that the current date is hard-coded as
9367 #   1970-01-01T00:02:03Z (a Thursday)
9368 # when running parser tests.  The timezone is also fixed to GMT, so
9369 # local date will be identical to current date.
9371 !! test
9372 Magic Word: {{CURRENTDAY}}
9373 !! wikitext
9374 {{CURRENTDAY}}
9375 !! html
9376 <p>1
9377 </p>
9378 !! end
9380 !! test
9381 Magic Word: {{CURRENTDAY2}}
9382 !! wikitext
9383 {{CURRENTDAY2}}
9384 !! html
9385 <p>01
9386 </p>
9387 !! end
9389 !! test
9390 Magic Word: {{CURRENTDAYNAME}}
9391 !! wikitext
9392 {{CURRENTDAYNAME}}
9393 !! html
9394 <p>Thursday
9395 </p>
9396 !! end
9398 !! test
9399 Magic Word: {{CURRENTDOW}}
9400 !! wikitext
9401 {{CURRENTDOW}}
9402 !! html
9403 <p>4
9404 </p>
9405 !! end
9407 !! test
9408 Magic Word: {{CURRENTMONTH}}
9409 !! wikitext
9410 {{CURRENTMONTH}}
9411 !! html
9412 <p>01
9413 </p>
9414 !! end
9416 !! test
9417 Magic Word: {{CURRENTMONTH1}}
9418 !! wikitext
9419 {{CURRENTMONTH1}}
9420 !! html
9421 <p>1
9422 </p>
9423 !! end
9425 !! test
9426 Magic Word: {{CURRENTMONTHABBREV}}
9427 !! wikitext
9428 {{CURRENTMONTHABBREV}}
9429 !! html
9430 <p>Jan
9431 </p>
9432 !! end
9434 !! test
9435 Magic Word: {{CURRENTMONTHNAME}}
9436 !! wikitext
9437 {{CURRENTMONTHNAME}}
9438 !! html
9439 <p>January
9440 </p>
9441 !! end
9443 !! test
9444 Magic Word: {{CURRENTMONTHNAMEGEN}}
9445 !! wikitext
9446 {{CURRENTMONTHNAMEGEN}}
9447 !! html
9448 <p>January
9449 </p>
9450 !! end
9452 !! test
9453 Magic Word: {{CURRENTTIME}}
9454 !! wikitext
9455 {{CURRENTTIME}}
9456 !! html
9457 <p>00:02
9458 </p>
9459 !! end
9461 !! test
9462 Magic Word: {{CURRENTHOUR}}
9463 !! wikitext
9464 {{CURRENTHOUR}}
9465 !! html
9466 <p>00
9467 </p>
9468 !! end
9470 !! test
9471 Magic Word: {{CURRENTWEEK}} (@bug 4594)
9472 !! wikitext
9473 {{CURRENTWEEK}}
9474 !! html
9475 <p>1
9476 </p>
9477 !! end
9479 !! test
9480 Magic Word: {{CURRENTYEAR}}
9481 !! wikitext
9482 {{CURRENTYEAR}}
9483 !! html
9484 <p>1970
9485 </p>
9486 !! end
9488 !! test
9489 Magic Word: {{CURRENTTIMESTAMP}}
9490 !! wikitext
9491 {{CURRENTTIMESTAMP}}
9492 !! html
9493 <p>19700101000203
9494 </p>
9495 !! end
9497 !! test
9498 Magic Words LOCAL (UTC)
9499 !! wikitext
9500 * {{LOCALMONTH}}
9501 * {{LOCALMONTH1}}
9502 * {{LOCALMONTHNAME}}
9503 * {{LOCALMONTHNAMEGEN}}
9504 * {{LOCALMONTHABBREV}}
9505 * {{LOCALDAY}}
9506 * {{LOCALDAY2}}
9507 * {{LOCALDAYNAME}}
9508 * {{LOCALYEAR}}
9509 * {{LOCALTIME}}
9510 * {{LOCALHOUR}}
9511 * {{LOCALWEEK}}
9512 * {{LOCALDOW}}
9513 * {{LOCALTIMESTAMP}}
9514 !! html
9515 <ul><li> 01</li>
9516 <li> 1</li>
9517 <li> January</li>
9518 <li> January</li>
9519 <li> Jan</li>
9520 <li> 1</li>
9521 <li> 01</li>
9522 <li> Thursday</li>
9523 <li> 1970</li>
9524 <li> 00:02</li>
9525 <li> 00</li>
9526 <li> 1</li>
9527 <li> 4</li>
9528 <li> 19700101000203</li></ul>
9530 !! end
9532 !! test
9533 Magic Word: {{FULLPAGENAME}}
9534 !! options
9535 title=[[User:Ævar Arnfjörð Bjarmason]]
9536 !! wikitext
9537 {{FULLPAGENAME}}
9538 !! html
9539 <p>User:Ævar Arnfjörð Bjarmason
9540 </p>
9541 !! end
9543 !! test
9544 Magic Word: {{FULLPAGENAMEE}}
9545 !! options
9546 title=[[User:Ævar Arnfjörð Bjarmason]]
9547 !! wikitext
9548 {{FULLPAGENAMEE}}
9549 !! html
9550 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
9551 </p>
9552 !! end
9554 !! test
9555 Magic Word: {{TALKSPACE}}
9556 !! options
9557 title=[[User:Ævar Arnfjörð Bjarmason]]
9558 !! wikitext
9559 {{TALKSPACE}}
9560 !! html
9561 <p>User talk
9562 </p>
9563 !! end
9565 !! test
9566 Magic Word: {{TALKSPACE}}, same namespace
9567 !! options
9568 title=[[User talk:Ævar Arnfjörð Bjarmason]]
9569 !! wikitext
9570 {{TALKSPACE}}
9571 !! html
9572 <p>User talk
9573 </p>
9574 !! end
9576 !! test
9577 Magic Word: {{TALKSPACE}}, main namespace
9578 !! options
9579 title=[[Parser Test]]
9580 !! wikitext
9581 {{TALKSPACE}}
9582 !! html
9583 <p>Talk
9584 </p>
9585 !! end
9587 !! test
9588 Magic Word: {{TALKSPACEE}}
9589 !! options
9590 title=[[User:Ævar Arnfjörð Bjarmason]]
9591 !! wikitext
9592 {{TALKSPACEE}}
9593 !! html
9594 <p>User_talk
9595 </p>
9596 !! end
9598 !! test
9599 Magic Word: {{SUBJECTSPACE}}
9600 !! options
9601 title=[[User talk:Ævar Arnfjörð Bjarmason]]
9602 !! wikitext
9603 {{SUBJECTSPACE}}
9604 !! html
9605 <p>User
9606 </p>
9607 !! end
9609 !! test
9610 Magic Word: {{SUBJECTSPACE}}, same namespace
9611 !! options
9612 title=[[User:Ævar Arnfjörð Bjarmason]]
9613 !! wikitext
9614 {{SUBJECTSPACE}}
9615 !! html
9616 <p>User
9617 </p>
9618 !! end
9620 !! test
9621 Magic Word: {{SUBJECTSPACE}}, main namespace
9622 !! options
9623 title=[[Parser Test]]
9624 !! wikitext
9625 {{SUBJECTSPACE}}
9626 !! html
9628 !! end
9630 !! test
9631 Magic Word: {{SUBJECTSPACEE}}
9632 !! options
9633 title=[[User talk:Ævar Arnfjörð Bjarmason]]
9634 !! wikitext
9635 {{SUBJECTSPACEE}}
9636 !! html
9637 <p>User
9638 </p>
9639 !! end
9641 !! test
9642 Magic Word: {{NAMESPACE}}
9643 !! options
9644 title=[[User:Ævar Arnfjörð Bjarmason]]
9645 !! wikitext
9646 {{NAMESPACE}}
9647 !! html
9648 <p>User
9649 </p>
9650 !! end
9652 !! test
9653 Magic Word: {{NAMESPACEE}}
9654 !! options
9655 title=[[User:Ævar Arnfjörð Bjarmason]]
9656 !! wikitext
9657 {{NAMESPACEE}}
9658 !! html
9659 <p>User
9660 </p>
9661 !! end
9663 !! test
9664 Magic Word: {{NAMESPACENUMBER}}
9665 !! options
9666 title=[[User:Ævar Arnfjörð Bjarmason]]
9667 !! wikitext
9668 {{NAMESPACENUMBER}}
9669 !! html
9670 <p>2
9671 </p>
9672 !! end
9674 !! test
9675 Magic Word: {{SUBPAGENAME}}
9676 !! options
9677 title=[[Ævar Arnfjörð Bjarmason/sub ö]] subpage
9678 !! wikitext
9679 {{SUBPAGENAME}}
9680 !! html
9681 <p>sub ö
9682 </p>
9683 !! end
9685 !! test
9686 Magic Word: {{SUBPAGENAMEE}}
9687 !! options
9688 title=[[Ævar Arnfjörð Bjarmason/sub ö]] subpage
9689 !! wikitext
9690 {{SUBPAGENAMEE}}
9691 !! html
9692 <p>sub_%C3%B6
9693 </p>
9694 !! end
9696 !! test
9697 Magic Word: {{ROOTPAGENAME}}
9698 !! options
9699 title=[[Ævar Arnfjörð Bjarmason/sub/sub2]] subpage
9700 !! wikitext
9701 {{ROOTPAGENAME}}
9702 !! html
9703 <p>Ævar Arnfjörð Bjarmason
9704 </p>
9705 !! end
9707 !! test
9708 Magic Word: {{ROOTPAGENAMEE}}
9709 !! options
9710 title=[[Ævar Arnfjörð Bjarmason/sub/sub2]] subpage
9711 !! wikitext
9712 {{ROOTPAGENAMEE}}
9713 !! html
9714 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
9715 </p>
9716 !! end
9718 !! test
9719 Magic Word: {{BASEPAGENAME}}
9720 !! options
9721 title=[[Ævar Arnfjörð Bjarmason/sub]] subpage
9722 !! wikitext
9723 {{BASEPAGENAME}}
9724 !! html
9725 <p>Ævar Arnfjörð Bjarmason
9726 </p>
9727 !! end
9729 !! test
9730 Magic Word: {{BASEPAGENAMEE}}
9731 !! options
9732 title=[[Ævar Arnfjörð Bjarmason/sub]] subpage
9733 !! wikitext
9734 {{BASEPAGENAMEE}}
9735 !! html
9736 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
9737 </p>
9738 !! end
9740 !! test
9741 Magic Word: {{TALKPAGENAME}}
9742 !! options
9743 title=[[User:Ævar Arnfjörð Bjarmason]]
9744 !! wikitext
9745 {{TALKPAGENAME}}
9746 !! html
9747 <p>User talk:Ævar Arnfjörð Bjarmason
9748 </p>
9749 !! end
9751 !! test
9752 Magic Word: {{TALKPAGENAMEE}}
9753 !! options
9754 title=[[User:Ævar Arnfjörð Bjarmason]]
9755 !! wikitext
9756 {{TALKPAGENAMEE}}
9757 !! html
9758 <p>User_talk:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
9759 </p>
9760 !! end
9762 !! test
9763 Magic Word: {{SUBJECTPAGENAME}}
9764 !! options
9765 title=[[User talk:Ævar Arnfjörð Bjarmason]]
9766 !! wikitext
9767 {{SUBJECTPAGENAME}}
9768 !! html
9769 <p>User:Ævar Arnfjörð Bjarmason
9770 </p>
9771 !! end
9773 !! test
9774 Magic Word: {{SUBJECTPAGENAMEE}}
9775 !! options
9776 title=[[User talk:Ævar Arnfjörð Bjarmason]]
9777 !! wikitext
9778 {{SUBJECTPAGENAMEE}}
9779 !! html
9780 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
9781 </p>
9782 !! end
9784 !! test
9785 Magic Word: {{NUMBEROFFILES}}
9786 !! wikitext
9787 {{NUMBEROFFILES}}
9788 !! html
9789 <p>6
9790 </p>
9791 !! end
9793 !! test
9794 Magic Word: {{PAGENAME}}
9795 !! options
9796 title=[[User:Ævar Arnfjörð Bjarmason]]
9797 !! wikitext
9798 {{PAGENAME}}
9799 !! html
9800 <p>Ævar Arnfjörð Bjarmason
9801 </p>
9802 !! end
9804 !! test
9805 Magic Word: {{PAGENAME}} with metacharacters
9806 !! options
9807 title=[['foo & bar = baz']]
9808 !! wikitext
9809 ''{{PAGENAME}}''
9810 !! html/php
9811 <p><i>&#39;foo &#38; bar &#61; baz&#39;</i>
9812 </p>
9813 !! html+tidy
9814 <p><i>'foo &amp; bar = baz'</i></p>
9815 !! end
9817 !! test
9818 Magic Word: {{PAGENAME}} with metacharacters (bug 26781)
9819 !! options
9820 title=[[*RFC 1234 http://example.com/]]
9821 !! wikitext
9822 {{PAGENAME}}
9823 !! html/php
9824 <p>&#42;RFC&#32;1234 http&#58;//example.com/
9825 </p>
9826 !! html+tidy
9827 <p>*RFC 1234 http://example.com/</p>
9828 !! end
9830 !! test
9831 Magic Word: {{PAGENAMEE}}
9832 !! options
9833 title=[[User:Ævar Arnfjörð Bjarmason]]
9834 !! wikitext
9835 {{PAGENAMEE}}
9836 !! html
9837 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
9838 </p>
9839 !! end
9841 !! test
9842 Magic Word: {{PAGENAMEE}} with metacharacters (bug 26781)
9843 !! options
9844 title=[[*RFC 1234 http://example.com/]]
9845 !! wikitext
9846 {{PAGENAMEE}}
9847 !! html/php
9848 <p>&#42;RFC_1234_http&#58;//example.com/
9849 </p>
9850 !! html+tidy
9851 <p>*RFC_1234_http://example.com/</p>
9852 !! end
9854 !! test
9855 Magic Word: {{REVISIONID}}
9856 !! wikitext
9857 {{REVISIONID}}
9858 !! html
9859 <p>1337
9860 </p>
9861 !! end
9863 !! test
9864 Magic Word: {{SCRIPTPATH}}
9865 !! wikitext
9866 {{SCRIPTPATH}}
9867 !! html
9869 !! end
9871 !! test
9872 Magic Word: {{STYLEPATH}}
9873 !! wikitext
9874 {{STYLEPATH}}
9875 !! html
9876 <p>/skins
9877 </p>
9878 !! end
9880 !! test
9881 Magic Word: {{SERVER}}
9882 !! wikitext
9883 {{SERVER}}
9884 !! html
9885 <p><a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
9886 </p>
9887 !! end
9889 !! test
9890 Magic Word: {{SERVERNAME}}
9891 !! wikitext
9892 {{SERVERNAME}}
9893 !! html
9894 <p>example.org
9895 </p>
9896 !! end
9898 !! test
9899 Magic Word: {{SITENAME}}
9900 !! wikitext
9901 {{SITENAME}}
9902 !! html
9903 <p>MediaWiki
9904 </p>
9905 !! end
9907 !! test
9908 Case-sensitive magic words, when cased differently, should just be template transclusions
9909 !! wikitext
9910 {{CurrentMonth}}
9911 {{currentday}}
9912 {{cURreNTweEK}}
9913 {{currentHour}}
9914 !! html
9915 <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>
9916 <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>
9917 <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>
9918 <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>
9919 </p>
9920 !! end
9922 !! test
9923 Case-insensitive magic words should still work with weird casing.
9924 !! wikitext
9925 {{sErVeRNaMe}}
9926 {{LCFirst:AOEU}}
9927 {{ucFIRST:aoeu}}
9928 {{SERver}}
9929 !! html
9930 <p>example.org
9931 aOEU
9932 Aoeu
9933 <a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
9934 </p>
9935 !! end
9937 # From plwiki:PLOS_ONE
9938 !! test
9939 Parsoid: Page property magic word with magic word contents
9940 !! wikitext
9941 {{DISPLAYTITLE:''{{PAGENAME}}''}}
9942 !! html/parsoid
9943 <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>"}]]}'/>
9944 !! end
9946 !! test
9947 Parsoid: Template-generated DISPLAYTITLE
9948 !! wikitext
9949 {{{{echo|DISPLAYTITLE}}:Foo}}
9950 !! html/parsoid
9951 <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}}]}'/>
9952 !! end
9954 !! test
9955 Namespace 1 {{ns:1}}
9956 !! wikitext
9957 {{ns:1}}
9958 !! html
9959 <p>Talk
9960 </p>
9961 !! end
9963 !! test
9964 Namespace 1 {{ns:01}}
9965 !! wikitext
9966 {{ns:01}}
9967 !! html
9968 <p>Talk
9969 </p>
9970 !! end
9972 !! test
9973 Namespace 0 {{ns:0}} (bug 4783)
9974 !! wikitext
9975 {{ns:0}}
9976 !! html
9978 !! end
9980 !! test
9981 Namespace 0 {{ns:00}} (bug 4783)
9982 !! wikitext
9983 {{ns:00}}
9984 !! html
9986 !! end
9988 !! test
9989 Namespace -1 {{ns:-1}}
9990 !! wikitext
9991 {{ns:-1}}
9992 !! html
9993 <p>Special
9994 </p>
9995 !! end
9997 !! test
9998 Namespace User {{ns:User}}
9999 !! wikitext
10000 {{ns:User}}
10001 !! html
10002 <p>User
10003 </p>
10004 !! end
10006 !! test
10007 Namespace User talk {{ns:User_talk}}
10008 !! wikitext
10009 {{ns:User_talk}}
10010 !! html
10011 <p>User talk
10012 </p>
10013 !! end
10015 !! test
10016 Namespace User talk {{ns:uSeR tAlK}}
10017 !! wikitext
10018 {{ns:uSeR tAlK}}
10019 !! html
10020 <p>User talk
10021 </p>
10022 !! end
10024 !! test
10025 Namespace File {{ns:File}}
10026 !! wikitext
10027 {{ns:File}}
10028 !! html
10029 <p>File
10030 </p>
10031 !! end
10033 !! test
10034 Namespace File {{ns:Image}}
10035 !! wikitext
10036 {{ns:Image}}
10037 !! html
10038 <p>File
10039 </p>
10040 !! end
10042 !! test
10043 Namespace (lang=de) Benutzer {{ns:User}}
10044 !! options
10045 language=de
10046 !! wikitext
10047 {{ns:User}}
10048 !! html
10049 <p>Benutzer
10050 </p>
10051 !! end
10053 !! test
10054 Namespace (lang=de) Benutzer Diskussion {{ns:3}}
10055 !! options
10056 language=de
10057 !! wikitext
10058 {{ns:3}}
10059 !! html
10060 <p>Benutzer Diskussion
10061 </p>
10062 !! end
10065 !! test
10066 Urlencode
10067 !! wikitext
10068 {{urlencode:hi world?!}}
10069 {{urlencode:hi world?!|WIKI}}
10070 {{urlencode:hi world?!|PATH}}
10071 {{urlencode:hi world?!|QUERY}}
10072 !! html
10073 <p>hi+world%3F%21
10074 hi_world%3F!
10075 hi%20world%3F%21
10076 hi+world%3F%21
10077 </p>
10078 !! end
10080 !! test
10081 Magic Word: prioritize type info over data-parsoid
10082 !! options
10083 parsoid=html2wt
10084 !! html/parsoid
10085 <meta property="mw:PageProp/forcetoc" data-parsoid='{"magicSrc":"__NOTOC__"}'/>
10086 !! wikitext
10087 __FORCETOC__
10088 !! end
10090 !! test
10091 Magic Word: serialize on separate line (parsoid)
10092 !! options
10093 parsoid=wt2wt,html2wt
10094 !! wikitext
10096 __NOTOC__
10098 !! html/parsoid
10099 foo<meta property="mw:PageProp/notoc"/>bar
10100 !! end
10102 !! test
10103 Magic Word: rt non-english wikis
10104 !! options
10105 parsoid=wt2wt
10106 language=de
10107 !! wikitext
10108 __NOEDITSECTION__
10109 !! html/parsoid
10110 <meta property="mw:PageProp/noeditsection" data-parsoid='{"magicSrc":"__NOEDITSECTION__"}'/>
10111 !! end
10113 !!test
10114 __proto__ is treated as normal wikitext (T105997)
10115 !!wikitext
10116 __proto__
10117 !!html
10118 <p>__proto__
10119 </p>
10120 !!end
10123 ### Magic links
10125 !! test
10126 Magic links: internal link to RFC (bug 479)
10127 !! wikitext
10128 [[RFC 123]]
10129 !! html/php
10130 <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>
10131 </p>
10132 !! html/parsoid
10133 <p><a rel="mw:WikiLink" href="./RFC_123" title="RFC 123">RFC 123</a></p>
10134 !! end
10136 !! test
10137 Magic links: RFC (bug 479)
10138 !! wikitext
10139 RFC 822
10140 !! html/php
10141 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc822">RFC 822</a>
10142 </p>
10143 !! html/parsoid
10144 <p><a href="//tools.ietf.org/html/rfc822" rel="mw:ExtLink">RFC 822</a></p>
10145 !! end
10147 !! test
10148 Magic links: RFC (bug 65278)
10149 !! wikitext
10150 This is RFC 822 but thisRFC 822 is not RFC 822linked.
10151 !! html/php
10152 <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.
10153 </p>
10154 !! html/parsoid
10155 <p>This is <a href="//tools.ietf.org/html/rfc822" rel="mw:ExtLink">RFC 822</a> but thisRFC 822 is not RFC 822linked.</p>
10156 !! end
10158 !! test
10159 Magic links: RFC (w/ non-newline whitespace, bug 28950/29025)
10160 !! wikitext
10161 RFC &nbsp;&#160;&#0160;&#xA0;&#Xa0; 822
10164 !! html/php
10165 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc822">RFC 822</a>
10168 </p>
10169 !! html/parsoid
10170 <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>
10172 822</p>
10173 !! end
10175 !! test
10176 Magic links: ISBN (bug 1937)
10177 !! wikitext
10178 ISBN 0-306-40615-2
10179 !! html/php
10180 <p><a href="/wiki/Special:BookSources/0306406152" class="internal mw-magiclink-isbn">ISBN 0-306-40615-2</a>
10181 </p>
10182 !! html/parsoid
10183 <p><a href="./Special:BookSources/0306406152" rel="mw:WikiLink">ISBN 0-306-40615-2</a></p>
10184 !! end
10186 !! test
10187 Magic links: ISBN (bug 65278)
10188 !! wikitext
10189 This is ISBN 978-0-316-09811-3 but thisISBN 978-0-316-09811-3 is not ISBN 978-0-316-09811-3linked.
10190 !! html/php
10191 <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.
10192 </p>
10193 !! html/parsoid
10194 <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>
10195 !! end
10197 !! test
10198 Magic links: ISBN (w/ non-newline whitespace, bug 28950/29025)
10199 !! wikitext
10200 ISBN &nbsp;&#160;&#0160;&#xA0;&#Xa0; 978&nbsp;0&#160;316&#0160;09811&#xA0;3
10201 ISBN
10202 9780316098113
10203 ISBN 978
10204 0316098113
10205 !! html/php
10206 <p><a href="/wiki/Special:BookSources/9780316098113" class="internal mw-magiclink-isbn">ISBN 978 0 316 09811 3</a>
10207 ISBN
10208 9780316098113
10209 ISBN 978
10210 0316098113
10211 </p>
10212 !! html/parsoid
10213 <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>
10214 ISBN
10215 9780316098113
10216 ISBN 978
10217 0316098113</p>
10218 !! end
10220 !! test
10221 Magic links: PMID incorrectly converts space to underscore
10222 !! wikitext
10223 PMID 1234
10224 !! html/php
10225 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a>
10226 </p>
10227 !! html/parsoid
10228 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract" rel="mw:ExtLink">PMID 1234</a></p>
10229 !! end
10231 !! test
10232 Magic links: PMID (bug 65278)
10233 !! wikitext
10234 This is PMID 1234 but thisPMID 1234 is not PMID 1234linked.
10235 !! html/php
10236 <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.
10237 </p>
10238 !! html/parsoid
10239 <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>
10240 !! end
10242 !! test
10243 Magic links: PMID (w/ non-newline whitespace, bug 28950/29025)
10244 !! wikitext
10245 PMID &nbsp;&#160;&#0160;&#xA0;&#Xa0; 1234
10246 PMID
10247 1234
10248 !! html/php
10249 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a>
10250 PMID
10251 1234
10252 </p>
10253 !! html/parsoid
10254 <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>
10255 PMID
10256 1234</p>
10257 !! end
10259 # <nowiki> nodes shouldn't be inserted during html2wt by Parsoid,
10260 # since these are ExtLinkText, not MagicLinkText
10261 !! test
10262 Magic links: use appropriate serialization for "almost" magic links.
10263 !! wikitext
10264 X[[Special:BookSources/0978739256|foo]]
10266 X[//tools.ietf.org/html/rfc1234 foo]
10267 !! html/php
10268 <p>X<a href="/wiki/Special:BookSources/0978739256" title="Special:BookSources/0978739256">foo</a>
10269 </p><p>X<a rel="nofollow" class="external text" href="//tools.ietf.org/html/rfc1234">foo</a>
10270 </p>
10271 !! html/parsoid
10272 <p>X<a rel="mw:WikiLink" href="./Special:BookSources/0978739256" title="Special:BookSources/0978739256">foo</a></p>
10273 <p>X<a rel="mw:ExtLink" href="//tools.ietf.org/html/rfc1234">foo</a></p>
10274 !! end
10277 ### Templates
10278 ####
10280 !! test
10281 Nonexistent template
10282 !! wikitext
10283 {{thistemplatedoesnotexist}}
10284 !! html
10285 <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>
10286 </p>
10287 !! end
10289 !! test
10290 Template with invalid target containing tags
10291 !! wikitext
10292 {{a<b>b</b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
10293 !! html
10294 <p>{{a<b>b</b>|foo|a=b|a = b}}
10295 </p>
10296 !! end
10298 !! test
10299 Template with invalid target containing unclosed tag
10300 !! wikitext
10301 {{a<b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
10302 !! html
10303 <p>{{a<b>|foo|a=b|a = b}}</b>
10304 </p>
10305 !! end
10307 !! test
10308 Template with invalid target containing wikilink
10309 !! wikitext
10310 {{[[Main Page]]}}
10311 !! html/php
10312 <p>{{<a href="/wiki/Main_Page" title="Main Page">Main Page</a>}}
10313 </p>
10314 !! html/parsoid
10315 <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>
10316 !! end
10318 !! test
10319 Template with just whitespace in it, bug #68421
10320 !! wikitext
10321 {{echo|{{ }}}}
10322 !! html/parsoid
10323 <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>
10324 !! end
10326 !! article
10327 Template:test
10328 !! text
10329 This is a test template
10330 !! endarticle
10332 !! test
10333 Simple template
10334 !! wikitext
10335 {{test}}
10336 !! html
10337 <p>This is a test template
10338 </p>
10339 !! end
10341 !! test
10342 Template with explicit namespace
10343 !! wikitext
10344 {{Template:test}}
10345 !! html
10346 <p>This is a test template
10347 </p>
10348 !! end
10351 !! article
10352 Template:paramtest
10353 !! text
10354 This is a test template with parameter {{{param}}}
10355 !! endarticle
10357 !! test
10358 Template parameter
10359 !! wikitext
10360 {{paramtest|param=foo}}
10361 !! html
10362 <p>This is a test template with parameter foo
10363 </p>
10364 !! end
10366 !! article
10367 Template:paramtestnum
10368 !! text
10369 [[{{{1}}}|{{{2}}}]]
10370 !! endarticle
10372 !! test
10373 Template unnamed parameter
10374 !! wikitext
10375 {{paramtestnum|Main Page|the main page}}
10376 !! html
10377 <p><a href="/wiki/Main_Page" title="Main Page">the main page</a>
10378 </p>
10379 !! end
10381 !! article
10382 Template:templatesimple
10383 !! text
10384 (test)
10385 !! endarticle
10387 !! article
10388 Template:templateredirect
10389 !! text
10390 #redirect [[Template:templatesimple]]
10391 !! endarticle
10393 !! article
10394 Template:templateasargtestnum
10395 !! text
10396 {{{{{1}}}}}
10397 !! endarticle
10399 !! article
10400 Template:templateasargtest
10401 !! text
10402 {{template{{{templ}}}}}
10403 !! endarticle
10405 !! article
10406 Template:templateasargtest2
10407 !! text
10408 {{{{{templ}}}}}
10409 !! endarticle
10411 !! test
10412 Template with template name as unnamed argument
10413 !! wikitext
10414 {{templateasargtestnum|templatesimple}}
10415 !! html
10416 <p>(test)
10417 </p>
10418 !! end
10420 !! test
10421 Template with template name as argument
10422 !! wikitext
10423 {{templateasargtest|templ=simple}}
10424 !! html
10425 <p>(test)
10426 </p>
10427 !! end
10429 !! test
10430 Template with template name as argument (2)
10431 !! wikitext
10432 {{templateasargtest2|templ=templatesimple}}
10433 !! html
10434 <p>(test)
10435 </p>
10436 !! end
10438 !! article
10439 Template:templateasargtestdefault
10440 !! text
10441 {{{{{templ|templatesimple}}}}}
10442 !! endarticle
10444 !! article
10445 Template:templa
10446 !! text
10447 '''templ'''
10448 !! endarticle
10450 !! test
10451 Template with default value
10452 !! wikitext
10453 {{templateasargtestdefault}}
10454 !! html
10455 <p>(test)
10456 </p>
10457 !! end
10459 !! test
10460 Template with default value (value set)
10461 !! wikitext
10462 {{templateasargtestdefault|templ=templa}}
10463 !! html
10464 <p><b>templ</b>
10465 </p>
10466 !! end
10468 !! test
10469 Template redirect
10470 !! wikitext
10471 {{templateredirect}}
10472 !! html/php
10473 <p>(test)
10474 </p>
10475 !! html/parsoid
10476 <link rel="mw:PageProp/redirect" href="./Template:Templatesimple" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"templateredirect","href":"./Template:Templateredirect"},"params":{},"i":0}}]}'/>
10477 !! end
10479 !! test
10480 Template with argument in separate line
10481 !! wikitext
10482 {{ templateasargtest  |
10483  templ = simple }}
10484 !! html
10485 <p>(test)
10486 </p>
10487 !! end
10489 !! test
10490 Template with complex template as argument
10491 !! wikitext
10492 {{paramtest|
10493   param ={{ templateasargtest  |
10494  templ = simple }}}}
10495 !! html
10496 <p>This is a test template with parameter (test)
10497 </p>
10498 !! end
10500 !! test
10501 Template with thumb image (with link in description)
10502 !! wikitext
10503 {{paramtest|param=[[Image:noimage.png|thumb|[[no link|link]] [[no link|caption]]]]}}
10504 !! html/php
10505 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>
10507 !! html+tidy
10508 <p>This is a test template with parameter</p>
10509 <div class="thumb tright">
10510 <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>
10511 <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>
10512 </div>
10513 </div>
10514 !! html/parsoid
10515 <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>
10516 !! end
10518 !! article
10519 Template:complextemplate
10520 !! text
10521 {{{1}}} {{paramtest|
10522   param ={{{param}}}}}
10523 !! endarticle
10525 !! test
10526 Template with complex arguments
10527 !! wikitext
10528 {{complextemplate|
10529   param ={{ templateasargtest  |
10530  templ = simple }}|[[Template:complextemplate|link]]}}
10531 !! html
10532 <p><a href="/wiki/Template:Complextemplate" title="Template:Complextemplate">link</a> This is a test template with parameter (test)
10533 </p>
10534 !! end
10536 !! test
10537 BUG 553: link with two variables in a piped link
10538 !! wikitext
10540 |[[{{{1}}}|{{{2}}}]]
10542 !! html/php
10543 <table>
10544 <tr>
10545 <td>[[{{{1}}}|{{{2}}}]]
10546 </td></tr></table>
10548 !! html/parsoid
10549 <table>
10550 <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>
10551 !! end
10553 # See: T2553
10554 !! test
10555 Abort table cell attribute parsing on wikilink
10556 !! wikitext
10558 | testing [[one|two]] | three || four
10559 | testing one two | three || four
10560 | testing="[[one|two]]" | three || four
10562 !! html/php
10563 <table>
10564 <tr>
10565 <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>
10566 <td> four
10567 </td>
10568 <td> three </td>
10569 <td> four
10570 </td>
10571 <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>
10572 <td> four
10573 </td></tr></table>
10575 !! html/parsoid
10576 <table>
10577 <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>
10578 <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>
10579 <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>
10580 </tbody></table>
10581 !! end
10583 !! test
10584 Don't abort table cell attribute parsing if wikilink is found in template arg
10585 !! wikitext
10587 | Test {{#tag:ref|One two "[[three]]" four}}
10589 !! html/parsoid
10590 <table>
10591 <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>
10592 </tbody></table>
10593 !! end
10595 !! test
10596 Magic variable as template parameter
10597 !! wikitext
10598 {{paramtest|param={{SITENAME}}}}
10599 !! html
10600 <p>This is a test template with parameter MediaWiki
10601 </p>
10602 !! end
10604 !! article
10605 Template:linktest
10606 !! text
10607 [[{{{param}}}|link]]
10608 !! endarticle
10610 !! test
10611 Template parameter as link source
10612 !! wikitext
10613 {{linktest|param=Main Page}}
10614 !! html
10615 <p><a href="/wiki/Main_Page" title="Main Page">link</a>
10616 </p>
10617 !! end
10619 !!article
10620 Template:paramtest2
10621 !! text
10622 including another template, {{paramtest|param={{{arg}}}}}
10623 !! endarticle
10625 !! test
10626 Template passing argument to another template
10627 !! wikitext
10628 {{paramtest2|arg='hmm'}}
10629 !! html
10630 <p>including another template, This is a test template with parameter 'hmm'
10631 </p>
10632 !! end
10634 !! article
10635 Template:Linktest2
10636 !! text
10637 Main Page
10638 !! endarticle
10640 !! test
10641 Template as link source
10642 !! wikitext
10643 [[{{linktest2}}]]
10645 [[{{linktest2}}|Main Page]]
10647 [[{{linktest2}}]]Page
10648 !! html
10649 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
10650 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
10651 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>Page
10652 </p>
10653 !! end
10656 !! article
10657 Template:loop1
10658 !! text
10659 {{loop2}}
10660 !! endarticle
10662 !! article
10663 Template:loop2
10664 !! text
10665 {{loop1}}
10666 !! endarticle
10668 !! test
10669 Template infinite loop
10670 !! wikitext
10671 {{loop1}}
10672 !! html
10673 <p><span class="error">Template loop detected: <a href="/wiki/Template:Loop1" title="Template:Loop1">Template:Loop1</a></span>
10674 </p>
10675 !! end
10677 !! test
10678 Template from main namespace
10679 !! wikitext
10680 {{:Main Page}}
10681 !! html
10682 <p>blah blah
10683 </p>
10684 !! end
10686 !! article
10687 Template:table
10688 !! text
10690 | 1 || 2
10692 | 3 || 4
10694 !! endarticle
10696 !! test
10697 BUG 529: Template with table, not included at beginning of line
10698 !! wikitext
10699 foo {{table}}
10700 !! html
10701 <p>foo 
10702 </p>
10703 <table>
10704 <tr>
10705 <td> 1 </td>
10706 <td> 2
10707 </td></tr>
10708 <tr>
10709 <td> 3 </td>
10710 <td> 4
10711 </td></tr></table>
10713 !! end
10715 !! test
10716 BUG 523: Template shouldn't eat newline (or add an extra one before table)
10717 !! wikitext
10719 {{table}}
10720 !! html
10721 <p>foo
10722 </p>
10723 <table>
10724 <tr>
10725 <td> 1 </td>
10726 <td> 2
10727 </td></tr>
10728 <tr>
10729 <td> 3 </td>
10730 <td> 4
10731 </td></tr></table>
10733 !! end
10735 !! test
10736 BUG 41: Template parameters shown as broken links
10737 !! wikitext
10738 {{{parameter}}}
10739 !! html
10740 <p>{{{parameter}}}
10741 </p>
10742 !! end
10744 !! test
10745 Template with targets containing wikilinks
10746 !! wikitext
10747 {{[[foo]]}}
10749 {{[[{{echo|foo}}]]}}
10751 {{{{echo|[[foo}}]]}}
10752 !! html
10753 <p>{{<a href="/wiki/Foo" title="Foo">foo</a>}}
10754 </p><p>{{<a href="/wiki/Foo" title="Foo">foo</a>}}
10755 </p><p>{{[[foo}}]]
10756 </p>
10757 !! end
10759 !! article
10760 Template:''
10761 !! text
10763 !! endarticle
10765 !! test
10766 Templates: Double quotes as template target
10767 !! wikitext
10768 foo {{''}} baz
10769 !! html/php
10770 <p>foo bar baz
10771 </p>
10772 !! html/parsoid
10773 <p>foo <span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"&#39;&#39;"},"params":{},"i":0}}]}'>bar</span> baz
10774 </p>
10775 !! end
10777 ## This test is about making sure Parsoid's data-mw is well formed in the
10778 ## face of multiple templates with intersecting and overlapping ranges.  The
10779 ## wikitext itself is wretched.
10780 !! test
10781 Templates with intersecting and overlapping ranges
10782 !! wikitext
10783 {|{{echo|
10784 <p>ha</p>}}
10785 {|{{echo|
10786 <p>ho</p>}}
10787 {{echo|{{!}}hi}}
10789 !! html/php+tidy
10790 <p>ha</p>
10791 <p>ho</p>
10792 <table>
10793 <tr>
10794 <td></td>
10795 </tr>
10796 <tr>
10797 <td>hi</td>
10798 </tr>
10799 </table>
10800 <table>
10801 <tr>
10802 <td></td>
10803 </tr>
10804 </table>
10805 !! html/parsoid
10806 <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":""}]]}'>
10808 </table><p about="#mwt1">ho</p><table about="#mwt1" typeof="mw:ExpandedAttrs" data-mw='{"attribs":[[{"txt":"","html":""},{"html":""}]]}'>
10810 <tbody><tr><td>hi</td></tr>
10811 </tbody></table>
10812 !! end
10814 !! article
10815 Template:MSGNW test
10816 !! text
10817 ''None'' of '''this''' should be 
10818 * interpreted
10819  but rather passed unmodified
10820 {{test}}
10821 <gallery>
10822 File:Foobar.jpg
10823 </gallery>
10824 <!-- comment -->
10825 !! endarticle
10827 # hmm, fix this or just deprecate msgnw and document its behavior?
10828 !! test
10829 msgnw keyword
10830 !! wikitext
10831 {{msgnw:MSGNW test}}
10832 !! html/php
10833 <p>&#39;&#39;None&#39;&#39; of &#39;&#39;&#39;this&#39;&#39;&#39; should be 
10834 &#42; interpreted
10835 &#32;but rather passed unmodified
10836 &#123;&#123;test&#125;&#125;
10837 &#60;gallery&#62;
10838 File:Foobar.jpg
10839 &#60;/gallery&#62;
10840 &#60;!-- comment --&#62;
10841 </p>
10842 !! end
10844 !! test
10845 int keyword
10846 !! wikitext
10847 {{int:youhavenewmessages|lots of money|not!}}
10848 !! html
10849 <p>You have lots of money (not!).
10850 </p>
10851 !! end
10853 !! test
10854 int keyword - non-existing message
10855 !! wikitext
10856 {{int:var}}
10857 !! html
10858 <p>&lt;var&gt;
10859 </p>
10860 !! end
10862 !! article
10863 Template:Includes
10864 !! text
10865 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
10866 !! endarticle
10868 !! test
10869 <includeonly> and <noinclude> being included
10870 !! wikitext
10871 {{Includes}}
10872 !! html
10873 <p>Foobar
10874 </p>
10875 !! end
10877 !! article
10878 Template:Includes2
10879 !! text
10880 <onlyinclude>Foo</onlyinclude>bar
10881 !! endarticle
10883 !! test
10884 <onlyinclude> being included
10885 !! wikitext
10886 {{Includes2}}
10887 !! html
10888 <p>Foo
10889 </p>
10890 !! end
10893 !! article
10894 Template:Includes3
10895 !! text
10896 <onlyinclude>Foo</onlyinclude>bar<includeonly>zar</includeonly>
10897 !! endarticle
10899 !! test
10900 <onlyinclude> and <includeonly> being included
10901 !! wikitext
10902 {{Includes3}}
10903 !! html
10904 <p>Foo
10905 </p>
10906 !! end
10908 !! test
10909 <includeonly> and <noinclude> on a page
10910 !! wikitext
10911 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
10912 !! html
10913 <p>Foozar
10914 </p>
10915 !! end
10917 !! test
10918 Un-closed <noinclude>
10919 !! wikitext
10920 <noinclude>
10921 !! html
10922 !! end
10924 !! test
10925 <onlyinclude> on a page
10926 !! wikitext
10927 <onlyinclude>Foo</onlyinclude>bar
10928 !! html
10929 <p>Foobar
10930 </p>
10931 !! end
10933 !! test
10934 Un-closed <onlyinclude>
10935 !! wikitext
10936 <onlyinclude>
10937 !! html
10938 !! end
10940 !!test
10941 Self-closed noinclude, includeonly, onlyinclude tags
10942 !! wikitext
10943 <noinclude />
10944 <includeonly />
10945 <onlyinclude />
10946 !! html
10947 <p><br />
10948 </p>
10949 !!end
10951 !!test
10952 Unbalanced includeonly and noinclude tags
10953 !! wikitext
10955 |a</noinclude>
10956 |b</noinclude></noinclude>
10957 |c</noinclude></includeonly>
10958 |d</includeonly></includeonly>
10960 !! html
10961 <table>
10962 <tr>
10963 <td>a
10964 </td>
10965 <td>b
10966 </td>
10967 <td>c&lt;/includeonly&gt;
10968 </td>
10969 <td>d&lt;/includeonly&gt;&lt;/includeonly&gt;
10970 </td></tr></table>
10972 !!end
10974 !! article
10975 Template:Includeonly section
10976 !! text
10977 <includeonly>
10978 ==Includeonly section==
10979 </includeonly>
10980 ==Section T-1==
10981 !!endarticle
10983 !! test
10984 Bug 6563: Edit link generation for section shown by <includeonly>
10985 !! wikitext
10986 {{includeonly section}}
10987 !! html
10988 <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>
10989 <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>
10991 !! end
10993 # Uses same input as the contents of [[Template:Includeonly section]]
10994 !! test
10995 Bug 6563: Section extraction for section shown by <includeonly>
10996 !! options
10997 section=T-2
10998 !! wikitext
10999 <includeonly>
11000 ==Includeonly section==
11001 </includeonly>
11002 ==Section T-2==
11003 !! html
11004 ==Section T-2==
11005 !! end
11007 !! test
11008 Bug 6563: Edit link generation for section suppressed by <includeonly>
11009 !! wikitext
11010 <includeonly>
11011 ==Includeonly section==
11012 </includeonly>
11013 ==Section 1==
11014 !! html
11015 <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>
11017 !! end
11019 !! test
11020 Bug 6563: Section extraction for section suppressed by <includeonly>
11021 !! options
11022 section=1
11023 !! wikitext
11024 <includeonly>
11025 ==Includeonly section==
11026 </includeonly>
11027 ==Section 1==
11028 !! html
11029 ==Section 1==
11030 !! end
11032 !! test
11033 Un-closed <includeonly>
11034 !! wikitext
11035 <includeonly>
11036 !! html/php
11037 !! html/parsoid
11038 <meta typeof="mw:Includes/IncludeOnly" data-parsoid='{"src":"&lt;includeonly>"}'/>
11039 !! end
11041 ## We used to, but no longer wt2wt this test since the default serializer
11042 ## will normalize the include directives to serialize on their own line.
11043 ## Selser will take care of preserving formatting in scenarios where they
11044 ## intermingled with other wikitext.
11045 !! test
11046 Includes and comments at SOL
11047 !! options
11048 parsoid=wt2html,html2html
11049 !! wikitext
11050 <!-- comment --><noinclude><!-- comment --></noinclude><!-- comment -->== hu ==
11052 <noinclude>
11053 some
11054 </noinclude>* stuff
11055 * here
11057 <includeonly>can have stuff</includeonly>=== here ===
11059 !! html/php
11060 <h2><span class="mw-headline" id="hu">hu</span></h2>
11061 <p>some
11062 </p>
11063 <ul><li> stuff</li>
11064 <li> here</li></ul>
11065 <h3><span class="mw-headline" id="here">here</span></h3>
11067 !! html/parsoid
11068 <!-- 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>
11070 <meta typeof="mw:Includes/NoInclude" data-parsoid='{"src":"&lt;noinclude>"}'/>
11071 <p>some</p>
11072 <meta typeof="mw:Includes/NoInclude/End" data-parsoid='{"src":"&lt;/noinclude>"}'/><ul><li> stuff</li>
11073 <li> here</li></ul>
11075 <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>
11077 !! end
11079 # TODO: test with DOM fragment reuse!
11080 !! test
11081 Parsoid: DOM fragment reuse
11082 !! options
11083 parsoid=wt2wt,wt2html
11084 !! wikitext
11085 a{{echo|b<table></table>c}}d
11087 a{{echo|b
11088 <table></table>
11089 c}}d
11091 {{echo|a
11093 <table></table>
11096 !! html
11097 <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>
11099 <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">
11100 </span><table about="#mwt2" data-parsoid='{"stx":"html"}'></table><span about="#mwt2">
11101 </span><p about="#mwt2">cd</p>
11103 <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">
11105 </span><table about="#mwt3" data-parsoid='{"stx":"html"}'></table><span about="#mwt3">
11107 </span><p about="#mwt3">b</p>
11108 !! end
11110 !! test
11111 Parsoid: Merge double tds (T52603)
11112 !! options
11113 parsoid
11114 !! wikitext
11116 |{{echo|{{!}} foo}}
11118 !! html
11119 <table><tbody>
11120 <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>
11121 </tbody></table>
11122 !! end
11124 !! test
11125 Parsoid: Merge double tds in nested transclusion content (T52603)
11126 !! options
11127 parsoid
11128 !! wikitext
11129 {{echo|<div>}}
11131 |{{echo|{{!}} foo}}
11133 {{echo|</div>}}
11134 !! html
11135 <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}}]}'>
11136 <table><tbody>
11137 <tr><td data-mw='{"parts":["|"]}'> foo</td></tr>
11138 </tbody></table>
11139 </div>
11140 !! end
11143 ### <includeonly> and <noinclude> in attributes
11145 !!test
11146 0. includeonly around the entire attribute
11147 !! wikitext
11148 <span <includeonly>id="v1"</includeonly><noinclude>id="v2"</noinclude>>bar</span>
11149 !! html
11150 <p><span id="v2">bar</span>
11151 </p>
11152 !!end
11154 !!test
11155 1. includeonly in html attr key
11156 !! wikitext
11157 <span <noinclude>id</noinclude><includeonly>about</includeonly>="foo">bar</span>
11158 !! html
11159 <p><span id="foo">bar</span>
11160 </p>
11161 !!end
11163 !!test
11164 2. includeonly in html attr value
11165 !! wikitext
11166 <span id="<noinclude>v1</noinclude><includeonly>v2</includeonly>">bar</span>
11167 <span id=<noinclude>"v1"</noinclude><includeonly>"v2"</includeonly>>bar</span>
11168 !! html
11169 <p><span id="v1">bar</span>
11170 <span id="v1">bar</span>
11171 </p>
11172 !!end
11174 !!test
11175 3. includeonly in part of an attr value
11176 !! wikitext
11177 <span style="color:<noinclude>red</noinclude><includeonly>blue</includeonly>;">bar</span>
11178 !! html
11179 <p><span style="color:red;">bar</span>
11180 </p>
11181 !!end
11183 !!test
11184 4. includeonly in table attributes
11185 !! wikitext
11187 |- <noinclude>
11190 </noinclude>
11191 |- <includeonly>
11194 </includeonly>
11196 !! html
11197 <table>
11200 <tr>
11201 <td>a
11202 </td></tr>
11203 </table>
11205 !!end
11208 ### Token Stream Patcher tests
11210 ### These tests won't always pass wt2wt and other modes because
11211 ### on serialization, the table will be output on a new line.
11212 ### For now, we are blacklisting them, and using this to test selser.
11215 !!test
11216 1. Table tag in SOL posn. should get reparsed correctly with valid TSR
11217 !!options
11218 parsoid=wt2html,wt2wt
11219 !!wikitext
11220 {{echo|}}{| width = '100%'
11221 |foo
11223 !!html/parsoid
11224 <span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":""}},"i":0}}]}'></span><table width="100%">
11225 <tbody><tr><td>foo</td></tr>
11226 </tbody></table>
11227 !!end
11229 ## We used to, but no longer wt2wt this test since the default serializer
11230 ## will normalize the include directives to serialize on their own line.
11231 ## Selser will take care of preserving formatting in scenarios where they
11232 ## intermingled with other wikitext.
11233 !!test
11234 2. Table tag in SOL posn. should get reparsed correctly with valid TSR
11235 !!options
11236 parsoid=wt2html
11237 !!wikitext
11238 <includeonly>a</includeonly>{| {{{b}}}
11241 !!html/parsoid
11242 <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":""}]]}'>
11243 <tbody><tr><td>c</td></tr>
11244 </tbody></table>
11245 !!end
11248 ### Testing parsing of templates where a template arg
11249 ### has the same name as the template itself.
11252 !! article
11253 Template:quote
11254 !! text
11255 {{{quote|{{{1}}}}}}
11256 !! endarticle
11258 !!test
11259 Templates: Template Name/Arg clash: 1. Use of positional param
11260 !! wikitext
11261 {{quote|foo}}
11262 !! html
11263 <p>foo
11264 </p>
11265 !!end
11267 !!test
11268 Templates: Template Name/Arg clash: 2. Use of named param
11269 !! wikitext
11270 {{quote|quote=foo}}
11271 !! html
11272 <p>foo
11273 </p>
11274 !!end
11276 !!test
11277 Templates: Template Name/Arg clash: 3. Use of named param with empty input
11278 !! wikitext
11279 {{quote|quote}}
11280 !! html
11281 <p>quote
11282 </p>
11283 !!end
11286 ### Parsoid-centric tests to stress Parsoid's ability to RT them unchanged
11289 !!test
11290 Templates: 1. Simple use
11291 !! wikitext
11292 {{echo|Foo}}
11293 !! html
11294 <p>Foo
11295 </p>
11296 !!end
11298 !!test
11299 Templates: 2. Inside a block tag
11300 !! wikitext
11301 <div>{{echo|Foo}}</div>
11302 <blockquote>{{echo|Foo}}</blockquote>
11303 !! html
11304 <div>Foo</div>
11305 <blockquote>Foo</blockquote>
11307 !! html+tidy
11308 <div>Foo</div>
11309 <blockquote>
11310 <p>Foo</p>
11311 </blockquote>
11312 !!end
11314 !!test
11315 Templates: P-wrapping: 1a. Templates on consecutive lines
11316 !! wikitext
11317 {{echo|Foo}}
11318 {{echo|bar}}
11319 !! html
11320 <p>Foo
11322 </p>
11323 !!end
11325 !!test
11326 Templates: P-wrapping: 1b. Templates on consecutive lines
11327 !! wikitext
11330 {{echo|bar}}
11331 {{echo|baz}}
11332 !! html
11333 <p>Foo
11334 </p><p>bar
11336 </p>
11337 !!end
11339 !!test
11340 Templates: P-wrapping: 1c. Templates on consecutive lines
11341 !! wikitext
11342 {{echo|Foo}}
11343 {{echo|bar}} <div>baz</div>
11344 !! html
11345 <p>Foo
11346 </p>
11347 bar <div>baz</div>
11349 !! html+tidy
11350 <p>Foo</p>
11351 <p>bar</p>
11352 <div>baz</div>
11353 !! end
11355 !!test
11356 Templates: P-wrapping: 1d. Template preceded by comment-only line
11357 !!options
11358 parsoid
11359 !! wikitext
11360 <!-- foo -->
11361 {{echo|Bar}}
11362 !! html
11363 <!-- foo -->
11365 <p about="#mwt223" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"Bar"}},"i":0}}]}'>Bar</p>
11366 !!end
11368 !!test
11369 Templates: Inline Text: 1. Multiple template uses
11370 !! wikitext
11371 {{echo|Foo}}bar{{echo|baz}}
11372 !! html
11373 <p>Foobarbaz
11374 </p>
11375 !!end
11377 !!test
11378 Templates: Inline Text: 2. Back-to-back template uses
11379 !! wikitext
11380 {{echo|Foo}}{{echo|bar}}
11381 !! html
11382 <p>Foobar
11383 </p>
11384 !!end
11386 !!test
11387 Templates: Block Tags: 1. Multiple template uses
11388 !! wikitext
11389 {{echo|<div>Foo</div>}}<div>bar</div>{{echo|<div>baz</div>}}
11390 !! html
11391 <div>Foo</div><div>bar</div><div>baz</div>
11393 !!end
11395 !!test
11396 Templates: Block Tags: 2. Back-to-back template uses
11397 !! wikitext
11398 {{echo|<div>Foo</div>}}{{echo|<div>bar</div>}}
11399 !! html
11400 <div>Foo</div><div>bar</div>
11402 !!end
11404 # This is an edge case relating to paragraph wrapping.
11405 !!test
11406 Templates: Correctly encapsulate templates producing </p> tag without a corresponding <p> tag
11407 !! wikitext
11408 {{echo|a
11409 b</p>}}
11410 !! html/parsoid
11411 <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
11412 b</p>
11413 !!end
11415 !!test
11416 Templates: Links: 1. Simple example
11417 !! wikitext
11418 {{echo|[[Foo|bar]]}}
11419 !! html
11420 <p><a href="/wiki/Foo" title="Foo">bar</a>
11421 </p>
11422 !!end
11424 !!test
11425 Templates: Links: 2. Generation of link href
11426 !! wikitext
11427 [[{{echo|Foo}}|bar]]
11428 !! html
11429 <p><a href="/wiki/Foo" title="Foo">bar</a>
11430 </p>
11431 !!end
11433 !!test
11434 Templates: Links: 3. Generation of part of a link href
11435 !! wikitext
11436 [[Fo{{echo|o}}|bar]]
11438 [[Foo{{echo|bar}}]]
11440 [[Foo{{echo|bar}}baz]]
11442 [[Foo{{echo|bar}}|bar]]
11444 [[:Foo{{echo|bar}}]]
11446 [[:Foo{{echo|bar}}|bar]]
11447 !! html
11448 <p><a href="/wiki/Foo" title="Foo">bar</a>
11449 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
11450 </p><p><a href="/index.php?title=Foobarbaz&amp;action=edit&amp;redlink=1" class="new" title="Foobarbaz (page does not exist)">Foobarbaz</a>
11451 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
11452 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
11453 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
11454 </p>
11455 !!end
11457 !!test
11458 Templates: Links: 4. Multiple templates generating link href
11459 !! wikitext
11460 [[{{echo|F}}{{echo|o}}ob{{echo|ar}}]]
11461 !! html
11462 <p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
11463 </p>
11464 !!end
11466 !!test
11467 Templates: Links: 5. Generation of link text
11468 !! wikitext
11469 [[Foo|{{echo|bar}}]]
11470 !! html
11471 <p><a href="/wiki/Foo" title="Foo">bar</a>
11472 </p>
11473 !!end
11475 !!test
11476 Templates: Links: 5. Nested templates (only outermost template should be marked)
11477 !! wikitext
11478 {{echo|[[{{echo|Foo}}|bar]]}}
11479 !! html
11480 <p><a href="/wiki/Foo" title="Foo">bar</a>
11481 </p>
11482 !!end
11484 !!test
11485 Templates: HTML Tag: 1. Generation of HTML attr. key
11486 !! wikitext
11487 <div {{echo|style}}="color:red;">foo</div>
11488 !! html
11489 <div style="color:red;">foo</div>
11491 !!end
11493 !!test
11494 Templates: HTML Tag: 2. Generation of HTML attr. value
11495 !! wikitext
11496 <div style={{echo|'color:red;'}}>foo</div>
11497 !! html
11498 <div style="color:red;">foo</div>
11500 !!end
11502 !!test
11503 Templates: HTML Tag: 3. Generation of HTML attr key and value
11504 !! wikitext
11505 <div {{echo|style}}={{echo|'color:red;'}}>foo</div>
11506 !! html
11507 <div style="color:red;">foo</div>
11509 !!end
11511 !!test
11512 Templates: HTML Tag: 4. Generation of starting piece of HTML attr value
11513 !! wikitext
11514 <div title="{{echo|This is a long title}} with just one piece templated">foo</div>
11515 !! html
11516 <div title="This is a long title with just one piece templated">foo</div>
11518 !!end
11520 !!test
11521 Templates: HTML Tag: 5. Generation of middle piece of HTML attr value
11522 !! wikitext
11523 <div title="This is a long title with just {{echo|one piece}} templated">foo</div>
11524 !! html
11525 <div title="This is a long title with just one piece templated">foo</div>
11527 !!end
11529 !!test
11530 Templates: HTML Tag: 6. Generation of end piece of HTML attr value
11531 !! wikitext
11532 <div title="This is a long title with just one piece {{echo|templated}}">foo</div>
11533 !! html
11534 <div title="This is a long title with just one piece templated">foo</div>
11536 !!end
11538 # SSS FIXME: While it is great we added support for all this,
11539 # do we want to make this part of the spec? Maybe we want to
11540 # deprecate this kind of usage in the future?
11541 !!test
11542 Templates: HTML Tag: 7. Generation of partial attribute key string
11543 !! wikitext
11544 <div st{{echo|yle}}="color:red;">foo</div>
11545 !! html
11546 <div style="color:red;">foo</div>
11548 !!end
11550 !! test
11551 Templates: HTML Tag: 8. Template-generated attribute (k=v)
11552 !! wikitext
11553 <div {{echo|1=id="v1"}}>bar</div>
11554 !! html
11555 <div id="v1">bar</div>
11557 !!end
11559 !! test
11560 Templates: HTML Tag: 9. Multiple template-generated attributes
11561 !! wikitext
11562 <div {{echo|1=id="v1" title="foo"}}>bar</div>
11563 !! html
11564 <div id="v1" title="foo">bar</div>
11566 !!end
11568 !! test
11569 Templates: Support for templates generating attributes and content
11570 !! wikitext
11571 {| {{mixed_attr_content_template}}
11573 |bar
11575 !! html/php
11576 <table style="color:red;" title="T48811">
11578 <tr>
11579 <td>foo
11580 </td></tr>
11581 <tr>
11582 <td>bar
11583 </td></tr></table>
11585 !! html/parsoid
11586 <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|}"]}'>
11587 <tbody><tr>
11588 <td>foo</td></tr>
11589 <tr>
11590 <td>bar</td></tr>
11591 </tbody></table>
11592 !!end
11594 !! test
11595 1. Entities and nowikis inside templated attributes should be handled correctly
11596 !! wikitext
11597 <div {{echo|style{{=}}"background:&#35;f9f9f9;"}}>foo</div>
11598 !! html/php
11599 <div style="background:#f9f9f9;">foo</div>
11601 !! html/parsoid
11602 <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>
11603 !! end
11605 !! test
11606 2. Entities and nowikis inside templated attributes should be handled correctly
11607 !! wikitext
11609 |{{table_attribs_3}}
11611 !! html/php
11612 <table>
11613 <tr>
11614 <td style="background:#f9f9f9;">Foo
11615 </td></tr></table>
11617 !! html/parsoid
11618 <table>
11619 <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>
11620 </tbody></table>
11621 !! end
11623 !! test
11624 3. Entities and nowikis inside templated attributes should be handled correctly inside templated tables
11625 !! wikitext
11626 {{tbl-start}}
11627 |{{table_attribs_3}}
11628 {{tbl-end}}
11629 !! html/php
11630 <table>
11631 <tr>
11632 <td style="background:#f9f9f9;">Foo
11633 </td></tr></table>
11635 !! html/parsoid
11636 <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}}]}'>
11637 <tbody><tr><td style="background:#f9f9f9;">Foo</td></tr>
11638 </tbody></table>
11639 !! end
11641 # T107622
11642 !! test
11643 4. Entities and nowikis inside templated attributes should be handled correctly inside templated tables
11644 !! wikitext
11646 | {{table_attribs_6}} hi
11648 !! html/php
11649 <table>
11650 <tr>
11651 <td style="background: red;"> hi
11652 </td></tr></table>
11654 !! html/parsoid
11655 <table>
11656 <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>
11657 </tbody></table>
11658 !! end
11660 !!test
11661 Templates: HTML Tables: 1. Generating start of a HTML table
11662 !! wikitext
11663 {{echo|<table><tr><td>foo</td>}}</tr></table>
11664 !! html
11665 <table><tr><td>foo</td></tr></table>
11667 !!end
11669 !!test
11670 Templates: HTML Tables: 2a. Generating middle of a HTML table
11671 !! wikitext
11672 <table><tr>{{echo|<td>foo</td>}}</tr></table>
11673 !! html
11674 <table><tr><td>foo</td></tr></table>
11676 !!end
11678 !!test
11679 Templates: HTML Tables: 2b. Generating middle of a HTML table
11680 !! wikitext
11681 <table>{{echo|<tr><td>foo</td></tr>}}</table>
11682 !! html
11683 <table><tr><td>foo</td></tr></table>
11685 !!end
11687 !!test
11688 Templates: HTML Tables: 3. Generating end of a HTML table
11689 !! wikitext
11690 <table><tr>{{echo|<td>foo</td></tr></table>}}
11691 !! html
11692 <table><tr><td>foo</td></tr></table>
11694 !!end
11696 !!test
11697 Templates: HTML Tables: 4a. Generating a single tag of a HTML table
11698 !! wikitext
11699 {{echo|<table>}}<tr><td>foo</td></tr></table>
11700 !! html
11701 <table><tr><td>foo</td></tr></table>
11703 !!end
11705 !!test
11706 Templates: HTML Tables: 4b. Generating a single tag of a HTML table
11707 !! wikitext
11708 <table>{{echo|<tr>}}<td>foo</td></tr></table>
11709 !! html
11710 <table><tr><td>foo</td></tr></table>
11712 !!end
11714 !!test
11715 Templates: HTML Tables: 4c. Generating a single tag of a HTML table
11716 !! wikitext
11717 <table><tr>{{echo|<td>}}foo</td></tr></table>
11718 !! html
11719 <table><tr><td>foo</td></tr></table>
11721 !!end
11723 !!test
11724 Templates: HTML Tables: 4d. Generating a single tag of a HTML table
11725 !! wikitext
11726 <table><tr><td>foo{{echo|</td>}}</tr></table>
11727 !! html
11728 <table><tr><td>foo</td></tr></table>
11730 !!end
11732 !!test
11733 Templates: HTML Tables: 4e. Generating a single tag of a HTML table
11734 !! wikitext
11735 <table><tr><td>foo</td>{{echo|</tr>}}</table>
11736 !! html
11737 <table><tr><td>foo</td></tr></table>
11739 !!end
11741 !!test
11742 Templates: HTML Tables: 4f. Generating a single tag of a HTML table
11743 !! wikitext
11744 <table><tr><td>foo</td></tr>{{echo|</table>}}
11745 !! html
11746 <table><tr><td>foo</td></tr></table>
11748 !!end
11750 !!test
11751 Templates: HTML Tables: 5. Proper fostering of categories from inside
11752 !!options
11753 parsoid=wt2html,wt2wt
11754 !! wikitext
11755 <table>[[Category:foo1]]<tr><td>foo</td></tr></table>
11756 <!--Two categories (Bug 50330)-->
11757 <table>[[Category:bar1]][[Category:bar2]]<tr><td>foo</td></tr></table>
11758 !! html
11759 <link rel="mw:PageProp/Category" href="./Category:Foo1"><table><tbody><tr><td>foo</td></tr></tbody></table>
11760 <!--Two categories (Bug 50330)-->
11761 <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>
11762 !!end
11764 !!test
11765 Templates: Wiki Tables: 1a. Fostering of entire template content
11766 !! wikitext
11768 {{echo|a}}
11770 !! html
11771 <table>
11773 <tr><td></td></tr></table>
11775 !! html+tidy
11776 <p>a</p>
11777 <table>
11778 <tr>
11779 <td></td>
11780 </tr>
11781 </table>
11782 !! end
11784 !!test
11785 Templates: Wiki Tables: 1b. Fostering of entire template content
11786 !! wikitext
11788 {{echo|<div>}}
11790 {{echo|</div>}}
11792 !! html
11793 <table>
11794 <div>
11795 <p>foo
11796 </p>
11797 </div>
11798 <tr><td></td></tr></table>
11800 !! html+tidy
11801 <div>
11802 <p>foo</p>
11803 </div>
11804 <table>
11805 <tr>
11806 <td></td>
11807 </tr>
11808 </table>
11809 !! end
11811 !!test
11812 Templates: Wiki Tables: 2. Fostering of partial template content
11813 !! wikitext
11815 {{echo|a
11816 <div>b</div>}}
11818 !! html
11819 <table>
11821 <div>b</div>
11822 <tr><td></td></tr></table>
11824 !! html+tidy
11825 <p>a</p>
11826 <div>b</div>
11827 <table>
11828 <tr>
11829 <td></td>
11830 </tr>
11831 </table>
11832 !! end
11834 !!test
11835 Templates: Wiki Tables: 3. td-content via multiple templates
11836 !! wikitext
11838 {{echo|{{pipe}}a}}{{echo|b}}
11840 !! html
11841 <table>
11842 <tr>
11843 <td>ab
11844 </td></tr></table>
11846 !!end
11848 !!test
11849 Templates: Wiki Tables: 4. Templated tags, no content
11850 !! wikitext
11851 {{tbl-start}}
11852 {{tbl-end}}
11853 !! html
11854 <table>
11855 <tr><td></td></tr></table>
11857 !!end
11859 !!test
11860 Templates: Wiki Tables: 5. Templated tags, regular td-tags
11861 !! wikitext
11862 {{tbl-start}}
11863 |foo
11864 {{tbl-end}}
11865 !! html
11866 <table>
11867 <tr>
11868 <td>foo
11869 </td></tr></table>
11871 !!end
11873 !!test
11874 Templates: Wiki Tables: 6. Templated tags, templated td-tags
11875 !! wikitext
11876 {{tbl-start}}
11877 {{!}}foo
11878 {{tbl-end}}
11879 !! html
11880 <table>
11881 <tr>
11882 <td>foo
11883 </td></tr></table>
11885 !!end
11887 ## This test case is very specific to Parsoid's internals
11888 ## and is hence only tested for Parsoid's code. Parsoid uses
11889 ## a <meta> marker tag for <ref> tags and they are expanded
11890 ## much later. We are verifying that this <meta> tag usage
11891 ## doesn't prevent foster parenting.
11892 !!test
11893 Templates: Wiki Tables: 7. Fosterable <ref>s should get fostered
11894 !!wikitext
11895 {{PartialTable}}<ref>foo</ref>
11898 <references />
11899 !!html/parsoid
11900 <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">
11901 <tbody>
11902 </tbody></table>
11904 <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>
11905 !!end
11907 !! test
11908 Templates: Wiki Tables: 8. Fosterable meta-tags should get fostered
11909 !! wikitext
11910 {{echo|
11911 {{{!}}
11912 {{!}}-}}
11913 <onlyinclude>
11914 |foo
11915 </onlyinclude>
11916 {{!}}}
11917 !! html/parsoid
11918 <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{{!}}}"]}'>
11919 </span><meta typeof="mw:Includes/OnlyInclude" about="#mwt1"/><table about="#mwt1">
11920 <tbody><tr>
11922 <td>foo
11923 <meta typeof="mw:Includes/OnlyInclude/End"/></td></tr>
11924 </tbody></table>
11925 !! end
11927 !!test
11928 Templates: Lists: Multi-line list-items via templates
11929 !! wikitext
11930 *{{echo|a {{nonexistent|
11931 unused}}}}
11932 *{{echo|b {{nonexistent|
11933 unused}}}}
11934 !! html
11935 <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>
11936 <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>
11938 !!end
11940 !!test
11941 Templates: Ugly nesting: 1. Quotes opened/closed across templates (echo)
11942 !! wikitext
11943 {{echo|''a}}{{echo|b''c''d}}{{echo|''e}}
11944 !! html
11945 <p><i>ab</i>c<i>d</i>e
11946 </p>
11947 !!end
11949 !!test
11950 Templates: Ugly nesting: 2. Quotes opened/closed across templates (echo_with_span)
11951 (PHP parser generates misnested html)
11952 !! wikitext
11953 {{echo_with_span|''a}}{{echo_with_span|b''c''d}}{{echo_with_span|''e}}
11954 !! html/parsoid
11955 <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>
11956 !!end
11958 !!test
11959 Templates: Ugly nesting: 3. Quotes opened/closed across templates (echo_with_div)
11960 (PHP parser generates misnested html; Parsoid html2wt mode adds newlines between {{echo}}s)
11961 !! options
11962 parsoid=wt2html,wt2wt
11963 !! wikitext
11964 {{echo_with_div|''a}}{{echo_with_div|b''c''d}}{{echo_with_div|''e}}
11965 !! html
11966 <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>
11967 <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>
11968 <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>
11969 !!end
11971 !!test
11972 Templates: Ugly nesting: 4. Divs opened/closed across templates
11973 !! wikitext
11974 a<div>b{{echo|c</div>d}}e
11975 !! html
11976 a<div>bc</div>de
11978 !! html+tidy
11979 <p>a</p>
11980 <div>bc</div>
11981 <p>de</p>
11982 !! end
11984 !!test
11985 Templates: Ugly templates: 1. Navbox template parses badly leading to table misnesting
11986 (Parsoid-centric)
11987 !! options
11988 parsoid
11989 !! wikitext
11991 |{{echo|foo</table>}}
11992 |bar
11994 !! html
11995 <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|}"]}'>
11997 <tbody>
11998 <tr>
11999 <td>foo</td></tr></tbody></table><span about="#mwt1">
12000 </span><span about="#mwt1">|bar</span><span about="#mwt1">
12001 |}</span>
12002 !!end
12004 !!test
12005 Templates: Ugly templates: 2. Navbox template parses badly leading to table misnesting
12006 (Parsoid-centric)
12007 !! options
12008 parsoid
12009 !! wikitext
12010 <table>
12011   <tr>
12012     <td>
12013     <table>
12014       <tr>
12015         <td>1. {{echo|foo </table>}}</td>
12016         <td> bar </td>
12017         <td>2. {{echo|baz </table>}}</td>
12018       </tr>
12019       <tr>
12020         <td>abc</td>
12021       </tr>
12022     </table>
12023     </td>
12024   </tr>
12025   <tr>
12026     <td>xyz</td>
12027   </tr>
12028 </table>
12029 !! html
12030 <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>"]}'>
12031   <tbody><tr>
12032     <td>
12033     <table>
12034       <tbody><tr>
12035         <td>1. foo </td></tr></tbody></table></td>
12036         <td> bar </td>
12037         <td>2. baz </td></tr></tbody></table><span about="#mwt2">
12038       </span><span about="#mwt2">
12039       </span><span about="#mwt2">
12040         </span><span about="#mwt2">abc</span><span about="#mwt2">
12041       </span><span about="#mwt2">
12042     </span><span about="#mwt2">
12043     </span><span about="#mwt2">
12044   </span><span about="#mwt2">
12045   </span><span about="#mwt2">
12046     </span><span about="#mwt2">xyz</span><span about="#mwt2">
12047   </span><span about="#mwt2">
12048 </span>
12049 !!end
12051 !! test
12052 Templates: Ugly templates: 3. newline-only template parameter
12053 !! wikitext
12054 foo {{echo|
12056 !! html
12057 <p>foo 
12058 </p>
12059 !! end
12061 # This looks like a bug: a single newline triggers p/br for some reason.
12062 !! test
12063 Templates: Ugly templates: 4. newline-only template parameter inconsistency
12064 !! wikitext
12065 {{echo|
12067 !! html
12068 <p><br />
12069 </p>
12070 !! end
12072 # Bug 64017 -- ugly wikitext with fostered content generates two template ranges that
12073 # have a true overlap (T1-start - T2-start - T1-end - T2-end).
12074 !! test
12075 Templates: Ugly templates: 5. Template encapsulation test: Non-trivial overlap of template ranges is properly handled
12076 !! wikitext
12077 {{echo|<table>}}
12078 {{echo|<div>foo}}
12079 {{echo|</table>}}
12080 !! html/parsoid
12081 <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
12082 </div><table about="#mwt1" data-parsoid='{"stx":"html"}'>
12083 </table>
12084 !! end
12086 # Bug 64017 -- ugly wikitext with fostered content generates two template ranges
12087 # that are "identical" and generate nesting cycles in the algorithm
12088 !! test
12089 Templates: Ugly templates: 6. Template encapsulation test: Cyclical nesting of template ranges is properly handled
12090 !! wikitext
12091 {{echo|<table><tr><td><table>}}
12092 {{echo|<div>}}
12093 {{echo|</div>}}
12094 !! html/parsoid
12095 <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"}'>
12096 </div><table about="#mwt1" data-parsoid='{"stx":"html"}'>
12097 </table></td></tr></tbody></table>
12098 !! end
12100 !! test
12101 Templates: Parameters substituted at the top-level
12102 !! wikitext
12103 {{{foo|''who'' {{echo|me}}? '''never!'''}}}
12104 !! html/php
12105 <p><i>who</i> me? <b>never!</b>
12106 </p>
12107 !! html/parsoid
12108 <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>
12109 !! end
12111 !!test
12112 Parser Functions: 1. Simple example
12113 !! wikitext
12114 {{uc:foo}}
12115 !! html
12116 <p>FOO
12117 </p>
12118 !!end
12120 !!test
12121 Parser Functions: 2. Nested use (only outermost should be marked up)
12122 !! wikitext
12123 {{uc:{{lc:FOO}}}}
12124 !! html
12125 <p>FOO
12126 </p>
12127 !!end
12130 ### Pre-save transform tests
12132 !! test
12133 pre-save transform: subst:
12134 !! options
12136 !! wikitext
12137 {{subst:test}}
12138 !! html/php
12139 This is a test template
12140 !! end
12142 !! test
12143 pre-save transform: normal template
12144 !! options
12146 !! wikitext
12147 {{test}}
12148 !! html/php
12149 {{test}}
12150 !! end
12152 !! test
12153 pre-save transform: nonexistent template
12154 !! options
12156 !! wikitext
12157 {{thistemplatedoesnotexist}}
12158 !! html/php
12159 {{thistemplatedoesnotexist}}
12160 !! end
12162 !! test
12163 pre-save transform: subst magic variables
12164 !! options
12166 !! wikitext
12167 {{subst:SITENAME}}
12168 !! html/php
12169 MediaWiki
12170 !! end
12172 # This is bug 89, which I fixed. -- wtm
12173 !! test
12174 pre-save transform: subst: templates with parameters
12175 !! options
12177 !! wikitext
12178 {{subst:paramtest|param="something else"}}
12179 !! html/php
12180 This is a test template with parameter "something else"
12181 !! end
12183 !! article
12184 Template:nowikitest
12185 !! text
12186 <nowiki>'''not wiki'''</nowiki>
12187 !! endarticle
12189 !! test
12190 pre-save transform: nowiki in subst (bug 1188)
12191 !! options
12193 !! wikitext
12194 {{subst:nowikitest}}
12195 !! html/php
12196 <nowiki>'''not wiki'''</nowiki>
12197 !! end
12199 !! article
12200 Template:commenttest
12201 !! text
12202 This template has <!-- a comment --> in it.
12203 !! endarticle
12205 !! test
12206 pre-save transform: comment in subst (bug 1936)
12207 !! options
12209 !! wikitext
12210 {{subst:commenttest}}
12211 !! html/php
12212 This template has <!-- a comment --> in it.
12213 !! end
12215 !! test
12216 pre-save transform: unclosed tag
12217 !! options
12219 !! wikitext
12220 <nowiki>'''not wiki'''
12221 !! html/php
12222 <nowiki>'''not wiki'''
12223 !! end
12225 !! test
12226 pre-save transform: mixed tag case
12227 !! options
12229 !! wikitext
12230 <NOwiki>'''not wiki'''</noWIKI>
12231 !! html/php
12232 <NOwiki>'''not wiki'''</noWIKI>
12233 !! end
12235 !! test
12236 pre-save transform: unclosed comment in <nowiki>
12237 !! options
12239 !! wikitext
12240 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
12241 !! html/php
12242 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
12243 !!end
12245 # Leading @ in this template definition works around a limitation
12246 # in parsoid's parserTests which otherwise strips the <span> from the
12247 # result (confusing it for a template wrapper)
12248 !! article
12249 Template:dangerous
12250 !!text
12251 @<span onmouseover="alert('crap')">Oh no</span>
12252 !!endarticle
12254 !!test
12255 (confirming safety of fix for subst bug 1936)
12256 !! wikitext
12257 {{Template:dangerous}}
12258 !! html
12259 <p>@<span>Oh no</span>
12260 </p>
12261 !! end
12263 !! test
12264 pre-save transform: comment containing gallery (bug 5024)
12265 !! options
12267 !! wikitext
12268 <!-- <gallery>data</gallery> -->
12269 !! html/php
12270 <!-- <gallery>data</gallery> -->
12271 !!end
12273 !! test
12274 pre-save transform: comment containing extension
12275 !! options
12277 !! wikitext
12278 <!-- <tag>data</tag> -->
12279 !! html/php
12280 <!-- <tag>data</tag> -->
12281 !!end
12283 !! test
12284 pre-save transform: comment containing nowiki
12285 !! options
12287 !! wikitext
12288 <!-- <nowiki>data</nowiki> -->
12289 !! html/php
12290 <!-- <nowiki>data</nowiki> -->
12291 !!end
12293 !! test
12294 pre-save transform: <noinclude> in subst (bug 3298)
12295 !! options
12297 !! wikitext
12298 {{subst:Includes}}
12299 !! html/php
12300 Foobar
12301 !! end
12303 !! test
12304 pre-save transform: <onlyinclude> in subst (bug 3298)
12305 !! options
12307 !! wikitext
12308 {{subst:Includes2}}
12309 !! html/php
12311 !! end
12313 !! article
12314 Template:SubstTest
12315 !!text
12316 {{<includeonly>subst:</includeonly>Includes}}
12317 !! endarticle
12319 !! article
12320 Template:SafeSubstTest
12321 !! text
12322 {{<includeonly>safesubst:</includeonly>Includes}}
12323 !! endarticle
12325 !! test
12326 bug 22297: safesubst: works during PST
12327 !! options
12329 !! wikitext
12330 {{subst:SafeSubstTest}}{{safesubst:SubstTest}}
12331 !! html/php
12332 FoobarFoobar
12333 !! end
12335 !! test
12336 bug 22297: safesubst: works during normal parse
12337 !! wikitext
12338 {{SafeSubstTest}}
12339 !! html
12340 <p>Foobar
12341 </p>
12342 !! end
12344 !! test
12345 subst: does not work during normal parse
12346 !! wikitext
12347 {{SubstTest}}
12348 !! html
12349 <p>{{subst:Includes}}
12350 </p>
12351 !! end
12353 !! test
12354 pre-save transform: context links ("pipe trick")
12355 !! options
12357 !! wikitext
12358 [[Article (context)|]]
12359 [[Bar:Article|]]
12360 [[:Bar:Article|]]
12361 [[Bar:Article (context)|]]
12362 [[:Bar:Article (context)|]]
12363 [[|Article]]
12364 [[|Article (context)]]
12365 [[Bar:X (Y) Z|]]
12366 [[:Bar:X (Y) Z|]]
12367 !! html/php
12368 [[Article (context)|Article]]
12369 [[Bar:Article|Article]]
12370 [[:Bar:Article|Article]]
12371 [[Bar:Article (context)|Article]]
12372 [[:Bar:Article (context)|Article]]
12373 [[Article]]
12374 [[Article (context)]]
12375 [[Bar:X (Y) Z|X (Y) Z]]
12376 [[:Bar:X (Y) Z|X (Y) Z]]
12377 !! end
12379 !! test
12380 pre-save transform: context links ("pipe trick") with interwiki prefix
12381 !! options
12383 !! wikitext
12384 [[interwiki:Article|]]
12385 [[:interwiki:Article|]]
12386 [[interwiki:Bar:Article|]]
12387 [[:interwiki:Bar:Article|]]
12388 !! html/php
12389 [[interwiki:Article|Article]]
12390 [[:interwiki:Article|Article]]
12391 [[interwiki:Bar:Article|Bar:Article]]
12392 [[:interwiki:Bar:Article|Bar:Article]]
12393 !! end
12395 !! test
12396 pre-save transform: context links ("pipe trick") with parens in title
12397 !! options
12398 pst title=[[Somearticle (context)]]
12399 !! wikitext
12400 [[|Article]]
12401 !! html/php
12402 [[Article (context)|Article]]
12403 !! end
12405 !! test
12406 pre-save transform: context links ("pipe trick") with comma in title
12407 !! options
12408 pst title=[[Someplace, Somewhere]]
12409 !! wikitext
12410 [[|Otherplace]]
12411 [[Otherplace, Elsewhere|]]
12412 [[Otherplace, Elsewhere, Anywhere|]]
12413 !! html/php
12414 [[Otherplace, Somewhere|Otherplace]]
12415 [[Otherplace, Elsewhere|Otherplace]]
12416 [[Otherplace, Elsewhere, Anywhere|Otherplace]]
12417 !! end
12419 !! test
12420 pre-save transform: context links ("pipe trick") with parens and comma
12421 !! options
12422 pst title=[[Someplace (IGNORED), Somewhere]]
12423 !! wikitext
12424 [[|Otherplace]]
12425 [[Otherplace (place), Elsewhere|]]
12426 !! html/php
12427 [[Otherplace, Somewhere|Otherplace]]
12428 [[Otherplace (place), Elsewhere|Otherplace]]
12429 !! end
12431 !! test
12432 pre-save transform: context links ("pipe trick") with comma and parens
12433 !! options
12434 pst title=[[Who, me? (context)]]
12435 !! wikitext
12436 [[|Yes, you.]]
12437 [[Me, Myself, and I (1937 song)|]]
12438 !! html/php
12439 [[Yes, you. (context)|Yes, you.]]
12440 [[Me, Myself, and I (1937 song)|Me, Myself, and I]]
12441 !! end
12443 !! test
12444 pre-save transform: context links ("pipe trick") with namespace
12445 !! options
12446 pst title=[[Ns:Somearticle]]
12447 !! wikitext
12448 [[|Article]]
12449 !! html/php
12450 [[Ns:Article|Article]]
12451 !! end
12453 !! test
12454 pre-save transform: context links ("pipe trick") with namespace and parens
12455 !! options
12456 pst title=[[Ns:Somearticle (context)]]
12457 !! wikitext
12458 [[|Article]]
12459 !! html/php
12460 [[Ns:Article (context)|Article]]
12461 !! end
12463 !! test
12464 pre-save transform: context links ("pipe trick") with namespace and comma
12465 !! options
12466 pst title=[[Ns:Somearticle, Context, Whatever]]
12467 !! wikitext
12468 [[|Article]]
12469 !! html/php
12470 [[Ns:Article, Context, Whatever|Article]]
12471 !! end
12473 !! test
12474 pre-save transform: context links ("pipe trick") with namespace, comma and parens
12475 !! options
12476 pst title=[[Ns:Somearticle, Context (context)]]
12477 !! wikitext
12478 [[|Article]]
12479 !! html/php
12480 [[Ns:Article (context)|Article]]
12481 !! end
12483 !! test
12484 pre-save transform: context links ("pipe trick") with namespace, parens and comma
12485 !! options
12486 pst title=[[Ns:Somearticle (IGNORED), Context]]
12487 !! wikitext
12488 [[|Article]]
12489 !! html/php
12490 [[Ns:Article, Context|Article]]
12491 !! end
12493 !! test
12494 pre-save transform: context links ("pipe trick") with full-width parens and no space (Japanese and Chinese style, bug 30149)
12495 !! options
12497 !! wikitext
12498 [[Article(context)|]]
12499 [[Bar:Article(context)|]]
12500 [[:Bar:Article(context)|]]
12501 [[|Article(context)]]
12502 [[Bar:X(Y)Z|]]
12503 [[:Bar:X(Y)Z|]]
12504 !! html/php
12505 [[Article(context)|Article]]
12506 [[Bar:Article(context)|Article]]
12507 [[:Bar:Article(context)|Article]]
12508 [[Article(context)]]
12509 [[Bar:X(Y)Z|X(Y)Z]]
12510 [[:Bar:X(Y)Z|X(Y)Z]]
12511 !! end
12513 !! test
12514 pre-save transform: context links ("pipe trick") with full-width parens and space (Japanese and Chinese style, bug 30149)
12515 !! options
12517 !! wikitext
12518 [[Article (context)|]]
12519 [[Bar:Article (context)|]]
12520 [[:Bar:Article (context)|]]
12521 [[|Article (context)]]
12522 [[Bar:X (Y) Z|]]
12523 [[:Bar:X (Y) Z|]]
12524 !! html/php
12525 [[Article (context)|Article]]
12526 [[Bar:Article (context)|Article]]
12527 [[:Bar:Article (context)|Article]]
12528 [[Article (context)]]
12529 [[Bar:X (Y) Z|X (Y) Z]]
12530 [[:Bar:X (Y) Z|X (Y) Z]]
12531 !! end
12533 !! test
12534 pre-save transform: context links ("pipe trick") with parens and no space (Korean style, bug 30149)
12535 !! options
12537 !! wikitext
12538 [[Article(context)|]]
12539 [[Bar:Article(context)|]]
12540 [[:Bar:Article(context)|]]
12541 [[|Article(context)]]
12542 [[Bar:X(Y)Z|]]
12543 [[:Bar:X(Y)Z|]]
12544 !! html/php
12545 [[Article(context)|Article]]
12546 [[Bar:Article(context)|Article]]
12547 [[:Bar:Article(context)|Article]]
12548 [[Article(context)]]
12549 [[Bar:X(Y)Z|X(Y)Z]]
12550 [[:Bar:X(Y)Z|X(Y)Z]]
12551 !! end
12553 !! test
12554 pre-save transform: context links ("pipe trick") with commas (bug 21660)
12555 !! options
12557 !! wikitext
12558 [[Article (context), context|]]
12559 [[Article (context),context|]]
12560 [[Bar:Article (context), context|]]
12561 [[Bar:Article (context),context|]]
12562 [[:Bar:Article (context), context|]]
12563 [[:Bar:Article (context),context|]]
12564 !! html/php
12565 [[Article (context), context|Article]]
12566 [[Article (context),context|Article]]
12567 [[Bar:Article (context), context|Article]]
12568 [[Bar:Article (context),context|Article]]
12569 [[:Bar:Article (context), context|Article]]
12570 [[:Bar:Article (context),context|Article]]
12571 !! end
12573 !! test
12574 pre-save transform: trim trailing empty lines
12575 !! options
12577 !! wikitext
12578 Empty lines are trimmed
12583 !! html/php
12584 Empty lines are trimmed
12585 !! end
12587 !! test
12588 pre-save transform: Signature expansion
12589 !! options
12591 !! wikitext
12592 * ~~~
12593 * <noinclude>~~~</noinclude>
12594 * <includeonly>~~~</includeonly>
12595 * <onlyinclude>~~~</onlyinclude>
12596 !! html/php
12597 * [[Special:Contributions/127.0.0.1|127.0.0.1]]
12598 * <noinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</noinclude>
12599 * <includeonly>[[Special:Contributions/127.0.0.1|127.0.0.1]]</includeonly>
12600 * <onlyinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</onlyinclude>
12601 !! end
12604 !! test
12605 pre-save transform: Signature expansion in nowiki tags (bug 93)
12606 !! options
12607 pst disabled
12608 !! wikitext
12609 Shall not expand:
12611 <nowiki>~~~~</nowiki>
12613 <includeonly><nowiki>~~~~</nowiki></includeonly>
12615 <noinclude><nowiki>~~~~</nowiki></noinclude>
12617 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
12619 {{subst:Foo}} shall be converted to FOO
12621 As well as inside noinclude/onlyinclude
12622 <noinclude>{{subst:Foo}}</noinclude>
12623 <onlyinclude>{{subst:Foo}}</onlyinclude>
12625 But not inside includeonly
12626 <includeonly>{{subst:Foo}}</includeonly>
12627 !! html/php
12628 Shall not expand:
12630 <nowiki>~~~~</nowiki>
12632 <includeonly><nowiki>~~~~</nowiki></includeonly>
12634 <noinclude><nowiki>~~~~</nowiki></noinclude>
12636 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
12638 FOO shall be converted to FOO
12640 As well as inside noinclude/onlyinclude
12641 <noinclude>FOO</noinclude>
12642 <onlyinclude>FOO</onlyinclude>
12644 But not inside includeonly
12645 <includeonly>{{subst:Foo}}</includeonly>
12646 !! end
12648 !! test
12649 Parsoid: Recognize nowiki with trailing space in tags
12650 !! options
12651 parsoid=wt2html
12652 !! wikitext
12653 <nowiki ><div>[[foo]]</nowiki >
12655 a<nowiki / >b
12657 c<nowiki />d
12659 e<nowiki/ >f
12660 !! html
12661 <p><span typeof="mw:Nowiki">&lt;div&gt;[[foo]]</span></p>
12662 <p>ab</p>
12663 <p>cd</p>
12664 <p>ef</p>
12665 !! end
12667 !! test
12668 Parsoid: Recognize nowiki with odd capitalization
12669 !! options
12670 parsoid=wt2html
12671 !! wikitext
12672 <noWikI ><div>[[foo]]</Nowiki >
12673 !! html
12674 <p><span typeof="mw:Nowiki">&lt;div&gt;[[foo]]</span></p>
12675 !! end
12678 !! test
12679 Parsoid: Escape nowiki with trailing space in tags
12680 !! options
12681 parsoid=html2wt
12682 !! html/parsoid
12683 <p>&lt;nowiki &gt; foo &lt/nowiki ></p>
12684 <p>a&lt;nowiki /&gt;b</p>
12685 <p>c&lt;nowiki/ &gt;d</p>
12686 !! wikitext
12687 &lt;nowiki &gt; foo &lt;/nowiki &gt;
12689 a&lt;nowiki /&gt;b
12691 c&lt;nowiki/ &gt;d
12692 !! end
12694 !! test
12695 Parsoid: Escape weird noWikI capitalizations
12696 !! options
12697 parsoid=html2wt
12698 !! html/parsoid
12699 <p>&lt;noWikI &gt; foo &lt/NoWikI ></p>
12700 !! wikitext
12701 &lt;noWikI &gt; foo &lt;/NoWikI &gt;
12702 !! end
12705 ### Message transform tests
12707 !! test
12708 message transform: magic variables
12709 !! options
12711 !! wikitext
12712 {{SITENAME}}
12713 !! html
12714 MediaWiki
12715 !! end
12717 !! test
12718 message transform: should not transform wiki markup
12719 !! options
12721 !! wikitext
12722 ''test''
12723 !! html
12724 ''test''
12725 !! end
12727 !! test
12728 message transform: <noinclude> in transcluded template (bug 4926)
12729 !! options
12731 !! wikitext
12732 {{Includes}}
12733 !! html
12734 Foobar
12735 !! end
12737 !! test
12738 message transform: <onlyinclude> in transcluded template (bug 4926)
12739 !! options
12741 !! wikitext
12742 {{Includes2}}
12743 !! html
12745 !! end
12747 !! test
12748 {{#special:}} page name, known
12749 !! options
12751 !! wikitext
12752 {{#special:Recentchanges}}
12753 !! html
12754 Special:RecentChanges
12755 !! end
12757 !! test
12758 {{#special:}} page name with subpage, known
12759 !! options
12761 !! wikitext
12762 {{#special:Recentchanges/param}}
12763 !! html
12764 Special:RecentChanges/param
12765 !! end
12767 !! test
12768 {{#special:}} page name, unknown
12769 !! options
12771 !! wikitext
12772 {{#special:foobar nonexistent}}
12773 !! html
12774 Special:Foobar nonexistent
12775 !! end
12777 !! test
12778 {{#speciale:}} page name, known
12779 !! options
12781 !! wikitext
12782 {{#speciale:Recentchanges}}
12783 !! html
12784 Special:RecentChanges
12785 !! end
12787 !! test
12788 {{#speciale:}} page name with subpage, known
12789 !! options
12791 !! wikitext
12792 {{#speciale:Recentchanges/param}}
12793 !! html
12794 Special:RecentChanges/param
12795 !! end
12797 !! test
12798 {{#speciale:}} page name, unknown
12799 !! options
12801 !! wikitext
12802 {{#speciale:foobar nonexistent}}
12803 !! html
12804 Special:Foobar_nonexistent
12805 !! end
12808 ### Images
12810 ### For Parsoid-specific tests, see
12811 #### https://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec#Images
12813 !! test
12814 Simple image
12815 !! options
12816 parsoid=wt2html,wt2wt,html2html
12817 !! wikitext
12818 [[Image:foobar.jpg]]
12819 !! html/php
12820 <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>
12821 </p>
12822 !! html/parsoid
12823 <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>
12824 !! end
12826 !! test
12827 Simple image (using File: namespace, now canonical)
12828 !! wikitext
12829 [[File:Foobar.jpg]]
12830 !! html/php
12831 <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>
12832 </p>
12833 !! html/parsoid
12834 <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>
12835 !! end
12837 !! test
12838 Right-aligned image
12839 !! wikitext
12840 [[File:Foobar.jpg|right]]
12841 !! html/php
12842 <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>
12844 !! html/parsoid
12845 <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>
12846 !! end
12848 !! test
12849 Image with caption
12850 !! wikitext
12851 [[File:Foobar.jpg|right|Caption text]]
12852 !! html/php
12853 <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>
12855 !! html/parsoid
12856 <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>
12857 !! end
12859 !! test
12860 Image with caption, bug 53312 #1
12861 !! wikitext
12862 [[File:Foobar.jpg|right|Caption page stuff]]
12863 !! html/php
12864 <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>
12866 !! html/parsoid
12867 <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>
12868 !! end
12870 !! test
12871 Image with caption, bug 53312 #2
12872 !! wikitext
12873 [[File:Foobar.jpg|right|Caption page=]]
12874 !! html/php
12875 <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>
12877 !! html/parsoid
12878 <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>
12879 !! end
12881 !! test
12882 Image with caption, bug 53312 #3
12883 !! wikitext
12884 [[File:Foobar.jpg|right|Caption page=stuff]]
12885 !! html/php
12886 <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>
12888 !! html/parsoid
12889 <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>
12890 !! end
12892 !! test
12893 Allow empty links in image captions (Bug 60753)
12894 !! options
12895 thumbsize=220
12896 !! wikitext
12897 [[File:Foobar.jpg|thumb|Caption [[Link1]]
12898 [[]]
12899 [[Link2]]
12901 !! html/php
12902 <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>
12904 !! html/parsoid
12905 <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>
12906 [[]]
12907 <a rel="mw:WikiLink" href="./Link2" title="Link2" data-parsoid='{"stx":"simple","a":{"href":"./Link2"},"sa":{"href":"Link2"}}'>Link2</a>
12908 </figcaption></figure>
12909 !! end
12911 !! test
12912 Titles in unlinked images (T23454)
12913 !! wikitext
12914 [[File:Foobar.jpg|link=|stuff]]
12915 !! html/php
12916 <p><img alt="stuff" src="http://example.com/images/3/3a/Foobar.jpg" title="stuff" width="1941" height="220" />
12917 </p>
12918 !! end
12920 !! test
12921 Link with empty target
12922 !! wikitext
12923 [[]]
12924 !! html
12925 <p>[[]]
12926 </p>
12927 !! end
12929 !! test
12930 Image with link trail
12931 !! wikitext
12932 Linktrails should not work for images: [[File:Foobar.jpg]]s
12933 !! html/php
12934 <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
12935 </p>
12936 !! html/parsoid
12937 <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>
12938 !! end
12940 !! test
12941 Image with empty attribute
12942 !! options
12943 parsoid=wt2html,wt2wt,html2html
12944 !! wikitext
12945 [[File:Foobar.jpg|right||Caption text]]
12946 !! html/php
12947 <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>
12949 !! html/parsoid
12950 <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>
12951 !! end
12953 !! test
12954 1. Block image with individual attributes from templates
12955 !! wikitext
12956 [[File:Foobar.jpg|thumb|{{echo|137px}}|This is a caption]]
12957 !! html/php
12958 <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>
12960 !! html/parsoid
12961 <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>
12962 !! end
12964 !! test
12965 2. Block Image with individual attributes from templates
12966 !! wikitext
12967 [[File:Foobar.jpg|{{echo|thumb}}|{{echo|137px}}|This is a caption]]
12968 !! html/php
12969 <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>
12971 !! html/parsoid
12972 <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>
12973 !! end
12975 !! test
12976 3. Inline image with individual attributes from templates
12977 !! wikitext
12978 [[File:Foobar.jpg|{{echo|50px}}]]
12979 !! html/php
12980 <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>
12981 </p>
12982 !! html/parsoid
12983 <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>
12984 !! end
12986 ## Parsoid does not provide editing support for images where templates produce multiple image attributes.
12987 ## To signal this, we add a 'mw:Placeholder' type to such images. This could change in the future.
12988 !! test
12989 Image with multiple attributes from the same template
12990 !! wikitext
12991 [[File:Foobar.jpg|{{image_attribs}}]]
12992 !! html/php
12993 <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>
12995 !! html/parsoid
12996 <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>
12997 !! end
12999 !! test
13000 Image with link tails
13001 !! options
13002 thumbsize=220
13003 !! wikitext
13004 123[[File:Foobar.jpg]]456
13005 123[[File:Foobar.jpg|right]]456
13006 123[[File:Foobar.jpg|thumb]]456
13007 !! html/php
13008 <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
13009 </p>
13010 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
13011 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
13013 !! html/php+tidy
13014 <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>
13015 <p>123</p>
13016 <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>
13017 <p>456 123</p>
13018 <div class="thumb tright">
13019 <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>
13020 <div class="thumbcaption">
13021 <div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>
13022 </div>
13023 </div>
13024 </div>
13025 <p>456</p>
13026 !! html/parsoid
13027 <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>
13028 <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>
13029 <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>
13030 !! end
13032 !! test
13033 Image with multiple captions -- only last one is accepted
13034 !! wikitext
13035 [[File:Foobar.jpg|right|Caption1 - ignored|[[Caption2]] - ignored|Caption3 - accepted]]
13036 !! html/php
13037 <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>
13039 !! html/parsoid
13040 <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>
13041 !! end
13043 !! test
13044 Image with multiple widths -- use last
13045 !! wikitext
13046 [[File:Foobar.jpg|200px|300px|caption]]
13047 !! html/php
13048 <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>
13049 </p>
13050 !! html/parsoid
13051 <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>
13052 !! end
13054 !! test
13055 Image with multiple alignments -- use first (bug 48664)
13056 !! options
13057 thumbsize=220
13058 !! wikitext
13059 [[File:Foobar.jpg|thumb|left|right|center|caption]]
13061 [[File:Foobar.jpg|middle|text-top|caption]]
13062 !! html/php
13063 <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>
13064 <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>
13065 </p>
13066 !! html/parsoid
13067 <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>
13068 <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>
13069 !! end
13071 !! test
13072 Image with width attribute at different positions
13073 !! wikitext
13074 [[File:Foobar.jpg|200px|right|Caption]]
13075 [[File:Foobar.jpg|right|200px|Caption]]
13076 [[File:Foobar.jpg|right|Caption|200px]]
13077 !! html/php
13078 <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>
13079 <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>
13080 <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>
13082 !! html/parsoid
13083 <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>
13084 <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>
13085 <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>
13086 !! end
13088 # a sad bit of backward-compatibility
13089 !! test
13090 Image with size specified with pxpx (bug 13500, 51628)
13091 !! options
13092 parsoid=wt2html,wt2wt,html2html
13093 !! wikitext
13094 [[File:Foobar.jpg|20pxpx]]
13095 [[File:Foobar.jpg|200x20pxpx]]
13096 !! html/php
13097 <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>
13098 <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>
13099 </p>
13100 !! html/parsoid
13101 <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>
13102 !! end
13104 !! test
13105 Image with link parameter, wiki target
13106 !! wikitext
13107 [[File:Foobar.jpg|link=Main Page]]
13108 !! html/php
13109 <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>
13110 </p>
13111 !! html/parsoid
13112 <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>
13113 !! end
13115 # parsoid bug 49293 (part 1)
13116 !! test
13117 Image with link parameter, URL target
13118 !! wikitext
13119 [[File:Foobar.jpg|link=http://example.com/]]
13120 !! html/php
13121 <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>
13122 </p>
13123 !! html/parsoid
13124 <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>
13125 !! end
13127 # parsoid bug 49293 (part 2)
13128 !! test
13129 Image with link parameter, protocol-less URL target
13130 !! wikitext
13131 [[File:Foobar.jpg|link=//example.com/]]
13132 !! html/php
13133 <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>
13134 </p>
13135 !! html/parsoid
13136 <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>
13137 !! end
13139 !! test
13140 Escaping non-block captions (T107435)
13141 !! options
13142 parsoid={
13143   "modes": ["wt2wt"],
13144   "changes": [
13145     ["[typeof~='mw:Image']", "attr", "data-mw", "{\"caption\": \"|\"}"]
13146   ]
13148 !! wikitext
13149 [[Image:Foobar.jpg|caption]]
13150 !! wikitext/edited
13151 [[Image:Foobar.jpg|<nowiki>|</nowiki>]]
13152 !! end
13154 # wgExternalLinkTarget not supported by Parsoid
13155 !! test
13156 Image with link parameter, wgExternalLinkTarget
13157 !! wikitext
13158 [[Image:foobar.jpg|link=http://example.com/]]
13159 !! config
13160 wgExternalLinkTarget='foobar'
13161 !! html/php
13162 <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>
13163 </p>
13164 !! end
13166 !! test
13167 Image with link parameter, wgNoFollowLinks set to false
13168 !! wikitext
13169 [[Image:foobar.jpg|link=http://example.com/]]
13170 !! config
13171 wgNoFollowLinks=false
13172 !! html
13173 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
13174 </p>
13175 !! end
13177 !! test
13178 Image with link parameter, wgNoFollowDomainExceptions
13179 !! wikitext
13180 [[Image:foobar.jpg|link=http://example.com/]]
13181 !! config
13182 wgNoFollowDomainExceptions='example.com'
13183 !! html
13184 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
13185 </p>
13186 !! end
13188 # wgExternalLinkTarget not supported by Parsoid
13189 !! test
13190 Image with link parameter, wgExternalLinkTarget, unnamed parameter
13191 !! wikitext
13192 [[Image:foobar.jpg|link=http://example.com/|Title]]
13193 !! config
13194 wgExternalLinkTarget='foobar'
13195 !! html/php
13196 <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>
13197 </p>
13198 !! end
13200 !! test
13201 Image with empty link parameter
13202 !! wikitext
13203 [[File:Foobar.jpg|link=]]
13204 !! html/php
13205 <p><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" />
13206 </p>
13207 !! html/parsoid
13208 <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>
13209 !! end
13211 !! test
13212 Image with link parameter (wiki target) and unnamed parameter
13213 !! wikitext
13214 [[File:Foobar.jpg|link=Main_Page|Title]]
13215 !! html/php
13216 <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>
13217 </p>
13218 !! html/parsoid
13219 <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>
13220 !! end
13222 !! test
13223 Image with link parameter (URL target) and unnamed parameter
13224 !! wikitext
13225 [[File:Foobar.jpg|link=http://example.com/|Title]]
13226 !! html/php
13227 <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>
13228 </p>
13229 !! html/parsoid
13230 <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>
13231 !! end
13233 !! test
13234 Thumbnail image with link parameter
13235 !! options
13236 thumbsize=220
13237 parsoid=wt2html,wt2wt,html2html
13238 !! wikitext
13239 [[File:Foobar.jpg|thumb|link=http://example.com/|Title]]
13240 !! html/php
13241 <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>
13243 !! html/parsoid
13244 <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>
13245 !! end
13247 !! test
13248 Manually-specified thumbnail image
13249 !! options
13250 thumbsize=220
13251 !! wikitext
13252 [[File:Foobar.jpg|thumb=Thumb.png|Title]]
13253 !! html/php
13254 <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>
13256 !! html/parsoid
13257 <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>
13258 !! end
13260 !! test
13261 Manually-specified thumbnail image with explicit link to wiki page
13262 !! options
13263 thumbsize=220
13264 parsoid=wt2html,wt2wt,html2html
13265 !! wikitext
13266 [[File:Foobar.jpg|thumb=Thumb.png|link=Main_Page|Title]]
13267 !! html/php
13268 <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>
13270 !! html/parsoid
13271 <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>
13272 !! end
13274 !! test
13275 Manually-specified thumbnail image with explicit link to url
13276 !! options
13277 thumbsize=220
13278 parsoid=wt2html,wt2wt,html2html
13279 !! wikitext
13280 [[File:Foobar.jpg|thumb=Thumb.png|link=http://example.com|Title]]
13281 !! html/php
13282 <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>
13284 !! html/parsoid
13285 <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>
13286 !! end
13288 !! test
13289 Manually-specified thumbnail image with explicit no link
13290 !! options
13291 thumbsize=220
13292 parsoid=wt2html,wt2wt,html2html
13293 !! wikitext
13294 [[File:Foobar.jpg|thumb=Thumb.png|link=|Title]]
13295 !! html/php
13296 <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>
13298 !! html/parsoid
13299 <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>
13300 !! end
13302 !! test
13303 Manually-specified thumbnail image with explicit link and alt text
13304 !! options
13305 thumbsize=220
13306 parsoid=wt2html,wt2wt,html2html
13307 !! wikitext
13308 [[File:Foobar.jpg|thumb=Thumb.png|link=Main_Page|alt=alttext|Title]]
13309 !! html/php
13310 <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>
13312 !! html/parsoid
13313 <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>
13314 !! end
13316 !! test
13317 Image with frame and link
13318 !! options
13319 parsoid=wt2html,wt2wt,html2html
13320 !! wikitext
13321 [[File:Foobar.jpg|frame|left|This is a test image [[Main Page]]]]
13322 !! html/php
13323 <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>
13325 !! html/parsoid
13326 <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>
13327 !! end
13329 !! test
13330 Image with frame and link and explicit alt
13331 !! options
13332 parsoid=wt2html,wt2wt,html2html
13333 !! wikitext
13334 [[Image:Foobar.jpg|frame|left|This is a test image [[Main Page]]|alt=Altitude]]
13335 !! html/php
13336 <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>
13338 !! html/parsoid
13339 <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>
13340 !! end
13342 !! test
13343 Image with wiki markup in implicit alt
13344 !! wikitext
13345 [[Image:Foobar.jpg|testing '''bold''' in alt]]
13347 [[Image:Foobar.jpg|alt=testing '''bold''' in alt]]
13348 !! html/php
13349 <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>
13350 </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>
13351 </p>
13352 !! html/parsoid
13353 <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>
13355 <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>
13356 !! end
13358 !! test
13359 Alt image option should handle most kinds of wikitext without barfing
13360 !! wikitext
13361 [[Image:Foobar.jpg|thumb|This is the image caption|alt=This is a [[link]] and a {{echo|''bold template''}}.]]
13362 !! html/php
13363 <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>
13365 !! html/parsoid
13366 <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>
13367 !! end
13369 ###################
13370 # Conflicting image format options.
13371 # First option specified should 'win'.
13372 # All three cases in each test should be identical.
13374 !! test
13375 Image with 'frameless' first.
13376 !! options
13377 parsoid=wt2html,wt2wt,html2html
13378 !! wikitext
13379 [[File:Foobar.jpg|frameless|caption]]
13381 [[File:Foobar.jpg|frameless|frame|caption]]
13383 [[File:Foobar.jpg|frameless|thumb|caption]]
13384 !! html/php
13385 <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>
13386 </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>
13387 </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>
13388 </p>
13389 !! html/parsoid
13390 <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>
13391 <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>
13392 <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>
13393 !! end
13395 !! test
13396 Image with 'frame' first.
13397 !! options
13398 parsoid=wt2html,wt2wt,html2html
13399 !! wikitext
13400 [[File:Foobar.jpg|frame|caption]]
13401 [[File:Foobar.jpg|frame|frameless|caption]]
13402 [[File:Foobar.jpg|frame|thumb|caption]]
13403 !! html/php
13404 <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>
13405 <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>
13406 <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>
13408 !! html/parsoid
13409 <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>
13410 <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>
13411 <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>
13412 !! end
13414 !! test
13415 Image with 'thumb' first.
13416 !! options
13417 parsoid=wt2html,wt2wt,html2html
13418 !! wikitext
13419 [[File:Foobar.jpg|thumb|caption]]
13420 [[File:Foobar.jpg|thumb|frameless|caption]]
13421 [[File:Foobar.jpg|thumb|frame|caption]]
13422 !! html/php
13423 <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>
13424 <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>
13425 <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>
13427 !! html/parsoid
13428 <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>
13429 <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>
13430 <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>
13431 !! end
13433 ###################
13434 # Image sizing.
13435 # See https://www.mediawiki.org/wiki/Help:Images#Size_and_frame
13436 # and https://phabricator.wikimedia.org/T64258
13437 # Foobar has actual size of 1941x220
13438 # 1. Thumbs & frameless always reduce, can't be enlarged unless it's
13439 #    a scalable format.
13440 # 2. Framed images always ignore size options; always render at default size.
13441 # 3. "Unspecified format" and border are the only types which can be
13442 #    enlarged.
13444 !! test
13445 Image: "unspecified format" and border enlarge
13446 !! options
13447 parsoid=wt2html,wt2wt,html2html
13448 !! wikitext
13449 [[File:Foobar.jpg|2000px]]
13451 [[File:Foobar.jpg|border|2000px]]
13452 !! html/php
13453 <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>
13454 </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>
13455 </p>
13456 !! html/parsoid
13457 <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>
13458 <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>
13459 !! end
13461 !! test
13462 Image: "unspecified format" and border reduce
13463 !! options
13464 parsoid=wt2html,wt2wt,html2html
13465 !! wikitext
13466 [[File:Foobar.jpg|1000px]]
13468 [[File:Foobar.jpg|border|1000px]]
13469 !! html/php
13470 <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>
13471 </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>
13472 </p>
13473 !! html/parsoid
13474 <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>
13475 <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>
13476 !! end
13478 !! test
13479 Image: thumbs reduce
13480 !! options
13481 parsoid=wt2html,wt2wt,html2html
13482 !! wikitext
13483 [[File:Foobar.jpg|thumb|50px]]
13484 !! html/php
13485 <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>
13487 !! html/parsoid
13488 <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>
13489 !! end
13491 !! test
13492 Image: bitmap thumbs can't be enlarged past original size, but vector can.
13493 !! options
13494 parsoid=wt2html,wt2wt,html2html
13495 !! wikitext
13496 [[File:Foobar.jpg|thumb|2000px]]
13498 [[File:Foobar.svg|thumb|2000px]]
13499 !! html/php
13500 <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>
13501 <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>
13503 !! html/parsoid
13504 <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>
13505 <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>
13506 !! end
13508 !! test
13509 Image: frameless can reduce in size
13510 !! options
13511 parsoid=wt2html,wt2wt,html2html
13512 !! wikitext
13513 [[File:Foobar.jpg|frameless|50px]]
13514 !! html/php
13515 <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>
13516 </p>
13517 !! html/parsoid
13518 <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>
13519 !! end
13521 !! test
13522 Image: bitmap frameless can't be enlarged past original size, but vector can
13523 !! options
13524 parsoid=wt2html,wt2wt,html2html
13525 !! wikitext
13526 [[File:Foobar.jpg|frameless|2000px]]
13528 [[File:Foobar.svg|frameless|2000px]]
13529 !! html/php
13530 <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>
13531 </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>
13532 </p>
13533 !! html/parsoid
13534 <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>
13535 <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>
13536 !! end
13538 !! test
13539 Image: framed images are always unscaled.
13540 !! options
13541 parsoid=wt2html,wt2wt,html2html
13542 !! wikitext
13543 [[File:Foobar.jpg|frame]]
13545 [[File:Foobar.jpg|frame|50px]]
13547 [[File:Foobar.jpg|frame|50x50px]]
13549 [[File:Foobar.jpg|frame|2000px]]
13550 !! html/php
13551 <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>
13552 <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>
13553 <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>
13554 <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>
13556 !! html/parsoid
13557 <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>
13558 <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>
13559 <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>
13560 <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>
13561 !! end
13563 ###################
13565 !! test
13566 Link to image page- image page normally doesn't exists, hence edit link
13567 Add test with existing image page
13568 #<p><a href="/wiki/File:Test" title="Image:Test">Image:test</a>
13569 !! wikitext
13570 [[:Image:test]]
13571 !! html
13572 <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>
13573 </p>
13574 !! end
13576 !! test
13577 bug 18784  Link to non-existent image page with caption should use caption as link text
13578 !! wikitext
13579 [[:Image:test|caption]]
13580 !! html
13581 <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>
13582 </p>
13583 !! end
13585 !! test
13586 Frameless image caption with a free URL
13587 !! wikitext
13588 [[File:Foobar.jpg|http://example.com]]
13589 !! html/php
13590 <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>
13591 </p>
13592 !! html/parsoid
13593 <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>
13594 !! end
13596 !! test
13597 Thumbnail image caption with a free URL
13598 !! options
13599 thumbsize=220
13600 !! wikitext
13601 [[File:Foobar.jpg|thumb|http://example.com]]
13602 !! html/php
13603 <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>
13605 !! html/parsoid
13606 <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>
13607 !! end
13609 !! test
13610 Thumbnail image caption with a free URL and explicit alt
13611 !! options
13612 thumbsize=220
13613 parsoid=wt2html,wt2wt,html2html
13614 !! wikitext
13615 [[File:Foobar.jpg|thumb|http://example.com|alt=Alteration]]
13616 !! html/php
13617 <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>
13619 !! html/parsoid
13620 <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>
13621 !! end
13623 !! test
13624 SVG thumbnails with no language set
13625 !! options
13626 !! wikitext
13627 [[File:Foobar.svg|thumb|caption]]
13628 !! html/php
13629 <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>
13631 !! html/parsoid
13632 <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>
13633 !! end
13635 !! test
13636 SVG thumbnails with language de
13637 !! options
13638 parsoid=wt2html,wt2wt,html2html
13639 !! wikitext
13640 [[File:Foobar.svg|thumb|caption|lang=de]]
13641 !! html/php
13642 <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>
13644 !! html/parsoid
13645 <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>
13646 !! end
13648 !! test
13649 SVG thumbnails with invalid language code
13650 !! options
13651 parsoid=wt2html,wt2wt,html2html
13652 !! wikitext
13653 [[File:Foobar.svg|thumb|caption|lang=invalid.language.code]]
13654 !! html/php
13655 <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>
13657 !! html/parsoid
13658 <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>
13659 !! end
13661 !! test
13662 BUG 1887: A ISBN with a thumbnail
13663 !! wikitext
13664 [[File:Foobar.jpg|thumb|ISBN 1235467890]]
13665 !! html/php
13666 <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>
13668 !! html/parsoid
13669 <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>
13670 !! end
13672 !! test
13673 BUG 1887: A RFC with a thumbnail
13674 !! wikitext
13675 [[File:Foobar.jpg|thumb|This is RFC 12354]]
13676 !! html/php
13677 <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>
13679 !! html/parsoid
13680 <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>
13681 !! end
13683 !! test
13684 BUG 1887: A mailto link with a thumbnail
13685 !! wikitext
13686 [[File:Foobar.jpg|thumb|Please mailto:nobody@example.com]]
13687 !! html/php
13688 <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>
13690 !! html/parsoid
13691 <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>
13692 !! end
13694 # Pending resolution to bug 368
13695 !! test
13696 BUG 648: Frameless image caption with a link
13697 !! wikitext
13698 [[File:Foobar.jpg|text with a [[link]] in it]]
13699 !! html/php
13700 <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>
13701 </p>
13702 !! html/parsoid
13703 <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>
13704 !! end
13706 !! test
13707 BUG 648: Frameless image caption with a link (suffix)
13708 !! wikitext
13709 [[File:Foobar.jpg|text with a [[link]]foo in it]]
13710 !! html/php
13711 <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>
13712 </p>
13713 !! html/parsoid
13714 <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>
13715 !! end
13717 !! test
13718 BUG 648: Frameless image caption with an interwiki link
13719 !! wikitext
13720 [[File:Foobar.jpg|text with a [[MeatBall:Link]] in it]]
13721 !! html/php
13722 <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>
13723 </p>
13724 !! html/parsoid
13725 <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>
13726 !! end
13728 !! test
13729 BUG 648: Frameless image caption with a piped interwiki link
13730 !! wikitext
13731 [[File:Foobar.jpg|text with a [[MeatBall:Link|link]] in it]]
13732 !! html/php
13733 <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>
13734 </p>
13735 !! html/parsoid
13736 <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>
13737 !! end
13739 !! test
13740 T107474: Frameless image caption with <nowiki>
13741 !! wikitext
13742 [[File:Foobar.jpg|<nowiki>text with a [[MeatBall:Link|link]] in it</nowiki>]]
13743 !! html/parsoid
13744 <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>
13745 !! end
13747 !! test
13748 Escape HTML special chars in image alt text
13749 !! wikitext
13750 [[File:Foobar.jpg|& < > "]]
13751 !! html/php
13752 <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>
13753 </p>
13754 !! html/parsoid
13755 <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>
13756 !! end
13758 !! test
13759 BUG 499: Alt text should have &#1234;, not &amp;1234;
13760 !! wikitext
13761 [[File:Foobar.jpg|&#9792;]]
13762 !! html/php
13763 <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>
13764 </p>
13765 !! html/parsoid
13766 <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>
13767 !! end
13769 !! test
13770 Broken image caption with link
13771 !! options
13772 parsoid=wt2html,wt2wt,html2html
13773 !! wikitext
13774 [[Image:Foobar.jpg|thumb|This is a broken caption. But [[Main Page|this]] is just an ordinary link.
13775 !! html/php
13776 <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.
13777 </p>
13778 !! html/parsoid
13779 <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>
13780 !! end
13782 !! test
13783 Image caption containing another image
13784 !! wikitext
13785 [[File:Foobar.jpg|thumb|This is a caption with another [[File:Thumb.png|image]] inside it!]]
13786 !! html/php
13787 <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>
13789 !! html/parsoid
13790 <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>
13791 !! end
13793 !! test
13794 Image: caption containing a newline
13795 !! wikitext
13796 [[File:Foobar.jpg|This
13797 *is some text]]
13798 !! html/php
13799 <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>
13800 </p>
13801 !! html/parsoid
13802 <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>
13803 !!end
13805 !!test
13806 Image: caption containing leading space
13807 (The leading space should not trigger nowiki escaping in wt2wt mode)
13808 !! wikitext
13809 [[File:Foobar.jpg|thumb| bar]]
13810 !! html/php
13811 <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>
13813 !! html/parsoid
13814 <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>
13815 !!end
13817 !! test
13818 Image: caption containing a table
13819 !! options
13820 parsoid=wt2html,wt2wt,html2html
13821 !! wikitext
13822 [[Image:Foobar.jpg|thumb|200px|This is an example image thumbnail caption with a table
13824 ! Foo !! Bar
13826 | Foo1 || Bar1
13828 and some more text.]]
13829 !! html/php
13830 <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>
13832 !! html/parsoid
13833 <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
13834 <table>
13835 <tbody>
13836 <tr><th>Foo </th><th>Bar</th></tr>
13837 <tr>
13838 <td>Foo1 </td>
13839 <td>Bar1</td></tr></tbody></table>and some more text.</figcaption></figure>
13840 !! end
13842 !! test
13843 Bug 3090: External links other than http: in image captions
13844 !! wikitext
13845 [[File:Foobar.jpg|thumb|200x200px|This caption has [irc://example.net irc] and [https://example.com Secure] ext links in it.]]
13846 !! html/php
13847 <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>
13849 !! html/parsoid
13850 <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>
13851 !! end
13853 !! test
13854 Custom class
13855 !! options
13856 parsoid=wt2html,wt2wt,html2html
13857 !! wikitext
13858 [[Image:foobar.jpg|a|class=b]]
13859 !! html/php
13860 <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>
13861 </p>
13862 !! html/parsoid
13863 <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>
13864 !! end
13866 !! test
13867 Localized image handling (1).
13868 !! options
13869 parsoid=wt2html,wt2wt,html2html
13870 language=es
13871 !! wikitext
13872 [[Archivo:Foobar.jpg|izquierda|enlace=foo|caption]]
13873 !! html/php
13874 <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>
13876 !! html/parsoid
13877 <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>
13878 !! end
13880 !! test
13881 Localized image handling (2).
13882 !! options
13883 thumbsize=220
13884 parsoid=wt2html,wt2wt,html2html
13885 language=es
13886 !! wikitext
13887 [[Archivo:Foobar.jpg|miniatura|izquierda|enlace=foo|caption]]
13888 !! html/php
13889 <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>
13891 !! html/parsoid
13892 <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>
13893 !! end
13895 !! test
13896 Localized image handling (3).
13897 !! options
13898 language=fa
13899 parsoid=html2wt
13900 !! html/parsoid
13901 <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>
13902 !! wikitext
13903 [[File:Foobar.jpg|بندانگشتی]]
13904 !! end
13906 !! test
13907 "border", "frameless" and "class" attributes on an image.
13908 !! options
13909 thumbsize=220
13910 parsoid=wt2html,wt2wt,html2html
13911 !! wikitext
13912 [[File:Foobar.jpg|frameless|border|class=extra|caption]]
13913 !! html/php
13914 <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>
13915 </p>
13916 !! html/parsoid
13917 <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>
13918 !! end
13920 # Note that 'right' is the default alignment, despite the misspelled 'righ' below
13921 !! test
13922 Invalid image attributes (bug 62500)
13923 !! options
13924 thumbsize=220
13925 parsoid=wt2html,wt2wt,html2html
13926 !! wikitext
13927 [[File:Foobar.jpg|thumb|float|left|caption]]
13929 [[File:Foobar.jpg|thumb|righ|caption]]
13931 [[File:Foobar.jpg|bogus1|thumb|bogus2|left|bogus3|caption]]
13932 !! html/php
13933 <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>
13934 <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>
13935 <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>
13937 !! html/parsoid
13938 <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>
13939 <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>
13940 <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>
13941 !! end
13943 !! article
13944 File:Barfoo.jpg
13945 !! text
13946 #REDIRECT [[File:Barfoo.jpg]]
13947 !! endarticle
13949 # FIXME: Parsoid should run this test -- but we'd need to teach the
13950 # mockAPI about the redirected Barfoo.jpg image.
13951 !! test
13952 Redirected image
13953 !! wikitext
13954 [[Image:Barfoo.jpg]]
13955 !! html/php
13956 <p><a href="/wiki/File:Barfoo.jpg" title="File:Barfoo.jpg" class="mw-redirect">File:Barfoo.jpg</a>
13957 </p>
13958 !! end
13960 !! test
13961 Missing image with uploads disabled
13962 !! options
13963 wgEnableUploads=0
13964 !! wikitext
13965 [[File:Foobaz.jpg]]
13966 !! html/php
13967 <p><a href="/wiki/File:Foobaz.jpg" title="File:Foobaz.jpg">File:Foobaz.jpg</a>
13968 </p>
13969 !! html/parsoid
13970 <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>
13971 !! end
13973 # Parsoid-specific testing for images
13974 # https://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec#Images
13975 # Currently imperfect due to a flaw in the Parsoid testrunner
13976 # Work in progress
13977 # THESE TESTS SHOULD BE MOVED UP and merged with the php-specific
13978 # image tests.
13980 !! test
13981 Parsoid-specific image handling - simple image with size and middle alignment
13982 !! wikitext
13983 [[File:Foobar.jpg|middle|50px]]
13984 !! html/parsoid
13985 <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>
13986 !! end
13988 !! test
13989 Parsoid-specific image handling - simple image with size, middle alignment,
13990 non-standard namespace alias
13991 !! options
13992 parsoid=wt2wt,wt2html,html2html
13993 !! wikitext
13994 [[Image:Foobar.jpg|middle|50px]]
13995 !! html/parsoid
13996 <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>
13997 !! end
13999 !! test
14000 Parsoid-specific image handling - simple image with size and middle alignment
14001 (existing content)
14002 !! wikitext
14003 [[File:Foobar.jpg|50px|middle]]
14004 !! html/parsoid
14005 <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>
14006 !! end
14008 !! test
14009 Parsoid-specific image handling - simple image with size and middle alignment
14010 and non-standard namespace name
14011 !! options
14012 parsoid=wt2html,wt2wt,html2html
14013 !! wikitext
14014 [[Image:Foobar.jpg|50px|middle]]
14015 !! html/parsoid
14016 <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>
14017 !! end
14019 !! test
14020 Parsoid-specific image handling - simple image with both sizes, a baseline alignment, and a caption
14021 !! wikitext
14022 [[File:Foobar.jpg|500x10px|baseline|caption]]
14023 !! html/parsoid
14024 <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>
14025 !! end
14027 !! test
14028 Parsoid-specific image handling - simple image with border and size spec
14029 !! wikitext
14030 [[File:Foobar.jpg|50px|border|caption]]
14031 !! html/parsoid
14032 <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>
14033 !! end
14035 !! test
14036 Parsoid-specific image handling - thumbnail with halign, valign, and caption
14037 !! wikitext
14038 [[File:Foobar.jpg|left|baseline|thumb|caption content]]
14039 !! html/parsoid
14040 <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>
14041 !! end
14043 !! test
14044 Parsoid-specific image handling - thumbnail with halign, valign, and caption
14045 (existing content)
14046 !! wikitext
14047 [[File:Foobar.jpg|thumb|left|baseline|caption content]]
14048 !! html/parsoid
14049 <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>
14050 !! end
14052 !! test
14053 Parsoid-specific image handling - thumbnail with specific size, halign, valign, and caption
14054 !! wikitext
14055 [[Image:Foobar.jpg|right|middle|thumb|50x50px|caption]]
14056 !! html/parsoid
14057 <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>
14058 !! end
14060 !! test
14061 Parsoid-specific image handling - thumbnail with specific size, halign,
14062 valign, and caption (existing content)
14063 !! wikitext
14064 [[File:Foobar.jpg|thumb|50x50px|right|middle|caption]]
14065 !! html/parsoid
14066 <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>
14067 !! end
14069 !! test
14070 Parsoid-specific image handling - framed image with specific size and caption
14071 (size is ignored)
14072 !! options
14073 parsoid=wt2html,wt2wt,html2html
14074 !! wikitext
14075 [[File:Foobar.jpg|frame|500x50px|caption]]
14076 !! html/parsoid
14077 <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>
14078 !! end
14080 !! test
14081 Parsoid-specific image handling - framed image with specific size, halign, valign, and caption
14082 (size is ignored)
14083 !! options
14084 parsoid=wt2html,wt2wt,html2html
14085 !! wikitext
14086 [[File:Foobar.jpg|left|baseline|frame|500x50px|caption]]
14087 !! html/parsoid
14088 <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>
14089 !! end
14091 !! test
14092 Parsoid-specific image handling - frameless image with specific size, border, and caption
14093 !! wikitext
14094 [[File:Foobar.jpg|frameless|442x50px|border|caption]]
14095 !! html/parsoid
14096 <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>
14097 !! end
14099 !! test
14100 Parsoid-specific image handling - simple image with a formatted caption
14101 !! wikitext
14102 [[File:Foobar.jpg|<table><tr><td>a</td><td>b</td></tr><tr><td>c</td></tr></table>]]
14103 !! html/parsoid
14104 <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>
14105 !! end
14107 !! test
14108 Parsoid-specific image handling - caption with a template in it
14109 !! wikitext
14110 [[File:Foobar.jpg|thumb|200x23px|This caption has a {{echo|transclusion}} in it.]]
14111 !! html/parsoid
14112 <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>
14113 !! end
14115 !! test
14116 Parsoid-specific image handling - caption with unbalanced tags in it
14117 !! options
14118 parsoid=wt2html,wt2wt,html2html
14119 !! wikitext
14121 [[File:Foobar.jpg|thumb|200x200px|This caption has a <center>unbalanced tag in it.]]
14123 !! html/parsoid
14124 <p>foo</p>
14125 <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>
14126 <p>bar</p>
14127 !! end
14129 !! test
14130 Parsoid-specific image handling - empty caption (1)
14131 !! options
14132 parsoid=wt2html,wt2wt
14133 !! wikitext
14134 [[File:Foobar.jpg|thumb|]]
14135 !! html/parsoid
14136 <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>
14137 !! end
14139 # empty captions don't get serialized unless we're in the "round trip" case
14140 !! test
14141 Parsoid-specific image handling - empty caption (2)
14142 !! options
14143 parsoid=html2wt
14144 !! html/parsoid
14145 <figure class="mw-default-size" typeof="mw:Image/Thumb">
14146   <a href="./File:Foobar.jpg">
14147     <img resource="./File:Foobar.jpg"
14148          src="//example.com/images/3/3a/Foobar.jpg"
14149          data-file-width="1941" data-file-height="220" data-file-type="bitmap"
14150          height="25" width="220"/>
14151   </a>
14152   <figcaption></figcaption>
14153 </figure>
14154 !! wikitext
14155 [[File:Foobar.jpg|thumb]]
14156 !! end
14158 !! test
14159 Parsoid-specific image handling - whitespace caption
14160 !! wikitext
14161 [[File:Foobar.jpg|thumb| ]]
14162 !! html/parsoid
14163 <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>
14164 !! end
14166 !! test
14167 Parsoid-specific image handling - lang option
14168 !! wikitext
14170 [[File:Foobar.svg|lang=de|caption]]
14172 !! html/parsoid
14173 <p>foo
14174 <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>
14175 bar</p>
14176 !! end
14178 ## Edge case bugs in Parsoid from T93580
14179 !! test
14180 T93580: 1. Templated <ref> inside block images
14181 !! wikitext
14182 [[File:Foobar.jpg|thumb|Caption with templated ref: {{echo|<ref>foo</ref>}}]]
14184 <references />
14185 !! html/parsoid
14186 <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>
14188 <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>
14189 !! end
14191 !! test
14192 T93580: 2. <ref> inside inline images
14193 !! wikitext
14194 [[File:Foobar.jpg|Undisplayed caption in inline image with ref: <ref>foo</ref>]]
14196 <references />
14197 !! html/parsoid
14198 <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>
14200 <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>
14201 !! end
14203 !! test
14204 T93580: 3. Templated <ref> inside inline images
14205 !! wikitext
14206 [[File:Foobar.jpg|Undisplayed caption in inline image with ref: {{echo|<ref>{{echo|foo}}</ref>}}]]
14208 <references />
14209 !! html/parsoid
14210 <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>
14212 <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>
14213 !! end
14216 ### Subpages
14218 !! article
14219 Subpage test/subpage
14220 !! text
14222 !! endarticle
14224 !! test
14225 Subpage link
14226 !! options
14227 subpage title=[[Subpage test]]
14228 !! wikitext
14229 [[/subpage]]
14230 !! html
14231 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a>
14232 </p>
14233 !! end
14235 !! test
14236 Subpage noslash link
14237 !! options
14238 subpage title=[[Subpage test]]
14239 !! wikitext
14240 [[/subpage/]]
14241 !! html
14242 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">subpage</a>
14243 </p>
14244 !! end
14246 !! article
14247 Subpage test/1/2/subpage
14248 !! text
14249 blah
14250 !! endarticle
14252 !! test
14253 Relative subpage noslash link
14254 !! options
14255 parsoid=wt2wt,wt2html,html2html
14256 subpage title=[[Subpage test/1/2/3/4]]
14257 !! wikitext
14258 [[../../subpage/]]
14260 [[../../subpage]]
14261 !! html/php
14262 <p><a href="/wiki/Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">subpage</a>
14263 </p><p><a href="/wiki/Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">Subpage test/1/2/subpage</a>
14264 </p>
14265 !! html/parsoid
14266 <p><a rel="mw:WikiLink" href="Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">subpage</a></p>
14267 <p><a rel="mw:WikiLink" href="Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">Subpage_test/1/2/subpage</a></p>
14268 !! end
14270 !! test
14271 Parsoid: dot-slash prefixed wikilinks
14272 !! wikitext
14273 [[./foo]]
14275 [[././bar]]
14277 [[././baz/]]
14278 !! html/php
14279 <p>[[./foo]]
14280 </p><p>[[././bar]]
14281 </p><p>[[././baz/]]
14282 </p>
14283 !! html/parsoid
14284 <p>[[./foo]]
14285 </p><p>[[././bar]]
14286 </p><p>[[././baz/]]
14287 </p>
14288 !! end
14290 !! test
14291 Render invalid page names as plain text (bug 51090)
14292 !! wikitext
14293 [[./../foo|bar]]
14294 [[foo�|bar]]
14295 [[foo/.|bar]]
14296 [[foo/..|bar]]
14297 [[foo~~~bar]]
14298 [[foo>bar]]
14299 [[foo[bar]]
14300 [[.]]
14301 [[..]]
14302 [[foo././bar]]
14304 [[{{echo|./../foo}}|bar]]
14305 [[{{echo|foo/.}}|bar]]
14306 [[{{echo|foo/..}}|bar]]
14307 [[{{echo|foo~~~~bar}}]]
14308 [[{{echo|foo>bar}}]]
14309 [[{{echo|foo././bar}}]]
14310 [[{{echo|foo{bar}}]]
14311 [[{{echo|foo}bar}}]]
14312 [[{{echo|foo[bar}}]]
14313 [[{{echo|foo]bar}}]]
14314 [[{{echo|foo<bar}}]]
14315 !!html/php
14316 <p>[[./../foo|bar]]
14317 [[foo�|bar]]
14318 [[foo/.|bar]]
14319 [[foo/..|bar]]
14320 [[foo~~~bar]]
14321 [[foo&gt;bar]]
14322 [[foo[bar]]
14323 [[.]]
14324 [[..]]
14325 [[foo././bar]]
14326 </p><p>[[./../foo|bar]]
14327 [[foo/.|bar]]
14328 [[foo/..|bar]]
14329 [[foo~~~~bar]]
14330 [[foo&gt;bar]]
14331 [[foo././bar]]
14332 [[foo{bar]]
14333 [[foo}bar]]
14334 [[foo[bar]]
14335 [[foo]bar]]
14336 [[foo&lt;bar]]
14337 </p>
14338 !!html/parsoid
14339 <p>[[./../foo|bar]]
14340 [[foo�|bar]]
14341 [[foo/.|bar]]
14342 [[foo/..|bar]]
14343 [[foo~~~bar]]
14344 [[foo>bar]]
14345 [[foo[bar]]
14346 [[.]]
14347 [[..]]
14348 [[foo././bar]]</p>
14350 <p>[[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"./../foo"}},"i":0}}]}'>./../foo</span>|bar]]
14351 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo/."}},"i":0}}]}'>foo/.</span>|bar]]
14352 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo/.."}},"i":0}}]}'>foo/..</span>|bar]]
14353 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo~~~~bar"}},"i":0}}]}'>foo~~~~bar</span>]]
14354 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo>bar"}},"i":0}}]}'>foo>bar</span>]]
14355 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo././bar"}},"i":0}}]}'>foo././bar</span>]]
14356 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo{bar"}},"i":0}}]}'>foo{bar</span>]]
14357 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo}bar"}},"i":0}}]}'>foo}bar</span>]]
14358 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo[bar"}},"i":0}}]}'>foo[bar</span>]]
14359 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo]bar"}},"i":0}}]}'>foo]bar</span>]]
14360 [[<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>
14361 !!end
14363 !! test
14364 Disabled subpages
14365 !! wikitext
14366 [[/subpage]]
14367 !! html
14368 <p><a href="/index.php?title=/subpage&amp;action=edit&amp;redlink=1" class="new" title="/subpage (page does not exist)">/subpage</a>
14369 </p>
14370 !! end
14372 !! test
14373 BUG 561: {{/Subpage}}
14374 !! options
14375 subpage title=[[Page]]
14376 !! wikitext
14377 {{/Subpage}}
14378 !! html
14379 <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>
14380 </p>
14381 !! end
14384 ### Categories
14386 !! article
14387 Category:MediaWiki User's Guide
14388 !! text
14389 blah
14390 !! endarticle
14392 !! test
14393 Link to category
14394 !! wikitext
14395 [[:Category:MediaWiki User's Guide]]
14396 !! html
14397 <p><a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">Category:MediaWiki User's Guide</a>
14398 </p>
14399 !! end
14401 !! test
14402 Simple category
14403 !! options
14405 !! wikitext
14406 [[Category:MediaWiki User's Guide]]
14407 !! html
14408 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
14409 !! end
14411 !! test
14412 PAGESINCATEGORY invalid title fatal (r33546 fix)
14413 !! wikitext
14414 {{PAGESINCATEGORY:<bogus>}}
14415 !! html
14416 <p>0
14417 </p>
14418 !! end
14420 !! test
14421 Category with different sort key
14422 !! options
14424 !! wikitext
14425 [[Category:MediaWiki User's Guide|Foo]]
14426 !! html
14427 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
14428 !! end
14430 !! test
14431 Category with identical sort key
14432 !! options
14434 !! wikitext
14435 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
14436 !! html
14437 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
14438 !! end
14440 !! test
14441 Category with empty sort key
14442 !! options
14445 !! wikitext
14446 [[Category:MediaWiki User's Guide|]]
14447 !! html/php
14448 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
14449 !! end
14451 !! test
14452 Category with empty sort key and parentheses
14453 !! options
14456 !! wikitext
14457 [[Category:Foo (bar)|]]
14458 !! html/php
14459 [[Category:Foo (bar)|Foo]]
14460 !! end
14462 ## We used to, but no longer wt2wt this test since the default serializer
14463 ## will normalize all categories to serialize on their own line.
14464 ## This wikitext usage is going to be fairly uncommon in production and
14465 ## selser will take care of preserving formatting in those scenarios.
14466 !! test
14467 Category with link tail
14468 !! options
14471 parsoid=wt2html
14472 !! wikitext
14473 123[[Category:Foo]]456
14474 !! html/php
14475 123[[Category:Foo]]456
14476 !! html/parsoid
14477 <p>123<link rel="mw:PageProp/Category" href="Category:Foo"/>456</p>
14478 !! end
14480 !! test
14481 Category with template
14482 !! options
14485 !! wikitext
14486 [[Category:{{echo|Foo}}]]
14487 !! html/php
14488 [[Category:{{echo|Foo}}]]
14489 !! end
14491 !! test
14492 Category with template in sort key
14493 !! options
14496 !! wikitext
14497 [[Category:Foo|{{echo|Bar}}]]
14498 !! html/php
14499 [[Category:Foo|{{echo|Bar}}]]
14500 !! end
14502 !! test
14503 Category with template in sort key and title
14504 !! options
14507 !! wikitext
14508 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
14509 !! html/php
14510 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
14511 !! end
14513 ## We used to, but no longer wt2wt this test since the default serializer
14514 ## will normalize all categories to serialize on their own line.
14515 ## This wikitext usage is going to be fairly uncommon in production and
14516 ## selser will take care of preserving formatting in those scenarios.
14517 !! test
14518 Category / paragraph interactions
14519 !! options
14520 parsoid=wt2html
14521 !! wikitext
14522 Foo [[Category:Baz]] Bar
14524 Foo [[Category:Baz]]
14528 [[Category:Baz]]
14532 [[Category:Baz]] Bar
14535 [[Category:Baz]]
14536  [[Category:Baz]]
14537 [[Category:Baz]]
14540 [[Category:Baz]]
14541  [[Category:Baz]]
14542 [[Category:Baz]]
14544 [[Category:Baz]]
14545  {{echo|[[Category:Baz]]}}
14546 [[Category:Baz]]
14547 !! html/php
14548 <p>Foo Bar
14549 </p><p>Foo
14551 </p><p>Foo
14553 </p><p>Foo Bar
14554 </p><p>Foo
14556 </p>
14557 !! html/parsoid
14558 <p>Foo <link rel="mw:PageProp/Category" href="Category:Baz"/> Bar</p>
14559 <p>Foo <link rel="mw:PageProp/Category" href="Category:Baz"/> Bar</p>
14560 <p>Foo <link rel="mw:PageProp/Category" href="Category:Baz"/> Bar</p>
14561 <p>Foo <link rel="mw:PageProp/Category" href="Category:Baz"/> Bar</p>
14562 <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>
14563 <link rel="mw:PageProp/Category" href="Category:Baz"/>
14564 !! end
14566 ## We used to, but no longer wt2wt this test since the default serializer
14567 ## will normalize all categories to serialize on their own line.
14568 ## This wikitext usage is going to be fairly uncommon in production and
14569 ## selser will take care of preserving formatting in those scenarios.
14571 ## The whitespace on the empty line is part of the test. Please do not delete
14572 !! test
14573 1. Categories and newlines: All preceding newlines should be suppressed (courtesy bug 87)
14574 !! options
14575 parsoid=wt2html
14576 !! wikitext
14577 This
14578    
14579 [[Category:Foo]] and this should be part of same paragraph (not an indent-pre)
14580    
14581 {{echo|[[Category:Foo]] and so should this!}}
14582 !! html/php
14583 <p>This and this should be part of same paragraph (not an indent-pre) and so should this!
14584 </p>
14585 !! html/parsoid
14586 <p>This
14587    
14588 <link rel="mw:PageProp/Category" href="./Category:Foo"/> and this should be part of same paragraph (not an indent-pre)
14589    
14590 <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>
14591 !! end
14593 ## Parsoid will not try to wt2wt this while preserving newlines because
14594 ## it suppresses excess newlines within list items -- and we don't want to
14595 ## introduce a special case just for categories, which is, in reality somewhat
14596 ## odd behavior -- categories are unlikely to be used in list items like this
14597 ## in top-level pages and are only likely to show up in template-generated
14598 ## list items where this RT-ing is a non-issue.
14600 ## The whitespace on the empty line is part of the test. Please do not delete
14601 !! test
14602 2. Categories and newlines: All preceding newlines should be suppressed (courtesy bug 87)
14603 !! options
14604 parsoid=wt2html
14605 !! wikitext
14606 * This
14607    
14608 [[Category:Foo]] and this should be part of the same list item
14609 * So should this
14611 {{echo|[[Category:Foo]] and this should be part of the same list item}}
14612 !! html
14613 <ul><li>This and this should be part of the same list item</li>
14614 <li>So should this and this should be part of the same list item</li></ul>
14615 !! html/parsoid
14616 <ul>
14617 <li>This <link rel="mw:PageProp/Category" href="./Category:Foo"/> and this should be part of the same list item</li>
14618 <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>
14619 </ul>
14620 !! end
14622 ## Newlines and categories that follow the last item of a list
14623 ## are treated differently because this (list followed by categories)
14624 ## is an extremely common pattern on wikis.
14625 !! test
14626 3. Categories and newlines: newline suppression for last list item should RT properly
14627 !! wikitext
14628 * a
14629 * b 
14630    
14631 [[Category:Foo]]
14632    
14633 [[Category:Bar]]
14634 [[Category:Baz]]
14635 !! html/parsoid
14636 <ul><li> a</li>
14637 <li> b</li></ul> 
14638    
14639 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/>
14640    
14641 <link rel="mw:PageProp/Category" href="./Category:Bar" data-parsoid='{"stx":"simple","a":{"href":"./Category:Bar"},"sa":{"href":"Category:Bar"}}'/>
14642 <link rel="mw:PageProp/Category" href="./Category:Baz" data-parsoid='{"stx":"simple","a":{"href":"./Category:Baz"},"sa":{"href":"Category:Baz"}}'/>
14643 !! end
14645 !! test
14646 4. Categories and newlines: newline suppression for last list item should RT properly
14647 !! wikitext
14648 * a
14649 **** b
14651 [[Category:Foo]]
14652 !! html/parsoid
14653 <ul><li> a
14654 <ul><li><ul><li><ul><li> b</li></ul></li></ul></li></ul></li></ul>
14656 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/>
14657 !! end
14659 ## only wt2html for this to make sure the algo only applies to the rightmost path
14660 !! test
14661 5. Categories and newlines: migrateTrailingCategories dom pass should only run on the rightmost path of nested lists
14662 !! options
14663 parsoid=wt2html
14664 !! wikitext
14665 * a
14666 ** b
14667 [[Category:Foo]]
14668 * c
14669 ** d
14670 [[Category:Foo]]
14671 !! html/parsoid
14672 <ul><li> a
14673 <ul><li> b
14674 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/></li></ul></li>
14675 <li> c
14676 <ul><li> d</li></ul></li></ul>
14677 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/>
14678 !! end
14680 ## We used to, but no longer wt2wt this test since the default serializer
14681 ## will normalize all categories to serialize on their own line.
14682 ## This wikitext usage is going to be fairly uncommon in production and
14683 ## selser will take care of preserving formatting in those scenarios.
14684 !! test
14685 6. Categories and newlines: migrateTrailingCategories dom pass should not migrate categories not preceded by newlines
14686 !! options
14687 parsoid=wt2html
14688 !! wikitext
14689 * a [[Category:Foo]]
14690 !! html/parsoid
14691 <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>
14692 !! end
14694 # This test also demonstrates because of newline+category tunneling
14695 # through the list hander, template wrapping doesn't expand to the
14696 # containing list when the list item swallows the category.
14697 !! test
14698 7. Categories and newlines: migrateTrailingCategories dom pass should leave template content alone
14699 !! wikitext
14700 * {{echo|a
14701 [[Category:Foo]]}}
14702 !! html/parsoid
14703 <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
14704 </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>
14705 !! end
14707 !! test
14708 8. Categories and newlines: migrateTrailingCategories dom pass should not get tripped by intervening templates
14709 !! wikitext
14710 * a
14712 {{echo|[[Category:Foo]]
14713 [[Category:Bar]]}}
14714 [[Category:Baz]]
14715 !! html/parsoid
14716 <ul><li> a</li></ul>
14718 <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">
14719 </span><link rel="mw:PageProp/Category" href="./Category:Bar" about="#mwt1" data-parsoid='{"stx":"simple","a":{"href":"./Category:Bar"},"sa":{"href":"Category:Bar"}}'/>
14720 <link rel="mw:PageProp/Category" href="./Category:Baz" data-parsoid='{"stx":"simple","a":{"href":"./Category:Baz"},"sa":{"href":"Category:Baz"}}'/>
14721 !! end
14723 !! test
14724 Parsoid: Serialize link to category page with colon escape
14725 !! options
14726 parsoid
14727 !! wikitext
14729 [[:Category:Foo]]
14730 [[:Category:Foo|Bar]]
14731 !! html
14733 <a rel="mw:WikiLink" href="./Category:Foo" title="Category:Foo">Category:Foo</a>
14734 <a rel="mw:WikiLink" href="./Category:Foo" title="Category:Foo">Bar</a>
14735 </p>
14736 !! end
14738 # We used to, but no longer wt2wt this test since the default serializer
14739 # will normalize all categories to serialize on their own line.
14740 # This wikitext usage is going to be fairly uncommon in production and
14741 # selser will take care of preventing whitespace insertion if this
14742 # occurs in an article.
14744 # html2html disabled for the same reason (whitespace insertion between
14745 # x and y).
14747 # html2wt disabled because it localizes the "Category" namespace.
14748 !! test
14749 Link prefix/suffixes aren't applied to category links
14750 !! options
14751 parsoid=wt2html
14752 language=is
14753 !! wikitext
14754 x[[Category:Foo]]y
14755 !! html/php
14756 <p>xy
14757 </p>
14758 !! html/parsoid
14759 <p>x<link rel="mw:PageProp/Category" href="./Flokkur:Foo" data-parsoid=""/>y</p>
14760 !! end
14762 !! test
14763 Parsoid: Serialize link to file page with colon escape
14764 !! options
14765 parsoid
14766 !! wikitext
14768 [[:File:Foo.png]]
14769 [[:File:Foo.png|Bar]]
14770 !! html
14772 <a rel="mw:WikiLink" href="./File:Foo.png" title="File:Foo.png">File:Foo.png</a>
14773 <a rel="mw:WikiLink" href="./File:Foo.png" title="File:Foo.png">Bar</a>
14774 </p>
14775 !! end
14777 !! test
14778 Parsoid: Serialize a genuine category link without colon escape
14779 !! options
14780 parsoid
14781 !! wikitext
14782 [[Category:Foo]]
14783 [[Category:Foo|Bar]]
14784 !! html
14785 <link rel="mw:PageProp/Category" href="./Category:Foo">
14786 <link rel="mw:PageProp/Category" href="./Category:Foo#Bar">
14787 !! end
14789 !! test
14790 Normalize hrefs properly before testing for invalid link targets (bug 70894)
14791 !! options
14792 parsoid=html2wt
14793 !! html/parsoid
14794 <link rel="mw:PageProp/Category" href="./Category:Toxine_bactérienne"/>
14795 !! wikitext
14796 [[Category:Toxine bactérienne]]
14797 !! end
14799 !! test
14800 Parsoid: Defaultsort
14801 !! wikitext
14802 {{DEFAULTSORT:Foo}}
14803 !! html/parsoid
14804 <meta property="mw:PageProp/categorydefaultsort" content="Foo"/>
14805 !! end
14807 !! test
14808 Parsoid: Defaultsort (template-generated)
14809 !! wikitext
14810 {{{{echo|DEFAULTSORT}}:Foo}}
14811 !! html/parsoid
14812 <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}}]}'/>
14813 !! end
14816 ### Inter-language links
14818 !! test
14819 Interlanguage links
14820 !! options
14822 !! wikitext
14823 [[es:Alimento]]
14824 [[fr:Nourriture]]
14825 [[zh:食品]]
14826 !! html/php
14827 es:Alimento fr:Nourriture zh:食品
14828 !! html/parsoid
14829 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Alimento"/>
14830 <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/Nourriture"/>
14831 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/食品"/>
14832 !! end
14834 !! test
14835 Duplicate interlanguage links (bug 24502)
14836 !! options
14838 !! wikitext
14839 [[es:1]]
14840 [[es:2]]
14841 [[fr:1]]
14842 [[fr:2]]
14843 !! html/php
14844 es:1 fr:1
14845 !! html/parsoid
14846 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/1"/>
14847 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/2"/>
14848 <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/1"/>
14849 <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/2"/>
14850 !! end
14853 ### Sections
14855 !! test
14856 Basic section headings
14857 !! wikitext
14858 == Headline 1 ==
14859 Some text
14861 ==Headline 2==
14862 More
14863 ===Smaller headline===
14864 Blah blah
14865 !! html
14866 <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>
14867 <p>Some text
14868 </p>
14869 <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>
14870 <p>More
14871 </p>
14872 <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>
14873 <p>Blah blah
14874 </p>
14875 !! end
14877 !! test
14878 Section headings with TOC
14879 !! wikitext
14880 == Headline 1 ==
14881 === Subheadline 1 ===
14882 ===== Skipping a level =====
14883 ====== Skipping a level ======
14885 == Headline 2 ==
14886 Some text
14887 ===Another headline===
14888 !! html
14889 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14890 <ul>
14891 <li class="toclevel-1 tocsection-1"><a href="#Headline_1"><span class="tocnumber">1</span> <span class="toctext">Headline 1</span></a>
14892 <ul>
14893 <li class="toclevel-2 tocsection-2"><a href="#Subheadline_1"><span class="tocnumber">1.1</span> <span class="toctext">Subheadline 1</span></a>
14894 <ul>
14895 <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>
14896 <ul>
14897 <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>
14898 </ul>
14899 </li>
14900 </ul>
14901 </li>
14902 </ul>
14903 </li>
14904 <li class="toclevel-1 tocsection-5"><a href="#Headline_2"><span class="tocnumber">2</span> <span class="toctext">Headline 2</span></a>
14905 <ul>
14906 <li class="toclevel-2 tocsection-6"><a href="#Another_headline"><span class="tocnumber">2.1</span> <span class="toctext">Another headline</span></a></li>
14907 </ul>
14908 </li>
14909 </ul>
14910 </div>
14912 <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>
14913 <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>
14914 <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>
14915 <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>
14916 <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>
14917 <p>Some text
14918 </p>
14919 <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>
14921 !! end
14923 !! test
14924 TOC anchors don't collide
14925 !! wikitext
14926 __FORCETOC__
14927 == Headline 2 ==
14928 == Headline ==
14929 == Headline 2 ==
14930 == Headline ==
14931 !! html/php
14932 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14933 <ul>
14934 <li class="toclevel-1 tocsection-1"><a href="#Headline_2"><span class="tocnumber">1</span> <span class="toctext">Headline 2</span></a></li>
14935 <li class="toclevel-1 tocsection-2"><a href="#Headline"><span class="tocnumber">2</span> <span class="toctext">Headline</span></a></li>
14936 <li class="toclevel-1 tocsection-3"><a href="#Headline_2_2"><span class="tocnumber">3</span> <span class="toctext">Headline 2</span></a></li>
14937 <li class="toclevel-1 tocsection-4"><a href="#Headline_3"><span class="tocnumber">4</span> <span class="toctext">Headline</span></a></li>
14938 </ul>
14939 </div>
14941 <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>
14942 <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>
14943 <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>
14944 <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>
14946 !! end
14948 # perl -e 'print "="x$_," Level $_ heading","="x$_,"\n" for 1..10'
14949 !! test
14950 Handling of sections up to level 6 and beyond
14951 !! wikitext
14952 = Level 1 Heading=
14953 == Level 2 Heading==
14954 === Level 3 Heading===
14955 ==== Level 4 Heading====
14956 ===== Level 5 Heading=====
14957 ====== Level 6 Heading======
14958 ======= Level 7 Heading=======
14959 ======== Level 8 Heading========
14960 ========= Level 9 Heading=========
14961 ========== Level 10 Heading==========
14962 !! html
14963 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14964 <ul>
14965 <li class="toclevel-1 tocsection-1"><a href="#Level_1_Heading"><span class="tocnumber">1</span> <span class="toctext">Level 1 Heading</span></a>
14966 <ul>
14967 <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>
14968 <ul>
14969 <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>
14970 <ul>
14971 <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>
14972 <ul>
14973 <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>
14974 <ul>
14975 <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>
14976 <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>
14977 <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>
14978 <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>
14979 <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>
14980 </ul>
14981 </li>
14982 </ul>
14983 </li>
14984 </ul>
14985 </li>
14986 </ul>
14987 </li>
14988 </ul>
14989 </li>
14990 </ul>
14991 </div>
14993 <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>
14994 <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>
14995 <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>
14996 <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>
14997 <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>
14998 <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>
14999 <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>
15000 <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>
15001 <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>
15002 <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>
15004 !! end
15006 !! test
15007 TOC regression (T11764)
15008 !! wikitext
15009 == title 1 ==
15010 === title 1.1 ===
15011 ==== title 1.1.1 ====
15012 === title 1.2 ===
15013 == title 2 ==
15014 === title 2.1 ===
15015 !! html
15016 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15017 <ul>
15018 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
15019 <ul>
15020 <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>
15021 <ul>
15022 <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>
15023 </ul>
15024 </li>
15025 <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>
15026 </ul>
15027 </li>
15028 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
15029 <ul>
15030 <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>
15031 </ul>
15032 </li>
15033 </ul>
15034 </div>
15036 <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>
15037 <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>
15038 <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>
15039 <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>
15040 <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>
15041 <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>
15043 !! end
15045 !! test
15046 TOC for heading containing <span id="..."></span> (T96153)
15047 !! wikitext
15048 __FORCETOC__
15049 ==<span id="old-anchor"></span>New title==
15050 !! html/php
15051 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15052 <ul>
15053 <li class="toclevel-1 tocsection-1"><a href="#New_title"><span class="tocnumber">1</span> <span class="toctext">New title</span></a></li>
15054 </ul>
15055 </div>
15057 <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>
15059 !! end
15061 !! test
15062 TOC with wgMaxTocLevel=3 (bug 6204)
15063 !! options
15064 wgMaxTocLevel=3
15065 !! wikitext
15066 == title 1 ==
15067 === title 1.1 ===
15068 ==== title 1.1.1 ====
15069 === title 1.2 ===
15070 == title 2 ==
15071 === title 2.1 ===
15072 !! html
15073 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15074 <ul>
15075 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
15076 <ul>
15077 <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>
15078 <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>
15079 </ul>
15080 </li>
15081 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
15082 <ul>
15083 <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>
15084 </ul>
15085 </li>
15086 </ul>
15087 </div>
15089 <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>
15090 <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>
15091 <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>
15092 <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>
15093 <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>
15094 <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>
15096 !! end
15098 !! test
15099 TOC with wgMaxTocLevel=3 and two level four headings (bug 6204)
15100 !! options
15101 wgMaxTocLevel=3
15102 !! wikitext
15103 ==Section 1==
15104 ===Section 1.1===
15105 ====Section 1.1.1====
15106 ====Section 1.1.1.1====
15107 ==Section 2==
15108 !! html
15109 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15110 <ul>
15111 <li class="toclevel-1 tocsection-1"><a href="#Section_1"><span class="tocnumber">1</span> <span class="toctext">Section 1</span></a>
15112 <ul>
15113 <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>
15114 </ul>
15115 </li>
15116 <li class="toclevel-1 tocsection-5"><a href="#Section_2"><span class="tocnumber">2</span> <span class="toctext">Section 2</span></a></li>
15117 </ul>
15118 </div>
15120 <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>
15121 <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>
15122 <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>
15123 <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>
15124 <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>
15126 !! end
15129 !! test
15130 Resolving duplicate section names
15131 !! wikitext
15132 == Foo bar ==
15133 == Foo bar ==
15134 !! html
15135 <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>
15136 <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>
15138 !! end
15140 !! test
15141 Resolving duplicate section names with differing case (bug 10721)
15142 !! wikitext
15143 == Foo bar ==
15144 == Foo Bar ==
15145 !! html
15146 <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>
15147 <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>
15149 !! end
15151 !! article
15152 Template:sections
15153 !! text
15154 ===Section 1===
15155 ==Section 2==
15156 !! endarticle
15158 !! test
15159 Template with sections, __NOTOC__
15160 !! wikitext
15161 __NOTOC__
15162 ==Section 0==
15163 {{sections}}
15164 ==Section 4==
15165 !! html
15166 <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>
15167 <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>
15168 <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>
15169 <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>
15171 !! end
15173 !! test
15174 __NOEDITSECTION__ keyword
15175 !! wikitext
15176 __NOEDITSECTION__
15177 ==Section 1==
15178 ==Section 2==
15179 !! html
15180 <h2><span class="mw-headline" id="Section_1">Section 1</span></h2>
15181 <h2><span class="mw-headline" id="Section_2">Section 2</span></h2>
15183 !! end
15185 !! test
15186 Link inside a section heading
15187 !! wikitext
15188 ==Section with a [[Main Page|link]] in it==
15189 !! html
15190 <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>
15192 !! end
15194 !! test
15195 TOC regression (T14077)
15196 !! wikitext
15197 __TOC__
15198 == title 1 ==
15199 === title 1.1 ===
15200 == title 2 ==
15201 !! html
15202 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15203 <ul>
15204 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
15205 <ul>
15206 <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>
15207 </ul>
15208 </li>
15209 <li class="toclevel-1 tocsection-3"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a></li>
15210 </ul>
15211 </div>
15213 <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>
15214 <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>
15215 <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>
15217 !! end
15219 !! test
15220 BUG 1219 URL next to image (good)
15221 !! wikitext
15222 http://example.com [[File:Foobar.jpg]]
15223 !! html/php
15224 <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>
15225 </p>
15226 !! html/parsoid
15227 <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>
15228 !!end
15230 !! test
15231 Short headings with trailing space should match behavior of Parser::doHeadings (bug 19910)
15232 !! wikitext
15233 === 
15234 The line above must have a trailing space!
15235 === <!--
15236 --> <!-- -->
15237 But just in case it doesn't...
15238 !! html
15239 <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>
15240 <p>The line above must have a trailing space!
15241 </p>
15242 <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>
15243 <p>But just in case it doesn't...
15244 </p>
15245 !! end
15247 !! test
15248 Header with special characters (bug 25462)
15249 !! wikitext
15250 The tooltips shall not show entities to the user (ie. be double escaped)
15252 == text > text ==
15253 section 1
15255 == text < text ==
15256 section 2
15258 == text & text ==
15259 section 3
15261 == text ' text ==
15262 section 4
15264 == text " text ==
15265 section 5
15266 !! html
15267 <p>The tooltips shall not show entities to the user (ie. be double escaped)
15268 </p>
15269 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15270 <ul>
15271 <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>
15272 <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>
15273 <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>
15274 <li class="toclevel-1 tocsection-4"><a href="#text_.27_text"><span class="tocnumber">4</span> <span class="toctext">text ' text</span></a></li>
15275 <li class="toclevel-1 tocsection-5"><a href="#text_.22_text"><span class="tocnumber">5</span> <span class="toctext">text " text</span></a></li>
15276 </ul>
15277 </div>
15279 <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>
15280 <p>section 1
15281 </p>
15282 <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>
15283 <p>section 2
15284 </p>
15285 <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>
15286 <p>section 3
15287 </p>
15288 <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>
15289 <p>section 4
15290 </p>
15291 <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>
15292 <p>section 5
15293 </p>
15294 !! end
15296 !! test
15297 Header with space, plus and underscore as entity
15298 !! wikitext
15299 Id should not contain + for spaces
15301 == Space between Text ==
15302 section 1
15304 == Space-Entity&#32;between&#32;Text ==
15305 section 2
15307 == Plus+between+Text ==
15308 section 3
15310 == Plus-Entity&#43;between&#43;Text ==
15311 section 4
15313 == Underscore_between_Text ==
15314 section 5
15316 == Underscore-Entity&#95;between&#95;Text ==
15317 section 6
15319 [[#Space between Text]]
15320 [[#Space-Entity&#32;between&#32;Text]]
15321 [[#Plus+between+Text]]
15322 [[#Plus-Entity&#43;between&#43;Text]]
15323 [[#Underscore_between_Text]]
15324 [[#Underscore-Entity&#95;between&#95;Text]]
15325 !! html
15326 <p>Id should not contain + for spaces
15327 </p>
15328 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15329 <ul>
15330 <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>
15331 <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>
15332 <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>
15333 <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>
15334 <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>
15335 <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>
15336 </ul>
15337 </div>
15339 <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>
15340 <p>section 1
15341 </p>
15342 <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>
15343 <p>section 2
15344 </p>
15345 <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>
15346 <p>section 3
15347 </p>
15348 <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>
15349 <p>section 4
15350 </p>
15351 <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>
15352 <p>section 5
15353 </p>
15354 <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>
15355 <p>section 6
15356 </p><p><a href="#Space_between_Text">#Space between Text</a>
15357 <a href="#Space-Entity_between_Text">#Space-Entity&#32;between&#32;Text</a>
15358 <a href="#Plus.2Bbetween.2BText">#Plus+between+Text</a>
15359 <a href="#Plus-Entity.2Bbetween.2BText">#Plus-Entity&#43;between&#43;Text</a>
15360 <a href="#Underscore_between_Text">#Underscore_between_Text</a>
15361 <a href="#Underscore-Entity_between_Text">#Underscore-Entity&#95;between&#95;Text</a>
15362 </p>
15363 !! end
15365 !! test
15366 Headers with excess '=' characters
15367 (Are similar tests necessary beyond the 1st level?)
15368 !! wikitext
15369 =foo==
15370 ==foo=
15371 =''italic'' heading==
15372 ==''italic'' heading=
15373 !! html
15374 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15375 <ul>
15376 <li class="toclevel-1 tocsection-1"><a href="#foo.3D"><span class="tocnumber">1</span> <span class="toctext">foo=</span></a></li>
15377 <li class="toclevel-1 tocsection-2"><a href="#.3Dfoo"><span class="tocnumber">2</span> <span class="toctext">=foo</span></a></li>
15378 <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>
15379 <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>
15380 </ul>
15381 </div>
15383 <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>
15384 <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>
15385 <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>
15386 <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>
15388 !! end
15390 !! test
15391 HTML headers vs TOC (bug 23393)
15392 (__NOEDITSECTION__ for clearer output, doesn't matter here)
15393 !! wikitext
15394 <h1>Header 1</h1>
15395 == Header 1.1 ==
15396 == Header 1.2 ==
15398 <h1>Header 2
15399 </h1>
15400 == Header 2.1 ==
15401 == Header 2.2 ==
15402 __NOEDITSECTION__
15403 !! html
15404 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15405 <ul>
15406 <li class="toclevel-1"><a href="#Header_1"><span class="tocnumber">1</span> <span class="toctext">Header 1</span></a>
15407 <ul>
15408 <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>
15409 <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>
15410 </ul>
15411 </li>
15412 <li class="toclevel-1"><a href="#Header_2"><span class="tocnumber">2</span> <span class="toctext">Header 2</span></a>
15413 <ul>
15414 <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>
15415 <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>
15416 </ul>
15417 </li>
15418 </ul>
15419 </div>
15421 <h1><span class="mw-headline" id="Header_1">Header 1</span></h1>
15422 <h2><span class="mw-headline" id="Header_1.1">Header 1.1</span></h2>
15423 <h2><span class="mw-headline" id="Header_1.2">Header 1.2</span></h2>
15424 <h1><span class="mw-headline" id="Header_2">Header 2</span></h1>
15425 <h2><span class="mw-headline" id="Header_2.1">Header 2.1</span></h2>
15426 <h2><span class="mw-headline" id="Header_2.2">Header 2.2</span></h2>
15428 !! end
15430 !! test
15431 Single-line or multiline-comments can follow headings
15432 !! options
15433 parsoid=wt2html,wt2wt
15434 !! wikitext
15435 ==foo==<!---->
15436 ==bar==<!--c1-->
15437 ==baz==<!--
15439 c3-->
15440 !! html
15441 <h2><span class="mw-headline" id="foo">foo</span></h2>
15442 <h2><span class="mw-headline" id="bar">bar</span></h2>
15443 <h2><span class="mw-headline" id="baz">baz</span></h2>
15445 !! end
15447 !! test
15448 BUG 1219 URL next to image (broken)
15449 !! wikitext
15450 http://example.com[[File:Foobar.jpg]]
15451 !! html/php
15452 <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>
15453 </p>
15454 !! html/parsoid
15455 <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>
15456 !!end
15458 !! test
15459 Bug 1186 news: in the middle of text
15460 !! wikitext
15461 http://en.wikinews.org/wiki/Wikinews:Workplace
15462 !! html
15463 <p><a rel="nofollow" class="external free" href="http://en.wikinews.org/wiki/Wikinews:Workplace">http://en.wikinews.org/wiki/Wikinews:Workplace</a>
15464 </p>
15465 !!end
15468 !! test
15469 Namespaced link must have a title
15470 !! wikitext
15471 [[Project:]]
15472 !! html
15473 <p>[[Project:]]
15474 </p>
15475 !!end
15477 !! test
15478 Namespaced link must have a title (bad fragment version)
15479 !! wikitext
15480 [[Project:#fragment]]
15481 !! html
15482 <p>[[Project:#fragment]]
15483 </p>
15484 !!end
15488 ### HTML tags and HTML attributes
15491 !! test
15492 div with no attributes
15493 !! wikitext
15494 <div>HTML rocks</div>
15495 !! html
15496 <div>HTML rocks</div>
15498 !! end
15500 !! test
15501 div with double-quoted attribute
15502 !! wikitext
15503 <div id="rock">HTML rocks</div>
15504 !! html
15505 <div id="rock">HTML rocks</div>
15507 !! end
15509 !! test
15510 div with single-quoted attribute
15511 !! wikitext
15512 <div id='rock'>HTML rocks</div>
15513 !! html
15514 <div id="rock">HTML rocks</div>
15516 !! end
15518 !! test
15519 div with unquoted attribute
15520 !! wikitext
15521 <div id=rock>HTML rocks</div>
15522 !! html
15523 <div id="rock">HTML rocks</div>
15525 !! end
15527 !! test
15528 div with illegal double attributes
15529 !! wikitext
15530 <div id="a" id="b">HTML rocks</div>
15531 !! html
15532 <div id="b">HTML rocks</div>
15534 !!end
15536 !! test
15537 div with empty attribute value, space before equals
15538 !! options
15539 parsoid=wt2html,html2html
15540 !! wikitext
15541 <div class =>HTML rocks</div>
15542 !! html/php
15543 <div class="">HTML rocks</div>
15545 !! html/parsoid
15546 <div class="" data-parsoid='{"stx":"html"}'>HTML rocks</div>
15547 !! end
15549 !! test
15550 div with multiple empty attribute values
15551 !! options
15552 parsoid=wt2html,html2html
15553 !! wikitext
15554 <div id= title=>HTML rocks</div>
15555 !! html/php
15556 <div id="title.3D">HTML rocks</div>
15558 !! html/parsoid
15559 <div id="title=" data-parsoid='{"stx":"html"}'>HTML rocks</div>
15560 !! end
15562 !! test
15563 table with multiple empty attribute values
15564 !! options
15565 parsoid=wt2html,html2html
15566 !! wikitext
15567 {| title= id=
15568 | hi
15570 !! html/php
15571 <table title="id=">
15572 <tr>
15573 <td> hi
15574 </td></tr></table>
15576 !! html/parsoid
15577 <table title="id=">
15578 <tbody><tr><td> hi</td></tr>
15579 </tbody></table>
15580 !! end
15582 !! test
15583 div with braces in attribute value
15584 !! wikitext
15585 <div title="{}">Foo</div>
15586 !! html/php
15587 <div title="&#123;}">Foo</div>
15589 !! html/parsoid
15590 <div title="{}">Foo</div>
15591 !! end
15593 !! test
15594 div with empty attribute value, no space before equals
15595 !! options
15596 parsoid=wt2html,html2html
15597 !! wikitext
15598 <div class=>HTML rocks</div>
15599 !! html/php
15600 <div class="">HTML rocks</div>
15602 !! html/parsoid
15603 <div class="">HTML rocks</div>
15604 !! end
15606 !! test
15607 HTML multiple attributes correction
15608 !! wikitext
15609 <p class="error" class="awesome">Awesome!</p>
15610 !! html
15611 <p class="awesome">Awesome!</p>
15613 !!end
15615 !! test
15616 Table multiple attributes correction
15617 !! wikitext
15619 !+ class="error" class="awesome"| status
15621 !! html
15622 <table>
15623 <tr>
15624 <th class="awesome"> status
15625 </th></tr></table>
15627 !!end
15629 !! test
15630 DIV IN UPPERCASE
15631 !! wikitext
15632 <DIV ID="x">HTML ROCKS</DIV>
15633 !! html
15634 <div id="x">HTML ROCKS</div>
15636 !!end
15638 !! test
15639 Non-ASCII pseudo-tags are rendered as text
15640 !! wikitext
15641 <khyô>
15642 !! html
15643 <p>&lt;khyô&gt;
15644 </p>
15645 !! end
15647 !! test
15648 Pseudo-tag with URL 'name' renders as url link
15649 !! wikitext
15650 <http://example.com/>
15651 !! html
15652 <p>&lt;<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&gt;
15653 </p>
15654 !! end
15656 !! test
15657 text with amp in the middle of nowhere
15658 !! wikitext
15659 Remember AT&T?
15660 !! html
15661 <p>Remember AT&amp;T?
15662 </p>
15663 !! end
15665 !! test
15666 text with character entity: eacute
15667 !! wikitext
15668 I always thought &eacute; was a cute letter.
15669 !! html
15670 <p>I always thought &#233; was a cute letter.
15671 </p>
15672 !! html+tidy
15673 <p>I always thought é was a cute letter.</p>
15674 !! end
15676 !! test
15677 text with entity-escaped character entity-like string: eacute
15678 !! wikitext
15679 I always thought &amp;eacute; was a cute letter.
15680 !! html
15681 <p>I always thought &amp;eacute; was a cute letter.
15682 </p>
15683 !! end
15685 !! test
15686 text with undefined character entity: xacute
15687 !! wikitext
15688 I always thought &xacute; was a cute letter.
15689 !! html
15690 <p>I always thought &amp;xacute; was a cute letter.
15691 </p>
15692 !! end
15694 !! test
15695 HTML5 tags
15696 !! wikitext
15697 <data value="5">five</data>
15698 <time datetime="2000-01-01T00:00Z">The new millenium started</time>
15699 <mark>This highlighted text</mark>
15700 !! html
15701 <p><data value="5">five</data>
15702 <time datetime="2000-01-01T00:00Z">The new millenium started</time>
15703 <mark>This highlighted text</mark>
15704 </p>
15705 !! end
15707 !! test
15708 HTML tag with leading space is parsed as text
15709 !! wikitext
15710 < div>foo< /div>
15711 !! html
15712 <p>&lt; div&gt;foo&lt; /div&gt;
15713 </p>
15714 !! end
15717 ### Nesting tests (see bug 41545, 50604, 51081)
15720 # This test case is fixed in Parsoid by domino 1.0.12. (bug 50604)
15721 # Note that html2wt is considerably more difficult if we use <b> in
15722 # the test case, instead of <big>
15723 !! test
15724 Ensure that HTML adoption agency algorithm is properly implemented.
15725 !! wikitext
15726 <big>X<big>Y</big>Z</big>
15727 !! html
15728 <p><big>X<big>Y</big>Z</big>
15729 </p>
15730 !! end
15732 # This was bug 41545 in the PHP parser.
15733 # Note that tidy doesn't handle this correctly.
15734 !! test
15735 Nesting of <kbd>
15736 !! wikitext
15737 <kbd>X<kbd>Y</kbd>Z</kbd>
15738 !! html
15739 <p><kbd>X<kbd>Y</kbd>Z</kbd>
15740 </p>
15741 !! end
15743 # The following cases were bug 51081 in the PHP parser.
15744 # Note that there are some other nestable tags (b, i, etc) which are
15745 # not covered; see bug 51081 for discussion.
15747 # Note that tidy doesn't handle this correctly.
15748 !! test
15749 Nesting of <em>
15750 !! wikitext
15751 <em>X<em>Y</em>Z</em>
15752 !! html
15753 <p><em>X<em>Y</em>Z</em>
15754 </p>
15755 !! end
15757 # Note that tidy doesn't handle this correctly.
15758 !! test
15759 Nesting of <strong>
15760 !! wikitext
15761 <strong>X<strong>Y</strong>Z</strong>
15762 !! html
15763 <p><strong>X<strong>Y</strong>Z</strong>
15764 </p>
15765 !! end
15767 !! test
15768 Nesting of <q>
15769 !! wikitext
15770 <q>X<q>Y</q>Z</q>
15771 !! html+tidy
15772 <p><q>X<q>Y</q>Z</q></p>
15773 !! end
15775 # Note that tidy doesn't handle this correctly.
15776 !! test
15777 Nesting of <ruby>
15778 !! wikitext
15779 <ruby>X<ruby>Y</ruby>Z</ruby>
15780 !! html
15781 <p><ruby>X<ruby>Y</ruby>Z</ruby>
15782 </p>
15783 !! end
15785 # Note that tidy doesn't handle this correctly.
15786 !! test
15787 Nesting of <bdo>
15788 !! wikitext
15789 <bdo>X<bdo>Y</bdo>Z</bdo>
15790 !! html
15791 <p><bdo>X<bdo>Y</bdo>Z</bdo>
15792 </p>
15793 !! end
15797 ### Media links
15800 !! test
15801 Media link
15802 !! wikitext
15803 [[Media:Foobar.jpg]]
15804 !! html
15805 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Media:Foobar.jpg</a>
15806 </p>
15807 !! end
15809 !! test
15810 Media link with text
15811 !! wikitext
15812 [[Media:Foobar.jpg|A neat file to look at]]
15813 !! html
15814 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">A neat file to look at</a>
15815 </p>
15816 !! end
15818 # FIXME: this is still bad HTML tag nesting
15819 # FIXME: doBlockLevels won't wrap this in a paragraph because it contains a div
15820 !! test
15821 Media link with nasty text
15822 !! wikitext
15823 [[Media:Foobar.jpg|Safe Link<div style=display:none>" onmouseover="alert(document.cookie)" onfoo="</div>]]
15824 !! html
15825 <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>
15827 !! html+tidy
15828 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Safe Link</a></p>
15829 <div style="display:none">" onmouseover="alert(document.cookie)" onfoo="</div>
15830 !! end
15832 !! test
15833 Media link to nonexistent file (bug 1702)
15834 !! wikitext
15835 [[Media:No such.jpg]]
15836 !! html
15837 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=No_such.jpg" class="new" title="No such.jpg">Media:No such.jpg</a>
15838 </p>
15839 !! end
15841 !! test
15842 Image link to nonexistent file (bug 1850 - good)
15843 !! wikitext
15844 [[File:No_such.jpg]]
15845 !! html/php
15846 <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>
15847 </p>
15848 !! html/parsoid
15849 <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>
15850 !! end
15852 !! test
15853 :Image link to nonexistent file (bug 1850 - bad)
15854 !! wikitext
15855 [[:Image:No such.jpg]]
15856 !! html/php
15857 <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>
15858 </p>
15859 !! html/parsoid
15860 <p><a rel="mw:WikiLink" href="./File:No_such.jpg" title="File:No such.jpg">Image:No such.jpg</a></p>
15861 !! end
15865 !! test
15866 Character reference normalization in link text (bug 1938)
15867 !! wikitext
15868 [[Main Page|this&that]]
15869 !! html
15870 <p><a href="/wiki/Main_Page" title="Main Page">this&amp;that</a>
15871 </p>
15872 !!end
15874 !! article
15875 אַ
15876 !! text
15877 Test for unicode normalization
15879 The page's name is U+05d0 U+05b7, with non-canonical form U+FB2E
15880 !! endarticle
15882 !! test
15883 (bug 19451) Links should refer to the normalized form.
15884 !! wikitext
15885 [[&#xFB2E;]]
15886 [[&#x5d0;&#x5b7;]]
15887 [[&#x5d0;ַ]]
15888 [[א&#x5b7;]]
15889 [[אַ]]
15890 !! html
15891 <p><a href="/wiki/%D7%90%D6%B7" title="אַ">&#xfb2e;</a>
15892 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;&#x5b7;</a>
15893 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;ַ</a>
15894 <a href="/wiki/%D7%90%D6%B7" title="אַ">א&#x5b7;</a>
15895 <a href="/wiki/%D7%90%D6%B7" title="אַ">אַ</a>
15896 </p>
15897 !! end
15899 !! test
15900 Empty attribute crash test (bug 2067)
15901 !! wikitext
15902 <font color="">foo</font>
15903 !! html
15904 <p><font color="">foo</font>
15905 </p>
15906 !! end
15908 !! test
15909 Empty attribute crash test single-quotes (bug 2067)
15910 !! wikitext
15911 <font color=''>foo</font>
15912 !! html
15913 <p><font color="">foo</font>
15914 </p>
15915 !! end
15917 !! test
15918 Attribute test: equals, then nothing
15919 !! options
15920 parsoid=wt2html,html2html
15921 !! wikitext
15922 <font color=>foo</font>
15923 !! html/php
15924 <p><font color="">foo</font>
15925 </p>
15926 !! html/parsoid
15927 <p><font color="" data-parsoid='{"stx":"html"}'>foo</font></p>
15928 !! end
15930 !! test
15931 Attribute test: unquoted value
15932 !! options
15933 parsoid=wt2html,html2html
15934 !! wikitext
15935 <font color=x>foo</font>
15936 !! html/php
15937 <p><font color="x">foo</font>
15938 </p>
15939 !! html/parsoid
15940 <p><font color="x" data-parsoid='{"stx":"html"}'>foo</font></p>
15941 !! end
15943 !! test
15944 Attribute test: unquoted but illegal value (hash)
15945 !! wikitext
15946 <font color=#x>foo</font>
15947 !! html
15948 <p><font color="#x">foo</font>
15949 </p>
15950 !! end
15952 # Parsoid does not serialize to empty attribute syntax,
15953 # so wt2wt and html2wt cases are skipped
15954 !! test
15955 Attribute test: no value (T54330)
15956 !! options
15957 parsoid=wt2html,html2html
15958 !! wikitext
15959 <font color>foo</font>
15960 !! html/php
15961 <p><font color="">foo</font>
15962 </p>
15963 !! html/parsoid
15964 <p><font color="">foo</font></p>
15965 !! end
15967 !! test
15968 Bug 2095: link with three closing brackets
15969 !! wikitext
15970 [[Main Page]]]
15971 !! html/php
15972 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>]
15973 </p>
15974 !! html/parsoid
15975 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">Main Page</a>]</p>
15976 !! end
15978 !! test
15979 Bug 2095: link with pipe and three closing brackets
15980 !! wikitext
15981 [[Main Page|link]]]
15982 !! html/php
15983 <p><a href="/wiki/Main_Page" title="Main Page">link</a>]
15984 </p>
15985 !! html/parsoid
15986 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">link</a>]</p>
15987 !! end
15989 !! test
15990 Bug 2095: link with pipe and three closing brackets, version 2
15991 !! wikitext
15992 [[Main Page|[http://example.com/]]]
15993 !! html/php
15994 <p><a href="/wiki/Main_Page" title="Main Page">[http://example.com/]</a>
15995 </p>
15996 !! html/parsoid
15997 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">[http://example.com/]</a></p>
15998 !! end
16002 ### Safety
16005 !! article
16006 Template:Dangerous attribute
16007 !! text
16008 " onmouseover="alert(document.cookie)
16009 !! endarticle
16011 !! article
16012 Template:Dangerous style attribute
16013 !! text
16014 border-size: expression(alert(document.cookie))
16015 !! endarticle
16017 !! article
16018 Template:Div style
16019 !! text
16020 <div style="float: right; {{{1}}}">Magic div</div>
16021 !! endarticle
16023 !! test
16024 Bug 2304: HTML attribute safety (safe template; regression bug 2309)
16025 !! wikitext
16026 <div title="{{test}}"></div>
16027 !! html
16028 <div title="This is a test template"></div>
16030 !! end
16032 # Parsoid has enough context to handle this case
16033 !! test
16034 Bug 2304: HTML attribute safety (dangerous template; 2309)
16035 !! wikitext
16036 <div title="{{dangerous attribute}}"></div>
16037 !! html/php
16038 <div title=""></div>
16040 !! html/parsoid
16041 <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>
16042 !! end
16044 !! test
16045 Bug 2304: HTML attribute safety (dangerous style template; 2309)
16046 !! wikitext
16047 <div style="{{dangerous style attribute}}"></div>
16048 !! html
16049 <div style="/* insecure input */"></div>
16051 !! end
16053 !! test
16054 Bug 2304: HTML attribute safety (safe parameter; 2309)
16055 !! wikitext
16056 {{div style|width: 200px}}
16057 !! html
16058 <div style="float: right; width: 200px">Magic div</div>
16060 !! end
16062 !! test
16063 Bug 2304: HTML attribute safety (unsafe parameter; 2309)
16064 !! wikitext
16065 {{div style|width: expression(alert(document.cookie))}}
16066 !! html
16067 <div style="/* insecure input */">Magic div</div>
16069 !! end
16071 !! test
16072 Bug 2304: HTML attribute safety (unsafe breakout parameter; 2309)
16073 !! wikitext
16074 {{div style|"><script>alert(document.cookie)</script>}}
16075 !! html
16076 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
16078 !! end
16080 !! test
16081 Bug 2304: HTML attribute safety (unsafe breakout parameter 2; 2309)
16082 !! wikitext
16083 {{div style|" ><script>alert(document.cookie)</script>}}
16084 !! html
16085 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
16087 !! end
16089 !! test
16090 Bug 2304: HTML attribute safety (link)
16091 !! wikitext
16092 <div title="[[Main Page]]"></div>
16093 !! html
16094 <div title="&#91;&#91;Main Page]]"></div>
16096 !! end
16098 !! test
16099 Bug 2304: HTML attribute safety (italics)
16100 !! wikitext
16101 <div title="''foobar''"></div>
16102 !! html
16103 <div title="&#39;&#39;foobar&#39;&#39;"></div>
16105 !! end
16107 !! test
16108 Bug 2304: HTML attribute safety (bold)
16109 !! wikitext
16110 <div title="'''foobar'''"></div>
16111 !! html
16112 <div title="&#39;&#39;&#39;foobar&#39;&#39;&#39;"></div>
16114 !! end
16117 !! test
16118 Bug 2304: HTML attribute safety (ISBN)
16119 !! wikitext
16120 <div title="ISBN 1234567890"></div>
16121 !! html
16122 <div title="&#73;SBN 1234567890"></div>
16124 !! end
16126 !! test
16127 Bug 2304: HTML attribute safety (RFC)
16128 !! wikitext
16129 <div title="RFC 1234"></div>
16130 !! html
16131 <div title="&#82;FC 1234"></div>
16133 !! end
16135 !! test
16136 Bug 2304: HTML attribute safety (PMID)
16137 !! wikitext
16138 <div title="PMID 1234567890"></div>
16139 !! html
16140 <div title="&#80;MID 1234567890"></div>
16142 !! end
16144 !! test
16145 Bug 2304: HTML attribute safety (web link)
16146 !! wikitext
16147 <div title="http://example.com/"></div>
16148 !! html
16149 <div title="http&#58;//example.com/"></div>
16151 !! end
16153 !! test
16154 Bug 2304: HTML attribute safety (named web link)
16155 !! wikitext
16156 <div title="[http://example.com/ link]"></div>
16157 !! html
16158 <div title="&#91;http&#58;//example.com/ link]"></div>
16160 !! end
16162 !! test
16163 Bug 3244: HTML attribute safety (extension; safe)
16164 !! wikitext
16165 <div style="<nowiki>background:blue</nowiki>"></div>
16166 !! html
16167 <div style="background:blue"></div>
16169 !! end
16171 !! test
16172 Bug 3244: HTML attribute safety (extension; unsafe)
16173 !! wikitext
16174 <div style="<nowiki>border-left:expression(alert(document.cookie))</nowiki>"></div>
16175 !! html
16176 <div style="/* insecure input */"></div>
16178 !! end
16180 # More MSIE fun discovered by Tom Gilder
16182 !! test
16183 MSIE CSS safety test: spurious slash
16184 !! wikitext
16185 <div style="background-image:u\rl(javascript:alert('boo'))">evil</div>
16186 !! html
16187 <div style="/* insecure input */">evil</div>
16189 !! end
16191 !! test
16192 MSIE CSS safety test: hex code
16193 !! wikitext
16194 <div style="background-image:u\72l(javascript:alert('boo'))">evil</div>
16195 !! html
16196 <div style="/* insecure input */">evil</div>
16198 !! end
16200 !! test
16201 MSIE CSS safety test: comment in url
16202 !! wikitext
16203 <div style="background-image:u/**/rl(javascript:alert('boo'))">evil</div>
16204 !! html
16205 <div style="background-image:u rl(javascript:alert(&#39;boo&#39;))">evil</div>
16207 !! end
16209 !! test
16210 MSIE CSS safety test: comment in expression
16211 !! wikitext
16212 <div style="background-image:expres/**/sion(alert('boo4'))">evil4</div>
16213 !! html
16214 <div style="background-image:expres sion(alert(&#39;boo4&#39;))">evil4</div>
16216 !! end
16218 !! test
16219 CSS safety test (all browsers): vertical tab (bug 55332 / CVE-2013-4567)
16220 !! wikitext
16221 <p style="font-size: 100px; background-image:url\b(https://www.google.com/images/srpr/logo6w.png)">A</p>
16222 !! html
16223 <p style="/* invalid control char */">A</p>
16225 !! end
16227 !! test
16228 MSIE 6 CSS safety test: Fullwidth (bug 55332)
16229 !! wikitext
16230 <p style="font-size: 100px; color: expression((title='XSSed'),'red')">A</p>
16231 <div style="top:EXPRESSION(alert())">B</div>
16232 !! html
16233 <p style="/* insecure input */">A</p>
16234 <div style="/* insecure input */">B</div>
16236 !! end
16238 !! test
16239 MSIE 6 CSS safety test: IPA extensions (bug 55332)
16240 !! wikitext
16241 <div style="background-image:uʀʟ(javascript:alert())">A</div>
16242 <p style="font-size: 100px; color: expʀessɪoɴ((title='XSSed'),'red')">B</p>
16243 !! html
16244 <div style="/* insecure input */">A</div>
16245 <p style="/* insecure input */">B</p>
16247 !! end
16249 !! test
16250 MSIE 6 CSS safety test: sup/sub script (bug 55332)
16251 !! wikitext
16252 <div style="background-image:url⁽javascript:alert())">A</div>
16253 <div style="background-image:url₍javascript:alert())">B</div>
16254 <p style="font-size: 100px; color: expressioⁿ((title='XSSed'),'red')">C</p>
16255 !! html
16256 <div style="/* insecure input */">A</div>
16257 <div style="/* insecure input */">B</div>
16258 <p style="/* insecure input */">C</p>
16260 !! end
16262 # FIXME: Parsoid fails to sanitize this! See T58846.
16263 !! test
16264 Opera -o-link CSS
16265 !! wikitext
16266 <div
16267 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;"
16268 style="-o-link:attr(title);-o-link-source:current">X</div>
16269 !! html
16270 <div title="data:text/html,&lt;img src=1 onerror=alert(1)&gt;" style="/* insecure input */">X</div>
16272 !! end
16274 !! test
16275 MSIE 6 CSS safety test: Repetition markers (bug 55332)
16276 !! wikitext
16277 <p style="font-size: 100px; color: expres〱ion((title='XSSed'),'red')">A</p>
16278 <p style="font-size: 100px; color: expresゝion((title='XSSed'),'red')">B</p>
16279 <p style="font-size: 100px; color: expresーion((title='XSSed'),'red')">C</p>
16280 <p style="font-size: 100px; color: expresヽion((title='XSSed'),'red')">D</p>
16281 <p style="font-size: 100px; color: expresﹽion((title='XSSed'),'red')">E</p>
16282 <p style="font-size: 100px; color: expresﹼion((title='XSSed'),'red')">F</p>
16283 <p style="font-size: 100px; color: expresーion((title='XSSed'),'red')">G</p>
16284 !! html
16285 <p style="/* insecure input */">A</p>
16286 <p style="/* insecure input */">B</p>
16287 <p style="/* insecure input */">C</p>
16288 <p style="/* insecure input */">D</p>
16289 <p style="/* insecure input */">E</p>
16290 <p style="/* insecure input */">F</p>
16291 <p style="/* insecure input */">G</p>
16293 !! end
16295 !! test
16296 Table attribute legitimate extension
16297 !! wikitext
16299 !+ style="<nowiki>color:blue</nowiki>"| status
16301 !! html
16302 <table>
16303 <tr>
16304 <th style="color:blue"> status
16305 </th></tr></table>
16307 !!end
16309 !! test
16310 Table attribute safety
16311 !! wikitext
16313 !+ style="<nowiki>border-width:expression(0+alert(document.cookie))</nowiki>"| status
16315 !! html
16316 <table>
16317 <tr>
16318 <th style="/* insecure input */"> status
16319 </th></tr></table>
16321 !! end
16323 !! test
16324 CSS line continuation 1
16325 !! wikitext
16326 <div style="background-image: u\&#10;rl(test.jpg);"></div>
16327 !! html
16328 <div style="/* insecure input */"></div>
16330 !! end
16332 !! test
16333 CSS line continuation 2
16334 !! wikitext
16335 <div style="background-image: u\&#13;rl(test.jpg); "></div>
16336 !! html
16337 <div style="/* invalid control char */"></div>
16339 !! end
16341 !! article
16342 Template:Identity
16343 !! text
16344 {{{1}}}
16345 !! endarticle
16347 !! test
16348 Expansion of multi-line templates in attribute values (bug 6255)
16349 !! wikitext
16350 <div style="background: {{identity|#00FF00}}">-</div>
16351 !! html
16352 <div style="background: #00FF00">-</div>
16354 !! end
16357 !! test
16358 Expansion of multi-line templates in attribute values (bug 6255 sanity check)
16359 !! wikitext
16360 <div style="background: 
16361 #00FF00">-</div>
16362 !! html/php
16363 <div style="background: #00FF00">-</div>
16365 !! html/parsoid
16366 <div style="background: 
16367 #00FF00">-</div>
16368 !! end
16370 !! test
16371 Expansion of multi-line templates in attribute values (bug 6255 sanity check 2)
16372 !! wikitext
16373 <div style="background: &#10;#00FF00">-</div>
16374 !! html
16375 <div style="background: &#10;#00FF00">-</div>
16377 !! end
16379 !! test
16380 evil <math>-wiki-tags without Extension:Math enabled
16381 !! wikitext
16382 <math><img src="some evil external link"><script>some_evil_javascript();</script></math>
16383 !! html+tidy
16384 <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>
16385 !! end
16388 ### Parser hooks (see tests/parser/parserTestsParserHook.php for the <tag> extension)
16390 !! test
16391 Parser hook: empty input
16392 !! wikitext
16393 <tag></tag>
16394 !! html/php
16395 <pre>
16397 array (
16399 </pre>
16401 !! html/parsoid
16402 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":""}}' data-parsoid='{}' about="#mwt2"></pre>
16403 !! end
16405 ## Don't expect parsoid to rt this form.
16406 !! test
16407 Parser hook: empty input using terminated empty elements
16408 !! options
16409 parsoid=wt2html,html2html
16410 !! wikitext
16411 <tag/>
16412 !! html/php
16413 <pre>
16414 NULL
16415 array (
16417 </pre>
16419 !! html/parsoid
16420 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":null}' data-parsoid='{}' about="#mwt2"></pre>
16421 !! end
16423 !! test
16424 Parser hook: empty input using terminated empty elements (space before)
16425 !! wikitext
16426 <tag />
16427 !! html/php
16428 <pre>
16429 NULL
16430 array (
16432 </pre>
16434 !! html/parsoid
16435 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":null}' data-parsoid='{}' about="#mwt2"></pre>
16436 !! end
16438 !! test
16439 Parser hook: basic input
16440 !! wikitext
16441 <tag>input</tag>
16442 !! html/php
16443 <pre>
16444 'input'
16445 array (
16447 </pre>
16449 !! html/parsoid
16450 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":"input"}}' data-parsoid='{}' about="#mwt2"></pre>
16451 !! end
16453 ## Don't expect parsoid to rt this form.
16454 !! test
16455 Parser hook: case insensitive
16456 !! options
16457 parsoid=wt2html,html2html
16458 !! wikitext
16459 <TAG>input</TAG>
16460 !! html/php
16461 <pre>
16462 'input'
16463 array (
16465 </pre>
16467 !! html/parsoid
16468 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":"input"}}' data-parsoid='{}' about="#mwt2"></pre>
16469 !! end
16471 ## Don't expect parsoid to rt this form.
16472 !! test
16473 Parser hook: case insensitive, redux
16474 !! options
16475 parsoid=wt2html,html2html
16476 !! wikitext
16477 <TaG>input</TAg>
16478 !! html/php
16479 <pre>
16480 'input'
16481 array (
16483 </pre>
16485 !! html/parsoid
16486 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":"input"}}' data-parsoid='{}' about="#mwt2"></pre>
16487 !! end
16489 !! test
16490 Parser hook: nested tags
16491 !! wikitext
16492 <tag><tag></tag></tag>
16493 !! html/php
16494 <pre>
16495 '<tag>'
16496 array (
16498 </pre>&lt;/tag&gt;
16500 !! html/parsoid
16501 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":"&lt;tag>"}}' data-parsoid='{}' about="#mwt2"></pre>&lt;/tag>
16502 !! end
16504 !! test
16505 Parser hook: basic arguments
16506 !! wikitext
16507 <tag width="200" height="100" depth="50" square=""></tag>
16508 !! html/php
16509 <pre>
16511 array (
16512   'width' => '200',
16513   'height' => '100',
16514   'depth' => '50',
16515   'square' => '',
16517 </pre>
16519 !! html/parsoid
16520 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{"width":"200","height":"100","depth":"50","square":""},"body":{"extsrc":""}}' data-parsoid='{}' about="#mwt2"></pre>
16521 !! end
16523 ## Don't expect parsoid to rt this form.
16524 !! test
16525 Parser hook: basic arguments, variations
16526 !! options
16527 parsoid=wt2html,html2html
16528 !! wikitext
16529 <tag width=200 height = "100" depth = '50' square></tag>
16530 !! html/php
16531 <pre>
16533 array (
16534   'width' => '200',
16535   'height' => '100',
16536   'depth' => '50',
16537   'square' => '',
16539 </pre>
16541 !! html/parsoid
16542 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{"width":"200","height":"100","depth":"50","square":""},"body":{"extsrc":""}}' data-parsoid='{}' about="#mwt2"></pre>
16543 !! end
16545 !! test
16546 Parser hook: argument containing a forward slash (bug 5344)
16547 !! wikitext
16548 <tag filename="/tmp/bla"></tag>
16549 !! html/php
16550 <pre>
16552 array (
16553   'filename' => '/tmp/bla',
16555 </pre>
16557 !! html/parsoid
16558 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{"filename":"/tmp/bla"},"body":{"extsrc":""}}' data-parsoid='{}' about="#mwt2"></pre>
16559 !! end
16561 ## Don't expect parsoid to rt this form.
16562 !! test
16563 Parser hook: empty input using terminated empty elements (bug 2374)
16564 !! options
16565 parsoid=wt2html,html2html
16566 !! wikitext
16567 <tag foo=bar/>text
16568 !! html/php
16569 <pre>
16570 NULL
16571 array (
16572   'foo' => 'bar',
16574 </pre>text
16576 !! html/parsoid
16577 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{"foo":"bar"},"body":null}' data-parsoid='{}' about="#mwt2"></pre>text
16578 !! end
16580 ## </tag> should be output literally since there is no matching tag that begins it
16581 ## Don't expect parsoid to rt this form.
16582 !! test
16583 Parser hook: basic arguments using terminated empty elements (bug 2374)
16584 !! options
16585 parsoid=wt2html
16586 !! wikitext
16587 <tag width=200 height = "100" depth = '50' square/>
16588 other stuff
16589 </tag>
16590 !! html/php
16591 <pre>
16592 NULL
16593 array (
16594   'width' => '200',
16595   'height' => '100',
16596   'depth' => '50',
16597   'square' => '',
16599 </pre>
16600 <p>other stuff
16601 &lt;/tag&gt;
16602 </p>
16603 !! html/parsoid
16604 <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
16605 &lt;/tag></p>
16606 !! end
16608 ## Don't expect parsoid to rt this form.
16609 !! test
16610 Parser hook: Don't allow unclosed extension tags
16611 !! options
16612 parsoid=wt2html
16613 !! wikitext
16614 test <tag>123
16616 this is a '''test'''
16617 !! html/php
16618 <p>test &lt;tag&gt;123
16619 </p><p>this is a <b>test</b>
16620 </p>
16621 !! html/parsoid
16622 <p>test &lt;tag>123</p>
16624 <p>this is a <b>test</b></p>
16625 !! end
16628 ### (see tests/parser/parserTestsParserHook.php for the <statictag> extension)
16631 !! test
16632 Parser hook: static parser hook not inside a comment
16633 !! wikitext
16634 <statictag>hello, world</statictag>
16636 <statictag action="flush" />
16637 !! html/php
16638 <p><br />
16639 hello, world
16640 </p>
16641 !! html/parsoid
16642 <p><span typeof="mw:Extension/statictag" data-mw='{"name":"statictag","attrs":{},"body":{"extsrc":"hello, world"}}' data-parsoid='{}' about="#mwt2"></span></p>
16643 <p typeof="mw:Extension/statictag" data-mw='{"name":"statictag","attrs":{"action":"flush"},"body":null}' data-parsoid='{}' about="#mwt4">hello, world</p>
16644 !! end
16646 !! test
16647 Parser hook: static parser hook inside a comment
16648 !! wikitext
16649 <!-- <statictag>hello, world</statictag> -->
16650 <statictag action="flush" />
16651 !! html/php
16652 <p><br />
16653 </p>
16654 !! html/parsoid
16655 <!-- <statictag&#x3E;hello, world</statictag&#x3E; -->
16656 <p typeof="mw:Extension/statictag" data-mw='{"name":"statictag","attrs":{"action":"flush"},"body":null}' data-parsoid='{}' about="#mwt2"></p>
16657 !! end
16659 # Nested template calls; this case was broken by Parser.php rev 1.506,
16660 # since reverted.
16662 !! article
16663 Template:One-parameter
16664 !! text
16665 (My parameter is: {{{1}}})
16666 !! endarticle
16668 !! article
16669 Template:Map-one-parameter
16670 !! text
16671 {{{{{1}}}|{{{2}}}}}
16672 !! endarticle
16674 !! test
16675 Nested template calls
16676 !! wikitext
16677 {{Map-one-parameter|One-parameter|param}}
16678 !! html
16679 <p>(My parameter is: param)
16680 </p>
16681 !! end
16685 ### Sanitizer
16688 # HTML+Tidy effectively strips out the empty tags completely
16689 # But since Parsoid doesn't it wraps the <s></s> tags in p-tags
16690 # which Tidy would have done for the PHP parser had there been content inside it.
16691 !! test
16692 Sanitizer: Closing of open tags
16693 !! wikitext
16694 <s></s><table></table>
16695 !! html
16696 <s></s><table></table>
16698 !! html/parsoid
16699 <p><s></s></p><table></table>
16700 !! end
16702 !! test
16703 Sanitizer: Closing of open but not closed tags
16704 !! wikitext
16705 <s>foo
16706 !! html
16707 <p><s>foo</s>
16708 </p>
16709 !! end
16711 !! test
16712 Sanitizer: Closing of closed but not open tags
16713 !! options
16714 parsoid=wt2html
16715 !! wikitext
16716 </s>
16717 !! html/php+tidy
16718 !! html/parsoid
16719 !! end
16721 !! test
16722 Sanitizer: Closing of closed but not open table tags
16723 !! options
16724 parsoid=wt2html
16725 !! wikitext
16726 Table not started</td></tr></table>
16727 !! html/php+tidy
16728 <p>Table not started</p>
16729 !! html/parsoid
16730 <p>Table not started</p>
16731 !! end
16733 !! test
16734 Sanitizer: Escaping of spaces, multibyte characters, colons & other stuff in id=""
16735 !! wikitext
16736 <span id="æ: v">byte</span>[[#æ: v|backlink]]
16737 !! html
16738 <p><span id=".C3.A6:_v">byte</span><a href="#.C3.A6:_v">backlink</a>
16739 </p>
16740 !! end
16742 # In HTML5, the restrictions are that id must contain at least one character,
16743 # and must not contain any space characters.
16744 !! test
16745 Sanitizer: Validating the contents of the id attribute (bug 4515)
16746 !! options
16747 disabled
16748 !! wikitext
16749 <br id="" /><br id="a space" />
16750 !! html
16751 Something ...
16752 !! end
16754 # In HTML5, id must be unique amongst all the ids in the element's home subtree.
16755 !! test
16756 Sanitizer: Validating id attribute uniqueness (bug 4515, bug 6301)
16757 !! options
16758 disabled
16759 !! wikitext
16760 <br id="foo" /><br id="foo" />
16761 !! html
16762 Something need to be done. foo-2 ? 
16763 !! end
16765 !! test
16766 Sanitizer: Validating that <meta> and <link> work, but only for Microdata
16767 !! wikitext
16768 <div itemscope>
16769         <meta itemprop="hello" content="world">
16770         <meta http-equiv="refresh" content="5">
16771         <meta itemprop="hello" http-equiv="refresh" content="5">
16772         <link itemprop="hello" href="{{SERVER}}">
16773         <link rel="stylesheet" href="{{SERVER}}">
16774         <link rel="stylesheet" itemprop="hello" href="{{SERVER}}">
16775 </div>
16776 !! html
16777 <div itemscope="">
16778 <p>     <meta itemprop="hello" content="world" />
16779         &lt;meta http-equiv="refresh" content="5"&gt;
16780         <meta itemprop="hello" content="5" />
16781 </p>
16782         <link itemprop="hello" href="http&#58;//example.org" />
16783         &lt;link rel="stylesheet" href="<a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>"&gt;
16784         <link itemprop="hello" href="http&#58;//example.org" />
16785 </div>
16787 !! end
16789 !! test
16790 Language converter: output gets cut off unexpectedly (bug 5757)
16791 !! options
16792 language=zh
16793 !! wikitext
16794 this bit is safe: }-
16796 but if we add a conversion instance: -{zh-cn:xxx;zh-tw:yyy}-
16798 then we get cut off here: }-
16800 all additional text is vanished
16801 !! html
16802 <p>this bit is safe: }-
16803 </p><p>but if we add a conversion instance: xxx
16804 </p><p>then we get cut off here: }-
16805 </p><p>all additional text is vanished
16806 </p>
16807 !! end
16809 !! test
16810 Self closed html pairs (bug 5487)
16811 !! options
16812 !! wikitext
16813 <center><font id="bug" />Centered text</center>
16814 <div><font id="bug2" />In div text</div>
16815 !! html
16816 <center>&lt;font id="bug" /&gt;Centered text</center>
16817 <div>&lt;font id="bug2" /&gt;In div text</div>
16819 !! end
16825 !! test
16826 Punctuation: nbsp before exclamation
16827 !! wikitext
16828 C'est grave !
16829 !! html
16830 <p>C'est grave&#160;!
16831 </p>
16832 !! end
16834 !! test
16835 Punctuation: CSS !important (bug 11874)
16836 !! wikitext
16837 <div style="width:50% !important">important</div>
16838 !! html
16839 <div style="width:50% !important">important</div>
16841 !!end
16843 !! test
16844 Punctuation: CSS ! important (bug 11874; with space after)
16845 !! wikitext
16846 <div style="width:50% ! important">important</div>
16847 !! html
16848 <div style="width:50% ! important">important</div>
16850 !!end
16852 !! test
16853 HTML bullet list, closed tags (bug 5497)
16854 !! wikitext
16855 <ul>
16856 <li>One</li>
16857 <li>Two</li>
16858 </ul>
16859 !! html/php
16860 <ul>
16861 <li>One</li>
16862 <li>Two</li>
16863 </ul>
16865 !! html/parsoid
16866 <ul data-parsoid='{"stx":"html"}'>
16867 <li data-parsoid='{"stx":"html"}'>One</li>
16868 <li data-parsoid='{"stx":"html"}'>Two</li>
16869 </ul>
16871 !! end
16873 !! test
16874 HTML bullet list, unclosed tags (bug 5497)
16875 !! wikitext
16876 <ul>
16877 <li>One
16878 <li>Two
16879 </ul>
16880 !! html/php+tidy
16881 <ul>
16882 <li>One</li>
16883 <li>Two</li>
16884 </ul>
16885 !! html/parsoid
16886 <ul data-parsoid='{"stx":"html"}'>
16887 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>One</li>
16888 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>Two</li>
16889 </ul>
16891 !! end
16893 !! test
16894 HTML ordered list, closed tags (bug 5497)
16895 !! wikitext
16896 <ol>
16897 <li>One</li>
16898 <li>Two</li>
16899 </ol>
16900 !! html/php
16901 <ol>
16902 <li>One</li>
16903 <li>Two</li>
16904 </ol>
16906 !! html/parsoid
16907 <ol data-parsoid='{"stx":"html"}'>
16908 <li data-parsoid='{"stx":"html"}'>One</li>
16909 <li data-parsoid='{"stx":"html"}'>Two</li>
16910 </ol>
16912 !! end
16914 !! test
16915 HTML ordered list, unclosed tags (bug 5497)
16916 !! options
16917 !! wikitext
16918 <ol>
16919 <li>One
16920 <li>Two
16921 </ol>
16922 !! html/php+tidy
16923 <ol>
16924 <li>One</li>
16925 <li>Two</li>
16926 </ol>
16927 !! html/parsoid
16928 <ol data-parsoid='{"stx":"html"}'>
16929 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>One</li>
16930 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>Two</li>
16931 </ol>
16933 !! end
16935 !! test
16936 HTML nested bullet list, closed tags (bug 5497)
16937 !! wikitext
16938 <ul>
16939 <li>One</li>
16940 <li>Two:
16941 <ul>
16942 <li>Sub-one</li>
16943 <li>Sub-two</li>
16944 </ul>
16945 </li>
16946 </ul>
16947 !! html/php
16948 <ul>
16949 <li>One</li>
16950 <li>Two:
16951 <ul>
16952 <li>Sub-one</li>
16953 <li>Sub-two</li>
16954 </ul>
16955 </li>
16956 </ul>
16958 !! html/parsoid
16959 <ul data-parsoid='{"stx":"html"}'>
16960 <li data-parsoid='{"stx":"html"}'>One</li>
16961 <li data-parsoid='{"stx":"html"}'>Two:
16962 <ul data-parsoid='{"stx":"html"}'>
16963 <li data-parsoid='{"stx":"html"}'>Sub-one</li>
16964 <li data-parsoid='{"stx":"html"}'>Sub-two</li>
16965 </ul>
16966 </li>
16967 </ul>
16968 !! end
16970 !! test
16971 HTML nested bullet list, open tags (bug 5497)
16972 !! wikitext
16973 <ul>
16974 <li>One
16975 <li>Two:
16976 <ul>
16977 <li>Sub-one
16978 <li>Sub-two
16979 </ul>
16980 </ul>
16981 !! html/php+tidy
16982 <ul>
16983 <li>One</li>
16984 <li>Two:
16985 <ul>
16986 <li>Sub-one</li>
16987 <li>Sub-two</li>
16988 </ul>
16989 </li>
16990 </ul>
16991 !! html/parsoid
16992 <ul>
16993 <li>One
16994 </li>
16995 <li>Two:
16996 <ul>
16997 <li>Sub-one
16998 </li>
16999 <li>Sub-two
17000 </li>
17001 </ul>
17002 </li>
17003 </ul>
17005 !! end
17007 !! test
17008 HTML nested ordered list, closed tags (bug 5497)
17009 !! wikitext
17010 <ol>
17011 <li>One</li>
17012 <li>Two:
17013 <ol>
17014 <li>Sub-one</li>
17015 <li>Sub-two</li>
17016 </ol>
17017 </li>
17018 </ol>
17019 !! html
17020 <ol>
17021 <li>One</li>
17022 <li>Two:
17023 <ol>
17024 <li>Sub-one</li>
17025 <li>Sub-two</li>
17026 </ol>
17027 </li>
17028 </ol>
17030 !! end
17032 !! test
17033 HTML nested ordered list, open tags (bug 5497)
17034 !! wikitext
17035 <ol>
17036 <li>One
17037 <li>Two:
17038 <ol>
17039 <li>Sub-one
17040 <li>Sub-two
17041 </ol>
17042 </ol>
17043 !! html/php
17044 <ol>
17045 <li>One
17046 <li>Two:
17047 <ol>
17048 <li>Sub-one
17049 <li>Sub-two
17050 </ol>
17051 </ol>
17053 !! html/parsoid
17054 <ol>
17055 <li>One
17056 </li>
17057 <li>Two:
17058 <ol>
17059 <li>Sub-one
17060 </li>
17061 <li>Sub-two
17062 </li>
17063 </ol>
17064 </li>
17065 </ol>
17067 !! end
17069 !! test
17070 HTML ordered list item with parameters oddity
17071 !! wikitext
17072 <ol><li id="fragment">One</li>
17073 </ol>
17074 !! html
17075 <ol><li id="fragment">One</li>
17076 </ol>
17078 !! end
17080 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
17081 !!test
17082 bug 5918: autonumbering
17083 !! wikitext
17084 [http://first/] [http://second] [ftp://ftp]
17086 ftp://inlineftp
17088 [mailto:enclosed@mail.tld With target]
17090 [mailto:enclosed@mail.tld]
17092 mailto:inline@mail.tld
17093 !! html/php
17094 <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>
17095 </p><p><a rel="nofollow" class="external free" href="ftp://inlineftp">ftp://inlineftp</a>
17096 </p><p><a rel="nofollow" class="external text" href="mailto:enclosed@mail.tld">With target</a>
17097 </p><p><a rel="nofollow" class="external autonumber" href="mailto:enclosed@mail.tld">[4]</a>
17098 </p><p><a rel="nofollow" class="external free" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a>
17099 </p>
17100 !! html/parsoid
17101 <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>
17102 <p><a rel="mw:ExtLink" href="ftp://inlineftp">ftp://inlineftp</a></p>
17103 <p><a rel="mw:ExtLink" href="mailto:enclosed@mail.tld">With target</a></p>
17104 <p><a rel="mw:ExtLink" href="mailto:enclosed@mail.tld"></a></p>
17105 <p><a rel="mw:ExtLink" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a></p>
17106 !! end
17110 # Security and HTML correctness
17111 # From Nick Jenkins' fuzz testing
17114 !! test
17115 Fuzz testing: Parser13
17116 !! wikitext
17117 {| 
17118 | http://a|
17119 !! html
17120 <table>
17121 <tr>
17122 <td>
17123 </td>
17124 </tr>
17125 </table>
17127 !! end
17129 !! test
17130 Fuzz testing: Parser14
17131 !! wikitext
17132 == onmouseover= ==
17133 http://__TOC__
17134 !! html
17135 <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>
17136 http://<div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
17137 <ul>
17138 <li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
17139 </ul>
17140 </div>
17143 !! html+tidy
17144 <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>
17145 <p>http://</p>
17146 <div id="toc" class="toc">
17147 <div id="toctitle">
17148 <h2>Contents</h2>
17149 </div>
17150 <ul>
17151 <li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
17152 </ul>
17153 </div>
17154 <p></p>
17155 !! end
17157 !! test
17158 Fuzz testing: Parser14-table
17159 !! options
17160 parsoid=wt2html,html2html
17161 !! wikitext
17162 ==a==
17163 {| STYLE=__TOC__
17164 !! html
17165 <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>
17166 <table style="&#95;_TOC&#95;_">
17167 <tr><td></td></tr>
17168 </table>
17170 !! html+tidy
17171 <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>
17172 <table style="__TOC__">
17173 <tr>
17174 <td></td>
17175 </tr>
17176 </table>
17177 !! html/parsoid
17178 <h2>a</h2>
17179 <table style="__TOC__"></table>
17180 !! end
17182 # Known to produce bogus xml (extra </td>)
17183 !! test
17184 Fuzz testing: Parser16
17185 !! wikitext
17187 !https://||||||
17188 !! html
17189 <table>
17190 <tr>
17191 <th>https://</th>
17192 <th></th>
17193 <th></th>
17194 <th>
17195 </td>
17196 </tr>
17197 </table>
17199 !! html+tidy
17200 <table>
17201 <tr>
17202 <th>https://</th>
17203 <th></th>
17204 <th></th>
17205 <th></th>
17206 </tr>
17207 </table>
17208 !! end
17210 !! test
17211 Fuzz testing: Parser21
17212 !! wikitext
17214 ! irc://{{ftp://a" onmouseover="alert('hello world');"
17216 !! html
17217 <table>
17218 <tr>
17219 <th> <a rel="nofollow" class="external free" href="irc://{{ftp://a">irc://{{ftp://a</a>" onmouseover="alert('hello world');"
17220 </th>
17221 <td>
17222 </td>
17223 </tr>
17224 </table>
17226 !! end
17228 !! test
17229 Fuzz testing: Parser22
17230 !! wikitext
17231 http://===r:::https://b
17234 !! html
17235 <p><a rel="nofollow" class="external free" href="http://===r:::https://b">http://===r:::https://b</a>
17236 </p>
17237 <table>
17238 <tr><td></td></tr>
17239 </table>
17241 !! end
17243 # Known to produce bad XML for now
17244 !! test
17245 Fuzz testing: Parser24
17246 !! wikitext
17248 {{{|
17249 <u CLASS=
17250 | {{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx--><noinclude>}}}} >
17251 <br style="onmouseover='alert(document.cookie);' " />
17253 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
17255 !! html
17256 <table>
17257 {{{|
17258 <u class="&#124;">}}}} &gt;
17259 <br style="onmouseover=&#39;alert(document.cookie);&#39;" />
17261 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
17262 <tr>
17263 <td></u>
17264 </td>
17265 </tr>
17266 </table>
17268 !! end
17270 # Note: the current result listed for this is not what the original one was,
17271 # but the original bug was JavaScript injection, which is fixed in any case.
17272 # It's not clear that the original result listed was any more correct than the
17273 # current one.  Original result:
17274 # <p>{{{| 
17275 # </p>
17276 # <li class="&#124;&#124;">
17277 # }}}blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
17278 !!test
17279 Fuzz testing: Parser25 (bug 6055)
17280 !! wikitext
17283 <LI CLASS=||
17285 }}}blah" onmouseover="alert('hello world');" align="left"'''MOVE MOUSE CURSOR OVER HERE
17286 !! html
17287 <p>&lt;LI CLASS=blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
17288 </p>
17289 !! end
17291 !!test
17292 Fuzz testing: URL adjacent extension (with space, clean)
17293 !! wikitext
17294 http://example.com <nowiki>junk</nowiki>
17295 !! html/php
17296 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a> junk
17297 </p>
17298 !! html/parsoid
17299 <p><a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a> <span typeof="mw:Nowiki">junk</span></p>
17300 !! end
17302 !!test
17303 Fuzz testing: URL adjacent extension (no space, dirty; nowiki)
17304 !! wikitext
17305 http://example.com<nowiki>junk</nowiki>
17306 !! html/php
17307 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>junk
17308 </p>
17309 !! html/parsoid
17310 <p><a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a><span typeof="mw:Nowiki">junk</span></p>
17311 !! end
17313 !!test
17314 Fuzz testing: URL adjacent extension (no space, dirty; pre)
17315 !! wikitext
17316 http://example.com<pre>junk</pre>
17317 !! html/php
17318 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a><pre>junk</pre>
17320 !! html/php+tidy
17321 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a></p>
17322 <pre>
17323 junk
17324 </pre>
17325 !! html/parsoid
17326 <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>
17327 !!end
17329 !!test
17330 Fuzz testing: image with bogus manual thumbnail
17331 !! wikitext
17332 [[Image:foobar.jpg|thumbnail= ]]
17333 !! html/php
17334 <div class="thumb tright"><div class="thumbinner" style="width:182px;">Error creating thumbnail:   <div class="thumbcaption"></div></div></div>
17336 !! html/parsoid
17337 <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>
17338 !!end
17340 !! test
17341 Fuzz testing: encoded newline in generated HTML replacements (bug 6577)
17342 !! wikitext
17343 <pre dir="&#10;"></pre>
17344 !! html
17345 <pre dir="&#10;"></pre>
17347 !! end
17349 !! test
17350 Parsing optional HTML elements (Bug 6171)
17351 !! options
17352 !! wikitext
17353 <table>
17354   <tr>
17355     <td> Some tabular data</td>
17356     <td> More tabular data ...
17357     <td> And yet som tabular data</td>
17358   </tr>
17359 </table>
17360 !! html
17361 <table>
17362   <tr>
17363     <td> Some tabular data</td>
17364     <td> More tabular data ...
17365     </td><td> And yet som tabular data</td>
17366   </tr>
17367 </table>
17369 !! end
17371 !! test
17372 Correct handling of <td>, <tr> (Bug 6171)
17373 !! options
17374 !! wikitext
17375 <table>
17376   <tr>
17377     <td> Some tabular data</td>
17378     <td> More tabular data ...</td>
17379     <td> And yet som tabular data</td>
17380   </tr>
17381 </table>
17382 !! html
17383 <table>
17384   <tr>
17385     <td> Some tabular data</td>
17386     <td> More tabular data ...</td>
17387     <td> And yet som tabular data</td>
17388   </tr>
17389 </table>
17391 !! end
17394 !! test
17395 Parsing crashing regression (fr:JavaScript)
17396 !! wikitext
17397 </body></x>
17398 !! html
17399 <p>&lt;/body&gt;&lt;/x&gt;
17400 </p>
17401 !! end
17403 !! test
17404 Inline wiki vs wiki block nesting
17405 !! wikitext
17406 '''Bold paragraph
17408 New wiki paragraph
17409 !! html
17410 <p><b>Bold paragraph</b>
17411 </p><p>New wiki paragraph
17412 </p>
17413 !! end
17415 # FIXME: The current php output is documented
17416 # and desired output is the parsoid target.
17417 !! test
17418 Inline HTML vs wiki block nesting
17419 !! wikitext
17420 <b>Bold paragraph
17422 New wiki paragraph
17423 !! html/php
17424 <p><b>Bold paragraph
17425 </p><p>New wiki paragraph</b>
17426 </p>
17427 !! html/parsoid
17428 <p><b>Bold paragraph</b>
17429 </p><p>New wiki paragraph
17430 </p>
17431 !! end
17433 # Original result was this:
17434 # <p><b>bold</b><b>bold<i>bolditalics</i></b>
17435 # </p>
17436 # While that might be marginally more intuitive, maybe, the six-apostrophe
17437 # construct is clearly pathological and the result stated here (which is what
17438 # the parser actually does) is about as reasonable as anything.
17439 !!test
17440 Mixing markup for italics and bold
17441 !! options
17442 !! wikitext
17443 '''bold''''''bold''bolditalics'''''
17444 !! html
17445 <p>'<i>bold'</i><b>bold<i>bolditalics</i></b>
17446 </p>
17447 !! end
17450 !! article
17451 Xyzzyx
17452 !! text
17453 Article for special page transclusion test
17454 !! endarticle
17456 !! test
17457 Special page transclusion
17458 !! options
17459 !! wikitext
17460 {{Special:Prefixindex/Xyzzyx}}
17461 !! html
17462 <ul class="mw-prefixindex-list"><li><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></li>
17463 </ul>
17465 !! end
17467 !! test
17468 Special page transclusion twice (bug 5021)
17469 !! options
17470 !! wikitext
17471 {{Special:Prefixindex/Xyzzyx}}
17472 {{Special:Prefixindex/Xyzzyx}}
17473 !! html
17474 <ul class="mw-prefixindex-list"><li><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></li>
17475 </ul>
17476 <ul class="mw-prefixindex-list"><li><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></li>
17477 </ul>
17479 !! end
17481 !! test
17482 Transclusion of default MediaWiki message
17483 !! wikitext
17484 {{MediaWiki:Mainpage}}
17485 !! html
17486 <p>Main Page
17487 </p>
17488 !! end
17490 !! test
17491 Transclusion of nonexistent MediaWiki message
17492 !! wikitext
17493 {{MediaWiki:Mainpagexxx}}
17494 !! html
17495 <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>
17496 </p>
17497 !! end
17499 !! test
17500 Transclusion of MediaWiki message with underscore
17501 !! wikitext
17502 {{MediaWiki:history_short}}
17503 !! html
17504 <p>History
17505 </p>
17506 !! end
17508 !! test
17509 Transclusion of MediaWiki message with space
17510 !! wikitext
17511 {{MediaWiki:history short}}
17512 !! html
17513 <p>History
17514 </p>
17515 !! end
17517 !! test
17518 Invalid header with following text
17519 !! wikitext
17520 = x = y
17521 !! html
17522 <p>= x = y
17523 </p>
17524 !! end
17527 !! test
17528 Section extraction test (section 0)
17529 !! options
17530 section=0
17531 !! wikitext
17532 start
17533 ==a==
17534 ===aa===
17535 ====aaa====
17536 ==b==
17537 ===ba===
17538 ===bb===
17539 ====bba====
17540 ===bc===
17541 ==c==
17542 ===ca===
17543 !! html/php
17544 start
17545 !! end
17547 !! test
17548 Section extraction test (section 1)
17549 !! options
17550 section=1
17551 !! wikitext
17552 start
17553 ==a==
17554 ===aa===
17555 ====aaa====
17556 ==b==
17557 ===ba===
17558 ===bb===
17559 ====bba====
17560 ===bc===
17561 ==c==
17562 ===ca===
17563 !! html/php
17564 ==a==
17565 ===aa===
17566 ====aaa====
17567 !! end
17569 !! test
17570 Section extraction test (section 2)
17571 !! options
17572 section=2
17573 !! wikitext
17574 start
17575 ==a==
17576 ===aa===
17577 ====aaa====
17578 ==b==
17579 ===ba===
17580 ===bb===
17581 ====bba====
17582 ===bc===
17583 ==c==
17584 ===ca===
17585 !! html/php
17586 ===aa===
17587 ====aaa====
17588 !! end
17590 !! test
17591 Section extraction test (section 3)
17592 !! options
17593 section=3
17594 !! wikitext
17595 start
17596 ==a==
17597 ===aa===
17598 ====aaa====
17599 ==b==
17600 ===ba===
17601 ===bb===
17602 ====bba====
17603 ===bc===
17604 ==c==
17605 ===ca===
17606 !! html/php
17607 ====aaa====
17608 !! end
17610 !! test
17611 Section extraction test (section 4)
17612 !! options
17613 section=4
17614 !! wikitext
17615 start
17616 ==a==
17617 ===aa===
17618 ====aaa====
17619 ==b==
17620 ===ba===
17621 ===bb===
17622 ====bba====
17623 ===bc===
17624 ==c==
17625 ===ca===
17626 !! html/php
17627 ==b==
17628 ===ba===
17629 ===bb===
17630 ====bba====
17631 ===bc===
17632 !! end
17634 !! test
17635 Section extraction test (section 5)
17636 !! options
17637 section=5
17638 !! wikitext
17639 start
17640 ==a==
17641 ===aa===
17642 ====aaa====
17643 ==b==
17644 ===ba===
17645 ===bb===
17646 ====bba====
17647 ===bc===
17648 ==c==
17649 ===ca===
17650 !! html/php
17651 ===ba===
17652 !! end
17654 !! test
17655 Section extraction test (section 6)
17656 !! options
17657 section=6
17658 !! wikitext
17659 start
17660 ==a==
17661 ===aa===
17662 ====aaa====
17663 ==b==
17664 ===ba===
17665 ===bb===
17666 ====bba====
17667 ===bc===
17668 ==c==
17669 ===ca===
17670 !! html/php
17671 ===bb===
17672 ====bba====
17673 !! end
17675 !! test
17676 Section extraction test (section 7)
17677 !! options
17678 section=7
17679 !! wikitext
17680 start
17681 ==a==
17682 ===aa===
17683 ====aaa====
17684 ==b==
17685 ===ba===
17686 ===bb===
17687 ====bba====
17688 ===bc===
17689 ==c==
17690 ===ca===
17691 !! html/php
17692 ====bba====
17693 !! end
17695 !! test
17696 Section extraction test (section 8)
17697 !! options
17698 section=8
17699 !! wikitext
17700 start
17701 ==a==
17702 ===aa===
17703 ====aaa====
17704 ==b==
17705 ===ba===
17706 ===bb===
17707 ====bba====
17708 ===bc===
17709 ==c==
17710 ===ca===
17711 !! html/php
17712 ===bc===
17713 !! end
17715 !! test
17716 Section extraction test (section 9)
17717 !! options
17718 section=9
17719 !! wikitext
17720 start
17721 ==a==
17722 ===aa===
17723 ====aaa====
17724 ==b==
17725 ===ba===
17726 ===bb===
17727 ====bba====
17728 ===bc===
17729 ==c==
17730 ===ca===
17731 !! html/php
17732 ==c==
17733 ===ca===
17734 !! end
17736 !! test
17737 Section extraction test (section 10)
17738 !! options
17739 section=10
17740 !! wikitext
17741 start
17742 ==a==
17743 ===aa===
17744 ====aaa====
17745 ==b==
17746 ===ba===
17747 ===bb===
17748 ====bba====
17749 ===bc===
17750 ==c==
17751 ===ca===
17752 !! html/php
17753 ===ca===
17754 !! end
17756 !! test
17757 Section extraction test (nonexistent section 11)
17758 !! options
17759 section=11
17760 !! wikitext
17761 start
17762 ==a==
17763 ===aa===
17764 ====aaa====
17765 ==b==
17766 ===ba===
17767 ===bb===
17768 ====bba====
17769 ===bc===
17770 ==c==
17771 ===ca===
17772 !! html/php
17773 !! end
17775 !! test
17776 Section extraction test with bogus heading (section 1)
17777 !! options
17778 section=1
17779 !! wikitext
17780 ==a==
17781 ==bogus== not a legal section
17782 ==b==
17783 !! html/php
17784 ==a==
17785 ==bogus== not a legal section
17786 !! end
17788 !! test
17789 Section extraction test with bogus heading (section 2)
17790 !! options
17791 section=2
17792 !! wikitext
17793 ==a==
17794 ==bogus== not a legal section
17795 ==b==
17796 !! html/php
17797 ==b==
17798 !! end
17800 !! test
17801 Section extraction test with comment after heading (section 1)
17802 !! options
17803 section=1
17804 !! wikitext
17805 ==a==
17806 ==b== <!-- -->
17807 ==c==
17808 !! html/php
17809 ==a==
17810 !! end
17812 !! test
17813 Section extraction test with comment after heading (section 2)
17814 !! options
17815 section=2
17816 !! wikitext
17817 ==a==
17818 ==b== <!-- -->
17819 ==c==
17820 !! html/php
17821 ==b== <!-- -->
17822 !! end
17824 !! test
17825 Section extraction test with bogus <nowiki> heading (section 1)
17826 !! options
17827 section=1
17828 !! wikitext
17829 ==a==
17830 ==bogus== <nowiki>not a legal section</nowiki>
17831 ==b==
17832 !! html/php
17833 ==a==
17834 ==bogus== <nowiki>not a legal section</nowiki>
17835 !! end
17837 !! test
17838 Section extraction test with bogus <nowiki> heading (section 2)
17839 !! options
17840 section=2
17841 !! wikitext
17842 ==a==
17843 ==bogus== <nowiki>not a legal section</nowiki>
17844 ==b==
17845 !! html/php
17846 ==b==
17847 !! end
17849 # Formerly testing for bug 2587, now resolved by the use of unmarked sections
17850 # instead of respecting commented sections
17851 !! test
17852 Section extraction prefixed by comment (section 1)
17853 !! options
17854 section=1
17855 !! wikitext
17856 <!-- -->==sec1==
17857 ==sec2==
17858 !! html/php
17859 ==sec2==
17860 !!end
17862 !! test
17863 Section extraction prefixed by comment (section 2)
17864 !! options
17865 section=2
17866 !! wikitext
17867 <!-- -->==sec1==
17868 ==sec2==
17869 !! html/php
17871 !!end
17873 # Formerly testing for bug 2607, now resolved by the use of unmarked sections
17874 # instead of respecting HTML-style headings
17875 !! test
17876 Section extraction, mixed wiki and html (section 1)
17877 !! options
17878 section=1
17879 !! wikitext
17880 <h2>unmarked</h2>
17881 unmarked
17882 ==1==
17884 ==2==
17886 !! html/php
17887 ==1==
17889 !! end
17891 !! test
17892 Section extraction, mixed wiki and html (section 2)
17893 !! options
17894 section=2
17895 !! wikitext
17896 <h2>unmarked</h2>
17897 unmarked
17898 ==1==
17900 ==2==
17902 !! html/php
17903 ==2==
17905 !! end
17908 # Formerly testing for bug 3342
17909 !! test
17910 Section extraction, heading surrounded by <noinclude>
17911 !! options
17912 section=1
17913 !! wikitext
17914 <noinclude>==unmarked==</noinclude>
17915 ==marked==
17916 !! html/php
17917 ==marked==
17918 !!end
17920 # Test behavior of bug 19910
17921 !! test
17922 Sectiion with all-equals
17923 !! options
17924 section=2
17925 !! wikitext
17926 === 
17927 The line above must have a trailing space
17928 === <!--
17929 --> <!-- -->
17930 But just in case it doesn't...
17931 !! html/php
17932 === <!--
17933 --> <!-- -->
17934 But just in case it doesn't...
17935 !! end
17937 !! test
17938 Section replacement test (section 0)
17939 !! options
17940 replace=0,"xxx"
17941 !! wikitext
17942 start
17943 ==a==
17944 ===aa===
17945 ====aaa====
17946 ==b==
17947 ===ba===
17948 ===bb===
17949 ====bba====
17950 ===bc===
17951 ==c==
17952 ===ca===
17953 !! html/php
17956 ==a==
17957 ===aa===
17958 ====aaa====
17959 ==b==
17960 ===ba===
17961 ===bb===
17962 ====bba====
17963 ===bc===
17964 ==c==
17965 ===ca===
17966 !! end
17968 !! test
17969 Section replacement test (section 1)
17970 !! options
17971 replace=1,"xxx"
17972 !! wikitext
17973 start
17974 ==a==
17975 ===aa===
17976 ====aaa====
17977 ==b==
17978 ===ba===
17979 ===bb===
17980 ====bba====
17981 ===bc===
17982 ==c==
17983 ===ca===
17984 !! html/php
17985 start
17988 ==b==
17989 ===ba===
17990 ===bb===
17991 ====bba====
17992 ===bc===
17993 ==c==
17994 ===ca===
17995 !! end
17997 !! test
17998 Section replacement test (section 2)
17999 !! options
18000 replace=2,"xxx"
18001 !! wikitext
18002 start
18003 ==a==
18004 ===aa===
18005 ====aaa====
18006 ==b==
18007 ===ba===
18008 ===bb===
18009 ====bba====
18010 ===bc===
18011 ==c==
18012 ===ca===
18013 !! html/php
18014 start
18015 ==a==
18018 ==b==
18019 ===ba===
18020 ===bb===
18021 ====bba====
18022 ===bc===
18023 ==c==
18024 ===ca===
18025 !! end
18027 !! test
18028 Section replacement test (section 3)
18029 !! options
18030 replace=3,"xxx"
18031 !! wikitext
18032 start
18033 ==a==
18034 ===aa===
18035 ====aaa====
18036 ==b==
18037 ===ba===
18038 ===bb===
18039 ====bba====
18040 ===bc===
18041 ==c==
18042 ===ca===
18043 !! html/php
18044 start
18045 ==a==
18046 ===aa===
18049 ==b==
18050 ===ba===
18051 ===bb===
18052 ====bba====
18053 ===bc===
18054 ==c==
18055 ===ca===
18056 !! end
18058 !! test
18059 Section replacement test (section 4)
18060 !! options
18061 replace=4,"xxx"
18062 !! wikitext
18063 start
18064 ==a==
18065 ===aa===
18066 ====aaa====
18067 ==b==
18068 ===ba===
18069 ===bb===
18070 ====bba====
18071 ===bc===
18072 ==c==
18073 ===ca===
18074 !! html/php
18075 start
18076 ==a==
18077 ===aa===
18078 ====aaa====
18081 ==c==
18082 ===ca===
18083 !! end
18085 !! test
18086 Section replacement test (section 5)
18087 !! options
18088 replace=5,"xxx"
18089 !! wikitext
18090 start
18091 ==a==
18092 ===aa===
18093 ====aaa====
18094 ==b==
18095 ===ba===
18096 ===bb===
18097 ====bba====
18098 ===bc===
18099 ==c==
18100 ===ca===
18101 !! html/php
18102 start
18103 ==a==
18104 ===aa===
18105 ====aaa====
18106 ==b==
18109 ===bb===
18110 ====bba====
18111 ===bc===
18112 ==c==
18113 ===ca===
18114 !! end
18116 !! test
18117 Section replacement test (section 6)
18118 !! options
18119 replace=6,"xxx"
18120 !! wikitext
18121 start
18122 ==a==
18123 ===aa===
18124 ====aaa====
18125 ==b==
18126 ===ba===
18127 ===bb===
18128 ====bba====
18129 ===bc===
18130 ==c==
18131 ===ca===
18132 !! html/php
18133 start
18134 ==a==
18135 ===aa===
18136 ====aaa====
18137 ==b==
18138 ===ba===
18141 ===bc===
18142 ==c==
18143 ===ca===
18144 !! end
18146 !! test
18147 Section replacement test (section 7)
18148 !! options
18149 replace=7,"xxx"
18150 !! wikitext
18151 start
18152 ==a==
18153 ===aa===
18154 ====aaa====
18155 ==b==
18156 ===ba===
18157 ===bb===
18158 ====bba====
18159 ===bc===
18160 ==c==
18161 ===ca===
18162 !! html/php
18163 start
18164 ==a==
18165 ===aa===
18166 ====aaa====
18167 ==b==
18168 ===ba===
18169 ===bb===
18172 ===bc===
18173 ==c==
18174 ===ca===
18175 !! end
18177 !! test
18178 Section replacement test (section 8)
18179 !! options
18180 replace=8,"xxx"
18181 !! wikitext
18182 start
18183 ==a==
18184 ===aa===
18185 ====aaa====
18186 ==b==
18187 ===ba===
18188 ===bb===
18189 ====bba====
18190 ===bc===
18191 ==c==
18192 ===ca===
18193 !! html/php
18194 start
18195 ==a==
18196 ===aa===
18197 ====aaa====
18198 ==b==
18199 ===ba===
18200 ===bb===
18201 ====bba====
18204 ==c==
18205 ===ca===
18206 !!end
18208 !! test
18209 Section replacement test (section 9)
18210 !! options
18211 replace=9,"xxx"
18212 !! wikitext
18213 start
18214 ==a==
18215 ===aa===
18216 ====aaa====
18217 ==b==
18218 ===ba===
18219 ===bb===
18220 ====bba====
18221 ===bc===
18222 ==c==
18223 ===ca===
18224 !! html/php
18225 start
18226 ==a==
18227 ===aa===
18228 ====aaa====
18229 ==b==
18230 ===ba===
18231 ===bb===
18232 ====bba====
18233 ===bc===
18235 !! end
18237 !! test
18238 Section replacement test (section 10)
18239 !! options
18240 replace=10,"xxx"
18241 !! wikitext
18242 start
18243 ==a==
18244 ===aa===
18245 ====aaa====
18246 ==b==
18247 ===ba===
18248 ===bb===
18249 ====bba====
18250 ===bc===
18251 ==c==
18252 ===ca===
18253 !! html/php
18254 start
18255 ==a==
18256 ===aa===
18257 ====aaa====
18258 ==b==
18259 ===ba===
18260 ===bb===
18261 ====bba====
18262 ===bc===
18263 ==c==
18265 !! end
18267 !! test
18268 Section replacement test with initial whitespace (bug 13728)
18269 !! options
18270 replace=2,"xxx"
18271 !! wikitext
18272  Preformatted initial line
18273 ==a==
18274 ===a===
18275 !! html/php
18276  Preformatted initial line
18277 ==a==
18279 !! end
18282 !! test
18283 Section extraction, heading followed by pre with 20 spaces (bug 6398)
18284 !! options
18285 section=1
18286 !! wikitext
18287 ==a==
18288                     a
18289 !! html/php
18290 ==a==
18291                     a
18292 !! end
18294 !! test
18295 Section extraction, heading followed by pre with 19 spaces (bug 6398 sanity check)
18296 !! options
18297 section=1
18298 !! wikitext
18299 ==a==
18300                    a
18301 !! html/php
18302 ==a==
18303                    a
18304 !! end
18307 !! test
18308 Section extraction, <pre> around bogus header (bug 10309)
18309 !! options
18310 section=2
18311 !! wikitext
18312 == Section One ==
18313 <pre>
18314 =======
18315 </pre>
18317 == Section Two ==
18318 stuff
18319 !! html/php
18320 == Section Two ==
18321 stuff
18322 !! end
18324 !! test
18325 Section replacement, <pre> around bogus header (bug 10309)
18326 !! options
18327 replace=2,"xxx"
18328 !! wikitext
18329 == Section One ==
18330 <pre>
18331 =======
18332 </pre>
18334 == Section Two ==
18335 stuff
18336 !! html/php
18337 == Section One ==
18338 <pre>
18339 =======
18340 </pre>
18343 !! end
18346 !! test
18347 Handling of &#x0A; in URLs
18348 !! wikitext
18349 ** irc://&#x0A;a
18350 !! html/php
18351 <ul><li><ul><li> <a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a></li></ul></li></ul>
18353 !! html/parsoid
18354 <ul><li><ul><li> <a rel="mw:ExtLink" href="irc://
18355 a">irc://
18356 a</a></li></ul></li></ul>
18357 !! end
18359 !! test
18360 Handling of %0A in URLs
18361 !! wikitext
18362 ** irc://%0Aa
18363 !! html/php
18364 <ul><li><ul><li> <a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a></li></ul></li></ul>
18366 !! html/parsoid
18367 <ul><li><ul><li> <a rel="mw:ExtLink" href="irc://%0Aa">irc://%0Aa</a></li></ul></li></ul>
18368 !! end
18371 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
18372 !! test
18373 5 quotes, code coverage +1 line
18374 !! options
18375 parsoid=wt2html
18376 !! wikitext
18377 '''''
18378 !! html/php
18379 !! html/parsoid
18380 <p><b><i></i></b></p>
18381 !! end
18383 # same html as previous, but wikitext adjusted to match parsoid html2wt
18384 # note that wt2html and html2html will put the <i> before the <b>
18385 !! test
18386 5 quotes, code coverage +1 line w/ nowiki (1)
18387 !! options
18388 parsoid=wt2wt,html2wt
18389 !! wikitext
18390 '''''<nowiki/>'''''
18391 !! html/php
18392 <p><i></i>
18393 </p>
18394 !! html/parsoid
18395 <p><b><i></i></b></p>
18396 !! end
18398 # same as previous, just swapping the <i> and <b>
18399 !! test
18400 5 quotes, code coverage +1 line w/ nowiki (2)
18401 !! wikitext
18402 '''''<nowiki/>'''''
18403 !! html/php
18404 <p><i></i>
18405 </p>
18406 !! html/parsoid
18407 <p><i><b></b></i></p>
18408 !! end
18410 !! test
18411 Special:Search page linking.
18412 !! wikitext
18413 {{Special:search}}
18414 !! html
18415 <p><a href="/wiki/Special:Search" title="Special:Search">Special:Search</a>
18416 </p>
18417 !! end
18419 !! test
18420 {{!}} is a magic word
18421 !! wikitext
18422 {{!}} is a magic word there and {{!}} is still a magic word here
18423 | is not a magic word here but {{!}} is still a magic word here
18424 !! html/php
18425 <p>| is a magic word there and | is still a magic word here
18426 | is not a magic word here but | is still a magic word here
18427 </p>
18428 !! html/parsoid
18429 <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
18430 | 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>
18432 !! end
18434 !! test
18435 Say the magic word
18436 !! options
18437 title=[[Parser test]]
18438 !! wikitext
18439 * {{PAGENAME}}
18440 * {{PAGENAMEE}}
18441 * {{FULLPAGENAME}}
18442 * {{FULLPAGENAMEE}}
18443 * {{BASEPAGENAME}}
18444 * {{BASEPAGENAMEE}}
18445 * {{SUBPAGENAME}}
18446 * {{SUBPAGENAMEE}}
18447 * {{ROOTPAGENAME}}
18448 * {{ROOTPAGENAMEE}}
18449 * {{TALKPAGENAME}}
18450 * {{TALKPAGENAMEE}}
18451 * {{SUBJECTPAGENAME}}
18452 * {{SUBJECTPAGENAMEE}}
18453 * {{NAMESPACEE}}
18454 * {{NAMESPACE}}
18455 * {{NAMESPACENUMBER}}
18456 * {{TALKSPACE}}
18457 * {{TALKSPACEE}}
18458 * {{SUBJECTSPACE}}
18459 * {{SUBJECTSPACEE}}
18460 * {{Dynamic|{{NUMBEROFUSERS}}|{{NUMBEROFPAGES}}|{{CURRENTVERSION}}|{{CONTENTLANGUAGE}}|{{DIRECTIONMARK}}|{{CURRENTTIMESTAMP}}|{{NUMBEROFARTICLES}}}}
18461 !! html
18462 <ul><li> Parser test</li>
18463 <li> Parser_test</li>
18464 <li> Parser test</li>
18465 <li> Parser_test</li>
18466 <li> Parser test</li>
18467 <li> Parser_test</li>
18468 <li> Parser test</li>
18469 <li> Parser_test</li>
18470 <li> Parser test</li>
18471 <li> Parser_test</li>
18472 <li> Talk:Parser test</li>
18473 <li> Talk:Parser_test</li>
18474 <li> Parser test</li>
18475 <li> Parser_test</li>
18476 <li> </li>
18477 <li> </li>
18478 <li> 0</li>
18479 <li> Talk</li>
18480 <li> Talk</li>
18481 <li> </li>
18482 <li> </li>
18483 <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>
18485 !! end
18486 ### Note: Above tests excludes the "{{NUMBEROFADMINS}}" magic word because it generates a MySQL error when included.
18488 !! test
18489 Gallery
18490 !! wikitext
18491 <gallery>
18492 image1.png |
18493 image2.gif|||||
18495 image3|
18496 image4    |300px| centre
18497  image5.svg| http://///////
18498 [[x|xx]]]]
18499 * image6
18500 </gallery>
18501 !! html
18502 <ul class="gallery mw-gallery-traditional">
18503                 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18504                         <div class="thumb" style="height: 150px;">Image1.png</div>
18505                         <div class="gallerytext">
18506                         </div>
18507                 </div></li>
18508                 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18509                         <div class="thumb" style="height: 150px;">Image2.gif</div>
18510                         <div class="gallerytext">
18511                         </div>
18512                 </div></li>
18513                 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18514                         <div class="thumb" style="height: 150px;">Image3</div>
18515                         <div class="gallerytext">
18516                         </div>
18517                 </div></li>
18518                 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18519                         <div class="thumb" style="height: 150px;">Image4</div>
18520                         <div class="gallerytext">
18521 <pre>centre
18522 </pre>
18523                         </div>
18524                 </div></li>
18525                 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18526                         <div class="thumb" style="height: 150px;">Image5.svg</div>
18527                         <div class="gallerytext">
18528 <p><a rel="nofollow" class="external free" href="http://///////">http://///////</a>
18529 </p>
18530                         </div>
18531                 </div></li>
18532                 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18533                         <div class="thumb" style="height: 150px;">* image6</div>
18534                         <div class="gallerytext">
18535                         </div>
18536                 </div></li>
18537 </ul>
18539 !! end
18541 !! test
18542 Gallery (with options)
18543 !! wikitext
18544 <gallery widths='70px' heights='40px' perrow='2' caption='Foo [[Main Page]]' >
18545 File:Nonexistent.jpg|caption
18546 File:Nonexistent.jpg
18547 image:foobar.jpg|some '''caption''' [[Main Page]]
18548 image:foobar.jpg
18549 image:foobar.jpg|Blabla|alt=This is a foo-bar.|blabla.
18550 </gallery>
18551 !! html
18552 <ul class="gallery mw-gallery-traditional" style="max-width: 226px;_width: 226px;">
18553         <li class='gallerycaption'>Foo <a href="/wiki/Main_Page" title="Main Page">Main Page</a></li>
18554                 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
18555                         <div class="thumb" style="height: 70px;">Nonexistent.jpg</div>
18556                         <div class="gallerytext">
18557 <p>caption
18558 </p>
18559                         </div>
18560                 </div></li>
18561                 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
18562                         <div class="thumb" style="height: 70px;">Nonexistent.jpg</div>
18563                         <div class="gallerytext">
18564                         </div>
18565                 </div></li>
18566                 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
18567                         <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>
18568                         <div class="gallerytext">
18569 <p>some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
18570 </p>
18571                         </div>
18572                 </div></li>
18573                 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
18574                         <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>
18575                         <div class="gallerytext">
18576                         </div>
18577                 </div></li>
18578                 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
18579                         <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>
18580                         <div class="gallerytext">
18581 <p>blabla.
18582 </p>
18583                         </div>
18584                 </div></li>
18585 </ul>
18587 !! end
18589 !! test
18590 Gallery with link that has fragment
18591 !! wikitext
18592 <gallery>
18593 image:foobar.jpg|link=Main_Page
18594 image:foobar.jpg|link=Main_Page#section
18595 image:foobar.jpg|link=Main Page#section|caption
18596 </gallery>
18597 !! html
18598 <ul class="gallery mw-gallery-traditional">
18599                 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18600                         <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>
18601                         <div class="gallerytext">
18602                         </div>
18603                 </div></li>
18604                 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18605                         <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>
18606                         <div class="gallerytext">
18607                         </div>
18608                 </div></li>
18609                 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18610                         <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>
18611                         <div class="gallerytext">
18612 <p>caption
18613 </p>
18614                         </div>
18615                 </div></li>
18616 </ul>
18618 !! end
18620 !! test
18621 Gallery with wikitext inside caption
18622 !! wikitext
18623 <gallery>
18624 File:foobar.jpg|[[File:foobar.jpg|20px|desc|alt=inneralt]]|alt=galleryalt
18625 File:foobar.jpg|{{Test|unamedParam|alt=param}}|alt=galleryalt
18626 </gallery>
18627 !! html
18628 <ul class="gallery mw-gallery-traditional">
18629                 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18630                         <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>
18631                         <div class="gallerytext">
18632 <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>
18633 </p>
18634                         </div>
18635                 </div></li>
18636                 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18637                         <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>
18638                         <div class="gallerytext">
18639 <p>This is a test template
18640 </p>
18641                         </div>
18642                 </div></li>
18643 </ul>
18645 !! end
18647 !! test
18648 gallery (with showfilename option)
18649 !! wikitext
18650 <gallery showfilename>
18651 File:Nonexistent.jpg|caption
18652 File:Nonexistent.jpg
18653 image:foobar.jpg|some '''caption''' [[Main Page]]
18654 File:Foobar.jpg
18655 </gallery>
18656 !! html
18657 <ul class="gallery mw-gallery-traditional">
18658                 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18659                         <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
18660                         <div class="gallerytext">
18661 <p><a href="/wiki/File:Nonexistent.jpg" title="File:Nonexistent.jpg">Nonexistent.jpg</a><br />
18662 caption
18663 </p>
18664                         </div>
18665                 </div></li>
18666                 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18667                         <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
18668                         <div class="gallerytext">
18669 <p><a href="/wiki/File:Nonexistent.jpg" title="File:Nonexistent.jpg">Nonexistent.jpg</a><br />
18670 </p>
18671                         </div>
18672                 </div></li>
18673                 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18674                         <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>
18675                         <div class="gallerytext">
18676 <p><a href="/wiki/File:Foobar.jpg" title="File:Foobar.jpg">Foobar.jpg</a><br />
18677 some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
18678 </p>
18679                         </div>
18680                 </div></li>
18681                 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18682                         <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>
18683                         <div class="gallerytext">
18684 <p><a href="/wiki/File:Foobar.jpg" title="File:Foobar.jpg">Foobar.jpg</a><br />
18685 </p>
18686                         </div>
18687                 </div></li>
18688 </ul>
18690 !! end
18692 !! test
18693 Gallery (with namespace-less filenames)
18694 !! wikitext
18695 <gallery>
18696 File:Nonexistent.jpg
18697 Nonexistent.jpg
18698 image:foobar.jpg
18699 foobar.jpg
18700 </gallery>
18701 !! html
18702 <ul class="gallery mw-gallery-traditional">
18703                 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18704                         <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
18705                         <div class="gallerytext">
18706                         </div>
18707                 </div></li>
18708                 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18709                         <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
18710                         <div class="gallerytext">
18711                         </div>
18712                 </div></li>
18713                 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18714                         <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>
18715                         <div class="gallerytext">
18716                         </div>
18717                 </div></li>
18718                 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18719                         <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>
18720                         <div class="gallerytext">
18721                         </div>
18722                 </div></li>
18723 </ul>
18725 !! end
18727 !! test
18728 HTML Hex character encoding (spells the word "JavaScript")
18729 !! options
18730 parsoid=wt2html,wt2wt,html2html
18731 !! wikitext
18732 &#x4A;&#x061;&#x0076;&#x00061;&#x000053;&#x0000063;&#114;&#x0000069;&#00000112;&#x0000000074;
18733 !! html/php
18734 <p>&#x4a;&#x61;&#x76;&#x61;&#x53;&#x63;&#114;&#x69;&#112;&#x74;
18735 </p>
18736 !! html/php+tidy
18737 <p>JavaScript</p>
18738 !! html/parsoid
18739 <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>
18740 !! end
18742 !! test
18743 HTML Hex character encoding bogus encoding (bug 26437 regression check)
18744 !! wikitext
18745 &#xsee;&#XSEE;
18746 !! html/php
18747 <p>&amp;#xsee;&amp;#XSEE;
18748 </p>
18749 !! html/parsoid
18750 <p>&amp;#xsee;&amp;#XSEE;</p>
18751 !! end
18753 !! test
18754 HTML Hex character encoding mixed case
18755 !! options
18756 parsoid=wt2html,wt2wt,html2html
18757 !! wikitext
18758 &#xEE;&#Xee;
18759 !! html/php
18760 <p>&#xee;&#xee;
18761 </p>
18762 !! html/php+tidy
18763 <p>îî</p>
18764 !! html/parsoid
18765 <p><span typeof="mw:Entity">î</span><span typeof="mw:Entity">î</span></p>
18766 !! end
18768 # See: http://www.w3.org/TR/html5/syntax.html#character-references
18769 # Note that U+000C (form feed) is not a valid XML character, so
18770 # it is banned even though allowed in HTML5.
18771 !! test
18772 Illegal character references (T106578)
18773 !! wikitext
18774 ; Null: &#00;
18775 ; FF: &#xC;
18776 ; CR: &#xD;
18777 ; Control (low): &#8;
18778 ; Control (high): &#x7F; &#x9F;
18779 ; Surrogate: &#xD83D;&#xDCA9;
18780 ; This is an okay astral character: &#x1F4A9;
18781 !! html+tidy
18782 <dl>
18783 <dt>Null</dt>
18784 <dd>&amp;#00;</dd>
18785 <dt>FF</dt>
18786 <dd>&amp;#xC;</dd>
18787 <dt>CR</dt>
18788 <dd>&amp;#xD;</dd>
18789 <dt>Control (low)</dt>
18790 <dd>&amp;#8;</dd>
18791 <dt>Control (high)</dt>
18792 <dd>&amp;#x7F; &amp;#x9F;</dd>
18793 <dt>Surrogate</dt>
18794 <dd>&amp;#xD83D;&amp;#xDCA9;</dd>
18795 <dt>This is an okay astral character</dt>
18796 <dd>💩</dd>
18797 </dl>
18798 !! end
18800 !! test
18801 __FORCETOC__ override
18802 !! wikitext
18803 __NEWSECTIONLINK__
18804 __FORCETOC__
18805 !! html/php
18806 <p><br />
18807 </p>
18808 !! end
18810 !! test
18811 ISBN code coverage
18812 !! wikitext
18813 ISBN  978-0-1234-56&#x20;789
18814 !! html
18815 <p><a href="/wiki/Special:BookSources/9780123456" class="internal mw-magiclink-isbn">ISBN 978-0-1234-56</a>&#x20;789
18816 </p>
18817 !! html+tidy
18818 <p><a href="/wiki/Special:BookSources/9780123456" class="internal mw-magiclink-isbn">ISBN 978-0-1234-56</a> 789</p>
18819 !! html/parsoid
18820 <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>
18821 !! end
18823 !! test
18824 ISBN followed by 5 spaces
18825 !! wikitext
18826 ISBN    
18827 !! html
18828 <p>ISBN    
18829 </p>
18830 !! end
18832 !! test
18833 Double ISBN
18834 !! wikitext
18835 ISBN ISBN 1234567890
18836 !! html/php
18837 <p>ISBN <a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
18838 </p>
18839 !! html/parsoid
18840 <p>ISBN <a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a></p>
18841 !! end
18843 # Uppercase X and lowercase x as well
18844 !! test
18845 ISBN with an X
18846 !! wikitext
18847 ISBN 3-462-04561-X
18848 ISBN 3-462-04561-x
18849 ISBN 080442957X
18850 ISBN 080442957x
18851 ISBN 978080442957X
18852 ISBN 978080442957x
18853 !! html/php
18854 <p><a href="/wiki/Special:BookSources/346204561X" class="internal mw-magiclink-isbn">ISBN 3-462-04561-X</a>
18855 <a href="/wiki/Special:BookSources/346204561X" class="internal mw-magiclink-isbn">ISBN 3-462-04561-x</a>
18856 <a href="/wiki/Special:BookSources/080442957X" class="internal mw-magiclink-isbn">ISBN 080442957X</a>
18857 <a href="/wiki/Special:BookSources/080442957X" class="internal mw-magiclink-isbn">ISBN 080442957x</a>
18858 <a href="/wiki/Special:BookSources/978080442957X" class="internal mw-magiclink-isbn">ISBN 978080442957X</a>
18859 <a href="/wiki/Special:BookSources/978080442957X" class="internal mw-magiclink-isbn">ISBN 978080442957x</a>
18860 </p>
18861 !! html/parsoid
18862 <p><a href="./Special:BookSources/346204561X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 3-462-04561-X</a>
18863 <a href="./Special:BookSources/346204561X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 3-462-04561-x</a>
18864 <a href="./Special:BookSources/080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 080442957X</a>
18865 <a href="./Special:BookSources/080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 080442957x</a>
18866 <a href="./Special:BookSources/978080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 978080442957X</a>
18867 <a href="./Special:BookSources/978080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 978080442957x</a></p>
18868 !! end
18870 !! test
18871 ISBN with empty prefix (parsoid test)
18872 !! wikitext
18873 ISBN 1234567890
18874 !! html/php
18875 <p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
18876 </p>
18877 !! html/parsoid
18878 <p><a href="./Special:BookSources/1234567890" rel="mw:WikiLink">ISBN 1234567890</a></p>
18879 !! end
18881 !! test
18882 Bug 22905: <abbr> followed by ISBN followed by </a>
18883 !! wikitext
18884 <abbr>(fr)</abbr> ISBN 2753300917 [http://www.example.com example.com]
18885 !! html/php
18886 <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>
18887 </p>
18888 !! html/parsoid
18889 <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>
18890 !! end
18892 !! test
18893 Double RFC
18894 !! wikitext
18895 RFC RFC 1234
18896 !! html
18897 <p>RFC <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc1234">RFC 1234</a>
18898 </p>
18899 !! end
18901 !! test
18902 Double RFC with a wiki link
18903 !! wikitext
18904 RFC [[RFC 1234]]
18905 !! html
18906 <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>
18907 </p>
18908 !! end
18910 !! test
18911 RFC code coverage
18912 !! wikitext
18913 RFC   983&#x20;987
18914 !! html
18915 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc983">RFC 983</a>&#x20;987
18916 </p>
18917 !! html+tidy
18918 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc983">RFC 983</a> 987</p>
18919 !! end
18921 !! test
18922 Centre-aligned image
18923 !! wikitext
18924 [[Image:foobar.jpg|centre]]
18925 !! html
18926 <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>
18928 !!end
18930 !! test
18931 None-aligned image
18932 !! wikitext
18933 [[Image:foobar.jpg|none]]
18934 !! html
18935 <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>
18937 !!end
18939 !! test
18940 Width + Height sized image (using px) (height is ignored)
18941 !! wikitext
18942 [[Image:foobar.jpg|640x480px]]
18943 !! html
18944 <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>
18945 </p>
18946 !!end
18948 !! test
18949 Width-sized image (using px, no following whitespace)
18950 !! wikitext
18951 [[Image:foobar.jpg|640px]]
18952 !! html
18953 <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>
18954 </p>
18955 !!end
18957 !! test
18958 Width-sized image (using px, with following whitespace - test regression from r39467)
18959 !! wikitext
18960 [[Image:foobar.jpg|640px ]]
18961 !! html
18962 <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>
18963 </p>
18964 !!end
18966 !! test
18967 Width-sized image (using px, with preceding whitespace - test regression from r39467)
18968 !! wikitext
18969 [[Image:foobar.jpg| 640px]]
18970 !! html
18971 <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>
18972 </p>
18973 !!end
18975 !! test
18976 Image with page parameter
18977 !! options
18978 djvu
18979 !! wikitext
18980 [[File:LoremIpsum.djvu|page=2]]
18981 !! html/php
18982 <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>
18983 </p>
18984 !! html/parsoid
18985 <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>
18986 !! end
18988 !! test
18989 Another italics / bold test
18990 !! wikitext
18991  ''' ''x'
18992 !! html
18993 <pre>'<i> </i>x'
18994 </pre>
18995 !!end
18997 # FIXME: The php output seems broken. It's interleaving some open/close tags.
18998 !! test
18999 dt/dd/dl test
19000 !! wikitext
19001 :;;;::
19002 !! html/php
19003 <dl><dd><dl><dt><dl><dt><dl><dt><dl><dd><dl><dd></dt></dl></dd></dl></dd></dl></dd></dl></dd></dl></dd></dl>
19005 !! html/parsoid
19006 <dl><dd><dl><dt><dl><dt><dl><dt><dl><dd><dl><dd></dd></dl></dd></dl></dt></dl></dt></dl></dt></dl></dd></dl>
19008 !!end
19011 # Images with the "|" character in external URLs in comment tags; Eats half the comment, leaves unmatched "</a>" tag.
19012 !! test
19013 Images with the "|" character in the comment
19014 !! wikitext
19015 [[File:Foobar.jpg|thumb|An [http://test/?param1=|left|&param2=|x external] URL]]
19016 !! html/php
19017 <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>
19019 !! html/parsoid
19020 <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>
19021 !! end
19023 !! test
19024 [Before] HTML without raw HTML enabled ($wgRawHtml==false)
19025 !! wikitext
19026 <html><script>alert(1);</script></html>
19027 !! html
19028 <p>&lt;html&gt;&lt;script&gt;alert(1);&lt;/script&gt;&lt;/html&gt;
19029 </p>
19030 !! end
19032 !! test
19033 HTML with raw HTML ($wgRawHtml==true)
19034 !! options
19035 wgRawHtml=1
19036 !! wikitext
19037 <html><script>alert(1);</script></html>
19038 !! html
19039 <p><script>alert(1);</script>
19040 </p>
19041 !! end
19043 !! test
19044 Parents of subpages, one level up
19045 !! options
19046 subpage title=[[Subpage test/L1/L2/L3]]
19047 !! wikitext
19048 [[../|L2]]
19049 !! html
19050 <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>
19051 </p>
19052 !! end
19055 !! test
19056 Parents of subpages, one level up, not named
19057 !! options
19058 subpage title=[[Subpage test/L1/L2/L3]]
19059 !! wikitext
19060 [[../]]
19061 !! html
19062 <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>
19063 </p>
19064 !! end
19068 !! test
19069 Parents of subpages, two levels up
19070 !! options
19071 subpage title=[[Subpage test/L1/L2/L3]]
19072 !! wikitext
19073 [[../../|L1]]2
19075 [[../../|L1]]l
19076 !! html
19077 <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
19078 </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>
19079 </p>
19080 !! end
19082 !! test
19083 Parents of subpages, two levels up, without trailing slash or name.
19084 !! options
19085 subpage title=[[Subpage test/L1/L2/L3]]
19086 !! wikitext
19087 [[../..]]
19088 !! html
19089 <p>[[../..]]
19090 </p>
19091 !! end
19093 !! test
19094 Parents of subpages, two levels up, with lots of extra trailing slashes.
19095 !! options
19096 subpage title=[[Subpage test/L1/L2/L3]]
19097 !! wikitext
19098 [[../../////]]
19099 !! html
19100 <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>
19101 </p>
19102 !! end
19104 !! article
19105 Subpage test/L1/L2/L3Sibling
19106 !! text
19107 Sibling article
19108 !! endarticle
19110 !! test
19111 Transclusion of a sibling page (one level up)
19112 !! options
19113 subpage title=[[Subpage test/L1/L2/L3]]
19114 !! wikitext
19115 {{../L3Sibling}}
19116 !! html
19117 <p>Sibling article
19118 </p>
19119 !! end
19121 !! test
19122 Transclusion of a child page
19123 !! options
19124 subpage title=[[Subpage test/L1/L2]]
19125 !! wikitext
19126 {{/L3Sibling}}
19127 !! html
19128 <p>Sibling article
19129 </p>
19130 !! end
19132 !! test
19133 Non-transclusion because of too many up levels
19134 !! options
19135 subpage title=[[Subpage test/L1/L2/L3]]
19136 !! wikitext
19137 {{../../../../More than parent}}
19138 !! html
19139 <p>{{../../../../More than parent}}
19140 </p>
19141 !! end
19143 !! test
19144 Definition list code coverage
19145 !! wikitext
19146 ; title   : def
19147 ; title : def
19148 ;title: def
19149 !! html/php
19150 <dl><dt> title  &#160;</dt>
19151 <dd> def</dd>
19152 <dt> title&#160;</dt>
19153 <dd> def</dd>
19154 <dt>title</dt>
19155 <dd> def</dd></dl>
19157 !! html/parsoid
19158 <dl><dt> title  <span typeof="mw:Placeholder"> </span></dt><dd> def</dd>
19159 <dt> title<span typeof="mw:Placeholder"> </span></dt><dd> def</dd>
19160 <dt>title</dt><dd> def</dd></dl>
19161 !! end
19163 !! test
19164 Don't fall for the self-closing div
19165 !! wikitext
19166 <div>hello world</div/>
19167 !! html
19168 <div>hello world</div>
19170 !! end
19172 !! test
19173 MSGNW magic word
19174 !! wikitext
19175 {{MSGNW:msg}}
19176 !! html/php
19177 <p>&#91;&#91;:Template:Msg&#93;&#93;
19178 </p>
19179 !! end
19181 !! test
19182 RAW magic word
19183 !! wikitext
19184 {{RAW:QUERTY}}
19185 !! html
19186 <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>
19187 </p>
19188 !! end
19190 # This isn't needed for XHTML conformance, but would be handy as a fallback security measure
19191 !! test
19192 Always escape literal '>' in output, not just after '<'
19193 !! wikitext
19195 !! html
19196 <p>&gt;&lt;&gt;
19197 </p>
19198 !! end
19200 !! test
19201 Template caching
19202 !! wikitext
19203 {{Test}}
19204 {{Test}}
19205 !! html
19206 <p>This is a test template
19207 This is a test template
19208 </p>
19209 !! end
19212 !! article
19213 MediaWiki:Fake
19214 !! text
19215 ==header==
19216 !! endarticle
19218 !! test
19219 Inclusion of !userCanEdit() content
19220 !! wikitext
19221 {{MediaWiki:Fake}}
19222 !! html
19223 <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>
19225 !! end
19228 !! test
19229 Out-of-order TOC heading levels
19230 !! wikitext
19231 ==2==
19232 ======6======
19233 ===3===
19235 =====5=====
19236 ==2==
19237 !! html
19238 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
19239 <ul>
19240 <li class="toclevel-1 tocsection-1"><a href="#2"><span class="tocnumber">1</span> <span class="toctext">2</span></a>
19241 <ul>
19242 <li class="toclevel-2 tocsection-2"><a href="#6"><span class="tocnumber">1.1</span> <span class="toctext">6</span></a></li>
19243 <li class="toclevel-2 tocsection-3"><a href="#3"><span class="tocnumber">1.2</span> <span class="toctext">3</span></a></li>
19244 </ul>
19245 </li>
19246 <li class="toclevel-1 tocsection-4"><a href="#1"><span class="tocnumber">2</span> <span class="toctext">1</span></a>
19247 <ul>
19248 <li class="toclevel-2 tocsection-5"><a href="#5"><span class="tocnumber">2.1</span> <span class="toctext">5</span></a></li>
19249 <li class="toclevel-2 tocsection-6"><a href="#2_2"><span class="tocnumber">2.2</span> <span class="toctext">2</span></a></li>
19250 </ul>
19251 </li>
19252 </ul>
19253 </div>
19255 <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>
19256 <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>
19257 <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>
19258 <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>
19259 <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>
19260 <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>
19262 !! end
19265 !! test
19266 ISBN with a dummy number
19267 !! wikitext
19268 ISBN ---
19269 !! html
19270 <p>ISBN ---
19271 </p>
19272 !! end
19275 !! test
19276 ISBN with space-delimited number
19277 !! wikitext
19278 ISBN 92 9017 032 8
19279 !! html
19280 <p><a href="/wiki/Special:BookSources/9290170328" class="internal mw-magiclink-isbn">ISBN 92 9017 032 8</a>
19281 </p>
19282 !! end
19285 !! test
19286 ISBN with multiple spaces, no number
19287 !! wikitext
19288 ISBN  foo
19289 !! html
19290 <p>ISBN  foo
19291 </p>
19292 !! end
19295 !! test
19296 ISBN length
19297 !! wikitext
19298 ISBN 123456789
19300 ISBN 1234567890
19302 ISBN 12345678901
19303 !! html
19304 <p>ISBN 123456789
19305 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
19306 </p><p>ISBN 12345678901
19307 </p>
19308 !! end
19311 !! test
19312 ISBN with trailing year (bug 8110)
19313 !! wikitext
19314 ISBN 1-234-56789-0 - 2006
19316 ISBN 1 234 56789 0 - 2006
19317 !! html
19318 <p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1-234-56789-0</a> - 2006
19319 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1 234 56789 0</a> - 2006
19320 </p>
19321 !! end
19324 !! test
19325 anchorencode
19326 !! wikitext
19327 {{anchorencode:foo bar©#%n}}
19328 !! html
19329 <p>foo_bar.C2.A9.23.25n
19330 </p>
19331 !! end
19333 !! test
19334 anchorencode trims spaces
19335 !! wikitext
19336 {{anchorencode: __pretty__please__}}
19337 !! html
19338 <p>pretty_please
19339 </p>
19340 !! end
19342 !! test
19343 anchorencode deals with links
19344 !! wikitext
19345 {{anchorencode: [[hello|world]] [[hi]]}}
19346 !! html
19347 <p>world_hi
19348 </p>
19349 !! end
19351 !! test
19352 anchorencode deals with templates
19353 !! wikitext
19354 {{anchorencode: {{Foo}} }}
19355 !! html
19356 <p>FOO
19357 </p>
19358 !! end
19360 !! test
19361 anchorencode encodes like the TOC generator: (bug 18431)
19362 !! wikitext
19363 === _ +:.3A%3A&&amp;]] ===
19364 {{anchorencode: _ +:.3A%3A&&amp;]] }}
19365 __NOEDITSECTION__
19366 !! html
19367 <h3><span class="mw-headline" id=".2B:.3A.253A.26.26.5D.5D">_ +:.3A%3A&amp;&amp;]]</span></h3>
19368 <p>.2B:.3A.253A.26.26.5D.5D
19369 </p>
19370 !! end
19372 !! test
19373 Bug 6200: blockquotes and paragraph formatting
19374 !! wikitext
19375 <blockquote>
19377 </blockquote>
19381  baz
19382 !! html
19383 <blockquote>
19384 <p>foo
19385 </p>
19386 </blockquote>
19387 <p>bar
19388 </p>
19389 <pre>baz
19390 </pre>
19391 !! end
19393 !! test
19394 Bug 8293: Use of center tag ruins paragraph formatting
19395 !! wikitext
19396 <center>
19398 </center>
19402  baz
19403 !! html
19404 <center>
19405 <p>foo
19406 </p>
19407 </center>
19408 <p>bar
19409 </p>
19410 <pre>baz
19411 </pre>
19412 !! end
19414 !!test
19415 Parsing of overlapping (improperly nested) inline html tags
19416 !! wikitext
19417 <span><s>x</span></s>
19418 !! html/php
19419 <p><span><s>x&lt;/span&gt;</s></span>
19420 </p>
19421 !! html/parsoid
19422 <p><span><s>x</s></span>
19423 </p>
19424 !!end
19427 ### Language variants related tests
19429 !! test
19430 Self-link in language variants
19431 !! options
19432 title=[[Dunav]] language=sr
19433 !! wikitext
19434 Both [[Dunav]] and [[Дунав]] are names for this river.
19435 !! html
19436 <p>Both <strong class="selflink">Dunav</strong> and <strong class="selflink">Дунав</strong> are names for this river.
19437 </p>
19438 !!end
19440 !! article
19441 Дуна
19442 !! text
19443 content
19444 !! endarticle
19446 !! test
19447 Link to another existing title shouldn't be parsed as self-link even if it's a variant of this title
19448 !! options
19449 title=[[Duna]] language=sr
19450 !! wikitext
19451 [[Дуна]] is not a self-link while [[Duna]] and [[Dуна]] are still self-links.
19452 !! html
19453 <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.
19454 </p>
19455 !! end
19457 !! test
19458 Link to a section of a variant of this title shouldn't be parsed as self-link
19459 !! options
19460 title=[[Duna]] language=sr
19461 !! wikitext
19462 [[Dуна]] is a self-link while [[Dunа#Foo]] and [[Dуна#Foo]] are not self-links.
19463 !! html
19464 <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.
19465 </p>
19466 !! end
19468 !! test
19469 Link to pages in language variants
19470 !! options
19471 language=sr
19472 !! wikitext
19473 Main Page can be written as [[Маин Паге]]
19474 !! html
19475 <p>Main Page can be written as <a href="/wiki/Main_Page" title="Main Page">Маин Паге</a>
19476 </p>
19477 !!end
19480 !! test
19481 Multiple links to pages in language variants
19482 !! options
19483 language=sr
19484 !! wikitext
19485 [[Main Page]] can be written as [[Маин Паге]] same as [[Маин Паге]].
19486 !! html
19487 <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>.
19488 </p>
19489 !!end
19492 !! test
19493 Simple template in language variants
19494 !! options
19495 language=sr
19496 !! wikitext
19497 {{тест}}
19498 !! html
19499 <p>This is a test template
19500 </p>
19501 !! end
19504 !! test
19505 Template with explicit namespace in language variants
19506 !! options
19507 language=sr
19508 !! wikitext
19509 {{Template:тест}}
19510 !! html
19511 <p>This is a test template
19512 </p>
19513 !! end
19516 !! test
19517 Basic test for template parameter in language variants
19518 !! options
19519 language=sr
19520 !! wikitext
19521 {{парамтест|param=foo}}
19522 !! html
19523 <p>This is a test template with parameter foo
19524 </p>
19525 !! end
19528 !! test
19529 Simple category in language variants
19530 !! options
19531 language=sr cat
19532 !! wikitext
19533 [[Category:МедиаWики Усер'с Гуиде]]
19534 !! html
19535 <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>
19536 !! end
19539 !! article
19540 Category:分类
19541 !! text
19542 blah
19543 !! endarticle
19545 !! article
19546 Category:分類
19547 !! text
19548 blah
19549 !! endarticle
19551 ## We used to, but no longer wt2wt this test since the default serializer
19552 ## will normalize all categories to serialize on their own line.
19553 ## This wikitext usage is going to be fairly uncommon in production and
19554 ## selser will take care of preserving formatting in those scenarios.
19555 !! test
19556 Don't convert blue categorylinks to another variant (bug 33210)
19557 !! options
19559 language=zh
19560 parsoid=wt2html
19561 !! wikitext
19562 [[A]][[Category:分类]]
19563 !! html/php
19564 <a href="/wiki/Category:%E5%88%86%E7%B1%BB" title="Category:分类">分类</a>
19565 !! html/parsoid
19566 <p><a rel="mw:WikiLink" href="A" title="A">A</a></p>
19567 <link rel="mw:PageProp/Category" href="Category:分类"/>
19568 !! end
19570 !! test
19571 Stripping -{}- tags (language variants)
19572 !! options
19573 language=sr
19574 !! wikitext
19575 Latin proverb: -{Ne nuntium necare}-
19576 !! html
19577 <p>Latin proverb: Ne nuntium necare
19578 </p>
19579 !! end
19582 !! test
19583 Prevent conversion with -{}- tags (language variants)
19584 !! options
19585 language=sr variant=sr-ec
19586 !! wikitext
19587 Latinski: -{Ne nuntium necare}-
19588 !! html
19589 <p>Латински: Ne nuntium necare
19590 </p>
19591 !! end
19594 !! test
19595 Prevent conversion of text with -{}- tags (language variants)
19596 !! options
19597 language=sr variant=sr-ec
19598 !! wikitext
19599 Latinski: -{Ne nuntium necare}-
19600 !! html
19601 <p>Латински: Ne nuntium necare
19602 </p>
19603 !! end
19606 !! test
19607 Prevent conversion of links with -{}- tags (language variants)
19608 !! options
19609 language=sr variant=sr-ec
19610 !! wikitext
19611 -{[[Main Page]]}-
19612 !! html
19613 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
19614 </p>
19615 !! end
19618 !! test
19619 -{}- tags within headlines (within html for parserConvert())
19620 !! options
19621 language=sr variant=sr-ec
19622 !! wikitext
19623 == -{Naslov}- ==
19624 !! html
19625 <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>
19627 !! end
19630 !! test
19631 Explicit definition of language variant alternatives
19632 !! options
19633 language=zh variant=zh-tw
19634 !! wikitext
19635 -{zh:China;zh-tw:Taiwan}-, not China
19636 !! html
19637 <p>Taiwan, not China
19638 </p>
19639 !! end
19642 !! test
19643 Conversion around HTML tags
19644 !! options
19645 language=sr variant=sr-ec
19646 !! wikitext
19647 -{H|span=>sr-ec:script;title=>sr-ec:src;}-
19648 <span title="La-{sr-el:L;sr-ec:C;}-tin">ski</span>
19649 !! html
19651 <span title="ЛаCтин">ски</span>
19652 </p>
19653 !! end
19656 !! test
19657 Explicit session-wise language variant mapping (A flag and - flag)
19658 !! options
19659 language=zh variant=zh-tw
19660 !! wikitext
19661 Taiwan is not China.
19662 But -{A|zh:China;zh-tw:Taiwan}- is China,
19663 (This-{-|zh:China;zh-tw:Taiwan}- should be stripped!)
19664 and -{China}- is China.
19665 !! html
19666 <p>Taiwan is not China.
19667 But Taiwan is Taiwan,
19668 (This should be stripped!)
19669 and China is China.
19670 </p>
19671 !! end
19673 !! test
19674 Explicit session-wise language variant mapping (H flag for hide)
19675 !! options
19676 language=zh variant=zh-tw
19677 !! wikitext
19678 (This-{H|zh:China;zh-tw:Taiwan}- should be stripped!)
19679 Taiwan is China.
19680 !! html
19681 <p>(This should be stripped!)
19682 Taiwan is Taiwan.
19683 </p>
19684 !! end
19686 !! test
19687 Adding explicit conversion rule for title (T flag)
19688 !! options
19689 language=zh variant=zh-tw showtitle
19690 !! wikitext
19691 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
19692 !! html
19693 Taiwan
19694 <p>Should be stripped!
19695 </p>
19696 !! end
19698 !! test
19699 Testing that changing the language variant here in the tests actually works
19700 !! options
19701 language=zh variant=zh showtitle
19702 !! wikitext
19703 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
19704 !! html
19705 China
19706 <p>Should be stripped!
19707 </p>
19708 !! end
19710 !! test
19711 Recursive conversion of alt and title attrs shouldn't clear converter state
19712 !! options
19713 language=zh variant=zh-cn showtitle
19714 !! wikitext
19715 -{H|zh-cn:Exclamation;zh-tw:exclamation;}-
19716 Should be stripped-{T|zh-cn:China;zh-tw:Taiwan}-<span title="exclamation">!</span>
19717 !! html
19718 China
19720 Should be stripped<span title="Exclamation">!</span>
19721 </p>
19722 !! end
19724 !! test
19725 Bug 24072: more test on conversion rule for title
19726 !! options
19727 language=zh variant=zh-tw showtitle
19728 !! wikitext
19729 This should be stripped-{T|zh:China;zh-tw:Taiwan}-!
19730 This won't take interferes with the title rule-{H|zh:Beijing;zh-tw:Taipei}-.
19731 !! html
19732 Taiwan
19733 <p>This should be stripped!
19734 This won't take interferes with the title rule.
19735 </p>
19736 !! end
19738 !! test
19739 Partly disable title conversion if variant == main language code
19740 !! options
19741 language=zh variant=zh title=[[ZH]] showtitle
19742 !! wikitext
19743 -{T|zh-cn:CN;zh-tw:TW}-
19744 !! html
19747 </p>
19748 !! end
19750 !! test
19751 Partly disable title conversion if variant == main language code, more
19752 !! options
19753 language=zh variant=zh title=[[ZH]] showtitle
19754 !! wikitext
19755 -{T|TW}-
19756 !! html
19759 </p>
19760 !! end
19762 !! test
19763 Raw output of variant escape tags (R flag)
19764 !! options
19765 language=zh variant=zh-tw
19766 !! wikitext
19767 Raw: -{R|zh:China;zh-tw:Taiwan}-
19768 !! html
19769 <p>Raw: zh:China;zh-tw:Taiwan
19770 </p>
19771 !! end
19773 !! test
19774 Strings evaluating false shouldn't be ignored by Language converter (T51072)
19775 !! options
19776 language=zh variant=zh-cn
19777 !! input
19778 -{zh-cn:0;zh-sg:1;zh-tw:2;zh-hk:3}-
19779 !! result
19780 <p>0
19781 </p>
19782 !! end
19784 !! test
19785 Conversion rules from [numeric-only string] to [something else] (T48634)
19786 !! options
19787 language=zh variant=zh-cn
19788 !! input
19789 -{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
19790 !! result
19791 <p>D12345EE12345
19792 </p>
19793 !! end
19795 !! test
19796 Bidirectional converter rule entries with an empty value should be ignored (T53551)
19797 !! options
19798 language=zh variant=zh-cn
19799 !! input
19800 -{H|zh-cn:foo;zh-tw:;}-foobar
19801 !! result
19802 <p>foobar
19803 </p>
19804 !! end
19806 !! test
19807 Unidirectional converter rule entries with an empty "from" string should be ignored (T53551)
19808 !! options
19809 language=zh variant=zh-cn
19810 !! input
19811 -{H|=>zh-cn:foo;}-foobar
19812 !! result
19813 <p>foobar
19814 </p>
19815 !! end
19817 !! test
19818 Empty converter rule entries shouldn't be inserted into the conversion table (T53551)
19819 !! options
19820 language=zh variant=zh-cn
19821 !! input
19822 -{H|}-foobar
19823 !! result
19824 <p>foobar
19825 </p>
19826 !! end
19828 !! test
19829 Nested using of manual convert syntax
19830 !! options
19831 language=zh variant=zh-hk
19832 !! wikitext
19833 Nested: -{zh-hans:Hi -{zh-cn:China;zh-sg:Singapore;}-;zh-hant:Hello -{zh-tw:Taiwan;zh-hk:H-{ong}- K-{}-ong;}-;}-!
19834 !! html
19835 <p>Nested: Hello Hong Kong!
19836 </p>
19837 !! end
19839 !! test
19840 Proper conversion of text in external links
19841 !! options
19842 language=sr variant=sr-ec
19843 !! wikitext
19844 http://www.google.com
19845 gopher://www.google.com
19846 [http://www.google.com http://www.google.com]
19847 [gopher://www.google.com gopher://www.google.com]
19848 [https://www.google.com irc://www.google.com]
19849 [ftp://www.google.com www.google.com/ftp://dir]
19850 [//www.google.com www.google.com]
19851 !! html
19852 <p><a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
19853 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
19854 <a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
19855 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
19856 <a rel="nofollow" class="external text" href="https://www.google.com">irc://www.google.com</a>
19857 <a rel="nofollow" class="external text" href="ftp://www.google.com">www.гоогле.цом/фтп://дир</a>
19858 <a rel="nofollow" class="external text" href="//www.google.com">www.гоогле.цом</a>
19859 </p>
19860 !! end
19862 !! test
19863 Do not convert roman numbers to language variants
19864 !! options
19865 language=sr variant=sr-ec
19866 !! wikitext
19867 Fridrih IV je car.
19868 !! html
19869 <p>Фридрих IV је цар.
19870 </p>
19871 !! end
19873 !! test
19874 Unclosed language converter markup "-{"
19875 !! options
19876 language=sr
19877 !! wikitext
19878 -{T|hello
19879 !! html
19880 <p>-{T|hello
19881 </p>
19882 !! end
19884 !! test
19885 Don't convert raw rule "-{R|=&gt;}-" to "=>"
19886 !! options
19887 language=sr
19888 !! wikitext
19889 -{R|=&gt;}-
19890 !! html
19891 <p>=&gt;
19892 </p>
19893 !!end
19895 !! test
19896 Don't break link parsing if language converter markup is in the caption.
19897 !! options
19898 language=sr variant=sr-ec
19899 !! wikitext
19900 [[Main Page|-{R|main page}-]]
19901 !! html
19902 <p><a href="/wiki/Main_Page" title="Маин Паге">main page</a>
19903 </p>
19904 !! end
19906 # FIXME: This test is currently broken in the PHP parser (bug 52661)
19907 !! test
19908 Don't break image parsing if language converter markup is in the caption.
19909 !! options
19910 language=sr
19911 !! wikitext
19912 [[File:Foobar.jpg|-{R|caption}-]]
19913 !! html/parsoid
19914 <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>
19915 </p>
19916 !! end
19918 # FIXME: This test is currently broken in the PHP parser (bug 52661)
19919 !! test
19920 Don't break list handling if language converter markup is in the item.
19921 !! options
19922 language=zh variant=zh-cn
19923 !! wikitext
19924 ;-{zh-cn:AAA;zh-tw:BBB}-
19925 !! html/php
19926 <dl><dt><span class="error">在手动语言转换规则中检测到错误</span></dd></dl>
19928 !! html/parsoid
19929 <dl><dt>AAA
19930 </dt></dl>
19931 !! end
19933 # FIXME: This test is currently broken in the PHP parser (bug 52661)
19934 !! test
19935 Don't break table handling if language converter markup is in the cell.
19936 !! options
19937 language=sr variant=sr-ec
19938 !! wikitext
19941 | -{R|B}-
19943 !! html/php
19944 <table>
19946 <tr>
19947 <td>Б}-
19948 </td></tr></table>
19950 !! html/parsoid
19951 <table>
19953 <tr>
19954 <td> B
19955 </td></tr></table>
19957 !! end
19959 !! test
19960 Bug 529: Uncovered bullet
19961 !! wikitext
19962 * Foo {{bullet}}
19963 !! html
19964 <ul><li> Foo </li>
19965 <li> Bar</li></ul>
19967 !! end
19969 # Plain MediaWiki does not remove empty lists, but tidy actually does.
19970 # Templates in Wikipedia rely on this behavior, as tidy has always been
19971 # enabled there. These tests are normally run *without* tidy, so specify the
19972 # full output here. 
19973 # To test realistic parsing behavior, apply a tidy-like transformation to both
19974 # the expected output and your parser's output.
19975 !! test
19976 Bug 529: Uncovered bullet leaving empty list, normally removed by tidy
19977 !! wikitext
19978 ******* Foo {{bullet}}
19979 !! html
19980 <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>
19981 <li> Bar</li></ul>
19983 !! end
19985 !! test
19986 Bug 529: Uncovered table already at line-start
19987 !! wikitext
19990 {{table}}
19992 !! html
19993 <p>x
19994 </p>
19995 <table>
19996 <tr>
19997 <td> 1 </td>
19998 <td> 2
19999 </td></tr>
20000 <tr>
20001 <td> 3 </td>
20002 <td> 4
20003 </td></tr></table>
20004 <p>y
20005 </p>
20006 !! end
20008 !! test
20009 Bug 529: Uncovered bullet in parser function result
20010 !! wikitext
20011 * Foo {{lc:{{bullet}} }}
20012 !! html
20013 <ul><li> Foo </li>
20014 <li> bar</li></ul>
20016 !! end
20018 !! test
20019 Bug 5678: Double-parsed template argument
20020 !! wikitext
20021 {{lc:{{{1}}}|hello}}
20022 !! html
20023 <p>{{{1}}}
20024 </p>
20025 !! end
20027 !! test
20028 Bug 5678: Double-parsed template invocation
20029 !! wikitext
20030 {{lc:{{paramtest {{!}} param = hello }} }}
20031 !! html
20032 <p>{{paramtest | param = hello }}
20033 </p>
20034 !! end
20036 !! test
20037 Case insensitivity of parser functions for non-ASCII characters (bug 8143)
20038 !! options
20039 language=cs
20040 title=[[Main Page]]
20041 !! wikitext
20042 {{PRVNÍVELKÉ:ěščř}}
20043 {{prvnívelké:ěščř}}
20044 {{PRVNÍMALÉ:ěščř}}
20045 {{prvnímalé:ěščř}}
20046 {{MALÁ:ěščř}}
20047 {{malá:ěščř}}
20048 {{VELKÁ:ěščř}}
20049 {{velká:ěščř}}
20050 !! html
20051 <p>Ěščř
20052 Ěščř
20053 ěščř
20054 ěščř
20055 ěščř
20056 ěščř
20057 ĚŠČŘ
20058 ĚŠČŘ
20059 </p>
20060 !! end
20062 !! test
20063 Morwen/13: Unclosed link followed by heading
20064 !! wikitext
20065 [[link
20066 ==heading==
20067 !! html
20068 <p>[[link
20069 </p>
20070 <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>
20072 !! end
20074 !! test
20075 HHP2.1: Heuristics for headings in preprocessor parenthetical structures
20076 !! wikitext
20077 {{foo|
20078 =heading=
20079 !! html
20080 <p>{{foo|
20081 </p>
20082 <h1><span class="mw-headline" id="heading">heading</span></h1>
20084 !! end
20086 !! test
20087 HHP2.2: Heuristics for headings in preprocessor parenthetical structures
20088 !! wikitext
20089 {{foo|
20090 ==heading==
20091 !! html
20092 <p>{{foo|
20093 </p>
20094 <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>
20096 !! end
20098 !! test
20099 Tildes in comments
20100 !! options
20102 !! wikitext
20103 <!-- ~~~~ -->
20104 !! html/php
20105 <!-- ~~~~ -->
20106 !! end
20108 !! test
20109 Paragraphs inside divs (no extra line breaks)
20110 !! wikitext
20111 <div>Line one
20113 Line two</div>
20114 !! html
20115 <div>Line one
20116 Line two</div>
20118 !! end
20120 !! test
20121 Paragraphs inside divs (extra line break on open)
20122 !! wikitext
20123 <div>
20124 Line one
20126 Line two</div>
20127 !! html
20128 <div>
20129 <p>Line one
20130 </p>
20131 Line two</div>
20133 !! end
20135 !! test
20136 Paragraphs inside divs (extra line break on close)
20137 !! wikitext
20138 <div>Line one
20140 Line two
20141 </div>
20142 !! html
20143 <div>Line one
20144 <p>Line two
20145 </p>
20146 </div>
20148 !! end
20150 !! test
20151 Paragraphs inside divs (extra line break on open and close)
20152 !! wikitext
20153 <div>
20154 Line one
20156 Line two
20157 </div>
20158 !! html
20159 <div>
20160 <p>Line one
20161 </p><p>Line two
20162 </p>
20163 </div>
20165 !! end
20167 !! test
20168 Nesting tags, paragraphs on lines which begin with <div>
20169 !! wikitext
20170 <div></div><strong>A
20171 B</strong>
20172 !! html/php+tidy
20173 <p><strong>A</strong></p>
20174 <p><strong>B</strong></p>
20175 !! html/parsoid
20176 <div></div>
20177 <p><strong>A
20178 B</strong>
20179 </p>
20180 !! end
20182 # Bug 6200: <blockquote> should behave like <div> with respect to line breaks
20183 !! test
20184 Bug 6200: paragraphs inside blockquotes (no extra line breaks)
20185 !! wikitext
20186 <blockquote>Line one
20188 Line two</blockquote>
20189 !! html
20190 <blockquote>Line one
20191 Line two</blockquote>
20193 !! html+tidy
20194 <blockquote>
20195 <p>Line one Line two</p>
20196 </blockquote>
20197 !! end
20199 !! test
20200 Bug 6200: paragraphs inside blockquotes (extra line break on open)
20201 !! wikitext
20202 <blockquote>
20203 Line one
20205 Line two</blockquote>
20206 !! html
20207 <blockquote>
20208 <p>Line one
20209 </p>
20210 Line two</blockquote>
20212 !! html+tidy
20213 <blockquote>
20214 <p>Line one</p>
20215 Line two</blockquote>
20216 !! end
20218 !! test
20219 Bug 6200: paragraphs inside blockquotes (extra line break on close)
20220 !! wikitext
20221 <blockquote>Line one
20223 Line two
20224 </blockquote>
20225 !! html
20226 <blockquote>Line one
20227 <p>Line two
20228 </p>
20229 </blockquote>
20231 !! html+tidy
20232 <blockquote>
20233 <p>Line one</p>
20234 <p>Line two</p>
20235 </blockquote>
20236 !! end
20238 !! test
20239 Bug 6200: paragraphs inside blockquotes (extra line break on open and close)
20240 !! wikitext
20241 <blockquote>
20242 Line one
20244 Line two
20245 </blockquote>
20246 !! html
20247 <blockquote>
20248 <p>Line one
20249 </p><p>Line two
20250 </p>
20251 </blockquote>
20253 !! html+tidy
20254 <blockquote>
20255 <p>Line one</p>
20256 <p>Line two</p>
20257 </blockquote>
20258 !! end
20260 !! test
20261 Paragraphs inside blockquotes/divs (no extra line breaks)
20262 !! wikitext
20263 <blockquote><div>Line one
20265 Line two</div></blockquote>
20266 !! html
20267 <blockquote><div>Line one
20268 Line two</div></blockquote>
20270 !! end
20272 !! test
20273 Paragraphs inside blockquotes/divs (extra line break on open)
20274 !! wikitext
20275 <blockquote><div>
20276 Line one
20278 Line two</div></blockquote>
20279 !! html
20280 <blockquote><div>
20281 <p>Line one
20282 </p>
20283 Line two</div></blockquote>
20285 !! end
20287 !! test
20288 Paragraphs inside blockquotes/divs (extra line break on close)
20289 !! wikitext
20290 <blockquote><div>Line one
20292 Line two
20293 </div></blockquote>
20294 !! html
20295 <blockquote><div>Line one
20296 <p>Line two
20297 </p>
20298 </div></blockquote>
20300 !! end
20302 !! test
20303 Paragraphs inside blockquotes/divs (extra line break on open and close)
20304 !! wikitext
20305 <blockquote><div>
20306 Line one
20308 Line two
20309 </div></blockquote>
20310 !! html
20311 <blockquote><div>
20312 <p>Line one
20313 </p><p>Line two
20314 </p>
20315 </div></blockquote>
20317 !! end
20319 !! test
20320 Interwiki links trounced by replaceExternalLinks after early LinkHolderArray expansion
20321 !! options
20322 wgLinkHolderBatchSize=0
20323 !! wikitext
20324 [[meatball:1]]
20325 [[meatball:2]]
20326 [[meatball:3]]
20327 !! html
20328 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?1" class="extiw" title="meatball:1">meatball:1</a>
20329 <a href="http://www.usemod.com/cgi-bin/mb.pl?2" class="extiw" title="meatball:2">meatball:2</a>
20330 <a href="http://www.usemod.com/cgi-bin/mb.pl?3" class="extiw" title="meatball:3">meatball:3</a>
20331 </p>
20332 !! end
20334 !! test
20335 Free external link invading image caption
20336 !! wikitext
20337 [[Image:Foobar.jpg|thumb|http://x|hello]]
20338 !! html
20339 <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>
20341 !! end
20343 !! test
20344 Bug 15196: localised external link numbers
20345 !! options
20346 language=fa
20347 !! wikitext
20348 [http://en.wikipedia.org/]
20349 !! html/php
20350 <p><a rel="nofollow" class="external autonumber" href="http://en.wikipedia.org/">[۱]</a>
20351 </p>
20352 !! html/parsoid
20353 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/"></a></p>
20354 !! end
20356 !! test
20357 Multibyte character in padleft
20358 !! wikitext
20359 {{padleft:-Hello|7|Æ}}
20360 !! html
20361 <p>Æ-Hello
20362 </p>
20363 !! end
20365 !! test
20366 Multibyte character in padright
20367 !! wikitext
20368 {{padright:Hello-|7|Æ}}
20369 !! html
20370 <p>Hello-Æ
20371 </p>
20372 !! end
20374 !!test
20375 formatdate parser function
20376 !! wikitext
20377 {{#formatdate:2009-03-24}}
20378 !! html
20379 <p><span class="mw-formatted-date" title="2009-03-24">2009-03-24</span>
20380 </p>
20381 !! end
20383 !!test
20384 formatdate parser function, with default format
20385 !! wikitext
20386 {{#formatdate:2009-03-24|mdy}}
20387 !! html
20388 <p><span class="mw-formatted-date" title="2009-03-24">March 24, 2009</span>
20389 </p>
20390 !! end
20392 !! test
20393 Spacing of numbers in formatted dates
20394 !! wikitext
20395 {{#formatdate:January 15}}
20396 !! html
20397 <p><span class="mw-formatted-date" title="01-15">January 15</span>
20398 </p>
20399 !! end
20401 !! test
20402 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
20403 !! options
20404 language=nl title=[[MediaWiki:Common.css]]
20405 !! wikitext
20406 {{#formatdate:2009-03-24|dmy}}
20407 !! html
20408 <p><span class="mw-formatted-date" title="2009-03-24">24 March 2009</span>
20409 </p>
20410 !! end
20417 # Edit comments
20420 !! test
20421 Edit comment with link
20422 !! options
20423 comment
20424 !! wikitext
20425 I like the [[Main Page]] a lot
20426 !! html/php
20427 I like the <a href="/wiki/Main_Page" title="Main Page">Main Page</a> a lot
20428 !!end
20430 !! test
20431 Edit comment with link and link text
20432 !! options
20433 comment
20434 !! wikitext
20435 I like the [[Main Page|best pages]] a lot
20436 !! html/php
20437 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
20438 !!end
20440 !! test
20441 Edit comment with link and link text with suffix
20442 !! options
20443 comment
20444 !! wikitext
20445 I like the [[Main Page|best page]]s a lot
20446 !! html/php
20447 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
20448 !!end
20450 !! test
20451 Edit comment with section link (non-local, eg in history list)
20452 !! options
20453 comment title=[[Main Page]]
20454 !! wikitext
20455 /* External links */ removed bogus entries
20456 !! html/php
20457 <a href="/wiki/Main_Page#External_links" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
20458 !!end
20460 !! test
20461 Edit comment with section link and text before it (non-local, eg in history list)
20462 !! options
20463 comment title=[[Main Page]]
20464 !! wikitext
20465 pre-comment text /* External links */ removed bogus entries
20466 !! html/php
20467 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>
20468 !!end
20470 !! test
20471 Edit comment with section link (local, eg in diff view)
20472 !! options
20473 comment local title=[[Main Page]]
20474 !! wikitext
20475 /* External links */ removed bogus entries
20476 !! html/php
20477 <a href="#External_links">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
20478 !!end
20480 !! test
20481 Edit comment with subpage link (bug 14080)
20482 !! options
20483 comment
20484 subpage
20485 title=[[Subpage test]]
20486 !! wikitext
20487 Poked at a [[/subpage]] here...
20488 !! html/php
20489 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a> here...
20490 !!end
20492 !! test
20493 Edit comment with subpage link and link text (bug 14080)
20494 !! options
20495 comment
20496 subpage
20497 title=[[Subpage test]]
20498 !! wikitext
20499 Poked at a [[/subpage|neat little page]] here...
20500 !! html/php
20501 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">neat little page</a> here...
20502 !!end
20504 !! test
20505 Edit comment with bogus subpage link in non-subpage NS (bug 14080)
20506 !! options
20507 comment
20508 title=[[Subpage test]]
20509 !! wikitext
20510 Poked at a [[/subpage]] here...
20511 !! html/php
20512 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...
20513 !!end
20515 !! test
20516 Edit comment with bare anchor link (local, as on diff)
20517 !! options
20518 comment
20519 local
20520 title=[[Main Page]]
20521 !! wikitext
20522 [[#section]]
20523 !! html/php
20524 <a href="#section">#section</a>
20525 !! end
20527 !! test
20528 Edit comment with bare anchor link (non-local, as on history)
20529 !! options
20530 comment
20531 title=[[Main Page]]
20532 !! wikitext
20533 [[#section]]
20534 !! html/php
20535 <a href="/wiki/Main_Page#section" title="Main Page">#section</a>
20536 !! end
20538 !! test
20539 Anchor starting with underscore
20540 !! options
20541 title=[[Foo]]
20542 !! wikitext
20543 [[#_ref|One]]
20544 !! html/php
20545 <p><a href="#_ref">One</a>
20546 </p>
20547 !! html/parsoid
20548 <p><a rel="mw:WikiLink" href="./Foo#_ref" data-parsoid='{"stx":"piped","a":{"href":"./Foo#_ref"},"sa":{"href":"#_ref"}}'>One</a></p>
20549 !! end
20551 !! test
20552 Id starting with underscore
20553 !! wikitext
20554 <div id="_ref"></div>
20555 !! html/*
20556 <div id="_ref"></div>
20558 !! end
20560 !! test
20561 Space normalisation on autocomment (bug 22784)
20562 !! options
20563 comment
20564 title=[[Main Page]]
20565 !! wikitext
20566 /* __hello__world__ */
20567 !! html/php
20568 <a href="/wiki/Main_Page#hello_world" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">__hello__world__</span></span>
20569 !! end
20571 !! test
20572 percent-encoding and + signs in comments (Bug 26410)
20573 !! options
20574 comment
20575 !! wikitext
20576 [[ABC%33D% ++]] [[ABC%33D% ++|+%20]]
20577 !! html/php
20578 <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>
20579 !! end
20581 # Parsoid doesn't support this yet: see bug 73581
20582 # but it *should* omit the 'src' attribute if the image is bad.
20583 # PHP side of tests was disabled in
20584 # mediawiki/core:6bd31e7d95161a6e88fa86df60871051da997c3c
20585 # because of issues in the PHP parserTests infrastructure
20586 # (but the output below is indeed what the PHP side emits)
20587 !! test
20588 Bad images - basic functionality
20589 !! wikitext
20590 [[File:Bad.jpg]]
20591 !! DISABLED/html/php
20592 !! html/parsoid
20593 <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>
20594 !! end
20596 !! test
20597 Bad images - bug 16039: text after bad image disappears
20598 !! wikitext
20599 Foo bar
20600 [[File:Bad.jpg]]
20601 Bar foo
20602 !! DISABLED/html/php
20603 <p>Foo bar
20604 </p><p>Bar foo
20605 </p>
20606 !! html/parsoid
20607 <p>Foo bar
20608 <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>
20609 Bar foo</p>
20610 !! end
20612 !! test
20613 Verify that displaytitle works (bug #22501) no displaytitle
20614 !! options
20615 showtitle
20616 !! config
20617 wgAllowDisplayTitle=true
20618 wgRestrictDisplayTitle=false
20619 !! wikitext
20620 this is not the the title
20621 !! html/php
20622 Parser test
20623 <p>this is not the the title
20624 </p>
20625 !! end
20627 !! test
20628 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=false
20629 !! options
20630 showtitle
20631 title=[[Screen]]
20632 !! config
20633 wgAllowDisplayTitle=true
20634 wgRestrictDisplayTitle=false
20635 !! wikitext
20636 this is not the the title
20637 {{DISPLAYTITLE:whatever}}
20638 !! html/php
20639 whatever
20640 <p>this is not the the title
20641 </p>
20642 !! end
20644 !! test
20645 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true mismatch
20646 !! options
20647 showtitle
20648 title=[[Screen]]
20649 !! config
20650 wgAllowDisplayTitle=true
20651 wgRestrictDisplayTitle=true
20652 !! wikitext
20653 this is not the the title
20654 {{DISPLAYTITLE:whatever}}
20655 !! html/php
20656 Screen
20657 <p>this is not the the title
20658 <span class="error"><strong>Warning:</strong> Display title "whatever" was ignored since it is not equivalent to the page's actual title.</span>
20659 </p>
20660 !! end
20662 !! test
20663 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true matching
20664 !! options
20665 showtitle
20666 title=[[Screen]]
20667 !! config
20668 wgAllowDisplayTitle=true
20669 wgRestrictDisplayTitle=true
20670 !! wikitext
20671 this is not the the title
20672 {{DISPLAYTITLE:screen}}
20673 !! html/php
20674 screen
20675 <p>this is not the the title
20676 </p>
20677 !! end
20679 !! test
20680 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false
20681 !! options
20682 showtitle
20683 title=[[Screen]]
20684 !! config
20685 wgAllowDisplayTitle=false
20686 !! wikitext
20687 this is not the the title
20688 {{DISPLAYTITLE:screen}}
20689 !! html/php
20690 Screen
20691 <p>this is not the the title
20692 <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>
20693 </p>
20694 !! end
20696 !! test
20697 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false no DISPLAYTITLE
20698 !! options
20699 showtitle
20700 title=[[Screen]]
20701 !! config
20702 wgAllowDisplayTitle=false
20703 !! wikitext
20704 this is not the the title
20705 !! html/php
20706 Screen
20707 <p>this is not the the title
20708 </p>
20709 !! end
20711 !! test
20712 Verify that displaytitle handles inline CSS styles (bug 26547) - rejected value
20713 !! options
20714 showtitle
20715 title=[[Screen]]
20716 !! config
20717 wgAllowDisplayTitle=true
20718 wgRestrictDisplayTitle=true
20719 !! wikitext
20720 this is not the the title
20721 {{DISPLAYTITLE:<span style="display: none;">s</span>creen}}
20722 !! html/php
20723 <span style="/* attempt to bypass $wgRestrictDisplayTitle */">s</span>creen
20724 <p>this is not the the title
20725 </p>
20726 !! end
20728 !! test
20729 Verify that displaytitle handles inline CSS styles (bug 26547) - accepted value
20730 !! options
20731 showtitle
20732 title=[[Screen]]
20733 !! config
20734 wgAllowDisplayTitle=true
20735 wgRestrictDisplayTitle=true
20736 !! wikitext
20737 this is not the the title
20738 {{DISPLAYTITLE:<span style="color: red;">s</span>creen}}
20739 !! html/php
20740 <span style="color: red;">s</span>creen
20741 <p>this is not the the title
20742 </p>
20743 !! end
20745 !! test
20746 Page status indicators: Empty name is invalid
20747 !! options
20748 showindicators
20749 !! wikitext
20750 <indicator name=" "></indicator>
20751 <indicator></indicator>
20752 !! html
20753 <p><span class="error"><strong>Error:</strong> Page status indicators' <code>name</code> attribute must not be empty.</span>
20754 <span class="error"><strong>Error:</strong> Page status indicators' <code>name</code> attribute must not be empty.</span>
20755 </p>
20756 !! end
20758 !! test
20759 Page status indicators: Weird syntaxes that are okay
20760 !! options
20761 showindicators
20762 !! wikitext
20763 <indicator name="empty" />
20764 <indicator name="name"></indicator>
20765 !! html
20766 empty=
20767 name=
20768 <p><br />
20769 </p>
20770 !! end
20772 !! test
20773 Page status indicators: Torture test
20774 !! options
20775 showindicators
20776 !! wikitext
20777 <indicator name="01">hello world</indicator>
20778 <indicator name="02">[[Main Page]]</indicator>
20779 <indicator name="03">[[File:Foobar.jpg|25px|link=]]</indicator>
20780 <indicator name="04">[[File:Foobar.jpg|25px]]</indicator>
20781 <indicator name="05">* foo
20782 * bar</indicator>
20783 <indicator name="06"><nowiki>foo</nowiki></indicator>
20784 <indicator name="07"> Preformatted</indicator>
20785 <indicator name="08"><div>Broken tag</indicator>
20786 <indicator name="09">{| class=wikitable
20787 | cell
20788 |}</indicator>
20789 <indicator name="10">Two
20791 paragraphs</indicator>
20792 !! html
20793 01=hello world
20794 02=<a href="/wiki/Main_Page" title="Main Page">Main Page</a>
20795 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" />
20796 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>
20797 05=<ul><li> foo</li>
20798 <li> bar</li></ul>
20800 06=foo
20801 07=<pre>Preformatted
20802 </pre>
20803 08=<div>Broken tag</div>
20805 09=<table class="wikitable">
20806 <tr>
20807 <td> cell
20808 </td></tr></table>
20810 10=<p>Two
20811 </p><p>paragraphs
20812 </p>
20813 <p><br />
20814 </p><p><br />
20815 </p><p><br />
20816 </p><p><br />
20817 </p><p><br />
20818 </p>
20819 !! end
20821 !! test
20822 preload: check <noinclude> and <includeonly>
20823 !! options
20824 preload
20825 !! wikitext
20826 Hello <noinclude>cruel</noinclude><includeonly>kind</includeonly> world.
20827 !! html/php
20828 Hello kind world.
20829 !! end
20831 !! test
20832 preload: check <onlyinclude>
20833 !! options
20834 preload
20835 !! wikitext
20836 Goodbye <onlyinclude>Hello world</onlyinclude>
20837 !! html/php
20838 Hello world
20839 !! end
20841 !! test
20842 preload: can pass tags through if we want to
20843 !! options
20844 preload
20845 !! wikitext
20846 <includeonly><</includeonly>includeonly>Hello world<includeonly><</includeonly>/includeonly>
20847 !! html/php
20848 <includeonly>Hello world</includeonly>
20849 !! end
20851 !! test
20852 preload: check that it doesn't try to do tricks
20853 !! options
20854 preload
20855 !! wikitext
20856 * <!-- Hello --> ''{{world}}'' {{<includeonly>subst:</includeonly>How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
20857 !! html/php
20858 * <!-- Hello --> ''{{world}}'' {{subst:How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
20859 !! end
20861 !! test
20862 Play a bit with r67090 and bug 3158
20863 !! wikitext
20864 <div style="width:50% !important">&nbsp;</div>
20865 <div style="width:50%&nbsp;!important">&nbsp;</div>
20866 <div style="width:50%&#160;!important">&nbsp;</div>
20867 <div style="border : solid;">&nbsp;</div>
20868 !! html/php
20869 <div style="width:50% !important">&#160;</div>
20870 <div style="width:50% !important">&#160;</div>
20871 <div style="width:50% !important">&#160;</div>
20872 <div style="border&#160;: solid;">&#160;</div>
20874 !! html/parsoid
20875 <div style="width:50% !important" data-parsoid='{"stx":"html"}'><span typeof="mw:Entity" data-parsoid='{"srcContent":" "}'> </span></div>
20876 <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>
20877 <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>
20878 <div style="border : solid;" data-parsoid='{"stx":"html"}'><span typeof="mw:Entity" data-parsoid='{"srcContent":" "}'> </span></div>
20880 !! end
20882 !! test
20883 HTML5 data attributes
20884 !! wikitext
20885 <span data-foo="bar">Baz</span>
20886 <p data-abc-def_hij="">Quuz</p>
20887 !! html/php
20888 <p><span data-foo="bar">Baz</span>
20889 </p>
20890 <p data-abc-def_hij="">Quuz</p>
20892 !! html/parsoid
20893 <p><span data-foo="bar" data-parsoid='{"stx":"html"}'>Baz</span></p>
20894 <p data-abc-def_hij="" data-parsoid='{"stx":"html"}'>Quuz</p>
20895 !! end
20897 !! test
20898 Strip reserved data attributes
20899 !! wikitext
20900 <div data-mw="foo" data-parsoid="bar" data-mw-someext="baz" data-ok="fred" data-ooui="xyzzy" data-bad:ns="ns">d</div>
20901 !! html/php
20902 <div data-ok="fred">d</div>
20904 !! html/parsoid
20905 <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>
20906 !! end
20908 !! test
20909 percent-encoding and + signs in internal links (Bug 26410)
20910 !! wikitext
20911 [[User:+%]] [[Page+title%]]
20912 [[%+]] [[%+|%20]] [[%+ ]] [[%+r]]
20913 [[%]] [[+]] [[File:%+abc%39|foo|[[bar]]]]
20914 [[%33%45]] [[%33%45+]]
20915 !! html/php
20916 <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>
20917 <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>
20918 <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>
20919 <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>
20920 </p>
20921 !! html/parsoid
20922 <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>
20923 <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>
20924 <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>
20925 <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>
20926 !! end
20928 !! test
20929 Special characters in embedded file links (bug 27679)
20930 !! wikitext
20931 [[File:Contains & ampersand.jpg]]
20932 [[File:Does not exist.jpg|Title with & ampersand]]
20933 !! html/php
20934 <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>
20935 <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>
20936 </p>
20937 !! html/parsoid
20938 <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>
20939 <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>
20940 !! end
20942 !! test
20943 Confirm that 'apos' named character reference doesn't make it to output (not legal in HTML 4)
20944 !! wikitext
20945 Text&apos;s been normalized?
20946 !! html
20947 <p>Text&#39;s been normalized?
20948 </p>
20949 !! end
20951 !! test
20952 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate free external links
20953 !! wikitext
20954 http://www.example.org/ <-- U+3000 (vim: ^Vu3000)
20955 !! html
20956 <p><a rel="nofollow" class="external free" href="http://www.example.org/">http://www.example.org/</a> &lt;-- U+3000 (vim: ^Vu3000)
20957 </p>
20958 !! end
20960 !! test
20961 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate bracketed external links
20962 !! wikitext
20963 [http://www.example.org/ ideograms]
20964 !! html
20965 <p><a rel="nofollow" class="external text" href="http://www.example.org/">ideograms</a>
20966 </p>
20967 !! end
20969 !! test
20970 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate external images links
20971 !! wikitext
20972 http://www.example.org/pic.png <-- U+3000 (vim: ^Vu3000)
20973 !! html
20974 <p><img src="http://www.example.org/pic.png" alt="pic.png"/> &lt;-- U+3000 (vim: ^Vu3000)
20975 </p>
20976 !! end
20978 !! article
20979 Mediawiki:loop1
20980 !! text
20981 {{Identical|A}}
20982 !! endarticle
20984 !! article
20985 Mediawiki:loop2
20986 !! text
20987 {{Identical|B}}
20988 !! endarticle
20990 !! article
20991 Template:Identical
20992 !! text
20993 {{int:loop1}}
20994 {{int:loop2}}
20995 !! endarticle
20997 !! test
20998 Bug 31098 Template which includes system messages which includes the template
20999 !! wikitext
21000 {{Identical}}
21001 !! html
21002 <p><span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
21003 <span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
21004 </p>
21005 !! end
21007 !! test
21008 Bug31490 Turkish: ucfirst 'blah'
21009 !! options
21010 language=tr
21011 !! wikitext
21012 {{ucfirst:blah}}
21013 !! html
21014 <p>Blah
21015 </p>
21016 !! end
21018 !! test
21019 Bug31490 Turkish: ucfirst 'ix'
21020 !! options
21021 language=tr
21022 !! wikitext
21023 {{ucfirst:ix}}
21024 !! html
21025 <p>İx
21026 </p>
21027 !! end
21029 !! test
21030 Bug31490 Turkish: lcfirst 'BLAH'
21031 !! options
21032 language=tr
21033 !! wikitext
21034 {{lcfirst:BLAH}}
21035 !! html
21036 <p>bLAH
21037 </p>
21038 !! end
21040 !! test
21041 Bug31490 Turkish: ucfırst (with a dotless i)
21042 !! options
21043 language=tr
21044 !! wikitext
21045 {{ucfırst:blah}}
21046 !! html
21047 <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>
21048 </p>
21049 !! end
21051 !! test
21052 Bug31490 ucfırst (with a dotless i) with English language
21053 !! options
21054 language=en
21055 !! wikitext
21056 {{ucfırst:blah}}
21057 !! html
21058 <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>
21059 </p>
21060 !! end
21062 !! test
21063 Bug 26375: TOC with italics
21064 !! options
21065 title=[[Main Page]]
21066 !! wikitext
21067 __TOC__
21068 == ''Lost'' episodes ==
21069 !! html
21070 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
21071 <ul>
21072 <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>
21073 </ul>
21074 </div>
21076 <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>
21078 !! end
21080 !! test
21081 Bug 26375: TOC with bold
21082 !! options
21083 title=[[Main Page]]
21084 !! wikitext
21085 __TOC__
21086 == '''should be bold''' then normal text ==
21087 !! html
21088 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
21089 <ul>
21090 <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>
21091 </ul>
21092 </div>
21094 <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>
21096 !! end
21098 !! test
21099 Bug 33845: Headings become cursive in TOC when they contain an image
21100 !! options
21101 title=[[Main Page]]
21102 !! wikitext
21103 __TOC__
21104 == Image [[Image:foobar.jpg]] ==
21105 !! html
21106 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
21107 <ul>
21108 <li class="toclevel-1 tocsection-1"><a href="#Image"><span class="tocnumber">1</span> <span class="toctext">Image</span></a></li>
21109 </ul>
21110 </div>
21112 <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>
21114 !! end
21116 !! test
21117 Bug 33845 (2): Headings become bold in TOC when they contain a blockquote
21118 !! options
21119 title=[[Main Page]]
21120 !! wikitext
21121 __TOC__
21122 == <blockquote>Quote</blockquote> ==
21123 !! html
21124 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
21125 <ul>
21126 <li class="toclevel-1 tocsection-1"><a href="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
21127 </ul>
21128 </div>
21130 <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>
21132 !! html+tidy
21133 <p></p>
21134 <div id="toc" class="toc">
21135 <div id="toctitle">
21136 <h2>Contents</h2>
21137 </div>
21138 <ul>
21139 <li class="toclevel-1 tocsection-1"><a href="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
21140 </ul>
21141 </div>
21142 <p></p>
21143 <h2><span class="mw-headline" id="Quote"></span></h2>
21144 <blockquote>
21145 <p><span class="mw-headline" id="Quote">Quote</span></p>
21146 </blockquote>
21147 <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>
21148 !! end
21150 !! test
21151 Unclosed tags in TOC
21152 !! options
21153 title=[[Main Page]]
21154 !! wikitext
21155 __TOC__
21156 == Proof: 2 < 3 ==
21157 <small>Hanc marginis exiguitas non caperet.</small>
21159 !! html
21160 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
21161 <ul>
21162 <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>
21163 </ul>
21164 </div>
21166 <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>
21167 <p><small>Hanc marginis exiguitas non caperet.</small>
21169 </p>
21170 !! end
21172 !! test
21173 Multiple tags in TOC
21174 !! wikitext
21175 __TOC__
21176 == <i>Foo</i> <b>Bar</b> ==
21178 == <i>Foo</i> <blockquote>Bar</blockquote> ==
21179 !! html
21180 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
21181 <ul>
21182 <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>
21183 <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>
21184 </ul>
21185 </div>
21187 <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>
21188 <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>
21190 !! html+tidy
21191 <p></p>
21192 <div id="toc" class="toc">
21193 <div id="toctitle">
21194 <h2>Contents</h2>
21195 </div>
21196 <ul>
21197 <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>
21198 <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>
21199 </ul>
21200 </div>
21201 <p></p>
21202 <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>
21203 <h2><span class="mw-headline" id="Foo_Bar_2"><i>Foo</i></span></h2>
21204 <blockquote>
21205 <p><span class="mw-headline" id="Foo_Bar_2">Bar</span></p>
21206 </blockquote>
21207 <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>
21208 !! end
21210 # Don't expect Parsoid to roundtrip this until the php parser comes closer to
21211 # html5 tag parsing.
21212 !! test
21213 Tags with parameters in TOC
21214 !! options
21215 parsoid=wt2html
21216 !! wikitext
21217 __TOC__
21218 == <sup class="in-h2">Hello</sup> ==
21220 == <sup class="a > b">Evilbye</sup> ==
21221 !! html/php
21222 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
21223 <ul>
21224 <li class="toclevel-1 tocsection-1"><a href="#Hello"><span class="tocnumber">1</span> <span class="toctext"><sup>Hello</sup></span></a></li>
21225 <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>
21226 </ul>
21227 </div>
21229 <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>
21230 <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>
21232 !! html/parsoid
21233 <meta property="mw:PageProp/toc" />
21234 <h2> <sup class="in-h2" data-parsoid='{"stx":"html"}'>Hello</sup> </h2>
21236 <h2> <sup class="a " data-parsoid='{"stx":"html"}'> b">Evilbye</sup> </h2>
21237 !! end
21239 !! test
21240 span tags with directionality in TOC
21241 !! wikitext
21242 __TOC__
21243 == <span dir="ltr">C++</span> ==
21245 == <span dir="rtl">זבנג!</span> ==
21247 == <span style="font-style: italic">The attributes on these span tags must be deleted from the TOC</span> ==
21249 == <span style="font-style: italic" dir="ltr">All attributes on these span tags must be deleted from the TOC</span> ==
21251 == <span dir="ltr" style="font-style: italic">Attributes after dir on these span tags must be deleted from the TOC</span> ==
21252 !! html
21253 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
21254 <ul>
21255 <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>
21256 <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>
21257 <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>
21258 <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>
21259 <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>
21260 </ul>
21261 </div>
21263 <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>
21264 <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>
21265 <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>
21266 <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>
21267 <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>
21269 !! end
21271 !! test
21272 Bug 72884: bdi element in ToC
21273 !! wikitext
21274 __TOC__
21275 == <bdi>test</bdi> ==
21276 !! html
21277 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
21278 <ul>
21279 <li class="toclevel-1 tocsection-1"><a href="#test"><span class="tocnumber">1</span> <span class="toctext"><bdi>test</bdi></span></a></li>
21280 </ul>
21281 </div>
21283 <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>
21285 !! end
21287 # Note that the html output does not have the <p></p>, but the
21288 # html+tidy output *does*.  This is because the empty <p></p> is
21289 # removed by the sanitizer, but only when tidy is *not* enabled (!).
21290 !! test
21291 Empty <p> tag in TOC, removed by Sanitizer (T92892)
21292 !! wikitext
21293 __TOC__
21294 == x ==
21295 !! html
21296 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
21297 <ul>
21298 <li class="toclevel-1 tocsection-1"><a href="#x"><span class="tocnumber">1</span> <span class="toctext">x</span></a></li>
21299 </ul>
21300 </div>
21302 <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>
21304 !! html+tidy
21305 <p></p>
21306 <div id="toc" class="toc">
21307 <div id="toctitle">
21308 <h2>Contents</h2>
21309 </div>
21310 <ul>
21311 <li class="toclevel-1 tocsection-1"><a href="#x"><span class="tocnumber">1</span> <span class="toctext">x</span></a></li>
21312 </ul>
21313 </div>
21314 <p></p>
21315 <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>
21316 !! end
21318 !! article
21319 MediaWiki:Bug32057
21320 !! text
21321 == {{int:headline_sample}} ==
21322 !! endarticle
21324 !! test
21325 Bug 32057: Title needed when expanding <h> nodes.
21326 !! options
21327 title=[[Main Page]]
21328 !! wikitext
21329 {{int:Bug32057}}
21330 !! html
21331 <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>
21333 !! end
21335 !! test
21336 Strip marker in urlencode
21337 !! wikitext
21338 {{urlencode:x<nowiki/>y}}
21339 {{urlencode:x<nowiki/>y|wiki}}
21340 {{urlencode:x<nowiki/>y|path}}
21341 {{urlencode:x<pre id="one">two</pre>y}}
21342 !! html
21343 <p>xy
21347 </p>
21348 !! end
21350 !! test
21351 Strip marker in lc
21352 !! wikitext
21353 {{lc:x<nowiki/>y}}
21354 !! html
21355 <p>xy
21356 </p>
21357 !! end
21359 !! test
21360 Strip marker in uc
21361 !! wikitext
21362 {{uc:x<nowiki/>y}}
21363 !! html
21364 <p>XY
21365 </p>
21366 !! end
21368 !! test
21369 Strip marker in formatNum
21370 !! wikitext
21371 {{formatnum:1<nowiki/>2}}
21372 {{formatnum:1<nowiki/>2|R}}
21373 !! html
21374 <p>12
21376 </p>
21377 !! end
21379 !! test
21380 Check noCommafy in formatNum
21381 !! options
21382 language=be-tarask
21383 !! wikitext
21384 {{formatnum:123456.78}}
21385 {{formatnum:123456.78|NOSEP}}
21386 !! html
21387 <p>123 456,78
21388 123456.78
21389 </p>
21390 !! end
21392 !! test
21393 Wrong option for formatNum (bug 56199)
21394 !! wikitext
21395 {{formatnum:1,234.56|Random}}
21396 {{formatnum:1,234.56|EVERYTHING}}
21397 {{formatnum:1234.56|any argument that has the string 'NOSEP'}}
21398 !! html
21399 <p>1,234.56
21400 1,234.56
21401 1,234.56
21402 </p>
21403 !! end
21405 !! test
21406 Strip marker in grammar
21407 !! options
21408 language=fi
21409 !! wikitext
21410 {{grammar:elative|foo<nowiki/>bar}}
21411 !! html
21412 <p>foobarista
21413 </p>
21414 !! end
21416 !! test
21417 Strip marker in padleft
21418 !! wikitext
21419 {{padleft:|2|x<nowiki/>y}}
21420 !! html
21421 <p>xy
21422 </p>
21423 !! end
21425 !! test
21426 Strip marker in padright
21427 !! wikitext
21428 {{padright:|2|x<nowiki/>y}}
21429 !! html
21430 <p>xy
21431 </p>
21432 !! end
21434 !! test
21435 Strip marker in anchorencode
21436 !! wikitext
21437 {{anchorencode:x<nowiki/>y}}
21438 !! html
21439 <p>xy
21440 </p>
21441 !! end
21443 !! test
21444 nowiki inside link inside heading (bug 18295)
21445 !! wikitext
21446 ==[[foo|x<nowiki>y</nowiki>z]]==
21447 !! html
21448 <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>
21450 !! end
21452 !! test
21453 new support for bdi element (bug 31817)
21454 !! wikitext
21455 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
21456 !! html
21457 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
21459 !!end
21461 !! test
21462 Ignore pipe between table row attributes
21463 !! wikitext
21465 | quux
21466 |- id=foo | style='color: red'
21467 | bar
21469 !! html
21470 <table>
21471 <tr>
21472 <td> quux
21473 </td></tr>
21474 <tr id="foo" style="color: red">
21475 <td> bar
21476 </td></tr></table>
21478 !! end
21480 !!test
21481 Gallery override link with WikiLink (bug 34852)
21482 !! wikitext
21483 <gallery>
21484 File:foobar.jpg|caption|alt=galleryalt|link=InterWikiLink
21485 </gallery>
21486 !! html
21487 <ul class="gallery mw-gallery-traditional">
21488                 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21489                         <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>
21490                         <div class="gallerytext">
21491 <p>caption
21492 </p>
21493                         </div>
21494                 </div></li>
21495 </ul>
21497 !! end
21499 !!test
21500 Gallery override link with absolute external link (bug 34852)
21501 !! wikitext
21502 <gallery>
21503 File:foobar.jpg|caption|alt=galleryalt|link=http://www.example.org
21504 </gallery>
21505 !! html
21506 <ul class="gallery mw-gallery-traditional">
21507                 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21508                         <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>
21509                         <div class="gallerytext">
21510 <p>caption
21511 </p>
21512                         </div>
21513                 </div></li>
21514 </ul>
21516 !! end
21518 !!test
21519 Gallery override link with malicious javascript (bug 34852)
21520 !! wikitext
21521 <gallery>
21522 File:foobar.jpg|caption|alt=galleryalt|link=" onclick="alert('malicious javascript code!');
21523 </gallery>
21524 !! html
21525 <ul class="gallery mw-gallery-traditional">
21526                 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21527                         <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>
21528                         <div class="gallerytext">
21529 <p>caption
21530 </p>
21531                         </div>
21532                 </div></li>
21533 </ul>
21535 !! end
21537 !!test
21538 Gallery with invalid title as link (bug 43964)
21539 !! wikitext
21540 <gallery>
21541 File:foobar.jpg|link=<
21542 </gallery>
21543 !! html
21544 <ul class="gallery mw-gallery-traditional">
21545                 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21546                         <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>
21547                         <div class="gallerytext">
21548                         </div>
21549                 </div></li>
21550 </ul>
21552 !! end
21554 !!test
21555 Language parser function
21556 !! wikitext
21557 {{#language:ar}}
21558 !! html
21559 <p>العربية
21560 </p>
21561 !! end
21563 !!test
21564 Padleft and padright as substr
21565 !! wikitext
21566 {{padleft:|3|abcde}}
21567 {{padright:|3|abcde}}
21568 !! html
21569 <p>abc
21571 </p>
21572 !! end
21574 !!test
21575 Special parser function
21576 !! wikitext
21577 {{#special:RandomPage}}
21578 {{#special:BaDtItLe}}
21579 {{#special:Foobar}}
21580 !! html
21581 <p>Special:Random
21582 Special:Badtitle
21583 Special:Foobar
21584 </p>
21585 !! end
21587 !!test
21588 Bug 34939 - Case insensitive link parsing ([HttP://])
21589 !! wikitext
21590 [HttP://MediaWiki.Org/]
21591 !! html/php
21592 <p><a rel="nofollow" class="external autonumber" href="HttP://MediaWiki.Org/">[1]</a>
21593 </p>
21594 !! html/parsoid
21595 <p><a rel="mw:ExtLink" href="HttP://MediaWiki.Org/"></a></p>
21596 !! end
21598 !!test
21599 Bug 34939 - Case insensitive link parsing ([HttP:// title])
21600 !! wikitext
21601 [HttP://MediaWiki.Org/ MediaWiki]
21602 !! html
21603 <p><a rel="nofollow" class="external text" href="HttP://MediaWiki.Org/">MediaWiki</a>
21604 </p>
21605 !! end
21607 !!test
21608 Bug 34939 - Case insensitive link parsing (HttP://)
21609 !! wikitext
21610 HttP://MediaWiki.Org/
21611 !! html/php
21612 <p><a rel="nofollow" class="external free" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a>
21613 </p>
21614 !! html/parsoid
21615 <p><a rel="mw:ExtLink" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a></p>
21616 !! end
21618 !!test
21619 Disable TOC
21620 !! options
21621 notoc
21622 !! wikitext
21623 Lead
21624 == Section 1 ==
21625 == Section 2 ==
21626 == Section 3 ==
21627 == Section 4 ==
21628 == Section 5 ==
21629 !! html
21630 <p>Lead
21631 </p>
21633 <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>
21634 <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>
21635 <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>
21636 <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>
21637 <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>
21639 !! end
21643 ### Parsoid-specific tests
21644 ### Parsoid-PHP parser incompatibilities
21646 !!test
21647 1. SOL-sensitive wikitext tokens as template-args
21648 !!options
21649 parsoid=wt2html,wt2wt
21650 !! wikitext
21651 {{echo|*a}}
21652 {{echo|#a}}
21653 {{echo|:a}}
21654 !! html
21655 <span about="#mwt1" typeof="mw:Transclusion">
21656 </span><ul about="#mwt1"><li>a</li>
21657 </ul>
21658 <span about="#mwt2" typeof="mw:Transclusion">
21659 </span><ol about="#mwt2"><li>a</li>
21660 </ol>
21661 <span about="#mwt3" typeof="mw:Transclusion">
21662 </span><dl about="#mwt3"><dd>a</dd>
21663 </dl>
21664 !!end
21666 #### -----------------------------------------------------------------
21667 #### Parsoid-specific functionality tests
21668 #### -----------------------------------------------------------------
21670 # Bug 63642/66749: Formatting elt fixup around images is cleaned up.
21671 # We know wt2wt will fail, but we expect selser to pass.
21672 # Due to the nature of our testing, wt2wt and selser tests will enter the
21673 # blacklist and we'll catch selser regressions based on changes to the
21674 # blacklist entries for selser tests.
21675 !! test
21676 1. Bad treebuilder fixup of formatting elt is cleaned up
21677 !! options
21678 parsoid=wt2html,wt2wt
21679 !! wikitext
21682 <small>
21683 [[Image:Foobar.jpg|right|Test]]
21684 </small>
21686 !! html/parsoid
21687 <table>
21688 <tbody><tr><td>
21689 <small>
21690 <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>
21691 </small>
21692 </td></tr>
21693 </tbody></table>
21694 !! end
21696 !! test
21697 2. Bad treebuilder fixup of formatting elt is cleaned up
21698 !! options
21699 parsoid=wt2html,wt2wt
21700 !! wikitext
21701 '''foo[[File:Foobar.jpg|thumb|caption]]bar'''
21703 <small>[[Image:Foobar.jpg|right|300px]]</small>
21704 !! html/parsoid
21706 <p><b>foo</b></p>
21707 <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>
21708 <p><b>bar</b></p>
21709 <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>
21710 !! end
21712 !! test
21713 3. Bad treebuilder fixup of formatting elt is cleaned up
21714 !! options
21715 parsoid=wt2html,wt2wt
21716 !! wikitext
21717 <small>'''foo[[File:Foobar.jpg|thumb|caption]]bar'''</small>
21718 !! html/parsoid
21719 <p><small><b>foo</b></small></p>
21720 <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>
21721 <p><small><b>bar</b></small></p>
21722 !! end
21724 !! test
21725 4. Bad treebuilder fixup of formatting elt is cleaned up: formatting tags around captionless images are ignored
21726 !! options
21727 parsoid=wt2html,wt2wt
21728 !! wikitext
21729 '''<small>[[Image:Foobar.jpg|right|300px]]</small>'''
21730 !! html/parsoid
21731 <p><b><small></small></b></p>
21732 <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>
21733 <p></p>
21734 !! end
21736 #### ----------------------------------------------------------------
21737 #### Parsoid-only testing of Parsoid's impl of <ref> and <references>
21738 #### tags. Parsoid's output for these tags differs from that of the
21739 #### PHP parser.
21740 #### ----------------------------------------------------------------
21742 !!test
21743 Ref: 1. ref-location should be replaced with an index span
21744 !! wikitext
21745 A <ref>foo</ref>
21746 B <ref name="x">foo</ref>
21747 C <ref name="y" />
21748 <references />
21749 !! html/parsoid
21750 <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>
21751 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>
21752 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>
21753 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt8" data-mw='{"name":"references","attrs":{}}'>
21754 <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>
21755 <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>
21756 <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>
21757 </ol>
21758 !!end
21760 !!test
21761 Ref: 2. ref-tags with identical names should all get the same index
21762 !! wikitext
21763 A <ref name="x">foo</ref>
21764 B <ref name="x" />
21765 <references />
21766 !! html/parsoid
21767 <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>
21768 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>
21769 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
21770 <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>
21771 </ol>
21772 !!end
21774 !!test
21775 Ref: 3. spaces in ref-names should be ignored
21776 !! wikitext
21777 A <ref name="x">foo</ref>
21778 B <ref name=" x " />
21779 C <ref name= x  />
21780 <references />
21781 !! html/parsoid
21782 <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>
21783 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>
21784 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>
21785 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt8" data-mw='{"name":"references","attrs":{}}'>
21786 <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>
21787 </ol>
21788 !!end
21790 # NOTE: constructor is a predefined property in JS and constructor as a ref-name can clash with it if not handled properly)
21791 !!test
21792 Ref: 4. 'constructor' should be accepted as a valid ref-name
21793 !! wikitext
21794 A <ref name="constructor">foo</ref>
21795 <references />
21796 !! html/parsoid
21797 <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>
21798 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
21799 <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>
21800 </ol>
21801 !!end
21803 !!test
21804 Ref: 5. body should accept generic wikitext
21805 !! wikitext
21806 A <ref>
21807  This is a '''[[bolded link]]''' and this is a {{echo|transclusion}}
21808 </ref>
21810 <references />
21811 !! html/parsoid
21812 <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>
21814 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'>
21815 <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>
21816 </span></li>
21817 </ol>
21818 !!end
21820 !!test
21821 Ref: 6. indent-pres should not be output in ref-body
21822 !! wikitext
21823 A <ref>
21824  foo
21825  bar
21826  baz
21827 </ref>
21829 <references />
21830 !! html/parsoid
21831 <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>
21833 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
21834 <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
21835  bar
21836  baz
21837 </span></li>
21838 </ol>
21839 !!end
21841 !!test
21842 Ref: 7. No p-wrapping in ref-body
21843 !! wikitext
21844 A <ref>
21854 booz
21855 </ref>
21857 <references />
21858 !! html/parsoid
21859 <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>
21861 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
21862 <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
21871 booz
21872 </span></li>
21873 </ol>
21874 !!end
21876 !!test
21877 Ref: 8. transclusion wikitext has lower precedence
21878 !! wikitext
21879 A <ref> foo {{echo|</ref> B C}}
21881 <references />
21882 !! html/parsoid
21883 <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>
21884 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
21885 <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>
21886 </ol>
21887 !!end
21889 !!test
21890 Ref: 9. unclosed comments should not leak out of ref-body
21891 !! wikitext
21892 A <ref> foo <!--</ref> B C
21893 <references />
21894 !! html/parsoid
21895 <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>
21896 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
21897 <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>
21898 </ol>
21899 !!end
21901 !!test
21902 Ref: 10. Unclosed HTML tags should not leak out of ref-body
21903 !! wikitext
21904 A <ref> <b> foo </ref> B C
21906 <references />
21907 !! html/parsoid
21908 <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>
21911 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
21912 <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>
21913 </ol>
21914 !!end
21916 !!test
21917 Ref: 11. ref-tags acts like an inline element wrt P-wrapping
21918 !! wikitext
21919 A <ref>foo</ref> B
21920 C <ref>bar</ref> D
21921 <references />
21922 !! html/parsoid
21923 <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
21924 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>
21925 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
21926 <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>
21927 <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>
21928 </ol>
21929 !!end
21931 !!test
21932 Ref: 12. ref-tags act as trailing newline migration barrier
21933 !! wikitext
21934 <!--the newline at the end of this line moves out of the p tag-->a
21936 b<!--the newline at the end of this line stays inside the p tag--> <ref />
21937 <ref />
21940 <references />
21941 !! html/parsoid
21942 <!--the newline at the end of this line moves out of the p tag--><p>a</p>
21945 <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>
21946 <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>
21948 <p>c</p>
21949 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
21950 <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>
21951 <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>
21952 !!end
21954 !!test
21955 Ref: 13. ref-tags are not SOL-transparent and block indent-pres
21956 !! wikitext
21957 <ref>foo</ref> A
21958 <ref>bar
21959 </ref> B
21960 <references />
21961 !! html/parsoid
21962 <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
21963 <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>
21964 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
21965 <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>
21966 <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
21967 </span></li>
21968 </ol>
21969 !!end
21971 !!test
21972 Ref: 14. A nested ref-tag should be emitted as plain text
21973 !! wikitext
21974 <ref>foo <ref>bar</ref> baz</ref>
21976 <references />
21977 !! html/parsoid
21978 <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>
21979 </p>
21980 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'>
21981 <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>
21982 </ol>
21983 !!end
21985 !!test
21986 Ref: 15. ref-tags with identical names should get identical indexes
21987 !! wikitext
21988 A1 <ref name="a">foo</ref> A2 <ref name="a" />
21989 B1 <ref name="b" /> B2 <ref name="b">bar</ref>
21991 <references />
21992 !! html/parsoid
21993 <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>
21994 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>
21996 <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>
21997 </ol>
21998 !!end
22000 ## We don't bother wt2wt-ing non-standard whitespace
22001 !!test
22002 Ref: 16. Tokenizer should accept non-standard whitespace in <ref> and </ref> tags
22003 !!options
22004 parsoid=wt2html
22005 !! wikitext
22006 A <ref >foo</ref >
22008 <references />
22009 !! html/parsoid
22010 <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>
22011 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
22012 <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>
22013 !!end
22015 !!test
22016 Ref: 17. Generate valid HTML5 id/about attributes
22017 !!wikitext
22018 <ref name="a b">foo</ref>
22020 <references />
22021 !!html/parsoid
22022 <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>
22023 </p>
22025 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
22026 <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>
22027 </ol>
22028 !!end
22030 !!test
22031 Ref: 18. T58916: Extension attributes should be parsed as plain text
22032 !!wikitext
22033 <ref name="{{echo|a}}">foo</ref>
22035 <references />
22036 !!html/parsoid
22037 <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>
22038 </p>
22040 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
22041 <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>
22042 </ol>
22043 !!end
22045 !!test
22046 Ref: 19. ref-tags with identical name encodings should get identical indexes
22047 !! wikitext
22048 1 <ref name="a & b">foo</ref> 2 <ref name="a &amp; b" />
22050 <references />
22051 !! html/parsoid
22052 <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>
22053 </p>
22054 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
22055 <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>
22056 </ol>
22057 !!end
22059 !!test
22060 Ref: 20. ref-tags with identical names but different content should keep it
22061 !! wikitext
22062 A <ref name="foo">Foo one</ref>
22063 B <ref name="foo">Foo two</ref>
22064 C <ref name="foo" />
22066 <references />
22067 !! html/parsoid
22068 <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>
22069 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>
22070 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>
22072 <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>
22073 </ol>
22074 !!end
22076 !!test
22077 References: 1. references tag without any refs should be handled properly
22078 !! wikitext
22079 <references />
22080 !! html/parsoid
22081 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt2" data-mw='{"name":"references","attrs":{}}'></ol>
22082 !!end
22084 !!test
22085 References: 2. references tag with group only outputs references from that group
22086 !! wikitext
22087 A <ref group="a">foo</ref>
22088 B <ref group="b">bar</ref>
22089 C <ref>baz</ref>
22091 <references group="a" />
22092 <references />
22093 <references group="b" />
22094 !! html/parsoid
22095 <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>
22096 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>
22097 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>
22099 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt8" data-mw-group="a" data-mw='{"name":"references","attrs":{"group":"a"}}'>
22100 <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>
22101 </ol>
22102 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt10" data-mw='{"name":"references","attrs":{}}'>
22103 <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>
22104 </ol>
22105 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt12" data-mw-group="b" data-mw='{"name":"references","attrs":{"group":"b"}}'>
22106 <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>
22107 </ol>
22108 !!end
22110 !!test
22111 References: 3. ref list should be cleared after processing references
22112 !! wikitext
22113 A <ref>foo</ref>
22115 <references />
22117 B <ref>bar</ref>
22119 <references />
22120 !! html/parsoid
22121 <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>
22123 <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>
22124 </ol>
22126 <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>
22128 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt8" data-mw='{"name":"references","attrs":{}}'>
22129 <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>
22130 </ol>
22131 !!end
22133 !!test
22134 References: 4. only referenced group should be cleared after processing references
22135 !! wikitext
22136 A <ref group="a">afoo</ref>
22137 B <ref>bfoo</ref>
22139 <references group="a" />
22141 C <ref>cfoo</ref>
22143 <references />
22144 !! html/parsoid
22145 <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>
22146 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>
22148 <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>
22149 </ol>
22151 <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>
22153 <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>
22154 </ol>
22155 !!end
22157 ## Don't expect this to rt since we're dropping content
22158 !! test
22159 References: 5. ref tags in references should be processed while ignoring all other content
22160 !! options
22161 parsoid=wt2html,html2html
22162 !! wikitext
22163 A <ref name="a" />
22164 B <ref name="b">bar</ref>
22166 <references>
22167 <ref name="a">foo</ref>
22168 This should just get lost.
22169 </references>
22170 !! html/parsoid
22171 <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>
22172 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>
22175 <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>
22176 </ol>
22177 !! end
22179 !! test
22180 References: 6. <references /> from a transclusion
22181 !! wikitext
22182 <ref>Foo</ref> {{echo|<references />}}
22183 !! html/parsoid
22184 <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>
22185 </ol>
22186 !! end
22188 !! test
22189 References: 7. Multiple references tags (one without and one with nested refs) should be correctly handled
22190 !! wikitext
22191 A <ref>foo bar for a</ref>
22192 B <ref group="X" name="b" />
22194 <references />
22196 <references group="X">
22197 <ref name="b">foo</ref>
22198 </references>
22199 !! html/parsoid
22200 <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>
22201 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>
22202 </p>
22204 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
22205 <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>
22206 </ol>
22208 <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"}}'>
22209 <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>
22210 </ol>
22211 !! end
22213 !! test
22214 References: 8. T88019: Remove <meta>s from templates inside <ref> that's itself inside a template
22215 !! wikitext
22216 X{{echo|<ref>foo {{echo|<b>bar</b>}} and {{echo|baz}} boo</ref>}}
22217 <references />
22218 !! html/parsoid
22219 <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>
22220 <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>
22221 </ol>
22222 !!end
22224 # This test only works in wt2html now as the <references /> are always generated
22225 # unless selser is active. Once T72722 is fixed, we should add a changes test
22226 # here to ensure that unrelated changes don't add the new <references />
22227 # when selser is active.
22228 !! test
22229 References: 9. Generate missing references list at the end
22230 !! wikitext
22231 A <ref>foo</ref>
22232 B <ref group="inexistent">bar</ref>
22233 !! html/parsoid
22234 <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>
22235 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{},"autoGenerated":true}'>
22236 <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>
22237 </ol>
22238 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw-group="inexistent" data-mw='{"name":"references","attrs":{"group":"inexistent"},"autoGenerated":true}'>
22239 <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>
22240 </ol>
22241 !! end
22243 !! test
22244 References: 10. New <references/> shouldn't be added for unrelated edits.
22245 !! options
22246 parsoid={
22247   "modes": ["selser"],
22248   "changes": [["#x", "remove"]],
22249   "selser": "noauto"
22251 !! wikitext
22252 Unrelated text<span id="x"> that's going to disappear</span>.
22253 A <ref>foo</ref>
22254 !! wikitext/edited
22255 Unrelated text.
22256 A <ref>foo</ref>
22257 !!end
22259 !! test
22260 Entities in ref name
22261 !! wikitext
22262 <ref name="test &amp; me">hi</ref>
22263 <references />
22264 !! html/parsoid
22265 <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>
22266 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
22267 <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>
22268 </ol>
22269 !! end
22271 ## The output here may look funny, but it's what the php parser will do.  The
22272 ## unclosed references tag becomes escaped text, and then a new references
22273 ## tag is auto-generated.  The test is wt2html only because it roundtrips with
22274 ## nowiki tags, and the auto-generated references tag is only dropped in
22275 ## rtTestMode.
22276 !! test
22277 Generate references for unclosed references tag
22278 !! options
22279 parsoid=wt2html
22280 !! wikitext
22281 a<ref>foo</ref>
22283 <references>
22284 !! html/parsoid
22285 <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>
22287 <p>&lt;references></p>
22288 <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>
22289 !! end
22291 !! test
22292 New reference serializes on its own line
22293 !! options
22294 parsoid=wt2wt,html2wt
22295 !! wikitext
22297 <references />
22298 !! html/parsoid
22299 foo<ol class="mw-references" typeof="mw:Extension/references" about="#mwt2" data-mw='{"name":"references","attrs":{}}'></ol>
22300 !! end
22302 #### ----------------------------------------------------------------
22303 #### Parsoid-only testing of Parsoid's impl of LST
22304 #### Not implemented yet, see
22305 #### https://www.mediawiki.org/wiki/Parsoid/HTML_based_LST
22306 #### ----------------------------------------------------------------
22308 !! test
22309 LST Sections: 1. Simple section start and end
22310 !! options
22311 parsoid={ "suppressErrors": true }
22312 !! wikitext
22313 <section begin="2011-05-16" />
22314 <section end="2014-04-10 (MW 1.23wmf22)" />
22315 !! html/parsoid
22316 <p><meta typeof="mw:Extension/LabeledSectionTransclusion/begin" content="2011-05-16"/>
22317 <meta typeof="mw:Extension/LabeledSectionTransclusion/end" content="2014-04-10 (MW 1.23wmf22)"/></p>
22318 !! end
22320 #--------- Test stripping of empty nodes in template content ----------
22321 !!test
22322 Empty LI and TR nodes should be stripped from template content
22323 !!wikitext
22324 {{EmptyLITest}}
22325 {{EmptyTRTest}}
22326 !!html/parsoid
22327 <ul about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyLITest","href":"./Template:EmptyLITest"},"params":{},"i":0}}]}'>
22328 <li>a</li>
22329 <li>b</li>
22330 </ul>
22331 <table about="#mwt2" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyTRTest","href":"./Template:EmptyTRTest"},"params":{},"i":0}}]}'>
22332 <tbody>
22333 <tr>
22334 <td>foo</td>
22335 </tr>
22336 <tr>
22337 <td>bar</td>
22338 </tr>
22339 </tbody>
22340 </table>
22341 !!end
22343 !!test
22344 Empty LI and TR nodes should not be stripped from top-level content
22345 !!wikitext
22346 * a
22348 * b
22352 |foo
22354 !!html/parsoid
22355 <ul>
22356 <li> a</li>
22357 <li></li>
22358 <li> b</li>
22359 </ul>
22360 <table>
22361 <tbody>
22362 <tr></tr>
22363 <tr>
22364 <td>foo</td>
22365 </tr>
22366 </tbody>
22367 </table>
22368 !!end
22370 !!test
22371 Empty TR nodes should not be stripped if they have any attributes set
22372 !!wikitext
22373 {{EmptyTRWithHTMLAttrTest}}
22374 !!html/parsoid
22375 <table about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyTRWithHTMLAttrTest","href":"./Template:EmptyTRWithHTMLAttrTest"},"params":{},"i":0}}]}'>
22376 <tr align="center"></tr>
22377 <tr><td>foo</td></tr>
22378 <tr align="center"></tr>
22379 <tr><td>bar</td></tr>
22380 </table>
22381 !!end
22383 #### ----------------------------------------------------------------
22384 #### The following section of tests are primarily to test
22385 #### wikitext escaping capabilities of Parsoid.  Given that
22386 #### escaping can be done any number of ways, the wikitext (input)
22387 #### is always adjusted to reflect how Parsoid adds nowiki
22388 #### escape tags.
22389 ####
22390 #### We are marking several tests as parsoid-only since the
22391 #### HTML in the result section is different from what the
22392 #### PHP parser generates for it.
22393 #### ----------------------------------------------------------------
22396 #### --------------- Headings ---------------
22397 #### 0. Unnested
22398 #### 1. Nested inside html <h1>=foo=</h1>
22399 #### 2. Outside heading nest on a single line <h1>foo</h1>*bar
22400 #### 3. Nested inside html with wikitext split by html tags
22401 #### 4. No escape needed
22402 #### 5. Empty headings <h1></h1>
22403 #### 6. Heading chars in SOL context
22404 #### ----------------------------------------
22405 !! test
22406 Headings: 0. Unnested
22407 !! options
22408 parsoid=html2wt
22409 !! html/parsoid
22410 <p>=foo=</p>
22412 <p> =foo=
22413 <!--cmt-->
22414 =foo=</p>
22416 <p>=foo<i>a</i>=</p>
22417 !! wikitext
22418 <nowiki>=foo=</nowiki>
22420 <nowiki> </nowiki>=foo=
22421 <!--cmt-->
22422 <nowiki>=foo=</nowiki>
22424 =foo''a''<nowiki>=</nowiki>
22425 !!end
22427 # New headings and existing headings are handled differently
22428 !! test
22429 Headings: 1. Nested inside html
22430 !! options
22431 parsoid=html2wt
22432 !! html/parsoid
22433 <h1>=foo=</h1>
22434 <h2>=foo=</h2>
22435 <h3>=foo=</h3>
22437 <h1 data-parsoid=''>=foo=</h1>
22438 <h2 data-parsoid=''>=foo=</h2>
22439 <h3 data-parsoid=''>=foo=</h3>
22440 <h4 data-parsoid=''>=foo=</h4>
22441 <h5 data-parsoid=''>=foo=</h5>
22442 <h6 data-parsoid=''>=foo=</h6>
22443 !! wikitext
22444 = =foo= =
22446 == =foo= ==
22448 === =foo= ===
22450 =<nowiki>=foo=</nowiki>=
22451 ==<nowiki>=foo=</nowiki>==
22452 ===<nowiki>=foo=</nowiki>===
22453 ====<nowiki>=foo=</nowiki>====
22454 =====<nowiki>=foo=</nowiki>=====
22455 ======<nowiki>=foo=</nowiki>======
22457 !!end
22459 !! test
22460 Headings: 2. Outside heading nest on a single line <h1>foo</h1>*bar
22461 !! options
22462 parsoid=html2wt
22463 !! html/parsoid
22464 <h1>foo</h1>*bar
22465 <h1>foo</h1>=bar
22466 <h1>foo</h1>=bar=
22467 !! wikitext
22468 = foo =
22469 <nowiki>*</nowiki>bar
22471 = foo =
22472 =bar
22474 = foo =
22475 <nowiki>=bar=</nowiki>
22476 !!end
22478 !! test
22479 Headings: 3. Nested inside html with wikitext split by html tags
22480 !! options
22481 parsoid=html2wt
22482 !! html/parsoid
22483 <h1>=<b>bold</b>foo=</h1>
22484 !! wikitext
22485 = ='''bold'''foo= =
22486 !!end
22488 !! test
22489 Headings: 4a. No escaping needed (testing just h1 and h2)
22490 !! options
22491 parsoid=html2wt
22492 !! html/parsoid
22493 <h1>=foo</h1>
22494 <h1>foo=</h1>
22495 <h1> =foo= </h1>
22496 <h1>=foo= bar</h1>
22497 <h2>=foo</h2>
22498 <h2>foo=</h2>
22499 <h1>=</h1>
22500 <h1><i>=</i>foo=</h1>
22501 !! wikitext
22502 = =foo =
22504 = foo= =
22506 = =foo= =
22508 = =foo= bar =
22510 == =foo ==
22512 == foo= ==
22514 = = =
22516 = ''=''foo= =
22517 !!end
22519 !! test
22520 Headings: 4b. No escaping needed (inside p-tags)
22521 !! options
22522 parsoid=html2wt
22523 !! html/parsoid
22524 <p>===
22525 =foo= x
22526 =foo= <s></s>
22527 </p>
22528 !! wikitext
22530 =foo= x
22531 =foo= <s></s>
22532 !!end
22534 !! test
22535 Headings: 5. Empty headings
22536 !! options
22537 parsoid=html2wt
22538 !! html/parsoid
22539 <h1 data-parsoid='{}'></h1>
22541 <h2 data-parsoid='{}'></h2>
22543 <h3 data-parsoid='{}'></h3>
22545 <h4 data-parsoid='{}'></h4>
22547 <h5 data-parsoid='{}'></h5>
22549 <h6 data-parsoid='{}'></h6>
22550 !! wikitext
22551 =<nowiki/>=
22553 ==<nowiki/>==
22555 ===<nowiki/>===
22557 ====<nowiki/>====
22559 =====<nowiki/>=====
22561 ======<nowiki/>======
22562 !!end
22564 !! test
22565 Headings: 6a. Heading chars in SOL context (with trailing spaces)
22566 !! options
22567 parsoid=html2wt
22568 !! html/parsoid
22569 <p>=a=</p>
22571 <p>=a=</p> 
22573 <p>=a=</p>      
22574 !! wikitext
22575 <nowiki>=a=</nowiki>
22577 <nowiki>=a=</nowiki> 
22579 <nowiki>=a=</nowiki>    
22580 !!end
22582 !! test
22583 Headings: 6b. Heading chars in SOL context (with trailing newlines)
22584 !! options
22585 parsoid=html2wt
22586 !! html/parsoid
22587 <p>=a=
22588 b</p>
22590 <p>=a= 
22591 b</p>
22593 <p>=a=  
22594 b</p>
22595 !! wikitext
22596 <nowiki>=a=</nowiki>
22599 <nowiki>=a=</nowiki> 
22602 <nowiki>=a=</nowiki>    
22604 !!end
22606 !! test
22607 Headings: 6c. Heading chars in SOL context (leading newline break)
22608 !! options
22609 parsoid=html2wt
22610 !! html/parsoid
22611 <p>a
22612 =b=</p>
22613 !! wikitext
22615 <nowiki>=b=</nowiki>
22616 !!end
22618 !! test
22619 Headings: 6d. Heading chars in SOL context (with interspersed comments)
22620 !! options
22621 parsoid=html2wt
22622 !! html/parsoid
22623 <!--c0--><p>=a=</p>
22625 <!--c1--><p>=a=</p> <!--c2-->    <!--c3-->
22626 !! wikitext
22627 <!--c0--><nowiki>=a=</nowiki>
22629 <!--c1--><nowiki>=a=</nowiki> <!--c2-->  <!--c3-->
22630 !!end
22632 !! test
22633 Headings: 6d. Heading chars in SOL context (No escaping needed)
22634 !! options
22635 parsoid=html2wt
22636 !! html/parsoid
22637 =a=<div>b</div>
22638 !! wikitext
22639 =a=<div>b</div>
22640 !!end
22642 !! test
22643 Headings: 7. Insert a newline between new content and headings
22644 !! options
22645 parsoid=html2wt
22646 !! html/parsoid
22647 <h2>NEW</h2>
22648 <p>new</p>
22649 <h2 data-parsoid='{}'>A</h2>
22650 <p data-parsoid='{}'>a</p>
22651 !! wikitext
22652 == NEW ==
22655 ==A==
22658 !! end
22660 #### --------------- Lists ---------------
22661 #### 0. Outside nests (*foo, etc.)
22662 #### 1. Nested inside html <ul><li>*foo</li></ul>
22663 #### 2. Inside definition lists
22664 #### 3. Only bullets at start should be escaped
22665 #### 4. No escapes needed
22666 #### 5. No unnecessary escapes
22667 #### 6. Escape bullets in SOL position
22668 #### 7. Escape bullets in a multi-line context
22669 #### ----------------------------------------
22671 !! test
22672 Lists: 0. Outside nests
22673 !! options
22674 parsoid=html2wt
22675 !! html/parsoid
22676 <p>*foo</p>
22678 <p>#foo</p>
22680 <p>;Foo:bar</p>
22681 !! wikitext
22682 <nowiki>*</nowiki>foo
22684 <nowiki>#</nowiki>foo
22686 <nowiki>;</nowiki>Foo<nowiki>:</nowiki>bar
22687 !!end
22689 ## Making these next 3 tests Parsoid-only since they are html2wt tests
22690 ## to test wikitext escaping, and insignificant whitespace diffs
22691 ## cause PHP parser tests to barf
22692 !! test
22693 Lists: 1. Nested inside html (No unnecessary escapes)
22694 !! options
22695 parsoid=html2wt
22696 !! html/parsoid
22697 <ul>
22698 <li>*foo</li>
22699 <li>#foo</li>
22700 <li>:foo</li>
22701 <li>;foo</li>
22702 <li data-parsoid='{}'>*foo</li>
22703 <li data-parsoid='{}'>#foo</li>
22704 <li data-parsoid='{}'>:foo</li>
22705 <li data-parsoid='{}'>;foo</li>
22706 </ul>
22708 <ol>
22709 <li>*foo</li>
22710 <li>#foo</li>
22711 <li>:foo</li>
22712 <li>;foo</li>
22713 <li data-parsoid='{}'>*foo</li>
22714 <li data-parsoid='{}'>#foo</li>
22715 <li data-parsoid='{}'>:foo</li>
22716 <li data-parsoid='{}'>;foo</li>
22717 </ol>
22718 !! wikitext
22719 * *foo
22720 * #foo
22721 * :foo
22722 * ;foo
22723 *<nowiki>*foo</nowiki>
22724 *<nowiki>#foo</nowiki>
22725 *<nowiki>:foo</nowiki>
22726 *<nowiki>;foo</nowiki>
22728 # *foo
22729 # #foo
22730 # :foo
22731 # ;foo
22732 #<nowiki>*foo</nowiki>
22733 #<nowiki>#foo</nowiki>
22734 #<nowiki>:foo</nowiki>
22735 #<nowiki>;foo</nowiki>
22736 !!end
22738 !! test
22739 Lists: 2. Inside definition lists
22740 !! options
22741 parsoid=html2wt
22742 !! html/parsoid
22743 <dl><dt>;foo</dt></dl>
22744 <dl><dt>:foo</dt></dl>
22745 <dl><dt>:foo</dt>
22746 <dd>bar</dd></dl>
22747 <dl><dd>:foo</dd></dl>
22748 !! wikitext
22749 ; ;foo
22751 ; <nowiki>:foo</nowiki>
22753 ; <nowiki>:foo</nowiki>
22754 : bar
22756 : :foo
22757 !!end
22759 !! test
22760 Lists: 3. Only bullets at start of text in wikitext-generated HTML should be escaped
22761 !! options
22762 parsoid=html2wt
22763 !! html/parsoid
22764 <ul>
22765 <li>*foo*bar</li>
22766 <li data-parsoid='{}'>*foo<i>it</i>*bar</li>
22767 </ul>
22768 !! wikitext
22769 * *foo*bar
22770 *<nowiki>*foo</nowiki>''it''*bar
22771 !!end
22773 !! test
22774 Lists: 4. No escapes needed
22775 !! options
22776 parsoid=html2wt
22777 !! html/parsoid
22778 <ul>
22779 <li>foo*bar
22780 </li>
22781 </ul>
22782 <ul>
22783 <li><i>foo</i>*bar
22784 </li>
22785 </ul>
22786 <ul>
22787 <li><a rel="mw:WikiLink" href="Foo" title="Foo">Foo</a>: bar
22788 </li>
22789 </ul>
22790 <ul>
22791 <li><a rel="mw:WikiLink" href="Foo" title="Foo">Foo</a>*bar
22792 </li>
22793 </ul>
22794 !! wikitext
22795 *foo*bar
22797 *''foo''*bar
22799 *[[Foo]]: bar
22801 *[[Foo]]*bar
22802 !!end
22804 !! test
22805 Lists: 5. No unnecessary escapes
22806 !! options
22807 parsoid=html2wt
22808 !! html/parsoid
22809 <ul><li> bar <span>[[foo]]</span></li></ul>
22810 <ul><li> =bar <span>[[foo]]</span></li></ul>
22811 <ul><li> [[bar <span>[[foo]]</span></li></ul>
22812 <ul><li> ]]bar <span>[[foo]]</span></li></ul>
22813 <ul><li> =bar <span>foo]]</span>=</li></ul>
22814 <ul><li> <s></s>: a</li></ul>
22815 <ul><li> <i>* foo</i></li></ul>
22817 !! wikitext
22818 * bar <span><nowiki>[[foo]]</nowiki></span>
22820 * =bar <span><nowiki>[[foo]]</nowiki></span>
22822 * [[bar <span><nowiki>[[foo]]</nowiki></span>
22824 * ]]bar <span><nowiki>[[foo]]</nowiki></span>
22826 * =bar <span>foo]]</span>=
22828 * <s></s>: a
22830 * ''* foo''
22831 !!end
22833 !! test
22834 Lists: 6. Escape bullets in SOL position
22835 !! options
22836 parsoid=html2wt
22837 !! html/parsoid
22838 <p><!--cmt-->*foo</p>
22839 !! wikitext
22840 <!--cmt--><nowiki>*</nowiki>foo
22841 !!end
22843 !! test
22844 Lists: 7. Escape bullets in a multi-line context
22845 !! options
22846 parsoid=html2wt
22847 !! html/parsoid
22848 <p>a
22850 </p>
22851 !! wikitext
22853 <nowiki>*</nowiki>b
22854 !!end
22856 !! test
22857 Lists: 8. Escape colons only if not present in tags
22858 !! options
22859 parsoid=html2wt
22860 !! html/parsoid
22861 <dl><dt>a:b<i>c:d</i></dt></dl>
22862 !! wikitext
22863 ; <nowiki>a:b</nowiki>''c:d''
22864 !! end
22866 #### --------------- HRs ---------------
22867 #### 1. Single line
22868 #### -----------------------------------
22870 !! test
22871 HRs: 1. Single line
22872 !! options
22873 parsoid=html2wt
22874 !! html/parsoid
22875 <hr />----
22876 <hr />=foo=
22877 <hr />*foo
22878 !! wikitext
22879 ----<nowiki>----</nowiki>
22880 ----=foo=
22881 ----*foo
22882 !! end
22884 #### --------------- Tables ---------------
22885 #### 1a. Simple example
22886 #### 1b. No escaping needed (!foo)
22887 #### 1c. No escaping needed (|foo)
22888 #### 1d. No escaping needed (|}foo)
22889 ####
22890 #### 2a. Nested in td (<td>foo|bar</td>)
22891 #### 2b. Nested in td (<td>foo||bar</td>)
22892 #### 2c. Nested in td -- no escaping needed(<td>foo!!bar</td>)
22893 ####
22894 #### 3a. Nested in th (<th>foo!bar</th>)
22895 #### 3b. Nested in th (<th>foo!!bar</th>)
22896 #### 3c. Nested in th -- no escaping needed(<th>foo||bar</th>)
22897 ####
22898 #### 4a. Escape -
22899 #### 4b. Escape +
22900 #### 4c. No escaping needed
22901 #### --------------------------------------
22903 !! test
22904 Tables: 1a. Simple example
22905 !! options
22906 parsoid=html2wt
22907 !! html/parsoid
22908 <p>{|
22910 </p>
22911 !! wikitext
22912 <nowiki>{|</nowiki>
22914 !! end
22916 !! test
22917 Tables: 1b. No escaping needed
22918 !! options
22919 parsoid=html2wt
22920 !! html/parsoid
22921 <p>!foo
22922 </p>
22923 !! wikitext
22924 !foo
22925 !! end
22927 !! test
22928 Tables: 1c. No escaping needed
22929 !! options
22930 parsoid=html2wt
22931 !! html/parsoid
22932 <p>|foo
22933 </p>
22934 !! wikitext
22935 |foo
22936 !! end
22938 !! test
22939 Tables: 1d. No escaping needed
22940 !! options
22941 parsoid=html2wt
22942 !! html/parsoid
22943 <p>|}foo
22944 </p>
22945 !! wikitext
22946 |}foo
22947 !! end
22949 !! test
22950 Tables: 2a. Nested in td
22951 !! options
22952 parsoid=html2wt
22953 !! html/parsoid
22954 <table><tbody><tr>
22955 <td>foo|bar</td></tr>
22956 <tr><td>x<div>a|b</div></td>
22957 </tbody></table>
22958 !! wikitext
22960 |<nowiki>foo|bar</nowiki>
22962 |x<div><nowiki>a|b</nowiki></div>
22964 !! html/php+tidy
22965 <table>
22966 <tr>
22967 <td>foo|bar</td>
22968 </tr>
22969 <tr>
22970 <td>x
22971 <div>a|b</div>
22972 </td>
22973 </tr>
22974 </table>
22975 !! end
22977 !! test
22978 Tables: 2b. Nested in td
22979 !! options
22980 parsoid=html2wt
22981 !! html/parsoid
22982 <table><tbody><tr>
22983 <td>foo||bar</td>
22984 <td>a<i>b||c</i></td>
22985 <td>a<i><div>b||c</div></i></td>
22986 </tr></tbody></table>
22987 !! wikitext
22989 |<nowiki>foo||bar</nowiki>
22990 |a''<nowiki>b||c</nowiki>''
22991 |a''<div><nowiki>b||c</nowiki></div>''
22993 !! html/php
22994 <table>
22995 <tr>
22996 <td>foo||bar
22997 </td>
22998 <td>a<i>b||c</i>
22999 </td>
23000 <td>a<i><div>b||c</div></i>
23001 </td></tr></table>
23003 !! end
23005 !! test
23006 Tables: 2c. Nested in td -- no escaping needed
23007 !! options
23008 parsoid=html2wt
23009 !! html/*
23010 <table>
23012 <tr>
23013 <td>foo!!bar
23014 </td></tr></table>
23016 !! wikitext
23019 |foo!!bar
23021 !! end
23023 !! test
23024 Tables: 3a. Nested in th
23025 !! options
23026 parsoid=html2wt
23027 !! html/*
23028 <table>
23030 <tr>
23031 <th>foo!bar
23032 </th></tr></table>
23034 !! wikitext
23037 !foo!bar
23039 !! end
23041 !! test
23042 Tables: 3b. Nested in th
23043 !! options
23044 parsoid=html2wt
23045 !! html/parsoid
23046 <table><tbody>
23047 <tr><th>foo!!bar</th>
23048 <th><i>foo|bar</i></th>
23049 <th><i>foo!!bar</i></th>
23050 <th><i><span>foo!!bar</span></i></th>
23051 </tr></tbody></table>
23052 !! wikitext
23054 !<nowiki>foo!!bar</nowiki>
23055 !''<nowiki>foo|bar</nowiki>''
23056 !''<nowiki>foo!!bar</nowiki>''
23057 !''<span><nowiki>foo!!bar</nowiki></span>''
23059 !! html/php
23060 <table>
23061 <tr>
23062 <th>foo!!bar
23063 </th>
23064 <th><i>foo|bar</i>
23065 </th>
23066 <th><i>foo!!bar</i>
23067 </th>
23068 <th><i><span>foo!!bar</span></i>
23069 </th></tr></table>
23071 !! end
23073 !! test
23074 Tables: 3c. Nested in th
23075 !! options
23076 parsoid=html2wt
23077 !! html/parsoid
23078 <table><tbody>
23079 <tr><th>foo||bar</th>
23080 <th><span typeof="mw:Nowiki">foo||bar</span></th>
23081 </tr></tbody></table>
23082 !! wikitext
23084 !<nowiki>foo||bar</nowiki>
23085 !<nowiki>foo||bar</nowiki>
23087 !! html/php
23088 <table>
23089 <tr>
23090 <th>foo||bar
23091 </th>
23092 <th>foo||bar
23093 </th></tr></table>
23095 !! end
23097 !! test
23098 Tables: 4a. Escape -
23099 !! options
23100 parsoid=html2wt
23101 !! html/*
23102 <table>
23104 <tr>
23105 <th>-bar
23106 </th></tr>
23107 <tr>
23108 <td>-bar
23109 </td></tr></table>
23111 !! wikitext
23114 !-bar
23117 |<nowiki>-bar</nowiki>
23119 !! end
23121 !! test
23122 Tables: 4b. Escape +
23123 !! options
23124 parsoid=html2wt
23125 !! html/*
23126 <table>
23128 <tr>
23129 <th>+bar
23130 </th></tr>
23131 <tr>
23132 <td>+bar
23133 </td></tr></table>
23135 !! wikitext
23138 !+bar
23141 |<nowiki>+bar</nowiki>
23143 !! end
23145 !! test
23146 Tables: 4c. No escaping needed
23147 !! options
23148 parsoid=html2wt
23149 !! html/parsoid
23150 <table><tbody>
23151 <tr><td>foo-bar</td><td>foo+bar</td></tr>
23152 <tr><td><i>foo</i>-bar</td><td><i>foo</i>+bar</td></tr>
23153 <tr><td>foo
23154 <p>bar|baz
23155 +bar
23156 -bar</p></td></tr>
23157 <tr><td>x
23158 <div>a|b</div></td>
23159 </tbody></table>
23160 !! wikitext
23162 |foo-bar
23163 |foo+bar
23165 |''foo''-bar
23166 |''foo''+bar
23168 |foo
23169 bar|baz
23170 +bar
23171 -bar
23174 <div>a|b</div>
23176 !! html/php
23177 <table>
23178 <tr>
23179 <td>foo-bar
23180 </td>
23181 <td>foo+bar
23182 </td></tr>
23183 <tr>
23184 <td><i>foo</i>-bar
23185 </td>
23186 <td><i>foo</i>+bar
23187 </td></tr>
23188 <tr>
23189 <td>foo
23190 <p>bar|baz
23191 +bar
23192 -bar
23193 </p>
23194 </td></tr>
23195 <tr>
23196 <td>x
23197 <div>a|b</div>
23198 </td></tr></table>
23200 !! end
23202 !! test
23203 Tables: 4d. No escaping needed
23204 !! options
23205 parsoid=html2wt
23206 !! html/parsoid
23207 <table>
23208 <tbody><tr><td><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo</a>-bar</td>
23209 <td data-parsoid='{"startTagSrc":"|","attrSepSrc":"|"}'>+1</td>
23210 <td data-parsoid='{"startTagSrc":"|","attrSepSrc":"|"}'>-2</td></tr>
23211 </tbody></table>
23212 !! wikitext
23214 |[[Foo]]-bar
23215 ||+1
23216 ||-2
23218 !! html/php
23219 <table>
23220 <tr>
23221 <td><a href="/wiki/Foo" title="Foo">Foo</a>-bar
23222 </td>
23223 <td>+1
23224 </td>
23225 <td>-2
23226 </td></tr></table>
23228 !! end
23230 !! test
23231 T97430: Don't emit empty nowiki pairs around marker meta tags
23232 !! options
23233 parsoid=html2wt
23234 !! html/parsoid
23235 <p>*This is a long sentence here that will make the nowiki algo split up the nowikis into multiple pairs
23236 |** Make this another long long long sentence forcing the nowiki algo to split up the nowikis.</p>
23237 !! wikitext
23238 <nowiki>*</nowiki>This is a long sentence here that will make the nowiki algo split up the nowikis into multiple pairs
23239 |** Make this another long long long sentence forcing the nowiki algo to split up the nowikis.
23240 !! end
23242 !! test
23243 Unclosed xmlish element in table line shouldn't eat end delimiters
23244 !! options
23245 parsoid=html2wt
23246 !! html/parsoid
23247 <table>
23248 <tbody><tr><td> &lt;foo</td>
23249 <td> bar></td></tr>
23250 </tbody></table>
23251 !! wikitext
23253 | <foo
23254 | bar>
23256 !! html/php
23257 <table>
23258 <tr>
23259 <td> &lt;foo
23260 </td>
23261 <td> bar&gt;
23262 </td></tr></table>
23264 !! end
23266 #### --------------- Links ----------------
23267 #### 1. Quote marks in link text
23268 #### 2. Wikilinks: Escapes needed
23269 #### 3. Wikilinks: No escapes needed
23270 #### 4. Extlinks: Escapes needed
23271 #### 5. Extlinks: No escapes needed
23272 #### --------------------------------------
23273 !! test
23274 Links 1. WikiLinks: No escapes needed
23275 !! options
23276 parsoid=html2wt
23277 !! html/parsoid
23278 <p><a rel="mw:WikiLink" href="Foo" title="Foo">Foo<i>boo</i></a>
23279 <a rel="mw:WikiLink" href="Foo" title="Foo">[Foobar]</a>
23280 <a rel="mw:WikiLink" href="Foo" title="Foo">x [Foobar] x</a></p>
23281 !! wikitext
23282 [[Foo|Foo''boo'']]
23283 [[Foo|[Foobar]]]
23284 [[Foo|x [Foobar] x]]
23285 !! html/php
23286 <p><a href="/wiki/Foo" title="Foo">Foo<i>boo</i></a>
23287 <a href="/wiki/Foo" title="Foo">[Foobar]</a>
23288 <a href="/wiki/Foo" title="Foo">x [Foobar] x</a>
23289 </p>
23290 !! end
23292 !! test
23293 Links 2. WikiLinks: Escapes needed
23294 !! options
23295 parsoid=html2wt
23296 !! html/parsoid
23297 <a href="Foo" rel="mw:WikiLink">Foobar]</a>
23298 <a href="Foo" rel="mw:WikiLink">x [http://google.com g] x</a>
23299 <a href="Foo" rel="mw:WikiLink">[[Bar]]</a>
23300 <a href="Foo" rel="mw:WikiLink">x [[Bar]] x</a>
23301 <a href="Foo" rel="mw:WikiLink">|Bar</a>
23302 <a href="Foo" rel="mw:WikiLink">]]bar</a>
23303 <a href="Foo" rel="mw:WikiLink">[[bar</a>
23304 <a href="Foo" rel="mw:WikiLink">x [[ y</a>
23305 <a href="Foo" rel="mw:WikiLink">x ]] y</a>
23306 <a href="Foo" rel="mw:WikiLink">x ]] y [[ z</a>
23307 !! wikitext
23308 [[Foo|<nowiki>Foobar]</nowiki>]]
23309 [[Foo|x <nowiki>[http://google.com g]</nowiki> x]]
23310 [[Foo|<nowiki>[[Bar]]</nowiki>]]
23311 [[Foo|<nowiki>x [[Bar]] x</nowiki>]]
23312 [[Foo|<nowiki>|Bar</nowiki>]]
23313 [[Foo|<nowiki>]]bar</nowiki>]]
23314 [[Foo|<nowiki>[[bar</nowiki>]]
23315 [[Foo|<nowiki>x [[ y</nowiki>]]
23316 [[Foo|<nowiki>x ]] y</nowiki>]]
23317 [[Foo|<nowiki>x ]] y [[ z</nowiki>]]
23318 !! html/php
23319 <p><a href="/wiki/Foo" title="Foo">Foobar]</a>
23320 <a href="/wiki/Foo" title="Foo">x [http://google.com g] x</a>
23321 <a href="/wiki/Foo" title="Foo">[[Bar]]</a>
23322 <a href="/wiki/Foo" title="Foo">x [[Bar]] x</a>
23323 <a href="/wiki/Foo" title="Foo">|Bar</a>
23324 <a href="/wiki/Foo" title="Foo">]]bar</a>
23325 <a href="/wiki/Foo" title="Foo">[[bar</a>
23326 <a href="/wiki/Foo" title="Foo">x [[ y</a>
23327 <a href="/wiki/Foo" title="Foo">x ]] y</a>
23328 <a href="/wiki/Foo" title="Foo">x ]] y [[ z</a>
23329 </p>
23330 !! end
23332 !! test
23333 Links 3. WikiLinks: No escapes needed
23334 !! options
23335 parsoid=html2wt
23336 !! html/parsoid
23337 <p><a rel="mw:WikiLink" href="Foo">[Foobar</a>
23338 <a rel="mw:WikiLink" href="Foo" title="Foo">foo|bar</a></p>
23339 !! wikitext
23340 [[Foo|[Foobar]]
23341 [[Foo|foo|bar]]
23342 !! html/php
23343 <p><a href="/wiki/Foo" title="Foo">[Foobar</a>
23344 <a href="/wiki/Foo" title="Foo">foo|bar</a>
23345 </p>
23346 !! end
23348 !! test
23349 Links 4. ExtLinks: Escapes needed
23350 !! options
23351 parsoid=html2wt
23352 !! html/parsoid
23353 <p><a rel="mw:ExtLink" href="http://google.com">[google]</a>
23354 <a rel="mw:ExtLink" href="http://google.com">google]</a></p>
23355 <p>[http://google.com]</p>
23356 <p>[http://google.com google]</p>
23357 <p>[<a rel="mw:ExtLink" href="http://google.com">http://google.com</a>]</p>
23358 <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>
23359 !! wikitext
23360 [http://google.com <nowiki>[google]</nowiki>]
23361 [http://google.com <nowiki>google]</nowiki>]
23363 <nowiki>[http://google.com]</nowiki>
23365 <nowiki>[http://google.com google]</nowiki>
23367 [http://google.com<nowiki>]</nowiki>
23369 [{{echo|http://google.com}}<nowiki>]</nowiki>
23370 !! html/php
23371 <p><a rel="nofollow" class="external text" href="http://google.com">[google]</a>
23372 <a rel="nofollow" class="external text" href="http://google.com">google]</a>
23373 </p><p>[http://google.com]
23374 </p><p>[http://google.com google]
23375 </p><p>[<a rel="nofollow" class="external free" href="http://google.com">http://google.com</a>]
23376 </p><p>[<a rel="nofollow" class="external free" href="http://google.com">http://google.com</a>]
23377 </p>
23378 !! end
23380 !! test
23381 Links 5. ExtLinks: No escapes needed
23382 !! options
23383 parsoid=html2wt
23384 !! html/parsoid
23385 <p><a rel="mw:ExtLink" href="http://google.com">[google</a></p>
23386 <p>[<a ref="mw:ExtLink" href="http://google.com"></a>]</p>
23387 !! wikitext
23388 [http://google.com [google]
23390 [[http://google.com]]
23391 !! html/php
23392 <p><a rel="nofollow" class="external text" href="http://google.com">[google</a>
23393 </p><p>[<a rel="nofollow" class="external autonumber" href="http://google.com">[1]</a>]
23394 </p>
23395 !! end
23397 !! test
23398 Links 6. Add <nowiki/>s between text-nodes and url-links when required (bug 64300)
23399 !! options
23400 parsoid=html2wt
23401 !! html/parsoid
23402 <p>x<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>y
23403 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>?x
23404 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>&amp;x
23405 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>'x
23406 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>,x
23407 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>.x
23408 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>;x
23409 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>:x
23410 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>;x
23411 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>!x
23412 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>=x
23413 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>(x)
23414 <a rel="mw:ExtLink" href="http://example.com(x" data-parsoid='{"stx":"url"}'>http://example.com(x</a>)
23415 </p>
23416 !! wikitext
23417 x<nowiki/>http://example.com<nowiki/>y
23418 http://example.com<nowiki/>?x
23419 http://example.com<nowiki/>&x
23420 http://example.com<nowiki/>'x
23421 http://example.com<nowiki/>,x
23422 http://example.com<nowiki/>.x
23423 http://example.com<nowiki/>;x
23424 http://example.com<nowiki/>:x
23425 http://example.com<nowiki/>;x
23426 http://example.com<nowiki/>!x
23427 http://example.com<nowiki/>=x
23428 http://example.com<nowiki/>(x)
23429 http://example.com(x<nowiki/>)
23430 !! end
23432 !! test
23433 Links 7a. Don't add spurious <nowiki/>s between text-nodes and url-links (bug 64300)
23434 !! options
23435 parsoid=html2wt
23436 !! html/parsoid
23437 <p>x
23438 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>
23440 "<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>"
23441 (<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>)
23442 (<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>) foo
23443 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>,
23444 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>, foo
23445 </p>
23446 !! wikitext
23448 http://example.com
23450 "http://example.com"
23451 (http://example.com)
23452 (http://example.com) foo
23453 http://example.com,
23454 http://example.com, foo
23455 !! html/php
23456 <p>x
23457 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
23459 "<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>"
23460 (<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
23461 (<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>) foo
23462 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>,
23463 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>, foo
23464 </p>
23465 !! end
23467 !! test
23468 Links 7b. Don't add spurious <nowiki/>s between text-nodes and url-links (bug 64300)
23469 !! options
23470 parsoid=html2wt
23471 !! html/parsoid
23472 <p><a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>.,;:!?\
23473 -<a rel="mw:ExtLink" href="http://example.com">http://example.com</a>:</p>
23474 !! wikitext
23475 http://example.com.,;:!?\
23476 -http://example.com:
23477 !! html/php
23478 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>.,;:!?\
23479 -<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>:
23480 </p>
23481 !! end
23483 !! test
23484 Links 8. Add <nowiki/>s between text-nodes and RFC-links when required (bug 64300)
23485 !! options
23486 parsoid=html2wt
23487 !! html/parsoid
23488 <p><a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>4
23489 <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>y
23490 X<a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>y</p>
23491 !! wikitext
23492 RFC 123<nowiki/>4
23493 RFC 123<nowiki/>y
23494 X<nowiki/>RFC 123<nowiki/>y
23495 !! end
23497 !! test
23498 Links 9. Don't add spurious <nowiki/>s between text-nodes and RFC-links (bug 64300)
23499 !! options
23500 parsoid=html2wt
23501 !! html/parsoid
23502 <p><a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>?foo
23503 <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>&amp;foo
23504 -<a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>-
23505 </p>
23506 !! wikitext
23507 RFC 123?foo
23508 RFC 123&foo
23509 -RFC 123-
23510 !! html/php
23511 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc123">RFC 123</a>?foo
23512 <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc123">RFC 123</a>&amp;foo
23513 -<a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc123">RFC 123</a>-
23514 </p>
23515 !! end
23517 !! test
23518 Links 10. Add <nowiki/>s between text-nodes and PMID-links when required (bug 64300)
23519 !! options
23520 parsoid=html2wt
23521 !! html/parsoid
23522 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>4
23523 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>y
23524 X<a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>y
23525 !! wikitext
23526 PMID 123<nowiki/>4
23527 PMID 123<nowiki/>y
23528 X<nowiki/>PMID 123<nowiki/>y
23529 !! end
23531 !! test
23532 Links 11. Don't add spurious <nowiki/>s between text-nodes and PMID-links (bug 64300)
23533 !! options
23534 parsoid=html2wt
23535 !! html/parsoid
23536 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>?foo
23537 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>&foo
23538 -<a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>-
23539 </p>
23540 !! wikitext
23541 PMID 123?foo
23542 PMID 123&foo
23543 -PMID 123-
23544 !! html/php
23545 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>?foo
23546 <a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>&amp;foo
23547 -<a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>-
23548 </p>
23549 !! end
23551 !! test
23552 Links 12. Add <nowiki/>s between text-nodes and ISBN-links when required (bug 64300)
23553 !! options
23554 parsoid=html2wt
23555 !! html/parsoid
23556 <p><a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>1
23557 <a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>x
23558 a<a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>b
23559 </p>
23560 !! wikitext
23561 ISBN 1234567890<nowiki/>1
23562 ISBN 1234567890<nowiki/>x
23563 a<nowiki/>ISBN 1234567890<nowiki/>b
23564 !! end
23566 !! test
23567 Links 13. Don't add spurious <nowiki/>s between text-nodes and ISBN-links (bug 64300)
23568 !! options
23569 parsoid=html2wt
23570 !! html/parsoid
23571 <p>-<a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>'s
23572 !! wikitext
23573 -ISBN 1234567890's
23574 !! html/php
23575 <p>-<a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>'s
23576 </p>
23577 !! end
23579 !! test
23580 Links 14. Protect link-like plain text. (Parsoid bug T78425)
23581 !! options
23582 parsoid=html2wt
23583 !! html/*
23584 <p>this is not a link: http://example.com
23585 </p>
23586 !! wikitext
23587 this is not a link: <nowiki>http://example.com</nowiki>
23588 !! end
23590 !! test
23591 Links 15. Link trails can't become link prefixes.
23592 !! options
23593 language=is
23594 parsoid=html2wt
23595 !! html/parsoid
23596 <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>
23597 !! wikitext
23598 [[Söfnuður]]-[[00]]
23599 !! html/php
23600 <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>
23601 </p>
23602 !! end
23604 #### --------------- Quotes ---------------
23605 #### 1. Quotes inside <b> and <i>
23606 #### 2. Link fragments separated by <i> and <b> tags
23607 #### 3. Link fragments inside <i> and <b>
23608 #### 4. No escaping needed
23609 #### --------------------------------------
23610 !! test
23611 1a. Quotes inside <b> and <i>
23612 !! options
23613 parsoid=html2wt
23614 !! html/*
23615 <p><i>'foo'</i>
23616 <i>''foo''</i>
23617 <i>'''foo'''</i>
23618 <i>foo</i>'s
23619 <b>'foo'</b>
23620 <b>''foo''</b>
23621 <b>'''foo'''</b>
23622 <b>foo'<i>bar'</i>baz</b>
23623 <b>foo</b>'s
23624 '<i>foo</i>
23625 <i>foo</i>'
23626 <i>foo'</i>'
23627 '<i>foo</i>'
23628 '<b>foo</b>
23629 <b>foo</b>'
23630 '<b>foo</b>'
23631 <i>fools'<span> errand</span></i>
23632 <i><span>fool</span>'s errand</i>
23633 '<i>foo</i> bar '<i>baz</i>
23634 a|!*#-:;+-~[]{}b'<i>x</i>
23635 </p>
23636 !! wikitext
23637 ''<nowiki/>'foo'''
23638 ''<nowiki>''foo''</nowiki>''
23639 ''<nowiki>'''foo'''</nowiki>''
23640 ''foo''<nowiki/>'s
23641 '''<nowiki/>'foo''''
23642 '''<nowiki>''foo''</nowiki>'''
23643 '''<nowiki>'''foo'''</nowiki>'''
23644 '''foo'<nowiki/>''bar'<nowiki/>''baz'''
23645 '''foo'''<nowiki/>'s
23646 '''foo''
23647 ''foo''<nowiki/>'
23648 ''foo'''<nowiki/>'
23649 '''foo''<nowiki/>'
23650 ''''foo'''
23651 '''foo'''<nowiki/>'
23652 ''''foo'''<nowiki/>'
23653 ''fools'<span> errand</span>''
23654 ''<span>fool</span>'s errand''
23655 '<nowiki/>''foo'' bar '''baz''
23656 a|!*#-:;+-~[]{}b'''x''
23657 !! end
23659 !! test
23660 1b. Quotes inside <b> and <i> with other tags on same line
23661 !! options
23662 parsoid=html2wt
23663 !! html/parsoid
23664 '<i>a</i> foo <i><a rel="mw:WikiLink" href="Bar" title="Bar">bar</a></i>
23665 <i>a'</i> foo <i><a rel="mw:WikiLink" href="Bar" title="Bar">bar</a></i>
23666 <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>
23667 <a rel="mw:WikiLink" href="Foo" title="Foo">foo</a> x'<i><a href="Bar" rel="mw:WikiLink" title="Bar">bar</a></i>
23668 '<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>
23669 '<i>foo</i> <div title="name">test</div>
23670 '<i>foo</i> and <br data-parsoid='{"stx":"html","noClose":true}'/> bar
23671 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'>
23672 <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>
23673 </ol>
23674 !! wikitext
23675 '''a'' foo ''[[bar]]''
23676 ''a''' foo ''[[bar]]''
23677 ''a''' foo '''{{echo|[[bar]]}}'''
23678 [[foo]] x'''[[bar]]''
23679 '''foo'' <ref>test</ref>
23680 '''foo'' <div title="name">test</div>
23681 '''foo'' and <br> bar
23682 <references />
23683 !! end
23685 !! test
23686 2. Link fragments separated by <i> and <b> tags
23687 !! options
23688 parsoid=html2wt
23689 !! html/parsoid
23690 <p>[[<i>foo</i>hello]]</p>
23691 <p>[[<b>foo</b>hello]]</p>
23692 !! wikitext
23693 [[''foo''<nowiki>hello]]</nowiki>
23695 [['''foo'''<nowiki>hello]]</nowiki>
23696 !! end
23698 # FIXME: Escaping one or both of [[ and ]] is also acceptable --
23699 #        this is one of the shortcomings of this format
23700 !! test
23701 3. Link fragments inside <i> and <b>
23702 !! options
23703 parsoid=html2wt
23704 !! html/parsoid
23705 <p><i>[[foo</i>]]</p>
23706 <p><b>[[foo</b>]]</p>
23707 !! wikitext
23708 ''[[foo''<nowiki>]]</nowiki>
23710 '''[[foo'''<nowiki>]]</nowiki>
23711 !! end
23713 !! test
23714 4. No escaping needed
23715 !! options
23716 options=html2wt
23717 !! html/parsoid
23718 <p>'<span><i>bar</i></span>'
23719 '<span><b>bar</b></span>'
23720 'a:b'foo
23721 </p>
23722 !! wikitext
23723 '<span>''bar''</span>'
23724 '<span>'''bar'''</span>'
23725 'a:b'foo
23726 !! end
23728 #### ----------- Paragraphs ---------------
23729 #### 1. No unnecessary escapes
23730 #### --------------------------------------
23732 !! test
23733 1. No unnecessary escapes
23734 !! options
23735 parsoid=html2wt
23736 !! html/parsoid
23737 <p>bar <span>[[foo]]</span>
23738 </p><p>=bar <span>[[foo]]</span>
23739 </p><p>[[bar <span>[[foo]]</span>
23740 </p><p>]]bar <span>[[foo]]</span>
23741 </p><p>=bar <span>foo]]</span>=
23742 </p>
23743 !! wikitext
23744 bar <span><nowiki>[[foo]]</nowiki></span>
23746 =bar <span><nowiki>[[foo]]</nowiki></span>
23748 [[bar <span><nowiki>[[foo]]</nowiki></span>
23750 ]]bar <span><nowiki>[[foo]]</nowiki></span>
23752 =bar <span>foo]]</span><nowiki>=</nowiki>
23753 !!end
23755 #### ----------------------- PRE --------------------------
23756 #### 1. Leading whitespace in SOL context should be escaped
23757 #### ------------------------------------------------------
23758 !! test
23759 1. Leading whitespace in SOL context should be escaped
23760 !! options
23761 parsoid=html2wt
23762 !! html/parsoid
23763 <p> a</p>
23765 <p>  a</p>
23767 <p>     a(tab)</p>
23769 <p>     a
23770 <!--cmt-->
23771   a</p>
23773 <p>a
23774  b</p>
23776 <p>a
23777         b</p>
23779 <p>a
23780          b</p>
23781 !! wikitext
23782 <nowiki> </nowiki>a
23784 <nowiki> </nowiki> a
23786         a(tab)
23788 <nowiki> </nowiki>      a
23789 <!--cmt-->
23790 <nowiki>  </nowiki>a
23793 <nowiki> </nowiki>b
23796         b
23799          b
23800 !! html/php
23801 <p> a
23802 </p><p>  a
23803 </p><p> a(tab)
23804 </p><p>         a
23805   a
23806 </p><p>a
23808 </p><p>a
23809         b
23810 </p><p>a
23811          b
23812 </p>
23813 !! end
23815 !! test
23816 2. Leading whitespace in non-indent-pre contexts should not be escaped
23817 !! options
23818 parsoid=html2wt
23819 !! html/parsoid
23820 <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>
23821 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
23822 <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>
23823  b</span></li>
23824 </ol>
23825 !! wikitext
23826 foo <ref>''a''
23827  b</ref>
23828 <references />
23829 !! end
23831 !! test
23832 3. Leading whitespace in indent-pre suppressing contexts should not be escaped
23833 !! options
23834 parsoid=html2wt
23835 !! html/parsoid
23836 <blockquote>
23839  <span>b</span>
23840  c</p>
23841 </blockquote>
23842 !! wikitext
23843 <blockquote>
23845  <span>b</span>
23847 </blockquote>
23848 !! end
23850 !! test
23851 4. Leading whitespace in indent-pre suppressing contexts should not be escaped
23852 !! options
23853 options=html2wt
23854 !! html/parsoid
23855  <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>
23856 !! wikitext
23857  [[File:Foobar.jpg|thumb|caption]]
23858 !! end
23860 !! test
23861 5. Nowiki escaping should account for indent-pres
23862 !! options
23863 parsoid=html2wt
23864 !! html/parsoid
23865 <pre>==foo==</pre>
23866 !! wikitext
23867  ==foo==
23868 !! end
23870 !!test
23871 T95794: nowiki escaping should account for leading space at start-of-line in an indent-pre block
23872 !! options
23873 parsoid=html2wt
23874 !! html/parsoid
23875 <pre>
23876 * foo
23877 * bar
23878 </pre>
23879 !! wikitext
23880  * foo
23881  * bar
23882 !! end
23884 #### --------------- Behavior Switches --------------------
23886 !! test
23887 1. Valid behavior switches should be escaped
23888 !! options
23889 parsoid=html2wt
23890 !! html/parsoid
23891 __TOC__
23892 <i>__TOC__</i>
23893 !! wikitext
23894 <nowiki>__TOC__</nowiki>
23895 ''<nowiki>__TOC__</nowiki>''
23896 !! end
23898 !! test
23899 2. Invalid behavior switches should not be escaped
23900 !! options
23901 parsoid=html2wt
23902 !! html/parsoid
23903 __TOO__
23904 __|__
23905 !! wikitext
23906 __TOO__
23907 __|__
23908 !! end
23910 # We use indent-pre as an indirect way to test for sol-transparent behavior.
23911 !! test
23912 Behavior switches should be SOL-transparent
23913 !! options
23914 parsoid=html2wt
23915 !! html/parsoid
23916  <meta property="mw:PageProp/toc" />
23918  <!-- this one's bogus -->
23919 <pre>__TOO__</pre>
23921 <pre data-parsoid='{}'><meta property="mw:PageProp/toc" data-parsoid='{"src":"__TOC__","magicSrc":"__TOC__"}'/> foo</pre>
23923 <meta property="mw:PageProp/toc" data-parsoid='{"src":"__TOC__","magicSrc":"__TOC__"}'/><pre data-parsoid='{}'>bar</pre>
23924 !! wikitext
23925  __TOC__
23927  <!-- this one's bogus -->
23928  __TOO__
23930  __TOC__ foo
23932 __TOC__
23933  bar
23934 !! end
23936 #### --------------- HTML tags ---------------
23937 #### 1. a tags
23938 #### 2. other tags
23939 #### 3. multi-line html tag
23940 #### 4. extension tags
23941 #### -----------------------------------------
23942 !! test
23943 1. a tags
23944 !! options
23945 parsoid=html2wt
23946 !! html/parsoid
23947 &lt;a href=&quot;http://google.com&quot;&gt;google&lt;/a&gt;
23948 !! wikitext
23949 <a href="http://google.com">google</a>
23950 !! end
23952 !! test
23953 2. other tags
23954 !! options
23955 parsoid=html2wt
23956 !! html/parsoid
23957 <ul><li> &lt;div&gt;foo&lt;/div&gt;</li>
23958 <li> &lt;div style=&quot;color:red&quot;&gt;foo&lt;/div&gt;</li>
23959 <li> &lt;td&gt;</li></ul>
23961 !! wikitext
23962 * <nowiki><div>foo</div></nowiki>
23963 * <nowiki><div style="color:red">foo</div></nowiki>
23964 * <nowiki><td></nowiki>
23965 !! end
23967 !! test
23968 3. multi-line html tag
23969 !! options
23970 parsoid=html2wt
23971 !! html/parsoid
23972 <p>&lt;div
23973 &gt;foo&lt;/div
23974 &gt;
23975 </p>
23976 !! wikitext
23977 <nowiki><div
23978 >foo</div
23979 ></nowiki>
23980 !! end
23982 !! test
23983 4. extension tags
23984 !! options
23985 parsoid=html2wt
23986 !! html/parsoid
23987 <p>&lt;ref&gt;foo&lt;/ref&gt;
23988 </p><p>&lt;ref&gt;bar
23989 </p><p>baz&lt;/ref&gt;
23990 </p>
23991 !! wikitext
23992 <nowiki><ref>foo</ref></nowiki>
23994 <nowiki><ref>bar</nowiki>
23996 baz<nowiki></ref></nowiki>
23997 !! end
23999 #### --------------- Others ---------------
24000 !! test
24001 Escaping nowikis
24002 !! options
24003 parsoid=html2wt
24004 !! html/parsoid
24005 <p>&lt;nowiki&gt;foo&lt;/nowiki&gt;
24006 </p>
24007 !! wikitext
24008 &lt;nowiki&gt;foo&lt;/nowiki&gt;
24009 !! end
24011 ## The quote-char in the input is necessary for triggering the bug
24012 !! test
24013 (Bug 52035) Nowiki-escaping should not get tripped by " :" in text
24014 !! options
24015 parsoid=html2wt
24016 !! html/parsoid
24017 <p>foo's bar :</p>
24018 !! wikitext
24019 foo's bar :
24020 !! end
24022 #----------- End of wikitext escaping tests --------------
24024 !! test
24026 Tag-like HTML structures are passed through as text
24027 !! wikitext
24028 <x y>
24030 <x.y>
24032 <x-y>
24040 1<d e>f
24041 !! html
24042 <p>&lt;x y&gt;
24043 </p><p>&lt;x.y&gt;
24044 </p><p>&lt;x-y&gt;
24045 </p><p>1&gt;2
24046 </p><p>x&lt;y
24047 </p><p>a&gt;b
24048 </p><p>1&lt;d e&gt;f
24049 </p>
24050 !! end
24052 !! test
24053 HTML tag with necessary entities in attributes
24054 !! wikitext
24055 <span title="&amp;amp;">foo</span>
24056 !! html
24057 <p><span title="&amp;amp;">foo</span>
24058 </p>
24059 !! end
24061 !! test
24062 HTML tag with 'unnecessary' entity encoding in attributes
24063 !! wikitext
24064 <span title="&amp;">foo</span>
24065 !! html
24066 <p><span title="&amp;">foo</span>
24067 </p>
24068 !! end
24070 !! test
24071 HTML tag with broken attribute value quoting
24072 !! options
24073 parsoid=wt2html,html2html
24074 !! wikitext
24075 <span title="Hello world>Foo</span>
24076 !! html/php
24077 <p><span title="Hello world">Foo</span>
24078 </p>
24079 !! html/parsoid
24080 <p><span title="Hello world">Foo</span></p>
24081 !! end
24083 !! test
24084 Self-closed tag with broken attribute value quoting
24085 !! options
24086 parsoid=wt2html,html2html
24087 !! wikitext
24088 <div title="Hello world />Foo
24089 !! html/php+tidy
24090 <div title="Hello world"></div>
24091 <p>Foo</p>
24092 !! html/parsoid
24093 <div title="Hello world " data-parsoid='{"stx":"html","selfClose":true}'></div><p>Foo</p>
24094 !! end
24096 !! test
24097 Table with broken attribute value quoting
24098 !! options
24099 parsoid=wt2html,html2html
24100 !! wikitext
24102 | title="Hello world|Foo
24104 !! html/php
24105 <table>
24106 <tr>
24107 <td title="Hello world">Foo
24108 </td></tr></table>
24110 !! html/parsoid
24111 <table>
24112 <tr>
24113 <td title="Hello world">Foo
24114 </td></tr></table>
24116 !! end
24118 !! test
24119 Table with broken attribute value quoting on consecutive lines
24120 !! options
24121 parsoid=wt2html,html2html
24122 !! wikitext
24124 | title="Hello world|Foo
24125 | style="color:red|Bar
24127 !! html/php
24128 <table>
24129 <tr>
24130 <td title="Hello world">Foo
24131 </td>
24132 <td style="color:red">Bar
24133 </td></tr></table>
24135 !! html/parsoid
24136 <table><tbody>
24137 <tr>
24138 <td title="Hello world">Foo
24139 </td><td style="color: red">Bar
24140 </td></tr></tbody></table>
24142 !! end
24144 !!test
24145 Accept empty td cell attribute
24146 !! wikitext
24148 | align="center" | foo ||  |
24150 !! html
24151 <table>
24152 <tr>
24153 <td align="center"> foo </td>
24154 <td>
24155 </td></tr></table>
24157 !!end
24159 !!test
24160 Non-empty attributes in th-cells
24161 !! wikitext
24163 ! Foo !! style="color: red" | Bar
24165 !! html
24166 <table>
24167 <tr>
24168 <th> Foo </th>
24169 <th style="color: red"> Bar
24170 </th></tr></table>
24172 !!end
24174 !!test
24175 Accept empty attributes in th-cells
24176 !! wikitext
24178 !| foo !!| bar
24180 !! html
24181 <table>
24182 <tr>
24183 <th> foo </th>
24184 <th> bar
24185 </th></tr></table>
24187 !!end
24189 !!test
24190 Empty table rows go away
24191 !! wikitext
24193 | Hello
24194 | there
24195 |- class="foo"
24198 !! html
24199 <table>
24200 <tr>
24201 <td> Hello
24202 </td>
24203 <td> there
24204 </td></tr>
24206 </table>
24208 !! end
24211 ### Parsoid-centric tests for testing RTing of inter-element separators
24212 ### Edge cases not tested by existing parser tests and specific to
24213 ### Parsoid-specific serialization strategies.
24216 !!test
24217 RT-ed inter-element separators should be valid separators
24218 !! wikitext
24220 |- [[foo]]
24222 !! html/php
24223 <table>
24225 </table>
24227 !! html/parsoid
24228 <table>
24229 <tbody><tr data-parsoid='{"startTagSrc":"|-","a":{"[[foo]]":null},"sa":{"[[foo]]":""},"autoInsertedEnd":true}'></tr>
24230 </tbody></table>
24231 !!end
24233 # Parsoid-only since PHP parser relies on Tidy for correct output
24234 !!test
24235 Trailing newlines in a deep dom-subtree that ends a wikitext line should be migrated out
24236 !!options
24237 parsoid
24238 !! wikitext
24240 |<small>foo
24245 |<small>foo<small>
24247 !! html
24248 <table>
24249 <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'><small data-parsoid='{"stx":"html","autoInsertedEnd":true}'>foo
24250 <p>bar</p></small></td></tr>
24251 </tbody></table>
24253 <table>
24254 <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>
24255 </tbody></table>
24256 !!end
24258 # Note that the "style" attribute is really a template parameter here.
24259 # The = would have to be {{=}} if you wanted the literal.
24260 !!test
24261 Empty TD followed by TD with tpl-generated attribute
24262 !! wikitext
24266 |{{echo|style='color:red'}}|foo
24268 !! html
24269 <table>
24271 <tr>
24272 <td>
24273 </td>
24274 <td>foo
24275 </td></tr></table>
24277 !!end
24279 !!test
24280 Indented table with an empty td
24281 !! wikitext
24282  {|
24283  |-
24285  |foo
24286  |}
24287 !! html
24288 <table>
24290 <tr>
24291 <td>
24292 </td>
24293 <td>foo
24294 </td></tr></table>
24296 !!end
24298 ## We have some newline diffs RT-ing this edge case
24299 ## and it is not important enough -- we seem to be emitting
24300 ## at most 2 newlines after a </tr> and this is unrelated to
24301 ## the issue from T85627 that this is testing.
24302 !!test
24303 Indented table with blank lines in between (T85627)
24304 !! options
24305 parsoid=wt2html
24306 !! wikitext
24307  {|
24308  |foo
24311  |}
24312 !! html
24313 <table>
24315 <tr>
24316 <td>foo
24317 </td></tr></table>
24319 !!end
24321 !!test
24322 Indented block & table
24323 !! wikitext
24324  <div>foo</div>
24325  {|
24326  |foo
24327  |}
24328 !! html/php
24329  <div>foo</div>
24330 <table>
24331 <tr>
24332 <td>foo
24333 </td></tr></table>
24335 !! html/parsoid
24336  <div data-parsoid='{"stx":"html"}'>foo</div>
24337  <table><tbody>
24338  <tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'>foo</td></tr>
24339  </tbody></table>
24340 !!end
24342 !! test
24343 Indent and comment before table row
24344 !! wikitext
24346  <!--hi-->|-
24347  | there
24349 !! html/php
24350 <table>
24352 <tr>
24353 <td> there
24354 </td></tr></table>
24356 !! html/parsoid
24357 <table>
24358  <!--hi--><tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'>
24359  <td data-parsoid='{"autoInsertedEnd":true}'> there</td></tr>
24360 </tbody></table>
24361 !! end
24363 # Parsoid-specific since PHP parser doesn't handle this mixed tbl-wikitext
24364 !!test
24365 Empty TR followed by a template-generated TR
24366 !!options
24367 parsoid
24368 !! wikitext
24371 {{echo|<tr><td>foo</td></tr>}}
24373 !! html
24374 <table>
24375 <tbody>
24376 <tr></tr>
24377 <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}}]}'>
24378 <td>foo</td></tr>
24379 </tbody></table>
24380 !!end
24382 ## PHP and parsoid output differ for this, and since this is primarily
24383 ## for testing Parsoid's serializer, marking this Parsoid only
24384 !!test
24385 Empty TR followed by mixed-ws-comment line should RT correctly
24386 !!options
24387 parsoid
24388 !! wikitext
24391  <!--c-->
24393 <!--c--> <!--d-->
24395 !! html
24396 <table>
24397 <tbody>
24398 <tr></tr>
24399  <!--c-->
24400 <tr>
24401 <!--c--> </tr><!--d-->
24402 </tbody></table>
24404 !!end
24406 !!test
24407 Multi-line image caption generated by templates with/without trailing newlines
24408 !! wikitext
24409 [[File:Foobar.jpg|thumb|300x300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}]]
24410 [[File:Foobar.jpg|thumb|300x300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}\n\n]]
24411 !! html/parsoid
24412 <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>
24413 <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>
24414 !!end
24416 !! test
24417 New element inserted (without intervening newlines) after an old sol-transparent node should serialize correctly
24418 !! options
24419 parsoid=html2wt
24420 !! html/parsoid
24421 <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>
24423 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{}'/><h1>new heading</h1>
24424 !! wikitext
24425 <includeonly>foo</includeonly>
24426 new para
24428 [[Category:Foo]]
24430 = new heading =
24431 !! end
24433 ## PHP emits broken html for this, and since this is primarily
24434 ## a Parsoid serializer test, marking this Parsoid only
24435 !!test
24436 Improperly nested inline or quotes tags with whitespace in between
24437 !! wikitext
24438 <span> <s>x</span> </s>
24439 ''' ''x''' ''
24440 !! html/parsoid
24441 <p><span> <s>x</s></span><s> </s>
24442 <b> <i>x</i></b><i> </i>
24443 </p>
24444 !!end
24446 !!test
24447 Encapsulate protected attributes from wt
24448 !! wikitext
24449 <div typeof="mw:placeholder stuff" data-mw="whoo" data-parsoid="weird" data-parsoid-other="no" about="time" rel="mw:true">foo</div>
24450 !! html/parsoid
24451 <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>
24452 </body>
24453 !!end
24455 ## Currently the p-wrapper is fragile in how it adds / removes transformations.
24456 ## Having nested or stray pre tags results in the attempt to add duplicates,
24457 ## causing an assertion fail. This test tries to prevent that situation.
24458 !!test
24459 Ensure ParagraphWrapper can deal with stray closing pre tags
24460 !!options
24461 parsoid=wt2html
24462 !! wikitext
24463 plain text</pre>
24464 !! html/parsoid
24465 plain text
24466 !!end
24468 !!test
24469 1. Ensure fostered text content is wrapped in element nodes
24470 !!options
24471 parsoid=wt2html
24472 !! wikitext
24473 <table>hi</table><table>ho</table>
24474 !! html/parsoid
24475 <p>hi</p>
24476 <table></table>
24477 <p>ho</p>
24478 <table></table>
24479 !!end
24481 !!test
24482 2. Ensure fostered text content is wrapped in element nodes (traps regressions around fostered marker on the element getting lost)
24483 !!options
24484 parsoid=wt2html,wt2wt
24485 !! wikitext
24486 <table>
24487 <tr> || ||
24488 <td> a
24489 </table>
24490 !! html/parsoid
24491 <p> || ||
24492 </p><table>
24493 <tbody><tr><td> a</td></tr>
24494 </tbody></table>
24495 !!end
24497 !!test
24498 Encapsulation properly handles null DSR information from foster box
24499 !!options
24500 parsoid=wt2html,wt2wt
24501 !! wikitext
24502 {{echo|<table>foo<tr><td>bar</td></tr></table>}}
24503 !! html/parsoid
24504 <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>
24505 !!end
24507 !!test
24508 1. Encapsulate foster-parented transclusion content
24509 !!options
24510 parsoid=wt2wt,wt2html
24511 !! wikitext
24512 <table>{{echo|foo<tr><td>bar</td></tr>}}</table>
24513 !! html/parsoid
24514 <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>
24515 <tbody>
24516 <tr>
24517 <td>bar</td>
24518 </tr>
24519 </tbody>
24520 </table>
24521 !!end
24523 !!test
24524 2. Encapsulate foster-parented transclusion content
24525 !!options
24526 parsoid=wt2wt,wt2html
24527 !! wikitext
24528 <table><div>{{echo|foo}}</div><tr><td>bar</td></tr></table>
24529 !! html/parsoid
24530 <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>
24531 <table>
24532 <tbody>
24533 <tr>
24534 <td>bar</td>
24535 </tr>
24536 </tbody>
24537 </table>
24538 !!end
24540 !!test
24541 3. Encapsulate foster-parented transclusion content
24542 !!options
24543 parsoid=wt2wt,wt2html
24544 !! wikitext
24545 <table><div><p>{{echo|foo</p></div><tr><td>}}bar</td></tr></table>
24546 !! html/parsoid
24547 <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;]}">
24548 <p>foo</p>
24549 </div>
24550 <table>
24551 <tbody>
24552 <tr>
24553 <td>bar</td>
24554 </tr>
24555 </tbody>
24556 </table>
24557 !!end
24559 !!test
24560 4. Encapsulate foster-parented transclusion content
24561 !!options
24562 parsoid=wt2wt,wt2html
24563 !! wikitext
24564 <table><div><p>{{echo|foo</p></div><tr><td>}}bar</td></tr></table>
24565 !! html/parsoid
24566 <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;]}">
24567 <p>foo</p>
24568 </div>
24569 <table>
24570 <tbody>
24571 <tr>
24572 <td>bar</td>
24573 </tr>
24574 </tbody>
24575 </table>
24576 !!end
24578 !!test
24579 5. Encapsulate foster-parented transclusion content
24580 !!options
24581 parsoid=wt2wt,wt2html
24582 !! wikitext
24583 <table><tr><td><div><p>{{echo|foo</p></div></td>foo}}</tr></table>
24584 !! html/parsoid
24585 <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>
24586 <table>
24587 <tbody>
24588 <tr>
24589 <td>
24590 <div>
24591 <p>foo</p>
24592 </div>
24593 </td>
24594 </tr>
24595 </tbody>
24596 </table>
24597 !!end
24599 !!test
24600 6. Encapsulate foster-parented transclusion content
24601 !!options
24602 parsoid=wt2wt,wt2html
24603 !! wikitext
24604 <table><tr><td><div><p>{{echo|foo</p></div></td>foo</tr></table>}}<p>ok</p>
24605 !! html/parsoid
24606 <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>
24607 <table>
24608 <tbody>
24609 <tr>
24610 <td>
24611 <div>
24612 <p>foo</p>
24613 </div>
24614 </td>
24615 </tr>
24616 </tbody>
24617 </table>
24618 <p>ok</p>
24619 !!end
24621 !!test
24622 7. Encapsulate foster-parented transclusion content
24623 !!options
24624 parsoid=wt2wt,wt2html
24625 !! wikitext
24626 <table>{{echo|<p>foo</p>}}<td>bar</td></table>
24627 !! html/parsoid
24628 <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>
24629 <table>
24630 <tbody>
24631 <tr>
24632 <td>bar</td>
24633 </tr>
24634 </tbody>
24635 </table>
24636 !!end
24638 # Note that the wt is broken on purpose: the = should be {{=}} if you
24639 # don't want it to be a template parameter key.
24640 !!test
24641 8. Encapsulate foster-parented transclusion content
24642 !!options
24643 parsoid=wt2wt,wt2html
24644 !! wikitext
24645 {{echo|a
24646 }}{|{{echo|style='color:red'}}
24650 !! html/parsoid
24651 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"a\n"}},"i":0}}]}'>a</p>
24652 <span> </span>
24653 <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>
24654 <table>
24655 <tbody>
24656 <tr>
24657 <td>b</td>
24658 </tr>
24659 </tbody>
24660 </table>
24661 !!end
24663 !!test
24664 9. Encapsulate foster-parented transclusion content
24665 !!options
24666 parsoid=wt2wt,wt2html
24667 !! wikitext
24668 <table>{{echo|hi</table>hello}}
24669 !! html/parsoid
24670 <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>
24671 !!end
24673 !!test
24674 Table in fosterable position
24675 !!options
24676 parsoid=wt2html
24677 !! wikitext
24678 {{OpenTable}}
24679 <div>
24682 </div>
24684 !! html/parsoid
24685 <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">
24686 </span>
24687 <table about="#mwt1" data-parsoid='{"autoInsertedEnd":true}'></table>
24689 <table>
24690 </table>
24691 !!end
24693 # Parsoid only for bug 64747
24694 !! test
24695 Properly encapsulate empty-content transclusions in fosterable positions
24696 !! wikitext
24697 <table>
24698 {{#if:|
24699 <td>foo</td>
24701 </table>
24702 !! html/parsoid
24703 <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"}]]}'>
24705 </table>
24706 !! end
24708 !! test
24709 Always encapsulate foster box when template range is expanded to table
24710 !! options
24711 parsoid=wt2wt
24712 !! wikitext
24714 hello
24715 {{OpenTable}}
24717 !! html/parsoid
24719 !! end
24721 !! test
24722 T115289: Unclosed table
24723 !! wikitext
24724 {{echo|<table>}}<!--c-->[[Category:Two]]
24725 !! html/parsoid
24726 <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>
24727 !! end
24729 !! test
24730 T115289: Don't migrate newlines out of tables with fostered content
24731 !! wikitext
24732 <table><td></td>{{echo|<tr>[[Category:One]]}}<!--c-->[[Category:Two]]
24733 !! html/parsoid
24734 <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>
24735 !! end
24737 !! test
24738 T73074: More fostering fun
24739 !! wikitext
24740 <table><td></td>{{echo|<tr>}}<!--c-->[[Category:Two]]
24741 !! html/parsoid
24742 <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>
24743 !! end
24745 !!test
24746 Support <object> element with .data attribute
24747 !!options
24748 parsoid=html2wt
24749 !! html/parsoid
24750 <object data="test.swf"></object>
24751 !! wikitext
24752 <object data="test.swf"></object>
24753 !!end
24755 !! test
24756 Don't block XML namespace declaration
24757 !! wikitext
24758 <span xmlns:dct="http://purl.org/dc/terms/" property="dct:title">MediaWiki</span>
24759 !! html/php
24760 <p><span xmlns:dct="http&#58;//purl.org/dc/terms/" property="dct:title">MediaWiki</span>
24761 </p>
24762 !! html/parsoid
24763 <p><span xmlns:dct="http://purl.org/dc/terms/" data-x-property="dct:title" data-parsoid='{"stx":"html"}'>MediaWiki</span></p>
24764 !! end
24766 # -----------------------------------------------------------------
24767 # The following section of tests are primarily to spec requirements
24768 # around serialization of new/edited content.
24770 # All these tests are marked Parsoid html2wt and html2html only
24771 # ----------------------------------------------------------------
24773 # 'mi' is a localinterwiki prefix as well as a language
24774 !! test
24775 Serialize interwiki links pointing to the current wiki as plain wiki links (bug 65869)
24776 !! options
24777 parsoid=html2wt
24778 !! html/parsoid
24779 <p><a rel="mw:ExtLink" href="http://mi.wikipedia.org/wiki/Foo">Foo</a></p>
24780 !! wikitext
24781 [[Foo]]
24782 !! end
24784 # See T93839
24785 !! test
24786 New wikilinks should be serialized properly
24787 !! options
24788 parsoid=html2wt
24789 !! html/parsoid
24790 <a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{}'>Foo</a>
24791 <a rel="mw:WikiLink" href="./Foo" title="Foo">Foo</a>
24792 !! wikitext
24793 [[Foo]]
24794 [[Foo]]
24795 !! end
24797 !! test
24798 New wiki links (href variations)
24799 !! options
24800 parsoid=html2wt
24801 !! html/parsoid
24802 <a rel="mw:WikiLink" href="./Foo_bar">Foo_bar</a>
24803 <a rel="mw:WikiLink" href="Foo_bar">Foo_bar</a>
24804 <a rel="mw:WikiLink" href="Foo bar">Foo_bar</a>
24805 <a rel="mw:WikiLink" href="./Toxine_bact%C3%A9rienne">Toxine bactérienne</a>
24806 !! wikitext
24807 [[Foo_bar]]
24808 [[Foo_bar]]
24809 [[Foo_bar]]
24810 [[Toxine bactérienne]]
24811 !! end
24813 !! test
24814 New wiki links (content string variations)
24815 !! options
24816 parsoid=html2wt
24817 !! html/parsoid
24818 <a rel="mw:WikiLink" href="./Foo_bar">Foo_bar</a>
24819 <a rel="mw:WikiLink" href="./Foo_bar">Foo bar</a>
24820 <a rel="mw:WikiLink" href="./Foo_bar">./Foo_bar</a>
24821 !! wikitext
24822 [[Foo_bar]]
24823 [[Foo bar]]
24824 [[Foo_bar|./Foo_bar]]
24825 !! end
24827 !! test
24828 New category links (href variations)
24829 !! options
24830 parsoid=html2wt
24831 !! html/parsoid
24832 <link rel="mw:PageProp/Category" href="./Category:Toxine_bactérienne" />
24833 <link rel="mw:PageProp/Category" href="./Category:Toxine_bact%C3%A9rienne" />
24834 <link rel="mw:PageProp/Category" href="Category:Toxine_bact%C3%A9rienne" />
24835 !! wikitext
24836 [[Category:Toxine bactérienne]]
24837 [[Category:Toxine bactérienne]]
24838 [[Category:Toxine bactérienne]]
24839 !! end
24841 !! test
24842 New sol transparent links don't need indent-pre nowiki protection
24843 !! options
24844 parsoid=html2wt
24845 language=de
24846 !! html/parsoid
24847          <link rel="mw:PageProp/redirect" href="./Main_Page">
24848 <!-- this is good  -->    <link rel="mw:PageProp/Category" href="./Category:Good" />
24849 <!-- this is great -->    <link rel="mw:PageProp/Category" href="./Kategorie:Great" />
24850 !! wikitext
24851          #WEITERLEITUNG [[Main Page]]
24852 <!-- this is good  -->    [[Category:Good]]
24853 <!-- this is great -->    [[Kategorie:Great]]
24854 !! end
24856 !! test
24857 New interlanguage links (href variations)
24858 !! options
24859 parsoid=html2wt
24860 !! html/parsoid
24861 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine bactérienne" />
24862 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine_bactérienne" />
24863 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine_bact%C3%A9rienne" />
24864 !! wikitext
24865 [[es:Toxine bactérienne]]
24866 [[es:Toxine_bactérienne]]
24867 [[es:Toxine_bactérienne]]
24868 !! end
24870 !! test
24871 Image: Modifying size of an image (1)
24872 !! options
24873 parsoid={
24874   "modes": ["wt2wt"],
24875   "changes": [
24876     ["img[height]", "attr", "height", "22"],
24877     ["img[width]", "attr", "width", "200"]
24878   ]
24880 !! wikitext
24881 [[Image:Foobar.jpg|230x230px]]
24882 !! wikitext/edited
24883 [[Image:Foobar.jpg|200x200px]]
24884 !!end
24886 !! test
24887 Image: Modifying size of an image (2)
24888 !! options
24889 parsoid={
24890   "modes": ["wt2wt"],
24891   "changes": [
24892     ["img[height]", "attr", "height", "100"],
24893     ["img[width]", "attr", "width", "500"]
24894   ]
24896 !! wikitext
24897 [[Image:Foobar.jpg|230x230px]]
24898 !! wikitext/edited
24899 [[Image:Foobar.jpg|500x500px]]
24900 !!end
24902 # Change in size is ignored so long as class='mw-default-size'
24903 !! test
24904 Image: Modifying size of an image (3)
24905 !! options
24906 parsoid={
24907   "modes": ["wt2wt"],
24908   "changes": [
24909     ["figure[class]", "removeClass", "mw-default-size"],
24910     ["figure img", "attr", "height", "19"],
24911     ["figure img", "attr", "width", "170"]
24912   ]
24914 !! wikitext
24915 [[Image:Foobar.jpg|thumb]]
24916 !! wikitext/edited
24917 [[Image:Foobar.jpg|thumb|170x170px]]
24918 !!end
24920 !! test
24921 Image: Modifying alignment of an image (bug 48665)
24922 !! options
24923 parsoid={
24924   "modes": ["wt2wt"],
24925   "changes": [
24926     ["figure[class]", "removeClass", "mw-halign-right"],
24927     ["figure[class]", "addClass", "mw-halign-left"]
24928   ]
24930 !! wikitext
24931 [[Image:Foobar.jpg|thumb|caption|right]]
24932 !! wikitext/edited
24933 [[Image:Foobar.jpg|thumb|caption|left]]
24934 !! end
24936 !! test
24937 Image: Modifying mw-default-size of an frameless image (bug 62805)
24938 !! options
24939 parsoid={
24940   "modes": ["wt2wt"],
24941   "changes": [
24942     ["figure.mw-default-size", "removeClass", "mw-default-size"]
24943   ]
24945 !! wikitext
24946 [[Image:Foobar.jpg|frameless|right]]
24947 !! wikitext/edited
24948 [[Image:Foobar.jpg|frameless|right|220x220px]]
24949 !! end
24951 !! test
24952 Image: Modifying valign of an image (bug 49221)
24953 !! options
24954 parsoid={
24955   "modes": ["wt2wt"],
24956   "changes": [
24957     ["*[typeof=\"mw:Image\"]", "removeClass", "mw-valign-middle"],
24958     ["*[typeof=\"mw:Image\"]", "addClass", "mw-valign-text-top"]
24959   ]
24961 !! wikitext
24962 [[File:Foobar.jpg|20px|middle]]
24963 !! wikitext/edited
24964 [[File:Foobar.jpg|20px|text-top]]
24965 !! end
24967 !! test
24968 Image: Modifying alt attribute of an image (bug 56400)
24969 !! options
24970 parsoid={
24971   "modes": ["wt2wt"],
24972   "changes": [
24973     ["img[alt]", "attr", "alt", "some alternate edited text"]
24974   ]
24976 !! wikitext
24977 [[File:Foobar.jpg|thumb|some caption|alt=some alternate text]]
24978 !! wikitext/edited
24979 [[File:Foobar.jpg|thumb|some caption|alt=some alternate edited text]]
24980 !!end
24982 !! test
24983 Image: Modifying caption of an image
24984 !! options
24985 parsoid={
24986   "modes": ["wt2wt"],
24987   "changes": [
24988     ["figcaption", "text", "new caption"]
24989   ]
24991 !! wikitext
24992 [[Image:Foobar.jpg|thumb|original caption]]
24993 !! wikitext/edited
24994 [[Image:Foobar.jpg|thumb|new caption]]
24995 !!end
24997 !! test
24998 Image: empty alt attribute (bug 48924)
24999 !! options
25000 parsoid
25001 !! wikitext
25002 [[File:Foobar.jpg|thumb|alt=|bar]]
25003 !! html
25004 <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>
25005 !! end
25007 !! test
25008 Image: new attributes should be serialized in wiki's language for RTL languages (bug 51852)
25009 !! options
25010 parsoid=html2wt
25011 language=ar
25012 disabled
25013 !! html/parsoid
25014 <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>
25015 !! wikitext
25016 [[Imagen:Foobar.jpg|derecha|miniaturadeimagen]]
25017 !! end
25019 !! test
25020 Image: Block level image should have \n before and after
25021 !! wikitext
25023 [[File:Foobar.jpg|right|thumb|150x150px]]
25025 !! html/parsoid
25026 <p>123</p>
25027 <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>
25028 <p>456</p>
25029 !!end
25031 !! test
25032 Image: New block level image should have \n before and after (existing content)
25033 !! wikitext
25035 [[File:Foobar.jpg|right|thumb|150x150px]]
25037 !! html/parsoid
25038 <p>123</p>
25039 <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>
25040 <p>456</p>
25041 !!end
25043 !! test
25044 Image: upright option (parsoid)
25045 !! wikitext
25046 [[File:Foobar.jpg|thumb|upright|caption]]
25047 [[File:Foobar.jpg|thumb|upright=0.5|caption]]
25048 [[File:Foobar.jpg|thumb|500x500px|upright=0.5|caption]]
25049 !! html/parsoid
25050 <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>
25051 <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>
25052 <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>
25053 !!end
25055 !! test
25056 Image: upright option is ignored on inline and frame images (parsoid)
25057 !! wikitext
25058 [[File:Foobar.jpg|500x500px|upright=0.5|caption]]
25059 !! html/parsoid
25060 <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>
25061 !!end
25063 !! test
25064 Image: from basic HTML (1)
25065 !! options
25066 parsoid=html2wt
25067 !! html/parsoid
25068 <span typeof="mw:Image">
25069   <img src="./File:Foobar.jpg" width=100 height=100 alt="Alt">
25070 </span>
25071 !! wikitext
25072 [[File:Foobar.jpg|link=|alt=Alt|100x100px]]
25073 !! end
25075 !! test
25076 Image: from basic HTML (2)
25077 !! options
25078 parsoid=html2wt
25079 !! html/parsoid
25080 <img src="./File:Foobar.jpg" width=100 height=100 alt="Alt">
25081 !! wikitext
25082 [[File:Foobar.jpg|link=|alt=Alt|100x100px]]
25083 !! end
25085 !! test
25086 Image: from basic HTML (3)
25087 !! options
25088 parsoid=html2wt
25089 !! html/parsoid
25090 <a href="Main"><img src="./File:Foobar.jpg" width=100 height=100 alt="Alt"></a>
25091 !! wikitext
25092 [[File:Foobar.jpg|link=Main|alt=Alt|100x100px]]
25093 !! end
25095 !! test
25096 Image: from basic HTML (4)
25097 !! options
25098 parsoid=html2wt
25099 !! html/parsoid
25100 <img src="./File:Foobar.jpg">
25101 !! wikitext
25102 [[File:Foobar.jpg|link=]]
25103 !! end
25105 !! test
25106 Lists: Serialize correctly even when list content is wrapped in p-tags (like VE does)
25107 !! options
25108 parsoid=html2wt
25109 !! html/parsoid
25110 <ul>
25111 <li><p>foo</p></li>
25112 </ul>
25113 !! wikitext
25114 * foo
25115 !! end
25117 !! test
25118 Lists: Serialize correctly even when list tags has unneeded whitespace between tags
25119 !! options
25120 parsoid=html2wt
25121 !! html/parsoid
25122 <ul> <li>foo</li></ul>
25123 !! wikitext
25124 * foo
25125 !! end
25127 !! test
25128 Don't strip leading whitespace when handling indent-pre suppressing tags
25129 !! options
25130 parsoid=html2wt
25131 !! html/parsoid
25132 <table>
25133   <tr><td> indented row</td></tr>
25134 </table>
25135 <blockquote><p>
25136  <b>This is very bold of you!</b>
25137 </p>
25138 <table><tr><td>
25139  indented cell (no pre-wrapping!)
25140 </td></tr></table>
25141 </blockquote>
25142 <p>foo</p>
25143  <div>bar</div>
25144 !! wikitext
25146   | indented row
25148 <blockquote>
25149  '''This is very bold of you!'''
25153  indented cell (no pre-wrapping!)
25155 </blockquote>
25157  <div>bar</div>
25158 !! end
25160 !! test
25161 Nowiki-wrap leading whitespace when handling indent-pre inducing tags
25162 !! options
25163 parsoid=html2wt
25164 !! html/parsoid
25165 <p>foo</p>
25166  <span>bar</span>
25168 <span>foo2
25169  </span>bar2
25171 <div>foo</div>
25172  <span>bar</span>
25174 <div>
25175  <span>foo</span>
25176 </div>
25177 !! wikitext
25180 <span>bar</span>
25182 <span>foo2
25183 <nowiki> </nowiki></span>bar2
25185 <div>foo</div>
25186 <nowiki> </nowiki><span>bar</span>
25188 <div>
25189 <nowiki> </nowiki><span>foo</span>
25190 </div>
25191 !! end
25193 !! test
25194 Lists: Dont insert newlines in a serialized list item.
25195 !! options
25196 parsoid=html2wt
25197 !! html/parsoid
25198 <ul><li>a<br>b</li><li>c</li></ul>
25199 !! wikitext
25200 * a<br>b
25201 * c
25202 !! end
25204 !! test
25205 1. Headings: Force sol-transparent links and behavior switches to serialize before/after
25206 !! options
25207 parsoid={
25208   "modes": ["html2wt"],
25209   "scrubWikitext": false
25211 !! html/parsoid
25212 <h2>hello there<link href="./Category:A1" rel="mw:PageProp/Category" /></h2>
25213 <h2><link href="./Category:A2" rel="mw:PageProp/Category" />hi pal</h2>
25215 <h2><!--foo-->  <link href="./Category:A3" rel="mw:PageProp/Category" />   how goes it</h2>
25216 <h2>it goes well   <link href="./Category:A4" rel="mw:PageProp/Category" />  <!--bar--></h2>
25218 <h2 data-parsoid='{}'>howdy<link href="./Category:A5" rel="mw:PageProp/Category" /></h2>
25220 <h2><meta property="mw:PageProp/toc" /> ok</h2>
25221 !! wikitext
25222 == hello there [[Category:A1]] ==
25224 == [[Category:A2]] hi pal ==
25226 == <!--foo-->  [[Category:A3]]    how goes it ==
25228 == it goes well    [[Category:A4]]  <!--bar--> ==
25230 ==howdy [[Category:A5]]==
25232 ==  __TOC__  ok ==
25233 !! end
25235 !! test
25236 2. Headings: Force sol-transparent links and behavior switches to serialize before/after
25237 !! options
25238 parsoid={
25239   "modes": ["html2wt"],
25240   "scrubWikitext": true
25242 !! html/parsoid
25243 <h2>hello there<link href="./Category:A1" rel="mw:PageProp/Category" /></h2>
25244 <h2><link href="./Category:A2" rel="mw:PageProp/Category" />hi pal</h2>
25246 <h2><!--foo-->  <link href="./Category:A3" rel="mw:PageProp/Category" />   how goes it</h2>
25247 <h2>it goes well   <link href="./Category:A4" rel="mw:PageProp/Category" />  <!--bar--></h2>
25249 <h2><meta property="mw:PageProp/toc" /> ok</h2>
25250 !! wikitext
25251 == hello there ==
25252 [[Category:A1]]
25253 [[Category:A2]]
25255 == hi pal ==
25257 <!--foo-->  [[Category:A3]]
25259 == how goes it ==
25261 == it goes well ==
25262 [[Category:A4]]  <!--bar-->
25264 __TOC__
25266 == ok ==
25267 !! end
25269 !! test
25270 Headings: Don't hoist metas that come from templates
25271 !! options
25272 parsoid={
25273   "modes": ["html2wt"],
25274   "scrubWikitext": true
25276 !! html/parsoid
25277 <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>
25278 !! wikitext
25279 == {{echo|foo [[Category:Foo]]}} ==
25280 !! end
25282 !! test
25283 Headings: Category in ref isn't hoisted
25284 !! options
25285 parsoid={
25286   "modes": ["html2wt"],
25287   "scrubWikitext": true
25289 !! html/parsoid
25290 <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>
25292 <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>
25293 !! wikitext
25294 == foo <ref>bar 
25295 [[Category:Baz]] </ref> ==
25297 <references />
25298 !! end
25300 !! test
25301 Parsoid: Serialize positional parameters with = in them as named parameter
25302 !! options
25303 parsoid=html2wt
25304 !! html/parsoid
25305 <p about="#mwt1" typeof="mw:Transclusion"
25306 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"f=oo"}},"i":0}}]}'>foo</p>
25308 <p about="#mwt1" typeof="mw:Transclusion"
25309 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"f=oo"}, "2":{"wt":"bar"}},"i":0}}]}'>foo</p>
25311 <!--Orig params with data-parsoid has heuristics for handling = chars-->
25312 <!--FIXME: But maybe the heuristic needs fixing to apply to new params as well-->
25313 <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>
25314 !! wikitext
25315 {{echo|1=f=oo}}
25317 {{echo|1=f=oo|2=bar}}
25319 <!--Orig params with data-parsoid has heuristics for handling = chars-->
25320 <!--FIXME: But maybe the heuristic needs fixing to apply to new params as well-->
25321 {{echo|<nowiki>f=oo</nowiki>|bar}}
25322 !! end
25324 !! test
25325 Parsoid: Serialize positional parameters with = in extlink as named parameter
25326 !! options
25327 parsoid=html2wt
25328 !! html/parsoid
25329 <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>
25330 !! wikitext
25331 {{echo|1=http://stuff?is=ok}}
25332 !! end
25334 !! test
25335 Parsoid: Correctly serialize block-node children when they are a combination of text and p-nodes
25336 !! options
25337 parsoid=html2wt
25338 !! html/parsoid
25339 <div>a<p>b</p></div>
25340 <div>a
25341 <p>b</p></div>
25342 <div>
25344 <p>b</p></div>
25345 !! wikitext
25346 <div>a
25348 </div>
25349 <div>a
25351 </div>
25352 <div>
25356 </div>
25357 !! end
25359 !! test
25360 Substrings resembling wikitext in hrefs should not get nowiki escapes
25361 !! options
25362 parsoid=html2wt
25363 !! html/parsoid
25364 <a rel="mw:WikiLink" href="./Foo''bar''baz">Foo''bar''baz</a>
25365 !! wikitext
25366 [[Foo''bar''baz]]
25367 !! end
25369 !! test
25370 Enforce single-line context in the serializer
25371 !! options
25372 parsoid=html2wt
25373 !! html/parsoid
25374 <h2>testing
25375 123</h2>
25377 <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">
25378 </span><span about="#mwt1">you</span> </h2>
25380 <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>
25382 <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
25383 there</span></li></ol>
25385 <ul><li>asd
25386 sdf</li></ul>
25388 <ul><li>foo
25390 baz</li>
25391 <li>foo <b>bar</b>
25392 baz</li></ul>
25394 <dl><dt>hi
25395 ho </dt><dd data-parsoid='{"stx":"row"}'> hi
25396 ho</dd></dl>
25398 <dl><dd> <table>
25399 <tbody><tr><td> ha
25401 ha</td></tr>
25402 </tbody></table></dd></dl>
25403 !! wikitext
25404 == testing 123 ==
25406 == hi {{bogus|there
25407 you}} ==
25409 == foo <ref>hello
25410 there</ref> ==
25412 <references />
25414 * asd sdf
25416 * foo bar baz
25417 * foo '''bar''' baz
25419 ; hi ho : hi ho
25421 : {|
25422 | ha
25426 !! end
25428 !! test
25429 Serialize new placeholder space without spans
25430 !! options
25431 parsoid=html2wt
25432 !! html/parsoid
25433 <p>foo<span typeof="mw:Placeholder"> </span>: bar</p>
25435 <p>foo<span typeof="mw:DisplaySpace mw:Placeholder" data-parsoid='{"src":" ","isDisplayHack":true}'> </span>: bar</p>
25437 <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>
25438 !! wikitext
25439 foo : bar
25441 foo : bar
25443 <ref>foo : bar</ref>ok
25444 !! end
25447 #-----------------------
25448 # Tag minimization tests
25449 #-----------------------
25451 !! test
25452 1. I/B quote minimization: wikitext-only tags should be combined
25453 !! options
25454 parsoid=html2wt
25455 !! html/parsoid
25456 <p><i>A</i><i>B</i></p>
25457 <p><b>A</b><b>B</b></p>
25458 <p><i>A</i><b><i>B</i></b></p>
25459 <p><b>A</b><i><b>B</b></i></p>
25460 <p><b>A</b><i><b>B</b><b>C</b></i><b>D</b></p>
25461 <p><i><b>A</b></i><i><b>B</b></i></p>
25462 <p><i><b>A</b></i><b><i>B</i></b></p>
25463 <p><b><i>A</i></b><i><b>B</b></i></p>
25464 !! wikitext
25465 ''AB''
25467 '''AB'''
25469 ''A'''B'''''
25471 '''A''B'''''
25473 '''A''BC''D'''
25475 '''''AB'''''
25477 '''''AB'''''
25479 '''''AB'''''
25480 !! end
25482 !! test
25483 2. I/B quote minimization: wikitext and html tags should not be combined
25484 !! options
25485 parsoid=html2wt
25486 !! html/parsoid
25487 <p><i>A</i><i data-parsoid='{"stx":"html"}'>B</i></p>
25488 <p><i>A</i><b><i data-parsoid='{"stx":"html"}'>B</i></b></p>
25489 !! wikitext
25490 ''A''<i>B</i>
25492 ''A''<nowiki/>'''<i>B</i>'''
25493 !! end
25495 !! test
25496 3. I/B quote minimization: templated content stops minimization
25497 !! options
25498 parsoid=html2wt
25499 !! html/parsoid
25500 <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>
25501 <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>
25502 !! wikitext
25503 ''A''{{echo|''B''}}
25505 ''A''{{echo|'''''B'''''}}
25506 !! end
25508 !! test
25509 4. I/B quote minimization: new content should be mimimized with adjacent old content
25510 !! options
25511 parsoid=html2wt
25512 !! html/parsoid
25513 <p><i>A</i><i>B</i></p>
25514 <p><b>A</b><b>B</b></p>
25515 <p><i>A</i><b><i>B</i></b></p>
25516 !! wikitext
25517 ''AB''
25519 '''AB'''
25521 ''A'''B'''''
25522 !! end
25524 !! test
25525 5a. Merge adjacent quote nodes if they've been edited
25526 !! options
25527 parsoid={
25528   "modes": ["wt2wt", "selser"],
25529   "changes": [
25530     ["p", "contents", "remove", ":contains('b')"]
25531   ]
25533 !! wikitext
25534 ''a''b''c''
25535 !! wikitext/edited
25536 ''ac''
25537 !! end
25539 !! test
25540 5b. Merge adjacent quote nodes if they've been edited
25541 !! options
25542 parsoid={
25543   "modes": ["wt2wt", "selser"],
25544   "changes": [
25545     ["#x", "remove"]
25546   ]
25548 !! wikitext
25549 ''a''<span id="x">b</span>''c''
25550 !! wikitext/edited
25551 ''ac''
25552 !! end
25554 !! test
25555 1. Merge adjacent link nodes as long as at least one element is new
25556 !! options
25557 parsoid={
25558   "modes": ["html2wt"],
25559   "scrubWikitext": true
25561 !! html/parsoid
25562 <a rel="mw:WikiLink" href="./Football">Foot</a><a rel="mw:WikiLink" href="./Football">ball</a>
25563 <a data-parsoid="{}" rel="mw:WikiLink" href="./Football">Foot</a><a rel="mw:WikiLink" href="./Football">ball</a>
25564 <a data-parsoid="{}" rel="mw:WikiLink" href="./Football">Foot</a><a data-parsoid="{}" rel="mw:WikiLink" href="./Football">ball</a>
25565 !! wikitext
25566 [[Football]]
25567 [[Football]]
25568 [[Football|Foot]][[Football|ball]]
25569 !! end
25571 !! test
25572 2. Merge adjacent link nodes and enable additional normalizations
25573 !! options
25574 parsoid={
25575   "modes": ["html2wt"],
25576   "scrubWikitext": true
25578 !! html/parsoid
25579 <a rel="mw:WikiLink" href="./Football"><i>Foot</i></a><a rel="mw:WikiLink" href="./Football"><i>ball</i></a>
25580 !! wikitext
25581 [[Football|''Football'']]
25582 !! end
25584 !! test
25585 3. Don't merge adjacent link nodes if scrubWikitext is false
25586 !! options
25587 parsoid={
25588   "modes": ["html2wt"],
25589   "scrubWikitext": false
25591 !! html/parsoid
25592 <a rel="mw:WikiLink" href="./Football">Foot</a><a rel="mw:WikiLink" href="./Football">ball</a>
25593 !! wikitext
25594 [[Football|Foot]][[Football|ball]]
25595 !! end
25597 #------------------------------
25598 # End of tag minimization tests
25599 #------------------------------
25601 !!test
25602 Bug 54262: New entities
25603 !! options
25604 parsoid=html2wt
25605 !! html/parsoid
25606 <span typeof="mw:Entity">&nbsp;</span>
25607 !! wikitext
25608 &nbsp;
25609 !! end
25611 ## Note that there is no wikitext output for 'unknownproperty' ##
25612 ## Unknown magic words are silently dropped ##
25614 !! test
25615 Magic words
25616 !! options
25617 parsoid=html2wt
25618 !! html/parsoid
25619 <meta property='mw:PageProp/toc' />
25620 <meta property='mw:PageProp/notoc' />
25621 <meta property='mw:PageProp/forcetoc' />
25622 <meta property='mw:PageProp/index' />
25623 <meta property='mw:PageProp/noindex' />
25624 <meta property='mw:PageProp/nogallery' />
25625 <meta property='mw:PageProp/noeditsection' />
25626 <meta property='mw:PageProp/notitleconvert' />
25627 <meta property='mw:PageProp/nocontentconvert' />
25628 <meta property='mw:PageProp/unknownproperty' />
25629 !! wikitext
25630 __TOC__
25631 __NOTOC__
25632 __FORCETOC__
25633 __INDEX__
25634 __NOINDEX__
25635 __NOGALLERY__
25636 __NOEDITSECTION__
25637 __NOTITLECONVERT__
25638 __NOCONTENTCONVERT__
25639 !! end
25641 !! test
25642 Consecutive <pre>s should not get merged
25643 !! options
25644 parsoid=html2wt,html2html
25645 !! html/parsoid
25646 <pre>a</pre><pre>b</pre>
25648 <pre>c
25649 </pre><pre>
25650 d</pre>
25652 <pre>e
25654 </pre><pre>
25656 f</pre>
25657 !! wikitext
25671 !! end
25673 !! test
25674 Edited ISBN links not serializable as ISBN links should serialize as wikilinks
25675 !! options
25676 parsoid=html2wt
25677 !! html/parsoid
25678 <a href="./Special:BookSources/1234567890" rel="mw:ExtLink">ISBN 1234567895</a>
25679 !! wikitext
25680 [[Special:BookSources/1234567890|ISBN 1234567895]]
25681 !! end
25683 !! test
25684 Edited RFC links not serializable as RFC links should serialize as extlinks
25685 !! options
25686 parsoid=html2wt
25687 !! html/parsoid
25688 <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink">New RFC</a>
25689 !! wikitext
25690 [//tools.ietf.org/html/rfc123 New RFC]
25691 !! end
25693 !! test
25694 Edited PMID links not serializable as PMID links should serialize as extlinks
25695 !! options
25696 parsoid=html2wt
25697 !! html/parsoid
25698 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink">New PMID</a>
25699 !! wikitext
25700 [//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract New PMID]
25701 !! end
25703 !! test
25704 WTS of autolinks with trailing/surrounding context
25705 !! options
25706 parsoid=html2wt
25707 !! html/parsoid
25708 <p><a href="http://cscott.net">http://cscott.net</a><b>foo</b></p>
25709 <p><a href="http://cscott.net">http://cscott.net</a><b data-parsoid='{"stx":"html"}'>foo</b></p>
25710 <p><b><a href="http://cscott.net">http://cscott.net</a></b></p>
25711 <p><b><a href="http://cscott.net">http://cscott.net</a> </b></p>
25712 <p><b><a href="http://cscott.net">http://cscott.net</a>x</b></p>
25713 <p><a href="http://cscott.net">http://cscott.net</a>x</p>
25714 !! wikitext
25715 http://cscott.net'''foo'''
25717 http://cscott.net<b>foo</b>
25719 '''http://cscott.net'''
25721 '''http://cscott.net '''
25723 '''http://cscott.net<nowiki/>x'''
25725 http://cscott.net<nowiki/>x
25726 !! end
25728 !! test
25729 WTS of autolinks with nowikis (round-trip)
25730 !! wikitext
25731 x<nowiki/>http://cscott.net<nowiki/>x
25732 !! html/parsoid
25733 <p>x<a rel="mw:ExtLink" href="http://cscott.net">http://cscott.net</a>x</p>
25734 !! end
25736 # this is the "easy" test because it leaves in place all the
25737 # data-parsoid information indicating this is an autolink
25738 !! test
25739 WTS of autolinks with escapes (editing)
25740 !! options
25741 parsoid={
25742   "modes": ["wt2wt"],
25743   "changes": [
25744     [ "meta", "remove" ]
25745   ]
25747 !! wikitext
25748 x<nowiki/>http://cscott.net<nowiki/>x
25749 !! wikitext/edited
25750 x<nowiki/>http://cscott.net<nowiki/>x
25751 !! end
25753 !! test
25754 WTS of edited autolink-like text (T103364)
25755 !! options
25756 parsoid={
25757   "modes": ["wt2wt"],
25758   "changes": [
25759     [ "span[typeof]", "removeAttr", "typeof" ]
25760   ]
25762 !! wikitext
25763 Not a link: <nowiki>http://example.com</nowiki>.
25764 !! wikitext/edited
25765 Not a link: <span><nowiki>http://example.com</nowiki></span>.
25766 !! end
25768 !! test
25769 WTS of newly-authored autolink-like text (T103364)
25770 !! options
25771 parsoid=html2wt
25772 !! html/parsoid
25773 <p>http://example.com is not a link.</p>
25774 !! wikitext
25775 <nowiki>http://example.com</nowiki> is not a link.
25776 !! end
25778 !! test
25779 WTS of autolink-like text after an autolink (T108563)
25780 !! options
25781 parsoid=html2wt
25782 !! html/parsoid
25783 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a> http://example.com is not a link.</p>
25784 !! wikitext
25785 http://example.com <nowiki>http://example.com</nowiki> is not a link.
25786 !! end
25788 !! test
25789 Magic links inside links (not autolinked)
25790 !! wikitext
25791 [[Foo|http://example.com]]
25792 [[Foo|RFC 1234]]
25793 [[Foo|PMID 1234]]
25794 [[Foo|ISBN 123456789x]]
25796 [http://foo.com http://example.com]
25797 [http://foo.com RFC 1234]
25798 [http://foo.com PMID 1234]
25799 [http://foo.com ISBN 123456789x]
25800 !! html+tidy
25801 <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>
25802 <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>
25803 !! html/parsoid
25804 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">http://example.com</a>
25805 <a rel="mw:WikiLink" href="./Foo" title="Foo">RFC 1234</a>
25806 <a rel="mw:WikiLink" href="./Foo" title="Foo">PMID 1234</a>
25807 <a rel="mw:WikiLink" href="./Foo" title="Foo">ISBN 123456789x</a></p>
25809 <p><a rel="mw:ExtLink" href="http://foo.com">http://example.com</a>
25810 <a rel="mw:ExtLink" href="http://foo.com">RFC 1234</a>
25811 <a rel="mw:ExtLink" href="http://foo.com">PMID 1234</a>
25812 <a rel="mw:ExtLink" href="http://foo.com">ISBN 123456789x</a></p>
25813 !! end
25815 !! test
25816 Magic links inside image captions (autolinked)
25817 !! wikitext
25818 [[File:Foobar.jpg|thumb|http://example.com]]
25819 [[File:Foobar.jpg|thumb|RFC 1234]]
25820 [[File:Foobar.jpg|thumb|PMID 1234]]
25821 [[File:Foobar.jpg|thumb|ISBN 123456789x]]
25822 !! html+tidy
25823 <div class="thumb tright">
25824 <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>
25825 <div class="thumbcaption">
25826 <div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>
25827 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a></div>
25828 </div>
25829 </div>
25830 <div class="thumb tright">
25831 <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>
25832 <div class="thumbcaption">
25833 <div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>
25834 <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc1234">RFC 1234</a></div>
25835 </div>
25836 </div>
25837 <div class="thumb tright">
25838 <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>
25839 <div class="thumbcaption">
25840 <div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>
25841 <a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a></div>
25842 </div>
25843 </div>
25844 <div class="thumb tright">
25845 <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>
25846 <div class="thumbcaption">
25847 <div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>
25848 <a href="/wiki/Special:BookSources/123456789X" class="internal mw-magiclink-isbn">ISBN 123456789x</a></div>
25849 </div>
25850 </div>
25851 !! html/parsoid
25852 <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>
25853 <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>
25854 <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>
25855 <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>
25856 !! end
25858 !! test
25859 WTS of magic word text (T109371)
25860 !! options
25861 parsoid=html2wt
25862 !! html/parsoid
25863 <p>RFC 1234</p>
25864 <p><a href="http://foo.com" rel="mw:ExtLink">RFC 1234</a></p>
25865 <p><a href="./Foo" rel="mw:WikiLink">RFC 1234</a></p>
25866 !! wikitext
25867 <nowiki>RFC 1234</nowiki>
25869 [http://foo.com RFC 1234]
25871 [[Foo|RFC 1234]]
25872 !! end
25874 !! test
25875 Edited Redirect link should emit a non-piped wikitext link
25876 !! options
25877 parsoid=html2wt
25878 !! html/parsoid
25879 <link rel="mw:PageProp/redirect" href="Bar" data-parsoid='{"a":{"href":"./Foo"},"sa":{"href":"Foo"}}'>
25880 !! wikitext
25881 #REDIRECT [[Bar]]
25882 !! end
25884 !! test
25885 T75121: Infer extension name from typeOf if data-mw is not present
25886 !! options
25887 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
25888 !! html/parsoid
25889 <div typeOf="mw:Extension/foo"></div>
25890 !! wikitext
25891 <foo />
25892 !! end
25894 # Note that the <p> wrapping isn't present in PHP parser output
25895 # The important thing for this test is that P-wrapping doesn't
25896 # interfere with the <nowiki> protection for leading - in <td>
25897 # (which isn't necessary for <th>).
25898 !! test
25899 T88318: p-wrapped dash in table.
25900 !! options
25901 parsoid=html2wt,wt2wt
25902 !! html/parsoid
25903 <table><tbody>
25904 <tr><th><p>-</p></th><th><p>- </p></th></tr>
25905 <tr><td><p>-</p></td><td><p>- </p></td></tr>
25906 <tr><td><small>-</small></td><td><br/><p>-</p></td><td><br/>-</td></tr>
25907 </tbody></table>
25908 !! wikitext
25911 !- 
25913 |<nowiki>-</nowiki>
25914 |<nowiki>- </nowiki>
25916 |<small>-</small>
25917 |<br>
25919 |<br>
25922 !! html/php+tidy
25923 <table>
25924 <tr>
25925 <th>-</th>
25926 <th>-</th>
25927 </tr>
25928 <tr>
25929 <td>-</td>
25930 <td>-</td>
25931 </tr>
25932 <tr>
25933 <td><small>-</small></td>
25934 <td><br />
25935 <p>-</p>
25936 </td>
25937 <td><br />
25938 <p>-</p>
25939 </td>
25940 </tr>
25941 </table>
25942 !! end
25944 !! test
25945 HTML id attribute with Parsoid-like element ids should not be serialized to wikitext
25946 !! options
25947 parsoid=html2wt
25948 !! html/parsoid
25949 <table id='mwAb'>
25950 <td id='mwAc'>foo</td>
25951 <td id='serialize-this'>bar</td>
25952 </table>
25953 !! wikitext
25955 |foo
25956 | id="serialize-this" |bar
25958 !! end
25960 !! test
25961 Parsoid-like element ids should not be serialized to wikitext unless shadowed
25962 !! options
25963 parsoid=html2wt
25964 !! html/parsoid
25965 <div id="mwAQ" data-parsoid='{"stx":"html","a":{"id":"mwAQ"},"sa":{"id":"hello"}}'>ok</div>
25966 !! wikitext
25967 <div id="hello">ok</div>
25968 !! end
25970 !! test
25971 WTS change modes
25972 !! options
25973 parsoid={
25974   "modes": ["wt2wt"],
25975   "changes": [
25976     [ "#xyz", "before", "<b>before</b> stuff " ],
25977     [ "#xyz", "after", " stuff <i>after</i>" ],
25978     [ "#xyz", "html", "x <b>y</b> z" ]
25979   ]
25981 !! wikitext
25982 <span id="xyz">hello</span>
25983 !! wikitext/edited
25984 '''before''' stuff <span id="xyz">x '''y''' z</span> stuff ''after''
25985 !! end
25987 !! test
25988 Never serialize a-tag as html, regardless of what data-parsoid has to say
25989 !! options
25990 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
25991 !! html/parsoid
25992 <a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{"stx":"html"}'>Foo</a>
25993 !! wikitext
25994 [[Foo]]
25995 !! end
25997 ## SSS FIXME: This is broken output nevertheless.
25998 ## What might be a reasonable non-broken output for this?
25999 ## This is an edge case unlikely to be seen in production
26000 ## that I am not wasting more time on this right now.
26001 !! test
26002 Never serialize a-tag as html, no matter what attributes it has
26003 !! options
26004 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
26005 !! html/parsoid
26006 <a bad='true' href='http://boo.org'><img src='http://boohoo.org' /></a>
26007 !! wikitext
26008 [http://boo.org http://boohoo.org]
26009 !! end
26011 # Misnested is an indication that selser can reuse the source but these have
26012 # shown to sneak through on occasion. See T101768.
26013 # The original wikitext here is: [http://test.com [[one]] two three]
26014 !! test
26015 Strip span tags added to mark misnested links
26016 !! options
26017 parsoid=html2wt
26018 !! html/parsoid
26019 <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>
26020 !! wikitext
26021 [http://test.com][[one]] two three
26022 !! end
26024 !! test
26025 Use data-parsoid.firstWikitextNode to compute newline constraints for template content
26026 !! options
26027 parsoid=html2wt
26028 !! html/parsoid
26029 <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|}"]}'>
26030 <tbody><tr><td>d
26031 </td></tr>
26032 </tbody></table>
26033 !! wikitext
26034 {{echo|a}}
26035 {|{{echo|c
26036 {{!}}d
26039 !! end
26041 ## This test verifies the presence and computation of this attribute indirectly
26042 ## by making an edit and ensuring that the serialization is correct (which it would be
26043 ## only if firstWikitextNode is properly set).
26044 !! test
26045 data-parsoid.firstWikitextNode should be computed properly in the presence of fostered content
26046 !! options
26047 parsoid= {
26048   "modes": ["wt2wt"],
26049   "changes": [
26050     [ "div#x", "remove" ],
26051     [ "div", "before", "<div>new</div>" ]
26052   ]
26054 !! wikitext
26055 <div id="x">foo</div>
26057 {{echo|<div>boo</div>
26058 {{!}}b}}
26061 !! wikitext/edited
26063 <div>new</div>
26065 {{echo|<div>boo</div>
26066 {{!}}b}}
26069 !! end
26071 # --------------------------------------------
26072 # Tests spec'ing wikitext serialization norms |
26073 # --------------------------------------------
26075 !! test
26076 1. Categories should always be serialized on their own line
26077 !! options
26078 parsoid=html2wt
26079 !! html/parsoid
26080 foo<link rel="mw:PageProp/Category" href="./Category:Foo">bar
26081 !! wikitext
26083 [[Category:Foo]]
26085 !! end
26087 !! test
26088 2. Categories that are part of templates should not introduce a line break
26089 !! wikitext
26090 foo {{echo|<span>bar</span> [[Category:baz]]}} bar
26091 !! html/parsoid
26092 <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>
26093 !! end
26095 # Careful while editing these next 2 tests. There are \u200f characters
26096 # before and after the <link> tags in the HTML and following some
26097 # of the categories in wikitext
26098 # Do not remove these characters in edits.
26100 # As part of the serialization, these bidi characters will get stripped.
26101 !! test
26102 RTL (\u200f) and LTR (\u200e) markers around category tags should be stripped
26103 !! options
26104 parsoid={
26105   "modes": ["html2wt"],
26106   "scrubWikitext": true
26108 !! html/parsoid
26109 <p>‏<link rel="mw:PageProp/Category" href="./קטגוריה:טקסים" />‏
26110 ‏<link rel="mw:PageProp/Category" href="./קטגוריה:_שיטות_משפט" />‏</p>
26111 !! wikitext
26112 [[קטגוריה:טקסים]]
26113 [[קטגוריה: שיטות משפט]]
26114 !! end
26116 !! test
26117 RTL (\u200f) and LTR (\u200e) markers should not be stripped if followed by a text node
26118 !! options
26119 parsoid={
26120   "modes": ["html2wt"],
26121   "scrubWikitext": true
26123 !! html/parsoid
26124 <p>‏<link rel="mw:PageProp/Category" href="./קטגוריה:טקסים" />‏y</p>
26125 !! wikitext
26126 [[קטגוריה:טקסים]]
26127 ‏y
26128 !! end
26130 !! test
26131 Lists: Add space after bullets
26132 !! options
26133 parsoid=html2wt
26134 !! html/parsoid
26135 <ul>
26136 <li>foo</li>
26137 <li> bar</li>
26138 <li><span> baz</span></li>
26139 </ul>
26140 !! wikitext
26141 * foo
26142 * bar
26143 * <span> baz</span>
26144 !! end
26146 !! test
26147 1. Headings: Add space before/after == (T53744)
26148 !! options
26149 parsoid=html2wt
26150 !! html/parsoid
26151 <h2>foo</h2>
26152 <h2> bar</h2>
26153 <h2>baz </h2>
26154 <h2><span> baz</span></h2>
26155 !! wikitext
26156 == foo ==
26158 == bar ==
26160 == baz ==
26162 == <span> baz</span> ==
26163 !! end
26165 !! test
26166 2. Headings: Add space before/after == even after hoisted content
26167 !! options
26168 parsoid={
26169   "modes": ["html2wt"],
26170   "scrubWikitext": true
26172 !! html/parsoid
26173 <h2> <link href="./Category:A2" rel="mw:PageProp/Category" />ok</h2>
26174 !! wikitext
26175  [[Category:A2]]
26177 == ok ==
26178 !! end
26180 !! test
26181 1. Headings: suppress newly created empty headings
26182 !! options
26183 parsoid={
26184   "modes": ["html2wt"],
26185   "scrubWikitext": true
26187 !! html/parsoid
26188 <h2></h2>
26189 !! wikitext
26190 !! end
26192 !! test
26193 2. Headings: don't suppress empty headings if scrubWikitext is false
26194 !! options
26195 parsoid=html2wt
26196 !! html/parsoid
26197 <h2></h2>
26198 !! wikitext
26199 ==<nowiki/>==
26200 !! end
26202 !! test
26203 3. Headings: suppress empty headings on edits
26204 !! options
26205 parsoid={
26206   "modes": ["selser"],
26207   "scrubWikitext": true,
26208   "changes": [
26209     [ "#x", "remove"]
26210   ]
26212 !! wikitext
26213 ==<span id="x">foo</span>==
26214 !! wikitext/edited
26215 !! end
26217 !! test
26218 Headings: Replace <br/> with a single whitespace char (when scrubWikitext = true)
26219 !! options
26220 parsoid={
26221   "modes": ["html2wt"],
26222   "scrubWikitext": true
26224 !! html/parsoid
26225 <h2>foo<br/>bar</h2>
26226 <h2>foo <span><br/>bar</span> baz</h2>
26227 !! wikitext
26228 == foo bar ==
26230 == foo <span> bar</span> baz ==
26231 !! end
26233 !! test
26234 Headings: Replace <br/> with a single whitespace char (when scrubWikitext = false)
26235 !! options
26236 parsoid={
26237   "modes": ["html2wt"],
26238   "scrubWikitext": false
26240 !! html/parsoid
26241 <h2>foo<br/>bar</h2>
26242 !! wikitext
26243 == foo<br> bar ==
26244 !! end
26246 !! test
26247 1. WT Quote Tags: suppress newly created empty style tags
26248 !! options
26249 parsoid={
26250   "modes": ["html2wt"],
26251   "scrubWikitext": true
26253 !! html/parsoid
26254 <i></i><b></b>
26255 !! wikitext
26256 !! end
26258 !! test
26259 2. WT Quote Tags: don't suppress empty style tags if scrubWikitext is false
26260 !! options
26261 parsoid=html2wt
26262 !! html/parsoid
26263 <i></i><b></b>
26264 !! wikitext
26265 ''<nowiki/>'''''<nowiki/>'''
26266 !! end
26268 !! test
26269 3. WT Quote Tags: suppress empty style tags on edits
26270 !! options
26271 parsoid={
26272   "modes": ["selser"],
26273   "scrubWikitext": true,
26274   "changes": [
26275     [ "#x", "remove"]
26276   ]
26278 !! wikitext
26279 '''<span id="x">foo</span>'''
26280 !! wikitext/edited
26281 !! end
26283 !! test
26284 1. Anchors: suppress newly created empty anchors
26285 !! options
26286 parsoid={
26287   "modes": ["html2wt"],
26288   "scrubWikitext": true
26290 !! html/parsoid
26291 <a rel="mw:WikiLink" href="./Test" title="Test"></a>
26292 !! wikitext
26293 !! end
26295 !! test
26296 2. Anchors: don't suppress empty anchors if scrubWikitext is false
26297 !! options
26298 parsoid={
26299   "modes": ["html2wt"],
26300   "scrubWikitext": false
26302 !! html/parsoid
26303 <a rel="mw:WikiLink" href="./Test" title="Test"></a>
26304 !! wikitext
26305 [[Test|<nowiki/>]]
26306 !! end
26308 !! test
26309 3. Anchors: suppress empty anchors on edits
26310 !! options
26311 parsoid={
26312   "modes": ["selser"],
26313   "scrubWikitext": true,
26314   "changes": [
26315     [ "#x", "remove"]
26316   ]
26318 !! wikitext
26319 [[Test|<span id="x">foo</span>]]
26320 !! wikitext/edited
26321 !! end
26323 !! test
26324 3a. Anchors: do not suppress numbered extlinks
26325 !! options
26326 parsoid={
26327   "modes": ["wt2wt"],
26328   "scrubWikitext": true
26330 !! wikitext
26331 [http://foo.com]
26332 !! html/parsoid
26333 <a rel="mw:ExtLink" href="http://foo.com"></a>
26334 !! end
26336 !! test
26337 3b. Anchors: do not suppress numbered extlinks
26338 !! options
26339 parsoid={
26340   "modes": ["wt2wt"],
26341   "scrubWikitext": true,
26342   "changes": [
26343     [ "#x", "remove"]
26344   ]
26346 !! wikitext
26347 [http://foo.com <span id="x">foo</span>]
26348 !! wikitext/edited
26349 [http://foo.com]
26350 !! end
26352 !!test
26353 Normalizations should be restricted to edited content
26354 !!options
26355 parsoid={
26356   "modes": ["selser"],
26357   "scrubWikitext": true,
26358   "changes": [
26359     [ "h1", "before", "<i></i>"]
26360   ]
26362 !!wikitext
26364 = =
26366 !!wikitext/edited
26368 = =
26370 !!end
26372 !! test
26373 1. Multiple normalizations (html2wt)
26374 !! options
26375 parsoid={
26376   "modes": ["html2wt"],
26377   "scrubWikitext": true
26379 !! html
26380 <h2><i></i></h2>
26381 <p><a href='Foo' rel='mw:WikiLink'>foo<i></i>
26382  </a><b><i></i></b>x</p>
26383 !! wikitext
26385 [[foo]]
26388 !! end
26390 !! test
26391 2. Multiple normalizations (selser)
26392 !! options
26393 parsoid={
26394   "modes": ["selser"],
26395   "scrubWikitext": true,
26396   "changes": [
26397     [ "#x", "after", "<h1><i></i></h1>\n<p> x<b></b></p>"]
26398   ]
26400 !! wikitext
26401 <span id="x">foo</span>
26402 !! wikitext/edited
26403 <span id="x">foo</span>
26406 !! end
26408 !! test
26409 1. Indent Pre Nowiki: suppress whitespace at the start of new paragraph
26410 !! options
26411 parsoid={
26412   "modes": ["html2wt"],
26413   "scrubWikitext": true
26415 !! html/parsoid
26416 <p> hi</p>
26417 <p>    hello</p>
26418 !! wikitext
26421 hello
26422 !! end
26424 !! test
26425 2. Indent Pre Nowiki: don't suppress whitespace at the start of new paragraph if scrubWikitext is false
26426 !! options
26427 parsoid=html2wt
26428 !! html/parsoid
26429 <p> hi</p>
26430 <p>    hello</p>
26431 !! wikitext
26432 <nowiki> </nowiki>hi
26434 <nowiki> </nowiki>   hello
26435 !! end
26437 !! test
26438 3. Indent Pre Nowiki: suppress whitespace after newlines in new paragraph or table cell
26439 !! options
26440 parsoid={
26441   "modes": ["html2wt"],
26442   "scrubWikitext": true
26444 !! html/parsoid
26445 <p>Foo
26446  bar
26447 baz</p>
26449 <table><tr><td>Foo
26450  bar
26451  baz bang</td></tr></table>
26453 <p><!--boo--> foo
26454  bar</p>
26456 <p> foo
26457  bar<span>boo</span></p>
26458 !! wikitext
26464 |Foo
26466 baz bang
26469 <!--boo-->foo
26473 bar<span>boo</span>
26474 !! end
26476 !! test
26477 4. Indent Pre Nowiki: suppress leading whitespace in edited paragraphs
26478 !! options
26479 parsoid={
26480   "modes": ["selser"],
26481   "scrubWikitext": true,
26482   "changes": [
26483     [ "p", "html", " a\n b" ]
26484   ]
26486 !! wikitext
26488 !! wikitext/edited
26491 !! end
26493 !! test
26494 1. New links that end in spaces
26495 !! options
26496 parsoid={
26497   "modes": ["html2wt"],
26498   "scrubWikitext": false
26500 !! html/parsoid
26501 <p><a rel="mw:WikiLink" href="./Berlin" title="Berlin">Berlin </a>is the capital of Germany.</p>
26502 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo </a><b>bar</b></p>
26503 <p><a rel="mw:WikiLink" href="./Boston" title="Boston">Boston </a> is a city.</p>
26504 !! wikitext
26505 [[Berlin ]]<nowiki/>is the capital of Germany.
26507 [[Foo ]]'''bar'''
26509 [[Boston ]] is a city.
26510 !! end
26512 !! test
26513 2. New links that end in spaces
26514 !! options
26515 parsoid={
26516   "modes": ["html2wt"],
26517   "scrubWikitext": true
26519 !! html/parsoid
26520 <p><a rel="mw:WikiLink" href="./Berlin" title="Berlin">Berlin </a>is the capital of Germany.</p>
26521 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo </a><b>bar</b></p>
26522 <p><a rel="mw:WikiLink" href="./Boston" title="Boston">Boston </a> is a city.</p>
26523 !! wikitext
26524 [[Berlin]] is the capital of Germany.
26526 [[Foo]] '''bar'''
26528 [[Boston]] is a city.
26529 !! end
26531 !! test
26532 1. Table cells with escapable prefixes
26533 !! options
26534 parsoid={
26535   "modes": ["html2wt"],
26536   "scrubWikitext": false
26538 !! html
26539 <table>
26540 <tr><td>a</td></tr>
26541 <tr><td>-</td></tr>
26542 <tr><td>+</td></tr>
26543 </table>
26544 !! wikitext
26548 |<nowiki>-</nowiki>
26550 |<nowiki>+</nowiki>
26552 !! end
26554 !! test
26555 2. Table cells with escapable prefixes
26556 !! options
26557 parsoid={
26558   "modes": ["html2wt"],
26559   "scrubWikitext": true
26561 !! html
26562 <table>
26563 <tr><td>a</td></tr>
26564 <tr><td>-</td></tr>
26565 <tr><td>+</td></tr>
26566 </table>
26567 !! wikitext
26571 | -
26573 | +
26575 !! end
26577 !! test
26578 3a. Table cells with escapable prefixes after edits
26579 !! options
26580 parsoid={
26581   "modes": ["selser"],
26582   "scrubWikitext": true,
26583   "changes": [
26584     [ "table tbody tr:first-child td:first-child", "remove"]
26585   ]
26587 !! wikitext
26589 |a||-
26591 !! wikitext/edited
26593 | -
26595 !! end
26597 !! test
26598 3b. Table cells with escapable prefixes after edits
26599 !! options
26600 parsoid={
26601   "modes": ["selser"],
26602   "scrubWikitext": true,
26603   "changes": [
26604     [ "table tbody tr:first-child td:first-child", "html", "-" ],
26605     [ "#x", "remove" ]
26606   ]
26608 !! wikitext
26610 |pqr
26611 |<span id="x">foo</span>+
26613 !! wikitext/edited
26615 | -
26616 | +
26618 !! end
26620 # FIXME: This test will fail because
26621 # normalization doesn't realize that the id attribute
26622 # will eliminate the escapable scenario
26623 !! test
26624 4a. Table cells without escapable prefixes after edits
26625 !! options
26626 parsoid={
26627   "modes": ["selser"],
26628   "scrubWikitext": true,
26629   "changes": [
26630     [ "#x", "html", "-" ]
26631   ]
26633 !! wikitext
26635 | id="x" |abcd
26637 !! wikitext/edited
26639 | id="x" |-
26641 !! end
26643 ## This tests normalizer's ability to discriminate between
26644 ## cells having identical content.
26645 !! test
26646 4b. Table cells without escapable prefixes after edits
26647 !! options
26648 parsoid={
26649   "modes": ["selser"],
26650   "scrubWikitext": true,
26651   "changes": [
26652     [ "td", "html", "-" ]
26653   ]
26655 !! wikitext
26657 |a||b
26659 !! wikitext/edited
26661 | -||-
26663 !! end
26665 ## This tests normalizer's ability to not be tripped by
26666 ## comments (and whitespace)
26667 !! test
26668 4c. Table cells without escapable prefixes after edits
26669 !! options
26670 parsoid={
26671   "modes": ["selser"],
26672   "scrubWikitext": true,
26673   "changes": [
26674     [ "table tbody tr td:first-child", "remove" ]
26675   ]
26677 !! wikitext
26680 <!--foo--> |a||-
26682 !! wikitext/edited
26685 <!--foo--> | -
26687 !! end
26689 ## This tests normalizer's ability to handle HTML cells
26690 !! test
26691 4d. Table cells without escapable prefixes after edits
26692 !! options
26693 parsoid={
26694   "modes": ["selser"],
26695   "scrubWikitext": true,
26696   "changes": [
26697     [ "td", "html", "-" ]
26698   ]
26700 !! wikitext
26701 <table>
26702 <tr><td>a</td></tr>
26703 </table>
26704 !! wikitext/edited
26705 <table>
26706 <tr><td>-</td></tr>
26707 </table>
26708 !! end
26710 ## T111151 Remove font elements without attributes
26711 !! test
26712 5a. font tags without attributes should be dropped in scrubWikitext mode
26713 !! options
26714 parsoid={
26715   "modes": ["html2wt"],
26716   "scrubWikitext": true
26718 !! html
26719 <font>foo</font>
26720 <font><font>bar</font></font>
26721 <font class="x">boo</font>
26722 !! wikitext
26725 <font class="x">boo</font>
26726 !! end
26728 !! test
26729 5b. font tags should not be dropped without scrubWikitext being enabled
26730 !! options
26731 parsoid={
26732   "modes": ["html2wt"],
26733   "scrubWikitext": false
26735 !! html
26736 <font>foo</font>
26737 !! wikitext
26738 <font>foo</font>
26739 !! end
26741 !! test
26742 Escape nowiki DOM elements
26743 !! options
26744 parsoid=html2wt
26745 !! html/parsoid
26746 <nowiki><i>foo</i></nowiki>
26747 !! wikitext
26748 &lt;nowiki&gt;''foo''&lt;/nowiki&gt;
26749 !! end
26751 # This is meant to be an interim fix while we go about figuring out
26752 # how to not introduce these trailing <nowiki/>s in the first place.
26753 !! test
26754 T115717: Strip trailing <nowiki/>s (without affecting valid uses)
26755 !! options
26756 parsoid=html2wt
26757 !! html/parsoid
26758 <p>x<meta typeof="mw:Placeholder" data-parsoid='{"src":"&lt;nowiki/>"}'/><meta typeof="mw:Placeholder" data-parsoid='{"src":"&lt;nowiki/>"}'/>
26759 y</p>
26760 <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>
26761 <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>
26762 !! wikitext
26766 {{echo|
26767 1 = <nowiki/>}}
26769 {{echo|
26770 1 = <nowiki/>
26772 !! end
26774 # ---------------------------------------------------
26775 # End of tests spec'ing wikitext serialization norms |
26776 # ---------------------------------------------------
26778 # T104032
26779 !! test
26780 Bare inline nodes not wrapped inside p-tags should be treated as p-wrapped
26781 !! options
26782 parsoid=html2wt
26783 !! html/parsoid
26784 a<p>b</p>
26785 <b>c</b><p>d</p>
26786 <table><tr>
26787 <td>a<p>b</p></td>
26788 <td><b>c</b><p>d</p></td>
26789 </tr></table>
26790 !! wikitext
26795 '''c'''
26801 |'''c'''
26804 !! end
26806 # -----------------------------------------------------------------
26807 # End of section for Parsoid-only html2wt tests for serialization
26808 # of new content
26809 # -----------------------------------------------------------------
26811 # -----------------------------------------------------------------
26812 # The following section of tests are primarily to spec behavior of
26813 # the selective serializer. All these tests have manual selser
26814 # changes. The automated selser changes for all tests handle the
26815 # wide variation of changes, but these tests here capture specs
26816 # deterministically.
26817 # ----------------------------------------------------------------
26819 ## T90517
26820 !! test
26821 Selser: New comments should not be lost
26822 !! options
26823 parsoid={
26824   "modes": ["selser"],
26825   "changes": [
26826     [ "#a", "after", "<!--c1-->" ],
26827     [ "#b", "before", "<!--c2-->" ]
26828   ]
26830 !! wikitext
26831 <span id="a">a</span>
26833 <span id="b">b</span>
26834 !! wikitext/edited
26835 <span id="a">a</span><!--c1-->
26837 <!--c2--><span id="b">b</span>
26838 !! end
26840 ## T89383
26841 !! test
26842 Selser: Check for validity of DSR before using it
26843 !! options
26844 parsoid={
26845   "modes": ["selser"],
26846   "changes": [
26847     [ "#a", "before", "<meta property='mw:PageProp/displaytitle' content='foo'>" ]
26848   ]
26850 !! wikitext
26851 <span id="a">a</span>
26852 !! wikitext/edited
26853 {{DISPLAYTITLE:foo}}
26854 <span id="a">a</span>
26855 !! end
26857 !! test
26858 1. DOMDiff: Changes to <ref> content should be looked up using id
26859 !! options
26860 parsoid={
26861   "modes": ["selser"],
26862   "changes": [
26863     ["#X", "after", "bar"],
26864     ["#Y", "after", "baz"]
26865   ]
26867 !! wikitext
26868 X <ref><span id="X">foo</span></ref>
26869 Y <ref name="a" />
26870 <references>
26871 <ref name="a"><span id="Y">foo</span></ref>
26872 </references>
26873 !! wikitext/edited
26874 X <ref><span id="X">foo</span>bar</ref>
26875 Y <ref name="a" />
26876 <references>
26877 <ref name="a"><span id="Y">foo</span>baz</ref>
26878 </references>
26879 !! end
26881 !! test
26882 2. DOMDiff: Changes to <ref> content should be looked up using id
26883 !! options
26884 parsoid={
26885   "modes": ["selser"],
26886   "changes": [
26887     ["#Z", "after", "bar"]
26888   ]
26890 !! wikitext
26891 A <ref>foo bar for a</ref>
26892 B <ref group="X" name="b" />
26894 <references />
26896 <references group="X">
26897 <ref name="b"><span id="Z">foo</span></ref>
26898 </references>
26899 !! wikitext/edited
26900 A <ref>foo bar for a</ref>
26901 B <ref group="X" name="b" />
26903 <references />
26905 <references group="X">
26906 <ref name="b"><span id="Z">foo</span>bar</ref>
26907 </references>
26908 !! end
26910 !! test
26911 Empty LI (T49673)
26912 !! wikitext
26913 * a
26916 * b
26917 !! html/php+tidy
26918 <ul>
26919 <li>a</li>
26920 <li class="mw-empty-li"></li>
26921 <li class="mw-empty-li"></li>
26922 <li>b</li>
26923 </ul>
26924 !! end