Merge "Added release notes for 'ContentHandler::runLegacyHooks' removal"
[mediawiki.git] / tests / parser / parserTests.txt
blob3853a12520e99b91b6be48dec1c0808bfb8af951
1 # MediaWiki Parser test cases
2 # Some taken from https://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, wgInterwikiMagic,
39 #  wgEnableMagicLinks
41 # For testing purposes, temporary articles can created:
42 # !!article / NAMESPACE:TITLE / !!text / ARTICLE TEXT / !!endarticle
43 # where '/' denotes a newline.
45 # This is the standard article assumed to exist.
46 !! article
47 Main Page
48 !! text
49 blah blah
50 !! endarticle
52 !!article
53 Foo
54 !!text
55 FOO
56 !!endarticle
58 !!article
59 Template:Foo
60 !!text
61 FOO
62 !!endarticle
64 !! article
65 Template:Blank
66 !! text
67 !! endarticle
69 !! article
70 Template:pipe
71 !! text
73 !! endarticle
75 !! article
76 Template:=
77 !! text
78 <nowiki>=</nowiki>
79 !! endarticle
81 !!article
82 MediaWiki:bad image list
83 !!text
84 * [[File:Bad.jpg]] except [[Nasty page]]
85 !!endarticle
87 !! article
88 Template:inner list
89 !! text
90 * item 1
91 !! endarticle
93 !! article
94 Template:tbl-start
95 !! text
97 !! endarticle
99 !! article
100 Template:tbl-end
101 !! text
103 !! endarticle
105 !! article
106 Template:echo
107 !! text
108 {{{1}}}
109 !! endarticle
111 !! article
112 Template:echo_with_span
113 !! text
114 <span>{{{1}}}</span>
115 !! endarticle
117 !! article
118 Template:echo_with_div
119 !! text
120 <div>{{{1}}}</div>
121 !! endarticle
123 !! article
124 Template:blank_param
125 !! text
126 {{{1}}}
127 {{{}}}
128 !! endarticle
130 !! article
131 Template:table_attribs
132 !! text
133 <noinclude>
134 |</noinclude>style="color:red;"|Foo
135 !! endarticle
137 !! article
138 Template:table_attribs_2
139 !! text
140 <noinclude>
141 |</noinclude>style="color:red;"|Foo
142 |Bar||Baz
143 !! endarticle
145 !! article
146 Template:table_attribs_3
147 !! text
148 <noinclude>
149 |</noinclude>style{{=}}"background:&#35;f9f9f9;"|Foo
150 !! endarticle
152 !! article
153 Template:table_attribs_4
154 !! text
155 | style="background-color:#DC241f;" width="10px" |
156 !! endarticle
158 !! article
159 Template:table_attribs_5
160 !! text
161 <noinclude>
162 |</noinclude>style="color:red;"||Bar
163 !! endarticle
165 !! article
166 Template:table_attribs_6
167 !! text
168 style="background: <nowiki>
171 red;</nowiki>" |
172 !! endarticle
174 !! article
175 Template:table_attribs_7
176 !! text
177 <noinclude>
178 |</noinclude>style{{=}}"background:&#35;f9f9f9;"|Foo<ref>foo</ref>
179 !! endarticle
181 !! article
182 Template:table_header_cells
183 !! text
184 {{table_attribs}}!!style='color:red;'|''Bar''||style='color:brown;'|''Foo'' and Baz
185 !! endarticle
187 !! article
188 Template:table_cells
189 !! text
190 {{table_attribs}}||style='color:red;'|''Bar''||style='color:brown;'|''Foo'' and Baz
191 !! endarticle
193 !! article
194 Template:PartialTable
195 !! text
198 !! endarticle
200 !! article
201 Template:image_attribs
202 !! text
203 <noinclude>
204 [[File:foobar.jpg|</noinclude>right|Caption text<noinclude>]]</noinclude>
205 !! endarticle
207 ## See T48811 for details
208 !! article
209 Template:mixed_attr_content_template
210 !! text
211 style="color:red;" title="T48811"
213 |foo
214 !! endarticle
216 !! article
217 Template:definition_list
218 !! text
220 ::two
221 !! endarticle
223 !! article
225 !! text
226 Weirdo titles!
227 !! endarticle
229 !!article
230 Template:Bullet
231 !!text
232 * Bar
233 !!endarticle
235 !!article
236 Template:OpenTable
237 !!text
239 !!endarticle
241 !!article
242 Template:EmptyLITest
243 !!text
248 !!endarticle
250 !!article
251 Template:EmptyTRTest
252 !!text
256 |foo
259 |bar
261 !!endarticle
263 !!article
264 Template:EmptyTRWithHTMLAttrTest
265 !!text
266 <table>
267 <tr align="center"></tr>
268 <tr><td>foo</td></tr>
269 <tr align="center"></tr>
270 <tr><td>bar</td></tr>
271 </table>
272 !!endarticle
274 !! article
275 Template:CircularRef
276 !! text
277 <ref>{{CircularRef}}</ref>
278 !! endarticle
281 ### Basic tests
283 !! test
284 Blank input
285 !! wikitext
286 !! html
287 !! end
289 !! test
290 CircularRef
291 !! wikitext
292 {{CircularRef}}
293 <references />
294 !! html/parsoid
295 <p><span about="#mwt1" class="mw-ref" id="cite_ref-1" rel="dc:references" typeof="mw:Transclusion  mw:Extension/ref" data-parsoid='{"pi":[[]]}' data-mw='{"parts":[{"template":{"target":{"wt":"CircularRef","href":"./Template:CircularRef"},"params":{},"i":0}}]}'><a href="./Main_Page#cite_note-1" style="counter-reset: mw-Ref 1;"><span class="mw-reflink-text">[1]</span></a></span></p>
296 <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="./Main_Page#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="{}">Error: Expansion loop detected at <a data-parsoid='{"a":{"href":null},"sa":{"href":"Template:CircularRef"}}'>Template:CircularRef</a></span></li></ol>
297 !! end
299 !! test
300 Simple paragraph
301 !! wikitext
302 This is a simple paragraph.
303 !! html
304 <p>This is a simple paragraph.
305 </p>
306 !! end
308 !! test
309 Paragraphs with extra newline spacing
310 !! wikitext
320 booz
321 !! html
322 <p>foo
323 </p><p>bar
324 </p><p><br />
326 </p><p><br />
327 </p><p>booz
328 </p>
329 !! end
331 !! test
332 Paragraphs with newline spacing with comment lines in between
333 !! wikitext
334 ----
336 <!--foo-->
338 ----
340 <!--foo--><!--More than 1 comment, still stripped-->
342 ----
344  <!--foo--> <!----> <!-- bar --> 
346 ----
348 <!--foo-->
351 ----
354 <!--foo-->
356 ----
358 <!--foo-->
362 ----
366 <!--foo-->
368 ----
369 !! html
370 <hr />
371 <p>a
373 </p>
374 <hr />
375 <p>a
377 </p>
378 <hr />
379 <p>a
381 </p>
382 <hr />
383 <p>a
384 </p><p>b
385 </p>
386 <hr />
387 <p>a
388 </p><p>b
389 </p>
390 <hr />
391 <p>a
392 </p><p><br />
394 </p>
395 <hr />
396 <p>a
397 </p><p><br />
399 </p>
400 <hr />
402 !! end
404 !! test
405 Paragraphs with newline spacing with non-empty white-space lines in between
406 !! wikitext
407 ----
411 ----
416 ----
417 !! html
418 <hr />
419 <p>a
420 </p><p>b
421 </p>
422 <hr />
423 <p>a
424 </p><p><br /> 
426 </p>
427 <hr />
429 !! end
431 !! test
432 Paragraphs with newline spacing with non-empty mixed comment and white-space lines in between
433 !! wikitext
434 ----
436  <!--foo-->
438 ----
440  <!--foo--><!--More than 1 comment doesn't disable stripping of this line!-->
442 ----
445 <!--foo-->
446  <!--bar-->
448 ----
451  <!--foo-->
452  <!--bar-->
455 ----
456 !! html
457 <hr />
458 <p>a
460 </p>
461 <hr />
462 <p>a
464 </p>
465 <hr />
466 <p>a
467 </p><p>b
468 </p>
469 <hr />
470 <p>a
471 </p><p><br /> 
473 </p>
474 <hr />
476 !! end
478 !! test
479 Extra newlines: More paragraphs with indented comment
480 !! wikitext
483    <!--boo-->
486 !! html
487 <p>a
488 </p><p><br />
490 </p>
491 !!end
493 !! test
494 Extra newlines followed by heading
495 !! wikitext
501 [[a]]
505 !! html
506 <p>a
507 </p><p><br />
508 </p>
509 <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>
510 <p><a href="/index.php?title=A&amp;action=edit&amp;redlink=1" class="new" title="A (page does not exist)">a</a>
511 </p><p><br />
512 </p>
513 <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>
515 !! end
517 !! test
518 Extra newlines between heading and content are swallowed
519 !! wikitext
524 [[a]]
525 !! html
526 <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>
527 <p><a href="/index.php?title=A&amp;action=edit&amp;redlink=1" class="new" title="A (page does not exist)">a</a>
528 </p>
529 !! end
531 !! test
532 Heading with line break in nowiki
533 !! options
534 parsoid=wt2html
535 !! wikitext
536 == A <nowiki>B
537 C</nowiki> ==
538 !! html
539 <h2><span class="mw-headline" id="A_B.0AC">A B
540 C</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 B&#10;C">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
542 !! html/parsoid
543 <h2 id="A_B.0AC">A <span typeof="mw:Nowiki">B
544 C</span> </h2>
545 !! end
547 !! test
548 Parsing an URL
549 !! wikitext
550 http://fr.wikipedia.org/wiki/🍺
551 <!-- EasterEgg we love beer, better be able be able to link to it -->
552 !! html
553 <p><a rel="nofollow" class="external free" href="http://fr.wikipedia.org/wiki/🍺">http://fr.wikipedia.org/wiki/🍺</a>
554 </p>
555 !! end
557 # Note that the html+tidy output removes the spaces after the <li>,
558 # which is a bug (https://sourceforge.net/p/tidy/bugs/945/, etc).
559 # This is an issue for all tests with lists.  We intentionally do
560 # *not* add html+tidy clauses for these, as we don't want to
561 # document/test the broken behavior.  (Parsoid matches the non-tidy
562 # output in these cases.)
564 !! test
565 Simple list
566 !! wikitext
567 * Item 1
568 * Item 2
569 !! html
570 <ul><li> Item 1</li>
571 <li> Item 2</li></ul>
573 !! end
575 !! test
576 Italics and bold
577 !! wikitext
578 * plain
579 * plain''italic''plain
580 * plain''italic''plain''italic''plain
581 * plain'''bold'''plain
582 * plain'''bold'''plain'''bold'''plain
583 * plain''italic''plain'''bold'''plain
584 * plain'''bold'''plain''italic''plain
585 * plain''italic'''bold-italic'''italic''plain
586 * plain'''bold''bold-italic''bold'''plain
587 * plain'''''bold-italic'''italic''plain
588 * plain'''''bold-italic''bold'''plain
589 * plain''italic'''bold-italic'''''plain
590 * plain'''bold''bold-italic'''''plain
591 * plain l'''italic''plain
592 * plain l''''bold''' plain
593 !! html
594 <ul><li> plain</li>
595 <li> plain<i>italic</i>plain</li>
596 <li> plain<i>italic</i>plain<i>italic</i>plain</li>
597 <li> plain<b>bold</b>plain</li>
598 <li> plain<b>bold</b>plain<b>bold</b>plain</li>
599 <li> plain<i>italic</i>plain<b>bold</b>plain</li>
600 <li> plain<b>bold</b>plain<i>italic</i>plain</li>
601 <li> plain<i>italic<b>bold-italic</b>italic</i>plain</li>
602 <li> plain<b>bold<i>bold-italic</i>bold</b>plain</li>
603 <li> plain<i><b>bold-italic</b>italic</i>plain</li>
604 <li> plain<b><i>bold-italic</i>bold</b>plain</li>
605 <li> plain<i>italic<b>bold-italic</b></i>plain</li>
606 <li> plain<b>bold<i>bold-italic</i></b>plain</li>
607 <li> plain l'<i>italic</i>plain</li>
608 <li> plain l'<b>bold</b> plain</li></ul>
610 !! end
612 # this example taken from the [[simple:Moon]] article (bug 47326)
613 !! test
614 Italics and possessives (1)
615 !! wikitext
616 obtained by ''[[Lunar Prospector]]'''s gamma-ray spectrometer
617 !! html
618 <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
619 </p>
620 !! end
622 # this example taken from [[en:Flaming Pie]] (bug 49926)
623 !! test
624 Italics and possessives (2)
625 !! wikitext
626 '''''Flaming Pie''''' is ... released in 1997. In ''Flaming Pie'''s liner notes
627 !! html
628 <p><i><b>Flaming Pie</b></i> is ... released in 1997. In <i>Flaming Pie'</i>s liner notes
629 </p>
630 !! end
632 # this example taken from [[en:Dictionary]] (bug 49926)
633 !! test
634 Italics and possessives (3)
635 !! wikitext
636 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''.
637 !! html
638 <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>.
639 </p>
640 !! end
644 ### 2-quote opening sequence tests
646 !! test
647 Italics and bold: 2-quote opening sequence: (2,2)
648 !! wikitext
649 ''foo''
650 !! html
651 <p><i>foo</i>
652 </p>
653 !!end
655 !! test
656 Italics and bold: 2-quote opening sequence: (2,3)
657 !! wikitext
658 ''foo'''
659 !! html/*
660 <p><i>foo'</i>
661 </p>
662 !!end
664 !! test
665 Italics and bold: 2-quote opening sequence: (2,4)
666 !! options
667 parsoid=wt2html
668 !! wikitext
669 ''foo''''
670 !! html/*
671 <p><i>foo''</i>
672 </p>
673 !!end
675 # same html as previous, but wikitext adjusted to match parsoid html2wt
676 !! test
677 Italics and bold: 2-quote opening sequence: (2,4) w/ nowiki
678 !! wikitext
679 ''foo<nowiki>''</nowiki>''
680 !! html
681 <p><i>foo''</i>
682 </p>
683 !! end
685 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
686 !! test
687 Italics and bold: 2-quote opening sequence: (2,5)
688 !! options
689 parsoid=wt2html
690 !! wikitext
691 ''foo'''''
692 !! html/php
693 <p><i>foo</i>
694 </p>
695 !! html/parsoid
696 <p><i>foo</i><b></b>
697 </p>
698 !!end
700 # same html as previous, but wikitext adjusted to match parsoid html2wt
701 !! test
702 Italics and bold: 2-quote opening sequence: (2,5+3) w/ nowiki
703 !! wikitext
704 ''foo'''''<nowiki/>'''
705 !! html/php
706 <p><i>foo</i>
707 </p>
708 !! html/parsoid
709 <p><i>foo</i><b></b>
710 </p>
711 !! end
715 ### 3-quote opening sequence tests
718 !! test
719 Italics and bold: 3-quote opening sequence: (3,2)
720 !! wikitext
721 '''foo''
722 !! html/*
723 <p>'<i>foo</i>
724 </p>
725 !!end
727 !! test
728 Italics and bold: 3-quote opening sequence: (3,3)
729 !! wikitext
730 '''foo'''
731 !! html
732 <p><b>foo</b>
733 </p>
734 !!end
736 !! test
737 Italics and bold: 3-quote opening sequence: (3,4)
738 !! wikitext
739 '''foo''''
740 !! html/*
741 <p><b>foo'</b>
742 </p>
743 !!end
745 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
746 !! test
747 Italics and bold: 3-quote opening sequence: (3,5)
748 !! options
749 parsoid=wt2html
750 !! wikitext
751 '''foo'''''
752 !! html/php
753 <p><b>foo</b>
754 </p>
755 !! html/parsoid
756 <p><b>foo</b><i></i>
757 </p>
758 !!end
760 # same html as previous, but wikitext adjusted to match parsoid html2wt
761 !! test
762 Italics and bold: 3-quote opening sequence: (3,5+2) w/ nowiki
763 !! wikitext
764 '''foo'''''<nowiki/>''
765 !! html/php
766 <p><b>foo</b>
767 </p>
768 !! html/parsoid
769 <p><b>foo</b><i></i>
770 </p>
771 !! end
775 ### 4-quote opening sequence tests
778 !! test
779 Italics and bold: 4-quote opening sequence: (4,2)
780 !! options
781 parsoid=wt2html
782 !! wikitext
783 ''''foo''
784 !! html/*
785 <p>''<i>foo</i>
786 </p>
787 !!end
789 # same html as previous, but wikitext adjusted to match parsoid html2wt
790 !! test
791 Italics and bold: 4-quote opening sequence: (4,2) w/ nowiki
792 !! wikitext
793 <nowiki>''</nowiki>''foo''
794 !! html
795 <p>''<i>foo</i>
796 </p>
797 !! end
799 !! test
800 Italics and bold: 4-quote opening sequence: (4,3)
801 !! wikitext
802 ''''foo'''
803 !! html/*
804 <p>'<b>foo</b>
805 </p>
806 !!end
808 !! test
809 Italics and bold: 4-quote opening sequence: (4,4)
810 !! options
811 parsoid=wt2html
812 !! wikitext
813 ''''foo''''
814 !! html/*
815 <p>'<b>foo'</b>
816 </p>
817 !!end
819 # same html as previous, but wikitext adjusted to match parsoid html2wt
820 !! test
821 Italics and bold: 4-quote opening sequence: (4,4) w/ nowiki
822 !! wikitext
823 '<nowiki/>'''foo''''
824 !! html
825 <p>'<b>foo'</b>
826 </p>
827 !! end
829 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
830 !! test
831 Italics and bold: 4-quote opening sequence: (4,5)
832 !! options
833 parsoid=wt2html
834 !! wikitext
835 ''''foo'''''
836 !! html/php
837 <p>'<b>foo</b>
838 </p>
839 !! html/parsoid
840 <p>'<b>foo</b><i></i>
841 </p>
842 !!end
844 # same html as previous, but wikitext adjusted to match parsoid html2wt
845 !! test
846 Italics and bold: 4-quote opening sequence: (4,5+2) w/ nowiki
847 !! wikitext
848 '<nowiki/>'''foo'''''<nowiki/>''
849 !! html/php
850 <p>'<b>foo</b>
851 </p>
852 !! html/parsoid
853 <p>'<b>foo</b><i></i>
854 </p>
855 !! end
859 ### 5-quote opening sequence tests
862 !! test
863 Italics and bold: 5-quote opening sequence: (5,2)
864 !! options
865 parsoid=wt2html
866 !! wikitext
867 '''''foo''
868 !! html/*
869 <p><b><i>foo</i></b>
870 </p>
871 !!end
873 # same html as previous, but wikitext adjusted to match parsoid html2wt
874 !! test
875 Italics and bold: 5-quote opening sequence: (5,2+3)
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,3)
885 !! options
886 parsoid=wt2html
887 !! wikitext
888 '''''foo'''
889 !! html/*
890 <p><i><b>foo</b></i>
891 </p>
892 !!end
894 # same html as previous, but wikitext adjusted to match parsoid html2wt
895 !! test
896 Italics and bold: 5-quote opening sequence: (5,3+2)
897 !! wikitext
898 '''''foo'''''
899 !! html
900 <p><i><b>foo</b></i>
901 </p>
902 !! end
904 !! test
905 Italics and bold: 5-quote opening sequence: (5,4)
906 !! options
907 parsoid=wt2html
908 !! wikitext
909 '''''foo''''
910 !! html/*
911 <p><i><b>foo'</b></i>
912 </p>
913 !!end
915 !! test
916 Italics and bold: 5-quote opening sequence: (5,5)
917 !! wikitext
918 '''''foo'''''
919 !! html
920 <p><i><b>foo</b></i>
921 </p>
922 !!end
924 !! test
925 Italics and bold: 5-quote opening sequence: (5,6)
926 !! wikitext
927 '''''foo''''''
928 !! html/*
929 <p><i><b>foo'</b></i>
930 </p>
931 !! end
934 ### multiple quote sequences in a line
936 !! test
937 Italics and bold: multiple quote sequences: (2,4,2)
938 !! options
939 parsoid=wt2html
940 !! wikitext
941 ''foo''''bar''
942 !! html/*
943 <p><i>foo'<b>bar</b></i>
944 </p>
945 !!end
948 # same html as previous, but wikitext adjusted to match parsoid html2wt
949 !! test
950 Italics and bold: multiple quote sequences: (2,4,2+3) w/ nowiki
951 !! wikitext
952 ''foo'<nowiki/>'''bar'''''
953 !! html
954 <p><i>foo'<b>bar</b></i>
955 </p>
956 !! end
959 !! test
960 Italics and bold: multiple quote sequences: (2,4,3)
961 !! options
962 parsoid=wt2html
963 !! wikitext
964 ''foo''''bar'''
965 !! html/*
966 <p><i>foo'<b>bar</b></i>
967 </p>
968 !!end
971 # same html as previous, but wikitext adjusted to match parsoid html2wt
972 !! test
973 Italics and bold: multiple quote sequences: (2,4,3+2) w/ nowiki
974 !! wikitext
975 ''foo'<nowiki/>'''bar'''''
976 !! html
977 <p><i>foo'<b>bar</b></i>
978 </p>
979 !! end
982 !! test
983 Italics and bold: multiple quote sequences: (2,4,4)
984 !! options
985 parsoid=wt2html
986 !! wikitext
987 ''foo''''bar''''
988 !! html/*
989 <p><i>foo'<b>bar'</b></i>
990 </p>
991 !!end
994 # same html as previous, but wikitext adjusted to match parsoid html2wt
995 !! test
996 Italics and bold: multiple quote sequences: (2,4,4+2) w/ nowiki
997 !! wikitext
998 ''foo'<nowiki/>'''bar'<nowiki/>'''''
999 !! html
1000 <p><i>foo'<b>bar'</b></i>
1001 </p>
1002 !! end
1005 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
1006 !! test
1007 Italics and bold: multiple quote sequences: (3,4,2)
1008 !! options
1009 parsoid=wt2html
1010 !! wikitext
1011 '''foo''''bar''
1012 !! html/php
1013 <p><b>foo'</b>bar
1014 </p>
1015 !! html/parsoid
1016 <p><b>foo'</b>bar<i></i>
1017 </p>
1018 !!end
1020 # same html as previous, but wikitext adjusted to match parsoid html2wt
1021 !! test
1022 Italics and bold: multiple quote sequences: (3,4,2+2) w/ nowiki
1023 !! options
1024 parsoid
1025 !! wikitext
1026 '''<nowiki>foo'</nowiki>'''bar''<nowiki/>''
1027 !! html/php
1028 <p><b>foo'</b>bar
1029 </p>
1030 !! html/parsoid
1031 <p><b><span typeof="mw:Nowiki">foo'</span></b>bar<i></i>
1032 </p>
1033 !! end
1036 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
1037 !! test
1038 Italics and bold: multiple quote sequences: (3,4,3)
1039 !! options
1040 parsoid=wt2html
1041 !! wikitext
1042 '''foo''''bar'''
1043 !! html/php
1044 <p><b>foo'</b>bar
1045 </p>
1046 !! html/parsoid
1047 <p><b>foo'</b>bar<b></b>
1048 </p>
1049 !!end
1051 # same html as previous, but wikitext adjusted to match parsoid html2wt
1052 !! test
1053 Italics and bold: multiple quote sequences: (3,4,3+3) w/ nowiki
1054 !! wikitext
1055 '''<nowiki>foo'</nowiki>'''bar'''<nowiki/>'''
1056 !! html/php
1057 <p><b>foo'</b>bar
1058 </p>
1059 !! html/parsoid
1060 <p><b><span typeof="mw:Nowiki">foo'</span></b>bar<b></b>
1061 </p>
1062 !! end
1065 ### other quote tests
1067 !! test
1068 Italics and bold: other quote tests: (2,3,5)
1069 !! wikitext
1070 ''this is about '''foo's family'''''
1071 !! html
1072 <p><i>this is about <b>foo's family</b></i>
1073 </p>
1074 !!end
1077 !! test
1078 Italics and bold: other quote tests: (2,(3,3),2)
1079 !! wikitext
1080 ''this is about '''foo's''' family''
1081 !! html
1082 <p><i>this is about <b>foo's</b> family</i>
1083 </p>
1084 !!end
1087 !! test
1088 Italics and bold: other quote tests: (3,2,3,2)
1089 !! options
1090 parsoid=wt2html
1091 !! wikitext
1092 '''this is about ''foo'''s family''
1093 !! html/*
1094 <p><b>this is about <i>foo</i></b><i>s family</i>
1095 </p>
1096 !!end
1099 # same html as previous, but wikitext adjusted to match parsoid html2wt
1100 !! test
1101 Italics and bold: other quote tests: (3,2,3+2+2,2)
1102 !! wikitext
1103 '''this is about ''foo'''''<nowiki/>''s family''
1104 !! html
1105 <p><b>this is about <i>foo</i></b><i>s family</i>
1106 </p>
1107 !! end
1110 !! test
1111 Italics and bold: other quote tests: (3,2,3,3)
1112 !! wikitext
1113 '''this is about ''foo'''s family'''
1114 !! html/*
1115 <p>'<i>this is about </i>foo<b>s family</b>
1116 </p>
1117 !!end
1120 !! test
1121 Italics and bold: other quote tests: (3,(2,2),3)
1122 !! wikitext
1123 '''this is about ''foo's'' family'''
1124 !! html
1125 <p><b>this is about <i>foo's</i> family</b>
1126 </p>
1127 !!end
1130 !! test
1131 Italicized possessive
1132 !! wikitext
1133 The ''[[Main Page]]'''s talk page.
1134 !! html/php
1135 <p>The <i><a href="/wiki/Main_Page" title="Main Page">Main Page</a>'</i>s talk page.
1136 </p>
1137 !! html/parsoid
1138 <p>The <i><a rel="mw:WikiLink"  href="Main_Page" title="Main Page">Main Page</a>'</i>s talk page.</p>
1139 !! end
1141 !! test
1142 Parsoid only: Quote balancing context should be restricted to td/th cells on the same wikitext line
1143 (Requires tidy for PHP parser output to be fixed up)
1144 !! options
1145 parsoid=wt2html,wt2wt
1146 !! wikitext
1148 !''a!!''b
1149 |''a||''b
1151 !! html/php+tidy
1152 <table>
1153 <tr>
1154 <th><i>a</i></th>
1155 <th><i>b</i></th>
1156 <td><i>a</i></td>
1157 <td><i>b</i></td>
1158 </tr>
1159 </table>
1160 !! html/parsoid
1161 <table>
1162 <tbody><tr><th><i>a</i></th><th><i>b</i></th>
1163 <td><i>a</i></td><td><i>b</i></td></tr>
1164 </tbody></table>
1165 !! end
1168 ### Non-html5 tags
1171 !! test
1172 Non-html5 tags should be accepted
1173 !! wikitext
1174 <center>''foo''</center>
1175 <big>''foo''</big>
1176 <font>''foo''</font>
1177 <strike>''foo''</strike>
1178 <tt>''foo''</tt>
1179 !! html
1180 <center><i>foo</i></center>
1181 <p><big><i>foo</i></big>
1182 <font><i>foo</i></font>
1183 <strike><i>foo</i></strike>
1184 <tt><i>foo</i></tt>
1185 </p>
1186 !! end
1188 !! test
1189 <wbr> is valid wikitext (bug 52468)
1190 !! wikitext
1191 <wbr>
1192 !! html
1193 <p><wbr />
1194 </p>
1195 !! end
1197 # <strike> is HTML4, <s> is HTML4/5.
1198 !! test
1199 <s> or <strike> for strikethrough
1200 !! wikitext
1201 <strike>strike</strike>
1203 <s>s</s>
1204 !! html
1205 <p><strike>strike</strike>
1206 </p><p><s>s</s>
1207 </p>
1208 !! end
1210 ## a not permitted
1211 ## i,b,br omitted
1212 !! test
1213 Text-level semantic html elements in wikitext
1214 !! wikitext
1215 <em>text</em>
1216 <strong>text</strong>
1217 <small>text</small>
1218 <s>text</s>
1219 <cite>text</cite>
1220 <q>text</q>
1221 <dfn>text</dfn>
1222 <abbr>text</abbr>
1223 <data>text</data>
1224 <time>text</time>
1225 <code>text</code>
1226 <var>text</var>
1227 <samp>text</samp>
1228 <kbd>text</kbd>
1229 <sub>text</sub>
1230 <u>text</u>
1231 <mark>text</mark>
1232 <ruby><rb>明日</rb><rp>(</rp><rt>Ashita</rt><rp> </rp><rtc>あした</rtc><rp>)</rp></ruby>
1233 <bdi>text</bdi>
1234 <bdo>text</bdo>
1235 <span>text</span>
1236 <wbr />
1237 !! html
1238 <p><em>text</em>
1239 <strong>text</strong>
1240 <small>text</small>
1241 <s>text</s>
1242 <cite>text</cite>
1243 <q>text</q>
1244 <dfn>text</dfn>
1245 <abbr>text</abbr>
1246 <data>text</data>
1247 <time>text</time>
1248 <code>text</code>
1249 <var>text</var>
1250 <samp>text</samp>
1251 <kbd>text</kbd>
1252 <sub>text</sub>
1253 <u>text</u>
1254 <mark>text</mark>
1255 <ruby><rb>明日</rb><rp>(</rp><rt>Ashita</rt><rp> </rp><rtc>あした</rtc><rp>)</rp></ruby>
1256 <bdi>text</bdi>
1257 <bdo>text</bdo>
1258 <span>text</span>
1259 <wbr />
1260 </p>
1261 !! end
1263 # test cases taken from
1264 # https://www.w3.org/TR/html5/text-level-semantics.html#the-ruby-element
1265 !! test
1266 Ruby markup (W3C-style)
1267 !! wikitext
1268 ; Mono-ruby for individual base characters
1269 : <ruby>日<rt>に</rt>本<rt>ほん</rt>語<rt>ご</rt></ruby>
1270 ; Group ruby
1271 : <ruby>今日<rt>きょう</rt></ruby>
1272 ; Jukugo ruby
1273 : <ruby>法<rb>華</rb><rb>経</rb><rt>ほ</rt><rt>け</rt><rt>きょう</rt></ruby>
1274 ; Inline ruby
1275 : <ruby>東<rb>京</rb><rp>(</rp><rt>とう</rt><rt>きょう</rt><rp>)</rp></ruby>
1276 ; Double-sided ruby
1277 : <ruby><rb>旧</rb><rb>金</rb><rb>山</rb><rt>jiù</rt><rt>jīn</rt><rt>shān</rt><rtc>San Francisco</rtc></ruby>
1278 <ruby>
1279 <rb>♥</rb><rtc><rt>Heart</rt></rtc><rtc lang="fr"><rt>Cœur</rt></rtc>
1280 <rb>☘</rb><rtc><rt>Shamrock</rt></rtc><rtc lang="fr"><rt>Trèfle</rt></rtc>
1281 <rb>✶</rb><rtc><rt>Star</rt></rtc><rtc lang="fr"><rt>Étoile</rt></rtc>
1282 </ruby>
1283 !! html
1284 <dl><dt> Mono-ruby for individual base characters</dt>
1285 <dd> <ruby>日<rt>に</rt>本<rt>ほん</rt>語<rt>ご</rt></ruby></dd>
1286 <dt> Group ruby</dt>
1287 <dd> <ruby>今日<rt>きょう</rt></ruby></dd>
1288 <dt> Jukugo ruby</dt>
1289 <dd> <ruby>法<rb>華</rb><rb>経</rb><rt>ほ</rt><rt>け</rt><rt>きょう</rt></ruby></dd>
1290 <dt> Inline ruby</dt>
1291 <dd> <ruby>東<rb>京</rb><rp>(</rp><rt>とう</rt><rt>きょう</rt><rp>)</rp></ruby></dd>
1292 <dt> Double-sided ruby</dt>
1293 <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>
1294 <p><ruby>
1295 <rb>♥</rb><rtc><rt>Heart</rt></rtc><rtc lang="fr"><rt>Cœur</rt></rtc>
1296 <rb>☘</rb><rtc><rt>Shamrock</rt></rtc><rtc lang="fr"><rt>Trèfle</rt></rtc>
1297 <rb>✶</rb><rtc><rt>Star</rt></rtc><rtc lang="fr"><rt>Étoile</rt></rtc>
1298 </ruby>
1299 </p>
1300 !! end
1302 # The next two test different paths in the sanitizer.
1303 !! test
1304 Non-word characters don't terminate tag names (bug 17663, 40670, 52022)
1305 !! wikitext
1306 <blockquote|>a</blockquote>
1308 <b→> doesn't terminate </b→>
1310 <bä> doesn't terminate </bä>
1312 <boo> doesn't terminate </boo>
1314 <s.foo> doesn't terminate </s.foo>
1316 <sub-ID#1>
1317 !! html
1318 <p>&lt;blockquote|&gt;a&lt;/blockquote&gt;
1319 </p><p>&lt;b→&gt; doesn't terminate &lt;/b→&gt;
1320 </p><p>&lt;bä&gt; doesn't terminate &lt;/bä&gt;
1321 </p><p>&lt;boo&gt; doesn't terminate &lt;/boo&gt;
1322 </p><p>&lt;s.foo&gt; doesn't terminate &lt;/s.foo&gt;
1323 </p><p>&lt;sub-ID#1&gt;
1324 </p>
1325 !! end
1327 # There is a tidy bug here: https://sourceforge.net/p/tidy/bugs/946/
1328 # If the non-word-character tag made it through the sanitizer, tidy
1329 # would munge it up.
1330 !! test
1331 Non-word characters don't terminate tag names + tidy
1332 !! wikitext
1333 <blockquote|>a</blockquote>
1335 <b→> doesn't terminate </b→>
1337 <bä> doesn't terminate </bä>
1339 <boo> doesn't terminate </boo>
1341 <s.foo> doesn't terminate </s.foo>
1343 <sub-ID#1>
1344 !! html+tidy
1345 <p>&lt;blockquote|&gt;a</p>
1346 <p>&lt;b→&gt; doesn't terminate &lt;/b→&gt;</p>
1347 <p>&lt;bä&gt; doesn't terminate &lt;/bä&gt;</p>
1348 <p>&lt;boo&gt; doesn't terminate &lt;/boo&gt;</p>
1349 <p>&lt;s.foo&gt; doesn't terminate &lt;/s.foo&gt;</p>
1350 <p>&lt;sub-ID#1&gt;</p>
1351 !! end
1354 ### See tests/parser/parserTestsParserHook.php for the <tåg> extension)
1355 ### This checks that HTML5 tags (with non-word characters in the tag
1356 ### name) make it safely through the parser -- the Sanitizer will
1357 ### munge them later, as it should.
1359 !! test
1360 Non-word characters are valid in extension tags (T19663)
1361 !! wikitext
1362 <tåg>tåg</tåg>
1363 !! html/php
1364 <pre>
1365 'tåg'
1366 array (
1368 </pre>
1370 !! html/parsoid
1371 <pre typeof="mw:Extension/tåg" data-mw='{"name":"tåg","attrs":{},"body":{"extsrc":"tåg"}}' data-parsoid='{}' about="#mwt2"></pre>
1372 !! end
1374 !! test
1375 Isolated close tags should be treated as literal text (bug 52760)
1376 !! options
1377 parsoid=wt2html
1378 !! wikitext
1379 </b>
1381 <s.foo>s</s>
1382 !! html/php+tidy
1383 <p>&lt;s.foo&gt;s</p>
1384 !! html/parsoid
1385 <p>&lt;s.foo&gt;s</p>
1386 !! end
1389 ### Special characters
1392 !! test
1393 Bare pipe character (bug 52363)
1394 !! wikitext
1396 !! html
1397 <p>|
1398 </p>
1399 !! end
1401 !! test
1402 Bare pipe character from a template (bug 52363)
1403 !! wikitext
1404 {{pipe}}
1405 !! html
1406 <p>|
1407 </p>
1408 !! end
1411 ### <nowiki> test cases
1414 !! test
1415 <nowiki> unordered list
1416 !! wikitext
1417 <nowiki>* This is not an unordered list item.</nowiki>
1418 !! html/php
1419 <p>* This is not an unordered list item.
1420 </p>
1421 !! html/parsoid
1422 <p><span typeof="mw:Nowiki">* This is not an unordered list item.</span></p>
1423 !! end
1425 !! test
1426 <nowiki> spacing
1427 !! wikitext
1428 <nowiki>Lorem ipsum dolor
1430 sed abit.
1431   sed nullum.
1433 :and a colon
1434 </nowiki>
1435 !! html/php
1436 <p>Lorem ipsum dolor
1438 sed abit.
1439   sed nullum.
1441 :and a colon
1443 </p>
1444 !! html/parsoid
1445 <p><span typeof="mw:Nowiki">Lorem ipsum dolor
1447 sed abit.
1448   sed nullum.
1450 :and a colon
1451 </span></p>
1452 !! end
1454 !! test
1455 Don't parse <nowiki><span class="error"></nowiki> (T149622)
1456 !! wikitext
1457 <nowiki><span class="error"></nowiki>
1458 !! html/php
1459 <p>&lt;span class="error"&gt;
1460 </p>
1461 !! html/parsoid
1462 <p><span typeof="mw:Nowiki">&lt;span class="error"></span></p>
1463 !! end
1465 !! test
1466 nowiki 3
1467 !! wikitext
1468 :There is not nowiki.
1469 :There is <nowiki>nowiki</nowiki>.
1471 #There is not nowiki.
1472 #There is <nowiki>nowiki</nowiki>.
1474 *There is not nowiki.
1475 *There is <nowiki>nowiki</nowiki>.
1476 !! html/php
1477 <dl><dd>There is not nowiki.</dd>
1478 <dd>There is nowiki.</dd></dl>
1479 <ol><li>There is not nowiki.</li>
1480 <li>There is nowiki.</li></ol>
1481 <ul><li>There is not nowiki.</li>
1482 <li>There is nowiki.</li></ul>
1484 !! html/parsoid
1485 <dl><dd data-parsoid='{}'>There is not nowiki.</dd>
1486 <dd data-parsoid='{}'>There is <span typeof="mw:Nowiki">nowiki</span>.</dd></dl>
1488 <ol><li data-parsoid='{}'>There is not nowiki.</li>
1489 <li data-parsoid='{}'>There is <span typeof="mw:Nowiki">nowiki</span>.</li></ol>
1491 <ul><li data-parsoid='{}'>There is not nowiki.</li>
1492 <li data-parsoid='{}'>There is <span typeof="mw:Nowiki">nowiki</span>.</li></ul>
1493 !! end
1495 !! test
1496 Entities inside <nowiki>
1497 !! wikitext
1498 <nowiki>&lt;</nowiki>
1499 !! html
1500 <p>&lt;
1501 </p>
1502 !! end
1504 !! test
1505 Entities inside template parameters
1506 !! wikitext
1507 {{echo|&ndash;}}
1508 !! html/php+tidy
1509 <p>–</p>
1510 !! html/parsoid
1511 <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>
1512 !! end
1514 !! test
1515 Properly escape nowiki when combined with other wiki markup
1516 !! options
1517 parsoid=html2wt
1518 !! html/parsoid
1519 <p>* &lt;/nowiki&gt; tag</p>
1520 !! wikitext
1521 <nowiki>*</nowiki> <nowiki>&lt;/nowiki&gt;</nowiki> tag
1522 !! end
1524 !! test
1525 T93824: Put escaped HTML tags inside nowiki
1526 !! options
1527 parsoid=html2wt
1528 !! html/parsoid
1529 <p>&lt;h2&gt;foo&lt;/h2&gt;</p>
1530 !! wikitext
1531 <nowiki><h2>foo</h2></nowiki>
1532 !! end
1534 !! test
1535 T71950: 1. Put nowiki as close to cause as possible, even with non-quote escapable chars
1536 !! options
1537 parsoid=html2wt
1538 !! html/parsoid
1539 <p>This text: L'<a rel="mw:WikiLink" href="./Foo">Foo</a>
1540 This text: L''<a rel="mw:WikiLink" href="./Foo">Foo</a>
1541 This text: L'''<a rel="mw:WikiLink" href="./Foo">Foo</a>''</p>
1542 !! wikitext
1543 This text: L'[[Foo]]
1544 This text: L<nowiki>''</nowiki>[[Foo]]
1545 This text: L<nowiki>'''</nowiki>[[Foo]]<nowiki>''</nowiki>
1546 !! end
1548 # This test fails because wikitext whitespace is not normalized before comparing.
1549 !! test
1550 T71950: 2. Put nowiki as close to cause as possible, after ' :'
1551 !! options
1552 parsoid=html2wt
1553 !! html/parsoid
1554 <p>This text : L''<a rel="mw:WikiLink" href="./Foo">Foo</a>
1555 </p>
1556 !! wikitext
1557 This text : L<nowiki>''</nowiki>[[Foo]]
1558 !! end
1560 # This test and the next one are html2wt only as they test that incorrect wikitext
1561 # passed in template arguments gets escaped or wrapped in nowikis where required.
1562 !! test
1563 T71482: Use {{!}} instead of nowiki for single pipe in template argument
1564 !! options
1565 parsoid=html2wt
1566 !! html/parsoid
1567 <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>
1568 <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>
1569 !! wikitext
1570 {{echo|foo{{!}}bar}}
1571 {{echo|<nowiki>foo|bar |[[</nowiki>}}
1572 !! end
1574 !! test
1575 T53961: Output correct nowikis in template arguments
1576 !! options
1577 parsoid=html2wt
1578 !! html/parsoid
1579 <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>
1580 <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>
1581 <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>
1582 <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>
1583 <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>
1584 !! wikitext
1585 {{echo|a [ b}}
1586 {{echo|<nowiki>a }} b</nowiki>}}
1587 {{echo|<nowiki>a [[ b</nowiki>}}
1588 {{echo|<nowiki>a | {{ ]]</nowiki>}}
1589 {{echo|a <nowiki>}</nowiki>}}
1590 !! end
1592 !! test
1593 Cases where "!!" needs nowiki protection
1594 !! options
1595 parsoid=html2wt
1596 !! html/parsoid
1597 <table>
1598 <tr><th>this needs protection !! here</th></tr>
1599 </table>
1601 <table>
1602 <tr><th>this does not need
1603 protection !! here</th></tr>
1604 </table>
1605 !! wikitext
1607 !<nowiki>this needs protection !! here</nowiki>
1611 !this does not need
1612 protection !! here
1614 !! end
1617 ### Comments
1619 !! test
1620 Comments and Indent-Pre
1621 !! wikitext
1622 <!-- comment 1 --> asdf
1624 <!-- comment 1 --> asdf
1625 <!-- comment 2 -->
1627 <!-- comment 1 --> asdf
1628 <!-- comment 2 -->xyz
1630 <!-- comment 1 --> asdf
1631 <!-- comment 2 --> xyz
1632 !! html
1633 <pre>asdf
1634 </pre>
1635 <pre>asdf
1636 </pre>
1637 <pre>asdf
1638 </pre>
1639 <p>xyz
1640 </p>
1641 <pre>asdf
1643 </pre>
1644 !! end
1646 !! test
1647 Comment test 2a
1648 !! wikitext
1649 asdf
1650 <!-- comment 1 -->
1652 !! html
1653 <p>asdf
1655 </p>
1656 !! end
1658 !! test
1659 Comment test 2b
1660 !! wikitext
1661 asdf
1662 <!-- comment 1 -->
1665 !! html
1666 <p>asdf
1667 </p><p>jkl
1668 </p>
1669 !! end
1671 !! test
1672 Comment test 3
1673 !! wikitext
1674 asdf
1675 <!-- comment 1 -->
1676 <!-- comment 2 -->
1678 !! html
1679 <p>asdf
1681 </p>
1682 !! end
1684 !! test
1685 Comment test 4
1686 !! wikitext
1687 asdf<!-- comment 1 -->jkl
1688 !! html
1689 <p>asdfjkl
1690 </p>
1691 !! end
1693 !! test
1694 Comment spacing
1695 !! wikitext
1697  <!-- foo --> b <!-- bar -->
1699 !! html
1700 <p>a
1701 </p>
1702 <pre> b 
1703 </pre>
1704 <p>c
1705 </p>
1706 !! end
1708 !! test
1709 Comment whitespace
1710 !! wikitext
1711 <!-- returns a single newline, not nothing, since the newline after > is not stripped -->
1712 !! html
1714 !! end
1716 !! test
1717 Comment semantics and delimiters
1718 !! wikitext
1719 <!-- --><!----><!-----><!------>
1720 !! html/php
1722 !! html/parsoid
1723 <!-- --><!----><!--&#x2D;--><!--&#x2D;&#x2D;-->
1724 !! end
1726 !! test
1727 Comment semantics and delimiters, redux
1728 !! wikitext
1729 <!-- In SGML every "foo" here would actually show up in the text -- foo -- bar
1730 -- foo -- funky huh? ... -->
1731 !! html/php
1733 !! html/parsoid
1734 <!-- In SGML every "foo" here would actually show up in the text &#x2D;&#x2D; foo &#x2D;&#x2D; bar
1735 &#x2D;&#x2D; foo &#x2D;&#x2D; funky huh? ... -->
1736 !! end
1738 !! test
1739 Comment semantics and delimiters: directors cut
1740 !! wikitext
1741 <!-- ... However we like to keep things simple and somewhat XML-ish so we eat
1742 everything starting with < followed by !-- until the first -- and > we see,
1743 that wouldn't be valid XML however, since in XML -- has to terminate a comment
1744 -->-->
1745 !! html/php
1746 <p>--&gt;
1747 </p>
1748 !! html/parsoid
1749 <!-- ... However we like to keep things simple and somewhat XML&#x2D;ish so we eat
1750 everything starting with < followed by !&#x2D;&#x2D; until the first &#x2D;&#x2D; and &#x3E; we see,
1751 that wouldn't be valid XML however, since in XML &#x2D;&#x2D; has to terminate a comment
1752 --><p>--></p>
1753 !! end
1755 !! test
1756 Comment semantics: nesting
1757 !! wikitext
1758 <!--<!-- no, we're not going to do anything fancy here -->-->
1759 !! html/php
1760 <p>--&gt;
1761 </p>
1762 !! html/parsoid
1763 <!--<!&#x2D;&#x2D; no, we're not going to do anything fancy here --><p>--></p>
1764 !! end
1766 # Parsoid closes the unclosed comment, even if it means a slight
1767 # round-trip diff.
1768 !! test
1769 Comment semantics: unclosed comment at end
1770 !! options
1771 parsoid=wt2html,html2html
1772 !! wikitext
1773 <!--This comment will run out to the end of the document
1774 !! html/php
1776 !! html/parsoid
1777 <!--This comment will run out to the end of the document-->
1778 !! end
1780 !! test
1781 Comment semantics: normalize comments to play nice with XML and browsers
1782 !! wikitext
1783 <!-- Browsers --!> think this is closed -->
1784 <!--> This would normally be text -->
1785 <!---> As would this -->
1786 <!-- XML doesn't like trailing dashes -------->
1787 <!-- Nor doubled hyphens -- anywhere in the data -->
1788 But this is not a comment.
1789 !! html/php
1790 <p>But this is not a comment.
1791 </p>
1792 !! html/parsoid
1793 <!-- Browsers &#x2D;&#x2D;!&#x3E; think this is closed -->
1794 <!--&#x3E; This would normally be text -->
1795 <!--&#x2D;&#x3E; As would this -->
1796 <!-- XML doesn't like trailing dashes &#x2D;&#x2D;&#x2D;&#x2D;&#x2D;&#x2D;-->
1797 <!-- Nor doubled hyphens &#x2D;&#x2D; anywhere in the data -->
1798 <p>But this is not a comment.</p>
1799 !! end
1801 !! test
1802 Comment semantics: round-trip even text which contains encoded -->
1803 !! wikitext
1804 <!-- hello & goodbye - > --&gt; --&amp;gt; --&xx -->
1805 !! html/parsoid
1806 <!-- hello &#x26; goodbye &#x2D; &#x3E; &#x2D;&#x2D;&#x3E; &#x2D;&#x2D;&#x26;gt; &#x2D;&#x2D;&#x26;xx -->
1807 !! end
1809 !! test
1810 Comment in template title
1811 !! wikitext
1812 {{f<!---->oo}}
1813 !! html
1814 <p>FOO
1815 </p>
1816 !! end
1818 !! test
1819 Comment on its own line post-expand
1820 !! wikitext
1822 {{blank}}<!---->
1824 !! html
1825 <p>a
1826 </p><p>b
1827 </p>
1828 !! end
1830 !! test
1831 Comment on its own line post-expand with non-significant whitespace
1832 !! wikitext
1834  {{blank}} <!----> 
1836 !! html
1837 <p>a
1838 </p><p>b
1839 </p>
1840 !! end
1842 !! test
1843 Multiple comments should still parse as SOL-transparent
1844 !! options
1845 parsoid=wt2html,wt2wt
1846 !! wikitext
1847 <!--c1-->*a
1848 <!--c2--><!--c3--><!--c4-->*b
1849 !! html/php
1850 <ul><li>a</li>
1851 <li>b</li></ul>
1853 !! html/parsoid
1854 <!--c1--><ul>
1855 <li>a
1856 </li>
1857 <!--c2--><!--c3--><!--c4-->
1858 <li>b
1859 </li>
1860 </ul>
1861 !! end
1864 ### paragraph wrapping tests
1866 !! test
1867 No block tags
1868 !! wikitext
1872 !! html
1873 <p>a
1874 </p><p>b
1875 </p>
1876 !! end
1878 !! test
1879 Block tag on one line (<div>)
1880 !! wikitext
1881 a <div>foo</div>
1884 !! html
1885 a <div>foo</div>
1886 <p>b
1887 </p>
1888 !! html+tidy
1889 <p>a</p>
1890 <div>foo</div>
1891 <p>b</p>
1892 !! end
1894 !! test
1895 Block tag on one line (<blockquote>)
1896 !! wikitext
1897 a <blockquote>foo</blockquote>
1900 !! html
1901 a <blockquote>foo</blockquote>
1902 <p>b
1903 </p>
1904 !! html+tidy
1905 <p>a</p>
1906 <blockquote>
1907 <p>foo</p>
1908 </blockquote>
1909 <p>b</p>
1910 !! end
1912 !! test
1913 Block tag on both lines (<div>)
1914 !! wikitext
1915 a <div>foo</div>
1917 b <div>foo</div>
1918 !! html
1919 a <div>foo</div>
1920 b <div>foo</div>
1922 !! html+tidy
1923 <p>a</p>
1924 <div>foo</div>
1925 <p>b</p>
1926 <div>foo</div>
1927 !! end
1929 !! test
1930 Block tag on both lines (<blockquote>)
1931 !! wikitext
1932 a <blockquote>foo</blockquote>
1934 b <blockquote>foo</blockquote>
1935 !! html
1936 a <blockquote>foo</blockquote>
1937 b <blockquote>foo</blockquote>
1939 !! html+tidy
1940 <p>a</p>
1941 <blockquote>
1942 <p>foo</p>
1943 </blockquote>
1944 <p>b</p>
1945 <blockquote>
1946 <p>foo</p>
1947 </blockquote>
1948 !! end
1950 !! test
1951 Multiple lines without block tags
1952 !! wikitext
1953 <div>foo</div> a
1956 d<!--foo--> e
1957 x <div>foo</div> z
1958 !! html
1959 <div>foo</div> a
1960 <p>b
1962 d e
1963 </p>
1964 x <div>foo</div> z
1966 !! html+tidy
1967 <div>foo</div>
1968 <p>a</p>
1969 <p>b c d e</p>
1970 <p>x</p>
1971 <div>foo</div>
1972 <p>z</p>
1973 !! end
1975 # Tidy strips out the empty <div> tags. Parsoid doesn't.
1976 # So, we have a separate section for Parsoid. We don't want
1977 # to mimic this stripping behavior in Parsoid. It affects
1978 # editing experience and also requires us to maintain additional
1979 # info for RT-ing.
1980 !! test
1981 Empty lines between lines with block tags
1982 !! wikitext
1983 <div></div>
1986 <div></div>a
1989 <div>a</div>b
1991 <div>b</div>d
1994 <div>e</div>
1995 !! html
1996 <div></div>
1997 <p><br />
1998 </p>
1999 <div></div>a
2000 <p>b
2001 </p>
2002 <div>a</div>b
2003 <div>b</div>d
2004 <p><br />
2005 </p>
2006 <div>e</div>
2008 !! html+tidy
2009 <p><br /></p>
2010 <p>a</p>
2011 <p>b</p>
2012 <div>a</div>
2013 <p>b</p>
2014 <div>b</div>
2015 <p>d</p>
2016 <p><br /></p>
2017 <div>e</div>
2018 !! html/parsoid
2019 <div data-parsoid='{"stx":"html"}'></div>
2021 <p><br /></p>
2022 <div data-parsoid='{"stx":"html"}'></div><p>a</p>
2024 <p>b</p>
2025 <div data-parsoid='{"stx":"html"}'>a</div><p>b</p>
2027 <div data-parsoid='{"stx":"html"}'>b</div><p>d</p>
2029 <p><br /></p>
2030 <div data-parsoid='{"stx":"html"}'>e</div>
2031 !! end
2033 ## PHP parser emits output which is broken
2034 !! test
2035 Unclosed HTML p-tags should be handled properly
2036 !! wikitext
2037 <div><p>foo</div>
2041 !! html/php+tidy
2042 <div>
2043 <p>foo</p>
2044 </div>
2045 <p>a</p>
2046 <p>b</p>
2047 !! html/parsoid
2048 <div data-parsoid='{"stx":"html"}'><p data-parsoid='{"stx":"html", "autoInsertedEnd":true}'>foo</p></div>
2049 <p>a</p>
2050 <p>b</p>
2051 !! end
2053 ## SSS FIXME: I can come up with other scenarios where this doesn't work because
2054 ## of eager output of buffered tokens in the p-wrapper. But, I'm going to ignore
2055 ## them for now.
2056 !! test
2057 1. P-wrapping should leave sol-transparent tags outside p-tags where possible
2058 !! options
2059 parsoid=wt2html
2060 !! wikitext
2061 a [[Category:A1]] [[Category:A2]]
2062 [[Category:A3]]
2063 [[Category:A4]]
2064 !! html/parsoid
2065 <p>a</p>
2066 <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"/>
2067 !! end
2069 !! test
2070 2. P-wrapping should leave sol-transparent tags outside p-tags where possible
2071 !! options
2072 parsoid=wt2html
2073 !! wikitext
2074 [[Category:A1]]a
2075 !! html/parsoid
2076 <link rel="mw:PageProp/Category" href="./Category:A1"/><p>a</p>
2077 !! end
2080 ### Preformatted text
2082 !! test
2083 Preformatted text
2084 !! wikitext
2085  This is some
2086  Preformatted text
2087  With ''italic''
2088  And '''bold'''
2089  And a [[Main Page|link]]
2090 !! html
2091 <pre>This is some
2092 Preformatted text
2093 With <i>italic</i>
2094 And <b>bold</b>
2095 And a <a href="/wiki/Main_Page" title="Main Page">link</a>
2096 </pre>
2097 !! end
2099 !! test
2100 Tabs don't trigger preformatted text
2101 !! wikitext
2102         This is not
2103          preformatted text.
2104  This is preformatted text.
2105         So is this.
2106 !! html/php
2107 <p>     This is not
2108          preformatted text.
2109 </p>
2110 <pre>This is preformatted text.
2111         So is this.
2112 </pre>
2113 !! html/parsoid
2114 <p>     This is not
2115          preformatted text.</p>
2116 <pre>This is preformatted text.
2117         So is this.</pre>
2118 !! end
2120 !! test
2121 Space before tab needs nowiki pre protection
2122 !! options
2123 parsoid=html2wt
2124 !! html/parsoid
2125 <p>     a</p>
2126 !! wikitext
2127 <nowiki> </nowiki>      a
2128 !! end
2130 !! test
2131 Ident preformatting with inline content
2132 !! wikitext
2134  ''b''
2135 !! html
2136 <pre>a
2137 <i>b</i>
2138 </pre>
2139 !! end
2141 !! test
2142 <pre> with <nowiki> inside (compatibility with 1.6 and earlier)
2143 !! wikitext
2144 <pre><nowiki>
2146 <cite>
2147 <em>
2148 </nowiki></pre>
2149 !! html
2150 <pre>
2151 &lt;b&gt;
2152 &lt;cite&gt;
2153 &lt;em&gt;
2154 </pre>
2156 !! end
2158 !! test
2159 Regression with preformatted in <center>
2160 !! wikitext
2161 <center>
2162  Blah
2163 </center>
2164 !! html
2165 <center>
2166 <pre>Blah
2167 </pre>
2168 </center>
2170 !! end
2172 !! test
2173 Bug 52763: Preformatted in <blockquote>
2174 !! wikitext
2175 <blockquote>
2176  Blah
2179  indented cell (no pre-wrapping!)
2181 </blockquote>
2182 !! html
2183 <blockquote>
2184 <p> Blah
2185 </p>
2186 <table>
2187 <tr>
2188 <td>
2189 <p> indented cell (no pre-wrapping!)
2190 </p>
2191 </td></tr></table>
2192 </blockquote>
2194 !! end
2196 !! test
2197 Bug 51086: Double newlines in blockquotes should be turned into paragraphs
2198 !! wikitext
2199 <blockquote>
2203 </blockquote>
2204 !! html
2205 <blockquote>
2206 <p>Foo
2207 </p><p>Bar
2208 </p>
2209 </blockquote>
2211 !! end
2213 !! test
2214 Bug 15491: <ins>/<del> in blockquote
2215 !! wikitext
2216 <blockquote>
2217 Foo <del>bar</del> <ins>baz</ins> quux
2218 </blockquote>
2219 !! html
2220 <blockquote>
2221 <p>Foo <del>bar</del> <ins>baz</ins> quux
2222 </p>
2223 </blockquote>
2225 !! end
2227 # Note that the p-wrapping is newline sensitive, which could be
2228 # considered a bug: tidy will wrap only the 'Foo' in the example
2229 # below in a <p> tag. (see comment 23-25 of bug #6200)
2230 !! test
2231 Bug 15491: <ins>/<del> in blockquote (2)
2232 !! wikitext
2233 <blockquote>Foo <del>bar</del> <ins>baz</ins> quux
2234 </blockquote>
2235 !! html
2236 <blockquote>Foo <del>bar</del> <ins>baz</ins> quux
2237 </blockquote>
2239 !! html+tidy
2240 <blockquote>
2241 <p>Foo</p>
2242 <del>bar</del> <ins>baz</ins> quux</blockquote>
2243 !! end
2245 !! test
2246 <pre> with attributes (bug 3202)
2247 !! wikitext
2248 <pre style="background: blue; color:white">Bluescreen of WikiDeath</pre>
2249 !! html
2250 <pre style="background: blue; color:white">Bluescreen of WikiDeath</pre>
2252 !! end
2254 !! test
2255 <pre> with width attribute (bug 3202)
2256 !! wikitext
2257 <pre width="8">Narrow screen goodies</pre>
2258 !! html
2259 <pre width="8">Narrow screen goodies</pre>
2261 !! end
2263 !! test
2264 <pre> with forbidden attribute (bug 3202)
2265 !! wikitext
2266 <pre width="8" onmouseover="alert(document.cookie)">Narrow screen goodies</pre>
2267 !! html
2268 <pre width="8">Narrow screen goodies</pre>
2270 !! end
2272 !! test
2273 Entities inside <pre>
2274 !! wikitext
2275 <pre>&lt;</pre>
2276 !! html
2277 <pre>&lt;</pre>
2279 !! end
2281 !! test
2282 <pre> with forbidden attribute values (bug 3202)
2283 !! wikitext
2284 <pre width="8" style="border-width: expression(alert(document.cookie))">Narrow screen goodies</pre>
2285 !! html
2286 <pre width="8" style="/* insecure input */">Narrow screen goodies</pre>
2288 !! end
2290 !! test
2291 <nowiki> inside <pre> (bug 13238)
2292 !! wikitext
2293 <pre>
2294 <nowiki>
2295 </pre>
2296 <pre>
2297 <nowiki></nowiki>
2298 </pre>
2299 <pre><nowiki><nowiki></nowiki>Foo<nowiki></nowiki></nowiki></pre>
2300 !! html
2301 <pre>
2302 &lt;nowiki&gt;
2303 </pre>
2304 <pre>
2306 </pre>
2307 <pre>&lt;nowiki&gt;Foo&lt;/nowiki&gt;</pre>
2309 !! end
2311 !! test
2312 <nowiki> inside of #tag:pre
2313 !! wikitext
2314 {{#tag:pre|Foo <nowiki>&rarr;bar</nowiki>}}
2315 !! html/php
2316 <pre>Foo &#8594;bar</pre>
2318 !! html/parsoid
2319 <pre about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"pi":[[{"k":"1"}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"#tag:pre","function":"#tag"},"params":{"1":{"wt":"Foo &lt;nowiki>&amp;rarr;bar&lt;/nowiki>"}},"i":0}}]}'>Foo <span typeof="mw:Entity">→</span>bar</pre>
2320 !! end
2322 !! test
2323 <nowiki> and <pre> preference (first one wins)
2324 !! wikitext
2325 <pre>
2326 <nowiki>
2327 </pre>
2328 </nowiki>
2329 </pre>
2331 <nowiki>
2332 <pre>
2333 <nowiki>
2334 </pre>
2335 </nowiki>
2336 </pre>
2338 !! html/php
2339 <pre>
2340 &lt;nowiki&gt;
2341 </pre>
2342 <p>&lt;/nowiki&gt;
2343 &lt;/pre&gt;
2344 </p><p>
2345 &lt;pre&gt;
2346 &lt;nowiki&gt;
2347 &lt;/pre&gt;
2349 &lt;/pre&gt;
2350 </p>
2351 !! html/parsoid
2352 <pre data-parsoid='{"stx":"html","strippedNL":true}'>&lt;nowiki>
2353 </pre>
2354 <p><span typeof="mw:Placeholder" data-parsoid='{"src":"&lt;/nowiki>"}'>&lt;/nowiki></span>
2355 &lt;/pre></p>
2357 <p><span typeof="mw:Nowiki">
2358 &lt;pre>
2359 &lt;nowiki>
2360 &lt;/pre>
2361 </span>
2362 &lt;/pre></p>
2363 !! end
2365 !! test
2366 </pre> inside nowiki
2367 !! wikitext
2368 <nowiki></pre></nowiki>
2369 !! html
2370 <p>&lt;/pre&gt;
2371 </p>
2372 !! end
2374 # Parsoid doesn't strip empty tags, like Tidy does.
2375 !! test
2376 Empty pre; pre inside other HTML tags (bug 54946)
2377 !! options
2378 parsoid=wt2html,wt2wt
2379 !! wikitext
2382 <div><pre>
2384 </pre></div>
2385 <pre></pre>
2386 !! html/php
2387 <p>a
2388 </p>
2389 <div><pre>
2391 </pre></div>
2392 <pre></pre>
2394 !! html/php+tidy
2395 <p>a</p>
2396 <div>
2397 <pre>
2399 </pre></div>
2400 !! html/parsoid
2401 <p>a</p>
2403 <div><pre>foo
2404 </pre></div>
2405 <pre></pre>
2406 !! end
2408 !! test
2409 HTML pre followed by indent-pre
2410 !! wikitext
2411 <pre>foo</pre>
2412  bar
2413 !! html
2414 <pre>foo</pre>
2415 <pre>bar
2416 </pre>
2417 !! end
2419 # Note that tidy removes the empty <p> tags from the start and end.
2420 # Parsoid does not, by design.
2421 !!test
2422 Block tag pre
2423 !! wikitext
2424 <p><pre>foo</pre></p>
2425 !! html/php+tidy
2426 <pre>
2428 </pre>
2429 !! html/parsoid
2430 <p data-parsoid='{"stx":"html","autoInsertedEnd":true}'></p><pre data-parsoid='{"stx":"html"}'>foo</pre><p data-parsoid='{"autoInsertedStart":true,"stx":"html"}'></p>
2431 !!end
2433 !!test
2434 Templates: Indent-Pre: 1a. Templates that break a line should suppress <pre>
2435 !! wikitext
2436  {{echo|}}
2437 !! html
2439 !!end
2441 !!test
2442 Templates: Indent-Pre: 1b. Templates that break a line should suppress <pre>
2443 !! wikitext
2444  {{echo|
2445 foo}}
2446 !! html
2447 <p>foo
2448 </p>
2449 !!end
2451 !! test
2452 Templates: Indent-Pre: 1c: Wrapping should be based on expanded content
2453 !! wikitext
2454  {{echo|a
2456 !! html
2457 <pre>a
2458 </pre>
2459 <p>b
2460 </p>
2461 !!end
2463 !! test
2464 Templates: Indent-Pre: 1d: Wrapping should be based on expanded content
2465 !! wikitext
2466  {{echo|a
2472 !! html
2473 <pre>a
2474 </pre>
2475 <p>b
2477 </p>
2478 <pre>d
2479 </pre>
2480 <p>e
2481 </p>
2482 !!end
2484 !!test
2485 Templates: Indent-Pre: 1e. Wrapping should be based on expanded content
2486 !! wikitext
2487 {{echo| foo}}
2489 {{echo| foo}}{{echo| bar}}
2491 {{echo| foo}}
2492 {{echo| bar}}
2494 {{echo|<!--cmt--> foo}}
2496 <!--cmt-->{{echo| foo}}
2498 {{echo|{{echo| }}bar}}
2499 !! html
2500 <pre>foo
2501 </pre>
2502 <pre>foo bar
2503 </pre>
2504 <pre>foo
2506 </pre>
2507 <pre>foo
2508 </pre>
2509 <pre>foo
2510 </pre>
2511 <pre>bar
2512 </pre>
2513 !!end
2515 !! test
2516 Templates: Indent-Pre: 1f: Wrapping should be based on expanded content
2517 !! wikitext
2518 {{echo| }}a
2520 {{echo|
2521  }}a
2523 {{echo|
2524  b}}
2526 {{echo|a
2527  }}b
2529 {{echo|a
2530 }} b
2531 !! html
2532 <pre>a
2533 </pre>
2534 <p><br />
2535 </p>
2536 <pre>a
2537 </pre>
2538 <p><br />
2539 </p>
2540 <pre>b
2541 </pre>
2542 <p>a
2543 </p>
2544 <pre>b
2545 </pre>
2546 <p>a
2547 </p>
2548 <pre>b
2549 </pre>
2550 !!end
2552 !! test
2553 Pres with newline attributes
2554 !! wikitext
2555 <pre class="one
2556 two">hi</pre>
2557 !! html/php
2558 <pre class="one two">hi</pre>
2560 !! html/parsoid
2561 <pre class="one
2562 two" data-parsoid='{"stx":"html"}'>hi</pre>
2563 !! end
2565 !! test
2566 Things that look like <pre> tags aren't treated as such
2567 !! wikitext
2568 Barack Obama <President> of the United States
2569 <President></President>
2570 !! html
2571 <p>Barack Obama &lt;President&gt; of the United States
2572 &lt;President&gt;&lt;/President&gt;
2573 </p>
2574 !! end
2576 !! test
2577 Handle broken pre-like tags (bug 64025)
2578 !! options
2579 parsoid=wt2html
2580 !! wikitext
2581 {{echo|<pre <pre>x</pre>}}
2583 <table><pre </table>
2584 !! html/php
2585 <pre>x</pre>
2586 <table>&lt;pre </table>
2588 !! html/php+tidy
2589 <pre>
2591 </pre>
2592 <p>&lt;pre</p>
2593 !! html/parsoid
2594 <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>
2597 <p>&lt;pre </p>
2599 <table></table>
2600 !! end
2602 !! test
2603 Parsoid: handle pre with space after attribute
2604 !! options
2605 parsoid=wt2html
2606 !! wikitext
2607 <pre style="width:50%;" >{{echo|foo}}</pre>
2608 !! html/php
2609 <pre style="width:50%;">{{echo|foo}}</pre>
2611 !! html/parsoid
2612 <pre style="width:50%;">{{echo|foo}}</pre>
2613 !! end
2615 # TODO / maybe: fix wt2wt for this
2616 !! test
2617 Parsoid: Don't paragraph-wrap fosterable content
2618 !! options
2619 parsoid=wt2html
2620 !! wikitext
2622 <td></td>
2623 <td></td>
2628 !! html
2629 <table>
2631 <tbody>
2632 <tr>
2633 <td></td>
2635 <td></td></tr>
2639 </tbody></table>
2640 !! end
2642 !! test
2643 Parsoid: Don't paragraph-wrap fosterable content even if table syntax is unbalanced
2644 !! options
2645 parsoid=wt2html
2646 !! wikitext
2648 <td>
2649 <td>
2650 </td>
2655 !! html
2656 <table>
2658 <tbody>
2659 <tr>
2660 <td></td>
2662 <td>
2663 </td></tr>
2667 </tbody></table>
2668 !! end
2671 #--------------------------------------------------------------------
2672 # Transclusion parameter whitespace stripping tests
2673 # Behavior is different for positional and named parameters
2674 #--------------------------------------------------------------------
2675 !! test
2676 Templates: Strip leading and trailing whitespace from named-param values
2677 !! wikitext
2678 {{echo|1= a }}
2680 {{echo|1= {{echo|b}} }}
2682 {{echo| 1 =
2683  c }}
2685 {{echo| 1 =
2686 * d
2688 !! html
2689 <p>a
2690 </p><p>b
2691 </p><p>c
2692 </p>
2693 <ul><li> d</li></ul>
2695 !! end
2697 !! test
2698 Templates: Don't strip whitespace from positional-param values
2699 !! wikitext
2700 {{echo|a }}
2702 {{echo|{{echo|b}} }}
2704 {{echo| c 
2707 {{echo| {{echo|d}}
2710 {{echo|
2711  e}}
2713 {{echo|
2714 * f}}
2716 {{echo|
2717  }}g
2718 !! html
2719 <p>a 
2720 </p><p>b 
2721 </p>
2722 <pre>c 
2723 </pre>
2724 <p><br />
2725 </p>
2726 <pre>d
2727 </pre>
2728 <p><br />
2729 </p>
2730 <pre>e
2731 </pre>
2732 <p><br />
2733 </p>
2734 <ul><li> f</li></ul>
2735 <p><br />
2736 </p>
2737 <pre>g
2738 </pre>
2739 !! end
2741 !! test
2742 Templates: Handle empty comment-and-ws-only lines correctly
2743 !! wikitext
2744 {{echo|foo
2745 <!--should be ignored-->
2746  <!--should be ignored as well-->
2747 bar}}
2748 !! html/php
2749 <p>foo
2751 </p>
2752 !! html/parsoid
2753 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo\n&lt;!--should be ignored-->\n &lt;!--should be ignored as well-->\nbar"}},"i":0}}]}'>foo <!--should be ignored--> <!--should be ignored as well--> bar</p>
2754 !! end
2756 !! test
2757 Templates: Handle comments in the target
2758 !! wikitext
2759 {{echo
2760 <!-- should be ignored -->
2761 |foo}}
2763 {{echo
2764 <!-- should be ignored and spaces on next line should not trip us up (T147742) -->
2765   |foo}}
2767 {{echo<!-- should be ignored -->
2768 |foo}}
2770 {{echo<!-- should be ignored -->|foo}}
2772 {{<!-- should be ignored -->echo|foo}}
2773 !! html/php
2774 <p>foo
2775 </p><p>foo
2776 </p><p>foo
2777 </p><p>foo
2778 </p><p>foo
2779 </p>
2780 !! html/parsoid
2781 <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>
2783 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo\n&lt;!-- should be ignored and spaces on next line should not trip us up (T147742) -->\n  ","href":"./Template:Echo"},"params":{"1":{"wt":"foo"}},"i":0}}]}'>foo</p>
2785 <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>
2787 <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>
2789 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo"}},"i":0}}]}'>foo</p>
2790 !!end
2792 !! test
2793 Templates: Handle comments in parameter names (bug 67657)
2794 !! wikitext
2795 {{echo|1
2796 <!-- should be ignored -->
2797 =foo}}
2799 {{echo|
2800 <!-- should be ignored -->
2801 1 = foo}}
2803 {{echo|1<!-- should be ignored -->=foo}}
2805 {{echo|<!-- should be ignored -->1=foo}}
2806 !! html/php
2807 <p>foo
2808 </p><p>foo
2809 </p><p>foo
2810 </p><p>foo
2811 </p>
2812 !! html/parsoid
2813 <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>
2815 <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>
2817 <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>
2819 <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>
2820 !!end
2822 !! test
2823 Templates: Other wikitext in parameter names (bug 67657)
2824 !! wikitext
2825 {{echo|''1''=foo}}
2826 !! html/php
2827 <p>{{{1}}}
2828 </p>
2829 !! html/parsoid
2830 <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>
2831 !!end
2833 #--------------------------------------------------------------------
2834 # Transclusion parameter escaping tests
2835 #--------------------------------------------------------------------
2836 !! test
2837 Templates: Parsoid parameter escaping test 1
2838 !! wikitext
2839 {{echo|[foo]|{{echo|[bar]}}}}
2840 !! html/php+tidy
2841 <p>[foo]</p>
2842 !! html/parsoid
2843 <p about="#mwt1" typeof="mw:Transclusion"
2844 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[foo]"},"2":{"wt":"{{echo|[bar]}}"}},"i":0}}]}'>[foo]</p>
2845 !! end
2847 !! test
2848 Parsoid: Pipes in external links in template parameter
2849 !! wikitext
2850 {{echo|[{{echo|http://example.com}} link]}}
2851 !! html/php+tidy
2852 <p><a rel="nofollow" class="external text" href="http://example.com">link</a></p>
2853 !! html/parsoid
2854 <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>
2855 !! end
2857 !! test
2858 Parsoid: pipe in transclusion parameter
2859 !! wikitext
2860 {{echo|http://foo.com/a&#124;b}}
2861 !! html/php+tidy
2862 <p><a rel="nofollow" class="external free" href="http://foo.com/a%7Cb">http://foo.com/a%7Cb</a></p>
2863 !! html/parsoid
2864 <p><a rel="mw:ExtLink" href="http://foo.com/a|b" about="#mwt1"
2865 typeof="mw:Transclusion"
2866 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>
2867 !! end
2869 !! test
2870 Parsoid: Pipe in external link target and content in template parameter
2871 !! options
2872 parsoid=html2wt,wt2wt
2873 !! wikitext
2874 {{echo|[http://foo.com/a&#124;b a&#124;b]}}
2875 !! html/php+tidy
2876 <p><a rel="nofollow" class="external text" href="http://foo.com/a%7Cb">a|b</a></p>
2877 !! html/parsoid
2878 <p><a rel="mw:ExtLink" href="http://foo.com/a|b" about="#mwt1"
2879 typeof="mw:Transclusion"
2880 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},
2881 "params":{"1":{"wt":"[http://foo.com/a|b a|b]"}},"i":0}}]}'>a|b</a></p>
2882 !! end
2884 !! test
2885 Parsoid: Pipe in template with nested template in external link target in template parameter (seriously)
2886 !! options
2887 parsoid
2888 !! wikitext
2889 {{echo|[{{fullurl:{{FULLPAGENAME}}|action=edit}} bar]}}
2890 !! html
2891 <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>
2892 !! end
2894 !! test
2895 Templates: Don't escape already nowiki-escaped text in template parameters
2896 !! options
2897 parsoid=html2wt,wt2wt
2898 !! wikitext
2899 {{echo|foo<nowiki>|</nowiki>bar}}
2900 {{echo|<nowiki>&lt;div&gt;</nowiki>}}
2901 {{echo|<nowiki></nowiki>}}
2902 !! html/php+tidy
2903 <p>foo|bar &lt;div&gt;</p>
2904 !! html/parsoid
2905 <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>
2906 <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>
2907 <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>
2908 </p>
2909 !! end
2911 ## Bug 52824
2912 !! test
2913 Templates: '=' char in nested transclusions should not trigger nowiki escapes or conversion to named param
2914 !! options
2915 parsoid=html2wt,wt2wt
2916 !! wikitext
2917 {{echo|{{echo|1=bar}}}}
2918 !! html/php+tidy
2919 <p>bar</p>
2920 !! html/parsoid
2921 <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>
2922 !! end
2924 ## Bug 56733
2925 !! test
2926 Templates parameters with special tokenizing behavior dont get modified because of arg escaping
2927 !! wikitext
2928 {{echo|a : b}}
2929 !! html/php+tidy
2930 <p>a&#160;: b</p>
2931 !! html/parsoid
2932 <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>
2933 !! end
2935 ## Bug T73412
2936 !! test
2937 Templates: Preserve blank parameter names
2938 !! wikitext
2939 {{echo|=foo}}
2940 !! html/php+tidy
2941 <p>{{{1}}}</p>
2942 !! html/parsoid
2943 <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"":{"wt":"foo"}},"i":0}}]}'>{{{1}}}</p>
2944 !! end
2946 !! test
2947 Templates: Preserve blank parameter names in other positions
2948 !! wikitext
2949 {{blank_param|bar|=foo}}
2950 !! html/php+tidy
2951 <p>bar foo</p>
2952 !! html/parsoid
2953 <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
2954 foo</p>
2955 !! end
2958 ### Parsoid-centric tests for testing RT edge cases for pre
2961 !!test
2962 1a. Indent-Pre and Comments
2963 !! wikitext
2965 <!--a-->
2967 !! html
2968 <pre>a
2969 </pre>
2970 <p>c
2971 </p>
2972 !!end
2974 !!test
2975 1b. Indent-Pre and Comments
2976 !! wikitext
2978  <!--a-->
2980 !! html
2981 <pre>a
2982 </pre>
2983 <p>c
2984 </p>
2985 !!end
2987 !!test
2988 1c. Indent-Pre and Comments
2989 !! wikitext
2990 <!--a-->  a
2992  <!--a--> a
2993 !! html
2994 <pre> a
2995 </pre>
2996 <pre> a
2997 </pre>
2998 !!end
3000 !!test
3001 1d. Indent-Pre and Comments
3002 (Pre-handler currently cannot distinguish between comment/ws order and normalizes them to [comment,ws] order)
3003 !! wikitext
3004 <!--a--> a
3006  <!--b-->b
3007 !! html
3008 <pre>a
3009 </pre>
3010 <pre>b
3011 </pre>
3012 !!end
3014 !!test
3015 2a. Indent-Pre and tables
3016 !! wikitext
3017  {|
3018  |-
3019  !h1!!h2
3020  |foo||bar
3021  |}
3022 !! html
3023 <table>
3025 <tr>
3026 <th>h1</th>
3027 <th>h2
3028 </th>
3029 <td>foo</td>
3030 <td>bar
3031 </td></tr></table>
3033 !!end
3035 !!test
3036 2b. Indent-Pre and tables
3037 !! wikitext
3038   {|
3039  |-
3040 |foo
3042 !! html
3043 <table>
3045 <tr>
3046 <td>foo
3047 </td></tr></table>
3049 !!end
3051 !!test
3052 2c. Indent-Pre and tables (bug 42252)
3053 !! wikitext
3055  |+ foo
3056  !  | bar
3058 !! html
3059 <table>
3060 <caption> foo
3061 </caption>
3062 <tr>
3063 <th> bar
3064 </th></tr></table>
3066 !!end
3068 !!test
3069 2d. Indent-Pre and tables
3070 !! wikitext
3072  {|
3073  | b
3074  |}
3075 !! html/php
3076 <pre>a
3077 </pre>
3078 <table>
3079 <tr>
3080 <td> b
3081 </td></tr></table>
3083 !! html/parsoid
3084 <pre>a</pre>
3085  <table>
3086  <tbody><tr><td> b</td></tr>
3087  </tbody></table>
3088 !!end
3090 !!test
3091 2e. Indent-Pre and table-line syntax
3092 !! wikitext
3094  | b
3095  | c
3096 !! html/php
3097 <pre>a
3098 | b
3099 | c
3100 </pre>
3101 !!end
3103 !!test
3104 2f. Indent-pre started by table-line syntax
3105 !! wikitext
3107  | b
3108  | c
3109 !! html/php
3110 <p>a
3111 </p>
3112 <pre>| b
3113 | c
3114 </pre>
3115 !! html/parsoid
3116 <p>a</p>
3117 <pre>
3118 | b
3119 | c</pre>
3120 !!end
3122 !! test
3123 2g. Indented table markup mixed with indented pre content (proposed in bug 6200)
3124 !! wikitext
3125  <table>
3126  <tr>
3127  <td>
3128  Text that should be rendered preformatted
3129  </td>
3130  </tr>
3131  </table>
3132 !! html
3133  <table>
3134  <tr>
3135  <td>
3136 <pre>Text that should be rendered preformatted
3137 </pre>
3138  </td>
3139  </tr>
3140  </table>
3142 !! end
3144 !!test
3145 3a. Indent-Pre and block tags (single-line html)
3146 !! wikitext
3147  a <p> foo </p>
3148  b <div> foo </div>
3149  c <blockquote> foo </blockquote>
3150  <span> foo </span>
3151 !! html
3152  a <p> foo </p>
3153  b <div> foo </div>
3154  c <blockquote> foo </blockquote>
3155 <pre><span> foo </span>
3156 </pre>
3157 !! html/parsoid
3158  <p>a </p><p data-parsoid='{"stx":"html"}'> foo </p>
3159  <p>b </p><div data-parsoid='{"stx":"html"}'> foo </div>
3160  <p>c </p><blockquote data-parsoid='{"stx":"html"}'> foo </blockquote>
3161 <pre><span> foo </span>
3162 </pre>
3163 !! html+tidy
3164 <p>a</p>
3165 <p>foo</p>
3166 <p>b</p>
3167 <div>foo</div>
3168 <p>c</p>
3169 <blockquote>
3170 <p>foo</p>
3171 </blockquote>
3172 <pre>
3173 <span> foo </span>
3174 </pre>
3175 !! end
3177 !!test
3178 3b. Indent-Pre and block tags (multi-line html)
3179 !! wikitext
3180  a <span>foo</span>
3181  b <div> foo </div>
3182 !! html
3183 <pre>a <span>foo</span>
3184 </pre>
3185  b <div> foo </div>
3187 !! html/parsoid
3188 <pre>a <span data-parsoid='{"stx":"html"}'>foo</span></pre>
3189  b <div data-parsoid='{"stx":"html"}'> foo </div>
3190 !! html+tidy
3191 <pre>
3192 a <span>foo</span>
3193 </pre>
3194 <p>b</p>
3195 <div>foo</div>
3196 !!end
3198 !!test
3199 3c. Indent-Pre and block tags (pre-content on separate line)
3200 !! wikitext
3202  foo
3203 </p>
3205 <div>
3206  foo
3207 </div>
3209 <center>
3210  foo
3211 </center>
3213 <blockquote>
3214  foo
3215 </blockquote>
3217 <blockquote>
3218 <pre>
3220 </pre>
3221 </blockquote>
3223 <table><tr><td>
3224  foo
3225 </td></tr></table>
3227 <ul><li>
3228   foo
3229 </li></ul>
3231 !! html
3233  foo
3234 </p>
3235 <div>
3236 <pre>foo
3237 </pre>
3238 </div>
3239 <center>
3240 <pre>foo
3241 </pre>
3242 </center>
3243 <blockquote>
3244 <p> foo
3245 </p>
3246 </blockquote>
3247 <blockquote>
3248 <pre>
3250 </pre>
3251 </blockquote>
3252 <table><tr><td>
3253 <pre>foo
3254 </pre>
3255 </td></tr></table>
3256 <ul><li>
3257   foo
3258 </li></ul>
3260 !!end
3262 !! test
3263 4. Indent-Pre and extension tags
3264 !! wikitext
3265  a <tag />
3266 !! html/php
3267  a <pre>
3268 NULL
3269 array (
3271 </pre>
3273 !! html/parsoid
3274  a <pre typeof="mw:Extension/tag" about="#mwt2" data-parsoid='{}' data-mw='{"name":"tag","attrs":{},"body":null}'></pre>
3275 !! end
3277 !!test
3278 Render paragraphs when indent-pre is suppressed in blocklevels
3279 !! wikitext
3280 <blockquote>
3281  foo
3283  bar
3284 </blockquote>
3285 !! html
3286 <blockquote>
3287 <p> foo
3288 </p><p> bar
3289 </p>
3290 </blockquote>
3292 !!end
3294 !!test
3295 4. Multiple spaces at start-of-line
3296 !! wikitext
3297     <p> foo </p>
3298     foo
3299         {|
3300 |foo
3302 !! html
3303     <p> foo </p>
3304 <pre>   foo
3305 </pre>
3306 <table>
3307 <tr>
3308 <td>foo
3309 </td></tr></table>
3311 !!end
3313 ## NOTE: the leading white-space chars on empty line are significant
3314 !! test
3315 5a. White-space in indent-pre
3316 !! wikitext
3317  a<br />
3320 !! html
3321 <pre>a<br />
3324 </pre>
3325 !! end
3327 ## NOTE: the leading white-space chars on empty line are significant
3328 !! test
3329 5b. White-space in indent-pre
3330 !! wikitext
3337 !! html
3338 <pre>a
3344 </pre>
3345 !! end
3347 !! test
3348 5c. White-space in indent-pre
3349 !! wikitext
3350  ''a''
3351   ''b''
3352    ''c''
3353 !! html
3354 <pre><i>a</i>
3355  <i>b</i>
3356   <i>c</i>
3357 </pre>
3358 !! end
3360 !! test
3361 6. Pre-blocks should extend across lines with leading WS even when there is no wrappable content
3362 !! wikitext
3365  <!-- continue -->
3371 !! html
3372 <pre>a
3375 </pre>
3376 <pre>c
3378 </pre>
3379 <p>d
3380 </p>
3381 !! end
3383 !! test
3384 7a. Indent-pre and category links
3385 !! options
3386 parsoid=wt2html,wt2wt
3387 !! wikitext
3388  [[Category:foo]] <!-- No pre-wrapping -->
3389 {{echo| [[Category:foo]]}} <!-- No pre-wrapping -->
3390 !! html/php+tidy
3391 !! html/parsoid
3392  <link rel="mw:PageProp/Category" href="./Category:Foo"> <!-- No pre&#x2D;wrapping -->
3393 <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 -->
3394 !! end
3396 ## We used to, but no longer wt2wt this test since the default serializer
3397 ## will normalize all categories to serialize on their own line.
3398 ## This wikitext usage is going to be fairly uncommon in production and
3399 ## selser will take care of preserving formatting in those scenarios.
3400 !! test
3401 7b. Indent-pre and category links
3402 !! options
3403 parsoid=wt2html
3404 !! wikitext
3405  [[Category:foo]] a
3406  [[Category:foo]] {{echo|b}}
3407 !! html/parsoid
3408 <pre><link rel="mw:PageProp/Category" href="./Category:Foo"> a
3409  <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>
3410 !! end
3412 !! test
3413 Indent-Pre: Newlines in comments shouldn't affect sol state
3414 !! wikitext
3415 a <!--
3417 --> b
3418 !! html/php+tidy
3419 <p>a b</p>
3420 !! html/parsoid
3421 <p>a <!--
3423 --> b</p>
3424 !! end
3427 ### HTML-pre (some to spec PHP parser behavior and some Parsoid-RT-centric)
3430 !!test
3431 HTML-pre: 1. embedded newlines
3432 !! wikitext
3433 <pre>foo</pre>
3435 <pre>
3437 </pre>
3439 <pre>
3442 </pre>
3444 <pre>
3448 </pre>
3449 !! html/php+tidy
3450 <pre>
3452 </pre>
3453 <pre>
3455 </pre>
3456 <pre>
3459 </pre>
3460 <pre>
3464 </pre>
3465 !! html/parsoid
3466 <pre data-parsoid='{"stx":"html"}'>foo</pre>
3468 <pre data-parsoid='{"stx":"html","strippedNL":"\n"}'>
3470 </pre>
3472 <pre data-parsoid='{"stx":"html"}'>
3475 </pre>
3477 <pre data-parsoid='{"stx":"html"}'>
3481 </pre>
3482 !!end
3484 !! test
3485 HTML-pre: big spaces
3486 !! wikitext
3487 <pre>
3492 haha
3497 haha
3502 </pre>
3503 !! html/php+tidy
3504 <pre>
3509 haha
3514 haha
3519 </pre>
3520 !! html/parsoid
3521 <pre data-parsoid='{"stx":"html"}'>
3526 haha
3531 haha
3536 </pre>
3537 !! end
3539 !!test
3540 HTML-pre: 2: indented text
3541 !! wikitext
3542 <pre>
3543  foo
3544 </pre>
3545 !! html
3546 <pre>
3547  foo
3548 </pre>
3550 !!end
3552 !!test
3553 HTML-pre: 3: other wikitext
3554 !! wikitext
3555 <pre>
3556 * foo
3557 # bar
3558 = no-h =
3559 '' no-italic ''
3560 [[ NoLink ]]
3561 </pre>
3562 !! html/php
3563 <pre>
3564 * foo
3565 # bar
3566 = no-h =
3567 '' no-italic ''
3568 [[ NoLink ]]
3569 </pre>
3571 !! html/parsoid
3572 <pre data-parsoid='{"stx":"html","strippedNL":true}'>* foo
3573 # bar
3574 = no-h =
3575 '' no-italic ''
3576 [[ NoLink ]]
3577 </pre>
3578 !!end
3581 ### Definition lists
3583 !! test
3584 Simple definition
3585 !! wikitext
3586 ; name : Definition
3587 !! html
3588 <dl><dt> name&#160;</dt>
3589 <dd> Definition</dd></dl>
3591 !! end
3593 !! test
3594 Definition list for indentation only
3595 !! wikitext
3596 : Indented text
3597 !! html
3598 <dl><dd> Indented text</dd></dl>
3600 !! end
3602 !! test
3603 Definition list with no space
3604 !! wikitext
3605 ;name:Definition
3606 !! html
3607 <dl><dt>name</dt>
3608 <dd>Definition</dd></dl>
3610 !!end
3612 !! test
3613 Definition list with URL link
3614 !! wikitext
3615 ; http://example.com/ : definition
3616 !! html
3617 <dl><dt> <a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&#160;</dt>
3618 <dd> definition</dd></dl>
3620 !! end
3622 !! test
3623 Definition list with bracketed URL link
3624 !! wikitext
3625 ;[http://www.example.com/ Example]:Something about it
3626 !! html
3627 <dl><dt><a rel="nofollow" class="external text" href="http://www.example.com/">Example</a></dt>
3628 <dd>Something about it</dd></dl>
3630 !! end
3632 !! test
3633 Definition list with wikilink containing colon
3634 !! wikitext
3635 ; [[Help:FAQ]]: The least-read page on Wikipedia
3636 !! html
3637 <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>
3638 <dd> The least-read page on Wikipedia</dd></dl>
3640 !! end
3642 # At Brion's and JeLuF's insistence... :)
3643 !! test
3644 Definition list with news link containing colon
3645 !! wikitext
3646 ;  news:alt.wikipedia.rox: This isn't even a real newsgroup!
3647 !! html/php
3648 <dl><dt>  <a rel="nofollow" class="external free" href="news:alt.wikipedia.rox">news:alt.wikipedia.rox</a></dt>
3649 <dd> This isn't even a real newsgroup!</dd></dl>
3651 !! html/parsoid
3652 <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>
3653 !! end
3655 !! test
3656 Malformed definition list with colon
3657 !! wikitext
3658 ;  news:alt.wikipedia.rox -- don't crash or enter an infinite loop
3659 !! html
3660 <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>
3662 !! end
3664 !! test
3665 Definition lists: colon in external link text
3666 !! wikitext
3667 ; [http://www.wikipedia2.org/ Wikipedia : The Next Generation]: OK, I made that up
3668 !! html
3669 <dl><dt> <a rel="nofollow" class="external text" href="http://www.wikipedia2.org/">Wikipedia&#160;: The Next Generation</a></dt>
3670 <dd> OK, I made that up</dd></dl>
3672 !! end
3674 !! test
3675 Definition lists: colon in HTML attribute
3676 !! wikitext
3677 ;<b style="display: inline">bold</b>
3678 !! html
3679 <dl><dt><b style="display: inline">bold</b></dt></dl>
3681 !! end
3683 !! test
3684 Definition lists: self-closed tag
3685 !! wikitext
3686 ;one<br/>two : two-line fun
3687 !! html
3688 <dl><dt>one<br />two&#160;</dt>
3689 <dd> two-line fun</dd></dl>
3691 !! end
3693 !! test
3694 Bug 11748: Literal closing tags
3695 !! wikitext
3696 <dl>
3697 <dt>test 1</dt>
3698 <dd>test test test test test</dd>
3699 <dt>test 2</dt>
3700 <dd>test test test test test</dd>
3701 </dl>
3702 !! html
3703 <dl>
3704 <dt>test 1</dt>
3705 <dd>test test test test test</dd>
3706 <dt>test 2</dt>
3707 <dd>test test test test test</dd>
3708 </dl>
3710 !! end
3712 !! test
3713 Definition and unordered list using wiki syntax nested in unordered list using html tags.
3714 !! wikitext
3715 <ul><li>
3716 ; term : description
3717 * unordered
3718 </li></ul>
3719 !! html
3720 <ul><li>
3721 <dl><dt> term&#160;</dt>
3722 <dd> description</dd></dl>
3723 <ul><li> unordered</li></ul>
3724 </li></ul>
3726 !! end
3728 !! test
3729 Definition list with empty definition and following paragraph
3730 !! wikitext
3731 ; term:
3732 Paragraph text
3733 !! html
3734 <dl><dt> term</dt>
3735 <dd></dd></dl>
3736 <p>Paragraph text
3737 </p>
3738 !! end
3740 !! test
3741 Nested definition lists using html syntax
3742 !! wikitext
3743 <dl><dt>x</dt>
3744 <dd>a</dd>
3745 <dd>b</dd></dl>
3746 !! html
3747 <dl><dt>x</dt>
3748 <dd>a</dd>
3749 <dd>b</dd></dl>
3751 !! end
3753 !! test
3754 Definition Lists: No nesting: Multiple dd's
3755 !! wikitext
3759 !! html
3760 <dl><dt>x</dt>
3761 <dd>a</dd>
3762 <dd>b</dd></dl>
3764 !! end
3766 !! test
3767 Definition Lists: Indentation: Regular
3768 !! wikitext
3770 ::i2
3771 :::i3
3772 !! html
3773 <dl><dd>i1
3774 <dl><dd>i2
3775 <dl><dd>i3</dd></dl></dd></dl></dd></dl>
3777 !! end
3779 !! test
3780 Definition Lists: Indentation: Missing 1st level
3781 !! wikitext
3782 ::i2
3783 :::i3
3784 !! html
3785 <dl><dd><dl><dd>i2
3786 <dl><dd>i3</dd></dl></dd></dl></dd></dl>
3788 !! end
3790 !! test
3791 Definition Lists: Indentation: Multi-level indent
3792 !! wikitext
3793 :::i3
3794 !! html
3795 <dl><dd><dl><dd><dl><dd>i3</dd></dl></dd></dl></dd></dl>
3797 !! end
3799 !! test
3800 Definition Lists: Hacky use to indent tables
3801 !! wikitext
3802 ::{|
3803 |foo
3804 |bar
3806 this text
3807 should be left alone
3808 !! html
3809 <dl><dd><dl><dd><table>
3810 <tr>
3811 <td>foo
3812 </td>
3813 <td>bar
3814 </td></tr></table></dd></dl></dd></dl>
3815 <p>this text
3816 should be left alone
3817 </p>
3818 !! end
3820 !! test
3821 Definition Lists: Hacky use to indent tables, with comments (bug 63979)
3822 !! wikitext
3823 <!-- foo -->
3824 ::{|
3825 |foo
3826 |bar
3827 |}<!-- bar -->
3828 this text
3829 should be left alone
3830 !! html/parsoid
3831 <!-- foo -->
3832 <dl><dd><dl><dd><table><tr>
3833 <td>foo</td>
3834 <td>bar</td>
3835 </tr></table><!-- bar --></dd></dl></dd></dl>
3836 <p>this text
3837 should be left alone</p>
3838 !! end
3840 !! test
3841 Definition Lists: Hacky use to indent tables, with comment before table
3842 !! wikitext
3843 ::<!-- foo -->{|
3844 |foo
3846 !! html/parsoid
3847 <dl><dd><dl><dd><!-- foo --><table><tr>
3848 <td>foo</td>
3849 </tr></table></dd></dl></dd></dl>
3850 !! end
3852 # The trailing whitespace in this test is to catch a regression in
3853 # Parsoid after T54473.
3854 !! test
3855 Definition Lists: Hacky use to indent tables (WS-insensitive)
3856 !! wikitext
3857 : {|
3859 |} 
3860 !! html/php
3861 <dl><dd><table>
3862 <tr>
3863 <td>a
3864 </td></tr></table></dd></dl>
3866 !! html/parsoid
3867 <dl><dd> <table>
3868 <tbody><tr><td>a</td></tr>
3869 </tbody></table> </dd></dl>
3870 !! end
3872 ## The PHP parser treats : items (dd) without a corresponding ; item (dt)
3873 ## as an empty dt item.  It also ignores all but the last ";" when followed
3874 ## by ":" later on.  So, ";" are not ignored in ";;;t3" but are ignored  in
3875 ## ";;;t3 :d1".  So, PHP parser behavior is a little inconsistent wrt multiple
3876 ## ";"s.
3878 ## Ex: ";;t2 ::d2" is transformed into:
3880 ## <dl>
3881 ##   <dt>t2 </dt>
3882 ##   <dd>
3883 ##     <dl>
3884 ##       <dt></dt>
3885 ##       <dd>d2</dd>
3886 ##     </dl>
3887 ##   </dd>
3888 ## </dl>
3890 ## But, Parsoid treats "; :" as a tight atomic unit and excess ":" as plain text
3891 ## So, the same wikitext above (;;t2 ::d2) is transformed into:
3893 ## <dl>
3894 ##   <dt>
3895 ##     <dl>
3896 ##       <dt>t2 </dt>
3897 ##       <dd>:d2</dd>
3898 ##     </dl>
3899 ##    </dt>
3900 ## </dl>
3902 ## All Parsoid only definition list tests have this difference.
3904 ## See also: https://phabricator.wikimedia.org/T8569
3905 ## and https://lists.wikimedia.org/pipermail/wikitext-l/2011-November/000483.html
3907 !! test
3908 Table / list interaction: indented table with lists in table contents
3909 !! wikitext
3912 | a
3913 * b
3915 | c
3916 * d
3918 !! html
3919 <dl><dd><table>
3921 <tr>
3922 <td> a
3923 <ul><li> b</li></ul>
3924 </td></tr>
3925 <tr>
3926 <td> c
3927 <ul><li> d</li></ul>
3928 </td></tr></table></dd></dl>
3930 !! end
3932 !!test
3933 Table / list interaction: lists nested in tables nested in indented lists
3934 !! wikitext
3946 !! html
3947 <dl><dd><table>
3948 <tr>
3949 <td>
3950 <dl><dd>a</dd>
3951 <dd>b</dd></dl>
3952 </td>
3953 <td>
3954 <ul><li>c</li>
3955 <li>d</li></ul>
3956 </td></tr></table></dd></dl>
3957 <ul><li>e</li>
3958 <li>f</li></ul>
3960 !!end
3962 !! test
3963 Definition Lists: Nesting: Multi-level (Parsoid only)
3964 !! options
3965 parsoid
3966 !! wikitext
3967 ;t1 :d1
3968 ;;t2 ::d2
3969 ;;;t3 :::d3
3970 !! html
3971 <dl>
3972   <dt>t1 </dt>
3973   <dd>d1</dd>
3974   <dt>
3975     <dl>
3976       <dt>t2 </dt>
3977       <dd>:d2</dd>
3978       <dt>
3979         <dl>
3980           <dt>t3 </dt>
3981           <dd>::d3</dd>
3982         </dl>
3983       </dt>
3984     </dl>
3985   </dt>
3986 </dl>
3989 !! end
3992 !! test
3993 Definition Lists: Nesting: Test 2 (Parsoid only)
3994 !! wikitext
3996 ::d2
3997 !! html/php+tidy
3998 <dl>
3999 <dt>t1</dt>
4000 <dd>
4001 <dl>
4002 <dd>d2</dd>
4003 </dl>
4004 </dd>
4005 </dl>
4006 !! html/parsoid
4007 <dl>
4008   <dt>t1</dt>
4009   <dd>
4010     <dl>
4011       <dd>d2</dd>
4012     </dl>
4013   </dd>
4014 </dl>
4016 !! end
4019 !! test
4020 Definition Lists: Nesting: Test 3 (Parsoid only)
4021 !! wikitext
4022 :;t1
4023 ::::d2
4024 !! html/php+tidy
4025 <dl>
4026 <dd>
4027 <dl>
4028 <dt>t1</dt>
4029 <dd>
4030 <dl>
4031 <dd>
4032 <dl>
4033 <dd>d2</dd>
4034 </dl>
4035 </dd>
4036 </dl>
4037 </dd>
4038 </dl>
4039 </dd>
4040 </dl>
4041 !! html/parsoid
4042 <dl>
4043   <dd>
4044     <dl>
4045       <dt>t1</dt>
4046       <dd>
4047         <dl>
4048           <dd>
4049             <dl>
4050               <dd>d2</dd>
4051             </dl>
4052           </dd>
4053         </dl>
4054       </dd>
4055     </dl>
4056   </dd>
4057 </dl>
4059 !! end
4062 !! test
4063 Definition Lists: Nesting: Test 4
4064 !! wikitext
4065 ::;t3
4066 :::d3
4067 !! html
4068 <dl><dd><dl><dd><dl><dt>t3</dt>
4069 <dd>d3</dd></dl></dd></dl></dd></dl>
4071 !! end
4074 ## The Parsoid team believes the following three test exposes a
4075 ## bug in the PHP parser.  (Parsoid team thinks the PHP parser is
4076 ## wrong to close the <dl> after the <dt> containing the <ul>.)
4077 ## It also exposes a "misfeature" in tidy, which doesn't like
4078 ## <dl> tags with a single <dt> child; it converts the <dt> into
4079 ## a <dd> in that case.  (Parsoid leaves the <dt> alone!)
4080 !! test
4081 Definition Lists: Mixed Lists: Test 1
4082 !! wikitext
4083 :;* foo
4084 ::* bar
4085 :; baz
4086 !! html/php
4087 <dl><dd><dl><dt><ul><li> foo</li>
4088 <li> bar</li></ul></dt></dl>
4089 <dl><dt> baz</dt></dl></dd></dl>
4091 !! html/php+tidy
4092 <dl>
4093 <dd>
4094 <dl>
4095 <dd>
4096 <ul>
4097 <li>foo</li>
4098 <li>bar</li>
4099 </ul>
4100 </dd>
4101 </dl>
4102 <dl>
4103 <dt>baz</dt>
4104 </dl>
4105 </dd>
4106 </dl>
4107 !! html/parsoid
4108 <dl>
4109 <dd><dl>
4110 <dt><ul>
4111 <li> foo
4112 </li>
4113 </ul></dt>
4114 <dd><ul>
4115 <li> bar
4116 </li>
4117 </ul></dd>
4118 <dt> baz</dt>
4119 </dl></dd>
4120 </dl>
4121 !! end
4123 !! test
4124 Definition Lists: Mixed Lists: Test 2
4125 !! wikitext
4126 *: d1
4127 *: d2
4128 !! html
4129 <ul><li><dl><dd> d1</dd>
4130 <dd> d2</dd></dl></li></ul>
4132 !! end
4135 !! test
4136 Definition Lists: Mixed Lists: Test 3
4137 !! wikitext
4138 *::: d1
4139 *::: d2
4140 !! html
4141 <ul><li><dl><dd><dl><dd><dl><dd> d1</dd>
4142 <dd> d2</dd></dl></dd></dl></dd></dl></li></ul>
4144 !! end
4147 !! test
4148 Definition Lists: Mixed Lists: Test 4
4149 !! wikitext
4150 *;d1 :d2
4151 *;d3 :d4
4152 !! html
4153 <ul><li><dl><dt>d1&#160;</dt>
4154 <dd>d2</dd>
4155 <dt>d3&#160;</dt>
4156 <dd>d4</dd></dl></li></ul>
4158 !! end
4161 !! test
4162 Definition Lists: Mixed Lists: Test 5
4163 !! wikitext
4164 *:d1
4165 *:: d2
4166 !! html
4167 <ul><li><dl><dd>d1
4168 <dl><dd> d2</dd></dl></dd></dl></li></ul>
4170 !! end
4173 !! test
4174 Definition Lists: Mixed Lists: Test 6
4175 !! wikitext
4176 #*:d1
4177 #*::: d3
4178 !! html
4179 <ol><li><ul><li><dl><dd>d1
4180 <dl><dd><dl><dd> d3</dd></dl></dd></dl></dd></dl></li></ul></li></ol>
4182 !! end
4185 !! test
4186 Definition Lists: Mixed Lists: Test 7
4187 !! wikitext
4188 :* d1
4189 :* d2
4190 !! html
4191 <dl><dd><ul><li> d1</li>
4192 <li> d2</li></ul></dd></dl>
4194 !! end
4197 !! test
4198 Definition Lists: Mixed Lists: Test 8
4199 !! wikitext
4200 :* d1
4201 ::* d2
4202 !! html
4203 <dl><dd><ul><li> d1</li></ul>
4204 <dl><dd><ul><li> d2</li></ul></dd></dl></dd></dl>
4206 !! end
4209 !! test
4210 Definition Lists: Mixed Lists: Test 9
4211 !! wikitext
4212 *;foo :bar
4213 !! html
4214 <ul><li><dl><dt>foo&#160;</dt>
4215 <dd>bar</dd></dl></li></ul>
4217 !! end
4220 !! test
4221 Definition Lists: Mixed Lists: Test 10
4222 !! wikitext
4223 *#;foo :bar
4224 !! html
4225 <ul><li><ol><li><dl><dt>foo&#160;</dt>
4226 <dd>bar</dd></dl></li></ol></li></ul>
4228 !! end
4230 # The Parsoid team disagrees with the PHP parser's seemingly-random
4231 # rules regarding dd/dt on the next two tests.  Parsoid is more
4232 # consistent, and recognizes the shared nesting and keeps the
4233 # still-open tags around until the nesting is complete.
4234 # (And tidy again converts <dt> to <dd> before 'bar'.)
4236 !! test
4237 Definition Lists: Mixed Lists: Test 11
4238 !! wikitext
4239 *#*#;*;;foo :bar
4240 *#*#;boo :baz
4241 !! html/php
4242 <ul><li><ol><li><ul><li><ol><li><dl><dt>foo&#160;</dt>
4243 <dd><ul><li><dl><dt><dl><dt>bar</dt></dl></dd></dl></li></ul></dd></dl>
4244 <dl><dt>boo&#160;</dt>
4245 <dd>baz</dd></dl></li></ol></li></ul></li></ol></li></ul>
4247 !! html/php+tidy
4248 <ul>
4249 <li>
4250 <ol>
4251 <li>
4252 <ul>
4253 <li>
4254 <ol>
4255 <li>
4256 <dl>
4257 <dt>foo&#160;</dt>
4258 <dd>
4259 <ul>
4260 <li>
4261 <dl>
4262 <dd>
4263 <dl>
4264 <dt>bar</dt>
4265 </dl>
4266 </dd>
4267 </dl>
4268 </li>
4269 </ul>
4270 </dd>
4271 </dl>
4272 <dl>
4273 <dt>boo&#160;</dt>
4274 <dd>baz</dd>
4275 </dl>
4276 </li>
4277 </ol>
4278 </li>
4279 </ul>
4280 </li>
4281 </ol>
4282 </li>
4283 </ul>
4284 !! html/parsoid
4285 <ul>
4286 <li>
4287 <ol>
4288 <li>
4289 <ul>
4290 <li>
4291 <ol>
4292 <li>
4293 <dl>
4294 <dt>
4295 <ul>
4296 <li>
4297 <dl>
4298 <dt>
4299 <dl>
4300 <dt>foo<span typeof="mw:Placeholder" data-parsoid='{"src":" "}'>&nbsp;</span></dt>
4301 <dd data-parsoid='{"stx":"row"}'>bar</dd>
4302 </dl></dt>
4303 </dl></li>
4304 </ul></dt>
4305 <dt>boo<span typeof="mw:Placeholder" data-parsoid='{"src":" "}'>&nbsp;</span></dt>
4306 <dd data-parsoid='{"stx":"row"}'>baz</dd>
4307 </dl></li>
4308 </ol></li>
4309 </ul></li>
4310 </ol></li>
4311 </ul>
4312 !! end
4315 # Another case where tidy converts a <dt> to a <dd> (but Parsoid doesn't).
4316 # From whitelist:
4317 # * The test is wrong, there are two colons where there should be :;
4318 # * The PHP parser is wrong to close the <dl> after the <dt> containing the <ul>.
4319 !! test
4320 Definition Lists: Weird Ones: Test 1
4321 !! wikitext
4322 *#;*::;; foo : bar (who uses this?)
4323 !! html/php
4324 <ul><li><ol><li><dl><dt> foo&#160;</dt>
4325 <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>
4327 !! html/php+tidy
4328 <ul>
4329 <li>
4330 <ol>
4331 <li>
4332 <dl>
4333 <dt>foo&#160;</dt>
4334 <dd>
4335 <ul>
4336 <li>
4337 <dl>
4338 <dd>
4339 <dl>
4340 <dd>
4341 <dl>
4342 <dd>
4343 <dl>
4344 <dt>bar (who uses this?)</dt>
4345 </dl>
4346 </dd>
4347 </dl>
4348 </dd>
4349 </dl>
4350 </dd>
4351 </dl>
4352 </li>
4353 </ul>
4354 </dd>
4355 </dl>
4356 </li>
4357 </ol>
4358 </li>
4359 </ul>
4360 !! html/parsoid
4361 <ul>
4362 <li>
4363 <ol>
4364 <li>
4365 <dl>
4366 <dt>
4367 <ul>
4368 <li>
4369 <dl>
4370 <dd>
4371 <dl>
4372 <dd>
4373 <dl>
4374 <dt>
4375 <dl>
4376 <dt> foo<span typeof="mw:DisplaySpace mw:Placeholder" data-parsoid='{"src":" ","isDisplayHack":true}'> </span></dt>
4377 <dd data-parsoid='{"stx":"row"}'> bar (who uses this?)</dd>
4378 </dl></dt>
4379 </dl></dd>
4380 </dl></dd>
4381 </dl></li>
4382 </ul></dt>
4383 </dl></li>
4384 </ol></li>
4385 </ul>
4386 !! end
4388 !! test
4389 Definition Lists: colons occurring in tags
4390 !! wikitext
4391 ;a:b
4392 ;'''a:b'''
4393 ;<i>a:b</i>
4394 ;<span>a:b</span>
4395 ;<div>a:b</div>
4396 ;<div>a
4397 :b</div>
4398 ;{{echo|a:b}}
4399 ;{{echo|''a:b''}}
4400 ;;;''a:b''
4401 !! html+tidy
4402 <dl>
4403 <dt>a</dt>
4404 <dd>b</dd>
4405 <dt><b>a:b</b></dt>
4406 <dt><i>a:b</i></dt>
4407 <dt><span>a:b</span></dt>
4408 <dd>
4409 <div>a:b</div>
4410 </dd>
4411 <dd>
4412 <div>a
4413 <dl>
4414 <dd>b</dd>
4415 </dl>
4416 </div>
4417 </dd>
4418 <dt>a</dt>
4419 <dd>b</dd>
4420 <dt><i>a:b</i></dt>
4421 </dl>
4422 <dl>
4423 <dd>
4424 <dl>
4425 <dd>
4426 <dl>
4427 <dt><i>a:b</i></dt>
4428 </dl>
4429 </dd>
4430 </dl>
4431 </dd>
4432 </dl>
4433 !! html/parsoid
4434 <dl><dt>a</dt><dd data-parsoid='{"stx":"row"}'>b</dd>
4435 <dt><b>a:b</b></dt>
4436 <dt><i data-parsoid='{"stx":"html"}'>a:b</i></dt>
4437 <dt><span data-parsoid='{"stx":"html"}'>a:b</span></dt>
4438 <dt><div data-parsoid='{"stx":"html"}'>a:b</div></dt>
4439 <dt><div data-parsoid='{"stx":"html","autoInsertedEnd":true}'>a</div></dt>
4440 <dd>b</dd>
4441 <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>
4442 <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>
4443 <dl><dt><dl><dt><i>a:b</i></dt></dl></dt></dl></dt></dl>
4444 !! end
4446 !! test
4447 Definition Lists: colons and tables 1
4448 !! wikitext
4450 | x
4453 | y
4455 !! html
4456 <dl><dd><table>
4457 <tr>
4458 <td> x
4459 </td></tr></table></dd></dl>
4460 <dl><dd><table>
4461 <tr>
4462 <td> y
4463 </td></tr></table></dd></dl>
4465 !! end
4467 # Parsoid's output (as documented below) differs from php's in this case.
4468 # This is probably a bug. If we fixup parsoid to match php's output, the
4469 # above test should pass and the below test case can be removed. It is
4470 # unclear which output is more desirable.
4472 !! test
4473 Definition Lists: colons and tables 2
4474 !! wikitext
4476 | x
4479 | y
4481 !! html/parsoid
4482 <dl><dd><table>
4483 <tr>
4484 <td> x
4485 </td></tr></table></dd>
4486 <dd><table>
4487 <tr>
4488 <td> y
4489 </td></tr></table></dd></dl>
4490 !! end
4492 !! test
4493 Definition Lists: template interaction
4494 !! wikitext
4495 ::{{definition_list}}
4497 :one
4498 ::{{definition_list}}
4499 :::two
4500 :::three
4501 ::four
4502 !! html/parsoid
4503 <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">
4504 </span><dd about="#mwt1">two</dd></dl></dd></dl>
4506 <dl><dd data-parsoid='{}'>one
4507 <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">
4508 </span><dd about="#mwt2">two
4509 <dl><dd>two</dd>
4510 <dd>three</dd></dl></dd>
4511 <dd data-parsoid='{}'>four</dd></dl></dd></dl>
4512 !! end
4516 ### External links
4518 !! test
4519 External links: non-bracketed
4520 !! wikitext
4521 Non-bracketed: http://example.com
4522 !! html
4523 <p>Non-bracketed: <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4524 </p>
4525 !! end
4527 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
4528 !! test
4529 External links: numbered
4530 !! wikitext
4531 Numbered: [http://example.com]
4532 Numbered: [http://example.net]
4533 Numbered: [http://example.com]
4534 !! html/php
4535 <p>Numbered: <a rel="nofollow" class="external autonumber" href="http://example.com">[1]</a>
4536 Numbered: <a rel="nofollow" class="external autonumber" href="http://example.net">[2]</a>
4537 Numbered: <a rel="nofollow" class="external autonumber" href="http://example.com">[3]</a>
4538 </p>
4539 !! html/parsoid
4540 <p>Numbered: <a rel="mw:ExtLink" href="http://example.com"></a>
4541 Numbered: <a rel="mw:ExtLink" href="http://example.net"></a>
4542 Numbered: <a rel="mw:ExtLink" href="http://example.com"></a></p>
4543 !!end
4545 !! test
4546 External links: specified text
4547 !! wikitext
4548 Specified text: [http://example.com link]
4549 !! html
4550 <p>Specified text: <a rel="nofollow" class="external text" href="http://example.com">link</a>
4551 </p>
4552 !!end
4554 !! test
4555 External links: trail
4556 !! wikitext
4557 Linktrails should not work for external links: [http://example.com link]s
4558 !! html
4559 <p>Linktrails should not work for external links: <a rel="nofollow" class="external text" href="http://example.com">link</a>s
4560 </p>
4561 !! end
4563 !! test
4564 External links: dollar sign in URL
4565 !! wikitext
4566 http://example.com/1$2345
4567 !! html
4568 <p><a rel="nofollow" class="external free" href="http://example.com/1$2345">http://example.com/1$2345</a>
4569 </p>
4570 !! end
4572 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
4573 !! test
4574 External links: dollar sign in URL (autonumber)
4575 !! wikitext
4576 [http://example.com/1$2345]
4577 !! html/php
4578 <p><a rel="nofollow" class="external autonumber" href="http://example.com/1$2345">[1]</a>
4579 </p>
4580 !! html/parsoid
4581 <p><a rel="mw:ExtLink" href="http://example.com/1$2345"></a></p>
4582 !!end
4584 !! test
4585 External links: open square bracket forbidden in URL (bug 4377)
4586 !! options
4587 parsoid=wt2html,wt2wt,html2html
4588 !! wikitext
4589 http://example.com/1[2345
4590 !! html/php
4591 <p><a rel="nofollow" class="external free" href="http://example.com/1">http://example.com/1</a>[2345
4592 </p>
4593 !! html/parsoid
4594 <p><a rel="mw:ExtLink" href="http://example.com/1">http://example.com/1</a>[2345</p>
4595 !! end
4597 !! test
4598 External links: open square bracket forbidden in URL (named) (bug 4377)
4599 !! options
4600 parsoid=wt2html,html2html
4601 !! wikitext
4602 [http://example.com/1[2345]
4603 !! html/php
4604 <p><a rel="nofollow" class="external text" href="http://example.com/1">[2345</a>
4605 </p>
4606 !! html/parsoid
4607 <p><a rel="mw:ExtLink" href="http://example.com/1">[2345</a></p>
4608 !!end
4610 # parsoid adds a space before the link name
4611 !! test
4612 External links: open square bracket forbidden in URL (named) (bug 4377)
4613 Parsoid variant.
4614 !! wikitext
4615 [http://example.com/1 [2345]
4616 !! html
4617 <p><a rel="nofollow" class="external text" href="http://example.com/1">[2345</a>
4618 </p>
4619 !!end
4621 !! test
4622 External links: nowiki in URL link text (bug 6230)
4623 !! wikitext
4624 [http://example.com/ <nowiki>''example site''</nowiki>]
4625 !! html
4626 <p><a rel="nofollow" class="external text" href="http://example.com/">''example site''</a>
4627 </p>
4628 !! end
4630 !! test
4631 External links: newline forbidden in text (bug 6230 regression check)
4632 !! wikitext
4633 [http://example.com/ first
4634 second]
4635 !! html
4636 <p>[<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a> first
4637 second]
4638 </p>
4639 !!end
4641 !! test
4642 External links: Pipe char between url and text
4643 !! wikitext
4644 [http://example.com | link]
4645 !! html
4646 <p><a rel="nofollow" class="external text" href="http://example.com">| link</a>
4647 </p>
4648 !!end
4650 !! test
4651 External links: protocol-relative URL in brackets
4652 !! wikitext
4653 [//example.com/ Test]
4654 !! html
4655 <p><a rel="nofollow" class="external text" href="//example.com/">Test</a>
4656 </p>
4657 !! end
4659 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
4660 !! test
4661 External links: protocol-relative URL in brackets without text
4662 !! wikitext
4663 [//example.com]
4664 !! html/php
4665 <p><a rel="nofollow" class="external autonumber" href="//example.com">[1]</a>
4666 </p>
4667 !! html/parsoid
4668 <p><a rel="mw:ExtLink" href="//example.com"></a></p>
4669 !! end
4671 !! test
4672 External links: protocol-relative URL in free text is left alone
4673 !! wikitext
4674 //example.com/Foo
4675 !! html
4676 <p>//example.com/Foo
4677 </p>
4678 !!end
4680 !! test
4681 External links: protocol-relative URL in the middle of a word is left alone (bug 30269)
4682 !! wikitext
4683 foo//example.com/Foo
4684 !! html
4685 <p>foo//example.com/Foo
4686 </p>
4687 !! end
4689 !! test
4690 External links: with no contents
4691 !! wikitext
4692 [http://en.wikipedia.org/wiki/Foo]
4694 [[wikipedia:Foo|Bar]]
4696 [[wikipedia:Foo|<span>Bar</span>]]
4697 !! html/php
4698 <p><a rel="nofollow" class="external autonumber" href="http://en.wikipedia.org/wiki/Foo">[1]</a>
4699 </p><p><a href="http://en.wikipedia.org/wiki/Foo" class="extiw" title="wikipedia:Foo">Bar</a>
4700 </p><p><a href="http://en.wikipedia.org/wiki/Foo" class="extiw" title="wikipedia:Foo"><span>Bar</span></a>
4701 </p>
4702 !! html/parsoid
4703 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo"></a></p>
4704 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo" title="wikipedia:Foo">Bar</a></p>
4705 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo" title="wikipedia:Foo"><span>Bar</span></a></p>
4706 !! end
4708 !! test
4709 External links: Free with trailing punctuation
4710 !! wikitext
4711 http://example.com,
4712 http://example.com;
4713 http://example.com\
4714 http://example.com.
4715 http://example.com:
4716 http://example.com!
4717 http://example.com?
4718 http://example.com)
4719 http://example.com/url_with_(brackets)
4720 (http://example.com/url_without_brackets)
4721 http://example.com/url_with_entity&amp;
4722 http://example.com/url_with_entity&#x26;
4723 http://example.com/url_with_entity&#038;
4724 http://example.com/url_with_entity&nbsp;
4725 http://example.com/url_with_entity&#xA0;
4726 http://example.com/url_with_entity&#160;
4727 http://example.com/url_with_entity&lt;
4728 http://example.com/url_with_entity&#x3C;
4729 http://example.com/url_with_entity&#60;
4730 !! html/php
4731 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>,
4732 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>;
4733 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>\
4734 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>.
4735 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>:
4736 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>!
4737 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>?
4738 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
4739 <a rel="nofollow" class="external free" href="http://example.com/url_with_(brackets)">http://example.com/url_with_(brackets)</a>
4740 (<a rel="nofollow" class="external free" href="http://example.com/url_without_brackets">http://example.com/url_without_brackets</a>)
4741 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
4742 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
4743 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
4744 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&#160;
4745 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&#xa0;
4746 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&#160;
4747 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&lt;
4748 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&#x3c;
4749 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&#60;
4750 </p>
4751 !! html/parsoid
4752 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a>,
4753 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>;
4754 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>\
4755 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>.
4756 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>:
4757 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>!
4758 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>?
4759 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>)
4760 <a rel="mw:ExtLink" href="http://example.com/url_with_(brackets)">http://example.com/url_with_(brackets)</a>
4761 (<a rel="mw:ExtLink" href="http://example.com/url_without_brackets">http://example.com/url_without_brackets</a>)
4762 <a rel="mw:ExtLink" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
4763 <a rel="mw:ExtLink" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
4764 <a rel="mw:ExtLink" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
4765 <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>
4766 <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>
4767 <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>
4768 <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>
4769 <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>
4770 <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>
4771 !! end
4773 !! test
4774 External links: tricky Parsoid html2html case
4775 !! options
4776 parsoid=wt2html,wt2wt,html2html
4777 !! wikitext
4778 http://example.com/url_with_entity&amp;amp;
4779 !! html/php
4780 <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>;
4781 </p>
4782 !! html/parsoid
4783 <p><a rel="mw:ExtLink" href="http://example.com/url_with_entity&amp;amp">http://example.com/url_with_entity&amp;amp</a>;</p>
4784 !! end
4786 !! test
4787 External links: Free with trailing quotes (T113666)
4788 !! wikitext
4789 '''News:''' Stuff here
4791 news:'a'b''c''d e
4792 !! html/php
4793 <p><b>News:</b> Stuff here
4794 </p><p><a rel="nofollow" class="external free" href="news:'a'b">news:'a'b</a><i>c</i>d e
4795 </p>
4796 !! html/parsoid
4797 <p><b>News:</b> Stuff here</p>
4798 <p><a rel="mw:ExtLink" href="news:'a'b">news:'a'b</a><i>c</i>d e</p>
4799 !! end
4801 !! test
4802 External links: Lone protocols are never linked (T105697)
4803 !! wikitext
4804 http://
4805 http://;
4806 (http://)
4807 bitcoin:
4808 bitcoin:;
4809 (bitcoin:)
4810 !! html
4811 <p>http://
4812 http://;
4813 (http://)
4814 bitcoin:
4815 bitcoin:;
4816 (bitcoin:)
4817 </p>
4818 !! end
4820 !! test
4821 External links: No preceding word characters allowed (bug 65278)
4822 !! wikitext
4823 NOPEhttp://example.com
4824 N0http://example.com
4825 ok:http://example.com
4826 ok-http://example.com
4827 !! html
4828 <p>NOPEhttp://example.com
4829 N0http://example.com
4830 ok:<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4831 ok-<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4832 </p>
4833 !! end
4835 !! test
4836 External links: nofollow domain exception
4837 !! wikitext
4838 A [https://no-nofollow.org/foobar link], and another [https://example.org link].
4839 !! html
4840 <p>A <a class="external text" href="https://no-nofollow.org/foobar">link</a>, and another <a rel="nofollow" class="external text" href="https://example.org">link</a>.
4841 </p>
4842 !!end
4844 !! test
4845 External image
4846 !! wikitext
4847 External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
4848 !! html
4849 <p>External image: <img src="http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png"/>
4850 </p>
4851 !! end
4853 !! test
4854 External image from https
4855 !! wikitext
4856 External image from https: https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
4857 !! html
4858 <p>External image from https: <img src="https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png"/>
4859 </p>
4860 !! end
4862 !! test
4863 External image (when not allowed)
4864 !! options
4865 wgAllowExternalImages=0
4866 !! wikitext
4867 External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
4868 !! html
4869 <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>
4870 </p>
4871 !! end
4873 !! test
4874 Link to non-http image, no img tag
4875 !! wikitext
4876 Link to non-http image, no img tag: ftp://example.com/test.jpg
4877 !! html
4878 <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>
4879 </p>
4880 !! end
4882 !! test
4883 External links: terminating separator
4884 !! wikitext
4885 Terminating separator: http://example.com/thing,
4886 !! html
4887 <p>Terminating separator: <a rel="nofollow" class="external free" href="http://example.com/thing">http://example.com/thing</a>,
4888 </p>
4889 !! end
4891 !! test
4892 External links: intervening separator
4893 !! wikitext
4894 Intervening separator: http://example.com/1,2,3
4895 !! html
4896 <p>Intervening separator: <a rel="nofollow" class="external free" href="http://example.com/1,2,3">http://example.com/1,2,3</a>
4897 </p>
4898 !! end
4900 !! test
4901 External links: old bug with URL in query
4902 !! wikitext
4903 Old bug with URL in query: [http://example.com/thing?url=http://example.com link]
4904 !! html
4905 <p>Old bug with URL in query: <a rel="nofollow" class="external text" href="http://example.com/thing?url=http://example.com">link</a>
4906 </p>
4907 !! end
4909 !! test
4910 External links: old URL-in-URL bug, mixed protocols
4911 !! wikitext
4912 And again with mixed protocols: [ftp://example.com?url=http://example.com link]
4913 !! html
4914 <p>And again with mixed protocols: <a rel="nofollow" class="external text" href="ftp://example.com?url=http://example.com">link</a>
4915 </p>
4916 !!end
4918 # Since Parsoid is starting to emit canonical wikitext for links,
4919 # [http://example.com http://example.com] will not RT back to that
4920 # form anymore.
4921 !! test
4922 External links: URL in text
4923 !! options
4924 parsoid=wt2html
4925 !! wikitext
4926 URL in text: [http://example.com http://example.com]
4927 !! html/php
4928 <p>URL in text: <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4929 </p>
4930 !! html/parsoid
4931 <p>URL in text: <a rel="mw:ExtLink" href="http://example.com">http://example.com</a></p>
4932 !! end
4934 !! test
4935 External links: Clickable images
4936 !! wikitext
4937 ja-style clickable images: [http://example.com http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png]
4938 !! html/php
4939 <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>
4940 </p>
4941 !! html/parsoid
4942 <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>
4943 !! end
4945 !! test
4946 External links: raw ampersand
4947 !! wikitext
4948 Old &amp; use: http://x&y
4949 !! html
4950 <p>Old &amp; use: <a rel="nofollow" class="external free" href="http://x&amp;y">http://x&amp;y</a>
4951 </p>
4952 !! end
4954 !! test
4955 External links: encoded ampersand
4956 !! wikitext
4957 Old &amp; use: http://x&amp;y
4958 !! html/php
4959 <p>Old &amp; use: <a rel="nofollow" class="external free" href="http://x&amp;y">http://x&amp;y</a>
4960 </p>
4961 !! html/parsoid
4962 <p>Old <span typeof="mw:Entity">&amp;</span> use: <a rel="mw:ExtLink" href="http://x&amp;y">http://x&amp;y</a></p>
4963 !! end
4965 !! test
4966 External links: encoded equals (bug 6102)
4967 !! wikitext
4968 http://example.com/?foo&#61;bar
4969 !! html/php
4970 <p><a rel="nofollow" class="external free" href="http://example.com/?foo=bar">http://example.com/?foo=bar</a>
4971 </p>
4972 !! html/parsoid
4973 <p><a rel="mw:ExtLink" href="http://example.com/?foo=bar">http://example.com/?foo=bar</a></p>
4974 !! end
4977 ## Note that parsoid doesn't explicit mark autonumbered links, nor
4978 ## does it number them.  As discussed in bug 53505, we can identify
4979 ## autonumbered links via CSS.
4982 !! test
4983 External links: [raw ampersand]
4984 !! wikitext
4985 Old &amp; use: [http://x&y]
4986 !! html/php
4987 <p>Old &amp; use: <a rel="nofollow" class="external autonumber" href="http://x&amp;y">[1]</a>
4988 </p>
4989 !! html/parsoid
4990 <p>Old <span typeof="mw:Entity">&amp;</span> use: <a rel="mw:ExtLink" href="http://x&amp;y"></a></p>
4991 !! end
4993 # note that parsoid html is identical to [raw ampersand] case; so html2wt
4994 # mode will return the [raw ampersand] wikitext
4995 !! test
4996 External links: [encoded ampersand]
4997 !! options
4998 parsoid=wt2html,wt2wt,html2html
4999 !! wikitext
5000 Old &amp; use: [http://x&amp;y]
5001 !! html/php
5002 <p>Old &amp; use: <a rel="nofollow" class="external autonumber" href="http://x&amp;y">[1]</a>
5003 </p>
5004 !! html/parsoid
5005 <p>Old <span typeof="mw:Entity">&amp;</span> use: <a rel="mw:ExtLink" href="http://x&amp;y"></a></p>
5006 !! end
5008 !! test
5009 External links: [raw equals]
5010 !! wikitext
5011 [http://example.com/?foo=bar]
5012 !! html/php
5013 <p><a rel="nofollow" class="external autonumber" href="http://example.com/?foo=bar">[1]</a>
5014 </p>
5015 !! html/parsoid
5016 <p><a rel="mw:ExtLink" href="http://example.com/?foo=bar"></a></p>
5017 !! end
5019 # note that parsoid html is identical to [raw equals] case; so html2wt
5020 # mode will return the [raw equals] wikitext
5021 !! test
5022 External links: [encoded equals] (bug 6102)
5023 !! options
5024 parsoid=wt2html,wt2wt,html2html
5025 !! wikitext
5026 [http://example.com/?foo&#61;bar]
5027 !! html/php
5028 <p><a rel="nofollow" class="external autonumber" href="http://example.com/?foo=bar">[1]</a>
5029 </p>
5030 !! html/parsoid
5031 <p><a rel="mw:ExtLink" href="http://example.com/?foo=bar"></a></p>
5032 !! end
5034 # xxx parsoid strips the IDN character, so the round-trip tests will
5035 #     obviously fail and are disabled. --cscott
5036 !! test
5037 External links: [IDN ignored character reference in hostname; strip it right off]
5038 !! options
5039 parsoid=wt2html,wt2wt,html2html
5040 !! wikitext
5041 [http://e&zwnj;xample.com/]
5042 !! html/php
5043 <p><a rel="nofollow" class="external autonumber" href="http://example.com/">[1]</a>
5044 </p>
5045 !! html/parsoid
5046 <p><a rel="mw:ExtLink" href="http://example.com/"></a></p>
5047 !! end
5049 # FIXME: This test (the IDN characters in the text of a link) is an inconsistency.
5050 # Where an external link could easily circumvent the sanitization of the text of
5051 # a link like this (where an IDN-ignore character is in the URL somewhere), this
5052 # test demands a higher standard. That's a bit strange.
5054 # Example:
5056 # http://e‌xample.com -> [http://example.com|http://example.com]
5057 # [http://example.com|http://e‌xample.com] -> [http://example.com|http://e‌xample.com]
5059 # The first example is sanitized, but the second is not. Any security benefits
5060 # from this production are trivial to circumvent. Either remove this test and
5061 # let the parser(s) do their thing unaccosted, or fix the inconsistency and change
5062 # the test accordingly.
5064 # All our love,
5065 # The Parsoid team.
5066 # xxx parsoid strips the IDN character, so the round-trip tests will
5067 #     obviously fail and are disabled. --cscott
5068 !! test
5069 External links: IDN ignored character reference in hostname; strip it right off
5070 !! options
5071 parsoid=wt2html,html2html
5072 !! wikitext
5073 http://e&zwnj;xample.com/
5074 !! html/php
5075 <p><a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>
5076 </p>
5077 !! html/parsoid
5078 <p><a rel="mw:ExtLink" href="http://example.com/">http://example.com/</a></p>
5079 !! end
5081 !! test
5082 External links: www.jpeg.org (bug 554)
5083 !! wikitext
5084 http://www.jpeg.org
5085 !! html
5086 <p><a rel="nofollow" class="external free" href="http://www.jpeg.org">http://www.jpeg.org</a>
5087 </p>
5088 !! end
5090 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
5091 !! test
5092 External links: URL within URL (original bug 2)
5093 !! wikitext
5094 [http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp]
5095 !! html/php
5096 <p><a rel="nofollow" class="external autonumber" href="http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp">[1]</a>
5097 </p>
5098 !! html/parsoid
5099 <p><a rel="mw:ExtLink" href="http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp"></a></p>
5100 !! end
5102 !! test
5103 BUG 361: URL inside bracketed URL
5104 !! wikitext
5105 [http://www.example.com/foo http://www.example.com/bar]
5106 !! html
5107 <p><a rel="nofollow" class="external text" href="http://www.example.com/foo">http://www.example.com/bar</a>
5108 </p>
5109 !! end
5111 !! test
5112 BUG 361: URL within URL, not bracketed
5113 !! wikitext
5114 http://www.example.com/foo?=http://www.example.com/bar
5115 !! html
5116 <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>
5117 </p>
5118 !! end
5120 !! test
5121 BUG 289: ">"-token in URL-tail
5122 !! wikitext
5123 http://www.example.com/<hello>
5124 !! html
5125 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a>&lt;hello&gt;
5126 </p>
5127 !!end
5129 !! test
5130 BUG 289: literal ">"-token in URL-tail
5131 !! wikitext
5132 http://www.example.com/<b>html</b>
5133 !! html/php
5134 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a><b>html</b>
5135 </p>
5136 !! html/parsoid
5137 <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>
5138 !! end
5140 !! test
5141 BUG 289: ">"-token in bracketed URL
5142 !! wikitext
5143 [http://www.example.com/<hello> stuff]
5144 !! html
5145 <p><a rel="nofollow" class="external text" href="http://www.example.com/">&lt;hello&gt; stuff</a>
5146 </p>
5147 !!end
5149 !! test
5150 BUG 289: literal ">"-token in bracketed URL
5151 !! wikitext
5152 [http://www.example.com/<b>html</b> stuff]
5153 !! html
5154 <p><a rel="nofollow" class="external text" href="http://www.example.com/"><b>html</b> stuff</a>
5155 </p>
5156 !!end
5158 !! test
5159 BUG 289: literal double quote at end of URL
5160 !! wikitext
5161 http://www.example.com/"hello"
5162 !! html
5163 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a>"hello"
5164 </p>
5165 !!end
5167 !! test
5168 BUG 289: literal double quote in bracketed URL
5169 !! wikitext
5170 [http://www.example.com/"hello" stuff]
5171 !! html
5172 <p><a rel="nofollow" class="external text" href="http://www.example.com/">"hello" stuff</a>
5173 </p>
5174 !!end
5176 !! test
5177 External links: multiple legal whitespace is fine, Magnus. Don't break it please. (bug 5081)
5178 !! wikitext
5179 [http://www.example.com  test]
5180 !! html
5181 <p><a rel="nofollow" class="external text" href="http://www.example.com">test</a>
5182 </p>
5183 !! end
5185 !! test
5186 External links: link text with spaces
5187 !! wikitext
5188 [http://www.example.com a b c]
5189 [http://www.example.com ''a'' ''b'']
5190 !! html
5191 <p><a rel="nofollow" class="external text" href="http://www.example.com">a b c</a>
5192 <a rel="nofollow" class="external text" href="http://www.example.com"><i>a</i> <i>b</i></a>
5193 </p>
5194 !! end
5196 !! test
5197 External links: wiki links within external link (Bug 3695)
5198 !! options
5199 parsoid=wt2html,html2html
5200 !! wikitext
5201 [http://example.com [[wikilink]] embedded in ext link]
5202 !! html/php
5203 <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>
5204 </p>
5205 !! html/parsoid
5206 <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>
5207 !! end
5209 !! test
5210 BUG 787: Links with one slash after the url protocol are invalid
5211 !! wikitext
5212 http:/example.com
5214 [http:/example.com title]
5215 !! html
5216 <p>http:/example.com
5217 </p><p>[http:/example.com title]
5218 </p>
5219 !! end
5221 !! test
5222 Bracketed external links with template-generated invalid target
5223 !! wikitext
5224 [{{echo|http:/example.com}} title]
5225 !! html
5226 <p>[http:/example.com title]
5227 </p>
5228 !! end
5230 !! test
5231 Bug 2702: Mismatched <i>, <b> and <a> tags are invalid
5232 !! wikitext
5233 ''[http://example.com text'']
5234 [http://example.com '''text]'''
5235 ''Something [http://example.com in italic'']
5236 ''Something [http://example.com mixed''''', even bold]'''
5237 '''''Now [http://example.com both''''']
5238 !! html
5239 <p><a rel="nofollow" class="external text" href="http://example.com"><i>text</i></a>
5240 <a rel="nofollow" class="external text" href="http://example.com"><b>text</b></a>
5241 <i>Something </i><a rel="nofollow" class="external text" href="http://example.com"><i>in italic</i></a>
5242 <i>Something </i><a rel="nofollow" class="external text" href="http://example.com"><i>mixed</i><b>, even bold</b></a>
5243 <i><b>Now </b></i><a rel="nofollow" class="external text" href="http://example.com"><i><b>both</b></i></a>
5244 </p>
5245 !! end
5248 !! test
5249 Bug 4781: %26 in URL
5250 !! wikitext
5251 http://www.example.com/?title=AT%26T
5252 !! html/php
5253 <p><a rel="nofollow" class="external free" href="http://www.example.com/?title=AT%26T">http://www.example.com/?title=AT%26T</a>
5254 </p>
5255 !! html/parsoid
5256 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=AT%26T">http://www.example.com/?title=AT%26T</a></p>
5257 !! end
5259 # According to https://www.w3.org/TR/2011/WD-html5-20110525/Overview.html#parsing-urls a plain
5260 # % is actually legal in HTML5. Any change in output would need testing though.
5261 !! test
5262 Bug 4781, 5267: %25 in URL
5263 !! wikitext
5264 http://www.example.com/?title=100%25_Bran
5265 !! html/php
5266 <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>
5267 </p>
5268 !! html/parsoid
5269 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=100%25_Bran">http://www.example.com/?title=100%25_Bran</a></p>
5270 !! end
5272 !! test
5273 Bug 4781, 5267: %28, %29 in URL
5274 !! wikitext
5275 http://www.example.com/?title=Ben-Hur_%281959_film%29
5276 !! html/php
5277 <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>
5278 </p>
5279 !! html/parsoid
5280 <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>
5281 !! end
5284 !! test
5285 Bug 4781: %26 in autonumber URL
5286 !! wikitext
5287 [http://www.example.com/?title=AT%26T]
5288 !! html/php
5289 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=AT%26T">[1]</a>
5290 </p>
5291 !! html/parsoid
5292 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=AT%26T"></a></p>
5293 !! end
5295 !! test
5296 Bug 4781, 5267: %26 in autonumber URL
5297 !! wikitext
5298 [http://www.example.com/?title=100%25_Bran]
5299 !! html/php
5300 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=100%25_Bran">[1]</a>
5301 </p>
5302 !! html/parsoid
5303 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=100%25_Bran"></a></p>
5304 !! end
5306 !! test
5307 Bug 4781, 5267: %28, %29 in autonumber URL
5308 !! wikitext
5309 [http://www.example.com/?title=Ben-Hur_%281959_film%29]
5310 !! html/php
5311 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">[1]</a>
5312 </p>
5313 !! html/parsoid
5314 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=Ben-Hur_%281959_film%29"></a></p>
5315 !! end
5318 !! test
5319 Bug 4781: %26 in bracketed URL
5320 !! wikitext
5321 [http://www.example.com/?title=AT%26T link]
5322 !! html/php
5323 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=AT%26T">link</a>
5324 </p>
5325 !! html/parsoid
5326 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=AT%26T">link</a></p>
5327 !! end
5329 !! test
5330 Bug 4781, 5267: %25 in bracketed URL
5331 !! wikitext
5332 [http://www.example.com/?title=100%25_Bran link]
5333 !! html
5334 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=100%25_Bran">link</a>
5335 </p>
5336 !! end
5338 !! test
5339 Bug 4781, 5267: %28, %29 in bracketed URL
5340 !! wikitext
5341 [http://www.example.com/?title=Ben-Hur_%281959_film%29 link]
5342 !! html/php
5343 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">link</a>
5344 </p>
5345 !! html/parsoid
5346 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">link</a></p>
5347 !! end
5349 !! test
5350 External link containing a period in the anchor. (bug 63947)
5351 !! wikitext
5352 [//foo.org/bar#baz. bang]
5354 [//foo.org/bar. bang]
5355 !! html/php
5356 <p><a rel="nofollow" class="external text" href="//foo.org/bar#baz.">bang</a>
5357 </p><p><a rel="nofollow" class="external text" href="//foo.org/bar.">bang</a>
5358 </p>
5359 !! html/parsoid
5360 <p><a rel="mw:ExtLink" href="//foo.org/bar#baz.">bang</a></p>
5361 <p><a rel="mw:ExtLink" href="//foo.org/bar.">bang</a></p>
5362 !! end
5364 !! test
5365 External link containing a single quote. (bug 63947)
5366 !! wikitext
5367 [//foo.org/bar'baz]
5369 [//foo.org/bar'baz bang]
5370 !! html/php
5371 <p><a rel="nofollow" class="external autonumber" href="//foo.org/bar'baz">[1]</a>
5372 </p><p><a rel="nofollow" class="external text" href="//foo.org/bar'baz">bang</a>
5373 </p>
5374 !! html/parsoid
5375 <p><a rel="mw:ExtLink" href="//foo.org/bar'baz"></a></p>
5376 <p><a rel="mw:ExtLink" href="//foo.org/bar'baz">bang</a></p>
5377 !! end
5379 !! test
5380 External link containing double-single-quotes in text '' (bug 4598 sanity check)
5381 !! wikitext
5382 Some [http://example.com/ pretty ''italics'' and stuff]!
5383 !! html
5384 <p>Some <a rel="nofollow" class="external text" href="http://example.com/">pretty <i>italics</i> and stuff</a>!
5385 </p>
5386 !! end
5388 !! test
5389 External link containing double-single-quotes in text embedded in italics (bug 4598 sanity check)
5390 !! wikitext
5391 ''Some [http://example.com/ pretty ''italics'' and stuff]!''
5392 !! html
5393 <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>
5394 </p>
5395 !! end
5397 !! test
5398 External link containing double-single-quotes with no space separating the url from text in italics
5399 !! wikitext
5400 [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]].]
5401 !! html/php
5402 <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>
5403 </p>
5404 !! html/php+tidy
5405 <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>
5406 !! html/parsoid
5407 <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>
5408 !! end
5410 !! test
5411 External link with comments in link text
5412 !! wikitext
5413 [http://www.google.com Google <!-- comment -->]
5414 !! html/php
5415 <p><a rel="nofollow" class="external text" href="http://www.google.com">Google </a>
5416 </p>
5417 !! html/parsoid
5418 <p><a rel="mw:ExtLink" href="http://www.google.com">Google <!-- comment --></a></p>
5419 !! end
5421 !! test
5422 External link to bare IPv4 address
5423 !! wikitext
5424 [http://192.168.0.1 Link]
5425 !! html/php
5426 <p><a rel="nofollow" class="external text" href="http://192.168.0.1">Link</a>
5427 </p>
5428 !! html/parsoid
5429 <p><a rel="mw:ExtLink" href="http://192.168.0.1">Link</a></p>
5430 !! end
5432 !! test
5433 URL-encoding in URL functions (single parameter)
5434 !! wikitext
5435 {{localurl:Some page|amp=&}}
5436 !! html
5437 <p>/index.php?title=Some_page&amp;amp=&amp;
5438 </p>
5439 !! end
5441 !! test
5442 URL-encoding in URL functions (multiple parameters)
5443 !! wikitext
5444 {{localurl:Some page|q=?&amp=&}}
5445 !! html
5446 <p>/index.php?title=Some_page&amp;q=?&amp;amp=&amp;
5447 </p>
5448 !! end
5450 !! test
5451 Brackets in urls
5452 !! wikitext
5453 http://example.com/index.php?foozoid%5B%5D=bar
5455 http://example.com/index.php?foozoid&#x5B;&#x5D;=bar
5456 !! html/php
5457 <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>
5458 </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>
5459 </p>
5460 !! html/parsoid
5461 <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>
5463 <p><a rel="mw:ExtLink" href="http://example.com/index.php?foozoid[]=bar">http://example.com/index.php?foozoid[]=bar</a></p>
5464 !! end
5466 !! test
5467 IPv6 urls, autolink format (T23261)
5468 !! wikitext
5469 http://[2404:130:0:1000::187:2]/index.php
5471 Examples from RFC 2373, section 2.2:
5472 * http://[1080::8:800:200C:417A]/unicast
5473 * http://[FF01::101]/multicast
5474 * http://[::1]/loopback
5475 * http://[::]/unspecified
5476 * http://[::13.1.68.3]/ipv4compat
5477 * http://[::FFFF:129.144.52.38]/ipv4compat
5479 Examples from RFC 2732, section 2:
5480 * http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html
5481 * http://[1080:0:0:0:8:800:200C:417A]/index.html
5482 * http://[3ffe:2a00:100:7031::1]
5483 * http://[1080::8:800:200C:417A]/foo
5484 * http://[::192.9.5.5]/ipng
5485 * http://[::FFFF:129.144.52.38]:80/index.html
5486 * http://[2010:836B:4179::836B:4179]
5488 !! html/php
5489 <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>
5490 </p><p>Examples from <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc2373">RFC 2373</a>, section 2.2:
5491 </p>
5492 <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>
5493 <li> <a rel="nofollow" class="external free" href="http://[FF01::101]/multicast">http://[FF01::101]/multicast</a></li>
5494 <li> <a rel="nofollow" class="external free" href="http://[::1]/loopback">http://[::1]/loopback</a></li>
5495 <li> <a rel="nofollow" class="external free" href="http://[::]/unspecified">http://[::]/unspecified</a></li>
5496 <li> <a rel="nofollow" class="external free" href="http://[::13.1.68.3]/ipv4compat">http://[::13.1.68.3]/ipv4compat</a></li>
5497 <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>
5498 <p>Examples from <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc2732">RFC 2732</a>, section 2:
5499 </p>
5500 <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>
5501 <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>
5502 <li> <a rel="nofollow" class="external free" href="http://[3ffe:2a00:100:7031::1]">http://[3ffe:2a00:100:7031::1]</a></li>
5503 <li> <a rel="nofollow" class="external free" href="http://[1080::8:800:200C:417A]/foo">http://[1080::8:800:200C:417A]/foo</a></li>
5504 <li> <a rel="nofollow" class="external free" href="http://[::192.9.5.5]/ipng">http://[::192.9.5.5]/ipng</a></li>
5505 <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>
5506 <li> <a rel="nofollow" class="external free" href="http://[2010:836B:4179::836B:4179]">http://[2010:836B:4179::836B:4179]</a></li></ul>
5508 !! html/parsoid
5509 <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>
5511 <p>Examples from <a href="//tools.ietf.org/html/rfc2373" rel="mw:ExtLink">RFC 2373</a>, section 2.2:</p>
5512 <ul><li> <a rel="mw:ExtLink" href="http://[1080::8:800:200C:417A]/unicast">http://[1080::8:800:200C:417A]/unicast</a></li>
5513 <li> <a rel="mw:ExtLink" href="http://[FF01::101]/multicast">http://[FF01::101]/multicast</a></li>
5514 <li> <a rel="mw:ExtLink" href="http://[::1]/loopback">http://[::1]/loopback</a></li>
5515 <li> <a rel="mw:ExtLink" href="http://[::]/unspecified">http://[::]/unspecified</a></li>
5516 <li> <a rel="mw:ExtLink" href="http://[::13.1.68.3]/ipv4compat">http://[::13.1.68.3]/ipv4compat</a></li>
5517 <li> <a rel="mw:ExtLink" href="http://[::FFFF:129.144.52.38]/ipv4compat">http://[::FFFF:129.144.52.38]/ipv4compat</a></li></ul>
5519 <p>Examples from <a href="//tools.ietf.org/html/rfc2732" rel="mw:ExtLink">RFC 2732</a>, section 2:</p>
5520 <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>
5521 <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>
5522 <li> <a rel="mw:ExtLink" href="http://[3ffe:2a00:100:7031::1]">http://[3ffe:2a00:100:7031::1]</a></li>
5523 <li> <a rel="mw:ExtLink" href="http://[1080::8:800:200C:417A]/foo">http://[1080::8:800:200C:417A]/foo</a></li>
5524 <li> <a rel="mw:ExtLink" href="http://[::192.9.5.5]/ipng">http://[::192.9.5.5]/ipng</a></li>
5525 <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>
5526 <li> <a rel="mw:ExtLink" href="http://[2010:836B:4179::836B:4179]">http://[2010:836B:4179::836B:4179]</a></li></ul>
5527 !! end
5529 !! test
5530 IPv6 urls, bracketed format (T23261)
5531 !! wikitext
5532 [http://[2404:130:0:1000::187:2]/index.php test]
5534 Examples from RFC 2373, section 2.2:
5535 * [http://[1080::8:800:200C:417A] unicast]
5536 * [http://[FF01::101] multicast]
5537 * [http://[::1]/ loopback]
5538 * [http://[::] unspecified]
5539 * [http://[::13.1.68.3] ipv4compat]
5540 * [http://[::FFFF:129.144.52.38] ipv4compat]
5542 Examples from RFC 2732, section 2:
5543 * [http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html 1]
5544 * [http://[1080:0:0:0:8:800:200C:417A]/index.html 2]
5545 * [http://[3ffe:2a00:100:7031::1] 3]
5546 * [http://[1080::8:800:200C:417A]/foo 4]
5547 * [http://[::192.9.5.5]/ipng 5]
5548 * [http://[::FFFF:129.144.52.38]:80/index.html 6]
5549 * [http://[2010:836B:4179::836B:4179] 7]
5551 !! html/php
5552 <p><a rel="nofollow" class="external text" href="http://[2404:130:0:1000::187:2]/index.php">test</a>
5553 </p><p>Examples from <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc2373">RFC 2373</a>, section 2.2:
5554 </p>
5555 <ul><li> <a rel="nofollow" class="external text" href="http://[1080::8:800:200C:417A]">unicast</a></li>
5556 <li> <a rel="nofollow" class="external text" href="http://[FF01::101]">multicast</a></li>
5557 <li> <a rel="nofollow" class="external text" href="http://[::1]/">loopback</a></li>
5558 <li> <a rel="nofollow" class="external text" href="http://[::]">unspecified</a></li>
5559 <li> <a rel="nofollow" class="external text" href="http://[::13.1.68.3]">ipv4compat</a></li>
5560 <li> <a rel="nofollow" class="external text" href="http://[::FFFF:129.144.52.38]">ipv4compat</a></li></ul>
5561 <p>Examples from <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc2732">RFC 2732</a>, section 2:
5562 </p>
5563 <ul><li> <a rel="nofollow" class="external text" href="http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html">1</a></li>
5564 <li> <a rel="nofollow" class="external text" href="http://[1080:0:0:0:8:800:200C:417A]/index.html">2</a></li>
5565 <li> <a rel="nofollow" class="external text" href="http://[3ffe:2a00:100:7031::1]">3</a></li>
5566 <li> <a rel="nofollow" class="external text" href="http://[1080::8:800:200C:417A]/foo">4</a></li>
5567 <li> <a rel="nofollow" class="external text" href="http://[::192.9.5.5]/ipng">5</a></li>
5568 <li> <a rel="nofollow" class="external text" href="http://[::FFFF:129.144.52.38]:80/index.html">6</a></li>
5569 <li> <a rel="nofollow" class="external text" href="http://[2010:836B:4179::836B:4179]">7</a></li></ul>
5571 !! html/parsoid
5572 <p><a rel="mw:ExtLink" href="http://[2404:130:0:1000::187:2]/index.php">test</a></p>
5574 <p>Examples from <a href="//tools.ietf.org/html/rfc2373" rel="mw:ExtLink">RFC 2373</a>, section 2.2:</p>
5575 <ul><li> <a rel="mw:ExtLink" href="http://[1080::8:800:200C:417A]">unicast</a></li>
5576 <li> <a rel="mw:ExtLink" href="http://[FF01::101]">multicast</a></li>
5577 <li> <a rel="mw:ExtLink" href="http://[::1]/">loopback</a></li>
5578 <li> <a rel="mw:ExtLink" href="http://[::]">unspecified</a></li>
5579 <li> <a rel="mw:ExtLink" href="http://[::13.1.68.3]">ipv4compat</a></li>
5580 <li> <a rel="mw:ExtLink" href="http://[::FFFF:129.144.52.38]">ipv4compat</a></li></ul>
5582 <p>Examples from <a href="//tools.ietf.org/html/rfc2732" rel="mw:ExtLink">RFC 2732</a>, section 2:</p>
5583 <ul><li> <a rel="mw:ExtLink" href="http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html">1</a></li>
5584 <li> <a rel="mw:ExtLink" href="http://[1080:0:0:0:8:800:200C:417A]/index.html">2</a></li>
5585 <li> <a rel="mw:ExtLink" href="http://[3ffe:2a00:100:7031::1]">3</a></li>
5586 <li> <a rel="mw:ExtLink" href="http://[1080::8:800:200C:417A]/foo">4</a></li>
5587 <li> <a rel="mw:ExtLink" href="http://[::192.9.5.5]/ipng">5</a></li>
5588 <li> <a rel="mw:ExtLink" href="http://[::FFFF:129.144.52.38]:80/index.html">6</a></li>
5589 <li> <a rel="mw:ExtLink" href="http://[2010:836B:4179::836B:4179]">7</a></li></ul>
5590 !! end
5592 !! test
5593 Non-extlinks in brackets
5594 !! wikitext
5595 [foo]
5596 [foo bar]
5597 [foo ''bar'']
5598 [fool's] errand
5599 [fool's errand]
5600 [{{echo|foo}}]
5601 [{{echo|foo}} bar]
5602 [{{echo|foo}} ''bar'']
5603 [{{echo|foo}}l's] errand
5604 [{{echo|foo}}l's errand]
5605 [url={{echo|foo}}]
5606 [url=http://example.com]
5607 [http:// bare protocols don't count]
5608 !! html/php
5609 <p>[foo]
5610 [foo bar]
5611 [foo <i>bar</i>]
5612 [fool's] errand
5613 [fool's errand]
5614 [foo]
5615 [foo bar]
5616 [foo <i>bar</i>]
5617 [fool's] errand
5618 [fool's errand]
5619 [url=foo]
5620 [url=<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>]
5621 [http:// bare protocols don't count]
5622 </p>
5623 !! html/parsoid
5624 <p>[foo]
5625 [foo bar]
5626 [foo <i>bar</i>]
5627 [fool's] errand
5628 [fool's errand]
5629 [<span typeof="mw:Placeholder" data-parsoid='{"src":"{{echo|foo}}"}'>foo</span>]
5630 [<span typeof="mw:Placeholder" data-parsoid='{"src":"{{echo|foo}}"}'>foo</span> bar]
5631 [<span typeof="mw:Placeholder" data-parsoid='{"src":"{{echo|foo}}"}'>foo</span> <i>bar</i>]
5632 [<span typeof="mw:Placeholder" data-parsoid='{"src":"{{echo|foo}}l&#39;s"}'>fool's</span>] errand
5633 [<span typeof="mw:Placeholder" data-parsoid='{"src":"{{echo|foo}}l&#39;s"}'>fool's</span> errand]
5634 [<span typeof="mw:Placeholder" data-parsoid='{"src":"url={{echo|foo}}"}'>url=foo</span>]
5635 [url=<a rel="mw:ExtLink" href="http://example.com">http://example.com</a>]
5636 [http:// bare protocols don't count]</p>
5637 !! end
5639 !! test
5640 Percent encoding in external links
5641 !! wikitext
5642 [https://github.com/search?l=&q=ResourceLoader+%40wikimedia Search]
5643 !! html/php
5644 <p><a rel="nofollow" class="external text" href="https://github.com/search?l=&amp;q=ResourceLoader+%40wikimedia">Search</a>
5645 </p>
5646 !! html/parsoid
5647 <p><a rel="mw:ExtLink"
5648 href="https://github.com/search?l=&amp;q=ResourceLoader+%40wikimedia">Search</a></p>
5649 !! end
5651 !! test
5652 Use url link syntax for links where the content is equal the link target
5653 !! wikitext
5654 http://example.com
5655 !! html/php
5656 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
5657 </p>
5658 !! html/parsoid
5659 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a></p>
5660 !! end
5662 !! test
5663 Parenthesis in external links, especially URL links
5664 !! wikitext
5665 http://example.com)
5667 http://example.com/test)
5669 http://example.com/(test)
5671 http://example.com/((test)
5673 (http://example.com/(test))
5675 (http://example.com/(test)))))
5677 http://example.com/a)b
5679 [http://example.com) foo]
5680 !! html/php
5681 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
5682 </p><p><a rel="nofollow" class="external free" href="http://example.com/test">http://example.com/test</a>)
5683 </p><p><a rel="nofollow" class="external free" href="http://example.com/(test)">http://example.com/(test)</a>
5684 </p><p><a rel="nofollow" class="external free" href="http://example.com/((test)">http://example.com/((test)</a>
5685 </p><p>(<a rel="nofollow" class="external free" href="http://example.com/(test))">http://example.com/(test))</a>
5686 </p><p>(<a rel="nofollow" class="external free" href="http://example.com/(test)))))">http://example.com/(test)))))</a>
5687 </p><p><a rel="nofollow" class="external free" href="http://example.com/a)b">http://example.com/a)b</a>
5688 </p><p><a rel="nofollow" class="external text" href="http://example.com)">foo</a>
5689 </p>
5690 !! html/parsoid
5691 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a>)</p>
5692 <p><a rel="mw:ExtLink" href="http://example.com/test">http://example.com/test</a>)</p>
5693 <p><a rel="mw:ExtLink" href="http://example.com/(test)">http://example.com/(test)</a></p>
5694 <p><a rel="mw:ExtLink" href="http://example.com/((test)">http://example.com/((test)</a></p>
5695 <p>(<a rel="mw:ExtLink" href="http://example.com/(test))">http://example.com/(test))</a></p>
5696 <p>(<a rel="mw:ExtLink" href="http://example.com/(test)))))">http://example.com/(test)))))</a></p>
5697 <p><a rel="mw:ExtLink" href="http://example.com/a)b">http://example.com/a)b</a></p>
5698 <p><a rel="mw:ExtLink" href="http://example.com)">foo</a></p>
5699 !! end
5701 !! test
5702 Parenthesis in external links, w/ transclusion or comment
5703 !! wikitext
5704 (http://example.com/{{echo|hi}})
5706 (http://example.com<!-- hi -->)
5707 !! html/php
5708 <p>(<a rel="nofollow" class="external free" href="http://example.com/hi">http://example.com/hi</a>)
5709 </p><p>(<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
5710 </p>
5711 !! html/parsoid
5712 <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>
5714 <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>
5715 !! end
5717 !! test
5718 Serialize <a> tags with invalid link targets as plain text
5719 !! options
5720 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
5721 !! html/parsoid
5722 <a rel="mw:WikiLink" href="[[foo]]">text</a>
5723 <a rel="mw:WikiLink" href="[[foo]]">*text</a>
5724 <a rel="mw:WikiLink" href="[[foo]]">[[foo]]</a>
5725 <a rel="mw:WikiLink" href="[[foo]]">*a [[foo]]</a>
5726 !! wikitext
5727 text
5728 <nowiki>*</nowiki>text
5729 <nowiki>[[foo]]</nowiki>
5730 <nowiki>*</nowiki>a <nowiki>[[foo]]</nowiki>
5731 !! end
5733 !! test
5734 mw:ExtLink -vs- mw:WikiLink (T94723)
5735 !! options
5736 parsoid=html2wt
5737 !! html/parsoid
5738 <a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{"stx":"piped","a":{"href":"./Foo"},"sa":{"href":"Foo"}}'>Bar</a>
5739 <a rel="mw:WikiLink" href="./Foo" title="Foo">Bar</a>
5740 <a rel="mw:WikiLink" href="http://en.wikipedia.org/wiki/Foo" title="Foo">Bar</a>
5741 <a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo" title="Foo">Bar</a>
5743 <a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/European_Robin">European Robin</a>
5744 <a rel="mw:WikiLink" href="http://en.wikipedia.org/wiki/European_Robin">European Robin</a>
5745 </p>
5746 !! wikitext
5747 [[Foo|Bar]]
5748 [[Foo|Bar]]
5749 [[wikipedia:Foo|Bar]]
5750 [[wikipedia:Foo|Bar]]
5752 [[wikipedia:European_Robin|European Robin]]
5753 [[wikipedia:European_Robin|European Robin]]
5754 !! end
5756 !! test
5757 mw:ExtLink linking to a interwiki URL can be round-tripped losslessly (T94723)
5758 !! options
5759 parsoid=wt2wt
5760 !! wikitext
5761 [http://en.wikipedia.org/wiki/European_Robin European Robin]
5762 !! html/parsoid
5763 THIS SECTION IS NOT USED (but Parsoid won't run the test without it)
5764 !! end
5768 ### Quotes
5771 !! test
5772 Quotes
5773 !! wikitext
5774 Normal text. '''Bold text.''' Normal text. ''Italic text.''
5776 Normal text. '''''Bold italic text.''''' Normal text.
5777 !! html
5778 <p>Normal text. <b>Bold text.</b> Normal text. <i>Italic text.</i>
5779 </p><p>Normal text. <i><b>Bold italic text.</b></i> Normal text.
5780 </p>
5781 !! end
5784 # Parsoid inserts an empty bold tag pair at the end of the line, that the PHP
5785 # parser strips. The wikitext contains just the first half of the bold
5786 # quote pair.
5787 !! test
5788 Unclosed and unmatched quotes
5789 !! wikitext
5790 '''''Bold italic text '''with bold deactivated''' in between.'''''
5792 '''''Bold italic text ''with italic deactivated'' in between.'''''
5794 '''Bold text..
5796 ..spanning two paragraphs (should not work).'''
5798 '''Bold tag left open
5800 ''Italic tag left open
5802 Normal text.
5804 <!-- Unmatching number of opening, closing tags: -->
5805 '''This year''''s election ''should'' beat '''last year''''s.
5807 ''Tom'''s car is bigger than ''Susan'''s.
5809 Plain ''italic'''s plain
5810 !! html/php
5811 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
5812 </p><p><b><i>Bold italic text </i>with italic deactivated<i> in between.</i></b>
5813 </p><p><b>Bold text..</b>
5814 </p><p>..spanning two paragraphs (should not work).
5815 </p><p><b>Bold tag left open</b>
5816 </p><p><i>Italic tag left open</i>
5817 </p><p>Normal text.
5818 </p><p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
5819 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
5820 </p><p>Plain <i>italic'</i>s plain
5821 </p>
5822 !! html/parsoid
5823 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
5824 </p><p><b><i>Bold italic text </i>with italic deactivated<i> in between.</i></b>
5825 </p><p><b>Bold text..</b>
5826 </p><p>..spanning two paragraphs (should not work).<b></b>
5827 </p><p><b>Bold tag left open</b>
5828 </p><p><i>Italic tag left open</i>
5829 </p><p>Normal text.
5830 </p>
5831 <!-- Unmatching number of opening, closing tags: -->
5832 <p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
5833 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
5834 </p><p>Plain <i>italic'</i>s plain
5835 </p>
5836 !! end
5839 ### Tables
5841 ### some content taken from http://meta.wikimedia.org/wiki/MediaWiki_User%27s_Guide:_Using_tables
5844 # This should not produce <table></table> as <table><tr><td></td></tr></table>
5845 # is the bare minimum required by the spec, see:
5846 # https://www.w3.org/TR/xhtml-modularization/dtd_module_defs.html#a_module_Basic_Tables
5847 # Parsoid team replies: empty table tags are legal in HTML5
5848 !! test
5849 A table with no data.
5850 !! options
5851 parsoid=wt2html
5852 !! wikitext
5853 {||}
5854 !! html/php
5856 !! html/parsoid
5857 <table></table>
5859 !! end
5861 !! test
5862 A table with stray table end tags on start tag line (wt2html)
5863 !! options
5864 parsoid=wt2html
5865 !! wikitext
5866 {|style="color: red;"|}
5868 {|style="color: red;" |}
5869 |foo
5872 {|style="color: red;"|} id="foo"
5873 |foo
5876 {|style="color: red;" |} id="foo"
5877 |foo
5879 !! html
5880 <table style="color: red;"></table>
5882 <table style="color: red;">
5883 <tbody><tr>
5884 <td>foo</td>
5885 </tr></tbody>
5886 </table>
5888 <table style="color: red;" id="foo">
5889 <tbody><tr>
5890 <td>foo</td>
5891 </tr></tbody>
5892 </table>
5894 <table style="color: red;" id="foo">
5895 <tbody><tr>
5896 <td>foo</td>
5897 </tr></tbody>
5898 </table>
5900 !! end
5902 !! test
5903 A table with no data (take 2)
5904 !! wikitext
5907 !! html/parsoid
5908 <table></table>
5909 !! end
5911 # A table with nothing but a caption is invalid XHTML, we might want to render
5912 # this as <p>caption</p>
5913 # Parsoid team replies: table with only a caption is legal in HTML5
5914 !! test
5915 A table with nothing but a caption
5916 !! wikitext
5918 |+ caption
5920 !! html/php
5921 <table>
5922 <caption> caption
5923 </caption><tr><td></td></tr></table>
5925 !! html/parsoid
5926 <table><caption> caption</caption></table>
5927 !! end
5929 !! test
5930 A table with caption with default-spaced attributes and a table row
5931 !! wikitext
5933 |+ style="color: red;" | caption1
5935 | foo
5937 !! html
5938 <table>
5939 <caption style="color: red;"> caption1
5940 </caption>
5941 <tr>
5942 <td> foo
5943 </td></tr></table>
5945 !! end
5947 !! test
5948 A table with captions with non-default spaced attributes and a table row
5949 !! wikitext
5951 |+style="color: red;"|caption2
5952 |+ style="color: red;"| caption3
5954 | foo
5956 !! html
5957 <table>
5958 <caption style="color: red;">caption2
5959 </caption>
5960 <caption style="color: red;"> caption3
5961 </caption>
5962 <tr>
5963 <td> foo
5964 </td></tr></table>
5966 !! end
5968 !! test
5969 Table td-cell syntax variations
5970 !! wikitext
5972 | foo bar foo | baz
5973 | foo bar foo || baz
5974 | style='color:red;' | baz
5975 | style='color:red;' || baz
5977 !! html
5978 <table>
5979 <tr>
5980 <td> baz
5981 </td>
5982 <td> foo bar foo </td>
5983 <td> baz
5984 </td>
5985 <td style="color:red;"> baz
5986 </td>
5987 <td> style='color:red;' </td>
5988 <td> baz
5989 </td></tr></table>
5991 !! end
5993 !! test
5994 Simple table
5995 !! wikitext
5997 | 1 || 2
5999 | 3 || 4
6001 !! html
6002 <table>
6003 <tr>
6004 <td> 1 </td>
6005 <td> 2
6006 </td></tr>
6007 <tr>
6008 <td> 3 </td>
6009 <td> 4
6010 </td></tr></table>
6012 !! end
6014 !! test
6015 Simple table but with multiple dashes for row wikitext
6016 !! wikitext
6018 | foo
6019 |-----
6020 | bar
6022 !! html
6023 <table>
6024 <tr>
6025 <td> foo
6026 </td></tr>
6027 <tr>
6028 <td> bar
6029 </td></tr></table>
6031 !! end
6033 !! test
6034 Multiplication table
6035 !! wikitext
6036 {| border="1" cellpadding="2"
6037 |+Multiplication table
6039 ! &times; !! 1 !! 2 !! 3
6041 ! 1
6042 | 1 || 2 || 3
6044 ! 2
6045 | 2 || 4 || 6
6047 ! 3
6048 | 3 || 6 || 9
6050 ! 4
6051 | 4 || 8 || 12
6053 ! 5
6054 | 5 || 10 || 15
6056 !! html
6057 <table border="1" cellpadding="2">
6058 <caption>Multiplication table
6059 </caption>
6060 <tr>
6061 <th> &#215; </th>
6062 <th> 1 </th>
6063 <th> 2 </th>
6064 <th> 3
6065 </th></tr>
6066 <tr>
6067 <th> 1
6068 </th>
6069 <td> 1 </td>
6070 <td> 2 </td>
6071 <td> 3
6072 </td></tr>
6073 <tr>
6074 <th> 2
6075 </th>
6076 <td> 2 </td>
6077 <td> 4 </td>
6078 <td> 6
6079 </td></tr>
6080 <tr>
6081 <th> 3
6082 </th>
6083 <td> 3 </td>
6084 <td> 6 </td>
6085 <td> 9
6086 </td></tr>
6087 <tr>
6088 <th> 4
6089 </th>
6090 <td> 4 </td>
6091 <td> 8 </td>
6092 <td> 12
6093 </td></tr>
6094 <tr>
6095 <th> 5
6096 </th>
6097 <td> 5 </td>
6098 <td> 10 </td>
6099 <td> 15
6100 </td></tr></table>
6102 !! end
6104 !! test
6105 Accept "||" in table headings
6106 !! wikitext
6108 !h1 || h2
6110 !! html
6111 <table>
6112 <tr>
6113 <th>h1 </th>
6114 <th> h2
6115 </th></tr></table>
6117 !! end
6119 !! test
6120 Accept "!!" in table data
6121 !! wikitext
6123 | Foo!! ||
6125 !! html
6126 <table>
6127 <tr>
6128 <td> Foo!! </td>
6129 <td>
6130 </td></tr></table>
6132 !! html/parsoid
6133 <table>
6134 <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>
6135 </tbody></table>
6136 !! end
6138 !! test
6139 Accept "||" in indented table headings
6140 !! wikitext
6142 !h1 || h2
6144 !! html
6145 <dl><dd><table>
6146 <tr>
6147 <th>h1 </th>
6148 <th> h2
6149 </th></tr></table></dd></dl>
6151 !! end
6153 !! test
6154 Accept "!!" in templates
6155 !! wikitext
6157 !a {{echo|b!!c}}
6159 !! html/php
6160 <table>
6161 <tr>
6162 <th>a b</th>
6163 <th>c
6164 </th></tr></table>
6166 !! html/parsoid
6167 <table>
6168 <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>
6169 !! end
6171 !! test
6172 Accept "!!" in table headings after newline
6173 !! wikitext
6176 b!!c
6178 !! html/php
6179 <table>
6180 <tr>
6181 <th>a
6182 <p>b!!c
6183 </p>
6184 </th></tr></table>
6186 !! html/parsoid
6187 <table>
6188 <tbody><tr><th>a
6189 <p>b!!c</p></th></tr>
6190 </tbody></table>
6191 !! end
6193 !! test
6194 Accept "!!" in table data of mixed wikitext / html syntax
6195 !! wikitext
6198 <tr><td>b!!c</td></tr>
6200 !! html+tidy
6201 <table>
6202 <tr>
6203 <th>a</th>
6204 </tr>
6205 <tr>
6206 <td>b!!c</td>
6207 </tr>
6208 </table>
6209 !! html/parsoid
6210 <table>
6211 <tbody><tr><th>a</th></tr>
6212 <tr data-parsoid='{"stx":"html"}'><td data-parsoid='{"stx":"html"}'>b!!c</td></tr>
6213 </tbody></table>
6214 !! end
6216 !! test
6217 Accept empty attributes in td/th cells (td/th cells starting with leading ||)
6218 !! wikitext
6220 !| h1
6221 || a
6223 !! html
6224 <table>
6225 <tr>
6226 <th> h1
6227 </th>
6228 <td> a
6229 </td></tr></table>
6231 !! end
6233 !!test
6234 Accept "| !" at start of line in tables (ignore !-attribute)
6235 !! wikitext
6238 | !style="color:red" | bar
6240 !! html
6241 <table>
6243 <tr>
6244 <td> bar
6245 </td></tr></table>
6247 !!end
6249 !!test
6250 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 +/- 
6251 !! wikitext
6254 |style='color:red;'|+1
6255 |style='color:blue;'|-1
6257 | 1 || 2 || 3
6258 | 1 ||+2 ||-3
6260 | +1
6261 | -1
6263 !! html
6264 <table>
6266 <tr>
6267 <td style="color:red;">+1
6268 </td>
6269 <td style="color:blue;">-1
6270 </td></tr>
6271 <tr>
6272 <td> 1 </td>
6273 <td> 2 </td>
6274 <td> 3
6275 </td>
6276 <td> 1 </td>
6277 <td>+2 </td>
6278 <td>-3
6279 </td></tr>
6280 <tr>
6281 <td> +1
6282 </td>
6283 <td> -1
6284 </td></tr></table>
6286 !!end
6288 !! test
6289 Table rowspan
6290 !! wikitext
6291 {| border=1
6292 | Cell 1, row 1
6293 |rowspan=2| Cell 2, row 1 (and 2)
6294 | Cell 3, row 1
6296 | Cell 1, row 2
6297 | Cell 3, row 2
6299 !! html
6300 <table border="1">
6301 <tr>
6302 <td> Cell 1, row 1
6303 </td>
6304 <td rowspan="2"> Cell 2, row 1 (and 2)
6305 </td>
6306 <td> Cell 3, row 1
6307 </td></tr>
6308 <tr>
6309 <td> Cell 1, row 2
6310 </td>
6311 <td> Cell 3, row 2
6312 </td></tr></table>
6314 !! end
6316 !! test
6317 Nested table
6318 !! wikitext
6319 {| border=1
6320 | &alpha;
6322 {| bgcolor=#ABCDEF border=2
6323 |nested
6325 |table
6327 |the original table again
6329 !! html
6330 <table border="1">
6331 <tr>
6332 <td> &#945;
6333 </td>
6334 <td>
6335 <table bgcolor="#ABCDEF" border="2">
6336 <tr>
6337 <td>nested
6338 </td></tr>
6339 <tr>
6340 <td>table
6341 </td></tr></table>
6342 </td>
6343 <td>the original table again
6344 </td></tr></table>
6346 !! end
6348 !! test
6349 Invalid attributes in table cell (bug 1830)
6350 !! wikitext
6352 |Cell:|broken
6354 !! html
6355 <table>
6356 <tr>
6357 <td>broken
6358 </td></tr></table>
6360 !! end
6362 !! test
6363 Table cell attributes: Pipes protected by nowikis should be treated as a plain character
6364 !! wikitext
6366 | title="foo" |bar
6367 | title="foo<nowiki>|</nowiki>" |bar
6368 | title="foo<nowiki>|</nowiki>" bar
6370 !! html/php
6371 <table>
6372 <tr>
6373 <td title="foo">bar
6374 </td>
6375 <td title="foo&#124;">bar
6376 </td>
6377 <td> title="foo|" bar
6378 </td></tr></table>
6380 !! html/parsoid
6381 <table>
6382 <tbody><tr><td title="foo">bar</td>
6383 <td title="foo|" data-parsoid='{"a":{"title":"foo|"},"sa":{"title":"foo&lt;nowiki>|&lt;/nowiki>"},"autoInsertedEnd":true}'>bar</td>
6384 <td> title="foo<span typeof="mw:Nowiki">|</span>" bar</td></tr>
6385 </tbody></table>
6386 !! end
6388 # See: http://lists.wikimedia.org/mailman/htdig/wikitech-l/2006-April/022293.html
6389 # N.B. The "|}" to close the table is missing from the input, so parsoid's
6390 #      *2wt modes will fail.
6391 !! test
6392 Table security: embedded pipes
6393 !! options
6394 parsoid=wt2html,html2html
6395 !! wikitext
6397 | |[ftp://|x||]" onmouseover="alert(document.cookie)">test
6398 !! html/php
6399 <table>
6400 <tr>
6401 <td>[<a rel="nofollow" class="external free" href="ftp://%7Cx">ftp://%7Cx</a></td>
6402 <td>]" onmouseover="alert(document.cookie)"&gt;test
6403 </td>
6404 </tr>
6405 </table>
6407 !! html/parsoid
6408 <table><tbody>
6409 <tr>
6410 <td data-parsoid='{"startTagSrc":"| ","attrSepSrc":"|","autoInsertedEnd":true}'><a rel="mw:ExtLink" href="ftp://|x||"></a>" onmouseover="alert(document.cookie)">test</td></tr></tbody></table>
6411 !! end
6413 !! test
6414 Element attributes with double ! should not be broken up by <th>
6415 !! wikitext
6417 ! hi <div class="!!">ha</div> ho
6419 !! html/php
6420 <table>
6421 <tr>
6422 <th> hi <div class="!!">ha</div> ho
6423 </th></tr></table>
6425 !! html/parsoid
6426 <table>
6427 <tbody><tr><th> hi <div class="!!" data-parsoid='{"stx":"html"}'>ha</div> ho</th></tr>
6428 </tbody></table>
6429 !! end
6431 !! test
6432 ! and || in element attributes should not be parsed as <th>/<td>
6433 !! wikitext
6435 | <div style="color: red !important;" data-contrived="put this here ||">hi</div>
6437 !! html/php
6438 <table>
6439 <tr>
6440 <td> <div style="color: red !important;" data-contrived="put this here &#124;&#124;">hi</div>
6441 </td></tr></table>
6443 !! html/parsoid
6444 <table>
6445 <tbody><tr><td> <div style="color: red !important;" data-contrived="put this here ||" data-parsoid='{"stx":"html"}'>hi</div></td></tr>
6446 </tbody></table>
6447 !! end
6449 # FIXME: The output seems broken. Filed as T110268.
6450 !! test
6451 ! and || in td attributes should not be parsed as <th>/<td>
6452 !! options
6453 parsoid=wt2html
6454 !! wikitext
6456 | style="color: red !important;" data-contrived="put this here ||" | foo
6458 !! html/php
6459 <table>
6460 <tr>
6461 <td> style="color: red !important;" data-contrived="put this here </td>
6462 <td> foo
6463 </td></tr></table>
6465 !! html/parsoid
6466 <table>
6467 <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>
6468 </tbody></table>
6469 !! end
6471 !! test
6472 Break on | in element attribute in template
6473 !! options
6474 parsoid=wt2html,html2html
6475 !! wikitext
6476 {{echo|1=<div class="hi|ho">ha</div>}}
6477 !! html/php
6478 <p>ho"&gt;ha&lt;/div&gt;
6479 </p>
6480 !! html/parsoid
6481 <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>
6482 !! end
6484 !! test
6485 Break on | in element attribute name in template
6486 !! wikitext
6487 {{echo|<div cla|ss="hiho">ha</div>}}
6488 !! html/parsoid
6489 <p about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"pi":[[{"k":"1"},{"k":"ss","named":true}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;div cla"},"ss":{"wt":"\"hiho\">ha&lt;/div>"}},"i":0}}]}'>&lt;div cla</p>
6490 !! end
6492 !! test
6493 Don't break on | in extension attribute in template
6494 !! wikitext
6495 {{echo|<ref name="hi|ho">ha</ref>}}
6497 <references />
6498 !! html/parsoid
6499 <p><span about="#mwt2" class="mw-ref" id="cite_ref-hi.7Cho_1-0" rel="dc:references" typeof="mw:Transclusion  mw:Extension/ref" data-parsoid='{"pi":[[{"k":"1"}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;ref name=\"hi|ho\">ha&lt;/ref>"}},"i":0}}]}'><a href="./Main_Page#cite_note-hi.7Cho-1" style="counter-reset: mw-Ref 1;"><span class="mw-reflink-text">[1]</span></a></span></p>
6501 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'><li about="#cite_note-hi.7Cho-1" id="cite_note-hi.7Cho-1"><a href="./Main_Page#cite_ref-hi.7Cho_1-0" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-hi.7Cho-1" class="mw-reference-text">ha</span></li></ol>
6502 !! end
6504 ## We don't support roundtripping of these attributes in Parsoid.
6505 ## Selective serialization takes care of preventing dirty diffs.
6506 ## But, on edits, we dirty-diff the invalid attribute text.
6507 !! test
6508 Invalid text in table attributes should be discarded
6509 !! options
6510 parsoid=wt2html
6511 !! wikitext
6512 {| <span>boo</span> style='border:1px solid black'
6513 |  <span>boo</span> style='color:blue'  | 1
6514 |<span>boo</span> style='color:blue'| 2
6516 !! html/php
6517 <table style="border:1px solid black">
6518 <tr>
6519 <td style="color:blue"> 1
6520 </td>
6521 <td style="color:blue"> 2
6522 </td></tr></table>
6524 !! html/parsoid
6525 <table style="border:1px solid black">
6526 <tr>
6527 <td style="color:blue"> 1</td>
6528 <td style="color:blue"> 2</td>
6529 </tr>
6530 </table>
6531 !! end
6533 !! test
6534 Invalid text in table attributes should be preserved by selective serializer
6535 !! options
6536 parsoid={
6537   "modes": ["selser"],
6538   "changes": [
6539     ["td:first-child", "text", "abc"],
6540     ["td + td", "text", "xyz"]
6541   ]
6543 !! wikitext
6544 {| <span>boo</span> style='border:1px solid black'
6545 |  <span>boo</span> style='color:blue'  | 1
6546 |<span>boo</span> style='color:blue'| 2
6548 !! wikitext/edited
6549 {| <span>boo</span> style='border:1px solid black'
6550 |  <span>boo</span> style='color:blue'  |abc
6551 |<span>boo</span> style='color:blue'|xyz
6553 !! end
6555 !! test
6556 1. Template-generated table cell attributes and cell content
6557 !! wikitext
6559 |{{table_attribs}}
6560 | {{table_attribs}}
6561 || {{table_attribs_5}}
6562 | <!--foo--> <!--bar--> <!--baz--> {{table_attribs}}
6563 |align=center {{table_attribs}}
6564 | <!--foo--> align=center <!--bar--> {{table_attribs}}
6566 !! html
6567 <table>
6568 <tr>
6569 <td style="color:red;">Foo
6570 </td>
6571 <td style="color:red;">Foo
6572 </td>
6573 <td> style="color:red;"</td>
6574 <td>Bar
6575 </td>
6576 <td style="color:red;">Foo
6577 </td>
6578 <td align="center" style="color:red;">Foo
6579 </td>
6580 <td align="center" style="color:red;">Foo
6581 </td></tr></table>
6583 !! end
6585 !! test
6586 2. Template-generated table cell attributes and cell content
6587 !! wikitext
6589 |{{table_attribs_2}}
6591 !! html/php
6592 <table>
6593 <tr>
6594 <td style="color:red;">Foo
6595 </td>
6596 <td>Bar</td>
6597 <td>Baz
6598 </td></tr></table>
6600 !! html/parsoid
6601 <table>
6602 <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>
6603 <td about="#mwt1">Bar</td><td about="#mwt1">Baz</td></tr>
6604 </tbody></table>
6605 !! end
6607 !! test
6608 3. Template-generated table cell attributes and cell content
6609 !! wikitext
6611 !align=center {{table_header_cells}}
6613 |align=center {{table_cells}}
6615 !! html/php
6616 <table>
6617 <tr>
6618 <th align="center" style="color:red;">Foo</th>
6619 <th style="color:red;"><i>Bar</i></th>
6620 <th style="color:brown;"><i>Foo</i> and Baz
6621 </th></tr>
6622 <tr>
6623 <td align="center" style="color:red;">Foo</td>
6624 <td style="color:red;"><i>Bar</i></td>
6625 <td style="color:brown;"><i>Foo</i> and Baz
6626 </td></tr></table>
6628 !! html/parsoid
6629 <table>
6630 <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>
6631 <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>
6632 </tbody></table>
6633 !! end
6635 !! test
6636 4. Template-generated table cell attributes and cell content inside a templated table
6637 !! wikitext
6638 {{tbl-start}}
6639 !align=center {{table_header_cells}}
6641 |align=center {{table_cells}}
6642 {{tbl-end}}
6643 !! html/php
6644 <table>
6645 <tr>
6646 <th align="center" style="color:red;">Foo</th>
6647 <th style="color:red;"><i>Bar</i></th>
6648 <th style="color:brown;"><i>Foo</i> and Baz
6649 </th></tr>
6650 <tr>
6651 <td align="center" style="color:red;">Foo</td>
6652 <td style="color:red;"><i>Bar</i></td>
6653 <td style="color:brown;"><i>Foo</i> and Baz
6654 </td></tr></table>
6656 !! html/parsoid
6657 <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}}]}'>
6658 <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>
6659 <tr>
6660 <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>
6661 </tbody></table>
6662 !! end
6664 ## Edge case fix to prevent future regressions
6665 !! test
6666 T107652: <ref>s in templates that also generate table cell attributes should be rendered properly
6667 !! wikitext
6669 |{{table_attribs_7}}
6671 <references />
6672 !! html/parsoid
6673 <table>
6674 <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="./Main_Page#cite_note-1" style="counter-reset: mw-Ref 1;"><span class="mw-reflink-text">[1]</span></a></span></td></tr>
6675 </tbody></table>
6676 <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="./Main_Page#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>
6677 !! end
6679 !! test
6680 Table with row followed by newlines and table heading
6681 !! options
6682 parsoid=wt2html,html2html
6683 !! wikitext
6687 ! foo
6689 !! html/*
6690 <table>
6693 <tr>
6694 <th> foo
6695 </th></tr></table>
6697 !! end
6699 !! test
6700 Table with empty line following the start tag
6701 !! options
6702 parsoid=wt2html,html2html
6703 !! wikitext
6707 | foo
6709 !! html/*
6710 <table>
6713 <tr>
6714 <td> foo
6715 </td></tr></table>
6717 !! end
6719 !! test
6720 Table attributes with empty value
6721 !! options
6722 parsoid=wt2html,html2html
6723 !! wikitext
6725 | style=| hello
6727 !! html/php
6728 <table>
6729 <tr>
6730 <td style=""> hello
6731 </td></tr></table>
6733 !! html/parsoid
6734 <table>
6735 <tbody><tr><td style=""> hello</td></tr>
6736 </tbody></table>
6737 !! end
6739 !! test
6740 Wikitext table with a lot of comments
6741 !! wikitext
6743 <!-- c0 -->
6744 | foo
6745 <!-- c1 -->
6746 |-<!-- c2 -->
6747 <!-- c3 -->
6748 |<!-- c4 -->
6749 <!-- c5 -->
6751 !! html
6752 <table>
6753 <tr>
6754 <td> foo
6755 </td></tr>
6756 <tr>
6757 <td>
6758 </td></tr></table>
6760 !! end
6762 !! test
6763 Wikitext table comments represented in parsoid dom
6764 !! wikitext
6765 {|<!--c1--><!--c2-->
6766 |-<!--c3-->
6767 | x
6769 !! html/php+tidy
6770 <table>
6771 <tr>
6772 <td>x</td>
6773 </tr>
6774 </table>
6775 !! html/parsoid
6776 <table><!--c1--><!--c2-->
6777 <tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'><!--c3-->
6778 <td data-parsoid='{"autoInsertedEnd":true}'> x</td></tr>
6779 </tbody></table>
6780 !! end
6782 !! test
6783 Wikitext table with double-line table cell
6784 !! wikitext
6789 !! html
6790 <table>
6791 <tr>
6792 <td>a
6793 <p>b
6794 </p>
6795 </td></tr></table>
6797 !! end
6799 !! test
6800 Table cell with a single comment
6801 !! wikitext
6803 | <!-- c1 -->
6804 | a
6806 !! html
6807 <table>
6808 <tr>
6809 <td>
6810 </td>
6811 <td> a
6812 </td></tr></table>
6814 !! end
6816 !! test
6817 Table-cell after a comment-only-empty-line
6818 !! wikitext
6821 <!--c1-->
6822 <!--c2-->| b
6824 !! html
6825 <table>
6826 <tr>
6827 <td>a
6828 </td>
6829 <td> b
6830 </td></tr></table>
6832 !! html/parsoid
6833 <table>
6834 <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'>a</td>
6835 <!--c1-->
6836 <!--c2--><td data-parsoid='{"autoInsertedEnd":true}'> b</td></tr>
6837 </tbody></table>
6839 !! end
6841 !! test
6842 Build table with {{!}}
6843 !! wikitext
6844 {{{!}} class="wikitable"
6845 ! header
6846 ! second header
6847 {{!}}- style="color:red;"
6848 {{!}} data {{!}}{{!}} style="color:red;" {{!}} second data
6849 {{!}}}
6850 !! html
6851 <table class="wikitable">
6852 <tr>
6853 <th> header
6854 </th>
6855 <th> second header
6856 </th></tr>
6857 <tr style="color:red;">
6858 <td> data </td>
6859 <td style="color:red;"> second data
6860 </td></tr></table>
6862 !! end
6864 !! test
6865 Build table with pipe as data
6866 !! wikitext
6867 {| class="wikitable"
6868 ! header
6869 ! second header
6870 |- style="color:red;"
6871 | data || style="color:red;" | second data
6873 | style="color:red;" | data with | || style="color:red;" | second data with |
6875 || data with | ||| second data with |
6877 !! html
6878 <table class="wikitable">
6879 <tr>
6880 <th> header
6881 </th>
6882 <th> second header
6883 </th></tr>
6884 <tr style="color:red;">
6885 <td> data </td>
6886 <td style="color:red;"> second data
6887 </td></tr>
6888 <tr>
6889 <td style="color:red;"> data with | </td>
6890 <td style="color:red;"> second data with |
6891 </td></tr>
6892 <tr>
6893 <td> data with | </td>
6894 <td> second data with |
6895 </td></tr></table>
6897 !! end
6899 !! test
6900 Build table with wikilink
6901 !! wikitext
6902 {| class="wikitable"
6903 ! header || second header
6904 |- style="color:red;"
6905 | data [[Main Page|linktext]] || second data [[Main Page|linktext]]
6907 | data || second data [[Main Page|link|text with pipe]]
6909 !! html
6910 <table class="wikitable">
6911 <tr>
6912 <th> header </th>
6913 <th> second header
6914 </th></tr>
6915 <tr style="color:red;">
6916 <td> data <a href="/wiki/Main_Page" title="Main Page">linktext</a> </td>
6917 <td> second data <a href="/wiki/Main_Page" title="Main Page">linktext</a>
6918 </td></tr>
6919 <tr>
6920 <td> data </td>
6921 <td> second data <a href="/wiki/Main_Page" title="Main Page">link|text with pipe</a>
6922 </td></tr></table>
6924 !! end
6926 # The expected HTML structure in this test is debatable. The PHP parser does
6927 # not parse this kind of table at all. The main focus for Parsoid is on
6928 # round-tripping, so this output is ok for now. TODO: revisit!
6929 !! test
6930 Wikitext table with html-syntax row
6931 !! wikitext
6934 <td>foo</td>
6936 !! html/parsoid
6937 <table>
6938 <tbody>
6939 <tr>
6940 <td>foo</td></tr></tbody></table>
6941 !! end
6943 ## Note that Parsoid output differs from PHP and PHP+tidy here.
6944 ## The lack of <tr> tags in the PHP output is arguably a bug in the
6945 ## PHP parser, which tidy then compounds by fostering the content
6946 ## entirely out of the table.  Parsoid recognizes the table context
6947 ## and generates <tr> and <td> wrappers as needed.  Hopefully nobody
6948 ## depends on PHP's treatment of broken table markup!
6949 !! test
6950 Implicit <td> after a |-
6951 !! options
6952 parsoid=wt2html,html2html
6953 !! wikitext
6958 !! html/php
6959 <table>
6962 </table>
6964 !! html/php+tidy
6965 <p>a</p>
6966 !! html/parsoid
6967 <table>
6968 <tr><td>a</td></tr>
6969 </table>
6970 !! end
6972 # Again, Parsoid adds implicit <td>s here, PHP and Tidy strip the b out.
6973 !! test
6974 <pre> tags should be recognized in an explicit <td> context, but not in an implicit <td> context
6975 !! options
6976 parsoid=wt2html,html2html
6977 !! wikitext
6985 !! html/php
6986 <table>
6988 <tr>
6989 <td>
6990 <pre>a
6991 </pre>
6992 </td></tr>
6994 </table>
6996 !! html/php+tidy
6997 <p>b</p>
6998 <table>
6999 <tr>
7000 <td>
7001 <pre>
7003 </pre></td>
7004 </tr>
7005 </table>
7006 !! html/parsoid
7007 <table>
7008 <tbody>
7009 <tr><td><pre>a</pre></td></tr>
7010 <tr><td> b</td></tr>
7011 </tbody>
7012 </table>
7013 !! end
7015 # PHP + Tidy strips the list out of the table; Parsoid wraps it.
7016 # Parsoid generates the missing <td>, so wt2wt won't succeed.
7017 !! test
7018 Lists should be recognized in an implicit <td> context
7019 !! options
7020 parsoid=wt2html,html2html
7021 !! wikitext
7026 !! html/php
7027 <table>
7029 <ul><li>a</li></ul>
7030 </table>
7032 !! html/php+tidy
7033 <ul>
7034 <li>a</li>
7035 </ul>
7036 !! html/parsoid
7037 <table>
7038 <tr>
7039 <td><ul>
7040 <li>a</li>
7041 </ul></td>
7042 </tr>
7043 </table>
7044 !! end
7046 !! test
7047 Table cells not properly parsed in an implicit-td context
7048 !! wikitext
7051 {{table_attribs_4}} || a || b
7053 !! html/php+tidy
7054 <table>
7055 <tr>
7056 <td style="background-color:#DC241f;" width="10px"></td>
7057 <td>a</td>
7058 <td>b</td>
7059 </tr>
7060 </table>
7061 !! html/parsoid
7062 <table>
7063 <tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'>
7064 <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>
7065 </tbody></table>
7066 !! end
7068 !! test
7069 Parsoid: Round-trip tables directly followed by content (bug 51219)
7070 !! options
7071 parsoid=wt2html,wt2wt
7072 !! wikitext
7074 |foo
7075 |} bar
7078 |baz
7079 |}<b>quux</b>
7080 !! html+tidy
7081 <table>
7082 <tr>
7083 <td>foo</td>
7084 </tr>
7085 </table>
7086 <p>bar</p>
7087 <table>
7088 <tr>
7089 <td>baz</td>
7090 </tr>
7091 </table>
7092 <p><b>quux</b></p>
7093 !! end
7095 !! test
7096 Parsoid: Default to a newline after tables in new content (bug 51219)
7097 !! options
7098 parsoid=html2wt
7099 !! html/parsoid
7100 <table><tbody>
7101 <tr><td>foo</td></tr></tbody></table> bar
7102 <table><tbody>
7103 <tr><td>baz</td></tr></tbody></table><b>quux</b>
7104 !! wikitext
7106 |foo
7108 <nowiki> </nowiki>bar
7110 |baz
7112 '''quux'''
7113 !! end
7115 !! test
7116 Parsoid: newline inducing block nodes don't suppress <nowiki>
7117 !! options
7118 parsoid=html2wt
7119 !! html/parsoid
7120  a<h1>foo</h1>
7121 !! wikitext
7122 <nowiki> </nowiki>a
7124 = foo =
7125 !! end
7127 !! test
7128 Parsoid: Row-syntax table headings followed by comment & table cells
7129 !! options
7130 parsoid=wt2html,wt2wt
7131 !! wikitext
7133 ! foo || bar
7134 <!-- foo -->  || baz || quux
7136 !! html/php
7137 <table>
7138 <tr>
7139 <th> foo </th>
7140 <th> bar
7141 </th>
7142 <td> baz </td>
7143 <td> quux
7144 </td></tr></table>
7146 !! html/parsoid
7147 <table>
7148 <tbody><tr><th> foo </th><th> bar
7149 <!-- foo -->  </th><td> baz </td><td> quux</td></tr>
7150 </tbody></table>
7151 !! end
7153 !!test
7154 Parsoid: Recover better from broken table attributes
7155 !!options
7156 parsoid=wt2html
7157 !!wikitext
7158 {| class="foo
7159 | class="bar" |
7162 !!html/php+tidy
7163 <table class="foo">
7164 <tr>
7165 <td class="bar">
7166 <p>foo</p>
7167 </td>
7168 </tr>
7169 </table>
7170 !!html/parsoid
7171 <table class="foo">
7172 <tr>
7173 <td class="bar">
7174 <p>foo</p></td></tr>
7175 </tbody></table>
7176 !!end
7178 !! test
7179 Tables: Digest broken attributes on table and tr tag
7180 !! options
7181 parsoid=wt2html
7182 !! wikitext
7183 {| || |} ++
7184 |- || || ++ --
7185 |- > [
7187 !! html
7188 <table>
7189 <tbody>
7190 <tr></tr>
7191 <tr></tr>
7192 </tbody></table>
7193 !! end
7195 # T137406: Whitespace in the HTML
7196 !! test
7197 1. Generate correct wikitext for tables with thead/tbody/tfoot
7198 !! options
7199 parsoid=html2wt
7200 !! html/parsoid
7201 <table>
7202 <caption>Test</caption>
7203 <thead>
7204 <tr>
7205 <th>Month</th>
7206 <th>Savings</th>
7207 </tr>
7208 </thead>
7209 <tbody>
7210 <tr>
7211 <td>January</td>
7212 <td>$100</td>
7213 </tr>
7214 <tr>
7215 <td>February</td>
7216 <td>$80</td>
7217 </tr>
7218 </tbody>
7219 <tfoot>
7220 <tr>
7221 <td>Sum</td>
7222 <td>$180</td>
7223 </tr>
7224 </tfoot>
7225 </table>
7226 !! wikitext
7228 |+Test
7229 !Month
7230 !Savings
7232 |January
7233 |$100
7235 |February
7236 |$80
7238 |Sum
7239 |$180
7241 !! html/php+tidy
7242 <table>
7243 <caption>Test</caption>
7244 <tr>
7245 <th>Month</th>
7246 <th>Savings</th>
7247 </tr>
7248 <tr>
7249 <td>January</td>
7250 <td>$100</td>
7251 </tr>
7252 <tr>
7253 <td>February</td>
7254 <td>$80</td>
7255 </tr>
7256 <tr>
7257 <td>Sum</td>
7258 <td>$180</td>
7259 </tr>
7260 </table>
7261 !! end
7263 # T137406: No whitespace in the HTML
7264 !! test
7265 2. Generate correct wikitext for tables with thead/tbody/tfoot
7266 !! options
7267 parsoid=html2wt
7268 !! html/parsoid
7269 <table><thead><tr><th>heading</th></tr></thead><tbody><tr><td>foo</td></tr></tbody></table>
7270 !! wikitext
7272 !heading
7274 |foo
7276 !! end
7278 !! test
7279 Testing serialization after deletion in references
7280 !! options
7281 parsoid={
7282   "modes": ["wt2wt"],
7283   "changes": [
7284     ["#x", "remove"]
7285   ]
7287 !! wikitext
7288 hi <ref><div id="x">ho</div></ref>
7290 <references />
7291 !! wikitext/edited
7292 hi <ref></ref>
7294 <references />
7295 !! end
7297 !!test
7298 Testing serialization after deletion of table cells
7299 !!options
7300 parsoid={
7301   "modes": ["wt2wt", "selser"],
7302   "changes": [
7303     ["#x", "remove"]
7304   ]
7306 !!wikitext
7308 !h1 !!h2 !!h3
7309 | id="x" |c1 {{!}}{{!}}{{!}}c2 |||c3
7311 !! wikitext/edited
7313 !h1 !!h2 !!h3
7314 |c2 |||c3
7316 !!end
7318 !! test
7319 Testing selser after addition of new row before first row (T125419)
7320 !! options
7321 parsoid={
7322   "modes": ["wt2wt", "selser"],
7323   "changes": [
7324     [ "tr", "before", "<tr><td>X</td></tr>" ]
7325   ]
7327 !! wikitext
7331 !! wikitext/edited
7337 !! end
7339 !! test
7340 Serialize new table rows in a HTML table using HTML tags
7341 !! options
7342 parsoid={
7343   "modes": ["wt2wt", "selser"],
7344   "changes": [
7345     [ "tr", "before", "<tr><td>X</td></tr>" ]
7346   ]
7348 !! wikitext
7349 <table><tr><td>a</td></tr></table>
7350 !! wikitext/edited
7351 <table><tr><td>X</td></tr><tr><td>a</td></tr></table>
7352 !! end
7354 !! test
7355 Serialize new table cells in a HTML row using HTML tags
7356 !! options
7357 parsoid={
7358   "modes": ["wt2wt", "selser"],
7359   "changes": [
7360     [ "td", "before", "<td>X</td>" ]
7361   ]
7363 !! wikitext
7364 <table><tr><td>a</td></tr></table>
7365 !! wikitext/edited
7366 <table><tr><td>X</td><td>a</td></tr></table>
7367 !! end
7369 !! test
7370 Wikitext tables can be nested inside HTML tables
7371 !! options
7372 parsoid=html2wt
7373 !! html
7374 <table data-parsoid='{"stx":"html"}'>
7375 <tr><td>
7376 <table>
7377 <tr><td>foo</td></tr>
7378 </table>
7379 </td></tr>
7380 </table>
7381 !! wikitext
7382 <table>
7383 <tr><td>
7385 |foo
7387 </td></tr>
7388 </table>
7389 !! end
7391 !! test
7392 Serialize wikitext list items as HTML list items when embedded in a HTML list
7393 !! options
7394 parsoid=html2wt
7395 !! html
7396 <ul data-parsoid='{"stx": "html"}'>
7397 <li data-parsoid='{}'>a</li>
7398 <li>b</li>
7399 </ul>
7400 !! wikitext
7401 <ul>
7402 <li>a</li>
7403 <li>b</li>
7404 </ul>
7405 !! end
7407 # SSS FIXME: Is this actually a good thing given the
7408 # odd nested list output that is generated by MW?
7409 # <ul><li>foo<ul>..</ul></li></ul> instead of
7410 # <ul><li>foo</li><ul>..</ul></ul>
7411 !! test
7412 Wikitext lists can be nested inside HTML lists
7413 !! options
7414 parsoid=html2wt
7415 !! html
7416 <ul data-parsoid='{"stx": "html"}'>
7417 <li data-parsoid='{"stx": "html"}'>a
7418 <ul><li>b</li></ul>
7419 </li>
7420 </ul>
7422 <ul data-parsoid='{"stx": "html"}'>
7423 <li>x
7424 <ul><li>y</li></ul>
7425 </li>
7426 </ul>
7427 !! wikitext
7428 <ul>
7429 <li>a
7430 * b
7431 </li>
7432 </ul>
7434 <ul>
7435 <li>x
7436 * y
7437 </li>
7438 </ul>
7439 !! end
7442 ### Internal links
7444 !! test
7445 Plain link, capitalized
7446 !! wikitext
7447 [[Main Page]]
7448 !! html
7449 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
7450 </p>
7451 !! end
7453 !! test
7454 Plain link, uncapitalized
7455 !! wikitext
7456 [[main Page]]
7457 !! html
7458 <p><a href="/wiki/Main_Page" title="Main Page">main Page</a>
7459 </p>
7460 !! end
7462 !! test
7463 Piped link
7464 !! wikitext
7465 [[Main Page|The Main Page]]
7466 !! html
7467 <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
7468 </p>
7469 !! end
7471 !! test
7472 Piped link with comment in link text
7473 !! wikitext
7474 [[Main Page|The Main<!--front--> Page]]
7475 !! html
7476 <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
7477 </p>
7478 !! end
7480 !! test
7481 Piped link with multiple pipe characters in link text
7482 !! wikitext
7483 [[Main Page||The|Main|Page|]]
7484 !! html/php
7485 <p><a href="/wiki/Main_Page" title="Main Page">|The|Main|Page|</a>
7486 </p>
7487 !! html/parsoid
7488 <p><a rel="mw:WikiLink" href="Main_Page" title="Main Page">|The|Main|Page|</a></p>
7489 !! end
7491 !! test
7492 Piped link with no link text
7493 !! wikitext
7494 [[Thomas Bek (bishop of St David's)|]]
7495 !! html/php
7496 <p>[[Thomas Bek (bishop of St David's)|]]
7497 </p>
7498 !! html/parsoid
7499 <p>[[Thomas Bek (bishop of St David's)|]]</p>
7500 !! end
7502 !! test
7503 Piped link with empty link text
7504 !! wikitext
7505 [[Main Page|<nowiki />]] - empty nowiki
7506 [[Main Page| ]] - empty space
7507 [[Main Page|&nbsp;]] - empty non breaking space
7508 !! html/php
7509 <p><a href="/wiki/Main_Page" title="Main Page"></a> - empty nowiki
7510 <a href="/wiki/Main_Page" title="Main Page"> </a> - empty space
7511 <a href="/wiki/Main_Page" title="Main Page">&#160;</a> - empty non breaking space
7512 </p>
7513 !! html/parsoid
7514 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page"><meta typeof="mw:Placeholder" data-parsoid='{"src":"&lt;nowiki />"}'/></a> - empty nowiki
7515 <a rel="mw:WikiLink" href="./Main_Page" title="Main Page"> </a> - empty space
7516 <a rel="mw:WikiLink" href="./Main_Page" title="Main Page"><span typeof="mw:Entity" data-parsoid='{"src":"&amp;nbsp;","srcContent":" "}'> </span></a> - empty non breaking space</p>
7517 !! end
7519 !! test
7520 Broken link
7521 !! wikitext
7522 [[Zigzagzogzagzig]]
7523 !! html
7524 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig</a>
7525 </p>
7526 !! end
7528 !! test
7529 Broken link with fragment
7530 !! wikitext
7531 [[Zigzagzogzagzig#zug]]
7532 !! html
7533 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig#zug</a>
7534 </p>
7535 !! end
7537 !! test
7538 Special page link with fragment
7539 !! wikitext
7540 [[Special:Version#anchor]]
7541 !! html
7542 <p><a href="/wiki/Special:Version#anchor" title="Special:Version">Special:Version#anchor</a>
7543 </p>
7544 !! end
7546 !! test
7547 Nonexistent special page link with fragment
7548 !! wikitext
7549 [[Special:ThisNameWillHopefullyNeverBeUsed#anchor]]
7550 !! html
7551 <p><a href="/wiki/Special:ThisNameWillHopefullyNeverBeUsed" class="new" title="Special:ThisNameWillHopefullyNeverBeUsed (page does not exist)">Special:ThisNameWillHopefullyNeverBeUsed#anchor</a>
7552 </p>
7553 !! end
7555 !! test
7556 Link with prefix
7557 !! wikitext
7558 xxx[[main Page]], xxx[[Main Page]], Xxx[[main Page]] XXX[[main Page]], XXX[[Main Page]]
7559 !! html
7560 <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>
7561 </p>
7562 !! end
7564 !! test
7565 Link with suffix
7566 !! wikitext
7567 [[Main Page]]xxx, [[Main Page]]XXX, [[Main Page]]!!!
7568 !! html
7569 <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>!!!
7570 </p>
7571 !! end
7573 !! article
7574 prefixed article
7575 !! text
7576 Some text
7577 !! endarticle
7579 !! test
7580 Bug 43661: Piped links with identical prefixes
7581 !! wikitext
7582 [[prefixed article|prefixed articles with spaces]]
7584 [[prefixed article|prefixed articlesaoeu]]
7586 [[Main Page|Main Page test]]
7587 !! html
7588 <p><a href="/wiki/Prefixed_article" title="Prefixed article">prefixed articles with spaces</a>
7589 </p><p><a href="/wiki/Prefixed_article" title="Prefixed article">prefixed articlesaoeu</a>
7590 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page test</a>
7591 </p>
7592 !! end
7595 !! test
7596 Link with HTML entity in suffix / tail
7597 !! wikitext
7598 [[Main Page]]&quot;, [[Main Page]]&#97;
7599 !! html/php
7600 <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;
7601 </p>
7602 !! html/parsoid
7603 <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>
7604 !! end
7606 !! test
7607 Link with 3 brackets
7608 !! wikitext
7609 [[[Main Page]]]
7610 Foo [[[Main Page]]]
7611 !! html
7612 <p>[[[Main Page]]]
7613 Foo [[[Main Page]]]
7614 </p>
7615 !! end
7617 !! test
7618 Link with 4 brackets
7619 !! wikitext
7620 [[[[Main Page]]]]
7621 !! html
7622 <p>[[<a href="/wiki/Main_Page" title="Main Page">Main Page</a>]]
7623 </p>
7624 !! end
7626 !! test
7627 Piped link with 3 brackets
7628 !! wikitext
7629 [[[main page|the main page]]]
7630 !! html
7631 <p>[[[main page|the main page]]]
7632 </p>
7633 !! end
7635 !! test
7636 Piped link with extlink-like text
7637 !! wikitext
7638 [[Main Page|[bar]]]
7639 [[Main Page|This is a [bar]]]
7640 !! html/php
7641 <p><a href="/wiki/Main_Page" title="Main Page">[bar]</a>
7642 <a href="/wiki/Main_Page" title="Main Page">This is a [bar]</a>
7643 </p>
7644 !! html/parsoid
7645 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page" data-parsoid='{"stx":"piped"}'>[bar]</a>
7646 <a rel="mw:WikiLink" href="./Main_Page" title="Main Page" data-parsoid='{"stx":"piped"}'>This is a [bar]</a></p>
7647 !! end
7649 !! test
7650 Link with multiple pipes
7651 !! wikitext
7652 [[Main Page|The|Main|Page]]
7653 !! html
7654 <p><a href="/wiki/Main_Page" title="Main Page">The|Main|Page</a>
7655 </p>
7656 !! end
7658 !! test
7659 Anchor containing a #. (bug 63430)
7660 !! wikitext
7661 [[Main Page#And#Link]]
7662 !! html/php
7663 <p><a href="/wiki/Main_Page#And.23Link" title="Main Page">Main Page#And#Link</a>
7664 </p>
7665 !! html/parsoid
7666 <p><a rel="mw:WikiLink" href="./Main_Page#And.23Link" title="Main Page" data-parsoid='{"stx":"simple","a":{"href":"./Main_Page#And.23Link"},"sa":{"href":"Main Page#And#Link"}}'>Main Page#And#Link</a></p>
7667 !! end
7669 !! test
7670 Link to namespaces
7671 !! wikitext
7672 [[Talk:Parser testing]], [[Meta:Disclaimers]]
7673 !! html
7674 <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>
7675 </p>
7676 !! end
7678 !! test
7679 Link with space in namespace
7680 !! wikitext
7681 [[User talk:Foo bar]]
7682 !! html
7683 <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>
7684 </p>
7685 !! end
7687 !! article
7688 MemoryAlpha:AlphaTest
7689 !! text
7690 This is an article in the MemoryAlpha namespace
7691 (which shadows the memoryalpha interwiki link).
7692 !! endarticle
7694 !! test
7695 Namespace takes precedence over interwiki link (bug 51680)
7696 !! wikitext
7697 [[MemoryAlpha:AlphaTest]]
7698 !! html
7699 <p><a href="/wiki/MemoryAlpha:AlphaTest" title="MemoryAlpha:AlphaTest">MemoryAlpha:AlphaTest</a>
7700 </p>
7701 !! end
7703 # The previous test doesn't work correctly in html2*, due to not recognizing the
7704 # link as an internal one. This one checks for the correct behavior.
7705 !! test
7706 Link to namespace preferred over interwiki with correct rel attribute
7707 !! options
7708 parsoid=html2wt,html2html
7709 !! html/parsoid
7710 <p><a rel="mw:WikiLink" href="./MemoryAlpha:AlphaTest" title="MemoryAlpha:AlphaTest">MemoryAlpha:AlphaTest</a></p>
7711 !! wikitext
7712 [[MemoryAlpha:AlphaTest]]
7713 !! end
7715 !! test
7716 Piped link to namespace
7717 !! wikitext
7718 [[Meta:Disclaimers|The disclaimers]]
7719 !! html
7720 <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>
7721 </p>
7722 !! end
7724 !! test
7725 Link containing }
7726 !! wikitext
7727 [[Usually caused by a typo (oops}]]
7728 !! html
7729 <p>[[Usually caused by a typo (oops}]]
7730 </p>
7731 !! end
7733 !! article
7734 7% Solution
7735 !! text
7736 Just a test of an article title containing a percent.
7737 !! endarticle
7739 !! test
7740 Link containing % (not as a hex sequence)
7741 !! wikitext
7742 [[7% Solution]]
7743 [[7% Solution|7%25 Solution]]
7744 !! html/php
7745 <p><a href="/wiki/7%25_Solution" title="7% Solution">7% Solution</a>
7746 <a href="/wiki/7%25_Solution" title="7% Solution">7%25 Solution</a>
7747 </p>
7748 !! html/parsoid
7749 <p><a rel="mw:WikiLink" href="./7%25_Solution" title="7% Solution">7% Solution</a>
7750 <a rel="mw:WikiLink" href="./7%25_Solution" title="7% Solution">7%25 Solution</a></p>
7751 !! end
7753 # note that the parsoid HTML is identical to the previous test output,
7754 # so the previous test ensures that the html2wt mode will generate the
7755 # "not as a hex sequence" wikitext.
7756 !! test
7757 Link containing % as a single hex sequence interpreted to char
7758 !! options
7759 parsoid=wt2wt,wt2html,html2html
7760 !! wikitext
7761 [[7%25 Solution]]
7762 [[7%25 Solution|7%25 Solution]]
7763 !! html/php
7764 <p><a href="/wiki/7%25_Solution" title="7% Solution">7% Solution</a>
7765 <a href="/wiki/7%25_Solution" title="7% Solution">7%25 Solution</a>
7766 </p>
7767 !! html/parsoid
7768 <p><a rel="mw:WikiLink" href="./7%25_Solution" title="7% Solution">7% Solution</a>
7769 <a rel="mw:WikiLink" href="./7%25_Solution" title="7% Solution">7%25 Solution</a></p>
7770 !!end
7772 !! test
7773 Link containing % as a double hex sequence interpreted to hex sequence
7774 !! wikitext
7775 [[7%2525 Solution]]
7776 !! html
7777 <p>[[7%2525 Solution]]
7778 </p>
7779 !!end
7781 ## Example for such a section: == < ==
7782 !! test
7783 Link containing "#<" and "#>" % as a hex sequences- these are valid section anchors
7784 !! wikitext
7785 [[%23%3c]][[%23%3e]]
7786 !! html/php
7787 <p><a href="#.3C">#&lt;</a><a href="#.3E">#&gt;</a>
7788 </p>
7789 !! html/parsoid
7790 <p><a rel="mw:WikiLink" href="./Main_Page#.3C" title="Main Page" data-parsoid='{"stx":"simple","a":{"href":"./Main_Page#.3C"},"sa":{"href":"%23%3c"}}'>#&lt;</a><a rel="mw:WikiLink" href="./Main_Page#.3E" title="Main Page" data-parsoid='{"stx":"simple","a":{"href":"./Main_Page#.3E"},"sa":{"href":"%23%3e"}}'>#></a></p>
7791 !! end
7793 !! test
7794 Link containing "<#" and ">#" as a hex sequences
7795 !! wikitext
7796 [[%3c%23]][[%3e%23]]
7797 !! html
7798 <p>[[%3c%23]][[%3e%23]]
7799 </p>
7800 !! end
7802 !! test
7803 Link containing an equals sign
7804 !! wikitext
7805 [[Special:BookSources/isbn=4-00-026157-6]]
7806 !! html/php
7807 <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>
7808 </p>
7809 !! html/parsoid
7810 <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>
7811 !! end
7813 !! article
7814 Foo~bar
7815 !! text
7816 Just a test of an article title containing a tilde.
7817 !! endarticle
7819 # note that links containing signatures, like [[Foo~~~~]], are
7820 # massaged by the pre-save transform (PST) and so the tildes are never
7821 # seen by the parser.
7822 !! test
7823 Link containing a tilde
7824 !! wikitext
7825 [[Foo~bar]]
7826 !! html/php
7827 <p><a href="/wiki/Foo~bar" title="Foo~bar">Foo~bar</a>
7828 </p>
7829 !! html/parsoid
7830 <p><a rel="mw:WikiLink" href="./Foo~bar" title="Foo~bar">Foo~bar</a></p>
7831 !! end
7833 !! test
7834 Link containing double-single-quotes '' (bug 4598)
7835 !! wikitext
7836 [[Lista d''e paise d''o munno]]
7837 !! html/php
7838 <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>
7839 </p>
7840 !! html/parsoid
7841 <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>
7842 !! end
7844 !! test
7845 Link containing double-single-quotes '' in text (bug 4598 sanity check)
7846 !! wikitext
7847 Some [[Link|pretty ''italics'' and stuff]]!
7848 !! html/php
7849 <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>!
7850 </p>
7851 !! html/parsoid
7852 <p>Some <a rel="mw:WikiLink" href="Link" title="Link">pretty <i>italics</i> and stuff</a>!</p>
7853 !! end
7855 !! test
7856 Link containing double-single-quotes '' in text embedded in italics (bug 4598 sanity check)
7857 !! wikitext
7858 ''Some [[Link|pretty ''italics'' and stuff]]!''
7859 !! html
7860 <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>
7861 </p>
7862 !! end
7864 !! test
7865 Link with double quotes in title part (literal) and alternate part (interpreted)
7866 !! wikitext
7867 [[File:Denys_Savchenko_''Pentecoste''.jpg]]
7869 [[''Pentecoste'']]
7871 [[''Pentecoste''|Pentecoste]]
7873 [[''Pentecoste''|''Pentecoste'']]
7874 !! html/php
7875 <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>
7876 </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>
7877 </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>
7878 </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>
7879 </p>
7880 !! html/parsoid
7881 <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>
7882 <p><a rel="mw:WikiLink" href="''Pentecoste''" title="''Pentecoste''">''Pentecoste''</a></p>
7883 <p><a rel="mw:WikiLink" href="''Pentecoste''" title="''Pentecoste''">Pentecoste</a></p>
7884 <p><a rel="mw:WikiLink" href="''Pentecoste''" title="''Pentecoste''"><i>Pentecoste</i></a></p>
7885 !! end
7887 !! test
7888 Broken image links with HTML captions (bug 39700)
7889 !! wikitext
7890 [[File:Nonexistent|<script></script>]]
7891 [[File:Nonexistent|100x100px|<script></script>]]
7892 [[File:Nonexistent|&lt;]]
7893 [[File:Nonexistent|a<i>b</i>c]]
7894 !! html/php
7895 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script&gt;&lt;/script&gt;</a>
7896 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script&gt;&lt;/script&gt;</a>
7897 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;</a>
7898 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">abc</a>
7899 </p>
7900 !! html/parsoid
7901 <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>
7902 <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>
7903 <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>
7904 <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>
7905 !! end
7907 !! test
7908 Plain link to URL
7909 !! wikitext
7910 [[http://www.example.com]]
7911 !! html/php
7912 <p>[<a rel="nofollow" class="external autonumber" href="http://www.example.com">[1]</a>]
7913 </p>
7914 !! html/parsoid
7915 <p>[<a rel="mw:ExtLink" href="http://www.example.com"></a>]</p>
7916 !! end
7918 !! test
7919 Plain link to URL with link text
7920 !! wikitext
7921 [[http://www.example.com Link text]]
7922 !! html
7923 <p>[<a rel="nofollow" class="external text" href="http://www.example.com">Link text</a>]
7924 </p>
7925 !! end
7927 !! test
7928 Plain link to protocol-relative URL
7929 !! wikitext
7930 [[//www.example.com]]
7931 !! html/php
7932 <p>[<a rel="nofollow" class="external autonumber" href="//www.example.com">[1]</a>]
7933 </p>
7934 !! html/parsoid
7935 <p>[<a rel="mw:ExtLink" href="//www.example.com"></a>]</p>
7936 !! end
7938 !! test
7939 Plain link to protocol-relative URL with link text
7940 !! wikitext
7941 [[//www.example.com Link text]]
7942 !! html
7943 <p>[<a rel="nofollow" class="external text" href="//www.example.com">Link text</a>]
7944 </p>
7945 !! end
7947 !! test
7948 Plain link to page with question mark in title
7949 !! wikitext
7950 [[A?b]]
7952 [[A?b|Baz]]
7953 !! html
7954 <p><a href="/wiki/A%3Fb" title="A?b">A?b</a>
7955 </p><p><a href="/wiki/A%3Fb" title="A?b">Baz</a>
7956 </p>
7957 !! end
7960 # I'm fairly sure the expected result here is wrong.
7961 # We want these to be URL links, not pseudo-pages with URLs for titles....
7962 # However the current output is also pretty screwy.
7964 # ----
7965 # I'm changing it to match the current output--it arguably makes more
7966 # sense in the light of the test above. Old expected result was:
7967 #<p>Piped link to URL: <a href="/index.php?title=Http://www.example.com&amp;action=edit" class="new">an example URL</a>
7968 #</p>
7969 # But I think this test is bordering on "garbage in, garbage out" anyway.
7970 # -- wtm
7971 !! test
7972 Piped link to URL
7973 !! wikitext
7974 Piped link to URL: [[http://www.example.com|an example URL]]
7975 !! html/php
7976 <p>Piped link to URL: [<a rel="nofollow" class="external text" href="http://www.example.com%7Can">example URL</a>]
7977 </p>
7978 !! html/parsoid
7979 <p>Piped link to URL: [<a rel="mw:ExtLink" href="http://www.example.com|an">example URL</a>]</p>
7980 !! end
7982 !! test
7983 BUG 2: [[page|http://url/]] should link to page, not http://url/
7984 !! wikitext
7985 [[Main Page|http://url/]]
7986 !! html/php
7987 <p><a href="/wiki/Main_Page" title="Main Page">http://url/</a>
7988 </p>
7989 !! html/parsoid
7990 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">http://url/</a></p>
7991 !! end
7993 # Parsoid does not mark self-links, by design.
7994 !! test
7995 BUG 337: Escaped self-links should be bold
7996 !! options
7997 title=[[Bug462]]
7998 !! wikitext
7999 [[Bu&#103;462]] [[Bug462]]
8000 !! html/php
8001 <p><strong class="selflink">Bu&#103;462</strong> <strong class="selflink">Bug462</strong>
8002 </p>
8003 !! html/php+tidy
8004 <p><strong class="selflink">Bug462</strong> <strong class="selflink">Bug462</strong></p>
8005 !! html/parsoid
8006 <p><a rel="mw:WikiLink" href="./Bug462" title="Bug462">Bug462</a> <a rel="mw:WikiLink" href="./Bug462" title="Bug462">Bug462</a></p>
8007 !! end
8009 !! test
8010 Self-link to section should not be bold
8011 !! options
8012 title=[[Main Page]]
8013 !! wikitext
8014 [[Main Page#section]]
8015 !! html
8016 <p><a href="/wiki/Main_Page#section" title="Main Page">Main Page#section</a>
8017 </p>
8018 !! end
8020 !! article
8022 !! text
8023 This is 00.
8024 !! endarticle
8026 !!test
8027 Self-link to numeric title
8028 !!options
8029 title=[[0]]
8030 !! wikitext
8031 [[0]]
8032 !! html
8033 <p><strong class="selflink">0</strong>
8034 </p>
8035 !!end
8037 !!test
8038 Link to numeric-equivalent title
8039 !!options
8040 title=[[0]]
8041 !! wikitext
8042 [[00]]
8043 !! html
8044 <p><a href="/wiki/00" title="00">00</a>
8045 </p>
8046 !!end
8048 !! test
8049 <nowiki> inside a link
8050 !! wikitext
8051 [[Main<nowiki> Page</nowiki>]] [[Main Page|the main page <nowiki>[it's not very good]</nowiki>]]
8052 !! html
8053 <p>[[Main Page]] <a href="/wiki/Main_Page" title="Main Page">the main page [it's not very good]</a>
8054 </p>
8055 !! end
8057 !! test
8058 Non-breaking spaces in title
8059 !! wikitext
8060 [[&nbsp; Main &nbsp; Page &nbsp;]]
8061 !! html
8062 <p><a href="/wiki/Main_Page" title="Main Page">&#160; Main &#160; Page &#160;</a>
8063 </p>
8064 !!end
8066 !! test
8067 Internal link with ca linktrail, surrounded by bold apostrophes (bug 27473 primary issue)
8068 !! options
8069 language=ca
8070 !! wikitext
8071 '''[[Main Page]]'''
8072 !! html
8073 <p><b><a href="/wiki/Main_Page" title="Main Page">Main Page</a></b>
8074 </p>
8075 !! end
8077 !! test
8078 Internal link with ca linktrail, surrounded by italic apostrophes (bug 27473 primary issue)
8079 !! options
8080 language=ca
8081 !! wikitext
8082 ''[[Main Page]]''
8083 !! html
8084 <p><i><a href="/wiki/Main_Page" title="Main Page">Main Page</a></i>
8085 </p>
8086 !! end
8088 !! test
8089 Internal link with en linktrail: no apostrophes (bug 27473)
8090 !! options
8091 language=en
8092 !! wikitext
8093 [[Something]]'nice
8094 !! html
8095 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (page does not exist)">Something</a>'nice
8096 </p>
8097 !! end
8099 !! test
8100 Internal link with ca linktrail with apostrophes (bug 27473)
8101 !! options
8102 language=ca
8103 !! wikitext
8104 [[Something]]'nice
8105 !! html
8106 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (encara no existeix)">Something'nice</a>
8107 </p>
8108 !! end
8110 !! test
8111 Internal link with kaa linktrail with apostrophes (bug 27473)
8112 !! options
8113 language=kaa
8114 !! wikitext
8115 [[Something]]'nice
8116 !! html
8117 <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>
8118 </p>
8119 !! end
8121 !! test
8122 Link with multiple ":" in a subpage-supporting namespace (bug 63636)
8123 !! wikitext
8124 [[User:Foo/Test/63636:Bar|Test]]
8125 !! html/php
8126 <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>
8127 </p>
8128 !! html/parsoid
8129 <p><a rel="mw:WikiLink" href="./User:Foo/Test/63636:Bar" title="User:Foo/Test/63636:Bar">Test</a></p>
8130 !! end
8132 ## Mainly a sanity check for Parsoid
8133 !! test
8134 Handle title parsing for subpages
8135 !! options
8136 title=[[/123123]]
8137 !! wikitext
8139 !! html/parsoid
8140 <p>123</p>
8141 !! end
8143 ## FIXME: Add a working php section here
8144 !! test
8145 Link to a subpage from a namespace other than main
8146 !! options
8147 title=[[User:test]]
8148 !! wikitext
8149 [[/123]]
8150 !! html/parsoid
8151 <p><a rel="mw:WikiLink" href="./User:Test/123" title="User:Test/123" data-parsoid='{"stx":"simple","a":{"href":"./User:Test/123"},"sa":{"href":"/123"}}'>/123</a></p>
8152 !! end
8154 !! test
8155 Ensure that transclusion titles are not url-decoded
8156 !! options
8157 subpage title=[[Test]]
8158 parsoid=wt2html
8159 !! wikitext
8160 {{Bar%C3%A9}} {{/Bar%C3%A9}}
8161 !! html/php
8162 <p>{{Bar%C3%A9}} {{/Bar%C3%A9}}
8163 </p>
8164 !! html/parsoid
8165 <p>{{Bar%C3%A9}} {{/Bar%C3%A9}}</p>
8166 !! end
8168 !! test
8169 Purely hash wikilink
8170 !! options
8171 title=[[User:test/123]]
8172 !! wikitext
8173 [[#a|b]]
8174 !! html/php
8175 <p><a href="#a">b</a>
8176 </p>
8177 !! html/parsoid
8178 <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>
8179 !! end
8181 !! test
8182 1. Interaction of linktrail and template encapsulation
8183 !! options
8184 parsoid
8185 !! wikitext
8186 {{echo|[[Foo]]}}l
8187 !! html
8188 <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>
8189 !! end
8191 !! test
8192 2. Interaction of linktrail and template encapsulation
8193 !! options
8194 parsoid
8195 !! wikitext
8196 {{echo|Some [[Fool]]}}s
8197 !! html
8198 <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>
8199 !! end
8201 !! test
8202 3. Interaction of linktrail and template encapsulation
8203 !! options
8204 parsoid
8205 !! wikitext
8206 {{echo|Some [[Fool]]s are '''bold and foolish'''}}
8207 !! html
8208 <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>
8209 !! end
8211 !! article
8212 Söfnuður
8213 !! text
8214 Test.
8215 !! endarticle
8217 !! test
8218 Internal link with is link prefix
8219 !! options
8220 language=is
8221 !! wikitext
8222 Aðrir mótmælenda[[söfnuður|söfnuðir]] og
8223 !! html
8224 <p>Aðrir <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðir</a> og
8225 </p>
8226 !! end
8228 !! article
8229 Mótmælendatrú
8230 !! text
8231 Test.
8232 !! endarticle
8234 !! test
8235 Internal link with is link trail and link prefix
8236 !! options
8237 language=is
8238 !! wikitext
8239 [[mótmælendatrú|xxx]]ar
8240 [[mótmælendatrú]]ar
8241 mótmælenda[[söfnuður]]
8242 mótmælenda[[söfnuður|söfnuðir]]
8243 mótmælenda[[söfnuður|söfnuðir]]xxx
8244 !! html
8245 <p><a href="/wiki/M%C3%B3tm%C3%A6lendatr%C3%BA" title="Mótmælendatrú">xxxar</a>
8246 <a href="/wiki/M%C3%B3tm%C3%A6lendatr%C3%BA" title="Mótmælendatrú">mótmælendatrúar</a>
8247 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuður</a>
8248 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðir</a>
8249 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðirxxx</a>
8250 </p>
8251 !! end
8253 !! test
8254 Parsoid link trail escaping
8255 !! options
8256 parsoid=html2wt,html2html
8257 !! html/parsoid
8258 <p><a rel="mw:WikiLink" href="Apple" title="Apple">apple</a>s</p>
8259 !! wikitext
8260 [[apple]]<nowiki/>s
8261 !! end
8263 !! test
8264 Parsoid link prefix escaping
8265 !! options
8266 language=is
8267 parsoid=html2wt,html2html
8268 !! html/parsoid
8269 <p>Aðrir mótmælenda<a rel="mw:WikiLink" href="Söfnuður" title="Söfnuður">söfnuður</a></p>
8270 !! wikitext
8271 Aðrir mótmælenda<nowiki/>[[söfnuður]]
8272 !! end
8274 !! test
8275 Parsoid-centric test: Whitespace in ext- and wiki-links should be preserved
8276 !! wikitext
8277 [[Foo|  bar]]
8279 [[Foo|  ''bar'']]
8281 [http://wp.org   foo]
8283 [http://wp.org   ''foo'']
8284 !! html
8285 <p><a href="/wiki/Foo" title="Foo">  bar</a>
8286 </p><p><a href="/wiki/Foo" title="Foo">  <i>bar</i></a>
8287 </p><p><a rel="nofollow" class="external text" href="http://wp.org">foo</a>
8288 </p><p><a rel="nofollow" class="external text" href="http://wp.org"><i>foo</i></a>
8289 </p>
8290 !! end
8292 !! test
8293 Parsoid: Scoped parsing should handle mixed transclusions and plain text
8294 !! options
8295 parsoid
8296 !! wikitext
8297 [[Foo|{{echo|a}} b {{echo|c}}]]
8298 !! html
8299 <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>
8300 !! end
8302 !! test
8303 Link with angle bracket after anchor
8304 !! wikitext
8305 [[Foo#<bar>]]
8306 !! html/php
8307 <p><a href="/wiki/Foo#.3Cbar.3E" title="Foo">Foo#&lt;bar&gt;</a>
8308 </p>
8309 !! html/parsoid
8310 <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>
8311 !! end
8314 ### Interwiki links (see maintenance/interwiki.sql)
8317 !! test
8318 Inline interwiki link
8319 !! options
8320 parsoid=wt2html,wt2wt,html2html
8321 !! wikitext
8322 [[MeatBall:SoftSecurity]]
8323 !! html/php
8324 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity</a>
8325 </p>
8326 !! html/parsoid
8327 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity" title="meatball:SoftSecurity">MeatBall:SoftSecurity</a></p>
8328 !! end
8330 !! test
8331 Inline interwiki link with empty title (bug 2372)
8332 !! options
8333 parsoid=wt2html,wt2wt,html2html
8334 !! wikitext
8335 [[MeatBall:]]
8336 !! html/php
8337 <p><a href="http://www.usemod.com/cgi-bin/mb.pl" class="extiw" title="meatball:">MeatBall:</a>
8338 </p>
8339 !! html/parsoid
8340 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?" title="meatball:">MeatBall:</a></p>
8341 !! end
8343 !! test
8344 Interwiki link encoding conversion (bug 1636)
8345 !! wikitext
8346 *[[Wikipedia:ro:Olteni&#0355;a]]
8347 *[[Wikipedia:ro:Olteni&#355;a]]
8348 !! html
8349 <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>
8350 <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>
8352 !! html+tidy
8353 <ul>
8354 <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>
8355 <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>
8356 </ul>
8357 !! end
8359 !! test
8360 Interwiki link with fragment (bug 2130)
8361 !! wikitext
8362 [[MeatBall:SoftSecurity#foo]]
8363 !! html
8364 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity#foo" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity#foo</a>
8365 </p>
8366 !! end
8368 !! test
8369 Link scenarios with escaped fragments
8370 !! wikitext
8371 [[#Is this great?]]
8372 [[Foo#Is this great?]]
8373 [[meatball:Foo#Is this great?]]
8374 !! html/php
8375 <p><a href="#Is_this_great.3F">#Is this great?</a>
8376 <a href="/wiki/Foo#Is_this_great.3F" title="Foo">Foo#Is this great?</a>
8377 <a href="http://www.usemod.com/cgi-bin/mb.pl?Foo#Is_this_great.3F" class="extiw" title="meatball:Foo">meatball:Foo#Is this great?</a>
8378 </p>
8379 !! html/parsoid
8380 <p><a rel="mw:WikiLink" href="./Main_Page#Is_this_great.3F" data-parsoid='{"stx":"simple","a":{"href":"./Main_Page#Is_this_great.3F"},"sa":{"href":"#Is this great?"}}'>#Is this great?</a>
8381 <a rel="mw:WikiLink" href="./Foo#Is_this_great.3F" title="Foo" data-parsoid='{"stx":"simple","a":{"href":"./Foo#Is_this_great.3F"},"sa":{"href":"Foo#Is this great?"}}'>Foo#Is this great?</a>
8382 <a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?Foo#Is_this_great.3F" title="meatball:Foo" data-parsoid='{"stx":"simple","a":{"href":"http://www.usemod.com/cgi-bin/mb.pl?Foo#Is_this_great.3F"},"sa":{"href":"meatball:Foo#Is this great?"},"isIW":true}'>meatball:Foo#Is this great?</a></p>
8383 !! end
8385 # Ideally the wikipedia: prefix here should be proto-relative too
8386 # [CSA]: this is kind of a bogus test, as the PHP parser test doesn't
8387 # define the 'en' prefix, and originally the test used 'wikipedia',
8388 # which isn't a localinterwiki prefix hence the links to the 'en:Foo'
8389 # article.
8390 !! test
8391 Different interwiki prefixes mapping to the same URL
8392 !! wikitext
8393 [[:en:Foo]]
8395 [[:en:Foo|Foo]]
8397 [[wikipedia:Foo]]
8399 [[:wikipedia:Foo|Foo]]
8401 [[wikipedia:en:Foo]]
8403 [[:wikipedia:en:Foo]]
8405 [[  wikiPEdia :Foo]]
8406 !! html/parsoid
8407 <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>
8409 <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>
8411 <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>
8413 <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>
8415 <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>
8417 <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>
8419 <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>
8420 !! end
8422 !! test
8423 Interwiki links that cannot be represented in wiki syntax
8424 !! wikitext
8425 [[meatball:ok]]
8426 [[meatball:ok#foo|ok with fragment]]
8427 [[meatball:ok_as_well?|ok ending with ? mark]]
8428 [http://de.wikipedia.org/wiki/Foo?action=history has query]
8429 [http://de.wikipedia.org/wiki/#foo is just fragment]
8431 !! html/php
8432 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?ok" class="extiw" title="meatball:ok">meatball:ok</a>
8433 <a href="http://www.usemod.com/cgi-bin/mb.pl?ok#foo" class="extiw" title="meatball:ok">ok with fragment</a>
8434 <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>
8435 <a rel="nofollow" class="external text" href="http://de.wikipedia.org/wiki/Foo?action=history">has query</a>
8436 <a rel="nofollow" class="external text" href="http://de.wikipedia.org/wiki/#foo">is just fragment</a>
8437 </p>
8438 !! html/parsoid
8439 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?ok" title="meatball:ok">meatball:ok</a>
8440 <a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?ok#foo" title="meatball:ok">ok with fragment</a>
8441 <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>
8442 <a rel="mw:ExtLink" href="http://de.wikipedia.org/wiki/Foo?action=history">has query</a>
8443 <a rel="mw:ExtLink" href="http://de.wikipedia.org/wiki/#foo">is just fragment</a></p>
8444 !! end
8446 !! test
8447 Interwiki links: trail
8448 !! wikitext
8449 [[wikipedia:Foo|Ba]]r
8450 !! html/php
8451 <p><a href="http://en.wikipedia.org/wiki/Foo" class="extiw" title="wikipedia:Foo">Bar</a>
8452 </p>
8453 !! html/parsoid
8454 <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>
8455 !! end
8457 !! test
8458 Local interwiki link
8459 !! options
8460 parsoid=wt2html,wt2wt,html2html
8461 !! wikitext
8462 [[local:Template:Foo]]
8463 !! html/php
8464 <p><a href="/wiki/Template:Foo" title="Template:Foo">local:Template:Foo</a>
8465 </p>
8466 !! html/parsoid
8467 <p><a rel="mw:WikiLink" href="./Template:Foo" title="Template:Foo">local:Template:Foo</a></p>
8468 !! end
8470 # Parsoid does not mark self-links, by design.
8471 !! test
8472 Local interwiki link: self-link to current page
8473 !! options
8474 title=[[Main Page]]
8475 parsoid=wt2html,wt2wt,html2html
8476 !! wikitext
8477 [[local:Main Page]]
8478 !! html/php
8479 <p><strong class="selflink">local:Main Page</strong>
8480 </p>
8481 !! html/parsoid
8482 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">local:Main Page</a></p>
8483 !! end
8485 !! test
8486 Local interwiki link: prefix only (bug 64167)
8487 !! options
8488 parsoid=wt2html,wt2wt,html2html
8489 !! wikitext
8490 [[local:]]
8491 !! html/php
8492 <p><a href="/wiki/Main_Page" title="Main Page">local:</a>
8493 </p>
8494 !! html/parsoid
8495 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">local:</a></p>
8496 !! end
8498 !! test
8499 Local interwiki link: with additional interwiki prefix (bug 61357)
8500 !! options
8501 parsoid=wt2html,wt2wt,html2html
8502 !! wikitext
8503 [[local:meatball:Hello]]
8504 !! html/php
8505 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?Hello" class="extiw" title="meatball:Hello">local:meatball:Hello</a>
8506 </p>
8507 !! html/parsoid
8508 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?Hello" title="meatball:Hello">local:meatball:Hello</a></p>
8509 !! end
8511 !! test
8512 Multiple local interwiki link prefixes
8513 !! wikitext
8514 [[local:local:local:local:mi:local:Foo]]
8515 !! options
8516 parsoid=wt2html,wt2wt,html2html
8517 !! html/php
8518 <p><a href="/wiki/Foo" title="Foo">local:local:local:local:mi:local:Foo</a>
8519 </p>
8520 !! html/parsoid
8521 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">local:local:local:local:mi:local:Foo</a></p>
8522 !! end
8525 ### Interlanguage links
8526 ### Language links (so that searching for '### language' matches..)
8529 !! test
8530 Interlanguage link
8531 !! wikitext
8532 Blah blah blah
8533 [[zh:Chinese]]
8534 !! html/php
8535 <p>Blah blah blah
8536 </p>
8537 !! html/parsoid
8538 <p>Blah blah blah</p>
8539 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
8540 !! end
8542 ## parsoid html2wt will lose the space variations
8543 !! test
8544 Interlanguage link with spacing
8545 !! options
8546 parsoid=wt2html,wt2wt,html2html
8547 !! wikitext
8548 Blah blah blah
8549 [[   zh  :    Chinese     ]]
8550 !! html/php
8551 <p>Blah blah blah
8552 </p>
8553 !! html/parsoid
8554 <p>Blah blah blah</p>
8555 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
8556 !! end
8558 !! test
8559 Double interlanguage link
8560 !! wikitext
8561 Blah blah blah
8562 [[es:Spanish]]
8563 [[zh:Chinese]]
8564 !! html/php
8565 <p>Blah blah blah
8566 </p>
8567 !! html/parsoid
8568 <p>Blah blah blah</p>
8569 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Spanish"/>
8570 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
8571 !! end
8573 ## parsoid html2wt will lose the space variations
8574 !! test
8575 Interlanguage link variations
8576 !! options
8577 parsoid=wt2html,wt2wt,html2html
8578 !! wikitext
8579 Blah blah blah
8580 [[   es :Spanish]]
8581 [[ ZH :Chinese]]
8582 [[es:Foo_bar]]
8583 !! html/php
8584 <p>Blah blah blah
8585 </p>
8586 !! html/parsoid
8587 <p>Blah blah blah</p>
8588 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Spanish" />
8589 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese" />
8590 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Foo_bar" />
8591 !! end
8593 ## parsoid html2wt will normalize the space to _
8594 !! test
8595 Space and question mark encoding in interlanguage links (T95473)
8596 !! options
8597 parsoid=wt2html,wt2wt,html2html
8598 !! wikitext
8599 Blah blah blah
8600 [[es:Foo bar?]]
8601 !! html/php
8602 <p>Blah blah blah
8603 </p>
8604 !! html/parsoid
8605 <p>Blah blah blah</p>
8606 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Foo_bar%3F" />
8607 !! end
8609 !! test
8610 Interlanguage link, with prefix links
8611 !! options
8612 language=ln
8613 !! wikitext
8614 Blah blah blah
8615 [[zh:Chinese]]
8616 !! html/php
8617 <p>Blah blah blah
8618 </p>
8619 !! html/parsoid
8620 <p>Blah blah blah</p>
8621 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
8622 !! end
8624 !! test
8625 Double interlanguage link, with prefix links (bug 8897)
8626 !! options
8627 language=ln
8628 !! wikitext
8629 Blah blah blah
8630 [[es:Spanish]]
8631 [[zh:Chinese]]
8632 !! html/php
8633 <p>Blah blah blah
8634 </p>
8635 !! html/parsoid
8636 <p>Blah blah blah</p>
8637 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Spanish"/>
8638 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
8639 !! end
8641 !! test
8642 "Extra" interlanguage links (bug 32189 / gerrit 111390)
8643 !! wikitext
8644 Blah blah blah
8645 [[mul:Article]]
8646 !! html/php
8647 <p>Blah blah blah
8648 </p>
8649 !! html/parsoid
8650 <p>Blah blah blah</p>
8651 <link rel="mw:PageProp/Language" title="Multilingual" href="http://wikisource.org/wiki/Article"/>
8652 !! end
8654 ## PHP parser tests script needs an update
8655 ## Parsoid html2wt will normalize output to [[:zh:Chinese]]
8656 !! test
8657 Language links render as inline links if $wgInterwikiMagic=false
8658 !! options
8659 wgInterwikiMagic=false
8660 parsoid=wt2html,wt2wt,html2html
8661 !! wikitext
8662 Blah blah blah
8663 [[zh:Chinese]]
8664 !! html/parsoid
8665 <p>Blah blah blah <a rel="mw:ExtLink" href="http://zh.wikipedia.org/wiki/Chinese" title="zh:Chinese">zh:Chinese</a></p>
8666 !! end
8668 ## PHP parser tests script needs an update
8669 ## Parsoid html2wt will normalize output to [[:zh:Chinese]]
8670 !! test
8671 Language links render as inline links in the Talk namespace
8672 !! options
8673 title=Talk:Foo
8674 parsoid=wt2html,wt2wt,html2html
8675 !! wikitext
8676 Blah blah blah
8677 [[zh:Chinese]]
8678 !! html/parsoid
8679 <p>Blah blah blah <a rel="mw:ExtLink" href="http://zh.wikipedia.org/wiki/Chinese" title="zh:Chinese">zh:Chinese</a></p>
8680 !! end
8682 !! test
8683 Parsoid-specific test: Wikilinks with &nbsp; should RT properly
8684 !! options
8685 language=ln
8686 !! wikitext
8687 [[WW&nbsp;II]]
8688 !! html
8689 <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>
8690 </p>
8691 !! end
8693 !! test
8694 Parsoid bug 53221: Wikilinks should be properly entity-escaped
8695 !! options
8696 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
8697 !! html/parsoid
8698 <p>He&amp;nbsp;llo <a href="Foo" rel="mw:WikiLink">He&amp;nbsp;llo</a></p>
8699 <p>He&amp;nbsp;llo <a href="He&amp;nbsp;llo" rel="mw:WikiLink">He&amp;nbsp;llo</a></p>
8700 !! wikitext
8701 He&amp;nbsp;llo [[Foo|He&amp;nbsp;llo]]
8703 He&amp;nbsp;llo He&amp;nbsp;llo
8704 !! html/php
8705 <p>He&amp;nbsp;llo <a href="/wiki/Foo" title="Foo">He&amp;nbsp;llo</a>
8706 </p><p>He&amp;nbsp;llo He&amp;nbsp;llo
8707 </p>
8708 !! end
8710 # html2wt will fail because of title normalization without data-parsoid
8711 !! test
8712 Parsoid: handle constructor well
8713 !! options
8714 parsoid=wt2html,wt2wt
8715 !! wikitext
8716 [[constructor]]
8718 [[constructor:foo]]
8719 !! html/php
8720 <p><a href="/index.php?title=Constructor&amp;action=edit&amp;redlink=1" class="new" title="Constructor (page does not exist)">constructor</a>
8721 </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>
8722 </p>
8723 !! html/parsoid
8724 <p><a rel="mw:WikiLink" href="./Constructor" title="Constructor" data-parsoid='{"stx":"simple","a":{"href":"./Constructor"},"sa":{"href":"constructor"}}'>constructor</a></p>
8726 <p><a rel="mw:WikiLink" href="./Constructor:foo" title="Constructor:foo" data-parsoid='{"stx":"simple","a":{"href":"./Constructor:foo"},"sa":{"href":"constructor:foo"}}'>constructor:foo</a></p>
8727 !! end
8729 !! article
8731 !! text
8732 Test.
8733 !! endarticle
8735 # Note that `ko` isn't a known interlanguage prefix
8736 !! test
8737 Parsoid: recognize interlanguage links without a target page
8738 !! options
8740 !! wikitext
8741 [[es:]]
8743 [[ko:]]
8744 !! html/php
8746 !! html/parsoid
8747 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/"/>
8749 <p><a rel="mw:WikiLink" href="./Ko:" title="Ko:">ko:</a></p>
8750 !! end
8752 # Note that `ko` isn't a known interwiki prefix
8753 !! test
8754 Parsoid: recognize interwiki links without a target page
8755 !! options
8756 parsoid=wt2html,wt2wt,html2html
8757 !! wikitext
8758 [[:es:]]
8760 [[:ko:]]
8761 !! html/php
8762 <p><a href="http://es.wikipedia.org/wiki/" class="extiw" title="es:">es:</a>
8763 </p><p><a href="/wiki/Ko:" title="Ko:">ko:</a>
8764 </p>
8765 !! html/parsoid
8766 <p><a rel="mw:ExtLink" href="http://es.wikipedia.org/wiki/" title="es:">es:</a></p>
8767 <p><a rel="mw:WikiLink" href="./Ko:" title="Ko:">ko:</a></p>
8768 !! end
8770 !! test
8771 Handle interwiki links pointing to the current wiki as plain wiki links (bug 45209)
8772 !! wikitext
8773 [[mi:Foo]]
8774 !! html/php
8775 <p><a href="/wiki/Foo" title="Foo">mi:Foo</a>
8776 </p>
8777 !! html/parsoid
8778 <p><a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{"stx":"simple","a":{"href":"./Foo"},"sa":{"href":"mi:Foo"}}'>mi:Foo</a></p>
8779 !! end
8781 !! test
8782 Interlanguage link with preceding local interwiki link (bug 68085)
8783 !! options
8784 parsoid=wt2html,wt2wt,html2html
8785 !! wikitext
8786 Blah blah blah
8787 [[local:es:Spanish]]
8788 !! html/php
8789 <p>Blah blah blah
8790 <a href="http://es.wikipedia.org/wiki/Spanish" class="extiw" title="es:Spanish">local:es:Spanish</a>
8791 </p>
8792 !! html/parsoid
8793 <p>Blah blah blah
8794 <a rel="mw:ExtLink" href="http://es.wikipedia.org/wiki/Spanish" title="es:Spanish">local:es:Spanish</a></p>
8795 !! end
8797 !! test
8798 Looks like an interlanguage link, but is actually a local interwiki
8799 !! options
8800 parsoid=wt2html,wt2wt,html2html
8801 !! wikitext
8802 Blah blah blah
8803 [[mi:Template:Foo]]
8804 !! html/php
8805 <p>Blah blah blah
8806 <a href="/wiki/Template:Foo" title="Template:Foo">mi:Template:Foo</a>
8807 </p>
8808 !! html/parsoid
8809 <p>Blah blah blah
8810 <a rel="mw:WikiLink" href="./Template:Foo" title="Template:Foo">mi:Template:Foo</a></p>
8811 !! end
8814 ### Redirects, Parsoid-only
8817 !! test
8818 1. Simple redirect to page
8819 !! wikitext
8820 #REDIRECT [[Main Page]]
8821 !! html/parsoid
8822 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
8823 !! end
8825 !! test
8826 2. Other redirect variants
8827 !! wikitext
8828 #REDIRECT [[Main_Page]]
8829 !! html/parsoid
8830 <link rel="mw:PageProp/redirect" href="./Main_Page" data-parsoid='{"src":"#REDIRECT ","a":{"href":"./Main_Page"},"sa":{"href":"Main_Page"}}'/>
8831 !! end
8833 # Not a valid redirect in PHP (although perhaps it was, once upon a time)
8834 # This tests the Parsoid bail-out code.
8835 !! test
8836 3. Other redirect variants
8837 !! wikitext
8838 #REDIRECT [[<nowiki>[[Bar]]</nowiki>]]
8839 !! html/parsoid
8840 <ol><li data-parsoid>REDIRECT [[[[Bar]]]]</li></ol>
8841 !! end
8843 !! test
8844 4. Redirect to a templated destination
8845 !! wikitext
8846 #REDIRECT [[{{echo|Foo}}bar]]
8847 !! html/parsoid
8848 <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"}]]}'/>
8849 !! end
8851 !! test
8852 Empty redirect
8853 !! options
8854 parsoid=wt2html,wt2wt
8855 !! wikitext
8856 #REDIRECT [[]]
8857 !! html/parsoid
8858 <ol>
8859 <li>REDIRECT [[]]</li></ol>
8860 !! end
8862 !! test
8863 Optional colon in #REDIRECT
8864 !! options
8865 # the colon is archaic syntax.  we support it for wt2html, but we
8866 # don't care that it roundtrips back to the modern syntax.
8867 parsoid=wt2html,html2html
8868 !! wikitext
8869 #REDIRECT:[[Main Page]]
8870 !! html/parsoid
8871 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
8872 !! end
8874 !! test
8875 Whitespace in #REDIRECT with optional colon
8876 !! options
8877 # the colon and gratuitous whitespace is archaic syntax.  we support
8878 # it for wt2html, but we don't care that it roundtrips back to the
8879 # modern syntax (without extra whitespace)
8880 parsoid=wt2html,html2html
8881 !! wikitext
8883  #REDIRECT 
8885 [[Main Page]]
8886 !! html/parsoid
8887 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
8888 !! end
8890 !! test
8891 Piped link in #REDIRECT
8892 !! options
8893 # content after piped link is ignored.  we support this syntax,
8894 # but don't care that the piped link is lost when we roundtrip this.
8895 parsoid=wt2html
8896 !! wikitext
8897 #REDIRECT [[Main Page|bar]]
8898 !! html/parsoid
8899 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
8900 !! end
8902 !! test
8903 Redirect to category (T104502)
8904 !! options
8905 parsoid=wt2html,wt2wt
8906 !! wikitext
8907 #REDIRECT [[Category:Foo]]
8908 !! html/parsoid
8909 <link rel="mw:PageProp/redirect" href="./Category:Foo"/>
8910 !! end
8912 !! test
8913 Redirect to category with URL encoding (T104502)
8914 !! options
8915 parsoid=wt2html
8916 !! wikitext
8917 #REDIRECT [[Category%3AFoo]]
8918 !! html/parsoid
8919 <link rel="mw:PageProp/redirect" href="./Category:Foo"/>
8920 !! end
8922 !! test
8923 Redirect to category page
8924 !! wikitext
8925 #REDIRECT [[:Category:Foo]]
8926 !! html/parsoid
8927 <link rel="mw:PageProp/redirect" href="./Category:Foo"/>
8928 !! end
8930 !! test
8931 Redirect to image page (1)
8932 !! wikitext
8933 #REDIRECT [[File:Wiki.png]]
8934 !! html/parsoid
8935 <link rel="mw:PageProp/redirect" href="./File:Wiki.png"/>
8936 !! end
8938 !! test
8939 Redirect to image page (2)
8940 !! wikitext
8941 #REDIRECT [[Image:Wiki.png]]
8942 !! html/parsoid
8943 <link rel="mw:PageProp/redirect" href="./File:Wiki.png"  data-parsoid='{"src":"#REDIRECT ","a":{"href":"./File:Wiki.png"},"sa":{"href":"Image:Wiki.png"}}'/>
8944 !! end
8946 # html2wt disabled because wts serializes as "#REDIRECT [[:en:File:Wiki.png]]"
8947 # Next test confirms this.
8948 !! test
8949 Redirect to language (1) (T104918)
8950 !! options
8951 parsoid=wt2html,wt2wt,html2html
8952 !! wikitext
8953 #REDIRECT [[en:File:Wiki.png]]
8954 !! html/parsoid
8955 <link rel="mw:PageProp/redirect" href="//en.wikipedia.org/wiki/File:Wiki.png"/>
8956 !! end
8958 !! test
8959 Redirect to language (2) (T104918)
8960 !! wikitext
8961 #REDIRECT [[:en:File:Wiki.png]]
8962 !! html/parsoid
8963 <link rel="mw:PageProp/redirect" href="//en.wikipedia.org/wiki/File:Wiki.png"/>
8964 !! end
8966 !! test
8967 Redirect to interwiki (T104918)
8968 !! wikitext
8969 #REDIRECT [[meatball:File:Wiki.png]]
8970 !! html/parsoid
8971 <link rel="mw:PageProp/redirect" href="http://www.usemod.com/cgi-bin/mb.pl?File:Wiki.png"/>
8972 !! end
8974 !! test
8975 Non-English #REDIRECT
8976 !! options
8977 language=is
8978 !! wikitext
8979 #TILVÍSUN [[Main Page]]
8980 !! html/parsoid
8981 <link rel="mw:PageProp/redirect" href="./Main_Page" data-parsoid='{"src":"#TILVÍSUN ","a":{"href":"./Main_Page"},"sa":{"href":"Main Page"}}'/>
8982 !! end
8984 !! test
8985 Redirect syntax under text isn't considered a redirect
8986 !! wikitext
8987 some text
8988 #redirect [[Main Page]]
8989 !! html/parsoid
8990 <p>some text</p>
8991 <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>
8992 !! end
8994 # FIXME: Should hoist the redirect to the top of the page and ensure there
8995 # is only one.
8996 !! test
8997 New redirect
8998 !! options
8999 parsoid=html2wt
9000 !! html/parsoid
9001 <p>Foo<link rel="mw:PageProp/redirect" href="./Foo"/></p>
9002 !! wikitext
9004 #REDIRECT [[Foo]]
9005 !! end
9008 ## XHTML tidiness
9011 !! test
9012 <br> to <br />
9013 !! wikitext
9014 1<br>2<br />3
9015 !! html
9016 <p>1<br />2<br />3
9017 </p>
9018 !! end
9020 !! test
9021 Broken br tag sanitization
9022 !! wikitext
9023 </br>
9024 !! html/php
9025 <p>&lt;/br&gt;
9026 </p>
9027 !! end
9029 # TODO: Fix html2html mode (bug 51055)!
9030 !! test
9031 Parsoid: Broken br tag recognition
9032 !! options
9033 parsoid=wt2html
9034 !! wikitext
9035 </br>
9037 <br/ >
9038 !! html+tidy
9039 <p><br /></p>
9040 <p><br /></p>
9041 !! end
9043 !! test
9044 Incorrecly removing closing slashes from correctly formed XHTML
9045 !! wikitext
9046 <br style="clear:both;" />
9047 !! html
9048 <p><br style="clear:both;" />
9049 </p>
9050 !! end
9052 !! test
9053 Failing to transform badly formed HTML into correct XHTML
9054 !! wikitext
9055 <br style="clear: left;">
9056 <br style="clear: right;">
9057 <br style="clear: both;">
9058 !! html
9059 <p><br style="clear: left;" />
9060 <br style="clear: right;" />
9061 <br style="clear: both;" />
9062 </p>
9063 !!end
9065 ## FIXME: Is Parsoid's acceptance of self-closing html-tags
9066 ## a feature or a bug? See https://phabricator.wikimedia.org/T76962
9067 !! test
9068 Handling html with a div self-closing tag
9069 !! wikitext
9070 <div title />
9071 <div title/>
9072 <div title/ >
9073 <div title=bar />
9074 <div title=bar/>
9075 <div title=bar/ >
9076 !! html/php
9077 <p>&lt;div title /&gt;
9078 &lt;div title/&gt;
9079 </p>
9080 <div>
9081 <p>&lt;div title=bar /&gt;
9082 &lt;div title=bar/&gt;
9083 </p>
9084 <div title="bar/"></div>
9085 </div>
9087 !! html/parsoid
9088 <div title="" data-parsoid='{"stx":"html","selfClose":true}'></div>
9089 <div title="" data-parsoid='{"stx":"html","selfClose":true}'></div>
9090 <div title="" data-parsoid='{"stx":"html","selfClose":true,"brokenHTMLTag":true}'></div>
9091 <div title="bar" data-parsoid='{"stx":"html","selfClose":true}'></div>
9092 <div title="bar" data-parsoid='{"stx":"html","selfClose":true}'></div>
9093 <div title="bar/" data-parsoid='{"stx":"html","autoInsertedEnd":true}'></div>
9094 !! end
9096 !! test
9097 Handling html with a br self-closing tag
9098 !! wikitext
9099 <br title />
9100 <br title/>
9101 <br title/ >
9102 <br title=bar />
9103 <br title=bar/>
9104 <br title=bar/ >
9105 !! html/php
9106 <p><br title="" />
9107 <br title="" />
9108 <br />
9109 <br title="bar" />
9110 <br title="bar" />
9111 <br title="bar/" />
9112 </p>
9113 !! html/parsoid
9114 <p><br title="" />
9115 <br title="" />
9116 <br title="" />
9117 <br title="bar" />
9118 <br title="bar" />
9119 <br title="bar/" />
9120 </p>
9121 !! end
9123 !! test
9124 Horizontal ruler (should it add that extra space?)
9125 !! wikitext
9126 <hr>
9127 <hr >
9128 foo <hr
9129 > bar
9130 !! html+tidy
9131 <hr />
9132 <hr />
9133 <p>foo</p>
9134 <hr />
9135 <p>bar</p>
9136 !! end
9138 !! test
9139 Horizontal ruler -- 4+ dashes render hr
9140 !! wikitext
9141 ----
9142 !! html
9143 <hr />
9145 !! end
9147 !! test
9148 Horizontal ruler -- eats additional dashes on the same line
9149 !! wikitext
9150 ---------
9151 !! html
9152 <hr />
9154 !! end
9156 !! test
9157 Horizontal ruler -- does not collapse dashes on consecutive lines
9158 !! wikitext
9159 ----
9160 ----
9161 !! html
9162 <hr />
9163 <hr />
9165 !! end
9167 !! test
9168 Horizontal ruler -- <4 dashes render as plain text
9169 !! wikitext
9171 !! html
9172 <p>---
9173 </p>
9174 !! end
9176 !! test
9177 Horizontal ruler -- Supports content following dashes on same line
9178 !! wikitext
9179 ---- Foo
9180 !! html
9181 <hr /> Foo
9183 !! html+tidy
9184 <hr />
9185 <p>Foo</p>
9186 !! end
9189 ### Block-level elements
9191 !! test
9192 Common list
9193 !! wikitext
9194 *Common list
9195 * item 2
9196 *item 3
9197 !! html
9198 <ul><li>Common list</li>
9199 <li> item 2</li>
9200 <li>item 3</li></ul>
9202 !! end
9204 !! test
9205 Numbered list
9206 !! wikitext
9207 #Numbered list
9208 #item 2
9209 # item 3
9210 !! html
9211 <ol><li>Numbered list</li>
9212 <li>item 2</li>
9213 <li> item 3</li></ol>
9215 !! end
9217 !! test
9218 Mixed list
9219 !! wikitext
9220 *Mixed list
9221 *# with numbers
9222 ** and bullets
9223 *# and numbers
9224 *bullets again
9225 **bullet level 2
9226 ***bullet level 3
9227 ***#Number on level 4
9228 **bullet level 2
9229 **#Number on level 3
9230 **#Number on level 3
9231 *#number level 2
9232 *Level 1
9233 *** Level 3
9234 #** Level 3, but ordered
9235 !! html
9236 <ul><li>Mixed list
9237 <ol><li> with numbers</li></ol>
9238 <ul><li> and bullets</li></ul>
9239 <ol><li> and numbers</li></ol></li>
9240 <li>bullets again
9241 <ul><li>bullet level 2
9242 <ul><li>bullet level 3
9243 <ol><li>Number on level 4</li></ol></li></ul></li>
9244 <li>bullet level 2
9245 <ol><li>Number on level 3</li>
9246 <li>Number on level 3</li></ol></li></ul>
9247 <ol><li>number level 2</li></ol></li>
9248 <li>Level 1
9249 <ul><li><ul><li> Level 3</li></ul></li></ul></li></ul>
9250 <ol><li><ul><li><ul><li> Level 3, but ordered</li></ul></li></ul></li></ol>
9252 !! end
9254 !! test
9255 1. Nested mixed wikitext and html list
9256 !! wikitext
9257 * hi
9258 * <ul><li>ho</li></ul>
9259 * hi
9260 ** ho
9261 !! html/php
9262 <ul><li> hi</li>
9263 <li> <ul><li>ho</li></ul></li>
9264 <li> hi
9265 <ul><li> ho</li></ul></li></ul>
9267 !! html/parsoid
9268 <ul><li> hi</li>
9269 <li> <ul data-parsoid='{"stx":"html"}'><li data-parsoid='{"stx":"html"}'>ho</li></ul></li>
9270 <li> hi
9271 <ul><li> ho</li></ul></li></ul>
9272 !! end
9274 !! test
9275 2. Nested mixed wikitext and html list (incompatible)
9276 !! wikitext
9277 ; hi
9278 : {{echo|<li>ho</li>}}
9279 !! html/php
9280 <dl><dt> hi</dt>
9281 <dd> <li>ho</li></dd></dl>
9283 !! html/parsoid
9284 <dl><dt> hi</dt>
9285 <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>
9286 !! end
9288 !! test
9289 Nested lists 1
9290 !! wikitext
9291 *foo
9292 **bar
9293 !! html
9294 <ul><li>foo
9295 <ul><li>bar</li></ul></li></ul>
9297 !! end
9299 !! test
9300 Nested lists 2
9301 !! wikitext
9302 **foo
9303 *bar
9304 !! html
9305 <ul><li><ul><li>foo</li></ul></li>
9306 <li>bar</li></ul>
9308 !! end
9310 !! test
9311 Nested lists 3 (first element empty)
9312 !! wikitext
9314 **bar
9315 !! html
9316 <ul><li>
9317 <ul><li>bar</li></ul></li></ul>
9319 !! end
9321 !! test
9322 Nested lists 4 (first element empty)
9323 !! wikitext
9325 *bar
9326 !! html
9327 <ul><li><ul><li></li></ul></li>
9328 <li>bar</li></ul>
9330 !! end
9332 !! test
9333 Nested lists 5 (both elements empty)
9334 !! wikitext
9337 !! html
9338 <ul><li><ul><li></li></ul></li>
9339 <li></li></ul>
9341 !! end
9343 !! test
9344 Nested lists 6 (both elements empty)
9345 !! wikitext
9348 !! html
9349 <ul><li>
9350 <ul><li></li></ul></li></ul>
9352 !! end
9354 !! test
9355 Nested lists 7 (skip initial nesting levels)
9356 !! wikitext
9357 *** foo
9358 !! html
9359 <ul><li><ul><li><ul><li> foo</li></ul></li></ul></li></ul>
9361 !! end
9363 !! test
9364 Nested lists 8 (multiple nesting transitions)
9365 !! wikitext
9366 * foo
9367 *** bar
9368 ** baz
9369 * boo
9370 !! html
9371 <ul><li> foo
9372 <ul><li><ul><li> bar</li></ul></li>
9373 <li> baz</li></ul></li>
9374 <li> boo</li></ul>
9376 !! end
9378 !! test
9379 Nested lists 9 (extension interaction)
9380 !! options
9381 parsoid
9382 !! wikitext
9383 *<references />
9384 !! html/parsoid
9385 <ul><li data-parsoid='{}'><ol class="mw-references" typeof="mw:Extension/references" about="#mwt2" data-parsoid='{}' data-mw='{"name":"references","attrs":{}}'></ol></li></ul>
9386 !! end
9388 !! test
9389 1. Lists with start-of-line-transparent tokens before bullets: Comments
9390 !! wikitext
9391 *foo
9392 *<!--cmt-->bar
9393 <!--cmt-->*baz
9394 !! html
9395 <ul><li>foo</li>
9396 <li>bar</li>
9397 <li>baz</li></ul>
9399 !! end
9401 !! test
9402 2. Lists with start-of-line-transparent tokens before bullets: Template close
9403 !! wikitext
9404 *foo {{echo|bar
9405 }}*baz
9406 !! html
9407 <ul><li>foo bar</li>
9408 <li>baz</li></ul>
9410 !! end
9412 !! test
9413 List items are not parsed correctly following a <pre> block (bug 785)
9414 !! wikitext
9415 * <pre>foo</pre>
9416 * <pre>bar</pre>
9417 * zar
9418 !! html/php
9419 <ul><li> <pre>foo</pre></li>
9420 <li> <pre>bar</pre></li>
9421 <li> zar</li></ul>
9423 !! html/parsoid
9424 <ul><li> <pre data-parsoid='{"stx":"html"}'>foo</pre></li>
9425 <li> <pre data-parsoid='{"stx":"html"}'>bar</pre></li>
9426 <li> zar</li></ul>
9427 !! end
9429 !! test
9430 List items from template
9431 !! wikitext
9433 {{inner list}}
9434 * item 2
9436 * item 0
9437 {{inner list}}
9438 * item 2
9440 * item 0
9441 * notSOL{{inner list}}
9442 * item 2
9443 !! html
9444 <ul><li> item 1</li>
9445 <li> item 2</li></ul>
9446 <ul><li> item 0</li>
9447 <li> item 1</li>
9448 <li> item 2</li></ul>
9449 <ul><li> item 0</li>
9450 <li> notSOL</li>
9451 <li> item 1</li>
9452 <li> item 2</li></ul>
9454 !! end
9456 !! test
9457 List interrupted by empty line or heading
9458 !! wikitext
9459 * foo
9461 ** bar
9462 == A heading ==
9463 * Another list item
9464 !! html
9465 <ul><li> foo</li></ul>
9466 <ul><li><ul><li> bar</li></ul></li></ul>
9467 <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>
9468 <ul><li> Another list item</li></ul>
9470 !!end
9472 !!test
9473 Multiple list tags generated by templates
9474 !! wikitext
9475 {{echo|<li>}}a
9476 {{echo|<li>}}b
9477 {{echo|<li>}}c
9478 !! html
9479 <li>a
9480 <li>b
9481 <li>c</li>
9482 </li>
9483 </li>
9485 !! html+tidy
9486 <ul>
9487 <li>a</li>
9488 <li>b</li>
9489 <li>c</li>
9490 </ul>
9491 !!end
9493 !!test
9494 Single-comment whitespace lines dont break lists, and neither do multi-comment whitespace lines
9495 !! wikitext
9497 <!--This line will NOT split the list-->
9499  <!--This line will NOT split the list either-->
9501  <!--foo--> <!----> <!--This line NOT split the list either--> 
9503 !! html
9504 <ul><li>a</li>
9505 <li>b</li>
9506 <li>c</li>
9507 <li>d</li></ul>
9509 !!end
9511 !!test
9512 Replacing whitespace with tabs still doesn't break the list (gerrit 78327)
9513 !! wikitext
9515 <!--This line will NOT split the list-->        
9517         <!--This line will NOT split the list either-->         
9519         <!--foo--> <!---->      <!--This line NOT split the list
9520         either-->        
9522 !! html
9523 <ul><li>a</li>
9524 <li>b</li>
9525 <li>c</li>
9526 <li>d</li></ul>
9528 !!end
9530 !!test
9531 Test the li-hack
9532 (The PHP parser relies on Tidy for the hack)
9533 !!options
9534 parsoid=wt2html,wt2wt
9535 !! wikitext
9536 * foo
9537 * <li>li-hack
9538 * {{echo|<li>templated li-hack}}
9539 * <!--foo--> <li> unsupported li-hack with preceding comments
9541 <ul>
9542 <li><li>not a li-hack
9543 </li>
9544 </ul>
9545 !! html+tidy
9546 <ul>
9547 <li>foo</li>
9548 <li>li-hack</li>
9549 <li>templated li-hack</li>
9550 <li>unsupported li-hack with preceding comments</li>
9551 </ul>
9552 <ul>
9553 <li>not a li-hack</li>
9554 </ul>
9555 !!end
9557 !! test
9558 Parsoid: Make sure nested lists are serialized on their own line even if HTML contains no newlines
9559 !! options
9560 parsoid
9561 !! wikitext
9562 # foo
9563 ## bar
9564 * foo
9565 ** bar
9566 : foo
9567 :: bar
9568 !! html
9569 <ol>
9570 <li> foo<ol>
9571 <li> bar</li>
9572 </ol></li>
9573 </ol><ul>
9574 <li> foo<ul>
9575 <li> bar</li>
9576 </ul></li>
9577 </ul><dl>
9578 <dd> foo<dl>
9579 <dd> bar</dd>
9580 </dl></dd>
9581 </dl>
9582 !! end
9584 !! test
9585 Parsoid: Test of whitespace serialization with Templated bullets
9586 !! options
9587 parsoid
9588 !! wikitext
9589 * {{bullet}}
9590 !! html
9591 <ul>
9592 <li> </li><li about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"bullet","href":"./Template:Bullet"},"params":{},"i":0}}]}'> Bar</li>
9593 </ul>
9594 !! end
9596 # ------------------------------------------------------------------------
9597 # The next set of tests are about Parsoid's ability to handle badly nested
9598 # tags (parse, minimize scope of fixup, and roundtrip back)
9599 # ------------------------------------------------------------------------
9601 !! test
9602 Unbalanced closing block tags break a list
9603 (php parser relies on Tidy to fix up)
9604 !! wikitext
9605 <div>
9606 *a</div><div>
9607 *b</div>
9608 !! html+tidy
9609 <div>
9610 <ul>
9611 <li>a</li>
9612 </ul>
9613 </div>
9614 <div>
9615 <ul>
9616 <li>b</li>
9617 </ul>
9618 </div>
9619 !! end
9621 # Parsoid fails this test, but it might be tricky to support properly.
9622 # See bug 68395.
9623 !! test
9624 Unbalanced closing non-block tags don't break a list
9625 (php parser relies on Tidy to fix up)
9626 !! wikitext
9627 <span>
9628 *a</span><span>
9629 *b</span>
9630 !! html/php+tidy
9631 <ul>
9632 <li><span>a</span></li>
9633 <li><span>b</span></li>
9634 </ul>
9635 !! html/parsoid
9636 <span>
9637 <ul>
9638 <li>a<span></span>
9639 </li>
9640 <li>b
9641 </li>
9642 </ul>
9643 </span>
9644 !! end
9646 !! test
9647 Unclosed formatting tags that straddle lists are closed and reopened
9648 (php parser relies on Tidy to fix up)
9649 !! options
9650 parsoid=wt2html,wt2wt,html2html
9651 !! wikitext
9652 # <s> a
9653 # b </s>
9654 !! html/php+tidy
9655 <ol>
9656 <li><s>a</s></li>
9657 <li><s>b</s></li>
9658 </ol>
9659 !! html/parsoid
9660 <ol><li> <s> a</s></li>
9661 <li><s> b </s></li></ol>
9662 !! end
9664 # See bug 68395.
9665 !!test
9666 1. List embedded in a formatting tag
9667 !! wikitext
9668 <small>
9669 * foo
9670 </small>
9671 !! html/php+tidy
9672 <ul>
9673 <li><small>foo</small></li>
9674 </ul>
9675 !! html/parsoid
9676 <small>
9677 <ul>
9678 <li> foo</li>
9679 </ul>
9680 </small>
9681 !!end
9683 ## Ugly Parsoid output here
9684 ## Not sure what the right output is.
9685 !!test
9686 2. List embedded in a formatting tag
9687 !! wikitext
9688 <small>
9690 *b</small>
9691 !! html/php+tidy
9692 <ul>
9693 <li><small>a</small></li>
9694 <li><small>b</small></li>
9695 </ul>
9696 !! html/parsoid
9697 <small></small>
9698 <ul><small>
9699 <li>a</li>
9700 </small>
9701 <li><small>b</small></li>
9702 </ul>
9703 !!end
9705 # Ugly Parsoid and PHP parser output here
9706 # Not sure if we want to make this a test!
9708 ## !!test
9709 ## 3. Unclosed formatting tags in list elements
9710 ## !! wikitext
9711 ## *<small>a
9712 ## *<small>b
9713 ## !! html/php+tidy
9714 ## <ul>
9715 ## <li><small>a</small></li>
9716 ## <li><small><small>b</small></small></li>
9717 ## </ul>
9718 ## !! html/parsoid
9719 ## <ul>
9720 ## <li><small>a</small></li>
9721 ## <small>
9722 ## <li><small>b</small></li>
9723 ## </small></ul>
9724 ## !!end
9726 # This is a bug in the PHP parser + tidy combination.
9727 # (The </tr> tag gets parsed as text and html-escaped by PHP,
9728 # and then fostered out of the table by tidy.)
9729 # We believe the Parsoid output to be correct.
9730 !! test
9731 Table with missing opening <tr> tag
9732 !! options
9733 parsoid=wt2html,wt2wt
9734 !! wikitext
9735 <table>
9736 <td>foo</td>
9737 </tr>
9738 </table>
9739 !! html+tidy
9740 <table>
9741 <tr>
9742 <td>foo</td>
9743 </tr>
9744 </table>
9745 !! end
9748 ### Magic Words
9751 # Note that the current date is hard-coded as
9752 #   1970-01-01T00:02:03Z (a Thursday)
9753 # when running parser tests.  The timezone is also fixed to GMT, so
9754 # local date will be identical to current date.
9756 !! test
9757 Magic Word: {{CURRENTDAY}}
9758 !! wikitext
9759 {{CURRENTDAY}}
9760 !! html
9761 <p>1
9762 </p>
9763 !! end
9765 !! test
9766 Magic Word: {{CURRENTDAY2}}
9767 !! wikitext
9768 {{CURRENTDAY2}}
9769 !! html
9770 <p>01
9771 </p>
9772 !! end
9774 !! test
9775 Magic Word: {{CURRENTDAYNAME}}
9776 !! wikitext
9777 {{CURRENTDAYNAME}}
9778 !! html
9779 <p>Thursday
9780 </p>
9781 !! end
9783 !! test
9784 Magic Word: {{CURRENTDOW}}
9785 !! wikitext
9786 {{CURRENTDOW}}
9787 !! html
9788 <p>4
9789 </p>
9790 !! end
9792 !! test
9793 Magic Word: {{CURRENTMONTH}}
9794 !! wikitext
9795 {{CURRENTMONTH}}
9796 !! html
9797 <p>01
9798 </p>
9799 !! end
9801 !! test
9802 Magic Word: {{CURRENTMONTH1}}
9803 !! wikitext
9804 {{CURRENTMONTH1}}
9805 !! html
9806 <p>1
9807 </p>
9808 !! end
9810 !! test
9811 Magic Word: {{CURRENTMONTHABBREV}}
9812 !! wikitext
9813 {{CURRENTMONTHABBREV}}
9814 !! html
9815 <p>Jan
9816 </p>
9817 !! end
9819 !! test
9820 Magic Word: {{CURRENTMONTHNAME}}
9821 !! wikitext
9822 {{CURRENTMONTHNAME}}
9823 !! html
9824 <p>January
9825 </p>
9826 !! end
9828 !! test
9829 Magic Word: {{CURRENTMONTHNAMEGEN}}
9830 !! wikitext
9831 {{CURRENTMONTHNAMEGEN}}
9832 !! html
9833 <p>January
9834 </p>
9835 !! end
9837 !! test
9838 Magic Word: {{CURRENTTIME}}
9839 !! wikitext
9840 {{CURRENTTIME}}
9841 !! html
9842 <p>00:02
9843 </p>
9844 !! end
9846 !! test
9847 Magic Word: {{CURRENTHOUR}}
9848 !! wikitext
9849 {{CURRENTHOUR}}
9850 !! html
9851 <p>00
9852 </p>
9853 !! end
9855 !! test
9856 Magic Word: {{CURRENTWEEK}} (@bug 4594)
9857 !! wikitext
9858 {{CURRENTWEEK}}
9859 !! html
9860 <p>1
9861 </p>
9862 !! end
9864 !! test
9865 Magic Word: {{CURRENTYEAR}}
9866 !! wikitext
9867 {{CURRENTYEAR}}
9868 !! html
9869 <p>1970
9870 </p>
9871 !! end
9873 !! test
9874 Magic Word: {{CURRENTTIMESTAMP}}
9875 !! wikitext
9876 {{CURRENTTIMESTAMP}}
9877 !! html
9878 <p>19700101000203
9879 </p>
9880 !! end
9882 !! test
9883 Magic Words LOCAL (UTC)
9884 !! wikitext
9885 * {{LOCALMONTH}}
9886 * {{LOCALMONTH1}}
9887 * {{LOCALMONTHNAME}}
9888 * {{LOCALMONTHNAMEGEN}}
9889 * {{LOCALMONTHABBREV}}
9890 * {{LOCALDAY}}
9891 * {{LOCALDAY2}}
9892 * {{LOCALDAYNAME}}
9893 * {{LOCALYEAR}}
9894 * {{LOCALTIME}}
9895 * {{LOCALHOUR}}
9896 * {{LOCALWEEK}}
9897 * {{LOCALDOW}}
9898 * {{LOCALTIMESTAMP}}
9899 !! html
9900 <ul><li> 01</li>
9901 <li> 1</li>
9902 <li> January</li>
9903 <li> January</li>
9904 <li> Jan</li>
9905 <li> 1</li>
9906 <li> 01</li>
9907 <li> Thursday</li>
9908 <li> 1970</li>
9909 <li> 00:02</li>
9910 <li> 00</li>
9911 <li> 1</li>
9912 <li> 4</li>
9913 <li> 19700101000203</li></ul>
9915 !! end
9917 !! test
9918 Magic Word: {{FULLPAGENAME}}
9919 !! options
9920 title=[[User:Ævar Arnfjörð Bjarmason]]
9921 !! wikitext
9922 {{FULLPAGENAME}}
9923 !! html
9924 <p>User:Ævar Arnfjörð Bjarmason
9925 </p>
9926 !! end
9928 !! test
9929 Magic Word: {{FULLPAGENAMEE}}
9930 !! options
9931 title=[[User:Ævar Arnfjörð Bjarmason]]
9932 !! wikitext
9933 {{FULLPAGENAMEE}}
9934 !! html
9935 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
9936 </p>
9937 !! end
9939 !! test
9940 Magic Word: {{TALKSPACE}}
9941 !! options
9942 title=[[User:Ævar Arnfjörð Bjarmason]]
9943 !! wikitext
9944 {{TALKSPACE}}
9945 !! html
9946 <p>User talk
9947 </p>
9948 !! end
9950 !! test
9951 Magic Word: {{TALKSPACE}}, same namespace
9952 !! options
9953 title=[[User talk:Ævar Arnfjörð Bjarmason]]
9954 !! wikitext
9955 {{TALKSPACE}}
9956 !! html
9957 <p>User talk
9958 </p>
9959 !! end
9961 !! test
9962 Magic Word: {{TALKSPACE}}, main namespace
9963 !! options
9964 title=[[Parser Test]]
9965 !! wikitext
9966 {{TALKSPACE}}
9967 !! html
9968 <p>Talk
9969 </p>
9970 !! end
9972 !! test
9973 Magic Word: {{TALKSPACEE}}
9974 !! options
9975 title=[[User:Ævar Arnfjörð Bjarmason]]
9976 !! wikitext
9977 {{TALKSPACEE}}
9978 !! html
9979 <p>User_talk
9980 </p>
9981 !! end
9983 !! test
9984 Magic Word: {{SUBJECTSPACE}}
9985 !! options
9986 title=[[User talk:Ævar Arnfjörð Bjarmason]]
9987 !! wikitext
9988 {{SUBJECTSPACE}}
9989 !! html
9990 <p>User
9991 </p>
9992 !! end
9994 !! test
9995 Magic Word: {{SUBJECTSPACE}}, same namespace
9996 !! options
9997 title=[[User:Ævar Arnfjörð Bjarmason]]
9998 !! wikitext
9999 {{SUBJECTSPACE}}
10000 !! html
10001 <p>User
10002 </p>
10003 !! end
10005 !! test
10006 Magic Word: {{SUBJECTSPACE}}, main namespace
10007 !! options
10008 title=[[Parser Test]]
10009 !! wikitext
10010 {{SUBJECTSPACE}}
10011 !! html
10013 !! end
10015 !! test
10016 Magic Word: {{SUBJECTSPACEE}}
10017 !! options
10018 title=[[User talk:Ævar Arnfjörð Bjarmason]]
10019 !! wikitext
10020 {{SUBJECTSPACEE}}
10021 !! html
10022 <p>User
10023 </p>
10024 !! end
10026 !! test
10027 Magic Word: {{NAMESPACE}}
10028 !! options
10029 title=[[User:Ævar Arnfjörð Bjarmason]]
10030 !! wikitext
10031 {{NAMESPACE}}
10032 !! html
10033 <p>User
10034 </p>
10035 !! end
10037 !! test
10038 Magic Word: {{NAMESPACEE}}
10039 !! options
10040 title=[[User:Ævar Arnfjörð Bjarmason]]
10041 !! wikitext
10042 {{NAMESPACEE}}
10043 !! html
10044 <p>User
10045 </p>
10046 !! end
10048 !! test
10049 Magic Word: {{NAMESPACENUMBER}}
10050 !! options
10051 title=[[User:Ævar Arnfjörð Bjarmason]]
10052 !! wikitext
10053 {{NAMESPACENUMBER}}
10054 !! html
10055 <p>2
10056 </p>
10057 !! end
10059 !! test
10060 Magic Word: {{SUBPAGENAME}}
10061 !! options
10062 title=[[Ævar Arnfjörð Bjarmason/sub ö]] subpage
10063 !! wikitext
10064 {{SUBPAGENAME}}
10065 !! html
10066 <p>sub ö
10067 </p>
10068 !! end
10070 !! test
10071 Magic Word: {{SUBPAGENAMEE}}
10072 !! options
10073 title=[[Ævar Arnfjörð Bjarmason/sub ö]] subpage
10074 !! wikitext
10075 {{SUBPAGENAMEE}}
10076 !! html
10077 <p>sub_%C3%B6
10078 </p>
10079 !! end
10081 !! test
10082 Magic Word: {{ROOTPAGENAME}}
10083 !! options
10084 title=[[Ævar Arnfjörð Bjarmason/sub/sub2]] subpage
10085 !! wikitext
10086 {{ROOTPAGENAME}}
10087 !! html
10088 <p>Ævar Arnfjörð Bjarmason
10089 </p>
10090 !! end
10092 !! test
10093 Magic Word: {{ROOTPAGENAMEE}}
10094 !! options
10095 title=[[Ævar Arnfjörð Bjarmason/sub/sub2]] subpage
10096 !! wikitext
10097 {{ROOTPAGENAMEE}}
10098 !! html
10099 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
10100 </p>
10101 !! end
10103 !! test
10104 Magic Word: {{BASEPAGENAME}}
10105 !! options
10106 title=[[Ævar Arnfjörð Bjarmason/sub]] subpage
10107 !! wikitext
10108 {{BASEPAGENAME}}
10109 !! html
10110 <p>Ævar Arnfjörð Bjarmason
10111 </p>
10112 !! end
10114 !! test
10115 Magic Word: {{BASEPAGENAMEE}}
10116 !! options
10117 title=[[Ævar Arnfjörð Bjarmason/sub]] subpage
10118 !! wikitext
10119 {{BASEPAGENAMEE}}
10120 !! html
10121 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
10122 </p>
10123 !! end
10125 !! test
10126 Magic Word: {{TALKPAGENAME}}
10127 !! options
10128 title=[[User:Ævar Arnfjörð Bjarmason]]
10129 !! wikitext
10130 {{TALKPAGENAME}}
10131 !! html
10132 <p>User talk:Ævar Arnfjörð Bjarmason
10133 </p>
10134 !! end
10136 !! test
10137 Magic Word: {{TALKPAGENAMEE}}
10138 !! options
10139 title=[[User:Ævar Arnfjörð Bjarmason]]
10140 !! wikitext
10141 {{TALKPAGENAMEE}}
10142 !! html
10143 <p>User_talk:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
10144 </p>
10145 !! end
10147 !! test
10148 Magic Word: {{SUBJECTPAGENAME}}
10149 !! options
10150 title=[[User talk:Ævar Arnfjörð Bjarmason]]
10151 !! wikitext
10152 {{SUBJECTPAGENAME}}
10153 !! html
10154 <p>User:Ævar Arnfjörð Bjarmason
10155 </p>
10156 !! end
10158 !! test
10159 Magic Word: {{SUBJECTPAGENAMEE}}
10160 !! options
10161 title=[[User talk:Ævar Arnfjörð Bjarmason]]
10162 !! wikitext
10163 {{SUBJECTPAGENAMEE}}
10164 !! html
10165 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
10166 </p>
10167 !! end
10169 !! test
10170 Magic Word: {{NUMBEROFFILES}}
10171 !! wikitext
10172 {{NUMBEROFFILES}}
10173 !! html
10174 <p>7
10175 </p>
10176 !! end
10178 !! test
10179 Magic Word: {{PAGENAME}}
10180 !! options
10181 title=[[User:Ævar Arnfjörð Bjarmason]]
10182 !! wikitext
10183 {{PAGENAME}}
10184 !! html
10185 <p>Ævar Arnfjörð Bjarmason
10186 </p>
10187 !! end
10189 !! test
10190 Magic Word: {{PAGENAME}} with metacharacters
10191 !! options
10192 title=[['foo & bar = baz']]
10193 !! wikitext
10194 ''{{PAGENAME}}''
10195 !! html/php
10196 <p><i>&#39;foo &#38; bar &#61; baz&#39;</i>
10197 </p>
10198 !! html+tidy
10199 <p><i>'foo &amp; bar = baz'</i></p>
10200 !! end
10202 !! test
10203 Magic Word: {{PAGENAME}} with metacharacters (bug 26781)
10204 !! options
10205 title=[[*RFC 1234 http://example.com/]]
10206 !! wikitext
10207 {{PAGENAME}}
10208 !! html/php
10209 <p>&#42;RFC&#32;1234 http&#58;//example.com/
10210 </p>
10211 !! html+tidy
10212 <p>*RFC 1234 http://example.com/</p>
10213 !! end
10215 !! test
10216 Magic Word: {{PAGENAMEE}}
10217 !! options
10218 title=[[User:Ævar Arnfjörð Bjarmason]]
10219 !! wikitext
10220 {{PAGENAMEE}}
10221 !! html
10222 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
10223 </p>
10224 !! end
10226 !! test
10227 Magic Word: {{PAGENAMEE}} with metacharacters (bug 26781)
10228 !! options
10229 title=[[*RFC 1234 http://example.com/]]
10230 !! wikitext
10231 {{PAGENAMEE}}
10232 !! html/php
10233 <p>&#42;RFC_1234_http&#58;//example.com/
10234 </p>
10235 !! html+tidy
10236 <p>*RFC_1234_http://example.com/</p>
10237 !! end
10239 !! test
10240 Magic Word: {{REVISIONID}}
10241 !! wikitext
10242 {{REVISIONID}}
10243 !! html
10244 <p>1337
10245 </p>
10246 !! end
10248 !! test
10249 Magic Word: {{SCRIPTPATH}}
10250 !! wikitext
10251 {{SCRIPTPATH}}
10252 !! html
10254 !! end
10256 !! test
10257 Magic Word: {{STYLEPATH}}
10258 !! wikitext
10259 {{STYLEPATH}}
10260 !! html
10261 <p>/skins
10262 </p>
10263 !! end
10265 !! test
10266 Magic Word: {{SERVER}}
10267 !! wikitext
10268 {{SERVER}}
10269 !! html
10270 <p><a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
10271 </p>
10272 !! end
10274 !! test
10275 Magic Word: {{SERVERNAME}}
10276 !! wikitext
10277 {{SERVERNAME}}
10278 !! html
10279 <p>example.org
10280 </p>
10281 !! end
10283 !! test
10284 Magic Word: {{SITENAME}}
10285 !! wikitext
10286 {{SITENAME}}
10287 !! html
10288 <p>MediaWiki
10289 </p>
10290 !! end
10292 !! test
10293 Magic Word: {{PAGELANGUAGE}}
10294 !! options
10295 language=fr
10296 !! wikitext
10297 {{PAGELANGUAGE}}
10298 !! html
10299 <p>fr
10300 </p>
10301 !! end
10303 !! test
10304 Magic Word: {{PAGELANGUAGE}} on a page with no explicitly set language
10305 !! wikitext
10306 {{PAGELANGUAGE}}
10307 !! html
10308 <p>en
10309 </p>
10310 !! end
10312 !! test
10313 Case-sensitive magic words, when cased differently, should just be template transclusions
10314 !! wikitext
10315 {{CurrentMonth}}
10316 {{currentday}}
10317 {{cURreNTweEK}}
10318 {{currentHour}}
10319 !! html
10320 <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>
10321 <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>
10322 <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>
10323 <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>
10324 </p>
10325 !! end
10327 !! test
10328 Case-insensitive magic words should still work with weird casing.
10329 !! wikitext
10330 {{sErVeRNaMe}}
10331 {{LCFirst:AOEU}}
10332 {{ucFIRST:aoeu}}
10333 {{SERver}}
10334 !! html
10335 <p>example.org
10336 aOEU
10337 Aoeu
10338 <a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
10339 </p>
10340 !! end
10342 # From plwiki:PLOS_ONE
10343 !! test
10344 Parsoid: Page property magic word with magic word contents
10345 !! wikitext
10346 {{DISPLAYTITLE:''{{PAGENAME}}''}}
10347 !! html/parsoid
10348 <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>"}]]}'/>
10349 !! end
10351 !! test
10352 Parsoid: Template-generated DISPLAYTITLE
10353 !! wikitext
10354 {{{{echo|DISPLAYTITLE}}:Foo}}
10355 !! html/parsoid
10356 <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}}]}'/>
10357 !! end
10359 !! test
10360 Namespace 1 {{ns:1}}
10361 !! wikitext
10362 {{ns:1}}
10363 !! html
10364 <p>Talk
10365 </p>
10366 !! end
10368 !! test
10369 Namespace 1 {{ns:01}}
10370 !! wikitext
10371 {{ns:01}}
10372 !! html
10373 <p>Talk
10374 </p>
10375 !! end
10377 !! test
10378 Namespace 0 {{ns:0}} (bug 4783)
10379 !! wikitext
10380 {{ns:0}}
10381 !! html
10383 !! end
10385 !! test
10386 Namespace 0 {{ns:00}} (bug 4783)
10387 !! wikitext
10388 {{ns:00}}
10389 !! html
10391 !! end
10393 !! test
10394 Namespace -1 {{ns:-1}}
10395 !! wikitext
10396 {{ns:-1}}
10397 !! html
10398 <p>Special
10399 </p>
10400 !! end
10402 !! test
10403 Namespace User {{ns:User}}
10404 !! wikitext
10405 {{ns:User}}
10406 !! html
10407 <p>User
10408 </p>
10409 !! end
10411 !! test
10412 Namespace User talk {{ns:User_talk}}
10413 !! wikitext
10414 {{ns:User_talk}}
10415 !! html
10416 <p>User talk
10417 </p>
10418 !! end
10420 !! test
10421 Namespace User talk {{ns:uSeR tAlK}}
10422 !! wikitext
10423 {{ns:uSeR tAlK}}
10424 !! html
10425 <p>User talk
10426 </p>
10427 !! end
10429 !! test
10430 Namespace File {{ns:File}}
10431 !! wikitext
10432 {{ns:File}}
10433 !! html
10434 <p>File
10435 </p>
10436 !! end
10438 !! test
10439 Namespace File {{ns:Image}}
10440 !! wikitext
10441 {{ns:Image}}
10442 !! html
10443 <p>File
10444 </p>
10445 !! end
10447 !! test
10448 Namespace (lang=de) Benutzer {{ns:User}}
10449 !! options
10450 language=de
10451 !! wikitext
10452 {{ns:User}}
10453 !! html
10454 <p>Benutzer
10455 </p>
10456 !! end
10458 !! test
10459 Namespace (lang=de) Benutzer Diskussion {{ns:3}}
10460 !! options
10461 language=de
10462 !! wikitext
10463 {{ns:3}}
10464 !! html
10465 <p>Benutzer Diskussion
10466 </p>
10467 !! end
10469 !! test
10470 Urlencode
10471 !! wikitext
10472 {{urlencode:hi world?!}}
10473 {{urlencode:hi world?!|WIKI}}
10474 {{urlencode:hi world?!|PATH}}
10475 {{urlencode:hi world?!|QUERY}}
10476 !! html/php
10477 <p>hi+world%3F%21
10478 hi_world%3F!
10479 hi%20world%3F%21
10480 hi+world%3F%21
10481 </p>
10482 !! end
10484 !! test
10485 Magic Word: prioritize type info over data-parsoid
10486 !! options
10487 parsoid=html2wt
10488 !! html/parsoid
10489 <meta property="mw:PageProp/forcetoc" data-parsoid='{"magicSrc":"__NOTOC__"}'/>
10490 !! wikitext
10491 __FORCETOC__
10492 !! end
10494 !! test
10495 Magic Word: serialize on separate line (parsoid)
10496 !! options
10497 parsoid=wt2wt,html2wt
10498 !! wikitext
10500 __NOTOC__
10502 !! html/parsoid
10503 foo<meta property="mw:PageProp/notoc"/>bar
10504 !! end
10506 !! test
10507 Magic Word: rt non-english wikis
10508 !! options
10509 parsoid=wt2wt
10510 language=de
10511 !! wikitext
10512 __NOEDITSECTION__
10513 !! html/parsoid
10514 <meta property="mw:PageProp/noeditsection" data-parsoid='{"magicSrc":"__NOEDITSECTION__"}'/>
10515 !! end
10517 !!test
10518 __proto__ is treated as normal wikitext (T105997)
10519 !!wikitext
10520 __proto__
10521 !!html
10522 <p>__proto__
10523 </p>
10524 !!end
10527 ### Magic links
10529 !! test
10530 Magic links: internal link to RFC (bug 479)
10531 !! wikitext
10532 [[RFC 123]]
10533 !! html/php
10534 <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>
10535 </p>
10536 !! html/parsoid
10537 <p><a rel="mw:WikiLink" href="./RFC_123" title="RFC 123">RFC 123</a></p>
10538 !! end
10540 !! test
10541 Magic links: RFC (bug 479)
10542 !! wikitext
10543 RFC 822
10544 !! html/php
10545 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc822">RFC 822</a>
10546 </p>
10547 !! html/parsoid
10548 <p><a href="//tools.ietf.org/html/rfc822" rel="mw:ExtLink">RFC 822</a></p>
10549 !! end
10551 !! test
10552 Magic links: RFC (bug 65278)
10553 !! wikitext
10554 This is RFC 822 but thisRFC 822 is not RFC 822linked.
10555 !! html/php
10556 <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.
10557 </p>
10558 !! html/parsoid
10559 <p>This is <a href="//tools.ietf.org/html/rfc822" rel="mw:ExtLink">RFC 822</a> but thisRFC 822 is not RFC 822linked.</p>
10560 !! end
10562 !! test
10563 Magic links: RFC (w/ non-newline whitespace, bug 28950/29025)
10564 !! wikitext
10565 RFC &nbsp;&#160;&#0160;&#xA0;&#Xa0; 822
10568 !! html/php
10569 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc822">RFC 822</a>
10572 </p>
10573 !! html/parsoid
10574 <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>
10576 822</p>
10577 !! end
10579 !! test
10580 Magic links: ISBN (bug 1937)
10581 !! wikitext
10582 ISBN 0-306-40615-2
10583 !! html/php
10584 <p><a href="/wiki/Special:BookSources/0306406152" class="internal mw-magiclink-isbn">ISBN 0-306-40615-2</a>
10585 </p>
10586 !! html/parsoid
10587 <p><a href="./Special:BookSources/0306406152" rel="mw:WikiLink">ISBN 0-306-40615-2</a></p>
10588 !! end
10590 !! test
10591 Magic links: ISBN (bug 65278)
10592 !! wikitext
10593 This is ISBN 978-0-316-09811-3 but thisISBN 978-0-316-09811-3 is not ISBN 978-0-316-09811-3linked.
10594 !! html/php
10595 <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.
10596 </p>
10597 !! html/parsoid
10598 <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>
10599 !! end
10601 !! test
10602 Magic links: ISBN (w/ non-newline whitespace, bug 28950/29025)
10603 !! wikitext
10604 ISBN &nbsp;&#160;&#0160;&#xA0;&#Xa0; 978&nbsp;0&#160;316&#0160;09811&#xA0;3
10605 ISBN
10606 9780316098113
10607 ISBN 978
10608 0316098113
10609 !! html/php
10610 <p><a href="/wiki/Special:BookSources/9780316098113" class="internal mw-magiclink-isbn">ISBN 978 0 316 09811 3</a>
10611 ISBN
10612 9780316098113
10613 ISBN 978
10614 0316098113
10615 </p>
10616 !! html/parsoid
10617 <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>
10618 ISBN
10619 9780316098113
10620 ISBN 978
10621 0316098113</p>
10622 !! end
10624 !! test
10625 Magic links: PMID incorrectly converts space to underscore
10626 !! wikitext
10627 PMID 1234
10628 !! html/php
10629 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a>
10630 </p>
10631 !! html/parsoid
10632 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract" rel="mw:ExtLink">PMID 1234</a></p>
10633 !! end
10635 !! test
10636 Magic links: PMID (bug 65278)
10637 !! wikitext
10638 This is PMID 1234 but thisPMID 1234 is not PMID 1234linked.
10639 !! html/php
10640 <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.
10641 </p>
10642 !! html/parsoid
10643 <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>
10644 !! end
10646 !! test
10647 Magic links: PMID (w/ non-newline whitespace, bug 28950/29025)
10648 !! wikitext
10649 PMID &nbsp;&#160;&#0160;&#xA0;&#Xa0; 1234
10650 PMID
10651 1234
10652 !! html/php
10653 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a>
10654 PMID
10655 1234
10656 </p>
10657 !! html/parsoid
10658 <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>
10659 PMID
10660 1234</p>
10661 !! end
10663 # <nowiki> nodes shouldn't be inserted during html2wt by Parsoid,
10664 # since these are ExtLinkText, not MagicLinkText
10665 !! test
10666 Magic links: use appropriate serialization for "almost" magic links.
10667 !! wikitext
10668 X[[Special:BookSources/0978739256|foo]]
10670 X[//tools.ietf.org/html/rfc1234 foo]
10671 !! html/php
10672 <p>X<a href="/wiki/Special:BookSources/0978739256" title="Special:BookSources/0978739256">foo</a>
10673 </p><p>X<a rel="nofollow" class="external text" href="//tools.ietf.org/html/rfc1234">foo</a>
10674 </p>
10675 !! html/parsoid
10676 <p>X<a rel="mw:WikiLink" href="./Special:BookSources/0978739256" title="Special:BookSources/0978739256">foo</a></p>
10677 <p>X<a rel="mw:ExtLink" href="//tools.ietf.org/html/rfc1234">foo</a></p>
10678 !! end
10680 !! test
10681 Magic links: All disabled (T47942)
10682 !! options
10683 wgEnableMagicLinks={"ISBN":false, "PMID":false, "RFC":false}
10684 !! wikitext
10685 ISBN 0-306-40615-2
10686 PMID 1234
10687 RFC 4321
10688 !! html/php
10689 <p>ISBN 0-306-40615-2
10690 PMID 1234
10691 RFC 4321
10692 </p>
10693 !! end
10696 ### Templates
10697 ####
10699 !! test
10700 Nonexistent template
10701 !! wikitext
10702 {{thistemplatedoesnotexist}}
10703 !! html
10704 <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>
10705 </p>
10706 !! end
10708 !! test
10709 Template with invalid target containing tags
10710 !! wikitext
10711 {{a<b>b</b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
10712 !! html
10713 <p>{{a<b>b</b>|foo|a=b|a = b}}
10714 </p>
10715 !! end
10717 !! test
10718 Template with invalid target containing unclosed tag
10719 !! wikitext
10720 {{a<b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
10721 !! html
10722 <p>{{a<b>|foo|a=b|a = b}}</b>
10723 </p>
10724 !! end
10726 !! test
10727 Template with invalid target containing wikilink
10728 !! wikitext
10729 {{[[Main Page]]}}
10730 !! html/php
10731 <p>{{<a href="/wiki/Main_Page" title="Main Page">Main Page</a>}}
10732 </p>
10733 !! html/parsoid
10734 <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>
10735 !! end
10737 !! test
10738 Template with just whitespace in it, bug #68421
10739 !! wikitext
10740 {{echo|{{ }}}}
10741 !! html/parsoid
10742 <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>
10743 !! end
10745 !! article
10746 Template:test
10747 !! text
10748 This is a test template
10749 !! endarticle
10751 !! test
10752 Simple template
10753 !! wikitext
10754 {{test}}
10755 !! html
10756 <p>This is a test template
10757 </p>
10758 !! end
10760 !! test
10761 Template with explicit namespace
10762 !! wikitext
10763 {{Template:test}}
10764 !! html
10765 <p>This is a test template
10766 </p>
10767 !! end
10770 !! article
10771 Template:paramtest
10772 !! text
10773 This is a test template with parameter {{{param}}}
10774 !! endarticle
10776 !! test
10777 Template parameter
10778 !! wikitext
10779 {{paramtest|param=foo}}
10780 !! html
10781 <p>This is a test template with parameter foo
10782 </p>
10783 !! end
10785 !! article
10786 Template:paramtestnum
10787 !! text
10788 [[{{{1}}}|{{{2}}}]]
10789 !! endarticle
10791 !! test
10792 Template unnamed parameter
10793 !! wikitext
10794 {{paramtestnum|Main Page|the main page}}
10795 !! html
10796 <p><a href="/wiki/Main_Page" title="Main Page">the main page</a>
10797 </p>
10798 !! end
10800 !! article
10801 Template:templatesimple
10802 !! text
10803 (test)
10804 !! endarticle
10806 !! article
10807 Template:templateredirect
10808 !! text
10809 #redirect [[Template:templatesimple]]
10810 !! endarticle
10812 !! article
10813 Template:templateasargtestnum
10814 !! text
10815 {{{{{1}}}}}
10816 !! endarticle
10818 !! article
10819 Template:templateasargtest
10820 !! text
10821 {{template{{{templ}}}}}
10822 !! endarticle
10824 !! article
10825 Template:templateasargtest2
10826 !! text
10827 {{{{{templ}}}}}
10828 !! endarticle
10830 !! test
10831 Template with template name as unnamed argument
10832 !! wikitext
10833 {{templateasargtestnum|templatesimple}}
10834 !! html
10835 <p>(test)
10836 </p>
10837 !! end
10839 !! test
10840 Template with template name as argument
10841 !! wikitext
10842 {{templateasargtest|templ=simple}}
10843 !! html
10844 <p>(test)
10845 </p>
10846 !! end
10848 !! test
10849 Template with template name as argument (2)
10850 !! wikitext
10851 {{templateasargtest2|templ=templatesimple}}
10852 !! html
10853 <p>(test)
10854 </p>
10855 !! end
10857 !! article
10858 Template:templateasargtestdefault
10859 !! text
10860 {{{{{templ|templatesimple}}}}}
10861 !! endarticle
10863 !! article
10864 Template:templa
10865 !! text
10866 '''templ'''
10867 !! endarticle
10869 !! test
10870 Template with default value
10871 !! wikitext
10872 {{templateasargtestdefault}}
10873 !! html
10874 <p>(test)
10875 </p>
10876 !! end
10878 !! test
10879 Template with default value (value set)
10880 !! wikitext
10881 {{templateasargtestdefault|templ=templa}}
10882 !! html
10883 <p><b>templ</b>
10884 </p>
10885 !! end
10887 !! test
10888 Template redirect
10889 !! wikitext
10890 {{templateredirect}}
10891 !! html/php
10892 <p>(test)
10893 </p>
10894 !! html/parsoid
10895 <link rel="mw:PageProp/redirect" href="./Template:Templatesimple" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"templateredirect","href":"./Template:Templateredirect"},"params":{},"i":0}}]}'/>
10896 !! end
10898 !! test
10899 Template with argument in separate line
10900 !! wikitext
10901 {{ templateasargtest  |
10902  templ = simple }}
10903 !! html
10904 <p>(test)
10905 </p>
10906 !! end
10908 !! test
10909 Template with complex template as argument
10910 !! wikitext
10911 {{paramtest|
10912   param ={{ templateasargtest  |
10913  templ = simple }}}}
10914 !! html
10915 <p>This is a test template with parameter (test)
10916 </p>
10917 !! end
10919 !! test
10920 Template with thumb image (with link in description)
10921 !! wikitext
10922 {{paramtest|param=[[Image:noimage.png|thumb|[[no link|link]] [[no link|caption]]]]}}
10923 !! html/php
10924 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>
10926 !! html+tidy
10927 <p>This is a test template with parameter</p>
10928 <div class="thumb tright">
10929 <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>
10930 <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>
10931 </div>
10932 </div>
10933 !! html/parsoid
10934 <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>
10935 !! end
10937 !! article
10938 Template:complextemplate
10939 !! text
10940 {{{1}}} {{paramtest|
10941   param ={{{param}}}}}
10942 !! endarticle
10944 !! test
10945 Template with complex arguments
10946 !! wikitext
10947 {{complextemplate|
10948   param ={{ templateasargtest  |
10949  templ = simple }}|[[Template:complextemplate|link]]}}
10950 !! html
10951 <p><a href="/wiki/Template:Complextemplate" title="Template:Complextemplate">link</a> This is a test template with parameter (test)
10952 </p>
10953 !! end
10955 !! test
10956 BUG 553: link with two variables in a piped link
10957 !! wikitext
10959 |[[{{{1}}}|{{{2}}}]]
10961 !! html/php
10962 <table>
10963 <tr>
10964 <td>[[{{{1}}}|{{{2}}}]]
10965 </td></tr></table>
10967 !! html/parsoid
10968 <table>
10969 <tbody><tr><td>[[<span about="#mwt5" typeof="mw:Param" data-mw='{"parts":[{"templatearg":{"target":{"wt":"1"},"params":{},"i":0}}]}'>{{{1}}}</span>|<span about="#mwt2" typeof="mw:Param" data-mw='{"parts":[{"templatearg":{"target":{"wt":"2"},"params":{},"i":0}}]}'>{{{2}}}</span>]]</td></tr>
10970 </tbody></table>
10971 !! end
10973 # See: T2553
10974 !! test
10975 Abort table cell attribute parsing on wikilink
10976 !! wikitext
10978 | testing [[one|two]] | three || four
10979 | testing one two | three || four
10980 | testing="[[one|two]]" | three || four
10982 !! html/php
10983 <table>
10984 <tr>
10985 <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>
10986 <td> four
10987 </td>
10988 <td> three </td>
10989 <td> four
10990 </td>
10991 <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>
10992 <td> four
10993 </td></tr></table>
10995 !! html/parsoid
10996 <table>
10997 <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>
10998 <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>
10999 <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>
11000 </tbody></table>
11001 !! end
11003 !! test
11004 Don't abort table cell attribute parsing if wikilink is found in template arg
11005 !! wikitext
11007 | Test {{#tag:ref|One two "[[three]]" four}}
11009 !! html/parsoid
11010 <table>
11011 <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>
11012 </tbody></table>
11013 !! end
11015 !! test
11016 Magic variable as template parameter
11017 !! wikitext
11018 {{paramtest|param={{SITENAME}}}}
11019 !! html
11020 <p>This is a test template with parameter MediaWiki
11021 </p>
11022 !! end
11024 !! article
11025 Template:linktest
11026 !! text
11027 [[{{{param}}}|link]]
11028 !! endarticle
11030 !! test
11031 Template parameter as link source
11032 !! wikitext
11033 {{linktest|param=Main Page}}
11034 !! html
11035 <p><a href="/wiki/Main_Page" title="Main Page">link</a>
11036 </p>
11037 !! end
11039 !!article
11040 Template:paramtest2
11041 !! text
11042 including another template, {{paramtest|param={{{arg}}}}}
11043 !! endarticle
11045 !! test
11046 Template passing argument to another template
11047 !! wikitext
11048 {{paramtest2|arg='hmm'}}
11049 !! html
11050 <p>including another template, This is a test template with parameter 'hmm'
11051 </p>
11052 !! end
11054 !! article
11055 Template:Linktest2
11056 !! text
11057 Main Page
11058 !! endarticle
11060 !! test
11061 Template as link source
11062 !! wikitext
11063 [[{{linktest2}}]]
11065 [[{{linktest2}}|Main Page]]
11067 [[{{linktest2}}]]Page
11068 !! html
11069 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
11070 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
11071 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>Page
11072 </p>
11073 !! end
11076 !! article
11077 Template:loop1
11078 !! text
11079 {{loop2}}
11080 !! endarticle
11082 !! article
11083 Template:loop2
11084 !! text
11085 {{loop1}}
11086 !! endarticle
11088 !! test
11089 Template infinite loop
11090 !! wikitext
11091 {{loop1}}
11092 !! html
11093 <p><span class="error">Template loop detected: <a href="/wiki/Template:Loop1" title="Template:Loop1">Template:Loop1</a></span>
11094 </p>
11095 !! end
11097 !! test
11098 Template from main namespace
11099 !! wikitext
11100 {{:Main Page}}
11101 !! html
11102 <p>blah blah
11103 </p>
11104 !! end
11106 !! article
11107 Template:table
11108 !! text
11110 | 1 || 2
11112 | 3 || 4
11114 !! endarticle
11116 !! test
11117 BUG 529: Template with table, not included at beginning of line
11118 !! wikitext
11119 foo {{table}}
11120 !! html
11121 <p>foo 
11122 </p>
11123 <table>
11124 <tr>
11125 <td> 1 </td>
11126 <td> 2
11127 </td></tr>
11128 <tr>
11129 <td> 3 </td>
11130 <td> 4
11131 </td></tr></table>
11133 !! end
11135 !! test
11136 BUG 523: Template shouldn't eat newline (or add an extra one before table)
11137 !! wikitext
11139 {{table}}
11140 !! html
11141 <p>foo
11142 </p>
11143 <table>
11144 <tr>
11145 <td> 1 </td>
11146 <td> 2
11147 </td></tr>
11148 <tr>
11149 <td> 3 </td>
11150 <td> 4
11151 </td></tr></table>
11153 !! end
11155 !! test
11156 BUG 41: Template parameters shown as broken links
11157 !! wikitext
11158 {{{parameter}}}
11159 !! html
11160 <p>{{{parameter}}}
11161 </p>
11162 !! end
11164 !! test
11165 Template with targets containing wikilinks
11166 !! wikitext
11167 {{[[foo]]}}
11169 {{[[{{echo|foo}}]]}}
11171 {{{{echo|[[foo}}]]}}
11172 !! html
11173 <p>{{<a href="/wiki/Foo" title="Foo">foo</a>}}
11174 </p><p>{{<a href="/wiki/Foo" title="Foo">foo</a>}}
11175 </p><p>{{[[foo}}]]
11176 </p>
11177 !! end
11179 !! article
11180 Template:''
11181 !! text
11183 !! endarticle
11185 !! test
11186 Templates: Double quotes as template target
11187 !! wikitext
11188 foo {{''}} baz
11189 !! html/php
11190 <p>foo bar baz
11191 </p>
11192 !! html/parsoid
11193 <p>foo <span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"&#39;&#39;","href":"./Template:&#39;&#39;"},"params":{},"i":0}}]}'>bar</span> baz
11194 </p>
11195 !! end
11197 ## This test is about making sure Parsoid's data-mw is well formed in the
11198 ## face of multiple templates with intersecting and overlapping ranges.  The
11199 ## wikitext itself is wretched.
11200 !! test
11201 Templates with intersecting and overlapping ranges
11202 !! wikitext
11203 {|{{echo|
11204 <p>ha</p>}}
11205 {|{{echo|
11206 <p>ho</p>}}
11207 {{echo|{{!}}hi}}
11209 !! html/php+tidy
11210 <p>ha</p>
11211 <p>ho</p>
11212 <table>
11213 <tr>
11214 <td></td>
11215 </tr>
11216 <tr>
11217 <td>hi</td>
11218 </tr>
11219 </table>
11220 <table>
11221 <tr>
11222 <td></td>
11223 </tr>
11224 </table>
11225 !! html/parsoid
11226 <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":""}]]}'>
11228 </table><p about="#mwt1">ho</p><table about="#mwt1" typeof="mw:ExpandedAttrs" data-mw='{"attribs":[[{"txt":"","html":""},{"html":""}]]}'>
11230 <tbody><tr><td>hi</td></tr>
11231 </tbody></table>
11232 !! end
11234 !! article
11235 Template:MSGNW test
11236 !! text
11237 ''None'' of '''this''' should be 
11238 * interpreted
11239  but rather passed unmodified
11240 {{test}}
11241 <gallery>
11242 File:Foobar.jpg
11243 </gallery>
11244 <!-- comment -->
11245 !! endarticle
11247 # hmm, fix this or just deprecate msgnw and document its behavior?
11248 !! test
11249 msgnw keyword
11250 !! wikitext
11251 {{msgnw:MSGNW test}}
11252 !! html/php
11253 <p>&#39;&#39;None&#39;&#39; of &#39;&#39;&#39;this&#39;&#39;&#39; should be 
11254 &#42; interpreted
11255 &#32;but rather passed unmodified
11256 &#123;&#123;test&#125;&#125;
11257 &#60;gallery&#62;
11258 File:Foobar.jpg
11259 &#60;/gallery&#62;
11260 &#60;!-- comment --&#62;
11261 </p>
11262 !! end
11264 !! test
11265 int keyword
11266 !! wikitext
11267 {{int:youhavenewmessages|lots of money|not!}}
11268 !! html
11269 <p>You have lots of money (not!).
11270 </p>
11271 !! end
11273 !! test
11274 int keyword - non-existing message
11275 !! wikitext
11276 {{int:var}}
11277 !! html
11278 <p>⧼var⧽
11279 </p>
11280 !! end
11282 !! article
11283 Template:Includes
11284 !! text
11285 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
11286 !! endarticle
11288 !! test
11289 <includeonly> and <noinclude> being included
11290 !! wikitext
11291 {{Includes}}
11292 !! html
11293 <p>Foobar
11294 </p>
11295 !! end
11297 !! article
11298 Template:Includes2
11299 !! text
11300 <onlyinclude>Foo</onlyinclude>bar
11301 !! endarticle
11303 !! test
11304 <onlyinclude> being included
11305 !! wikitext
11306 {{Includes2}}
11307 !! html
11308 <p>Foo
11309 </p>
11310 !! end
11313 !! article
11314 Template:Includes3
11315 !! text
11316 <onlyinclude>Foo</onlyinclude>bar<includeonly>zar</includeonly>
11317 !! endarticle
11319 !! test
11320 <onlyinclude> and <includeonly> being included
11321 !! wikitext
11322 {{Includes3}}
11323 !! html
11324 <p>Foo
11325 </p>
11326 !! end
11328 !! test
11329 <includeonly> and <noinclude> on a page
11330 !! wikitext
11331 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
11332 !! html
11333 <p>Foozar
11334 </p>
11335 !! end
11337 !! test
11338 Un-closed <noinclude>
11339 !! wikitext
11340 <noinclude>
11341 !! html
11342 !! end
11344 !! test
11345 <onlyinclude> on a page
11346 !! wikitext
11347 <onlyinclude>Foo</onlyinclude>bar
11348 !! html
11349 <p>Foobar
11350 </p>
11351 !! end
11353 !! test
11354 Un-closed <onlyinclude>
11355 !! wikitext
11356 <onlyinclude>
11357 !! html
11358 !! end
11360 !!test
11361 Self-closed noinclude, includeonly, onlyinclude tags
11362 !! wikitext
11363 <noinclude />
11364 <includeonly />
11365 <onlyinclude />
11366 !! html
11367 <p><br />
11368 </p>
11369 !!end
11371 !!test
11372 Unbalanced includeonly and noinclude tags
11373 !! wikitext
11375 |a</noinclude>
11376 |b</noinclude></noinclude>
11377 |c</noinclude></includeonly>
11378 |d</includeonly></includeonly>
11380 !! html
11381 <table>
11382 <tr>
11383 <td>a
11384 </td>
11385 <td>b
11386 </td>
11387 <td>c&lt;/includeonly&gt;
11388 </td>
11389 <td>d&lt;/includeonly&gt;&lt;/includeonly&gt;
11390 </td></tr></table>
11392 !!end
11394 !! article
11395 Template:Includeonly section
11396 !! text
11397 <includeonly>
11398 ==Includeonly section==
11399 </includeonly>
11400 ==Section T-1==
11401 !!endarticle
11403 !! test
11404 Bug 6563: Edit link generation for section shown by <includeonly>
11405 !! wikitext
11406 {{includeonly section}}
11407 !! html
11408 <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>
11409 <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>
11411 !! end
11413 # Uses same input as the contents of [[Template:Includeonly section]]
11414 !! test
11415 Bug 6563: Section extraction for section shown by <includeonly>
11416 !! options
11417 section=T-2
11418 !! wikitext
11419 <includeonly>
11420 ==Includeonly section==
11421 </includeonly>
11422 ==Section T-2==
11423 !! html
11424 ==Section T-2==
11425 !! end
11427 !! test
11428 Bug 6563: Edit link generation for section suppressed by <includeonly>
11429 !! wikitext
11430 <includeonly>
11431 ==Includeonly section==
11432 </includeonly>
11433 ==Section 1==
11434 !! html
11435 <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>
11437 !! end
11439 !! test
11440 Bug 6563: Section extraction for section suppressed by <includeonly>
11441 !! options
11442 section=1
11443 !! wikitext
11444 <includeonly>
11445 ==Includeonly section==
11446 </includeonly>
11447 ==Section 1==
11448 !! html
11449 ==Section 1==
11450 !! end
11452 !! test
11453 Un-closed <includeonly>
11454 !! wikitext
11455 <includeonly>
11456 !! html/php
11457 !! html/parsoid
11458 <meta typeof="mw:Includes/IncludeOnly" data-parsoid='{"src":"&lt;includeonly>"}'/>
11459 !! end
11461 ## We used to, but no longer wt2wt this test since the default serializer
11462 ## will normalize the include directives to serialize on their own line.
11463 ## Selser will take care of preserving formatting in scenarios where they
11464 ## intermingled with other wikitext.
11465 !! test
11466 Includes and comments at SOL
11467 !! options
11468 parsoid=wt2html,html2html
11469 !! wikitext
11470 <!-- comment --><noinclude><!-- comment --></noinclude><!-- comment -->== hu ==
11472 <noinclude>
11473 some
11474 </noinclude>* stuff
11475 * here
11477 <includeonly>can have stuff</includeonly>=== here ===
11479 !! html/php
11480 <h2><span class="mw-headline" id="hu">hu</span></h2>
11481 <p>some
11482 </p>
11483 <ul><li> stuff</li>
11484 <li> here</li></ul>
11485 <h3><span class="mw-headline" id="here">here</span></h3>
11487 !! html/parsoid
11488 <!-- 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>
11490 <meta typeof="mw:Includes/NoInclude" data-parsoid='{"src":"&lt;noinclude>"}'/>
11491 <p>some</p>
11492 <meta typeof="mw:Includes/NoInclude/End" data-parsoid='{"src":"&lt;/noinclude>"}'/><ul><li> stuff</li>
11493 <li> here</li></ul>
11495 <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>
11497 !! end
11499 # TODO: test with DOM fragment reuse!
11500 !! test
11501 Parsoid: DOM fragment reuse
11502 !! options
11503 parsoid=wt2wt,wt2html
11504 !! wikitext
11505 a{{echo|b<table></table>c}}d
11507 a{{echo|b
11508 <table></table>
11509 c}}d
11511 {{echo|a
11513 <table></table>
11516 !! html
11517 <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>
11519 <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">
11520 </span><table about="#mwt2" data-parsoid='{"stx":"html"}'></table><span about="#mwt2">
11521 </span><p about="#mwt2">cd</p>
11523 <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">
11525 </span><table about="#mwt3" data-parsoid='{"stx":"html"}'></table><span about="#mwt3">
11527 </span><p about="#mwt3">b</p>
11528 !! end
11530 !! test
11531 Parsoid: Merge double tds (T52603)
11532 !! options
11533 parsoid
11534 !! wikitext
11536 |{{echo|{{!}} foo}}
11538 !! html
11539 <table><tbody>
11540 <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>
11541 </tbody></table>
11542 !! end
11544 !! test
11545 Parsoid: Merge double tds in nested transclusion content (T52603)
11546 !! options
11547 parsoid
11548 !! wikitext
11549 {{echo|<div>}}
11551 |{{echo|{{!}} foo}}
11553 {{echo|</div>}}
11554 !! html
11555 <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}}]}'>
11556 <table><tbody>
11557 <tr><td data-mw='{"parts":["|"]}'> foo</td></tr>
11558 </tbody></table>
11559 </div>
11560 !! end
11563 ### <includeonly> and <noinclude> in attributes
11565 !!test
11566 0. includeonly around the entire attribute
11567 !! wikitext
11568 <span <includeonly>id="v1"</includeonly><noinclude>id="v2"</noinclude>>bar</span>
11569 !! html
11570 <p><span id="v2">bar</span>
11571 </p>
11572 !!end
11574 !!test
11575 1. includeonly in html attr key
11576 !! wikitext
11577 <span <noinclude>id</noinclude><includeonly>about</includeonly>="foo">bar</span>
11578 !! html
11579 <p><span id="foo">bar</span>
11580 </p>
11581 !!end
11583 !!test
11584 2. includeonly in html attr value
11585 !! wikitext
11586 <span id="<noinclude>v1</noinclude><includeonly>v2</includeonly>">bar</span>
11587 <span id=<noinclude>"v1"</noinclude><includeonly>"v2"</includeonly>>bar</span>
11588 !! html
11589 <p><span id="v1">bar</span>
11590 <span id="v1">bar</span>
11591 </p>
11592 !!end
11594 !!test
11595 3. includeonly in part of an attr value
11596 !! wikitext
11597 <span style="color:<noinclude>red</noinclude><includeonly>blue</includeonly>;">bar</span>
11598 !! html
11599 <p><span style="color:red;">bar</span>
11600 </p>
11601 !!end
11603 !!test
11604 4. includeonly in table attributes
11605 !! wikitext
11607 |- <noinclude>
11610 </noinclude>
11611 |- <includeonly>
11614 </includeonly>
11616 !! html
11617 <table>
11620 <tr>
11621 <td>a
11622 </td></tr>
11623 </table>
11625 !!end
11628 ### Token Stream Patcher tests
11630 ### These tests won't always pass wt2wt and other modes because
11631 ### on serialization, the table will be output on a new line.
11632 ### For now, we are blacklisting them, and using this to test selser.
11635 !!test
11636 1. Table tag in SOL posn. should get reparsed correctly with valid TSR
11637 !!options
11638 parsoid=wt2html,wt2wt
11639 !!wikitext
11640 {{echo|}}{| width = '100%'
11641 |foo
11643 !!html/parsoid
11644 <span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":""}},"i":0}}]}'></span><table width="100%">
11645 <tbody><tr><td>foo</td></tr>
11646 </tbody></table>
11647 !!end
11649 ## We used to, but no longer wt2wt this test since the default serializer
11650 ## will normalize the include directives to serialize on their own line.
11651 ## Selser will take care of preserving formatting in scenarios where they
11652 ## intermingled with other wikitext.
11653 !!test
11654 2. Table tag in SOL posn. should get reparsed correctly with valid TSR
11655 !!options
11656 parsoid=wt2html
11657 !!wikitext
11658 <includeonly>a</includeonly>{| {{{b}}}
11661 !!html/parsoid
11662 <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;{\"pi\":[[]],\"dsr\":[31,38,null,null]}&#39; data-mw=&#39;{\"parts\":[{\"templatearg\":{\"target\":{\"wt\":\"b\"},\"params\":{},\"i\":0}}]}&#39;>{{{b}}}&lt;/span>"},{"html":""}]]}'>
11663 <tbody><tr><td>c</td></tr>
11664 </tbody></table>
11665 !!end
11667 !! test
11668 Table wikitext syntax outside wiki-tables
11669 !! wikitext
11671 |+ not a caption
11672 ! not a table heading
11673 |- not a table row
11674 | not a table cell
11675 | class="foo bar" | baz
11680 !! html
11681 <p>a
11682 |+ not a caption
11683 ! not a table heading
11684 |- not a table row
11685 | not a table cell
11686 | class="foo bar" | baz
11691 </p>
11692 !! end
11695 ### Testing parsing of templates where a template arg
11696 ### has the same name as the template itself.
11699 !! article
11700 Template:quote
11701 !! text
11702 {{{quote|{{{1}}}}}}
11703 !! endarticle
11705 !!test
11706 Templates: Template Name/Arg clash: 1. Use of positional param
11707 !! wikitext
11708 {{quote|foo}}
11709 !! html
11710 <p>foo
11711 </p>
11712 !!end
11714 !!test
11715 Templates: Template Name/Arg clash: 2. Use of named param
11716 !! wikitext
11717 {{quote|quote=foo}}
11718 !! html
11719 <p>foo
11720 </p>
11721 !!end
11723 !!test
11724 Templates: Template Name/Arg clash: 3. Use of named param with empty input
11725 !! wikitext
11726 {{quote|quote}}
11727 !! html
11728 <p>quote
11729 </p>
11730 !!end
11733 ### Parsoid-centric tests to stress Parsoid's ability to RT them unchanged
11736 !!test
11737 Templates: 1. Simple use
11738 !! wikitext
11739 {{echo|Foo}}
11740 !! html
11741 <p>Foo
11742 </p>
11743 !!end
11745 !!test
11746 Templates: 2. Inside a block tag
11747 !! wikitext
11748 <div>{{echo|Foo}}</div>
11749 <blockquote>{{echo|Foo}}</blockquote>
11750 !! html
11751 <div>Foo</div>
11752 <blockquote>Foo</blockquote>
11754 !! html+tidy
11755 <div>Foo</div>
11756 <blockquote>
11757 <p>Foo</p>
11758 </blockquote>
11759 !!end
11761 !!test
11762 Templates: P-wrapping: 1a. Templates on consecutive lines
11763 !! wikitext
11764 {{echo|Foo}}
11765 {{echo|bar}}
11766 !! html
11767 <p>Foo
11769 </p>
11770 !!end
11772 !!test
11773 Templates: P-wrapping: 1b. Templates on consecutive lines
11774 !! wikitext
11777 {{echo|bar}}
11778 {{echo|baz}}
11779 !! html
11780 <p>Foo
11781 </p><p>bar
11783 </p>
11784 !!end
11786 !!test
11787 Templates: P-wrapping: 1c. Templates on consecutive lines
11788 !! wikitext
11789 {{echo|Foo}}
11790 {{echo|bar}} <div>baz</div>
11791 !! html
11792 <p>Foo
11793 </p>
11794 bar <div>baz</div>
11796 !! html+tidy
11797 <p>Foo</p>
11798 <p>bar</p>
11799 <div>baz</div>
11800 !! end
11802 !!test
11803 Templates: P-wrapping: 1d. Template preceded by comment-only line
11804 !!options
11805 parsoid
11806 !! wikitext
11807 <!-- foo -->
11808 {{echo|Bar}}
11809 !! html
11810 <!-- foo -->
11812 <p about="#mwt223" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"Bar"}},"i":0}}]}'>Bar</p>
11813 !!end
11815 !!test
11816 Templates: Inline Text: 1. Multiple template uses
11817 !! wikitext
11818 {{echo|Foo}}bar{{echo|baz}}
11819 !! html
11820 <p>Foobarbaz
11821 </p>
11822 !!end
11824 !!test
11825 Templates: Inline Text: 2. Back-to-back template uses
11826 !! wikitext
11827 {{echo|Foo}}{{echo|bar}}
11828 !! html
11829 <p>Foobar
11830 </p>
11831 !!end
11833 !!test
11834 Templates: Block Tags: 1. Multiple template uses
11835 !! wikitext
11836 {{echo|<div>Foo</div>}}<div>bar</div>{{echo|<div>baz</div>}}
11837 !! html
11838 <div>Foo</div><div>bar</div><div>baz</div>
11840 !!end
11842 !!test
11843 Templates: Block Tags: 2. Back-to-back template uses
11844 !! wikitext
11845 {{echo|<div>Foo</div>}}{{echo|<div>bar</div>}}
11846 !! html
11847 <div>Foo</div><div>bar</div>
11849 !!end
11851 # This is an edge case relating to paragraph wrapping.
11852 !!test
11853 Templates: Correctly encapsulate templates producing </p> tag without a corresponding <p> tag
11854 !! wikitext
11855 {{echo|a
11856 b</p>}}
11857 !! html/parsoid
11858 <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
11859 b</p>
11860 !!end
11862 !!test
11863 Templates: Links: 1. Simple example
11864 !! wikitext
11865 {{echo|[[Foo|bar]]}}
11866 !! html
11867 <p><a href="/wiki/Foo" title="Foo">bar</a>
11868 </p>
11869 !!end
11871 !!test
11872 Templates: Links: 2. Generation of link href
11873 !! wikitext
11874 [[{{echo|Foo}}|bar]]
11875 !! html
11876 <p><a href="/wiki/Foo" title="Foo">bar</a>
11877 </p>
11878 !!end
11880 !!test
11881 Templates: Links: 3. Generation of part of a link href
11882 !! wikitext
11883 [[Fo{{echo|o}}|bar]]
11885 [[Foo{{echo|bar}}]]
11887 [[Foo{{echo|bar}}baz]]
11889 [[Foo{{echo|bar}}|bar]]
11891 [[:Foo{{echo|bar}}]]
11893 [[:Foo{{echo|bar}}|bar]]
11894 !! html
11895 <p><a href="/wiki/Foo" title="Foo">bar</a>
11896 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
11897 </p><p><a href="/index.php?title=Foobarbaz&amp;action=edit&amp;redlink=1" class="new" title="Foobarbaz (page does not exist)">Foobarbaz</a>
11898 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
11899 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
11900 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
11901 </p>
11902 !!end
11904 !!test
11905 Templates: Links: 4. Multiple templates generating link href
11906 !! wikitext
11907 [[{{echo|F}}{{echo|o}}ob{{echo|ar}}]]
11908 !! html
11909 <p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
11910 </p>
11911 !!end
11913 !!test
11914 Templates: Links: 5. Generation of link text
11915 !! wikitext
11916 [[Foo|{{echo|bar}}]]
11917 !! html
11918 <p><a href="/wiki/Foo" title="Foo">bar</a>
11919 </p>
11920 !!end
11922 !!test
11923 Templates: Links: 5. Nested templates (only outermost template should be marked)
11924 !! wikitext
11925 {{echo|[[{{echo|Foo}}|bar]]}}
11926 !! html
11927 <p><a href="/wiki/Foo" title="Foo">bar</a>
11928 </p>
11929 !!end
11931 !!test
11932 Templates: HTML Tag: 1. Generation of HTML attr. key
11933 !! wikitext
11934 <div {{echo|style}}="color:red;">foo</div>
11935 !! html
11936 <div style="color:red;">foo</div>
11938 !!end
11940 !!test
11941 Templates: HTML Tag: 2. Generation of HTML attr. value
11942 !! wikitext
11943 <div style={{echo|'color:red;'}}>foo</div>
11944 !! html
11945 <div style="color:red;">foo</div>
11947 !!end
11949 !!test
11950 Templates: HTML Tag: 3. Generation of HTML attr key and value
11951 !! wikitext
11952 <div {{echo|style}}={{echo|'color:red;'}}>foo</div>
11953 !! html
11954 <div style="color:red;">foo</div>
11956 !!end
11958 !!test
11959 Templates: HTML Tag: 4. Generation of starting piece of HTML attr value
11960 !! wikitext
11961 <div title="{{echo|This is a long title}} with just one piece templated">foo</div>
11962 !! html
11963 <div title="This is a long title with just one piece templated">foo</div>
11965 !!end
11967 !!test
11968 Templates: HTML Tag: 5. Generation of middle piece of HTML attr value
11969 !! wikitext
11970 <div title="This is a long title with just {{echo|one piece}} templated">foo</div>
11971 !! html
11972 <div title="This is a long title with just one piece templated">foo</div>
11974 !!end
11976 !!test
11977 Templates: HTML Tag: 6. Generation of end piece of HTML attr value
11978 !! wikitext
11979 <div title="This is a long title with just one piece {{echo|templated}}">foo</div>
11980 !! html
11981 <div title="This is a long title with just one piece templated">foo</div>
11983 !!end
11985 # SSS FIXME: While it is great we added support for all this,
11986 # do we want to make this part of the spec? Maybe we want to
11987 # deprecate this kind of usage in the future?
11988 !!test
11989 Templates: HTML Tag: 7. Generation of partial attribute key string
11990 !! wikitext
11991 <div st{{echo|yle}}="color:red;">foo</div>
11992 !! html
11993 <div style="color:red;">foo</div>
11995 !!end
11997 !! test
11998 Templates: HTML Tag: 8. Template-generated attribute (k=v)
11999 !! wikitext
12000 <div {{echo|1=id="v1"}}>bar</div>
12001 !! html
12002 <div id="v1">bar</div>
12004 !!end
12006 !! test
12007 Templates: HTML Tag: 9. Multiple template-generated attributes
12008 !! wikitext
12009 <div {{echo|1=id="v1" title="foo"}}>bar</div>
12010 !! html
12011 <div id="v1" title="foo">bar</div>
12013 !!end
12015 !! test
12016 Templates: Support for templates generating attributes and content
12017 !! wikitext
12018 {| {{mixed_attr_content_template}}
12020 |bar
12022 !! html/php
12023 <table style="color:red;" title="T48811">
12025 <tr>
12026 <td>foo
12027 </td></tr>
12028 <tr>
12029 <td>bar
12030 </td></tr></table>
12032 !! html/parsoid
12033 <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|}"]}'>
12034 <tbody><tr>
12035 <td>foo</td></tr>
12036 <tr>
12037 <td>bar</td></tr>
12038 </tbody></table>
12039 !!end
12041 !! test
12042 1. Entities and nowikis inside templated attributes should be handled correctly
12043 !! wikitext
12044 <div {{echo|style{{=}}"background:&#35;f9f9f9;"}}>foo</div>
12045 !! html/php
12046 <div style="background:#f9f9f9;">foo</div>
12048 !! html/parsoid
12049 <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>
12050 !! end
12052 !! test
12053 2. Entities and nowikis inside templated attributes should be handled correctly
12054 !! wikitext
12056 |{{table_attribs_3}}
12058 !! html/php
12059 <table>
12060 <tr>
12061 <td style="background:#f9f9f9;">Foo
12062 </td></tr></table>
12064 !! html/parsoid
12065 <table>
12066 <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>
12067 </tbody></table>
12068 !! end
12070 !! test
12071 3. Entities and nowikis inside templated attributes should be handled correctly inside templated tables
12072 !! wikitext
12073 {{tbl-start}}
12074 |{{table_attribs_3}}
12075 {{tbl-end}}
12076 !! html/php
12077 <table>
12078 <tr>
12079 <td style="background:#f9f9f9;">Foo
12080 </td></tr></table>
12082 !! html/parsoid
12083 <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}}]}'>
12084 <tbody><tr><td style="background:#f9f9f9;">Foo</td></tr>
12085 </tbody></table>
12086 !! end
12088 # T107622
12089 !! test
12090 4. Entities and nowikis inside templated attributes should be handled correctly inside templated tables
12091 !! wikitext
12093 | {{table_attribs_6}} hi
12095 !! html/php
12096 <table>
12097 <tr>
12098 <td style="background: red;"> hi
12099 </td></tr></table>
12101 !! html/parsoid
12102 <table>
12103 <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>
12104 </tbody></table>
12105 !! end
12107 !!test
12108 Templates: HTML Tables: 1. Generating start of a HTML table
12109 !! wikitext
12110 {{echo|<table><tr><td>foo</td>}}</tr></table>
12111 !! html
12112 <table><tr><td>foo</td></tr></table>
12114 !!end
12116 !!test
12117 Templates: HTML Tables: 2a. Generating middle of a HTML table
12118 !! wikitext
12119 <table><tr>{{echo|<td>foo</td>}}</tr></table>
12120 !! html
12121 <table><tr><td>foo</td></tr></table>
12123 !!end
12125 !!test
12126 Templates: HTML Tables: 2b. Generating middle of a HTML table
12127 !! wikitext
12128 <table>{{echo|<tr><td>foo</td></tr>}}</table>
12129 !! html
12130 <table><tr><td>foo</td></tr></table>
12132 !!end
12134 !!test
12135 Templates: HTML Tables: 3. Generating end of a HTML table
12136 !! wikitext
12137 <table><tr>{{echo|<td>foo</td></tr></table>}}
12138 !! html
12139 <table><tr><td>foo</td></tr></table>
12141 !!end
12143 !!test
12144 Templates: HTML Tables: 4a. Generating a single tag of a HTML table
12145 !! wikitext
12146 {{echo|<table>}}<tr><td>foo</td></tr></table>
12147 !! html
12148 <table><tr><td>foo</td></tr></table>
12150 !!end
12152 !!test
12153 Templates: HTML Tables: 4b. Generating a single tag of a HTML table
12154 !! wikitext
12155 <table>{{echo|<tr>}}<td>foo</td></tr></table>
12156 !! html
12157 <table><tr><td>foo</td></tr></table>
12159 !!end
12161 !!test
12162 Templates: HTML Tables: 4c. Generating a single tag of a HTML table
12163 !! wikitext
12164 <table><tr>{{echo|<td>}}foo</td></tr></table>
12165 !! html
12166 <table><tr><td>foo</td></tr></table>
12168 !!end
12170 !!test
12171 Templates: HTML Tables: 4d. Generating a single tag of a HTML table
12172 !! wikitext
12173 <table><tr><td>foo{{echo|</td>}}</tr></table>
12174 !! html
12175 <table><tr><td>foo</td></tr></table>
12177 !!end
12179 !!test
12180 Templates: HTML Tables: 4e. Generating a single tag of a HTML table
12181 !! wikitext
12182 <table><tr><td>foo</td>{{echo|</tr>}}</table>
12183 !! html
12184 <table><tr><td>foo</td></tr></table>
12186 !!end
12188 !!test
12189 Templates: HTML Tables: 4f. Generating a single tag of a HTML table
12190 !! wikitext
12191 <table><tr><td>foo</td></tr>{{echo|</table>}}
12192 !! html
12193 <table><tr><td>foo</td></tr></table>
12195 !!end
12197 !!test
12198 Templates: HTML Tables: 5. Proper fostering of categories from inside
12199 !!options
12200 parsoid=wt2html,wt2wt
12201 !! wikitext
12202 <table>[[Category:foo1]]<tr><td>foo</td></tr></table>
12203 <!--Two categories (Bug 50330)-->
12204 <table>[[Category:bar1]][[Category:bar2]]<tr><td>foo</td></tr></table>
12205 !! html
12206 <link rel="mw:PageProp/Category" href="./Category:Foo1"><table><tbody><tr><td>foo</td></tr></tbody></table>
12207 <!--Two categories (Bug 50330)-->
12208 <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>
12209 !!end
12211 !!test
12212 Templates: Wiki Tables: 1a. Fostering of entire template content
12213 !! wikitext
12215 {{echo|a}}
12217 !! html
12218 <table>
12220 <tr><td></td></tr></table>
12222 !! html+tidy
12223 <p>a</p>
12224 <table>
12225 <tr>
12226 <td></td>
12227 </tr>
12228 </table>
12229 !! end
12231 !!test
12232 Templates: Wiki Tables: 1b. Fostering of entire template content
12233 !! wikitext
12235 {{echo|<div>}}
12237 {{echo|</div>}}
12239 !! html
12240 <table>
12241 <div>
12242 <p>foo
12243 </p>
12244 </div>
12245 <tr><td></td></tr></table>
12247 !! html+tidy
12248 <div>
12249 <p>foo</p>
12250 </div>
12251 <table>
12252 <tr>
12253 <td></td>
12254 </tr>
12255 </table>
12256 !! end
12258 !!test
12259 Templates: Wiki Tables: 2. Fostering of partial template content
12260 !! wikitext
12262 {{echo|a
12263 <div>b</div>}}
12265 !! html
12266 <table>
12268 <div>b</div>
12269 <tr><td></td></tr></table>
12271 !! html+tidy
12272 <p>a</p>
12273 <div>b</div>
12274 <table>
12275 <tr>
12276 <td></td>
12277 </tr>
12278 </table>
12279 !! end
12281 !!test
12282 Templates: Wiki Tables: 3. td-content via multiple templates
12283 !! wikitext
12285 {{echo|{{pipe}}a}}{{echo|b}}
12287 !! html
12288 <table>
12289 <tr>
12290 <td>ab
12291 </td></tr></table>
12293 !!end
12295 !!test
12296 Templates: Wiki Tables: 4. Templated tags, no content
12297 !! wikitext
12298 {{tbl-start}}
12299 {{tbl-end}}
12300 !! html
12301 <table>
12302 <tr><td></td></tr></table>
12304 !!end
12306 !!test
12307 Templates: Wiki Tables: 5. Templated tags, regular td-tags
12308 !! wikitext
12309 {{tbl-start}}
12310 |foo
12311 {{tbl-end}}
12312 !! html
12313 <table>
12314 <tr>
12315 <td>foo
12316 </td></tr></table>
12318 !!end
12320 !!test
12321 Templates: Wiki Tables: 6. Templated tags, templated td-tags
12322 !! wikitext
12323 {{tbl-start}}
12324 {{!}}foo
12325 {{tbl-end}}
12326 !! html
12327 <table>
12328 <tr>
12329 <td>foo
12330 </td></tr></table>
12332 !!end
12334 ## This test case is very specific to Parsoid's internals
12335 ## and is hence only tested for Parsoid's code. Parsoid uses
12336 ## a <meta> marker tag for <ref> tags and they are expanded
12337 ## much later. We are verifying that this <meta> tag usage
12338 ## doesn't prevent foster parenting.
12339 !!test
12340 Templates: Wiki Tables: 7. Fosterable <ref>s should get fostered
12341 !!wikitext
12342 {{PartialTable}}<ref>foo</ref>
12345 <references />
12346 !!html/parsoid
12347 <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="./Main_Page#cite_note-1"><span class="mw-reflink-text">[1]</span></a></span><table about="#mwt2">
12348 <tbody>
12349 </tbody></table>
12351 <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="./Main_Page#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>
12352 !!end
12354 !! test
12355 Templates: Wiki Tables: 8. Fosterable meta-tags should get fostered
12356 !! wikitext
12357 {{echo|
12358 {{{!}}
12359 {{!}}-}}
12360 <onlyinclude>
12361 |foo
12362 </onlyinclude>
12363 {{!}}}
12364 !! html/parsoid
12365 <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{{!}}}"]}'>
12366 </span><meta typeof="mw:Includes/OnlyInclude" about="#mwt1"/><table about="#mwt1">
12367 <tbody><tr>
12369 <td>foo
12370 <meta typeof="mw:Includes/OnlyInclude/End"/></td></tr>
12371 </tbody></table>
12372 !! end
12374 !!test
12375 Templates: Lists: Multi-line list-items via templates
12376 !! wikitext
12377 *{{echo|a {{nonexistent|
12378 unused}}}}
12379 *{{echo|b {{nonexistent|
12380 unused}}}}
12381 !! html
12382 <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>
12383 <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>
12385 !!end
12387 !!test
12388 Templates: Ugly nesting: 1. Quotes opened/closed across templates (echo)
12389 !! wikitext
12390 {{echo|''a}}{{echo|b''c''d}}{{echo|''e}}
12391 !! html
12392 <p><i>ab</i>c<i>d</i>e
12393 </p>
12394 !!end
12396 !!test
12397 Templates: Ugly nesting: 2. Quotes opened/closed across templates (echo_with_span)
12398 (PHP parser generates misnested html)
12399 !! wikitext
12400 {{echo_with_span|''a}}{{echo_with_span|b''c''d}}{{echo_with_span|''e}}
12401 !! html/parsoid
12402 <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>
12403 !!end
12405 !!test
12406 Templates: Ugly nesting: 3. Quotes opened/closed across templates (echo_with_div)
12407 (PHP parser generates misnested html; Parsoid html2wt mode adds newlines between {{echo}}s)
12408 !! options
12409 parsoid=wt2html,wt2wt
12410 !! wikitext
12411 {{echo_with_div|''a}}{{echo_with_div|b''c''d}}{{echo_with_div|''e}}
12412 !! html
12413 <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>
12414 <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>
12415 <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>
12416 !!end
12418 !!test
12419 Templates: Ugly nesting: 4. Divs opened/closed across templates
12420 !! wikitext
12421 a<div>b{{echo|c</div>d}}e
12422 !! html
12423 a<div>bc</div>de
12425 !! html+tidy
12426 <p>a</p>
12427 <div>bc</div>
12428 <p>de</p>
12429 !! end
12431 !!test
12432 Templates: Ugly templates: 1. Navbox template parses badly leading to table misnesting
12433 (Parsoid-centric)
12434 !! options
12435 parsoid
12436 !! wikitext
12438 |{{echo|foo</table>}}
12439 |bar
12441 !! html
12442 <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|}"]}'>
12444 <tbody>
12445 <tr>
12446 <td>foo</td></tr></tbody></table><span about="#mwt1">
12447 </span><span about="#mwt1">|bar</span><span about="#mwt1">
12448 |}</span>
12449 !!end
12451 !!test
12452 Templates: Ugly templates: 2. Navbox template parses badly leading to table misnesting
12453 (Parsoid-centric)
12454 !! options
12455 parsoid
12456 !! wikitext
12457 <table>
12458   <tr>
12459     <td>
12460     <table>
12461       <tr>
12462         <td>1. {{echo|foo </table>}}</td>
12463         <td> bar </td>
12464         <td>2. {{echo|baz </table>}}</td>
12465       </tr>
12466       <tr>
12467         <td>abc</td>
12468       </tr>
12469     </table>
12470     </td>
12471   </tr>
12472   <tr>
12473     <td>xyz</td>
12474   </tr>
12475 </table>
12476 !! html
12477 <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>"]}'>
12478   <tbody><tr>
12479     <td>
12480     <table>
12481       <tbody><tr>
12482         <td>1. foo </td></tr></tbody></table></td>
12483         <td> bar </td>
12484         <td>2. baz </td></tr></tbody></table><span about="#mwt2">
12485       </span><span about="#mwt2">
12486       </span><span about="#mwt2">
12487         </span><span about="#mwt2">abc</span><span about="#mwt2">
12488       </span><span about="#mwt2">
12489     </span><span about="#mwt2">
12490     </span><span about="#mwt2">
12491   </span><span about="#mwt2">
12492   </span><span about="#mwt2">
12493     </span><span about="#mwt2">xyz</span><span about="#mwt2">
12494   </span><span about="#mwt2">
12495 </span>
12496 !!end
12498 !! test
12499 Templates: Ugly templates: 3. newline-only template parameter
12500 !! wikitext
12501 foo {{echo|
12503 !! html
12504 <p>foo 
12505 </p>
12506 !! end
12508 # This looks like a bug: a single newline triggers p/br for some reason.
12509 !! test
12510 Templates: Ugly templates: 4. newline-only template parameter inconsistency
12511 !! wikitext
12512 {{echo|
12514 !! html
12515 <p><br />
12516 </p>
12517 !! end
12519 # Bug 64017 -- ugly wikitext with fostered content generates two template ranges that
12520 # have a true overlap (T1-start - T2-start - T1-end - T2-end).
12521 !! test
12522 Templates: Ugly templates: 5. Template encapsulation test: Non-trivial overlap of template ranges is properly handled
12523 !! wikitext
12524 {{echo|<table>}}
12525 {{echo|<div>foo}}
12526 {{echo|</table>}}
12527 !! html/parsoid
12528 <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
12529 </div><table about="#mwt1" data-parsoid='{"stx":"html"}'>
12530 </table>
12531 !! end
12533 # Bug 64017 -- ugly wikitext with fostered content generates two template ranges
12534 # that are "identical" and generate nesting cycles in the algorithm
12535 !! test
12536 Templates: Ugly templates: 6. Template encapsulation test: Cyclical nesting of template ranges is properly handled
12537 !! wikitext
12538 {{echo|<table><tr><td><table>}}
12539 {{echo|<div>}}
12540 {{echo|</div>}}
12541 !! html/parsoid
12542 <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"}'>
12543 </div><table about="#mwt1" data-parsoid='{"stx":"html"}'>
12544 </table></td></tr></tbody></table>
12545 !! end
12547 !! test
12548 Templates: Parameters substituted at the top-level
12549 !! wikitext
12550 {{{foo|''who'' {{echo|me}}? '''never!'''}}}
12552 {{{foo|bar|baz}}}
12553 !! html/php
12554 <p><i>who</i> me? <b>never!</b>
12555 </p><p>bar
12556 </p>
12557 !! html/parsoid
12558 <p about="#mwt2" typeof="mw:Param" data-mw='{"parts":[{"templatearg":{"target":{"wt":"foo"},"params":{"1":{"wt":"&#39;&#39;who&#39;&#39; {{echo|me}}? &#39;&#39;&#39;never!&#39;&#39;&#39;"}},"i":0}}]}'><i>who</i> me? <b>never!</b></p>
12560 <p about="#mwt3" typeof="mw:Param" data-mw='{"parts":[{"templatearg":{"target":{"wt":"foo"},"params":{"1":{"wt":"bar"},"2":{"wt":"baz"}},"i":0}}]}'>bar</p>
12561 !! end
12563 !!test
12564 Parser Functions: 1. Simple example
12565 !! wikitext
12566 {{uc:foo}}
12567 !! html
12568 <p>FOO
12569 </p>
12570 !!end
12572 !!test
12573 Parser Functions: 2. Nested use (only outermost should be marked up)
12574 !! wikitext
12575 {{uc:{{lc:FOO}}}}
12576 !! html
12577 <p>FOO
12578 </p>
12579 !!end
12582 ### Pre-save transform tests
12584 !! test
12585 pre-save transform: subst:
12586 !! options
12588 !! wikitext
12589 {{subst:test}}
12590 !! html/php
12591 This is a test template
12592 !! end
12594 !! test
12595 pre-save transform: normal template
12596 !! options
12598 !! wikitext
12599 {{test}}
12600 !! html/php
12601 {{test}}
12602 !! end
12604 !! test
12605 pre-save transform: nonexistent template
12606 !! options
12608 !! wikitext
12609 {{thistemplatedoesnotexist}}
12610 !! html/php
12611 {{thistemplatedoesnotexist}}
12612 !! end
12614 !! test
12615 pre-save transform: subst magic variables
12616 !! options
12618 !! wikitext
12619 {{subst:SITENAME}}
12620 !! html/php
12621 MediaWiki
12622 !! end
12624 # This is bug 89, which I fixed. -- wtm
12625 !! test
12626 pre-save transform: subst: templates with parameters
12627 !! options
12629 !! wikitext
12630 {{subst:paramtest|param="something else"}}
12631 !! html/php
12632 This is a test template with parameter "something else"
12633 !! end
12635 !! article
12636 Template:nowikitest
12637 !! text
12638 <nowiki>'''not wiki'''</nowiki>
12639 !! endarticle
12641 !! test
12642 pre-save transform: nowiki in subst (bug 1188)
12643 !! options
12645 !! wikitext
12646 {{subst:nowikitest}}
12647 !! html/php
12648 <nowiki>'''not wiki'''</nowiki>
12649 !! end
12651 !! article
12652 Template:commenttest
12653 !! text
12654 This template has <!-- a comment --> in it.
12655 !! endarticle
12657 !! test
12658 pre-save transform: comment in subst (bug 1936)
12659 !! options
12661 !! wikitext
12662 {{subst:commenttest}}
12663 !! html/php
12664 This template has <!-- a comment --> in it.
12665 !! end
12667 !! test
12668 pre-save transform: unclosed tag
12669 !! options
12671 !! wikitext
12672 <nowiki>'''not wiki'''
12673 !! html/php
12674 <nowiki>'''not wiki'''
12675 !! end
12677 !! test
12678 pre-save transform: mixed tag case
12679 !! options
12681 !! wikitext
12682 <NOwiki>'''not wiki'''</noWIKI>
12683 !! html/php
12684 <NOwiki>'''not wiki'''</noWIKI>
12685 !! end
12687 !! test
12688 pre-save transform: unclosed comment in <nowiki>
12689 !! options
12691 !! wikitext
12692 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
12693 !! html/php
12694 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
12695 !!end
12697 # Leading @ in this template definition works around a limitation
12698 # in parsoid's parserTests which otherwise strips the <span> from the
12699 # result (confusing it for a template wrapper)
12700 !! article
12701 Template:dangerous
12702 !!text
12703 @<span onmouseover="alert('crap')">Oh no</span>
12704 !!endarticle
12706 !!test
12707 (confirming safety of fix for subst bug 1936)
12708 !! wikitext
12709 {{Template:dangerous}}
12710 !! html
12711 <p>@<span>Oh no</span>
12712 </p>
12713 !! end
12715 !! test
12716 pre-save transform: comment containing gallery (bug 5024)
12717 !! options
12719 !! wikitext
12720 <!-- <gallery>data</gallery> -->
12721 !! html/php
12722 <!-- <gallery>data</gallery> -->
12723 !!end
12725 !! test
12726 pre-save transform: comment containing extension
12727 !! options
12729 !! wikitext
12730 <!-- <tag>data</tag> -->
12731 !! html/php
12732 <!-- <tag>data</tag> -->
12733 !!end
12735 !! test
12736 pre-save transform: comment containing nowiki
12737 !! options
12739 !! wikitext
12740 <!-- <nowiki>data</nowiki> -->
12741 !! html/php
12742 <!-- <nowiki>data</nowiki> -->
12743 !!end
12745 !! test
12746 pre-save transform: <noinclude> in subst (bug 3298)
12747 !! options
12749 !! wikitext
12750 {{subst:Includes}}
12751 !! html/php
12752 Foobar
12753 !! end
12755 !! test
12756 pre-save transform: <onlyinclude> in subst (bug 3298)
12757 !! options
12759 !! wikitext
12760 {{subst:Includes2}}
12761 !! html/php
12763 !! end
12765 !! article
12766 Template:SubstTest
12767 !!text
12768 {{<includeonly>subst:</includeonly>Includes}}
12769 !! endarticle
12771 !! article
12772 Template:SafeSubstTest
12773 !! text
12774 {{<includeonly>safesubst:</includeonly>Includes}}
12775 !! endarticle
12777 !! test
12778 bug 22297: safesubst: works during PST
12779 !! options
12781 !! wikitext
12782 {{subst:SafeSubstTest}}{{safesubst:SubstTest}}
12783 !! html/php
12784 FoobarFoobar
12785 !! end
12787 !! test
12788 bug 22297: safesubst: works during normal parse
12789 !! wikitext
12790 {{SafeSubstTest}}
12791 !! html
12792 <p>Foobar
12793 </p>
12794 !! end
12796 !! test
12797 subst: does not work during normal parse
12798 !! wikitext
12799 {{SubstTest}}
12800 !! html
12801 <p>{{subst:Includes}}
12802 </p>
12803 !! end
12805 !! test
12806 pre-save transform: context links ("pipe trick")
12807 !! options
12809 !! wikitext
12810 [[Article (context)|]]
12811 [[Bar:Article|]]
12812 [[:Bar:Article|]]
12813 [[Bar:Article (context)|]]
12814 [[:Bar:Article (context)|]]
12815 [[|Article]]
12816 [[|Article (context)]]
12817 [[Bar:X (Y) Z|]]
12818 [[:Bar:X (Y) Z|]]
12819 !! html/php
12820 [[Article (context)|Article]]
12821 [[Bar:Article|Article]]
12822 [[:Bar:Article|Article]]
12823 [[Bar:Article (context)|Article]]
12824 [[:Bar:Article (context)|Article]]
12825 [[Article]]
12826 [[Article (context)]]
12827 [[Bar:X (Y) Z|X (Y) Z]]
12828 [[:Bar:X (Y) Z|X (Y) Z]]
12829 !! end
12831 !! test
12832 pre-save transform: context links ("pipe trick") with interwiki prefix
12833 !! options
12835 !! wikitext
12836 [[interwiki:Article|]]
12837 [[:interwiki:Article|]]
12838 [[interwiki:Bar:Article|]]
12839 [[:interwiki:Bar:Article|]]
12840 !! html/php
12841 [[interwiki:Article|Article]]
12842 [[:interwiki:Article|Article]]
12843 [[interwiki:Bar:Article|Bar:Article]]
12844 [[:interwiki:Bar:Article|Bar:Article]]
12845 !! end
12847 !! test
12848 pre-save transform: context links ("pipe trick") with parens in title
12849 !! options
12850 pst title=[[Somearticle (context)]]
12851 !! wikitext
12852 [[|Article]]
12853 !! html/php
12854 [[Article (context)|Article]]
12855 !! end
12857 !! test
12858 pre-save transform: context links ("pipe trick") with comma in title
12859 !! options
12860 pst title=[[Someplace, Somewhere]]
12861 !! wikitext
12862 [[|Otherplace]]
12863 [[Otherplace, Elsewhere|]]
12864 [[Otherplace, Elsewhere, Anywhere|]]
12865 !! html/php
12866 [[Otherplace, Somewhere|Otherplace]]
12867 [[Otherplace, Elsewhere|Otherplace]]
12868 [[Otherplace, Elsewhere, Anywhere|Otherplace]]
12869 !! end
12871 !! test
12872 pre-save transform: context links ("pipe trick") with parens and comma
12873 !! options
12874 pst title=[[Someplace (IGNORED), Somewhere]]
12875 !! wikitext
12876 [[|Otherplace]]
12877 [[Otherplace (place), Elsewhere|]]
12878 !! html/php
12879 [[Otherplace, Somewhere|Otherplace]]
12880 [[Otherplace (place), Elsewhere|Otherplace]]
12881 !! end
12883 !! test
12884 pre-save transform: context links ("pipe trick") with comma and parens
12885 !! options
12886 pst title=[[Who, me? (context)]]
12887 !! wikitext
12888 [[|Yes, you.]]
12889 [[Me, Myself, and I (1937 song)|]]
12890 !! html/php
12891 [[Yes, you. (context)|Yes, you.]]
12892 [[Me, Myself, and I (1937 song)|Me, Myself, and I]]
12893 !! end
12895 !! test
12896 pre-save transform: context links ("pipe trick") with namespace
12897 !! options
12898 pst title=[[Ns:Somearticle]]
12899 !! wikitext
12900 [[|Article]]
12901 !! html/php
12902 [[Ns:Article|Article]]
12903 !! end
12905 !! test
12906 pre-save transform: context links ("pipe trick") with namespace and parens
12907 !! options
12908 pst title=[[Ns:Somearticle (context)]]
12909 !! wikitext
12910 [[|Article]]
12911 !! html/php
12912 [[Ns:Article (context)|Article]]
12913 !! end
12915 !! test
12916 pre-save transform: context links ("pipe trick") with namespace and comma
12917 !! options
12918 pst title=[[Ns:Somearticle, Context, Whatever]]
12919 !! wikitext
12920 [[|Article]]
12921 !! html/php
12922 [[Ns:Article, Context, Whatever|Article]]
12923 !! end
12925 !! test
12926 pre-save transform: context links ("pipe trick") with namespace, comma and parens
12927 !! options
12928 pst title=[[Ns:Somearticle, Context (context)]]
12929 !! wikitext
12930 [[|Article]]
12931 !! html/php
12932 [[Ns:Article (context)|Article]]
12933 !! end
12935 !! test
12936 pre-save transform: context links ("pipe trick") with namespace, parens and comma
12937 !! options
12938 pst title=[[Ns:Somearticle (IGNORED), Context]]
12939 !! wikitext
12940 [[|Article]]
12941 !! html/php
12942 [[Ns:Article, Context|Article]]
12943 !! end
12945 !! test
12946 pre-save transform: context links ("pipe trick") with full-width parens and no space (Japanese and Chinese style, bug 30149)
12947 !! options
12949 !! wikitext
12950 [[Article(context)|]]
12951 [[Bar:Article(context)|]]
12952 [[:Bar:Article(context)|]]
12953 [[|Article(context)]]
12954 [[Bar:X(Y)Z|]]
12955 [[:Bar:X(Y)Z|]]
12956 !! html/php
12957 [[Article(context)|Article]]
12958 [[Bar:Article(context)|Article]]
12959 [[:Bar:Article(context)|Article]]
12960 [[Article(context)]]
12961 [[Bar:X(Y)Z|X(Y)Z]]
12962 [[:Bar:X(Y)Z|X(Y)Z]]
12963 !! end
12965 !! test
12966 pre-save transform: context links ("pipe trick") with full-width parens and space (Japanese and Chinese style, bug 30149)
12967 !! options
12969 !! wikitext
12970 [[Article (context)|]]
12971 [[Bar:Article (context)|]]
12972 [[:Bar:Article (context)|]]
12973 [[|Article (context)]]
12974 [[Bar:X (Y) Z|]]
12975 [[:Bar:X (Y) Z|]]
12976 !! html/php
12977 [[Article (context)|Article]]
12978 [[Bar:Article (context)|Article]]
12979 [[:Bar:Article (context)|Article]]
12980 [[Article (context)]]
12981 [[Bar:X (Y) Z|X (Y) Z]]
12982 [[:Bar:X (Y) Z|X (Y) Z]]
12983 !! end
12985 !! test
12986 pre-save transform: context links ("pipe trick") with parens and no space (Korean style, bug 30149)
12987 !! options
12989 !! wikitext
12990 [[Article(context)|]]
12991 [[Bar:Article(context)|]]
12992 [[:Bar:Article(context)|]]
12993 [[|Article(context)]]
12994 [[Bar:X(Y)Z|]]
12995 [[:Bar:X(Y)Z|]]
12996 !! html/php
12997 [[Article(context)|Article]]
12998 [[Bar:Article(context)|Article]]
12999 [[:Bar:Article(context)|Article]]
13000 [[Article(context)]]
13001 [[Bar:X(Y)Z|X(Y)Z]]
13002 [[:Bar:X(Y)Z|X(Y)Z]]
13003 !! end
13005 !! test
13006 pre-save transform: context links ("pipe trick") with commas (bug 21660)
13007 !! options
13009 !! wikitext
13010 [[Article (context), context|]]
13011 [[Article (context),context|]]
13012 [[Bar:Article (context), context|]]
13013 [[Bar:Article (context),context|]]
13014 [[:Bar:Article (context), context|]]
13015 [[:Bar:Article (context),context|]]
13016 !! html/php
13017 [[Article (context), context|Article]]
13018 [[Article (context),context|Article]]
13019 [[Bar:Article (context), context|Article]]
13020 [[Bar:Article (context),context|Article]]
13021 [[:Bar:Article (context), context|Article]]
13022 [[:Bar:Article (context),context|Article]]
13023 !! end
13025 !! test
13026 pre-save transform: trim trailing empty lines
13027 !! options
13029 !! wikitext
13030 Empty lines are trimmed
13035 !! html/php
13036 Empty lines are trimmed
13037 !! end
13039 !! test
13040 pre-save transform: Signature expansion
13041 !! options
13043 !! wikitext
13044 * ~~~
13045 * <noinclude>~~~</noinclude>
13046 * <includeonly>~~~</includeonly>
13047 * <onlyinclude>~~~</onlyinclude>
13048 !! html/php
13049 * [[Special:Contributions/127.0.0.1|127.0.0.1]]
13050 * <noinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</noinclude>
13051 * <includeonly>[[Special:Contributions/127.0.0.1|127.0.0.1]]</includeonly>
13052 * <onlyinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</onlyinclude>
13053 !! end
13056 !! test
13057 pre-save transform: Signature expansion in nowiki tags (bug 93)
13058 !! options
13059 pst disabled
13060 !! wikitext
13061 Shall not expand:
13063 <nowiki>~~~~</nowiki>
13065 <includeonly><nowiki>~~~~</nowiki></includeonly>
13067 <noinclude><nowiki>~~~~</nowiki></noinclude>
13069 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
13071 {{subst:Foo}} shall be converted to FOO
13073 As well as inside noinclude/onlyinclude
13074 <noinclude>{{subst:Foo}}</noinclude>
13075 <onlyinclude>{{subst:Foo}}</onlyinclude>
13077 But not inside includeonly
13078 <includeonly>{{subst:Foo}}</includeonly>
13079 !! html/php
13080 Shall not expand:
13082 <nowiki>~~~~</nowiki>
13084 <includeonly><nowiki>~~~~</nowiki></includeonly>
13086 <noinclude><nowiki>~~~~</nowiki></noinclude>
13088 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
13090 FOO shall be converted to FOO
13092 As well as inside noinclude/onlyinclude
13093 <noinclude>FOO</noinclude>
13094 <onlyinclude>FOO</onlyinclude>
13096 But not inside includeonly
13097 <includeonly>{{subst:Foo}}</includeonly>
13098 !! end
13100 !! test
13101 Parsoid: Recognize nowiki with trailing space in tags
13102 !! options
13103 parsoid=wt2html
13104 !! wikitext
13105 <nowiki ><div>[[foo]]</nowiki >
13107 a<nowiki / >b
13109 c<nowiki />d
13111 e<nowiki/ >f
13112 !! html
13113 <p><span typeof="mw:Nowiki">&lt;div&gt;[[foo]]</span></p>
13114 <p>ab</p>
13115 <p>cd</p>
13116 <p>ef</p>
13117 !! end
13119 !! test
13120 Parsoid: Recognize nowiki with odd capitalization
13121 !! options
13122 parsoid=wt2html
13123 !! wikitext
13124 <noWikI ><div>[[foo]]</Nowiki >
13125 !! html
13126 <p><span typeof="mw:Nowiki">&lt;div&gt;[[foo]]</span></p>
13127 !! end
13130 !! test
13131 Parsoid: Escape nowiki with trailing space in tags
13132 !! options
13133 parsoid=html2wt
13134 !! html/parsoid
13135 <p>&lt;nowiki &gt; foo &lt/nowiki ></p>
13136 <p>a&lt;nowiki /&gt;b</p>
13137 <p>c&lt;nowiki/ &gt;d</p>
13138 !! wikitext
13139 &lt;nowiki &gt; foo &lt;/nowiki &gt;
13141 a&lt;nowiki /&gt;b
13143 c&lt;nowiki/ &gt;d
13144 !! end
13146 !! test
13147 Parsoid: Escape weird noWikI capitalizations
13148 !! options
13149 parsoid=html2wt
13150 !! html/parsoid
13151 <p>&lt;noWikI &gt; foo &lt/NoWikI ></p>
13152 !! wikitext
13153 &lt;noWikI &gt; foo &lt;/NoWikI &gt;
13154 !! end
13157 ### Message transform tests
13159 !! test
13160 message transform: magic variables
13161 !! options
13163 !! wikitext
13164 {{SITENAME}}
13165 !! html
13166 MediaWiki
13167 !! end
13169 !! test
13170 message transform: should not transform wiki markup
13171 !! options
13173 !! wikitext
13174 ''test''
13175 !! html
13176 ''test''
13177 !! end
13179 !! test
13180 message transform: <noinclude> in transcluded template (bug 4926)
13181 !! options
13183 !! wikitext
13184 {{Includes}}
13185 !! html
13186 Foobar
13187 !! end
13189 !! test
13190 message transform: <onlyinclude> in transcluded template (bug 4926)
13191 !! options
13193 !! wikitext
13194 {{Includes2}}
13195 !! html
13197 !! end
13199 !! test
13200 {{#special:}} page name, known
13201 !! options
13203 !! wikitext
13204 {{#special:Recentchanges}}
13205 !! html
13206 Special:RecentChanges
13207 !! end
13209 !! test
13210 {{#special:}} page name with subpage, known
13211 !! options
13213 !! wikitext
13214 {{#special:Recentchanges/param}}
13215 !! html
13216 Special:RecentChanges/param
13217 !! end
13219 !! test
13220 {{#special:}} page name, unknown
13221 !! options
13223 !! wikitext
13224 {{#special:foobar nonexistent}}
13225 !! html
13226 Special:Foobar nonexistent
13227 !! end
13229 !! test
13230 {{#speciale:}} page name, known
13231 !! options
13233 !! wikitext
13234 {{#speciale:Recentchanges}}
13235 !! html
13236 Special:RecentChanges
13237 !! end
13239 !! test
13240 {{#speciale:}} page name with subpage, known
13241 !! options
13243 !! wikitext
13244 {{#speciale:Recentchanges/param}}
13245 !! html
13246 Special:RecentChanges/param
13247 !! end
13249 !! test
13250 {{#speciale:}} page name, unknown
13251 !! options
13253 !! wikitext
13254 {{#speciale:foobar nonexistent}}
13255 !! html
13256 Special:Foobar_nonexistent
13257 !! end
13260 ### Images
13262 ### For Parsoid-specific tests, see
13263 #### https://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec#Images
13265 !! test
13266 Simple image
13267 !! options
13268 parsoid=wt2html,wt2wt,html2html
13269 !! wikitext
13270 [[Image:foobar.jpg]]
13271 !! html/php
13272 <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>
13273 </p>
13274 !! html/parsoid
13275 <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>
13276 !! end
13278 !! test
13279 Simple image (using File: namespace, now canonical)
13280 !! wikitext
13281 [[File:Foobar.jpg]]
13282 !! html/php
13283 <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>
13284 </p>
13285 !! html/parsoid
13286 <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>
13287 !! end
13289 !! test
13290 Right-aligned image
13291 !! wikitext
13292 [[File:Foobar.jpg|right]]
13293 !! html/php
13294 <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>
13296 !! html/parsoid
13297 <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>
13298 !! end
13300 !! test
13301 Image with caption
13302 !! wikitext
13303 [[File:Foobar.jpg|right|Caption text]]
13304 !! html/php
13305 <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>
13307 !! html/parsoid
13308 <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>
13309 !! end
13311 !! test
13312 Image with caption, bug 53312 #1
13313 !! wikitext
13314 [[File:Foobar.jpg|right|Caption page stuff]]
13315 !! html/php
13316 <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>
13318 !! html/parsoid
13319 <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>
13320 !! end
13322 !! test
13323 Image with caption, bug 53312 #2
13324 !! wikitext
13325 [[File:Foobar.jpg|right|Caption page=]]
13326 !! html/php
13327 <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>
13329 !! html/parsoid
13330 <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>
13331 !! end
13333 !! test
13334 Image with caption, bug 53312 #3
13335 !! wikitext
13336 [[File:Foobar.jpg|right|Caption page=stuff]]
13337 !! html/php
13338 <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>
13340 !! html/parsoid
13341 <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>
13342 !! end
13344 !! test
13345 Allow empty links in image captions (Bug 60753)
13346 !! options
13347 thumbsize=220
13348 !! wikitext
13349 [[File:Foobar.jpg|thumb|Caption [[Link1]]
13350 [[]]
13351 [[Link2]]
13353 !! html/php
13354 <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>
13356 !! html/parsoid
13357 <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>
13358 [[]]
13359 <a rel="mw:WikiLink" href="./Link2" title="Link2" data-parsoid='{"stx":"simple","a":{"href":"./Link2"},"sa":{"href":"Link2"}}'>Link2</a>
13360 </figcaption></figure>
13361 !! end
13363 !! test
13364 Titles in unlinked images (T23454)
13365 !! wikitext
13366 [[File:Foobar.jpg|link=|stuff]]
13367 !! html/php
13368 <p><img alt="stuff" src="http://example.com/images/3/3a/Foobar.jpg" title="stuff" width="1941" height="220" />
13369 </p>
13370 !! end
13372 !! test
13373 Link with empty target
13374 !! wikitext
13375 [[]]
13376 !! html
13377 <p>[[]]
13378 </p>
13379 !! end
13381 !! test
13382 Image with link trail
13383 !! wikitext
13384 Linktrails should not work for images: [[File:Foobar.jpg]]s
13385 !! html/php
13386 <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
13387 </p>
13388 !! html/parsoid
13389 <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>
13390 !! end
13392 !! test
13393 Image with empty attribute
13394 !! options
13395 parsoid=wt2html,wt2wt,html2html
13396 !! wikitext
13397 [[File:Foobar.jpg|right||Caption text]]
13398 !! html/php
13399 <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>
13401 !! html/parsoid
13402 <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>
13403 !! end
13405 !! test
13406 1. Block image with individual attributes from templates
13407 !! wikitext
13408 [[File:Foobar.jpg|thumb|{{echo|137px}}|This is a caption]]
13409 !! html/php
13410 <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>
13412 !! html/parsoid
13413 <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>
13414 !! end
13416 !! test
13417 2. Block Image with individual attributes from templates
13418 !! wikitext
13419 [[File:Foobar.jpg|{{echo|thumb}}|{{echo|137px}}|This is a caption]]
13420 !! html/php
13421 <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>
13423 !! html/parsoid
13424 <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>
13425 !! end
13427 !! test
13428 3. Inline image with individual attributes from templates
13429 !! wikitext
13430 [[File:Foobar.jpg|{{echo|50px}}]]
13431 !! html/php
13432 <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>
13433 </p>
13434 !! html/parsoid
13435 <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>
13436 !! end
13438 ## Parsoid does not provide editing support for images where templates produce multiple image attributes.
13439 ## To signal this, we add a 'mw:Placeholder' type to such images. This could change in the future.
13440 !! test
13441 Image with multiple attributes from the same template
13442 !! wikitext
13443 [[File:Foobar.jpg|{{image_attribs}}]]
13444 !! html/php
13445 <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>
13447 !! html/parsoid
13448 <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>
13449 !! end
13451 !! test
13452 Image with link tails
13453 !! options
13454 thumbsize=220
13455 !! wikitext
13456 123[[File:Foobar.jpg]]456
13457 123[[File:Foobar.jpg|right]]456
13458 123[[File:Foobar.jpg|thumb]]456
13459 !! html/php
13460 <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
13461 </p>
13462 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
13463 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
13465 !! html/php+tidy
13466 <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>
13467 <p>123</p>
13468 <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>
13469 <p>456 123</p>
13470 <div class="thumb tright">
13471 <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>
13472 <div class="thumbcaption">
13473 <div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>
13474 </div>
13475 </div>
13476 </div>
13477 <p>456</p>
13478 !! html/parsoid
13479 <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>
13480 <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>
13481 <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>
13482 !! end
13484 !! test
13485 Image with multiple captions -- only last one is accepted
13486 !! wikitext
13487 [[File:Foobar.jpg|right|Caption1 - ignored|[[Caption2]] - ignored|Caption3 - accepted]]
13488 !! html/php
13489 <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>
13491 !! html/parsoid
13492 <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>
13493 !! end
13495 !! test
13496 Image with multiple widths -- use last
13497 !! wikitext
13498 [[File:Foobar.jpg|200px|300px|caption]]
13499 !! html/php
13500 <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>
13501 </p>
13502 !! html/parsoid
13503 <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>
13504 !! end
13506 !! test
13507 Image with multiple alignments -- use first (bug 48664)
13508 !! options
13509 thumbsize=220
13510 !! wikitext
13511 [[File:Foobar.jpg|thumb|left|right|center|caption]]
13513 [[File:Foobar.jpg|middle|text-top|caption]]
13514 !! html/php
13515 <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>
13516 <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>
13517 </p>
13518 !! html/parsoid
13519 <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>
13520 <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>
13521 !! end
13523 !! test
13524 Image with width attribute at different positions
13525 !! wikitext
13526 [[File:Foobar.jpg|200px|right|Caption]]
13527 [[File:Foobar.jpg|right|200px|Caption]]
13528 [[File:Foobar.jpg|right|Caption|200px]]
13529 !! html/php
13530 <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>
13531 <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>
13532 <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>
13534 !! html/parsoid
13535 <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>
13536 <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>
13537 <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>
13538 !! end
13540 # a sad bit of backward-compatibility
13541 !! test
13542 Image with size specified with pxpx (bug 13500, 51628)
13543 !! options
13544 parsoid=wt2html,wt2wt,html2html
13545 !! wikitext
13546 [[File:Foobar.jpg|20pxpx]]
13547 [[File:Foobar.jpg|200x20pxpx]]
13548 !! html/php
13549 <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>
13550 <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>
13551 </p>
13552 !! html/parsoid
13553 <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>
13554 !! end
13556 !! test
13557 Image with link parameter, wiki target
13558 !! wikitext
13559 [[File:Foobar.jpg|link=Main Page]]
13560 !! html/php
13561 <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>
13562 </p>
13563 !! html/parsoid
13564 <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>
13565 !! end
13567 # parsoid bug 49293 (part 1)
13568 !! test
13569 Image with link parameter, URL target
13570 !! wikitext
13571 [[File:Foobar.jpg|link=http://example.com/]]
13572 !! html/php
13573 <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>
13574 </p>
13575 !! html/parsoid
13576 <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>
13577 !! end
13579 # parsoid bug 49293 (part 2)
13580 !! test
13581 Image with link parameter, protocol-less URL target
13582 !! wikitext
13583 [[File:Foobar.jpg|link=//example.com/]]
13584 !! html/php
13585 <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>
13586 </p>
13587 !! html/parsoid
13588 <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>
13589 !! end
13591 !! test
13592 Escaping non-block captions (T107435)
13593 !! options
13594 parsoid={
13595   "modes": ["wt2wt"],
13596   "changes": [
13597     ["[typeof~='mw:Image']", "attr", "data-mw", "{\"caption\": \"|\"}"]
13598   ]
13600 !! wikitext
13601 [[Image:Foobar.jpg|caption]]
13602 !! wikitext/edited
13603 [[Image:Foobar.jpg|<nowiki>|</nowiki>]]
13604 !! end
13606 # wgExternalLinkTarget not supported by Parsoid
13607 !! test
13608 Image with link parameter, wgExternalLinkTarget
13609 !! wikitext
13610 [[Image:foobar.jpg|link=http://example.com/]]
13611 !! config
13612 wgExternalLinkTarget='foobar'
13613 !! html/php
13614 <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>
13615 </p>
13616 !! end
13618 !! test
13619 Image with link parameter, wgNoFollowLinks set to false
13620 !! wikitext
13621 [[Image:foobar.jpg|link=http://example.com/]]
13622 !! config
13623 wgNoFollowLinks=false
13624 !! html
13625 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
13626 </p>
13627 !! end
13629 !! test
13630 Image with link parameter, wgNoFollowDomainExceptions
13631 !! wikitext
13632 [[Image:foobar.jpg|link=http://example.com/]]
13633 !! config
13634 wgNoFollowDomainExceptions='example.com'
13635 !! html
13636 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
13637 </p>
13638 !! end
13640 # wgExternalLinkTarget not supported by Parsoid
13641 !! test
13642 Image with link parameter, wgExternalLinkTarget, unnamed parameter
13643 !! wikitext
13644 [[Image:foobar.jpg|link=http://example.com/|Title]]
13645 !! config
13646 wgExternalLinkTarget='foobar'
13647 !! html/php
13648 <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>
13649 </p>
13650 !! end
13652 !! test
13653 Image with empty link parameter
13654 !! wikitext
13655 [[File:Foobar.jpg|link=]]
13656 !! html/php
13657 <p><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" />
13658 </p>
13659 !! html/parsoid
13660 <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>
13661 !! end
13663 !! test
13664 Image with link parameter (wiki target) and unnamed parameter
13665 !! wikitext
13666 [[File:Foobar.jpg|link=Main_Page|Title]]
13667 !! html/php
13668 <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>
13669 </p>
13670 !! html/parsoid
13671 <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>
13672 !! end
13674 !! test
13675 Image with link parameter (URL target) and unnamed parameter
13676 !! wikitext
13677 [[File:Foobar.jpg|link=http://example.com/|Title]]
13678 !! html/php
13679 <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>
13680 </p>
13681 !! html/parsoid
13682 <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>
13683 !! end
13685 !! test
13686 Thumbnail image with link parameter
13687 !! options
13688 thumbsize=220
13689 parsoid=wt2html,wt2wt,html2html
13690 !! wikitext
13691 [[File:Foobar.jpg|thumb|link=http://example.com/|Title]]
13692 !! html/php
13693 <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>
13695 !! html/parsoid
13696 <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>
13697 !! end
13699 !! test
13700 Manually-specified thumbnail image
13701 !! options
13702 thumbsize=220
13703 !! wikitext
13704 [[File:Foobar.jpg|thumb=Thumb.png|Title]]
13705 !! html/php
13706 <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>
13708 !! html/parsoid
13709 <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>
13710 !! end
13712 !! test
13713 Manually-specified thumbnail image with explicit link to wiki page
13714 !! options
13715 thumbsize=220
13716 parsoid=wt2html,wt2wt,html2html
13717 !! wikitext
13718 [[File:Foobar.jpg|thumb=Thumb.png|link=Main_Page|Title]]
13719 !! html/php
13720 <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>
13722 !! html/parsoid
13723 <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>
13724 !! end
13726 !! test
13727 Manually-specified thumbnail image with explicit link to url
13728 !! options
13729 thumbsize=220
13730 parsoid=wt2html,wt2wt,html2html
13731 !! wikitext
13732 [[File:Foobar.jpg|thumb=Thumb.png|link=http://example.com|Title]]
13733 !! html/php
13734 <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>
13736 !! html/parsoid
13737 <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>
13738 !! end
13740 !! test
13741 Manually-specified thumbnail image with explicit no link
13742 !! options
13743 thumbsize=220
13744 parsoid=wt2html,wt2wt,html2html
13745 !! wikitext
13746 [[File:Foobar.jpg|thumb=Thumb.png|link=|Title]]
13747 !! html/php
13748 <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>
13750 !! html/parsoid
13751 <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>
13752 !! end
13754 !! test
13755 Manually-specified thumbnail image with explicit link and alt text
13756 !! options
13757 thumbsize=220
13758 parsoid=wt2html,wt2wt,html2html
13759 !! wikitext
13760 [[File:Foobar.jpg|thumb=Thumb.png|link=Main_Page|alt=alttext|Title]]
13761 !! html/php
13762 <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>
13764 !! html/parsoid
13765 <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>
13766 !! end
13768 !! test
13769 Image with frame and link
13770 !! options
13771 parsoid=wt2html,wt2wt,html2html
13772 !! wikitext
13773 [[File:Foobar.jpg|frame|left|This is a test image [[Main Page]]]]
13774 !! html/php
13775 <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>
13777 !! html/parsoid
13778 <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>
13779 !! end
13781 !! test
13782 Image with frame and link and explicit alt
13783 !! options
13784 parsoid=wt2html,wt2wt,html2html
13785 !! wikitext
13786 [[Image:Foobar.jpg|frame|left|This is a test image [[Main Page]]|alt=Altitude]]
13787 !! html/php
13788 <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>
13790 !! html/parsoid
13791 <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>
13792 !! end
13794 !! test
13795 Image with wiki markup in implicit alt
13796 !! wikitext
13797 [[Image:Foobar.jpg|testing '''bold''' in alt]]
13799 [[Image:Foobar.jpg|alt=testing '''bold''' in alt]]
13800 !! html/php
13801 <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>
13802 </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>
13803 </p>
13804 !! html/parsoid
13805 <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>
13807 <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>
13808 !! end
13810 !! test
13811 Alt image option should handle most kinds of wikitext without barfing
13812 !! wikitext
13813 [[Image:Foobar.jpg|thumb|This is the image caption|alt=This is a [[link]] and a {{echo|''bold template''}}.]]
13814 !! html/php
13815 <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>
13817 !! html/parsoid
13818 <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>
13819 !! end
13821 ###################
13822 # Conflicting image format options.
13823 # First option specified should 'win'.
13824 # All three cases in each test should be identical.
13826 !! test
13827 Image with 'frameless' first.
13828 !! options
13829 parsoid=wt2html,wt2wt,html2html
13830 !! wikitext
13831 [[File:Foobar.jpg|frameless|caption]]
13833 [[File:Foobar.jpg|frameless|frame|caption]]
13835 [[File:Foobar.jpg|frameless|thumb|caption]]
13836 !! html/php
13837 <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>
13838 </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>
13839 </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>
13840 </p>
13841 !! html/parsoid
13842 <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>
13843 <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>
13844 <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>
13845 !! end
13847 !! test
13848 Image with 'frame' first.
13849 !! options
13850 parsoid=wt2html,wt2wt,html2html
13851 !! wikitext
13852 [[File:Foobar.jpg|frame|caption]]
13853 [[File:Foobar.jpg|frame|frameless|caption]]
13854 [[File:Foobar.jpg|frame|thumb|caption]]
13855 !! html/php
13856 <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>
13857 <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>
13858 <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>
13860 !! html/parsoid
13861 <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>
13862 <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>
13863 <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>
13864 !! end
13866 !! test
13867 Image with 'thumb' first.
13868 !! options
13869 parsoid=wt2html,wt2wt,html2html
13870 !! wikitext
13871 [[File:Foobar.jpg|thumb|caption]]
13872 [[File:Foobar.jpg|thumb|frameless|caption]]
13873 [[File:Foobar.jpg|thumb|frame|caption]]
13874 !! html/php
13875 <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>
13876 <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>
13877 <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>
13879 !! html/parsoid
13880 <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>
13881 <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>
13882 <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>
13883 !! end
13885 ###################
13886 # Image sizing.
13887 # See https://www.mediawiki.org/wiki/Help:Images#Size_and_frame
13888 # and https://phabricator.wikimedia.org/T64258
13889 # Foobar has actual size of 1941x220
13890 # 1. Thumbs & frameless always reduce, can't be enlarged unless it's
13891 #    a scalable format.
13892 # 2. Framed images always ignore size options; always render at default size.
13893 # 3. "Unspecified format" and border are the only types which can be
13894 #    enlarged.
13896 !! test
13897 Image: "unspecified format" and border enlarge
13898 !! options
13899 parsoid=wt2html,wt2wt,html2html
13900 !! wikitext
13901 [[File:Foobar.jpg|2000px]]
13903 [[File:Foobar.jpg|border|2000px]]
13904 !! html/php
13905 <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>
13906 </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>
13907 </p>
13908 !! html/parsoid
13909 <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>
13910 <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>
13911 !! end
13913 !! test
13914 Image: "unspecified format" and border reduce
13915 !! options
13916 parsoid=wt2html,wt2wt,html2html
13917 !! wikitext
13918 [[File:Foobar.jpg|1000px]]
13920 [[File:Foobar.jpg|border|1000px]]
13921 !! html/php
13922 <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>
13923 </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>
13924 </p>
13925 !! html/parsoid
13926 <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>
13927 <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>
13928 !! end
13930 !! test
13931 Image: thumbs reduce
13932 !! options
13933 parsoid=wt2html,wt2wt,html2html
13934 !! wikitext
13935 [[File:Foobar.jpg|thumb|50px]]
13936 !! html/php
13937 <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>
13939 !! html/parsoid
13940 <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>
13941 !! end
13943 !! test
13944 Image: bitmap thumbs can't be enlarged past original size, but vector can.
13945 !! options
13946 parsoid=wt2html,wt2wt,html2html
13947 !! wikitext
13948 [[File:Foobar.jpg|thumb|2000px]]
13950 [[File:Foobar.svg|thumb|2000px]]
13951 !! html/php
13952 <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>
13953 <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>
13955 !! html/parsoid
13956 <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>
13957 <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>
13958 !! end
13960 !! test
13961 Image: frameless can reduce in size
13962 !! options
13963 parsoid=wt2html,wt2wt,html2html
13964 !! wikitext
13965 [[File:Foobar.jpg|frameless|50px]]
13966 !! html/php
13967 <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>
13968 </p>
13969 !! html/parsoid
13970 <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>
13971 !! end
13973 !! test
13974 Image: bitmap frameless can't be enlarged past original size, but vector can
13975 !! options
13976 parsoid=wt2html,wt2wt,html2html
13977 !! wikitext
13978 [[File:Foobar.jpg|frameless|2000px]]
13980 [[File:Foobar.svg|frameless|2000px]]
13981 !! html/php
13982 <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>
13983 </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>
13984 </p>
13985 !! html/parsoid
13986 <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>
13987 <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>
13988 !! end
13990 !! test
13991 Image: framed images are always unscaled.
13992 !! options
13993 parsoid=wt2html,wt2wt,html2html
13994 !! wikitext
13995 [[File:Foobar.jpg|frame]]
13997 [[File:Foobar.jpg|frame|50px]]
13999 [[File:Foobar.jpg|frame|50x50px]]
14001 [[File:Foobar.jpg|frame|2000px]]
14002 !! html/php
14003 <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>
14004 <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>
14005 <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>
14006 <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>
14008 !! html/parsoid
14009 <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>
14010 <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>
14011 <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>
14012 <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>
14013 !! end
14015 ###################
14017 !! test
14018 Link to image page- image page normally doesn't exists, hence edit link
14019 Add test with existing image page
14020 #<p><a href="/wiki/File:Test" title="Image:Test">Image:test</a>
14021 !! wikitext
14022 [[:Image:test]]
14023 !! html
14024 <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>
14025 </p>
14026 !! end
14028 !! test
14029 bug 18784  Link to non-existent image page with caption should use caption as link text
14030 !! wikitext
14031 [[:Image:test|caption]]
14032 !! html
14033 <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>
14034 </p>
14035 !! end
14037 !! test
14038 Frameless image caption with a free URL
14039 !! wikitext
14040 [[File:Foobar.jpg|http://example.com]]
14041 !! html/php
14042 <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>
14043 </p>
14044 !! html/parsoid
14045 <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>
14046 !! end
14048 !! test
14049 Thumbnail image caption with a free URL
14050 !! options
14051 thumbsize=220
14052 !! wikitext
14053 [[File:Foobar.jpg|thumb|http://example.com]]
14054 !! html/php
14055 <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>
14057 !! html/parsoid
14058 <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>
14059 !! end
14061 !! test
14062 Thumbnail image caption with a free URL and explicit alt
14063 !! options
14064 thumbsize=220
14065 parsoid=wt2html,wt2wt,html2html
14066 !! wikitext
14067 [[File:Foobar.jpg|thumb|http://example.com|alt=Alteration]]
14068 !! html/php
14069 <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>
14071 !! html/parsoid
14072 <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>
14073 !! end
14075 !! test
14076 SVG thumbnails with no language set
14077 !! options
14078 !! wikitext
14079 [[File:Foobar.svg|thumb|caption]]
14080 !! html/php
14081 <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>
14083 !! html/parsoid
14084 <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>
14085 !! end
14087 !! test
14088 SVG thumbnails with language de
14089 !! options
14090 parsoid=wt2html,wt2wt,html2html
14091 !! wikitext
14092 [[File:Foobar.svg|thumb|caption|lang=de]]
14093 !! html/php
14094 <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>
14096 !! html/parsoid
14097 <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>
14098 !! end
14100 !! test
14101 SVG thumbnails with invalid language code
14102 !! options
14103 parsoid=wt2html,wt2wt,html2html
14104 !! wikitext
14105 [[File:Foobar.svg|thumb|caption|lang=invalid.language.code]]
14106 !! html/php
14107 <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>
14109 !! html/parsoid
14110 <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>
14111 !! end
14113 !! test
14114 BUG 1887: A ISBN with a thumbnail
14115 !! wikitext
14116 [[File:Foobar.jpg|thumb|ISBN 1235467890]]
14117 !! html/php
14118 <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>
14120 !! html/parsoid
14121 <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>
14122 !! end
14124 !! test
14125 BUG 1887: A RFC with a thumbnail
14126 !! wikitext
14127 [[File:Foobar.jpg|thumb|This is RFC 12354]]
14128 !! html/php
14129 <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>
14131 !! html/parsoid
14132 <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>
14133 !! end
14135 !! test
14136 BUG 1887: A mailto link with a thumbnail
14137 !! wikitext
14138 [[File:Foobar.jpg|thumb|Please mailto:nobody@example.com]]
14139 !! html/php
14140 <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>
14142 !! html/parsoid
14143 <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>
14144 !! end
14146 # Pending resolution to bug 368
14147 !! test
14148 BUG 648: Frameless image caption with a link
14149 !! wikitext
14150 [[File:Foobar.jpg|text with a [[link]] in it]]
14151 !! html/php
14152 <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>
14153 </p>
14154 !! html/parsoid
14155 <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>
14156 !! end
14158 !! test
14159 BUG 648: Frameless image caption with a link (suffix)
14160 !! wikitext
14161 [[File:Foobar.jpg|text with a [[link]]foo in it]]
14162 !! html/php
14163 <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>
14164 </p>
14165 !! html/parsoid
14166 <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>
14167 !! end
14169 !! test
14170 BUG 648: Frameless image caption with an interwiki link
14171 !! wikitext
14172 [[File:Foobar.jpg|text with a [[MeatBall:Link]] in it]]
14173 !! html/php
14174 <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>
14175 </p>
14176 !! html/parsoid
14177 <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>
14178 !! end
14180 !! test
14181 BUG 648: Frameless image caption with a piped interwiki link
14182 !! wikitext
14183 [[File:Foobar.jpg|text with a [[MeatBall:Link|link]] in it]]
14184 !! html/php
14185 <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>
14186 </p>
14187 !! html/parsoid
14188 <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>
14189 !! end
14191 !! test
14192 T107474: Frameless image caption with <nowiki>
14193 !! wikitext
14194 [[File:Foobar.jpg|<nowiki>text with a [[MeatBall:Link|link]] in it</nowiki>]]
14195 !! html/parsoid
14196 <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>
14197 !! end
14199 !! test
14200 Escape HTML special chars in image alt text
14201 !! wikitext
14202 [[File:Foobar.jpg|& < > "]]
14203 !! html/php
14204 <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>
14205 </p>
14206 !! html/parsoid
14207 <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>
14208 !! end
14210 !! test
14211 Escape HTML special chars in image alt text with LanguageConverter
14212 !! options
14213 language=zh
14214 !! wikitext
14215 [[File:Foobar.jpg|& < > "]]
14216 !! html/php
14217 <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>
14218 </p>
14219 !! html/parsoid
14220 <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>
14221 !! end
14223 !! test
14224 Entities in file name and attributes
14225 !! wikitext
14226 [[File:7%25 solution.gif|manualthumb=7%25 solution.gif|link=7%25 solution|[[7%25 solution]]]]
14227 !! html/php
14228 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=7%25_solution.gif" class="new" title="File:7% solution.gif">7% solution</a>
14229 </p>
14230 !! html/parsoid
14231 <p><span class="mw-default-size" typeof="mw:Error mw:Image" data-parsoid='{"optList":[{"ck":"bogus","ak":"manualthumb=7%25 solution.gif"},{"ck":"link","ak":"link=7%25 solution"},{"ck":"caption","ak":"[[7%25 solution]]"}]}' data-mw='{"errors":[{"key":"missing-image","message":"This image does not exist."}],"caption":"&lt;a rel=\"mw:WikiLink\" href=\"./7%25_solution\" title=\"7% solution\" data-parsoid=&#39;{\"stx\":\"simple\",\"a\":{\"href\":\"./7%25_solution\"},\"sa\":{\"href\":\"7%25 solution\"},\"dsr\":[74,91,2,2]}&#39;>7% solution&lt;/a>"}'><a href="./7%25_solution" data-parsoid='{"a":{"href":"./7%25_solution"},"sa":{"href":"link=7%25 solution"}}'><img resource="./File:7%25_solution.gif" src="./Special:FilePath/7%25_solution.gif" height="220" width="220" data-parsoid='{"a":{"resource":"./File:7%25_solution.gif","height":"220","width":"220"},"sa":{"resource":"File:7%25 solution.gif"}}'/></a></span></p>
14232 !! end
14234 !! test
14235 BUG 499: Alt text should have &#1234;, not &amp;1234;
14236 !! wikitext
14237 [[File:Foobar.jpg|&#9792;]]
14238 !! html/php
14239 <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>
14240 </p>
14241 !! html/parsoid
14242 <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>
14243 !! end
14245 !! test
14246 Broken image caption with link
14247 !! options
14248 parsoid=wt2html,wt2wt,html2html
14249 !! wikitext
14250 [[Image:Foobar.jpg|thumb|This is a broken caption. But [[Main Page|this]] is just an ordinary link.
14251 !! html/php
14252 <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.
14253 </p>
14254 !! html/parsoid
14255 <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>
14256 !! end
14258 !! test
14259 Image caption containing another image
14260 !! wikitext
14261 [[File:Foobar.jpg|thumb|This is a caption with another [[File:Thumb.png|image]] inside it!]]
14262 !! html/php
14263 <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>
14265 !! html/parsoid
14266 <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>
14267 !! end
14269 !! test
14270 Image: caption containing a newline
14271 !! wikitext
14272 [[File:Foobar.jpg|This
14273 *is some text]]
14274 !! html/php
14275 <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>
14276 </p>
14277 !! html/parsoid
14278 <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>
14279 !!end
14281 !!test
14282 Image: caption containing leading space
14283 (The leading space should not trigger nowiki escaping in wt2wt mode)
14284 !! wikitext
14285 [[File:Foobar.jpg|thumb| bar]]
14286 !! html/php
14287 <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>
14289 !! html/parsoid
14290 <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>
14291 !!end
14293 !! test
14294 Image: caption containing a table
14295 !! options
14296 parsoid=wt2html,wt2wt,html2html
14297 !! wikitext
14298 [[Image:Foobar.jpg|thumb|200px|This is an example image thumbnail caption with a table
14300 ! Foo !! Bar
14302 | Foo1 || Bar1
14304 and some more text.]]
14305 !! html/php
14306 <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>
14308 !! html/parsoid
14309 <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
14310 <table>
14311 <tbody>
14312 <tr><th>Foo </th><th>Bar</th></tr>
14313 <tr>
14314 <td>Foo1 </td>
14315 <td>Bar1</td></tr></tbody></table>and some more text.</figcaption></figure>
14316 !! end
14318 !! test
14319 Bug 3090: External links other than http: in image captions
14320 !! wikitext
14321 [[File:Foobar.jpg|thumb|200x200px|This caption has [irc://example.net irc] and [https://example.com Secure] ext links in it.]]
14322 !! html/php
14323 <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>
14325 !! html/parsoid
14326 <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>
14327 !! end
14329 !! test
14330 Custom class
14331 !! options
14332 parsoid=wt2html,wt2wt,html2html
14333 !! wikitext
14334 [[Image:foobar.jpg|a|class=b]]
14335 !! html/php
14336 <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>
14337 </p>
14338 !! html/parsoid
14339 <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>
14340 !! end
14342 !! test
14343 Localized image handling (1).
14344 !! options
14345 parsoid=wt2html,wt2wt,html2html
14346 language=es
14347 !! wikitext
14348 [[Archivo:Foobar.jpg|izquierda|enlace=foo|caption]]
14349 !! html/php
14350 <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>
14352 !! html/parsoid
14353 <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>
14354 !! end
14356 !! test
14357 Localized image handling (2).
14358 !! options
14359 thumbsize=220
14360 parsoid=wt2html,wt2wt,html2html
14361 language=es
14362 !! wikitext
14363 [[Archivo:Foobar.jpg|miniatura|izquierda|enlace=foo|caption]]
14364 !! html/php
14365 <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>
14367 !! html/parsoid
14368 <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>
14369 !! end
14371 !! test
14372 Localized image handling (3).
14373 !! options
14374 language=fa
14375 parsoid=html2wt
14376 !! html/parsoid
14377 <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>
14378 !! wikitext
14379 [[File:Foobar.jpg|بندانگشتی]]
14380 !! end
14382 !! test
14383 "border", "frameless" and "class" attributes on an image.
14384 !! options
14385 thumbsize=220
14386 parsoid=wt2html,wt2wt,html2html
14387 !! wikitext
14388 [[File:Foobar.jpg|frameless|border|class=extra|caption]]
14389 !! html/php
14390 <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>
14391 </p>
14392 !! html/parsoid
14393 <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>
14394 !! end
14396 # Note that 'right' is the default alignment, despite the misspelled 'righ' below
14397 !! test
14398 Invalid image attributes (bug 62500)
14399 !! options
14400 thumbsize=220
14401 parsoid=wt2html,wt2wt,html2html
14402 !! wikitext
14403 [[File:Foobar.jpg|thumb|float|left|caption]]
14405 [[File:Foobar.jpg|thumb|righ|caption]]
14407 [[File:Foobar.jpg|bogus1|thumb|bogus2|left|bogus3|caption]]
14408 !! html/php
14409 <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>
14410 <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>
14411 <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>
14413 !! html/parsoid
14414 <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>
14415 <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>
14416 <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>
14417 !! end
14419 !! article
14420 File:Barfoo.jpg
14421 !! text
14422 #REDIRECT [[File:Barfoo.jpg]]
14423 !! endarticle
14425 # FIXME: Parsoid should run this test -- but we'd need to teach the
14426 # mockAPI about the redirected Barfoo.jpg image.
14427 !! test
14428 Redirected image
14429 !! wikitext
14430 [[Image:Barfoo.jpg]]
14431 !! html/php
14432 <p><a href="/wiki/File:Barfoo.jpg" class="mw-redirect" title="File:Barfoo.jpg">File:Barfoo.jpg</a>
14433 </p>
14434 !! end
14436 !! test
14437 Missing image with uploads disabled
14438 !! options
14439 wgEnableUploads=0
14440 !! wikitext
14441 [[File:Foobaz.jpg]]
14442 !! html/php
14443 <p><a href="/wiki/File:Foobaz.jpg" title="File:Foobaz.jpg">File:Foobaz.jpg</a>
14444 </p>
14445 !! html/parsoid
14446 <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>
14447 !! end
14449 # Parsoid-specific testing for images
14450 # https://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec#Images
14451 # Currently imperfect due to a flaw in the Parsoid testrunner
14452 # Work in progress
14453 # THESE TESTS SHOULD BE MOVED UP and merged with the php-specific
14454 # image tests.
14456 !! test
14457 Parsoid-specific image handling - simple image with size and middle alignment
14458 !! wikitext
14459 [[File:Foobar.jpg|middle|50px]]
14460 !! html/parsoid
14461 <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>
14462 !! end
14464 !! test
14465 Parsoid-specific image handling - simple image with size, middle alignment,
14466 non-standard namespace alias
14467 !! options
14468 parsoid=wt2wt,wt2html,html2html
14469 !! wikitext
14470 [[Image:Foobar.jpg|middle|50px]]
14471 !! html/parsoid
14472 <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>
14473 !! end
14475 !! test
14476 Parsoid-specific image handling - simple image with size and middle alignment
14477 (existing content)
14478 !! wikitext
14479 [[File:Foobar.jpg|50px|middle]]
14480 !! html/parsoid
14481 <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>
14482 !! end
14484 !! test
14485 Parsoid-specific image handling - simple image with size and middle alignment
14486 and non-standard namespace name
14487 !! options
14488 parsoid=wt2html,wt2wt,html2html
14489 !! wikitext
14490 [[Image:Foobar.jpg|50px|middle]]
14491 !! html/parsoid
14492 <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>
14493 !! end
14495 !! test
14496 Parsoid-specific image handling - simple image with both sizes, a baseline alignment, and a caption
14497 !! wikitext
14498 [[File:Foobar.jpg|500x10px|baseline|caption]]
14499 !! html/parsoid
14500 <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>
14501 !! end
14503 !! test
14504 Parsoid-specific image handling - simple image with border and size spec
14505 !! wikitext
14506 [[File:Foobar.jpg|50px|border|caption]]
14507 !! html/parsoid
14508 <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>
14509 !! end
14511 !! test
14512 Parsoid-specific image handling - thumbnail with halign, valign, and caption
14513 !! wikitext
14514 [[File:Foobar.jpg|left|baseline|thumb|caption content]]
14515 !! html/parsoid
14516 <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>
14517 !! end
14519 !! test
14520 Parsoid-specific image handling - thumbnail with halign, valign, and caption
14521 (existing content)
14522 !! wikitext
14523 [[File:Foobar.jpg|thumb|left|baseline|caption content]]
14524 !! html/parsoid
14525 <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>
14526 !! end
14528 !! test
14529 Parsoid-specific image handling - thumbnail with specific size, halign, valign, and caption
14530 !! wikitext
14531 [[Image:Foobar.jpg|right|middle|thumb|50x50px|caption]]
14532 !! html/parsoid
14533 <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>
14534 !! end
14536 !! test
14537 Parsoid-specific image handling - thumbnail with specific size, halign,
14538 valign, and caption (existing content)
14539 !! wikitext
14540 [[File:Foobar.jpg|thumb|50x50px|right|middle|caption]]
14541 !! html/parsoid
14542 <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>
14543 !! end
14545 !! test
14546 Parsoid-specific image handling - framed image with specific size and caption
14547 (size is ignored)
14548 !! options
14549 parsoid=wt2html,wt2wt,html2html
14550 !! wikitext
14551 [[File:Foobar.jpg|frame|500x50px|caption]]
14552 !! html/parsoid
14553 <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>
14554 !! end
14556 !! test
14557 Parsoid-specific image handling - framed image with specific size, halign, valign, and caption
14558 (size is ignored)
14559 !! options
14560 parsoid=wt2html,wt2wt,html2html
14561 !! wikitext
14562 [[File:Foobar.jpg|left|baseline|frame|500x50px|caption]]
14563 !! html/parsoid
14564 <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>
14565 !! end
14567 !! test
14568 Parsoid-specific image handling - frameless image with specific size, border, and caption
14569 !! wikitext
14570 [[File:Foobar.jpg|frameless|442x50px|border|caption]]
14571 !! html/parsoid
14572 <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>
14573 !! end
14575 !! test
14576 Parsoid-specific image handling - simple image with a formatted caption
14577 !! wikitext
14578 [[File:Foobar.jpg|<table><tr><td>a</td><td>b</td></tr><tr><td>c</td></tr></table>]]
14579 !! html/parsoid
14580 <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>
14581 !! end
14583 !! test
14584 Parsoid-specific image handling - caption with a template in it
14585 !! wikitext
14586 [[File:Foobar.jpg|thumb|200x23px|This caption has a {{echo|transclusion}} in it.]]
14587 !! html/parsoid
14588 <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>
14589 !! end
14591 !! test
14592 Parsoid-specific image handling - caption with unbalanced tags in it
14593 !! options
14594 parsoid=wt2html,wt2wt,html2html
14595 !! wikitext
14597 [[File:Foobar.jpg|thumb|200x200px|This caption has a <center>unbalanced tag in it.]]
14599 !! html/parsoid
14600 <p>foo</p>
14601 <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>
14602 <p>bar</p>
14603 !! end
14605 !! test
14606 Parsoid-specific image handling - empty caption (1)
14607 !! options
14608 parsoid=wt2html,wt2wt
14609 !! wikitext
14610 [[File:Foobar.jpg|thumb|]]
14611 !! html/parsoid
14612 <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>
14613 !! end
14615 # empty captions don't get serialized unless we're in the "round trip" case
14616 !! test
14617 Parsoid-specific image handling - empty caption (2)
14618 !! options
14619 parsoid=html2wt
14620 !! html/parsoid
14621 <figure class="mw-default-size" typeof="mw:Image/Thumb">
14622   <a href="./File:Foobar.jpg">
14623     <img resource="./File:Foobar.jpg"
14624          src="//example.com/images/3/3a/Foobar.jpg"
14625          data-file-width="1941" data-file-height="220" data-file-type="bitmap"
14626          height="25" width="220"/>
14627   </a>
14628   <figcaption></figcaption>
14629 </figure>
14630 !! wikitext
14631 [[File:Foobar.jpg|thumb]]
14632 !! end
14634 !! test
14635 Parsoid-specific image handling - whitespace caption
14636 !! wikitext
14637 [[File:Foobar.jpg|thumb| ]]
14638 !! html/parsoid
14639 <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>
14640 !! end
14642 !! test
14643 Parsoid-specific image handling - lang option
14644 !! wikitext
14646 [[File:Foobar.svg|lang=de|caption]]
14648 !! html/parsoid
14649 <p>foo
14650 <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>
14651 bar</p>
14652 !! end
14654 ## Edge case bugs in Parsoid from T93580
14655 !! test
14656 T93580: 1. Templated <ref> inside block images
14657 !! wikitext
14658 [[File:Foobar.jpg|thumb|Caption with templated ref: {{echo|<ref>foo</ref>}}]]
14660 <references />
14661 !! html/parsoid
14662 <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="./Main_Page#cite_note-1" style="counter-reset: mw-Ref 1;"><span class="mw-reflink-text">[1]</span></a></span></figcaption></figure>
14664 <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="./Main_Page#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>
14665 !! end
14667 !! test
14668 T93580: 2. <ref> inside inline images
14669 !! wikitext
14670 [[File:Foobar.jpg|Undisplayed caption in inline image with ref: <ref>foo</ref>]]
14672 <references />
14673 !! html/parsoid
14674 <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=\"./Main_Page#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>
14676 <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="./Main_Page#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>
14677 !! end
14679 !! test
14680 T93580: 3. Templated <ref> inside inline images
14681 !! wikitext
14682 [[File:Foobar.jpg|Undisplayed caption in inline image with ref: {{echo|<ref>{{echo|foo}}</ref>}}]]
14684 <references />
14685 !! html/parsoid
14686 <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=\"./Main_Page#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>
14688 <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="./Main_Page#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>
14689 !! end
14692 ### Subpages
14694 !! article
14695 Subpage test/subpage
14696 !! text
14698 !! endarticle
14700 !! test
14701 Subpage link
14702 !! options
14703 subpage title=[[Subpage test]]
14704 !! wikitext
14705 [[/subpage]]
14706 !! html
14707 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a>
14708 </p>
14709 !! end
14711 !! test
14712 Subpage noslash link
14713 !! options
14714 subpage title=[[Subpage test]]
14715 !! wikitext
14716 [[/subpage/]]
14717 !! html
14718 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">subpage</a>
14719 </p>
14720 !! end
14722 !! article
14723 Subpage test/1/2/subpage
14724 !! text
14725 blah
14726 !! endarticle
14728 !! test
14729 Relative subpage noslash link
14730 !! options
14731 parsoid=wt2wt,wt2html,html2html
14732 subpage title=[[Subpage test/1/2/3/4]]
14733 !! wikitext
14734 [[../../subpage/]]
14736 [[../../subpage]]
14737 !! html/php
14738 <p><a href="/wiki/Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">subpage</a>
14739 </p><p><a href="/wiki/Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">Subpage test/1/2/subpage</a>
14740 </p>
14741 !! html/parsoid
14742 <p><a rel="mw:WikiLink" href="Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">subpage</a></p>
14743 <p><a rel="mw:WikiLink" href="Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">Subpage_test/1/2/subpage</a></p>
14744 !! end
14746 !! test
14747 Parsoid: dot-slash prefixed wikilinks
14748 !! wikitext
14749 [[./foo]]
14751 [[././bar]]
14753 [[././baz/]]
14754 !! html/php
14755 <p>[[./foo]]
14756 </p><p>[[././bar]]
14757 </p><p>[[././baz/]]
14758 </p>
14759 !! html/parsoid
14760 <p>[[./foo]]
14761 </p><p>[[././bar]]
14762 </p><p>[[././baz/]]
14763 </p>
14764 !! end
14766 !! test
14767 Render invalid page names as plain text (bug 51090)
14768 !! wikitext
14769 [[./../foo|bar]]
14770 [[foo�|bar]]
14771 [[foo/.|bar]]
14772 [[foo/..|bar]]
14773 [[foo~~~bar]]
14774 [[foo>bar]]
14775 [[foo[bar]]
14776 [[.]]
14777 [[..]]
14778 [[foo././bar]]
14780 [[{{echo|./../foo}}|bar]]
14781 [[{{echo|foo/.}}|bar]]
14782 [[{{echo|foo/..}}|bar]]
14783 [[{{echo|foo~~~~bar}}]]
14784 [[{{echo|foo>bar}}]]
14785 [[{{echo|foo././bar}}]]
14786 [[{{echo|foo{bar}}]]
14787 [[{{echo|foo}bar}}]]
14788 [[{{echo|foo[bar}}]]
14789 [[{{echo|foo]bar}}]]
14790 [[{{echo|foo<bar}}]]
14791 !!html/php
14792 <p>[[./../foo|bar]]
14793 [[foo�|bar]]
14794 [[foo/.|bar]]
14795 [[foo/..|bar]]
14796 [[foo~~~bar]]
14797 [[foo&gt;bar]]
14798 [[foo[bar]]
14799 [[.]]
14800 [[..]]
14801 [[foo././bar]]
14802 </p><p>[[./../foo|bar]]
14803 [[foo/.|bar]]
14804 [[foo/..|bar]]
14805 [[foo~~~~bar]]
14806 [[foo&gt;bar]]
14807 [[foo././bar]]
14808 [[foo{bar]]
14809 [[foo}bar]]
14810 [[foo[bar]]
14811 [[foo]bar]]
14812 [[foo&lt;bar]]
14813 </p>
14814 !!html/parsoid
14815 <p>[[./../foo|bar]]
14816 [[foo�|bar]]
14817 [[foo/.|bar]]
14818 [[foo/..|bar]]
14819 [[foo~~~bar]]
14820 [[foo>bar]]
14821 [[foo[bar]]
14822 [[.]]
14823 [[..]]
14824 [[foo././bar]]</p>
14826 <p>[[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"./../foo"}},"i":0}}]}'>./../foo</span>|bar]]
14827 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo/."}},"i":0}}]}'>foo/.</span>|bar]]
14828 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo/.."}},"i":0}}]}'>foo/..</span>|bar]]
14829 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo~~~~bar"}},"i":0}}]}'>foo~~~~bar</span>]]
14830 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo>bar"}},"i":0}}]}'>foo>bar</span>]]
14831 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo././bar"}},"i":0}}]}'>foo././bar</span>]]
14832 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo{bar"}},"i":0}}]}'>foo{bar</span>]]
14833 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo}bar"}},"i":0}}]}'>foo}bar</span>]]
14834 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo[bar"}},"i":0}}]}'>foo[bar</span>]]
14835 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo]bar"}},"i":0}}]}'>foo]bar</span>]]
14836 [[<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>
14837 !!end
14839 !! test
14840 Disabled subpages
14841 !! wikitext
14842 [[/subpage]]
14843 !! html
14844 <p><a href="/index.php?title=/subpage&amp;action=edit&amp;redlink=1" class="new" title="/subpage (page does not exist)">/subpage</a>
14845 </p>
14846 !! end
14848 !! test
14849 BUG 561: {{/Subpage}}
14850 !! options
14851 subpage title=[[Page]]
14852 !! wikitext
14853 {{/Subpage}}
14854 !! html
14855 <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>
14856 </p>
14857 !! end
14860 ### Categories
14862 !! article
14863 Category:MediaWiki User's Guide
14864 !! text
14865 blah
14866 !! endarticle
14868 !! test
14869 Link to category
14870 !! wikitext
14871 [[:Category:MediaWiki User's Guide]]
14872 !! html
14873 <p><a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">Category:MediaWiki User's Guide</a>
14874 </p>
14875 !! end
14877 !! test
14878 Simple category
14879 !! options
14881 !! wikitext
14882 [[Category:MediaWiki User's Guide]]
14883 !! html/php
14884 cat=MediaWiki_User's_Guide sort=
14885 !! html/parsoid
14886 <link rel="mw:PageProp/Category" href="./Category:MediaWiki_User's_Guide" data-parsoid='{"stx":"simple","a":{"href":"./Category:MediaWiki_User&#39;s_Guide"},"sa":{"href":"Category:MediaWiki User&#39;s Guide"}}'/>
14887 !! end
14889 !! test
14890 PAGESINCATEGORY invalid title fatal (r33546 fix)
14891 !! wikitext
14892 {{PAGESINCATEGORY:<bogus>}}
14893 !! html
14894 <p>0
14895 </p>
14896 !! end
14898 !! test
14899 Category with different sort key
14900 !! options
14902 !! wikitext
14903 [[Category:MediaWiki User's Guide|Foo]]
14904 !! html/php
14905 cat=MediaWiki_User's_Guide sort=Foo
14906 !! html/parsoid
14907 <link rel="mw:PageProp/Category" href="./Category:MediaWiki_User's_Guide#Foo" data-parsoid='{"stx":"piped","a":{"href":"./Category:MediaWiki_User&#39;s_Guide"},"sa":{"href":"Category:MediaWiki User&#39;s Guide"}}'/>
14908 !! end
14910 !! test
14911 Category with identical sort key
14912 !! options
14914 !! wikitext
14915 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
14916 !! html/php
14917 cat=MediaWiki_User's_Guide sort=MediaWiki User's Guide
14918 !! html/parsoid
14919 <link rel="mw:PageProp/Category" href="./Category:MediaWiki_User's_Guide#MediaWiki%20User's%20Guide" data-parsoid='{"stx":"piped","a":{"href":"./Category:MediaWiki_User&#39;s_Guide"},"sa":{"href":"Category:MediaWiki User&#39;s Guide"}}'/>
14920 !! end
14922 !! test
14923 Category with empty sort key
14924 !! options
14927 !! wikitext
14928 [[Category:MediaWiki User's Guide|]]
14929 !! html/php
14930 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
14931 !! end
14933 !! test
14934 Category with empty sort key and parentheses
14935 !! options
14938 !! wikitext
14939 [[Category:Foo (bar)|]]
14940 !! html/php
14941 [[Category:Foo (bar)|Foo]]
14942 !! end
14944 !! test
14945 Category with link tail
14946 !! options
14949 !! wikitext
14950 123[[Category:Foo]]456
14951 !! html/php
14952 123[[Category:Foo]]456
14953 !! end
14955 !! test
14956 Category with template
14957 !! options
14960 !! wikitext
14961 [[Category:{{echo|Foo}}]]
14962 !! html/php
14963 [[Category:{{echo|Foo}}]]
14964 !! end
14966 !! test
14967 Category with template in sort key
14968 !! options
14971 !! wikitext
14972 [[Category:Foo|{{echo|Bar}}]]
14973 !! html/php
14974 [[Category:Foo|{{echo|Bar}}]]
14975 !! end
14977 !! test
14978 Category with template in sort key and title
14979 !! options
14982 !! wikitext
14983 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
14984 !! html/php
14985 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
14986 !! end
14988 ## We used to, but no longer wt2wt this test since the default serializer
14989 ## will normalize all categories to serialize on their own line.
14990 ## This wikitext usage is going to be fairly uncommon in production and
14991 ## selser will take care of preserving formatting in those scenarios.
14992 !! test
14993 Category / paragraph interactions
14994 !! options
14995 parsoid=wt2html
14996 !! wikitext
14997 Foo [[Category:Baz]] Bar
14999 Foo [[Category:Baz]]
15003 [[Category:Baz]]
15007 [[Category:Baz]] Bar
15010 [[Category:Baz]]
15011  [[Category:Baz]]
15012 [[Category:Baz]]
15015 [[Category:Baz]]
15016  [[Category:Baz]]
15017 [[Category:Baz]]
15019 [[Category:Baz]]
15020  {{echo|[[Category:Baz]]}}
15021 [[Category:Baz]]
15022 !! html/php
15023 <p>Foo Bar
15024 </p><p>Foo
15026 </p><p>Foo
15028 </p><p>Foo Bar
15029 </p><p>Foo
15031 </p>
15032 !! html/parsoid
15033 <p>Foo <link rel="mw:PageProp/Category" href="Category:Baz"/> Bar</p>
15034 <p>Foo <link rel="mw:PageProp/Category" href="Category:Baz"/> Bar</p>
15035 <p>Foo <link rel="mw:PageProp/Category" href="Category:Baz"/> Bar</p>
15036 <p>Foo <link rel="mw:PageProp/Category" href="Category:Baz"/> Bar</p>
15037 <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>
15038 <link rel="mw:PageProp/Category" href="Category:Baz"/>
15039 !! end
15041 ## We used to, but no longer wt2wt this test since the default serializer
15042 ## will normalize all categories to serialize on their own line.
15043 ## This wikitext usage is going to be fairly uncommon in production and
15044 ## selser will take care of preserving formatting in those scenarios.
15046 ## The whitespace on the empty line is part of the test. Please do not delete
15047 !! test
15048 1. Categories and newlines: All preceding newlines should be suppressed (courtesy bug 87)
15049 !! options
15050 parsoid=wt2html
15051 !! wikitext
15052 This
15053    
15054 [[Category:Foo]] and this should be part of same paragraph (not an indent-pre)
15055    
15056 {{echo|[[Category:Foo]] and so should this!}}
15057 !! html/php
15058 <p>This and this should be part of same paragraph (not an indent-pre) and so should this!
15059 </p>
15060 !! html/parsoid
15061 <p>This
15062    
15063 <link rel="mw:PageProp/Category" href="./Category:Foo"/> and this should be part of same paragraph (not an indent-pre)
15064    
15065 <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>
15066 !! end
15068 ## Parsoid will not try to wt2wt this while preserving newlines because
15069 ## it suppresses excess newlines within list items -- and we don't want to
15070 ## introduce a special case just for categories, which is, in reality somewhat
15071 ## odd behavior -- categories are unlikely to be used in list items like this
15072 ## in top-level pages and are only likely to show up in template-generated
15073 ## list items where this RT-ing is a non-issue.
15075 ## The whitespace on the empty line is part of the test. Please do not delete
15076 !! test
15077 2. Categories and newlines: All preceding newlines should be suppressed (courtesy bug 87)
15078 !! options
15079 parsoid=wt2html
15080 !! wikitext
15081 * This
15082    
15083 [[Category:Foo]] and this should be part of the same list item
15084 * So should this
15086 {{echo|[[Category:Foo]] and this should be part of the same list item}}
15087 !! html
15088 <ul><li>This and this should be part of the same list item</li>
15089 <li>So should this and this should be part of the same list item</li></ul>
15090 !! html/parsoid
15091 <ul>
15092 <li>This <link rel="mw:PageProp/Category" href="./Category:Foo"/> and this should be part of the same list item</li>
15093 <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>
15094 </ul>
15095 !! end
15097 ## Newlines and categories that follow the last item of a list
15098 ## are treated differently because this (list followed by categories)
15099 ## is an extremely common pattern on wikis.
15100 !! test
15101 3. Categories and newlines: newline suppression for last list item should RT properly
15102 !! wikitext
15103 * a
15104 * b 
15105    
15106 [[Category:Foo]]
15107    
15108 [[Category:Bar]]
15109 [[Category:Baz]]
15110 !! html/parsoid
15111 <ul><li> a</li>
15112 <li> b</li></ul> 
15113    
15114 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/>
15115    
15116 <link rel="mw:PageProp/Category" href="./Category:Bar" data-parsoid='{"stx":"simple","a":{"href":"./Category:Bar"},"sa":{"href":"Category:Bar"}}'/>
15117 <link rel="mw:PageProp/Category" href="./Category:Baz" data-parsoid='{"stx":"simple","a":{"href":"./Category:Baz"},"sa":{"href":"Category:Baz"}}'/>
15118 !! end
15120 !! test
15121 4. Categories and newlines: newline suppression for last list item should RT properly
15122 !! wikitext
15123 * a
15124 **** b
15126 [[Category:Foo]]
15127 !! html/parsoid
15128 <ul><li> a
15129 <ul><li><ul><li><ul><li> b</li></ul></li></ul></li></ul></li></ul>
15131 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/>
15132 !! end
15134 ## only wt2html for this to make sure the algo only applies to the rightmost path
15135 !! test
15136 5. Categories and newlines: migrateTrailingCategories dom pass should only run on the rightmost path of nested lists
15137 !! options
15138 parsoid=wt2html
15139 !! wikitext
15140 * a
15141 ** b
15142 [[Category:Foo]]
15143 * c
15144 ** d
15145 [[Category:Foo]]
15146 !! html/parsoid
15147 <ul><li> a
15148 <ul><li> b
15149 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/></li></ul></li>
15150 <li> c
15151 <ul><li> d</li></ul></li></ul>
15152 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/>
15153 !! end
15155 ## We used to, but no longer wt2wt this test since the default serializer
15156 ## will normalize all categories to serialize on their own line.
15157 ## This wikitext usage is going to be fairly uncommon in production and
15158 ## selser will take care of preserving formatting in those scenarios.
15159 !! test
15160 6. Categories and newlines: migrateTrailingCategories dom pass should not migrate categories not preceded by newlines
15161 !! options
15162 parsoid=wt2html
15163 !! wikitext
15164 * a [[Category:Foo]]
15165 !! html/parsoid
15166 <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>
15167 !! end
15169 # This test also demonstrates because of newline+category tunneling
15170 # through the list hander, template wrapping doesn't expand to the
15171 # containing list when the list item swallows the category.
15172 !! test
15173 7. Categories and newlines: migrateTrailingCategories dom pass should leave template content alone
15174 !! wikitext
15175 * {{echo|a
15176 [[Category:Foo]]}}
15177 !! html/parsoid
15178 <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
15179 </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>
15180 !! end
15182 !! test
15183 8. Categories and newlines: migrateTrailingCategories dom pass should not get tripped by intervening templates
15184 !! wikitext
15185 * a
15187 {{echo|[[Category:Foo]]
15188 [[Category:Bar]]}}
15189 [[Category:Baz]]
15190 !! html/parsoid
15191 <ul><li> a</li></ul>
15193 <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">
15194 </span><link rel="mw:PageProp/Category" href="./Category:Bar" about="#mwt1" data-parsoid='{"stx":"simple","a":{"href":"./Category:Bar"},"sa":{"href":"Category:Bar"}}'/>
15195 <link rel="mw:PageProp/Category" href="./Category:Baz" data-parsoid='{"stx":"simple","a":{"href":"./Category:Baz"},"sa":{"href":"Category:Baz"}}'/>
15196 !! end
15198 !! test
15199 Category links with multiple namespaces
15200 !! wikitext
15201 [[Category:Project:Foo]]
15202 !! html/parsoid
15203 <link rel="mw:PageProp/Category" href="./Category:Project:Foo" />
15204 !! end
15206 !! test
15207 Parsoid: Serialize link to category page with colon escape
15208 !! options
15209 parsoid
15210 !! wikitext
15212 [[:Category:Foo]]
15213 [[:Category:Foo|Bar]]
15214 !! html
15216 <a rel="mw:WikiLink" href="./Category:Foo" title="Category:Foo">Category:Foo</a>
15217 <a rel="mw:WikiLink" href="./Category:Foo" title="Category:Foo">Bar</a>
15218 </p>
15219 !! end
15221 # We used to, but no longer wt2wt this test since the default serializer
15222 # will normalize all categories to serialize on their own line.
15223 # This wikitext usage is going to be fairly uncommon in production and
15224 # selser will take care of preventing whitespace insertion if this
15225 # occurs in an article.
15227 # html2html disabled for the same reason (whitespace insertion between
15228 # x and y).
15230 # html2wt disabled because it localizes the "Category" namespace.
15231 !! test
15232 Link prefix/suffixes aren't applied to category links
15233 !! options
15234 parsoid=wt2html
15235 language=is
15236 !! wikitext
15237 x[[Category:Foo]]y
15238 !! html/php
15239 <p>xy
15240 </p>
15241 !! html/parsoid
15242 <p>x<link rel="mw:PageProp/Category" href="./Flokkur:Foo" data-parsoid=""/>y</p>
15243 !! end
15245 !! test
15246 Parsoid: Serialize link to file page with colon escape
15247 !! options
15248 parsoid
15249 !! wikitext
15251 [[:File:Foo.png]]
15252 [[:File:Foo.png|Bar]]
15253 !! html
15255 <a rel="mw:WikiLink" href="./File:Foo.png" title="File:Foo.png">File:Foo.png</a>
15256 <a rel="mw:WikiLink" href="./File:Foo.png" title="File:Foo.png">Bar</a>
15257 </p>
15258 !! end
15260 !! test
15261 Parsoid: Serialize a genuine category link without colon escape
15262 !! options
15263 parsoid
15264 !! wikitext
15265 [[Category:Foo]]
15266 [[Category:Foo|Bar]]
15267 !! html
15268 <link rel="mw:PageProp/Category" href="./Category:Foo">
15269 <link rel="mw:PageProp/Category" href="./Category:Foo#Bar">
15270 !! end
15272 !! test
15273 Normalize hrefs properly before testing for invalid link targets (bug 70894)
15274 !! options
15275 parsoid=html2wt
15276 !! html/parsoid
15277 <link rel="mw:PageProp/Category" href="./Category:Toxine_bactérienne"/>
15278 !! wikitext
15279 [[Category:Toxine bactérienne]]
15280 !! end
15282 !! test
15283 Parsoid: Defaultsort
15284 !! wikitext
15285 {{DEFAULTSORT:Foo}}
15286 !! html/parsoid
15287 <meta property="mw:PageProp/categorydefaultsort" content="Foo"/>
15288 !! end
15290 !! test
15291 Parsoid: Defaultsort (template-generated)
15292 !! wikitext
15293 {{{{echo|DEFAULTSORT}}:Foo}}
15294 !! html/parsoid
15295 <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}}]}'/>
15296 !! end
15299 ### Inter-language links
15301 !! test
15302 Interlanguage links
15303 !! options
15305 !! wikitext
15306 [[es:Alimento]]
15307 [[fr:Nourriture]]
15308 [[zh:食品]]
15309 !! html/php
15310 es:Alimento fr:Nourriture zh:食品
15311 !! html/parsoid
15312 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Alimento"/>
15313 <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/Nourriture"/>
15314 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/食品"/>
15315 !! end
15317 !! test
15318 Duplicate interlanguage links (bug 24502)
15319 !! options
15321 !! wikitext
15322 [[es:1]]
15323 [[es:2]]
15324 [[fr:1]]
15325 [[fr:2]]
15326 !! html/php
15327 es:1 fr:1
15328 !! html/parsoid
15329 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/1"/>
15330 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/2"/>
15331 <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/1"/>
15332 <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/2"/>
15333 !! end
15336 ### Sections
15338 !! test
15339 Basic section headings
15340 !! wikitext
15341 == Headline 1 ==
15342 Some text
15344 ==Headline 2==
15345 More
15346 ===Smaller headline===
15347 Blah blah
15348 !! html
15349 <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>
15350 <p>Some text
15351 </p>
15352 <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>
15353 <p>More
15354 </p>
15355 <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>
15356 <p>Blah blah
15357 </p>
15358 !! end
15360 !! test
15361 Section headings with TOC
15362 !! wikitext
15363 == Headline 1 ==
15364 === Subheadline 1 ===
15365 ===== Skipping a level =====
15366 ====== Skipping a level ======
15368 == Headline 2 ==
15369 Some text
15370 ===Another headline===
15371 !! html
15372 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15373 <ul>
15374 <li class="toclevel-1 tocsection-1"><a href="#Headline_1"><span class="tocnumber">1</span> <span class="toctext">Headline 1</span></a>
15375 <ul>
15376 <li class="toclevel-2 tocsection-2"><a href="#Subheadline_1"><span class="tocnumber">1.1</span> <span class="toctext">Subheadline 1</span></a>
15377 <ul>
15378 <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>
15379 <ul>
15380 <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>
15381 </ul>
15382 </li>
15383 </ul>
15384 </li>
15385 </ul>
15386 </li>
15387 <li class="toclevel-1 tocsection-5"><a href="#Headline_2"><span class="tocnumber">2</span> <span class="toctext">Headline 2</span></a>
15388 <ul>
15389 <li class="toclevel-2 tocsection-6"><a href="#Another_headline"><span class="tocnumber">2.1</span> <span class="toctext">Another headline</span></a></li>
15390 </ul>
15391 </li>
15392 </ul>
15393 </div>
15395 <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>
15396 <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>
15397 <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>
15398 <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>
15399 <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>
15400 <p>Some text
15401 </p>
15402 <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>
15404 !! end
15406 !! test
15407 TOC anchors don't collide
15408 !! wikitext
15409 __FORCETOC__
15410 == Headline 2 ==
15411 == Headline ==
15412 == Headline 2 ==
15413 == Headline ==
15414 !! html/php
15415 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15416 <ul>
15417 <li class="toclevel-1 tocsection-1"><a href="#Headline_2"><span class="tocnumber">1</span> <span class="toctext">Headline 2</span></a></li>
15418 <li class="toclevel-1 tocsection-2"><a href="#Headline"><span class="tocnumber">2</span> <span class="toctext">Headline</span></a></li>
15419 <li class="toclevel-1 tocsection-3"><a href="#Headline_2_2"><span class="tocnumber">3</span> <span class="toctext">Headline 2</span></a></li>
15420 <li class="toclevel-1 tocsection-4"><a href="#Headline_3"><span class="tocnumber">4</span> <span class="toctext">Headline</span></a></li>
15421 </ul>
15422 </div>
15424 <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>
15425 <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>
15426 <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>
15427 <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>
15429 !! end
15431 # perl -e 'print "="x$_," Level $_ heading","="x$_,"\n" for 1..10'
15432 !! test
15433 Handling of sections up to level 6 and beyond
15434 !! wikitext
15435 = Level 1 Heading=
15436 == Level 2 Heading==
15437 === Level 3 Heading===
15438 ==== Level 4 Heading====
15439 ===== Level 5 Heading=====
15440 ====== Level 6 Heading======
15441 ======= Level 7 Heading=======
15442 ======== Level 8 Heading========
15443 ========= Level 9 Heading=========
15444 ========== Level 10 Heading==========
15445 !! html
15446 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15447 <ul>
15448 <li class="toclevel-1 tocsection-1"><a href="#Level_1_Heading"><span class="tocnumber">1</span> <span class="toctext">Level 1 Heading</span></a>
15449 <ul>
15450 <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>
15451 <ul>
15452 <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>
15453 <ul>
15454 <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>
15455 <ul>
15456 <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>
15457 <ul>
15458 <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>
15459 <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>
15460 <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>
15461 <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>
15462 <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>
15463 </ul>
15464 </li>
15465 </ul>
15466 </li>
15467 </ul>
15468 </li>
15469 </ul>
15470 </li>
15471 </ul>
15472 </li>
15473 </ul>
15474 </div>
15476 <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>
15477 <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>
15478 <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>
15479 <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>
15480 <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>
15481 <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>
15482 <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>
15483 <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>
15484 <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>
15485 <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>
15487 !! end
15489 !! test
15490 TOC regression (T11764)
15491 !! wikitext
15492 == title 1 ==
15493 === title 1.1 ===
15494 ==== title 1.1.1 ====
15495 === title 1.2 ===
15496 == title 2 ==
15497 === title 2.1 ===
15498 !! html
15499 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15500 <ul>
15501 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
15502 <ul>
15503 <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>
15504 <ul>
15505 <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>
15506 </ul>
15507 </li>
15508 <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>
15509 </ul>
15510 </li>
15511 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
15512 <ul>
15513 <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>
15514 </ul>
15515 </li>
15516 </ul>
15517 </div>
15519 <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>
15520 <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>
15521 <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>
15522 <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>
15523 <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>
15524 <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>
15526 !! end
15528 !! test
15529 TOC for heading containing <span id="..."></span> (T96153)
15530 !! wikitext
15531 __FORCETOC__
15532 ==<span id="old-anchor"></span>New title==
15533 !! html/php
15534 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15535 <ul>
15536 <li class="toclevel-1 tocsection-1"><a href="#New_title"><span class="tocnumber">1</span> <span class="toctext">New title</span></a></li>
15537 </ul>
15538 </div>
15540 <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>
15542 !! end
15544 !! test
15545 TOC with wgMaxTocLevel=3 (bug 6204)
15546 !! options
15547 wgMaxTocLevel=3
15548 !! wikitext
15549 == title 1 ==
15550 === title 1.1 ===
15551 ==== title 1.1.1 ====
15552 === title 1.2 ===
15553 == title 2 ==
15554 === title 2.1 ===
15555 !! html
15556 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15557 <ul>
15558 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
15559 <ul>
15560 <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>
15561 <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>
15562 </ul>
15563 </li>
15564 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
15565 <ul>
15566 <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>
15567 </ul>
15568 </li>
15569 </ul>
15570 </div>
15572 <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>
15573 <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>
15574 <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>
15575 <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>
15576 <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>
15577 <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>
15579 !! end
15581 !! test
15582 TOC with wgMaxTocLevel=3 and two level four headings (bug 6204)
15583 !! options
15584 wgMaxTocLevel=3
15585 !! wikitext
15586 ==Section 1==
15587 ===Section 1.1===
15588 ====Section 1.1.1====
15589 ====Section 1.1.1.1====
15590 ==Section 2==
15591 !! html
15592 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15593 <ul>
15594 <li class="toclevel-1 tocsection-1"><a href="#Section_1"><span class="tocnumber">1</span> <span class="toctext">Section 1</span></a>
15595 <ul>
15596 <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>
15597 </ul>
15598 </li>
15599 <li class="toclevel-1 tocsection-5"><a href="#Section_2"><span class="tocnumber">2</span> <span class="toctext">Section 2</span></a></li>
15600 </ul>
15601 </div>
15603 <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>
15604 <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>
15605 <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>
15606 <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>
15607 <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>
15609 !! end
15612 !! test
15613 Resolving duplicate section names
15614 !! wikitext
15615 == Foo bar ==
15616 == Foo bar ==
15617 !! html
15618 <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>
15619 <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>
15621 !! end
15623 !! test
15624 Resolving duplicate section names with differing case (bug 10721)
15625 !! wikitext
15626 == Foo bar ==
15627 == Foo Bar ==
15628 !! html
15629 <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>
15630 <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>
15632 !! end
15634 !! article
15635 Template:sections
15636 !! text
15637 ===Section 1===
15638 ==Section 2==
15639 !! endarticle
15641 !! test
15642 Template with sections, __NOTOC__
15643 !! wikitext
15644 __NOTOC__
15645 ==Section 0==
15646 {{sections}}
15647 ==Section 4==
15648 !! html
15649 <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>
15650 <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>
15651 <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>
15652 <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>
15654 !! end
15656 !! test
15657 __NOEDITSECTION__ keyword
15658 !! wikitext
15659 __NOEDITSECTION__
15660 ==Section 1==
15661 ==Section 2==
15662 !! html
15663 <h2><span class="mw-headline" id="Section_1">Section 1</span></h2>
15664 <h2><span class="mw-headline" id="Section_2">Section 2</span></h2>
15666 !! end
15668 !! test
15669 Link inside a section heading
15670 !! wikitext
15671 ==Section with a [[Main Page|link]] in it==
15672 !! html
15673 <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>
15675 !! end
15677 !! test
15678 TOC regression (T14077)
15679 !! wikitext
15680 __TOC__
15681 == title 1 ==
15682 === title 1.1 ===
15683 == title 2 ==
15684 !! html
15685 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15686 <ul>
15687 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
15688 <ul>
15689 <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>
15690 </ul>
15691 </li>
15692 <li class="toclevel-1 tocsection-3"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a></li>
15693 </ul>
15694 </div>
15696 <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>
15697 <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>
15698 <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>
15700 !! end
15702 !! test
15703 BUG 1219 URL next to image (good)
15704 !! wikitext
15705 http://example.com [[File:Foobar.jpg]]
15706 !! html/php
15707 <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>
15708 </p>
15709 !! html/parsoid
15710 <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>
15711 !!end
15713 !! test
15714 Short headings with trailing space should match behavior of Parser::doHeadings (bug 19910)
15715 !! wikitext
15716 === 
15717 The line above must have a trailing space!
15718 === <!--
15719 --> <!-- -->
15720 But just in case it doesn't...
15721 !! html
15722 <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>
15723 <p>The line above must have a trailing space!
15724 </p>
15725 <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>
15726 <p>But just in case it doesn't...
15727 </p>
15728 !! end
15730 !! test
15731 Header with special characters (bug 25462)
15732 !! wikitext
15733 The tooltips shall not show entities to the user (ie. be double escaped)
15735 == text > text ==
15736 section 1
15738 == text < text ==
15739 section 2
15741 == text & text ==
15742 section 3
15744 == text ' text ==
15745 section 4
15747 == text " text ==
15748 section 5
15749 !! html
15750 <p>The tooltips shall not show entities to the user (ie. be double escaped)
15751 </p>
15752 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15753 <ul>
15754 <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>
15755 <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>
15756 <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>
15757 <li class="toclevel-1 tocsection-4"><a href="#text_.27_text"><span class="tocnumber">4</span> <span class="toctext">text ' text</span></a></li>
15758 <li class="toclevel-1 tocsection-5"><a href="#text_.22_text"><span class="tocnumber">5</span> <span class="toctext">text " text</span></a></li>
15759 </ul>
15760 </div>
15762 <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>
15763 <p>section 1
15764 </p>
15765 <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>
15766 <p>section 2
15767 </p>
15768 <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>
15769 <p>section 3
15770 </p>
15771 <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>
15772 <p>section 4
15773 </p>
15774 <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>
15775 <p>section 5
15776 </p>
15777 !! end
15779 !! test
15780 Header with space, plus and underscore as entity
15781 !! wikitext
15782 Id should not contain + for spaces
15784 == Space between Text ==
15785 section 1
15787 == Space-Entity&#32;between&#32;Text ==
15788 section 2
15790 == Plus+between+Text ==
15791 section 3
15793 == Plus-Entity&#43;between&#43;Text ==
15794 section 4
15796 == Underscore_between_Text ==
15797 section 5
15799 == Underscore-Entity&#95;between&#95;Text ==
15800 section 6
15802 [[#Space between Text]]
15803 [[#Space-Entity&#32;between&#32;Text]]
15804 [[#Plus+between+Text]]
15805 [[#Plus-Entity&#43;between&#43;Text]]
15806 [[#Underscore_between_Text]]
15807 [[#Underscore-Entity&#95;between&#95;Text]]
15808 !! html
15809 <p>Id should not contain + for spaces
15810 </p>
15811 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15812 <ul>
15813 <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>
15814 <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>
15815 <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>
15816 <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>
15817 <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>
15818 <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>
15819 </ul>
15820 </div>
15822 <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>
15823 <p>section 1
15824 </p>
15825 <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>
15826 <p>section 2
15827 </p>
15828 <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>
15829 <p>section 3
15830 </p>
15831 <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>
15832 <p>section 4
15833 </p>
15834 <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>
15835 <p>section 5
15836 </p>
15837 <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>
15838 <p>section 6
15839 </p><p><a href="#Space_between_Text">#Space between Text</a>
15840 <a href="#Space-Entity_between_Text">#Space-Entity&#32;between&#32;Text</a>
15841 <a href="#Plus.2Bbetween.2BText">#Plus+between+Text</a>
15842 <a href="#Plus-Entity.2Bbetween.2BText">#Plus-Entity&#43;between&#43;Text</a>
15843 <a href="#Underscore_between_Text">#Underscore_between_Text</a>
15844 <a href="#Underscore-Entity_between_Text">#Underscore-Entity&#95;between&#95;Text</a>
15845 </p>
15846 !! end
15848 !! test
15849 Headers with excess '=' characters
15850 (Are similar tests necessary beyond the 1st level?)
15851 !! wikitext
15852 =foo==
15853 ==foo=
15854 =''italic'' heading==
15855 ==''italic'' heading=
15856 !! html
15857 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15858 <ul>
15859 <li class="toclevel-1 tocsection-1"><a href="#foo.3D"><span class="tocnumber">1</span> <span class="toctext">foo=</span></a></li>
15860 <li class="toclevel-1 tocsection-2"><a href="#.3Dfoo"><span class="tocnumber">2</span> <span class="toctext">=foo</span></a></li>
15861 <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>
15862 <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>
15863 </ul>
15864 </div>
15866 <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>
15867 <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>
15868 <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>
15869 <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>
15871 !! end
15873 !! test
15874 HTML headers vs TOC (bug 23393)
15875 (__NOEDITSECTION__ for clearer output, doesn't matter here)
15876 !! wikitext
15877 <h1>Header 1</h1>
15878 == Header 1.1 ==
15879 == Header 1.2 ==
15881 <h1>Header 2
15882 </h1>
15883 == Header 2.1 ==
15884 == Header 2.2 ==
15885 __NOEDITSECTION__
15886 !! html
15887 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15888 <ul>
15889 <li class="toclevel-1"><a href="#Header_1"><span class="tocnumber">1</span> <span class="toctext">Header 1</span></a>
15890 <ul>
15891 <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>
15892 <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>
15893 </ul>
15894 </li>
15895 <li class="toclevel-1"><a href="#Header_2"><span class="tocnumber">2</span> <span class="toctext">Header 2</span></a>
15896 <ul>
15897 <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>
15898 <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>
15899 </ul>
15900 </li>
15901 </ul>
15902 </div>
15904 <h1><span class="mw-headline" id="Header_1">Header 1</span></h1>
15905 <h2><span class="mw-headline" id="Header_1.1">Header 1.1</span></h2>
15906 <h2><span class="mw-headline" id="Header_1.2">Header 1.2</span></h2>
15907 <h1><span class="mw-headline" id="Header_2">Header 2</span></h1>
15908 <h2><span class="mw-headline" id="Header_2.1">Header 2.1</span></h2>
15909 <h2><span class="mw-headline" id="Header_2.2">Header 2.2</span></h2>
15911 !! end
15913 !! test
15914 Single-line or multiline-comments can follow headings
15915 !! options
15916 parsoid=wt2html,wt2wt
15917 !! wikitext
15918 ==foo==<!---->
15919 ==bar==<!--c1-->
15920 ==baz==<!--
15922 c3-->
15923 !! html
15924 <h2><span class="mw-headline" id="foo">foo</span></h2>
15925 <h2><span class="mw-headline" id="bar">bar</span></h2>
15926 <h2><span class="mw-headline" id="baz">baz</span></h2>
15928 !! end
15930 !! test
15931 BUG 1219 URL next to image (broken)
15932 !! wikitext
15933 http://example.com[[File:Foobar.jpg]]
15934 !! html/php
15935 <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>
15936 </p>
15937 !! html/parsoid
15938 <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>
15939 !!end
15941 !! test
15942 Bug 1186 news: in the middle of text
15943 !! wikitext
15944 http://en.wikinews.org/wiki/Wikinews:Workplace
15945 !! html
15946 <p><a rel="nofollow" class="external free" href="http://en.wikinews.org/wiki/Wikinews:Workplace">http://en.wikinews.org/wiki/Wikinews:Workplace</a>
15947 </p>
15948 !!end
15951 !! test
15952 Namespaced link must have a title
15953 !! wikitext
15954 [[Project:]]
15955 !! html
15956 <p>[[Project:]]
15957 </p>
15958 !!end
15960 !! test
15961 Namespaced link must have a title (bad fragment version)
15962 !! wikitext
15963 [[Project:#fragment]]
15964 !! html
15965 <p>[[Project:#fragment]]
15966 </p>
15967 !!end
15971 ### HTML tags and HTML attributes
15974 !! test
15975 div with no attributes
15976 !! wikitext
15977 <div>HTML rocks</div>
15978 !! html
15979 <div>HTML rocks</div>
15981 !! end
15983 !! test
15984 div with double-quoted attribute
15985 !! wikitext
15986 <div id="rock">HTML rocks</div>
15987 !! html
15988 <div id="rock">HTML rocks</div>
15990 !! end
15992 !! test
15993 div with single-quoted attribute
15994 !! wikitext
15995 <div id='rock'>HTML rocks</div>
15996 !! html
15997 <div id="rock">HTML rocks</div>
15999 !! end
16001 !! test
16002 div with unquoted attribute
16003 !! wikitext
16004 <div id=rock>HTML rocks</div>
16005 !! html
16006 <div id="rock">HTML rocks</div>
16008 !! end
16010 !! test
16011 div with illegal double attributes
16012 !! wikitext
16013 <div id="a" id="b">HTML rocks</div>
16014 !! html
16015 <div id="b">HTML rocks</div>
16017 !!end
16019 !! test
16020 div with empty attribute value, space before equals
16021 !! options
16022 parsoid=wt2html,html2html
16023 !! wikitext
16024 <div class =>HTML rocks</div>
16025 !! html/php
16026 <div class="">HTML rocks</div>
16028 !! html/parsoid
16029 <div class="" data-parsoid='{"stx":"html"}'>HTML rocks</div>
16030 !! end
16032 !! test
16033 div with multiple empty attribute values
16034 !! options
16035 parsoid=wt2html,html2html
16036 !! wikitext
16037 <div id= title=>HTML rocks</div>
16038 !! html/php
16039 <div id="title.3D">HTML rocks</div>
16041 !! html/parsoid
16042 <div id="title.3D" data-parsoid='{"stx":"html"}'>HTML rocks</div>
16043 !! end
16045 !! test
16046 table with multiple empty attribute values
16047 !! options
16048 parsoid=wt2html,html2html
16049 !! wikitext
16050 {| title= id=
16051 | hi
16053 !! html/php
16054 <table title="id=">
16055 <tr>
16056 <td> hi
16057 </td></tr></table>
16059 !! html/parsoid
16060 <table title="id=">
16061 <tbody><tr><td> hi</td></tr>
16062 </tbody></table>
16063 !! end
16065 !! test
16066 div with braces in attribute value
16067 !! wikitext
16068 <div title="{}">Foo</div>
16069 !! html/php
16070 <div title="&#123;}">Foo</div>
16072 !! html/parsoid
16073 <div title="{}">Foo</div>
16074 !! end
16076 !! test
16077 div with empty attribute value, no space before equals
16078 !! options
16079 parsoid=wt2html,html2html
16080 !! wikitext
16081 <div class=>HTML rocks</div>
16082 !! html/php
16083 <div class="">HTML rocks</div>
16085 !! html/parsoid
16086 <div class="">HTML rocks</div>
16087 !! end
16089 !! test
16090 HTML multiple attributes correction
16091 !! wikitext
16092 <p class="error" class="awesome">Awesome!</p>
16093 !! html
16094 <p class="awesome">Awesome!</p>
16096 !!end
16098 !! test
16099 Table multiple attributes correction
16100 !! wikitext
16102 !+ class="error" class="awesome"| status
16104 !! html
16105 <table>
16106 <tr>
16107 <th class="awesome"> status
16108 </th></tr></table>
16110 !!end
16112 !! test
16113 DIV IN UPPERCASE
16114 !! wikitext
16115 <DIV ID="x">HTML ROCKS</DIV>
16116 !! html
16117 <div id="x">HTML ROCKS</div>
16119 !!end
16121 !! test
16122 Non-ASCII pseudo-tags are rendered as text
16123 !! wikitext
16124 <khyô>
16125 !! html
16126 <p>&lt;khyô&gt;
16127 </p>
16128 !! end
16130 !! test
16131 Pseudo-tag with URL 'name' renders as url link
16132 !! wikitext
16133 <http://example.com/>
16134 !! html
16135 <p>&lt;<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&gt;
16136 </p>
16137 !! end
16139 !! test
16140 text with amp in the middle of nowhere
16141 !! wikitext
16142 Remember AT&T?
16143 !! html
16144 <p>Remember AT&amp;T?
16145 </p>
16146 !! end
16148 !! test
16149 text with character entity: eacute
16150 !! wikitext
16151 I always thought &eacute; was a cute letter.
16152 !! html
16153 <p>I always thought &#233; was a cute letter.
16154 </p>
16155 !! html+tidy
16156 <p>I always thought é was a cute letter.</p>
16157 !! end
16159 !! test
16160 text with entity-escaped character entity-like string: eacute
16161 !! wikitext
16162 I always thought &amp;eacute; was a cute letter.
16163 !! html
16164 <p>I always thought &amp;eacute; was a cute letter.
16165 </p>
16166 !! end
16168 !! test
16169 text with undefined character entity: xacute
16170 !! wikitext
16171 I always thought &xacute; was a cute letter.
16172 !! html
16173 <p>I always thought &amp;xacute; was a cute letter.
16174 </p>
16175 !! end
16177 !! test
16178 HTML5 tags
16179 !! wikitext
16180 <data value="5">five</data>
16181 <time datetime="2000-01-01T00:00Z">The new millenium started</time>
16182 <mark>This highlighted text</mark>
16183 !! html
16184 <p><data value="5">five</data>
16185 <time datetime="2000-01-01T00:00Z">The new millenium started</time>
16186 <mark>This highlighted text</mark>
16187 </p>
16188 !! end
16190 !! test
16191 HTML tag with leading space is parsed as text
16192 !! wikitext
16193 < div>foo< /div>
16194 !! html
16195 <p>&lt; div&gt;foo&lt; /div&gt;
16196 </p>
16197 !! end
16200 ### Nesting tests (see bug 41545, 50604, 51081)
16203 # This test case is fixed in Parsoid by domino 1.0.12. (bug 50604)
16204 # Note that html2wt is considerably more difficult if we use <b> in
16205 # the test case, instead of <big>
16206 !! test
16207 Ensure that HTML adoption agency algorithm is properly implemented.
16208 !! wikitext
16209 <big>X<big>Y</big>Z</big>
16210 !! html
16211 <p><big>X<big>Y</big>Z</big>
16212 </p>
16213 !! end
16215 # This was bug 41545 in the PHP parser.
16216 # Note that tidy doesn't handle this correctly.
16217 !! test
16218 Nesting of <kbd>
16219 !! wikitext
16220 <kbd>X<kbd>Y</kbd>Z</kbd>
16221 !! html
16222 <p><kbd>X<kbd>Y</kbd>Z</kbd>
16223 </p>
16224 !! end
16226 # The following cases were bug 51081 in the PHP parser.
16227 # Note that there are some other nestable tags (b, i, etc) which are
16228 # not covered; see bug 51081 for discussion.
16230 # Note that tidy doesn't handle this correctly.
16231 !! test
16232 Nesting of <em>
16233 !! wikitext
16234 <em>X<em>Y</em>Z</em>
16235 !! html
16236 <p><em>X<em>Y</em>Z</em>
16237 </p>
16238 !! end
16240 # Note that tidy doesn't handle this correctly.
16241 !! test
16242 Nesting of <strong>
16243 !! wikitext
16244 <strong>X<strong>Y</strong>Z</strong>
16245 !! html
16246 <p><strong>X<strong>Y</strong>Z</strong>
16247 </p>
16248 !! end
16250 !! test
16251 Nesting of <q>
16252 !! wikitext
16253 <q>X<q>Y</q>Z</q>
16254 !! html+tidy
16255 <p><q>X<q>Y</q>Z</q></p>
16256 !! end
16258 # Note that tidy doesn't handle this correctly.
16259 !! test
16260 Nesting of <ruby>
16261 !! wikitext
16262 <ruby>X<ruby>Y</ruby>Z</ruby>
16263 !! html
16264 <p><ruby>X<ruby>Y</ruby>Z</ruby>
16265 </p>
16266 !! end
16268 # Note that tidy doesn't handle this correctly.
16269 !! test
16270 Nesting of <bdo>
16271 !! wikitext
16272 <bdo>X<bdo>Y</bdo>Z</bdo>
16273 !! html
16274 <p><bdo>X<bdo>Y</bdo>Z</bdo>
16275 </p>
16276 !! end
16280 ### Media links
16283 !! test
16284 Media link
16285 !! wikitext
16286 [[Media:Foobar.jpg]]
16287 !! html
16288 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Media:Foobar.jpg</a>
16289 </p>
16290 !! end
16292 !! test
16293 Media link with text
16294 !! wikitext
16295 [[Media:Foobar.jpg|A neat file to look at]]
16296 !! html
16297 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">A neat file to look at</a>
16298 </p>
16299 !! end
16301 # FIXME: this is still bad HTML tag nesting
16302 # FIXME: doBlockLevels won't wrap this in a paragraph because it contains a div
16303 !! test
16304 Media link with nasty text
16305 !! wikitext
16306 [[Media:Foobar.jpg|Safe Link<div style=display:none>" onmouseover="alert(document.cookie)" onfoo="</div>]]
16307 !! html
16308 <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>
16310 !! html+tidy
16311 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Safe Link</a></p>
16312 <div style="display:none">" onmouseover="alert(document.cookie)" onfoo="</div>
16313 !! end
16315 !! test
16316 Media link to nonexistent file (bug 1702)
16317 !! wikitext
16318 [[Media:No such.jpg]]
16319 !! html
16320 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=No_such.jpg" class="new" title="No such.jpg">Media:No such.jpg</a>
16321 </p>
16322 !! end
16324 !! test
16325 Image link to nonexistent file (bug 1850 - good)
16326 !! wikitext
16327 [[File:No_such.jpg]]
16328 !! html/php
16329 <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>
16330 </p>
16331 !! html/parsoid
16332 <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>
16333 !! end
16335 !! test
16336 :Image link to nonexistent file (bug 1850 - bad)
16337 !! wikitext
16338 [[:Image:No such.jpg]]
16339 !! html/php
16340 <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>
16341 </p>
16342 !! html/parsoid
16343 <p><a rel="mw:WikiLink" href="./File:No_such.jpg" title="File:No such.jpg">Image:No such.jpg</a></p>
16344 !! end
16348 !! test
16349 Character reference normalization in link text (bug 1938)
16350 !! wikitext
16351 [[Main Page|this&that]]
16352 !! html
16353 <p><a href="/wiki/Main_Page" title="Main Page">this&amp;that</a>
16354 </p>
16355 !!end
16357 !! article
16358 אַ
16359 !! text
16360 Test for unicode normalization
16362 The page's name is U+05d0 U+05b7, with non-canonical form U+FB2E
16363 !! endarticle
16365 !! test
16366 (bug 19451) Links should refer to the normalized form.
16367 !! wikitext
16368 [[&#xFB2E;]]
16369 [[&#x5d0;&#x5b7;]]
16370 [[&#x5d0;ַ]]
16371 [[א&#x5b7;]]
16372 [[אַ]]
16373 !! html
16374 <p><a href="/wiki/%D7%90%D6%B7" title="אַ">&#xfb2e;</a>
16375 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;&#x5b7;</a>
16376 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;ַ</a>
16377 <a href="/wiki/%D7%90%D6%B7" title="אַ">א&#x5b7;</a>
16378 <a href="/wiki/%D7%90%D6%B7" title="אַ">אַ</a>
16379 </p>
16380 !! end
16382 !! test
16383 Empty attribute crash test (bug 2067)
16384 !! wikitext
16385 <font color="">foo</font>
16386 !! html
16387 <p><font color="">foo</font>
16388 </p>
16389 !! end
16391 !! test
16392 Empty attribute crash test single-quotes (bug 2067)
16393 !! wikitext
16394 <font color=''>foo</font>
16395 !! html
16396 <p><font color="">foo</font>
16397 </p>
16398 !! end
16400 !! test
16401 Attribute test: equals, then nothing
16402 !! options
16403 parsoid=wt2html,html2html
16404 !! wikitext
16405 <font color=>foo</font>
16406 !! html/php
16407 <p><font color="">foo</font>
16408 </p>
16409 !! html/parsoid
16410 <p><font color="" data-parsoid='{"stx":"html"}'>foo</font></p>
16411 !! end
16413 !! test
16414 Attribute test: unquoted value
16415 !! options
16416 parsoid=wt2html,html2html
16417 !! wikitext
16418 <font color=x>foo</font>
16419 !! html/php
16420 <p><font color="x">foo</font>
16421 </p>
16422 !! html/parsoid
16423 <p><font color="x" data-parsoid='{"stx":"html"}'>foo</font></p>
16424 !! end
16426 !! test
16427 Attribute test: unquoted but illegal value (hash)
16428 !! wikitext
16429 <font color=#x>foo</font>
16430 !! html
16431 <p><font color="#x">foo</font>
16432 </p>
16433 !! end
16435 # Parsoid does not serialize to empty attribute syntax,
16436 # so wt2wt and html2wt cases are skipped
16437 !! test
16438 Attribute test: no value (T54330)
16439 !! options
16440 parsoid=wt2html,html2html
16441 !! wikitext
16442 <font color>foo</font>
16443 !! html/php
16444 <p><font color="">foo</font>
16445 </p>
16446 !! html/parsoid
16447 <p><font color="">foo</font></p>
16448 !! end
16450 !! test
16451 Bug 2095: link with three closing brackets
16452 !! wikitext
16453 [[Main Page]]]
16454 !! html/php
16455 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>]
16456 </p>
16457 !! html/parsoid
16458 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">Main Page</a>]</p>
16459 !! end
16461 !! test
16462 Bug 2095: link with pipe and three closing brackets
16463 !! wikitext
16464 [[Main Page|link]]]
16465 !! html/php
16466 <p><a href="/wiki/Main_Page" title="Main Page">link</a>]
16467 </p>
16468 !! html/parsoid
16469 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">link</a>]</p>
16470 !! end
16472 !! test
16473 Bug 2095: link with pipe and three closing brackets, version 2
16474 !! wikitext
16475 [[Main Page|[http://example.com/]]]
16476 !! html/php
16477 <p><a href="/wiki/Main_Page" title="Main Page">[http://example.com/]</a>
16478 </p>
16479 !! html/parsoid
16480 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">[http://example.com/]</a></p>
16481 !! end
16485 ### Safety
16488 !! article
16489 Template:Dangerous attribute
16490 !! text
16491 " onmouseover="alert(document.cookie)
16492 !! endarticle
16494 !! article
16495 Template:Dangerous style attribute
16496 !! text
16497 border-size: expression(alert(document.cookie))
16498 !! endarticle
16500 !! article
16501 Template:Div style
16502 !! text
16503 <div style="float: right; {{{1}}}">Magic div</div>
16504 !! endarticle
16506 !! test
16507 Bug 2304: HTML attribute safety (safe template; regression bug 2309)
16508 !! wikitext
16509 <div title="{{test}}"></div>
16510 !! html
16511 <div title="This is a test template"></div>
16513 !! end
16515 # Parsoid has enough context to handle this case
16516 !! test
16517 Bug 2304: HTML attribute safety (dangerous template; 2309)
16518 !! wikitext
16519 <div title="{{dangerous attribute}}"></div>
16520 !! html/php
16521 <div title=""></div>
16523 !! html/parsoid
16524 <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>
16525 !! end
16527 !! test
16528 Bug 2304: HTML attribute safety (dangerous style template; 2309)
16529 !! wikitext
16530 <div style="{{dangerous style attribute}}"></div>
16531 !! html
16532 <div style="/* insecure input */"></div>
16534 !! end
16536 !! test
16537 Bug 2304: HTML attribute safety (safe parameter; 2309)
16538 !! wikitext
16539 {{div style|width: 200px}}
16540 !! html
16541 <div style="float: right; width: 200px">Magic div</div>
16543 !! end
16545 !! test
16546 Bug 2304: HTML attribute safety (unsafe parameter; 2309)
16547 !! wikitext
16548 {{div style|width: expression(alert(document.cookie))}}
16549 !! html
16550 <div style="/* insecure input */">Magic div</div>
16552 !! end
16554 !! test
16555 Bug 2304: HTML attribute safety (unsafe breakout parameter; 2309)
16556 !! wikitext
16557 {{div style|"><script>alert(document.cookie)</script>}}
16558 !! html
16559 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
16561 !! end
16563 !! test
16564 Bug 2304: HTML attribute safety (unsafe breakout parameter 2; 2309)
16565 !! wikitext
16566 {{div style|" ><script>alert(document.cookie)</script>}}
16567 !! html
16568 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
16570 !! end
16572 !! test
16573 Bug 2304: HTML attribute safety (link)
16574 !! wikitext
16575 <div title="[[Main Page]]"></div>
16576 !! html
16577 <div title="&#91;&#91;Main Page]]"></div>
16579 !! end
16581 !! test
16582 Bug 2304: HTML attribute safety (italics)
16583 !! wikitext
16584 <div title="''foobar''"></div>
16585 !! html
16586 <div title="&#39;&#39;foobar&#39;&#39;"></div>
16588 !! end
16590 !! test
16591 Bug 2304: HTML attribute safety (bold)
16592 !! wikitext
16593 <div title="'''foobar'''"></div>
16594 !! html
16595 <div title="&#39;&#39;&#39;foobar&#39;&#39;&#39;"></div>
16597 !! end
16600 !! test
16601 Bug 2304: HTML attribute safety (ISBN)
16602 !! wikitext
16603 <div title="ISBN 1234567890"></div>
16604 !! html
16605 <div title="&#73;SBN 1234567890"></div>
16607 !! end
16609 !! test
16610 Bug 2304: HTML attribute safety (RFC)
16611 !! wikitext
16612 <div title="RFC 1234"></div>
16613 !! html
16614 <div title="&#82;FC 1234"></div>
16616 !! end
16618 !! test
16619 Bug 2304: HTML attribute safety (PMID)
16620 !! wikitext
16621 <div title="PMID 1234567890"></div>
16622 !! html
16623 <div title="&#80;MID 1234567890"></div>
16625 !! end
16627 !! test
16628 Bug 2304: HTML attribute safety (web link)
16629 !! wikitext
16630 <div title="http://example.com/"></div>
16631 !! html
16632 <div title="http&#58;//example.com/"></div>
16634 !! end
16636 !! test
16637 Bug 2304: HTML attribute safety (named web link)
16638 !! wikitext
16639 <div title="[http://example.com/ link]"></div>
16640 !! html
16641 <div title="&#91;http&#58;//example.com/ link]"></div>
16643 !! end
16645 !! test
16646 Bug 3244: HTML attribute safety (extension; safe)
16647 !! wikitext
16648 <div style="<nowiki>background:blue</nowiki>"></div>
16649 !! html
16650 <div style="background:blue"></div>
16652 !! end
16654 !! test
16655 Bug 3244: HTML attribute safety (extension; unsafe)
16656 !! wikitext
16657 <div style="<nowiki>border-left:expression(alert(document.cookie))</nowiki>"></div>
16658 !! html
16659 <div style="/* insecure input */"></div>
16661 !! end
16663 # More MSIE fun discovered by Tom Gilder
16665 !! test
16666 MSIE CSS safety test: spurious slash
16667 !! wikitext
16668 <div style="background-image:u\rl(javascript:alert('boo'))">evil</div>
16669 !! html
16670 <div style="/* insecure input */">evil</div>
16672 !! end
16674 !! test
16675 MSIE CSS safety test: hex code
16676 !! wikitext
16677 <div style="background-image:u\72l(javascript:alert('boo'))">evil</div>
16678 !! html
16679 <div style="/* insecure input */">evil</div>
16681 !! end
16683 !! test
16684 MSIE CSS safety test: comment in url
16685 !! wikitext
16686 <div style="background-image:u/**/rl(javascript:alert('boo'))">evil</div>
16687 !! html
16688 <div style="background-image:u rl(javascript:alert(&#39;boo&#39;))">evil</div>
16690 !! end
16692 !! test
16693 MSIE CSS safety test: comment in expression
16694 !! wikitext
16695 <div style="background-image:expres/**/sion(alert('boo4'))">evil4</div>
16696 !! html
16697 <div style="background-image:expres sion(alert(&#39;boo4&#39;))">evil4</div>
16699 !! end
16701 !! test
16702 CSS safety test (all browsers): vertical tab (bug 55332 / CVE-2013-4567)
16703 !! wikitext
16704 <p style="font-size: 100px; background-image:url\b(https://www.google.com/images/srpr/logo6w.png)">A</p>
16705 !! html
16706 <p style="/* invalid control char */">A</p>
16708 !! end
16710 !! test
16711 MSIE 6 CSS safety test: Fullwidth (bug 55332)
16712 !! wikitext
16713 <p style="font-size: 100px; color: expression((title='XSSed'),'red')">A</p>
16714 <div style="top:EXPRESSION(alert())">B</div>
16715 !! html
16716 <p style="/* insecure input */">A</p>
16717 <div style="/* insecure input */">B</div>
16719 !! end
16721 !! test
16722 MSIE 6 CSS safety test: IPA extensions (bug 55332)
16723 !! wikitext
16724 <div style="background-image:uʀʟ(javascript:alert())">A</div>
16725 <p style="font-size: 100px; color: expʀessɪoɴ((title='XSSed'),'red')">B</p>
16726 !! html
16727 <div style="/* insecure input */">A</div>
16728 <p style="/* insecure input */">B</p>
16730 !! end
16732 !! test
16733 MSIE 6 CSS safety test: sup/sub script (bug 55332)
16734 !! wikitext
16735 <div style="background-image:url⁽javascript:alert())">A</div>
16736 <div style="background-image:url₍javascript:alert())">B</div>
16737 <p style="font-size: 100px; color: expressioⁿ((title='XSSed'),'red')">C</p>
16738 !! html
16739 <div style="/* insecure input */">A</div>
16740 <div style="/* insecure input */">B</div>
16741 <p style="/* insecure input */">C</p>
16743 !! end
16745 # FIXME: Parsoid fails to sanitize this! See T58846.
16746 !! test
16747 Opera -o-link CSS
16748 !! wikitext
16749 <div
16750 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;"
16751 style="-o-link:attr(title);-o-link-source:current">X</div>
16752 !! html
16753 <div title="data:text/html,&lt;img src=1 onerror=alert(1)&gt;" style="/* insecure input */">X</div>
16755 !! end
16757 !! test
16758 MSIE 6 CSS safety test: Repetition markers (bug 55332)
16759 !! wikitext
16760 <p style="font-size: 100px; color: expres〱ion((title='XSSed'),'red')">A</p>
16761 <p style="font-size: 100px; color: expresゝion((title='XSSed'),'red')">B</p>
16762 <p style="font-size: 100px; color: expresーion((title='XSSed'),'red')">C</p>
16763 <p style="font-size: 100px; color: expresヽion((title='XSSed'),'red')">D</p>
16764 <p style="font-size: 100px; color: expresﹽion((title='XSSed'),'red')">E</p>
16765 <p style="font-size: 100px; color: expresﹼion((title='XSSed'),'red')">F</p>
16766 <p style="font-size: 100px; color: expresーion((title='XSSed'),'red')">G</p>
16767 !! html
16768 <p style="/* insecure input */">A</p>
16769 <p style="/* insecure input */">B</p>
16770 <p style="/* insecure input */">C</p>
16771 <p style="/* insecure input */">D</p>
16772 <p style="/* insecure input */">E</p>
16773 <p style="/* insecure input */">F</p>
16774 <p style="/* insecure input */">G</p>
16776 !! end
16778 !! test
16779 Table attribute legitimate extension
16780 !! wikitext
16782 !+ style="<nowiki>color:blue</nowiki>"| status
16784 !! html
16785 <table>
16786 <tr>
16787 <th style="color:blue"> status
16788 </th></tr></table>
16790 !!end
16792 !! test
16793 Table attribute safety
16794 !! wikitext
16796 !+ style="<nowiki>border-width:expression(0+alert(document.cookie))</nowiki>"| status
16798 !! html
16799 <table>
16800 <tr>
16801 <th style="/* insecure input */"> status
16802 </th></tr></table>
16804 !! end
16806 !! test
16807 CSS line continuation 1
16808 !! wikitext
16809 <div style="background-image: u\&#10;rl(test.jpg);"></div>
16810 !! html
16811 <div style="/* insecure input */"></div>
16813 !! end
16815 !! test
16816 CSS line continuation 2
16817 !! wikitext
16818 <div style="background-image: u\&#13;rl(test.jpg); "></div>
16819 !! html
16820 <div style="/* invalid control char */"></div>
16822 !! end
16824 !! article
16825 Template:Identity
16826 !! text
16827 {{{1}}}
16828 !! endarticle
16830 !! test
16831 Expansion of multi-line templates in attribute values (bug 6255)
16832 !! wikitext
16833 <div style="background: {{identity|#00FF00}}">-</div>
16834 !! html
16835 <div style="background: #00FF00">-</div>
16837 !! end
16840 !! test
16841 Expansion of multi-line templates in attribute values (bug 6255 sanity check)
16842 !! wikitext
16843 <div style="background: 
16844 #00FF00">-</div>
16845 !! html/php
16846 <div style="background: #00FF00">-</div>
16848 !! html/parsoid
16849 <div style="background: 
16850 #00FF00">-</div>
16851 !! end
16853 !! test
16854 Expansion of multi-line templates in attribute values (bug 6255 sanity check 2)
16855 !! wikitext
16856 <div style="background: &#10;#00FF00">-</div>
16857 !! html
16858 <div style="background: &#10;#00FF00">-</div>
16860 !! end
16862 !! test
16863 Tags which are hidden from Tidy cannot pass through the Sanitizer
16864 !! wikitext
16865 <mw:toc><script>alert();</script></mw:toc>
16866 !! html+tidy
16867 <p>&lt;mw:toc&gt;&lt;script&gt;alert();&lt;/script&gt;&lt;/mw:toc&gt;</p>
16868 !! end
16871 ### Parser hooks (see tests/parser/parserTestsParserHook.php for the <tag> extension)
16873 !! test
16874 Parser hook: empty input
16875 !! wikitext
16876 <tag></tag>
16877 !! html/php
16878 <pre>
16880 array (
16882 </pre>
16884 !! html/parsoid
16885 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":""}}' data-parsoid='{}' about="#mwt2"></pre>
16886 !! end
16888 ## Don't expect parsoid to rt this form.
16889 !! test
16890 Parser hook: empty input using terminated empty elements
16891 !! options
16892 parsoid=wt2html,html2html
16893 !! wikitext
16894 <tag/>
16895 !! html/php
16896 <pre>
16897 NULL
16898 array (
16900 </pre>
16902 !! html/parsoid
16903 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":null}' data-parsoid='{}' about="#mwt2"></pre>
16904 !! end
16906 !! test
16907 Parser hook: empty input using terminated empty elements (space before)
16908 !! wikitext
16909 <tag />
16910 !! html/php
16911 <pre>
16912 NULL
16913 array (
16915 </pre>
16917 !! html/parsoid
16918 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":null}' data-parsoid='{}' about="#mwt2"></pre>
16919 !! end
16921 !! test
16922 Parser hook: basic input
16923 !! wikitext
16924 <tag>input</tag>
16925 !! html/php
16926 <pre>
16927 'input'
16928 array (
16930 </pre>
16932 !! html/parsoid
16933 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":"input"}}' data-parsoid='{}' about="#mwt2"></pre>
16934 !! end
16936 ## Don't expect parsoid to rt this form.
16937 !! test
16938 Parser hook: case insensitive
16939 !! options
16940 parsoid=wt2html,html2html
16941 !! wikitext
16942 <TAG>input</TAG>
16943 !! html/php
16944 <pre>
16945 'input'
16946 array (
16948 </pre>
16950 !! html/parsoid
16951 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":"input"}}' data-parsoid='{}' about="#mwt2"></pre>
16952 !! end
16954 ## Don't expect parsoid to rt this form.
16955 !! test
16956 Parser hook: case insensitive, redux
16957 !! options
16958 parsoid=wt2html,html2html
16959 !! wikitext
16960 <TaG>input</TAg>
16961 !! html/php
16962 <pre>
16963 'input'
16964 array (
16966 </pre>
16968 !! html/parsoid
16969 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":"input"}}' data-parsoid='{}' about="#mwt2"></pre>
16970 !! end
16972 !! test
16973 Parser hook: nested tags
16974 !! wikitext
16975 <tag><tag></tag></tag>
16976 !! html/php
16977 <pre>
16978 '<tag>'
16979 array (
16981 </pre>&lt;/tag&gt;
16983 !! html/parsoid
16984 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":"&lt;tag>"}}' data-parsoid='{}' about="#mwt2"></pre>&lt;/tag>
16985 !! end
16987 !! test
16988 Parser hook: basic arguments
16989 !! wikitext
16990 <tag width="200" height="100" depth="50" square=""></tag>
16991 !! html/php
16992 <pre>
16994 array (
16995   'width' => '200',
16996   'height' => '100',
16997   'depth' => '50',
16998   'square' => '',
17000 </pre>
17002 !! html/parsoid
17003 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{"width":"200","height":"100","depth":"50","square":""},"body":{"extsrc":""}}' data-parsoid='{}' about="#mwt2"></pre>
17004 !! end
17006 ## Don't expect parsoid to rt this form.
17007 !! test
17008 Parser hook: basic arguments, variations
17009 !! options
17010 parsoid=wt2html,html2html
17011 !! wikitext
17012 <tag width=200 height = "100" depth = '50' square></tag>
17013 !! html/php
17014 <pre>
17016 array (
17017   'width' => '200',
17018   'height' => '100',
17019   'depth' => '50',
17020   'square' => '',
17022 </pre>
17024 !! html/parsoid
17025 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{"width":"200","height":"100","depth":"50","square":""},"body":{"extsrc":""}}' data-parsoid='{}' about="#mwt2"></pre>
17026 !! end
17028 !! test
17029 Parser hook: argument containing a forward slash (bug 5344)
17030 !! wikitext
17031 <tag filename="/tmp/bla"></tag>
17032 !! html/php
17033 <pre>
17035 array (
17036   'filename' => '/tmp/bla',
17038 </pre>
17040 !! html/parsoid
17041 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{"filename":"/tmp/bla"},"body":{"extsrc":""}}' data-parsoid='{}' about="#mwt2"></pre>
17042 !! end
17044 ## Don't expect parsoid to rt this form.
17045 !! test
17046 Parser hook: empty input using terminated empty elements (bug 2374)
17047 !! options
17048 parsoid=wt2html,html2html
17049 !! wikitext
17050 <tag foo=bar/>text
17051 !! html/php
17052 <pre>
17053 NULL
17054 array (
17055   'foo' => 'bar',
17057 </pre>text
17059 !! html/parsoid
17060 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{"foo":"bar"},"body":null}' data-parsoid='{}' about="#mwt2"></pre>text
17061 !! end
17063 ## </tag> should be output literally since there is no matching tag that begins it
17064 ## Don't expect parsoid to rt this form.
17065 !! test
17066 Parser hook: basic arguments using terminated empty elements (bug 2374)
17067 !! options
17068 parsoid=wt2html
17069 !! wikitext
17070 <tag width=200 height = "100" depth = '50' square/>
17071 other stuff
17072 </tag>
17073 !! html/php
17074 <pre>
17075 NULL
17076 array (
17077   'width' => '200',
17078   'height' => '100',
17079   'depth' => '50',
17080   'square' => '',
17082 </pre>
17083 <p>other stuff
17084 &lt;/tag&gt;
17085 </p>
17086 !! html/parsoid
17087 <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
17088 &lt;/tag></p>
17089 !! end
17091 ## Don't expect parsoid to rt this form.
17092 !! test
17093 Parser hook: Don't allow unclosed extension tags
17094 !! options
17095 parsoid=wt2html
17096 !! wikitext
17097 test <tag>123
17099 this is a '''test'''
17100 !! html/php
17101 <p>test &lt;tag&gt;123
17102 </p><p>this is a <b>test</b>
17103 </p>
17104 !! html/parsoid
17105 <p>test &lt;tag>123</p>
17107 <p>this is a <b>test</b></p>
17108 !! end
17111 ### (see tests/parser/parserTestsParserHook.php for the <statictag> extension)
17114 !! test
17115 Parser hook: static parser hook not inside a comment
17116 !! wikitext
17117 <statictag>hello, world</statictag>
17119 <statictag action="flush" />
17120 !! html/php
17121 <p><br />
17122 hello, world
17123 </p>
17124 !! html/parsoid
17125 <p><span typeof="mw:Extension/statictag" data-mw='{"name":"statictag","attrs":{},"body":{"extsrc":"hello, world"}}' data-parsoid='{}' about="#mwt2"></span></p>
17126 <p typeof="mw:Extension/statictag" data-mw='{"name":"statictag","attrs":{"action":"flush"},"body":null}' data-parsoid='{}' about="#mwt4">hello, world</p>
17127 !! end
17129 !! test
17130 Parser hook: static parser hook inside a comment
17131 !! wikitext
17132 <!-- <statictag>hello, world</statictag> -->
17133 <statictag action="flush" />
17134 !! html/php
17135 <p><br />
17136 </p>
17137 !! html/parsoid
17138 <!-- <statictag&#x3E;hello, world</statictag&#x3E; -->
17139 <p typeof="mw:Extension/statictag" data-mw='{"name":"statictag","attrs":{"action":"flush"},"body":null}' data-parsoid='{}' about="#mwt2"></p>
17140 !! end
17142 # Nested template calls; this case was broken by Parser.php rev 1.506,
17143 # since reverted.
17145 !! article
17146 Template:One-parameter
17147 !! text
17148 (My parameter is: {{{1}}})
17149 !! endarticle
17151 !! article
17152 Template:Map-one-parameter
17153 !! text
17154 {{{{{1}}}|{{{2}}}}}
17155 !! endarticle
17157 !! test
17158 Nested template calls
17159 !! wikitext
17160 {{Map-one-parameter|One-parameter|param}}
17161 !! html
17162 <p>(My parameter is: param)
17163 </p>
17164 !! end
17168 ### Sanitizer
17171 # HTML+Tidy effectively strips out the empty tags completely
17172 # But since Parsoid doesn't it wraps the <s></s> tags in p-tags
17173 # which Tidy would have done for the PHP parser had there been content inside it.
17174 !! test
17175 Sanitizer: Closing of open tags
17176 !! wikitext
17177 <s></s><table></table>
17178 !! html
17179 <s></s><table></table>
17181 !! html/parsoid
17182 <p><s></s></p><table></table>
17183 !! end
17185 !! test
17186 Sanitizer: Closing of open but not closed tags
17187 !! wikitext
17188 <s>foo
17189 !! html
17190 <p><s>foo</s>
17191 </p>
17192 !! end
17194 !! test
17195 Sanitizer: Closing of closed but not open tags
17196 !! options
17197 parsoid=wt2html
17198 !! wikitext
17199 </s>
17200 !! html/php+tidy
17201 !! html/parsoid
17202 !! end
17204 !! test
17205 Sanitizer: Closing of closed but not open table tags
17206 !! options
17207 parsoid=wt2html
17208 !! wikitext
17209 Table not started</td></tr></table>
17210 !! html/php+tidy
17211 <p>Table not started</p>
17212 !! html/parsoid
17213 <p>Table not started</p>
17214 !! end
17216 !! test
17217 Sanitizer: Escaping of spaces, multibyte characters, colons & other stuff in id=""
17218 !! wikitext
17219 <span id="æ: v">byte</span>[[#æ: v|backlink]]
17220 !! html/php
17221 <p><span id=".C3.A6:_v">byte</span><a href="#.C3.A6:_v">backlink</a>
17222 </p>
17223 !! html/parsoid
17224 <p><span id=".C3.A6:_v" data-parsoid='{"stx":"html","a":{"id":".C3.A6:_v"},"sa":{"id":"æ: v"}}'>byte</span><a rel="mw:WikiLink" href="./Main_Page#.C3.A6:_v" data-parsoid='{"stx":"piped","a":{"href":"./Main_Page#.C3.A6:_v"},"sa":{"href":"#æ: v"}}'>backlink</a></p>
17225 !! end
17227 # In HTML5, the restrictions are that id must contain at least one character,
17228 # and must not contain any space characters.
17229 !! test
17230 Sanitizer: Validating the contents of the id attribute (bug 4515)
17231 !! options
17232 disabled
17233 !! wikitext
17234 <br id="" /><br id="a space" />
17235 !! html
17236 Something ...
17237 !! end
17239 # In HTML5, id must be unique amongst all the ids in the element's home subtree.
17240 !! test
17241 Sanitizer: Validating id attribute uniqueness (bug 4515, bug 6301)
17242 !! options
17243 disabled
17244 !! wikitext
17245 <br id="foo" /><br id="foo" />
17246 !! html
17247 Something need to be done. foo-2 ? 
17248 !! end
17250 !! test
17251 Sanitizer: Validating that <meta> and <link> work, but only for Microdata
17252 !! wikitext
17253 <div itemscope>
17254         <meta itemprop="hello" content="world">
17255         <meta http-equiv="refresh" content="5">
17256         <meta itemprop="hello" http-equiv="refresh" content="5">
17257         <link itemprop="hello" href="{{SERVER}}">
17258         <link rel="stylesheet" href="{{SERVER}}">
17259         <link rel="stylesheet" itemprop="hello" href="{{SERVER}}">
17260 </div>
17261 !! html
17262 <div itemscope="">
17263 <p>     <meta itemprop="hello" content="world" />
17264         &lt;meta http-equiv="refresh" content="5"&gt;
17265         <meta itemprop="hello" content="5" />
17266 </p>
17267         <link itemprop="hello" href="http&#58;//example.org" />
17268         &lt;link rel="stylesheet" href="<a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>"&gt;
17269         <link itemprop="hello" href="http&#58;//example.org" />
17270 </div>
17272 !! end
17274 !! test
17275 Language converter: output gets cut off unexpectedly (bug 5757)
17276 !! options
17277 language=zh
17278 !! wikitext
17279 this bit is safe: }-
17281 but if we add a conversion instance: -{zh-cn:xxx;zh-tw:yyy}-
17283 then we get cut off here: }-
17285 all additional text is vanished
17286 !! html
17287 <p>this bit is safe: }-
17288 </p><p>but if we add a conversion instance: xxx
17289 </p><p>then we get cut off here: }-
17290 </p><p>all additional text is vanished
17291 </p>
17292 !! end
17294 !! test
17295 Self closed html pairs (bug 5487)
17296 !! options
17297 !! wikitext
17298 <center><font id="bug" />Centered text</center>
17299 <div><font id="bug2" />In div text</div>
17300 !! html
17301 <center>&lt;font id="bug" /&gt;Centered text</center>
17302 <div>&lt;font id="bug2" /&gt;In div text</div>
17304 !! end
17310 !! test
17311 Punctuation: nbsp before exclamation
17312 !! wikitext
17313 C'est grave !
17314 !! html
17315 <p>C'est grave&#160;!
17316 </p>
17317 !! end
17319 !! test
17320 Punctuation: CSS !important (bug 11874)
17321 !! wikitext
17322 <div style="width:50% !important">important</div>
17323 !! html
17324 <div style="width:50% !important">important</div>
17326 !!end
17328 !! test
17329 Punctuation: CSS ! important (bug 11874; with space after)
17330 !! wikitext
17331 <div style="width:50% ! important">important</div>
17332 !! html
17333 <div style="width:50% ! important">important</div>
17335 !!end
17337 !! test
17338 HTML bullet list, closed tags (bug 5497)
17339 !! wikitext
17340 <ul>
17341 <li>One</li>
17342 <li>Two</li>
17343 </ul>
17344 !! html/php
17345 <ul>
17346 <li>One</li>
17347 <li>Two</li>
17348 </ul>
17350 !! html/parsoid
17351 <ul data-parsoid='{"stx":"html"}'>
17352 <li data-parsoid='{"stx":"html"}'>One</li>
17353 <li data-parsoid='{"stx":"html"}'>Two</li>
17354 </ul>
17356 !! end
17358 !! test
17359 HTML bullet list, unclosed tags (bug 5497)
17360 !! wikitext
17361 <ul>
17362 <li>One
17363 <li>Two
17364 </ul>
17365 !! html/php+tidy
17366 <ul>
17367 <li>One</li>
17368 <li>Two</li>
17369 </ul>
17370 !! html/parsoid
17371 <ul data-parsoid='{"stx":"html"}'>
17372 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>One</li>
17373 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>Two</li>
17374 </ul>
17376 !! end
17378 !! test
17379 HTML ordered list, closed tags (bug 5497)
17380 !! wikitext
17381 <ol>
17382 <li>One</li>
17383 <li>Two</li>
17384 </ol>
17385 !! html/php
17386 <ol>
17387 <li>One</li>
17388 <li>Two</li>
17389 </ol>
17391 !! html/parsoid
17392 <ol data-parsoid='{"stx":"html"}'>
17393 <li data-parsoid='{"stx":"html"}'>One</li>
17394 <li data-parsoid='{"stx":"html"}'>Two</li>
17395 </ol>
17397 !! end
17399 !! test
17400 HTML ordered list, unclosed tags (bug 5497)
17401 !! options
17402 !! wikitext
17403 <ol>
17404 <li>One
17405 <li>Two
17406 </ol>
17407 !! html/php+tidy
17408 <ol>
17409 <li>One</li>
17410 <li>Two</li>
17411 </ol>
17412 !! html/parsoid
17413 <ol data-parsoid='{"stx":"html"}'>
17414 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>One</li>
17415 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>Two</li>
17416 </ol>
17418 !! end
17420 !! test
17421 HTML nested bullet list, closed tags (bug 5497)
17422 !! wikitext
17423 <ul>
17424 <li>One</li>
17425 <li>Two:
17426 <ul>
17427 <li>Sub-one</li>
17428 <li>Sub-two</li>
17429 </ul>
17430 </li>
17431 </ul>
17432 !! html/php
17433 <ul>
17434 <li>One</li>
17435 <li>Two:
17436 <ul>
17437 <li>Sub-one</li>
17438 <li>Sub-two</li>
17439 </ul>
17440 </li>
17441 </ul>
17443 !! html/parsoid
17444 <ul data-parsoid='{"stx":"html"}'>
17445 <li data-parsoid='{"stx":"html"}'>One</li>
17446 <li data-parsoid='{"stx":"html"}'>Two:
17447 <ul data-parsoid='{"stx":"html"}'>
17448 <li data-parsoid='{"stx":"html"}'>Sub-one</li>
17449 <li data-parsoid='{"stx":"html"}'>Sub-two</li>
17450 </ul>
17451 </li>
17452 </ul>
17453 !! end
17455 !! test
17456 HTML nested bullet list, open tags (bug 5497)
17457 !! wikitext
17458 <ul>
17459 <li>One
17460 <li>Two:
17461 <ul>
17462 <li>Sub-one
17463 <li>Sub-two
17464 </ul>
17465 </ul>
17466 !! html/php+tidy
17467 <ul>
17468 <li>One</li>
17469 <li>Two:
17470 <ul>
17471 <li>Sub-one</li>
17472 <li>Sub-two</li>
17473 </ul>
17474 </li>
17475 </ul>
17476 !! html/parsoid
17477 <ul>
17478 <li>One
17479 </li>
17480 <li>Two:
17481 <ul>
17482 <li>Sub-one
17483 </li>
17484 <li>Sub-two
17485 </li>
17486 </ul>
17487 </li>
17488 </ul>
17490 !! end
17492 !! test
17493 HTML nested ordered list, closed tags (bug 5497)
17494 !! wikitext
17495 <ol>
17496 <li>One</li>
17497 <li>Two:
17498 <ol>
17499 <li>Sub-one</li>
17500 <li>Sub-two</li>
17501 </ol>
17502 </li>
17503 </ol>
17504 !! html
17505 <ol>
17506 <li>One</li>
17507 <li>Two:
17508 <ol>
17509 <li>Sub-one</li>
17510 <li>Sub-two</li>
17511 </ol>
17512 </li>
17513 </ol>
17515 !! end
17517 !! test
17518 HTML nested ordered list, open tags (bug 5497)
17519 !! wikitext
17520 <ol>
17521 <li>One
17522 <li>Two:
17523 <ol>
17524 <li>Sub-one
17525 <li>Sub-two
17526 </ol>
17527 </ol>
17528 !! html/php
17529 <ol>
17530 <li>One
17531 <li>Two:
17532 <ol>
17533 <li>Sub-one
17534 <li>Sub-two
17535 </ol>
17536 </ol>
17538 !! html/parsoid
17539 <ol>
17540 <li>One
17541 </li>
17542 <li>Two:
17543 <ol>
17544 <li>Sub-one
17545 </li>
17546 <li>Sub-two
17547 </li>
17548 </ol>
17549 </li>
17550 </ol>
17552 !! end
17554 !! test
17555 HTML ordered list item with parameters oddity
17556 !! wikitext
17557 <ol><li id="fragment">One</li>
17558 </ol>
17559 !! html
17560 <ol><li id="fragment">One</li>
17561 </ol>
17563 !! end
17565 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
17566 !!test
17567 bug 5918: autonumbering
17568 !! wikitext
17569 [http://first/] [http://second] [ftp://ftp]
17571 ftp://inlineftp
17573 [mailto:enclosed@mail.tld With target]
17575 [mailto:enclosed@mail.tld]
17577 mailto:inline@mail.tld
17578 !! html/php
17579 <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>
17580 </p><p><a rel="nofollow" class="external free" href="ftp://inlineftp">ftp://inlineftp</a>
17581 </p><p><a rel="nofollow" class="external text" href="mailto:enclosed@mail.tld">With target</a>
17582 </p><p><a rel="nofollow" class="external autonumber" href="mailto:enclosed@mail.tld">[4]</a>
17583 </p><p><a rel="nofollow" class="external free" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a>
17584 </p>
17585 !! html/parsoid
17586 <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>
17587 <p><a rel="mw:ExtLink" href="ftp://inlineftp">ftp://inlineftp</a></p>
17588 <p><a rel="mw:ExtLink" href="mailto:enclosed@mail.tld">With target</a></p>
17589 <p><a rel="mw:ExtLink" href="mailto:enclosed@mail.tld"></a></p>
17590 <p><a rel="mw:ExtLink" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a></p>
17591 !! end
17595 # Security and HTML correctness
17596 # From Nick Jenkins' fuzz testing
17599 !! test
17600 Fuzz testing: Parser13
17601 !! wikitext
17602 {| 
17603 | http://a|
17604 !! html
17605 <table>
17606 <tr>
17607 <td>
17608 </td>
17609 </tr>
17610 </table>
17612 !! end
17614 !! test
17615 Fuzz testing: Parser14
17616 !! wikitext
17617 == onmouseover= ==
17618 http://__TOC__
17619 !! html
17620 <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>
17621 http://<div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
17622 <ul>
17623 <li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
17624 </ul>
17625 </div>
17628 !! html+tidy
17629 <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>
17630 <p>http://</p>
17631 <div id="toc" class="toc">
17632 <div id="toctitle">
17633 <h2>Contents</h2>
17634 </div>
17635 <ul>
17636 <li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
17637 </ul>
17638 </div>
17639 <p></p>
17640 !! end
17642 !! test
17643 Fuzz testing: Parser14-table
17644 !! options
17645 parsoid=wt2html,html2html
17646 !! wikitext
17647 ==a==
17648 {| STYLE=__TOC__
17649 !! html
17650 <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>
17651 <table style="&#95;_TOC&#95;_">
17652 <tr><td></td></tr>
17653 </table>
17655 !! html+tidy
17656 <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>
17657 <table style="__TOC__">
17658 <tr>
17659 <td></td>
17660 </tr>
17661 </table>
17662 !! html/parsoid
17663 <h2>a</h2>
17664 <table style="__TOC__"></table>
17665 !! end
17667 # Known to produce bogus xml (extra </td>)
17668 !! test
17669 Fuzz testing: Parser16
17670 !! wikitext
17672 !https://||||||
17673 !! html
17674 <table>
17675 <tr>
17676 <th>https://</th>
17677 <th></th>
17678 <th></th>
17679 <th>
17680 </td>
17681 </tr>
17682 </table>
17684 !! html+tidy
17685 <table>
17686 <tr>
17687 <th>https://</th>
17688 <th></th>
17689 <th></th>
17690 <th></th>
17691 </tr>
17692 </table>
17693 !! end
17695 !! test
17696 Fuzz testing: Parser21
17697 !! wikitext
17699 ! irc://{{ftp://a" onmouseover="alert('hello world');"
17701 !! html
17702 <table>
17703 <tr>
17704 <th> <a rel="nofollow" class="external free" href="irc://{{ftp://a">irc://{{ftp://a</a>" onmouseover="alert('hello world');"
17705 </th>
17706 <td>
17707 </td>
17708 </tr>
17709 </table>
17711 !! end
17713 !! test
17714 Fuzz testing: Parser22
17715 !! wikitext
17716 http://===r:::https://b
17719 !! html
17720 <p><a rel="nofollow" class="external free" href="http://===r:::https://b">http://===r:::https://b</a>
17721 </p>
17722 <table>
17723 <tr><td></td></tr>
17724 </table>
17726 !! end
17728 # Known to produce bad XML for now
17729 !! test
17730 Fuzz testing: Parser24
17731 !! options
17732 parsoid=wt2html
17733 !! wikitext
17735 {{{|
17736 <u CLASS=
17737 | {{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx--><noinclude>}}}} >
17738 <br style="onmouseover='alert(document.cookie);' " />
17740 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
17742 !! html/php
17743 <table>
17744 {{{|
17745 <u class="&#124;">}}}} &gt;
17746 <br style="onmouseover=&#39;alert(document.cookie);&#39;" />
17748 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
17749 <tr>
17750 <td></u>
17751 </td>
17752 </tr>
17753 </table>
17755 !! html/parsoid
17756 <p data-parsoid='{"fostered":true,"autoInsertedEnd":true}'>{{{|
17757 <u class="|" about="#mwt2" typeof="mw:ExpandedAttrs" data-parsoid='{"stx":"html","a":{"{{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx-->&lt;noinclude>}}}}":null},"sa":{"{{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx-->&lt;noinclude>}}}}":""},"autoInsertedEnd":true}' data-mw='{"attribs":[[{"txt":"{{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx-->}}}}","html":"{&lt;span about=\"#mwt1\" typeof=\"mw:Param\" data-parsoid=&#39;{\"pi\":[[]],\"dsr\":[21,79,null,null]}&#39; data-mw=&#39;{\"parts\":[{\"templatearg\":{\"target\":{\"wt\":\"SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx-->&amp;lt;noinclude>\"},\"params\":{},\"i\":0}}]}&#39;>{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx-->}}}&lt;/span>}"},{"html":""}]]}'>
17758 <br style="onmouseover='alert(document.cookie);' " data-parsoid='{"stx":"html","selfClose":true}'/></u></p><p data-parsoid='{"fostered":true,"autoInsertedEnd":true}'><u class="|" about="#mwt2" typeof="mw:ExpandedAttrs" data-parsoid='{"stx":"html","a":{"{{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx-->&lt;noinclude>}}}}":null},"sa":{"{{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx-->&lt;noinclude>}}}}":""},"autoInsertedEnd":true,"autoInsertedStart":true}' data-mw='{"attribs":[[{"txt":"{{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx-->}}}}","html":"{&lt;span about=\"#mwt1\" typeof=\"mw:Param\" data-parsoid=&#39;{\"pi\":[[]],\"dsr\":[21,79,null,null]}&#39; data-mw=&#39;{\"parts\":[{\"templatearg\":{\"target\":{\"wt\":\"SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx-->&amp;lt;noinclude>\"},\"params\":{},\"i\":0}}]}&#39;>{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx-->}}}&lt;/span>}"},{"html":""}]]}'>MOVE YOUR MOUSE CURSOR OVER THIS TEXT</u></p><table data-parsoid='{"autoInsertedEnd":true}'>
17762 <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'></td></tr></tbody></table>
17763 !! end
17765 # Note: the current result listed for this is not what the original one was,
17766 # but the original bug was JavaScript injection, which is fixed in any case.
17767 # It's not clear that the original result listed was any more correct than the
17768 # current one.  Original result:
17769 # <p>{{{| 
17770 # </p>
17771 # <li class="&#124;&#124;">
17772 # }}}blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
17773 !!test
17774 Fuzz testing: Parser25 (bug 6055)
17775 !! wikitext
17778 <LI CLASS=||
17780 }}}blah" onmouseover="alert('hello world');" align="left"'''MOVE MOUSE CURSOR OVER HERE
17781 !! html/php
17782 <p>&lt;LI CLASS=blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
17783 </p>
17784 !! html/parsoid
17785 <span about="#mwt1" typeof="mw:Param" data-parsoid='{"pi":[[{"k":"1"},{"k":"2"},{"k":"3"}]]}' data-mw='{"parts":[{"templatearg":{"target":{"wt":"\n"},"params":{"1":{"wt":" \n&lt;LI CLASS="},"2":{"wt":""},"3":{"wt":"\n >\n"}},"i":0}},"blah\" onmouseover=\"alert(&#39;hello world&#39;);\" align=\"left\"&#39;&#39;&#39;MOVE MOUSE CURSOR OVER HERE"]}'> 
17786 </span><p about="#mwt1">&lt;LI CLASS=blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b></p>
17787 !! end
17789 !!test
17790 Fuzz testing: URL adjacent extension (with space, clean)
17791 !! wikitext
17792 http://example.com <nowiki>junk</nowiki>
17793 !! html/php
17794 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a> junk
17795 </p>
17796 !! html/parsoid
17797 <p><a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a> <span typeof="mw:Nowiki">junk</span></p>
17798 !! end
17800 !!test
17801 Fuzz testing: URL adjacent extension (no space, dirty; nowiki)
17802 !! wikitext
17803 http://example.com<nowiki>junk</nowiki>
17804 !! html/php
17805 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>junk
17806 </p>
17807 !! html/parsoid
17808 <p><a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a><span typeof="mw:Nowiki">junk</span></p>
17809 !! end
17811 !!test
17812 Fuzz testing: URL adjacent extension (no space, dirty; pre)
17813 !! wikitext
17814 http://example.com<pre>junk</pre>
17815 !! html/php
17816 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a><pre>junk</pre>
17818 !! html/php+tidy
17819 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a></p>
17820 <pre>
17821 junk
17822 </pre>
17823 !! html/parsoid
17824 <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>
17825 !!end
17827 !!test
17828 Fuzz testing: image with bogus manual thumbnail
17829 !! wikitext
17830 [[Image:foobar.jpg|thumbnail= ]]
17831 !! html/php
17832 <div class="thumb tright"><div class="thumbinner" style="width:182px;">Error creating thumbnail:   <div class="thumbcaption"></div></div></div>
17834 !! html/parsoid
17835 <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>
17836 !!end
17838 !! test
17839 Fuzz testing: encoded newline in generated HTML replacements (bug 6577)
17840 !! wikitext
17841 <pre dir="&#10;"></pre>
17842 !! html
17843 <pre dir="&#10;"></pre>
17845 !! end
17847 !! test
17848 Parsing optional HTML elements (Bug 6171)
17849 !! options
17850 !! wikitext
17851 <table>
17852   <tr>
17853     <td> Some tabular data</td>
17854     <td> More tabular data ...
17855     <td> And yet som tabular data</td>
17856   </tr>
17857 </table>
17858 !! html
17859 <table>
17860   <tr>
17861     <td> Some tabular data</td>
17862     <td> More tabular data ...
17863     </td><td> And yet som tabular data</td>
17864   </tr>
17865 </table>
17867 !! end
17869 !! test
17870 Correct handling of <td>, <tr> (Bug 6171)
17871 !! options
17872 !! wikitext
17873 <table>
17874   <tr>
17875     <td> Some tabular data</td>
17876     <td> More tabular data ...</td>
17877     <td> And yet som tabular data</td>
17878   </tr>
17879 </table>
17880 !! html
17881 <table>
17882   <tr>
17883     <td> Some tabular data</td>
17884     <td> More tabular data ...</td>
17885     <td> And yet som tabular data</td>
17886   </tr>
17887 </table>
17889 !! end
17892 !! test
17893 Parsing crashing regression (fr:JavaScript)
17894 !! wikitext
17895 </body></x>
17896 !! html
17897 <p>&lt;/body&gt;&lt;/x&gt;
17898 </p>
17899 !! end
17901 !! test
17902 Inline wiki vs wiki block nesting
17903 !! wikitext
17904 '''Bold paragraph
17906 New wiki paragraph
17907 !! html
17908 <p><b>Bold paragraph</b>
17909 </p><p>New wiki paragraph
17910 </p>
17911 !! end
17913 # FIXME: The current php output is documented
17914 # and desired output is the parsoid target.
17915 !! test
17916 Inline HTML vs wiki block nesting
17917 !! wikitext
17918 <b>Bold paragraph
17920 New wiki paragraph
17921 !! html/php
17922 <p><b>Bold paragraph
17923 </p><p>New wiki paragraph</b>
17924 </p>
17925 !! html/parsoid
17926 <p><b>Bold paragraph</b>
17927 </p><p>New wiki paragraph
17928 </p>
17929 !! end
17931 # Original result was this:
17932 # <p><b>bold</b><b>bold<i>bolditalics</i></b>
17933 # </p>
17934 # While that might be marginally more intuitive, maybe, the six-apostrophe
17935 # construct is clearly pathological and the result stated here (which is what
17936 # the parser actually does) is about as reasonable as anything.
17937 !!test
17938 Mixing markup for italics and bold
17939 !! options
17940 !! wikitext
17941 '''bold''''''bold''bolditalics'''''
17942 !! html
17943 <p>'<i>bold'</i><b>bold<i>bolditalics</i></b>
17944 </p>
17945 !! end
17948 !! article
17949 Xyzzyx
17950 !! text
17951 Article for special page transclusion test
17952 !! endarticle
17954 !! test
17955 Special page transclusion
17956 !! options
17957 !! wikitext
17958 {{Special:Prefixindex/Xyzzyx}}
17959 !! html
17960 <ul class="mw-prefixindex-list"><li><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></li>
17961 </ul>
17963 !! end
17965 !! test
17966 Special page transclusion twice (bug 5021)
17967 !! options
17968 !! wikitext
17969 {{Special:Prefixindex/Xyzzyx}}
17970 {{Special:Prefixindex/Xyzzyx}}
17971 !! html
17972 <ul class="mw-prefixindex-list"><li><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></li>
17973 </ul>
17974 <ul class="mw-prefixindex-list"><li><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></li>
17975 </ul>
17977 !! end
17979 !! test
17980 Transclusion of default MediaWiki message
17981 !! wikitext
17982 {{MediaWiki:Mainpage}}
17983 !! html
17984 <p>Main Page
17985 </p>
17986 !! end
17988 !! test
17989 Transclusion of nonexistent MediaWiki message
17990 !! wikitext
17991 {{MediaWiki:Mainpagexxx}}
17992 !! html
17993 <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>
17994 </p>
17995 !! end
17997 !! test
17998 Transclusion of MediaWiki message with underscore
17999 !! wikitext
18000 {{MediaWiki:history_short}}
18001 !! html
18002 <p>History
18003 </p>
18004 !! end
18006 !! test
18007 Transclusion of MediaWiki message with space
18008 !! wikitext
18009 {{MediaWiki:history short}}
18010 !! html
18011 <p>History
18012 </p>
18013 !! end
18015 !! test
18016 Invalid header with following text
18017 !! wikitext
18018 = x = y
18019 !! html
18020 <p>= x = y
18021 </p>
18022 !! end
18025 !! test
18026 Section extraction test (section 0)
18027 !! options
18028 section=0
18029 !! wikitext
18030 start
18031 ==a==
18032 ===aa===
18033 ====aaa====
18034 ==b==
18035 ===ba===
18036 ===bb===
18037 ====bba====
18038 ===bc===
18039 ==c==
18040 ===ca===
18041 !! html/php
18042 start
18043 !! end
18045 !! test
18046 Section extraction test (section 1)
18047 !! options
18048 section=1
18049 !! wikitext
18050 start
18051 ==a==
18052 ===aa===
18053 ====aaa====
18054 ==b==
18055 ===ba===
18056 ===bb===
18057 ====bba====
18058 ===bc===
18059 ==c==
18060 ===ca===
18061 !! html/php
18062 ==a==
18063 ===aa===
18064 ====aaa====
18065 !! end
18067 !! test
18068 Section extraction test (section 2)
18069 !! options
18070 section=2
18071 !! wikitext
18072 start
18073 ==a==
18074 ===aa===
18075 ====aaa====
18076 ==b==
18077 ===ba===
18078 ===bb===
18079 ====bba====
18080 ===bc===
18081 ==c==
18082 ===ca===
18083 !! html/php
18084 ===aa===
18085 ====aaa====
18086 !! end
18088 !! test
18089 Section extraction test (section 3)
18090 !! options
18091 section=3
18092 !! wikitext
18093 start
18094 ==a==
18095 ===aa===
18096 ====aaa====
18097 ==b==
18098 ===ba===
18099 ===bb===
18100 ====bba====
18101 ===bc===
18102 ==c==
18103 ===ca===
18104 !! html/php
18105 ====aaa====
18106 !! end
18108 !! test
18109 Section extraction test (section 4)
18110 !! options
18111 section=4
18112 !! wikitext
18113 start
18114 ==a==
18115 ===aa===
18116 ====aaa====
18117 ==b==
18118 ===ba===
18119 ===bb===
18120 ====bba====
18121 ===bc===
18122 ==c==
18123 ===ca===
18124 !! html/php
18125 ==b==
18126 ===ba===
18127 ===bb===
18128 ====bba====
18129 ===bc===
18130 !! end
18132 !! test
18133 Section extraction test (section 5)
18134 !! options
18135 section=5
18136 !! wikitext
18137 start
18138 ==a==
18139 ===aa===
18140 ====aaa====
18141 ==b==
18142 ===ba===
18143 ===bb===
18144 ====bba====
18145 ===bc===
18146 ==c==
18147 ===ca===
18148 !! html/php
18149 ===ba===
18150 !! end
18152 !! test
18153 Section extraction test (section 6)
18154 !! options
18155 section=6
18156 !! wikitext
18157 start
18158 ==a==
18159 ===aa===
18160 ====aaa====
18161 ==b==
18162 ===ba===
18163 ===bb===
18164 ====bba====
18165 ===bc===
18166 ==c==
18167 ===ca===
18168 !! html/php
18169 ===bb===
18170 ====bba====
18171 !! end
18173 !! test
18174 Section extraction test (section 7)
18175 !! options
18176 section=7
18177 !! wikitext
18178 start
18179 ==a==
18180 ===aa===
18181 ====aaa====
18182 ==b==
18183 ===ba===
18184 ===bb===
18185 ====bba====
18186 ===bc===
18187 ==c==
18188 ===ca===
18189 !! html/php
18190 ====bba====
18191 !! end
18193 !! test
18194 Section extraction test (section 8)
18195 !! options
18196 section=8
18197 !! wikitext
18198 start
18199 ==a==
18200 ===aa===
18201 ====aaa====
18202 ==b==
18203 ===ba===
18204 ===bb===
18205 ====bba====
18206 ===bc===
18207 ==c==
18208 ===ca===
18209 !! html/php
18210 ===bc===
18211 !! end
18213 !! test
18214 Section extraction test (section 9)
18215 !! options
18216 section=9
18217 !! wikitext
18218 start
18219 ==a==
18220 ===aa===
18221 ====aaa====
18222 ==b==
18223 ===ba===
18224 ===bb===
18225 ====bba====
18226 ===bc===
18227 ==c==
18228 ===ca===
18229 !! html/php
18230 ==c==
18231 ===ca===
18232 !! end
18234 !! test
18235 Section extraction test (section 10)
18236 !! options
18237 section=10
18238 !! wikitext
18239 start
18240 ==a==
18241 ===aa===
18242 ====aaa====
18243 ==b==
18244 ===ba===
18245 ===bb===
18246 ====bba====
18247 ===bc===
18248 ==c==
18249 ===ca===
18250 !! html/php
18251 ===ca===
18252 !! end
18254 !! test
18255 Section extraction test (nonexistent section 11)
18256 !! options
18257 section=11
18258 !! wikitext
18259 start
18260 ==a==
18261 ===aa===
18262 ====aaa====
18263 ==b==
18264 ===ba===
18265 ===bb===
18266 ====bba====
18267 ===bc===
18268 ==c==
18269 ===ca===
18270 !! html/php
18271 !! end
18273 !! test
18274 Section extraction test with bogus heading (section 1)
18275 !! options
18276 section=1
18277 !! wikitext
18278 ==a==
18279 ==bogus== not a legal section
18280 ==b==
18281 !! html/php
18282 ==a==
18283 ==bogus== not a legal section
18284 !! end
18286 !! test
18287 Section extraction test with bogus heading (section 2)
18288 !! options
18289 section=2
18290 !! wikitext
18291 ==a==
18292 ==bogus== not a legal section
18293 ==b==
18294 !! html/php
18295 ==b==
18296 !! end
18298 !! test
18299 Section extraction test with comment after heading (section 1)
18300 !! options
18301 section=1
18302 !! wikitext
18303 ==a==
18304 ==b== <!-- -->
18305 ==c==
18306 !! html/php
18307 ==a==
18308 !! end
18310 !! test
18311 Section extraction test with comment after heading (section 2)
18312 !! options
18313 section=2
18314 !! wikitext
18315 ==a==
18316 ==b== <!-- -->
18317 ==c==
18318 !! html/php
18319 ==b== <!-- -->
18320 !! end
18322 !! test
18323 Section extraction test with bogus <nowiki> heading (section 1)
18324 !! options
18325 section=1
18326 !! wikitext
18327 ==a==
18328 ==bogus== <nowiki>not a legal section</nowiki>
18329 ==b==
18330 !! html/php
18331 ==a==
18332 ==bogus== <nowiki>not a legal section</nowiki>
18333 !! end
18335 !! test
18336 Section extraction test with bogus <nowiki> heading (section 2)
18337 !! options
18338 section=2
18339 !! wikitext
18340 ==a==
18341 ==bogus== <nowiki>not a legal section</nowiki>
18342 ==b==
18343 !! html/php
18344 ==b==
18345 !! end
18347 # Formerly testing for bug 2587, now resolved by the use of unmarked sections
18348 # instead of respecting commented sections
18349 !! test
18350 Section extraction prefixed by comment (section 1)
18351 !! options
18352 section=1
18353 !! wikitext
18354 <!-- -->==sec1==
18355 ==sec2==
18356 !! html/php
18357 ==sec2==
18358 !!end
18360 !! test
18361 Section extraction prefixed by comment (section 2)
18362 !! options
18363 section=2
18364 !! wikitext
18365 <!-- -->==sec1==
18366 ==sec2==
18367 !! html/php
18369 !!end
18371 # Formerly testing for bug 2607, now resolved by the use of unmarked sections
18372 # instead of respecting HTML-style headings
18373 !! test
18374 Section extraction, mixed wiki and html (section 1)
18375 !! options
18376 section=1
18377 !! wikitext
18378 <h2>unmarked</h2>
18379 unmarked
18380 ==1==
18382 ==2==
18384 !! html/php
18385 ==1==
18387 !! end
18389 !! test
18390 Section extraction, mixed wiki and html (section 2)
18391 !! options
18392 section=2
18393 !! wikitext
18394 <h2>unmarked</h2>
18395 unmarked
18396 ==1==
18398 ==2==
18400 !! html/php
18401 ==2==
18403 !! end
18406 # Formerly testing for bug 3342
18407 !! test
18408 Section extraction, heading surrounded by <noinclude>
18409 !! options
18410 section=1
18411 !! wikitext
18412 <noinclude>==unmarked==</noinclude>
18413 ==marked==
18414 !! html/php
18415 ==marked==
18416 !!end
18418 # Test behavior of bug 19910
18419 !! test
18420 Sectiion with all-equals
18421 !! options
18422 section=2
18423 !! wikitext
18424 === 
18425 The line above must have a trailing space
18426 === <!--
18427 --> <!-- -->
18428 But just in case it doesn't...
18429 !! html/php
18430 === <!--
18431 --> <!-- -->
18432 But just in case it doesn't...
18433 !! end
18435 !! test
18436 Section replacement test (section 0)
18437 !! options
18438 replace=0,"xxx"
18439 !! wikitext
18440 start
18441 ==a==
18442 ===aa===
18443 ====aaa====
18444 ==b==
18445 ===ba===
18446 ===bb===
18447 ====bba====
18448 ===bc===
18449 ==c==
18450 ===ca===
18451 !! html/php
18454 ==a==
18455 ===aa===
18456 ====aaa====
18457 ==b==
18458 ===ba===
18459 ===bb===
18460 ====bba====
18461 ===bc===
18462 ==c==
18463 ===ca===
18464 !! end
18466 !! test
18467 Section replacement test (section 1)
18468 !! options
18469 replace=1,"xxx"
18470 !! wikitext
18471 start
18472 ==a==
18473 ===aa===
18474 ====aaa====
18475 ==b==
18476 ===ba===
18477 ===bb===
18478 ====bba====
18479 ===bc===
18480 ==c==
18481 ===ca===
18482 !! html/php
18483 start
18486 ==b==
18487 ===ba===
18488 ===bb===
18489 ====bba====
18490 ===bc===
18491 ==c==
18492 ===ca===
18493 !! end
18495 !! test
18496 Section replacement test (section 2)
18497 !! options
18498 replace=2,"xxx"
18499 !! wikitext
18500 start
18501 ==a==
18502 ===aa===
18503 ====aaa====
18504 ==b==
18505 ===ba===
18506 ===bb===
18507 ====bba====
18508 ===bc===
18509 ==c==
18510 ===ca===
18511 !! html/php
18512 start
18513 ==a==
18516 ==b==
18517 ===ba===
18518 ===bb===
18519 ====bba====
18520 ===bc===
18521 ==c==
18522 ===ca===
18523 !! end
18525 !! test
18526 Section replacement test (section 3)
18527 !! options
18528 replace=3,"xxx"
18529 !! wikitext
18530 start
18531 ==a==
18532 ===aa===
18533 ====aaa====
18534 ==b==
18535 ===ba===
18536 ===bb===
18537 ====bba====
18538 ===bc===
18539 ==c==
18540 ===ca===
18541 !! html/php
18542 start
18543 ==a==
18544 ===aa===
18547 ==b==
18548 ===ba===
18549 ===bb===
18550 ====bba====
18551 ===bc===
18552 ==c==
18553 ===ca===
18554 !! end
18556 !! test
18557 Section replacement test (section 4)
18558 !! options
18559 replace=4,"xxx"
18560 !! wikitext
18561 start
18562 ==a==
18563 ===aa===
18564 ====aaa====
18565 ==b==
18566 ===ba===
18567 ===bb===
18568 ====bba====
18569 ===bc===
18570 ==c==
18571 ===ca===
18572 !! html/php
18573 start
18574 ==a==
18575 ===aa===
18576 ====aaa====
18579 ==c==
18580 ===ca===
18581 !! end
18583 !! test
18584 Section replacement test (section 5)
18585 !! options
18586 replace=5,"xxx"
18587 !! wikitext
18588 start
18589 ==a==
18590 ===aa===
18591 ====aaa====
18592 ==b==
18593 ===ba===
18594 ===bb===
18595 ====bba====
18596 ===bc===
18597 ==c==
18598 ===ca===
18599 !! html/php
18600 start
18601 ==a==
18602 ===aa===
18603 ====aaa====
18604 ==b==
18607 ===bb===
18608 ====bba====
18609 ===bc===
18610 ==c==
18611 ===ca===
18612 !! end
18614 !! test
18615 Section replacement test (section 6)
18616 !! options
18617 replace=6,"xxx"
18618 !! wikitext
18619 start
18620 ==a==
18621 ===aa===
18622 ====aaa====
18623 ==b==
18624 ===ba===
18625 ===bb===
18626 ====bba====
18627 ===bc===
18628 ==c==
18629 ===ca===
18630 !! html/php
18631 start
18632 ==a==
18633 ===aa===
18634 ====aaa====
18635 ==b==
18636 ===ba===
18639 ===bc===
18640 ==c==
18641 ===ca===
18642 !! end
18644 !! test
18645 Section replacement test (section 7)
18646 !! options
18647 replace=7,"xxx"
18648 !! wikitext
18649 start
18650 ==a==
18651 ===aa===
18652 ====aaa====
18653 ==b==
18654 ===ba===
18655 ===bb===
18656 ====bba====
18657 ===bc===
18658 ==c==
18659 ===ca===
18660 !! html/php
18661 start
18662 ==a==
18663 ===aa===
18664 ====aaa====
18665 ==b==
18666 ===ba===
18667 ===bb===
18670 ===bc===
18671 ==c==
18672 ===ca===
18673 !! end
18675 !! test
18676 Section replacement test (section 8)
18677 !! options
18678 replace=8,"xxx"
18679 !! wikitext
18680 start
18681 ==a==
18682 ===aa===
18683 ====aaa====
18684 ==b==
18685 ===ba===
18686 ===bb===
18687 ====bba====
18688 ===bc===
18689 ==c==
18690 ===ca===
18691 !! html/php
18692 start
18693 ==a==
18694 ===aa===
18695 ====aaa====
18696 ==b==
18697 ===ba===
18698 ===bb===
18699 ====bba====
18702 ==c==
18703 ===ca===
18704 !!end
18706 !! test
18707 Section replacement test (section 9)
18708 !! options
18709 replace=9,"xxx"
18710 !! wikitext
18711 start
18712 ==a==
18713 ===aa===
18714 ====aaa====
18715 ==b==
18716 ===ba===
18717 ===bb===
18718 ====bba====
18719 ===bc===
18720 ==c==
18721 ===ca===
18722 !! html/php
18723 start
18724 ==a==
18725 ===aa===
18726 ====aaa====
18727 ==b==
18728 ===ba===
18729 ===bb===
18730 ====bba====
18731 ===bc===
18733 !! end
18735 !! test
18736 Section replacement test (section 10)
18737 !! options
18738 replace=10,"xxx"
18739 !! wikitext
18740 start
18741 ==a==
18742 ===aa===
18743 ====aaa====
18744 ==b==
18745 ===ba===
18746 ===bb===
18747 ====bba====
18748 ===bc===
18749 ==c==
18750 ===ca===
18751 !! html/php
18752 start
18753 ==a==
18754 ===aa===
18755 ====aaa====
18756 ==b==
18757 ===ba===
18758 ===bb===
18759 ====bba====
18760 ===bc===
18761 ==c==
18763 !! end
18765 !! test
18766 Section replacement test with initial whitespace (bug 13728)
18767 !! options
18768 replace=2,"xxx"
18769 !! wikitext
18770  Preformatted initial line
18771 ==a==
18772 ===a===
18773 !! html/php
18774  Preformatted initial line
18775 ==a==
18777 !! end
18780 !! test
18781 Section extraction, heading followed by pre with 20 spaces (bug 6398)
18782 !! options
18783 section=1
18784 !! wikitext
18785 ==a==
18786                     a
18787 !! html/php
18788 ==a==
18789                     a
18790 !! end
18792 !! test
18793 Section extraction, heading followed by pre with 19 spaces (bug 6398 sanity check)
18794 !! options
18795 section=1
18796 !! wikitext
18797 ==a==
18798                    a
18799 !! html/php
18800 ==a==
18801                    a
18802 !! end
18805 !! test
18806 Section extraction, <pre> around bogus header (bug 10309)
18807 !! options
18808 section=2
18809 !! wikitext
18810 == Section One ==
18811 <pre>
18812 =======
18813 </pre>
18815 == Section Two ==
18816 stuff
18817 !! html/php
18818 == Section Two ==
18819 stuff
18820 !! end
18822 !! test
18823 Section replacement, <pre> around bogus header (bug 10309)
18824 !! options
18825 replace=2,"xxx"
18826 !! wikitext
18827 == Section One ==
18828 <pre>
18829 =======
18830 </pre>
18832 == Section Two ==
18833 stuff
18834 !! html/php
18835 == Section One ==
18836 <pre>
18837 =======
18838 </pre>
18841 !! end
18844 !! test
18845 Handling of &#x0A; in URLs
18846 !! wikitext
18847 ** irc://&#x0A;a
18848 !! html/php
18849 <ul><li><ul><li> <a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a></li></ul></li></ul>
18851 !! html/parsoid
18852 <ul><li><ul><li> <a rel="mw:ExtLink" href="irc://
18853 a">irc://
18854 a</a></li></ul></li></ul>
18855 !! end
18857 !! test
18858 Handling of %0A in URLs
18859 !! wikitext
18860 ** irc://%0Aa
18861 !! html/php
18862 <ul><li><ul><li> <a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a></li></ul></li></ul>
18864 !! html/parsoid
18865 <ul><li><ul><li> <a rel="mw:ExtLink" href="irc://%0Aa">irc://%0Aa</a></li></ul></li></ul>
18866 !! end
18869 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
18870 !! test
18871 5 quotes, code coverage +1 line
18872 !! options
18873 parsoid=wt2html
18874 !! wikitext
18875 '''''
18876 !! html/php
18877 !! html/parsoid
18878 <p><b><i></i></b></p>
18879 !! end
18881 # same html as previous, but wikitext adjusted to match parsoid html2wt
18882 # note that wt2html and html2html will put the <i> before the <b>
18883 !! test
18884 5 quotes, code coverage +1 line w/ nowiki (1)
18885 !! options
18886 parsoid=wt2wt,html2wt
18887 !! wikitext
18888 '''''<nowiki/>'''''
18889 !! html/php
18890 <p><i></i>
18891 </p>
18892 !! html/parsoid
18893 <p><b><i></i></b></p>
18894 !! end
18896 # same as previous, just swapping the <i> and <b>
18897 !! test
18898 5 quotes, code coverage +1 line w/ nowiki (2)
18899 !! wikitext
18900 '''''<nowiki/>'''''
18901 !! html/php
18902 <p><i></i>
18903 </p>
18904 !! html/parsoid
18905 <p><i><b></b></i></p>
18906 !! end
18908 !! test
18909 Special:Search page linking.
18910 !! wikitext
18911 {{Special:search}}
18912 !! html
18913 <p><a href="/wiki/Special:Search" title="Special:Search">Special:Search</a>
18914 </p>
18915 !! end
18917 !! test
18918 {{!}} is a magic word
18919 !! wikitext
18920 {{!}} is a magic word there and {{!}} is still a magic word here
18921 | is not a magic word here but {{!}} is still a magic word here
18922 !! html/php
18923 <p>| is a magic word there and | is still a magic word here
18924 | is not a magic word here but | is still a magic word here
18925 </p>
18926 !! html/parsoid
18927 <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
18928 | 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>
18930 !! end
18932 !! test
18933 Say the magic word
18934 !! options
18935 title=[[Parser test]]
18936 !! wikitext
18937 * {{PAGENAME}}
18938 * {{PAGENAMEE}}
18939 * {{FULLPAGENAME}}
18940 * {{FULLPAGENAMEE}}
18941 * {{BASEPAGENAME}}
18942 * {{BASEPAGENAMEE}}
18943 * {{SUBPAGENAME}}
18944 * {{SUBPAGENAMEE}}
18945 * {{ROOTPAGENAME}}
18946 * {{ROOTPAGENAMEE}}
18947 * {{TALKPAGENAME}}
18948 * {{TALKPAGENAMEE}}
18949 * {{SUBJECTPAGENAME}}
18950 * {{SUBJECTPAGENAMEE}}
18951 * {{NAMESPACEE}}
18952 * {{NAMESPACE}}
18953 * {{NAMESPACENUMBER}}
18954 * {{TALKSPACE}}
18955 * {{TALKSPACEE}}
18956 * {{SUBJECTSPACE}}
18957 * {{SUBJECTSPACEE}}
18958 * {{Dynamic|{{NUMBEROFUSERS}}|{{NUMBEROFPAGES}}|{{CURRENTVERSION}}|{{CONTENTLANGUAGE}}|{{DIRECTIONMARK}}|{{CURRENTTIMESTAMP}}|{{NUMBEROFARTICLES}}}}
18959 !! html
18960 <ul><li> Parser test</li>
18961 <li> Parser_test</li>
18962 <li> Parser test</li>
18963 <li> Parser_test</li>
18964 <li> Parser test</li>
18965 <li> Parser_test</li>
18966 <li> Parser test</li>
18967 <li> Parser_test</li>
18968 <li> Parser test</li>
18969 <li> Parser_test</li>
18970 <li> Talk:Parser test</li>
18971 <li> Talk:Parser_test</li>
18972 <li> Parser test</li>
18973 <li> Parser_test</li>
18974 <li> </li>
18975 <li> </li>
18976 <li> 0</li>
18977 <li> Talk</li>
18978 <li> Talk</li>
18979 <li> </li>
18980 <li> </li>
18981 <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>
18983 !! end
18984 ### Note: Above tests excludes the "{{NUMBEROFADMINS}}" magic word because it generates a MySQL error when included.
18986 ## Parsoid thinks the "centre" here is a property, not a caption.
18987 !! test
18988 Gallery
18989 !! options
18990 parsoid={
18991   "modes": ["wt2html"],
18992   "nativeGallery": true
18994 !! wikitext
18995 <gallery>
18996 image1.png |
18997 image2.gif|||||
18999 image3|
19000 image4    |300px| centre
19001  image5.svg| http://///////
19002 [[x|xx]]]]
19003 * image6
19004 </gallery>
19005 !! html/php
19006 <ul class="gallery mw-gallery-traditional">
19007                 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19008                         <div class="thumb" style="height: 150px;">Image1.png</div>
19009                         <div class="gallerytext">
19010                         </div>
19011                 </div></li>
19012                 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19013                         <div class="thumb" style="height: 150px;">Image2.gif</div>
19014                         <div class="gallerytext">
19015                         </div>
19016                 </div></li>
19017                 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19018                         <div class="thumb" style="height: 150px;">Image3</div>
19019                         <div class="gallerytext">
19020                         </div>
19021                 </div></li>
19022                 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19023                         <div class="thumb" style="height: 150px;">Image4</div>
19024                         <div class="gallerytext">
19025 <pre>centre
19026 </pre>
19027                         </div>
19028                 </div></li>
19029                 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19030                         <div class="thumb" style="height: 150px;">Image5.svg</div>
19031                         <div class="gallerytext">
19032 <p><a rel="nofollow" class="external free" href="http://///////">http://///////</a>
19033 </p>
19034                         </div>
19035                 </div></li>
19036                 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19037                         <div class="thumb" style="height: 150px;">* image6</div>
19038                         <div class="gallerytext">
19039                         </div>
19040                 </div></li>
19041 </ul>
19043 !! html/parsoid
19044 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt3" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
19045 <li class="gallerybox" style="width: 155px;"><div class="thumb" style="width: 150px; height: 150px;"><span style="display: inline-block; height: 100%; vertical-align: middle;"></span><span style="vertical-align: middle; display: inline-block;">image1.png </span></div><div class="gallerytext"></div></li>
19046 <li class="gallerybox" style="width: 155px;"><div class="thumb" style="width: 150px; height: 150px;"><span style="display: inline-block; height: 100%; vertical-align: middle;"></span><span style="vertical-align: middle; display: inline-block;">image2.gif</span></div><div class="gallerytext"></div></li>
19047 <li class="gallerybox" style="width: 155px;"><div class="thumb" style="width: 150px; height: 150px;"><span style="display: inline-block; height: 100%; vertical-align: middle;"></span><span style="vertical-align: middle; display: inline-block;">image3</span></div><div class="gallerytext"></div></li>
19048 <li class="gallerybox" style="width: 155px;"><div class="thumb" style="width: 150px; height: 150px;"><span style="display: inline-block; height: 100%; vertical-align: middle;"></span><span style="vertical-align: middle; display: inline-block;">image4    </span></div><div class="gallerytext"></div></li>
19049 <li class="gallerybox" style="width: 155px;"><div class="thumb" style="width: 150px; height: 150px;"><span style="display: inline-block; height: 100%; vertical-align: middle;"></span><span style="vertical-align: middle; display: inline-block;"> image5.svg</span></div><div class="gallerytext"> <a rel="mw:ExtLink" href="http://///////">http://///////</a></div></li>
19050 <li class="gallerybox" style="width: 155px;"><div class="thumb" style="width: 150px; height: 150px;"><span style="display: inline-block; height: 100%; vertical-align: middle;"></span><span style="vertical-align: middle; display: inline-block;">* image6</span></div><div class="gallerytext"></div></li>
19051 </ul>
19052 !! end
19054 !! test
19055 Gallery (with options, html)
19056 !! options
19057 parsoid={
19058   "modes": ["wt2html", "html2html"],
19059   "nativeGallery": true
19061 !! wikitext
19062 <gallery widths="70px" heights="40px" perrow="2" caption="Foo [[Main Page]]">
19063 File:Nonexistent.jpg|caption
19064 File:Nonexistent.jpg
19065 image:foobar.jpg|some '''caption''' [[Main Page]]
19066 image:foobar.jpg
19067 image:foobar.jpg|Blabla|alt=This is a foo-bar.|blabla.
19068 </gallery>
19069 !! html/php
19070 <ul class="gallery mw-gallery-traditional" style="max-width: 226px;_width: 226px;">
19071         <li class='gallerycaption'>Foo <a href="/wiki/Main_Page" title="Main Page">Main Page</a></li>
19072                 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
19073                         <div class="thumb" style="height: 70px;">Nonexistent.jpg</div>
19074                         <div class="gallerytext">
19075 <p>caption
19076 </p>
19077                         </div>
19078                 </div></li>
19079                 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
19080                         <div class="thumb" style="height: 70px;">Nonexistent.jpg</div>
19081                         <div class="gallerytext">
19082                         </div>
19083                 </div></li>
19084                 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
19085                         <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>
19086                         <div class="gallerytext">
19087 <p>some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
19088 </p>
19089                         </div>
19090                 </div></li>
19091                 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
19092                         <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>
19093                         <div class="gallerytext">
19094                         </div>
19095                 </div></li>
19096                 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
19097                         <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>
19098                         <div class="gallerytext">
19099 <p>blabla.
19100 </p>
19101                         </div>
19102                 </div></li>
19103 </ul>
19105 !! html/parsoid
19106 <ul class="gallery mw-gallery-traditional" style="max-width: 226px; _width: 226px;" typeof="mw:Extension/gallery" about="#mwt3" data-mw='{"name":"gallery","attrs":{"widths":"70px","heights":"40px","perrow":"2"},"body":{}}'>
19107 <li class="gallerycaption">Foo <a rel="mw:WikiLink" href="./Main_Page" title="Main Page">Main Page</a></li>
19108 <li class="gallerybox" style="width: 105px;"><div class="thumb" style="width: 100px; height: 70px;"><span style="display: inline-block; height: 100%; vertical-align: middle;"></span><span style="vertical-align: middle; display: inline-block;">File:Nonexistent.jpg</span></div><div class="gallerytext">caption</div></li>
19109 <li class="gallerybox" style="width: 105px;"><div class="thumb" style="width: 100px; height: 70px;"><span style="display: inline-block; height: 100%; vertical-align: middle;"></span><span style="vertical-align: middle; display: inline-block;">File:Nonexistent.jpg</span></div><div class="gallerytext"></div></li>
19110 <li class="gallerybox" style="width: 105px;"><div class="thumb" style="width: 100px; height: 70px;"><span style="display: inline-block; height: 100%; vertical-align: middle;"></span><span typeof="mw:Image" style="vertical-align: middle; display: inline-block;"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/70px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="8" width="70"/></a></span></div><div class="gallerytext">some <b>caption</b> <a rel="mw:WikiLink" href="./Main_Page" title="Main Page">Main Page</a></div></li>
19111 <li class="gallerybox" style="width: 105px;"><div class="thumb" style="width: 100px; height: 70px;"><span style="display: inline-block; height: 100%; vertical-align: middle;"></span><span typeof="mw:Image" style="vertical-align: middle; display: inline-block;"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/70px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="8" width="70"/></a></span></div><div class="gallerytext"></div></li>
19112 <li class="gallerybox" style="width: 105px;"><div class="thumb" style="width: 100px; height: 70px;"><span style="display: inline-block; height: 100%; vertical-align: middle;"></span><span typeof="mw:Image" style="vertical-align: middle; display: inline-block;"><a href="./File:Foobar.jpg"><img alt="This is a foo-bar." resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/70px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="8" width="70"/></a></span></div><div class="gallerytext">blabla.</div></li>
19113 </ul>
19114 !! end
19116 !! test
19117 Gallery (with options, extsrc)
19118 !! options
19119 parsoid={
19120   "nativeGallery": false
19122 !! wikitext
19123 <gallery widths="70px" heights="40px" perrow="2" caption="Foo [[Main Page]]">
19124 File:Nonexistent.jpg|caption
19125 File:Nonexistent.jpg
19126 image:foobar.jpg|some '''caption''' [[Main Page]]
19127 image:foobar.jpg
19128 image:foobar.jpg|Blabla|alt=This is a foo-bar.|blabla.
19129 </gallery>
19130 !! html/php
19131 <ul class="gallery mw-gallery-traditional" style="max-width: 226px;_width: 226px;">
19132         <li class='gallerycaption'>Foo <a href="/wiki/Main_Page" title="Main Page">Main Page</a></li>
19133                 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
19134                         <div class="thumb" style="height: 70px;">Nonexistent.jpg</div>
19135                         <div class="gallerytext">
19136 <p>caption
19137 </p>
19138                         </div>
19139                 </div></li>
19140                 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
19141                         <div class="thumb" style="height: 70px;">Nonexistent.jpg</div>
19142                         <div class="gallerytext">
19143                         </div>
19144                 </div></li>
19145                 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
19146                         <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>
19147                         <div class="gallerytext">
19148 <p>some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
19149 </p>
19150                         </div>
19151                 </div></li>
19152                 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
19153                         <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>
19154                         <div class="gallerytext">
19155                         </div>
19156                 </div></li>
19157                 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
19158                         <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>
19159                         <div class="gallerytext">
19160 <p>blabla.
19161 </p>
19162                         </div>
19163                 </div></li>
19164 </ul>
19166 !! html/parsoid
19167 <ul class="gallery mw-gallery-traditional" style="max-width: 226px; _width: 226px;" typeof="mw:Extension/gallery" about="#mwt3" data-parsoid='{}' data-mw='{"name":"gallery","attrs":{"widths":"70px","heights":"40px","perrow":"2","caption":"Foo [[Main Page]]"},"body":{"extsrc":"\nFile:Nonexistent.jpg|caption\nFile:Nonexistent.jpg\nimage:foobar.jpg|some &#39;&#39;&#39;caption&#39;&#39;&#39; [[Main Page]]\nimage:foobar.jpg\nimage:foobar.jpg|Blabla|alt=This is a foo-bar.|blabla.\n"}}'>
19168 <li class="gallerycaption">Foo <a rel="mw:WikiLink" href="./Main_Page" title="Main Page">Main Page</a></li>
19169 <li class="gallerybox" style="width: 105px;"><div class="thumb" style="width: 100px; height: 70px;"><span style="display: inline-block; height: 100%; vertical-align: middle;"></span><span style="vertical-align: middle; display: inline-block;">File:Nonexistent.jpg</span></div><div class="gallerytext">caption</div></li>
19170 <li class="gallerybox" style="width: 105px;"><div class="thumb" style="width: 100px; height: 70px;"><span style="display: inline-block; height: 100%; vertical-align: middle;"></span><span style="vertical-align: middle; display: inline-block;">File:Nonexistent.jpg</span></div><div class="gallerytext"></div></li>
19171 <li class="gallerybox" style="width: 105px;"><div class="thumb" style="width: 100px; height: 70px;"><span style="display: inline-block; height: 100%; vertical-align: middle;"></span><span typeof="mw:Image" style="vertical-align: middle; display: inline-block;"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/70px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="8" width="70"/></a></span></div><div class="gallerytext">some <b>caption</b> <a rel="mw:WikiLink" href="./Main_Page" title="Main Page">Main Page</a></div></li>
19172 <li class="gallerybox" style="width: 105px;"><div class="thumb" style="width: 100px; height: 70px;"><span style="display: inline-block; height: 100%; vertical-align: middle;"></span><span typeof="mw:Image" style="vertical-align: middle; display: inline-block;"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/70px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="8" width="70"/></a></span></div><div class="gallerytext"></div></li>
19173 <li class="gallerybox" style="width: 105px;"><div class="thumb" style="width: 100px; height: 70px;"><span style="display: inline-block; height: 100%; vertical-align: middle;"></span><span typeof="mw:Image" style="vertical-align: middle; display: inline-block;"><a href="./File:Foobar.jpg"><img alt="This is a foo-bar." resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/70px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="8" width="70"/></a></span></div><div class="gallerytext">blabla.</div></li>
19174 </ul>
19175 !! end
19177 !! test
19178 Gallery with link that has fragment
19179 !! options
19180 parsoid={
19181   "modes": ["wt2html", "html2html"],
19182   "nativeGallery": true
19184 !! wikitext
19185 <gallery>
19186 image:foobar.jpg|link=Main_Page
19187 image:foobar.jpg|link=Main_Page#section
19188 image:foobar.jpg|link=Main Page#section|caption
19189 </gallery>
19190 !! html/php
19191 <ul class="gallery mw-gallery-traditional">
19192                 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19193                         <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>
19194                         <div class="gallerytext">
19195                         </div>
19196                 </div></li>
19197                 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19198                         <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>
19199                         <div class="gallerytext">
19200                         </div>
19201                 </div></li>
19202                 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19203                         <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>
19204                         <div class="gallerytext">
19205 <p>caption
19206 </p>
19207                         </div>
19208                 </div></li>
19209 </ul>
19211 !! html/parsoid
19212 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
19213 <li class="gallerybox" style="width: 155px;"><div class="thumb" style="width: 150px; height: 150px;"><span style="display: inline-block; height: 100%; vertical-align: middle;"></span><span typeof="mw:Image" style="vertical-align: middle; display: inline-block;"><a href="./Main_Page"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="14" width="120"/></a></span></div><div class="gallerytext"></div></li>
19214 <li class="gallerybox" style="width: 155px;"><div class="thumb" style="width: 150px; height: 150px;"><span style="display: inline-block; height: 100%; vertical-align: middle;"></span><span typeof="mw:Image" style="vertical-align: middle; display: inline-block;"><a href="./Main_Page#section"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="14" width="120"/></a></span></div><div class="gallerytext"></div></li>
19215 <li class="gallerybox" style="width: 155px;"><div class="thumb" style="width: 150px; height: 150px;"><span style="display: inline-block; height: 100%; vertical-align: middle;"></span><span typeof="mw:Image" style="vertical-align: middle; display: inline-block;"><a href="./Main_Page#section"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="14" width="120"/></a></span></div><div class="gallerytext">caption</div></li>
19216 </ul>
19217 !! end
19219 ## Whoops, Parsoid shouldn't be parsing templates in the attribute caption!
19220 !! test
19221 Gallery with template inside caption
19222 !! options
19223 parsoid={
19224   "nativeGallery": true
19226 !! wikitext
19227 <gallery caption="{{echo|hi}}">
19228 File:Foobar.jpg|{{echo|ho}}
19229 </gallery>
19230 !! html/php
19231 <ul class="gallery mw-gallery-traditional">
19232         <li class='gallerycaption'>{{echo|hi}}</li>
19233                 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19234                         <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>
19235                         <div class="gallerytext">
19236 <p>ho
19237 </p>
19238                         </div>
19239                 </div></li>
19240 </ul>
19242 !! html/parsoid
19243 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt6" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
19244 <li class="gallerycaption"><span about="#mwt3" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"hi"}},"i":0}}]}'>hi</span></li>
19245 <li class="gallerybox" style="width: 155px;"><div class="thumb" style="width: 150px; height: 150px;"><span style="display: inline-block; height: 100%; vertical-align: middle;"></span><span typeof="mw:Image" style="vertical-align: middle; display: inline-block;"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="14" width="120"/></a></span></div><div class="gallerytext"><span about="#mwt5" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"ho"}},"i":0}}]}'>ho</span></div></li>
19246 </ul>
19247 !! end
19249 !! test
19250 Gallery with wikitext inside caption
19251 !! options
19252 parsoid={
19253   "nativeGallery": true
19255 !! wikitext
19256 <gallery>
19257 File:Foobar.jpg|alt=galleryalt|[[File:Foobar.jpg|alt=inneralt|20x20px|desc]]
19258 File:Foobar.jpg|alt=galleryalt|{{Test|unamedParam|alt=param}}
19259 </gallery>
19260 !! html/php
19261 <ul class="gallery mw-gallery-traditional">
19262                 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19263                         <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>
19264                         <div class="gallerytext">
19265 <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>
19266 </p>
19267                         </div>
19268                 </div></li>
19269                 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19270                         <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>
19271                         <div class="gallerytext">
19272 <p>This is a test template
19273 </p>
19274                         </div>
19275                 </div></li>
19276 </ul>
19278 !! html/parsoid
19279 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt6" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
19280 <li class="gallerybox" style="width: 155px;"><div class="thumb" style="width: 150px; height: 150px;"><span style="display: inline-block; height: 100%; vertical-align: middle;"></span><span typeof="mw:Image" style="vertical-align: middle; display: inline-block;"><a href="./File:Foobar.jpg"><img alt="galleryalt" resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="14" width="120"/></a></span></div><div class="gallerytext"><span typeof="mw:Image" data-mw='{"caption":"desc"}'><a href="./File:Foobar.jpg"><img alt="inneralt" 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></div></li>
19281 <li class="gallerybox" style="width: 155px;"><div class="thumb" style="width: 150px; height: 150px;"><span style="display: inline-block; height: 100%; vertical-align: middle;"></span><span typeof="mw:Image" style="vertical-align: middle; display: inline-block;"><a href="./File:Foobar.jpg"><img alt="galleryalt" resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="14" width="120"/></a></span></div><div class="gallerytext"><span about="#mwt4" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"Test","href":"./Template:Test"},"params":{"1":{"wt":"unamedParam"},"alt":{"wt":"param"}},"i":0}}]}'>This is a test template</span></div></li>
19282 </ul>
19283 !! end
19285 !! test
19286 Gallery (with showfilename option)
19287 !! options
19288 parsoid={
19289   "nativeGallery": true
19291 !! wikitext
19292 <gallery showfilename="">
19293 File:Nonexistent.jpg|caption
19294 File:Nonexistent.jpg
19295 File:Foobar.jpg|some '''caption''' [[Main Page]]
19296 File:Foobar.jpg
19297 </gallery>
19298 !! html/php
19299 <ul class="gallery mw-gallery-traditional">
19300                 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19301                         <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
19302                         <div class="gallerytext">
19303 <p><a href="/wiki/File:Nonexistent.jpg" class="galleryfilename galleryfilename-truncate" title="File:Nonexistent.jpg">Nonexistent.jpg</a>
19304 caption
19305 </p>
19306                         </div>
19307                 </div></li>
19308                 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19309                         <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
19310                         <div class="gallerytext">
19311 <p><a href="/wiki/File:Nonexistent.jpg" class="galleryfilename galleryfilename-truncate" title="File:Nonexistent.jpg">Nonexistent.jpg</a>
19312 </p>
19313                         </div>
19314                 </div></li>
19315                 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19316                         <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>
19317                         <div class="gallerytext">
19318 <p><a href="/wiki/File:Foobar.jpg" class="galleryfilename galleryfilename-truncate" title="File:Foobar.jpg">Foobar.jpg</a>
19319 some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
19320 </p>
19321                         </div>
19322                 </div></li>
19323                 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19324                         <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>
19325                         <div class="gallerytext">
19326 <p><a href="/wiki/File:Foobar.jpg" class="galleryfilename galleryfilename-truncate" title="File:Foobar.jpg">Foobar.jpg</a>
19327 </p>
19328                         </div>
19329                 </div></li>
19330 </ul>
19332 !! html/parsoid
19333 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt3" data-mw='{"name":"gallery","attrs":{"showfilename":""},"body":{}}'>
19334 <li class="gallerybox" style="width: 155px;"><div class="thumb" style="width: 150px; height: 150px;"><span style="display: inline-block; height: 100%; vertical-align: middle;"></span><span style="vertical-align: middle; display: inline-block;">File:Nonexistent.jpg</span></div><div class="gallerytext"><a href="./File:Nonexistent.jpg" class="galleryfilename galleryfilename-truncate" title="File:Nonexistent.jpg">File:Nonexistent.jpg</a>caption</div></li>
19335 <li class="gallerybox" style="width: 155px;"><div class="thumb" style="width: 150px; height: 150px;"><span style="display: inline-block; height: 100%; vertical-align: middle;"></span><span style="vertical-align: middle; display: inline-block;">File:Nonexistent.jpg</span></div><div class="gallerytext"><a href="./File:Nonexistent.jpg" class="galleryfilename galleryfilename-truncate" title="File:Nonexistent.jpg">File:Nonexistent.jpg</a></div></li>
19336 <li class="gallerybox" style="width: 155px;"><div class="thumb" style="width: 150px; height: 150px;"><span style="display: inline-block; height: 100%; vertical-align: middle;"></span><span typeof="mw:Image" style="vertical-align: middle; display: inline-block;"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="14" width="120"/></a></span></div><div class="gallerytext"><a href="./File:Foobar.jpg" class="galleryfilename galleryfilename-truncate" title="File:Foobar.jpg">File:Foobar.jpg</a>some <b>caption</b> <a rel="mw:WikiLink" href="./Main_Page" title="Main Page">Main Page</a></div></li>
19337 <li class="gallerybox" style="width: 155px;"><div class="thumb" style="width: 150px; height: 150px;"><span style="display: inline-block; height: 100%; vertical-align: middle;"></span><span typeof="mw:Image" style="vertical-align: middle; display: inline-block;"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="14" width="120"/></a></span></div><div class="gallerytext"><a href="./File:Foobar.jpg" class="galleryfilename galleryfilename-truncate" title="File:Foobar.jpg">File:Foobar.jpg</a></div></li>
19338 </ul>
19339 !! end
19341 ## Should Parsoid be preserving these variations?
19342 !! test
19343 Gallery (with namespace-less filenames)
19344 !! options
19345 parsoid={
19346   "modes": ["wt2html", "html2html"],
19347   "nativeGallery": true
19349 !! wikitext
19350 <gallery>
19351 File:Nonexistent.jpg
19352 Nonexistent.jpg
19353 image:foobar.jpg
19354 foobar.jpg
19355 </gallery>
19356 !! html/php
19357 <ul class="gallery mw-gallery-traditional">
19358                 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19359                         <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
19360                         <div class="gallerytext">
19361                         </div>
19362                 </div></li>
19363                 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19364                         <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
19365                         <div class="gallerytext">
19366                         </div>
19367                 </div></li>
19368                 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19369                         <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>
19370                         <div class="gallerytext">
19371                         </div>
19372                 </div></li>
19373                 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19374                         <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>
19375                         <div class="gallerytext">
19376                         </div>
19377                 </div></li>
19378 </ul>
19380 !! html/parsoid
19381 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
19382 <li class="gallerybox" style="width: 155px;"><div class="thumb" style="width: 150px; height: 150px;"><span style="display: inline-block; height: 100%; vertical-align: middle;"></span><span style="vertical-align: middle; display: inline-block;">File:Nonexistent.jpg</span></div><div class="gallerytext"></div></li>
19383 <li class="gallerybox" style="width: 155px;"><div class="thumb" style="width: 150px; height: 150px;"><span style="display: inline-block; height: 100%; vertical-align: middle;"></span><span style="vertical-align: middle; display: inline-block;">Nonexistent.jpg</span></div><div class="gallerytext"></div></li>
19384 <li class="gallerybox" style="width: 155px;"><div class="thumb" style="width: 150px; height: 150px;"><span style="display: inline-block; height: 100%; vertical-align: middle;"></span><span typeof="mw:Image" style="vertical-align: middle; display: inline-block;"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="14" width="120"/></a></span></div><div class="gallerytext"></div></li>
19385 <li class="gallerybox" style="width: 155px;"><div class="thumb" style="width: 150px; height: 150px;"><span style="display: inline-block; height: 100%; vertical-align: middle;"></span><span typeof="mw:Image" style="vertical-align: middle; display: inline-block;"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="14" width="120"/></a></span></div><div class="gallerytext"></div></li>
19386 </ul>
19387 !! end
19389 !! test
19390 Gallery override link with WikiLink (T36852)
19391 !! options
19392 parsoid={
19393   "nativeGallery": true
19395 !! wikitext
19396 <gallery>
19397 File:Foobar.jpg|alt=galleryalt|link=InterWikiLink
19398 </gallery>
19399 !! html/php
19400 <ul class="gallery mw-gallery-traditional">
19401                 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19402                         <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>
19403                         <div class="gallerytext">
19404                         </div>
19405                 </div></li>
19406 </ul>
19408 !! html/parsoid
19409 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-parsoid='{"dsr":[0,70,2,2]}' data-mw='{"name":"gallery","attrs":{},"body":{}}'>
19410 <li class="gallerybox" style="width: 155px;"><div class="thumb" style="width: 150px; height: 150px;"><span style="display: inline-block; height: 100%; vertical-align: middle;"></span><span typeof="mw:Image" style="vertical-align: middle; display: inline-block;"><a href="./InterWikiLink"><img alt="galleryalt" resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="14" width="120"/></a></span></div><div class="gallerytext"></div></li>
19411 </ul>
19412 !! end
19414 !! test
19415 Gallery override link with absolute external link (T36852)
19416 !! options
19417 parsoid={
19418   "nativeGallery": true
19420 !! wikitext
19421 <gallery>
19422 File:Foobar.jpg|alt=galleryalt|link=http://www.example.org
19423 </gallery>
19424 !! html/php
19425 <ul class="gallery mw-gallery-traditional">
19426                 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19427                         <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>
19428                         <div class="gallerytext">
19429                         </div>
19430                 </div></li>
19431 </ul>
19433 !! html/parsoid
19434 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
19435 <li class="gallerybox" style="width: 155px;"><div class="thumb" style="width: 150px; height: 150px;"><span style="display: inline-block; height: 100%; vertical-align: middle;"></span><span typeof="mw:Image" style="vertical-align: middle; display: inline-block;"><a href="http://www.example.org"><img alt="galleryalt" resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="14" width="120"/></a></span></div><div class="gallerytext"></div></li>
19436 </ul>
19437 !! end
19439 !! test
19440 Gallery override link with malicious javascript (T36852)
19441 !! options
19442 parsoid={
19443   "modes": ["wt2html", "html2html"],
19444   "nativeGallery": true
19446 !! wikitext
19447 <gallery>
19448 File:Foobar.jpg|alt=galleryalt|link=" onclick="alert('malicious javascript code!');
19449 </gallery>
19450 !! html/php
19451 <ul class="gallery mw-gallery-traditional">
19452                 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19453                         <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>
19454                         <div class="gallerytext">
19455                         </div>
19456                 </div></li>
19457 </ul>
19459 !! html/parsoid
19460 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
19461 <li class="gallerybox" style="width: 155px;"><div class="thumb" style="width: 150px; height: 150px;"><span style="display: inline-block; height: 100%; vertical-align: middle;"></span><span typeof="mw:Image" style="vertical-align: middle; display: inline-block;"><a href="./&quot;_onclick=&quot;alert('malicious_javascript_code!');"><img alt="galleryalt" resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="14" width="120"/></a></span></div><div class="gallerytext"></div></li>
19462 </ul>
19463 !! end
19465 !! test
19466 Gallery with invalid title as link (T45964)
19467 !! options
19468 parsoid={
19469   "modes": ["wt2html", "html2html"],
19470   "nativeGallery": true
19472 !! wikitext
19473 <gallery>
19474 File:Foobar.jpg|link=<
19475 </gallery>
19476 !! html/php
19477 <ul class="gallery mw-gallery-traditional">
19478                 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19479                         <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>
19480                         <div class="gallerytext">
19481                         </div>
19482                 </div></li>
19483 </ul>
19485 !! html/parsoid
19486 <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
19487 <li class="gallerybox" style="width: 155px;"><div class="thumb" style="width: 150px; height: 150px;"><span style="display: inline-block; height: 100%; vertical-align: middle;"></span><span typeof="mw:Image" style="vertical-align: middle; display: inline-block;"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="14" width="120"/></a></span></div><div class="gallerytext">link=&lt;</div></li>
19488 </ul>
19489 !! end
19491 !! test
19492 HTML Hex character encoding (spells the word "JavaScript")
19493 !! options
19494 parsoid=wt2html,wt2wt,html2html
19495 !! wikitext
19496 &#x4A;&#x061;&#x0076;&#x00061;&#x000053;&#x0000063;&#114;&#x0000069;&#00000112;&#x0000000074;
19497 !! html/php
19498 <p>&#x4a;&#x61;&#x76;&#x61;&#x53;&#x63;&#114;&#x69;&#112;&#x74;
19499 </p>
19500 !! html/php+tidy
19501 <p>JavaScript</p>
19502 !! html/parsoid
19503 <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>
19504 !! end
19506 !! test
19507 HTML Hex character encoding bogus encoding (bug 26437 regression check)
19508 !! wikitext
19509 &#xsee;&#XSEE;
19510 !! html/php
19511 <p>&amp;#xsee;&amp;#XSEE;
19512 </p>
19513 !! html/parsoid
19514 <p>&amp;#xsee;&amp;#XSEE;</p>
19515 !! end
19517 !! test
19518 HTML Hex character encoding mixed case
19519 !! options
19520 parsoid=wt2html,wt2wt,html2html
19521 !! wikitext
19522 &#xEE;&#Xee;
19523 !! html/php
19524 <p>&#xee;&#xee;
19525 </p>
19526 !! html/php+tidy
19527 <p>îî</p>
19528 !! html/parsoid
19529 <p><span typeof="mw:Entity">î</span><span typeof="mw:Entity">î</span></p>
19530 !! end
19532 # See: https://www.w3.org/TR/html5/syntax.html#character-references
19533 # Note that U+000C (form feed) is not a valid XML character, so
19534 # it is banned even though allowed in HTML5.
19535 !! test
19536 Illegal character references (T106578)
19537 !! wikitext
19538 ; Null: &#00;
19539 ; FF: &#xC;
19540 ; CR: &#xD;
19541 ; Control (low): &#8;
19542 ; Control (high): &#x7F; &#x9F;
19543 ; Surrogate: &#xD83D;&#xDCA9;
19544 ; This is an okay astral character: &#x1F4A9;
19545 !! html+tidy
19546 <dl>
19547 <dt>Null</dt>
19548 <dd>&amp;#00;</dd>
19549 <dt>FF</dt>
19550 <dd>&amp;#xC;</dd>
19551 <dt>CR</dt>
19552 <dd>&amp;#xD;</dd>
19553 <dt>Control (low)</dt>
19554 <dd>&amp;#8;</dd>
19555 <dt>Control (high)</dt>
19556 <dd>&amp;#x7F; &amp;#x9F;</dd>
19557 <dt>Surrogate</dt>
19558 <dd>&amp;#xD83D;&amp;#xDCA9;</dd>
19559 <dt>This is an okay astral character</dt>
19560 <dd>💩</dd>
19561 </dl>
19562 !! end
19564 !! test
19565 __FORCETOC__ override
19566 !! wikitext
19567 __NEWSECTIONLINK__
19568 __FORCETOC__
19569 !! html/php
19570 <p><br />
19571 </p>
19572 !! end
19574 !! test
19575 ISBN code coverage
19576 !! wikitext
19577 ISBN  978-0-1234-56&#x20;789
19578 !! html
19579 <p><a href="/wiki/Special:BookSources/9780123456" class="internal mw-magiclink-isbn">ISBN 978-0-1234-56</a>&#x20;789
19580 </p>
19581 !! html+tidy
19582 <p><a href="/wiki/Special:BookSources/9780123456" class="internal mw-magiclink-isbn">ISBN 978-0-1234-56</a> 789</p>
19583 !! html/parsoid
19584 <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>
19585 !! end
19587 !! test
19588 ISBN followed by 5 spaces
19589 !! wikitext
19590 ISBN    
19591 !! html
19592 <p>ISBN    
19593 </p>
19594 !! end
19596 !! test
19597 Double ISBN
19598 !! wikitext
19599 ISBN ISBN 1234567890
19600 !! html/php
19601 <p>ISBN <a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
19602 </p>
19603 !! html/parsoid
19604 <p>ISBN <a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a></p>
19605 !! end
19607 # Uppercase X and lowercase x as well
19608 !! test
19609 ISBN with an X
19610 !! wikitext
19611 ISBN 3-462-04561-X
19612 ISBN 3-462-04561-x
19613 ISBN 080442957X
19614 ISBN 080442957x
19615 ISBN 978080442957X
19616 ISBN 978080442957x
19617 !! html/php
19618 <p><a href="/wiki/Special:BookSources/346204561X" class="internal mw-magiclink-isbn">ISBN 3-462-04561-X</a>
19619 <a href="/wiki/Special:BookSources/346204561X" class="internal mw-magiclink-isbn">ISBN 3-462-04561-x</a>
19620 <a href="/wiki/Special:BookSources/080442957X" class="internal mw-magiclink-isbn">ISBN 080442957X</a>
19621 <a href="/wiki/Special:BookSources/080442957X" class="internal mw-magiclink-isbn">ISBN 080442957x</a>
19622 <a href="/wiki/Special:BookSources/978080442957X" class="internal mw-magiclink-isbn">ISBN 978080442957X</a>
19623 <a href="/wiki/Special:BookSources/978080442957X" class="internal mw-magiclink-isbn">ISBN 978080442957x</a>
19624 </p>
19625 !! html/parsoid
19626 <p><a href="./Special:BookSources/346204561X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 3-462-04561-X</a>
19627 <a href="./Special:BookSources/346204561X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 3-462-04561-x</a>
19628 <a href="./Special:BookSources/080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 080442957X</a>
19629 <a href="./Special:BookSources/080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 080442957x</a>
19630 <a href="./Special:BookSources/978080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 978080442957X</a>
19631 <a href="./Special:BookSources/978080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 978080442957x</a></p>
19632 !! end
19634 !! test
19635 ISBN with empty prefix (parsoid test)
19636 !! wikitext
19637 ISBN 1234567890
19638 !! html/php
19639 <p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
19640 </p>
19641 !! html/parsoid
19642 <p><a href="./Special:BookSources/1234567890" rel="mw:WikiLink">ISBN 1234567890</a></p>
19643 !! end
19645 !! test
19646 Bug 22905: <abbr> followed by ISBN followed by </a>
19647 !! wikitext
19648 <abbr>(fr)</abbr> ISBN 2753300917 [http://www.example.com example.com]
19649 !! html/php
19650 <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>
19651 </p>
19652 !! html/parsoid
19653 <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>
19654 !! end
19656 !! test
19657 Double RFC
19658 !! wikitext
19659 RFC RFC 1234
19660 !! html
19661 <p>RFC <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc1234">RFC 1234</a>
19662 </p>
19663 !! end
19665 !! test
19666 Double RFC with a wiki link
19667 !! wikitext
19668 RFC [[RFC 1234]]
19669 !! html
19670 <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>
19671 </p>
19672 !! end
19674 !! test
19675 RFC code coverage
19676 !! wikitext
19677 RFC   983&#x20;987
19678 !! html
19679 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc983">RFC 983</a>&#x20;987
19680 </p>
19681 !! html+tidy
19682 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc983">RFC 983</a> 987</p>
19683 !! end
19685 !! test
19686 Centre-aligned image
19687 !! wikitext
19688 [[Image:foobar.jpg|centre]]
19689 !! html
19690 <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>
19692 !!end
19694 !! test
19695 None-aligned image
19696 !! wikitext
19697 [[Image:foobar.jpg|none]]
19698 !! html
19699 <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>
19701 !!end
19703 !! test
19704 Width + Height sized image (using px) (height is ignored)
19705 !! wikitext
19706 [[Image:foobar.jpg|640x480px]]
19707 !! html
19708 <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>
19709 </p>
19710 !!end
19712 !! test
19713 Width-sized image (using px, no following whitespace)
19714 !! wikitext
19715 [[Image:foobar.jpg|640px]]
19716 !! html
19717 <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>
19718 </p>
19719 !!end
19721 !! test
19722 Width-sized image (using px, with following whitespace - test regression from r39467)
19723 !! wikitext
19724 [[Image:foobar.jpg|640px ]]
19725 !! html
19726 <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>
19727 </p>
19728 !!end
19730 !! test
19731 Width-sized image (using px, with preceding whitespace - test regression from r39467)
19732 !! wikitext
19733 [[Image:foobar.jpg| 640px]]
19734 !! html
19735 <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>
19736 </p>
19737 !!end
19739 !! test
19740 Image with page parameter
19741 !! options
19742 djvu
19743 !! wikitext
19744 [[File:LoremIpsum.djvu|page=2]]
19745 !! html/php
19746 <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>
19747 </p>
19748 !! html/parsoid
19749 <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>
19750 !! end
19752 !! test
19753 Another italics / bold test
19754 !! wikitext
19755  ''' ''x'
19756 !! html
19757 <pre>'<i> </i>x'
19758 </pre>
19759 !!end
19761 # FIXME: The php output seems broken. It's interleaving some open/close tags.
19762 !! test
19763 dt/dd/dl test
19764 !! wikitext
19765 :;;;::
19766 !! html/php
19767 <dl><dd><dl><dt><dl><dt><dl><dt><dl><dd><dl><dd></dt></dl></dd></dl></dd></dl></dd></dl></dd></dl></dd></dl>
19769 !! html/parsoid
19770 <dl><dd><dl><dt><dl><dt><dl><dt><dl><dd><dl><dd></dd></dl></dd></dl></dt></dl></dt></dl></dt></dl></dd></dl>
19772 !!end
19775 # Images with the "|" character in external URLs in comment tags; Eats half the comment, leaves unmatched "</a>" tag.
19776 !! test
19777 Images with the "|" character in the comment
19778 !! wikitext
19779 [[File:Foobar.jpg|thumb|An [http://test/?param1=|left|&param2=|x external] URL]]
19780 !! html/php
19781 <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>
19783 !! html/parsoid
19784 <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>
19785 !! end
19787 !! test
19788 [Before] HTML without raw HTML enabled ($wgRawHtml==false)
19789 !! wikitext
19790 <html><script>alert(1);</script></html>
19791 !! html
19792 <p>&lt;html&gt;&lt;script&gt;alert(1);&lt;/script&gt;&lt;/html&gt;
19793 </p>
19794 !! end
19796 !! test
19797 HTML with raw HTML ($wgRawHtml==true)
19798 !! options
19799 wgRawHtml=1
19800 !! wikitext
19801 <html><script>alert(1);</script></html>
19802 !! html
19803 <p><script>alert(1);</script>
19804 </p>
19805 !! end
19807 !! test
19808 Parents of subpages, one level up
19809 !! options
19810 subpage title=[[Subpage test/L1/L2/L3]]
19811 !! wikitext
19812 [[../|L2]]
19813 !! html
19814 <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>
19815 </p>
19816 !! end
19819 !! test
19820 Parents of subpages, one level up, not named
19821 !! options
19822 subpage title=[[Subpage test/L1/L2/L3]]
19823 !! wikitext
19824 [[../]]
19825 !! html
19826 <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>
19827 </p>
19828 !! end
19832 !! test
19833 Parents of subpages, two levels up
19834 !! options
19835 subpage title=[[Subpage test/L1/L2/L3]]
19836 !! wikitext
19837 [[../../|L1]]2
19839 [[../../|L1]]l
19840 !! html
19841 <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
19842 </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>
19843 </p>
19844 !! end
19846 !! test
19847 Parents of subpages, two levels up, without trailing slash or name.
19848 !! options
19849 subpage title=[[Subpage test/L1/L2/L3]]
19850 !! wikitext
19851 [[../..]]
19852 !! html
19853 <p>[[../..]]
19854 </p>
19855 !! end
19857 !! test
19858 Parents of subpages, two levels up, with lots of extra trailing slashes.
19859 !! options
19860 subpage title=[[Subpage test/L1/L2/L3]]
19861 !! wikitext
19862 [[../../////]]
19863 !! html
19864 <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>
19865 </p>
19866 !! end
19868 !! article
19869 Subpage test/L1/L2/L3Sibling
19870 !! text
19871 Sibling article
19872 !! endarticle
19874 !! test
19875 Transclusion of a sibling page (one level up)
19876 !! options
19877 subpage title=[[Subpage test/L1/L2/L3]]
19878 !! wikitext
19879 {{../L3Sibling}}
19880 !! html
19881 <p>Sibling article
19882 </p>
19883 !! end
19885 !! test
19886 Transclusion of a child page
19887 !! options
19888 subpage title=[[Subpage test/L1/L2]]
19889 !! wikitext
19890 {{/L3Sibling}}
19891 !! html
19892 <p>Sibling article
19893 </p>
19894 !! end
19896 # This is wt2html only in Parsoid because we add <nowiki>
19897 # because of {{..}} and we don't expect to fix that to
19898 # eliminate the nowikis selective for {{..}} markup.
19899 !! test
19900 Non-transclusion because of too many up levels
19901 !! options
19902 subpage title=[[Subpage test/L1/L2/L3]]
19903 parsoid=wt2html
19904 !! wikitext
19905 {{../../../../More than parent}}
19906 !! html/php
19907 <p>{{../../../../More than parent}}
19908 </p>
19909 !! html/parsoid
19910 <p>{{../../../../More than parent}}</p>
19911 !! end
19913 !! test
19914 Definition list code coverage
19915 !! wikitext
19916 ; title   : def
19917 ; title : def
19918 ;title: def
19919 !! html/php
19920 <dl><dt> title  &#160;</dt>
19921 <dd> def</dd>
19922 <dt> title&#160;</dt>
19923 <dd> def</dd>
19924 <dt>title</dt>
19925 <dd> def</dd></dl>
19927 !! html/parsoid
19928 <dl><dt> title  <span typeof="mw:Placeholder"> </span></dt><dd> def</dd>
19929 <dt> title<span typeof="mw:Placeholder"> </span></dt><dd> def</dd>
19930 <dt>title</dt><dd> def</dd></dl>
19931 !! end
19933 !! test
19934 Don't fall for the self-closing div
19935 !! wikitext
19936 <div>hello world</div/>
19937 !! html
19938 <div>hello world</div>
19940 !! end
19942 !! test
19943 MSGNW magic word
19944 !! wikitext
19945 {{MSGNW:msg}}
19946 !! html/php
19947 <p>&#91;&#91;:Template:Msg&#93;&#93;
19948 </p>
19949 !! end
19951 !! test
19952 RAW magic word
19953 !! wikitext
19954 {{RAW:QUERTY}}
19955 !! html
19956 <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>
19957 </p>
19958 !! end
19960 # This isn't needed for XHTML conformance, but would be handy as a fallback security measure
19961 !! test
19962 Always escape literal '>' in output, not just after '<'
19963 !! wikitext
19965 !! html
19966 <p>&gt;&lt;&gt;
19967 </p>
19968 !! end
19970 !! test
19971 Template caching
19972 !! wikitext
19973 {{Test}}
19974 {{Test}}
19975 !! html
19976 <p>This is a test template
19977 This is a test template
19978 </p>
19979 !! end
19982 !! article
19983 MediaWiki:Fake
19984 !! text
19985 ==header==
19986 !! endarticle
19988 !! test
19989 Inclusion of !userCanEdit() content
19990 !! wikitext
19991 {{MediaWiki:Fake}}
19992 !! html
19993 <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>
19995 !! end
19998 !! test
19999 Out-of-order TOC heading levels
20000 !! wikitext
20001 ==2==
20002 ======6======
20003 ===3===
20005 =====5=====
20006 ==2==
20007 !! html
20008 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
20009 <ul>
20010 <li class="toclevel-1 tocsection-1"><a href="#2"><span class="tocnumber">1</span> <span class="toctext">2</span></a>
20011 <ul>
20012 <li class="toclevel-2 tocsection-2"><a href="#6"><span class="tocnumber">1.1</span> <span class="toctext">6</span></a></li>
20013 <li class="toclevel-2 tocsection-3"><a href="#3"><span class="tocnumber">1.2</span> <span class="toctext">3</span></a></li>
20014 </ul>
20015 </li>
20016 <li class="toclevel-1 tocsection-4"><a href="#1"><span class="tocnumber">2</span> <span class="toctext">1</span></a>
20017 <ul>
20018 <li class="toclevel-2 tocsection-5"><a href="#5"><span class="tocnumber">2.1</span> <span class="toctext">5</span></a></li>
20019 <li class="toclevel-2 tocsection-6"><a href="#2_2"><span class="tocnumber">2.2</span> <span class="toctext">2</span></a></li>
20020 </ul>
20021 </li>
20022 </ul>
20023 </div>
20025 <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>
20026 <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>
20027 <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>
20028 <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>
20029 <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>
20030 <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>
20032 !! end
20035 !! test
20036 ISBN with a dummy number
20037 !! wikitext
20038 ISBN ---
20039 !! html
20040 <p>ISBN ---
20041 </p>
20042 !! end
20045 !! test
20046 ISBN with space-delimited number
20047 !! wikitext
20048 ISBN 92 9017 032 8
20049 !! html
20050 <p><a href="/wiki/Special:BookSources/9290170328" class="internal mw-magiclink-isbn">ISBN 92 9017 032 8</a>
20051 </p>
20052 !! end
20055 !! test
20056 ISBN with multiple spaces, no number
20057 !! wikitext
20058 ISBN  foo
20059 !! html
20060 <p>ISBN  foo
20061 </p>
20062 !! end
20065 !! test
20066 ISBN length
20067 !! wikitext
20068 ISBN 123456789
20070 ISBN 1234567890
20072 ISBN 12345678901
20073 !! html
20074 <p>ISBN 123456789
20075 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
20076 </p><p>ISBN 12345678901
20077 </p>
20078 !! end
20081 !! test
20082 ISBN with trailing year (bug 8110)
20083 !! wikitext
20084 ISBN 1-234-56789-0 - 2006
20086 ISBN 1 234 56789 0 - 2006
20087 !! html
20088 <p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1-234-56789-0</a> - 2006
20089 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1 234 56789 0</a> - 2006
20090 </p>
20091 !! end
20094 !! test
20095 anchorencode
20096 !! wikitext
20097 {{anchorencode:foo bar©#%n}}
20098 !! html
20099 <p>foo_bar.C2.A9.23.25n
20100 </p>
20101 !! end
20103 !! test
20104 anchorencode trims spaces
20105 !! wikitext
20106 {{anchorencode: __pretty__please__}}
20107 !! html
20108 <p>pretty_please
20109 </p>
20110 !! end
20112 !! test
20113 anchorencode deals with links
20114 !! wikitext
20115 {{anchorencode: [[hello|world]] [[hi]]}}
20116 !! html
20117 <p>world_hi
20118 </p>
20119 !! end
20121 !! test
20122 anchorencode deals with templates
20123 !! wikitext
20124 {{anchorencode: {{Foo}} }}
20125 !! html
20126 <p>FOO
20127 </p>
20128 !! end
20130 !! test
20131 anchorencode encodes like the TOC generator: (bug 18431)
20132 !! wikitext
20133 === _ +:.3A%3A&&amp;]] ===
20134 {{anchorencode: _ +:.3A%3A&&amp;]] }}
20135 __NOEDITSECTION__
20136 !! html
20137 <h3><span class="mw-headline" id=".2B:.3A.253A.26.26.5D.5D">_ +:.3A%3A&amp;&amp;]]</span></h3>
20138 <p>.2B:.3A.253A.26.26.5D.5D
20139 </p>
20140 !! end
20142 !! test
20143 Bug 6200: blockquotes and paragraph formatting
20144 !! wikitext
20145 <blockquote>
20147 </blockquote>
20151  baz
20152 !! html
20153 <blockquote>
20154 <p>foo
20155 </p>
20156 </blockquote>
20157 <p>bar
20158 </p>
20159 <pre>baz
20160 </pre>
20161 !! end
20163 !! test
20164 Bug 8293: Use of center tag ruins paragraph formatting
20165 !! wikitext
20166 <center>
20168 </center>
20172  baz
20173 !! html
20174 <center>
20175 <p>foo
20176 </p>
20177 </center>
20178 <p>bar
20179 </p>
20180 <pre>baz
20181 </pre>
20182 !! end
20184 !!test
20185 Parsing of overlapping (improperly nested) inline html tags
20186 !! wikitext
20187 <span><s>x</span></s>
20188 !! html/php
20189 <p><span><s>x&lt;/span&gt;</s></span>
20190 </p>
20191 !! html/parsoid
20192 <p><span><s>x</s></span>
20193 </p>
20194 !!end
20197 ### Language variants related tests
20199 !! test
20200 Self-link in language variants
20201 !! options
20202 title=[[Dunav]] language=sr
20203 !! wikitext
20204 Both [[Dunav]] and [[Дунав]] are names for this river.
20205 !! html
20206 <p>Both <strong class="selflink">Dunav</strong> and <strong class="selflink">Дунав</strong> are names for this river.
20207 </p>
20208 !!end
20210 !! article
20211 Дуна
20212 !! text
20213 content
20214 !! endarticle
20216 !! test
20217 Link to another existing title shouldn't be parsed as self-link even if it's a variant of this title
20218 !! options
20219 title=[[Duna]] language=sr
20220 !! wikitext
20221 [[Дуна]] is not a self-link while [[Duna]] and [[Dуна]] are still self-links.
20222 !! html
20223 <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.
20224 </p>
20225 !! end
20227 !! test
20228 Link to a section of a variant of this title shouldn't be parsed as self-link
20229 !! options
20230 title=[[Duna]] language=sr
20231 !! wikitext
20232 [[Dуна]] is a self-link while [[Dunа#Foo]] and [[Dуна#Foo]] are not self-links.
20233 !! html
20234 <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.
20235 </p>
20236 !! end
20238 !! test
20239 Link to pages in language variants
20240 !! options
20241 language=sr
20242 !! wikitext
20243 Main Page can be written as [[Маин Паге]]
20244 !! html
20245 <p>Main Page can be written as <a href="/wiki/Main_Page" title="Main Page">Маин Паге</a>
20246 </p>
20247 !!end
20250 !! test
20251 Multiple links to pages in language variants
20252 !! options
20253 language=sr
20254 !! wikitext
20255 [[Main Page]] can be written as [[Маин Паге]] same as [[Маин Паге]].
20256 !! html
20257 <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>.
20258 </p>
20259 !!end
20262 !! test
20263 Simple template in language variants
20264 !! options
20265 language=sr
20266 !! wikitext
20267 {{тест}}
20268 !! html
20269 <p>This is a test template
20270 </p>
20271 !! end
20274 !! test
20275 Template with explicit namespace in language variants
20276 !! options
20277 language=sr
20278 !! wikitext
20279 {{Template:тест}}
20280 !! html
20281 <p>This is a test template
20282 </p>
20283 !! end
20286 !! test
20287 Basic test for template parameter in language variants
20288 !! options
20289 language=sr
20290 !! wikitext
20291 {{парамтест|param=foo}}
20292 !! html
20293 <p>This is a test template with parameter foo
20294 </p>
20295 !! end
20297 !! test
20298 Simple category in language variants
20299 !! options
20300 language=sr cat
20301 !! wikitext
20302 [[Category:МедиаWики Усер'с Гуиде]]
20303 !! html/php
20304 cat=МедиаWики_Усер'с_Гуиде sort=
20305 !! html/parsoid
20306 <link rel="mw:PageProp/Category" href="./Категорија:МедиаWики_Усер'с_Гуиде" data-parsoid='{"stx":"simple","a":{"href":"./Категорија:МедиаWики_Усер&#39;с_Гуиде"},"sa":{"href":"Category:МедиаWики Усер&#39;с Гуиде"}}'/>
20307 !! end
20309 !! article
20310 Category:分类
20311 !! text
20312 blah
20313 !! endarticle
20315 !! article
20316 Category:分類
20317 !! text
20318 blah
20319 !! endarticle
20321 ## We used to, but no longer wt2wt this test since the default serializer
20322 ## will normalize all categories to serialize on their own line.
20323 ## This wikitext usage is going to be fairly uncommon in production and
20324 ## selser will take care of preserving formatting in those scenarios.
20325 !! test
20326 Don't convert blue categorylinks to another variant (bug 33210)
20327 !! options
20329 language=zh
20330 parsoid=wt2html
20331 !! wikitext
20332 [[A]][[Category:分类]]
20333 !! html/php
20334 cat=分类 sort=
20335 !! html/parsoid
20336 <p><a rel="mw:WikiLink" href="A" title="A">A</a></p>
20337 <link rel="mw:PageProp/Category" href="Category:分类"/>
20338 !! end
20340 !! test
20341 Stripping -{}- tags (language variants)
20342 !! options
20343 language=sr
20344 !! wikitext
20345 Latin proverb: -{Ne nuntium necare}-
20346 !! html
20347 <p>Latin proverb: Ne nuntium necare
20348 </p>
20349 !! end
20352 !! test
20353 Prevent conversion with -{}- tags (language variants)
20354 !! options
20355 language=sr variant=sr-ec
20356 !! wikitext
20357 Latinski: -{Ne nuntium necare}-
20358 !! html
20359 <p>Латински: Ne nuntium necare
20360 </p>
20361 !! end
20364 !! test
20365 Prevent conversion of text with -{}- tags (language variants)
20366 !! options
20367 language=sr variant=sr-ec
20368 !! wikitext
20369 Latinski: -{Ne nuntium necare}-
20370 !! html
20371 <p>Латински: Ne nuntium necare
20372 </p>
20373 !! end
20376 !! test
20377 Prevent conversion of links with -{}- tags (language variants)
20378 !! options
20379 language=sr variant=sr-ec
20380 !! wikitext
20381 -{[[Main Page]]}-
20382 !! html
20383 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
20384 </p>
20385 !! end
20388 !! test
20389 -{}- tags within headlines (within html for parserConvert())
20390 !! options
20391 language=sr variant=sr-ec
20392 !! wikitext
20393 == -{Naslov}- ==
20394 !! html
20395 <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>
20397 !! end
20400 !! test
20401 Explicit definition of language variant alternatives
20402 !! options
20403 language=zh variant=zh-tw
20404 !! wikitext
20405 -{zh:China;zh-tw:Taiwan}-, not China
20406 !! html
20407 <p>Taiwan, not China
20408 </p>
20409 !! end
20412 !! test
20413 Conversion around HTML tags
20414 !! options
20415 language=sr variant=sr-ec
20416 !! wikitext
20417 -{H|span=>sr-ec:script;title=>sr-ec:src;}-
20418 <span title="La-{sr-el:L;sr-ec:C;}-tin">ski</span>
20419 !! html
20421 <span title="ЛаCтин">ски</span>
20422 </p>
20423 !! end
20426 !! test
20427 Explicit session-wise language variant mapping (A flag and - flag)
20428 !! options
20429 language=zh variant=zh-tw
20430 !! wikitext
20431 Taiwan is not China.
20432 But -{A|zh:China;zh-tw:Taiwan}- is China,
20433 (This-{-|zh:China;zh-tw:Taiwan}- should be stripped!)
20434 and -{China}- is China.
20435 !! html
20436 <p>Taiwan is not China.
20437 But Taiwan is Taiwan,
20438 (This should be stripped!)
20439 and China is China.
20440 </p>
20441 !! end
20443 !! test
20444 Explicit session-wise language variant mapping (H flag for hide)
20445 !! options
20446 language=zh variant=zh-tw
20447 !! wikitext
20448 (This-{H|zh:China;zh-tw:Taiwan}- should be stripped!)
20449 Taiwan is China.
20450 !! html
20451 <p>(This should be stripped!)
20452 Taiwan is Taiwan.
20453 </p>
20454 !! end
20456 !! test
20457 Adding explicit conversion rule for title (T flag)
20458 !! options
20459 language=zh variant=zh-tw showtitle
20460 !! wikitext
20461 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
20462 !! html
20463 Taiwan
20464 <p>Should be stripped!
20465 </p>
20466 !! end
20468 !! test
20469 Testing that changing the language variant here in the tests actually works
20470 !! options
20471 language=zh variant=zh showtitle
20472 !! wikitext
20473 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
20474 !! html
20475 China
20476 <p>Should be stripped!
20477 </p>
20478 !! end
20480 !! test
20481 Recursive conversion of alt and title attrs shouldn't clear converter state
20482 !! options
20483 language=zh variant=zh-cn showtitle
20484 !! wikitext
20485 -{H|zh-cn:Exclamation;zh-tw:exclamation;}-
20486 Should be stripped-{T|zh-cn:China;zh-tw:Taiwan}-<span title="exclamation">!</span>
20487 !! html
20488 China
20490 Should be stripped<span title="Exclamation">!</span>
20491 </p>
20492 !! end
20494 !! test
20495 Bug 24072: more test on conversion rule for title
20496 !! options
20497 language=zh variant=zh-tw showtitle
20498 !! wikitext
20499 This should be stripped-{T|zh:China;zh-tw:Taiwan}-!
20500 This won't take interferes with the title rule-{H|zh:Beijing;zh-tw:Taipei}-.
20501 !! html
20502 Taiwan
20503 <p>This should be stripped!
20504 This won't take interferes with the title rule.
20505 </p>
20506 !! end
20508 !! test
20509 Partly disable title conversion if variant == main language code
20510 !! options
20511 language=zh variant=zh title=[[ZH]] showtitle
20512 !! wikitext
20513 -{T|zh-cn:CN;zh-tw:TW}-
20514 !! html
20517 </p>
20518 !! end
20520 !! test
20521 Partly disable title conversion if variant == main language code, more
20522 !! options
20523 language=zh variant=zh title=[[ZH]] showtitle
20524 !! wikitext
20525 -{T|TW}-
20526 !! html
20529 </p>
20530 !! end
20532 !! test
20533 Raw output of variant escape tags (R flag)
20534 !! options
20535 language=zh variant=zh-tw
20536 !! wikitext
20537 Raw: -{R|zh:China;zh-tw:Taiwan}-
20538 !! html
20539 <p>Raw: zh:China;zh-tw:Taiwan
20540 </p>
20541 !! end
20543 !! test
20544 Strings evaluating false shouldn't be ignored by Language converter (T51072)
20545 !! options
20546 language=zh variant=zh-cn
20547 !! input
20548 -{zh-cn:0;zh-sg:1;zh-tw:2;zh-hk:3}-
20549 !! result
20550 <p>0
20551 </p>
20552 !! end
20554 !! test
20555 Conversion rules from [numeric-only string] to [something else] (T48634)
20556 !! options
20557 language=zh variant=zh-cn
20558 !! input
20559 -{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
20560 !! result
20561 <p>D12345EE12345
20562 </p>
20563 !! end
20565 !! test
20566 Bidirectional converter rule entries with an empty value should be ignored (T53551)
20567 !! options
20568 language=zh variant=zh-cn
20569 !! input
20570 -{H|zh-cn:foo;zh-tw:;}-foobar
20571 !! result
20572 <p>foobar
20573 </p>
20574 !! end
20576 !! test
20577 Unidirectional converter rule entries with an empty "from" string should be ignored (T53551)
20578 !! options
20579 language=zh variant=zh-cn
20580 !! input
20581 -{H|=>zh-cn:foo;}-foobar
20582 !! result
20583 <p>foobar
20584 </p>
20585 !! end
20587 !! test
20588 Empty converter rule entries shouldn't be inserted into the conversion table (T53551)
20589 !! options
20590 language=zh variant=zh-cn
20591 !! input
20592 -{H|}-foobar
20593 !! result
20594 <p>foobar
20595 </p>
20596 !! end
20598 !! test
20599 Nested using of manual convert syntax
20600 !! options
20601 language=zh variant=zh-hk
20602 !! wikitext
20603 Nested: -{zh-hans:Hi -{zh-cn:China;zh-sg:Singapore;}-;zh-hant:Hello -{zh-tw:Taiwan;zh-hk:H-{ong}- K-{}-ong;}-;}-!
20604 !! html
20605 <p>Nested: Hello Hong Kong!
20606 </p>
20607 !! end
20609 # Since Parsoid is starting to emit canonical wikitext for links,
20610 # [http://example.com http://example.com] will not RT back to that
20611 # form anymore.
20612 !! test
20613 Proper conversion of text in external links
20614 !! options
20615 language=sr variant=sr-ec
20616 parsoid=wt2html
20617 !! wikitext
20618 http://www.google.com
20619 gopher://www.google.com
20620 [http://www.google.com http://www.google.com]
20621 [gopher://www.google.com gopher://www.google.com]
20622 [https://www.google.com irc://www.google.com]
20623 [ftp://www.google.com www.google.com/ftp://dir]
20624 [//www.google.com www.google.com]
20625 !! html/php
20626 <p><a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
20627 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
20628 <a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
20629 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
20630 <a rel="nofollow" class="external text" href="https://www.google.com">irc://www.google.com</a>
20631 <a rel="nofollow" class="external text" href="ftp://www.google.com">www.гоогле.цом/фтп://дир</a>
20632 <a rel="nofollow" class="external text" href="//www.google.com">www.гоогле.цом</a>
20633 </p>
20634 !! html/parsoid
20635 <p><a rel="mw:ExtLink" href="http://www.google.com">http://www.google.com</a>
20636 <a rel="mw:ExtLink" href="gopher://www.google.com">gopher://www.google.com</a>
20637 <a rel="mw:ExtLink" href="http://www.google.com">http://www.google.com</a>
20638 <a rel="mw:ExtLink" href="gopher://www.google.com">gopher://www.google.com</a>
20639 <a rel="mw:ExtLink" href="https://www.google.com">irc://www.google.com</a>
20640 <a rel="mw:ExtLink" href="ftp://www.google.com">www.гоогле.цом/фтп://дир</a>
20641 <a rel="mw:ExtLink" href="//www.google.com">www.гоогле.цом</a></p>
20642 !! end
20644 !! test
20645 Do not convert roman numbers to language variants
20646 !! options
20647 language=sr variant=sr-ec
20648 !! wikitext
20649 Fridrih IV je car.
20650 !! html
20651 <p>Фридрих IV је цар.
20652 </p>
20653 !! end
20655 !! test
20656 Unclosed language converter markup "-{"
20657 !! options
20658 language=sr
20659 !! wikitext
20660 -{T|hello
20661 !! html
20662 <p>-{T|hello
20663 </p>
20664 !! end
20666 !! test
20667 Don't convert raw rule "-{R|=&gt;}-" to "=>"
20668 !! options
20669 language=sr
20670 !! wikitext
20671 -{R|=&gt;}-
20672 !! html
20673 <p>=&gt;
20674 </p>
20675 !!end
20677 !! test
20678 Don't break link parsing if language converter markup is in the caption.
20679 !! options
20680 language=sr variant=sr-ec
20681 !! wikitext
20682 [[Main Page|-{R|main page}-]]
20683 !! html
20684 <p><a href="/wiki/Main_Page" title="Маин Паге">main page</a>
20685 </p>
20686 !! end
20688 # FIXME: This test is currently broken in the PHP parser T153761
20689 !! test
20690 T146304: Don't break template parsing if language converter markup is in the parameter.
20691 !! options
20692 language=sr variant=sr-ec
20693 disabled
20694 !! wikitext
20695 {{echo|-{R|foo}-}}
20696 !! html/php
20697 <p>foo
20698 </p>
20699 !! end
20701 !! test
20702 T146305: Don't break image parsing if language converter markup is in the caption.
20703 !! options
20704 language=sr
20705 !! wikitext
20706 [[File:Foobar.jpg|thumb|-{R|caption:}-]]
20707 !! html/php
20708 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/%D0%94%D0%B0%D1%82%D0%BE%D1%82%D0%B5%D0%BA%D0%B0: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/%D0%94%D0%B0%D1%82%D0%BE%D1%82%D0%B5%D0%BA%D0%B0:Foobar.jpg" class="internal" title="Повећај"></a></div>caption:</div></div></div>
20710 !! html/parsoid
20711 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="./Датотека:Foobar.jpg"><img resource="./Датотека: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><span typeof="mw:LanguageVariant" data-mw='{"disabled":true,"show":true,"text":"caption:"}'></span></figcaption></figure>
20712 !! end
20714 !! test
20715 T146305: Don't break image parsing if nested language converter markup is in the caption.
20716 !! options
20717 language=zh variant=zh-cn
20718 !! wikitext
20719 [[File:Foobar.jpg|thumb|-{zh-cn:blog (hk: -{zh-hans|WEBJOURNAL}-, tw: -{zh-hans|WEBLOG}-)}-]]
20720 !! html/php
20721 <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="放大"></a></div>blog (hk: WEBJOURNAL, tw: WEBLOG)</div></div></div>
20723 !! html/parsoid
20724 <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><span typeof="mw:LanguageVariant" data-mw='{"bidir":[{"l":"zh-cn","t":"blog (hk: &lt;span typeof=\"mw:LanguageVariant\" data-parsoid=&#39;{\"fl\":[\"zh-hans\"],\"dsr\":[42,64,null,2]}&#39; data-mw=&#39;{\"filter\":[\"zh-hans\"],\"text\":\"WEBJOURNAL\"}&#39;>&lt;/span>, tw: &lt;span typeof=\"mw:LanguageVariant\" data-parsoid=&#39;{\"fl\":[\"zh-hans\"],\"dsr\":[70,88,null,2]}&#39; data-mw=&#39;{\"filter\":[\"zh-hans\"],\"text\":\"WEBLOG\"}&#39;>&lt;/span>)"}],"show":true}'></span></figcaption></figure>
20725 !! end
20727 !! test
20728 Don't break gallery if language converter markup is inside.
20729 !! options
20730 language=zh
20731 !! wikitext
20732 <gallery>
20733 File:foobar.jpg|[[File:foobar.jpg|20px|desc|alt=-{R|foo}-|-{R|bar}-]]|alt=-{R|bat}-
20734 File:foobar.jpg|{{Test|unamedParam|alt=-{R|param}-}}|alt=galleryalt
20735 </gallery>
20736 !! html
20737 <ul class="gallery mw-gallery-traditional">
20738                 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20739                         <div class="thumb" style="width: 150px;"><div style="margin:68px auto;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="bat" 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>
20740                         <div class="gallerytext">
20741 <p><a href="/wiki/File:Foobar.jpg" class="image" title="bar"><img alt="foo" 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>
20742 </p>
20743                         </div>
20744                 </div></li>
20745                 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20746                         <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>
20747                         <div class="gallerytext">
20748 <p>This is a test template
20749 </p>
20750                         </div>
20751                 </div></li>
20752 </ul>
20754 !! end
20756 # FIXME: This test is currently broken in the PHP parser (bug 52661)
20757 !! test
20758 Don't break list handling if language converter markup is in the item.
20759 !! options
20760 language=zh variant=zh-cn
20761 !! wikitext
20762 ;-{zh-cn:AAA;zh-tw:BBB}-
20763 !! html/php
20764 <dl><dt><span class="error">在手动语言转换规则中检测到错误</span></dd></dl>
20766 !! html/parsoid
20767 <dl><dt>AAA
20768 </dt></dl>
20769 !! end
20771 !! test
20772 T153140: Don't break table handling if language converter markup is in the cell.
20773 !! options
20774 language=sr variant=sr-ec
20775 !! wikitext
20778 | -{R|B}-
20780 !! html/php
20781 <table>
20783 <tr>
20784 <td> B
20785 </td></tr></table>
20787 !! html/parsoid
20788 <table>
20790 <tr>
20791 <td> B
20792 </td></tr></table>
20794 !! end
20796 !! test
20797 Bug 529: Uncovered bullet
20798 !! wikitext
20799 * Foo {{bullet}}
20800 !! html
20801 <ul><li> Foo </li>
20802 <li> Bar</li></ul>
20804 !! end
20806 # Plain MediaWiki does not remove empty lists, but tidy actually does.
20807 # Templates in Wikipedia rely on this behavior, as tidy has always been
20808 # enabled there. These tests are normally run *without* tidy, so specify the
20809 # full output here. 
20810 # To test realistic parsing behavior, apply a tidy-like transformation to both
20811 # the expected output and your parser's output.
20812 !! test
20813 Bug 529: Uncovered bullet leaving empty list, normally removed by tidy
20814 !! wikitext
20815 ******* Foo {{bullet}}
20816 !! html
20817 <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>
20818 <li> Bar</li></ul>
20820 !! end
20822 !! test
20823 Bug 529: Uncovered table already at line-start
20824 !! wikitext
20827 {{table}}
20829 !! html
20830 <p>x
20831 </p>
20832 <table>
20833 <tr>
20834 <td> 1 </td>
20835 <td> 2
20836 </td></tr>
20837 <tr>
20838 <td> 3 </td>
20839 <td> 4
20840 </td></tr></table>
20841 <p>y
20842 </p>
20843 !! end
20845 !! test
20846 Bug 529: Uncovered bullet in parser function result
20847 !! wikitext
20848 * Foo {{lc:{{bullet}} }}
20849 !! html
20850 <ul><li> Foo </li>
20851 <li> bar</li></ul>
20853 !! end
20855 !! test
20856 Bug 5678: Double-parsed template argument
20857 !! wikitext
20858 {{lc:{{{1}}}|hello}}
20859 !! html
20860 <p>{{{1}}}
20861 </p>
20862 !! end
20864 !! test
20865 Bug 5678: Double-parsed template invocation
20866 !! wikitext
20867 {{lc:{{paramtest {{!}} param = hello }} }}
20868 !! html
20869 <p>{{paramtest | param = hello }}
20870 </p>
20871 !! end
20873 !! test
20874 Case insensitivity of parser functions for non-ASCII characters (bug 8143)
20875 !! options
20876 language=cs
20877 title=[[Main Page]]
20878 !! wikitext
20879 {{PRVNÍVELKÉ:ěščř}}
20880 {{prvnívelké:ěščř}}
20881 {{PRVNÍMALÉ:ěščř}}
20882 {{prvnímalé:ěščř}}
20883 {{MALÁ:ěščř}}
20884 {{malá:ěščř}}
20885 {{VELKÁ:ěščř}}
20886 {{velká:ěščř}}
20887 !! html
20888 <p>Ěščř
20889 Ěščř
20890 ěščř
20891 ěščř
20892 ěščř
20893 ěščř
20894 ĚŠČŘ
20895 ĚŠČŘ
20896 </p>
20897 !! end
20899 !! test
20900 Morwen/13: Unclosed link followed by heading
20901 !! wikitext
20902 [[link
20903 ==heading==
20904 !! html
20905 <p>[[link
20906 </p>
20907 <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>
20909 !! end
20911 !! test
20912 HHP2.1: Heuristics for headings in preprocessor parenthetical structures
20913 !! wikitext
20914 {{foo|
20915 =heading=
20916 !! html
20917 <p>{{foo|
20918 </p>
20919 <h1><span class="mw-headline" id="heading">heading</span></h1>
20921 !! end
20923 !! test
20924 HHP2.2: Heuristics for headings in preprocessor parenthetical structures
20925 !! wikitext
20926 {{foo|
20927 ==heading==
20928 !! html
20929 <p>{{foo|
20930 </p>
20931 <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>
20933 !! end
20935 !! test
20936 Tildes in comments
20937 !! options
20939 !! wikitext
20940 <!-- ~~~~ -->
20941 !! html/php
20942 <!-- ~~~~ -->
20943 !! end
20945 !! test
20946 Paragraphs inside divs (no extra line breaks)
20947 !! wikitext
20948 <div>Line one
20950 Line two</div>
20951 !! html
20952 <div>Line one
20953 Line two</div>
20955 !! end
20957 !! test
20958 Paragraphs inside divs (extra line break on open)
20959 !! wikitext
20960 <div>
20961 Line one
20963 Line two</div>
20964 !! html
20965 <div>
20966 <p>Line one
20967 </p>
20968 Line two</div>
20970 !! end
20972 !! test
20973 Paragraphs inside divs (extra line break on close)
20974 !! wikitext
20975 <div>Line one
20977 Line two
20978 </div>
20979 !! html
20980 <div>Line one
20981 <p>Line two
20982 </p>
20983 </div>
20985 !! end
20987 !! test
20988 Paragraphs inside divs (extra line break on open and close)
20989 !! wikitext
20990 <div>
20991 Line one
20993 Line two
20994 </div>
20995 !! html
20996 <div>
20997 <p>Line one
20998 </p><p>Line two
20999 </p>
21000 </div>
21002 !! end
21004 !! test
21005 Nesting tags, paragraphs on lines which begin with <div>
21006 !! wikitext
21007 <div></div><strong>A
21008 B</strong>
21009 !! html/php+tidy
21010 <p><strong>A</strong></p>
21011 <p><strong>B</strong></p>
21012 !! html/parsoid
21013 <div></div>
21014 <p><strong>A
21015 B</strong>
21016 </p>
21017 !! end
21019 # Bug 6200: <blockquote> should behave like <div> with respect to line breaks
21020 !! test
21021 Bug 6200: paragraphs inside blockquotes (no extra line breaks)
21022 !! wikitext
21023 <blockquote>Line one
21025 Line two</blockquote>
21026 !! html
21027 <blockquote>Line one
21028 Line two</blockquote>
21030 !! html+tidy
21031 <blockquote>
21032 <p>Line one Line two</p>
21033 </blockquote>
21034 !! end
21036 !! test
21037 Bug 6200: paragraphs inside blockquotes (extra line break on open)
21038 !! wikitext
21039 <blockquote>
21040 Line one
21042 Line two</blockquote>
21043 !! html
21044 <blockquote>
21045 <p>Line one
21046 </p>
21047 Line two</blockquote>
21049 !! html+tidy
21050 <blockquote>
21051 <p>Line one</p>
21052 Line two</blockquote>
21053 !! end
21055 !! test
21056 Bug 6200: paragraphs inside blockquotes (extra line break on close)
21057 !! wikitext
21058 <blockquote>Line one
21060 Line two
21061 </blockquote>
21062 !! html
21063 <blockquote>Line one
21064 <p>Line two
21065 </p>
21066 </blockquote>
21068 !! html+tidy
21069 <blockquote>
21070 <p>Line one</p>
21071 <p>Line two</p>
21072 </blockquote>
21073 !! end
21075 !! test
21076 Bug 6200: paragraphs inside blockquotes (extra line break on open and close)
21077 !! wikitext
21078 <blockquote>
21079 Line one
21081 Line two
21082 </blockquote>
21083 !! html
21084 <blockquote>
21085 <p>Line one
21086 </p><p>Line two
21087 </p>
21088 </blockquote>
21090 !! html+tidy
21091 <blockquote>
21092 <p>Line one</p>
21093 <p>Line two</p>
21094 </blockquote>
21095 !! end
21097 !! test
21098 Paragraphs inside blockquotes/divs (no extra line breaks)
21099 !! wikitext
21100 <blockquote><div>Line one
21102 Line two</div></blockquote>
21103 !! html
21104 <blockquote><div>Line one
21105 Line two</div></blockquote>
21107 !! end
21109 !! test
21110 Paragraphs inside blockquotes/divs (extra line break on open)
21111 !! wikitext
21112 <blockquote><div>
21113 Line one
21115 Line two</div></blockquote>
21116 !! html
21117 <blockquote><div>
21118 <p>Line one
21119 </p>
21120 Line two</div></blockquote>
21122 !! end
21124 !! test
21125 Paragraphs inside blockquotes/divs (extra line break on close)
21126 !! wikitext
21127 <blockquote><div>Line one
21129 Line two
21130 </div></blockquote>
21131 !! html
21132 <blockquote><div>Line one
21133 <p>Line two
21134 </p>
21135 </div></blockquote>
21137 !! end
21139 !! test
21140 Paragraphs inside blockquotes/divs (extra line break on open and close)
21141 !! wikitext
21142 <blockquote><div>
21143 Line one
21145 Line two
21146 </div></blockquote>
21147 !! html
21148 <blockquote><div>
21149 <p>Line one
21150 </p><p>Line two
21151 </p>
21152 </div></blockquote>
21154 !! end
21156 !! test
21157 Interwiki links trounced by replaceExternalLinks after early LinkHolderArray expansion
21158 !! options
21159 wgLinkHolderBatchSize=0
21160 !! wikitext
21161 [[meatball:1]]
21162 [[meatball:2]]
21163 [[meatball:3]]
21164 !! html
21165 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?1" class="extiw" title="meatball:1">meatball:1</a>
21166 <a href="http://www.usemod.com/cgi-bin/mb.pl?2" class="extiw" title="meatball:2">meatball:2</a>
21167 <a href="http://www.usemod.com/cgi-bin/mb.pl?3" class="extiw" title="meatball:3">meatball:3</a>
21168 </p>
21169 !! end
21171 !! test
21172 Free external link invading image caption
21173 !! wikitext
21174 [[Image:Foobar.jpg|thumb|http://x|hello]]
21175 !! html
21176 <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>
21178 !! end
21180 !! test
21181 Bug 15196: localised external link numbers
21182 !! options
21183 language=fa
21184 !! wikitext
21185 [http://en.wikipedia.org/]
21186 !! html/php
21187 <p><a rel="nofollow" class="external autonumber" href="http://en.wikipedia.org/">[۱]</a>
21188 </p>
21189 !! html/parsoid
21190 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/"></a></p>
21191 !! end
21193 !! test
21194 Multibyte character in padleft
21195 !! wikitext
21196 {{padleft:-Hello|7|Æ}}
21197 !! html
21198 <p>Æ-Hello
21199 </p>
21200 !! end
21202 !! test
21203 Multibyte character in padright
21204 !! wikitext
21205 {{padright:Hello-|7|Æ}}
21206 !! html
21207 <p>Hello-Æ
21208 </p>
21209 !! end
21211 !!test
21212 formatdate parser function
21213 !! wikitext
21214 {{#formatdate:2009-03-24}}
21215 !! html
21216 <p><span class="mw-formatted-date" title="2009-03-24">2009-03-24</span>
21217 </p>
21218 !! end
21220 !!test
21221 formatdate parser function, with default format
21222 !! wikitext
21223 {{#formatdate:2009-03-24|mdy}}
21224 !! html
21225 <p><span class="mw-formatted-date" title="2009-03-24">March 24, 2009</span>
21226 </p>
21227 !! end
21229 !! test
21230 Spacing of numbers in formatted dates
21231 !! wikitext
21232 {{#formatdate:January 15}}
21233 !! html
21234 <p><span class="mw-formatted-date" title="01-15">January 15</span>
21235 </p>
21236 !! end
21238 !! test
21239 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
21240 !! options
21241 language=nl title=[[MediaWiki:Common.css]]
21242 !! wikitext
21243 {{#formatdate:2009-03-24|dmy}}
21244 !! html
21245 <p><span class="mw-formatted-date" title="2009-03-24">24 March 2009</span>
21246 </p>
21247 !! end
21254 # Edit comments
21257 !! test
21258 Edit comment with link
21259 !! options
21260 comment
21261 !! wikitext
21262 I like the [[Main Page]] a lot
21263 !! html/php
21264 I like the <a href="/wiki/Main_Page" title="Main Page">Main Page</a> a lot
21265 !!end
21267 !! test
21268 Edit comment with link and link text
21269 !! options
21270 comment
21271 !! wikitext
21272 I like the [[Main Page|best pages]] a lot
21273 !! html/php
21274 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
21275 !!end
21277 !! test
21278 Edit comment with link and link text with suffix
21279 !! options
21280 comment
21281 !! wikitext
21282 I like the [[Main Page|best page]]s a lot
21283 !! html/php
21284 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
21285 !!end
21287 !! test
21288 Edit comment with section link (non-local, eg in history list)
21289 !! options
21290 comment title=[[Main Page]]
21291 !! wikitext
21292 /* External links */ removed bogus entries
21293 !! html/php
21294 <a href="/wiki/Main_Page#External_links" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
21295 !!end
21297 !! test
21298 Edit comment with section link and text before it (non-local, eg in history list)
21299 !! options
21300 comment title=[[Main Page]]
21301 !! wikitext
21302 pre-comment text /* External links */ removed bogus entries
21303 !! html/php
21304 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>
21305 !!end
21307 !! test
21308 Edit comment with section link (local, eg in diff view)
21309 !! options
21310 comment local title=[[Main Page]]
21311 !! wikitext
21312 /* External links */ removed bogus entries
21313 !! html/php
21314 <a href="#External_links">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
21315 !!end
21317 !! test
21318 Edit comment with subpage link (bug 14080)
21319 !! options
21320 comment
21321 subpage
21322 title=[[Subpage test]]
21323 !! wikitext
21324 Poked at a [[/subpage]] here...
21325 !! html/php
21326 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a> here...
21327 !!end
21329 !! test
21330 Edit comment with subpage link and link text (bug 14080)
21331 !! options
21332 comment
21333 subpage
21334 title=[[Subpage test]]
21335 !! wikitext
21336 Poked at a [[/subpage|neat little page]] here...
21337 !! html/php
21338 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">neat little page</a> here...
21339 !!end
21341 !! test
21342 Edit comment with bogus subpage link in non-subpage NS (bug 14080)
21343 !! options
21344 comment
21345 title=[[Subpage test]]
21346 !! wikitext
21347 Poked at a [[/subpage]] here...
21348 !! html/php
21349 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...
21350 !!end
21352 !! test
21353 Edit comment with bare anchor link (local, as on diff)
21354 !! options
21355 comment
21356 local
21357 title=[[Main Page]]
21358 !! wikitext
21359 [[#section]]
21360 !! html/php
21361 <a href="#section">#section</a>
21362 !! end
21364 !! test
21365 Edit comment with bare anchor link (non-local, as on history)
21366 !! options
21367 comment
21368 title=[[Main Page]]
21369 !! wikitext
21370 [[#section]]
21371 !! html/php
21372 <a href="/wiki/Main_Page#section" title="Main Page">#section</a>
21373 !! end
21375 !! test
21376 Anchor starting with underscore
21377 !! options
21378 title=[[Foo]]
21379 !! wikitext
21380 [[#_ref|One]]
21381 !! html/php
21382 <p><a href="#_ref">One</a>
21383 </p>
21384 !! html/parsoid
21385 <p><a rel="mw:WikiLink" href="./Foo#_ref" data-parsoid='{"stx":"piped","a":{"href":"./Foo#_ref"},"sa":{"href":"#_ref"}}'>One</a></p>
21386 !! end
21388 !! test
21389 Id starting with underscore
21390 !! wikitext
21391 <div id="_ref"></div>
21392 !! html/*
21393 <div id="_ref"></div>
21395 !! end
21397 !! test
21398 Edit comment with link with more than one pipe (T99346)
21399 !! options
21400 comment
21401 !! wikitext
21402 [[Main Page|Many|pipes]]
21403 !! html/php
21404 <a href="/wiki/Main_Page" title="Main Page">Many|pipes</a>
21405 !! end
21407 !! test
21408 Complex edit comment with link with more than one pipe (T99346)
21409 !! options
21410 comment
21411 !! wikitext
21412 Created page with "<noinclude>[[Category:Requests for permissions/Bot|{{subst:#titleparts:{{subst:PAGENAME}}|1|3}}]]</noinclude> === [[User:MineoBot|]] 8=== {{Request for permissions/links|Mineo..."
21413 !! html/php
21414 Created page with &quot;&lt;noinclude&gt;<a href="/index.php?title=Category:Requests_for_permissions/Bot&amp;action=edit&amp;redlink=1" class="new" title="Category:Requests for permissions/Bot (page does not exist)">{{subst:#titleparts:{{subst:PAGENAME}}|1|3}}</a>&lt;/noinclude&gt; === <a href="/index.php?title=User:MineoBot&amp;action=edit&amp;redlink=1" class="new" title="User:MineoBot (page does not exist)">User:MineoBot</a> 8=== {{Request for permissions/links|Mineo...&quot;
21415 !! end
21417 !! test
21418 Space normalisation on autocomment (bug 22784)
21419 !! options
21420 comment
21421 title=[[Main Page]]
21422 !! wikitext
21423 /* __hello__world__ */
21424 !! html/php
21425 <a href="/wiki/Main_Page#hello_world" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">__hello__world__</span></span>
21426 !! end
21428 !! test
21429 percent-encoding and + signs in comments (Bug 26410)
21430 !! options
21431 comment
21432 !! wikitext
21433 [[ABC%33D% ++]] [[ABC%33D% ++|+%20]]
21434 !! html/php
21435 <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>
21436 !! end
21438 # Parsoid doesn't support this yet: see bug 73581
21439 # but it *should* omit the 'src' attribute if the image is bad.
21440 # PHP side of tests was disabled in
21441 # mediawiki/core:6bd31e7d95161a6e88fa86df60871051da997c3c
21442 # because of issues in the PHP parserTests infrastructure
21443 # (but the output below is indeed what the PHP side emits)
21444 !! test
21445 Bad images - basic functionality
21446 !! wikitext
21447 [[File:Bad.jpg]]
21448 !! DISABLED/html/php
21449 !! html/parsoid
21450 <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>
21451 !! end
21453 !! test
21454 Bad images - bug 16039: text after bad image disappears
21455 !! wikitext
21456 Foo bar
21457 [[File:Bad.jpg]]
21458 Bar foo
21459 !! DISABLED/html/php
21460 <p>Foo bar
21461 </p><p>Bar foo
21462 </p>
21463 !! html/parsoid
21464 <p>Foo bar
21465 <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>
21466 Bar foo</p>
21467 !! end
21469 !! test
21470 Verify that displaytitle works (bug #22501) no displaytitle
21471 !! options
21472 showtitle
21473 !! config
21474 wgAllowDisplayTitle=true
21475 wgRestrictDisplayTitle=false
21476 !! wikitext
21477 this is not the the title
21478 !! html/php
21479 Parser test
21480 <p>this is not the the title
21481 </p>
21482 !! end
21484 !! test
21485 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=false
21486 !! options
21487 showtitle
21488 title=[[Screen]]
21489 !! config
21490 wgAllowDisplayTitle=true
21491 wgRestrictDisplayTitle=false
21492 !! wikitext
21493 this is not the the title
21494 {{DISPLAYTITLE:whatever}}
21495 !! html/php
21496 whatever
21497 <p>this is not the the title
21498 </p>
21499 !! end
21501 !! test
21502 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true mismatch
21503 !! options
21504 showtitle
21505 title=[[Screen]]
21506 !! config
21507 wgAllowDisplayTitle=true
21508 wgRestrictDisplayTitle=true
21509 !! wikitext
21510 this is not the the title
21511 {{DISPLAYTITLE:whatever}}
21512 !! html/php
21513 Screen
21514 <p>this is not the the title
21515 </p>
21516 !! end
21518 !! test
21519 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true matching
21520 !! options
21521 showtitle
21522 title=[[Screen]]
21523 !! config
21524 wgAllowDisplayTitle=true
21525 wgRestrictDisplayTitle=true
21526 !! wikitext
21527 this is not the the title
21528 {{DISPLAYTITLE:screen}}
21529 !! html/php
21530 screen
21531 <p>this is not the the title
21532 </p>
21533 !! end
21535 !! test
21536 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false
21537 !! options
21538 showtitle
21539 title=[[Screen]]
21540 !! config
21541 wgAllowDisplayTitle=false
21542 !! wikitext
21543 this is not the the title
21544 {{DISPLAYTITLE:screen}}
21545 !! html/php
21546 Screen
21547 <p>this is not the the title
21548 <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>
21549 </p>
21550 !! end
21552 !! test
21553 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false no DISPLAYTITLE
21554 !! options
21555 showtitle
21556 title=[[Screen]]
21557 !! config
21558 wgAllowDisplayTitle=false
21559 !! wikitext
21560 this is not the the title
21561 !! html/php
21562 Screen
21563 <p>this is not the the title
21564 </p>
21565 !! end
21567 !! test
21568 Verify that displaytitle handles inline CSS styles (bug 26547) - rejected value
21569 !! options
21570 showtitle
21571 title=[[Screen]]
21572 !! config
21573 wgAllowDisplayTitle=true
21574 wgRestrictDisplayTitle=true
21575 !! wikitext
21576 this is not the the title
21577 {{DISPLAYTITLE:<span style="display: none;">s</span>creen}}
21578 !! html/php
21579 <span style="/* attempt to bypass $wgRestrictDisplayTitle */">s</span>creen
21580 <p>this is not the the title
21581 </p>
21582 !! end
21584 !! test
21585 Verify that displaytitle handles inline CSS styles (bug 26547) - accepted value
21586 !! options
21587 showtitle
21588 title=[[Screen]]
21589 !! config
21590 wgAllowDisplayTitle=true
21591 wgRestrictDisplayTitle=true
21592 !! wikitext
21593 this is not the the title
21594 {{DISPLAYTITLE:<span style="color: red;">s</span>creen}}
21595 !! html/php
21596 <span style="color: red;">s</span>creen
21597 <p>this is not the the title
21598 </p>
21599 !! end
21601 !! test
21602 Page status indicators: Empty name is invalid
21603 !! options
21604 showindicators
21605 !! wikitext
21606 <indicator name=" "></indicator>
21607 <indicator></indicator>
21608 !! html
21609 <p><span class="error"><strong>Error:</strong> Page status indicators' <code>name</code> attribute must not be empty.</span>
21610 <span class="error"><strong>Error:</strong> Page status indicators' <code>name</code> attribute must not be empty.</span>
21611 </p>
21612 !! end
21614 !! test
21615 Page status indicators: Weird syntaxes that are okay
21616 !! options
21617 showindicators
21618 !! wikitext
21619 <indicator name="empty" />
21620 <indicator name="name"></indicator>
21621 !! html
21622 empty=
21623 name=
21624 <p><br />
21625 </p>
21626 !! end
21628 !! test
21629 Page status indicators: Torture test
21630 !! options
21631 showindicators
21632 !! wikitext
21633 <indicator name="01">hello world</indicator>
21634 <indicator name="02">[[Main Page]]</indicator>
21635 <indicator name="03">[[File:Foobar.jpg|25px|link=]]</indicator>
21636 <indicator name="04">[[File:Foobar.jpg|25px]]</indicator>
21637 <indicator name="05">* foo
21638 * bar</indicator>
21639 <indicator name="06"><nowiki>foo</nowiki></indicator>
21640 <indicator name="07"> Preformatted</indicator>
21641 <indicator name="08"><div>Broken tag</indicator>
21642 <indicator name="09">{| class=wikitable
21643 | cell
21644 |}</indicator>
21645 <indicator name="10">Two
21647 paragraphs</indicator>
21648 !! html
21649 01=hello world
21650 02=<a href="/wiki/Main_Page" title="Main Page">Main Page</a>
21651 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" />
21652 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>
21653 05=<ul><li> foo</li>
21654 <li> bar</li></ul>
21656 06=foo
21657 07=<pre>Preformatted
21658 </pre>
21659 08=<div>Broken tag</div>
21661 09=<table class="wikitable">
21662 <tr>
21663 <td> cell
21664 </td></tr></table>
21666 10=<p>Two
21667 </p><p>paragraphs
21668 </p>
21669 <p><br />
21670 </p><p><br />
21671 </p><p><br />
21672 </p><p><br />
21673 </p><p><br />
21674 </p>
21675 !! end
21677 !! test
21678 preload: check <noinclude> and <includeonly>
21679 !! options
21680 preload
21681 !! wikitext
21682 Hello <noinclude>cruel</noinclude><includeonly>kind</includeonly> world.
21683 !! html/php
21684 Hello kind world.
21685 !! end
21687 !! test
21688 preload: check <onlyinclude>
21689 !! options
21690 preload
21691 !! wikitext
21692 Goodbye <onlyinclude>Hello world</onlyinclude>
21693 !! html/php
21694 Hello world
21695 !! end
21697 !! test
21698 preload: can pass tags through if we want to
21699 !! options
21700 preload
21701 !! wikitext
21702 <includeonly><</includeonly>includeonly>Hello world<includeonly><</includeonly>/includeonly>
21703 !! html/php
21704 <includeonly>Hello world</includeonly>
21705 !! end
21707 !! test
21708 preload: check that it doesn't try to do tricks
21709 !! options
21710 preload
21711 !! wikitext
21712 * <!-- Hello --> ''{{world}}'' {{<includeonly>subst:</includeonly>How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
21713 !! html/php
21714 * <!-- Hello --> ''{{world}}'' {{subst:How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
21715 !! end
21717 !! test
21718 Play a bit with r67090 and bug 3158
21719 !! wikitext
21720 <div style="width:50% !important">&nbsp;</div>
21721 <div style="width:50%&nbsp;!important">&nbsp;</div>
21722 <div style="width:50%&#160;!important">&nbsp;</div>
21723 <div style="border : solid;">&nbsp;</div>
21724 !! html/php
21725 <div style="width:50% !important">&#160;</div>
21726 <div style="width:50% !important">&#160;</div>
21727 <div style="width:50% !important">&#160;</div>
21728 <div style="border&#160;: solid;">&#160;</div>
21730 !! html/parsoid
21731 <div style="width:50% !important" data-parsoid='{"stx":"html"}'><span typeof="mw:Entity" data-parsoid='{"srcContent":" "}'> </span></div>
21732 <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>
21733 <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>
21734 <div style="border : solid;" data-parsoid='{"stx":"html"}'><span typeof="mw:Entity" data-parsoid='{"srcContent":" "}'> </span></div>
21736 !! end
21738 !! test
21739 HTML5 data attributes
21740 !! wikitext
21741 <span data-foo="bar">Baz</span>
21742 <p data-abc-def_hij="">Quuz</p>
21743 !! html/php
21744 <p><span data-foo="bar">Baz</span>
21745 </p>
21746 <p data-abc-def_hij="">Quuz</p>
21748 !! html/parsoid
21749 <p><span data-foo="bar" data-parsoid='{"stx":"html"}'>Baz</span></p>
21750 <p data-abc-def_hij="" data-parsoid='{"stx":"html"}'>Quuz</p>
21751 !! end
21753 !! test
21754 Strip reserved data attributes
21755 !! wikitext
21756 <div data-mw="foo" data-parsoid="bar" data-mw-someext="baz" data-ok="fred" data-ooui="xyzzy" data-bad:ns="ns">d</div>
21757 !! html/php
21758 <div data-ok="fred">d</div>
21760 !! html/parsoid
21761 <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>
21762 !! end
21764 !! test
21765 percent-encoding and + signs in internal links (Bug 26410)
21766 !! wikitext
21767 [[User:+%]] [[Page+title%]]
21768 [[%+]] [[%+|%20]] [[%+ ]] [[%+r]]
21769 [[%]] [[+]] [[File:%+abc%39|foo|[[bar]]]]
21770 [[%33%45]] [[%33%45+]]
21771 !! html/php
21772 <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>
21773 <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>
21774 <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>
21775 <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>
21776 </p>
21777 !! html/parsoid
21778 <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>
21779 <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>
21780 <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>
21781 <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>
21782 !! end
21784 !! test
21785 Special characters in embedded file links (bug 27679)
21786 !! wikitext
21787 [[File:Contains & ampersand.jpg]]
21788 [[File:Does not exist.jpg|Title with & ampersand]]
21789 !! html/php
21790 <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>
21791 <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>
21792 </p>
21793 !! html/parsoid
21794 <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>
21795 <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>
21796 !! end
21798 !! test
21799 Confirm that 'apos' named character reference doesn't make it to output (not legal in HTML 4)
21800 !! wikitext
21801 Text&apos;s been normalized?
21802 !! html
21803 <p>Text&#39;s been normalized?
21804 </p>
21805 !! end
21807 !! test
21808 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate free external links
21809 !! wikitext
21810 http://www.example.org/ <-- U+3000 (vim: ^Vu3000)
21811 !! html
21812 <p><a rel="nofollow" class="external free" href="http://www.example.org/">http://www.example.org/</a> &lt;-- U+3000 (vim: ^Vu3000)
21813 </p>
21814 !! end
21816 !! test
21817 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate bracketed external links
21818 !! wikitext
21819 [http://www.example.org/ ideograms]
21820 !! html
21821 <p><a rel="nofollow" class="external text" href="http://www.example.org/">ideograms</a>
21822 </p>
21823 !! end
21825 !! test
21826 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate external images links
21827 !! wikitext
21828 http://www.example.org/pic.png <-- U+3000 (vim: ^Vu3000)
21829 !! html
21830 <p><img src="http://www.example.org/pic.png" alt="pic.png"/> &lt;-- U+3000 (vim: ^Vu3000)
21831 </p>
21832 !! end
21834 !! article
21835 Mediawiki:loop1
21836 !! text
21837 {{Identical|A}}
21838 !! endarticle
21840 !! article
21841 Mediawiki:loop2
21842 !! text
21843 {{Identical|B}}
21844 !! endarticle
21846 !! article
21847 Template:Identical
21848 !! text
21849 {{int:loop1}}
21850 {{int:loop2}}
21851 !! endarticle
21853 !! test
21854 Bug 31098 Template which includes system messages which includes the template
21855 !! wikitext
21856 {{Identical}}
21857 !! html
21858 <p><span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
21859 <span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
21860 </p>
21861 !! end
21863 !! test
21864 Bug31490 Turkish: ucfirst 'blah'
21865 !! options
21866 language=tr
21867 !! wikitext
21868 {{ucfirst:blah}}
21869 !! html
21870 <p>Blah
21871 </p>
21872 !! end
21874 !! test
21875 Bug31490 Turkish: ucfirst 'ix'
21876 !! options
21877 language=tr
21878 !! wikitext
21879 {{ucfirst:ix}}
21880 !! html
21881 <p>İx
21882 </p>
21883 !! end
21885 !! test
21886 Bug31490 Turkish: lcfirst 'BLAH'
21887 !! options
21888 language=tr
21889 !! wikitext
21890 {{lcfirst:BLAH}}
21891 !! html
21892 <p>bLAH
21893 </p>
21894 !! end
21896 !! test
21897 Bug31490 Turkish: ucfırst (with a dotless i)
21898 !! options
21899 language=tr
21900 !! wikitext
21901 {{ucfırst:blah}}
21902 !! html
21903 <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>
21904 </p>
21905 !! end
21907 !! test
21908 Bug31490 ucfırst (with a dotless i) with English language
21909 !! options
21910 language=en
21911 !! wikitext
21912 {{ucfırst:blah}}
21913 !! html
21914 <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>
21915 </p>
21916 !! end
21918 !! test
21919 Bug 26375: TOC with italics
21920 !! options
21921 title=[[Main Page]]
21922 !! wikitext
21923 __TOC__
21924 == ''Lost'' episodes ==
21925 !! html
21926 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
21927 <ul>
21928 <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>
21929 </ul>
21930 </div>
21932 <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>
21934 !! end
21936 !! test
21937 Bug 26375: TOC with bold
21938 !! options
21939 title=[[Main Page]]
21940 !! wikitext
21941 __TOC__
21942 == '''should be bold''' then normal text ==
21943 !! html
21944 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
21945 <ul>
21946 <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>
21947 </ul>
21948 </div>
21950 <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>
21952 !! end
21954 !! test
21955 Bug 33845: Headings become cursive in TOC when they contain an image
21956 !! options
21957 title=[[Main Page]]
21958 !! wikitext
21959 __TOC__
21960 == Image [[Image:foobar.jpg]] ==
21961 !! html
21962 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
21963 <ul>
21964 <li class="toclevel-1 tocsection-1"><a href="#Image"><span class="tocnumber">1</span> <span class="toctext">Image</span></a></li>
21965 </ul>
21966 </div>
21968 <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>
21970 !! end
21972 !! test
21973 Bug 33845 (2): Headings become bold in TOC when they contain a blockquote
21974 !! options
21975 title=[[Main Page]]
21976 !! wikitext
21977 __TOC__
21978 == <blockquote>Quote</blockquote> ==
21979 !! html
21980 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
21981 <ul>
21982 <li class="toclevel-1 tocsection-1"><a href="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
21983 </ul>
21984 </div>
21986 <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>
21988 !! html+tidy
21989 <p></p>
21990 <div id="toc" class="toc">
21991 <div id="toctitle">
21992 <h2>Contents</h2>
21993 </div>
21994 <ul>
21995 <li class="toclevel-1 tocsection-1"><a href="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
21996 </ul>
21997 </div>
21998 <p></p>
21999 <h2><span class="mw-headline" id="Quote"></span></h2>
22000 <blockquote>
22001 <p><span class="mw-headline" id="Quote">Quote</span></p>
22002 </blockquote>
22003 <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>
22004 !! end
22006 !! test
22007 Unclosed tags in TOC
22008 !! options
22009 title=[[Main Page]]
22010 !! wikitext
22011 __TOC__
22012 == Proof: 2 < 3 ==
22013 <small>Hanc marginis exiguitas non caperet.</small>
22015 !! html
22016 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
22017 <ul>
22018 <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>
22019 </ul>
22020 </div>
22022 <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>
22023 <p><small>Hanc marginis exiguitas non caperet.</small>
22025 </p>
22026 !! end
22028 !! test
22029 Multiple tags in TOC
22030 !! wikitext
22031 __TOC__
22032 == <i>Foo</i> <b>Bar</b> ==
22034 == <i>Foo</i> <blockquote>Bar</blockquote> ==
22035 !! html
22036 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
22037 <ul>
22038 <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>
22039 <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>
22040 </ul>
22041 </div>
22043 <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>
22044 <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>
22046 !! html+tidy
22047 <p></p>
22048 <div id="toc" class="toc">
22049 <div id="toctitle">
22050 <h2>Contents</h2>
22051 </div>
22052 <ul>
22053 <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>
22054 <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>
22055 </ul>
22056 </div>
22057 <p></p>
22058 <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>
22059 <h2><span class="mw-headline" id="Foo_Bar_2"><i>Foo</i></span></h2>
22060 <blockquote>
22061 <p><span class="mw-headline" id="Foo_Bar_2">Bar</span></p>
22062 </blockquote>
22063 <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>
22064 !! end
22066 # Don't expect Parsoid to roundtrip this until the php parser comes closer to
22067 # html5 tag parsing.
22068 !! test
22069 Tags with parameters in TOC
22070 !! options
22071 parsoid=wt2html
22072 !! wikitext
22073 __TOC__
22074 == <sup class="in-h2">Hello</sup> ==
22076 == <sup class="a > b">Evilbye</sup> ==
22077 !! html/php
22078 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
22079 <ul>
22080 <li class="toclevel-1 tocsection-1"><a href="#Hello"><span class="tocnumber">1</span> <span class="toctext"><sup>Hello</sup></span></a></li>
22081 <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>
22082 </ul>
22083 </div>
22085 <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>
22086 <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>
22088 !! html/parsoid
22089 <meta property="mw:PageProp/toc" />
22090 <h2> <sup class="in-h2" data-parsoid='{"stx":"html"}'>Hello</sup> </h2>
22092 <h2> <sup class="a " data-parsoid='{"stx":"html"}'> b">Evilbye</sup> </h2>
22093 !! end
22095 !! test
22096 span tags with directionality in TOC
22097 !! wikitext
22098 __TOC__
22099 == <span dir="ltr">C++</span> ==
22101 == <span dir="rtl">זבנג!</span> ==
22103 == <span style="font-style: italic">The attributes on these span tags must be deleted from the TOC</span> ==
22105 == <span style="font-style: italic" dir="ltr">All attributes on these span tags must be deleted from the TOC</span> ==
22107 == <span dir="ltr" style="font-style: italic">Attributes after dir on these span tags must be deleted from the TOC</span> ==
22108 !! html
22109 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
22110 <ul>
22111 <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>
22112 <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>
22113 <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>
22114 <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>
22115 <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>
22116 </ul>
22117 </div>
22119 <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>
22120 <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>
22121 <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>
22122 <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>
22123 <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>
22125 !! end
22127 !! test
22128 Bug 72884: bdi element in ToC
22129 !! wikitext
22130 __TOC__
22131 == <bdi>test</bdi> ==
22132 !! html
22133 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
22134 <ul>
22135 <li class="toclevel-1 tocsection-1"><a href="#test"><span class="tocnumber">1</span> <span class="toctext"><bdi>test</bdi></span></a></li>
22136 </ul>
22137 </div>
22139 <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>
22141 !! end
22143 !! test
22144 T35715: s/strike element in ToC
22145 !! wikitext
22146 __TOC__
22147 == <s>test</s> test <strike>test</strike> ==
22148 !! html
22149 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
22150 <ul>
22151 <li class="toclevel-1 tocsection-1"><a href="#test_test_test"><span class="tocnumber">1</span> <span class="toctext"><s>test</s> test <strike>test</strike></span></a></li>
22152 </ul>
22153 </div>
22155 <h2><span class="mw-headline" id="test_test_test"><s>test</s> test <strike>test</strike></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 test test">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
22157 !! end
22159 # Note that the html output does not have the <p></p>, but the
22160 # html+tidy output *does*.  This is because the empty <p></p> is
22161 # removed by the sanitizer, but only when tidy is *not* enabled (!).
22162 !! test
22163 Empty <p> tag in TOC, removed by Sanitizer (T92892)
22164 !! wikitext
22165 __TOC__
22166 == x ==
22167 !! html
22168 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
22169 <ul>
22170 <li class="toclevel-1 tocsection-1"><a href="#x"><span class="tocnumber">1</span> <span class="toctext">x</span></a></li>
22171 </ul>
22172 </div>
22174 <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>
22176 !! html+tidy
22177 <p></p>
22178 <div id="toc" class="toc">
22179 <div id="toctitle">
22180 <h2>Contents</h2>
22181 </div>
22182 <ul>
22183 <li class="toclevel-1 tocsection-1"><a href="#x"><span class="tocnumber">1</span> <span class="toctext">x</span></a></li>
22184 </ul>
22185 </div>
22186 <p></p>
22187 <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>
22188 !! end
22190 !! article
22191 MediaWiki:Bug32057
22192 !! text
22193 == {{int:headline_sample}} ==
22194 !! endarticle
22196 !! test
22197 Bug 32057: Title needed when expanding <h> nodes.
22198 !! options
22199 title=[[Main Page]]
22200 !! wikitext
22201 {{int:Bug32057}}
22202 !! html
22203 <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>
22205 !! end
22207 !! test
22208 Strip marker in urlencode
22209 !! wikitext
22210 {{urlencode:x<nowiki/>y}}
22211 {{urlencode:x<nowiki/>y|wiki}}
22212 {{urlencode:x<nowiki/>y|path}}
22213 {{urlencode:x<pre id="one">two</pre>y}}
22214 !! html/php
22215 <p>xy
22219 </p>
22220 !! end
22222 !! test
22223 Strip marker in lc
22224 !! wikitext
22225 {{lc:x<nowiki/>y}}
22226 !! html
22227 <p>xy
22228 </p>
22229 !! end
22231 !! test
22232 Strip marker in uc
22233 !! wikitext
22234 {{uc:x<nowiki/>y}}
22235 !! html
22236 <p>XY
22237 </p>
22238 !! end
22240 !! test
22241 Strip marker in formatNum
22242 !! wikitext
22243 {{formatnum:1<nowiki/>2}}
22244 {{formatnum:1<nowiki/>2|R}}
22245 !! html
22246 <p>12
22248 </p>
22249 !! end
22251 !! test
22252 Check noCommafy in formatNum
22253 !! options
22254 language=be-tarask
22255 !! wikitext
22256 {{formatnum:123456.78}}
22257 {{formatnum:123456.78|NOSEP}}
22258 !! html
22259 <p>123 456,78
22260 123456.78
22261 </p>
22262 !! end
22264 !! test
22265 Wrong option for formatNum (bug 56199)
22266 !! wikitext
22267 {{formatnum:1,234.56|Random}}
22268 {{formatnum:1,234.56|EVERYTHING}}
22269 {{formatnum:1234.56|any argument that has the string 'NOSEP'}}
22270 !! html
22271 <p>1,234.56
22272 1,234.56
22273 1,234.56
22274 </p>
22275 !! end
22277 !! test
22278 Strip marker in grammar
22279 !! options
22280 language=fi
22281 !! wikitext
22282 {{grammar:elative|foo<nowiki/>bar}}
22283 !! html
22284 <p>foobarista
22285 </p>
22286 !! end
22288 !! test
22289 Strip marker in padleft
22290 !! wikitext
22291 {{padleft:|2|x<nowiki/>y}}
22292 !! html
22293 <p>xy
22294 </p>
22295 !! end
22297 !! test
22298 Strip marker in padright
22299 !! wikitext
22300 {{padright:|2|x<nowiki/>y}}
22301 !! html
22302 <p>xy
22303 </p>
22304 !! end
22306 !! test
22307 Strip marker in anchorencode
22308 !! wikitext
22309 {{anchorencode:x<nowiki/>y}}
22310 !! html
22311 <p>xy
22312 </p>
22313 !! end
22315 !! test
22316 nowiki inside link inside heading (bug 18295)
22317 !! wikitext
22318 ==[[foo|x<nowiki>y</nowiki>z]]==
22319 !! html
22320 <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>
22322 !! end
22324 !! test
22325 new support for bdi element (bug 31817)
22326 !! wikitext
22327 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
22328 !! html
22329 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
22331 !!end
22333 !! test
22334 Ignore pipe between table row attributes
22335 !! wikitext
22337 | quux
22338 |- id=foo | style='color: red'
22339 | bar
22341 !! html
22342 <table>
22343 <tr>
22344 <td> quux
22345 </td></tr>
22346 <tr id="foo" style="color: red">
22347 <td> bar
22348 </td></tr></table>
22350 !! end
22352 !!test
22353 Gallery override link with WikiLink (bug 34852)
22354 !! wikitext
22355 <gallery>
22356 File:foobar.jpg|caption|alt=galleryalt|link=InterWikiLink
22357 </gallery>
22358 !! html
22359 <ul class="gallery mw-gallery-traditional">
22360                 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
22361                         <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>
22362                         <div class="gallerytext">
22363 <p>caption
22364 </p>
22365                         </div>
22366                 </div></li>
22367 </ul>
22369 !! end
22371 !!test
22372 Gallery override link with absolute external link (bug 34852)
22373 !! wikitext
22374 <gallery>
22375 File:foobar.jpg|caption|alt=galleryalt|link=http://www.example.org
22376 </gallery>
22377 !! html
22378 <ul class="gallery mw-gallery-traditional">
22379                 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
22380                         <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>
22381                         <div class="gallerytext">
22382 <p>caption
22383 </p>
22384                         </div>
22385                 </div></li>
22386 </ul>
22388 !! end
22390 !! test
22391 Gallery override link with absolute external link with LanguageConverter
22392 !! options
22393 language=zh
22394 !! input
22395 <gallery>
22396 File:foobar.jpg|caption|alt=galleryalt|link=http://www.example.org
22397 </gallery>
22398 !! result
22399 <ul class="gallery mw-gallery-traditional">
22400                 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
22401                         <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>
22402                         <div class="gallerytext">
22403 <p>caption
22404 </p>
22405                         </div>
22406                 </div></li>
22407 </ul>
22409 !! end
22411 !!test
22412 Gallery override link with malicious javascript (bug 34852)
22413 !! wikitext
22414 <gallery>
22415 File:foobar.jpg|caption|alt=galleryalt|link=" onclick="alert('malicious javascript code!');
22416 </gallery>
22417 !! html
22418 <ul class="gallery mw-gallery-traditional">
22419                 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
22420                         <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>
22421                         <div class="gallerytext">
22422 <p>caption
22423 </p>
22424                         </div>
22425                 </div></li>
22426 </ul>
22428 !! end
22430 !!test
22431 Gallery with invalid title as link (bug 43964)
22432 !! wikitext
22433 <gallery>
22434 File:foobar.jpg|link=<
22435 </gallery>
22436 !! html
22437 <ul class="gallery mw-gallery-traditional">
22438                 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
22439                         <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>
22440                         <div class="gallerytext">
22441                         </div>
22442                 </div></li>
22443 </ul>
22445 !! end
22447 !!test
22448 Language parser function
22449 !! wikitext
22450 {{#language:ar}}
22451 !! html
22452 <p>العربية
22453 </p>
22454 !! end
22456 !!test
22457 Padleft and padright as substr
22458 !! wikitext
22459 {{padleft:|3|abcde}}
22460 {{padright:|3|abcde}}
22461 !! html
22462 <p>abc
22464 </p>
22465 !! end
22467 !!test
22468 Special parser function
22469 !! wikitext
22470 {{#special:RandomPage}}
22471 {{#special:BaDtItLe}}
22472 {{#special:Foobar}}
22473 !! html
22474 <p>Special:Random
22475 Special:Badtitle
22476 Special:Foobar
22477 </p>
22478 !! end
22480 !!test
22481 Bug 34939 - Case insensitive link parsing ([HttP://])
22482 !! wikitext
22483 [HttP://MediaWiki.Org/]
22484 !! html/php
22485 <p><a rel="nofollow" class="external autonumber" href="HttP://MediaWiki.Org/">[1]</a>
22486 </p>
22487 !! html/parsoid
22488 <p><a rel="mw:ExtLink" href="HttP://MediaWiki.Org/"></a></p>
22489 !! end
22491 !!test
22492 Bug 34939 - Case insensitive link parsing ([HttP:// title])
22493 !! wikitext
22494 [HttP://MediaWiki.Org/ MediaWiki]
22495 !! html
22496 <p><a rel="nofollow" class="external text" href="HttP://MediaWiki.Org/">MediaWiki</a>
22497 </p>
22498 !! end
22500 !!test
22501 Bug 34939 - Case insensitive link parsing (HttP://)
22502 !! wikitext
22503 HttP://MediaWiki.Org/
22504 !! html/php
22505 <p><a rel="nofollow" class="external free" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a>
22506 </p>
22507 !! html/parsoid
22508 <p><a rel="mw:ExtLink" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a></p>
22509 !! end
22511 !!test
22512 Disable TOC
22513 !! options
22514 notoc
22515 !! wikitext
22516 Lead
22517 == Section 1 ==
22518 == Section 2 ==
22519 == Section 3 ==
22520 == Section 4 ==
22521 == Section 5 ==
22522 !! html
22523 <p>Lead
22524 </p>
22526 <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>
22527 <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>
22528 <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>
22529 <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>
22530 <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>
22532 !! end
22536 ### Parsoid-specific tests
22537 ### Parsoid-PHP parser incompatibilities
22539 !!test
22540 1. SOL-sensitive wikitext tokens as template-args
22541 !!options
22542 parsoid=wt2html,wt2wt
22543 !! wikitext
22544 {{echo|*a}}
22545 {{echo|#a}}
22546 {{echo|:a}}
22547 !! html
22548 <span about="#mwt1" typeof="mw:Transclusion">
22549 </span><ul about="#mwt1"><li>a</li>
22550 </ul>
22551 <span about="#mwt2" typeof="mw:Transclusion">
22552 </span><ol about="#mwt2"><li>a</li>
22553 </ol>
22554 <span about="#mwt3" typeof="mw:Transclusion">
22555 </span><dl about="#mwt3"><dd>a</dd>
22556 </dl>
22557 !!end
22559 #### -----------------------------------------------------------------
22560 #### Parsoid-specific functionality tests
22561 #### -----------------------------------------------------------------
22563 # Bug 63642/66749: Formatting elt fixup around images is cleaned up.
22564 # We know wt2wt will fail, but we expect selser to pass.
22565 # Due to the nature of our testing, wt2wt and selser tests will enter the
22566 # blacklist and we'll catch selser regressions based on changes to the
22567 # blacklist entries for selser tests.
22568 !! test
22569 1. Bad treebuilder fixup of formatting elt is cleaned up
22570 !! options
22571 parsoid=wt2html,wt2wt
22572 !! wikitext
22575 <small>
22576 [[Image:Foobar.jpg|right|Test]]
22577 </small>
22579 !! html/parsoid
22580 <table>
22581 <tbody><tr><td>
22582 <small>
22583 <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>
22584 </small>
22585 </td></tr>
22586 </tbody></table>
22587 !! end
22589 !! test
22590 2. Bad treebuilder fixup of formatting elt is cleaned up
22591 !! options
22592 parsoid=wt2html,wt2wt
22593 !! wikitext
22594 '''foo[[File:Foobar.jpg|thumb|caption]]bar'''
22596 <small>[[Image:Foobar.jpg|right|300px]]</small>
22597 !! html/parsoid
22599 <p><b>foo</b></p>
22600 <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>
22601 <p><b>bar</b></p>
22602 <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>
22603 !! end
22605 !! test
22606 3. Bad treebuilder fixup of formatting elt is cleaned up
22607 !! options
22608 parsoid=wt2html,wt2wt
22609 !! wikitext
22610 <small>'''foo[[File:Foobar.jpg|thumb|caption]]bar'''</small>
22611 !! html/parsoid
22612 <p><small><b>foo</b></small></p>
22613 <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>
22614 <p><small><b>bar</b></small></p>
22615 !! end
22617 !! test
22618 4. Bad treebuilder fixup of formatting elt is cleaned up: formatting tags around captionless images are ignored
22619 !! options
22620 parsoid=wt2html,wt2wt
22621 !! wikitext
22622 '''<small>[[Image:Foobar.jpg|right|300px]]</small>'''
22623 !! html/parsoid
22624 <p><b><small></small></b></p>
22625 <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>
22626 <p></p>
22627 !! end
22629 #### ----------------------------------------------------------------
22630 #### Parsoid-only testing of Parsoid's impl of <ref> and <references>
22631 #### tags. Parsoid's output for these tags differs from that of the
22632 #### PHP parser.
22633 #### ----------------------------------------------------------------
22635 !!test
22636 Ref: 1. ref-location should be replaced with an index span
22637 !! wikitext
22638 A <ref>foo</ref>
22639 B <ref name="x">foo</ref>
22640 C <ref name="y" />
22641 <references />
22642 !! html/parsoid
22643 <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="./Main_Page#cite_note-1"><span class="mw-reflink-text">[1]</span></a></span>
22644 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="./Main_Page#cite_note-x-2"><span class="mw-reflink-text">[2]</span></a></span>
22645 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="./Main_Page#cite_note-y-3"><span class="mw-reflink-text">[3]</span></a></span></p>
22646 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt8" data-mw='{"name":"references","attrs":{}}'>
22647 <li about="#cite_note-1" id="cite_note-1"><a href="./Main_Page#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>
22648 <li about="#cite_note-x-2" id="cite_note-x-2"><a href="./Main_Page#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>
22649 <li about="#cite_note-y-3" id="cite_note-y-3"><a href="./Main_Page#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>
22650 </ol>
22651 !!end
22653 !!test
22654 Ref: 2. ref-tags with identical names should all get the same index
22655 !! wikitext
22656 A <ref name="x">foo</ref>
22657 B <ref name="x" />
22658 <references />
22659 !! html/parsoid
22660 <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="./Main_Page#cite_note-x-1"><span class="mw-reflink-text">[1]</span></a></span>
22661 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="./Main_Page#cite_note-x-1"><span class="mw-reflink-text">[1]</span></a></span></p>
22662 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
22663 <li about="#cite_note-x-1" id="cite_note-x-1"><span rel="mw:referencedBy"><a href="./Main_Page#cite_ref-x_1-0"><span class="mw-linkback-text">1 </span></a><a href="./Main_Page#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>
22664 </ol>
22665 !!end
22667 !!test
22668 Ref: 3. spaces in ref-names should be ignored
22669 !! wikitext
22670 A <ref name="x">foo</ref>
22671 B <ref name=" x " />
22672 C <ref name= x  />
22673 <references />
22674 !! html/parsoid
22675 <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="./Main_Page#cite_note-x-1"><span class="mw-reflink-text">[1]</span></a></span>
22676 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="./Main_Page#cite_note-x-1"><span class="mw-reflink-text">[1]</span></a></span>
22677 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="./Main_Page#cite_note-x-1"><span class="mw-reflink-text">[1]</span></a></span></p>
22678 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt8" data-mw='{"name":"references","attrs":{}}'>
22679 <li about="#cite_note-x-1" id="cite_note-x-1"><span rel="mw:referencedBy"><a href="./Main_Page#cite_ref-x_1-0"><span class="mw-linkback-text">1 </span></a><a href="./Main_Page#cite_ref-x_1-1"><span class="mw-linkback-text">2 </span></a><a href="./Main_Page#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>
22680 </ol>
22681 !!end
22683 # NOTE: constructor is a predefined property in JS and constructor as a ref-name can clash with it if not handled properly)
22684 !!test
22685 Ref: 4. 'constructor' should be accepted as a valid ref-name
22686 !! wikitext
22687 A <ref name="constructor">foo</ref>
22688 <references />
22689 !! html/parsoid
22690 <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="./Main_Page#cite_note-constructor-1"><span class="mw-reflink-text">[1]</span></a></span></p>
22691 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
22692 <li about="#cite_note-constructor-1" id="cite_note-constructor-1"><a href="./Main_Page#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>
22693 </ol>
22694 !!end
22696 !!test
22697 Ref: 5. body should accept generic wikitext
22698 !! wikitext
22699 A <ref>
22700  This is a '''[[bolded link]]''' and this is a {{echo|transclusion}}
22701 </ref>
22703 <references />
22704 !! html/parsoid
22705 <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="./Main_Page#cite_note-1"><span class="mw-reflink-text">[1]</span></a></span></p>
22707 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'>
22708 <li about="#cite_note-1" id="cite_note-1"><a href="./Main_Page#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>
22709 </span></li>
22710 </ol>
22711 !!end
22713 !!test
22714 Ref: 6. indent-pres should not be output in ref-body
22715 !! wikitext
22716 A <ref>
22717  foo
22718  bar
22719  baz
22720 </ref>
22722 <references />
22723 !! html/parsoid
22724 <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="./Main_Page#cite_note-1"><span class="mw-reflink-text">[1]</span></a></span></p>
22726 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
22727 <li about="#cite_note-1" id="cite_note-1"><a href="./Main_Page#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
22728  bar
22729  baz
22730 </span></li>
22731 </ol>
22732 !!end
22734 !!test
22735 Ref: 7. No p-wrapping in ref-body
22736 !! wikitext
22737 A <ref>
22747 booz
22748 </ref>
22750 <references />
22751 !! html/parsoid
22752 <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="./Main_Page#cite_note-1"><span class="mw-reflink-text">[1]</span></a></span></p>
22754 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
22755 <li about="#cite_note-1" id="cite_note-1"><a href="./Main_Page#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
22764 booz
22765 </span></li>
22766 </ol>
22767 !!end
22769 !!test
22770 Ref: 8. transclusion wikitext has lower precedence
22771 !! wikitext
22772 A <ref> foo {{echo|</ref> B C}}
22774 <references />
22775 !! html/parsoid
22776 <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="./Main_Page#cite_note-1"><span class="mw-reflink-text">[1]</span></a></span> B C}}</p>
22777 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
22778 <li about="#cite_note-1" id="cite_note-1"><a href="./Main_Page#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>
22779 </ol>
22780 !!end
22782 !!test
22783 Ref: 9. unclosed comments should not leak out of ref-body
22784 !! wikitext
22785 A <ref> foo <!--</ref> B C
22786 <references />
22787 !! html/parsoid
22788 <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="./Main_Page#cite_note-1"><span class="mw-reflink-text">[1]</span></a></span> B C</p>
22789 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
22790 <li about="#cite_note-1" id="cite_note-1"><a href="./Main_Page#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>
22791 </ol>
22792 !!end
22794 !!test
22795 Ref: 10. Unclosed HTML tags should not leak out of ref-body
22796 !! wikitext
22797 A <ref> <b> foo </ref> B C
22799 <references />
22800 !! html/parsoid
22801 <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="./Main_Page#cite_note-1"><span class="mw-reflink-text">[1]</span></a></span> B C</p>
22804 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
22805 <li about="#cite_note-1" id="cite_note-1"><a href="./Main_Page#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>
22806 </ol>
22807 !!end
22809 !!test
22810 Ref: 11. ref-tags acts like an inline element wrt P-wrapping
22811 !! wikitext
22812 A <ref>foo</ref> B
22813 C <ref>bar</ref> D
22814 <references />
22815 !! html/parsoid
22816 <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="./Main_Page#cite_note-1"><span class="mw-reflink-text">[1]</span></a></span> B
22817 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="./Main_Page#cite_note-2"><span class="mw-reflink-text">[2]</span></a></span> D</p>
22818 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
22819 <li about="#cite_note-1" id="cite_note-1"><a href="./Main_Page#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>
22820 <li about="#cite_note-2" id="cite_note-2"><a href="./Main_Page#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>
22821 </ol>
22822 !!end
22824 !!test
22825 Ref: 12. ref-tags act as trailing newline migration barrier
22826 !! wikitext
22827 <!--the newline at the end of this line moves out of the p tag-->a
22829 b<!--the newline at the end of this line stays inside the p tag--> <ref />
22830 <ref />
22833 <references />
22834 !! html/parsoid
22835 <!--the newline at the end of this line moves out of the p tag--><p>a</p>
22838 <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="./Main_Page#cite_note-1"><span class="mw-reflink-text">[1]</span></a></span>
22839 <span about="#mwt4" class="mw-ref" id="cite_ref-2" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{}}'><a href="./Main_Page#cite_note-2"><span class="mw-reflink-text">[2]</span></a></span></p>
22841 <p>c</p>
22842 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
22843 <li about="#cite_note-1" id="cite_note-1"><a href="./Main_Page#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>
22844 <li about="#cite_note-2" id="cite_note-2"><a href="./Main_Page#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>
22845 !!end
22847 !!test
22848 Ref: 13. ref-tags are not SOL-transparent and block indent-pres
22849 !! wikitext
22850 <ref>foo</ref> A
22851 <ref>bar
22852 </ref> B
22853 <references />
22854 !! html/parsoid
22855 <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="./Main_Page#cite_note-1"><span class="mw-reflink-text">[1]</span></a></span> A
22856 <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="./Main_Page#cite_note-2"><span class="mw-reflink-text">[2]</span></a></span> B</p>
22857 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
22858 <li about="#cite_note-1" id="cite_note-1"><a href="./Main_Page#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>
22859 <li about="#cite_note-2" id="cite_note-2"><a href="./Main_Page#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
22860 </span></li>
22861 </ol>
22862 !!end
22864 ## Roundtripping fails because of nowiki'ing
22865 !! test
22866 Ref: 14. A nested ref-tag should be emitted as plain text
22867 !! options
22868 parsoid=wt2html
22869 !! wikitext
22870 <ref>foo <ref>bar</ref> baz</ref>
22872 <references />
22873 !! html/parsoid
22874 <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="./Main_Page#cite_note-1" style="counter-reset: mw-Ref 1;"><span class="mw-reflink-text">[1]</span></a></span> baz&lt;/ref></p>
22876 <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="./Main_Page#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 &lt;ref>bar</span></li></ol>
22877 !! end
22879 !!test
22880 Ref: 15. ref-tags with identical names should get identical indexes
22881 !! wikitext
22882 A1 <ref name="a">foo</ref> A2 <ref name="a" />
22883 B1 <ref name="b" /> B2 <ref name="b">bar</ref>
22885 <references />
22886 !! html/parsoid
22887 <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="./Main_Page#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="./Main_Page#cite_note-a-1"><span class="mw-reflink-text">[1]</span></a></span>
22888 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="./Main_Page#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="./Main_Page#cite_note-b-2"><span class="mw-reflink-text">[2]</span></a></span></p>
22890 <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="./Main_Page#cite_ref-a_1-0"><span class="mw-linkback-text">1 </span></a><a href="./Main_Page#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="./Main_Page#cite_ref-b_2-0"><span class="mw-linkback-text">1 </span></a><a href="./Main_Page#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>
22891 </ol>
22892 !!end
22894 ## We don't bother wt2wt-ing non-standard whitespace
22895 !!test
22896 Ref: 16. Tokenizer should accept non-standard whitespace in <ref> and </ref> tags
22897 !!options
22898 parsoid=wt2html
22899 !! wikitext
22900 A <ref >foo</ref >
22902 <references />
22903 !! html/parsoid
22904 <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="./Main_Page#cite_note-1"><span class="mw-reflink-text">[1]</span></a></span></p>
22905 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
22906 <li about="#cite_note-1" id="cite_note-1"><a href="./Main_Page#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>
22907 !!end
22909 !!test
22910 Ref: 17. Generate valid HTML5 id/about attributes
22911 !!wikitext
22912 <ref name="a b">foo</ref>
22913 <ref name=":0">ve-created name</ref>
22915 <references />
22916 !!html/parsoid
22917 <p><span about="#mwt2" 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="./Main_Page#cite_note-a_b-1" style="counter-reset: mw-Ref 1;"><span class="mw-reflink-text">[1]</span></a></span>
22918 <span about="#mwt4" class="mw-ref" id="cite_ref-:0_2-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-:0-2"},"attrs":{"name":":0"}}'><a href="./Main_Page#cite_note-:0-2" style="counter-reset: mw-Ref 2;"><span class="mw-reflink-text">[2]</span></a></span>
22920 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'><li about="#cite_note-a_b-1" id="cite_note-a_b-1"><a href="./Main_Page#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><li about="#cite_note-:0-2" id="cite_note-:0-2"><a href="./Main_Page#cite_ref-:0_2-0" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-:0-2" class="mw-reference-text">ve-created name</span></li></ol>
22922 !!end
22924 !!test
22925 Ref: 18. T58916: Extension attributes should be parsed as plain text
22926 !!wikitext
22927 <ref name="{{echo|a}}">foo</ref>
22929 <references />
22930 !!html/parsoid
22931 <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="./Main_Page#cite_note-.7B.7Becho.7Ca.7D.7D-1"><span class="mw-reflink-text">[1]</span></a></span>
22932 </p>
22934 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
22935 <li about="#cite_note-.7B.7Becho.7Ca.7D.7D-1" id="cite_note-.7B.7Becho.7Ca.7D.7D-1"><a href="./Main_Page#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>
22936 </ol>
22937 !!end
22939 !!test
22940 Ref: 19. ref-tags with identical name encodings should get identical indexes
22941 !! wikitext
22942 1 <ref name="a & b">foo</ref> 2 <ref name="a &amp; b" />
22944 <references />
22945 !! html/parsoid
22946 <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="./Main_Page#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="./Main_Page#cite_note-a_.26_b-1"><span class="mw-reflink-text">[1]</span></a></span>
22947 </p>
22948 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
22949 <li about="#cite_note-a_.26_b-1" id="cite_note-a_.26_b-1"><span rel="mw:referencedBy"><a href="./Main_Page#cite_ref-a_.26_b_1-0"><span class="mw-linkback-text">1 </span></a><a href="./Main_Page#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>
22950 </ol>
22951 !!end
22953 !!test
22954 Ref: 20. ref-tags with identical names but different content should keep it
22955 !! wikitext
22956 A <ref name="foo">Foo one</ref>
22957 B <ref name="foo">Foo two</ref>
22958 C <ref name="foo" />
22960 <references />
22961 !! html/parsoid
22962 <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="./Main_Page#cite_note-foo-1"><span class="mw-reflink-text">[1]</span></a></span>
22963 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="./Main_Page#cite_note-foo-1"><span class="mw-reflink-text">[1]</span></a></span>
22964 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="./Main_Page#cite_note-foo-1"><span class="mw-reflink-text">[1]</span></a></span></p>
22966 <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="./Main_Page#cite_ref-foo_1-0"><span class="mw-linkback-text">1 </span></a><a href="./Main_Page#cite_ref-foo_1-1"><span class="mw-linkback-text">2 </span></a><a href="./Main_Page#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>
22967 </ol>
22968 !!end
22970 !!test
22971 References: 1. references tag without any refs should be handled properly
22972 !! wikitext
22973 <references />
22974 !! html/parsoid
22975 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt2" data-mw='{"name":"references","attrs":{}}'></ol>
22976 !!end
22978 !!test
22979 References: 2. references tag with group only outputs references from that group
22980 !! wikitext
22981 A <ref group="a">foo</ref>
22982 B <ref group="b">bar</ref>
22983 C <ref>baz</ref>
22985 <references group="a" />
22986 <references />
22987 <references group="b" />
22988 !! html/parsoid
22989 <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="./Main_Page#cite_note-1" data-mw-group="a"><span class="mw-reflink-text">[a 1]</span></a></span>
22990 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="./Main_Page#cite_note-2" data-mw-group="b"><span class="mw-reflink-text">[b 1]</span></a></span>
22991 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="./Main_Page#cite_note-3"><span class="mw-reflink-text">[1]</span></a></span></p>
22993 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt8" data-mw-group="a" data-mw='{"name":"references","attrs":{"group":"a"}}'>
22994 <li about="#cite_note-1" id="cite_note-1"><a href="./Main_Page#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>
22995 </ol>
22996 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt10" data-mw='{"name":"references","attrs":{}}'>
22997 <li about="#cite_note-3" id="cite_note-3"><a href="./Main_Page#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>
22998 </ol>
22999 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt12" data-mw-group="b" data-mw='{"name":"references","attrs":{"group":"b"}}'>
23000 <li about="#cite_note-2" id="cite_note-2"><a href="./Main_Page#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>
23001 </ol>
23002 !!end
23004 !!test
23005 References: 3. ref list should be cleared after processing references
23006 !! wikitext
23007 A <ref>foo</ref>
23009 <references />
23011 B <ref>bar</ref>
23013 <references />
23014 !! html/parsoid
23015 <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="./Main_Page#cite_note-1"><span class="mw-reflink-text">[1]</span></a></span></p>
23017 <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="./Main_Page#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>
23018 </ol>
23020 <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="./Main_Page#cite_note-2"><span class="mw-reflink-text">[1]</span></a></span></p>
23022 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt8" data-mw='{"name":"references","attrs":{}}'>
23023 <li about="#cite_note-2" id="cite_note-2"><a href="./Main_Page#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>
23024 </ol>
23025 !!end
23027 !!test
23028 References: 4. only referenced group should be cleared after processing references
23029 !! wikitext
23030 A <ref group="a">afoo</ref>
23031 B <ref>bfoo</ref>
23033 <references group="a" />
23035 C <ref>cfoo</ref>
23037 <references />
23038 !! html/parsoid
23039 <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="./Main_Page#cite_note-1" data-mw-group="a"><span class="mw-reflink-text">[a 1]</span></a></span>
23040 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="./Main_Page#cite_note-2"><span class="mw-reflink-text">[1]</span></a></span></p>
23042 <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="./Main_Page#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>
23043 </ol>
23045 <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="./Main_Page#cite_note-3"><span class="mw-reflink-text">[2]</span></a></span></p>
23047 <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="./Main_Page#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="./Main_Page#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>
23048 </ol>
23049 !!end
23051 ## Don't expect this to rt since we're dropping content
23052 !! test
23053 References: 5. ref tags in references should be processed while ignoring all other content
23054 !! options
23055 parsoid=wt2html,html2html
23056 !! wikitext
23057 A <ref name="a" />
23058 B <ref name="b">bar</ref>
23060 <references>
23061 <ref name="a">foo</ref>
23062 This should just get lost.
23063 </references>
23064 !! html/parsoid
23065 <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="./Main_Page#cite_note-a-1"><span class="mw-reflink-text">[1]</span></a></span>
23066 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="./Main_Page#cite_note-b-2"><span class="mw-reflink-text">[2]</span></a></span></p>
23069 <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=\"./Main_Page#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="./Main_Page#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="./Main_Page#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>
23070 </ol>
23071 !! end
23073 !! test
23074 References: 6. <references /> from a transclusion
23075 !! wikitext
23076 <ref>Foo</ref> {{echo|<references />}}
23077 !! html/parsoid
23078 <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="./Main_Page#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="./Main_Page#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>
23079 </ol>
23080 !! end
23082 !! test
23083 References: 7. Multiple references tags (one without and one with nested refs) should be correctly handled
23084 !! wikitext
23085 A <ref>foo bar for a</ref>
23086 B <ref group="X" name="b" />
23088 <references />
23090 <references group="X">
23091 <ref name="b">foo</ref>
23092 </references>
23093 !! html/parsoid
23094 <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="./Main_Page#cite_note-1"><span class="mw-reflink-text">[1]</span></a></span>
23095 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="./Main_Page#cite_note-b-2" data-mw-group="X"><span class="mw-reflink-text">[X 1]</span></a></span>
23096 </p>
23098 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
23099 <li about="#cite_note-1" id="cite_note-1"><a href="./Main_Page#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>
23100 </ol>
23102 <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=\"./Main_Page#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"}}'>
23103 <li about="#cite_note-b-2" id="cite_note-b-2"><a href="./Main_Page#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>
23104 </ol>
23105 !! end
23107 !! test
23108 References: 8. T88019: Remove <meta>s from templates inside <ref> that's itself inside a template
23109 !! wikitext
23110 X{{echo|<ref>foo {{echo|<b>bar</b>}} and {{echo|baz}} boo</ref>}}
23111 <references />
23112 !! html/parsoid
23113 <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="./Main_Page#cite_note-1"><span class="mw-reflink-text">[1]</span></a></span></p>
23114 <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="./Main_Page#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>
23115 </ol>
23116 !!end
23118 # This test only works in wt2html now as the <references /> are always generated
23119 # unless selser is active. Once T72722 is fixed, we should add a changes test
23120 # here to ensure that unrelated changes don't add the new <references />
23121 # when selser is active.
23122 !! test
23123 References: 9. Generate missing references list at the end
23124 !! wikitext
23125 A <ref>foo</ref>
23126 B <ref group="inexistent">bar</ref>
23127 !! html/parsoid
23128 <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="./Main_Page#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="./Main_Page#cite_note-2" data-mw-group="inexistent"><span class="mw-reflink-text">[inexistent 1]</span></a></span></p>
23129 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{},"autoGenerated":true}'>
23130 <li about="#cite_note-1" id="cite_note-1"><a href="./Main_Page#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>
23131 </ol>
23132 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw-group="inexistent" data-mw='{"name":"references","attrs":{"group":"inexistent"},"autoGenerated":true}'>
23133 <li about="#cite_note-2" id="cite_note-2"><a href="./Main_Page#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>
23134 </ol>
23135 !! end
23137 !! test
23138 References: 10. New <references/> shouldn't be added for unrelated edits.
23139 !! options
23140 parsoid={
23141   "modes": ["selser"],
23142   "changes": [["#x", "remove"]],
23143   "selser": "noauto"
23145 !! wikitext
23146 Unrelated text<span id="x"> that's going to disappear</span>.
23147 A <ref>foo</ref>
23148 !! wikitext/edited
23149 Unrelated text.
23150 A <ref>foo</ref>
23151 !!end
23153 !! test
23154 Entities in ref name
23155 !! wikitext
23156 <ref name="test &amp; me">hi</ref>
23157 <references />
23158 !! html/parsoid
23159 <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="./Main_Page#cite_note-test_.26_me-1"><span class="mw-reflink-text">[1]</span></a></span></p>
23160 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
23161 <li about="#cite_note-test_.26_me-1" id="cite_note-test_.26_me-1"><a href="./Main_Page#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>
23162 </ol>
23163 !! end
23165 ## The output here may look funny, but it's what the php parser will do.  The
23166 ## unclosed references tag becomes escaped text, and then a new references
23167 ## tag is auto-generated.  The test is wt2html only because it roundtrips with
23168 ## nowiki tags, and the auto-generated references tag is only dropped in
23169 ## rtTestMode.
23170 !! test
23171 Generate references for unclosed references tag
23172 !! options
23173 parsoid=wt2html
23174 !! wikitext
23175 a<ref>foo</ref>
23177 <references>
23178 !! html/parsoid
23179 <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="./Main_Page#cite_note-1" style="counter-reset: mw-Ref 1;"><span class="mw-reflink-text">[1]</span></a></span></p>
23181 <p>&lt;references></p>
23182 <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="./Main_Page#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>
23183 !! end
23185 !! test
23186 New reference serializes on its own line
23187 !! options
23188 parsoid=wt2wt,html2wt
23189 !! wikitext
23191 <references />
23192 !! html/parsoid
23193 foo<ol class="mw-references" typeof="mw:Extension/references" about="#mwt2" data-mw='{"name":"references","attrs":{}}'></ol>
23194 !! end
23196 #### ----------------------------------------------------------------
23197 #### Parsoid-only testing of Parsoid's impl of LST
23198 #### Not implemented yet, see
23199 #### https://www.mediawiki.org/wiki/Parsoid/HTML_based_LST
23200 #### ----------------------------------------------------------------
23202 ## We still need to support serializing the older format while content is stored.
23203 !! test
23204 LST Sections: Backwards compatibility
23205 !! options
23206 parsoid={
23207   "suppressErrors": true,
23208   "modes": ["html2wt"]
23210 !! wikitext
23211 <section begin="2011-05-16" />
23212 <section end="2014-04-10 (MW 1.23wmf22)" />
23213 !! html/parsoid
23214 <p><meta typeof="mw:Extension/LabeledSectionTransclusion/begin" content="2011-05-16"/>
23215 <meta typeof="mw:Extension/LabeledSectionTransclusion/end" content="2014-04-10 (MW 1.23wmf22)"/></p>
23216 !! end
23218 ## The unconventional output is the result of `usePHPPreProcessor` being
23219 ## disabled in parserTests.js.  This test is mainly just to show <section> is
23220 ## recognized as an extension tag w/o a native handler.
23221 !! test
23222 LST Sections: Newfangled approach
23223 !! options
23224 parsoid={ "suppressErrors": true }
23225 !! wikitext
23226 <section begin="2011-05-16" />
23227 <section end="2014-04-10 (MW 1.23wmf22)" />
23228 !! html/parsoid
23229 <p><span typeof="mw:Extension/section" about="#mwt1" data-parsoid='{"stx":"html","selfClose":true,"src":"&lt;section begin=\"2011-05-16\" />","tagWidths":[30,0]}'>&lt;section begin="2011-05-16" /></span>
23230 <span typeof="mw:Extension/section" about="#mwt2" data-parsoid='{"stx":"html","selfClose":true,"src":"&lt;section end=\"2014-04-10 (MW 1.23wmf22)\" />","tagWidths":[43,0]}'>&lt;section end="2014-04-10 (MW 1.23wmf22)" /></span></p>
23231 !! end
23233 #--------- Test stripping of empty nodes in template content ----------
23234 !!test
23235 Empty LI and TR nodes should be stripped from template content
23236 !!wikitext
23237 {{EmptyLITest}}
23238 {{EmptyTRTest}}
23239 !!html/parsoid
23240 <ul about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyLITest","href":"./Template:EmptyLITest"},"params":{},"i":0}}]}'>
23241 <li>a</li>
23242 <li>b</li>
23243 </ul>
23244 <table about="#mwt2" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyTRTest","href":"./Template:EmptyTRTest"},"params":{},"i":0}}]}'>
23245 <tbody>
23246 <tr>
23247 <td>foo</td>
23248 </tr>
23249 <tr>
23250 <td>bar</td>
23251 </tr>
23252 </tbody>
23253 </table>
23254 !!end
23256 !!test
23257 Empty LI and TR nodes should not be stripped from top-level content
23258 !!wikitext
23259 * a
23261 * b
23265 |foo
23267 !!html/parsoid
23268 <ul>
23269 <li> a</li>
23270 <li></li>
23271 <li> b</li>
23272 </ul>
23273 <table>
23274 <tbody>
23275 <tr></tr>
23276 <tr>
23277 <td>foo</td>
23278 </tr>
23279 </tbody>
23280 </table>
23281 !!end
23283 !!test
23284 Empty TR nodes should not be stripped if they have any attributes set
23285 !!wikitext
23286 {{EmptyTRWithHTMLAttrTest}}
23287 !!html/parsoid
23288 <table about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyTRWithHTMLAttrTest","href":"./Template:EmptyTRWithHTMLAttrTest"},"params":{},"i":0}}]}'>
23289 <tr align="center"></tr>
23290 <tr><td>foo</td></tr>
23291 <tr align="center"></tr>
23292 <tr><td>bar</td></tr>
23293 </table>
23294 !!end
23296 #### ----------------------------------------------------------------
23297 #### The following section of tests are primarily to test
23298 #### wikitext escaping capabilities of Parsoid.  Given that
23299 #### escaping can be done any number of ways, the wikitext (input)
23300 #### is always adjusted to reflect how Parsoid adds nowiki
23301 #### escape tags.
23302 ####
23303 #### We are marking several tests as parsoid-only since the
23304 #### HTML in the result section is different from what the
23305 #### PHP parser generates for it.
23306 #### ----------------------------------------------------------------
23309 #### --------------- Headings ---------------
23310 #### 0. Unnested
23311 #### 1. Nested inside html <h1>=foo=</h1>
23312 #### 2. Outside heading nest on a single line <h1>foo</h1>*bar
23313 #### 3. Nested inside html with wikitext split by html tags
23314 #### 4. No escape needed
23315 #### 5. Empty headings <h1></h1>
23316 #### 6. Heading chars in SOL context
23317 #### ----------------------------------------
23318 !! test
23319 Headings: 0. Unnested
23320 !! options
23321 parsoid=html2wt
23322 !! html/parsoid
23323 <p>=foo=</p>
23325 <p> =foo=
23326 <!--cmt-->
23327 =foo=</p>
23329 <p>=foo<i>a</i>=</p>
23330 !! wikitext
23331 <nowiki>=foo=</nowiki>
23333 <nowiki> </nowiki>=foo=
23334 <!--cmt-->
23335 <nowiki>=foo=</nowiki>
23337 =foo''a''<nowiki>=</nowiki>
23338 !!end
23340 # New headings and existing headings are handled differently
23341 !! test
23342 Headings: 1. Nested inside html
23343 !! options
23344 parsoid=html2wt
23345 !! html/parsoid
23346 <h1>=foo=</h1>
23347 <h2>=foo=</h2>
23348 <h3>=foo=</h3>
23350 <h1 data-parsoid=''>=foo=</h1>
23351 <h2 data-parsoid=''>=foo=</h2>
23352 <h3 data-parsoid=''>=foo=</h3>
23353 <h4 data-parsoid=''>=foo=</h4>
23354 <h5 data-parsoid=''>=foo=</h5>
23355 <h6 data-parsoid=''>=foo=</h6>
23356 !! wikitext
23357 = =foo= =
23359 == =foo= ==
23361 === =foo= ===
23363 =<nowiki>=foo=</nowiki>=
23364 ==<nowiki>=foo=</nowiki>==
23365 ===<nowiki>=foo=</nowiki>===
23366 ====<nowiki>=foo=</nowiki>====
23367 =====<nowiki>=foo=</nowiki>=====
23368 ======<nowiki>=foo=</nowiki>======
23370 !!end
23372 !! test
23373 Headings: 2. Outside heading nest on a single line <h1>foo</h1>*bar
23374 !! options
23375 parsoid=html2wt
23376 !! html/parsoid
23377 <h1>foo</h1>*bar
23378 <h1>foo</h1>=bar
23379 <h1>foo</h1>=bar=
23380 !! wikitext
23381 = foo =
23382 <nowiki>*</nowiki>bar
23384 = foo =
23385 =bar
23387 = foo =
23388 <nowiki>=bar=</nowiki>
23389 !!end
23391 !! test
23392 Headings: 3. Nested inside html with wikitext split by html tags
23393 !! options
23394 parsoid=html2wt
23395 !! html/parsoid
23396 <h1>=<b>bold</b>foo=</h1>
23397 !! wikitext
23398 = ='''bold'''foo= =
23399 !!end
23401 !! test
23402 Headings: 4a. No escaping needed (testing just h1 and h2)
23403 !! options
23404 parsoid=html2wt
23405 !! html/parsoid
23406 <h1>=foo</h1>
23407 <h1>foo=</h1>
23408 <h1> =foo= </h1>
23409 <h1>=foo= bar</h1>
23410 <h2>=foo</h2>
23411 <h2>foo=</h2>
23412 <h1>=</h1>
23413 <h1><i>=</i>foo=</h1>
23414 !! wikitext
23415 = =foo =
23417 = foo= =
23419 = =foo= =
23421 = =foo= bar =
23423 == =foo ==
23425 == foo= ==
23427 = = =
23429 = ''=''foo= =
23430 !!end
23432 !! test
23433 Headings: 4b. No escaping needed (inside p-tags)
23434 !! options
23435 parsoid=html2wt
23436 !! html/parsoid
23437 <p>===
23438 =foo= x
23439 =foo= <s></s>
23440 </p>
23441 !! wikitext
23443 =foo= x
23444 =foo= <s></s>
23445 !!end
23447 !! test
23448 Headings: 5. Empty headings
23449 !! options
23450 parsoid=html2wt
23451 !! html/parsoid
23452 <h1 data-parsoid='{}'></h1>
23454 <h2 data-parsoid='{}'></h2>
23456 <h3 data-parsoid='{}'></h3>
23458 <h4 data-parsoid='{}'></h4>
23460 <h5 data-parsoid='{}'></h5>
23462 <h6 data-parsoid='{}'></h6>
23463 !! wikitext
23464 =<nowiki/>=
23466 ==<nowiki/>==
23468 ===<nowiki/>===
23470 ====<nowiki/>====
23472 =====<nowiki/>=====
23474 ======<nowiki/>======
23475 !!end
23477 !! test
23478 Headings: 6a. Heading chars in SOL context (with trailing spaces)
23479 !! options
23480 parsoid=html2wt
23481 !! html/parsoid
23482 <p>=a=</p>
23484 <p>=a=</p> 
23486 <p>=a=</p>      
23487 !! wikitext
23488 <nowiki>=a=</nowiki>
23490 <nowiki>=a=</nowiki> 
23492 <nowiki>=a=</nowiki>    
23493 !!end
23495 !! test
23496 Headings: 6b. Heading chars in SOL context (with trailing newlines)
23497 !! options
23498 parsoid=html2wt
23499 !! html/parsoid
23500 <p>=a=
23501 b</p>
23503 <p>=a= 
23504 b</p>
23506 <p>=a=  
23507 b</p>
23508 !! wikitext
23509 <nowiki>=a=</nowiki>
23512 <nowiki>=a=</nowiki> 
23515 <nowiki>=a=</nowiki>    
23517 !!end
23519 !! test
23520 Headings: 6c. Heading chars in SOL context (leading newline break)
23521 !! options
23522 parsoid=html2wt
23523 !! html/parsoid
23524 <p>a
23525 =b=</p>
23526 !! wikitext
23528 <nowiki>=b=</nowiki>
23529 !!end
23531 !! test
23532 Headings: 6d. Heading chars in SOL context (with interspersed comments)
23533 !! options
23534 parsoid=html2wt
23535 !! html/parsoid
23536 <!--c0--><p>=a=</p>
23538 <!--c1--><p>=a=</p> <!--c2-->    <!--c3-->
23539 !! wikitext
23540 <!--c0--><nowiki>=a=</nowiki>
23542 <!--c1--><nowiki>=a=</nowiki> <!--c2-->  <!--c3-->
23543 !!end
23545 !! test
23546 Headings: 6d. Heading chars in SOL context (No escaping needed)
23547 !! options
23548 parsoid=html2wt
23549 !! html/parsoid
23550 =a=<div>b</div>
23551 !! wikitext
23552 =a=<div>b</div>
23553 !!end
23555 !! test
23556 Headings: 7. Insert a newline between new content and headings
23557 !! options
23558 parsoid=html2wt
23559 !! html/parsoid
23560 <h2>NEW</h2>
23561 <p>new</p>
23562 <h2 data-parsoid='{}'>A</h2>
23563 <p data-parsoid='{}'>a</p>
23564 !! wikitext
23565 == NEW ==
23568 ==A==
23571 !! end
23573 #### --------------- Lists ---------------
23574 #### 0. Outside nests (*foo, etc.)
23575 #### 1. Nested inside html <ul><li>*foo</li></ul>
23576 #### 2. Inside definition lists
23577 #### 3. Only bullets at start should be escaped
23578 #### 4. No escapes needed
23579 #### 5. No unnecessary escapes
23580 #### 6. Escape bullets in SOL position
23581 #### 7. Escape bullets in a multi-line context
23582 #### ----------------------------------------
23584 !! test
23585 Lists: 0. Outside nests
23586 !! options
23587 parsoid=html2wt
23588 !! html/parsoid
23589 <p>*foo</p>
23591 <p>#foo</p>
23593 <p>;Foo:bar</p>
23594 !! wikitext
23595 <nowiki>*</nowiki>foo
23597 <nowiki>#</nowiki>foo
23599 <nowiki>;</nowiki>Foo<nowiki>:</nowiki>bar
23600 !!end
23602 ## Making these next 3 tests Parsoid-only since they are html2wt tests
23603 ## to test wikitext escaping, and insignificant whitespace diffs
23604 ## cause PHP parser tests to barf
23605 !! test
23606 Lists: 1. Nested inside html (No unnecessary escapes)
23607 !! options
23608 parsoid=html2wt
23609 !! html/parsoid
23610 <ul>
23611 <li>*foo</li>
23612 <li>#foo</li>
23613 <li>:foo</li>
23614 <li>;foo</li>
23615 <li data-parsoid='{}'>*foo</li>
23616 <li data-parsoid='{}'>#foo</li>
23617 <li data-parsoid='{}'>:foo</li>
23618 <li data-parsoid='{}'>;foo</li>
23619 </ul>
23621 <ol>
23622 <li>*foo</li>
23623 <li>#foo</li>
23624 <li>:foo</li>
23625 <li>;foo</li>
23626 <li data-parsoid='{}'>*foo</li>
23627 <li data-parsoid='{}'>#foo</li>
23628 <li data-parsoid='{}'>:foo</li>
23629 <li data-parsoid='{}'>;foo</li>
23630 </ol>
23631 !! wikitext
23632 * *foo
23633 * #foo
23634 * :foo
23635 * ;foo
23636 *<nowiki>*foo</nowiki>
23637 *<nowiki>#foo</nowiki>
23638 *<nowiki>:foo</nowiki>
23639 *<nowiki>;foo</nowiki>
23641 # *foo
23642 # #foo
23643 # :foo
23644 # ;foo
23645 #<nowiki>*foo</nowiki>
23646 #<nowiki>#foo</nowiki>
23647 #<nowiki>:foo</nowiki>
23648 #<nowiki>;foo</nowiki>
23649 !!end
23651 !! test
23652 Lists: 2. Inside definition lists
23653 !! options
23654 parsoid=html2wt
23655 !! html/parsoid
23656 <dl><dt>;foo</dt></dl>
23657 <dl><dt>:foo</dt></dl>
23658 <dl><dt>:foo</dt>
23659 <dd>bar</dd></dl>
23660 <dl><dd>:foo</dd></dl>
23661 !! wikitext
23662 ; ;foo
23664 ; <nowiki>:foo</nowiki>
23666 ; <nowiki>:foo</nowiki>
23667 : bar
23669 : :foo
23670 !!end
23672 !! test
23673 Lists: 3. Only bullets at start of text in wikitext-generated HTML should be escaped
23674 !! options
23675 parsoid=html2wt
23676 !! html/parsoid
23677 <ul>
23678 <li>*foo*bar</li>
23679 <li data-parsoid='{}'>*foo<i>it</i>*bar</li>
23680 </ul>
23681 !! wikitext
23682 * *foo*bar
23683 *<nowiki>*foo</nowiki>''it''*bar
23684 !!end
23686 !! test
23687 Lists: 4. No escapes needed
23688 !! options
23689 parsoid=html2wt
23690 !! html/parsoid
23691 <ul>
23692 <li>foo*bar
23693 </li>
23694 </ul>
23695 <ul>
23696 <li><i>foo</i>*bar
23697 </li>
23698 </ul>
23699 <ul>
23700 <li><a rel="mw:WikiLink" href="Foo" title="Foo">Foo</a>: bar
23701 </li>
23702 </ul>
23703 <ul>
23704 <li><a rel="mw:WikiLink" href="Foo" title="Foo">Foo</a>*bar
23705 </li>
23706 </ul>
23707 !! wikitext
23708 *foo*bar
23710 *''foo''*bar
23712 *[[Foo]]: bar
23714 *[[Foo]]*bar
23715 !!end
23717 !! test
23718 Lists: 5. No unnecessary escapes
23719 !! options
23720 parsoid=html2wt
23721 !! html/parsoid
23722 <ul><li> bar <span>[[foo]]</span></li></ul>
23723 <ul><li> =bar <span>[[foo]]</span></li></ul>
23724 <ul><li> [[bar <span>[[foo]]</span></li></ul>
23725 <ul><li> ]]bar <span>[[foo]]</span></li></ul>
23726 <ul><li> =bar <span>foo]]</span>=</li></ul>
23727 <ul><li> <s></s>: a</li></ul>
23728 <ul><li> <i>* foo</i></li></ul>
23730 !! wikitext
23731 * bar <span><nowiki>[[foo]]</nowiki></span>
23733 * =bar <span><nowiki>[[foo]]</nowiki></span>
23735 * [[bar <span><nowiki>[[foo]]</nowiki></span>
23737 * ]]bar <span><nowiki>[[foo]]</nowiki></span>
23739 * =bar <span>foo]]</span>=
23741 * <s></s>: a
23743 * ''* foo''
23744 !!end
23746 !! test
23747 Lists: 6. Escape bullets in SOL position
23748 !! options
23749 parsoid=html2wt
23750 !! html/parsoid
23751 <p><!--cmt-->*foo</p>
23752 !! wikitext
23753 <!--cmt--><nowiki>*</nowiki>foo
23754 !!end
23756 !! test
23757 Lists: 7. Escape bullets in a multi-line context
23758 !! options
23759 parsoid=html2wt
23760 !! html/parsoid
23761 <p>a
23763 </p>
23764 !! wikitext
23766 <nowiki>*</nowiki>b
23767 !!end
23769 !! test
23770 Lists: 8. Escape colons only if not present in tags
23771 !! options
23772 parsoid=html2wt
23773 !! html/parsoid
23774 <dl><dt>a:b<i>c:d</i></dt></dl>
23775 !! wikitext
23776 ; <nowiki>a:b</nowiki>''c:d''
23777 !! end
23779 #### --------------- HRs ---------------
23780 #### 1. Single line
23781 #### -----------------------------------
23783 !! test
23784 HRs: 1. Single line
23785 !! options
23786 parsoid=html2wt
23787 !! html/parsoid
23788 <hr />----
23789 <hr />=foo=
23790 <hr />*foo
23791 !! wikitext
23792 ----<nowiki>----</nowiki>
23793 ----=foo=
23794 ----*foo
23795 !! end
23797 #### --------------- Tables ---------------
23798 #### 1a. Simple example
23799 #### 1b. No escaping needed (!foo)
23800 #### 1c. No escaping needed (|foo)
23801 #### 1d. No escaping needed (|}foo)
23802 ####
23803 #### 2a. Nested in td (<td>foo|bar</td>)
23804 #### 2b. Nested in td (<td>foo||bar</td>)
23805 #### 2c. Nested in td -- no escaping needed(<td>foo!!bar</td>)
23806 ####
23807 #### 3a. Nested in th (<th>foo!bar</th>)
23808 #### 3b. Nested in th (<th>foo!!bar</th>)
23809 #### 3c. Nested in th -- no escaping needed(<th>foo||bar</th>)
23810 ####
23811 #### 4a. Escape -
23812 #### 4b. Escape +
23813 #### 4c. No escaping needed
23814 #### --------------------------------------
23816 !! test
23817 Tables: 1a. Simple example
23818 !! options
23819 parsoid=html2wt
23820 !! html/parsoid
23821 <p>{|
23823 </p>
23824 !! wikitext
23825 <nowiki>{|</nowiki>
23827 !! end
23829 !! test
23830 Tables: 1b. No escaping needed
23831 !! options
23832 parsoid=html2wt
23833 !! html/parsoid
23834 <p>!foo
23835 </p>
23836 !! wikitext
23837 !foo
23838 !! end
23840 !! test
23841 Tables: 1c. No escaping needed
23842 !! options
23843 parsoid=html2wt
23844 !! html/parsoid
23845 <p>|foo
23846 </p>
23847 !! wikitext
23848 |foo
23849 !! end
23851 !! test
23852 Tables: 1d. No escaping needed
23853 !! options
23854 parsoid=html2wt
23855 !! html/parsoid
23856 <p>|}foo
23857 </p>
23858 !! wikitext
23859 |}foo
23860 !! end
23862 !! test
23863 Tables: 2a. Nested in td
23864 !! options
23865 parsoid=html2wt
23866 !! html/parsoid
23867 <table><tbody><tr>
23868 <td>foo|bar</td></tr>
23869 <tr><td>x<div>a|b</div></td>
23870 </tbody></table>
23871 !! wikitext
23873 |<nowiki>foo|bar</nowiki>
23875 |x<div><nowiki>a|b</nowiki></div>
23877 !! html/php+tidy
23878 <table>
23879 <tr>
23880 <td>foo|bar</td>
23881 </tr>
23882 <tr>
23883 <td>x
23884 <div>a|b</div>
23885 </td>
23886 </tr>
23887 </table>
23888 !! end
23890 !! test
23891 Tables: 2b. Nested in td
23892 !! options
23893 parsoid=html2wt
23894 !! html/parsoid
23895 <table><tbody><tr>
23896 <td>foo||bar</td>
23897 <td>a<i>b||c</i></td>
23898 <td>a<i><div>b||c</div></i></td>
23899 </tr></tbody></table>
23900 !! wikitext
23902 |<nowiki>foo||bar</nowiki>
23903 |a''<nowiki>b||c</nowiki>''
23904 |a''<div><nowiki>b||c</nowiki></div>''
23906 !! html/php
23907 <table>
23908 <tr>
23909 <td>foo||bar
23910 </td>
23911 <td>a<i>b||c</i>
23912 </td>
23913 <td>a<i><div>b||c</div></i>
23914 </td></tr></table>
23916 !! end
23918 !! test
23919 Tables: 2c. Nested in td -- no escaping needed
23920 !! options
23921 parsoid=html2wt
23922 !! html/*
23923 <table>
23924 <tr>
23925 <td>foo!!bar
23926 </td></tr></table>
23928 !! wikitext
23930 |foo!!bar
23932 !! end
23934 !! test
23935 Tables: 3a. Nested in th
23936 !! options
23937 parsoid=html2wt
23938 !! html/*
23939 <table>
23940 <tr>
23941 <th>foo!bar
23942 </th></tr></table>
23944 !! wikitext
23946 !foo!bar
23948 !! end
23950 !! test
23951 Tables: 3b. Nested in th
23952 !! options
23953 parsoid=html2wt
23954 !! html/parsoid
23955 <table><tbody>
23956 <tr><th>foo!!bar</th>
23957 <th><i>foo|bar</i></th>
23958 <th><i>foo!!bar</i></th>
23959 <th><i><span>foo!!bar</span></i></th>
23960 </tr></tbody></table>
23961 !! wikitext
23963 !<nowiki>foo!!bar</nowiki>
23964 !''<nowiki>foo|bar</nowiki>''
23965 !''<nowiki>foo!!bar</nowiki>''
23966 !''<span><nowiki>foo!!bar</nowiki></span>''
23968 !! html/php
23969 <table>
23970 <tr>
23971 <th>foo!!bar
23972 </th>
23973 <th><i>foo|bar</i>
23974 </th>
23975 <th><i>foo!!bar</i>
23976 </th>
23977 <th><i><span>foo!!bar</span></i>
23978 </th></tr></table>
23980 !! end
23982 !! test
23983 Tables: 3c. Nested in th
23984 !! options
23985 parsoid=html2wt
23986 !! html/parsoid
23987 <table><tbody>
23988 <tr><th>foo||bar</th>
23989 <th><span typeof="mw:Nowiki">foo||bar</span></th>
23990 </tr></tbody></table>
23991 !! wikitext
23993 !<nowiki>foo||bar</nowiki>
23994 !<nowiki>foo||bar</nowiki>
23996 !! html/php
23997 <table>
23998 <tr>
23999 <th>foo||bar
24000 </th>
24001 <th>foo||bar
24002 </th></tr></table>
24004 !! end
24006 !! test
24007 Tables: 4a. Escape -
24008 !! options
24009 parsoid=html2wt
24010 !! html/*
24011 <table>
24012 <tr>
24013 <th>-bar
24014 </th></tr>
24015 <tr>
24016 <td>-bar
24017 </td></tr></table>
24019 !! wikitext
24021 !-bar
24023 |<nowiki>-bar</nowiki>
24025 !! end
24027 !! test
24028 Tables: 4b. Escape +
24029 !! options
24030 parsoid=html2wt
24031 !! html/*
24032 <table>
24033 <tr>
24034 <th>+bar
24035 </th></tr>
24036 <tr>
24037 <td>+bar
24038 </td></tr></table>
24040 !! wikitext
24042 !+bar
24044 |<nowiki>+bar</nowiki>
24046 !! end
24048 !! test
24049 Tables: 4c. No escaping needed
24050 !! options
24051 parsoid=html2wt
24052 !! html/parsoid
24053 <table><tbody>
24054 <tr><td>foo-bar</td><td>foo+bar</td></tr>
24055 <tr><td><i>foo</i>-bar</td><td><i>foo</i>+bar</td></tr>
24056 <tr><td>foo
24057 <p>bar|baz
24058 +bar
24059 -bar</p></td></tr>
24060 <tr><td>x
24061 <div>a|b</div></td>
24062 </tbody></table>
24063 !! wikitext
24065 |foo-bar
24066 |foo+bar
24068 |''foo''-bar
24069 |''foo''+bar
24071 |foo
24072 bar|baz
24073 +bar
24074 -bar
24077 <div>a|b</div>
24079 !! html/php
24080 <table>
24081 <tr>
24082 <td>foo-bar
24083 </td>
24084 <td>foo+bar
24085 </td></tr>
24086 <tr>
24087 <td><i>foo</i>-bar
24088 </td>
24089 <td><i>foo</i>+bar
24090 </td></tr>
24091 <tr>
24092 <td>foo
24093 <p>bar|baz
24094 +bar
24095 -bar
24096 </p>
24097 </td></tr>
24098 <tr>
24099 <td>x
24100 <div>a|b</div>
24101 </td></tr></table>
24103 !! end
24105 !! test
24106 Tables: 4d. No escaping needed
24107 !! options
24108 parsoid=html2wt
24109 !! html/parsoid
24110 <table>
24111 <tbody><tr><td><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo</a>-bar</td>
24112 <td data-parsoid='{"startTagSrc":"|","attrSepSrc":"|"}'>+1</td>
24113 <td data-parsoid='{"startTagSrc":"|","attrSepSrc":"|"}'>-2</td></tr>
24114 </tbody></table>
24115 !! wikitext
24117 |[[Foo]]-bar
24118 ||+1
24119 ||-2
24121 !! html/php
24122 <table>
24123 <tr>
24124 <td><a href="/wiki/Foo" title="Foo">Foo</a>-bar
24125 </td>
24126 <td>+1
24127 </td>
24128 <td>-2
24129 </td></tr></table>
24131 !! end
24133 !! test
24134 T97430: Don't emit empty nowiki pairs around marker meta tags
24135 !! options
24136 parsoid=html2wt
24137 !! html/parsoid
24138 <p>*This is a long sentence here that will make the nowiki algo split up the nowikis into multiple pairs
24139 |** Make this another long long long sentence forcing the nowiki algo to split up the nowikis.</p>
24140 !! wikitext
24141 <nowiki>*</nowiki>This is a long sentence here that will make the nowiki algo split up the nowikis into multiple pairs
24142 |** Make this another long long long sentence forcing the nowiki algo to split up the nowikis.
24143 !! end
24145 !! test
24146 Unclosed xmlish element in table line shouldn't eat end delimiters
24147 !! options
24148 parsoid=html2wt
24149 !! html/parsoid
24150 <table>
24151 <tbody><tr><td> &lt;foo</td>
24152 <td> bar></td></tr>
24153 </tbody></table>
24154 !! wikitext
24156 | <foo
24157 | bar>
24159 !! html/php
24160 <table>
24161 <tr>
24162 <td> &lt;foo
24163 </td>
24164 <td> bar&gt;
24165 </td></tr></table>
24167 !! end
24169 #### --------------- Links ----------------
24170 #### 1. Quote marks in link text
24171 #### 2. Wikilinks: Escapes needed
24172 #### 3. Wikilinks: No escapes needed
24173 #### 4. Extlinks: Escapes needed
24174 #### 5. Extlinks: No escapes needed
24175 #### --------------------------------------
24176 !! test
24177 Links 1. WikiLinks: No escapes needed
24178 !! options
24179 parsoid=html2wt
24180 !! html/parsoid
24181 <p><a rel="mw:WikiLink" href="Foo" title="Foo">Foo<i>boo</i></a>
24182 <a rel="mw:WikiLink" href="Foo" title="Foo">[Foobar]</a>
24183 <a rel="mw:WikiLink" href="Foo" title="Foo">x [Foobar] x</a></p>
24184 !! wikitext
24185 [[Foo|Foo''boo'']]
24186 [[Foo|[Foobar]]]
24187 [[Foo|x [Foobar] x]]
24188 !! html/php
24189 <p><a href="/wiki/Foo" title="Foo">Foo<i>boo</i></a>
24190 <a href="/wiki/Foo" title="Foo">[Foobar]</a>
24191 <a href="/wiki/Foo" title="Foo">x [Foobar] x</a>
24192 </p>
24193 !! end
24195 !! test
24196 Links 2. WikiLinks: Escapes needed
24197 !! options
24198 parsoid=html2wt
24199 !! html/parsoid
24200 <a href="Foo" rel="mw:WikiLink">Foobar]</a>
24201 <a href="Foo" rel="mw:WikiLink">x [http://google.com g] x</a>
24202 <a href="Foo" rel="mw:WikiLink">[[Bar]]</a>
24203 <a href="Foo" rel="mw:WikiLink">x [[Bar]] x</a>
24204 <a href="Foo" rel="mw:WikiLink">|Bar</a>
24205 <a href="Foo" rel="mw:WikiLink">]]bar</a>
24206 <a href="Foo" rel="mw:WikiLink">[[bar</a>
24207 <a href="Foo" rel="mw:WikiLink">x [[ y</a>
24208 <a href="Foo" rel="mw:WikiLink">x ]] y</a>
24209 <a href="Foo" rel="mw:WikiLink">x ]] y [[ z</a>
24210 !! wikitext
24211 [[Foo|<nowiki>Foobar]</nowiki>]]
24212 [[Foo|x <nowiki>[http://google.com g]</nowiki> x]]
24213 [[Foo|<nowiki>[[Bar]]</nowiki>]]
24214 [[Foo|<nowiki>x [[Bar]] x</nowiki>]]
24215 [[Foo|<nowiki>|Bar</nowiki>]]
24216 [[Foo|<nowiki>]]bar</nowiki>]]
24217 [[Foo|<nowiki>[[bar</nowiki>]]
24218 [[Foo|<nowiki>x [[ y</nowiki>]]
24219 [[Foo|<nowiki>x ]] y</nowiki>]]
24220 [[Foo|<nowiki>x ]] y [[ z</nowiki>]]
24221 !! html/php
24222 <p><a href="/wiki/Foo" title="Foo">Foobar]</a>
24223 <a href="/wiki/Foo" title="Foo">x [http://google.com g] x</a>
24224 <a href="/wiki/Foo" title="Foo">[[Bar]]</a>
24225 <a href="/wiki/Foo" title="Foo">x [[Bar]] x</a>
24226 <a href="/wiki/Foo" title="Foo">|Bar</a>
24227 <a href="/wiki/Foo" title="Foo">]]bar</a>
24228 <a href="/wiki/Foo" title="Foo">[[bar</a>
24229 <a href="/wiki/Foo" title="Foo">x [[ y</a>
24230 <a href="/wiki/Foo" title="Foo">x ]] y</a>
24231 <a href="/wiki/Foo" title="Foo">x ]] y [[ z</a>
24232 </p>
24233 !! end
24235 !! test
24236 Links 3. WikiLinks: No escapes needed
24237 !! options
24238 parsoid=html2wt
24239 !! html/parsoid
24240 <p><a rel="mw:WikiLink" href="Foo">[Foobar</a>
24241 <a rel="mw:WikiLink" href="Foo" title="Foo">foo|bar</a></p>
24242 !! wikitext
24243 [[Foo|[Foobar]]
24244 [[Foo|foo|bar]]
24245 !! html/php
24246 <p><a href="/wiki/Foo" title="Foo">[Foobar</a>
24247 <a href="/wiki/Foo" title="Foo">foo|bar</a>
24248 </p>
24249 !! end
24251 !! test
24252 Links 4. ExtLinks: Escapes needed
24253 !! options
24254 parsoid=html2wt
24255 !! html/parsoid
24256 <p><a rel="mw:ExtLink" href="http://google.com">[google]</a>
24257 <a rel="mw:ExtLink" href="http://google.com">google]</a></p>
24258 <p>[http://google.com]</p>
24259 <p>[http://google.com google]</p>
24260 <p>[<a rel="mw:ExtLink" href="http://google.com">http://google.com</a>]</p>
24261 <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>
24262 !! wikitext
24263 [http://google.com <nowiki>[google]</nowiki>]
24264 [http://google.com <nowiki>google]</nowiki>]
24266 <nowiki>[http://google.com]</nowiki>
24268 <nowiki>[http://google.com google]</nowiki>
24270 [http://google.com<nowiki>]</nowiki>
24272 [{{echo|http://google.com}}<nowiki>]</nowiki>
24273 !! html/php
24274 <p><a rel="nofollow" class="external text" href="http://google.com">[google]</a>
24275 <a rel="nofollow" class="external text" href="http://google.com">google]</a>
24276 </p><p>[http://google.com]
24277 </p><p>[http://google.com google]
24278 </p><p>[<a rel="nofollow" class="external free" href="http://google.com">http://google.com</a>]
24279 </p><p>[<a rel="nofollow" class="external free" href="http://google.com">http://google.com</a>]
24280 </p>
24281 !! end
24283 !! test
24284 Links 5. ExtLinks: No escapes needed
24285 !! options
24286 parsoid=html2wt
24287 !! html/parsoid
24288 <p><a rel="mw:ExtLink" href="http://google.com">[google</a></p>
24289 <p>[<a ref="mw:ExtLink" href="http://google.com"></a>]</p>
24290 !! wikitext
24291 [http://google.com [google]
24293 [[http://google.com]]
24294 !! html/php
24295 <p><a rel="nofollow" class="external text" href="http://google.com">[google</a>
24296 </p><p>[<a rel="nofollow" class="external autonumber" href="http://google.com">[1]</a>]
24297 </p>
24298 !! end
24300 !! test
24301 Links 6. Add <nowiki/>s between text-nodes and url-links when required (bug 64300)
24302 !! options
24303 parsoid=html2wt
24304 !! html/parsoid
24305 <p>x<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>y
24306 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>?x
24307 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>&amp;x
24308 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>'x
24309 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>,x
24310 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>.x
24311 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>;x
24312 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>:x
24313 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>;x
24314 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>!x
24315 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>=x
24316 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>(x)
24317 <a rel="mw:ExtLink" href="http://example.com(x" data-parsoid='{"stx":"url"}'>http://example.com(x</a>)
24318 </p>
24319 !! wikitext
24320 x<nowiki/>http://example.com<nowiki/>y
24321 http://example.com<nowiki/>?x
24322 http://example.com<nowiki/>&x
24323 http://example.com<nowiki/>'x
24324 http://example.com<nowiki/>,x
24325 http://example.com<nowiki/>.x
24326 http://example.com<nowiki/>;x
24327 http://example.com<nowiki/>:x
24328 http://example.com<nowiki/>;x
24329 http://example.com<nowiki/>!x
24330 http://example.com<nowiki/>=x
24331 http://example.com<nowiki/>(x)
24332 http://example.com(x<nowiki/>)
24333 !! end
24335 !! test
24336 Links 7a. Don't add spurious <nowiki/>s between text-nodes and url-links (bug 64300)
24337 !! options
24338 parsoid=html2wt
24339 !! html/parsoid
24340 <p>x
24341 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>
24343 "<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>"
24344 (<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>)
24345 (<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>) foo
24346 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>,
24347 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>, foo
24348 </p>
24349 !! wikitext
24351 http://example.com
24353 "http://example.com"
24354 (http://example.com)
24355 (http://example.com) foo
24356 http://example.com,
24357 http://example.com, foo
24358 !! html/php
24359 <p>x
24360 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
24362 "<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>"
24363 (<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
24364 (<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>) foo
24365 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>,
24366 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>, foo
24367 </p>
24368 !! end
24370 !! test
24371 Links 7b. Don't add spurious <nowiki/>s between text-nodes and url-links (bug 64300)
24372 !! options
24373 parsoid=html2wt
24374 !! html/parsoid
24375 <p><a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>.,;:!?\
24376 -<a rel="mw:ExtLink" href="http://example.com">http://example.com</a>:</p>
24377 !! wikitext
24378 http://example.com.,;:!?\
24379 -http://example.com:
24380 !! html/php
24381 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>.,;:!?\
24382 -<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>:
24383 </p>
24384 !! end
24386 !! test
24387 Links 8. Add <nowiki/>s between text-nodes and RFC-links when required (bug 64300)
24388 !! options
24389 parsoid=html2wt
24390 !! html/parsoid
24391 <p><a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>4
24392 <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>y
24393 X<a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>y</p>
24394 !! wikitext
24395 RFC 123<nowiki/>4
24396 RFC 123<nowiki/>y
24397 X<nowiki/>RFC 123<nowiki/>y
24398 !! end
24400 !! test
24401 Links 9. Don't add spurious <nowiki/>s between text-nodes and RFC-links (bug 64300)
24402 !! options
24403 parsoid=html2wt
24404 !! html/parsoid
24405 <p><a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>?foo
24406 <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>&amp;foo
24407 -<a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>-
24408 </p>
24409 !! wikitext
24410 RFC 123?foo
24411 RFC 123&foo
24412 -RFC 123-
24413 !! html/php
24414 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc123">RFC 123</a>?foo
24415 <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc123">RFC 123</a>&amp;foo
24416 -<a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc123">RFC 123</a>-
24417 </p>
24418 !! end
24420 !! test
24421 Links 10. Add <nowiki/>s between text-nodes and PMID-links when required (bug 64300)
24422 !! options
24423 parsoid=html2wt
24424 !! html/parsoid
24425 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>4
24426 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>y
24427 X<a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>y
24428 !! wikitext
24429 PMID 123<nowiki/>4
24430 PMID 123<nowiki/>y
24431 X<nowiki/>PMID 123<nowiki/>y
24432 !! end
24434 !! test
24435 Links 11. Don't add spurious <nowiki/>s between text-nodes and PMID-links (bug 64300)
24436 !! options
24437 parsoid=html2wt
24438 !! html/parsoid
24439 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>?foo
24440 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>&foo
24441 -<a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>-
24442 </p>
24443 !! wikitext
24444 PMID 123?foo
24445 PMID 123&foo
24446 -PMID 123-
24447 !! html/php
24448 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>?foo
24449 <a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>&amp;foo
24450 -<a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>-
24451 </p>
24452 !! end
24454 !! test
24455 Links 12. Add <nowiki/>s between text-nodes and ISBN-links when required (bug 64300)
24456 !! options
24457 parsoid=html2wt
24458 !! html/parsoid
24459 <p><a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>1
24460 <a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>x
24461 a<a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>b
24462 </p>
24463 !! wikitext
24464 ISBN 1234567890<nowiki/>1
24465 ISBN 1234567890<nowiki/>x
24466 a<nowiki/>ISBN 1234567890<nowiki/>b
24467 !! end
24469 !! test
24470 Links 13. Don't add spurious <nowiki/>s between text-nodes and ISBN-links (bug 64300)
24471 !! options
24472 parsoid=html2wt
24473 !! html/parsoid
24474 <p>-<a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>'s
24475 !! wikitext
24476 -ISBN 1234567890's
24477 !! html/php
24478 <p>-<a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>'s
24479 </p>
24480 !! end
24482 !! test
24483 Links 14. Protect link-like plain text. (Parsoid bug T78425)
24484 !! options
24485 parsoid=html2wt
24486 !! html/*
24487 <p>this is not a link: http://example.com
24488 </p>
24489 !! wikitext
24490 this is not a link: <nowiki>http://example.com</nowiki>
24491 !! end
24493 !! test
24494 Links 15. Link trails can't become link prefixes.
24495 !! options
24496 language=is
24497 parsoid=html2wt
24498 !! html/parsoid
24499 <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>
24500 !! wikitext
24501 [[Söfnuður]]-[[00]]
24502 !! html/php
24503 <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>
24504 </p>
24505 !! end
24507 #### --------------- Quotes ---------------
24508 #### 1. Quotes inside <b> and <i>
24509 #### 2. Link fragments separated by <i> and <b> tags
24510 #### 3. Link fragments inside <i> and <b>
24511 #### 4. No escaping needed
24512 #### --------------------------------------
24513 !! test
24514 1a. Quotes inside <b> and <i>
24515 !! options
24516 parsoid=html2wt
24517 !! html/*
24518 <p><i>'foo'</i>
24519 <i>''foo''</i>
24520 <i>'''foo'''</i>
24521 <i>foo</i>'s
24522 <b>'foo'</b>
24523 <b>''foo''</b>
24524 <b>'''foo'''</b>
24525 <b>foo'<i>bar'</i>baz</b>
24526 <b>foo</b>'s
24527 '<i>foo</i>
24528 <i>foo</i>'
24529 <i>foo'</i>'
24530 '<i>foo</i>'
24531 '<b>foo</b>
24532 <b>foo</b>'
24533 '<b>foo</b>'
24534 <i>fools'<span> errand</span></i>
24535 <i><span>fool</span>'s errand</i>
24536 '<i>foo</i> bar '<i>baz</i>
24537 a|!*#-:;+-~[]{}b'<i>x</i>
24538 </p>
24539 !! wikitext
24540 ''<nowiki/>'foo'''
24541 ''<nowiki>''foo''</nowiki>''
24542 ''<nowiki>'''foo'''</nowiki>''
24543 ''foo''<nowiki/>'s
24544 '''<nowiki/>'foo''''
24545 '''<nowiki>''foo''</nowiki>'''
24546 '''<nowiki>'''foo'''</nowiki>'''
24547 '''foo'<nowiki/>''bar'<nowiki/>''baz'''
24548 '''foo'''<nowiki/>'s
24549 '''foo''
24550 ''foo''<nowiki/>'
24551 ''foo'''<nowiki/>'
24552 '''foo''<nowiki/>'
24553 ''''foo'''
24554 '''foo'''<nowiki/>'
24555 ''''foo'''<nowiki/>'
24556 ''fools'<span> errand</span>''
24557 ''<span>fool</span>'s errand''
24558 '<nowiki/>''foo'' bar '''baz''
24559 a|!*#-:;+-~[]{}b'''x''
24560 !! end
24562 !! test
24563 1b. Quotes inside <b> and <i> with other tags on same line
24564 !! options
24565 parsoid=html2wt
24566 !! html/parsoid
24567 '<i>a</i> foo <i><a rel="mw:WikiLink" href="Bar" title="Bar">bar</a></i>
24568 <i>a'</i> foo <i><a rel="mw:WikiLink" href="Bar" title="Bar">bar</a></i>
24569 <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>
24570 <a rel="mw:WikiLink" href="Foo" title="Foo">foo</a> x'<i><a href="Bar" rel="mw:WikiLink" title="Bar">bar</a></i>
24571 '<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="./Main_Page#cite_note-1"><span class="mw-reflink-text">[1]</span></a></span>
24572 '<i>foo</i> <div title="name">test</div>
24573 '<i>foo</i> and <br data-parsoid='{"stx":"html","noClose":true}'/> bar
24574 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'>
24575 <li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="./Main_Page#cite_ref-1">↑</a></span> <span id="mw-reference-text-cite_note-1" class="mw-reference-text" data-parsoid="{}">test</span></li>
24576 </ol>
24577 !! wikitext
24578 '''a'' foo ''[[bar]]''
24579 ''a''' foo ''[[bar]]''
24580 ''a''' foo '''{{echo|[[bar]]}}'''
24581 [[foo]] x'''[[bar]]''
24582 '''foo'' <ref>test</ref>
24583 '''foo'' <div title="name">test</div>
24584 '''foo'' and <br> bar
24585 <references />
24586 !! end
24588 !! test
24589 2. Link fragments separated by <i> and <b> tags
24590 !! options
24591 parsoid=html2wt
24592 !! html/parsoid
24593 <p>[[<i>foo</i>hello]]</p>
24594 <p>[[<b>foo</b>hello]]</p>
24595 !! wikitext
24596 [[''foo''<nowiki>hello]]</nowiki>
24598 [['''foo'''<nowiki>hello]]</nowiki>
24599 !! end
24601 # FIXME: Escaping one or both of [[ and ]] is also acceptable --
24602 #        this is one of the shortcomings of this format
24603 !! test
24604 3. Link fragments inside <i> and <b>
24605 !! options
24606 parsoid=html2wt
24607 !! html/parsoid
24608 <p><i>[[foo</i>]]</p>
24609 <p><b>[[foo</b>]]</p>
24610 !! wikitext
24611 ''[[foo''<nowiki>]]</nowiki>
24613 '''[[foo'''<nowiki>]]</nowiki>
24614 !! end
24616 !! test
24617 4. No escaping needed
24618 !! options
24619 options=html2wt
24620 !! html/parsoid
24621 <p>'<span><i>bar</i></span>'
24622 '<span><b>bar</b></span>'
24623 'a:b'foo
24624 </p>
24625 !! wikitext
24626 '<span>''bar''</span>'
24627 '<span>'''bar'''</span>'
24628 'a:b'foo
24629 !! end
24631 #### ----------- Paragraphs ---------------
24632 #### 1. No unnecessary escapes
24633 #### --------------------------------------
24635 !! test
24636 1. No unnecessary escapes
24637 !! options
24638 parsoid=html2wt
24639 !! html/parsoid
24640 <p>bar <span>[[foo]]</span>
24641 </p><p>=bar <span>[[foo]]</span>
24642 </p><p>[[bar <span>[[foo]]</span>
24643 </p><p>]]bar <span>[[foo]]</span>
24644 </p><p>=bar <span>foo]]</span>=
24645 </p>
24646 !! wikitext
24647 bar <span><nowiki>[[foo]]</nowiki></span>
24649 =bar <span><nowiki>[[foo]]</nowiki></span>
24651 [[bar <span><nowiki>[[foo]]</nowiki></span>
24653 ]]bar <span><nowiki>[[foo]]</nowiki></span>
24655 =bar <span>foo]]</span><nowiki>=</nowiki>
24656 !!end
24658 #### ----------------------- PRE --------------------------
24659 #### 1. Leading whitespace in SOL context should be escaped
24660 #### ------------------------------------------------------
24661 !! test
24662 1. Leading whitespace in SOL context should be escaped
24663 !! options
24664 parsoid=html2wt
24665 !! html/parsoid
24666 <p> a</p>
24668 <p>  a</p>
24670 <p>     a(tab)</p>
24672 <p>     a
24673 <!--cmt-->
24674   a</p>
24676 <p>a
24677  b</p>
24679 <p>a
24680         b</p>
24682 <p>a
24683          b</p>
24684 !! wikitext
24685 <nowiki> </nowiki>a
24687 <nowiki> </nowiki> a
24689         a(tab)
24691 <nowiki> </nowiki>      a
24692 <!--cmt-->
24693 <nowiki>  </nowiki>a
24696 <nowiki> </nowiki>b
24699         b
24702          b
24703 !! html/php
24704 <p> a
24705 </p><p>  a
24706 </p><p> a(tab)
24707 </p><p>         a
24708   a
24709 </p><p>a
24711 </p><p>a
24712         b
24713 </p><p>a
24714          b
24715 </p>
24716 !! end
24718 !! test
24719 2. Leading whitespace in non-indent-pre contexts should not be escaped
24720 !! options
24721 parsoid=html2wt
24722 !! html/parsoid
24723 <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="./Main_Page#cite_note-1"><span class="mw-reflink-text">[1]</span></a></span></p>
24724 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
24725 <li about="#cite_note-1" id="cite_note-1"><a href="./Main_Page#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>
24726  b</span></li>
24727 </ol>
24728 !! wikitext
24729 foo <ref>''a''
24730  b</ref>
24731 <references />
24732 !! end
24734 !! test
24735 3. Leading whitespace in indent-pre suppressing contexts should not be escaped
24736 !! options
24737 parsoid=html2wt
24738 !! html/parsoid
24739 <blockquote>
24742  <span>b</span>
24743  c</p>
24744 </blockquote>
24745 !! wikitext
24746 <blockquote>
24748  <span>b</span>
24750 </blockquote>
24751 !! end
24753 !! test
24754 4. Leading whitespace in indent-pre suppressing contexts should not be escaped
24755 !! options
24756 options=html2wt
24757 !! html/parsoid
24758  <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>
24759 !! wikitext
24760  [[File:Foobar.jpg|thumb|caption]]
24761 !! end
24763 !! test
24764 5. Nowiki escaping should account for indent-pres
24765 !! options
24766 parsoid=html2wt
24767 !! html/parsoid
24768 <pre>==foo==</pre>
24769 !! wikitext
24770  ==foo==
24771 !! end
24773 !!test
24774 T95794: nowiki escaping should account for leading space at start-of-line in an indent-pre block
24775 !! options
24776 parsoid=html2wt
24777 !! html/parsoid
24778 <pre>
24779 * foo
24780 * bar
24781 </pre>
24782 !! wikitext
24783  * foo
24784  * bar
24785 !! end
24787 #### --------------- Behavior Switches --------------------
24789 !! test
24790 1. Valid behavior switches should be escaped
24791 !! options
24792 parsoid=html2wt
24793 !! html/parsoid
24794 __TOC__
24795 <i>__TOC__</i>
24796 !! wikitext
24797 <nowiki>__TOC__</nowiki>
24798 ''<nowiki>__TOC__</nowiki>''
24799 !! end
24801 !! test
24802 2. Invalid behavior switches should not be escaped
24803 !! options
24804 parsoid=html2wt
24805 !! html/parsoid
24806 __TOO__
24807 __|__
24808 !! wikitext
24809 __TOO__
24810 __|__
24811 !! end
24813 # We use indent-pre as an indirect way to test for sol-transparent behavior.
24814 !! test
24815 Behavior switches should be SOL-transparent
24816 !! options
24817 parsoid=html2wt
24818 !! html/parsoid
24819  <meta property="mw:PageProp/toc" />
24821  <!-- this one's bogus -->
24822 <pre>__TOO__</pre>
24824 <pre data-parsoid='{}'><meta property="mw:PageProp/toc" data-parsoid='{"src":"__TOC__","magicSrc":"__TOC__"}'/> foo</pre>
24826 <meta property="mw:PageProp/toc" data-parsoid='{"src":"__TOC__","magicSrc":"__TOC__"}'/><pre data-parsoid='{}'>bar</pre>
24827 !! wikitext
24828  __TOC__
24830  <!-- this one's bogus -->
24831  __TOO__
24833  __TOC__ foo
24835 __TOC__
24836  bar
24837 !! end
24839 #### --------------- HTML tags ---------------
24840 #### 1. a tags
24841 #### 2. other tags
24842 #### 3. multi-line html tag
24843 #### 4. extension tags
24844 #### -----------------------------------------
24845 !! test
24846 1. a tags
24847 !! options
24848 parsoid=html2wt
24849 !! html/parsoid
24850 &lt;a href=&quot;http://google.com&quot;&gt;google&lt;/a&gt;
24851 !! wikitext
24852 <a href="http://google.com">google</a>
24853 !! end
24855 !! test
24856 2. other tags
24857 !! options
24858 parsoid=html2wt
24859 !! html/parsoid
24860 <ul><li> &lt;div&gt;foo&lt;/div&gt;</li>
24861 <li> &lt;div style=&quot;color:red&quot;&gt;foo&lt;/div&gt;</li>
24862 <li> &lt;td&gt;</li></ul>
24864 !! wikitext
24865 * <nowiki><div>foo</div></nowiki>
24866 * <nowiki><div style="color:red">foo</div></nowiki>
24867 * <nowiki><td></nowiki>
24868 !! end
24870 !! test
24871 3. multi-line html tag
24872 !! options
24873 parsoid=html2wt
24874 !! html/parsoid
24875 <p>&lt;div
24876 &gt;foo&lt;/div
24877 &gt;
24878 </p>
24879 !! wikitext
24880 <nowiki><div
24881 >foo</div
24882 ></nowiki>
24883 !! end
24885 !! test
24886 4. extension tags
24887 !! options
24888 parsoid=html2wt
24889 !! html/parsoid
24890 <p>&lt;ref&gt;foo&lt;/ref&gt;
24891 </p><p>&lt;ref&gt;bar
24892 </p><p>baz&lt;/ref&gt;
24893 </p>
24894 !! wikitext
24895 <nowiki><ref>foo</ref></nowiki>
24897 <nowiki><ref>bar</nowiki>
24899 baz<nowiki></ref></nowiki>
24900 !! end
24902 #### --------------- Others ---------------
24903 !! test
24904 Escaping nowikis
24905 !! options
24906 parsoid=html2wt
24907 !! html/parsoid
24908 <p>&lt;nowiki&gt;foo&lt;/nowiki&gt;
24909 </p>
24910 !! wikitext
24911 &lt;nowiki&gt;foo&lt;/nowiki&gt;
24912 !! end
24914 ## The quote-char in the input is necessary for triggering the bug
24915 !! test
24916 (Bug 52035) Nowiki-escaping should not get tripped by " :" in text
24917 !! options
24918 parsoid=html2wt
24919 !! html/parsoid
24920 <p>foo's bar :</p>
24921 !! wikitext
24922 foo's bar :
24923 !! end
24925 #----------- End of wikitext escaping tests --------------
24927 !! test
24929 Tag-like HTML structures are passed through as text
24930 !! wikitext
24931 <x y>
24933 <x.y>
24935 <x-y>
24943 1<d e>f
24944 !! html
24945 <p>&lt;x y&gt;
24946 </p><p>&lt;x.y&gt;
24947 </p><p>&lt;x-y&gt;
24948 </p><p>1&gt;2
24949 </p><p>x&lt;y
24950 </p><p>a&gt;b
24951 </p><p>1&lt;d e&gt;f
24952 </p>
24953 !! end
24955 !! test
24956 HTML tag with necessary entities in attributes
24957 !! wikitext
24958 <span title="&amp;amp;">foo</span>
24959 !! html
24960 <p><span title="&amp;amp;">foo</span>
24961 </p>
24962 !! end
24964 !! test
24965 HTML tag with 'unnecessary' entity encoding in attributes
24966 !! wikitext
24967 <span title="&amp;">foo</span>
24968 !! html
24969 <p><span title="&amp;">foo</span>
24970 </p>
24971 !! end
24973 !! test
24974 HTML tag with broken attribute value quoting
24975 !! options
24976 parsoid=wt2html,html2html
24977 !! wikitext
24978 <span title="Hello world>Foo</span>
24979 !! html/php
24980 <p><span title="Hello world">Foo</span>
24981 </p>
24982 !! html/parsoid
24983 <p><span title="Hello world">Foo</span></p>
24984 !! end
24986 !! test
24987 Self-closed tag with broken attribute value quoting
24988 !! options
24989 parsoid=wt2html,html2html
24990 !! wikitext
24991 <div title="Hello world />Foo
24992 !! html/php+tidy
24993 <div title="Hello world"></div>
24994 <p>Foo</p>
24995 !! html/parsoid
24996 <div title="Hello world " data-parsoid='{"stx":"html","selfClose":true}'></div><p>Foo</p>
24997 !! end
24999 !! test
25000 Table with broken attribute value quoting
25001 !! options
25002 parsoid=wt2html,html2html
25003 !! wikitext
25005 | title="Hello world|Foo
25007 !! html/php
25008 <table>
25009 <tr>
25010 <td title="Hello world">Foo
25011 </td></tr></table>
25013 !! html/parsoid
25014 <table>
25015 <tr>
25016 <td title="Hello world">Foo
25017 </td></tr></table>
25019 !! end
25021 !! test
25022 Table with broken attribute value quoting on consecutive lines
25023 !! options
25024 parsoid=wt2html,html2html
25025 !! wikitext
25027 | title="Hello world|Foo
25028 | style="color:red|Bar
25030 !! html/php
25031 <table>
25032 <tr>
25033 <td title="Hello world">Foo
25034 </td>
25035 <td style="color:red">Bar
25036 </td></tr></table>
25038 !! html/parsoid
25039 <table><tbody>
25040 <tr>
25041 <td title="Hello world">Foo
25042 </td><td style="color: red">Bar
25043 </td></tr></tbody></table>
25045 !! end
25047 !!test
25048 Accept empty td cell attribute
25049 !! wikitext
25051 | align="center" | foo ||  |
25053 !! html
25054 <table>
25055 <tr>
25056 <td align="center"> foo </td>
25057 <td>
25058 </td></tr></table>
25060 !!end
25062 !!test
25063 Non-empty attributes in th-cells
25064 !! wikitext
25066 ! Foo !! style="color: red" | Bar
25068 !! html
25069 <table>
25070 <tr>
25071 <th> Foo </th>
25072 <th style="color: red"> Bar
25073 </th></tr></table>
25075 !!end
25077 !!test
25078 Accept empty attributes in th-cells
25079 !! wikitext
25081 !| foo !!| bar
25083 !! html
25084 <table>
25085 <tr>
25086 <th> foo </th>
25087 <th> bar
25088 </th></tr></table>
25090 !!end
25092 !!test
25093 Empty table rows go away
25094 !! wikitext
25096 | Hello
25097 | there
25098 |- class="foo"
25101 !! html
25102 <table>
25103 <tr>
25104 <td> Hello
25105 </td>
25106 <td> there
25107 </td></tr>
25109 </table>
25111 !! end
25114 ### Parsoid-centric tests for testing RTing of inter-element separators
25115 ### Edge cases not tested by existing parser tests and specific to
25116 ### Parsoid-specific serialization strategies.
25119 !!test
25120 RT-ed inter-element separators should be valid separators
25121 !! wikitext
25123 |- [[foo]]
25125 !! html/php
25126 <table>
25128 </table>
25130 !! html/parsoid
25131 <table>
25132 <tbody><tr data-parsoid='{"startTagSrc":"|-","a":{"[[foo]]":null},"sa":{"[[foo]]":""},"autoInsertedEnd":true}'></tr>
25133 </tbody></table>
25134 !!end
25136 # Parsoid-only since PHP parser relies on Tidy for correct output
25137 !!test
25138 Trailing newlines in a deep dom-subtree that ends a wikitext line should be migrated out
25139 !!options
25140 parsoid
25141 !! wikitext
25143 |<small>foo
25148 |<small>foo<small>
25150 !! html
25151 <table>
25152 <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'><small data-parsoid='{"stx":"html","autoInsertedEnd":true}'>foo
25153 <p>bar</p></small></td></tr>
25154 </tbody></table>
25156 <table>
25157 <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>
25158 </tbody></table>
25159 !!end
25161 # Note that the "style" attribute is really a template parameter here.
25162 # The = would have to be {{=}} if you wanted the literal.
25163 !!test
25164 Empty TD followed by TD with tpl-generated attribute
25165 !! wikitext
25169 |{{echo|style='color:red'}}|foo
25171 !! html
25172 <table>
25174 <tr>
25175 <td>
25176 </td>
25177 <td>foo
25178 </td></tr></table>
25180 !!end
25182 !!test
25183 Indented table with an empty td
25184 !! wikitext
25185  {|
25186  |-
25188  |foo
25189  |}
25190 !! html
25191 <table>
25193 <tr>
25194 <td>
25195 </td>
25196 <td>foo
25197 </td></tr></table>
25199 !!end
25201 ## We have some newline diffs RT-ing this edge case
25202 ## and it is not important enough -- we seem to be emitting
25203 ## at most 2 newlines after a </tr> and this is unrelated to
25204 ## the issue from T85627 that this is testing.
25205 !!test
25206 Indented table with blank lines in between (T85627)
25207 !! options
25208 parsoid=wt2html
25209 !! wikitext
25210  {|
25211  |foo
25214  |}
25215 !! html
25216 <table>
25218 <tr>
25219 <td>foo
25220 </td></tr></table>
25222 !!end
25224 !!test
25225 Indented block & table
25226 !! wikitext
25227  <div>foo</div>
25228  {|
25229  |foo
25230  |}
25231 !! html/php
25232  <div>foo</div>
25233 <table>
25234 <tr>
25235 <td>foo
25236 </td></tr></table>
25238 !! html/parsoid
25239  <div data-parsoid='{"stx":"html"}'>foo</div>
25240  <table><tbody>
25241  <tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'>foo</td></tr>
25242  </tbody></table>
25243 !!end
25245 !! test
25246 Indent and comment before table row
25247 !! wikitext
25249  <!--hi-->|-
25250  | there
25252 !! html/php
25253 <table>
25255 <tr>
25256 <td> there
25257 </td></tr></table>
25259 !! html/parsoid
25260 <table>
25261  <!--hi--><tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'>
25262  <td data-parsoid='{"autoInsertedEnd":true}'> there</td></tr>
25263 </tbody></table>
25264 !! end
25266 # Parsoid-specific since PHP parser doesn't handle this mixed tbl-wikitext
25267 !!test
25268 Empty TR followed by a template-generated TR
25269 !!options
25270 parsoid
25271 !! wikitext
25274 {{echo|<tr><td>foo</td></tr>}}
25276 !! html
25277 <table>
25278 <tbody>
25279 <tr></tr>
25280 <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}}]}'>
25281 <td>foo</td></tr>
25282 </tbody></table>
25283 !!end
25285 ## PHP and parsoid output differ for this, and since this is primarily
25286 ## for testing Parsoid's serializer, marking this Parsoid only
25287 !!test
25288 Empty TR followed by mixed-ws-comment line should RT correctly
25289 !!options
25290 parsoid
25291 !! wikitext
25294  <!--c-->
25296 <!--c--> <!--d-->
25298 !! html
25299 <table>
25300 <tbody>
25301 <tr></tr>
25302  <!--c-->
25303 <tr>
25304 <!--c--> </tr><!--d-->
25305 </tbody></table>
25307 !!end
25309 !!test
25310 Multi-line image caption generated by templates with/without trailing newlines
25311 !! wikitext
25312 [[File:Foobar.jpg|thumb|300x300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}]]
25313 [[File:Foobar.jpg|thumb|300x300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}\n\n]]
25314 !! html/parsoid
25315 <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>
25316 <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>
25317 !!end
25319 !! test
25320 New element inserted (without intervening newlines) after an old sol-transparent node should serialize correctly
25321 !! options
25322 parsoid=html2wt
25323 !! html/parsoid
25324 <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>
25326 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{}'/><h1>new heading</h1>
25327 !! wikitext
25328 <includeonly>foo</includeonly>
25329 new para
25331 [[Category:Foo]]
25333 = new heading =
25334 !! end
25336 ## PHP emits broken html for this, and since this is primarily
25337 ## a Parsoid serializer test, marking this Parsoid only
25338 !!test
25339 Improperly nested inline or quotes tags with whitespace in between
25340 !! wikitext
25341 <span> <s>x</span> </s>
25342 ''' ''x''' ''
25343 !! html/parsoid
25344 <p><span> <s>x</s></span><s> </s>
25345 <b> <i>x</i></b><i> </i>
25346 </p>
25347 !!end
25349 !!test
25350 Encapsulate protected attributes from wt
25351 !! wikitext
25352 <div typeof="mw:placeholder stuff" data-mw="whoo" data-parsoid="weird" data-parsoid-other="no" about="time" rel="mw:true">foo</div>
25354 {| typeof="mw:placeholder stuff" data-mw="whoo" data-parsoid="weird" data-parsoid-other="no" about="time" rel="mw:true"
25355 | ok
25357 !! html/parsoid
25358 <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>
25360 <table 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">
25361 <tbody><tr><td data-parsoid='{"autoInsertedEnd":true}'> ok</td></tr>
25362 </tbody></table>
25363 !!end
25365 ## Currently the p-wrapper is fragile in how it adds / removes transformations.
25366 ## Having nested or stray pre tags results in the attempt to add duplicates,
25367 ## causing an assertion fail. This test tries to prevent that situation.
25368 !!test
25369 Ensure ParagraphWrapper can deal with stray closing pre tags
25370 !!options
25371 parsoid=wt2html
25372 !! wikitext
25373 plain text</pre>
25374 !! html/parsoid
25375 plain text
25376 !!end
25378 !!test
25379 1. Ensure fostered text content is wrapped in element nodes
25380 !!options
25381 parsoid=wt2html
25382 !! wikitext
25383 <table>hi</table><table>ho</table>
25384 !! html/parsoid
25385 <p>hi</p>
25386 <table></table>
25387 <p>ho</p>
25388 <table></table>
25389 !!end
25391 !!test
25392 2. Ensure fostered text content is wrapped in element nodes (traps regressions around fostered marker on the element getting lost)
25393 !!options
25394 parsoid=wt2html,wt2wt
25395 !! wikitext
25396 <table>
25397 <tr> || ||
25398 <td> a
25399 </table>
25400 !! html/parsoid
25401 <p> || ||
25402 </p><table>
25403 <tbody><tr><td> a</td></tr>
25404 </tbody></table>
25405 !!end
25407 !!test
25408 Encapsulation properly handles null DSR information from foster box
25409 !!options
25410 parsoid=wt2html,wt2wt
25411 !! wikitext
25412 {{echo|<table>foo<tr><td>bar</td></tr></table>}}
25413 !! html/parsoid
25414 <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>
25415 !!end
25417 !!test
25418 1. Encapsulate foster-parented transclusion content
25419 !!options
25420 parsoid=wt2wt,wt2html
25421 !! wikitext
25422 <table>{{echo|foo<tr><td>bar</td></tr>}}</table>
25423 !! html/parsoid
25424 <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>
25425 <tbody>
25426 <tr>
25427 <td>bar</td>
25428 </tr>
25429 </tbody>
25430 </table>
25431 !!end
25433 !!test
25434 2. Encapsulate foster-parented transclusion content
25435 !!options
25436 parsoid=wt2wt,wt2html
25437 !! wikitext
25438 <table><div>{{echo|foo}}</div><tr><td>bar</td></tr></table>
25439 !! html/parsoid
25440 <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>
25441 <table>
25442 <tbody>
25443 <tr>
25444 <td>bar</td>
25445 </tr>
25446 </tbody>
25447 </table>
25448 !!end
25450 !!test
25451 3. Encapsulate foster-parented transclusion content
25452 !!options
25453 parsoid=wt2wt,wt2html
25454 !! wikitext
25455 <table><div><p>{{echo|foo</p></div><tr><td>}}bar</td></tr></table>
25456 !! html/parsoid
25457 <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;]}">
25458 <p>foo</p>
25459 </div>
25460 <table>
25461 <tbody>
25462 <tr>
25463 <td>bar</td>
25464 </tr>
25465 </tbody>
25466 </table>
25467 !!end
25469 !!test
25470 4. Encapsulate foster-parented transclusion content
25471 !!options
25472 parsoid=wt2wt,wt2html
25473 !! wikitext
25474 <table><div><p>{{echo|foo</p></div><tr><td>}}bar</td></tr></table>
25475 !! html/parsoid
25476 <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;]}">
25477 <p>foo</p>
25478 </div>
25479 <table>
25480 <tbody>
25481 <tr>
25482 <td>bar</td>
25483 </tr>
25484 </tbody>
25485 </table>
25486 !!end
25488 !!test
25489 5. Encapsulate foster-parented transclusion content
25490 !!options
25491 parsoid=wt2wt,wt2html
25492 !! wikitext
25493 <table><tr><td><div><p>{{echo|foo</p></div></td>foo}}</tr></table>
25494 !! html/parsoid
25495 <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>
25496 <table>
25497 <tbody>
25498 <tr>
25499 <td>
25500 <div>
25501 <p>foo</p>
25502 </div>
25503 </td>
25504 </tr>
25505 </tbody>
25506 </table>
25507 !!end
25509 !!test
25510 6. Encapsulate foster-parented transclusion content
25511 !!options
25512 parsoid=wt2wt,wt2html
25513 !! wikitext
25514 <table><tr><td><div><p>{{echo|foo</p></div></td>foo</tr></table>}}<p>ok</p>
25515 !! html/parsoid
25516 <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>
25517 <table>
25518 <tbody>
25519 <tr>
25520 <td>
25521 <div>
25522 <p>foo</p>
25523 </div>
25524 </td>
25525 </tr>
25526 </tbody>
25527 </table>
25528 <p>ok</p>
25529 !!end
25531 !!test
25532 7. Encapsulate foster-parented transclusion content
25533 !!options
25534 parsoid=wt2wt,wt2html
25535 !! wikitext
25536 <table>{{echo|<p>foo</p>}}<td>bar</td></table>
25537 !! html/parsoid
25538 <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>
25539 <table>
25540 <tbody>
25541 <tr>
25542 <td>bar</td>
25543 </tr>
25544 </tbody>
25545 </table>
25546 !!end
25548 # Note that the wt is broken on purpose: the = should be {{=}} if you
25549 # don't want it to be a template parameter key.
25550 !!test
25551 8. Encapsulate foster-parented transclusion content
25552 !!options
25553 parsoid=wt2wt,wt2html
25554 !! wikitext
25555 {{echo|a
25556 }}{|{{echo|style='color:red'}}
25560 !! html/parsoid
25561 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"a\n"}},"i":0}}]}'>a</p>
25562 <span> </span>
25563 <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>
25564 <table>
25565 <tbody>
25566 <tr>
25567 <td>b</td>
25568 </tr>
25569 </tbody>
25570 </table>
25571 !!end
25573 !!test
25574 9. Encapsulate foster-parented transclusion content
25575 !!options
25576 parsoid=wt2wt,wt2html
25577 !! wikitext
25578 <table>{{echo|hi</table>hello}}
25579 !! html/parsoid
25580 <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>
25581 !!end
25583 !!test
25584 Table in fosterable position
25585 !!options
25586 parsoid=wt2html
25587 !! wikitext
25588 {{OpenTable}}
25589 <div>
25592 </div>
25594 !! html/parsoid
25595 <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">
25596 </span>
25597 <table about="#mwt1" data-parsoid='{"autoInsertedEnd":true}'></table>
25599 <table>
25600 </table>
25601 !!end
25603 # Parsoid only for bug 64747
25604 !! test
25605 Properly encapsulate empty-content transclusions in fosterable positions
25606 !! wikitext
25607 <table>
25608 {{#if:|
25609 <td>foo</td>
25611 </table>
25612 !! html/parsoid
25613 <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"}]]}'>
25615 </table>
25616 !! end
25618 !! test
25619 Always encapsulate foster box when template range is expanded to table
25620 !! options
25621 parsoid=wt2wt
25622 !! wikitext
25624 hello
25625 {{OpenTable}}
25627 !! html/parsoid
25629 !! end
25631 !! test
25632 T115289: Unclosed table
25633 !! wikitext
25634 {{echo|<table>}}<!--c-->[[Category:Two]]
25635 !! html/parsoid
25636 <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>
25637 !! end
25639 !! test
25640 T115289: Don't migrate newlines out of tables with fostered content
25641 !! wikitext
25642 <table><td></td>{{echo|<tr>[[Category:One]]}}<!--c-->[[Category:Two]]
25643 !! html/parsoid
25644 <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>
25645 !! end
25647 !! test
25648 T73074: More fostering fun
25649 !! wikitext
25650 <table><td></td>{{echo|<tr>}}<!--c-->[[Category:Two]]
25651 !! html/parsoid
25652 <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>
25653 !! end
25655 !!test
25656 Support <object> element with .data attribute
25657 !!options
25658 parsoid=html2wt
25659 !! html/parsoid
25660 <object data="test.swf"></object>
25661 !! wikitext
25662 <object data="test.swf"></object>
25663 !!end
25665 !! test
25666 Don't block XML namespace declaration
25667 !! wikitext
25668 <span xmlns:dct="http://purl.org/dc/terms/" property="dct:title">MediaWiki</span>
25669 !! html/php
25670 <p><span xmlns:dct="http&#58;//purl.org/dc/terms/" property="dct:title">MediaWiki</span>
25671 </p>
25672 !! html/parsoid
25673 <p><span xmlns:dct="http://purl.org/dc/terms/" data-x-property="dct:title" data-parsoid='{"stx":"html"}'>MediaWiki</span></p>
25674 !! end
25676 # -----------------------------------------------------------------
25677 # The following section of tests are primarily to spec requirements
25678 # around Parsoid's serialization (old, new, edited content)
25680 # All these tests are marked Parsoid html2wt and html2html only
25681 # ----------------------------------------------------------------
25683 !! test
25684 Ignore rel attribute in a-tags during serialization to url-links
25685 !! options
25686 parsoid=html2wt
25687 !! html/parsoid
25688 <a href='http://en.wikipedia.org/wiki/Foobar'>http://en.wikipedia.org/wiki/Foobar</a>
25689 <a href='http://en.wikipedia.org/wiki/Foobar' rel='mw:ExtLink'>http://en.wikipedia.org/wiki/Foobar</a>
25690 <a href='http://en.wikipedia.org/wiki/Foobar' rel='mw:WikiLink'>http://en.wikipedia.org/wiki/Foobar</a>
25691 !! wikitext
25692 http://en.wikipedia.org/wiki/Foobar
25693 http://en.wikipedia.org/wiki/Foobar
25694 http://en.wikipedia.org/wiki/Foobar
25695 !! end
25697 # 'mi' is a localinterwiki prefix as well as a language
25698 !! test
25699 Serialize interwiki links pointing to the current wiki as plain wiki links (bug 65869)
25700 !! options
25701 parsoid=html2wt
25702 !! html/parsoid
25703 <p><a rel="mw:ExtLink" href="http://mi.wikipedia.org/wiki/Foo">Foo</a></p>
25704 !! wikitext
25705 [[Foo]]
25706 !! end
25708 # See T93839
25709 !! test
25710 New wikilinks should be serialized properly
25711 !! options
25712 parsoid=html2wt
25713 !! html/parsoid
25714 <a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{}'>Foo</a>
25715 <a rel="mw:WikiLink" href="./Foo" title="Foo">Foo</a>
25716 <a href="//en.wikipedia.org/wiki/Foo">//en.wikipedia.org/wiki/Foo</a>
25717 <a href="http://en.wikipedia.org/wiki/Foo">http://en.wikipedia.org/wiki/Foo</a>
25718 <a href="//en.wikipedia.org/wiki/Foo_bar">//en.wikipedia.org/wiki/Foo bar</a>
25719 !! wikitext
25720 [[Foo]]
25721 [[Foo]]
25722 [[:en:Foo|//en.wikipedia.org/wiki/Foo]]
25723 http://en.wikipedia.org/wiki/Foo
25724 [[:en:Foo_bar|//en.wikipedia.org/wiki/Foo bar]]
25725 !! end
25727 !! test
25728 New wiki links (href variations)
25729 !! options
25730 parsoid=html2wt
25731 !! html/parsoid
25732 <a rel="mw:WikiLink" href="./Foo_bar">Foo_bar</a>
25733 <a rel="mw:WikiLink" href="Foo_bar">Foo_bar</a>
25734 <a rel="mw:WikiLink" href="Foo bar">Foo_bar</a>
25735 <a rel="mw:WikiLink" href="./Toxine_bact%C3%A9rienne">Toxine bactérienne</a>
25736 !! wikitext
25737 [[Foo_bar]]
25738 [[Foo_bar]]
25739 [[Foo_bar]]
25740 [[Toxine bactérienne]]
25741 !! end
25743 !! test
25744 New wiki links (content string variations)
25745 !! options
25746 parsoid=html2wt
25747 !! html/parsoid
25748 <a rel="mw:WikiLink" href="./Foo_bar">Foo_bar</a>
25749 <a rel="mw:WikiLink" href="./Foo_bar">Foo bar</a>
25750 <a rel="mw:WikiLink" href="./Foo_bar">./Foo_bar</a>
25751 !! wikitext
25752 [[Foo_bar]]
25753 [[Foo bar]]
25754 [[Foo_bar|./Foo_bar]]
25755 !! end
25757 !! test
25758 New category links (href variations)
25759 !! options
25760 parsoid=html2wt
25761 !! html/parsoid
25762 <link rel="mw:PageProp/Category" href="./Category:Toxine_bactérienne" />
25763 <link rel="mw:PageProp/Category" href="./Category:Toxine_bact%C3%A9rienne" />
25764 <link rel="mw:PageProp/Category" href="Category:Toxine_bact%C3%A9rienne" />
25765 !! wikitext
25766 [[Category:Toxine bactérienne]]
25767 [[Category:Toxine bactérienne]]
25768 [[Category:Toxine bactérienne]]
25769 !! end
25771 !! test
25772 New sol transparent links don't need indent-pre nowiki protection
25773 !! options
25774 parsoid=html2wt
25775 language=de
25776 !! html/parsoid
25777          <link rel="mw:PageProp/redirect" href="./Main_Page">
25778 <!-- this is good  -->    <link rel="mw:PageProp/Category" href="./Category:Good" />
25779 <!-- this is great -->    <link rel="mw:PageProp/Category" href="./Kategorie:Great" />
25780 !! wikitext
25781          #WEITERLEITUNG [[Main Page]]
25782 <!-- this is good  -->    [[Category:Good]]
25783 <!-- this is great -->    [[Kategorie:Great]]
25784 !! end
25786 !! test
25787 New interlanguage links (href variations)
25788 !! options
25789 parsoid=html2wt
25790 !! html/parsoid
25791 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine bactérienne" />
25792 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine_bactérienne" />
25793 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine_bact%C3%A9rienne" />
25794 !! wikitext
25795 [[es:Toxine bactérienne]]
25796 [[es:Toxine_bactérienne]]
25797 [[es:Toxine_bactérienne]]
25798 !! end
25800 !! test
25801 Image: Modifying size of an image (1)
25802 !! options
25803 parsoid={
25804   "modes": ["wt2wt"],
25805   "changes": [
25806     ["img[height]", "attr", "height", "22"],
25807     ["img[width]", "attr", "width", "200"]
25808   ]
25810 !! wikitext
25811 [[Image:Foobar.jpg|230x230px]]
25812 !! wikitext/edited
25813 [[Image:Foobar.jpg|200x200px]]
25814 !!end
25816 !! test
25817 Image: Modifying size of an image (2)
25818 !! options
25819 parsoid={
25820   "modes": ["wt2wt"],
25821   "changes": [
25822     ["img[height]", "attr", "height", "100"],
25823     ["img[width]", "attr", "width", "500"]
25824   ]
25826 !! wikitext
25827 [[Image:Foobar.jpg|230x230px]]
25828 !! wikitext/edited
25829 [[Image:Foobar.jpg|500x500px]]
25830 !!end
25832 # Change in size is ignored so long as class='mw-default-size'
25833 !! test
25834 Image: Modifying size of an image (3)
25835 !! options
25836 parsoid={
25837   "modes": ["wt2wt"],
25838   "changes": [
25839     ["figure[class]", "removeClass", "mw-default-size"],
25840     ["figure img", "attr", "height", "19"],
25841     ["figure img", "attr", "width", "170"]
25842   ]
25844 !! wikitext
25845 [[Image:Foobar.jpg|thumb]]
25846 !! wikitext/edited
25847 [[Image:Foobar.jpg|thumb|170x170px]]
25848 !!end
25850 !! test
25851 Image: Modifying alignment of an image (bug 48665)
25852 !! options
25853 parsoid={
25854   "modes": ["wt2wt"],
25855   "changes": [
25856     ["figure[class]", "removeClass", "mw-halign-right"],
25857     ["figure[class]", "addClass", "mw-halign-left"]
25858   ]
25860 !! wikitext
25861 [[Image:Foobar.jpg|thumb|caption|right]]
25862 !! wikitext/edited
25863 [[Image:Foobar.jpg|thumb|caption|left]]
25864 !! end
25866 !! test
25867 Image: Modifying mw-default-size of an frameless image (bug 62805)
25868 !! options
25869 parsoid={
25870   "modes": ["wt2wt"],
25871   "changes": [
25872     ["figure.mw-default-size", "removeClass", "mw-default-size"]
25873   ]
25875 !! wikitext
25876 [[Image:Foobar.jpg|frameless|right]]
25877 !! wikitext/edited
25878 [[Image:Foobar.jpg|frameless|right|220x220px]]
25879 !! end
25881 !! test
25882 Image: Modifying valign of an image (bug 49221)
25883 !! options
25884 parsoid={
25885   "modes": ["wt2wt"],
25886   "changes": [
25887     ["*[typeof=\"mw:Image\"]", "removeClass", "mw-valign-middle"],
25888     ["*[typeof=\"mw:Image\"]", "addClass", "mw-valign-text-top"]
25889   ]
25891 !! wikitext
25892 [[File:Foobar.jpg|20px|middle]]
25893 !! wikitext/edited
25894 [[File:Foobar.jpg|20px|text-top]]
25895 !! end
25897 !! test
25898 Image: Modifying alt attribute of an image (bug 56400)
25899 !! options
25900 parsoid={
25901   "modes": ["wt2wt"],
25902   "changes": [
25903     ["img[alt]", "attr", "alt", "some alternate edited text"]
25904   ]
25906 !! wikitext
25907 [[File:Foobar.jpg|thumb|some caption|alt=some alternate text]]
25908 !! wikitext/edited
25909 [[File:Foobar.jpg|thumb|some caption|alt=some alternate edited text]]
25910 !!end
25912 !! test
25913 Image: Modifying caption of an image
25914 !! options
25915 parsoid={
25916   "modes": ["wt2wt"],
25917   "changes": [
25918     ["figcaption", "text", "new caption"]
25919   ]
25921 !! wikitext
25922 [[Image:Foobar.jpg|thumb|original caption]]
25923 !! wikitext/edited
25924 [[Image:Foobar.jpg|thumb|new caption]]
25925 !!end
25927 !! test
25928 Image: empty alt attribute (bug 48924)
25929 !! options
25930 parsoid
25931 !! wikitext
25932 [[File:Foobar.jpg|thumb|alt=|bar]]
25933 !! html
25934 <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>
25935 !! end
25937 !! test
25938 Image: new attributes should be serialized in wiki's language for RTL languages (bug 51852)
25939 !! options
25940 parsoid=html2wt
25941 language=ar
25942 disabled
25943 !! html/parsoid
25944 <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>
25945 !! wikitext
25946 [[Imagen:Foobar.jpg|derecha|miniaturadeimagen]]
25947 !! end
25949 !! test
25950 Image: Block level image should have \n before and after
25951 !! wikitext
25953 [[File:Foobar.jpg|right|thumb|150x150px]]
25955 !! html/parsoid
25956 <p>123</p>
25957 <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>
25958 <p>456</p>
25959 !!end
25961 !! test
25962 Image: New block level image should have \n before and after (existing content)
25963 !! wikitext
25965 [[File:Foobar.jpg|right|thumb|150x150px]]
25967 !! html/parsoid
25968 <p>123</p>
25969 <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>
25970 <p>456</p>
25971 !!end
25973 !! test
25974 Image: upright option (parsoid)
25975 !! wikitext
25976 [[File:Foobar.jpg|thumb|upright|caption]]
25977 [[File:Foobar.jpg|thumb|upright=0.5|caption]]
25978 [[File:Foobar.jpg|thumb|500x500px|upright=0.5|caption]]
25979 !! html/parsoid
25980 <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>
25981 <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>
25982 <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>
25983 !!end
25985 !! test
25986 Image: upright option is ignored on inline and frame images (parsoid)
25987 !! wikitext
25988 [[File:Foobar.jpg|500x500px|upright=0.5|caption]]
25989 !! html/parsoid
25990 <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>
25991 !!end
25993 !! test
25994 Image: from basic HTML (1)
25995 !! options
25996 parsoid=html2wt
25997 !! html/parsoid
25998 <span typeof="mw:Image">
25999   <img src="./File:Foobar.jpg" width=100 height=100 alt="Alt">
26000 </span>
26001 !! wikitext
26002 [[File:Foobar.jpg|link=|alt=Alt|100x100px]]
26003 !! end
26005 !! test
26006 Image: from basic HTML (2)
26007 !! options
26008 parsoid=html2wt
26009 !! html/parsoid
26010 <img src="./File:Foobar.jpg" width=100 height=100 alt="Alt">
26011 !! wikitext
26012 [[File:Foobar.jpg|link=|alt=Alt|100x100px]]
26013 !! end
26015 !! test
26016 Image: from basic HTML (3)
26017 !! options
26018 parsoid=html2wt
26019 !! html/parsoid
26020 <a href="Main"><img src="./File:Foobar.jpg" width=100 height=100 alt="Alt"></a>
26021 !! wikitext
26022 [[File:Foobar.jpg|link=Main|alt=Alt|100x100px]]
26023 !! end
26025 !! test
26026 Image: from basic HTML (4)
26027 !! options
26028 parsoid=html2wt
26029 !! html/parsoid
26030 <img src="./File:Foobar.jpg">
26031 !! wikitext
26032 [[File:Foobar.jpg|link=]]
26033 !! end
26035 !! test
26036 Image: Invalid title as link
26037 !! wikitext
26038 [[File:Foobar.jpg|link=<]]
26039 !! html/php
26040 <p><a href="/wiki/File:Foobar.jpg" class="image" title="link=&lt;"><img alt="link=&lt;" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
26041 </p>
26042 !! html/parsoid
26043 <p><span class="mw-default-size" typeof="mw:Image" data-parsoid='{"optList":[{"ck":"link","ak":"link=&lt;"}]}' data-mw='{"caption":"link=&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>
26044 !! end
26046 !! test
26047 Lists: Serialize correctly even when list content is wrapped in p-tags (like VE does)
26048 !! options
26049 parsoid=html2wt
26050 !! html/parsoid
26051 <ul>
26052 <li><p>foo</p></li>
26053 </ul>
26054 !! wikitext
26055 * foo
26056 !! end
26058 !! test
26059 Lists: Serialize correctly even when list tags has unneeded whitespace between tags
26060 !! options
26061 parsoid=html2wt
26062 !! html/parsoid
26063 <ul> <li>foo</li></ul>
26064 !! wikitext
26065 * foo
26066 !! end
26068 !! test
26069 Don't strip leading whitespace when handling indent-pre suppressing tags
26070 !! options
26071 parsoid=html2wt
26072 !! html/parsoid
26073 <table>
26074   <tr><td> indented row</td></tr>
26075 </table>
26076 <blockquote><p>
26077  <b>This is very bold of you!</b>
26078 </p>
26079 <table><tr><td>
26080  indented cell (no pre-wrapping!)
26081 </td></tr></table>
26082 </blockquote>
26083 <p>foo</p>
26084  <div>bar</div>
26085 !! wikitext
26087   | indented row
26089 <blockquote>
26090  '''This is very bold of you!'''
26094  indented cell (no pre-wrapping!)
26096 </blockquote>
26098  <div>bar</div>
26099 !! end
26101 !! test
26102 Nowiki-wrap leading whitespace when handling indent-pre inducing tags
26103 !! options
26104 parsoid=html2wt
26105 !! html/parsoid
26106 <p>foo</p>
26107  <span>bar</span>
26109 <span>foo2
26110  </span>bar2
26112 <div>foo</div>
26113  <span>bar</span>
26115 <div>
26116  <span>foo</span>
26117 </div>
26118 !! wikitext
26121 <span>bar</span>
26123 <span>foo2
26124 <nowiki> </nowiki></span>bar2
26126 <div>foo</div>
26127 <nowiki> </nowiki><span>bar</span>
26129 <div>
26130 <nowiki> </nowiki><span>foo</span>
26131 </div>
26132 !! end
26134 !! test
26135 Lists: Dont insert newlines in a serialized list item.
26136 !! options
26137 parsoid=html2wt
26138 !! html/parsoid
26139 <ul><li>a<br>b</li><li>c</li></ul>
26140 !! wikitext
26141 * a<br>b
26142 * c
26143 !! end
26145 !! test
26146 1. Headings: Force sol-transparent links and behavior switches to serialize before/after
26147 !! options
26148 parsoid={
26149   "modes": ["html2wt"],
26150   "scrubWikitext": false
26152 !! html/parsoid
26153 <h2>hello there<link href="./Category:A1" rel="mw:PageProp/Category" /></h2>
26154 <h2><link href="./Category:A2" rel="mw:PageProp/Category" />hi pal</h2>
26156 <h2><!--foo-->  <link href="./Category:A3" rel="mw:PageProp/Category" />   how goes it</h2>
26157 <h2>it goes well   <link href="./Category:A4" rel="mw:PageProp/Category" />  <!--bar--></h2>
26159 <h2 data-parsoid='{}'>howdy<link href="./Category:A5" rel="mw:PageProp/Category" /></h2>
26161 <h2><meta property="mw:PageProp/toc" /> ok</h2>
26162 !! wikitext
26163 == hello there [[Category:A1]] ==
26165 == [[Category:A2]] hi pal ==
26167 == <!--foo-->  [[Category:A3]]    how goes it ==
26169 == it goes well    [[Category:A4]]  <!--bar--> ==
26171 ==howdy [[Category:A5]]==
26173 ==  __TOC__  ok ==
26174 !! end
26176 !! test
26177 2. Headings: Force sol-transparent links and behavior switches to serialize before/after
26178 !! options
26179 parsoid={
26180   "modes": ["html2wt"],
26181   "scrubWikitext": true
26183 !! html/parsoid
26184 <h2>hello there<link href="./Category:A1" rel="mw:PageProp/Category" /></h2>
26185 <h2><link href="./Category:A2" rel="mw:PageProp/Category" />hi pal</h2>
26187 <h2><!--foo-->  <link href="./Category:A3" rel="mw:PageProp/Category" />   how goes it</h2>
26188 <h2>it goes well   <link href="./Category:A4" rel="mw:PageProp/Category" />  <!--bar--></h2>
26190 <h2><meta property="mw:PageProp/toc" /> ok</h2>
26191 !! wikitext
26192 == hello there ==
26193 [[Category:A1]]
26194 [[Category:A2]]
26196 == hi pal ==
26198 <!--foo-->  [[Category:A3]]
26200 == how goes it ==
26202 == it goes well ==
26203 [[Category:A4]]  <!--bar-->
26205 __TOC__
26207 == ok ==
26208 !! end
26210 !! test
26211 Headings: Don't hoist metas that come from templates
26212 !! options
26213 parsoid={
26214   "modes": ["html2wt"],
26215   "scrubWikitext": true
26217 !! html/parsoid
26218 <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>
26219 !! wikitext
26220 == {{echo|foo [[Category:Foo]]}} ==
26221 !! end
26223 !! test
26224 Headings: Category in ref isn't hoisted
26225 !! options
26226 parsoid={
26227   "modes": ["html2wt"],
26228   "scrubWikitext": true
26230 !! html/parsoid
26231 <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="./Main_Page#cite_note-1"><span class="mw-reflink-text">[1]</span></a></span> </h2>
26233 <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="./Main_Page#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>
26234 !! wikitext
26235 == foo <ref>bar 
26236 [[Category:Baz]] </ref> ==
26238 <references />
26239 !! end
26241 !! test
26242 Parsoid: Serialize positional parameters with = in them as named parameter
26243 !! options
26244 parsoid=html2wt
26245 !! html/parsoid
26246 <p about="#mwt1" typeof="mw:Transclusion"
26247 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"f=oo"}},"i":0}}]}'>foo</p>
26249 <p about="#mwt1" typeof="mw:Transclusion"
26250 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"f=oo"}, "2":{"wt":"bar"}},"i":0}}]}'>foo</p>
26252 <!--Orig params with data-parsoid has heuristics for handling = chars-->
26253 <!--FIXME: But maybe the heuristic needs fixing to apply to new params as well-->
26254 <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>
26255 !! wikitext
26256 {{echo|1=f=oo}}
26258 {{echo|1=f=oo|2=bar}}
26260 <!--Orig params with data-parsoid has heuristics for handling = chars-->
26261 <!--FIXME: But maybe the heuristic needs fixing to apply to new params as well-->
26262 {{echo|<nowiki>f=oo</nowiki>|bar}}
26263 !! end
26265 !! test
26266 Parsoid: Serialize positional parameters with = in extlink as named parameter
26267 !! options
26268 parsoid=html2wt
26269 !! html/parsoid
26270 <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>
26271 !! wikitext
26272 {{echo|1=http://stuff?is=ok}}
26273 !! end
26275 !! test
26276 Parsoid: Correctly serialize block-node children when they are a combination of text and p-nodes
26277 !! options
26278 parsoid=html2wt
26279 !! html/parsoid
26280 <div>a<p>b</p></div>
26281 <div>a
26282 <p>b</p></div>
26283 <div>
26285 <p>b</p></div>
26286 !! wikitext
26287 <div>a
26289 </div>
26290 <div>a
26292 </div>
26293 <div>
26297 </div>
26298 !! end
26300 !! test
26301 Substrings resembling wikitext in hrefs should not get nowiki escapes
26302 !! options
26303 parsoid=html2wt
26304 !! html/parsoid
26305 <a rel="mw:WikiLink" href="./Foo''bar''baz">Foo''bar''baz</a>
26306 !! wikitext
26307 [[Foo''bar''baz]]
26308 !! end
26310 !! test
26311 Enforce single-line context in the serializer
26312 !! options
26313 parsoid=html2wt
26314 !! html/parsoid
26315 <h2>testing
26316 123</h2>
26318 <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">
26319 </span><span about="#mwt1">you</span> </h2>
26321 <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="./Main_Page#cite_note-1"><span class="mw-reflink-text">[1]</span></a></span> </h2>
26323 <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="./Main_Page#cite_ref-1">↑</a></span> <span id="mw-reference-text-cite_note-1" class="mw-reference-text" data-parsoid="{}">hello
26324 there</span></li></ol>
26326 <ul><li>asd
26327 sdf</li></ul>
26329 <ul><li>foo
26331 baz</li>
26332 <li>foo <b>bar</b>
26333 baz</li></ul>
26335 <dl><dt>hi
26336 ho </dt><dd data-parsoid='{"stx":"row"}'> hi
26337 ho</dd></dl>
26339 <dl><dd> <table>
26340 <tbody><tr><td> ha
26342 ha</td></tr>
26343 </tbody></table></dd></dl>
26344 !! wikitext
26345 == testing 123 ==
26347 == hi {{bogus|there
26348 you}} ==
26350 == foo <ref>hello
26351 there</ref> ==
26353 <references />
26355 * asd sdf
26357 * foo bar baz
26358 * foo '''bar''' baz
26360 ; hi ho : hi ho
26362 : {|
26363 | ha
26367 !! end
26369 !! test
26370 Serialize new placeholder space without spans
26371 !! options
26372 parsoid=html2wt
26373 !! html/parsoid
26374 <p>foo<span typeof="mw:Placeholder"> </span>: bar</p>
26376 <p>foo<span typeof="mw:DisplaySpace mw:Placeholder" data-parsoid='{"src":" ","isDisplayHack":true}'> </span>: bar</p>
26378 <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>
26379 !! wikitext
26380 foo : bar
26382 foo : bar
26384 <ref>foo : bar</ref>ok
26385 !! end
26388 #-----------------------
26389 # Tag minimization tests
26390 #-----------------------
26392 !! test
26393 1. I/B quote minimization: wikitext-only tags should be combined
26394 !! options
26395 parsoid=html2wt
26396 !! html/parsoid
26397 <p><i>A</i><i>B</i></p>
26398 <p><b>A</b><b>B</b></p>
26399 <p><i>A</i><b><i>B</i></b></p>
26400 <p><b>A</b><i><b>B</b></i></p>
26401 <p><b>A</b><i><b>B</b><b>C</b></i><b>D</b></p>
26402 <p><i><b>A</b></i><i><b>B</b></i></p>
26403 <p><i><b>A</b></i><b><i>B</i></b></p>
26404 <p><b><i>A</i></b><i><b>B</b></i></p>
26405 !! wikitext
26406 ''AB''
26408 '''AB'''
26410 ''A'''B'''''
26412 '''A''B'''''
26414 '''A''BC''D'''
26416 '''''AB'''''
26418 '''''AB'''''
26420 '''''AB'''''
26421 !! end
26423 !! test
26424 2. I/B quote minimization: wikitext and html tags should not be combined
26425 !! options
26426 parsoid=html2wt
26427 !! html/parsoid
26428 <p><i>A</i><i data-parsoid='{"stx":"html"}'>B</i></p>
26429 <p><i>A</i><b><i data-parsoid='{"stx":"html"}'>B</i></b></p>
26430 !! wikitext
26431 ''A''<i>B</i>
26433 ''A''<nowiki/>'''<i>B</i>'''
26434 !! end
26436 !! test
26437 3. I/B quote minimization: templated content stops minimization
26438 !! options
26439 parsoid=html2wt
26440 !! html/parsoid
26441 <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>
26442 <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>
26443 !! wikitext
26444 ''A''{{echo|''B''}}
26446 ''A''{{echo|'''''B'''''}}
26447 !! end
26449 !! test
26450 4. I/B quote minimization: new content should be mimimized with adjacent old content
26451 !! options
26452 parsoid=html2wt
26453 !! html/parsoid
26454 <p><i>A</i><i>B</i></p>
26455 <p><b>A</b><b>B</b></p>
26456 <p><i>A</i><b><i>B</i></b></p>
26457 !! wikitext
26458 ''AB''
26460 '''AB'''
26462 ''A'''B'''''
26463 !! end
26465 !! test
26466 5a. Merge adjacent quote nodes if they've been edited
26467 !! options
26468 parsoid={
26469   "modes": ["wt2wt", "selser"],
26470   "changes": [
26471     ["p", "contents", "remove", ":contains('b')"]
26472   ]
26474 !! wikitext
26475 ''a''b''c''
26476 !! wikitext/edited
26477 ''ac''
26478 !! end
26480 !! test
26481 5b. Merge adjacent quote nodes if they've been edited
26482 !! options
26483 parsoid={
26484   "modes": ["wt2wt", "selser"],
26485   "changes": [
26486     ["#x", "remove"]
26487   ]
26489 !! wikitext
26490 ''a''<span id="x">b</span>''c''
26491 !! wikitext/edited
26492 ''ac''
26493 !! end
26495 !! test
26496 1. Merge adjacent link nodes as long as at least one element is new
26497 !! options
26498 parsoid={
26499   "modes": ["html2wt"],
26500   "scrubWikitext": true
26502 !! html/parsoid
26503 <a rel="mw:WikiLink" href="./Football">Foot</a><a rel="mw:WikiLink" href="./Football">ball</a>
26504 <a data-parsoid="{}" rel="mw:WikiLink" href="./Football">Foot</a><a rel="mw:WikiLink" href="./Football">ball</a>
26505 <a data-parsoid="{}" rel="mw:WikiLink" href="./Football">Foot</a><a data-parsoid="{}" rel="mw:WikiLink" href="./Football">ball</a>
26506 !! wikitext
26507 [[Football]]
26508 [[Football]]
26509 [[Football|Foot]][[Football|ball]]
26510 !! end
26512 !! test
26513 2. Merge adjacent link nodes and enable additional normalizations
26514 !! options
26515 parsoid={
26516   "modes": ["html2wt"],
26517   "scrubWikitext": true
26519 !! html/parsoid
26520 <a rel="mw:WikiLink" href="./Football"><i>Foot</i></a><a rel="mw:WikiLink" href="./Football"><i>ball</i></a>
26521 !! wikitext
26522 [[Football|''Football'']]
26523 !! end
26525 !! test
26526 3. Don't merge adjacent link nodes if scrubWikitext is false
26527 !! options
26528 parsoid={
26529   "modes": ["html2wt"],
26530   "scrubWikitext": false
26532 !! html/parsoid
26533 <a rel="mw:WikiLink" href="./Football">Foot</a><a rel="mw:WikiLink" href="./Football">ball</a>
26534 !! wikitext
26535 [[Football|Foot]][[Football|ball]]
26536 !! end
26538 #------------------------------
26539 # End of tag minimization tests
26540 #------------------------------
26542 !!test
26543 Bug 54262: New entities
26544 !! options
26545 parsoid=html2wt
26546 !! html/parsoid
26547 <span typeof="mw:Entity">&nbsp;</span>
26548 !! wikitext
26549 &nbsp;
26550 !! end
26552 ## Note that there is no wikitext output for 'unknownproperty' ##
26553 ## Unknown magic words are silently dropped ##
26555 !! test
26556 Magic words
26557 !! options
26558 parsoid=html2wt
26559 !! html/parsoid
26560 <meta property='mw:PageProp/toc' />
26561 <meta property='mw:PageProp/notoc' />
26562 <meta property='mw:PageProp/forcetoc' />
26563 <meta property='mw:PageProp/index' />
26564 <meta property='mw:PageProp/noindex' />
26565 <meta property='mw:PageProp/nogallery' />
26566 <meta property='mw:PageProp/noeditsection' />
26567 <meta property='mw:PageProp/notitleconvert' />
26568 <meta property='mw:PageProp/nocontentconvert' />
26569 <meta property='mw:PageProp/unknownproperty' />
26570 !! wikitext
26571 __TOC__
26572 __NOTOC__
26573 __FORCETOC__
26574 __INDEX__
26575 __NOINDEX__
26576 __NOGALLERY__
26577 __NOEDITSECTION__
26578 __NOTITLECONVERT__
26579 __NOCONTENTCONVERT__
26580 !! end
26582 !! test
26583 Consecutive <pre>s should not get merged
26584 !! options
26585 parsoid=html2wt,html2html
26586 !! html/parsoid
26587 <pre>a</pre><pre>b</pre>
26589 <pre>c
26590 </pre><pre>
26591 d</pre>
26593 <pre>e
26595 </pre><pre>
26597 f</pre>
26598 !! wikitext
26612 !! end
26614 !! test
26615 Edited ISBN links not serializable as ISBN links should serialize as wikilinks
26616 !! options
26617 parsoid=html2wt
26618 !! html/parsoid
26619 <a href="./Special:BookSources/1234567890" rel="mw:ExtLink">ISBN 1234567895</a>
26620 !! wikitext
26621 [[Special:BookSources/1234567890|ISBN 1234567895]]
26622 !! end
26624 !! test
26625 Edited RFC links not serializable as RFC links should serialize as extlinks
26626 !! options
26627 parsoid=html2wt
26628 !! html/parsoid
26629 <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink">New RFC</a>
26630 !! wikitext
26631 [//tools.ietf.org/html/rfc123 New RFC]
26632 !! end
26634 !! test
26635 Edited PMID links not serializable as PMID links should serialize as extlinks
26636 !! options
26637 parsoid=html2wt
26638 !! html/parsoid
26639 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink">New PMID</a>
26640 !! wikitext
26641 [//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract New PMID]
26642 !! end
26644 !! test
26645 WTS of autolinks with trailing/surrounding context
26646 !! options
26647 parsoid=html2wt
26648 !! html/parsoid
26649 <p><a href="http://cscott.net">http://cscott.net</a><b>foo</b></p>
26650 <p><a href="http://cscott.net">http://cscott.net</a><b data-parsoid='{"stx":"html"}'>foo</b></p>
26651 <p><b><a href="http://cscott.net">http://cscott.net</a></b></p>
26652 <p><b><a href="http://cscott.net">http://cscott.net</a> </b></p>
26653 <p><b><a href="http://cscott.net">http://cscott.net</a>x</b></p>
26654 <p><a href="http://cscott.net">http://cscott.net</a>x</p>
26655 !! wikitext
26656 http://cscott.net'''foo'''
26658 http://cscott.net<b>foo</b>
26660 '''http://cscott.net'''
26662 '''http://cscott.net '''
26664 '''http://cscott.net<nowiki/>x'''
26666 http://cscott.net<nowiki/>x
26667 !! end
26669 !! test
26670 WTS of autolinks with nowikis (round-trip)
26671 !! wikitext
26672 x<nowiki/>http://cscott.net<nowiki/>x
26673 !! html/parsoid
26674 <p>x<a rel="mw:ExtLink" href="http://cscott.net">http://cscott.net</a>x</p>
26675 !! end
26677 # this is the "easy" test because it leaves in place all the
26678 # data-parsoid information indicating this is an autolink
26679 !! test
26680 WTS of autolinks with escapes (editing)
26681 !! options
26682 parsoid={
26683   "modes": ["wt2wt"],
26684   "changes": [
26685     [ "meta", "remove" ]
26686   ]
26688 !! wikitext
26689 x<nowiki/>http://cscott.net<nowiki/>x
26690 !! wikitext/edited
26691 x<nowiki/>http://cscott.net<nowiki/>x
26692 !! end
26694 !! test
26695 WTS of edited autolink-like text (T103364)
26696 !! options
26697 parsoid={
26698   "modes": ["wt2wt"],
26699   "changes": [
26700     [ "span[typeof]", "removeAttr", "typeof" ]
26701   ]
26703 !! wikitext
26704 Not a link: <nowiki>http://example.com</nowiki>.
26705 !! wikitext/edited
26706 Not a link: <span><nowiki>http://example.com</nowiki></span>.
26707 !! end
26709 !! test
26710 WTS of newly-authored autolink-like text (T103364)
26711 !! options
26712 parsoid=html2wt
26713 !! html/parsoid
26714 <p>http://example.com is not a link.</p>
26715 !! wikitext
26716 <nowiki>http://example.com</nowiki> is not a link.
26717 !! end
26719 !! test
26720 WTS of autolink-like text after an autolink (T108563)
26721 !! options
26722 parsoid=html2wt
26723 !! html/parsoid
26724 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a> http://example.com is not a link.</p>
26725 !! wikitext
26726 http://example.com <nowiki>http://example.com</nowiki> is not a link.
26727 !! end
26729 !! test
26730 Magic links inside links (not autolinked)
26731 !! wikitext
26732 [[Foo|http://example.com]]
26733 [[Foo|RFC 1234]]
26734 [[Foo|PMID 1234]]
26735 [[Foo|ISBN 123456789x]]
26737 [http://foo.com http://example.com]
26738 [http://foo.com RFC 1234]
26739 [http://foo.com PMID 1234]
26740 [http://foo.com ISBN 123456789x]
26741 !! html+tidy
26742 <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>
26743 <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>
26744 !! html/parsoid
26745 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">http://example.com</a>
26746 <a rel="mw:WikiLink" href="./Foo" title="Foo">RFC 1234</a>
26747 <a rel="mw:WikiLink" href="./Foo" title="Foo">PMID 1234</a>
26748 <a rel="mw:WikiLink" href="./Foo" title="Foo">ISBN 123456789x</a></p>
26750 <p><a rel="mw:ExtLink" href="http://foo.com">http://example.com</a>
26751 <a rel="mw:ExtLink" href="http://foo.com">RFC 1234</a>
26752 <a rel="mw:ExtLink" href="http://foo.com">PMID 1234</a>
26753 <a rel="mw:ExtLink" href="http://foo.com">ISBN 123456789x</a></p>
26754 !! end
26756 !! test
26757 Magic links inside image captions (autolinked)
26758 !! wikitext
26759 [[File:Foobar.jpg|thumb|http://example.com]]
26760 [[File:Foobar.jpg|thumb|RFC 1234]]
26761 [[File:Foobar.jpg|thumb|PMID 1234]]
26762 [[File:Foobar.jpg|thumb|ISBN 123456789x]]
26763 !! html+tidy
26764 <div class="thumb tright">
26765 <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>
26766 <div class="thumbcaption">
26767 <div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>
26768 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a></div>
26769 </div>
26770 </div>
26771 <div class="thumb tright">
26772 <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>
26773 <div class="thumbcaption">
26774 <div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>
26775 <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc1234">RFC 1234</a></div>
26776 </div>
26777 </div>
26778 <div class="thumb tright">
26779 <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>
26780 <div class="thumbcaption">
26781 <div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>
26782 <a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a></div>
26783 </div>
26784 </div>
26785 <div class="thumb tright">
26786 <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>
26787 <div class="thumbcaption">
26788 <div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>
26789 <a href="/wiki/Special:BookSources/123456789X" class="internal mw-magiclink-isbn">ISBN 123456789x</a></div>
26790 </div>
26791 </div>
26792 !! html/parsoid
26793 <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>
26794 <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>
26795 <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>
26796 <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>
26797 !! end
26799 !! test
26800 WTS of magic word text (T109371)
26801 !! options
26802 parsoid=html2wt
26803 !! html/parsoid
26804 <p>RFC 1234</p>
26805 <p><a href="http://foo.com" rel="mw:ExtLink">RFC 1234</a></p>
26806 <p><a href="./Foo" rel="mw:WikiLink">RFC 1234</a></p>
26807 !! wikitext
26808 <nowiki>RFC 1234</nowiki>
26810 [http://foo.com RFC 1234]
26812 [[Foo|RFC 1234]]
26813 !! end
26815 !! test
26816 Edited Redirect link should emit a non-piped wikitext link
26817 !! options
26818 parsoid=html2wt
26819 !! html/parsoid
26820 <link rel="mw:PageProp/redirect" href="Bar" data-parsoid='{"a":{"href":"./Foo"},"sa":{"href":"Foo"}}'>
26821 !! wikitext
26822 #REDIRECT [[Bar]]
26823 !! end
26825 !! test
26826 T75121: Infer extension name from typeOf if data-mw is not present
26827 !! options
26828 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
26829 !! html/parsoid
26830 <div typeOf="mw:Extension/foo"></div>
26831 !! wikitext
26832 <foo />
26833 !! end
26835 # Note that the <p> wrapping isn't present in PHP parser output
26836 # The important thing for this test is that P-wrapping doesn't
26837 # interfere with the <nowiki> protection for leading - in <td>
26838 # (which isn't necessary for <th>).
26839 !! test
26840 T88318: p-wrapped dash in table.
26841 !! options
26842 parsoid=html2wt,wt2wt
26843 !! html/parsoid
26844 <table><tbody>
26845 <tr><th><p>-</p></th><th><p>- </p></th></tr>
26846 <tr><td><p>-</p></td><td><p>- </p></td></tr>
26847 <tr><td><small>-</small></td><td><br/><p>-</p></td><td><br/>-</td></tr>
26848 </tbody></table>
26849 !! wikitext
26852 !- 
26854 |<nowiki>-</nowiki>
26855 |<nowiki>- </nowiki>
26857 |<small>-</small>
26858 |<br>
26860 |<br>
26863 !! html/php+tidy
26864 <table>
26865 <tr>
26866 <th>-</th>
26867 <th>-</th>
26868 </tr>
26869 <tr>
26870 <td>-</td>
26871 <td>-</td>
26872 </tr>
26873 <tr>
26874 <td><small>-</small></td>
26875 <td><br />
26876 <p>-</p>
26877 </td>
26878 <td><br />
26879 <p>-</p>
26880 </td>
26881 </tr>
26882 </table>
26883 !! end
26885 !! test
26886 T149209: WTS: Handle newlines in table cells properly
26887 !! options
26888 parsoid=html2wt
26889 !! html/parsoid
26890 <table>
26891 <tbody>
26892 <tr><td>a
26894 </td><td data-parsoid='{"stx_v":"row"}'>c</td></tr>
26895 <tr><td><p>x</p>
26896 </td><td data-parsoid='{"stx_v":"row", "startTagSrc": "{{!}}{{!}}"}'>y</td></tr>
26897 </tbody></table>
26898 <table>
26899 <tbody>
26900 <tr><th>a
26902 </th><th data-parsoid='{"stx_v":"row"}'>c</th></tr>
26903 <tr><th><p>x</h>
26904 </th><th data-parsoid='{"stx_v":"row"}'>y</th></tr>
26905 </tbody></table>
26906 !! wikitext
26913 {{!}}y
26923 !! end
26925 !! test
26926 T149209: Selser: Handle newlines in table cells properly
26927 !! options
26928 parsoid={
26929   "modes": ["selser"],
26930   "changes": [
26931     [ "#h1", "html", "a\nb\n" ],
26932     [ "#h2", "html", "a\nb\n" ],
26933     [ "#c1", "html", "a\nb\n" ],
26934     [ "#c2", "html", "<p>a</p>" ],
26935     [ "#c3", "html", "<p>a</p>" ],
26936     [ "#c4", "html", "edit-me<p>a</p>" ]
26937   ]
26939 !! wikitext
26941 ! id="h1" |edit-me!!1
26943 ! id="h2" |edit-me||2
26945 | id="c1" |edit-me||3
26947 | id="c2" |edit-me||4
26949 | id="c3" |edit-me||p||q||r
26951 | id="c4" |edit-me||p||q||r
26953 !! wikitext/edited
26955 ! id="h1" |a
26959 ! id="h2" |a
26963 | id="c1" |a
26967 | id="c2" |a
26970 | id="c3" |a
26971 |p||q||r
26973 | id="c4" |edit-me
26975 |p||q||r
26977 !! end
26979 !! test
26980 HTML id attribute with Parsoid-like element ids should not be serialized to wikitext
26981 !! options
26982 parsoid=html2wt
26983 !! html/parsoid
26984 <table id='mwAb'>
26985 <td id='mwAc'>foo</td>
26986 <td id='serialize-this'>bar</td>
26987 </table>
26988 !! wikitext
26990 |foo
26991 | id="serialize-this" |bar
26993 !! end
26995 !! test
26996 Parsoid-like element ids should not be serialized to wikitext unless shadowed
26997 !! options
26998 parsoid=html2wt
26999 !! html/parsoid
27000 <div id="mwAQ" data-parsoid='{"stx":"html","a":{"id":"mwAQ"},"sa":{"id":"hello"}}'>ok</div>
27001 !! wikitext
27002 <div id="hello">ok</div>
27003 !! end
27005 !! test
27006 WTS change modes
27007 !! options
27008 parsoid={
27009   "modes": ["wt2wt"],
27010   "changes": [
27011     [ "#xyz", "before", "<b>before</b> stuff " ],
27012     [ "#xyz", "after", " stuff <i>after</i>" ],
27013     [ "#xyz", "html", "x <b>y</b> z" ]
27014   ]
27016 !! wikitext
27017 <span id="xyz">hello</span>
27018 !! wikitext/edited
27019 '''before''' stuff <span id="xyz">x '''y''' z</span> stuff ''after''
27020 !! end
27022 !! test
27023 Never serialize a-tag as html, regardless of what data-parsoid has to say
27024 !! options
27025 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
27026 !! html/parsoid
27027 <a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{"stx":"html"}'>Foo</a>
27028 !! wikitext
27029 [[Foo]]
27030 !! end
27032 ## SSS FIXME: This is broken output nevertheless.
27033 ## What might be a reasonable non-broken output for this?
27034 ## This is an edge case unlikely to be seen in production
27035 ## that I am not wasting more time on this right now.
27036 !! test
27037 Never serialize a-tag as html, no matter what attributes it has
27038 !! options
27039 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
27040 !! html/parsoid
27041 <a bad='true' href='http://boo.org'><img src='http://boohoo.org' /></a>
27042 !! wikitext
27043 [http://boo.org http://boohoo.org]
27044 !! end
27046 # Misnested is an indication that selser can reuse the source but these have
27047 # shown to sneak through on occasion. See T101768.
27048 # The original wikitext here is: [http://test.com [[one]] two three]
27049 !! test
27050 Strip span tags added to mark misnested links
27051 !! options
27052 parsoid=html2wt
27053 !! html/parsoid
27054 <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>
27055 !! wikitext
27056 [http://test.com][[one]] two three
27057 !! end
27059 !! test
27060 Use data-parsoid.firstWikitextNode to compute newline constraints for template content
27061 !! options
27062 parsoid=html2wt
27063 !! html/parsoid
27064 <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|}"]}'>
27065 <tbody><tr><td>d
27066 </td></tr>
27067 </tbody></table>
27068 !! wikitext
27069 {{echo|a}}
27070 {|{{echo|c
27071 {{!}}d
27074 !! end
27076 ## This test verifies the presence and computation of this attribute indirectly
27077 ## by making an edit and ensuring that the serialization is correct (which it would be
27078 ## only if firstWikitextNode is properly set).
27079 !! test
27080 data-parsoid.firstWikitextNode should be computed properly in the presence of fostered content
27081 !! options
27082 parsoid= {
27083   "modes": ["wt2wt"],
27084   "changes": [
27085     [ "div#x", "remove" ],
27086     [ "div", "before", "<div>new</div>" ]
27087   ]
27089 !! wikitext
27090 <div id="x">foo</div>
27092 {{echo|<div>boo</div>
27093 {{!}}b}}
27096 !! wikitext/edited
27098 <div>new</div>
27100 {{echo|<div>boo</div>
27101 {{!}}b}}
27104 !! end
27106 # --------------------------------------------
27107 # Tests spec'ing wikitext serialization norms |
27108 # --------------------------------------------
27110 !! test
27111 1. Categories should always be serialized on their own line
27112 !! options
27113 parsoid=html2wt
27114 !! html/parsoid
27115 foo<link rel="mw:PageProp/Category" href="./Category:Foo">bar
27116 !! wikitext
27118 [[Category:Foo]]
27120 !! end
27122 !! test
27123 2. Categories that are part of templates should not introduce a line break
27124 !! wikitext
27125 foo {{echo|<span>bar</span> [[Category:baz]]}} bar
27126 !! html/parsoid
27127 <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>
27128 !! end
27130 # Careful while editing these next 2 tests. There are \u200f characters
27131 # before and after the <link> tags in the HTML and following some
27132 # of the categories in wikitext
27133 # Do not remove these characters in edits.
27135 # As part of the serialization, these bidi characters will get stripped.
27136 !! test
27137 RTL (\u200f) and LTR (\u200e) markers around category tags should be stripped
27138 !! options
27139 parsoid={
27140   "modes": ["html2wt"],
27141   "scrubWikitext": true
27143 !! html/parsoid
27144 <p>‏<link rel="mw:PageProp/Category" href="./קטגוריה:טקסים" />‏
27145 ‏<link rel="mw:PageProp/Category" href="./קטגוריה:_שיטות_משפט" />‏</p>
27146 !! wikitext
27147 [[קטגוריה:טקסים]]
27148 [[קטגוריה: שיטות משפט]]
27149 !! end
27151 !! test
27152 RTL (\u200f) and LTR (\u200e) markers should not be stripped if followed by a text node
27153 !! options
27154 parsoid={
27155   "modes": ["html2wt"],
27156   "scrubWikitext": true
27158 !! html/parsoid
27159 <p>‏<link rel="mw:PageProp/Category" href="./קטגוריה:טקסים" />‏y</p>
27160 !! wikitext
27161 [[קטגוריה:טקסים]]
27162 ‏y
27163 !! end
27165 !! test
27166 Lists: Add space after bullets
27167 !! options
27168 parsoid=html2wt
27169 !! html/parsoid
27170 <ul>
27171 <li>foo</li>
27172 <li> bar</li>
27173 <li><span> baz</span></li>
27174 </ul>
27175 !! wikitext
27176 * foo
27177 * bar
27178 * <span> baz</span>
27179 !! end
27181 !! test
27182 1. Headings: Add space before/after == (T53744)
27183 !! options
27184 parsoid=html2wt
27185 !! html/parsoid
27186 <h2>foo</h2>
27187 <h2> bar</h2>
27188 <h2>baz </h2>
27189 <h2><span> baz</span></h2>
27190 !! wikitext
27191 == foo ==
27193 == bar ==
27195 == baz ==
27197 == <span> baz</span> ==
27198 !! end
27200 !! test
27201 2. Headings: Add space before/after == even after hoisted content
27202 !! options
27203 parsoid={
27204   "modes": ["html2wt"],
27205   "scrubWikitext": true
27207 !! html/parsoid
27208 <h2> <link href="./Category:A2" rel="mw:PageProp/Category" />ok</h2>
27209 !! wikitext
27210  [[Category:A2]]
27212 == ok ==
27213 !! end
27215 !! test
27216 1. Headings: suppress newly created empty headings
27217 !! options
27218 parsoid={
27219   "modes": ["html2wt"],
27220   "scrubWikitext": true
27222 !! html/parsoid
27223 <h2></h2>
27224 !! wikitext
27225 !! end
27227 !! test
27228 2. Headings: don't suppress empty headings if scrubWikitext is false
27229 !! options
27230 parsoid=html2wt
27231 !! html/parsoid
27232 <h2></h2>
27233 !! wikitext
27234 ==<nowiki/>==
27235 !! end
27237 !! test
27238 3. Headings: suppress empty headings on edits
27239 !! options
27240 parsoid={
27241   "modes": ["selser"],
27242   "scrubWikitext": true,
27243   "changes": [
27244     [ "#x", "remove"]
27245   ]
27247 !! wikitext
27248 ==<span id="x">foo</span>==
27249 !! wikitext/edited
27250 !! end
27252 !! test
27253 Headings: Replace <br/> with a single whitespace char (when scrubWikitext = true)
27254 !! options
27255 parsoid={
27256   "modes": ["html2wt"],
27257   "scrubWikitext": true
27259 !! html/parsoid
27260 <h2>foo<br/>bar</h2>
27261 <h2>foo <span><br/>bar</span> baz</h2>
27262 !! wikitext
27263 == foo bar ==
27265 == foo <span> bar</span> baz ==
27266 !! end
27268 !! test
27269 Headings: Replace <br/> with a single whitespace char (when scrubWikitext = false)
27270 !! options
27271 parsoid={
27272   "modes": ["html2wt"],
27273   "scrubWikitext": false
27275 !! html/parsoid
27276 <h2>foo<br/>bar</h2>
27277 !! wikitext
27278 == foo<br> bar ==
27279 !! end
27281 !! test
27282 1. WT Quote Tags: suppress newly created empty style tags
27283 !! options
27284 parsoid={
27285   "modes": ["html2wt"],
27286   "scrubWikitext": true
27288 !! html/parsoid
27289 <i></i><b></b>
27290 !! wikitext
27291 !! end
27293 !! test
27294 2. WT Quote Tags: don't suppress empty style tags if scrubWikitext is false
27295 !! options
27296 parsoid=html2wt
27297 !! html/parsoid
27298 <i></i><b></b>
27299 !! wikitext
27300 ''<nowiki/>'''''<nowiki/>'''
27301 !! end
27303 !! test
27304 3. WT Quote Tags: suppress empty style tags on edits
27305 !! options
27306 parsoid={
27307   "modes": ["selser"],
27308   "scrubWikitext": true,
27309   "changes": [
27310     [ "#x", "remove"]
27311   ]
27313 !! wikitext
27314 '''<span id="x">foo</span>'''
27315 !! wikitext/edited
27316 !! end
27318 !! test
27319 1. Anchors: suppress newly created empty anchors
27320 !! options
27321 parsoid={
27322   "modes": ["html2wt"],
27323   "scrubWikitext": true
27325 !! html/parsoid
27326 <a rel="mw:WikiLink" href="./Test" title="Test"></a>
27327 !! wikitext
27328 !! end
27330 !! test
27331 2. Anchors: don't suppress empty anchors if scrubWikitext is false
27332 !! options
27333 parsoid={
27334   "modes": ["html2wt"],
27335   "scrubWikitext": false
27337 !! html/parsoid
27338 <a rel="mw:WikiLink" href="./Test" title="Test"></a>
27339 !! wikitext
27340 [[Test|<nowiki/>]]
27341 !! end
27343 !! test
27344 3. Anchors: suppress empty anchors on edits
27345 !! options
27346 parsoid={
27347   "modes": ["selser"],
27348   "scrubWikitext": true,
27349   "changes": [
27350     [ "#x", "remove"]
27351   ]
27353 !! wikitext
27354 [[Test|<span id="x">foo</span>]]
27355 !! wikitext/edited
27356 !! end
27358 !! test
27359 3a. Anchors: do not suppress numbered extlinks
27360 !! options
27361 parsoid={
27362   "modes": ["wt2wt"],
27363   "scrubWikitext": true
27365 !! wikitext
27366 [http://foo.com]
27367 !! html/parsoid
27368 <a rel="mw:ExtLink" href="http://foo.com"></a>
27369 !! end
27371 !! test
27372 3b. Anchors: do not suppress numbered extlinks
27373 !! options
27374 parsoid={
27375   "modes": ["wt2wt"],
27376   "scrubWikitext": true,
27377   "changes": [
27378     [ "#x", "remove"]
27379   ]
27381 !! wikitext
27382 [http://foo.com <span id="x">foo</span>]
27383 !! wikitext/edited
27384 [http://foo.com]
27385 !! end
27387 !!test
27388 Normalizations should be restricted to edited content
27389 !!options
27390 parsoid={
27391   "modes": ["selser"],
27392   "scrubWikitext": true,
27393   "changes": [
27394     [ "h1", "before", "<i></i>"]
27395   ]
27397 !!wikitext
27399 = =
27401 !!wikitext/edited
27403 = =
27405 !!end
27407 !! test
27408 1. Multiple normalizations (html2wt)
27409 !! options
27410 parsoid={
27411   "modes": ["html2wt"],
27412   "scrubWikitext": true
27414 !! html
27415 <h2><i></i></h2>
27416 <p><a href='Foo' rel='mw:WikiLink'>foo<i></i>
27417  </a><b><i></i></b>x</p>
27418 !! wikitext
27420 [[foo]]
27423 !! end
27425 !! test
27426 2. Multiple normalizations (selser)
27427 !! options
27428 parsoid={
27429   "modes": ["selser"],
27430   "scrubWikitext": true,
27431   "changes": [
27432     [ "#x", "after", "<h1><i></i></h1>\n<p> x<b></b></p>"]
27433   ]
27435 !! wikitext
27436 <span id="x">foo</span>
27437 !! wikitext/edited
27438 <span id="x">foo</span>
27441 !! end
27443 !! test
27444 1. Indent Pre Nowiki: suppress whitespace at the start of new paragraph
27445 !! options
27446 parsoid={
27447   "modes": ["html2wt"],
27448   "scrubWikitext": true
27450 !! html/parsoid
27451 <p> hi</p>
27452 <p>    hello</p>
27453 !! wikitext
27456 hello
27457 !! end
27459 !! test
27460 2. Indent Pre Nowiki: don't suppress whitespace at the start of new paragraph if scrubWikitext is false
27461 !! options
27462 parsoid=html2wt
27463 !! html/parsoid
27464 <p> hi</p>
27465 <p>    hello</p>
27466 !! wikitext
27467 <nowiki> </nowiki>hi
27469 <nowiki> </nowiki>   hello
27470 !! end
27472 !! test
27473 3. Indent Pre Nowiki: suppress whitespace after newlines in new paragraph or table cell
27474 !! options
27475 parsoid={
27476   "modes": ["html2wt"],
27477   "scrubWikitext": true
27479 !! html/parsoid
27480 <p>Foo
27481  bar
27482 baz</p>
27484 <table><tr><td>Foo
27485  bar
27486  baz bang</td></tr></table>
27488 <p><!--boo--> foo
27489  bar</p>
27491 <p> foo
27492  bar<span>boo</span></p>
27493 !! wikitext
27499 |Foo
27501 baz bang
27504 <!--boo-->foo
27508 bar<span>boo</span>
27509 !! end
27511 !! test
27512 4. Indent Pre Nowiki: suppress leading whitespace in edited paragraphs
27513 !! options
27514 parsoid={
27515   "modes": ["selser"],
27516   "scrubWikitext": true,
27517   "changes": [
27518     [ "p", "html", " a\n b" ]
27519   ]
27521 !! wikitext
27523 !! wikitext/edited
27526 !! end
27528 !! test
27529 1. New links that end in spaces
27530 !! options
27531 parsoid={
27532   "modes": ["html2wt"],
27533   "scrubWikitext": false
27535 !! html/parsoid
27536 <p><a rel="mw:WikiLink" href="./Berlin" title="Berlin">Berlin </a>is the capital of Germany.</p>
27537 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo </a><b>bar</b></p>
27538 <p><a rel="mw:WikiLink" href="./Boston" title="Boston">Boston </a> is a city.</p>
27539 !! wikitext
27540 [[Berlin ]]<nowiki/>is the capital of Germany.
27542 [[Foo ]]'''bar'''
27544 [[Boston ]] is a city.
27545 !! end
27547 !! test
27548 2. New links that end in spaces
27549 !! options
27550 parsoid={
27551   "modes": ["html2wt"],
27552   "scrubWikitext": true
27554 !! html/parsoid
27555 <p><a rel="mw:WikiLink" href="./Berlin" title="Berlin">Berlin </a>is the capital of Germany.</p>
27556 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo </a><b>bar</b></p>
27557 <p><a rel="mw:WikiLink" href="./Boston" title="Boston">Boston </a> is a city.</p>
27558 !! wikitext
27559 [[Berlin]] is the capital of Germany.
27561 [[Foo]] '''bar'''
27563 [[Boston]] is a city.
27564 !! end
27566 !! test
27567 1. Table cells with escapable prefixes
27568 !! options
27569 parsoid={
27570   "modes": ["html2wt"],
27571   "scrubWikitext": false
27573 !! html
27574 <table>
27575 <tr><td>a</td></tr>
27576 <tr><td>-</td></tr>
27577 <tr><td>+</td></tr>
27578 </table>
27579 !! wikitext
27583 |<nowiki>-</nowiki>
27585 |<nowiki>+</nowiki>
27587 !! end
27589 !! test
27590 2. Table cells with escapable prefixes
27591 !! options
27592 parsoid={
27593   "modes": ["html2wt"],
27594   "scrubWikitext": true
27596 !! html
27597 <table>
27598 <tr><td>a</td></tr>
27599 <tr><td>-</td></tr>
27600 <tr><td>+</td></tr>
27601 </table>
27602 !! wikitext
27606 | -
27608 | +
27610 !! end
27612 !! test
27613 3a. Table cells with escapable prefixes after edits
27614 !! options
27615 parsoid={
27616   "modes": ["selser"],
27617   "scrubWikitext": true,
27618   "changes": [
27619     [ "table tbody tr:first-child td:first-child", "remove"]
27620   ]
27622 !! wikitext
27624 |a||-
27626 !! wikitext/edited
27628 | -
27630 !! end
27632 !! test
27633 3b. Table cells with escapable prefixes after edits
27634 !! options
27635 parsoid={
27636   "modes": ["selser"],
27637   "scrubWikitext": true,
27638   "changes": [
27639     [ "table tbody tr:first-child td:first-child", "html", "-" ],
27640     [ "#x", "remove" ]
27641   ]
27643 !! wikitext
27645 |pqr
27646 |<span id="x">foo</span>+
27648 !! wikitext/edited
27650 | -
27651 | +
27653 !! end
27655 # FIXME: This test will fail because
27656 # normalization doesn't realize that the id attribute
27657 # will eliminate the escapable scenario
27658 !! test
27659 4a. Table cells without escapable prefixes after edits
27660 !! options
27661 parsoid={
27662   "modes": ["selser"],
27663   "scrubWikitext": true,
27664   "changes": [
27665     [ "#x", "html", "-" ]
27666   ]
27668 !! wikitext
27670 | id="x" |abcd
27672 !! wikitext/edited
27674 | id="x" |-
27676 !! end
27678 ## This tests normalizer's ability to discriminate between
27679 ## cells having identical content.
27680 !! test
27681 4b. Table cells without escapable prefixes after edits
27682 !! options
27683 parsoid={
27684   "modes": ["selser"],
27685   "scrubWikitext": true,
27686   "changes": [
27687     [ "td", "html", "-" ]
27688   ]
27690 !! wikitext
27692 |a||b
27694 !! wikitext/edited
27696 | -||-
27698 !! end
27700 ## This tests normalizer's ability to not be tripped by
27701 ## comments (and whitespace)
27702 !! test
27703 4c. Table cells without escapable prefixes after edits
27704 !! options
27705 parsoid={
27706   "modes": ["selser"],
27707   "scrubWikitext": true,
27708   "changes": [
27709     [ "table tbody tr td:first-child", "remove" ]
27710   ]
27712 !! wikitext
27715 <!--foo--> |a||-
27717 !! wikitext/edited
27720 <!--foo--> | -
27722 !! end
27724 ## This tests normalizer's ability to handle HTML cells
27725 !! test
27726 4d. Table cells without escapable prefixes after edits
27727 !! options
27728 parsoid={
27729   "modes": ["selser"],
27730   "scrubWikitext": true,
27731   "changes": [
27732     [ "td", "html", "-" ]
27733   ]
27735 !! wikitext
27736 <table>
27737 <tr><td>a</td></tr>
27738 </table>
27739 !! wikitext/edited
27740 <table>
27741 <tr><td>-</td></tr>
27742 </table>
27743 !! end
27745 ## T111151 Remove font elements without attributes
27746 !! test
27747 5a. font tags without attributes should be dropped in scrubWikitext mode
27748 !! options
27749 parsoid={
27750   "modes": ["html2wt"],
27751   "scrubWikitext": true
27753 !! html
27754 <font>foo</font>
27755 <font><font>bar</font></font>
27756 <font class="x">boo</font>
27757 !! wikitext
27760 <font class="x">boo</font>
27761 !! end
27763 !! test
27764 5b. font tags should not be dropped without scrubWikitext being enabled
27765 !! options
27766 parsoid={
27767   "modes": ["html2wt"],
27768   "scrubWikitext": false
27770 !! html
27771 <font>foo</font>
27772 !! wikitext
27773 <font>foo</font>
27774 !! end
27776 !! test
27777 Escape nowiki DOM elements
27778 !! options
27779 parsoid=html2wt
27780 !! html/parsoid
27781 <nowiki><i>foo</i></nowiki>
27782 !! wikitext
27783 &lt;nowiki&gt;''foo''&lt;/nowiki&gt;
27784 !! end
27786 # This is meant to be an interim fix while we go about figuring out
27787 # how to not introduce these trailing <nowiki/>s in the first place.
27788 !! test
27789 T115717: Strip trailing <nowiki/>s (without affecting valid uses)
27790 !! options
27791 parsoid=html2wt
27792 !! html/parsoid
27793 <p>x<meta typeof="mw:Placeholder" data-parsoid='{"src":"&lt;nowiki/>"}'/><meta typeof="mw:Placeholder" data-parsoid='{"src":"&lt;nowiki/>"}'/>
27794 y</p>
27795 <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>
27796 <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>
27797 !! wikitext
27801 {{echo|
27802 1 = <nowiki/>}}
27804 {{echo|
27805 1 = <nowiki/>
27807 !! end
27809 # ---------------------------------------------------
27810 # End of tests spec'ing wikitext serialization norms |
27811 # ---------------------------------------------------
27813 # T104032
27814 !! test
27815 Bare inline nodes not wrapped inside p-tags should be treated as p-wrapped
27816 !! options
27817 parsoid=html2wt
27818 !! html/parsoid
27819 a<p>b</p>
27820 <b>c</b><p>d</p>
27821 <table><tr>
27822 <td>a<p>b</p></td>
27823 <td><b>c</b><p>d</p></td>
27824 </tr></table>
27825 !! wikitext
27830 '''c'''
27836 |'''c'''
27839 !! end
27841 # -----------------------------------------------------------------
27842 # End of section for Parsoid-only html2wt tests for serialization
27843 # of new content
27844 # -----------------------------------------------------------------
27846 # -----------------------------------------------------------------
27847 # The following section of tests are primarily to spec behavior of
27848 # the selective serializer. All these tests have manual selser
27849 # changes. The automated selser changes for all tests handle the
27850 # wide variation of changes, but these tests here capture specs
27851 # deterministically.
27852 # ----------------------------------------------------------------
27854 ## T90517
27855 !! test
27856 Selser: New comments should not be lost
27857 !! options
27858 parsoid={
27859   "modes": ["selser"],
27860   "changes": [
27861     [ "#a", "after", "<!--c1-->" ],
27862     [ "#b", "before", "<!--c2-->" ]
27863   ]
27865 !! wikitext
27866 <span id="a">a</span>
27868 <span id="b">b</span>
27869 !! wikitext/edited
27870 <span id="a">a</span><!--c1-->
27872 <!--c2--><span id="b">b</span>
27873 !! end
27875 ## T89383
27876 !! test
27877 Selser: Check for validity of DSR before using it
27878 !! options
27879 parsoid={
27880   "modes": ["selser"],
27881   "changes": [
27882     [ "#a", "before", "<meta property='mw:PageProp/displaytitle' content='foo'>" ]
27883   ]
27885 !! wikitext
27886 <span id="a">a</span>
27887 !! wikitext/edited
27888 {{DISPLAYTITLE:foo}}
27889 <span id="a">a</span>
27890 !! end
27892 !! test
27893 1. DOMDiff: Changes to <ref> content should be looked up using id
27894 !! options
27895 parsoid={
27896   "modes": ["selser"],
27897   "changes": [
27898     ["#X", "after", "bar"],
27899     ["#Y", "after", "baz"]
27900   ]
27902 !! wikitext
27903 X <ref><span id="X">foo</span></ref>
27904 Y <ref name="a" />
27905 <references>
27906 <ref name="a"><span id="Y">foo</span></ref>
27907 </references>
27908 !! wikitext/edited
27909 X <ref><span id="X">foo</span>bar</ref>
27910 Y <ref name="a" />
27911 <references>
27912 <ref name="a"><span id="Y">foo</span>baz</ref>
27913 </references>
27914 !! end
27916 !! test
27917 2. DOMDiff: Changes to <ref> content should be looked up using id
27918 !! options
27919 parsoid={
27920   "modes": ["selser"],
27921   "changes": [
27922     ["#Z", "after", "bar"]
27923   ]
27925 !! wikitext
27926 A <ref>foo bar for a</ref>
27927 B <ref group="X" name="b" />
27929 <references />
27931 <references group="X">
27932 <ref name="b"><span id="Z">foo</span></ref>
27933 </references>
27934 !! wikitext/edited
27935 A <ref>foo bar for a</ref>
27936 B <ref group="X" name="b" />
27938 <references />
27940 <references group="X">
27941 <ref name="b"><span id="Z">foo</span>bar</ref>
27942 </references>
27943 !! end
27945 !! test
27946 DOMDiff: Edits to content nested in elements with templated attributes should not be lost (T139388)
27947 !! options
27948 parsoid={
27949   "modes": ["selser"],
27950   "changes": [
27951     [ "div:first-child", "text", "bar" ]
27952   ]
27954 !! wikitext
27955 <div style="{{1x|color:red;}}%">foo</div>
27956 !! wikitext/edited
27957 <div style="{{1x|color:red;}}%">bar</div>
27958 !! end
27960 !! test
27961 Empty LI (T49673)
27962 !! wikitext
27963 * a
27966 * b
27967 !! html/php+tidy
27968 <ul>
27969 <li>a</li>
27970 <li class="mw-empty-elt"></li>
27971 <li class="mw-empty-elt"></li>
27972 <li>b</li>
27973 </ul>
27974 !! end
27976 !! test
27977 Thumbnail output
27978 !! wikitext
27979 [[File:Thumb.png|thumb]]
27980 !! html/php+tidy
27981 <div class="thumb tright">
27982 <div class="thumbinner" style="width:137px;"><a href="/wiki/File:Thumb.png" class="image"><img alt="Thumb.png" src="http://example.com/images/e/ea/Thumb.png" width="135" height="135" class="thumbimage" /></a>
27983 <div class="thumbcaption">
27984 <div class="magnify"><a href="/wiki/File:Thumb.png" class="internal" title="Enlarge"></a></div>
27985 </div>
27986 </div>
27987 </div>
27988 !! end
27990 !! test
27991 unclosed internal link XSS (T137264)
27992 !! wikitext
27993 [[#%3Cscript%3Ealert(1)%3C/script%3E|
27994 !! html/php
27995 <p>[[#&lt;script&gt;alert(1)&lt;/script&gt;|
27996 </p>
27997 !! html/parsoid
27998 <p>[[#%3Cscript%3Ealert(1)%3C/script%3E|</p>
27999 !! end