Implement extension registration from an extension.json file
[mediawiki.git] / tests / parser / parserTests.txt
blob7eb152ab8eed1568a588c9954a478d9848e5a85e
1 # MediaWiki Parser test cases
2 # Some taken from http://meta.wikimedia.org/wiki/Parser_testing
3 # All (C) their respective authors and released under the GPL
5 # The syntax should be fairly self-explanatory.
7 # Currently supported test options:
8 # One of the following three:
10 #  (default)  generate HTML output
11 #  pst        apply pre-save transform
12 #  msg        apply message transform
14 # Plus any combination of these:
16 # cat           add category links
17 # ill           add inter-language links
18 # subpage       enable subpages (disabled by default)
19 # noxml         don't check for XML well-formedness
20 # title=[[XXX]] run test using article title XXX
21 # language=XXX  set content language to XXX for this test
22 # variant=XXX   set the variant of language for this test (eg zh-tw)
23 # disabled      do not run test
24 # parsoid       parsoid-specific options (not run by PHP parser unless
25 #                 the test includes an html/php section)
26 # php           php-only test (not run by the parsoid parser unless
27 #                 the test includes an html/parsoid section)
28 # showtitle     make the first line the title
29 # comment       run through Linker::formatComment() instead of main parser
30 # local         format section links in edit comment text as local links
31 # notoc         disable table of contents
32 # thumbsize=NNN set the default thumb size to NNNpx for this test
34 # You can also set the following parser properties via test options:
35 #  wgEnableUploads, wgAllowExternalImages, wgMaxTocLevel,
36 #  wgLinkHolderBatchSize, wgRawHtml
38 # For testing purposes, temporary articles can created:
39 # !!article / NAMESPACE:TITLE / !!text / ARTICLE TEXT / !!endarticle
40 # where '/' denotes a newline.
42 # This is the standard article assumed to exist.
43 !! article
44 Main Page
45 !! text
46 blah blah
47 !! endarticle
49 !!article
50 Foo
51 !!text
52 FOO
53 !!endarticle
55 !!article
56 Template:Foo
57 !!text
58 FOO
59 !!endarticle
61 !! article
62 Template:Blank
63 !! text
64 !! endarticle
66 !! article
67 Template:pipe
68 !! text
70 !! endarticle
72 !!article
73 MediaWiki:bad image list
74 !!text
75 * [[File:Bad.jpg]] except [[Nasty page]]
76 !!endarticle
78 !! article
79 Template:inner list
80 !! text
81 * item 1
82 !! endarticle
84 !! article
85 Template:tbl-start
86 !! text
88 !! endarticle
90 !! article
91 Template:tbl-end
92 !! text
94 !! endarticle
96 !! article
97 Template:echo
98 !! text
99 {{{1}}}
100 !! endarticle
102 !! article
103 Template:echo_with_span
104 !! text
105 <span>{{{1}}}</span>
106 !! endarticle
108 !! article
109 Template:echo_with_div
110 !! text
111 <div>{{{1}}}</div>
112 !! endarticle
114 !! article
115 Template:attr_str
116 !! text
117 {{{1}}}="{{{2}}}"
118 !! endarticle
120 !! article
121 Template:table_attribs
122 !! text
123 <noinclude>
124 |</noinclude>style="color: red"| Foo
125 !! endarticle
127 !! article
128 Template:table_cells
129 !! text
130 {{table_attribs}} || Bar || Baz
131 !! endarticle
133 !! article
134 Template:image_attribs
135 !! text
136 <noinclude>
137 [[File:foobar.jpg|</noinclude>right|Caption text<noinclude>]]</noinclude>
138 !! endarticle
140 !! article
142 !! text
143 Weirdo titles!
144 !! endarticle
146 !!article
147 Template:Bullet
148 !!text
149 * Bar
150 !!endarticle
152 !!article
153 Template:OpenTable
154 !!text
156 !!endarticle
158 !!article
159 Template:EmptyLITest
160 !!text
165 !!endarticle
167 !!article
168 Template:EmptyTRTest
169 !!text
173 |foo
176 |bar
178 !!endarticle
180 !!article
181 Template:EmptyTRWithHTMLAttrTest
182 !!text
183 <table>
184 <tr align="center"></tr>
185 <tr><td>foo</td></tr>
186 <tr align="center"></tr>
187 <tr><td>bar</td></tr>
188 </table>
189 !!endarticle
192 ### Basic tests
194 !! test
195 Blank input
196 !! wikitext
197 !! html
198 !! end
201 !! test
202 Simple paragraph
203 !! wikitext
204 This is a simple paragraph.
205 !! html
206 <p>This is a simple paragraph.
207 </p>
208 !! end
210 !! test
211 Paragraphs with extra newline spacing
212 !! wikitext
222 booz
223 !! html
224 <p>foo
225 </p><p>bar
226 </p><p><br />
228 </p><p><br />
229 </p><p>booz
230 </p>
231 !! end
233 !! test
234 Paragraphs with newline spacing with comment lines in between
235 !! wikitext
236 ----
238 <!--foo-->
240 ----
242 <!--foo--><!--More than 1 comment, still stripped-->
244 ----
246  <!--foo--> <!----> <!-- bar --> 
248 ----
250 <!--foo-->
253 ----
256 <!--foo-->
258 ----
260 <!--foo-->
264 ----
268 <!--foo-->
270 ----
271 !! html
272 <hr />
273 <p>a
275 </p>
276 <hr />
277 <p>a
279 </p>
280 <hr />
281 <p>a
283 </p>
284 <hr />
285 <p>a
286 </p><p>b
287 </p>
288 <hr />
289 <p>a
290 </p><p>b
291 </p>
292 <hr />
293 <p>a
294 </p><p><br />
296 </p>
297 <hr />
298 <p>a
299 </p><p><br />
301 </p>
302 <hr />
304 !! end
306 !! test
307 Paragraphs with newline spacing with non-empty white-space lines in between
308 !! wikitext
309 ----
313 ----
318 ----
319 !! html
320 <hr />
321 <p>a
322 </p><p>b
323 </p>
324 <hr />
325 <p>a
326 </p><p><br /> 
328 </p>
329 <hr />
331 !! end
333 !! test
334 Paragraphs with newline spacing with non-empty mixed comment and white-space lines in between
335 !! wikitext
336 ----
338  <!--foo-->
340 ----
342  <!--foo--><!--More than 1 comment doesn't disable stripping of this line!-->
344 ----
347 <!--foo-->
348  <!--bar-->
350 ----
353  <!--foo-->
354  <!--bar-->
357 ----
358 !! html
359 <hr />
360 <p>a
362 </p>
363 <hr />
364 <p>a
366 </p>
367 <hr />
368 <p>a
369 </p><p>b
370 </p>
371 <hr />
372 <p>a
373 </p><p><br /> 
375 </p>
376 <hr />
378 !! end
380 !! test
381 Extra newlines: More paragraphs with indented comment
382 !! wikitext
385    <!--boo-->
388 !! html
389 <p>a
390 </p><p><br />
392 </p>
393 !!end
395 !! test
396 Extra newlines followed by heading
397 !! wikitext
403 [[a]]
407 !! html
408 <p>a
409 </p><p><br />
410 </p>
411 <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>
412 <p><a href="/index.php?title=A&amp;action=edit&amp;redlink=1" class="new" title="A (page does not exist)">a</a>
413 </p><p><br />
414 </p>
415 <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>
417 !! end
419 !! test
420 Extra newlines between heading and content are swallowed
421 !! wikitext
426 [[a]]
427 !! html
428 <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>
429 <p><a href="/index.php?title=A&amp;action=edit&amp;redlink=1" class="new" title="A (page does not exist)">a</a>
430 </p>
431 !! end
433 !! test
434 Parsing an URL
435 !! wikitext
436 http://fr.wikipedia.org/wiki/🍺
437 <!-- EasterEgg we love beer, better be able be able to link to it -->
438 !! html
439 <p><a rel="nofollow" class="external free" href="http://fr.wikipedia.org/wiki/🍺">http://fr.wikipedia.org/wiki/🍺</a>
440 </p>
441 !! end
443 # Note that the html+tidy output removes the spaces after the <li>,
444 # which is a bug (http://sourceforge.net/p/tidy/bugs/945/, etc).
445 # This is an issue for all tests with lists.  We intentionally do
446 # *not* add html+tidy clauses for these, as we don't want to
447 # document/test the broken behavior.  (Parsoid matches the non-tidy
448 # output in these cases.)
450 !! test
451 Simple list
452 !! wikitext
453 * Item 1
454 * Item 2
455 !! html
456 <ul><li> Item 1</li>
457 <li> Item 2</li></ul>
459 !! end
461 !! test
462 Italics and bold
463 !! wikitext
464 * plain
465 * plain''italic''plain
466 * plain''italic''plain''italic''plain
467 * plain'''bold'''plain
468 * plain'''bold'''plain'''bold'''plain
469 * plain''italic''plain'''bold'''plain
470 * plain'''bold'''plain''italic''plain
471 * plain''italic'''bold-italic'''italic''plain
472 * plain'''bold''bold-italic''bold'''plain
473 * plain'''''bold-italic'''italic''plain
474 * plain'''''bold-italic''bold'''plain
475 * plain''italic'''bold-italic'''''plain
476 * plain'''bold''bold-italic'''''plain
477 * plain l'''italic''plain
478 * plain l''''bold''' plain
479 !! html
480 <ul><li> plain</li>
481 <li> plain<i>italic</i>plain</li>
482 <li> plain<i>italic</i>plain<i>italic</i>plain</li>
483 <li> plain<b>bold</b>plain</li>
484 <li> plain<b>bold</b>plain<b>bold</b>plain</li>
485 <li> plain<i>italic</i>plain<b>bold</b>plain</li>
486 <li> plain<b>bold</b>plain<i>italic</i>plain</li>
487 <li> plain<i>italic<b>bold-italic</b>italic</i>plain</li>
488 <li> plain<b>bold<i>bold-italic</i>bold</b>plain</li>
489 <li> plain<i><b>bold-italic</b>italic</i>plain</li>
490 <li> plain<b><i>bold-italic</i>bold</b>plain</li>
491 <li> plain<i>italic<b>bold-italic</b></i>plain</li>
492 <li> plain<b>bold<i>bold-italic</i></b>plain</li>
493 <li> plain l'<i>italic</i>plain</li>
494 <li> plain l'<b>bold</b> plain</li></ul>
496 !! end
498 # this example taken from the [[simple:Moon]] article (bug 47326)
499 !! test
500 Italics and possessives (1)
501 !! wikitext
502 obtained by ''[[Lunar Prospector]]'''s gamma-ray spectrometer
503 !! html
504 <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
505 </p>
506 !! end
508 # this example taken from [[en:Flaming Pie]] (bug 49926)
509 !! test
510 Italics and possessives (2)
511 !! wikitext
512 '''''Flaming Pie''''' is ... released in 1997. In ''Flaming Pie'''s liner notes
513 !! html
514 <p><i><b>Flaming Pie</b></i> is ... released in 1997. In <i>Flaming Pie'</i>s liner notes
515 </p>
516 !! end
518 # this example taken from [[en:Dictionary]] (bug 49926)
519 !! test
520 Italics and possessives (3)
521 !! wikitext
522 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''.
523 !! html
524 <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>.
525 </p>
526 !! end
530 ### 2-quote opening sequence tests
532 !! test
533 Italics and bold: 2-quote opening sequence: (2,2)
534 !! wikitext
535 ''foo''
536 !! html
537 <p><i>foo</i>
538 </p>
539 !!end
541 !! test
542 Italics and bold: 2-quote opening sequence: (2,3)
543 !! wikitext
544 ''foo'''
545 !! html/*
546 <p><i>foo'</i>
547 </p>
548 !!end
550 !! test
551 Italics and bold: 2-quote opening sequence: (2,4)
552 !! options
553 parsoid=wt2html
554 !! wikitext
555 ''foo''''
556 !! html/*
557 <p><i>foo''</i>
558 </p>
559 !!end
561 # same html as previous, but wikitext adjusted to match parsoid html2wt
562 !! test
563 Italics and bold: 2-quote opening sequence: (2,4) w/ nowiki
564 !! wikitext
565 ''foo<nowiki>''</nowiki>''
566 !! html
567 <p><i>foo''</i>
568 </p>
569 !! end
571 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
572 !! test
573 Italics and bold: 2-quote opening sequence: (2,5)
574 !! options
575 parsoid=wt2html
576 !! wikitext
577 ''foo'''''
578 !! html/php
579 <p><i>foo</i>
580 </p>
581 !! html/parsoid
582 <p><i>foo</i><b></b>
583 </p>
584 !!end
586 # same html as previous, but wikitext adjusted to match parsoid html2wt
587 !! test
588 Italics and bold: 2-quote opening sequence: (2,5+3) w/ nowiki
589 !! wikitext
590 ''foo'''''<nowiki/>'''
591 !! html/php
592 <p><i>foo</i>
593 </p>
594 !! html/parsoid
595 <p><i>foo</i><b></b>
596 </p>
597 !! end
601 ### 3-quote opening sequence tests
604 !! test
605 Italics and bold: 3-quote opening sequence: (3,2)
606 !! wikitext
607 '''foo''
608 !! html/*
609 <p>'<i>foo</i>
610 </p>
611 !!end
613 !! test
614 Italics and bold: 3-quote opening sequence: (3,3)
615 !! wikitext
616 '''foo'''
617 !! html
618 <p><b>foo</b>
619 </p>
620 !!end
622 !! test
623 Italics and bold: 3-quote opening sequence: (3,4)
624 !! wikitext
625 '''foo''''
626 !! html/*
627 <p><b>foo'</b>
628 </p>
629 !!end
631 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
632 !! test
633 Italics and bold: 3-quote opening sequence: (3,5)
634 !! options
635 parsoid=wt2html
636 !! wikitext
637 '''foo'''''
638 !! html/php
639 <p><b>foo</b>
640 </p>
641 !! html/parsoid
642 <p><b>foo</b><i></i>
643 </p>
644 !!end
646 # same html as previous, but wikitext adjusted to match parsoid html2wt
647 !! test
648 Italics and bold: 3-quote opening sequence: (3,5+2) w/ nowiki
649 !! wikitext
650 '''foo'''''<nowiki/>''
651 !! html/php
652 <p><b>foo</b>
653 </p>
654 !! html/parsoid
655 <p><b>foo</b><i></i>
656 </p>
657 !! end
661 ### 4-quote opening sequence tests
664 !! test
665 Italics and bold: 4-quote opening sequence: (4,2)
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: 4-quote opening sequence: (4,2) w/ nowiki
678 !! wikitext
679 <nowiki>''</nowiki>''foo''
680 !! html
681 <p>''<i>foo</i>
682 </p>
683 !! end
685 !! test
686 Italics and bold: 4-quote opening sequence: (4,3)
687 !! wikitext
688 ''''foo'''
689 !! html/*
690 <p>'<b>foo</b>
691 </p>
692 !!end
694 !! test
695 Italics and bold: 4-quote opening sequence: (4,4)
696 !! options
697 parsoid=wt2html
698 !! wikitext
699 ''''foo''''
700 !! html/*
701 <p>'<b>foo'</b>
702 </p>
703 !!end
705 # same html as previous, but wikitext adjusted to match parsoid html2wt
706 !! test
707 Italics and bold: 4-quote opening sequence: (4,4) w/ nowiki
708 !! wikitext
709 '<nowiki/>'''foo'<nowiki/>'''
710 !! html
711 <p>'<b>foo'</b>
712 </p>
713 !! end
715 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
716 !! test
717 Italics and bold: 4-quote opening sequence: (4,5)
718 !! options
719 parsoid=wt2html
720 !! wikitext
721 ''''foo'''''
722 !! html/php
723 <p>'<b>foo</b>
724 </p>
725 !! html/parsoid
726 <p>'<b>foo</b><i></i>
727 </p>
728 !!end
730 # same html as previous, but wikitext adjusted to match parsoid html2wt
731 !! test
732 Italics and bold: 4-quote opening sequence: (4,5+2) w/ nowiki
733 !! wikitext
734 '<nowiki/>'''foo'''''<nowiki/>''
735 !! html/php
736 <p>'<b>foo</b>
737 </p>
738 !! html/parsoid
739 <p>'<b>foo</b><i></i>
740 </p>
741 !! end
745 ### 5-quote opening sequence tests
748 !! test
749 Italics and bold: 5-quote opening sequence: (5,2)
750 !! options
751 parsoid=wt2html
752 !! wikitext
753 '''''foo''
754 !! html/*
755 <p><b><i>foo</i></b>
756 </p>
757 !!end
759 # same html as previous, but wikitext adjusted to match parsoid html2wt
760 # skipping wt2html and html2html because it wants to put <i> before <b>
761 !! test
762 Italics and bold: 5-quote opening sequence: (5,2+3)
763 !! options
764 parsoid=wt2wt,html2wt
765 !! wikitext
766 '''''foo'''''
767 !! html
768 <p><b><i>foo</i></b>
769 </p>
770 !! end
772 !! test
773 Italics and bold: 5-quote opening sequence: (5,3)
774 !! options
775 parsoid=wt2html
776 !! wikitext
777 '''''foo'''
778 !! html/*
779 <p><i><b>foo</b></i>
780 </p>
781 !!end
783 # same html as previous, but wikitext adjusted to match parsoid html2wt
784 !! test
785 Italics and bold: 5-quote opening sequence: (5,3+2)
786 !! wikitext
787 '''''foo'''''
788 !! html
789 <p><i><b>foo</b></i>
790 </p>
791 !! end
793 !! test
794 Italics and bold: 5-quote opening sequence: (5,4)
795 !! options
796 parsoid=wt2html
797 !! wikitext
798 '''''foo''''
799 !! html/*
800 <p><i><b>foo'</b></i>
801 </p>
802 !!end
804 !! test
805 Italics and bold: 5-quote opening sequence: (5,5)
806 !! wikitext
807 '''''foo'''''
808 !! html
809 <p><i><b>foo</b></i>
810 </p>
811 !!end
813 !! test
814 Italics and bold: 5-quote opening sequence: (5,6)
815 !! wikitext
816 '''''foo''''''
817 !! html/*
818 <p><i><b>foo'</b></i>
819 </p>
820 !! end
823 ### multiple quote sequences in a line
825 !! test
826 Italics and bold: multiple quote sequences: (2,4,2)
827 !! options
828 parsoid=wt2html
829 !! wikitext
830 ''foo''''bar''
831 !! html/*
832 <p><i>foo'<b>bar</b></i>
833 </p>
834 !!end
837 # same html as previous, but wikitext adjusted to match parsoid html2wt
838 !! test
839 Italics and bold: multiple quote sequences: (2,4,2+3) w/ nowiki
840 !! wikitext
841 ''foo'<nowiki/>'''bar'''''
842 !! html
843 <p><i>foo'<b>bar</b></i>
844 </p>
845 !! end
848 !! test
849 Italics and bold: multiple quote sequences: (2,4,3)
850 !! options
851 parsoid=wt2html
852 !! wikitext
853 ''foo''''bar'''
854 !! html/*
855 <p><i>foo'<b>bar</b></i>
856 </p>
857 !!end
860 # same html as previous, but wikitext adjusted to match parsoid html2wt
861 !! test
862 Italics and bold: multiple quote sequences: (2,4,3+2) w/ nowiki
863 !! wikitext
864 ''foo'<nowiki/>'''bar'''''
865 !! html
866 <p><i>foo'<b>bar</b></i>
867 </p>
868 !! end
871 !! test
872 Italics and bold: multiple quote sequences: (2,4,4)
873 !! options
874 parsoid=wt2html
875 !! wikitext
876 ''foo''''bar''''
877 !! html/*
878 <p><i>foo'<b>bar'</b></i>
879 </p>
880 !!end
883 # same html as previous, but wikitext adjusted to match parsoid html2wt
884 !! test
885 Italics and bold: multiple quote sequences: (2,4,4+2) w/ nowiki
886 !! wikitext
887 ''foo'<nowiki/>'''bar'<nowiki/>'''''
888 !! html
889 <p><i>foo'<b>bar'</b></i>
890 </p>
891 !! end
894 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
895 !! test
896 Italics and bold: multiple quote sequences: (3,4,2)
897 !! options
898 parsoid=wt2html
899 !! wikitext
900 '''foo''''bar''
901 !! html/php
902 <p><b>foo'</b>bar
903 </p>
904 !! html/parsoid
905 <p><b>foo'</b>bar<i></i>
906 </p>
907 !!end
909 # same html as previous, but wikitext adjusted to match parsoid html2wt
910 !! test
911 Italics and bold: multiple quote sequences: (3,4,2+2) w/ nowiki
912 !! options
913 parsoid
914 !! wikitext
915 '''<nowiki>foo'</nowiki>'''bar''<nowiki/>''
916 !! html/php
917 <p><b>foo'</b>bar
918 </p>
919 !! html/parsoid
920 <p><b><span typeof="mw:Nowiki">foo'</span></b>bar<i></i>
921 </p>
922 !! end
925 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
926 !! test
927 Italics and bold: multiple quote sequences: (3,4,3)
928 !! options
929 parsoid=wt2html
930 !! wikitext
931 '''foo''''bar'''
932 !! html/php
933 <p><b>foo'</b>bar
934 </p>
935 !! html/parsoid
936 <p><b>foo'</b>bar<b></b>
937 </p>
938 !!end
940 # same html as previous, but wikitext adjusted to match parsoid html2wt
941 !! test
942 Italics and bold: multiple quote sequences: (3,4,3+3) w/ nowiki
943 !! wikitext
944 '''<nowiki>foo'</nowiki>'''bar'''<nowiki/>'''
945 !! html/php
946 <p><b>foo'</b>bar
947 </p>
948 !! html/parsoid
949 <p><b><span typeof="mw:Nowiki">foo'</span></b>bar<b></b>
950 </p>
951 !! end
954 ### other quote tests
956 !! test
957 Italics and bold: other quote tests: (2,3,5)
958 !! wikitext
959 ''this is about '''foo's family'''''
960 !! html
961 <p><i>this is about <b>foo's family</b></i>
962 </p>
963 !!end
966 !! test
967 Italics and bold: other quote tests: (2,(3,3),2)
968 !! wikitext
969 ''this is about '''foo's''' family''
970 !! html
971 <p><i>this is about <b>foo's</b> family</i>
972 </p>
973 !!end
976 !! test
977 Italics and bold: other quote tests: (3,2,3,2)
978 !! options
979 parsoid=wt2html
980 !! wikitext
981 '''this is about ''foo'''s family''
982 !! html/*
983 <p><b>this is about <i>foo</i></b><i>s family</i>
984 </p>
985 !!end
988 # same html as previous, but wikitext adjusted to match parsoid html2wt
989 !! test
990 Italics and bold: other quote tests: (3,2,3+2+2,2)
991 !! wikitext
992 '''this is about ''foo'''''<nowiki/>''s family''
993 !! html
994 <p><b>this is about <i>foo</i></b><i>s family</i>
995 </p>
996 !! end
999 !! test
1000 Italics and bold: other quote tests: (3,2,3,3)
1001 !! wikitext
1002 '''this is about ''foo'''s family'''
1003 !! html/*
1004 <p>'<i>this is about </i>foo<b>s family</b>
1005 </p>
1006 !!end
1009 !! test
1010 Italics and bold: other quote tests: (3,(2,2),3)
1011 !! wikitext
1012 '''this is about ''foo's'' family'''
1013 !! html
1014 <p><b>this is about <i>foo's</i> family</b>
1015 </p>
1016 !!end
1019 !! test
1020 Italicized possessive
1021 !! wikitext
1022 The ''[[Main Page]]'''s talk page.
1023 !! html/php
1024 <p>The <i><a href="/wiki/Main_Page" title="Main Page">Main Page</a>'</i>s talk page.
1025 </p>
1026 !! html/parsoid
1027 <p>The <i><a rel="mw:WikiLink"  href="Main_Page" title="Main Page">Main Page</a>'</i>s talk page.</p>
1028 !! end
1030 !! test
1031 Parsoid only: Quote balancing context should be restricted to td/th cells on the same wikitext line
1032 (Requires tidy for PHP parser output to be fixed up)
1033 !! options
1034 parsoid=wt2html,wt2wt
1035 !! wikitext
1037 !''a!!''b
1038 |''a||''b
1040 !! html/php+tidy
1041 <table>
1042 <tr>
1043 <th><i>a</i></th>
1044 <th><i>b</i></th>
1045 <td><i>a</i></td>
1046 <td><i>b</i></td>
1047 </tr>
1048 </table>
1049 !! html/parsoid
1050 <table>
1051 <tbody><tr><th><i>a</i></th><th><i>b</i></th>
1052 <td><i>a</i></td><td><i>b</i></td></tr>
1053 </tbody></table>
1054 !! end
1057 ### Non-html5 tags
1060 !! test
1061 Non-html5 tags should be accepted
1062 !! wikitext
1063 <center>''foo''</center>
1064 <big>''foo''</big>
1065 <font>''foo''</font>
1066 <strike>''foo''</strike>
1067 <tt>''foo''</tt>
1068 !! html
1069 <center><i>foo</i></center>
1070 <p><big><i>foo</i></big>
1071 <font><i>foo</i></font>
1072 <strike><i>foo</i></strike>
1073 <tt><i>foo</i></tt>
1074 </p>
1075 !! end
1077 !! test
1078 <wbr> is valid wikitext (bug 52468)
1079 !! wikitext
1080 <wbr>
1081 !! html
1082 <p><wbr />
1083 </p>
1084 !! end
1086 # <strike> is HTML4, <s> is HTML4/5.
1087 !! test
1088 <s> or <strike> for strikethrough
1089 !! wikitext
1090 <strike>strike</strike>
1092 <s>s</s>
1093 !! html
1094 <p><strike>strike</strike>
1095 </p><p><s>s</s>
1096 </p>
1097 !! end
1099 ## a not permitted
1100 ## i,b,br omitted
1101 !! test
1102 Text-level semantic html elements in wikitext
1103 !! wikitext
1104 <em>text</em>
1105 <strong>text</strong>
1106 <small>text</small>
1107 <s>text</s>
1108 <cite>text</cite>
1109 <q>text</q>
1110 <dfn>text</dfn>
1111 <abbr>text</abbr>
1112 <data>text</data>
1113 <time>text</time>
1114 <code>text</code>
1115 <var>text</var>
1116 <samp>text</samp>
1117 <kbd>text</kbd>
1118 <sub>text</sub>
1119 <u>text</u>
1120 <mark>text</mark>
1121 <ruby><rb>明日</rb><rp>(</rp><rt>Ashita</rt><rp> </rp><rtc>あした</rtc><rp>)</rp></ruby>
1122 <bdi>text</bdi>
1123 <bdo>text</bdo>
1124 <span>text</span>
1125 <wbr />
1126 !! html
1127 <p><em>text</em>
1128 <strong>text</strong>
1129 <small>text</small>
1130 <s>text</s>
1131 <cite>text</cite>
1132 <q>text</q>
1133 <dfn>text</dfn>
1134 <abbr>text</abbr>
1135 <data>text</data>
1136 <time>text</time>
1137 <code>text</code>
1138 <var>text</var>
1139 <samp>text</samp>
1140 <kbd>text</kbd>
1141 <sub>text</sub>
1142 <u>text</u>
1143 <mark>text</mark>
1144 <ruby><rb>明日</rb><rp>(</rp><rt>Ashita</rt><rp> </rp><rtc>あした</rtc><rp>)</rp></ruby>
1145 <bdi>text</bdi>
1146 <bdo>text</bdo>
1147 <span>text</span>
1148 <wbr />
1149 </p>
1150 !! end
1152 # test cases taken from
1153 # http://www.w3.org/TR/html5/text-level-semantics.html#the-ruby-element
1154 !! test
1155 Ruby markup (W3C-style)
1156 !! wikitext
1157 ; Mono-ruby for individual base characters
1158 : <ruby>日<rt>に</rt>本<rt>ほん</rt>語<rt>ご</rt></ruby>
1159 ; Group ruby
1160 : <ruby>今日<rt>きょう</rt></ruby>
1161 ; Jukugo ruby
1162 : <ruby>法<rb>華</rb><rb>経</rb><rt>ほ</rt><rt>け</rt><rt>きょう</rt></ruby>
1163 ; Inline ruby
1164 : <ruby>東<rb>京</rb><rp>(</rp><rt>とう</rt><rt>きょう</rt><rp>)</rp></ruby>
1165 ; Double-sided ruby
1166 : <ruby><rb>旧</rb><rb>金</rb><rb>山</rb><rt>jiù</rt><rt>jīn</rt><rt>shān</rt><rtc>San Francisco</rtc></ruby>
1167 <ruby>
1168 <rb>♥</rb><rtc><rt>Heart</rt></rtc><rtc lang="fr"><rt>Cœur</rt></rtc>
1169 <rb>☘</rb><rtc><rt>Shamrock</rt></rtc><rtc lang="fr"><rt>Trèfle</rt></rtc>
1170 <rb>✶</rb><rtc><rt>Star</rt></rtc><rtc lang="fr"><rt>Étoile</rt></rtc>
1171 </ruby>
1172 !! html
1173 <dl><dt> Mono-ruby for individual base characters</dt>
1174 <dd> <ruby>日<rt>に</rt>本<rt>ほん</rt>語<rt>ご</rt></ruby></dd>
1175 <dt> Group ruby</dt>
1176 <dd> <ruby>今日<rt>きょう</rt></ruby></dd>
1177 <dt> Jukugo ruby</dt>
1178 <dd> <ruby>法<rb>華</rb><rb>経</rb><rt>ほ</rt><rt>け</rt><rt>きょう</rt></ruby></dd>
1179 <dt> Inline ruby</dt>
1180 <dd> <ruby>東<rb>京</rb><rp>(</rp><rt>とう</rt><rt>きょう</rt><rp>)</rp></ruby></dd>
1181 <dt> Double-sided ruby</dt>
1182 <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>
1183 <p><ruby>
1184 <rb>♥</rb><rtc><rt>Heart</rt></rtc><rtc lang="fr"><rt>Cœur</rt></rtc>
1185 <rb>☘</rb><rtc><rt>Shamrock</rt></rtc><rtc lang="fr"><rt>Trèfle</rt></rtc>
1186 <rb>✶</rb><rtc><rt>Star</rt></rtc><rtc lang="fr"><rt>Étoile</rt></rtc>
1187 </ruby>
1188 </p>
1189 !! end
1191 # There is a tidy bug here: http://sourceforge.net/p/tidy/bugs/946/
1192 !! test
1193 Non-word characters don't terminate tag names (bug 17663, 40670, 52022)
1194 !! wikitext
1195 <b→> doesn't work! </b→>
1197 <bä> doesn't work! </bä>
1199 <boo> works fine </boo>
1201 <s.foo>s.foo</s.foo>
1203 <sub-ID#1>
1204 !! html
1205 <p>&lt;b→&gt; doesn't work! &lt;/b→&gt;
1206 </p><p>&lt;bä&gt; doesn't work! &lt;/bä&gt;
1207 </p><p>&lt;boo&gt; works fine &lt;/boo&gt;
1208 </p><p>&lt;s.foo&gt;s.foo&lt;/s.foo&gt;
1209 </p><p>&lt;sub-ID#1&gt;
1210 </p>
1211 !! end
1213 !! test
1214 Isolated close tags should be treated as literal text (bug 52760)
1215 !! wikitext
1216 </b>
1218 <s.foo>s</s>
1219 !! html
1220 <p>&lt;/b&gt;
1221 </p><p>&lt;s.foo&gt;s&lt;/s&gt;
1222 </p>
1223 !! end
1226 ### Special characters
1229 !! test
1230 Bare pipe character (bug 52363)
1231 !! wikitext
1233 !! html
1234 <p>|
1235 </p>
1236 !! end
1238 !! test
1239 Bare pipe character from a template (bug 52363)
1240 !! wikitext
1241 {{pipe}}
1242 !! html
1243 <p>|
1244 </p>
1245 !! end
1248 ### <nowiki> test cases
1251 !! test
1252 <nowiki> unordered list
1253 !! wikitext
1254 <nowiki>* This is not an unordered list item.</nowiki>
1255 !! html
1256 <p>* This is not an unordered list item.
1257 </p>
1258 !! end
1260 !! test
1261 <nowiki> spacing
1262 !! wikitext
1263 <nowiki>Lorem ipsum dolor
1265 sed abit.
1266   sed nullum.
1268 :and a colon
1269 </nowiki>
1270 !! html
1271 <p>Lorem ipsum dolor
1273 sed abit.
1274   sed nullum.
1276 :and a colon
1278 </p>
1279 !! end
1281 !! test
1282 nowiki 3
1283 !! wikitext
1284 :There is not nowiki.
1285 :There is <nowiki>nowiki</nowiki>.
1287 #There is not nowiki.
1288 #There is <nowiki>nowiki</nowiki>.
1290 *There is not nowiki.
1291 *There is <nowiki>nowiki</nowiki>.
1292 !! html
1293 <dl><dd>There is not nowiki.</dd>
1294 <dd>There is nowiki.</dd></dl>
1295 <ol><li>There is not nowiki.</li>
1296 <li>There is nowiki.</li></ol>
1297 <ul><li>There is not nowiki.</li>
1298 <li>There is nowiki.</li></ul>
1300 !! end
1302 !! test
1303 Entities inside <nowiki>
1304 !! wikitext
1305 <nowiki>&lt;</nowiki>
1306 !! html
1307 <p>&lt;
1308 </p>
1309 !! end
1311 !! test
1312 Entities inside template parameters
1313 !! options
1314 parsoid
1315 !! wikitext
1316 {{echo|&ndash;}}
1317 !! html
1318 <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>
1319 !! end
1321 !! test
1322 Properly escape nowiki when combined with other wiki markup
1323 !! options
1324 parsoid=html2wt
1325 !! wikitext
1326 <nowiki>* &lt;/nowiki&gt;</nowiki> tag
1327 !! html
1328 <p>* &lt;/nowiki&gt; tag</p>
1329 !! end
1332 ### Comments
1334 !! test
1335 Comments and Indent-Pre
1336 !! wikitext
1337 <!-- comment 1 --> asdf
1339 <!-- comment 1 --> asdf
1340 <!-- comment 2 -->
1342 <!-- comment 1 --> asdf
1343 <!-- comment 2 -->xyz
1345 <!-- comment 1 --> asdf
1346 <!-- comment 2 --> xyz
1347 !! html
1348 <pre>asdf
1349 </pre>
1350 <pre>asdf
1351 </pre>
1352 <pre>asdf
1353 </pre>
1354 <p>xyz
1355 </p>
1356 <pre>asdf
1358 </pre>
1359 !! end
1361 !! test
1362 Comment test 2a
1363 !! wikitext
1364 asdf
1365 <!-- comment 1 -->
1367 !! html
1368 <p>asdf
1370 </p>
1371 !! end
1373 !! test
1374 Comment test 2b
1375 !! wikitext
1376 asdf
1377 <!-- comment 1 -->
1380 !! html
1381 <p>asdf
1382 </p><p>jkl
1383 </p>
1384 !! end
1386 !! test
1387 Comment test 3
1388 !! wikitext
1389 asdf
1390 <!-- comment 1 -->
1391 <!-- comment 2 -->
1393 !! html
1394 <p>asdf
1396 </p>
1397 !! end
1399 !! test
1400 Comment test 4
1401 !! wikitext
1402 asdf<!-- comment 1 -->jkl
1403 !! html
1404 <p>asdfjkl
1405 </p>
1406 !! end
1408 !! test
1409 Comment spacing
1410 !! wikitext
1412  <!-- foo --> b <!-- bar -->
1414 !! html
1415 <p>a
1416 </p>
1417 <pre> b 
1418 </pre>
1419 <p>c
1420 </p>
1421 !! end
1423 !! test
1424 Comment whitespace
1425 !! wikitext
1426 <!-- returns a single newline, not nothing, since the newline after > is not stripped -->
1427 !! html
1429 !! end
1431 !! test
1432 Comment semantics and delimiters
1433 !! wikitext
1434 <!-- --><!----><!-----><!------>
1435 !! html
1437 !! end
1439 !! test
1440 Comment semantics and delimiters, redux
1441 !! wikitext
1442 <!-- In SGML every "foo" here would actually show up in the text -- foo -- bar
1443 -- foo -- funky huh? ... -->
1444 !! html
1446 !! end
1448 !! test
1449 Comment semantics and delimiters: directors cut
1450 !! wikitext
1451 <!-- ... However we like to keep things simple and somewhat XML-ish so we eat
1452 everything starting with < followed by !-- until the first -- and > we see,
1453 that wouldn't be valid XML however, since in XML -- has to terminate a comment
1454 -->-->
1455 !! html
1456 <p>--&gt;
1457 </p>
1458 !! end
1460 !! test
1461 Comment semantics: nesting
1462 !! wikitext
1463 <!--<!-- no, we're not going to do anything fancy here -->-->
1464 !! html
1465 <p>--&gt;
1466 </p>
1467 !! end
1469 !! test
1470 Comment semantics: unclosed comment at end
1471 !! wikitext
1472 <!--This comment will run out to the end of the document
1473 !! html
1475 !! end
1477 # Bug 58184: document parsoid's behaviour
1478 !! test
1479 Suppress comment closing tag in lenient browsers
1480 !! options
1481 parsoid=wt2html,html2html
1482 !! wikitext
1483 <!-- Browsers--!> think this is closed -->
1484 !! html/php
1486 !! html/parsoid
1487 <!-- Browsers--¡> think this is closed -->
1488 !! end
1490 !! test
1491 Comment in template title
1492 !! wikitext
1493 {{f<!---->oo}}
1494 !! html
1495 <p>FOO
1496 </p>
1497 !! end
1499 !! test
1500 Comment on its own line post-expand
1501 !! wikitext
1503 {{blank}}<!---->
1505 !! html
1506 <p>a
1507 </p><p>b
1508 </p>
1509 !! end
1511 !! test
1512 Comment on its own line post-expand with non-significant whitespace
1513 !! wikitext
1515  {{blank}} <!----> 
1517 !! html
1518 <p>a
1519 </p><p>b
1520 </p>
1521 !! end
1523 !! test
1524 Multiple comments should still parse as SOL-transparent
1525 !! options
1526 parsoid=wt2html,wt2wt
1527 !! wikitext
1528 <!--c1-->*a
1529 <!--c2--><!--c3--><!--c4-->*b
1530 !! html
1531 <ul>
1532 <li>a
1533 </li>
1534 <li>b
1535 </li>
1536 </ul>
1537 !! end
1540 ### paragraph wrapping tests
1542 !! test
1543 No block tags
1544 !! wikitext
1548 !! html
1549 <p>a
1550 </p><p>b
1551 </p>
1552 !! end
1554 !! test
1555 Block tag on one line (<div>)
1556 !! wikitext
1557 a <div>foo</div>
1560 !! html
1561 a <div>foo</div>
1562 <p>b
1563 </p>
1564 !! html+tidy
1565 <p>a</p>
1566 <div>foo</div>
1567 <p>b</p>
1568 !! end
1570 !! test
1571 Block tag on one line (<blockquote>)
1572 !! wikitext
1573 a <blockquote>foo</blockquote>
1576 !! html
1577 a <blockquote>foo</blockquote>
1578 <p>b
1579 </p>
1580 !! html+tidy
1581 <p>a</p>
1582 <blockquote>
1583 <p>foo</p>
1584 </blockquote>
1585 <p>b</p>
1586 !! end
1588 !! test
1589 Block tag on both lines (<div>)
1590 !! wikitext
1591 a <div>foo</div>
1593 b <div>foo</div>
1594 !! html
1595 a <div>foo</div>
1596 b <div>foo</div>
1598 !! html+tidy
1599 <p>a</p>
1600 <div>foo</div>
1601 <p>b</p>
1602 <div>foo</div>
1603 !! end
1605 !! test
1606 Block tag on both lines (<blockquote>)
1607 !! wikitext
1608 a <blockquote>foo</blockquote>
1610 b <blockquote>foo</blockquote>
1611 !! html
1612 a <blockquote>foo</blockquote>
1613 b <blockquote>foo</blockquote>
1615 !! html+tidy
1616 <p>a</p>
1617 <blockquote>
1618 <p>foo</p>
1619 </blockquote>
1620 <p>b</p>
1621 <blockquote>
1622 <p>foo</p>
1623 </blockquote>
1624 !! end
1626 !! test
1627 Multiple lines without block tags
1628 !! wikitext
1629 <div>foo</div> a
1632 d<!--foo--> e
1633 x <div>foo</div> z
1634 !! html
1635 <div>foo</div> a
1636 <p>b
1638 d e
1639 </p>
1640 x <div>foo</div> z
1642 !! html+tidy
1643 <div>foo</div>
1644 <p>a</p>
1645 <p>b c d e</p>
1646 <p>x</p>
1647 <div>foo</div>
1648 <p>z</p>
1649 !! end
1651 # Tidy strips out the empty <div> tags. Parsoid doesn't.
1652 # So, we have a separate section for Parsoid. We don't want
1653 # to mimic this stripping behavior in Parsoid. It affects
1654 # editing experience and also requires us to maintain additional
1655 # info for RT-ing.
1656 !! test
1657 Empty lines between lines with block tags
1658 !! wikitext
1659 <div></div>
1662 <div></div>a
1665 <div>a</div>b
1667 <div>b</div>d
1670 <div>e</div>
1671 !! html
1672 <div></div>
1673 <p><br />
1674 </p>
1675 <div></div>a
1676 <p>b
1677 </p>
1678 <div>a</div>b
1679 <div>b</div>d
1680 <p><br />
1681 </p>
1682 <div>e</div>
1684 !! html+tidy
1685 <p><br /></p>
1686 <p>a</p>
1687 <p>b</p>
1688 <div>a</div>
1689 <p>b</p>
1690 <div>b</div>
1691 <p>d</p>
1692 <p><br /></p>
1693 <div>e</div>
1694 !! html/parsoid
1695 <div data-parsoid='{"stx":"html"}'></div>
1697 <p><br /></p>
1698 <div data-parsoid='{"stx":"html"}'></div><p>a</p>
1700 <p>b</p>
1701 <div data-parsoid='{"stx":"html"}'>a</div><p>b</p>
1703 <div data-parsoid='{"stx":"html"}'>b</div><p>d</p>
1705 <p><br /></p>
1706 <div data-parsoid='{"stx":"html"}'>e</div>
1707 !! end
1709 ## PHP parser emits output which is broken
1710 ## XXX The parsoid output doesn't match the tidy output.
1711 !! test
1712 Unclosed HTML p-tags should be handled properly
1713 !! wikitext
1714 <div><p>foo</div>
1718 !! html/php+tidy
1719 <div>
1720 <p>foo&lt;/div&gt;</p>
1721 <p>a</p>
1722 b</div>
1723 !! html/parsoid
1724 <div data-parsoid='{"stx":"html"}'><p data-parsoid='{"stx":"html", "autoInsertedEnd":true}'>foo</p></div>
1725 <p>a</p>
1726 <p>b</p>
1727 !! end
1729 ## SSS FIXME: I can come up with other scenarios where this doesn't work because
1730 ## of eager output of buffered tokens in the p-wrapper. But, I'm going to ignore
1731 ## them for now.
1732 !! test
1733 1. P-wrapping should leave sol-transparent tags outside p-tags where possible
1734 !! options
1735 parsoid=wt2html
1736 !! wikitext
1737 a [[Category:A1]] [[Category:A2]]
1738 [[Category:A3]]
1739 [[Category:A4]]
1740 !! html/parsoid
1741 <p>a</p>
1742 <link href="Category:A1"/> <link href="Category:A2"/> <link href="Category:A3"/> <link href="Category:A4"/>
1743 !! end
1745 !! test
1746 2. P-wrapping should leave sol-transparent tags outside p-tags where possible
1747 !! options
1748 parsoid=wt2html
1749 !! wikitext
1750 [[Category:A1]]a
1751 !! html/parsoid
1752 <link href="Category:A1"/><p>a</p>
1753 !! end
1756 ### Preformatted text
1758 !! test
1759 Preformatted text
1760 !! wikitext
1761  This is some
1762  Preformatted text
1763  With ''italic''
1764  And '''bold'''
1765  And a [[Main Page|link]]
1766 !! html
1767 <pre>This is some
1768 Preformatted text
1769 With <i>italic</i>
1770 And <b>bold</b>
1771 And a <a href="/wiki/Main_Page" title="Main Page">link</a>
1772 </pre>
1773 !! end
1775 !! test
1776 Tabs don't trigger preformatted text
1777 !! wikitext
1778         This is not
1779          preformatted text.
1780  This is preformatted text.
1781         So is this.
1782 !! html
1783 <p>     This is not
1784          preformatted text.
1785 </p>
1786 <pre>This is preformatted text.
1787         So is this.
1788 </pre>
1789 !! end
1791 !! test
1792 Ident preformatting with inline content
1793 !! wikitext
1795  ''b''
1796 !! html
1797 <pre>a
1798 <i>b</i>
1799 </pre>
1800 !! end
1802 !! test
1803 <pre> with <nowiki> inside (compatibility with 1.6 and earlier)
1804 !! wikitext
1805 <pre><nowiki>
1807 <cite>
1808 <em>
1809 </nowiki></pre>
1810 !! html
1811 <pre>
1812 &lt;b&gt;
1813 &lt;cite&gt;
1814 &lt;em&gt;
1815 </pre>
1817 !! end
1819 !! test
1820 Regression with preformatted in <center>
1821 !! wikitext
1822 <center>
1823  Blah
1824 </center>
1825 !! html
1826 <center>
1827 <pre>Blah
1828 </pre>
1829 </center>
1831 !! end
1833 !! test
1834 Bug 52763: Preformatted in <blockquote>
1835 !! wikitext
1836 <blockquote>
1837  Blah
1840  indented cell (no pre-wrapping!)
1842 </blockquote>
1843 !! html
1844 <blockquote>
1845 <p> Blah
1846 </p>
1847 <table>
1848 <tr>
1849 <td>
1850 <p> indented cell (no pre-wrapping!)
1851 </p>
1852 </td></tr></table>
1853 </blockquote>
1855 !! end
1857 !! test
1858 Bug 51086: Double newlines in blockquotes should be turned into paragraphs
1859 !! wikitext
1860 <blockquote>
1864 </blockquote>
1865 !! html
1866 <blockquote>
1867 <p>Foo
1868 </p><p>Bar
1869 </p>
1870 </blockquote>
1872 !! end
1874 !! test
1875 Bug 15491: <ins>/<del> in blockquote
1876 !! wikitext
1877 <blockquote>
1878 Foo <del>bar</del> <ins>baz</ins> quux
1879 </blockquote>
1880 !! html
1881 <blockquote>
1882 <p>Foo <del>bar</del> <ins>baz</ins> quux
1883 </p>
1884 </blockquote>
1886 !! end
1888 # Note that the p-wrapping is newline sensitive, which could be
1889 # considered a bug: tidy will wrap only the 'Foo' in the example
1890 # below in a <p> tag. (see comment 23-25 of bug #6200)
1891 !! test
1892 Bug 15491: <ins>/<del> in blockquote (2)
1893 !! wikitext
1894 <blockquote>Foo <del>bar</del> <ins>baz</ins> quux
1895 </blockquote>
1896 !! html
1897 <blockquote>Foo <del>bar</del> <ins>baz</ins> quux
1898 </blockquote>
1900 !! html+tidy
1901 <blockquote>
1902 <p>Foo</p>
1903 <del>bar</del> <ins>baz</ins> quux</blockquote>
1904 !! end
1906 !! test
1907 <pre> with attributes (bug 3202)
1908 !! wikitext
1909 <pre style="background: blue; color:white">Bluescreen of WikiDeath</pre>
1910 !! html
1911 <pre style="background: blue; color:white">Bluescreen of WikiDeath</pre>
1913 !! end
1915 !! test
1916 <pre> with width attribute (bug 3202)
1917 !! wikitext
1918 <pre width="8">Narrow screen goodies</pre>
1919 !! html
1920 <pre width="8">Narrow screen goodies</pre>
1922 !! end
1924 !! test
1925 <pre> with forbidden attribute (bug 3202)
1926 !! wikitext
1927 <pre width="8" onmouseover="alert(document.cookie)">Narrow screen goodies</pre>
1928 !! html
1929 <pre width="8">Narrow screen goodies</pre>
1931 !! end
1933 !! test
1934 Entities inside <pre>
1935 !! wikitext
1936 <pre>&lt;</pre>
1937 !! html
1938 <pre>&lt;</pre>
1940 !! end
1942 !! test
1943 <pre> with forbidden attribute values (bug 3202)
1944 !! wikitext
1945 <pre width="8" style="border-width: expression(alert(document.cookie))">Narrow screen goodies</pre>
1946 !! html
1947 <pre width="8" style="/* insecure input */">Narrow screen goodies</pre>
1949 !! end
1951 !! test
1952 <nowiki> inside <pre> (bug 13238)
1953 !! wikitext
1954 <pre>
1955 <nowiki>
1956 </pre>
1957 <pre>
1958 <nowiki></nowiki>
1959 </pre>
1960 <pre><nowiki><nowiki></nowiki>Foo<nowiki></nowiki></nowiki></pre>
1961 !! html
1962 <pre>
1963 &lt;nowiki&gt;
1964 </pre>
1965 <pre>
1967 </pre>
1968 <pre>&lt;nowiki&gt;Foo&lt;/nowiki&gt;</pre>
1970 !! end
1972 !! test
1973 <nowiki> and <pre> preference (first one wins)
1974 !! wikitext
1975 <pre>
1976 <nowiki>
1977 </pre>
1978 </nowiki>
1979 </pre>
1981 <nowiki>
1982 <pre>
1983 <nowiki>
1984 </pre>
1985 </nowiki>
1986 </pre>
1988 !! html
1989 <pre>
1990 &lt;nowiki&gt;
1991 </pre>
1992 <p>&lt;/nowiki&gt;
1993 &lt;/pre&gt;
1994 </p><p>
1995 &lt;pre&gt;
1996 &lt;nowiki&gt;
1997 &lt;/pre&gt;
1999 &lt;/pre&gt;
2000 </p>
2001 !! end
2003 !! test
2004 </pre> inside nowiki
2005 !! wikitext
2006 <nowiki></pre></nowiki>
2007 !! html
2008 <p>&lt;/pre&gt;
2009 </p>
2010 !! end
2012 # Parsoid doesn't strip empty tags, like Tidy does.
2013 !! test
2014 Empty pre; pre inside other HTML tags (bug 54946)
2015 !! options
2016 parsoid=wt2html,wt2wt
2017 !! wikitext
2020 <div><pre>
2022 </pre></div>
2023 <pre></pre>
2024 !! html/php
2025 <p>a
2026 </p>
2027 <div><pre>
2029 </pre></div>
2030 <pre></pre>
2032 !! html/php+tidy
2033 <p>a</p>
2034 <div>
2035 <pre>
2037 </pre></div>
2038 !! html/parsoid
2039 <p>a</p>
2041 <div><pre>foo
2042 </pre></div>
2043 <pre></pre>
2044 !! end
2046 !! test
2047 HTML pre followed by indent-pre
2048 !! wikitext
2049 <pre>foo</pre>
2050  bar
2051 !! html
2052 <pre>foo</pre>
2053 <pre>bar
2054 </pre>
2055 !! end
2057 !!test
2058 Block tag pre
2059 !!options
2060 parsoid
2061 !! wikitext
2062 <p><pre>foo</pre></p>
2063 !! html
2064 <p data-parsoid='{"stx":"html","autoInsertedEnd":true}'></p><pre data-parsoid='{"stx":"html"}'>foo</pre><p data-parsoid='{"autoInsertedStart":true,"stx":"html"}'></p>
2065 !!end
2067 !!test
2068 Templates: Indent-Pre: 1a. Templates that break a line should suppress <pre>
2069 !! wikitext
2070  {{echo|}}
2071 !! html
2073 !!end
2075 !!test
2076 Templates: Indent-Pre: 1b. Templates that break a line should suppress <pre>
2077 !! wikitext
2078  {{echo|
2079 foo}}
2080 !! html
2081 <p>foo
2082 </p>
2083 !!end
2085 !! test
2086 Templates: Indent-Pre: 1c: Wrapping should be based on expanded content
2087 !! wikitext
2088  {{echo|a
2090 !! html
2091 <pre>a
2092 </pre>
2093 <p>b
2094 </p>
2095 !!end
2097 !! test
2098 Templates: Indent-Pre: 1d: Wrapping should be based on expanded content
2099 !! wikitext
2100  {{echo|a
2106 !! html
2107 <pre>a
2108 </pre>
2109 <p>b
2111 </p>
2112 <pre>d
2113 </pre>
2114 <p>e
2115 </p>
2116 !!end
2118 !!test
2119 Templates: Indent-Pre: 1e. Wrapping should be based on expanded content
2120 !! wikitext
2121 {{echo| foo}}
2123 {{echo| foo}}{{echo| bar}}
2125 {{echo| foo}}
2126 {{echo| bar}}
2128 {{echo|<!--cmt--> foo}}
2130 <!--cmt-->{{echo| foo}}
2132 {{echo|{{echo| }}bar}}
2133 !! html
2134 <pre>foo
2135 </pre>
2136 <pre>foo bar
2137 </pre>
2138 <pre>foo
2140 </pre>
2141 <pre>foo
2142 </pre>
2143 <pre>foo
2144 </pre>
2145 <pre>bar
2146 </pre>
2147 !!end
2149 !! test
2150 Templates: Indent-Pre: 1f: Wrapping should be based on expanded content
2151 !! wikitext
2152 {{echo| }}a
2154 {{echo|
2155  }}a
2157 {{echo|
2158  b}}
2160 {{echo|a
2161  }}b
2163 {{echo|a
2164 }} b
2165 !! html
2166 <pre>a
2167 </pre>
2168 <p><br />
2169 </p>
2170 <pre>a
2171 </pre>
2172 <p><br />
2173 </p>
2174 <pre>b
2175 </pre>
2176 <p>a
2177 </p>
2178 <pre>b
2179 </pre>
2180 <p>a
2181 </p>
2182 <pre>b
2183 </pre>
2184 !!end
2186 !! test
2187 Things that look like <pre> tags aren't treated as such
2188 !! wikitext
2189 Barack Obama <President> of the United States
2190 <President></President>
2191 !! html
2192 <p>Barack Obama &lt;President&gt; of the United States
2193 &lt;President&gt;&lt;/President&gt;
2194 </p>
2195 !! end
2197 ## PHP parser discards the "<pre " string
2198 !! test
2199 Handle broken pre-like tags (bug 64025)
2200 !! options
2201 parsoid=wt2html
2202 !! wikitext
2203 {{echo|<pre <pre>x</pre>}}
2205 <table><pre </table>
2206 !! html/php
2207 <pre>x</pre>
2208 <table><pre></pre></table>
2210 !! html/parsoid
2211 <pre about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"a":{"&lt;pre":null},"sa":{"&lt;pre":""},"stx":"html","pi":[[{"k":"1","spc":["","","",""]}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;pre &lt;pre>x&lt;/pre>"}},"i":0}}]}'>x</pre>
2214 <p>&lt;pre </p>
2216 <table></table>
2217 !! end
2219 !! test
2220 Parsoid: handle pre with space after attribute
2221 !! options
2222 parsoid=wt2html
2223 !! wikitext
2224 <pre style="width:50%;" >{{echo|foo}}</pre>
2225 !! html
2226 <pre style="width:50%;">{{echo|foo}}</pre>
2227 !! end
2229 # TODO / maybe: fix wt2wt for this
2230 !! test
2231 Parsoid: Don't paragraph-wrap fosterable content
2232 !! options
2233 parsoid=wt2html
2234 !! wikitext
2236 <td></td>
2237 <td></td>
2242 !! html
2243 <table>
2245 <tbody>
2246 <tr>
2247 <td></td>
2249 <td></td></tr>
2253 </tbody></table>
2254 !! end
2256 !! test
2257 Parsoid: Don't paragraph-wrap fosterable content even if table syntax is unbalanced
2258 !! options
2259 parsoid=wt2html
2260 !! wikitext
2262 <td>
2263 <td>
2264 </td>
2269 !! html
2270 <table>
2272 <tbody>
2273 <tr>
2274 <td></td>
2276 <td>
2277 </td></tr>
2281 </tbody></table>
2282 !! end
2285 #--------------------------------------------------------------------
2286 # Transclusion parameter whitespace stripping tests
2287 # Behavior is different for positional and named parameters
2288 #--------------------------------------------------------------------
2289 !! test
2290 Templates: Strip leading and trailing whitespace from named-param values
2291 !! wikitext
2292 {{echo|1= a }}
2294 {{echo|1= {{echo|b}} }}
2296 {{echo| 1 =
2297  c }}
2299 {{echo| 1 =
2300 * d
2302 !! html
2303 <p>a
2304 </p><p>b
2305 </p><p>c
2306 </p>
2307 <ul><li> d</li></ul>
2309 !! end
2311 !! test
2312 Templates: Don't strip whitespace from positional-param values
2313 !! wikitext
2314 {{echo|a }}
2316 {{echo|{{echo|b}} }}
2318 {{echo| c 
2321 {{echo| {{echo|d}}
2324 {{echo|
2325  e}}
2327 {{echo|
2328 * f}}
2330 {{echo|
2331  }}g
2332 !! html
2333 <p>a 
2334 </p><p>b 
2335 </p>
2336 <pre>c 
2337 </pre>
2338 <p><br />
2339 </p>
2340 <pre>d
2341 </pre>
2342 <p><br />
2343 </p>
2344 <pre>e
2345 </pre>
2346 <p><br />
2347 </p>
2348 <ul><li> f</li></ul>
2349 <p><br />
2350 </p>
2351 <pre>g
2352 </pre>
2353 !! end
2355 !! test
2356 Templates: Handle empty comment-and-ws-only lines correctly
2357 !! wikitext
2358 {{echo|foo
2359 <!--should be ignored-->
2360  <!--should be ignored as well-->
2361 bar}}
2362 !! html
2363 <p>foo
2365 </p>
2366 !! end
2368 !! test
2369 Templates: Handle comments in the target
2370 !! wikitext
2371 {{echo
2372 <!-- should be ignored -->
2373 |foo}}
2375 {{echo<!-- should be ignored -->
2376 |foo}}
2378 {{echo<!-- should be ignored -->|foo}}
2380 {{<!-- should be ignored -->echo|foo}}
2381 !!html/parsoid
2382 <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>
2384 <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>
2386 <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>
2388 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo"}},"i":0}}]}'>foo</p>
2389 !!end
2391 !! test
2392 Templates: Handle comments in parameter names (bug 67657)
2393 !! wikitext
2394 {{echo|1
2395 <!-- should be ignored -->
2396 =foo}}
2398 {{echo|
2399 <!-- should be ignored -->
2400 1 = foo}}
2402 {{echo|1<!-- should be ignored --> = foo}}
2404 {{echo|<!-- should be ignored -->1 = foo}}
2405 !!html/parsoid
2406 <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>
2408 <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>
2410 <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>
2412 <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>
2413 !!end
2415 !! test
2416 Templates: Other wikitext in parameter names (bug 67657)
2417 !! wikitext
2418 {{echo|''1''=foo}}
2419 !!html/parsoid
2420 <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>
2421 !!html/php
2422 <p>{{{1}}}
2423 </p>
2424 !!end
2426 #--------------------------------------------------------------------
2427 # Transclusion parameter escaping tests
2428 #--------------------------------------------------------------------
2429 !! test
2430 Templates: Parsoid parameter escaping test 1
2431 !! options
2432 parsoid
2433 !! wikitext
2434 {{echo|[foo]|{{echo|[bar]}}}}
2435 !! html
2436 <p about="#mwt1" typeof="mw:Transclusion"
2437 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[foo]"},"2":{"wt":"{{echo|[bar]}}"}},"i":0}}]}'>[foo]</p>
2438 !! end
2440 !! test
2441 Parsoid: Pipes in external links in template parameter
2442 !! options
2443 parsoid
2444 !! wikitext
2445 {{echo|[{{echo|http://example.com}} link]}}
2446 !! html
2447 <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>
2448 !! end
2450 !! test
2451 Parsoid: pipe in transclusion parameter
2452 !! options
2453 parsoid
2454 !! wikitext
2455 {{echo|http://foo.com/a&#124;b}}
2456 !! html
2457 <p><a rel="mw:ExtLink" href="http://foo.com/a|b" about="#mwt1"
2458 typeof="mw:Transclusion"
2459 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>
2460 !! end
2462 !! test
2463 Parsoid: Pipe in external link target and content in template parameter
2464 !! options
2465 parsoid=html2wt,wt2wt
2466 !! wikitext
2467 {{echo|[http://foo.com/a&#124;b a&#124;b]}}
2468 !! html
2469 <p><a rel="mw:ExtLink" href="http://foo.com/a|b" about="#mwt1"
2470 typeof="mw:Transclusion"
2471 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},
2472 "params":{"1":{"wt":"[http://foo.com/a|b a|b]"}},"i":0}}]}'>a|b</a></p>
2473 !! end
2475 !! test
2476 Parsoid: Pipe in template with nested template in external link target in template parameter (seriously)
2477 !! options
2478 parsoid
2479 !! wikitext
2480 {{echo|[{{fullurl:{{FULLPAGENAME}}|action=edit}} bar]}}
2481 !! html
2482 <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>
2483 !! end
2485 !! test
2486 Templates: Don't escape already nowiki-escaped text in template parameters
2487 !! options
2488 parsoid=html2wt,wt2wt
2489 !! wikitext
2490 {{echo|foo<nowiki>|</nowiki>bar}}
2491 {{echo|<nowiki>&lt;div&gt;</nowiki>}}
2492 {{echo|<nowiki></nowiki>}}
2493 !! html
2494 <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>
2495 <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>
2496 <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>
2497 </p>
2498 !! end
2500 ## Bug 52824
2501 !! test
2502 Templates: '=' char in nested transclusions should not trigger nowiki escapes or conversion to named param
2503 !! options
2504 parsoid=html2wt,wt2wt
2505 !! wikitext
2506 {{echo|{{echo|1=bar}}}}
2507 !! html
2508 <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>
2509 !! end
2511 ## Bug 56733
2512 !! test
2513 Templates parameters with special tokenizing behavior dont get modified because of arg escaping
2514 !! options
2515 parsoid
2516 !! wikitext
2517 {{echo|a : b}}
2518 !! html
2519 <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:Placeholder" data-parsoid='{"isDisplayHack":true}'> </span>: b</p>
2520 !! end
2523 ### Parsoid-centric tests for testing RT edge cases for pre
2526 !!test
2527 1a. Indent-Pre and Comments
2528 !! wikitext
2530 <!--a-->
2532 !! html
2533 <pre>a
2534 </pre>
2535 <p>c
2536 </p>
2537 !!end
2539 !!test
2540 1b. Indent-Pre and Comments
2541 !! wikitext
2543  <!--a-->
2545 !! html
2546 <pre>a
2547 </pre>
2548 <p>c
2549 </p>
2550 !!end
2552 !!test
2553 1c. Indent-Pre and Comments
2554 !! wikitext
2555 <!--a-->  a
2557  <!--a--> a
2558 !! html
2559 <pre> a
2560 </pre>
2561 <pre> a
2562 </pre>
2563 !!end
2565 !!test
2566 1d. Indent-Pre and Comments
2567 (Pre-handler currently cannot distinguish between comment/ws order and normalizes them to [comment,ws] order)
2568 !! wikitext
2569 <!--a--> a
2571  <!--b-->b
2572 !! html
2573 <pre>a
2574 </pre>
2575 <pre>b
2576 </pre>
2577 !!end
2579 !!test
2580 2a. Indent-Pre and tables
2581 !! wikitext
2582  {|
2583  |-
2584  !h1!!h2
2585  |foo||bar
2586  |}
2587 !! html
2588 <table>
2590 <tr>
2591 <th>h1</th>
2592 <th>h2
2593 </th>
2594 <td>foo</td>
2595 <td>bar
2596 </td></tr></table>
2598 !!end
2600 !!test
2601 2b. Indent-Pre and tables
2602 !! wikitext
2603   {|
2604  |-
2605 |foo
2607 !! html
2608 <table>
2610 <tr>
2611 <td>foo
2612 </td></tr></table>
2614 !!end
2616 !!test
2617 2c. Indent-Pre and tables (bug 42252)
2618 !! wikitext
2620  |+ foo
2621  !  | bar
2623 !! html
2624 <table>
2625 <caption> foo
2626 </caption>
2627 <tr>
2628 <th> bar
2629 </th></tr></table>
2631 !!end
2633 !!test
2634 2d. Indent-Pre and tables
2635 !! wikitext
2637  {|
2638  | b
2639  |}
2640 !! html/php
2641 <pre>a
2642 </pre>
2643 <table>
2644 <tr>
2645 <td> b
2646 </td></tr></table>
2648 !! html/parsoid
2649 <pre>a</pre>
2650  <table>
2651  <tbody><tr><td> b</td></tr>
2652  </tbody></table>
2653 !!end
2655 !!test
2656 2e. Indent-Pre and table-line syntax
2657 !! wikitext
2659  | b
2660  | c
2661 !! html/php
2662 <pre>a
2663 | b
2664 | c
2665 </pre>
2666 !!end
2668 !!test
2669 2f. Indent-pre started by table-line syntax
2670 !! wikitext
2672  | b
2673  | c
2674 !! html/php
2675 <p>a
2676 </p>
2677 <pre>| b
2678 | c
2679 </pre>
2680 !! html/parsoid
2681 <p>a</p>
2682 <pre>
2683 | b
2684 | c</pre>
2685 !!end
2687 !!test
2688 3a. Indent-Pre and block tags (single-line html)
2689 !! wikitext
2690  a <p> foo </p>
2691  b <div> foo </div>
2692  c <blockquote> foo </blockquote>
2693  <span> foo </span>
2694 !! html
2695  a <p> foo </p>
2696  b <div> foo </div>
2697  c <blockquote> foo </blockquote>
2698 <pre><span> foo </span>
2699 </pre>
2700 !! html/parsoid
2701  <p>a </p><p data-parsoid='{"stx":"html"}'> foo </p>
2702  <p>b </p><div data-parsoid='{"stx":"html"}'> foo </div>
2703  <p>c </p><blockquote data-parsoid='{"stx":"html"}'> foo </blockquote>
2704 <pre><span> foo </span>
2705 </pre>
2706 !! html+tidy
2707 <p>a</p>
2708 <p>foo</p>
2709 <p>b</p>
2710 <div>foo</div>
2711 <p>c</p>
2712 <blockquote>
2713 <p>foo</p>
2714 </blockquote>
2715 <pre>
2716 <span> foo </span>
2717 </pre>
2718 !! end
2720 !!test
2721 3b. Indent-Pre and block tags (multi-line html)
2722 !! wikitext
2723  a <span>foo</span>
2724  b <div> foo </div>
2725 !! html
2726 <pre>a <span>foo</span>
2727 </pre>
2728  b <div> foo </div>
2730 !! html/parsoid
2731 <pre>a <span data-parsoid='{"stx":"html"}'>foo</span></pre>
2732  b <div data-parsoid='{"stx":"html"}'> foo </div>
2733 !! html+tidy
2734 <pre>
2735 a <span>foo</span>
2736 </pre>
2737 <p>b</p>
2738 <div>foo</div>
2739 !!end
2741 !!test
2742 3c. Indent-Pre and block tags (pre-content on separate line)
2743 !! wikitext
2745  foo
2746 </p>
2748 <div>
2749  foo
2750 </div>
2752 <center>
2753  foo
2754 </center>
2756 <blockquote>
2757  foo
2758 </blockquote>
2760 <blockquote>
2761 <pre>
2763 </pre>
2764 </blockquote>
2766 <table><tr><td>
2767  foo
2768 </td></tr></table>
2770 <ul><li>
2771   foo
2772 </li></ul>
2774 !! html
2776  foo
2777 </p>
2778 <div>
2779 <pre>foo
2780 </pre>
2781 </div>
2782 <center>
2783 <pre>foo
2784 </pre>
2785 </center>
2786 <blockquote>
2787 <p> foo
2788 </p>
2789 </blockquote>
2790 <blockquote>
2791 <pre>
2793 </pre>
2794 </blockquote>
2795 <table><tr><td>
2796 <pre>foo
2797 </pre>
2798 </td></tr></table>
2799 <ul><li>
2800   foo
2801 </li></ul>
2803 !!end
2805 !!test
2806 4. Indent-Pre and extension tags
2807 !! wikitext
2808  a <gallery>
2809 File:foobar.jpg
2810 </gallery>
2811 !! html
2812  a <ul class="gallery mw-gallery-traditional">
2813                 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
2814                         <div class="thumb" style="width: 150px;"><div style="margin:68px auto;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" width="120" height="14" /></a></div></div>
2815                         <div class="gallerytext">
2816                         </div>
2817                 </div></li>
2818 </ul>
2820 !! html+tidy
2821 <p>a</p>
2822 <ul class="gallery mw-gallery-traditional">
2823 <li class="gallerybox" style="width: 155px">
2824 <div style="width: 155px">
2825 <div class="thumb" style="width: 150px;">
2826 <div style="margin:68px auto;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" width="120" height="14" /></a></div>
2827 </div>
2828 <div class="gallerytext"></div>
2829 </div>
2830 </li>
2831 </ul>
2832 !!end
2834 !! test
2835 Table wikitext syntax outside wiki-tables
2836 !! wikitext
2838 ! not a table heading
2839 |- not a table row
2840 | not a table cell
2841 | class="foo bar" | baz
2846 !! html
2847 <p>a
2848 ! not a table heading
2849 |- not a table row
2850 | not a table cell
2851 | class="foo bar" | baz
2856 </p>
2857 !! end
2859 !!test
2860 Render paragraphs when indent-pre is suppressed in blocklevels
2861 !! wikitext
2862 <blockquote>
2863  foo
2865  bar
2866 </blockquote>
2867 !! html
2868 <blockquote>
2869 <p> foo
2870 </p><p> bar
2871 </p>
2872 </blockquote>
2874 !!end
2876 !!test
2877 4. Multiple spaces at start-of-line
2878 !! wikitext
2879     <p> foo </p>
2880     foo
2881         {|
2882 |foo
2884 !! html
2885     <p> foo </p>
2886 <pre>   foo
2887 </pre>
2888 <table>
2889 <tr>
2890 <td>foo
2891 </td></tr></table>
2893 !!end
2895 ## NOTE: the leading white-space chars on empty line are significant
2896 !! test
2897 5a. White-space in indent-pre
2898 !! wikitext
2899  a<br />
2902 !! html
2903 <pre>a<br />
2906 </pre>
2907 !! end
2909 ## NOTE: the leading white-space chars on empty line are significant
2910 !! test
2911 5b. White-space in indent-pre
2912 !! wikitext
2919 !! html
2920 <pre>a
2926 </pre>
2927 !! end
2929 !! test
2930 5c. White-space in indent-pre
2931 !! wikitext
2932  ''a''
2933   ''b''
2934    ''c''
2935 !! html
2936 <pre><i>a</i>
2937  <i>b</i>
2938   <i>c</i>
2939 </pre>
2940 !! end
2942 !! test
2943 6. Pre-blocks should extend across lines with leading WS even when there is no wrappable content
2944 !! wikitext
2947  <!-- continue -->
2953 !! html
2954 <pre>a
2957 </pre>
2958 <pre>c
2960 </pre>
2961 <p>d
2962 </p>
2963 !! end
2965 !! test
2966 7a. Indent-pre and category links
2967 !! options
2968 parsoid=wt2html,wt2wt
2969 !! wikitext
2970  [[Category:foo]] <!-- No pre-wrapping -->
2971 {{echo| [[Category:foo]]}} <!-- No pre-wrapping -->
2972 !! html
2973  <link rel="mw:PageProp/Category" href="./Category:Foo"> <!-- No pre-wrapping -->
2974 <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-wrapping -->
2975 !! end
2977 !! test
2978 7b. Indent-pre and category links
2979 !! options
2980 parsoid=wt2html,wt2wt
2981 !! wikitext
2982  [[Category:foo]] a
2983  [[Category:foo]] {{echo|b}}
2984 !! html
2985 <pre>
2986 <link rel="mw:PageProp/Category" href="./Category:Foo"> a
2987 <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>
2988 !! end
2991 ### HTML-pre (some to spec PHP parser behavior and some Parsoid-RT-centric)
2994 !!test
2995 HTML-pre: 1. embedded newlines
2996 !! wikitext
2997 <pre>foo</pre>
2999 <pre>
3001 </pre>
3003 <pre>
3006 </pre>
3008 <pre>
3012 </pre>
3013 !! html
3014 <pre>foo</pre>
3015 <pre>
3017 </pre>
3018 <pre>
3021 </pre>
3022 <pre>
3026 </pre>
3028 !! html/parsoid
3029 <pre data-parsoid='{"stx":"html"}'>foo</pre>
3031 <pre data-parsoid='{"stx":"html","strippedNL":"\n"}'>
3033 </pre>
3035 <pre data-parsoid='{"stx":"html"}'>
3038 </pre>
3040 <pre data-parsoid='{"stx":"html"}'>
3044 </pre>
3045 !!end
3047 !! test
3048 HTML-pre: big spaces
3049 !! wikitext
3050 <pre>
3055 haha
3060 haha
3065 </pre>
3066 !! html
3067 <pre>
3072 haha
3077 haha
3082 </pre>
3084 !! html/parsoid
3085 <pre data-parsoid='{"stx":"html"}'>
3090 haha
3095 haha
3100 </pre>
3101 !! end
3103 !!test
3104 HTML-pre: 2: indented text
3105 !! wikitext
3106 <pre>
3107  foo
3108 </pre>
3109 !! html
3110 <pre>
3111  foo
3112 </pre>
3114 !!end
3116 !!test
3117 HTML-pre: 3: other wikitext
3118 !! wikitext
3119 <pre>
3120 * foo
3121 # bar
3122 = no-h =
3123 '' no-italic ''
3124 [[ NoLink ]]
3125 </pre>
3126 !! html
3127 <pre>
3128 * foo
3129 # bar
3130 = no-h =
3131 '' no-italic ''
3132 [[ NoLink ]]
3133 </pre>
3135 !!end
3138 ### Definition lists
3140 !! test
3141 Simple definition
3142 !! wikitext
3143 ; name : Definition
3144 !! html
3145 <dl><dt> name&#160;</dt>
3146 <dd> Definition</dd></dl>
3148 !! end
3150 !! test
3151 Definition list for indentation only
3152 !! wikitext
3153 : Indented text
3154 !! html
3155 <dl><dd> Indented text</dd></dl>
3157 !! end
3159 !! test
3160 Definition list with no space
3161 !! wikitext
3162 ;name:Definition
3163 !! html
3164 <dl><dt>name</dt>
3165 <dd>Definition</dd></dl>
3167 !!end
3169 !! test
3170 Definition list with URL link
3171 !! wikitext
3172 ; http://example.com/ : definition
3173 !! html
3174 <dl><dt> <a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&#160;</dt>
3175 <dd> definition</dd></dl>
3177 !! end
3179 !! test
3180 Definition list with bracketed URL link
3181 !! wikitext
3182 ;[http://www.example.com/ Example]:Something about it
3183 !! html
3184 <dl><dt><a rel="nofollow" class="external text" href="http://www.example.com/">Example</a></dt>
3185 <dd>Something about it</dd></dl>
3187 !! end
3189 !! test
3190 Definition list with wikilink containing colon
3191 !! wikitext
3192 ; [[Help:FAQ]]: The least-read page on Wikipedia
3193 !! html
3194 <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>
3195 <dd> The least-read page on Wikipedia</dd></dl>
3197 !! end
3199 # At Brion's and JeLuF's insistence... :)
3200 !! test
3201 Definition list with news link containing colon
3202 !! wikitext
3203 ;  news:alt.wikipedia.rox: This isn't even a real newsgroup!
3204 !! html
3205 <dl><dt>  <a rel="nofollow" class="external free" href="news:alt.wikipedia.rox">news:alt.wikipedia.rox</a></dt>
3206 <dd> This isn't even a real newsgroup!</dd></dl>
3208 !! end
3210 !! test
3211 Malformed definition list with colon
3212 !! wikitext
3213 ;  news:alt.wikipedia.rox -- don't crash or enter an infinite loop
3214 !! html
3215 <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>
3217 !! end
3219 !! test
3220 Definition lists: colon in external link text
3221 !! wikitext
3222 ; [http://www.wikipedia2.org/ Wikipedia : The Next Generation]: OK, I made that up
3223 !! html
3224 <dl><dt> <a rel="nofollow" class="external text" href="http://www.wikipedia2.org/">Wikipedia&#160;: The Next Generation</a></dt>
3225 <dd> OK, I made that up</dd></dl>
3227 !! end
3229 !! test
3230 Definition lists: colon in HTML attribute
3231 !! wikitext
3232 ;<b style="display: inline">bold</b>
3233 !! html
3234 <dl><dt><b style="display: inline">bold</b></dt></dl>
3236 !! end
3238 !! test
3239 Definition lists: self-closed tag
3240 !! wikitext
3241 ;one<br/>two : two-line fun
3242 !! html
3243 <dl><dt>one<br />two&#160;</dt>
3244 <dd> two-line fun</dd></dl>
3246 !! end
3248 !! test
3249 Bug 11748: Literal closing tags
3250 !! wikitext
3251 <dl>
3252 <dt>test 1</dt>
3253 <dd>test test test test test</dd>
3254 <dt>test 2</dt>
3255 <dd>test test test test test</dd>
3256 </dl>
3257 !! html
3258 <dl>
3259 <dt>test 1</dt>
3260 <dd>test test test test test</dd>
3261 <dt>test 2</dt>
3262 <dd>test test test test test</dd>
3263 </dl>
3265 !! end
3267 !! test
3268 Definition and unordered list using wiki syntax nested in unordered list using html tags.
3269 !! wikitext
3270 <ul><li>
3271 ; term : description
3272 * unordered
3273 </li></ul>
3274 !! html
3275 <ul><li>
3276 <dl><dt> term&#160;</dt>
3277 <dd> description</dd></dl>
3278 <ul><li> unordered</li></ul>
3279 </li></ul>
3281 !! end
3283 !! test
3285 Definition list with empty definition and following paragraph
3286 !! wikitext
3287 ; term:
3288 Paragraph text
3289 !! html
3290 <dl><dt> term</dt>
3291 <dd></dd></dl>
3292 <p>Paragraph text
3293 </p>
3294 !! end
3296 !! test
3297 Nested definition lists using html syntax
3298 !! wikitext
3299 <dl><dt>x</dt>
3300 <dd>a</dd>
3301 <dd>b</dd></dl>
3303 !! end
3305 !! test
3306 Definition Lists: No nesting: Multiple dd's
3307 !! wikitext
3311 !! html
3312 <dl><dt>x</dt>
3313 <dd>a</dd>
3314 <dd>b</dd></dl>
3316 !! end
3318 !! test
3319 Definition Lists: Indentation: Regular
3320 !! wikitext
3322 ::i2
3323 :::i3
3324 !! html
3325 <dl><dd>i1
3326 <dl><dd>i2
3327 <dl><dd>i3</dd></dl></dd></dl></dd></dl>
3329 !! end
3331 !! test
3332 Definition Lists: Indentation: Missing 1st level
3333 !! wikitext
3334 ::i2
3335 :::i3
3336 !! html
3337 <dl><dd><dl><dd>i2
3338 <dl><dd>i3</dd></dl></dd></dl></dd></dl>
3340 !! end
3342 !! test
3343 Definition Lists: Indentation: Multi-level indent
3344 !! wikitext
3345 :::i3
3346 !! html
3347 <dl><dd><dl><dd><dl><dd>i3</dd></dl></dd></dl></dd></dl>
3349 !! end
3351 !! test
3352 Definition Lists: Hacky use to indent tables
3353 !! wikitext
3354 ::{|
3355 |foo
3356 |bar
3358 this text
3359 should be left alone
3360 !! html
3361 <dl><dd><dl><dd><table>
3362 <tr>
3363 <td>foo
3364 </td>
3365 <td>bar
3366 </td></tr></table></dd></dl></dd></dl>
3367 <p>this text
3368 should be left alone
3369 </p>
3370 !! end
3372 !! test
3373 Definition Lists: Hacky use to indent tables, with comments (bug 63979)
3374 !! wikitext
3375 <!-- foo -->
3376 ::{|
3377 |foo
3378 |bar
3379 |}<!-- bar -->
3380 this text
3381 should be left alone
3382 !! html/parsoid
3383 <!-- foo -->
3384 <dl><dd><dl><dd><table><tr>
3385 <td>foo</td>
3386 <td>bar</td>
3387 </tr></table><!-- bar --></dd></dl></dd></dl>
3388 <p>this text
3389 should be left alone</p>
3390 !! end
3392 !! test
3393 Definition Lists: Hacky use to indent tables, with comment before table
3394 !! wikitext
3395 ::<!-- foo -->{|
3396 |foo
3398 !! html/parsoid
3399 <dl><dd><dl><dd><!-- foo --><table><tr>
3400 <td>foo</td>
3401 </tr></table></dd></dl></dd></dl>
3402 !! end
3404 # Bug 52473
3405 !! test
3406 Definition Lists: Hacky use to indent tables (WS-insensitive)
3407 !! options
3408 parsoid
3409 !! wikitext
3410 : {|
3412 |} 
3413 !! html
3414 <dl>
3415 <dd> <table><tr><td>a</td></tr></table> </dd>
3416 </dl>
3417 !! end
3418 ## The PHP parser treats : items (dd) without a corresponding ; item (dt)
3419 ## as an empty dt item.  It also ignores all but the last ";" when followed
3420 ## by ":" later on.  So, ";" are not ignored in ";;;t3" but are ignored  in
3421 ## ";;;t3 :d1".  So, PHP parser behavior is a little inconsistent wrt multiple
3422 ## ";"s.
3424 ## Ex: ";;t2 ::d2" is transformed into:
3426 ## <dl>
3427 ##   <dt>t2 </dt>
3428 ##   <dd>
3429 ##     <dl>
3430 ##       <dt></dt>
3431 ##       <dd>d2</dd>
3432 ##     </dl>
3433 ##   </dd>
3434 ## </dl>
3436 ## But, Parsoid treats "; :" as a tight atomic unit and excess ":" as plain text
3437 ## So, the same wikitext above (;;t2 ::d2) is transformed into:
3439 ## <dl>
3440 ##   <dt>
3441 ##     <dl>
3442 ##       <dt>t2 </dt>
3443 ##       <dd>:d2</dd>
3444 ##     </dl>
3445 ##    </dt>
3446 ## </dl>
3448 ## All Parsoid only definition list tests have this difference.
3450 ## See also: https://bugzilla.wikimedia.org/show_bug.cgi?id=6569
3451 ## and http://lists.wikimedia.org/pipermail/wikitext-l/2011-November/000483.html
3453 !! test
3454 Table / list interaction: indented table with lists in table contents
3455 !! wikitext
3458 | a
3459 * b
3461 | c
3462 * d
3464 !! html
3465 <dl><dd><table>
3467 <tr>
3468 <td> a
3469 <ul><li> b</li></ul>
3470 </td></tr>
3471 <tr>
3472 <td> c
3473 <ul><li> d</li></ul>
3474 </td></tr></table></dd></dl>
3476 !! end
3478 !!test
3479 Table / list interaction: lists nested in tables nested in indented lists
3480 !! wikitext
3492 !! html
3493 <dl><dd><table>
3494 <tr>
3495 <td>
3496 <dl><dd>a</dd>
3497 <dd>b</dd></dl>
3498 </td>
3499 <td>
3500 <ul><li>c</li>
3501 <li>d</li></ul>
3502 </td></tr></table></dd></dl>
3503 <ul><li>e</li>
3504 <li>f</li></ul>
3506 !!end
3508 !! test
3509 Definition Lists: Nesting: Multi-level (Parsoid only)
3510 !! options
3511 parsoid
3512 !! wikitext
3513 ;t1 :d1
3514 ;;t2 ::d2
3515 ;;;t3 :::d3
3516 !! html
3517 <dl>
3518   <dt>t1 </dt>
3519   <dd>d1</dd>
3520   <dt>
3521     <dl>
3522       <dt>t2 </dt>
3523       <dd>:d2</dd>
3524       <dt>
3525         <dl>
3526           <dt>t3 </dt>
3527           <dd>::d3</dd>
3528         </dl>
3529       </dt>
3530     </dl>
3531   </dt>
3532 </dl>
3535 !! end
3538 !! test
3539 Definition Lists: Nesting: Test 2 (Parsoid only)
3540 !! options
3541 parsoid
3542 !! wikitext
3544 ::d2
3545 !! html
3546 <dl>
3547   <dt>t1</dt>
3548   <dd>
3549     <dl>
3550       <dd>d2</dd>
3551     </dl>
3552   </dd>
3553 </dl>
3555 !! end
3558 !! test
3559 Definition Lists: Nesting: Test 3 (Parsoid only)
3560 !! options
3561 parsoid
3562 !! wikitext
3563 :;t1
3564 ::::d2
3565 !! html
3566 <dl>
3567   <dd>
3568     <dl>
3569       <dt>t1</dt>
3570       <dd>
3571         <dl>
3572           <dd>
3573             <dl>
3574               <dd>d2</dd>
3575             </dl>
3576           </dd>
3577         </dl>
3578       </dd>
3579     </dl>
3580   </dd>
3581 </dl>
3583 !! end
3586 !! test
3587 Definition Lists: Nesting: Test 4
3588 !! wikitext
3589 ::;t3
3590 :::d3
3591 !! html
3592 <dl><dd><dl><dd><dl><dt>t3</dt>
3593 <dd>d3</dd></dl></dd></dl></dd></dl>
3595 !! end
3598 ## The Parsoid team believes the following three test exposes a
3599 ## bug in the PHP parser.  (Parsoid team thinks the PHP parser is
3600 ## wrong to close the <dl> after the <dt> containing the <ul>.)
3601 ## It also exposes a "misfeature" in tidy, which doesn't like
3602 ## <dl> tags with a single <dt> child; it converts the <dt> into
3603 ## a <dd> in that case.  (Parsoid leaves the <dt> alone!)
3604 !! test
3605 Definition Lists: Mixed Lists: Test 1
3606 !! wikitext
3607 :;* foo
3608 ::* bar
3609 :; baz
3610 !! html/php
3611 <dl><dd><dl><dt><ul><li> foo</li>
3612 <li> bar</li></ul></dt></dl>
3613 <dl><dt> baz</dt></dl></dd></dl>
3615 !! html/php+tidy
3616 <dl>
3617 <dd>
3618 <dl>
3619 <dd>
3620 <ul>
3621 <li>foo</li>
3622 <li>bar</li>
3623 </ul>
3624 </dd>
3625 </dl>
3626 <dl>
3627 <dt>baz</dt>
3628 </dl>
3629 </dd>
3630 </dl>
3631 !! html/parsoid
3632 <dl>
3633 <dd><dl>
3634 <dt><ul>
3635 <li> foo
3636 </li>
3637 </ul></dt>
3638 <dd><ul>
3639 <li> bar
3640 </li>
3641 </ul></dd>
3642 <dt> baz</dt>
3643 </dl></dd>
3644 </dl>
3645 !! end
3647 !! test
3648 Definition Lists: Mixed Lists: Test 2
3649 !! wikitext
3650 *: d1
3651 *: d2
3652 !! html
3653 <ul><li><dl><dd> d1</dd>
3654 <dd> d2</dd></dl></li></ul>
3656 !! end
3659 !! test
3660 Definition Lists: Mixed Lists: Test 3
3661 !! wikitext
3662 *::: d1
3663 *::: d2
3664 !! html
3665 <ul><li><dl><dd><dl><dd><dl><dd> d1</dd>
3666 <dd> d2</dd></dl></dd></dl></dd></dl></li></ul>
3668 !! end
3671 !! test
3672 Definition Lists: Mixed Lists: Test 4
3673 !! wikitext
3674 *;d1 :d2
3675 *;d3 :d4
3676 !! html
3677 <ul><li><dl><dt>d1&#160;</dt>
3678 <dd>d2</dd>
3679 <dt>d3&#160;</dt>
3680 <dd>d4</dd></dl></li></ul>
3682 !! end
3685 !! test
3686 Definition Lists: Mixed Lists: Test 5
3687 !! wikitext
3688 *:d1
3689 *:: d2
3690 !! html
3691 <ul><li><dl><dd>d1
3692 <dl><dd> d2</dd></dl></dd></dl></li></ul>
3694 !! end
3697 !! test
3698 Definition Lists: Mixed Lists: Test 6
3699 !! wikitext
3700 #*:d1
3701 #*::: d3
3702 !! html
3703 <ol><li><ul><li><dl><dd>d1
3704 <dl><dd><dl><dd> d3</dd></dl></dd></dl></dd></dl></li></ul></li></ol>
3706 !! end
3709 !! test
3710 Definition Lists: Mixed Lists: Test 7
3711 !! wikitext
3712 :* d1
3713 :* d2
3714 !! html
3715 <dl><dd><ul><li> d1</li>
3716 <li> d2</li></ul></dd></dl>
3718 !! end
3721 !! test
3722 Definition Lists: Mixed Lists: Test 8
3723 !! wikitext
3724 :* d1
3725 ::* d2
3726 !! html
3727 <dl><dd><ul><li> d1</li></ul>
3728 <dl><dd><ul><li> d2</li></ul></dd></dl></dd></dl>
3730 !! end
3733 !! test
3734 Definition Lists: Mixed Lists: Test 9
3735 !! wikitext
3736 *;foo :bar
3737 !! html
3738 <ul><li><dl><dt>foo&#160;</dt>
3739 <dd>bar</dd></dl></li></ul>
3741 !! end
3744 !! test
3745 Definition Lists: Mixed Lists: Test 10
3746 !! wikitext
3747 *#;foo :bar
3748 !! html
3749 <ul><li><ol><li><dl><dt>foo&#160;</dt>
3750 <dd>bar</dd></dl></li></ol></li></ul>
3752 !! end
3754 # The Parsoid team disagrees with the PHP parser's seemingly-random
3755 # rules regarding dd/dt on the next two tests.  Parsoid is more
3756 # consistent, and recognizes the shared nesting and keeps the
3757 # still-open tags around until the nesting is complete.
3758 # (And tidy again converts <dt> to <dd> before 'bar'.)
3760 !! test
3761 Definition Lists: Mixed Lists: Test 11
3762 !! wikitext
3763 *#*#;*;;foo :bar
3764 *#*#;boo :baz
3765 !! html/php
3766 <ul><li><ol><li><ul><li><ol><li><dl><dt>foo&#160;</dt>
3767 <dd><ul><li><dl><dt><dl><dt>bar</dt></dl></dd></dl></li></ul></dd></dl>
3768 <dl><dt>boo&#160;</dt>
3769 <dd>baz</dd></dl></li></ol></li></ul></li></ol></li></ul>
3771 !! html/php+tidy
3772 <ul>
3773 <li>
3774 <ol>
3775 <li>
3776 <ul>
3777 <li>
3778 <ol>
3779 <li>
3780 <dl>
3781 <dt>foo&#160;</dt>
3782 <dd>
3783 <ul>
3784 <li>
3785 <dl>
3786 <dd>
3787 <dl>
3788 <dt>bar</dt>
3789 </dl>
3790 </dd>
3791 </dl>
3792 </li>
3793 </ul>
3794 </dd>
3795 </dl>
3796 <dl>
3797 <dt>boo&#160;</dt>
3798 <dd>baz</dd>
3799 </dl>
3800 </li>
3801 </ol>
3802 </li>
3803 </ul>
3804 </li>
3805 </ol>
3806 </li>
3807 </ul>
3808 !! html/parsoid
3809 <ul>
3810 <li>
3811 <ol>
3812 <li>
3813 <ul>
3814 <li>
3815 <ol>
3816 <li>
3817 <dl>
3818 <dt>
3819 <ul>
3820 <li>
3821 <dl>
3822 <dt>
3823 <dl>
3824 <dt>foo<span typeof="mw:Placeholder" data-parsoid='{"src":" "}'>&nbsp;</span></dt>
3825 <dd data-parsoid='{"stx":"row"}'>bar</dd>
3826 </dl></dt>
3827 </dl></li>
3828 </ul></dt>
3829 <dt>boo<span typeof="mw:Placeholder" data-parsoid='{"src":" "}'>&nbsp;</span></dt>
3830 <dd data-parsoid='{"stx":"row"}'>baz</dd>
3831 </dl></li>
3832 </ol></li>
3833 </ul></li>
3834 </ol></li>
3835 </ul>
3836 !! end
3839 # Another case where tidy converts a <dt> to a <dd> (but Parsoid doesn't).
3840 !! test
3841 Definition Lists: Weird Ones: Test 1
3842 !! wikitext
3843 *#;*::;; foo : bar (who uses this?)
3844 !! html/php
3845 <ul><li><ol><li><dl><dt> foo&#160;</dt>
3846 <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>
3848 !! html/php+tidy
3849 <ul>
3850 <li>
3851 <ol>
3852 <li>
3853 <dl>
3854 <dt>foo&#160;</dt>
3855 <dd>
3856 <ul>
3857 <li>
3858 <dl>
3859 <dd>
3860 <dl>
3861 <dd>
3862 <dl>
3863 <dd>
3864 <dl>
3865 <dt>bar (who uses this?)</dt>
3866 </dl>
3867 </dd>
3868 </dl>
3869 </dd>
3870 </dl>
3871 </dd>
3872 </dl>
3873 </li>
3874 </ul>
3875 </dd>
3876 </dl>
3877 </li>
3878 </ol>
3879 </li>
3880 </ul>
3881 !! html/parsoid
3882 <ul>
3883 <li>
3884 <ol>
3885 <li>
3886 <dl>
3887 <dt>
3888 <ul>
3889 <li>
3890 <dl>
3891 <dd>
3892 <dl>
3893 <dd>
3894 <dl>
3895 <dt>
3896 <dl>
3897 <dt> foo<span typeof="mw:Placeholder" data-parsoid='{"src":" "}'>&nbsp;</span></dt>
3898 <dd data-parsoid='{"stx":"row"}'> bar (who uses this?)</dd>
3899 </dl></dt>
3900 </dl></dd>
3901 </dl></dd>
3902 </dl></li>
3903 </ul></dt>
3904 </dl></li>
3905 </ol></li>
3906 </ul>
3907 !! end
3909 !! test
3910 Definition Lists: colons occurring in tags
3911 !! wikitext
3912 ;a:b
3913 ;'''a:b'''
3914 ;<i>a:b</i>
3915 ;<span>a:b</span>
3916 ;<div>a:b</div>
3917 ;{{echo|a:b}}
3918 ;{{echo|''a:b''}}
3919 !! html
3920 <dl><dt>a</dt>
3921 <dd>b</dd>
3922 <dt><b>a:b</b></dt>
3923 <dt><i>a:b</i></dt>
3924 <dt><span>a:b</span></dt>
3925 <dt><div>a:b</div></dt>
3926 <dt>a</dt>
3927 <dd>b</dd>
3928 <dt><i>a:b</i></dt></dl>
3930 !! end
3932 !! test
3933 Definition Lists: colons and tables 1
3934 !! wikitext
3936 | x
3939 | y
3941 !! html
3942 <dl><dd><table>
3943 <tr>
3944 <td> x
3945 </td></tr></table></dd></dl>
3946 <dl><dd><table>
3947 <tr>
3948 <td> y
3949 </td></tr></table></dd></dl>
3951 !! end
3953 # Parsoid's output (as documented below) differs from php's in this case.
3954 # This is probably a bug. If we fixup parsoid to match php's output, the
3955 # above test should pass and the below test case can be removed. It is
3956 # unclear which output is more desirable.
3958 !! test
3959 Definition Lists: colons and tables 2
3960 !! wikitext
3962 | x
3965 | y
3967 !! html/parsoid
3968 <dl><dd><table>
3969 <tr>
3970 <td> x
3971 </td></tr></table></dd>
3972 <dd><table>
3973 <tr>
3974 <td> y
3975 </td></tr></table></dd></dl>
3976 !! end
3980 ### External links
3982 !! test
3983 External links: non-bracketed
3984 !! wikitext
3985 Non-bracketed: http://example.com
3986 !! html
3987 <p>Non-bracketed: <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
3988 </p>
3989 !! end
3991 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
3992 !! test
3993 External links: numbered
3994 !! wikitext
3995 Numbered: [http://example.com]
3996 Numbered: [http://example.net]
3997 Numbered: [http://example.com]
3998 !! html/php
3999 <p>Numbered: <a rel="nofollow" class="external autonumber" href="http://example.com">[1]</a>
4000 Numbered: <a rel="nofollow" class="external autonumber" href="http://example.net">[2]</a>
4001 Numbered: <a rel="nofollow" class="external autonumber" href="http://example.com">[3]</a>
4002 </p>
4003 !! html/parsoid
4004 <p>Numbered: <a rel="mw:ExtLink" href="http://example.com"></a>
4005 Numbered: <a rel="mw:ExtLink" href="http://example.net"></a>
4006 Numbered: <a rel="mw:ExtLink" href="http://example.com"></a></p>
4007 !!end
4009 !! test
4010 External links: specified text
4011 !! wikitext
4012 Specified text: [http://example.com link]
4013 !! html
4014 <p>Specified text: <a rel="nofollow" class="external text" href="http://example.com">link</a>
4015 </p>
4016 !!end
4018 !! test
4019 External links: trail
4020 !! wikitext
4021 Linktrails should not work for external links: [http://example.com link]s
4022 !! html
4023 <p>Linktrails should not work for external links: <a rel="nofollow" class="external text" href="http://example.com">link</a>s
4024 </p>
4025 !! end
4027 !! test
4028 External links: dollar sign in URL
4029 !! wikitext
4030 http://example.com/1$2345
4031 !! html
4032 <p><a rel="nofollow" class="external free" href="http://example.com/1$2345">http://example.com/1$2345</a>
4033 </p>
4034 !! end
4036 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
4037 !! test
4038 External links: dollar sign in URL (autonumber)
4039 !! wikitext
4040 [http://example.com/1$2345]
4041 !! html/php
4042 <p><a rel="nofollow" class="external autonumber" href="http://example.com/1$2345">[1]</a>
4043 </p>
4044 !! html/parsoid
4045 <p><a rel="mw:ExtLink" href="http://example.com/1$2345"></a></p>
4046 !!end
4048 !! test
4049 External links: open square bracket forbidden in URL (bug 4377)
4050 !! options
4051 parsoid=wt2html,wt2wt,html2html
4052 !! wikitext
4053 http://example.com/1[2345
4054 !! html/php
4055 <p><a rel="nofollow" class="external free" href="http://example.com/1">http://example.com/1</a>[2345
4056 </p>
4057 !! html/parsoid
4058 <p><a rel="mw:ExtLink" href="http://example.com/1">http://example.com/1</a>[2345</p>
4059 !! end
4061 !! test
4062 External links: open square bracket forbidden in URL (named) (bug 4377)
4063 !! options
4064 parsoid=wt2html,html2html
4065 !! wikitext
4066 [http://example.com/1[2345]
4067 !! html/php
4068 <p><a rel="nofollow" class="external text" href="http://example.com/1">[2345</a>
4069 </p>
4070 !! html/parsoid
4071 <p><a rel="mw:ExtLink" href="http://example.com/1">[2345</a></p>
4072 !!end
4074 # parsoid adds a space before the link name
4075 !! test
4076 External links: open square bracket forbidden in URL (named) (bug 4377)
4077 Parsoid variant.
4078 !! wikitext
4079 [http://example.com/1 [2345]
4080 !! html
4081 <p><a rel="nofollow" class="external text" href="http://example.com/1">[2345</a>
4082 </p>
4083 !!end
4085 !! test
4086 External links: nowiki in URL link text (bug 6230)
4087 !! wikitext
4088 [http://example.com/ <nowiki>''example site''</nowiki>]
4089 !! html
4090 <p><a rel="nofollow" class="external text" href="http://example.com/">''example site''</a>
4091 </p>
4092 !! end
4094 !! test
4095 External links: newline forbidden in text (bug 6230 regression check)
4096 !! wikitext
4097 [http://example.com/ first
4098 second]
4099 !! html
4100 <p>[<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a> first
4101 second]
4102 </p>
4103 !!end
4105 !! test
4106 External links: Pipe char between url and text
4107 !! wikitext
4108 [http://example.com | link]
4109 !! html
4110 <p><a rel="nofollow" class="external text" href="http://example.com">| link</a>
4111 </p>
4112 !!end
4114 !! test
4115 External links: protocol-relative URL in brackets
4116 !! wikitext
4117 [//example.com/ Test]
4118 !! html
4119 <p><a rel="nofollow" class="external text" href="//example.com/">Test</a>
4120 </p>
4121 !! end
4123 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
4124 !! test
4125 External links: protocol-relative URL in brackets without text
4126 !! wikitext
4127 [//example.com]
4128 !! html/php
4129 <p><a rel="nofollow" class="external autonumber" href="//example.com">[1]</a>
4130 </p>
4131 !! html/parsoid
4132 <p><a rel="mw:ExtLink" href="//example.com"></a></p>
4133 !! end
4135 !! test
4136 External links: protocol-relative URL in free text is left alone
4137 !! wikitext
4138 //example.com/Foo
4139 !! html
4140 <p>//example.com/Foo
4141 </p>
4142 !!end
4144 !! test
4145 External links: protocol-relative URL in the middle of a word is left alone (bug 30269)
4146 !! wikitext
4147 foo//example.com/Foo
4148 !! html
4149 <p>foo//example.com/Foo
4150 </p>
4151 !! end
4153 !! test
4154 External links: with no contents
4155 !! wikitext
4156 [http://en.wikipedia.org/wiki/Foo]
4158 [[wikipedia:Foo|Bar]]
4160 [[wikipedia:Foo|<span>Bar</span>]]
4161 !! html/php
4162 <p><a rel="nofollow" class="external autonumber" href="http://en.wikipedia.org/wiki/Foo">[1]</a>
4163 </p><p><a href="http://en.wikipedia.org/wiki/Foo" class="extiw" title="wikipedia:Foo">Bar</a>
4164 </p><p><a href="http://en.wikipedia.org/wiki/Foo" class="extiw" title="wikipedia:Foo"><span>Bar</span></a>
4165 </p>
4166 !! html/parsoid
4167 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo"></a></p>
4168 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo" title="wikipedia:Foo">Bar</a></p>
4169 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo" title="wikipedia:Foo"><span>Bar</span></a></p>
4170 !! end
4172 !! test
4173 External links: Free with trailing punctuation
4174 !! wikitext
4175 http://example.com,
4176 http://example.com;
4177 http://example.com\
4178 http://example.com.
4179 http://example.com:
4180 http://example.com!
4181 http://example.com?
4182 http://example.com)
4183 http://example.com/url_with_(brackets)
4184 (http://example.com/url_without_brackets)
4185 http://example.com/url_with_entity&nbsp;
4186 http://example.com/url_with_entity&#xA0;
4187 http://example.com/url_with_entity&#160;
4188 http://example.com/url_with_entity&lt;
4189 http://example.com/url_with_entity&#x3C;
4190 http://example.com/url_with_entity&#60;
4191 !! html
4192 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>,
4193 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>;
4194 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>\
4195 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>.
4196 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>:
4197 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>!
4198 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>?
4199 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
4200 <a rel="nofollow" class="external free" href="http://example.com/url_with_(brackets)">http://example.com/url_with_(brackets)</a>
4201 (<a rel="nofollow" class="external free" href="http://example.com/url_without_brackets">http://example.com/url_without_brackets</a>)
4202 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity ">http://example.com/url_with_entity </a>
4203 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity ">http://example.com/url_with_entity </a>
4204 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity ">http://example.com/url_with_entity </a>
4205 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&lt;
4206 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity%3C">http://example.com/url_with_entity%3C</a>
4207 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity%3C">http://example.com/url_with_entity%3C</a>
4208 </p>
4209 !! end
4211 !! test
4212 External links: No preceding word characters allowed (bug 65278)
4213 !! wikitext
4214 NOPEhttp://example.com
4215 N0http://example.com
4216 ok:http://example.com
4217 ok-http://example.com
4218 !! html
4219 <p>NOPEhttp://example.com
4220 N0http://example.com
4221 ok:<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4222 ok-<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4223 </p>
4224 !! end
4226 !! test
4227 External image
4228 !! wikitext
4229 External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
4230 !! html
4231 <p>External image: <img src="http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" />
4232 </p>
4233 !! end
4235 !! test
4236 External image from https
4237 !! wikitext
4238 External image from https: https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
4239 !! html
4240 <p>External image from https: <img src="https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" />
4241 </p>
4242 !! end
4244 !! test
4245 External image (when not allowed)
4246 !! options
4247 wgAllowExternalImages=0
4248 !! wikitext
4249 External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
4250 !! html
4251 <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>
4252 </p>
4253 !! end
4255 !! test
4256 Link to non-http image, no img tag
4257 !! wikitext
4258 Link to non-http image, no img tag: ftp://example.com/test.jpg
4259 !! html
4260 <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>
4261 </p>
4262 !! end
4264 !! test
4265 External links: terminating separator
4266 !! wikitext
4267 Terminating separator: http://example.com/thing,
4268 !! html
4269 <p>Terminating separator: <a rel="nofollow" class="external free" href="http://example.com/thing">http://example.com/thing</a>,
4270 </p>
4271 !! end
4273 !! test
4274 External links: intervening separator
4275 !! wikitext
4276 Intervening separator: http://example.com/1,2,3
4277 !! html
4278 <p>Intervening separator: <a rel="nofollow" class="external free" href="http://example.com/1,2,3">http://example.com/1,2,3</a>
4279 </p>
4280 !! end
4282 !! test
4283 External links: old bug with URL in query
4284 !! wikitext
4285 Old bug with URL in query: [http://example.com/thing?url=http://example.com link]
4286 !! html
4287 <p>Old bug with URL in query: <a rel="nofollow" class="external text" href="http://example.com/thing?url=http://example.com">link</a>
4288 </p>
4289 !! end
4291 !! test
4292 External links: old URL-in-URL bug, mixed protocols
4293 !! wikitext
4294 And again with mixed protocols: [ftp://example.com?url=http://example.com link]
4295 !! html
4296 <p>And again with mixed protocols: <a rel="nofollow" class="external text" href="ftp://example.com?url=http://example.com">link</a>
4297 </p>
4298 !!end
4300 !! test
4301 External links: URL in text
4302 !! wikitext
4303 URL in text: [http://example.com http://example.com]
4304 !! html
4305 <p>URL in text: <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4306 </p>
4307 !! end
4309 !! test
4310 External links: Clickable images
4311 !! wikitext
4312 ja-style clickable images: [http://example.com http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png]
4313 !! html
4314 <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>
4315 </p>
4316 !!end
4318 !! test
4319 External links: raw ampersand
4320 !! wikitext
4321 Old &amp; use: http://x&y
4322 !! html
4323 <p>Old &amp; use: <a rel="nofollow" class="external free" href="http://x&amp;y">http://x&amp;y</a>
4324 </p>
4325 !! end
4327 !! test
4328 External links: encoded ampersand
4329 !! wikitext
4330 Old &amp; use: http://x&amp;y
4331 !! html/php
4332 <p>Old &amp; use: <a rel="nofollow" class="external free" href="http://x&amp;y">http://x&amp;y</a>
4333 </p>
4334 !! html/parsoid
4335 <p>Old <span typeof="mw:Entity">&amp;</span> use: <a rel="mw:ExtLink" href="http://x&amp;y">http://x&amp;y</a></p>
4336 !! end
4338 !! test
4339 External links: encoded equals (bug 6102)
4340 !! wikitext
4341 http://example.com/?foo&#61;bar
4342 !! html/php
4343 <p><a rel="nofollow" class="external free" href="http://example.com/?foo=bar">http://example.com/?foo=bar</a>
4344 </p>
4345 !! html/parsoid
4346 <p><a rel="mw:ExtLink" href="http://example.com/?foo=bar">http://example.com/?foo=bar</a></p>
4347 !! end
4350 ## Note that parsoid doesn't explicit mark autonumbered links, nor
4351 ## does it number them.  As discussed in bug 53505, we can identify
4352 ## autonumbered links via CSS.
4355 !! test
4356 External links: [raw ampersand]
4357 !! wikitext
4358 Old &amp; use: [http://x&y]
4359 !! html/php
4360 <p>Old &amp; use: <a rel="nofollow" class="external autonumber" href="http://x&amp;y">[1]</a>
4361 </p>
4362 !! html/parsoid
4363 <p>Old <span typeof="mw:Entity">&amp;</span> use: <a rel="mw:ExtLink" href="http://x&amp;y"></a></p>
4364 !! end
4366 # note that parsoid html is identical to [raw ampersand] case; so html2wt
4367 # mode will return the [raw ampersand] wikitext
4368 !! test
4369 External links: [encoded ampersand]
4370 !! options
4371 parsoid=wt2html,wt2wt,html2html
4372 !! wikitext
4373 Old &amp; use: [http://x&amp;y]
4374 !! html/php
4375 <p>Old &amp; use: <a rel="nofollow" class="external autonumber" href="http://x&amp;y">[1]</a>
4376 </p>
4377 !! html/parsoid
4378 <p>Old <span typeof="mw:Entity">&amp;</span> use: <a rel="mw:ExtLink" href="http://x&amp;y"></a></p>
4379 !! end
4381 !! test
4382 External links: [raw equals]
4383 !! wikitext
4384 [http://example.com/?foo=bar]
4385 !! html/php
4386 <p><a rel="nofollow" class="external autonumber" href="http://example.com/?foo=bar">[1]</a>
4387 </p>
4388 !! html/parsoid
4389 <p><a rel="mw:ExtLink" href="http://example.com/?foo=bar"></a></p>
4390 !! end
4392 # note that parsoid html is identical to [raw equals] case; so html2wt
4393 # mode will return the [raw equals] wikitext
4394 !! test
4395 External links: [encoded equals] (bug 6102)
4396 !! options
4397 parsoid=wt2html,wt2wt,html2html
4398 !! wikitext
4399 [http://example.com/?foo&#61;bar]
4400 !! html/php
4401 <p><a rel="nofollow" class="external autonumber" href="http://example.com/?foo=bar">[1]</a>
4402 </p>
4403 !! html/parsoid
4404 <p><a rel="mw:ExtLink" href="http://example.com/?foo=bar"></a></p>
4405 !! end
4407 # xxx parsoid strips the IDN character, so the round-trip tests will
4408 #     obviously fail and are disabled. --cscott
4409 !! test
4410 External links: [IDN ignored character reference in hostname; strip it right off]
4411 !! options
4412 parsoid=wt2html,wt2wt,html2html
4413 !! wikitext
4414 [http://e&zwnj;xample.com/]
4415 !! html/php
4416 <p><a rel="nofollow" class="external autonumber" href="http://example.com/">[1]</a>
4417 </p>
4418 !! html/parsoid
4419 <p><a rel="mw:ExtLink" href="http://example.com/"></a></p>
4420 !! end
4422 # FIXME: This test (the IDN characters in the text of a link) is an inconsistency.
4423 # Where an external link could easily circumvent the sanitization of the text of
4424 # a link like this (where an IDN-ignore character is in the URL somewhere), this
4425 # test demands a higher standard. That's a bit strange.
4427 # Example:
4429 # http://e‌xample.com -> [http://example.com|http://example.com]
4430 # [http://example.com|http://e‌xample.com] -> [http://example.com|http://e‌xample.com]
4432 # The first example is sanitized, but the second is not. Any security benefits
4433 # from this production are trivial to circumvent. Either remove this test and
4434 # let the parser(s) do their thing unaccosted, or fix the inconsistency and change
4435 # the test accordingly.
4437 # All our love,
4438 # The Parsoid team.
4439 # xxx parsoid strips the IDN character, so the round-trip tests will
4440 #     obviously fail and are disabled. --cscott
4441 !! test
4442 External links: IDN ignored character reference in hostname; strip it right off
4443 !! options
4444 parsoid=wt2html,html2html
4445 !! wikitext
4446 http://e&zwnj;xample.com/
4447 !! html/php
4448 <p><a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>
4449 </p>
4450 !! html/parsoid
4451 <p><a rel="mw:ExtLink" href="http://example.com/">http://example.com/</a></p>
4452 !! end
4454 !! test
4455 External links: www.jpeg.org (bug 554)
4456 !! wikitext
4457 http://www.jpeg.org
4458 !! html
4459 <p><a rel="nofollow" class="external free" href="http://www.jpeg.org">http://www.jpeg.org</a>
4460 </p>
4461 !! end
4463 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
4464 !! test
4465 External links: URL within URL (original bug 2)
4466 !! wikitext
4467 [http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp]
4468 !! html/php
4469 <p><a rel="nofollow" class="external autonumber" href="http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp">[1]</a>
4470 </p>
4471 !! html/parsoid
4472 <p><a rel="mw:ExtLink" href="http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp"></a></p>
4473 !! end
4475 !! test
4476 BUG 361: URL inside bracketed URL
4477 !! wikitext
4478 [http://www.example.com/foo http://www.example.com/bar]
4479 !! html
4480 <p><a rel="nofollow" class="external text" href="http://www.example.com/foo">http://www.example.com/bar</a>
4481 </p>
4482 !! end
4484 !! test
4485 BUG 361: URL within URL, not bracketed
4486 !! wikitext
4487 http://www.example.com/foo?=http://www.example.com/bar
4488 !! html
4489 <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>
4490 </p>
4491 !! end
4493 !! test
4494 BUG 289: ">"-token in URL-tail
4495 !! wikitext
4496 http://www.example.com/<hello>
4497 !! html
4498 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a>&lt;hello&gt;
4499 </p>
4500 !!end
4502 !! test
4503 BUG 289: literal ">"-token in URL-tail
4504 !! wikitext
4505 http://www.example.com/<b>html</b>
4506 !! html
4507 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a><b>html</b>
4508 </p>
4509 !!end
4511 !! test
4512 BUG 289: ">"-token in bracketed URL
4513 !! wikitext
4514 [http://www.example.com/<hello> stuff]
4515 !! html
4516 <p><a rel="nofollow" class="external text" href="http://www.example.com/">&lt;hello&gt; stuff</a>
4517 </p>
4518 !!end
4520 !! test
4521 BUG 289: literal ">"-token in bracketed URL
4522 !! wikitext
4523 [http://www.example.com/<b>html</b> stuff]
4524 !! html
4525 <p><a rel="nofollow" class="external text" href="http://www.example.com/"><b>html</b> stuff</a>
4526 </p>
4527 !!end
4529 !! test
4530 BUG 289: literal double quote at end of URL
4531 !! wikitext
4532 http://www.example.com/"hello"
4533 !! html
4534 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a>"hello"
4535 </p>
4536 !!end
4538 !! test
4539 BUG 289: literal double quote in bracketed URL
4540 !! wikitext
4541 [http://www.example.com/"hello" stuff]
4542 !! html
4543 <p><a rel="nofollow" class="external text" href="http://www.example.com/">"hello" stuff</a>
4544 </p>
4545 !!end
4547 !! test
4548 External links: multiple legal whitespace is fine, Magnus. Don't break it please. (bug 5081)
4549 !! wikitext
4550 [http://www.example.com  test]
4551 !! html
4552 <p><a rel="nofollow" class="external text" href="http://www.example.com">test</a>
4553 </p>
4554 !! end
4556 !! test
4557 External links: link text with spaces
4558 !! wikitext
4559 [http://www.example.com a b c]
4560 [http://www.example.com ''a'' ''b'']
4561 !! html
4562 <p><a rel="nofollow" class="external text" href="http://www.example.com">a b c</a>
4563 <a rel="nofollow" class="external text" href="http://www.example.com"><i>a</i> <i>b</i></a>
4564 </p>
4565 !! end
4567 !! test
4568 External links: wiki links within external link (Bug 3695)
4569 !! wikitext
4570 [http://example.com [[wikilink]] embedded in ext link]
4571 !! html/php
4572 <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>
4573 </p>
4574 !! html/parsoid
4575 <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>
4576 !! end
4578 !! test
4579 BUG 787: Links with one slash after the url protocol are invalid
4580 !! wikitext
4581 http:/example.com
4583 [http:/example.com title]
4584 !! html
4585 <p>http:/example.com
4586 </p><p>[http:/example.com title]
4587 </p>
4588 !! end
4590 !! test
4591 Bracketed external links with template-generated invalid target
4592 !! wikitext
4593 [{{echo|http:/example.com}} title]
4594 !! html
4595 <p>[http:/example.com title]
4596 </p>
4597 !! end
4599 !! test
4600 Bug 2702: Mismatched <i>, <b> and <a> tags are invalid
4601 !! wikitext
4602 ''[http://example.com text'']
4603 [http://example.com '''text]'''
4604 ''Something [http://example.com in italic'']
4605 ''Something [http://example.com mixed''''', even bold]'''
4606 '''''Now [http://example.com both''''']
4607 !! html
4608 <p><a rel="nofollow" class="external text" href="http://example.com"><i>text</i></a>
4609 <a rel="nofollow" class="external text" href="http://example.com"><b>text</b></a>
4610 <i>Something </i><a rel="nofollow" class="external text" href="http://example.com"><i>in italic</i></a>
4611 <i>Something </i><a rel="nofollow" class="external text" href="http://example.com"><i>mixed</i><b>, even bold</b></a>
4612 <i><b>Now </b></i><a rel="nofollow" class="external text" href="http://example.com"><i><b>both</b></i></a>
4613 </p>
4614 !! end
4617 !! test
4618 Bug 4781: %26 in URL
4619 !! wikitext
4620 http://www.example.com/?title=AT%26T
4621 !! html/php
4622 <p><a rel="nofollow" class="external free" href="http://www.example.com/?title=AT%26T">http://www.example.com/?title=AT%26T</a>
4623 </p>
4624 !! html/parsoid
4625 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=AT%26T">http://www.example.com/?title=AT%26T</a></p>
4626 !! end
4628 # According to http://dev.w3.org/html5/spec/Overview.html#parsing-urls a plain
4629 # % is actually legal in HTML5. Any change in output would need testing though.
4630 !! test
4631 Bug 4781, 5267: %25 in URL
4632 !! wikitext
4633 http://www.example.com/?title=100%25_Bran
4634 !! html/php
4635 <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>
4636 </p>
4637 !! html/parsoid
4638 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=100%25_Bran">http://www.example.com/?title=100%25_Bran</a></p>
4639 !! end
4641 !! test
4642 Bug 4781, 5267: %28, %29 in URL
4643 !! wikitext
4644 http://www.example.com/?title=Ben-Hur_%281959_film%29
4645 !! html/php
4646 <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>
4647 </p>
4648 !! html/parsoid
4649 <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>
4650 !! end
4653 !! test
4654 Bug 4781: %26 in autonumber URL
4655 !! wikitext
4656 [http://www.example.com/?title=AT%26T]
4657 !! html/php
4658 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=AT%26T">[1]</a>
4659 </p>
4660 !! html/parsoid
4661 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=AT%26T"></a></p>
4662 !! end
4664 !! test
4665 Bug 4781, 5267: %26 in autonumber URL
4666 !! wikitext
4667 [http://www.example.com/?title=100%25_Bran]
4668 !! html/php
4669 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=100%25_Bran">[1]</a>
4670 </p>
4671 !! html/parsoid
4672 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=100%25_Bran"></a></p>
4673 !! end
4675 !! test
4676 Bug 4781, 5267: %28, %29 in autonumber URL
4677 !! wikitext
4678 [http://www.example.com/?title=Ben-Hur_%281959_film%29]
4679 !! html/php
4680 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">[1]</a>
4681 </p>
4682 !! html/parsoid
4683 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=Ben-Hur_%281959_film%29"></a></p>
4684 !! end
4687 !! test
4688 Bug 4781: %26 in bracketed URL
4689 !! wikitext
4690 [http://www.example.com/?title=AT%26T link]
4691 !! html/php
4692 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=AT%26T">link</a>
4693 </p>
4694 !! html/parsoid
4695 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=AT%26T">link</a></p>
4696 !! end
4698 !! test
4699 Bug 4781, 5267: %25 in bracketed URL
4700 !! wikitext
4701 [http://www.example.com/?title=100%25_Bran link]
4702 !! html
4703 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=100%25_Bran">link</a>
4704 </p>
4705 !! end
4707 !! test
4708 Bug 4781, 5267: %28, %29 in bracketed URL
4709 !! wikitext
4710 [http://www.example.com/?title=Ben-Hur_%281959_film%29 link]
4711 !! html/php
4712 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">link</a>
4713 </p>
4714 !! html/parsoid
4715 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">link</a></p>
4716 !! end
4718 !! test
4719 External link containing a period in the anchor. (bug 63947)
4720 !! wikitext
4721 [//foo.org/bar#baz. bang]
4723 [//foo.org/bar. bang]
4724 !! html/php
4725 <p><a rel="nofollow" class="external text" href="//foo.org/bar#baz.">bang</a>
4726 </p><p><a rel="nofollow" class="external text" href="//foo.org/bar.">bang</a>
4727 </p>
4728 !! html/parsoid
4729 <p><a rel="mw:ExtLink" href="//foo.org/bar#baz.">bang</a></p>
4730 <p><a rel="mw:ExtLink" href="//foo.org/bar.">bang</a></p>
4731 !! end
4733 !! test
4734 External link containing a single quote. (bug 63947)
4735 !! wikitext
4736 [//foo.org/bar'baz]
4738 [//foo.org/bar'baz bang]
4739 !! html/php
4740 <p><a rel="nofollow" class="external autonumber" href="//foo.org/bar'baz">[1]</a>
4741 </p><p><a rel="nofollow" class="external text" href="//foo.org/bar'baz">bang</a>
4742 </p>
4743 !! html/parsoid
4744 <p><a rel="mw:ExtLink" href="//foo.org/bar'baz"></a></p>
4745 <p><a rel="mw:ExtLink" href="//foo.org/bar'baz">bang</a></p>
4746 !! end
4749 !! test
4750 External link containing a period in the anchor. (bug 63947)
4751 !! wikitext
4752 [//foo.org/bar#baz. bang]
4754 [//foo.org/bar. bang]
4755 !! html/php
4756 <p><a rel="nofollow" class="external text" href="//foo.org/bar#baz.">bang</a>
4757 </p><p><a rel="nofollow" class="external text" href="//foo.org/bar.">bang</a>
4758 </p>
4759 !! html/parsoid
4760 <p><a rel="mw:ExtLink" href="//foo.org/bar#baz.">bang</a></p>
4761 <p><a rel="mw:ExtLink" href="//foo.org/bar.">bang</a></p>
4762 !! end
4764 !! test
4765 External link containing a single quote. (bug 63947)
4766 !! wikitext
4767 [//foo.org/bar'baz]
4769 [//foo.org/bar'baz bang]
4770 !! html/php
4771 <p><a rel="nofollow" class="external autonumber" href="//foo.org/bar'baz">[1]</a>
4772 </p><p><a rel="nofollow" class="external text" href="//foo.org/bar'baz">bang</a>
4773 </p>
4774 !! html/parsoid
4775 <p><a rel="mw:ExtLink" href="//foo.org/bar'baz"></a></p>
4776 <p><a rel="mw:ExtLink" href="//foo.org/bar'baz">bang</a></p>
4777 !! end
4780 !! test
4781 External link containing double-single-quotes in text '' (bug 4598 sanity check)
4782 !! wikitext
4783 Some [http://example.com/ pretty ''italics'' and stuff]!
4784 !! html
4785 <p>Some <a rel="nofollow" class="external text" href="http://example.com/">pretty <i>italics</i> and stuff</a>!
4786 </p>
4787 !! end
4789 !! test
4790 External link containing double-single-quotes in text embedded in italics (bug 4598 sanity check)
4791 !! wikitext
4792 ''Some [http://example.com/ pretty ''italics'' and stuff]!''
4793 !! html
4794 <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>
4795 </p>
4796 !! end
4798 !! test
4799 External link containing double-single-quotes with no space separating the url from text in italics
4800 !! wikitext
4801 [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]].]
4802 !! html/php
4803 <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>
4804 </p>
4805 !! html/php+tidy
4806 <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>
4807 !! html/parsoid
4808 <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>
4809 !! end
4811 !! test
4812 External link with comments in link text
4813 !! wikitext
4814 [http://www.google.com Google <!-- comment -->]
4815 !! html
4816 <p><a rel="nofollow" class="external text" href="http://www.google.com">Google </a>
4817 </p>
4818 !! end
4820 !! test
4821 URL-encoding in URL functions (single parameter)
4822 !! wikitext
4823 {{localurl:Some page|amp=&}}
4824 !! html
4825 <p>/index.php?title=Some_page&amp;amp=&amp;
4826 </p>
4827 !! end
4829 !! test
4830 URL-encoding in URL functions (multiple parameters)
4831 !! wikitext
4832 {{localurl:Some page|q=?&amp=&}}
4833 !! html
4834 <p>/index.php?title=Some_page&amp;q=?&amp;amp=&amp;
4835 </p>
4836 !! end
4838 !! test
4839 Brackets in urls
4840 !! wikitext
4841 http://example.com/index.php?foozoid%5B%5D=bar
4843 http://example.com/index.php?foozoid&#x5B;&#x5D;=bar
4844 !! html/php
4845 <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>
4846 </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>
4847 </p>
4848 !! html/parsoid
4849 <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>
4851 <p><a rel="mw:ExtLink" href="http://example.com/index.php?foozoid[]=bar">http://example.com/index.php?foozoid[]=bar</a></p>
4852 !! end
4854 !! test
4855 IPv6 urls (bug 21261)
4856 !! options
4857 disabled
4858 !! wikitext
4859 http://[2404:130:0:1000::187:2]/index.php
4860 !! html
4861 <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>
4862 </p>
4863 !! end
4865 !! test
4866 Non-extlinks in brackets
4867 !! wikitext
4868 [foo]
4869 [foo bar]
4870 [foo ''bar'']
4871 [fool's] errand
4872 [fool's errand]
4873 [{{echo|foo}}]
4874 [{{echo|foo}} bar]
4875 [{{echo|foo}} ''bar'']
4876 [{{echo|foo}}l's] errand
4877 [{{echo|foo}}l's errand]
4878 [url={{echo|foo}}]
4879 [url=http://example.com]
4880 !! html
4881 <p>[foo]
4882 [foo bar]
4883 [foo <i>bar</i>]
4884 [fool's] errand
4885 [fool's errand]
4886 [foo]
4887 [foo bar]
4888 [foo <i>bar</i>]
4889 [fool's] errand
4890 [fool's errand]
4891 [url=foo]
4892 [url=<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>]
4893 </p>
4894 !! end
4896 !! test
4897 Percent encoding in external links
4898 !! wikitext
4899 [https://github.com/search?l=&q=ResourceLoader+%40wikimedia Search]
4900 !! html/php
4901 <p><a rel="nofollow" class="external text" href="https://github.com/search?l=&amp;q=ResourceLoader+%40wikimedia">Search</a>
4902 </p>
4903 !! html/parsoid
4904 <p><a rel="mw:ExtLink"
4905 href="https://github.com/search?l=&amp;q=ResourceLoader+%40wikimedia">Search</a></p>
4906 !! end
4908 !! test
4909 Use url link syntax for links where the content is equal the link target
4910 !! wikitext
4911 http://example.com
4912 !! html/php
4913 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4914 </p>
4915 !! html/parsoid
4916 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a></p>
4917 !! end
4919 !! test
4920 Parenthesis in external links, especially URL links
4921 !! wikitext
4922 http://example.com)
4924 http://example.com/test)
4926 http://example.com/(test)
4928 http://example.com/((test)
4930 (http://example.com/(test))
4932 (http://example.com/(test)))))
4934 http://example.com/a)b
4936 [http://example.com) foo]
4937 !! html/php
4938 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
4939 </p><p><a rel="nofollow" class="external free" href="http://example.com/test">http://example.com/test</a>)
4940 </p><p><a rel="nofollow" class="external free" href="http://example.com/(test)">http://example.com/(test)</a>
4941 </p><p><a rel="nofollow" class="external free" href="http://example.com/((test)">http://example.com/((test)</a>
4942 </p><p>(<a rel="nofollow" class="external free" href="http://example.com/(test))">http://example.com/(test))</a>
4943 </p><p>(<a rel="nofollow" class="external free" href="http://example.com/(test)))))">http://example.com/(test)))))</a>
4944 </p><p><a rel="nofollow" class="external free" href="http://example.com/a)b">http://example.com/a)b</a>
4945 </p><p><a rel="nofollow" class="external text" href="http://example.com)">foo</a>
4946 </p>
4947 !! html/parsoid
4948 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a>)</p>
4949 <p><a rel="mw:ExtLink" href="http://example.com/test">http://example.com/test</a>)</p>
4950 <p><a rel="mw:ExtLink" href="http://example.com/(test)">http://example.com/(test)</a></p>
4951 <p><a rel="mw:ExtLink" href="http://example.com/((test)">http://example.com/((test)</a></p>
4952 <p>(<a rel="mw:ExtLink" href="http://example.com/(test))">http://example.com/(test))</a></p>
4953 <p>(<a rel="mw:ExtLink" href="http://example.com/(test)))))">http://example.com/(test)))))</a></p>
4954 <p><a rel="mw:ExtLink" href="http://example.com/a)b">http://example.com/a)b</a></p>
4955 <p><a rel="mw:ExtLink" href="http://example.com)">foo</a></p>
4956 !! end
4958 !! test
4959 Parenthesis in external links, w/ transclusion or comment
4960 !! wikitext
4961 (http://example.com/{{echo|hi}})
4963 (http://example.com<!-- hi -->)
4964 !! html/php
4965 <p>(<a rel="nofollow" class="external free" href="http://example.com/hi">http://example.com/hi</a>)
4966 </p><p>(<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
4967 </p>
4968 !! html/parsoid
4969 <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=\"{&amp;quot;pi&amp;quot;:[[{&amp;quot;k&amp;quot;:&amp;quot;1&amp;quot;,&amp;quot;spc&amp;quot;:[&amp;quot;&amp;quot;,&amp;quot;&amp;quot;,&amp;quot;&amp;quot;,&amp;quot;&amp;quot;]}]],&amp;quot;dsr&amp;quot;:[20,31,null,null]}\" data-mw=\"{&amp;quot;parts&amp;quot;:[{&amp;quot;template&amp;quot;:{&amp;quot;target&amp;quot;:{&amp;quot;wt&amp;quot;:&amp;quot;echo&amp;quot;,&amp;quot;href&amp;quot;:&amp;quot;./Template:Echo&amp;quot;},&amp;quot;params&amp;quot;:{&amp;quot;1&amp;quot;:{&amp;quot;wt&amp;quot;:&amp;quot;hi&amp;quot;}},&amp;quot;i&amp;quot;:0}}]}\">hi&lt;/span>"}]]}'>http://example.com/hi</a>)</p>
4971 <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>
4972 !! end
4974 !! test
4975 Replace invalid link targets when serializing
4976 !! options
4977 parsoid=html2wt
4978 !! html
4979 <a rel="mw:WikiLink" href="./]] foo [[bar">Manual</a>
4980 !! wikitext
4981 [[MediaWiki:Badtitletext|Manual]]
4982 !! end
4985 ### Quotes
4988 !! test
4989 Quotes
4990 !! wikitext
4991 Normal text. '''Bold text.''' Normal text. ''Italic text.''
4993 Normal text. '''''Bold italic text.''''' Normal text.
4994 !! html
4995 <p>Normal text. <b>Bold text.</b> Normal text. <i>Italic text.</i>
4996 </p><p>Normal text. <i><b>Bold italic text.</b></i> Normal text.
4997 </p>
4998 !! end
5001 # Parsoid inserts an empty bold tag pair at the end of the line, that the PHP
5002 # parser strips. The wikitext contains just the first half of the bold
5003 # quote pair.
5004 !! test
5005 Unclosed and unmatched quotes
5006 !! wikitext
5007 '''''Bold italic text '''with bold deactivated''' in between.'''''
5009 '''''Bold italic text ''with italic deactivated'' in between.'''''
5011 '''Bold text..
5013 ..spanning two paragraphs (should not work).'''
5015 '''Bold tag left open
5017 ''Italic tag left open
5019 Normal text.
5021 <!-- Unmatching number of opening, closing tags: -->
5022 '''This year''''s election ''should'' beat '''last year''''s.
5024 ''Tom'''s car is bigger than ''Susan'''s.
5026 Plain ''italic'''s plain
5027 !! html/php
5028 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
5029 </p><p><b><i>Bold italic text </i>with italic deactivated<i> in between.</i></b>
5030 </p><p><b>Bold text..</b>
5031 </p><p>..spanning two paragraphs (should not work).
5032 </p><p><b>Bold tag left open</b>
5033 </p><p><i>Italic tag left open</i>
5034 </p><p>Normal text.
5035 </p><p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
5036 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
5037 </p><p>Plain <i>italic'</i>s plain
5038 </p>
5039 !! html/parsoid
5040 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
5041 </p><p><b><i>Bold italic text </i>with italic deactivated<i> in between.</i></b>
5042 </p><p><b>Bold text..</b>
5043 </p><p>..spanning two paragraphs (should not work).<b></b>
5044 </p><p><b>Bold tag left open</b>
5045 </p><p><i>Italic tag left open</i>
5046 </p><p>Normal text.
5047 </p><p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
5048 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
5049 </p><p>Plain <i>italic'</i>s plain
5050 </p>
5051 !! end
5054 ### Tables
5056 ### some content taken from http://meta.wikimedia.org/wiki/MediaWiki_User%27s_Guide:_Using_tables
5059 # This should not produce <table></table> as <table><tr><td></td></tr></table>
5060 # is the bare minimum required by the spec, see:
5061 # http://www.w3.org/TR/xhtml-modularization/dtd_module_defs.html#a_module_Basic_Tables
5062 # Parsoid team replies: empty table tags are legal in HTML5
5063 !! test
5064 A table with no data.
5065 !! options
5066 parsoid=wt2html
5067 !! wikitext
5068 {||}
5069 !! html/php
5071 !! html/parsoid
5072 <table></table>
5074 !! end
5076 !! test
5077 A table with stray table end tags on start tag line (wt2html)
5078 !! options
5079 parsoid=wt2html
5080 !! wikitext
5081 {|style="color: red;"|}
5083 {|style="color: red;" |}
5084 |foo
5087 {|style="color: red;"|} id="foo"
5088 |foo
5091 {|style="color: red;" |} id="foo"
5092 |foo
5094 !! html
5095 <table style="color: red;"></table>
5097 <table style="color: red;">
5098 <tbody><tr>
5099 <td>foo</td>
5100 </tr></tbody>
5101 </table>
5103 <table style="color: red;" id="foo">
5104 <tbody><tr>
5105 <td>foo</td>
5106 </tr></tbody>
5107 </table>
5109 <table style="color: red;" id="foo">
5110 <tbody><tr>
5111 <td>foo</td>
5112 </tr></tbody>
5113 </table>
5115 !! end
5117 !! test
5118 A table with no data (take 2)
5119 !! wikitext
5122 !! html/parsoid
5123 <table></table>
5124 !! end
5126 # A table with nothing but a caption is invalid XHTML, we might want to render
5127 # this as <p>caption</p>
5128 # Parsoid team replies: table with only a caption is legal in HTML5
5129 !! test
5130 A table with nothing but a caption
5131 !! wikitext
5133 |+ caption
5135 !! html/php
5136 <table>
5137 <caption> caption
5138 </caption><tr><td></td></tr></table>
5140 !! html/parsoid
5141 <table><caption> caption</caption></table>
5142 !! end
5144 !! test
5145 A table with caption with default-spaced attributes and a table row
5146 !! wikitext
5148 |+ style="color: red;" | caption1
5150 | foo
5152 !! html
5153 <table>
5154 <caption style="color: red;"> caption1
5155 </caption>
5156 <tr>
5157 <td> foo
5158 </td></tr></table>
5160 !! end
5162 !! test
5163 A table with captions with non-default spaced attributes and a table row
5164 !! wikitext
5166 |+style="color: red;"|caption2
5167 |+ style="color: red;"| caption3
5169 | foo
5171 !! html
5172 <table>
5173 <caption style="color: red;">caption2
5174 </caption>
5175 <caption style="color: red;"> caption3
5176 </caption>
5177 <tr>
5178 <td> foo
5179 </td></tr></table>
5181 !! end
5183 !! test
5184 Table td-cell syntax variations
5185 !! wikitext
5187 | foo bar foo | baz
5188 | foo bar foo || baz
5189 | style='color:red;' | baz
5190 | style='color:red;' || baz
5192 !! html
5193 <table>
5194 <tr>
5195 <td> baz
5196 </td>
5197 <td> foo bar foo </td>
5198 <td> baz
5199 </td>
5200 <td style="color:red;"> baz
5201 </td>
5202 <td> style='color:red;' </td>
5203 <td> baz
5204 </td></tr></table>
5206 !! end
5208 !! test
5209 Simple table
5210 !! wikitext
5212 | 1 || 2
5214 | 3 || 4
5216 !! html
5217 <table>
5218 <tr>
5219 <td> 1 </td>
5220 <td> 2
5221 </td></tr>
5222 <tr>
5223 <td> 3 </td>
5224 <td> 4
5225 </td></tr></table>
5227 !! end
5229 !! test
5230 Simple table but with multiple dashes for row wikitext
5231 !! wikitext
5233 | foo
5234 |-----
5235 | bar
5237 !! html
5238 <table>
5239 <tr>
5240 <td> foo
5241 </td></tr>
5242 <tr>
5243 <td> bar
5244 </td></tr></table>
5246 !! end
5247 !! test
5248 Multiplication table
5249 !! wikitext
5250 {| border="1" cellpadding="2"
5251 |+Multiplication table
5253 ! &times; !! 1 !! 2 !! 3
5255 ! 1
5256 | 1 || 2 || 3
5258 ! 2
5259 | 2 || 4 || 6
5261 ! 3
5262 | 3 || 6 || 9
5264 ! 4
5265 | 4 || 8 || 12
5267 ! 5
5268 | 5 || 10 || 15
5270 !! html
5271 <table border="1" cellpadding="2">
5272 <caption>Multiplication table
5273 </caption>
5274 <tr>
5275 <th> &#215; </th>
5276 <th> 1 </th>
5277 <th> 2 </th>
5278 <th> 3
5279 </th></tr>
5280 <tr>
5281 <th> 1
5282 </th>
5283 <td> 1 </td>
5284 <td> 2 </td>
5285 <td> 3
5286 </td></tr>
5287 <tr>
5288 <th> 2
5289 </th>
5290 <td> 2 </td>
5291 <td> 4 </td>
5292 <td> 6
5293 </td></tr>
5294 <tr>
5295 <th> 3
5296 </th>
5297 <td> 3 </td>
5298 <td> 6 </td>
5299 <td> 9
5300 </td></tr>
5301 <tr>
5302 <th> 4
5303 </th>
5304 <td> 4 </td>
5305 <td> 8 </td>
5306 <td> 12
5307 </td></tr>
5308 <tr>
5309 <th> 5
5310 </th>
5311 <td> 5 </td>
5312 <td> 10 </td>
5313 <td> 15
5314 </td></tr></table>
5316 !! end
5318 !! test
5319 Accept "||" in table headings
5320 !! wikitext
5322 !h1 || h2
5324 !! html
5325 <table>
5326 <tr>
5327 <th>h1 </th>
5328 <th> h2
5329 </th></tr></table>
5331 !! end
5333 !! test
5334 Accept "!!" in table data
5335 !! wikitext
5337 | Foo!! ||
5339 !! html
5340 <table>
5341 <tr>
5342 <td> Foo!! </td>
5343 <td>
5344 </td></tr></table>
5346 !! html/parsoid
5347 <table>
5348 <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>
5349 </tbody></table>
5350 !! end
5352 !! test
5353 Accept "||" in indented table headings
5354 !! wikitext
5356 !h1 || h2
5358 !! html
5359 <dl><dd><table>
5360 <tr>
5361 <th>h1 </th>
5362 <th> h2
5363 </th></tr></table></dd></dl>
5365 !! end
5367 !! test
5368 Accept empty attributes in td/th cells (td/th cells starting with leading ||)
5369 !! wikitext
5371 !| h1
5372 || a
5374 !! html
5375 <table>
5376 <tr>
5377 <th> h1
5378 </th>
5379 <td> a
5380 </td></tr></table>
5382 !! end
5384 !!test
5385 Accept "| !" at start of line in tables (ignore !-attribute)
5386 !! wikitext
5389 | !style="color:red" | bar
5391 !! html
5392 <table>
5394 <tr>
5395 <td> bar
5396 </td></tr></table>
5398 !!end
5400 !!test
5401 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 +/- 
5402 !! wikitext
5405 |style='color:red;'|+1
5406 |style='color:blue;'|-1
5408 | 1 || 2 || 3
5409 | 1 ||+2 ||-3
5411 | +1
5412 | -1
5414 !! html
5415 <table>
5417 <tr>
5418 <td style="color:red;">+1
5419 </td>
5420 <td style="color:blue;">-1
5421 </td></tr>
5422 <tr>
5423 <td> 1 </td>
5424 <td> 2 </td>
5425 <td> 3
5426 </td>
5427 <td> 1 </td>
5428 <td>+2 </td>
5429 <td>-3
5430 </td></tr>
5431 <tr>
5432 <td> +1
5433 </td>
5434 <td> -1
5435 </td></tr></table>
5437 !!end
5439 !! test
5440 Table rowspan
5441 !! wikitext
5442 {| border=1
5443 | Cell 1, row 1
5444 |rowspan=2| Cell 2, row 1 (and 2)
5445 | Cell 3, row 1
5447 | Cell 1, row 2
5448 | Cell 3, row 2
5450 !! html
5451 <table border="1">
5452 <tr>
5453 <td> Cell 1, row 1
5454 </td>
5455 <td rowspan="2"> Cell 2, row 1 (and 2)
5456 </td>
5457 <td> Cell 3, row 1
5458 </td></tr>
5459 <tr>
5460 <td> Cell 1, row 2
5461 </td>
5462 <td> Cell 3, row 2
5463 </td></tr></table>
5465 !! end
5467 !! test
5468 Nested table
5469 !! wikitext
5470 {| border=1
5471 | &alpha;
5473 {| bgcolor=#ABCDEF border=2
5474 |nested
5476 |table
5478 |the original table again
5480 !! html
5481 <table border="1">
5482 <tr>
5483 <td> &#945;
5484 </td>
5485 <td>
5486 <table bgcolor="#ABCDEF" border="2">
5487 <tr>
5488 <td>nested
5489 </td></tr>
5490 <tr>
5491 <td>table
5492 </td></tr></table>
5493 </td>
5494 <td>the original table again
5495 </td></tr></table>
5497 !! end
5499 !! test
5500 Invalid attributes in table cell (bug 1830)
5501 !! wikitext
5503 |Cell:|broken
5505 !! html
5506 <table>
5507 <tr>
5508 <td>broken
5509 </td></tr></table>
5511 !! end
5514 # The "|}" to close the table is missing from the input, so parsoid's
5515 # *2wt modes will fail.
5516 !! test
5517 Table security: embedded pipes (http://lists.wikimedia.org/mailman/htdig/wikitech-l/2006-April/022293.html)
5518 !! options
5519 parsoid=wt2html,html2html
5520 !! wikitext
5522 | |[ftp://|x||]" onmouseover="alert(document.cookie)">test
5523 !! html/php
5524 <table>
5525 <tr>
5526 <td>[<a rel="nofollow" class="external free" href="ftp://%7Cx">ftp://%7Cx</a></td>
5527 <td>]" onmouseover="alert(document.cookie)"&gt;test
5528 </td>
5529 </tr>
5530 </table>
5532 !! html/parsoid
5533 <table><tbody>
5534 <tr>
5535 <td><a rel="mw:ExtLink" href="ftp://|x||"></a>" onmouseover="alert(document.cookie)">test</td></tr></tbody></table>
5536 !! end
5539 !! test
5540 Indented table markup mixed with indented pre content (proposed in bug 6200)
5541 !! wikitext
5542  <table>
5543  <tr>
5544  <td>
5545  Text that should be rendered preformatted
5546  </td>
5547  </tr>
5548  </table>
5549 !! html
5550  <table>
5551  <tr>
5552  <td>
5553 <pre>Text that should be rendered preformatted
5554 </pre>
5555  </td>
5556  </tr>
5557  </table>
5559 !! end
5561 !! test
5562 Template-generated table cell attributes and cell content
5563 !! wikitext
5565 |{{table_attribs}}
5566 | {{table_attribs}}
5567 | <!--foo--> <!--bar--> <!--baz--> {{table_attribs}}
5568 |align=center {{table_attribs}}
5569 | <!--foo--> align=center <!--bar--> {{table_attribs}}
5571 !! html
5572 <table>
5573 <tr>
5574 <td style="color: red"> Foo
5575 </td>
5576 <td style="color: red"> Foo
5577 </td>
5578 <td style="color: red"> Foo
5579 </td>
5580 <td align="center" style="color: red"> Foo
5581 </td>
5582 <td align="center" style="color: red"> Foo
5583 </td></tr></table>
5585 !! end
5587 !! test
5588 Template-generated table cell attributes and cell content (2)
5589 !! wikitext
5591 |align=center {{table_cells}}
5593 !! html
5594 <table>
5595 <tr>
5596 <td align="center" style="color: red"> Foo </td>
5597 <td> Bar </td>
5598 <td> Baz
5599 </td></tr></table>
5601 !! end
5603 !! test
5604 Table with row followed by newlines and table heading
5605 !! wikitext
5609 ! foo
5611 !! html
5612 <table>
5615 <tr>
5616 <th> foo
5617 </th></tr></table>
5619 !! end
5621 !! test
5622 Table with empty line following the start tag
5623 !! wikitext
5627 | foo
5629 !! html
5630 <table>
5633 <tr>
5634 <td> foo
5635 </td></tr></table>
5637 !! end
5639 # FIXME: Preserve the attribute properly (with an empty string as value) in
5640 # the PHP parser. Parsoid implements the behavior below.
5641 !! test
5642 Table attributes with empty value
5643 !! wikitext
5645 | style=| hello
5647 !! html/parsoid
5648 <table>
5649 <tbody>
5650 <tr>
5651 <td style=""> hello
5652 </td></tr></tbody></table>
5654 !! end
5656 !! test
5657 Wikitext table with a lot of comments
5658 !! wikitext
5660 <!-- c0 -->
5661 | foo
5662 <!-- c1 -->
5663 |- <!-- c2 -->
5664 <!-- c3 -->
5665 |<!-- c4 -->
5666 <!-- c5 -->
5668 !! html
5669 <table>
5670 <tr>
5671 <td> foo
5672 </td></tr>
5673 <tr>
5674 <td>
5675 </td></tr></table>
5677 !! end
5679 !! test
5680 Wikitext table with double-line table cell
5681 !! wikitext
5686 !! html
5687 <table>
5688 <tr>
5689 <td>a
5690 <p>b
5691 </p>
5692 </td></tr></table>
5694 !! end
5696 !! test
5697 Table cell with a single comment
5698 !! wikitext
5700 | <!-- c1 -->
5701 | a
5703 !! html
5704 <table>
5705 <tr>
5706 <td>
5707 </td>
5708 <td> a
5709 </td></tr></table>
5711 !! end
5713 !! test
5714 Table-cell after a comment-only-empty-line
5715 !! wikitext
5718 <!--c1-->
5719 <!--c2-->| b
5721 !! html
5722 <table>
5723 <tr>
5724 <td>a
5725 </td>
5726 <td> b
5727 </td></tr></table>
5729 !! html/parsoid
5730 <table>
5731 <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'>a</td>
5732 <!--c1-->
5733 <!--c2--><td data-parsoid='{"autoInsertedEnd":true}'> b</td></tr>
5734 </tbody></table>
5736 !! end
5738 !! test
5739 Build table with {{!}}
5740 !! wikitext
5741 {{{!}} class="wikitable"
5742 ! header
5743 ! second header
5744 {{!}}- style="color:red;"
5745 {{!}} data {{!}}{{!}} style="color:red;" {{!}} second data
5746 {{!}}}
5747 !! html
5748 <table class="wikitable">
5749 <tr>
5750 <th> header
5751 </th>
5752 <th> second header
5753 </th></tr>
5754 <tr style="color:red;">
5755 <td> data </td>
5756 <td style="color:red;"> second data
5757 </td></tr></table>
5759 !! end
5761 !! test
5762 Build table with pipe as data
5763 !! wikitext
5764 {| class="wikitable"
5765 ! header
5766 ! second header
5767 |- style="color:red;"
5768 | data || style="color:red;" | second data
5770 | style="color:red;" | data with | || style="color:red;" | second data with |
5772 || data with | ||| second data with |
5774 !! html
5775 <table class="wikitable">
5776 <tr>
5777 <th> header
5778 </th>
5779 <th> second header
5780 </th></tr>
5781 <tr style="color:red;">
5782 <td> data </td>
5783 <td style="color:red;"> second data
5784 </td></tr>
5785 <tr>
5786 <td style="color:red;"> data with | </td>
5787 <td style="color:red;"> second data with |
5788 </td></tr>
5789 <tr>
5790 <td> data with | </td>
5791 <td> second data with |
5792 </td></tr></table>
5794 !! end
5796 !! test
5797 Build table with wikilink
5798 !! wikitext
5799 {| class="wikitable"
5800 ! header || second header
5801 |- style="color:red;"
5802 | data [[Main Page|linktext]] || second data [[Main Page|linktext]]
5804 | data || second data [[Main Page|link|text with pipe]]
5806 !! html
5807 <table class="wikitable">
5808 <tr>
5809 <th> header </th>
5810 <th> second header
5811 </th></tr>
5812 <tr style="color:red;">
5813 <td> data <a href="/wiki/Main_Page" title="Main Page">linktext</a> </td>
5814 <td> second data <a href="/wiki/Main_Page" title="Main Page">linktext</a>
5815 </td></tr>
5816 <tr>
5817 <td> data </td>
5818 <td> second data <a href="/wiki/Main_Page" title="Main Page">link|text with pipe</a>
5819 </td></tr></table>
5821 !! end
5823 # The expected HTML structure in this test is debatable. The PHP parser does
5824 # not parse this kind of table at all. The main focus for Parsoid is on
5825 # round-tripping, so this output is ok for now. TODO: revisit!
5826 !! test
5827 Wikitext table with html-syntax row
5828 !! wikitext
5831 <td>foo</td>
5833 !! html/parsoid
5834 <table>
5835 <tbody>
5836 <tr>
5837 <td>foo</td></tr></tbody></table>
5838 !! end
5840 ## Note that Parsoid output differs from PHP and PHP+tidy here.
5841 ## The lack of <tr> tags in the PHP output is arguably a bug in the
5842 ## PHP parser, which tidy then compounds by fostering the content
5843 ## entirely out of the table.  Parsoid recognizes the table context
5844 ## and generates <tr> and <td> wrappers as needed.  Hopefully nobody
5845 ## depends on PHP's treatment of broken table markup!
5846 !! test
5847 Implicit <td> after a |-
5848 !! options
5849 parsoid=wt2html,html2html
5850 !! wikitext
5855 !! html/php
5856 <table>
5859 </table>
5861 !! html/php+tidy
5862 <p>a</p>
5863 !! html/parsoid
5864 <table>
5865 <tr><td>a</td></tr>
5866 </table>
5867 !! end
5869 # Again, Parsoid adds implicit <td>s here, PHP and Tidy strip the b out.
5870 !! test
5871 <pre> tags should be recognized in an explicit <td> context, but not in an implicit <td> context
5872 !! options
5873 parsoid=wt2html,html2html
5874 !! wikitext
5882 !! html/php
5883 <table>
5885 <tr>
5886 <td>
5887 <pre>a
5888 </pre>
5889 </td></tr>
5891 </table>
5893 !! html/php+tidy
5894 <p>b</p>
5895 <table>
5896 <tr>
5897 <td>
5898 <pre>
5900 </pre></td>
5901 </tr>
5902 </table>
5903 !! html/parsoid
5904 <table>
5905 <tbody>
5906 <tr><td><pre>a</pre></td></tr>
5907 <tr><td> b</td></tr>
5908 </tbody>
5909 </table>
5910 !! end
5912 # PHP + Tidy strips the list out of the table; Parsoid wraps it.
5913 # Parsoid generates the missing <td>, so wt2wt won't succeed.
5914 !! test
5915 Lists should be recognized in an implicit <td> context
5916 !! options
5917 parsoid=wt2html,html2html
5918 !! wikitext
5923 !! html/php
5924 <table>
5926 <ul><li>a</li></ul>
5927 </table>
5929 !! html/php+tidy
5930 <ul>
5931 <li>a</li>
5932 </ul>
5933 !! html/parsoid
5934 <table>
5935 <tr>
5936 <td><ul>
5937 <li>a</li>
5938 </ul></td>
5939 </tr>
5940 </table>
5941 !! end
5943 !! test
5944 Parsoid: Round-trip tables directly followed by content (bug 51219)
5945 !! options
5946 parsoid=wt2html,wt2wt
5947 !! wikitext
5949 |foo
5950 |} bar
5953 |baz
5954 |}<b>quux</b>
5955 !! html+tidy
5956 <table>
5957 <tr>
5958 <td>foo</td>
5959 </tr>
5960 </table>
5961 <p>bar</p>
5962 <table>
5963 <tr>
5964 <td>baz</td>
5965 </tr>
5966 </table>
5967 <p><b>quux</b></p>
5968 !! end
5970 !! test
5971 Parsoid: Default to a newline after tables in new content (bug 51219)
5972 !! options
5973 parsoid=html2wt
5974 !! wikitext
5976 |foo
5978 <nowiki> </nowiki>bar
5980 |baz
5982 '''quux'''
5983 !! html
5984 <table><tbody>
5985 <tr><td>foo</td></tr></tbody></table> bar
5986 <table><tbody>
5987 <tr><td>baz</td></tr></tbody></table><b>quux</b>
5988 !! end
5990 !! test
5991 Parsoid: newline inducing block nodes don't suppress <nowiki>
5992 !! options
5993 parsoid=html2wt
5994 !! wikitext
5995 <nowiki> </nowiki>a
5997 = foo =
5998 !! html
5999  a<h1>foo</h1>
6000 !! end
6002 !! test
6003 Parsoid: Row-syntax table headings followed by comment & table cells
6004 !! options
6005 parsoid=wt2html,wt2wt
6006 !! wikitext
6008 ! foo || bar
6009 <!-- foo -->  || baz || quux
6011 !! html/php
6012 <table>
6013 <tr>
6014 <th> foo </th>
6015 <th> bar
6016 </th>
6017 <td> baz </td>
6018 <td> quux
6019 </td></tr></table>
6021 !! html/parsoid
6022 <table>
6023 <tbody><tr><th> foo </th><th> bar
6024 <!-- foo -->  </th><td> baz </td><td> quux</td></tr>
6025 </tbody></table>
6026 !! end
6029 # PHP throws away the (semi-broken) "foo" class here; Parsoid
6030 # preserves it.
6031 !!test
6032 Parsoid: Recover better from broken table attributes
6033 !!options
6034 parsoid=wt2html
6035 !!wikitext
6036 {| class="foo
6037 | class="bar" |
6040 !!html/php+tidy
6041 <table>
6042 <tr>
6043 <td class="bar">
6044 <p>foo</p>
6045 </td>
6046 </tr>
6047 </table>
6048 !!html/parsoid
6049 <table class="foo">
6050 <tr>
6051 <td class="bar">
6052 <p>foo</p></td></tr>
6053 </tbody></table>
6054 !!end
6056 !! test
6057 Strip unsupported table tags
6058 !! options
6059 parsoid=html2wt
6060 !! html
6061 <table>
6062 <thead>
6063 <tr>
6064 <th>Month</th>
6065 <th>Savings</th>
6066 </tr>
6067 </thead>
6068 <tbody>
6069 <tr>
6070 <td>January</td>
6071 <td>$100</td>
6072 </tr>
6073 <tr>
6074 <td>February</td>
6075 <td>$80</td>
6076 </tr>
6077 </tbody>
6078 <tfoot>
6079 <tr>
6080 <td>Sum</td>
6081 <td>$180</td>
6082 </tr>
6083 </tfoot>
6084 </table>
6085 !! wikitext
6088 !Month
6089 !Savings
6091 |January
6092 |$100
6095 |February
6096 |$80
6098 |Sum
6099 |$180
6102 !! end
6105 ### Internal links
6107 !! test
6108 Plain link, capitalized
6109 !! wikitext
6110 [[Main Page]]
6111 !! html
6112 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
6113 </p>
6114 !! end
6116 !! test
6117 Plain link, uncapitalized
6118 !! wikitext
6119 [[main Page]]
6120 !! html
6121 <p><a href="/wiki/Main_Page" title="Main Page">main Page</a>
6122 </p>
6123 !! end
6125 !! test
6126 Piped link
6127 !! wikitext
6128 [[Main Page|The Main Page]]
6129 !! html
6130 <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
6131 </p>
6132 !! end
6134 !! test
6135 Piped link with comment in link text
6136 !! wikitext
6137 [[Main Page|The Main<!--front--> Page]]
6138 !! html
6139 <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
6140 </p>
6141 !! end
6143 !! test
6144 Piped link with multiple pipe characters in link text
6145 !! wikitext
6146 [[Main Page||The|Main|Page|]]
6147 !! html/php
6148 <p><a href="/wiki/Main_Page" title="Main Page">|The|Main|Page|</a>
6149 </p>
6150 !! html/parsoid
6151 <p><a rel="mw:WikiLink" href="Main_Page" title="Main Page">|The|Main|Page|</a></p>
6152 !! end
6154 !! test
6155 Broken link
6156 !! wikitext
6157 [[Zigzagzogzagzig]]
6158 !! html
6159 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig</a>
6160 </p>
6161 !! end
6163 !! test
6164 Broken link with fragment
6165 !! wikitext
6166 [[Zigzagzogzagzig#zug]]
6167 !! html
6168 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig#zug</a>
6169 </p>
6170 !! end
6172 !! test
6173 Special page link with fragment
6174 !! wikitext
6175 [[Special:Version#anchor]]
6176 !! html
6177 <p><a href="/wiki/Special:Version#anchor" title="Special:Version">Special:Version#anchor</a>
6178 </p>
6179 !! end
6181 !! test
6182 Nonexistent special page link with fragment
6183 !! wikitext
6184 [[Special:ThisNameWillHopefullyNeverBeUsed#anchor]]
6185 !! html
6186 <p><a href="/wiki/Special:ThisNameWillHopefullyNeverBeUsed" class="new" title="Special:ThisNameWillHopefullyNeverBeUsed (page does not exist)">Special:ThisNameWillHopefullyNeverBeUsed#anchor</a>
6187 </p>
6188 !! end
6190 !! test
6191 Link with prefix
6192 !! wikitext
6193 xxx[[main Page]], xxx[[Main Page]], Xxx[[main Page]] XXX[[main Page]], XXX[[Main Page]]
6194 !! html
6195 <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>
6196 </p>
6197 !! end
6199 !! test
6200 Link with suffix
6201 !! wikitext
6202 [[Main Page]]xxx, [[Main Page]]XXX, [[Main Page]]!!!
6203 !! html
6204 <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>!!!
6205 </p>
6206 !! end
6208 !! article
6209 prefixed article
6210 !! text
6211 Some text
6212 !! endarticle
6214 !! test
6215 Bug 43661: Piped links with identical prefixes
6216 !! wikitext
6217 [[prefixed article|prefixed articles with spaces]]
6219 [[prefixed article|prefixed articlesaoeu]]
6221 [[Main Page|Main Page test]]
6222 !! html
6223 <p><a href="/wiki/Prefixed_article" title="Prefixed article">prefixed articles with spaces</a>
6224 </p><p><a href="/wiki/Prefixed_article" title="Prefixed article">prefixed articlesaoeu</a>
6225 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page test</a>
6226 </p>
6227 !! end
6230 !! test
6231 Link with HTML entity in suffix / tail
6232 !! wikitext
6233 [[Main Page]]&quot;, [[Main Page]]&#97;
6234 !! html
6235 <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;
6236 </p>
6237 !! end
6239 !! test
6240 Link with 3 brackets
6241 !! wikitext
6242 [[[Main Page]]]
6243 !! html
6244 <p>[[[Main Page]]]
6245 </p>
6246 !! end
6248 !! test
6249 Link with 4 brackets
6250 !! wikitext
6251 [[[[Main Page]]]]
6252 !! html
6253 <p>[[<a href="/wiki/Main_Page" title="Main Page">Main Page</a>]]
6254 </p>
6255 !! end
6257 !! test
6258 Piped link with 3 brackets
6259 !! wikitext
6260 [[[main page|the main page]]]
6261 !! html
6262 <p>[[[main page|the main page]]]
6263 </p>
6264 !! end
6266 !! test
6267 Piped link with extlink-like text
6268 !! wikitext
6269 [[Main Page|[bar]]]
6270 [[Main Page|This is a [bar]]]
6271 !! html
6272 <p><a href="/wiki/Main_Page" title="Main Page">[bar]</a>
6273 <a href="/wiki/Main_Page" title="Main Page">This is a [bar]</a>
6274 </p>
6275 !! end
6277 !! test
6278 Link with multiple pipes
6279 !! wikitext
6280 [[Main Page|The|Main|Page]]
6281 !! html
6282 <p><a href="/wiki/Main_Page" title="Main Page">The|Main|Page</a>
6283 </p>
6284 !! end
6286 # Note that parsoid does not munge anchor text; all non-space
6287 # characters are valid in HTML5 ids.
6288 !! test
6289 Anchor containing a #. (bug 63430)
6290 !! wikitext
6291 [[Main Page#And#Link]]
6292 !! html/php
6293 <p><a href="/wiki/Main_Page#And.23Link" title="Main Page">Main Page#And#Link</a>
6294 </p>
6295 !! html/parsoid
6296 <p><a rel="mw:WikiLink" href="./Main_Page#And%23Link" title="Main Page">Main Page#And#Link</a></p>
6297 !! end
6299 !! test
6300 Link to namespaces
6301 !! wikitext
6302 [[Talk:Parser testing]], [[Meta:Disclaimers]]
6303 !! html
6304 <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>
6305 </p>
6306 !! end
6308 !! test
6309 Link with space in namespace
6310 !! wikitext
6311 [[User talk:Foo bar]]
6312 !! html
6313 <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>
6314 </p>
6315 !! end
6317 !! article
6318 MemoryAlpha:AlphaTest
6319 !! text
6320 This is an article in the MemoryAlpha namespace
6321 (which shadows the memoryalpha interwiki link).
6322 !! endarticle
6324 !! test
6325 Namespace takes precedence over interwiki link (bug 51680)
6326 !! wikitext
6327 [[MemoryAlpha:AlphaTest]]
6328 !! html
6329 <p><a href="/wiki/MemoryAlpha:AlphaTest" title="MemoryAlpha:AlphaTest">MemoryAlpha:AlphaTest</a>
6330 </p>
6331 !! end
6333 # The previous test doesn't work correctly in html2*, due to not recognizing the
6334 # link as an internal one. This one checks for the correct behavior.
6335 !! test
6336 Link to namespace preferred over interwiki with correct rel attribute
6337 !! options
6338 parsoid=html2wt,html2html
6339 !! wikitext
6340 [[MemoryAlpha:AlphaTest]]
6341 !! html
6342 <p><a rel="mw:WikiLink" href="./MemoryAlpha:AlphaTest" title="MemoryAlpha:AlphaTest">MemoryAlpha:AlphaTest</a>
6343 </p>
6344 !! end
6346 !! test
6347 Piped link to namespace
6348 !! wikitext
6349 [[Meta:Disclaimers|The disclaimers]]
6350 !! html
6351 <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>
6352 </p>
6353 !! end
6355 !! test
6356 Link containing }
6357 !! wikitext
6358 [[Usually caused by a typo (oops}]]
6359 !! html
6360 <p>[[Usually caused by a typo (oops}]]
6361 </p>
6362 !! end
6364 !! article
6365 7% Solution
6366 !! text
6367 Just a test of an article title containing a percent.
6368 !! endarticle
6370 !! test
6371 Link containing % (not as a hex sequence)
6372 !! wikitext
6373 [[7% Solution]]
6374 !! html/php
6375 <p><a href="/wiki/7%25_Solution" title="7% Solution">7% Solution</a>
6376 </p>
6377 !! html/parsoid
6378 <p><a rel="mw:WikiLink" href="./7%25_Solution" title="7% Solution">7% Solution</a></p>
6379 !! end
6381 # note that the parsoid HTML is identical to the previous test output,
6382 # so the previous test ensures that the html2wt mode will generate the
6383 # "not as a hex sequence" wikitext.
6384 !! test
6385 Link containing % as a single hex sequence interpreted to char
6386 !! options
6387 parsoid=wt2wt,wt2html,html2html
6388 !! wikitext
6389 [[7%25 Solution]]
6390 !! html/php
6391 <p><a href="/wiki/7%25_Solution" title="7% Solution">7% Solution</a>
6392 </p>
6393 !! html/parsoid
6394 <p><a rel="mw:WikiLink" href="./7%25_Solution" title="7% Solution">7% Solution</a></p>
6395 !!end
6397 !! test
6398 Link containing % as a double hex sequence interpreted to hex sequence
6399 !! wikitext
6400 [[7%2525 Solution]]
6401 !! html
6402 <p>[[7%2525 Solution]]
6403 </p>
6404 !!end
6406 # note that parsoid does not munge anchor text; all non-space
6407 # characters are valid in HTML5 anchors.
6408 !! test
6409 Link containing "#<" and "#>" % as a hex sequences- these are valid section anchors
6410 Example for such a section: == < ==
6411 !! wikitext
6412 [[%23%3c]][[%23%3e]]
6413 !! html/php
6414 <p><a href="#.3C">#&lt;</a><a href="#.3E">#&gt;</a>
6415 </p>
6416 !! html/parsoid
6417 <p><a rel="mw:WikiLink" href="./Main%20Page#%3C" title="Main Page">#&lt;</a><a rel="mw:WikiLink" href="./Main%20Page#%3E" title="Main Page">#></a></p>
6418 !! end
6420 !! test
6421 Link containing "<#" and ">#" as a hex sequences
6422 !! wikitext
6423 [[%3c%23]][[%3e%23]]
6424 !! html
6425 <p>[[%3c%23]][[%3e%23]]
6426 </p>
6427 !! end
6429 !! test
6430 Link containing an equals sign
6431 !! wikitext
6432 [[Special:BookSources/isbn=4-00-026157-6]]
6433 !! html/php
6434 <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>
6435 </p>
6436 !! html/parsoid
6437 <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>
6438 !! end
6440 !! article
6441 Foo~bar
6442 !! text
6443 Just a test of an article title containing a tilde.
6444 !! endarticle
6446 # note that links containing signatures, like [[Foo~~~~]], are
6447 # massaged by the pre-save transform (PST) and so the tildes are never
6448 # seen by the parser.
6449 !! test
6450 Link containing a tilde
6451 !! wikitext
6452 [[Foo~bar]]
6453 !! html/php
6454 <p><a href="/wiki/Foo%7Ebar" title="Foo~bar">Foo~bar</a>
6455 </p>
6456 !! html/parsoid
6457 <p><a rel="mw:WikiLink" href="./Foo~bar" title="Foo~bar">Foo~bar</a></p>
6458 !! end
6460 !! test
6461 Link containing double-single-quotes '' (bug 4598)
6462 !! wikitext
6463 [[Lista d''e paise d''o munno]]
6464 !! html/php
6465 <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>
6466 </p>
6467 !! html/parsoid
6468 <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>
6469 !! end
6471 !! test
6472 Link containing double-single-quotes '' in text (bug 4598 sanity check)
6473 !! wikitext
6474 Some [[Link|pretty ''italics'' and stuff]]!
6475 !! html/php
6476 <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>!
6477 </p>
6478 !! html/parsoid
6479 <p>Some <a rel="mw:WikiLink" href="Link" title="Link">pretty <i>italics</i> and stuff</a>!</p>
6480 !! end
6482 !! test
6483 Link containing double-single-quotes '' in text embedded in italics (bug 4598 sanity check)
6484 !! wikitext
6485 ''Some [[Link|pretty ''italics'' and stuff]]!''
6486 !! html
6487 <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>
6488 </p>
6489 !! end
6491 !! test
6492 Link with double quotes in title part (literal) and alternate part (interpreted)
6493 !! wikitext
6494 [[File:Denys_Savchenko_''Pentecoste''.jpg]]
6496 [[''Pentecoste'']]
6498 [[''Pentecoste''|Pentecoste]]
6500 [[''Pentecoste''|''Pentecoste'']]
6501 !! html/php
6502 <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>
6503 </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>
6504 </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>
6505 </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>
6506 </p>
6507 !! html/parsoid
6508 <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>
6509 <p><a rel="mw:WikiLink" href="''Pentecoste''" title="''Pentecoste''">''Pentecoste''</a></p>
6510 <p><a rel="mw:WikiLink" href="''Pentecoste''" title="''Pentecoste''">Pentecoste</a></p>
6511 <p><a rel="mw:WikiLink" href="''Pentecoste''" title="''Pentecoste''"><i>Pentecoste</i></a></p>
6512 !! end
6514 !! test
6515 Broken image links with HTML captions (bug 39700)
6516 !! wikitext
6517 [[File:Nonexistent|<script></script>]]
6518 [[File:Nonexistent|100x100px|<script></script>]]
6519 [[File:Nonexistent|&lt;]]
6520 [[File:Nonexistent|a<i>b</i>c]]
6521 !! html/php
6522 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script&gt;&lt;/script&gt;</a>
6523 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script&gt;&lt;/script&gt;</a>
6524 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;</a>
6525 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">abc</a>
6526 </p>
6527 !! html/parsoid
6528 <p><span class="mw-default-size" typeof="mw:Error mw:Image" data-mw='{"errors":[{"key":"missing-image","message":"This image does not exist."}],"caption":"&lt;script>&lt;/script>"}'><a href="./File:Nonexistent"><img resource="./File:Nonexistent" src="./Special:FilePath/Nonexistent" height="220" width="220"/></a></span>
6529 <span typeof="mw:Error mw:Image" data-mw='{"errors":[{"key":"missing-image","message":"This image does not exist."}],"caption":"&lt;script>&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"/></a></span>
6530 <span class="mw-default-size" typeof="mw:Error mw:Image" data-mw='{"errors":[{"key":"missing-image","message":"This image does not exist."}],"caption":"&amp;lt;"}'><a href="./File:Nonexistent"><img resource="./File:Nonexistent" src="./Special:FilePath/Nonexistent" height="220" width="220"/></a></span>
6531 <span class="mw-default-size" typeof="mw:Error mw:Image" data-mw='{"errors":[{"key":"missing-image","message":"This image does not exist."}],"caption":"a&lt;i>b&lt;/i>c"}'><a href="./File:Nonexistent"><img resource="./File:Nonexistent" src="./Special:FilePath/Nonexistent" height="220" width="220"/></a></span></p>
6532 !! end
6534 !! test
6535 Plain link to URL
6536 !! wikitext
6537 [[http://www.example.com]]
6538 !! html/php
6539 <p>[<a rel="nofollow" class="external autonumber" href="http://www.example.com">[1]</a>]
6540 </p>
6541 !! html/parsoid
6542 <p>[<a rel="mw:ExtLink" href="http://www.example.com"></a>]</p>
6543 !! end
6545 !! test
6546 Plain link to URL with link text
6547 !! wikitext
6548 [[http://www.example.com Link text]]
6549 !! html
6550 <p>[<a rel="nofollow" class="external text" href="http://www.example.com">Link text</a>]
6551 </p>
6552 !! end
6554 !! test
6555 Plain link to protocol-relative URL
6556 !! wikitext
6557 [[//www.example.com]]
6558 !! html/php
6559 <p>[<a rel="nofollow" class="external autonumber" href="//www.example.com">[1]</a>]
6560 </p>
6561 !! html/parsoid
6562 <p>[<a rel="mw:ExtLink" href="//www.example.com"></a>]</p>
6563 !! end
6565 !! test
6566 Plain link to protocol-relative URL with link text
6567 !! wikitext
6568 [[//www.example.com Link text]]
6569 !! html
6570 <p>[<a rel="nofollow" class="external text" href="//www.example.com">Link text</a>]
6571 </p>
6572 !! end
6574 !! test
6575 Plain link to page with question mark in title
6576 !! wikitext
6577 [[A?b]]
6579 [[A?b|Baz]]
6580 !! html
6581 <p><a href="/wiki/A%3Fb" title="A?b">A?b</a>
6582 </p><p><a href="/wiki/A%3Fb" title="A?b">Baz</a>
6583 </p>
6584 !! end
6587 # I'm fairly sure the expected result here is wrong.
6588 # We want these to be URL links, not pseudo-pages with URLs for titles....
6589 # However the current output is also pretty screwy.
6591 # ----
6592 # I'm changing it to match the current output--it arguably makes more
6593 # sense in the light of the test above. Old expected result was:
6594 #<p>Piped link to URL: <a href="/index.php?title=Http://www.example.com&amp;action=edit" class="new">an example URL</a>
6595 #</p>
6596 # But I think this test is bordering on "garbage in, garbage out" anyway.
6597 # -- wtm
6598 !! test
6599 Piped link to URL
6600 !! wikitext
6601 Piped link to URL: [[http://www.example.com|an example URL]]
6602 !! html/php
6603 <p>Piped link to URL: [<a rel="nofollow" class="external text" href="http://www.example.com%7Can">example URL</a>]
6604 </p>
6605 !! html/parsoid
6606 <p>Piped link to URL: [<a rel="mw:ExtLink" href="http://www.example.com|an">example URL</a>]</p>
6607 !! end
6609 !! test
6610 BUG 2: [[page|http://url/]] should link to page, not http://url/
6611 !! wikitext
6612 [[Main Page|http://url/]]
6613 !! html/php
6614 <p><a href="/wiki/Main_Page" title="Main Page">http://url/</a>
6615 </p>
6616 !! html/parsoid
6617 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">http://url/</a></p>
6618 !! end
6620 # Parsoid does not mark self-links, by design.
6621 !! test
6622 BUG 337: Escaped self-links should be bold
6623 !! options
6624 title=[[Bug462]]
6625 !! wikitext
6626 [[Bu&#103;462]] [[Bug462]]
6627 !! html/php
6628 <p><strong class="selflink">Bu&#103;462</strong> <strong class="selflink">Bug462</strong>
6629 </p>
6630 !! html/php+tidy
6631 <p><strong class="selflink">Bug462</strong> <strong class="selflink">Bug462</strong></p>
6632 !! html/parsoid
6633 <p><a rel="mw:WikiLink" href="./Bug462" title="Bug462">Bug462</a> <a rel="mw:WikiLink" href="./Bug462" title="Bug462">Bug462</a></p>
6634 !! end
6636 !! test
6637 Self-link to section should not be bold
6638 !! options
6639 title=[[Main Page]]
6640 !! wikitext
6641 [[Main Page#section]]
6642 !! html
6643 <p><a href="/wiki/Main_Page#section" title="Main Page">Main Page#section</a>
6644 </p>
6645 !! end
6647 !! article
6649 !! text
6650 This is 00.
6651 !! endarticle
6653 !!test
6654 Self-link to numeric title
6655 !!options
6656 title=[[0]]
6657 !! wikitext
6658 [[0]]
6659 !! html
6660 <p><strong class="selflink">0</strong>
6661 </p>
6662 !!end
6664 !!test
6665 Link to numeric-equivalent title
6666 !!options
6667 title=[[0]]
6668 !! wikitext
6669 [[00]]
6670 !! html
6671 <p><a href="/wiki/00" title="00">00</a>
6672 </p>
6673 !!end
6675 !! test
6676 <nowiki> inside a link
6677 !! wikitext
6678 [[Main<nowiki> Page</nowiki>]] [[Main Page|the main page <nowiki>[it's not very good]</nowiki>]]
6679 !! html
6680 <p>[[Main Page]] <a href="/wiki/Main_Page" title="Main Page">the main page [it's not very good]</a>
6681 </p>
6682 !! end
6684 !! test
6685 Non-breaking spaces in title
6686 !! wikitext
6687 [[&nbsp; Main &nbsp; Page &nbsp;]]
6688 !! html
6689 <p><a href="/wiki/Main_Page" title="Main Page">&#160; Main &#160; Page &#160;</a>
6690 </p>
6691 !!end
6693 !! test
6694 Internal link with ca linktrail, surrounded by bold apostrophes (bug 27473 primary issue)
6695 !! options
6696 language=ca
6697 !! wikitext
6698 '''[[Main Page]]'''
6699 !! html
6700 <p><b><a href="/wiki/Main_Page" title="Main Page">Main Page</a></b>
6701 </p>
6702 !! end
6704 !! test
6705 Internal link with ca linktrail, surrounded by italic apostrophes (bug 27473 primary issue)
6706 !! options
6707 language=ca
6708 !! wikitext
6709 ''[[Main Page]]''
6710 !! html
6711 <p><i><a href="/wiki/Main_Page" title="Main Page">Main Page</a></i>
6712 </p>
6713 !! end
6715 !! test
6716 Internal link with en linktrail: no apostrophes (bug 27473)
6717 !! options
6718 language=en
6719 !! wikitext
6720 [[Something]]'nice
6721 !! html
6722 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (page does not exist)">Something</a>'nice
6723 </p>
6724 !! end
6726 !! test
6727 Internal link with ca linktrail with apostrophes (bug 27473)
6728 !! options
6729 language=ca
6730 !! wikitext
6731 [[Something]]'nice
6732 !! html
6733 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (encara no existeix)">Something'nice</a>
6734 </p>
6735 !! end
6737 !! test
6738 Internal link with kaa linktrail with apostrophes (bug 27473)
6739 !! options
6740 language=kaa
6741 !! wikitext
6742 [[Something]]'nice
6743 !! html
6744 <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>
6745 </p>
6746 !! end
6748 !! test
6749 Link with multiple ":" in a subpage-supporting namespace (bug 63636)
6750 !! wikitext
6751 [[User:Foo/Test/63636:Bar|Test]]
6752 !! html/php
6753 <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>
6754 </p>
6755 !! html/parsoid
6756 <p><a rel="mw:WikiLink" href="./User:Foo/Test/63636:Bar" title="User:Foo/Test/63636:Bar">Test</a></p>
6757 !! end
6759 !! test
6760 Purely hash wikilink
6761 !! options
6762 title=[[User:test/123]]
6763 !! wikitext
6764 [[#a|b]]
6765 !! html/php
6766 <p><a href="#a">b</a>
6767 </p>
6768 !! html/parsoid
6769 <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>
6770 !! end
6772 !! test
6773 1. Interaction of linktrail and template encapsulation
6774 !! options
6775 parsoid
6776 !! wikitext
6777 {{echo|[[Foo]]}}l
6778 !! html
6779 <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>
6780 !! end
6782 !! test
6783 2. Interaction of linktrail and template encapsulation
6784 !! options
6785 parsoid
6786 !! wikitext
6787 {{echo|Some [[Fool]]}}s
6788 !! html
6789 <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","spc":["","","",""]}]]}'>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>
6790 !! end
6792 !! test
6793 3. Interaction of linktrail and template encapsulation
6794 !! options
6795 parsoid
6796 !! wikitext
6797 {{echo|Some [[Fool]]s are '''bold and foolish'''}}
6798 !! html
6799 <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","spc":["","","",""]}]]}'>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>
6800 !! end
6802 !! article
6803 Söfnuður
6804 !! text
6805 Test.
6806 !! endarticle
6808 !! test
6809 Internal link with is link prefix
6810 !! options
6811 language=is
6812 !! wikitext
6813 Aðrir mótmælenda[[söfnuður|söfnuðir]] og
6814 !! html
6815 <p>Aðrir <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðir</a> og
6816 </p>
6817 !! end
6819 !! article
6820 Mótmælendatrú
6821 !! text
6822 Test.
6823 !! endarticle
6825 !! test
6826 Internal link with is link trail and link prefix
6827 !! options
6828 language=is
6829 !! wikitext
6830 [[mótmælendatrú|xxx]]ar
6831 [[mótmælendatrú]]ar
6832 mótmælenda[[söfnuður]]
6833 mótmælenda[[söfnuður|söfnuðir]]
6834 mótmælenda[[söfnuður|söfnuðir]]xxx
6835 !! html
6836 <p><a href="/wiki/M%C3%B3tm%C3%A6lendatr%C3%BA" title="Mótmælendatrú">xxxar</a>
6837 <a href="/wiki/M%C3%B3tm%C3%A6lendatr%C3%BA" title="Mótmælendatrú">mótmælendatrúar</a>
6838 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuður</a>
6839 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðir</a>
6840 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðirxxx</a>
6841 </p>
6842 !! end
6844 !! test
6845 Parsoid link trail escaping
6846 !! options
6847 parsoid=html2wt,html2html
6848 !! wikitext
6849 [[apple]]<nowiki/>s
6850 !! html
6851 <p><a rel="mw:WikiLink" href="Apple" title="Apple">apple</a>s</p>
6852 !! end
6854 !! test
6855 Parsoid link prefix escaping
6856 !! options
6857 language=is
6858 parsoid=html2wt,html2html
6859 !! wikitext
6860 Aðrir mótmælenda<nowiki/>[[söfnuður]]
6861 !! html
6862 <p>Aðrir mótmælenda<a rel="mw:WikiLink" href="Söfnuður" title="Söfnuður">söfnuður</a></p>
6863 !! end
6865 !! test
6866 Parsoid-centric test: Whitespace in ext- and wiki-links should be preserved
6867 !! wikitext
6868 [[Foo|  bar]]
6870 [[Foo|  ''bar'']]
6872 [http://wp.org   foo]
6874 [http://wp.org   ''foo'']
6875 !! html
6876 <p><a href="/wiki/Foo" title="Foo">  bar</a>
6877 </p><p><a href="/wiki/Foo" title="Foo">  <i>bar</i></a>
6878 </p><p><a rel="nofollow" class="external text" href="http://wp.org">foo</a>
6879 </p><p><a rel="nofollow" class="external text" href="http://wp.org"><i>foo</i></a>
6880 </p>
6881 !! end
6883 !! test
6884 Parsoid: Scoped parsing should handle mixed transclusions and plain text
6885 !! options
6886 parsoid
6887 !! wikitext
6888 [[Foo|{{echo|a}} b {{echo|c}}]]
6889 !! html
6890 <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>
6891 !! end
6893 !! test
6894 Link with angle bracket after anchor
6895 !! wikitext
6896 [[Foo#<bar>]]
6897 !! html/php
6898 <p><a href="/wiki/Foo#.3Cbar.3E" title="Foo">Foo#&lt;bar&gt;</a>
6899 </p>
6900 !! html/parsoid
6901 <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>
6902 !! end
6905 ### Interwiki links (see maintenance/interwiki.sql)
6908 !! test
6909 Inline interwiki link
6910 !! options
6911 parsoid=wt2html,wt2wt,html2html
6912 !! wikitext
6913 [[MeatBall:SoftSecurity]]
6914 !! html/php
6915 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity</a>
6916 </p>
6917 !! html/parsoid
6918 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity" title="meatball:SoftSecurity">MeatBall:SoftSecurity</a></p>
6919 !! end
6921 !! test
6922 Inline interwiki link with empty title (bug 2372)
6923 !! options
6924 parsoid=wt2html,wt2wt,html2html
6925 !! wikitext
6926 [[MeatBall:]]
6927 !! html/php
6928 <p><a href="http://www.usemod.com/cgi-bin/mb.pl" class="extiw" title="meatball:">MeatBall:</a>
6929 </p>
6930 !! html/parsoid
6931 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?" title="meatball:">MeatBall:</a></p>
6932 !! end
6934 !! test
6935 Interwiki link encoding conversion (bug 1636)
6936 !! wikitext
6937 *[[Wikipedia:ro:Olteni&#0355;a]]
6938 *[[Wikipedia:ro:Olteni&#355;a]]
6939 !! html
6940 <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>
6941 <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>
6943 !! html+tidy
6944 <ul>
6945 <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>
6946 <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>
6947 </ul>
6948 !! end
6950 !! test
6951 Interwiki link with fragment (bug 2130)
6952 !! wikitext
6953 [[MeatBall:SoftSecurity#foo]]
6954 !! html
6955 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity#foo" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity#foo</a>
6956 </p>
6957 !! end
6959 # Ideally the wikipedia: prefix here should be proto-relative too
6960 # [CSA]: this is kind of a bogus test, as the PHP parser test doesn't
6961 # define the 'en' prefix, and originally the test used 'wikipedia',
6962 # which isn't a localinterwiki prefix hence the links to the 'en:Foo'
6963 # article.
6964 !! test
6965 Different interwiki prefixes mapping to the same URL
6966 !! wikitext
6967 [[:en:Foo]]
6969 [[:en:Foo|Foo]]
6971 [[wikipedia:Foo]]
6973 [[:wikipedia:Foo|Foo]]
6975 [[wikipedia:en:Foo]]
6977 [[:wikipedia:en:Foo]]
6979 [[  wikiPEdia :Foo]]
6980 !! html/parsoid
6981 <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>
6983 <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>
6985 <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>
6987 <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>
6989 <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>
6991 <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>
6993 <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>
6994 !! end
6996 !! test
6997 Interwiki links that cannot be represented in wiki syntax
6998 !! wikitext
6999 [[meatball:ok]]
7000 [[meatball:ok#foo|ok with fragment]]
7001 [[meatball:ok_as_well?|ok ending with ? mark]]
7002 [http://de.wikipedia.org/wiki/Foo?action=history has query]
7003 [http://de.wikipedia.org/wiki/#foo is just fragment]
7005 !! html/php
7006 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?ok" class="extiw" title="meatball:ok">meatball:ok</a>
7007 <a href="http://www.usemod.com/cgi-bin/mb.pl?ok#foo" class="extiw" title="meatball:ok">ok with fragment</a>
7008 <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>
7009 <a rel="nofollow" class="external text" href="http://de.wikipedia.org/wiki/Foo?action=history">has query</a>
7010 <a rel="nofollow" class="external text" href="http://de.wikipedia.org/wiki/#foo">is just fragment</a>
7011 </p>
7012 !! html/parsoid
7013 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?ok" title="meatball:ok">meatball:ok</a>
7014 <a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?ok#foo" title="meatball:ok">ok with fragment</a>
7015 <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>
7016 <a rel="mw:ExtLink" href="http://de.wikipedia.org/wiki/Foo?action=history">has query</a>
7017 <a rel="mw:ExtLink" href="http://de.wikipedia.org/wiki/#foo">is just fragment</a></p>
7018 !! end
7020 !! test
7021 Interwiki links: trail
7022 !! wikitext
7023 [[wikipedia:Foo|Ba]]r
7024 !! html/php
7025 <p><a href="http://en.wikipedia.org/wiki/Foo" class="extiw" title="wikipedia:Foo">Bar</a>
7026 </p>
7027 !! html/parsoid
7028 <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>
7029 !! end
7031 !! test
7032 Local interwiki link
7033 !! options
7034 parsoid=wt2html,wt2wt,html2html
7035 !! wikitext
7036 [[local:Template:Foo]]
7037 !! html/php
7038 <p><a href="/wiki/Template:Foo" title="Template:Foo">local:Template:Foo</a>
7039 </p>
7040 !! html/parsoid
7041 <p><a rel="mw:WikiLink" href="./Template:Foo" title="Template:Foo">local:Template:Foo</a></p>
7042 !! end
7044 # Parsoid does not mark self-links, by design.
7045 !! test
7046 Local interwiki link: self-link to current page
7047 !! options
7048 title=[[Main Page]]
7049 parsoid=wt2html,wt2wt,html2html
7050 !! wikitext
7051 [[local:Main Page]]
7052 !! html/php
7053 <p><strong class="selflink">local:Main Page</strong>
7054 </p>
7055 !! html/parsoid
7056 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">local:Main Page</a></p>
7057 !! end
7059 !! test
7060 Local interwiki link: prefix only (bug 64167)
7061 !! options
7062 parsoid=wt2html,wt2wt,html2html
7063 !! wikitext
7064 [[local:]]
7065 !! html/php
7066 <p><a href="/wiki/Main_Page" title="Main Page">local:</a>
7067 </p>
7068 !! html/parsoid
7069 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">local:</a></p>
7070 !! end
7072 !! test
7073 Local interwiki link: with additional interwiki prefix (bug 61357)
7074 !! options
7075 parsoid=wt2html,wt2wt,html2html
7076 !! wikitext
7077 [[local:meatball:Hello]]
7078 !! html/php
7079 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?Hello" class="extiw" title="meatball:Hello">local:meatball:Hello</a>
7080 </p>
7081 !! html/parsoid
7082 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?Hello" title="meatball:Hello">local:meatball:Hello</a></p>
7083 !! end
7085 !! test
7086 Multiple local interwiki link prefixes
7087 !! wikitext
7088 [[local:local:local:local:mi:local:Foo]]
7089 !! options
7090 parsoid=wt2html,wt2wt,html2html
7091 !! html/php
7092 <p><a href="/wiki/Foo" title="Foo">local:local:local:local:mi:local:Foo</a>
7093 </p>
7094 !! html/parsoid
7095 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">local:local:local:local:mi:local:Foo</a></p>
7096 !! end
7099 ### Interlanguage links
7100 ### Language links (so that searching for '### language' matches..)
7103 !! test
7104 Interlanguage link
7105 !! options
7106 parsoid=wt2html,wt2wt,html2html
7107 !! wikitext
7108 Blah blah blah
7109 [[zh:Chinese]]
7110 !! html/php
7111 <p>Blah blah blah
7112 </p>
7113 !! html/parsoid
7114 <p>Blah blah blah</p>
7115 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
7116 !! end
7118 !! test
7119 Interlanguage link with spacing
7120 !! options
7121 parsoid=wt2html,wt2wt,html2html
7122 !! wikitext
7123 Blah blah blah
7124 [[   zh  :    Chinese     ]]
7125 !! html/php
7126 <p>Blah blah blah
7127 </p>
7128 !! html/parsoid
7129 <p>Blah blah blah</p>
7130 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
7131 !! end
7133 !! test
7134 Double interlanguage link
7135 !! options
7136 parsoid=wt2html,wt2wt,html2html
7137 !! wikitext
7138 Blah blah blah
7139 [[es:Spanish]]
7140 [[zh:Chinese]]
7141 !! html/php
7142 <p>Blah blah blah
7143 </p>
7144 !! html/parsoid
7145 <p>Blah blah blah</p>
7146 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Spanish"/>
7147 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
7148 !! end
7150 !! test
7151 Interlanguage link variations
7152 !! options
7153 parsoid=wt2html,wt2wt,html2html
7154 !! wikitext
7155 Blah blah blah
7156 [[   es :Spanish]]
7157 [[ ZH :Chinese]]
7158 [[es:Foo_bar]]
7159 [[es:Foo bar]]
7160 !! html/php
7161 <p>Blah blah blah
7162 </p>
7163 !! html/parsoid
7164 <p>Blah blah blah</p>
7165 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Spanish" />
7166 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese" />
7167 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Foo_bar" />
7168 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Foo_bar" />
7169 !! end
7171 !! test
7172 Interlanguage link, with prefix links
7173 !! options
7174 language=ln
7175 !! wikitext
7176 Blah blah blah
7177 [[zh:Chinese]]
7178 !! html/php
7179 <p>Blah blah blah
7180 </p>
7181 !! html/parsoid
7182 <p>Blah blah blah</p>
7183 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
7184 !! end
7186 !! test
7187 Double interlanguage link, with prefix links (bug 8897)
7188 !! options
7189 language=ln
7190 !! wikitext
7191 Blah blah blah
7192 [[es:Spanish]]
7193 [[zh:Chinese]]
7194 !! html/php
7195 <p>Blah blah blah
7196 </p>
7197 !! html/parsoid
7198 <p>Blah blah blah</p>
7199 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Spanish"/>
7200 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
7201 !! end
7203 !! test
7204 "Extra" interlanguage links (bug 32189 / gerrit 111390)
7205 !! wikitext
7206 Blah blah blah
7207 [[mul:Article]]
7208 !! html/php
7209 <p>Blah blah blah
7210 </p>
7211 !! html/parsoid
7212 <p>Blah blah blah</p>
7213 <link rel="mw:PageProp/Language" title="Multilingual" href="http://wikisource.org/wiki/Article"/>
7214 !! end
7216 !! test
7217 Parsoid-specific test: Wikilinks with &nbsp; should RT properly
7218 !! options
7219 language=ln
7220 !! wikitext
7221 [[WW&nbsp;II]]
7222 !! html
7223 <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>
7224 </p>
7225 !! end
7227 !! test
7228 Parsoid bug 53221: Wikilinks should be properly entity-escaped
7229 !! options
7230 parsoid=html2wt
7231 !! wikitext
7232 He&amp;nbsp;llo [[Foo|He&amp;nbsp;llo]]
7234 He&amp;nbsp;llo [[He&amp;nbsp;llo]]
7235 !! html
7236 <p>He&amp;nbsp;llo <a href="Foo" rel="mw:WikiLink">He&amp;nbsp;llo</a></p>
7237 <p>He&amp;nbsp;llo <a href="He&amp;nbsp;llo" rel="mw:WikiLink">He&amp;nbsp;llo</a></p>
7238 !! end
7240 !! test
7241 Parsoid: handle constructor well
7242 !! wikitext
7243 [[constructor]]
7245 [[constructor:foo]]
7246 !! html/php
7247 <p><a href="/index.php?title=Constructor&amp;action=edit&amp;redlink=1" class="new" title="Constructor (page does not exist)">constructor</a>
7248 </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>
7249 </p>
7250 !! html/parsoid
7251 <p><a rel="mw:WikiLink" href="./Constructor" title="Constructor" data-parsoid="{&quot;stx&quot;:&quot;simple&quot;,&quot;a&quot;:{&quot;href&quot;:&quot;./Constructor&quot;},&quot;sa&quot;:{&quot;href&quot;:&quot;constructor&quot;}}">constructor</a></p>
7253 <p><a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid="{&quot;stx&quot;:&quot;simple&quot;,&quot;a&quot;:{&quot;href&quot;:&quot;./Foo&quot;},&quot;sa&quot;:{&quot;href&quot;:&quot;constructor:foo&quot;}}">constructor:foo</a></p>
7254 !! end
7256 !! article
7258 !! text
7259 Test.
7260 !! endarticle
7262 # Note that `ko` isn't a known interlanguage prefix
7263 !! test
7264 Parsoid: recognize interlanguage links without a target page
7265 !! options
7267 !! wikitext
7268 [[es:]]
7270 [[ko:]]
7271 !! html/php
7273 !! html/parsoid
7274 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/"/>
7276 <p><a rel="mw:WikiLink" href="./Ko:" title="Ko:">ko:</a></p>
7277 !! end
7279 # Note that `ko` isn't a known interwiki prefix
7280 !! test
7281 Parsoid: recognize interwiki links without a target page
7282 !! options
7283 parsoid=wt2html,wt2wt,html2html
7284 !! wikitext
7285 [[:es:]]
7287 [[:ko:]]
7288 !! html/php
7289 <p><a href="http://es.wikipedia.org/wiki/" class="extiw" title="es:">es:</a>
7290 </p><p><a href="/wiki/Ko:" title="Ko:">ko:</a>
7291 </p>
7292 !! html/parsoid
7293 <p><a rel="mw:ExtLink" href="http://es.wikipedia.org/wiki/" title="es:">es:</a></p>
7294 <p><a rel="mw:WikiLink" href="./Ko:" title="Ko:">ko:</a></p>
7295 !! end
7297 !! test
7298 Handle interwiki links pointing to the current wiki as plain wiki links (bug 45209)
7299 !! wikitext
7300 [[mi:Foo]]
7301 !! html/php
7302 <p><a href="/wiki/Foo" title="Foo">mi:Foo</a>
7303 </p>
7304 !! html/parsoid
7305 <p><a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{"stx":"simple","a":{"href":"./Foo"},"sa":{"href":"mi:Foo"}}'>mi:Foo</a></p>
7306 !! end
7308 !! test
7309 Interlanguage link with preceding local interwiki link (bug 68085)
7310 !! options
7311 parsoid=wt2html,wt2wt,html2html
7312 !! wikitext
7313 Blah blah blah
7314 [[local:es:Spanish]]
7315 !! html/php
7316 <p>Blah blah blah
7317 <a href="http://es.wikipedia.org/wiki/Spanish" class="extiw" title="es:Spanish">local:es:Spanish</a>
7318 </p>
7319 !! html/parsoid
7320 <p>Blah blah blah
7321 <a rel="mw:ExtLink" href="http://es.wikipedia.org/wiki/Spanish" title="es:Spanish">local:es:Spanish</a></p>
7322 !! end
7324 !! test
7325 Looks like an interlanguage link, but is actually a local interwiki
7326 !! options
7327 parsoid=wt2html,wt2wt,html2html
7328 !! wikitext
7329 Blah blah blah
7330 [[mi:Template:Foo]]
7331 !! html/php
7332 <p>Blah blah blah
7333 <a href="/wiki/Template:Foo" title="Template:Foo">mi:Template:Foo</a>
7334 </p>
7335 !! html/parsoid
7336 <p>Blah blah blah
7337 <a rel="mw:WikiLink" href="Template:Foo" title="Template:Foo">mi:Template:Foo</a></p>
7338 !! end
7341 ### Redirects, Parsoid-only
7343 !! test
7344 1. Simple redirect to page
7345 !! options
7346 parsoid
7347 !! wikitext
7348 #REDIRECT [[Main Page]]
7349 !! html
7350 <link rel="mw:PageProp/redirect" href="./Main_Page">
7351 !! end
7353 # Only wt2html and html2html since "Main_Page" will serialize to "Main Page"
7354 !! test
7355 2. Other redirect variants
7356 !! options
7357 parsoid=wt2html,wt2wt
7358 !! wikitext
7359 #REDIRECT [[Main_Page]]
7360 #REDIRECT [[<nowiki>[[Bar]]</nowiki>]]
7361 !! html/parsoid
7362 <link rel="mw:PageProp/redirect" href="./Main_Page"><link rel="mw:PageProp/redirect" href="./%5B%5BBar%5D%5D">
7363 !! end
7365 !! test
7366 Empty redirect
7367 !! options
7368 parsoid=wt2html,wt2wt
7369 !! wikitext
7370 #REDIRECT [[]]
7371 !! html
7372 <ol>
7373 <li>REDIRECT [[]]</li></ol>
7374 !! end
7376 !! test
7377 Optional colon in #REDIRECT
7378 !! options
7379 # the colon is archaic syntax.  we support it for wt2html, but we
7380 # don't care that it roundtrips back to the modern syntax.
7381 parsoid=wt2html,html2html
7382 !! wikitext
7383 #REDIRECT:[[Main Page]]
7384 !! html
7385 <link rel="mw:PageProp/redirect" href="./Main_Page">
7386 !! end
7388 !! test
7389 Whitespace in #REDIRECT with optional colon
7390 !! options
7391 # the colon and gratuitous whitespace is archaic syntax.  we support
7392 # it for wt2html, but we don't care that it roundtrips back to the
7393 # modern syntax (without extra whitespace)
7394 parsoid=wt2html,html2html
7395 !! wikitext
7397  #REDIRECT 
7399 [[Main Page]]
7400 !! html
7401 <link rel="mw:PageProp/redirect" href="./Main_Page">
7402 !! end
7404 !! test
7405 Piped link in #REDIRECT
7406 !! options
7407 # content after piped link is ignored.  we support this syntax,
7408 # but don't care that the piped link is lost when we roundtrip this.
7409 parsoid=wt2html
7410 !! wikitext
7411 #REDIRECT [[Main Page|bar]]
7412 !! html
7413 <link rel="mw:PageProp/redirect" href="./Main_Page">
7414 !! end
7416 !! test
7417 Redirect to category
7418 !! options
7419 parsoid=wt2html
7420 !! wikitext
7421 #REDIRECT [[Category:Foo]]
7422 !! html
7423 <link rel="mw:PageProp/redirect" href="./Category:Foo"><link rel="mw:PageProp/Category" href="./Category:Foo">
7424 !! end
7426 !! test
7427 Redirect to category with URL encoding
7428 !! options
7429 parsoid=wt2html
7430 !! wikitext
7431 #REDIRECT [[Category%3AFoo]]
7432 !! html
7433 <link rel="mw:PageProp/redirect" href="./Category:Foo"><link rel="mw:PageProp/Category" href="./Category:Foo">
7434 !! end
7436 !! test
7437 Redirect to category page
7438 !! options
7439 parsoid=wt2html,html2html
7440 !! wikitext
7441 #REDIRECT [[:Category:Foo]]
7442 !! html
7443 <p><a rel="mw:WikiLink" href="Category:Foo" title="Category:Foo">Category:Foo</a></p>
7444 !! end
7446 !! test
7447 Redirect to image page (1)
7448 !! options
7449 parsoid
7450 !! wikitext
7451 #REDIRECT [[File:Wiki.png]]
7452 !! html
7453 <link rel="mw:PageProp/redirect" href="./File:Wiki.png">
7454 !! end
7456 !! test
7457 Redirect to image page (2)
7458 !! options
7459 parsoid
7460 !! wikitext
7461 #REDIRECT [[Image:Wiki.png]]
7462 !! html
7463 <link rel="mw:PageProp/redirect" href="./File:Wiki.png">
7464 !! end
7466 !! test
7467 Redirect to language
7468 !! options
7469 parsoid
7470 !! wikitext
7471 #REDIRECT [[en:File:Wiki.png]]
7472 !! html
7473 <link rel="mw:PageProp/redirect" href="File:Wiki.png">
7474 !! end
7476 !! test
7477 Redirect to interwiki
7478 !! options
7479 parsoid
7480 !! wikitext
7481 #REDIRECT [[meatball:File:Wiki.png]]
7482 !! html
7483 <link rel="mw:PageProp/redirect" href="File:Wiki.png">
7484 !! end
7486 !! test
7487 Non-English #REDIRECT
7488 !! options
7489 parsoid
7490 language=is
7491 !! wikitext
7492 #TILVÍSUN [[Main Page]]
7493 !! html
7494 <link rel="mw:PageProp/redirect" href="./Main_Page">
7495 !! end
7497 !! test
7498 New redirect
7499 !! options
7500 parsoid=html2wt
7501 !! wikitext
7503 #REDIRECT [[Foo]]
7504 !! html
7505 <p>Foo<link rel="mw:PageProp/redirect" href="./Foo"></p>
7506 !! end
7509 ## XHTML tidiness
7512 !! test
7513 <br> to <br />
7514 !! wikitext
7515 1<br>2<br />3
7516 !! html
7517 <p>1<br />2<br />3
7518 </p>
7519 !! end
7521 !! test
7522 Broken br tag sanitization
7523 !! wikitext
7524 </br>
7525 !! html/php
7526 <p>&lt;/br&gt;
7527 </p>
7528 !! end
7530 # TODO: Fix html2html mode (bug 51055)!
7531 # This </br> handling was added as part of bug 50831; but it
7532 # differs from how PHP+tidy handles this.  We should investigate
7533 # this.
7534 !! test
7535 Parsoid: Broken br tag recognition
7536 !! options
7537 parsoid=wt2html
7538 !! wikitext
7539 </br>
7541 <br/ >
7542 !! html/php+tidy
7543 <p>&lt;/br&gt;</p>
7544 <p><br /></p>
7545 !! html/parsoid
7546 <p><br></p>
7547 <p><br/></p>
7548 !! end
7550 !! test
7551 Incorrecly removing closing slashes from correctly formed XHTML
7552 !! wikitext
7553 <br style="clear:both;" />
7554 !! html
7555 <p><br style="clear:both;" />
7556 </p>
7557 !! end
7559 !! test
7560 Failing to transform badly formed HTML into correct XHTML
7561 !! wikitext
7562 <br style="clear: left;">
7563 <br style="clear: right;">
7564 <br style="clear: both;">
7565 !! html
7566 <p><br style="clear: left;" />
7567 <br style="clear: right;" />
7568 <br style="clear: both;" />
7569 </p>
7570 !!end
7572 ## FIXME: Is Parsoid's acceptance of self-closing html-tags
7573 ## a feature or a bug? See https://phabricator.wikimedia.org/T76962
7574 !! test
7575 Handling html with a div self-closing tag
7576 !! wikitext
7577 <div title />
7578 <div title/>
7579 <div title/ >
7580 <div title=bar />
7581 <div title=bar/>
7582 <div title=bar/ >
7583 !! html/php
7584 <p>&lt;div title /&gt;
7585 &lt;div title/&gt;
7586 </p>
7587 <div>
7588 <p>&lt;div title=bar /&gt;
7589 &lt;div title=bar/&gt;
7590 </p>
7591 <div title="bar/"></div>
7592 </div>
7594 !! html/parsoid
7595 <div title="" data-parsoid='{"stx":"html","selfClose":true}'></div>
7596 <div title="" data-parsoid='{"stx":"html","selfClose":true}'></div>
7597 <div title="" data-parsoid='{"stx":"html","selfClose":true,"brokenHTMLTag":true}'></div>
7598 <div title="bar" data-parsoid='{"stx":"html","selfClose":true}'></div>
7599 <div title="bar" data-parsoid='{"stx":"html","selfClose":true}'></div>
7600 <div title="bar/" data-parsoid='{"stx":"html","autoInsertedEnd":true}'></div>
7601 !! end
7603 !! test
7604 Handling html with a br self-closing tag
7605 !! wikitext
7606 <br title />
7607 <br title/>
7608 <br title/ >
7609 <br title=bar />
7610 <br title=bar/>
7611 <br title=bar/ >
7612 !! html/php
7613 <p><br title="title" />
7614 <br title="title" />
7615 <br />
7616 <br title="bar" />
7617 <br title="bar" />
7618 <br title="bar/" />
7619 </p>
7620 !! html/parsoid
7621 <p><br title="" />
7622 <br title="" />
7623 <br title="" />
7624 <br title="bar" />
7625 <br title="bar" />
7626 <br title="bar/" />
7627 </p>
7628 !! end
7630 !! test
7631 Horizontal ruler (should it add that extra space?)
7632 !! wikitext
7633 <hr>
7634 <hr >
7635 foo <hr
7636 > bar
7637 !! html+tidy
7638 <hr />
7639 <hr />
7640 <p>foo</p>
7641 <hr />
7642 <p>bar</p>
7643 !! end
7645 !! test
7646 Horizontal ruler -- 4+ dashes render hr
7647 !! wikitext
7648 ----
7649 !! html
7650 <hr />
7652 !! end
7654 !! test
7655 Horizontal ruler -- eats additional dashes on the same line
7656 !! wikitext
7657 ---------
7658 !! html
7659 <hr />
7661 !! end
7663 !! test
7664 Horizontal ruler -- does not collapse dashes on consecutive lines
7665 !! wikitext
7666 ----
7667 ----
7668 !! html
7669 <hr />
7670 <hr />
7672 !! end
7674 !! test
7675 Horizontal ruler -- <4 dashes render as plain text
7676 !! wikitext
7678 !! html
7679 <p>---
7680 </p>
7681 !! end
7683 !! test
7684 Horizontal ruler -- Supports content following dashes on same line
7685 !! wikitext
7686 ---- Foo
7687 !! html
7688 <hr /> Foo
7690 !! html+tidy
7691 <hr />
7692 <p>Foo</p>
7693 !! end
7696 ### Block-level elements
7698 !! test
7699 Common list
7700 !! wikitext
7701 *Common list
7702 * item 2
7703 *item 3
7704 !! html
7705 <ul><li>Common list</li>
7706 <li> item 2</li>
7707 <li>item 3</li></ul>
7709 !! end
7711 !! test
7712 Numbered list
7713 !! wikitext
7714 #Numbered list
7715 #item 2
7716 # item 3
7717 !! html
7718 <ol><li>Numbered list</li>
7719 <li>item 2</li>
7720 <li> item 3</li></ol>
7722 !! end
7724 !! test
7725 Mixed list
7726 !! wikitext
7727 *Mixed list
7728 *# with numbers
7729 ** and bullets
7730 *# and numbers
7731 *bullets again
7732 **bullet level 2
7733 ***bullet level 3
7734 ***#Number on level 4
7735 **bullet level 2
7736 **#Number on level 3
7737 **#Number on level 3
7738 *#number level 2
7739 *Level 1
7740 *** Level 3
7741 #** Level 3, but ordered
7742 !! html
7743 <ul><li>Mixed list
7744 <ol><li> with numbers</li></ol>
7745 <ul><li> and bullets</li></ul>
7746 <ol><li> and numbers</li></ol></li>
7747 <li>bullets again
7748 <ul><li>bullet level 2
7749 <ul><li>bullet level 3
7750 <ol><li>Number on level 4</li></ol></li></ul></li>
7751 <li>bullet level 2
7752 <ol><li>Number on level 3</li>
7753 <li>Number on level 3</li></ol></li></ul>
7754 <ol><li>number level 2</li></ol></li>
7755 <li>Level 1
7756 <ul><li><ul><li> Level 3</li></ul></li></ul></li></ul>
7757 <ol><li><ul><li><ul><li> Level 3, but ordered</li></ul></li></ul></li></ol>
7759 !! end
7761 !! test
7762 Nested lists 1
7763 !! wikitext
7764 *foo
7765 **bar
7766 !! html
7767 <ul><li>foo
7768 <ul><li>bar</li></ul></li></ul>
7770 !! end
7772 !! test
7773 Nested lists 2
7774 !! wikitext
7775 **foo
7776 *bar
7777 !! html
7778 <ul><li><ul><li>foo</li></ul></li>
7779 <li>bar</li></ul>
7781 !! end
7783 !! test
7784 Nested lists 3 (first element empty)
7785 !! wikitext
7787 **bar
7788 !! html
7789 <ul><li>
7790 <ul><li>bar</li></ul></li></ul>
7792 !! end
7794 !! test
7795 Nested lists 4 (first element empty)
7796 !! wikitext
7798 *bar
7799 !! html
7800 <ul><li><ul><li></li></ul></li>
7801 <li>bar</li></ul>
7803 !! end
7805 !! test
7806 Nested lists 5 (both elements empty)
7807 !! wikitext
7810 !! html
7811 <ul><li><ul><li></li></ul></li>
7812 <li></li></ul>
7814 !! end
7816 !! test
7817 Nested lists 6 (both elements empty)
7818 !! wikitext
7821 !! html
7822 <ul><li>
7823 <ul><li></li></ul></li></ul>
7825 !! end
7827 !! test
7828 Nested lists 7 (skip initial nesting levels)
7829 !! wikitext
7830 *** foo
7831 !! html
7832 <ul><li><ul><li><ul><li> foo</li></ul></li></ul></li></ul>
7834 !! end
7836 !! test
7837 Nested lists 8 (multiple nesting transitions)
7838 !! wikitext
7839 * foo
7840 *** bar
7841 ** baz
7842 * boo
7843 !! html
7844 <ul><li> foo
7845 <ul><li><ul><li> bar</li></ul></li>
7846 <li> baz</li></ul></li>
7847 <li> boo</li></ul>
7849 !! end
7851 !! test
7852 1. Lists with start-of-line-transparent tokens before bullets: Comments
7853 !! wikitext
7854 *foo
7855 *<!--cmt-->bar
7856 <!--cmt-->*baz
7857 !! html
7858 <ul><li>foo</li>
7859 <li>bar</li>
7860 <li>baz</li></ul>
7862 !! end
7864 !! test
7865 2. Lists with start-of-line-transparent tokens before bullets: Template close
7866 !! wikitext
7867 *foo {{echo|bar
7868 }}*baz
7869 !! html
7870 <ul><li>foo bar</li>
7871 <li>baz</li></ul>
7873 !! end
7875 !! test
7876 List items are not parsed correctly following a <pre> block (bug 785)
7877 !! wikitext
7878 * <pre>foo</pre>
7879 * <pre>bar</pre>
7880 * zar
7881 !! html
7882 <ul><li> <pre>foo</pre></li>
7883 <li> <pre>bar</pre></li>
7884 <li> zar</li></ul>
7886 !! end
7888 !! test
7889 List items from template
7890 !! wikitext
7892 {{inner list}}
7893 * item 2
7895 * item 0
7896 {{inner list}}
7897 * item 2
7899 * item 0
7900 * notSOL{{inner list}}
7901 * item 2
7902 !! html
7903 <ul><li> item 1</li>
7904 <li> item 2</li></ul>
7905 <ul><li> item 0</li>
7906 <li> item 1</li>
7907 <li> item 2</li></ul>
7908 <ul><li> item 0</li>
7909 <li> notSOL</li>
7910 <li> item 1</li>
7911 <li> item 2</li></ul>
7913 !! end
7915 !! test
7916 List interrupted by empty line or heading
7917 !! wikitext
7918 * foo
7920 ** bar
7921 == A heading ==
7922 * Another list item
7923 !! html
7924 <ul><li> foo</li></ul>
7925 <ul><li><ul><li> bar</li></ul></li></ul>
7926 <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>
7927 <ul><li> Another list item</li></ul>
7929 !!end
7931 !!test
7932 Multiple list tags generated by templates
7933 !! wikitext
7934 {{echo|<li>}}a
7935 {{echo|<li>}}b
7936 {{echo|<li>}}c
7937 !! html
7938 <li>a
7939 <li>b
7940 <li>c</li>
7941 </li>
7942 </li>
7944 !! html+tidy
7945 <ul>
7946 <li>a</li>
7947 <li>b</li>
7948 <li>c</li>
7949 </ul>
7950 !!end
7952 !!test
7953 Single-comment whitespace lines dont break lists, and neither do multi-comment whitespace lines
7954 !! wikitext
7956 <!--This line will NOT split the list-->
7958  <!--This line will NOT split the list either-->
7960  <!--foo--> <!----> <!--This line NOT split the list either--> 
7962 !! html
7963 <ul><li>a</li>
7964 <li>b</li>
7965 <li>c</li>
7966 <li>d</li></ul>
7968 !!end
7970 !!test
7971 Replacing whitespace with tabs still doesn't break the list (gerrit 78327)
7972 !! wikitext
7974 <!--This line will NOT split the list-->        
7976         <!--This line will NOT split the list either-->         
7978         <!--foo--> <!---->      <!--This line NOT split the list
7979         either-->        
7981 !! html
7982 <ul><li>a</li>
7983 <li>b</li>
7984 <li>c</li>
7985 <li>d</li></ul>
7987 !!end
7989 !!test
7990 Test the li-hack
7991 (The PHP parser relies on Tidy for the hack)
7992 !!options
7993 parsoid=wt2html,wt2wt
7994 !! wikitext
7995 * foo
7996 * <li>li-hack
7997 * {{echo|<li>templated li-hack}}
7998 * <!--foo--> <li> unsupported li-hack with preceding comments
8000 <ul>
8001 <li><li>not a li-hack
8002 </li>
8003 </ul>
8004 !! html+tidy
8005 <ul>
8006 <li>foo</li>
8007 <li>li-hack</li>
8008 <li>templated li-hack</li>
8009 <li>unsupported li-hack with preceding comments</li>
8010 </ul>
8011 <ul>
8012 <li>not a li-hack</li>
8013 </ul>
8014 !!end
8016 !! test
8017 Parsoid: Make sure nested lists are serialized on their own line even if HTML contains no newlines
8018 !! options
8019 parsoid
8020 !! wikitext
8021 # foo
8022 ## bar
8023 * foo
8024 ** bar
8025 : foo
8026 :: bar
8027 !! html
8028 <ol>
8029 <li> foo<ol>
8030 <li> bar</li>
8031 </ol></li>
8032 </ol><ul>
8033 <li> foo<ul>
8034 <li> bar</li>
8035 </ul></li>
8036 </ul><dl>
8037 <dd> foo<dl>
8038 <dd> bar</dd>
8039 </dl></dd>
8040 </dl>
8041 !! end
8043 !! test
8044 Parsoid: Test of whitespace serialization with Templated bullets
8045 !! options
8046 parsoid
8047 !! wikitext
8048 * {{bullet}}
8049 !! html
8050 <ul>
8051 <li> </li><li about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"bullet","href":"./Template:Bullet"},"params":{},"i":0}}]}'> Bar</li>
8052 </ul>
8053 !! end
8055 # ------------------------------------------------------------------------
8056 # The next set of tests are about Parsoid's ability to handle badly nested
8057 # tags (parse, minimize scope of fixup, and roundtrip back)
8058 # ------------------------------------------------------------------------
8060 !! test
8061 Unbalanced closing block tags break a list
8062 (php parser relies on Tidy to fix up)
8063 !! wikitext
8064 <div>
8065 *a</div><div>
8066 *b</div>
8067 !! html+tidy
8068 <div>
8069 <ul>
8070 <li>a</li>
8071 </ul>
8072 </div>
8073 <div>
8074 <ul>
8075 <li>b</li>
8076 </ul>
8077 </div>
8078 !! end
8080 # Parsoid fails this test, but it might be tricky to support properly.
8081 # See bug 68395.
8082 !! test
8083 Unbalanced closing non-block tags don't break a list
8084 (php parser relies on Tidy to fix up)
8085 !! wikitext
8086 <span>
8087 *a</span><span>
8088 *b</span>
8089 !! html/php+tidy
8090 <ul>
8091 <li><span>a</span></li>
8092 <li><span>b</span></li>
8093 </ul>
8094 !! html/parsoid
8095 <span>
8096 <ul>
8097 <li>a<span></span>
8098 </li>
8099 <li>b
8100 </li>
8101 </ul>
8102 </span>
8103 !! end
8105 !! test
8106 Unclosed formatting tags that straddle lists are closed and reopened
8107 (php parser relies on Tidy to fix up)
8108 !! options
8109 parsoid=wt2html,wt2wt,html2html
8110 !! wikitext
8111 # <s> a
8112 # b </s>
8113 !! html/php+tidy
8114 <ol>
8115 <li><s>a</s></li>
8116 <li><s>b</s></li>
8117 </ol>
8118 !! html/parsoid
8119 <ol><li> <s> a</s></li>
8120 <li><s> b </s></li></ol>
8121 !! end
8123 # Parsoid fails this test, but it might be tricky to support properly.
8124 # See bug 68395.
8125 !!test
8126 List embedded in a non-block tag
8127 (Ugly Parsoid output -- worth fixing; PHP parser relies on Tidy)
8128 !! wikitext
8129 <small>
8130 * foo
8131 </small>
8132 !! html/php+tidy
8133 <ul>
8134 <li><small>foo</small></li>
8135 </ul>
8136 !! html/parsoid
8137 <small>
8138 <ul>
8139 <li> foo</li>
8140 </ul>
8141 </small>
8142 !!end
8144 # This is a bug in the PHP parser + tidy combination.
8145 # (The </tr> tag gets parsed as text and html-escaped by PHP,
8146 # and then fostered out of the table by tidy.)
8147 # We believe the Parsoid output to be correct.
8148 !! test
8149 Table with missing opening <tr> tag
8150 !! options
8151 parsoid=wt2html,wt2wt
8152 !! wikitext
8153 <table>
8154 <td>foo</td>
8155 </tr>
8156 </table>
8157 !! html/php+tidy
8158 <p>&lt;/tr&gt;</p>
8159 <table>
8160 <tr>
8161 <td>foo</td>
8162 </tr>
8163 </table>
8164 !! html/parsoid
8165 <table>
8166 <tr>
8167 <td>foo</td>
8168 </tr>
8169 </table>
8170 !! end
8173 ### Magic Words
8176 # Note that the current date is hard-coded as
8177 #   1970-01-01T00:02:03Z (a Thursday)
8178 # when running parser tests.  The timezone is also fixed to GMT, so
8179 # local date will be identical to current date.
8181 !! test
8182 Magic Word: {{CURRENTDAY}}
8183 !! wikitext
8184 {{CURRENTDAY}}
8185 !! html
8186 <p>1
8187 </p>
8188 !! end
8190 !! test
8191 Magic Word: {{CURRENTDAY2}}
8192 !! wikitext
8193 {{CURRENTDAY2}}
8194 !! html
8195 <p>01
8196 </p>
8197 !! end
8199 !! test
8200 Magic Word: {{CURRENTDAYNAME}}
8201 !! wikitext
8202 {{CURRENTDAYNAME}}
8203 !! html
8204 <p>Thursday
8205 </p>
8206 !! end
8208 !! test
8209 Magic Word: {{CURRENTDOW}}
8210 !! wikitext
8211 {{CURRENTDOW}}
8212 !! html
8213 <p>4
8214 </p>
8215 !! end
8217 !! test
8218 Magic Word: {{CURRENTMONTH}}
8219 !! wikitext
8220 {{CURRENTMONTH}}
8221 !! html
8222 <p>01
8223 </p>
8224 !! end
8226 !! test
8227 Magic Word: {{CURRENTMONTH1}}
8228 !! wikitext
8229 {{CURRENTMONTH1}}
8230 !! html
8231 <p>1
8232 </p>
8233 !! end
8235 !! test
8236 Magic Word: {{CURRENTMONTHABBREV}}
8237 !! wikitext
8238 {{CURRENTMONTHABBREV}}
8239 !! html
8240 <p>Jan
8241 </p>
8242 !! end
8244 !! test
8245 Magic Word: {{CURRENTMONTHNAME}}
8246 !! wikitext
8247 {{CURRENTMONTHNAME}}
8248 !! html
8249 <p>January
8250 </p>
8251 !! end
8253 !! test
8254 Magic Word: {{CURRENTMONTHNAMEGEN}}
8255 !! wikitext
8256 {{CURRENTMONTHNAMEGEN}}
8257 !! html
8258 <p>January
8259 </p>
8260 !! end
8262 !! test
8263 Magic Word: {{CURRENTTIME}}
8264 !! wikitext
8265 {{CURRENTTIME}}
8266 !! html
8267 <p>00:02
8268 </p>
8269 !! end
8271 !! test
8272 Magic Word: {{CURRENTHOUR}}
8273 !! wikitext
8274 {{CURRENTHOUR}}
8275 !! html
8276 <p>00
8277 </p>
8278 !! end
8280 !! test
8281 Magic Word: {{CURRENTWEEK}} (@bug 4594)
8282 !! wikitext
8283 {{CURRENTWEEK}}
8284 !! html
8285 <p>1
8286 </p>
8287 !! end
8289 !! test
8290 Magic Word: {{CURRENTYEAR}}
8291 !! wikitext
8292 {{CURRENTYEAR}}
8293 !! html
8294 <p>1970
8295 </p>
8296 !! end
8298 !! test
8299 Magic Word: {{CURRENTTIMESTAMP}}
8300 !! wikitext
8301 {{CURRENTTIMESTAMP}}
8302 !! html
8303 <p>19700101000203
8304 </p>
8305 !! end
8307 !! test
8308 Magic Words LOCAL (UTC)
8309 !! wikitext
8310 * {{LOCALMONTH}}
8311 * {{LOCALMONTH1}}
8312 * {{LOCALMONTHNAME}}
8313 * {{LOCALMONTHNAMEGEN}}
8314 * {{LOCALMONTHABBREV}}
8315 * {{LOCALDAY}}
8316 * {{LOCALDAY2}}
8317 * {{LOCALDAYNAME}}
8318 * {{LOCALYEAR}}
8319 * {{LOCALTIME}}
8320 * {{LOCALHOUR}}
8321 * {{LOCALWEEK}}
8322 * {{LOCALDOW}}
8323 * {{LOCALTIMESTAMP}}
8324 !! html
8325 <ul><li> 01</li>
8326 <li> 1</li>
8327 <li> January</li>
8328 <li> January</li>
8329 <li> Jan</li>
8330 <li> 1</li>
8331 <li> 01</li>
8332 <li> Thursday</li>
8333 <li> 1970</li>
8334 <li> 00:02</li>
8335 <li> 00</li>
8336 <li> 1</li>
8337 <li> 4</li>
8338 <li> 19700101000203</li></ul>
8340 !! end
8342 !! test
8343 Magic Word: {{FULLPAGENAME}}
8344 !! options
8345 title=[[User:Ævar Arnfjörð Bjarmason]]
8346 !! wikitext
8347 {{FULLPAGENAME}}
8348 !! html
8349 <p>User:Ævar Arnfjörð Bjarmason
8350 </p>
8351 !! end
8353 !! test
8354 Magic Word: {{FULLPAGENAMEE}}
8355 !! options
8356 title=[[User:Ævar Arnfjörð Bjarmason]]
8357 !! wikitext
8358 {{FULLPAGENAMEE}}
8359 !! html
8360 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
8361 </p>
8362 !! end
8364 !! test
8365 Magic Word: {{TALKSPACE}}
8366 !! options
8367 title=[[User:Ævar Arnfjörð Bjarmason]]
8368 !! wikitext
8369 {{TALKSPACE}}
8370 !! html
8371 <p>User talk
8372 </p>
8373 !! end
8375 !! test
8376 Magic Word: {{TALKSPACE}}, same namespace
8377 !! options
8378 title=[[User talk:Ævar Arnfjörð Bjarmason]]
8379 !! wikitext
8380 {{TALKSPACE}}
8381 !! html
8382 <p>User talk
8383 </p>
8384 !! end
8386 !! test
8387 Magic Word: {{TALKSPACE}}, main namespace
8388 !! options
8389 title=[[Parser Test]]
8390 !! wikitext
8391 {{TALKSPACE}}
8392 !! html
8393 <p>Talk
8394 </p>
8395 !! end
8397 !! test
8398 Magic Word: {{TALKSPACEE}}
8399 !! options
8400 title=[[User:Ævar Arnfjörð Bjarmason]]
8401 !! wikitext
8402 {{TALKSPACEE}}
8403 !! html
8404 <p>User_talk
8405 </p>
8406 !! end
8408 !! test
8409 Magic Word: {{SUBJECTSPACE}}
8410 !! options
8411 title=[[User talk:Ævar Arnfjörð Bjarmason]]
8412 !! wikitext
8413 {{SUBJECTSPACE}}
8414 !! html
8415 <p>User
8416 </p>
8417 !! end
8419 !! test
8420 Magic Word: {{SUBJECTSPACE}}, same namespace
8421 !! options
8422 title=[[User:Ævar Arnfjörð Bjarmason]]
8423 !! wikitext
8424 {{SUBJECTSPACE}}
8425 !! html
8426 <p>User
8427 </p>
8428 !! end
8430 !! test
8431 Magic Word: {{SUBJECTSPACE}}, main namespace
8432 !! options
8433 title=[[Parser Test]]
8434 !! wikitext
8435 {{SUBJECTSPACE}}
8436 !! html
8438 !! end
8440 !! test
8441 Magic Word: {{SUBJECTSPACEE}}
8442 !! options
8443 title=[[User talk:Ævar Arnfjörð Bjarmason]]
8444 !! wikitext
8445 {{SUBJECTSPACEE}}
8446 !! html
8447 <p>User
8448 </p>
8449 !! end
8451 !! test
8452 Magic Word: {{NAMESPACE}}
8453 !! options
8454 title=[[User:Ævar Arnfjörð Bjarmason]]
8455 !! wikitext
8456 {{NAMESPACE}}
8457 !! html
8458 <p>User
8459 </p>
8460 !! end
8462 !! test
8463 Magic Word: {{NAMESPACEE}}
8464 !! options
8465 title=[[User:Ævar Arnfjörð Bjarmason]]
8466 !! wikitext
8467 {{NAMESPACEE}}
8468 !! html
8469 <p>User
8470 </p>
8471 !! end
8473 !! test
8474 Magic Word: {{NAMESPACENUMBER}}
8475 !! options
8476 title=[[User:Ævar Arnfjörð Bjarmason]]
8477 !! wikitext
8478 {{NAMESPACENUMBER}}
8479 !! html
8480 <p>2
8481 </p>
8482 !! end
8484 !! test
8485 Magic Word: {{SUBPAGENAME}}
8486 !! options
8487 title=[[Ævar Arnfjörð Bjarmason/sub ö]] subpage
8488 !! wikitext
8489 {{SUBPAGENAME}}
8490 !! html
8491 <p>sub ö
8492 </p>
8493 !! end
8495 !! test
8496 Magic Word: {{SUBPAGENAMEE}}
8497 !! options
8498 title=[[Ævar Arnfjörð Bjarmason/sub ö]] subpage
8499 !! wikitext
8500 {{SUBPAGENAMEE}}
8501 !! html
8502 <p>sub_%C3%B6
8503 </p>
8504 !! end
8506 !! test
8507 Magic Word: {{ROOTPAGENAME}}
8508 !! options
8509 title=[[Ævar Arnfjörð Bjarmason/sub/sub2]] subpage
8510 !! wikitext
8511 {{ROOTPAGENAME}}
8512 !! html
8513 <p>Ævar Arnfjörð Bjarmason
8514 </p>
8515 !! end
8517 !! test
8518 Magic Word: {{ROOTPAGENAMEE}}
8519 !! options
8520 title=[[Ævar Arnfjörð Bjarmason/sub/sub2]] subpage
8521 !! wikitext
8522 {{ROOTPAGENAMEE}}
8523 !! html
8524 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
8525 </p>
8526 !! end
8528 !! test
8529 Magic Word: {{BASEPAGENAME}}
8530 !! options
8531 title=[[Ævar Arnfjörð Bjarmason/sub]] subpage
8532 !! wikitext
8533 {{BASEPAGENAME}}
8534 !! html
8535 <p>Ævar Arnfjörð Bjarmason
8536 </p>
8537 !! end
8539 !! test
8540 Magic Word: {{BASEPAGENAMEE}}
8541 !! options
8542 title=[[Ævar Arnfjörð Bjarmason/sub]] subpage
8543 !! wikitext
8544 {{BASEPAGENAMEE}}
8545 !! html
8546 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
8547 </p>
8548 !! end
8550 !! test
8551 Magic Word: {{TALKPAGENAME}}
8552 !! options
8553 title=[[User:Ævar Arnfjörð Bjarmason]]
8554 !! wikitext
8555 {{TALKPAGENAME}}
8556 !! html
8557 <p>User talk:Ævar Arnfjörð Bjarmason
8558 </p>
8559 !! end
8561 !! test
8562 Magic Word: {{TALKPAGENAMEE}}
8563 !! options
8564 title=[[User:Ævar Arnfjörð Bjarmason]]
8565 !! wikitext
8566 {{TALKPAGENAMEE}}
8567 !! html
8568 <p>User_talk:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
8569 </p>
8570 !! end
8572 !! test
8573 Magic Word: {{SUBJECTPAGENAME}}
8574 !! options
8575 title=[[User talk:Ævar Arnfjörð Bjarmason]]
8576 !! wikitext
8577 {{SUBJECTPAGENAME}}
8578 !! html
8579 <p>User:Ævar Arnfjörð Bjarmason
8580 </p>
8581 !! end
8583 !! test
8584 Magic Word: {{SUBJECTPAGENAMEE}}
8585 !! options
8586 title=[[User talk:Ævar Arnfjörð Bjarmason]]
8587 !! wikitext
8588 {{SUBJECTPAGENAMEE}}
8589 !! html
8590 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
8591 </p>
8592 !! end
8594 !! test
8595 Magic Word: {{NUMBEROFFILES}}
8596 !! wikitext
8597 {{NUMBEROFFILES}}
8598 !! html
8599 <p>5
8600 </p>
8601 !! end
8603 !! test
8604 Magic Word: {{PAGENAME}}
8605 !! options
8606 title=[[User:Ævar Arnfjörð Bjarmason]]
8607 !! wikitext
8608 {{PAGENAME}}
8609 !! html
8610 <p>Ævar Arnfjörð Bjarmason
8611 </p>
8612 !! end
8614 !! test
8615 Magic Word: {{PAGENAME}} with metacharacters
8616 !! options
8617 title=[['foo & bar = baz']]
8618 !! wikitext
8619 ''{{PAGENAME}}''
8620 !! html/php
8621 <p><i>&#39;foo &#38; bar &#61; baz&#39;</i>
8622 </p>
8623 !! html+tidy
8624 <p><i>'foo &amp; bar = baz'</i></p>
8625 !! end
8627 !! test
8628 Magic Word: {{PAGENAME}} with metacharacters (bug 26781)
8629 !! options
8630 title=[[*RFC 1234 http://example.com/]]
8631 !! wikitext
8632 {{PAGENAME}}
8633 !! html/php
8634 <p>&#42;RFC&#32;1234 http&#58;//example.com/
8635 </p>
8636 !! html+tidy
8637 <p>*RFC 1234 http://example.com/</p>
8638 !! end
8640 !! test
8641 Magic Word: {{PAGENAMEE}}
8642 !! options
8643 title=[[User:Ævar Arnfjörð Bjarmason]]
8644 !! wikitext
8645 {{PAGENAMEE}}
8646 !! html
8647 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
8648 </p>
8649 !! end
8651 !! test
8652 Magic Word: {{PAGENAMEE}} with metacharacters (bug 26781)
8653 !! options
8654 title=[[*RFC 1234 http://example.com/]]
8655 !! wikitext
8656 {{PAGENAMEE}}
8657 !! html/php
8658 <p>&#42;RFC_1234_http&#58;//example.com/
8659 </p>
8660 !! html+tidy
8661 <p>*RFC_1234_http://example.com/</p>
8662 !! end
8664 !! test
8665 Magic Word: {{REVISIONID}}
8666 !! wikitext
8667 {{REVISIONID}}
8668 !! html
8669 <p>1337
8670 </p>
8671 !! end
8673 !! test
8674 Magic Word: {{SCRIPTPATH}}
8675 !! wikitext
8676 {{SCRIPTPATH}}
8677 !! html
8678 <p>/
8679 </p>
8680 !! end
8682 !! test
8683 Magic Word: {{STYLEPATH}}
8684 !! wikitext
8685 {{STYLEPATH}}
8686 !! html
8687 <p>/skins
8688 </p>
8689 !! end
8691 !! test
8692 Magic Word: {{SERVER}}
8693 !! wikitext
8694 {{SERVER}}
8695 !! html
8696 <p><a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
8697 </p>
8698 !! end
8700 !! test
8701 Magic Word: {{SERVERNAME}}
8702 !! wikitext
8703 {{SERVERNAME}}
8704 !! html
8705 <p>example.org
8706 </p>
8707 !! end
8709 !! test
8710 Magic Word: {{SITENAME}}
8711 !! wikitext
8712 {{SITENAME}}
8713 !! html
8714 <p>MediaWiki
8715 </p>
8716 !! end
8718 !! test
8719 Case-sensitive magic words, when cased differently, should just be template transclusions
8720 !! wikitext
8721 {{CurrentMonth}}
8722 {{currentday}}
8723 {{cURreNTweEK}}
8724 {{currentHour}}
8725 !! html
8726 <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>
8727 <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>
8728 <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>
8729 <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>
8730 </p>
8731 !! end
8733 !! test
8734 Case-insensitive magic words should still work with weird casing.
8735 !! wikitext
8736 {{sErVeRNaMe}}
8737 {{LCFirst:AOEU}}
8738 {{ucFIRST:aoeu}}
8739 {{SERver}}
8740 !! html
8741 <p>example.org
8742 aOEU
8743 Aoeu
8744 <a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
8745 </p>
8746 !! end
8748 !! test
8749 Namespace 1 {{ns:1}}
8750 !! wikitext
8751 {{ns:1}}
8752 !! html
8753 <p>Talk
8754 </p>
8755 !! end
8757 !! test
8758 Namespace 1 {{ns:01}}
8759 !! wikitext
8760 {{ns:01}}
8761 !! html
8762 <p>Talk
8763 </p>
8764 !! end
8766 !! test
8767 Namespace 0 {{ns:0}} (bug 4783)
8768 !! wikitext
8769 {{ns:0}}
8770 !! html
8772 !! end
8774 !! test
8775 Namespace 0 {{ns:00}} (bug 4783)
8776 !! wikitext
8777 {{ns:00}}
8778 !! html
8780 !! end
8782 !! test
8783 Namespace -1 {{ns:-1}}
8784 !! wikitext
8785 {{ns:-1}}
8786 !! html
8787 <p>Special
8788 </p>
8789 !! end
8791 !! test
8792 Namespace User {{ns:User}}
8793 !! wikitext
8794 {{ns:User}}
8795 !! html
8796 <p>User
8797 </p>
8798 !! end
8800 !! test
8801 Namespace User talk {{ns:User_talk}}
8802 !! wikitext
8803 {{ns:User_talk}}
8804 !! html
8805 <p>User talk
8806 </p>
8807 !! end
8809 !! test
8810 Namespace User talk {{ns:uSeR tAlK}}
8811 !! wikitext
8812 {{ns:uSeR tAlK}}
8813 !! html
8814 <p>User talk
8815 </p>
8816 !! end
8818 !! test
8819 Namespace File {{ns:File}}
8820 !! wikitext
8821 {{ns:File}}
8822 !! html
8823 <p>File
8824 </p>
8825 !! end
8827 !! test
8828 Namespace File {{ns:Image}}
8829 !! wikitext
8830 {{ns:Image}}
8831 !! html
8832 <p>File
8833 </p>
8834 !! end
8836 !! test
8837 Namespace (lang=de) Benutzer {{ns:User}}
8838 !! options
8839 language=de
8840 !! wikitext
8841 {{ns:User}}
8842 !! html
8843 <p>Benutzer
8844 </p>
8845 !! end
8847 !! test
8848 Namespace (lang=de) Benutzer Diskussion {{ns:3}}
8849 !! options
8850 language=de
8851 !! wikitext
8852 {{ns:3}}
8853 !! html
8854 <p>Benutzer Diskussion
8855 </p>
8856 !! end
8859 !! test
8860 Urlencode
8861 !! wikitext
8862 {{urlencode:hi world?!}}
8863 {{urlencode:hi world?!|WIKI}}
8864 {{urlencode:hi world?!|PATH}}
8865 {{urlencode:hi world?!|QUERY}}
8866 !! html
8867 <p>hi+world%3F%21
8868 hi_world%3F!
8869 hi%20world%3F%21
8870 hi+world%3F%21
8871 </p>
8872 !! end
8874 !! test
8875 Magic Word: prioritize type info over data-parsoid
8876 !! options
8877 parsoid=html2wt
8878 !! wikitext
8879 __FORCETOC__
8880 !! html
8881 <meta property="mw:PageProp/forcetoc" data-parsoid='{"src":"__NOTOC__","magicSrc":"__NOTOC__"}'/>
8882 !! end
8884 !! test
8885 Magic Word: serialize on separate line (parsoid)
8886 !! options
8887 parsoid=wt2wt,html2wt
8888 !! wikitext
8890 __NOTOC__
8892 !! html
8893 foo<meta property="mw:PageProp/notoc"/>bar
8894 !! end
8896 !! test
8897 Magic Word: rt non-english wikis
8898 !! options
8899 parsoid=wt2wt
8900 language=de
8901 !! wikitext
8902 __NOEDITSECTION__
8903 !! html
8904 <meta property="mw:PageProp/noeditsection" data-parsoid='{"src":"__NOEDITSECTION__","magicSrc":"__NOEDITSECTION__"}'/>
8905 !! end
8908 ### Magic links
8910 !! test
8911 Magic links: internal link to RFC (bug 479)
8912 !! wikitext
8913 [[RFC 123]]
8914 !! html
8915 <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>
8916 </p>
8917 !! end
8919 !! test
8920 Magic links: RFC (bug 479)
8921 !! wikitext
8922 RFC 822
8923 !! html
8924 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc822">RFC 822</a>
8925 </p>
8926 !! end
8928 !! test
8929 Magic links: RFC (bug 65278)
8930 !! wikitext
8931 This is RFC 822 but thisRFC 822 is not RFC 822linked.
8932 !! html
8933 <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.
8934 </p>
8935 !! end
8937 !! test
8938 Magic links: RFC (w/ non-newline whitespace, bug 28950/29025)
8939 !! wikitext
8940 RFC &nbsp;&#160;&#0160;&#xA0;&#Xa0; 822
8943 !! html
8944 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc822">RFC 822</a>
8947 </p>
8948 !! end
8950 !! test
8951 Magic links: ISBN (bug 1937)
8952 !! wikitext
8953 ISBN 0-306-40615-2
8954 !! html
8955 <p><a href="/wiki/Special:BookSources/0306406152" class="internal mw-magiclink-isbn">ISBN 0-306-40615-2</a>
8956 </p>
8957 !! end
8959 !! test
8960 Magic links: ISBN (bug 65278)
8961 !! wikitext
8962 This is ISBN 978-0-316-09811-3 but thisISBN 978-0-316-09811-3 is not ISBN 978-0-316-09811-3linked.
8963 !! html
8964 <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.
8965 </p>
8966 !! end
8968 !! test
8969 Magic links: ISBN (w/ non-newline whitespace, bug 28950/29025)
8970 !! wikitext
8971 ISBN &nbsp;&#160;&#0160;&#xA0;&#Xa0; 978&nbsp;0&#160;316&#0160;09811&#xA0;3
8972 ISBN
8973 9780316098113
8974 ISBN 978
8975 0316098113
8976 !! html
8977 <p><a href="/wiki/Special:BookSources/9780316098113" class="internal mw-magiclink-isbn">ISBN 978 0 316 09811 3</a>
8978 ISBN
8979 9780316098113
8980 ISBN 978
8981 0316098113
8982 </p>
8983 !! end
8985 !! test
8986 Magic links: PMID incorrectly converts space to underscore
8987 !! wikitext
8988 PMID 1234
8989 !! html
8990 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a>
8991 </p>
8992 !! end
8994 !! test
8995 Magic links: PMID (bug 65278)
8996 !! wikitext
8997 This is PMID 1234 but thisPMID 1234 is not PMID 1234linked.
8998 !! html
8999 <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.
9000 </p>
9001 !! end
9003 !! test
9004 Magic links: PMID (w/ non-newline whitespace, bug 28950/29025)
9005 !! wikitext
9006 PMID &nbsp;&#160;&#0160;&#xA0;&#Xa0; 1234
9007 PMID
9008 1234
9009 !! html
9010 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a>
9011 PMID
9012 1234
9013 </p>
9014 !! end
9017 ### Templates
9018 ####
9020 !! test
9021 Nonexistent template
9022 !! wikitext
9023 {{thistemplatedoesnotexist}}
9024 !! html
9025 <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>
9026 </p>
9027 !! end
9029 !! test
9030 Template with invalid target containing tags
9031 !! wikitext
9032 {{a<b>b</b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
9033 !! html
9034 <p>{{a<b>b</b>|foo|a=b|a = b}}
9035 </p>
9036 !! end
9038 !! test
9039 Template with invalid target containing unclosed tag
9040 !! wikitext
9041 {{a<b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
9042 !! html
9043 <p>{{a<b>|foo|a=b|a = b}}</b>
9044 </p>
9045 !! end
9047 !! test
9048 Template with invalid target containing wikilink
9049 !! wikitext
9050 {{[[Main Page]]}}
9051 !! html/php
9052 <p>{{<a href="/wiki/Main_Page" title="Main Page">Main Page</a>}}
9053 </p>
9054 !! html/parsoid
9055 <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>
9056 !! end
9058 !! test
9059 Template with just whitespace in it, bug #68421
9060 !! wikitext
9061 {{echo|{{ }}}}
9062 !! html/parsoid
9063 <p><span typeof="mw:Transclusion mw:Nowiki" about="#mwt1" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"{{ }}"}},"i":0}}]}'>{{ }}</span></p>
9064 !! end
9066 !! article
9067 Template:test
9068 !! text
9069 This is a test template
9070 !! endarticle
9072 !! test
9073 Simple template
9074 !! wikitext
9075 {{test}}
9076 !! html
9077 <p>This is a test template
9078 </p>
9079 !! end
9081 !! test
9082 Template with explicit namespace
9083 !! wikitext
9084 {{Template:test}}
9085 !! html
9086 <p>This is a test template
9087 </p>
9088 !! end
9091 !! article
9092 Template:paramtest
9093 !! text
9094 This is a test template with parameter {{{param}}}
9095 !! endarticle
9097 !! test
9098 Template parameter
9099 !! wikitext
9100 {{paramtest|param=foo}}
9101 !! html
9102 <p>This is a test template with parameter foo
9103 </p>
9104 !! end
9106 !! article
9107 Template:paramtestnum
9108 !! text
9109 [[{{{1}}}|{{{2}}}]]
9110 !! endarticle
9112 !! test
9113 Template unnamed parameter
9114 !! wikitext
9115 {{paramtestnum|Main Page|the main page}}
9116 !! html
9117 <p><a href="/wiki/Main_Page" title="Main Page">the main page</a>
9118 </p>
9119 !! end
9121 !! article
9122 Template:templatesimple
9123 !! text
9124 (test)
9125 !! endarticle
9127 !! article
9128 Template:templateredirect
9129 !! text
9130 #redirect [[Template:templatesimple]]
9131 !! endarticle
9133 !! article
9134 Template:templateasargtestnum
9135 !! text
9136 {{{{{1}}}}}
9137 !! endarticle
9139 !! article
9140 Template:templateasargtest
9141 !! text
9142 {{template{{{templ}}}}}
9143 !! endarticle
9145 !! article
9146 Template:templateasargtest2
9147 !! text
9148 {{{{{templ}}}}}
9149 !! endarticle
9151 !! test
9152 Template with template name as unnamed argument
9153 !! wikitext
9154 {{templateasargtestnum|templatesimple}}
9155 !! html
9156 <p>(test)
9157 </p>
9158 !! end
9160 !! test
9161 Template with template name as argument
9162 !! wikitext
9163 {{templateasargtest|templ=simple}}
9164 !! html
9165 <p>(test)
9166 </p>
9167 !! end
9169 !! test
9170 Template with template name as argument (2)
9171 !! wikitext
9172 {{templateasargtest2|templ=templatesimple}}
9173 !! html
9174 <p>(test)
9175 </p>
9176 !! end
9178 !! article
9179 Template:templateasargtestdefault
9180 !! text
9181 {{{{{templ|templatesimple}}}}}
9182 !! endarticle
9184 !! article
9185 Template:templa
9186 !! text
9187 '''templ'''
9188 !! endarticle
9190 !! test
9191 Template with default value
9192 !! wikitext
9193 {{templateasargtestdefault}}
9194 !! html
9195 <p>(test)
9196 </p>
9197 !! end
9199 !! test
9200 Template with default value (value set)
9201 !! wikitext
9202 {{templateasargtestdefault|templ=templa}}
9203 !! html
9204 <p><b>templ</b>
9205 </p>
9206 !! end
9208 !! test
9209 Template redirect
9210 !! wikitext
9211 {{templateredirect}}
9212 !! html
9213 <p>(test)
9214 </p>
9215 !! end
9217 !! test
9218 Template with argument in separate line
9219 !! wikitext
9220 {{ templateasargtest  |
9221  templ = simple }}
9222 !! html
9223 <p>(test)
9224 </p>
9225 !! end
9227 !! test
9228 Template with complex template as argument
9229 !! wikitext
9230 {{paramtest|
9231   param ={{ templateasargtest  |
9232  templ = simple }}}}
9233 !! html
9234 <p>This is a test template with parameter (test)
9235 </p>
9236 !! end
9238 !! test
9239 Template with thumb image (with link in description)
9240 !! wikitext
9241 {{paramtest|param =[[Image:noimage.png|thumb|[[no link|link]] [[no link|caption]]]]}}
9242 !! html/php
9243 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>
9245 !! html+tidy
9246 <p>This is a test template with parameter</p>
9247 <div class="thumb tright">
9248 <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>
9249 <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>
9250 </div>
9251 </div>
9252 !! html/parsoid
9253 <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>
9254 !! end
9256 !! article
9257 Template:complextemplate
9258 !! text
9259 {{{1}}} {{paramtest|
9260   param ={{{param}}}}}
9261 !! endarticle
9263 !! test
9264 Template with complex arguments
9265 !! wikitext
9266 {{complextemplate|
9267   param ={{ templateasargtest  |
9268  templ = simple }}|[[Template:complextemplate|link]]}}
9269 !! html
9270 <p><a href="/wiki/Template:Complextemplate" title="Template:Complextemplate">link</a> This is a test template with parameter (test)
9271 </p>
9272 !! end
9274 !! test
9275 BUG 553: link with two variables in a piped link
9276 !! wikitext
9278 |[[{{{1}}}|{{{2}}}]]
9280 !! html
9281 <table>
9282 <tr>
9283 <td>[[{{{1}}}|{{{2}}}]]
9284 </td></tr></table>
9286 !! end
9288 !! test
9289 Magic variable as template parameter
9290 !! wikitext
9291 {{paramtest|param={{SITENAME}}}}
9292 !! html
9293 <p>This is a test template with parameter MediaWiki
9294 </p>
9295 !! end
9297 !! article
9298 Template:linktest
9299 !! text
9300 [[{{{param}}}|link]]
9301 !! endarticle
9303 !! test
9304 Template parameter as link source
9305 !! wikitext
9306 {{linktest|param=Main Page}}
9307 !! html
9308 <p><a href="/wiki/Main_Page" title="Main Page">link</a>
9309 </p>
9310 !! end
9312 !!test
9313 Template-generated attribute string (k='v')
9314 !! wikitext
9315 <span {{attr_str|id|v1}}>bar</span>
9316 !! html
9317 <p><span id="v1">bar</span>
9318 </p>
9319 !!end
9321 !!article
9322 Template:paramtest2
9323 !! text
9324 including another template, {{paramtest|param={{{arg}}}}}
9325 !! endarticle
9327 !! test
9328 Template passing argument to another template
9329 !! wikitext
9330 {{paramtest2|arg='hmm'}}
9331 !! html
9332 <p>including another template, This is a test template with parameter 'hmm'
9333 </p>
9334 !! end
9336 !! article
9337 Template:Linktest2
9338 !! text
9339 Main Page
9340 !! endarticle
9342 !! test
9343 Template as link source
9344 !! wikitext
9345 [[{{linktest2}}]]
9347 [[{{linktest2}}|Main Page]]
9349 [[{{linktest2}}]]Page
9350 !! html
9351 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
9352 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
9353 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>Page
9354 </p>
9355 !! end
9358 !! article
9359 Template:loop1
9360 !! text
9361 {{loop2}}
9362 !! endarticle
9364 !! article
9365 Template:loop2
9366 !! text
9367 {{loop1}}
9368 !! endarticle
9370 !! test
9371 Template infinite loop
9372 !! wikitext
9373 {{loop1}}
9374 !! html
9375 <p><span class="error">Template loop detected: <a href="/wiki/Template:Loop1" title="Template:Loop1">Template:Loop1</a></span>
9376 </p>
9377 !! end
9379 !! test
9380 Template from main namespace
9381 !! wikitext
9382 {{:Main Page}}
9383 !! html
9384 <p>blah blah
9385 </p>
9386 !! end
9388 !! article
9389 Template:table
9390 !! text
9392 | 1 || 2
9394 | 3 || 4
9396 !! endarticle
9398 !! test
9399 BUG 529: Template with table, not included at beginning of line
9400 !! wikitext
9401 foo {{table}}
9402 !! html
9403 <p>foo 
9404 </p>
9405 <table>
9406 <tr>
9407 <td> 1 </td>
9408 <td> 2
9409 </td></tr>
9410 <tr>
9411 <td> 3 </td>
9412 <td> 4
9413 </td></tr></table>
9415 !! end
9417 !! test
9418 BUG 523: Template shouldn't eat newline (or add an extra one before table)
9419 !! wikitext
9421 {{table}}
9422 !! html
9423 <p>foo
9424 </p>
9425 <table>
9426 <tr>
9427 <td> 1 </td>
9428 <td> 2
9429 </td></tr>
9430 <tr>
9431 <td> 3 </td>
9432 <td> 4
9433 </td></tr></table>
9435 !! end
9437 !! test
9438 BUG 41: Template parameters shown as broken links
9439 !! wikitext
9440 {{{parameter}}}
9441 !! html
9442 <p>{{{parameter}}}
9443 </p>
9444 !! end
9446 !! test
9447 Template with targets containing wikilinks
9448 !! wikitext
9449 {{[[foo]]}}
9451 {{[[{{echo|foo}}]]}}
9453 {{{{echo|[[foo}}]]}}
9454 !! html
9455 <p>{{<a href="/wiki/Foo" title="Foo">foo</a>}}
9456 </p><p>{{<a href="/wiki/Foo" title="Foo">foo</a>}}
9457 </p><p>{{[[foo}}]]
9458 </p>
9459 !! end
9461 !! article
9462 Template:MSGNW test
9463 !! text
9464 ''None'' of '''this''' should be 
9465 * interpreted
9466  but rather passed unmodified
9467 {{test}}
9468 <gallery>
9469 File:Foobar.jpg
9470 </gallery>
9471 !! endarticle
9473 # hmm, fix this or just deprecate msgnw and document its behavior?
9474 !! test
9475 msgnw keyword
9476 !! wikitext
9477 {{msgnw:MSGNW test}}
9478 !! html
9479 <p>&#39;&#39;None&#39;&#39; of &#39;&#39;&#39;this&#39;&#39;&#39; should be 
9480 &#42; interpreted
9481 &#32;but rather passed unmodified
9482 &#123;&#123;test&#125;&#125;
9483 &#60;gallery&#62;
9484 File:Foobar.jpg
9485 &#60;/gallery&#62;
9486 </p>
9487 !! end
9489 !! test
9490 int keyword
9491 !! wikitext
9492 {{int:youhavenewmessages|lots of money|not!}}
9493 !! html
9494 <p>You have lots of money (not!).
9495 </p>
9496 !! end
9498 !! article
9499 Template:Includes
9500 !! text
9501 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
9502 !! endarticle
9504 !! test
9505 <includeonly> and <noinclude> being included
9506 !! wikitext
9507 {{Includes}}
9508 !! html
9509 <p>Foobar
9510 </p>
9511 !! end
9513 !! article
9514 Template:Includes2
9515 !! text
9516 <onlyinclude>Foo</onlyinclude>bar
9517 !! endarticle
9519 !! test
9520 <onlyinclude> being included
9521 !! wikitext
9522 {{Includes2}}
9523 !! html
9524 <p>Foo
9525 </p>
9526 !! end
9529 !! article
9530 Template:Includes3
9531 !! text
9532 <onlyinclude>Foo</onlyinclude>bar<includeonly>zar</includeonly>
9533 !! endarticle
9535 !! test
9536 <onlyinclude> and <includeonly> being included
9537 !! wikitext
9538 {{Includes3}}
9539 !! html
9540 <p>Foo
9541 </p>
9542 !! end
9544 !! test
9545 <includeonly> and <noinclude> on a page
9546 !! wikitext
9547 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
9548 !! html
9549 <p>Foozar
9550 </p>
9551 !! end
9553 !! test
9554 Un-closed <noinclude>
9555 !! wikitext
9556 <noinclude>
9557 !! html
9558 !! end
9560 !! test
9561 <onlyinclude> on a page
9562 !! wikitext
9563 <onlyinclude>Foo</onlyinclude>bar
9564 !! html
9565 <p>Foobar
9566 </p>
9567 !! end
9569 !! test
9570 Un-closed <onlyinclude>
9571 !! wikitext
9572 <onlyinclude>
9573 !! html
9574 !! end
9576 !!test
9577 Self-closed noinclude, includeonly, onlyinclude tags
9578 !! wikitext
9579 <noinclude />
9580 <includeonly />
9581 <onlyinclude />
9582 !! html
9583 <p><br />
9584 </p>
9585 !!end
9587 !!test
9588 Unbalanced includeonly and noinclude tags
9589 !! wikitext
9591 |a</noinclude>
9592 |b</noinclude></noinclude>
9593 |c</noinclude></includeonly>
9594 |d</includeonly></includeonly>
9596 !! html
9597 <table>
9598 <tr>
9599 <td>a
9600 </td>
9601 <td>b
9602 </td>
9603 <td>c&lt;/includeonly&gt;
9604 </td>
9605 <td>d&lt;/includeonly&gt;&lt;/includeonly&gt;
9606 </td></tr></table>
9608 !!end
9610 !! article
9611 Template:Includeonly section
9612 !! text
9613 <includeonly>
9614 ==Includeonly section==
9615 </includeonly>
9616 ==Section T-1==
9617 !!endarticle
9619 !! test
9620 Bug 6563: Edit link generation for section shown by <includeonly>
9621 !! wikitext
9622 {{includeonly section}}
9623 !! html
9624 <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>
9625 <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>
9627 !! end
9629 # Uses same input as the contents of [[Template:Includeonly section]]
9630 !! test
9631 Bug 6563: Section extraction for section shown by <includeonly>
9632 !! options
9633 section=T-2
9634 !! wikitext
9635 <includeonly>
9636 ==Includeonly section==
9637 </includeonly>
9638 ==Section T-2==
9639 !! html
9640 ==Section T-2==
9641 !! end
9643 !! test
9644 Bug 6563: Edit link generation for section suppressed by <includeonly>
9645 !! wikitext
9646 <includeonly>
9647 ==Includeonly section==
9648 </includeonly>
9649 ==Section 1==
9650 !! html
9651 <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>
9653 !! end
9655 !! test
9656 Bug 6563: Section extraction for section suppressed by <includeonly>
9657 !! options
9658 section=1
9659 !! wikitext
9660 <includeonly>
9661 ==Includeonly section==
9662 </includeonly>
9663 ==Section 1==
9664 !! html
9665 ==Section 1==
9666 !! end
9668 !! test
9669 Un-closed <includeonly>
9670 !! wikitext
9671 <includeonly>
9672 !! html
9673 !! end
9675 !! test
9676 Includes and comments at SOL
9677 !! wikitext
9678 <!-- comment --><noinclude><!-- comment --></noinclude><!-- comment -->== hu ==
9680 <noinclude>
9681 some
9682 </noinclude>* stuff
9683 * here
9685 <includeonly>can have stuff</includeonly>=== here ===
9687 !! html/php
9688 <h2><span class="mw-headline" id="hu">hu</span></h2>
9689 <p>some
9690 </p>
9691 <ul><li> stuff</li>
9692 <li> here</li></ul>
9693 <h3><span class="mw-headline" id="here">here</span></h3>
9695 !! html/parsoid
9696 <!-- 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>
9698 <meta typeof="mw:Includes/NoInclude" data-parsoid='{"src":"&lt;noinclude>"}'/>
9699 <p>some</p>
9700 <meta typeof="mw:Includes/NoInclude/End" data-parsoid='{"src":"&lt;/noinclude>"}'/><ul><li> stuff</li>
9701 <li> here</li></ul>
9703 <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>
9705 !! end
9707 # TODO: test with DOM fragment reuse!
9708 !! test
9709 Parsoid: DOM fragment reuse
9710 !! options
9711 parsoid=wt2wt,wt2html
9712 !! wikitext
9713 a{{echo|b<table></table>c}}d
9715 a{{echo|b
9716 <table></table>
9717 c}}d
9719 {{echo|a
9721 <table></table>
9724 !! html
9725 <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","spc":["","","",""]}]]}'>ab</p><table about="#mwt1" data-parsoid='{"stx":"html"}'></table><p about="#mwt1">cd</p>
9727 <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","spc":["","","",""]}]]}'>ab</p><span about="#mwt2">
9728 </span><table about="#mwt2" data-parsoid='{"stx":"html"}'></table><span about="#mwt2">
9729 </span><p about="#mwt2">cd</p>
9731 <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","spc":["","","",""]}]]}'>a</p><span about="#mwt3">
9733 </span><table about="#mwt3" data-parsoid='{"stx":"html"}'></table><span about="#mwt3">
9735 </span><p about="#mwt3">b</p>
9736 !! end
9738 !! test
9739 Parsoid: Merge double tds (bug 50603)
9740 !! options
9741 parsoid
9742 !! wikitext
9744 |{{echo|{{!}} foo}}
9746 !! html
9747 <table><tbody>
9748 <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>
9749 </tbody></table>
9750 !! end
9752 !! test
9753 Parsoid: Merge double tds in nested transclusion content (bug 50603)
9754 !! options
9755 parsoid
9756 !! wikitext
9757 {{echo|<div>}}
9759 |{{echo|{{!}} foo}}
9761 {{echo|</div>}}
9762 !! html
9763 <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}}]}'>
9764 <table><tbody>
9765 <tr><td data-mw='{"parts":["|"]}'> foo</td></tr>
9766 </tbody></table>
9767 </div>
9768 !! end
9771 ### <includeonly> and <noinclude> in attributes
9773 !!test
9774 0. includeonly around the entire attribute
9775 !! wikitext
9776 <span <includeonly>id="v1"</includeonly><noinclude>id="v2"</noinclude>>bar</span>
9777 !! html
9778 <p><span id="v2">bar</span>
9779 </p>
9780 !!end
9782 !!test
9783 1. includeonly in html attr key
9784 !! wikitext
9785 <span <noinclude>id</noinclude><includeonly>about</includeonly>="foo">bar</span>
9786 !! html
9787 <p><span id="foo">bar</span>
9788 </p>
9789 !!end
9791 !!test
9792 2. includeonly in html attr value
9793 !! wikitext
9794 <span id="<noinclude>v1</noinclude><includeonly>v2</includeonly>">bar</span>
9795 <span id=<noinclude>"v1"</noinclude><includeonly>"v2"</includeonly>>bar</span>
9796 !! html
9797 <p><span id="v1">bar</span>
9798 <span id="v1">bar</span>
9799 </p>
9800 !!end
9802 !!test
9803 3. includeonly in part of an attr value
9804 !! wikitext
9805 <span style="color:<noinclude>red</noinclude><includeonly>blue</includeonly>;">bar</span>
9806 !! html
9807 <p><span style="color:red;">bar</span>
9808 </p>
9809 !!end
9811 !!test
9812 4. includeonly in table attributes
9813 !! wikitext
9815 |- <noinclude>
9818 </noinclude>
9819 |- <includeonly>
9822 </includeonly>
9824 !! html
9825 <table>
9828 <tr>
9829 <td>a
9830 </td></tr>
9831 </table>
9833 !!end
9836 ### Token Stream Patcher tests
9838 ### These tests won't always pass wt2wt and other modes because
9839 ### on serialization, the table will be output on a new line.
9840 ### For now, we are blacklisting them, and using this to test selser.
9843 !!test
9844 1. Table tag in SOL posn. should get reparsed correctly with valid TSR
9845 !!options
9846 parsoid=wt2html,wt2wt
9847 !!wikitext
9848 {{echo|}}{| width = '100%'
9849 |foo
9851 !!html/parsoid
9852 <span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":""}},"i":0}}]}'></span><table width="100%">
9853 <tbody><tr><td>foo</td></tr>
9854 </tbody></table>
9855 !!end
9857 !!test
9858 2. Table tag in SOL posn. should get reparsed correctly with valid TSR
9859 !!options
9860 parsoid=wt2html,wt2wt
9861 !!wikitext
9862 <includeonly>a</includeonly>{| {{{b}}}
9865 !!html/parsoid
9866 <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-mw='{"attribs":[[{"txt":"{{{b}}}","html":"&lt;span about=\"#mwt1\" typeof=\"mw:Param\" data-parsoid=\"{&amp;quot;dsr&amp;quot;:[31,38,null,null],&amp;quot;src&amp;quot;:&amp;quot;{{{b}}}&amp;quot;}\">{{{b}}}&lt;/span>"},{"html":""}]]}' data-parsoid='{"a":{"{{{b}}}":null},"sa":{"{{{b}}}":""}}'>
9867 <tbody><tr><td>c</td></tr>
9868 </tbody></table>
9870 !!end
9873 ### Testing parsing of templates where a template arg
9874 ### has the same name as the template itself.
9877 !! article
9878 Template:quote
9879 !! text
9880 {{{quote|{{{1}}}}}}
9881 !! endarticle
9883 !!test
9884 Templates: Template Name/Arg clash: 1. Use of positional param
9885 !! wikitext
9886 {{quote|foo}}
9887 !! html
9888 <p>foo
9889 </p>
9890 !!end
9892 !!test
9893 Templates: Template Name/Arg clash: 2. Use of named param
9894 !! wikitext
9895 {{quote|quote=foo}}
9896 !! html
9897 <p>foo
9898 </p>
9899 !!end
9901 !!test
9902 Templates: Template Name/Arg clash: 3. Use of named param with empty input
9903 !! wikitext
9904 {{quote|quote}}
9905 !! html
9906 <p>quote
9907 </p>
9908 !!end
9911 ### Parsoid-centric tests to stress Parsoid's ability to RT them unchanged
9914 !!test
9915 Templates: 1. Simple use
9916 !! wikitext
9917 {{echo|Foo}}
9918 !! html
9919 <p>Foo
9920 </p>
9921 !!end
9923 !!test
9924 Templates: 2. Inside a block tag
9925 !! wikitext
9926 <div>{{echo|Foo}}</div>
9927 <blockquote>{{echo|Foo}}</blockquote>
9928 !! html
9929 <div>Foo</div>
9930 <blockquote>Foo</blockquote>
9932 !! html+tidy
9933 <div>Foo</div>
9934 <blockquote>
9935 <p>Foo</p>
9936 </blockquote>
9937 !!end
9939 !!test
9940 Templates: P-wrapping: 1a. Templates on consecutive lines
9941 !! wikitext
9942 {{echo|Foo}}
9943 {{echo|bar}}
9944 !! html
9945 <p>Foo
9947 </p>
9948 !!end
9950 !!test
9951 Templates: P-wrapping: 1b. Templates on consecutive lines
9952 !! wikitext
9955 {{echo|bar}}
9956 {{echo|baz}}
9957 !! html
9958 <p>Foo
9959 </p><p>bar
9961 </p>
9962 !!end
9964 !!test
9965 Templates: P-wrapping: 1c. Templates on consecutive lines
9966 !! wikitext
9967 {{echo|Foo}}
9968 {{echo|bar}} <div>baz</div>
9969 !! html
9970 <p>Foo
9971 </p>
9972 bar <div>baz</div>
9974 !! html+tidy
9975 <p>Foo</p>
9976 <p>bar</p>
9977 <div>baz</div>
9978 !! end
9980 !!test
9981 Templates: P-wrapping: 1d. Template preceded by comment-only line
9982 !!options
9983 parsoid
9984 !! wikitext
9985 <!-- foo -->
9986 {{echo|Bar}}
9987 !! html
9988 <!-- foo -->
9990 <p about="#mwt223" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"Bar"}},"i":0}}]}'>Bar</p>
9991 !!end
9993 !!test
9994 Templates: Inline Text: 1. Multiple template uses
9995 !! wikitext
9996 {{echo|Foo}}bar{{echo|baz}}
9997 !! html
9998 <p>Foobarbaz
9999 </p>
10000 !!end
10002 !!test
10003 Templates: Inline Text: 2. Back-to-back template uses
10004 !! wikitext
10005 {{echo|Foo}}{{echo|bar}}
10006 !! html
10007 <p>Foobar
10008 </p>
10009 !!end
10011 !!test
10012 Templates: Block Tags: 1. Multiple template uses
10013 !! wikitext
10014 {{echo|<div>Foo</div>}}<div>bar</div>{{echo|<div>baz</div>}}
10015 !! html
10016 <div>Foo</div><div>bar</div><div>baz</div>
10018 !!end
10020 !!test
10021 Templates: Block Tags: 2. Back-to-back template uses
10022 !! wikitext
10023 {{echo|<div>Foo</div>}}{{echo|<div>bar</div>}}
10024 !! html
10025 <div>Foo</div><div>bar</div>
10027 !!end
10029 # This is an edge case relating to paragraph wrapping.
10030 !!test
10031 Templates: Correctly encapsulate templates producing </p> tag without a corresponding <p> tag
10032 !! wikitext
10033 {{echo|a
10034 b</p>}}
10035 !! html/parsoid
10036 <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
10037 b</p>
10038 !!end
10040 !!test
10041 Templates: Links: 1. Simple example
10042 !! wikitext
10043 {{echo|[[Foo|bar]]}}
10044 !! html
10045 <p><a href="/wiki/Foo" title="Foo">bar</a>
10046 </p>
10047 !!end
10049 !!test
10050 Templates: Links: 2. Generation of link href
10051 !! wikitext
10052 [[{{echo|Foo}}|bar]]
10053 !! html
10054 <p><a href="/wiki/Foo" title="Foo">bar</a>
10055 </p>
10056 !!end
10058 !!test
10059 Templates: Links: 3. Generation of part of a link href
10060 !! wikitext
10061 [[Fo{{echo|o}}|bar]]
10063 [[Foo{{echo|bar}}]]
10065 [[Foo{{echo|bar}}baz]]
10067 [[Foo{{echo|bar}}|bar]]
10069 [[:Foo{{echo|bar}}]]
10071 [[:Foo{{echo|bar}}|bar]]
10072 !! html
10073 <p><a href="/wiki/Foo" title="Foo">bar</a>
10074 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
10075 </p><p><a href="/index.php?title=Foobarbaz&amp;action=edit&amp;redlink=1" class="new" title="Foobarbaz (page does not exist)">Foobarbaz</a>
10076 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
10077 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
10078 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
10079 </p>
10080 !!end
10082 !!test
10083 Templates: Links: 4. Multiple templates generating link href
10084 !! wikitext
10085 [[{{echo|F}}{{echo|o}}ob{{echo|ar}}]]
10086 !! html
10087 <p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
10088 </p>
10089 !!end
10091 !!test
10092 Templates: Links: 5. Generation of link text
10093 !! wikitext
10094 [[Foo|{{echo|bar}}]]
10095 !! html
10096 <p><a href="/wiki/Foo" title="Foo">bar</a>
10097 </p>
10098 !!end
10100 !!test
10101 Templates: Links: 5. Nested templates (only outermost template should be marked)
10102 !! wikitext
10103 {{echo|[[{{echo|Foo}}|bar]]}}
10104 !! html
10105 <p><a href="/wiki/Foo" title="Foo">bar</a>
10106 </p>
10107 !!end
10109 !!test
10110 Templates: HTML Tag: 1. Generation of HTML attr. key
10111 !! wikitext
10112 <div {{echo|style}}="color:red;">foo</div>
10113 !! html
10114 <div style="color:red;">foo</div>
10116 !!end
10118 !!test
10119 Templates: HTML Tag: 2. Generation of HTML attr. value
10120 !! wikitext
10121 <div style={{echo|'color:red;'}}>foo</div>
10122 !! html
10123 <div style="color:red;">foo</div>
10125 !!end
10127 !!test
10128 Templates: HTML Tag: 3. Generation of HTML attr key and value
10129 !! wikitext
10130 <div {{echo|style}}={{echo|'color:red;'}}>foo</div>
10131 !! html
10132 <div style="color:red;">foo</div>
10134 !!end
10136 !!test
10137 Templates: HTML Tag: 4. Generation of starting piece of HTML attr value
10138 !! wikitext
10139 <div title="{{echo|This is a long title}} with just one piece templated">foo</div>
10140 !! html
10141 <div title="This is a long title with just one piece templated">foo</div>
10143 !!end
10145 !!test
10146 Templates: HTML Tag: 5. Generation of middle piece of HTML attr value
10147 !! wikitext
10148 <div title="This is a long title with just {{echo|one piece}} templated">foo</div>
10149 !! html
10150 <div title="This is a long title with just one piece templated">foo</div>
10152 !!end
10154 !!test
10155 Templates: HTML Tag: 6. Generation of end piece of HTML attr value
10156 !! wikitext
10157 <div title="This is a long title with just one piece {{echo|templated}}">foo</div>
10158 !! html
10159 <div title="This is a long title with just one piece templated">foo</div>
10161 !!end
10163 !!test
10164 Templates: HTML Tag: 7. Generation of partial attribute key string
10165 !! wikitext
10166 <div st{{echo|yle}}="color:red;">foo</div>
10167 !! html
10168 <div style="color:red;">foo</div>
10170 !!end
10172 !!test
10173 Templates: HTML Tables: 1. Generating start of a HTML table
10174 !! wikitext
10175 {{echo|<table><tr><td>foo</td>}}</tr></table>
10176 !! html
10177 <table><tr><td>foo</td></tr></table>
10179 !!end
10181 !!test
10182 Templates: HTML Tables: 2a. Generating middle of a HTML table
10183 !! wikitext
10184 <table><tr>{{echo|<td>foo</td>}}</tr></table>
10185 !! html
10186 <table><tr><td>foo</td></tr></table>
10188 !!end
10190 !!test
10191 Templates: HTML Tables: 2b. Generating middle of a HTML table
10192 !! wikitext
10193 <table>{{echo|<tr><td>foo</td></tr>}}</table>
10194 !! html
10195 <table><tr><td>foo</td></tr></table>
10197 !!end
10199 !!test
10200 Templates: HTML Tables: 3. Generating end of a HTML table
10201 !! wikitext
10202 <table><tr>{{echo|<td>foo</td></tr></table>}}
10203 !! html
10204 <table><tr><td>foo</td></tr></table>
10206 !!end
10208 !!test
10209 Templates: HTML Tables: 4a. Generating a single tag of a HTML table
10210 !! wikitext
10211 {{echo|<table>}}<tr><td>foo</td></tr></table>
10212 !! html
10213 <table><tr><td>foo</td></tr></table>
10215 !!end
10217 !!test
10218 Templates: HTML Tables: 4b. Generating a single tag of a HTML table
10219 !! wikitext
10220 <table>{{echo|<tr>}}<td>foo</td></tr></table>
10221 !! html
10222 <table><tr><td>foo</td></tr></table>
10224 !!end
10226 !!test
10227 Templates: HTML Tables: 4c. Generating a single tag of a HTML table
10228 !! wikitext
10229 <table><tr>{{echo|<td>}}foo</td></tr></table>
10230 !! html
10231 <table><tr><td>foo</td></tr></table>
10233 !!end
10235 !!test
10236 Templates: HTML Tables: 4d. Generating a single tag of a HTML table
10237 !! wikitext
10238 <table><tr><td>foo{{echo|</td>}}</tr></table>
10239 !! html
10240 <table><tr><td>foo</td></tr></table>
10242 !!end
10244 !!test
10245 Templates: HTML Tables: 4e. Generating a single tag of a HTML table
10246 !! wikitext
10247 <table><tr><td>foo</td>{{echo|</tr>}}</table>
10248 !! html
10249 <table><tr><td>foo</td></tr></table>
10251 !!end
10253 !!test
10254 Templates: HTML Tables: 4f. Generating a single tag of a HTML table
10255 !! wikitext
10256 <table><tr><td>foo</td></tr>{{echo|</table>}}
10257 !! html
10258 <table><tr><td>foo</td></tr></table>
10260 !!end
10262 !!test
10263 Templates: HTML Tables: 5. Proper fostering of categories from inside
10264 !!options
10265 parsoid=wt2html,wt2wt
10266 !! wikitext
10267 <table>[[Category:foo1]]<tr><td>foo</td></tr></table>
10268 <!--Two categories (Bug 50330)-->
10269 <table>[[Category:bar1]][[Category:bar2]]<tr><td>foo</td></tr></table>
10270 !! html
10271 <link rel="mw:PageProp/Category" href="./Category:Foo1"><table><tbody><tr><td>foo</td></tr></tbody></table>
10272 <!--Two categories (Bug 50330)-->
10273 <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>
10274 !!end
10276 !!test
10277 Templates: Wiki Tables: 1a. Fostering of entire template content
10278 !! wikitext
10280 {{echo|a}}
10282 !! html
10283 <table>
10285 <tr><td></td></tr></table>
10287 !! html+tidy
10288 <p>a</p>
10289 <table>
10290 <tr>
10291 <td></td>
10292 </tr>
10293 </table>
10294 !! end
10296 !!test
10297 Templates: Wiki Tables: 1b. Fostering of entire template content
10298 !! wikitext
10300 {{echo|<div>}}
10302 {{echo|</div>}}
10304 !! html
10305 <table>
10306 <div>
10307 <p>foo
10308 </p>
10309 </div>
10310 <tr><td></td></tr></table>
10312 !! html+tidy
10313 <div>
10314 <p>foo</p>
10315 </div>
10316 <table>
10317 <tr>
10318 <td></td>
10319 </tr>
10320 </table>
10321 !! end
10323 !!test
10324 Templates: Wiki Tables: 2. Fostering of partial template content
10325 !! wikitext
10327 {{echo|a
10328 <div>b</div>}}
10330 !! html
10331 <table>
10333 <div>b</div>
10334 <tr><td></td></tr></table>
10336 !! html+tidy
10337 <p>a</p>
10338 <div>b</div>
10339 <table>
10340 <tr>
10341 <td></td>
10342 </tr>
10343 </table>
10344 !! end
10346 !!test
10347 Templates: Wiki Tables: 3. td-content via multiple templates
10348 !! wikitext
10350 {{echo|{{pipe}}a}}{{echo|b}}
10352 !! html
10353 <table>
10354 <tr>
10355 <td>ab
10356 </td></tr></table>
10358 !!end
10360 !!test
10361 Templates: Wiki Tables: 4. Templated tags, no content
10362 !! wikitext
10363 {{tbl-start}}
10364 {{tbl-end}}
10365 !! html
10366 <table>
10367 <tr><td></td></tr></table>
10369 !!end
10371 !!test
10372 Templates: Wiki Tables: 5. Templated tags, regular td-tags
10373 !! wikitext
10374 {{tbl-start}}
10375 |foo
10376 {{tbl-end}}
10377 !! html
10378 <table>
10379 <tr>
10380 <td>foo
10381 </td></tr></table>
10383 !!end
10385 !!test
10386 Templates: Wiki Tables: 6. Templated tags, templated td-tags
10387 !! wikitext
10388 {{tbl-start}}
10389 {{!}}foo
10390 {{tbl-end}}
10391 !! html
10392 <table>
10393 <tr>
10394 <td>foo
10395 </td></tr></table>
10397 !!end
10399 !!test
10400 Templates: Lists: Multi-line list-items via templates
10401 !! wikitext
10402 *{{echo|a {{nonexistent|
10403 unused}}}}
10404 *{{echo|b {{nonexistent|
10405 unused}}}}
10406 !! html
10407 <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>
10408 <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>
10410 !!end
10412 !!test
10413 Templates: Ugly nesting: 1. Quotes opened/closed across templates (echo)
10414 !! wikitext
10415 {{echo|''a}}{{echo|b''c''d}}{{echo|''e}}
10416 !! html
10417 <p><i>ab</i>c<i>d</i>e
10418 </p>
10419 !!end
10421 !!test
10422 Templates: Ugly nesting: 2. Quotes opened/closed across templates (echo_with_span)
10423 (PHP parser generates misnested html)
10424 !! wikitext
10425 {{echo_with_span|''a}}{{echo_with_span|b''c''d}}{{echo_with_span|''e}}
10426 !! html/parsoid
10427 <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>
10428 !!end
10430 !!test
10431 Templates: Ugly nesting: 3. Quotes opened/closed across templates (echo_with_div)
10432 (PHP parser generates misnested html; Parsoid html2wt mode adds newlines between {{echo}}s)
10433 !! options
10434 parsoid=wt2html,wt2wt
10435 !! wikitext
10436 {{echo_with_div|''a}}{{echo_with_div|b''c''d}}{{echo_with_div|''e}}
10437 !! html
10438 <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>
10439 <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>
10440 <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>
10441 !!end
10443 !!test
10444 Templates: Ugly nesting: 4. Divs opened/closed across templates
10445 !! wikitext
10446 a<div>b{{echo|c</div>d}}e
10447 !! html
10448 a<div>bc</div>de
10450 !! html+tidy
10451 <p>a</p>
10452 <div>bc</div>
10453 <p>de</p>
10454 !! end
10456 !!test
10457 Templates: Ugly templates: 1. Navbox template parses badly leading to table misnesting
10458 (Parsoid-centric)
10459 !! options
10460 parsoid
10461 !! wikitext
10463 |{{echo|foo</table>}}
10464 |bar
10466 !! html
10467 <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|}"]}'>
10469 <tbody>
10470 <tr>
10471 <td>foo</td></tr></tbody></table><span about="#mwt1">
10472 </span><span about="#mwt1">|bar</span><span about="#mwt1">
10473 |}</span>
10474 !!end
10476 !!test
10477 Templates: Ugly templates: 2. Navbox template parses badly leading to table misnesting
10478 (Parsoid-centric)
10479 !! options
10480 parsoid
10481 !! wikitext
10482 <table>
10483   <tr>
10484     <td>
10485     <table>
10486       <tr>
10487         <td>1. {{echo|foo </table>}}</td>
10488         <td> bar </td>
10489         <td>2. {{echo|baz </table>}}</td>
10490       </tr>
10491       <tr>
10492         <td>abc</td>
10493       </tr>
10494     </table>
10495     </td>
10496   </tr>
10497   <tr>
10498     <td>xyz</td>
10499   </tr>
10500 </table>
10501 !! html
10502 <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>"]}'>
10503   <tbody><tr>
10504     <td>
10505     <table>
10506       <tbody><tr>
10507         <td>1. foo </td></tr></tbody></table></td>
10508         <td> bar </td>
10509         <td>2. baz </td></tr></tbody></table><span about="#mwt2">
10510       </span><span about="#mwt2">
10511       </span><span about="#mwt2">
10512         </span><span about="#mwt2">abc</span><span about="#mwt2">
10513       </span><span about="#mwt2">
10514     </span><span about="#mwt2">
10515     </span><span about="#mwt2">
10516   </span><span about="#mwt2">
10517   </span><span about="#mwt2">
10518     </span><span about="#mwt2">xyz</span><span about="#mwt2">
10519   </span><span about="#mwt2">
10520 </span>
10521 !!end
10523 !! test
10524 Templates: Ugly templates: 3. newline-only template parameter
10525 !! wikitext
10526 foo {{echo|
10528 !! html
10529 <p>foo 
10530 </p>
10531 !! end
10533 # This looks like a bug: a single newline triggers p/br for some reason.
10534 !! test
10535 Templates: Ugly templates: 4. newline-only template parameter inconsistency
10536 !! wikitext
10537 {{echo|
10539 !! html
10540 <p><br />
10541 </p>
10542 !! end
10544 # Bug 64017 -- ugly wikitext with fostered content generates two template ranges that
10545 # have a true overlap (T1-start - T2-start - T1-end - T2-end).
10546 !! test
10547 Templates: Ugly templates: 5. Template encapsulation test: Non-trivial overlap of template ranges is properly handled
10548 !! wikitext
10549 {{echo|<table>}}
10550 {{echo|<div>foo}}
10551 {{echo|</table>}}
10552 !! html/parsoid
10553 <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","spc":["","","",""]}],[{"k":"1","spc":["","","",""]}],[{"k":"1","spc":["","","",""]}]]}'>foo
10554 </div><table about="#mwt1" data-parsoid='{"stx":"html"}'>
10555 </table>
10556 !! end
10558 # Bug 64017 -- ugly wikitext with fostered content generates two template ranges
10559 # that are "identical" and generate nesting cycles in the algorithm
10560 !! test
10561 Templates: Ugly templates: 6. Template encapsulation test: Cyclical nesting of template ranges is properly handled
10562 !! wikitext
10563 {{echo|<table><tr><td><table>}}
10564 {{echo|<div>}}
10565 {{echo|</div>}}
10566 !! html/parsoid
10567 <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","spc":["","","",""]}],[{"k":"1","spc":["","","",""]}],[{"k":"1","spc":["","","",""]}]]}'><tbody><tr data-parsoid='{"stx":"html"}'><td data-parsoid='{"stx":"html"}'><div data-parsoid='{"stx":"html"}'>
10568 </div><table about="#mwt1" data-parsoid='{"stx":"html"}'>
10569 </table></td></tr></tbody></table>
10570 !! end
10572 !!test
10573 Parser Functions: 1. Simple example
10574 !! wikitext
10575 {{uc:foo}}
10576 !! html
10577 <p>FOO
10578 </p>
10579 !!end
10581 !!test
10582 Parser Functions: 2. Nested use (only outermost should be marked up)
10583 !! wikitext
10584 {{uc:{{lc:FOO}}}}
10585 !! html
10586 <p>FOO
10587 </p>
10588 !!end
10591 ### Pre-save transform tests
10593 !! test
10594 pre-save transform: subst:
10595 !! options
10597 !! wikitext
10598 {{subst:test}}
10599 !! html
10600 This is a test template
10601 !! end
10603 !! test
10604 pre-save transform: normal template
10605 !! options
10607 !! wikitext
10608 {{test}}
10609 !! html
10610 {{test}}
10611 !! end
10613 !! test
10614 pre-save transform: nonexistent template
10615 !! options
10617 !! wikitext
10618 {{thistemplatedoesnotexist}}
10619 !! html
10620 {{thistemplatedoesnotexist}}
10621 !! end
10624 !! test
10625 pre-save transform: subst magic variables
10626 !! options
10628 !! wikitext
10629 {{subst:SITENAME}}
10630 !! html
10631 MediaWiki
10632 !! end
10634 # This is bug 89, which I fixed. -- wtm
10635 !! test
10636 pre-save transform: subst: templates with parameters
10637 !! options
10639 !! wikitext
10640 {{subst:paramtest|param="something else"}}
10641 !! html
10642 This is a test template with parameter "something else"
10643 !! end
10645 !! article
10646 Template:nowikitest
10647 !! text
10648 <nowiki>'''not wiki'''</nowiki>
10649 !! endarticle
10651 !! test
10652 pre-save transform: nowiki in subst (bug 1188)
10653 !! options
10655 !! wikitext
10656 {{subst:nowikitest}}
10657 !! html
10658 <nowiki>'''not wiki'''</nowiki>
10659 !! end
10662 !! article
10663 Template:commenttest
10664 !! text
10665 This template has <!-- a comment --> in it.
10666 !! endarticle
10668 !! test
10669 pre-save transform: comment in subst (bug 1936)
10670 !! options
10672 !! wikitext
10673 {{subst:commenttest}}
10674 !! html
10675 This template has <!-- a comment --> in it.
10676 !! end
10678 !! test
10679 pre-save transform: unclosed tag
10680 !! options
10681 pst noxml
10682 !! wikitext
10683 <nowiki>'''not wiki'''
10684 !! html
10685 <nowiki>'''not wiki'''
10686 !! end
10688 !! test
10689 pre-save transform: mixed tag case
10690 !! options
10691 pst noxml
10692 !! wikitext
10693 <NOwiki>'''not wiki'''</noWIKI>
10694 !! html
10695 <NOwiki>'''not wiki'''</noWIKI>
10696 !! end
10698 !! test
10699 pre-save transform: unclosed comment in <nowiki>
10700 !! options
10701 pst noxml
10702 !! wikitext
10703 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
10704 !! html
10705 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
10706 !!end
10708 # Leading @ in this template definition works around a limitation
10709 # in parsoid's parserTests which otherwise strips the <span> from the
10710 # result (confusing it for a template wrapper)
10711 !! article
10712 Template:dangerous
10713 !!text
10714 @<span onmouseover="alert('crap')">Oh no</span>
10715 !!endarticle
10717 !!test
10718 (confirming safety of fix for subst bug 1936)
10719 !! wikitext
10720 {{Template:dangerous}}
10721 !! html
10722 <p>@<span>Oh no</span>
10723 </p>
10724 !! end
10726 !! test
10727 pre-save transform: comment containing gallery (bug 5024)
10728 !! options
10730 !! wikitext
10731 <!-- <gallery>data</gallery> -->
10732 !! html
10733 <!-- <gallery>data</gallery> -->
10734 !!end
10736 !! test
10737 pre-save transform: comment containing extension
10738 !! options
10740 !! wikitext
10741 <!-- <tag>data</tag> -->
10742 !! html
10743 <!-- <tag>data</tag> -->
10744 !!end
10746 !! test
10747 pre-save transform: comment containing nowiki
10748 !! options
10750 !! wikitext
10751 <!-- <nowiki>data</nowiki> -->
10752 !! html
10753 <!-- <nowiki>data</nowiki> -->
10754 !!end
10756 !! test
10757 pre-save transform: <noinclude> in subst (bug 3298)
10758 !! options
10760 !! wikitext
10761 {{subst:Includes}}
10762 !! html
10763 Foobar
10764 !! end
10766 !! test
10767 pre-save transform: <onlyinclude> in subst (bug 3298)
10768 !! options
10770 !! wikitext
10771 {{subst:Includes2}}
10772 !! html
10774 !! end
10776 !! article
10777 Template:SubstTest
10778 !!text
10779 {{<includeonly>subst:</includeonly>Includes}}
10780 !! endarticle
10782 !! article
10783 Template:SafeSubstTest
10784 !! text
10785 {{<includeonly>safesubst:</includeonly>Includes}}
10786 !! endarticle
10788 !! test
10789 bug 22297: safesubst: works during PST
10790 !! options
10792 !! wikitext
10793 {{subst:SafeSubstTest}}{{safesubst:SubstTest}}
10794 !! html
10795 FoobarFoobar
10796 !! end
10798 !! test
10799 bug 22297: safesubst: works during normal parse
10800 !! wikitext
10801 {{SafeSubstTest}}
10802 !! html
10803 <p>Foobar
10804 </p>
10805 !! end
10807 !! test
10808 subst: does not work during normal parse
10809 !! wikitext
10810 {{SubstTest}}
10811 !! html
10812 <p>{{subst:Includes}}
10813 </p>
10814 !! end
10816 !! test
10817 pre-save transform: context links ("pipe trick")
10818 !! options
10820 !! wikitext
10821 [[Article (context)|]]
10822 [[Bar:Article|]]
10823 [[:Bar:Article|]]
10824 [[Bar:Article (context)|]]
10825 [[:Bar:Article (context)|]]
10826 [[|Article]]
10827 [[|Article (context)]]
10828 [[Bar:X (Y) Z|]]
10829 [[:Bar:X (Y) Z|]]
10830 !! html
10831 [[Article (context)|Article]]
10832 [[Bar:Article|Article]]
10833 [[:Bar:Article|Article]]
10834 [[Bar:Article (context)|Article]]
10835 [[:Bar:Article (context)|Article]]
10836 [[Article]]
10837 [[Article (context)]]
10838 [[Bar:X (Y) Z|X (Y) Z]]
10839 [[:Bar:X (Y) Z|X (Y) Z]]
10840 !! end
10842 !! test
10843 pre-save transform: context links ("pipe trick") with interwiki prefix
10844 !! options
10846 !! wikitext
10847 [[interwiki:Article|]]
10848 [[:interwiki:Article|]]
10849 [[interwiki:Bar:Article|]]
10850 [[:interwiki:Bar:Article|]]
10851 !! html
10852 [[interwiki:Article|Article]]
10853 [[:interwiki:Article|Article]]
10854 [[interwiki:Bar:Article|Bar:Article]]
10855 [[:interwiki:Bar:Article|Bar:Article]]
10856 !! end
10858 !! test
10859 pre-save transform: context links ("pipe trick") with parens in title
10860 !! options
10861 pst title=[[Somearticle (context)]]
10862 !! wikitext
10863 [[|Article]]
10864 !! html
10865 [[Article (context)|Article]]
10866 !! end
10868 !! test
10869 pre-save transform: context links ("pipe trick") with comma in title
10870 !! options
10871 pst title=[[Someplace, Somewhere]]
10872 !! wikitext
10873 [[|Otherplace]]
10874 [[Otherplace, Elsewhere|]]
10875 [[Otherplace, Elsewhere, Anywhere|]]
10876 !! html
10877 [[Otherplace, Somewhere|Otherplace]]
10878 [[Otherplace, Elsewhere|Otherplace]]
10879 [[Otherplace, Elsewhere, Anywhere|Otherplace]]
10880 !! end
10882 !! test
10883 pre-save transform: context links ("pipe trick") with parens and comma
10884 !! options
10885 pst title=[[Someplace (IGNORED), Somewhere]]
10886 !! wikitext
10887 [[|Otherplace]]
10888 [[Otherplace (place), Elsewhere|]]
10889 !! html
10890 [[Otherplace, Somewhere|Otherplace]]
10891 [[Otherplace (place), Elsewhere|Otherplace]]
10892 !! end
10894 !! test
10895 pre-save transform: context links ("pipe trick") with comma and parens
10896 !! options
10897 pst title=[[Who, me? (context)]]
10898 !! wikitext
10899 [[|Yes, you.]]
10900 [[Me, Myself, and I (1937 song)|]]
10901 !! html
10902 [[Yes, you. (context)|Yes, you.]]
10903 [[Me, Myself, and I (1937 song)|Me, Myself, and I]]
10904 !! end
10906 !! test
10907 pre-save transform: context links ("pipe trick") with namespace
10908 !! options
10909 pst title=[[Ns:Somearticle]]
10910 !! wikitext
10911 [[|Article]]
10912 !! html
10913 [[Ns:Article|Article]]
10914 !! end
10916 !! test
10917 pre-save transform: context links ("pipe trick") with namespace and parens
10918 !! options
10919 pst title=[[Ns:Somearticle (context)]]
10920 !! wikitext
10921 [[|Article]]
10922 !! html
10923 [[Ns:Article (context)|Article]]
10924 !! end
10926 !! test
10927 pre-save transform: context links ("pipe trick") with namespace and comma
10928 !! options
10929 pst title=[[Ns:Somearticle, Context, Whatever]]
10930 !! wikitext
10931 [[|Article]]
10932 !! html
10933 [[Ns:Article, Context, Whatever|Article]]
10934 !! end
10936 !! test
10937 pre-save transform: context links ("pipe trick") with namespace, comma and parens
10938 !! options
10939 pst title=[[Ns:Somearticle, Context (context)]]
10940 !! wikitext
10941 [[|Article]]
10942 !! html
10943 [[Ns:Article (context)|Article]]
10944 !! end
10946 !! test
10947 pre-save transform: context links ("pipe trick") with namespace, parens and comma
10948 !! options
10949 pst title=[[Ns:Somearticle (IGNORED), Context]]
10950 !! wikitext
10951 [[|Article]]
10952 !! html
10953 [[Ns:Article, Context|Article]]
10954 !! end
10956 !! test
10957 pre-save transform: context links ("pipe trick") with full-width parens and no space (Japanese and Chinese style, bug 30149)
10958 !! options
10960 !! wikitext
10961 [[Article(context)|]]
10962 [[Bar:Article(context)|]]
10963 [[:Bar:Article(context)|]]
10964 [[|Article(context)]]
10965 [[Bar:X(Y)Z|]]
10966 [[:Bar:X(Y)Z|]]
10967 !! html
10968 [[Article(context)|Article]]
10969 [[Bar:Article(context)|Article]]
10970 [[:Bar:Article(context)|Article]]
10971 [[Article(context)]]
10972 [[Bar:X(Y)Z|X(Y)Z]]
10973 [[:Bar:X(Y)Z|X(Y)Z]]
10974 !! end
10976 !! test
10977 pre-save transform: context links ("pipe trick") with full-width parens and space (Japanese and Chinese style, bug 30149)
10978 !! options
10980 !! wikitext
10981 [[Article (context)|]]
10982 [[Bar:Article (context)|]]
10983 [[:Bar:Article (context)|]]
10984 [[|Article (context)]]
10985 [[Bar:X (Y) Z|]]
10986 [[:Bar:X (Y) Z|]]
10987 !! html
10988 [[Article (context)|Article]]
10989 [[Bar:Article (context)|Article]]
10990 [[:Bar:Article (context)|Article]]
10991 [[Article (context)]]
10992 [[Bar:X (Y) Z|X (Y) Z]]
10993 [[:Bar:X (Y) Z|X (Y) Z]]
10994 !! end
10996 !! test
10997 pre-save transform: context links ("pipe trick") with parens and no space (Korean style, bug 30149)
10998 !! options
11000 !! wikitext
11001 [[Article(context)|]]
11002 [[Bar:Article(context)|]]
11003 [[:Bar:Article(context)|]]
11004 [[|Article(context)]]
11005 [[Bar:X(Y)Z|]]
11006 [[:Bar:X(Y)Z|]]
11007 !! html
11008 [[Article(context)|Article]]
11009 [[Bar:Article(context)|Article]]
11010 [[:Bar:Article(context)|Article]]
11011 [[Article(context)]]
11012 [[Bar:X(Y)Z|X(Y)Z]]
11013 [[:Bar:X(Y)Z|X(Y)Z]]
11014 !! end
11016 !! test
11017 pre-save transform: context links ("pipe trick") with commas (bug 21660)
11018 !! options
11020 !! wikitext
11021 [[Article (context), context|]]
11022 [[Article (context),context|]]
11023 [[Bar:Article (context), context|]]
11024 [[Bar:Article (context),context|]]
11025 [[:Bar:Article (context), context|]]
11026 [[:Bar:Article (context),context|]]
11027 !! html
11028 [[Article (context), context|Article]]
11029 [[Article (context),context|Article]]
11030 [[Bar:Article (context), context|Article]]
11031 [[Bar:Article (context),context|Article]]
11032 [[:Bar:Article (context), context|Article]]
11033 [[:Bar:Article (context),context|Article]]
11034 !! end
11036 !! test
11037 pre-save transform: trim trailing empty lines
11038 !! options
11040 !! wikitext
11041 Empty lines are trimmed
11046 !! html
11047 Empty lines are trimmed
11048 !! end
11050 !! test
11051 pre-save transform: Signature expansion
11052 !! options
11054 !! wikitext
11055 * ~~~
11056 * <noinclude>~~~</noinclude>
11057 * <includeonly>~~~</includeonly>
11058 * <onlyinclude>~~~</onlyinclude>
11059 !! html
11060 * [[Special:Contributions/127.0.0.1|127.0.0.1]]
11061 * <noinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</noinclude>
11062 * <includeonly>[[Special:Contributions/127.0.0.1|127.0.0.1]]</includeonly>
11063 * <onlyinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</onlyinclude>
11064 !! end
11067 !! test
11068 pre-save transform: Signature expansion in nowiki tags (bug 93)
11069 !! options
11070 pst disabled
11071 !! wikitext
11072 Shall not expand:
11074 <nowiki>~~~~</nowiki>
11076 <includeonly><nowiki>~~~~</nowiki></includeonly>
11078 <noinclude><nowiki>~~~~</nowiki></noinclude>
11080 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
11082 {{subst:Foo}} shall be converted to FOO
11084 As well as inside noinclude/onlyinclude
11085 <noinclude>{{subst:Foo}}</noinclude>
11086 <onlyinclude>{{subst:Foo}}</onlyinclude>
11088 But not inside includeonly
11089 <includeonly>{{subst:Foo}}</includeonly>
11090 !! html
11091 Shall not expand:
11093 <nowiki>~~~~</nowiki>
11095 <includeonly><nowiki>~~~~</nowiki></includeonly>
11097 <noinclude><nowiki>~~~~</nowiki></noinclude>
11099 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
11101 FOO shall be converted to FOO
11103 As well as inside noinclude/onlyinclude
11104 <noinclude>FOO</noinclude>
11105 <onlyinclude>FOO</onlyinclude>
11107 But not inside includeonly
11108 <includeonly>{{subst:Foo}}</includeonly>
11109 !! end
11111 !! test
11112 Parsoid: Recognize nowiki with trailing space in tags
11113 !! options
11114 parsoid=wt2html
11115 !! wikitext
11116 <nowiki ><div>[[foo]]</nowiki >
11118 a<nowiki / >b
11120 c<nowiki />d
11122 e<nowiki/ >f
11123 !! html
11124 <p><span typeof="mw:Nowiki">&lt;div&gt;[[foo]]</span></p>
11125 <p>ab</p>
11126 <p>cd</p>
11127 <p>ef</p>
11128 !! end
11130 !! test
11131 Parsoid: Recognize nowiki with odd capitalization
11132 !! options
11133 parsoid=wt2html
11134 !! wikitext
11135 <noWikI ><div>[[foo]]</Nowiki >
11136 !! html
11137 <p><span typeof="mw:Nowiki">&lt;div&gt;[[foo]]</span></p>
11138 !! end
11141 !! test
11142 Parsoid: Escape nowiki with trailing space in tags
11143 !! options
11144 parsoid=html2wt
11145 !! wikitext
11146 &lt;nowiki &gt; foo &lt;/nowiki &gt;
11148 a&lt;nowiki /&gt;b
11150 c&lt;nowiki/ &gt;d
11151 !! html
11152 <p>&lt;nowiki &gt; foo &lt/nowiki ></p>
11153 <p>a&lt;nowiki /&gt;b</p>
11154 <p>c&lt;nowiki/ &gt;d</p>
11155 !! end
11157 !! test
11158 Parsoid: Escape weird noWikI capitalizations
11159 !! options
11160 parsoid=html2wt
11161 !! wikitext
11162 &lt;noWikI &gt; foo &lt;/NoWikI &gt;
11163 !! html
11164 <p>&lt;noWikI &gt; foo &lt/NoWikI ></p>
11165 !! end
11168 ### Message transform tests
11170 !! test
11171 message transform: magic variables
11172 !! options
11174 !! wikitext
11175 {{SITENAME}}
11176 !! html
11177 MediaWiki
11178 !! end
11180 !! test
11181 message transform: should not transform wiki markup
11182 !! options
11184 !! wikitext
11185 ''test''
11186 !! html
11187 ''test''
11188 !! end
11190 !! test
11191 message transform: <noinclude> in transcluded template (bug 4926)
11192 !! options
11194 !! wikitext
11195 {{Includes}}
11196 !! html
11197 Foobar
11198 !! end
11200 !! test
11201 message transform: <onlyinclude> in transcluded template (bug 4926)
11202 !! options
11204 !! wikitext
11205 {{Includes2}}
11206 !! html
11208 !! end
11210 !! test
11211 {{#special:}} page name, known
11212 !! options
11214 !! wikitext
11215 {{#special:Recentchanges}}
11216 !! html
11217 Special:RecentChanges
11218 !! end
11220 !! test
11221 {{#special:}} page name with subpage, known
11222 !! options
11224 !! wikitext
11225 {{#special:Recentchanges/param}}
11226 !! html
11227 Special:RecentChanges/param
11228 !! end
11230 !! test
11231 {{#special:}} page name, unknown
11232 !! options
11234 !! wikitext
11235 {{#special:foobar nonexistent}}
11236 !! html
11237 Special:Foobar nonexistent
11238 !! end
11240 !! test
11241 {{#speciale:}} page name, known
11242 !! options
11244 !! wikitext
11245 {{#speciale:Recentchanges}}
11246 !! html
11247 Special:RecentChanges
11248 !! end
11250 !! test
11251 {{#speciale:}} page name with subpage, known
11252 !! options
11254 !! wikitext
11255 {{#speciale:Recentchanges/param}}
11256 !! html
11257 Special:RecentChanges/param
11258 !! end
11260 !! test
11261 {{#speciale:}} page name, unknown
11262 !! options
11264 !! wikitext
11265 {{#speciale:foobar nonexistent}}
11266 !! html
11267 Special:Foobar_nonexistent
11268 !! end
11271 ### Images
11273 ### For Parsoid-specific tests, see
11274 #### https://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec#Images
11276 !! test
11277 Simple image
11278 !! options
11279 parsoid=wt2html,wt2wt,html2html
11280 !! wikitext
11281 [[Image:foobar.jpg]]
11282 !! html/php
11283 <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>
11284 </p>
11285 !! html/parsoid
11286 <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" height="220" width="1941"></a></span></p>
11287 !! end
11289 !! test
11290 Simple image (using File: namespace, now canonical)
11291 !! wikitext
11292 [[File:Foobar.jpg]]
11293 !! html/php
11294 <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>
11295 </p>
11296 !! html/parsoid
11297 <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" height="220" width="1941"></a></span></p>
11298 !! end
11300 !! test
11301 Right-aligned image
11302 !! wikitext
11303 [[File:Foobar.jpg|right]]
11304 !! html/php
11305 <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>
11307 !! html/parsoid
11308 <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" height="220" width="1941"></a></figure>
11309 !! end
11311 !! test
11312 Image with caption
11313 !! wikitext
11314 [[File:Foobar.jpg|right|Caption text]]
11315 !! html/php
11316 <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>
11318 !! html/parsoid
11319 <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" height="220" width="1941"></a><figcaption>Caption text</figcaption></figure>
11320 !! end
11322 !! test
11323 Image with caption, bug 53312 #1
11324 !! wikitext
11325 [[File:Foobar.jpg|right|Caption page stuff]]
11326 !! html/php
11327 <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>
11329 !! html/parsoid
11330 <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" height="220" width="1941"></a><figcaption>Caption page stuff</figcaption></figure>
11331 !! end
11333 !! test
11334 Image with caption, bug 53312 #2
11335 !! wikitext
11336 [[File:Foobar.jpg|right|Caption page=]]
11337 !! html/php
11338 <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>
11340 !! html/parsoid
11341 <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" height="220" width="1941"></a><figcaption>Caption page=</figcaption></figure>
11342 !! end
11344 !! test
11345 Image with caption, bug 53312 #3
11346 !! wikitext
11347 [[File:Foobar.jpg|right|Caption page=stuff]]
11348 !! html/php
11349 <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>
11351 !! html/parsoid
11352 <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" height="220" width="1941"></a><figcaption>Caption page=stuff</figcaption></figure>
11353 !! end
11355 !! test
11356 Allow empty links in image captions (Bug 60753)
11357 !! options
11358 thumbsize=220
11359 !! wikitext
11360 [[File:Foobar.jpg|thumb|Caption [[Link1]]
11361 [[]]
11362 [[Link2]]
11364 !! html/php
11365 <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>
11367 !! html/parsoid
11368 <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" 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>
11369 [[]]
11370 <a rel="mw:WikiLink" href="./Link2" title="Link2" data-parsoid='{"stx":"simple","a":{"href":"./Link2"},"sa":{"href":"Link2"}}'>Link2</a>
11371 </figcaption></figure>
11372 !! end
11374 !! test
11375 Titles in unlinked images (T23454)
11376 !! wikitext
11377 [[File:Foobar.jpg|link=|stuff]]
11378 !! html/php
11379 <p><img alt="stuff" src="http://example.com/images/3/3a/Foobar.jpg" title="stuff" width="1941" height="220" />
11380 </p>
11381 !! end
11383 !! test
11384 Link with empty target
11385 !! wikitext
11386 [[]]
11387 !! html
11388 <p>[[]]
11389 </p>
11390 !! end
11392 !! test
11393 Image with empty attribute
11394 !! options
11395 parsoid=wt2html,wt2wt,html2html
11396 !! wikitext
11397 [[File:Foobar.jpg|right||Caption text]]
11398 !! html/php
11399 <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>
11401 !! html/parsoid
11402 <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" height="220" width="1941"></a><figcaption>Caption text</figcaption></figure>
11403 !! end
11405 !! test
11406 1. Block image with individual attributes from templates
11407 !! wikitext
11408 [[File:Foobar.jpg|thumb|{{echo|137px}}|This is a caption]]
11409 !! html/php
11410 <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>
11412 !! html/parsoid
11413 <figure typeof="mw:Image/Thumb mw:ExpandedAttrs" about="#mwt2" data-mw='{"attribs":[["thumbnail",{"html":"thumb"}],["width",{"html":"&lt;span about=\"#mwt1\" typeof=\"mw:Transclusion\" data-parsoid=\"{&amp;quot;pi&amp;quot;:[[{&amp;quot;k&amp;quot;:&amp;quot;1&amp;quot;,&amp;quot;spc&amp;quot;:[&amp;quot;&amp;quot;,&amp;quot;&amp;quot;,&amp;quot;&amp;quot;,&amp;quot;&amp;quot;]}]],&amp;quot;dsr&amp;quot;:[24,38,null,null]}\" data-mw=\"{&amp;quot;parts&amp;quot;:[{&amp;quot;template&amp;quot;:{&amp;quot;target&amp;quot;:{&amp;quot;wt&amp;quot;:&amp;quot;echo&amp;quot;,&amp;quot;href&amp;quot;:&amp;quot;./Template:Echo&amp;quot;},&amp;quot;params&amp;quot;:{&amp;quot;1&amp;quot;:{&amp;quot;wt&amp;quot;:&amp;quot;137px&amp;quot;}},&amp;quot;i&amp;quot;:0}}]}\">137px&lt;/span>"}]]}'><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/137px-Foobar.jpg" height="16" width="137"/></a><figcaption>This is a caption</figcaption></figure>
11414 !! end
11416 !! test
11417 2. Block Image with individual attributes from templates
11418 !! wikitext
11419 [[File:Foobar.jpg|{{echo|thumb}}|{{echo|137px}}|This is a caption]]
11420 !! html/php
11421 <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>
11423 !! html/parsoid
11424 <figure typeof="mw:Image/Thumb mw:ExpandedAttrs" about="#mwt3" data-mw='{"attribs":[["thumbnail",{"html":"&lt;span about=\"#mwt1\" typeof=\"mw:Transclusion\" data-parsoid=\"{&amp;quot;pi&amp;quot;:[[{&amp;quot;k&amp;quot;:&amp;quot;1&amp;quot;,&amp;quot;spc&amp;quot;:[&amp;quot;&amp;quot;,&amp;quot;&amp;quot;,&amp;quot;&amp;quot;,&amp;quot;&amp;quot;]}]],&amp;quot;dsr&amp;quot;:[18,32,null,null]}\" data-mw=\"{&amp;quot;parts&amp;quot;:[{&amp;quot;template&amp;quot;:{&amp;quot;target&amp;quot;:{&amp;quot;wt&amp;quot;:&amp;quot;echo&amp;quot;,&amp;quot;href&amp;quot;:&amp;quot;./Template:Echo&amp;quot;},&amp;quot;params&amp;quot;:{&amp;quot;1&amp;quot;:{&amp;quot;wt&amp;quot;:&amp;quot;thumb&amp;quot;}},&amp;quot;i&amp;quot;:0}}]}\">thumb&lt;/span>"}],["width",{"html":"&lt;span about=\"#mwt2\" typeof=\"mw:Transclusion\" data-parsoid=\"{&amp;quot;pi&amp;quot;:[[{&amp;quot;k&amp;quot;:&amp;quot;1&amp;quot;,&amp;quot;spc&amp;quot;:[&amp;quot;&amp;quot;,&amp;quot;&amp;quot;,&amp;quot;&amp;quot;,&amp;quot;&amp;quot;]}]],&amp;quot;dsr&amp;quot;:[33,47,null,null]}\" data-mw=\"{&amp;quot;parts&amp;quot;:[{&amp;quot;template&amp;quot;:{&amp;quot;target&amp;quot;:{&amp;quot;wt&amp;quot;:&amp;quot;echo&amp;quot;,&amp;quot;href&amp;quot;:&amp;quot;./Template:Echo&amp;quot;},&amp;quot;params&amp;quot;:{&amp;quot;1&amp;quot;:{&amp;quot;wt&amp;quot;:&amp;quot;137px&amp;quot;}},&amp;quot;i&amp;quot;:0}}]}\">137px&lt;/span>"}]]}'><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/137px-Foobar.jpg" height="16" width="137"/></a><figcaption>This is a caption</figcaption></figure>
11425 !! end
11427 !! test
11428 3. Inline image with individual attributes from templates
11429 !! wikitext
11430 [[File:Foobar.jpg|{{echo|50px}}]]
11431 !! html/php
11432 <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>
11433 </p>
11434 !! html/parsoid
11435 <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=\"{&amp;quot;pi&amp;quot;:[[{&amp;quot;k&amp;quot;:&amp;quot;1&amp;quot;,&amp;quot;spc&amp;quot;:[&amp;quot;&amp;quot;,&amp;quot;&amp;quot;,&amp;quot;&amp;quot;,&amp;quot;&amp;quot;]}]],&amp;quot;dsr&amp;quot;:[18,31,null,null]}\" data-mw=\"{&amp;quot;parts&amp;quot;:[{&amp;quot;template&amp;quot;:{&amp;quot;target&amp;quot;:{&amp;quot;wt&amp;quot;:&amp;quot;echo&amp;quot;,&amp;quot;href&amp;quot;:&amp;quot;./Template:Echo&amp;quot;},&amp;quot;params&amp;quot;:{&amp;quot;1&amp;quot;:{&amp;quot;wt&amp;quot;:&amp;quot;50px&amp;quot;}},&amp;quot;i&amp;quot;:0}}]}\">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" height="6" width="50"/></a></span></p>
11436 !! end
11438 ## Parsoid does not provide editing support for images where templates produce multiple image attributes.
11439 ## To signal this, we add a 'mw:Placeholder' type to such images. This could change in the future.
11440 !! test
11441 Image with multiple attributes from the same template
11442 !! wikitext
11443 [[File:Foobar.jpg|{{image_attribs}}]]
11444 !! html/php
11445 <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>
11447 !! html/parsoid
11448 <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" height="220" width="1941"></a><figcaption>Caption text</figcaption></figure>
11449 !! end
11451 !! test
11452 Image with link tails
11453 !! options
11454 thumbsize=220
11455 !! wikitext
11456 123[[File:Foobar.jpg]]456
11457 123[[File:Foobar.jpg|right]]456
11458 123[[File:Foobar.jpg|thumb]]456
11459 !! html/php
11460 <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
11461 </p>
11462 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
11463 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
11465 !! html/php+tidy
11466 <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>
11467 <p>123</p>
11468 <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>
11469 <p>456 123</p>
11470 <div class="thumb tright">
11471 <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>
11472 <div class="thumbcaption">
11473 <div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>
11474 </div>
11475 </div>
11476 </div>
11477 <p>456</p>
11478 !! html/parsoid
11479 <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" height="220" width="1941"></a></span>456</p>
11480 <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" height="220" width="1941"></a></figure><p>456</p>
11481 <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/180px-Foobar.jpg" height="25" width="220"></a></figure><p>456</p>
11482 !! end
11484 !! test
11485 Image with multiple captions -- only last one is accepted
11486 !! wikitext
11487 [[File:Foobar.jpg|right|Caption1 - ignored|[[Caption2]] - ignored|Caption3 - accepted]]
11488 !! html/php
11489 <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>
11491 !! html/parsoid
11492 <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" height="220" width="1941"></a><figcaption>Caption3 - accepted</figcaption></figure>
11493 !! end
11495 !! test
11496 Image with multiple widths -- use last
11497 !! wikitext
11498 [[File:Foobar.jpg|200px|300px|caption]]
11499 !! html/php
11500 <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>
11501 </p>
11502 !! html/parsoid
11503 <p><span 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" height="34" width="300"/></a></span></p>
11504 !! end
11506 !! test
11507 Image with multiple alignments -- use first (bug 48664)
11508 !! options
11509 thumbsize=220
11510 !! wikitext
11511 [[File:Foobar.jpg|thumb|left|right|center|caption]]
11513 [[File:Foobar.jpg|middle|text-top|caption]]
11514 !! html/php
11515 <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>
11516 <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>
11517 </p>
11518 !! html/parsoid
11519 <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/3/3a/Foobar.jpg" height="25" width="220"/></a><figcaption>caption</figcaption></figure>
11520 <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" height="220" width="1941"/></a></span></p>
11521 !! end
11523 !! test
11524 Image with width attribute at different positions
11525 !! wikitext
11526 [[File:Foobar.jpg|200px|right|Caption]]
11527 [[File:Foobar.jpg|right|200px|Caption]]
11528 [[File:Foobar.jpg|right|Caption|200px]]
11529 !! html/php
11530 <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>
11531 <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>
11532 <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>
11534 !! html/parsoid
11535 <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" height="23" width="200"></a><figcaption>Caption</figcaption></figure>
11536 <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" height="23" width="200"></a><figcaption>Caption</figcaption></figure>
11537 <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" height="23" width="200"></a><figcaption>Caption</figcaption></figure>
11538 !! end
11540 # a sad bit of backward-compatibility
11541 !! test
11542 Image with size specified with pxpx (bug 13500, 51628)
11543 !! options
11544 parsoid=wt2html,wt2wt,html2html
11545 !! wikitext
11546 [[File:Foobar.jpg|20pxpx]]
11547 [[File:Foobar.jpg|200x20pxpx]]
11548 !! html/php
11549 <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>
11550 <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>
11551 </p>
11552 !! html/parsoid
11553 <p><span typeof="mw:Image"><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="2" width="20"/></a></span> <span typeof="mw:Image"><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="20" width="177"/></a></span></p>
11554 !! end
11556 !! test
11557 Image with link parameter, wiki target
11558 !! wikitext
11559 [[File:Foobar.jpg|link=Main Page]]
11560 !! html/php
11561 <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>
11562 </p>
11563 !! html/parsoid
11564 <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" height="220" width="1941"></a></span></p>
11565 !! end
11567 # parsoid bug 49293 (part 1)
11568 !! test
11569 Image with link parameter, URL target
11570 !! wikitext
11571 [[File:Foobar.jpg|link=http://example.com/]]
11572 !! html/php
11573 <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>
11574 </p>
11575 !! html/parsoid
11576 <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" height="220" width="1941"></a></span></p>
11577 !! end
11579 # parsoid bug 49293 (part 2)
11580 !! test
11581 Image with link parameter, protocol-less URL target
11582 !! wikitext
11583 [[File:Foobar.jpg|link=//example.com/]]
11584 !! html/php
11585 <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>
11586 </p>
11587 !! html/parsoid
11588 <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" height="220" width="1941"></a></span></p>
11589 !! end
11591 !! test
11592 Image with link parameter, wgExternalLinkTarget
11593 !! wikitext
11594 [[Image:foobar.jpg|link=http://example.com/]]
11595 !! config
11596 wgExternalLinkTarget='foobar'
11597 !! html
11598 <p><a href="http://example.com/" target="foobar" rel="nofollow"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
11599 </p>
11600 !! end
11602 !! test
11603 Image with link parameter, wgNoFollowLinks set to false
11604 !! wikitext
11605 [[Image:foobar.jpg|link=http://example.com/]]
11606 !! config
11607 wgNoFollowLinks=false
11608 !! html
11609 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
11610 </p>
11611 !! end
11613 !! test
11614 Image with link parameter, wgNoFollowDomainExceptions
11615 !! wikitext
11616 [[Image:foobar.jpg|link=http://example.com/]]
11617 !! config
11618 wgNoFollowDomainExceptions='example.com'
11619 !! html
11620 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
11621 </p>
11622 !! end
11624 !! test
11625 Image with link parameter, wgExternalLinkTarget, unnamed parameter
11626 !! wikitext
11627 [[Image:foobar.jpg|link=http://example.com/|Title]]
11628 !! config
11629 wgExternalLinkTarget='foobar'
11630 !! html
11631 <p><a href="http://example.com/" title="Title" target="foobar" rel="nofollow"><img alt="Title" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
11632 </p>
11633 !! end
11635 !! test
11636 Image with empty link parameter
11637 !! wikitext
11638 [[File:Foobar.jpg|link=]]
11639 !! html/php
11640 <p><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" />
11641 </p>
11642 !! html/parsoid
11643 <p><span class="mw-default-size" typeof="mw:Image"><span><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="220" width="1941"></span></span></p>
11644 !! end
11646 !! test
11647 Image with link parameter (wiki target) and unnamed parameter
11648 !! wikitext
11649 [[File:Foobar.jpg|link=Main_Page|Title]]
11650 !! html/php
11651 <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>
11652 </p>
11653 !! html/parsoid
11654 <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" height="220" width="1941"></a></span></p>
11655 !! end
11657 !! test
11658 Image with link parameter (URL target) and unnamed parameter
11659 !! wikitext
11660 [[File:Foobar.jpg|link=http://example.com/|Title]]
11661 !! html/php
11662 <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>
11663 </p>
11664 !! html/parsoid
11665 <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" height="220" width="1941"></a></span></p>
11666 !! end
11668 !! test
11669 Thumbnail image with link parameter
11670 !! options
11671 thumbsize=220
11672 parsoid=wt2html,wt2wt,html2html
11673 !! wikitext
11674 [[File:Foobar.jpg|thumb|link=http://example.com/|Title]]
11675 !! html/php
11676 <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>
11678 !! html/parsoid
11679 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="http://example.com/"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="25" width="220"/></a><figcaption>Title</figcaption></figure>
11680 !! end
11682 !! test
11683 Manually-specified thumbnail image
11684 !! options
11685 thumbsize=220
11686 !! wikitext
11687 [[File:Foobar.jpg|thumb=Thumb.png|Title]]
11688 !! html/php
11689 <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>
11691 !! html/parsoid
11692 <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" height="135" width="135"/></a><figcaption>Title</figcaption></figure>
11693 !! end
11695 !! test
11696 Manually-specified thumbnail image with explicit link to wiki page
11697 !! options
11698 thumbsize=220
11699 parsoid=wt2html,wt2wt,html2html
11700 !! wikitext
11701 [[File:Foobar.jpg|thumb=Thumb.png|link=Main_Page|Title]]
11702 !! html/php
11703 <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>
11705 !! html/parsoid
11706 <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" height="135" width="135"/></a><figcaption>Title</figcaption></figure>
11707 !! end
11709 !! test
11710 Manually-specified thumbnail image with explicit link to url
11711 !! options
11712 thumbsize=220
11713 parsoid=wt2html,wt2wt,html2html
11714 !! wikitext
11715 [[File:Foobar.jpg|thumb=Thumb.png|link=http://example.com|Title]]
11716 !! html/php
11717 <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>
11719 !! html/parsoid
11720 <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" height="135" width="135"/></a><figcaption>Title</figcaption></figure>
11721 !! end
11723 !! test
11724 Manually-specified thumbnail image with explicit no link
11725 !! options
11726 thumbsize=220
11727 parsoid=wt2html,wt2wt,html2html
11728 !! wikitext
11729 [[File:Foobar.jpg|thumb=Thumb.png|link=|Title]]
11730 !! html/php
11731 <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>
11733 !! html/parsoid
11734 <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" height="135" width="135"/></span><figcaption>Title</figcaption></figure>
11735 !! end
11737 !! test
11738 Manually-specified thumbnail image with explicit link and alt text
11739 !! options
11740 thumbsize=220
11741 parsoid=wt2html,wt2wt,html2html
11742 !! wikitext
11743 [[File:Foobar.jpg|thumb=Thumb.png|link=Main_Page|alt=alttext|Title]]
11744 !! html/php
11745 <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>
11747 !! html/parsoid
11748 <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" height="135" width="135"/></a><figcaption>Title</figcaption></figure>
11749 !! end
11751 !! test
11752 Image with frame and link
11753 !! options
11754 parsoid=wt2html,wt2wt,html2html
11755 !! wikitext
11756 [[File:Foobar.jpg|frame|left|This is a test image [[Main Page]]]]
11757 !! html/php
11758 <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>
11760 !! html/parsoid
11761 <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" 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>
11762 !! end
11764 !! test
11765 Image with frame and link and explicit alt
11766 !! options
11767 parsoid=wt2html,wt2wt,html2html
11768 !! wikitext
11769 [[Image:Foobar.jpg|frame|left|This is a test image [[Main Page]]|alt=Altitude]]
11770 !! html/php
11771 <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>
11773 !! html/parsoid
11774 <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" 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>
11775 !! end
11777 !! test
11778 Image with wiki markup in implicit alt
11779 !! options
11780 parsoid=wt2html,wt2wt,html2html
11781 !! wikitext
11782 [[Image:Foobar.jpg|testing '''bold''' in alt]]
11784 [[Image:Foobar.jpg|alt=testing '''bold''' in alt]]
11785 !! html/php
11786 <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>
11787 </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>
11788 </p>
11789 !! html/parsoid
11790 <p><span class="mw-default-size" typeof="mw:Image" data-mw="{&quot;caption&quot;:&quot;testing '''bold''' in alt&quot;}"><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="220" width="1941"/></a></span></p>
11791 <p><span class="mw-default-size" typeof="mw:Image"><a href="File:Foobar.jpg"><img alt="testing bold in alt" resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="220" width="1941"/></a></span></p>
11792 !! end
11794 ###################
11795 # Conflicting image format options.
11796 # First option specified should 'win'.
11797 # All three cases in each test should be identical.
11799 !! test
11800 Image with 'frameless' first.
11801 !! options
11802 parsoid=wt2html,wt2wt,html2html
11803 !! wikitext
11804 [[File:Foobar.jpg|frameless|caption]]
11806 [[File:Foobar.jpg|frameless|frame|caption]]
11808 [[File:Foobar.jpg|frameless|thumb|caption]]
11809 !! html/php
11810 <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>
11811 </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>
11812 </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>
11813 </p>
11814 !! html/parsoid
11815 <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/3/3a/Foobar.jpg" height="25" width="220"/></a></span></p>
11816 <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/3/3a/Foobar.jpg" height="25" width="220"/></a></span></p>
11817 <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/3/3a/Foobar.jpg" height="25" width="220"/></a></span></p>
11818 !! end
11820 !! test
11821 Image with 'frame' first.
11822 !! options
11823 parsoid=wt2html,wt2wt,html2html
11824 !! wikitext
11825 [[File:Foobar.jpg|frame|caption]]
11826 [[File:Foobar.jpg|frame|frameless|caption]]
11827 [[File:Foobar.jpg|frame|thumb|caption]]
11828 !! html/php
11829 <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>
11830 <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>
11831 <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>
11833 !! html/parsoid
11834 <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" height="220" width="1941"/></a><figcaption>caption</figcaption></figure>
11835 <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" height="220" width="1941"/></a><figcaption>caption</figcaption></figure>
11836 <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" height="220" width="1941"/></a><figcaption>caption</figcaption></figure>
11837 !! end
11839 !! test
11840 Image with 'thumb' first.
11841 !! options
11842 parsoid=wt2html,wt2wt,html2html
11843 !! wikitext
11844 [[File:Foobar.jpg|thumb|caption]]
11845 [[File:Foobar.jpg|thumb|frameless|caption]]
11846 [[File:Foobar.jpg|thumb|frame|caption]]
11847 !! html/php
11848 <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>
11849 <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>
11850 <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>
11852 !! html/parsoid
11853 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="25" width="220"/></a><figcaption>caption</figcaption></figure>
11854 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="25" width="220"/></a><figcaption>caption</figcaption></figure>
11855 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="25" width="220"/></a><figcaption>caption</figcaption></figure>
11856 !! end
11858 ###################
11859 # Image sizing.
11860 # See https://www.mediawiki.org/wiki/Help:Images#Size_and_frame
11861 # and https://bugzilla.wikimedia.org/show_bug.cgi?id=62258
11862 # Foobar has actual size of 1941x220
11863 # 1. Thumbs & frameless always reduce, can't be enlarged unless it's
11864 #    a scalable format.
11865 # 2. Framed images always ignore size options; always render at default size.
11866 # 3. "Unspecified format" and border are the only types which can be
11867 #    enlarged.
11869 !! test
11870 Image: "unspecified format" and border enlarge
11871 !! options
11872 parsoid=wt2html,wt2wt,html2html
11873 !! wikitext
11874 [[File:Foobar.jpg|2000px]]
11876 [[File:Foobar.jpg|border|2000px]]
11877 !! html/php
11878 <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>
11879 </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>
11880 </p>
11881 !! html/parsoid
11882 <p><span typeof="mw:Image"><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="227" width="2000"/></a></span></p>
11883 <p><span class="mw-image-border" typeof="mw:Image"><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="227" width="2000"/></a></span></p>
11884 !! end
11886 !! test
11887 Image: "unspecified format" and border reduce
11888 !! options
11889 parsoid=wt2html,wt2wt,html2html
11890 !! wikitext
11891 [[File:Foobar.jpg|1000px]]
11893 [[File:Foobar.jpg|border|1000px]]
11894 !! html/php
11895 <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>
11896 </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>
11897 </p>
11898 !! html/parsoid
11899 <p><span typeof="mw:Image"><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="113" width="1000"/></a></span></p>
11900 <p><span class="mw-image-border" typeof="mw:Image"><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="113" width="1000"/></a></span></p>
11901 !! end
11903 !! test
11904 Image: thumbs reduce
11905 !! options
11906 parsoid=wt2html,wt2wt,html2html
11907 !! wikitext
11908 [[File:Foobar.jpg|thumb|50px]]
11909 !! html/php
11910 <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>
11912 !! html/parsoid
11913 <figure typeof="mw:Image/Thumb"><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="6" width="50"/></a></figure>
11914 !! end
11916 !! test
11917 Image: bitmap thumbs can't be enlarged past original size, but vector can.
11918 !! options
11919 parsoid=wt2html,wt2wt,html2html
11920 !! wikitext
11921 [[File:Foobar.jpg|thumb|2000px]]
11923 [[File:Foobar.svg|thumb|2000px]]
11924 !! html/php
11925 <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>
11926 <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>
11928 !! html/parsoid
11929 <figure typeof="mw:Image/Thumb"><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="220" width="1941"/></a></figure>
11930 <figure typeof="mw:Image/Thumb"><a href="File:Foobar.svg"><img resource="./File:Foobar.svg" src="//example.com/images/f/ff/Foobar.svg" height="1500" width="2000"/></a></figure>
11931 !! end
11933 !! test
11934 Image: frameless can reduce in size
11935 !! options
11936 parsoid=wt2html,wt2wt,html2html
11937 !! wikitext
11938 [[File:Foobar.jpg|frameless|50px]]
11939 !! html/php
11940 <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>
11941 </p>
11942 !! html/parsoid
11943 <p><span typeof="mw:Image/Frameless"><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="6" width="50"/></a></span></p>
11944 !! end
11946 !! test
11947 Image: bitmap frameless can't be enlarged past original size, but vector can
11948 !! options
11949 parsoid=wt2html,wt2wt,html2html
11950 !! wikitext
11951 [[File:Foobar.jpg|frameless|2000px]]
11953 [[File:Foobar.svg|frameless|2000px]]
11954 !! html/php
11955 <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>
11956 </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>
11957 </p>
11958 !! html/parsoid
11959 <p><span typeof="mw:Image/Frameless"><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="220" width="1941"/></a></span></p>
11960 <p><span typeof="mw:Image/Frameless"><a href="File:Foobar.svg"><img resource="./File:Foobar.svg" src="//example.com/images/f/ff/Foobar.svg" height="1500" width="2000"/></a></span></p>
11961 !! end
11963 !! test
11964 Image: framed images are always unscaled.
11965 !! options
11966 parsoid=wt2html,wt2wt,html2html
11967 !! wikitext
11968 [[File:Foobar.jpg|frame]]
11970 [[File:Foobar.jpg|frame|50px]]
11972 [[File:Foobar.jpg|frame|50x50px]]
11974 [[File:Foobar.jpg|frame|2000px]]
11975 !! html/php
11976 <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>
11977 <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>
11978 <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>
11979 <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>
11981 !! html/parsoid
11982 <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" height="220" width="1941"/></a></figure>
11983 <figure typeof="mw:Image/Frame"><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="220" width="1941"/></a></figure>
11984 <figure typeof="mw:Image/Frame"><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="220" width="1941"/></a></figure>
11985 <figure typeof="mw:Image/Frame"><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="220" width="1941"/></a></figure>
11986 !! end
11988 ###################
11990 !! test
11991 Link to image page- image page normally doesn't exists, hence edit link
11992 Add test with existing image page
11993 #<p><a href="/wiki/File:Test" title="Image:Test">Image:test</a>
11994 !! wikitext
11995 [[:Image:test]]
11996 !! html
11997 <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>
11998 </p>
11999 !! end
12001 !! test
12002 bug 18784  Link to non-existent image page with caption should use caption as link text
12003 !! wikitext
12004 [[:Image:test|caption]]
12005 !! html
12006 <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>
12007 </p>
12008 !! end
12010 !! test
12011 Frameless image caption with a free URL
12012 !! wikitext
12013 [[File:Foobar.jpg|http://example.com]]
12014 !! html/php
12015 <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>
12016 </p>
12017 !! html/parsoid
12018 <p><span class="mw-default-size" typeof="mw:Image" data-mw='{"caption":"http://example.com"}'><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="220" width="1941"/></a></span></p>
12019 !! end
12021 !! test
12022 Thumbnail image caption with a free URL
12023 !! options
12024 thumbsize=220
12025 !! wikitext
12026 [[File:Foobar.jpg|thumb|http://example.com]]
12027 !! html/php
12028 <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>
12030 !! html/parsoid
12031 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="25" width="220"/></a><figcaption><a rel="mw:ExtLink" href="http://example.com">http://example.com</a></figcaption></figure>
12032 !! end
12034 !! test
12035 Thumbnail image caption with a free URL and explicit alt
12036 !! options
12037 thumbsize=220
12038 parsoid=wt2html,wt2wt,html2html
12039 !! wikitext
12040 [[File:Foobar.jpg|thumb|http://example.com|alt=Alteration]]
12041 !! html/php
12042 <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>
12044 !! html/parsoid
12045 <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/3/3a/Foobar.jpg" height="25" width="220"/></a><figcaption><a rel="mw:ExtLink" href="http://example.com">http://example.com</a></figcaption></figure>
12046 !! end
12048 !! test
12049 SVG thumbnails with no language set
12050 !! options
12051 !! wikitext
12052 [[File:Foobar.svg|thumb|caption]]
12053 !! html/php
12054 <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>
12056 !! html/parsoid
12057 <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" height="165" width="220"/></a><figcaption>caption</figcaption></figure>
12058 !! end
12060 !! test
12061 SVG thumbnails with language de
12062 !! options
12063 parsoid=wt2html,wt2wt,html2html
12064 !! wikitext
12065 [[File:Foobar.svg|thumb|caption|lang=de]]
12066 !! html/php
12067 <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>
12069 !! html/parsoid
12070 <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" lang="de" height="165" width="220"/></a><figcaption>caption</figcaption></figure>
12071 !! end
12073 !! test
12074 SVG thumbnails with invalid language code
12075 !! options
12076 parsoid=wt2html,wt2wt,html2html
12077 !! wikitext
12078 [[File:Foobar.svg|thumb|caption|lang=invalid.language.code]]
12079 !! html/php
12080 <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>
12082 !! html/parsoid
12083 <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" height="165" width="220"/></a><figcaption>lang=invalid.language.code</figcaption></figure>
12084 !! end
12086 !! test
12087 BUG 1887: A ISBN with a thumbnail
12088 !! wikitext
12089 [[File:Foobar.jpg|thumb|ISBN 1235467890]]
12090 !! html/php
12091 <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>
12093 !! html/parsoid
12094 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="25" width="220"/></a><figcaption><a href="Special:BookSources/1235467890" rel="mw:ExtLink">ISBN 1235467890</a></figcaption></figure>
12095 !! end
12097 !! test
12098 BUG 1887: A RFC with a thumbnail
12099 !! wikitext
12100 [[File:Foobar.jpg|thumb|This is RFC 12354]]
12101 !! html/php
12102 <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>
12104 !! html/parsoid
12105 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="25" width="220"/></a><figcaption>This is <a href="//tools.ietf.org/html/rfc12354" rel="mw:ExtLink">RFC 12354</a></figcaption></figure>
12106 !! end
12108 !! test
12109 BUG 1887: A mailto link with a thumbnail
12110 !! wikitext
12111 [[File:Foobar.jpg|thumb|Please mailto:nobody@example.com]]
12112 !! html/php
12113 <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>
12115 !! html/parsoid
12116 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="25" width="220"/></a><figcaption>Please <a rel="mw:ExtLink" href="mailto:nobody@example.com">mailto:nobody@example.com</a></figcaption></figure>
12117 !! end
12119 # Pending resolution to bug 368
12120 !! test
12121 BUG 648: Frameless image caption with a link
12122 !! wikitext
12123 [[File:Foobar.jpg|text with a [[link]] in it]]
12124 !! html/php
12125 <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>
12126 </p>
12127 !! html/parsoid
12128 <p><span class="mw-default-size" typeof="mw:Image" data-mw='{"caption":"text with a [[link]] in it"}'><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="220" width="1941"/></a></span></p>
12129 !! end
12131 !! test
12132 BUG 648: Frameless image caption with a link (suffix)
12133 !! wikitext
12134 [[File:Foobar.jpg|text with a [[link]]foo in it]]
12135 !! html/php
12136 <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>
12137 </p>
12138 !! html/parsoid
12139 <p><span class="mw-default-size" typeof="mw:Image" data-mw='{"caption":"text with a [[link]]foo in it"}'><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="220" width="1941"/></a></span></p>
12140 !! end
12142 !! test
12143 BUG 648: Frameless image caption with an interwiki link
12144 !! wikitext
12145 [[File:Foobar.jpg|text with a [[MeatBall:Link]] in it]]
12146 !! html/php
12147 <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>
12148 </p>
12149 !! html/parsoid
12150 <p><span class="mw-default-size" typeof="mw:Image" data-mw='{"caption":"text with a [[MeatBall:Link]] in it"}'><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="220" width="1941"/></a></span></p>
12151 !! end
12153 !! test
12154 BUG 648: Frameless image caption with a piped interwiki link
12155 !! wikitext
12156 [[File:Foobar.jpg|text with a [[MeatBall:Link|link]] in it]]
12157 !! html/php
12158 <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>
12159 </p>
12160 !! html/parsoid
12161 <p><span class="mw-default-size" typeof="mw:Image" data-mw='{"caption":"text with a [[MeatBall:Link|link]] in it"}'><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="220" width="1941"/></a></span></p>
12162 !! end
12164 !! test
12165 Escape HTML special chars in image alt text
12166 !! wikitext
12167 [[File:Foobar.jpg|& < > "]]
12168 !! html/php
12169 <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>
12170 </p>
12171 !! html/parsoid
12172 <p><span class="mw-default-size" typeof="mw:Image" data-mw='{"caption":"&amp; &lt; > \""}'><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="220" width="1941"/></a></span></p>
12173 !! end
12175 !! test
12176 BUG 499: Alt text should have &#1234;, not &amp;1234;
12177 !! wikitext
12178 [[File:Foobar.jpg|&#9792;]]
12179 !! html/php
12180 <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>
12181 </p>
12182 !! html/parsoid
12183 <p><span class="mw-default-size" typeof="mw:Image" data-mw='{"caption":"&amp;#9792;"}'><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="220" width="1941"/></a></span></p>
12184 !! end
12186 !! test
12187 Broken image caption with link
12188 !! options
12189 parsoid=wt2html,wt2wt,html2html
12190 !! wikitext
12191 [[Image:Foobar.jpg|thumb|This is a broken caption. But [[Main Page|this]] is just an ordinary link.
12192 !! html/php
12193 <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.
12194 </p>
12195 !! html/parsoid
12196 <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>
12197 !! end
12199 !! test
12200 Image caption containing another image
12201 !! wikitext
12202 [[File:Foobar.jpg|thumb|This is a caption with another [[File:Thumb.png|image]] inside it!]]
12203 !! html/php
12204 <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>
12206 !! html/parsoid
12207 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" 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" height="135" width="135"/></a></span> inside it!</figcaption></figure>
12208 !! end
12210 !! test
12211 Image: caption containing a newline
12212 !! wikitext
12213 [[File:Foobar.jpg|This
12214 *is some text]]
12215 !! html/php
12216 <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>
12217 </p>
12218 !! html/parsoid
12219 <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" height="220" width="1941"/></a></span></p>
12220 !!end
12222 !!test
12223 Image: caption containing leading space
12224 (The leading space should not trigger nowiki escaping in wt2wt mode)
12225 !! wikitext
12226 [[File:Foobar.jpg|thumb| bar]]
12227 !! html/php
12228 <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>
12230 !! html/parsoid
12231 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="25" width="220"/></a><figcaption> bar</figcaption></figure>
12232 !!end
12234 !! test
12235 Image: caption containing a table
12236 !! options
12237 parsoid=wt2html,wt2wt,html2html
12238 !! wikitext
12239 [[Image:Foobar.jpg|thumb|200px|This is an example image thumbnail caption with a table
12241 ! Foo !! Bar
12243 | Foo1 || Bar1
12245 and some more text.]]
12246 !! html/php
12247 <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>
12249 !! html/parsoid
12250 <figure typeof="mw:Image/Thumb"><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="23" width="200"/></a><figcaption>This is an example image thumbnail caption with a table
12251 <table>
12252 <tbody>
12253 <tr><th>Foo </th><th>Bar</th></tr>
12254 <tr>
12255 <td>Foo1 </td>
12256 <td>Bar1</td></tr></tbody></table>and some more text.</figcaption></figure>
12257 !! end
12259 !! test
12260 Bug 3090: External links other than http: in image captions
12261 !! wikitext
12262 [[File:Foobar.jpg|thumb|200x200px|This caption has [irc://example.net irc] and [https://example.com Secure] ext links in it.]]
12263 !! html/php
12264 <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>
12266 !! html/parsoid
12267 <figure typeof="mw:Image/Thumb"><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" 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>
12268 !! end
12270 !! test
12271 Custom class
12272 !! options
12273 parsoid=wt2html,wt2wt,html2html
12274 !! wikitext
12275 [[Image:foobar.jpg|a|class=b]]
12276 !! html/php
12277 <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>
12278 </p>
12279 !! html/parsoid
12280 <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" height="220" width="1941"/></a></span></p>
12281 !! end
12283 !! test
12284 Localized image handling (1).
12285 !! options
12286 parsoid=wt2html,wt2wt,html2html
12287 language=es
12288 !! wikitext
12289 [[Archivo:Foobar.jpg|izquierda|enlace=foo|caption]]
12290 !! html/php
12291 <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>
12293 !! html/parsoid
12294 <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" height="220" width="1941"/></a><figcaption>caption</figcaption></figure>
12295 !! end
12297 !! test
12298 Localized image handling (2).
12299 !! options
12300 thumbsize=220
12301 parsoid=wt2html,wt2wt,html2html
12302 language=es
12303 !! wikitext
12304 [[Archivo:Foobar.jpg|miniatura|izquierda|enlace=foo|caption]]
12305 !! html/php
12306 <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>
12308 !! html/parsoid
12309 <figure class="mw-default-size mw-halign-left" typeof="mw:Image/Thumb"><a href="./Foo"><img resource="./Archivo:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="25" width="220"/></a><figcaption>caption</figcaption></figure>
12310 !! end
12312 !! test
12313 "border", "frameless" and "class" attributes on an image.
12314 !! options
12315 thumbsize=220
12316 parsoid=wt2html,wt2wt,html2html
12317 !! wikitext
12318 [[File:Foobar.jpg|frameless|border|class=extra|caption]]
12319 !! html/php
12320 <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>
12321 </p>
12322 !! html/parsoid
12323 <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/3/3a/Foobar.jpg" height="25" width="220"/></a></span></p>
12324 !! end
12326 # Note that 'right' is the default alignment, despite the misspelled 'righ' below
12327 !! test
12328 Invalid image attributes (bug 62500)
12329 !! options
12330 thumbsize=220
12331 parsoid=wt2html,wt2wt,html2html
12332 !! wikitext
12333 [[File:Foobar.jpg|thumb|float|left|caption]]
12335 [[File:Foobar.jpg|thumb|righ|caption]]
12337 [[File:Foobar.jpg|bogus1|thumb|bogus2|left|bogus3|caption]]
12338 !! html/php
12339 <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>
12340 <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>
12341 <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>
12343 !! html/parsoid
12344 <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/3/3a/Foobar.jpg" height="25" width="220"/></a><figcaption>caption</figcaption></figure>
12345 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="25" width="220"/></a><figcaption>caption</figcaption></figure>
12346 <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/3/3a/Foobar.jpg" height="25" width="220"/></a><figcaption>caption</figcaption></figure>
12347 !! end
12349 !! article
12350 File:Barfoo.jpg
12351 !! text
12352 #REDIRECT [[File:Barfoo.jpg]]
12353 !! endarticle
12355 # FIXME: Parsoid should run this test -- but we'd need to teach the
12356 # mockAPI about the redirected Barfoo.jpg image.
12357 !! test
12358 Redirected image
12359 !! wikitext
12360 [[Image:Barfoo.jpg]]
12361 !! html/php
12362 <p><a href="/wiki/File:Barfoo.jpg" title="File:Barfoo.jpg">File:Barfoo.jpg</a>
12363 </p>
12364 !! end
12366 !! test
12367 Missing image with uploads disabled
12368 !! options
12369 wgEnableUploads=0
12370 !! wikitext
12371 [[File:Foobaz.jpg]]
12372 !! html/php
12373 <p><a href="/wiki/File:Foobaz.jpg" title="File:Foobaz.jpg">File:Foobaz.jpg</a>
12374 </p>
12375 !! html/parsoid
12376 <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>
12377 !! end
12379 # Parsoid-specific testing for images
12380 # https://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec#Images
12381 # Currently imperfect due to a flaw in the Parsoid testrunner
12382 # Work in progress
12383 # THESE TESTS SHOULD BE MOVED UP and merged with the php-specific
12384 # image tests.
12386 !! test
12387 Parsoid-specific image handling - simple image with size and middle alignment
12388 !! wikitext
12389 [[File:Foobar.jpg|middle|50px]]
12390 !! html/parsoid
12391 <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" height="6" width="50"></a></span></p>
12392 !! end
12394 !! test
12395 Parsoid-specific image handling - simple image with size, middle alignment,
12396 non-standard namespace alias
12397 !! options
12398 parsoid=wt2wt,wt2html,html2html
12399 !! wikitext
12400 [[Image:Foobar.jpg|middle|50px]]
12401 !! html/parsoid
12402 <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" height="6" width="50"></a></span></p>
12403 !! end
12405 !! test
12406 Parsoid-specific image handling - simple image with size and middle alignment
12407 (existing content)
12408 !! wikitext
12409 [[File:Foobar.jpg|50px|middle]]
12410 !! html/parsoid
12411 <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" height="6" width="50" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"6","width":"50"},"sa":{"resource":"File:Foobar.jpg"}}'/></a></span></p>
12412 !! end
12414 !! test
12415 Parsoid-specific image handling - simple image with size and middle alignment
12416 and non-standard namespace name
12417 !! options
12418 parsoid=wt2html,wt2wt,html2html
12419 !! wikitext
12420 [[Image:Foobar.jpg|50px|middle]]
12421 !! html/parsoid
12422 <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" height="6" width="50"></a></span></p>
12423 !! end
12425 !! test
12426 Parsoid-specific image handling - simple image with both sizes, a baseline alignment, and a caption
12427 !! wikitext
12428 [[File:Foobar.jpg|500x10px|baseline|caption]]
12429 !! html/parsoid
12430 <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" height="10" width="89" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"10","width":"89"},"sa":{"resource":"File:Foobar.jpg"}}'/></a></span></p>
12431 !! end
12433 !! test
12434 Parsoid-specific image handling - simple image with border and size spec
12435 !! wikitext
12436 [[File:Foobar.jpg|50px|border|caption]]
12437 !! html/parsoid
12438 <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" height="6" width="50" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"6","width":"50"},"sa":{"resource":"File:Foobar.jpg"}}'/></a></span></p>
12439 !! end
12441 !! test
12442 Parsoid-specific image handling - thumbnail with halign, valign, and caption
12443 !! wikitext
12444 [[File:Foobar.jpg|left|baseline|thumb|caption content]]
12445 !! html/parsoid
12446 <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/180px-Foobar.jpg" height="25" width="220" /></a><figcaption>caption content</figcaption></figure>
12447 !! end
12449 !! test
12450 Parsoid-specific image handling - thumbnail with halign, valign, and caption
12451 (existing content)
12452 !! wikitext
12453 [[File:Foobar.jpg|thumb|left|baseline|caption content]]
12454 !! html/parsoid
12455 <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/180px-Foobar.jpg" 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>
12456 !! end
12458 !! test
12459 Parsoid-specific image handling - thumbnail with specific size, halign, valign, and caption
12460 !! wikitext
12461 [[Image:Foobar.jpg|right|middle|thumb|50x50px|caption]]
12462 !! html/parsoid
12463 <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" height="6" width="50" /></a><figcaption>caption</figcaption></figure>
12464 !! end
12466 !! test
12467 Parsoid-specific image handling - thumbnail with specific size, halign,
12468 valign, and caption (existing content)
12469 !! wikitext
12470 [[File:Foobar.jpg|thumb|50x50px|right|middle|caption]]
12471 !! html/parsoid
12472 <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" 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>
12473 !! end
12475 !! test
12476 Parsoid-specific image handling - framed image with specific size and caption
12477 (size is ignored)
12478 !! options
12479 parsoid=wt2html,wt2wt,html2html
12480 !! wikitext
12481 [[File:Foobar.jpg|frame|500x50px|caption]]
12482 !! html/parsoid
12483 <figure typeof="mw:Image/Frame"><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="220" width="1941" /></a><figcaption>caption</figcaption></figure>
12484 !! end
12486 !! test
12487 Parsoid-specific image handling - framed image with specific size, halign, valign, and caption
12488 (size is ignored)
12489 !! options
12490 parsoid=wt2html,wt2wt,html2html
12491 !! wikitext
12492 [[File:Foobar.jpg|left|baseline|frame|500x50px|caption]]
12493 !! html/parsoid
12494 <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" height="220" width="1941" /></a><figcaption>caption</figcaption></figure>
12495 !! end
12497 !! test
12498 Parsoid-specific image handling - frameless image with specific size, border, and caption
12499 !! wikitext
12500 [[File:Foobar.jpg|frameless|442x50px|border|caption]]
12501 !! html/parsoid
12502 <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" height="50" width="442" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"50","width":"442"},"sa":{"resource":"File:Foobar.jpg"}}'/></a></span></p>
12503 !! end
12505 !! test
12506 Parsoid-specific image handling - simple image with a formatted caption
12507 !! wikitext
12508 [[File:Foobar.jpg|<table><tr><td>a</td><td>b</td></tr><tr><td>c</td></tr></table>]]
12509 !! html/parsoid
12510 <p><span class="mw-default-size" typeof="mw:Image" data-mw='{"caption":"&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>"}'><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="220" width="1941"></a></span></p>
12511 !! end
12513 !! test
12514 Parsoid-specific image handling - caption with a template in it
12515 !! wikitext
12516 [[File:Foobar.jpg|thumb|200x23px|This caption has a {{echo|transclusion}} in it.]]
12517 !! html/parsoid
12518 <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" 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>
12519 !! end
12521 !! test
12522 Parsoid-specific image handling - caption with unbalanced tags in it
12523 !! options
12524 parsoid=wt2html,wt2wt,html2html
12525 !! wikitext
12527 [[File:Foobar.jpg|thumb|200x200px|This caption has a <center>unbalanced tag in it.]]
12529 !! html/parsoid
12530 <p>foo</p>
12531 <figure typeof="mw:Image/Thumb"><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="23" width="200"></a><figcaption>This caption has a <center>unbalanced tag in it.</center></figcaption></figure>
12532 <p>bar</p>
12533 !! end
12535 !! test
12536 Parsoid-specific image handling - empty caption (1)
12537 !! options
12538 parsoid=wt2html,wt2wt
12539 !! wikitext
12540 [[File:Foobar.jpg|thumb|]]
12541 !! html/parsoid
12542 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="25" width="220"/></a><figcaption></figcaption></figure>
12543 !! end
12545 # empty captions don't get serialized unless we're in the "round trip" case
12546 !! test
12547 Parsoid-specific image handling - empty caption (2)
12548 !! options
12549 parsoid=html2wt
12550 !! html/parsoid
12551 <figure class="mw-default-size" typeof="mw:Image/Thumb">
12552   <a href="File:Foobar.jpg">
12553     <img resource="./File:Foobar.jpg"
12554          src="//example.com/images/3/3a/Foobar.jpg"
12555          height="25" width="220"/>
12556   </a>
12557   <figcaption></figcaption>
12558 </figure>
12559 !! wikitext
12560 [[File:Foobar.jpg|thumb]]
12561 !! end
12563 !! test
12564 Parsoid-specific image handling - whitespace caption
12565 !! wikitext
12566 [[File:Foobar.jpg|thumb| ]]
12567 !! html/parsoid
12568 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="25" width="220"/></a><figcaption> </figcaption></figure>
12569 !! end
12571 !! test
12572 Parsoid-specific image handling - lang option
12573 !! wikitext
12575 [[File:Foobar.svg|lang=de|caption]]
12577 !! html/parsoid
12578 <p>foo
12579 <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" height="180" width="240"/></a></span>
12580 bar</p>
12581 !! end
12585 ### Subpages
12587 !! article
12588 Subpage test/subpage
12589 !! text
12591 !! endarticle
12593 !! test
12594 Subpage link
12595 !! options
12596 subpage title=[[Subpage test]]
12597 !! wikitext
12598 [[/subpage]]
12599 !! html
12600 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a>
12601 </p>
12602 !! end
12604 !! test
12605 Subpage noslash link
12606 !! options
12607 subpage title=[[Subpage test]]
12608 !! wikitext
12609 [[/subpage/]]
12610 !! html
12611 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">subpage</a>
12612 </p>
12613 !! end
12615 !! article
12616 Subpage test/1/2/subpage
12617 !! text
12618 blah
12619 !! endarticle
12621 !! test
12622 Relative subpage noslash link
12623 !! options
12624 parsoid=wt2wt,wt2html,html2html
12625 subpage title=[[Subpage test/1/2/3/4]]
12626 !! wikitext
12627 [[../../subpage/]]
12629 [[../../subpage]]
12630 !! html/php
12631 <p><a href="/wiki/Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">subpage</a>
12632 </p><p><a href="/wiki/Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">Subpage test/1/2/subpage</a>
12633 </p>
12634 !! html/parsoid
12635 <p><a rel="mw:WikiLink" href="Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">subpage</a></p>
12636 <p><a rel="mw:WikiLink" href="Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">Subpage_test/1/2/subpage</a></p>
12637 !! end
12639 !! test
12640 Parsoid: dot-slash prefixed wikilinks
12641 !! wikitext
12642 [[./foo]]
12644 [[././bar]]
12646 [[././baz/]]
12647 !! html/php
12648 <p>[[./foo]]
12649 </p><p>[[././bar]]
12650 </p><p>[[././baz/]]
12651 </p>
12652 !! html/parsoid
12653 <p>[[./foo]]
12654 </p><p>[[././bar]]
12655 </p><p>[[././baz/]]
12656 </p>
12657 !! end
12659 !! test
12660 Render invalid page names as plain text (bug 51090)
12661 !! wikitext
12662 [[./../foo|bar]]
12663 [[foo�|bar]]
12664 [[foo/.|bar]]
12665 [[foo/..|bar]]
12666 [[foo~~~bar]]
12667 [[foo>bar]]
12668 [[foo[bar]]
12669 [[.]]
12670 [[..]]
12671 [[foo././bar]]
12673 [[{{echo|./../foo}}|bar]]
12674 [[{{echo|foo/.}}|bar]]
12675 [[{{echo|foo/..}}|bar]]
12676 [[{{echo|foo~~~~bar}}]]
12677 [[{{echo|foo>bar}}]]
12678 [[{{echo|foo././bar}}]]
12679 [[{{echo|foo{bar}}]]
12680 [[{{echo|foo}bar}}]]
12681 [[{{echo|foo[bar}}]]
12682 [[{{echo|foo]bar}}]]
12683 [[{{echo|foo<bar}}]]
12684 !!html/php
12685 <p>[[./../foo|bar]]
12686 [[foo�|bar]]
12687 [[foo/.|bar]]
12688 [[foo/..|bar]]
12689 [[foo~~~bar]]
12690 [[foo&gt;bar]]
12691 [[foo[bar]]
12692 [[.]]
12693 [[..]]
12694 [[foo././bar]]
12695 </p><p>[[./../foo|bar]]
12696 [[foo/.|bar]]
12697 [[foo/..|bar]]
12698 [[foo~~~~bar]]
12699 [[foo&gt;bar]]
12700 [[foo././bar]]
12701 [[foo{bar]]
12702 [[foo}bar]]
12703 [[foo[bar]]
12704 [[foo]bar]]
12705 [[foo&lt;bar]]
12706 </p>
12707 !!html/parsoid
12708 <p>[[./../foo|bar]]
12709 [[foo�|bar]]
12710 [[foo/.|bar]]
12711 [[foo/..|bar]]
12712 [[foo~~~bar]]
12713 [[foo>bar]]
12714 [[foo[bar]]
12715 [[.]]
12716 [[..]]
12717 [[foo././bar]]</p>
12719 <p>[[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"./../foo"}},"i":0}}]}'>./../foo</span>|bar]]
12720 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo/."}},"i":0}}]}'>foo/.</span>|bar]]
12721 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo/.."}},"i":0}}]}'>foo/..</span>|bar]]
12722 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo~~~~bar"}},"i":0}}]}'>foo~~~~bar</span>]]
12723 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo>bar"}},"i":0}}]}'>foo>bar</span>]]
12724 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo././bar"}},"i":0}}]}'>foo././bar</span>]]
12725 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo{bar"}},"i":0}}]}'>foo{bar</span>]]
12726 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo}bar"}},"i":0}}]}'>foo}bar</span>]]
12727 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo[bar"}},"i":0}}]}'>foo[bar</span>]]
12728 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo]bar"}},"i":0}}]}'>foo]bar</span>]]
12729 [[<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>
12730 !!end
12732 !! test
12733 Disabled subpages
12734 !! wikitext
12735 [[/subpage]]
12736 !! html
12737 <p><a href="/index.php?title=/subpage&amp;action=edit&amp;redlink=1" class="new" title="/subpage (page does not exist)">/subpage</a>
12738 </p>
12739 !! end
12741 !! test
12742 BUG 561: {{/Subpage}}
12743 !! options
12744 subpage title=[[Page]]
12745 !! wikitext
12746 {{/Subpage}}
12747 !! html
12748 <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>
12749 </p>
12750 !! end
12753 ### Categories
12755 !! article
12756 Category:MediaWiki User's Guide
12757 !! text
12758 blah
12759 !! endarticle
12761 !! test
12762 Link to category
12763 !! wikitext
12764 [[:Category:MediaWiki User's Guide]]
12765 !! html
12766 <p><a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">Category:MediaWiki User's Guide</a>
12767 </p>
12768 !! end
12770 !! test
12771 Simple category
12772 !! options
12774 !! wikitext
12775 [[Category:MediaWiki User's Guide]]
12776 !! html
12777 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
12778 !! end
12780 !! test
12781 PAGESINCATEGORY invalid title fatal (r33546 fix)
12782 !! wikitext
12783 {{PAGESINCATEGORY:<bogus>}}
12784 !! html
12785 <p>0
12786 </p>
12787 !! end
12789 !! test
12790 Category with different sort key
12791 !! options
12793 !! wikitext
12794 [[Category:MediaWiki User's Guide|Foo]]
12795 !! html
12796 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
12797 !! end
12799 !! test
12800 Category with identical sort key
12801 !! options
12803 !! wikitext
12804 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
12805 !! html
12806 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
12807 !! end
12809 !! test
12810 Category with empty sort key
12811 !! options
12814 !! wikitext
12815 [[Category:MediaWiki User's Guide|]]
12816 !! html
12817 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
12818 !! end
12820 !! test
12821 Category with empty sort key and parentheses
12822 !! options
12825 !! wikitext
12826 [[Category:Foo (bar)|]]
12827 !! html
12828 [[Category:Foo (bar)|Foo]]
12829 !! end
12831 !! test
12832 Category with link tail
12833 !! options
12836 !! wikitext
12837 123[[Category:Foo]]456
12838 !! html
12839 123[[Category:Foo]]456
12840 !! end
12842 !! test
12843 Category with template
12844 !! options
12847 !! wikitext
12848 [[Category:{{echo|Foo}}]]
12849 !! html
12850 [[Category:{{echo|Foo}}]]
12851 !! end
12853 !! test
12854 Category with template in sort key
12855 !! options
12858 !! wikitext
12859 [[Category:Foo|{{echo|Bar}}]]
12860 !! html
12861 [[Category:Foo|{{echo|Bar}}]]
12862 !! end
12864 !! test
12865 Category with template in sort key and title
12866 !! options
12869 !! wikitext
12870 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
12871 !! html
12872 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
12873 !! end
12875 !! test
12876 Category / paragraph interactions
12877 !! wikitext
12878 Foo [[Category:Baz]] Bar
12880 Foo [[Category:Baz]]
12884 [[Category:Baz]]
12888 [[Category:Baz]] Bar
12891 [[Category:Baz]]
12892  [[Category:Baz]]
12893 [[Category:Baz]]
12896 [[Category:Baz]]
12897  [[Category:Baz]]
12898 [[Category:Baz]]
12900 [[Category:Baz]]
12901  {{echo|[[Category:Baz]]}}
12902 [[Category:Baz]]
12903 !! html
12904 <p>Foo Bar
12905 </p><p>Foo
12907 </p><p>Foo
12909 </p><p>Foo Bar
12910 </p><p>Foo
12912 </p>
12913 !! end
12915 !! test
12916 Parsoid: Serialize link to category page with colon escape
12917 !! options
12918 parsoid
12919 !! wikitext
12921 [[:Category:Foo]]
12922 [[:Category:Foo|Bar]]
12923 !! html
12925 <a rel="mw:WikiLink" href="Category:Foo" title="Category:Foo">Category:Foo</a>
12926 <a rel="mw:WikiLink" href="Category:Foo" title="Category:Foo">Bar</a>
12927 </p>
12928 !! end
12930 !! test
12931 Parsoid: Link prefix/suffixes aren't applied to category links
12932 !! options
12933 parsoid=wt2html,wt2wt,html2html
12934 language=is
12935 !! wikitext
12936 x[[Category:Foo]]y
12937 !! html
12938 <p>x<link rel="mw:PageProp/Category" href="Category:Foo">y</p>
12939 !! end
12941 !! test
12942 Parsoid: Serialize link to file page with colon escape
12943 !! options
12944 parsoid
12945 !! wikitext
12947 [[:File:Foo.png]]
12948 [[:File:Foo.png|Bar]]
12949 !! html
12951 <a rel="mw:WikiLink" href="File:Foo.png" title="File:Foo.png">File:Foo.png</a>
12952 <a rel="mw:WikiLink" href="File:Foo.png" title="File:Foo.png">Bar</a>
12953 </p>
12954 !! end
12956 !! test
12957 Parsoid: Serialize a genuine category link without colon escape
12958 !! options
12959 parsoid
12960 !! wikitext
12961 [[Category:Foo]]
12962 [[Category:Foo|Bar]]
12963 !! html
12964 <link rel="mw:PageProp/Category" href="Category:Foo">
12965 <link rel="mw:PageProp/Category" href="Category:Foo#Bar">
12966 !! end
12968 !! test
12969 Normalize hrefs properly before testing for invalid link targets (bug 70894)
12970 !! options
12971 parsoid=html2wt
12972 !! html
12973 <link rel="mw:PageProp/Category" href="./Category:Toxine_bactérienne"/>
12974 !! wikitext
12975 [[Category:Toxine bactérienne]]
12976 !! end
12978 !! test
12979 Parsoid: Defaultsort
12980 !! options
12981 parsoid
12982 !! wikitext
12983 {{DEFAULTSORT:Foo}}
12984 !! html
12985 <meta property="mw:PageProp/categorydefaultsort" content="Foo"/>
12986 !! end
12989 ### Inter-language links
12991 !! test
12992 Interlanguage links
12993 !! options
12995 !! wikitext
12996 [[es:Alimento]]
12997 [[fr:Nourriture]]
12998 [[zh:食品]]
12999 !! html/php
13000 es:Alimento fr:Nourriture zh:食品
13001 !! html/parsoid
13002 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Alimento"/>
13003 <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/Nourriture"/>
13004 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/食品"/>
13005 !! end
13007 !! test
13008 Duplicate interlanguage links (bug 24502)
13009 !! options
13011 !! wikitext
13012 [[es:1]]
13013 [[es:2]]
13014 [[fr:1]]
13015 [[fr:2]]
13016 !! html/php
13017 es:1 fr:1
13018 !! html/parsoid
13019 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/1"/>
13020 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/2"/>
13021 <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/1"/>
13022 <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/2"/>
13023 !! end
13026 ### Sections
13028 !! test
13029 Basic section headings
13030 !! wikitext
13031 == Headline 1 ==
13032 Some text
13034 ==Headline 2==
13035 More
13036 ===Smaller headline===
13037 Blah blah
13038 !! html
13039 <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>
13040 <p>Some text
13041 </p>
13042 <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>
13043 <p>More
13044 </p>
13045 <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>
13046 <p>Blah blah
13047 </p>
13048 !! end
13050 !! test
13051 Section headings with TOC
13052 !! wikitext
13053 == Headline 1 ==
13054 === Subheadline 1 ===
13055 ===== Skipping a level =====
13056 ====== Skipping a level ======
13058 == Headline 2 ==
13059 Some text
13060 ===Another headline===
13061 !! html
13062 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
13063 <ul>
13064 <li class="toclevel-1 tocsection-1"><a href="#Headline_1"><span class="tocnumber">1</span> <span class="toctext">Headline 1</span></a>
13065 <ul>
13066 <li class="toclevel-2 tocsection-2"><a href="#Subheadline_1"><span class="tocnumber">1.1</span> <span class="toctext">Subheadline 1</span></a>
13067 <ul>
13068 <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>
13069 <ul>
13070 <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>
13071 </ul>
13072 </li>
13073 </ul>
13074 </li>
13075 </ul>
13076 </li>
13077 <li class="toclevel-1 tocsection-5"><a href="#Headline_2"><span class="tocnumber">2</span> <span class="toctext">Headline 2</span></a>
13078 <ul>
13079 <li class="toclevel-2 tocsection-6"><a href="#Another_headline"><span class="tocnumber">2.1</span> <span class="toctext">Another headline</span></a></li>
13080 </ul>
13081 </li>
13082 </ul>
13083 </div>
13085 <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>
13086 <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>
13087 <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>
13088 <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>
13089 <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>
13090 <p>Some text
13091 </p>
13092 <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>
13094 !! end
13096 # perl -e 'print "="x$_," Level $_ heading","="x$_,"\n" for 1..10'
13097 !! test
13098 Handling of sections up to level 6 and beyond
13099 !! wikitext
13100 = Level 1 Heading=
13101 == Level 2 Heading==
13102 === Level 3 Heading===
13103 ==== Level 4 Heading====
13104 ===== Level 5 Heading=====
13105 ====== Level 6 Heading======
13106 ======= Level 7 Heading=======
13107 ======== Level 8 Heading========
13108 ========= Level 9 Heading=========
13109 ========== Level 10 Heading==========
13110 !! html
13111 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
13112 <ul>
13113 <li class="toclevel-1 tocsection-1"><a href="#Level_1_Heading"><span class="tocnumber">1</span> <span class="toctext">Level 1 Heading</span></a>
13114 <ul>
13115 <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>
13116 <ul>
13117 <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>
13118 <ul>
13119 <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>
13120 <ul>
13121 <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>
13122 <ul>
13123 <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>
13124 <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>
13125 <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>
13126 <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>
13127 <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>
13128 </ul>
13129 </li>
13130 </ul>
13131 </li>
13132 </ul>
13133 </li>
13134 </ul>
13135 </li>
13136 </ul>
13137 </li>
13138 </ul>
13139 </div>
13141 <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>
13142 <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>
13143 <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>
13144 <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>
13145 <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>
13146 <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>
13147 <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>
13148 <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>
13149 <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>
13150 <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>
13152 !! end
13154 !! test
13155 TOC regression (bug 9764)
13156 !! wikitext
13157 == title 1 ==
13158 === title 1.1 ===
13159 ==== title 1.1.1 ====
13160 === title 1.2 ===
13161 == title 2 ==
13162 === title 2.1 ===
13163 !! html
13164 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
13165 <ul>
13166 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
13167 <ul>
13168 <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>
13169 <ul>
13170 <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>
13171 </ul>
13172 </li>
13173 <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>
13174 </ul>
13175 </li>
13176 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
13177 <ul>
13178 <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>
13179 </ul>
13180 </li>
13181 </ul>
13182 </div>
13184 <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>
13185 <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>
13186 <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>
13187 <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>
13188 <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>
13189 <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>
13191 !! end
13193 !! test
13194 TOC with wgMaxTocLevel=3 (bug 6204)
13195 !! options
13196 wgMaxTocLevel=3
13197 !! wikitext
13198 == title 1 ==
13199 === title 1.1 ===
13200 ==== title 1.1.1 ====
13201 === title 1.2 ===
13202 == title 2 ==
13203 === title 2.1 ===
13204 !! html
13205 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
13206 <ul>
13207 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
13208 <ul>
13209 <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>
13210 <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>
13211 </ul>
13212 </li>
13213 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
13214 <ul>
13215 <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>
13216 </ul>
13217 </li>
13218 </ul>
13219 </div>
13221 <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>
13222 <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>
13223 <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>
13224 <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>
13225 <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>
13226 <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>
13228 !! end
13230 !! test
13231 TOC with wgMaxTocLevel=3 and two level four headings (bug 6204)
13232 !! options
13233 wgMaxTocLevel=3
13234 !! wikitext
13235 ==Section 1==
13236 ===Section 1.1===
13237 ====Section 1.1.1====
13238 ====Section 1.1.1.1====
13239 ==Section 2==
13240 !! html
13241 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
13242 <ul>
13243 <li class="toclevel-1 tocsection-1"><a href="#Section_1"><span class="tocnumber">1</span> <span class="toctext">Section 1</span></a>
13244 <ul>
13245 <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>
13246 </ul>
13247 </li>
13248 <li class="toclevel-1 tocsection-5"><a href="#Section_2"><span class="tocnumber">2</span> <span class="toctext">Section 2</span></a></li>
13249 </ul>
13250 </div>
13252 <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>
13253 <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>
13254 <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>
13255 <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>
13256 <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>
13258 !! end
13261 !! test
13262 Resolving duplicate section names
13263 !! wikitext
13264 == Foo bar ==
13265 == Foo bar ==
13266 !! html
13267 <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>
13268 <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>
13270 !! end
13272 !! test
13273 Resolving duplicate section names with differing case (bug 10721)
13274 !! wikitext
13275 == Foo bar ==
13276 == Foo Bar ==
13277 !! html
13278 <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>
13279 <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>
13281 !! end
13283 !! article
13284 Template:sections
13285 !! text
13286 ===Section 1===
13287 ==Section 2==
13288 !! endarticle
13290 !! test
13291 Template with sections, __NOTOC__
13292 !! wikitext
13293 __NOTOC__
13294 ==Section 0==
13295 {{sections}}
13296 ==Section 4==
13297 !! html
13298 <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>
13299 <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>
13300 <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>
13301 <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>
13303 !! end
13305 !! test
13306 __NOEDITSECTION__ keyword
13307 !! wikitext
13308 __NOEDITSECTION__
13309 ==Section 1==
13310 ==Section 2==
13311 !! html
13312 <h2><span class="mw-headline" id="Section_1">Section 1</span></h2>
13313 <h2><span class="mw-headline" id="Section_2">Section 2</span></h2>
13315 !! end
13317 !! test
13318 Link inside a section heading
13319 !! wikitext
13320 ==Section with a [[Main Page|link]] in it==
13321 !! html
13322 <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>
13324 !! end
13326 !! test
13327 TOC regression (bug 12077)
13328 !! wikitext
13329 __TOC__
13330 == title 1 ==
13331 === title 1.1 ===
13332 == title 2 ==
13333 !! html
13334 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
13335 <ul>
13336 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
13337 <ul>
13338 <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>
13339 </ul>
13340 </li>
13341 <li class="toclevel-1 tocsection-3"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a></li>
13342 </ul>
13343 </div>
13345 <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>
13346 <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>
13347 <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>
13349 !! end
13351 !! test
13352 BUG 1219 URL next to image (good)
13353 !! wikitext
13354 http://example.com [[Image:foobar.jpg]]
13355 !! html
13356 <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>
13357 </p>
13358 !!end
13360 !! test
13361 Short headings with trailing space should match behavior of Parser::doHeadings (bug 19910)
13362 !! wikitext
13363 === 
13364 The line above must have a trailing space!
13365 === <!--
13366 --> <!-- -->
13367 But just in case it doesn't...
13368 !! html
13369 <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>
13370 <p>The line above must have a trailing space!
13371 </p>
13372 <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>
13373 <p>But just in case it doesn't...
13374 </p>
13375 !! end
13377 !! test
13378 Header with special characters (bug 25462)
13379 !! wikitext
13380 The tooltips shall not show entities to the user (ie. be double escaped)
13382 == text > text ==
13383 section 1
13385 == text < text ==
13386 section 2
13388 == text & text ==
13389 section 3
13391 == text ' text ==
13392 section 4
13394 == text " text ==
13395 section 5
13396 !! html
13397 <p>The tooltips shall not show entities to the user (ie. be double escaped)
13398 </p>
13399 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
13400 <ul>
13401 <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>
13402 <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>
13403 <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>
13404 <li class="toclevel-1 tocsection-4"><a href="#text_.27_text"><span class="tocnumber">4</span> <span class="toctext">text ' text</span></a></li>
13405 <li class="toclevel-1 tocsection-5"><a href="#text_.22_text"><span class="tocnumber">5</span> <span class="toctext">text " text</span></a></li>
13406 </ul>
13407 </div>
13409 <h2><span class="mw-headline" id="text_.3E_text">text &gt; text</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: text > text">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
13410 <p>section 1
13411 </p>
13412 <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>
13413 <p>section 2
13414 </p>
13415 <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>
13416 <p>section 3
13417 </p>
13418 <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>
13419 <p>section 4
13420 </p>
13421 <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>
13422 <p>section 5
13423 </p>
13424 !! end
13426 !! test
13427 Header with space, plus and underscore as entity
13428 !! wikitext
13429 Id should not contain + for spaces
13431 == Space between Text ==
13432 section 1
13434 == Space-Entity&#32;between&#32;Text ==
13435 section 2
13437 == Plus+between+Text ==
13438 section 3
13440 == Plus-Entity&#43;between&#43;Text ==
13441 section 4
13443 == Underscore_between_Text ==
13444 section 5
13446 == Underscore-Entity&#95;between&#95;Text ==
13447 section 6
13449 [[#Space between Text]]
13450 [[#Space-Entity&#32;between&#32;Text]]
13451 [[#Plus+between+Text]]
13452 [[#Plus-Entity&#43;between&#43;Text]]
13453 [[#Underscore_between_Text]]
13454 [[#Underscore-Entity&#95;between&#95;Text]]
13455 !! html
13456 <p>Id should not contain + for spaces
13457 </p>
13458 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
13459 <ul>
13460 <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>
13461 <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>
13462 <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>
13463 <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>
13464 <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>
13465 <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>
13466 </ul>
13467 </div>
13469 <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>
13470 <p>section 1
13471 </p>
13472 <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>
13473 <p>section 2
13474 </p>
13475 <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>
13476 <p>section 3
13477 </p>
13478 <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>
13479 <p>section 4
13480 </p>
13481 <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>
13482 <p>section 5
13483 </p>
13484 <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>
13485 <p>section 6
13486 </p><p><a href="#Space_between_Text">#Space between Text</a>
13487 <a href="#Space-Entity_between_Text">#Space-Entity&#32;between&#32;Text</a>
13488 <a href="#Plus.2Bbetween.2BText">#Plus+between+Text</a>
13489 <a href="#Plus-Entity.2Bbetween.2BText">#Plus-Entity&#43;between&#43;Text</a>
13490 <a href="#Underscore_between_Text">#Underscore_between_Text</a>
13491 <a href="#Underscore-Entity_between_Text">#Underscore-Entity&#95;between&#95;Text</a>
13492 </p>
13493 !! end
13495 !! test
13496 Headers with excess '=' characters
13497 (Are similar tests necessary beyond the 1st level?)
13498 !! wikitext
13499 =foo==
13500 ==foo=
13501 =''italic'' heading==
13502 ==''italic'' heading=
13503 !! html
13504 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
13505 <ul>
13506 <li class="toclevel-1 tocsection-1"><a href="#foo.3D"><span class="tocnumber">1</span> <span class="toctext">foo=</span></a></li>
13507 <li class="toclevel-1 tocsection-2"><a href="#.3Dfoo"><span class="tocnumber">2</span> <span class="toctext">=foo</span></a></li>
13508 <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>
13509 <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>
13510 </ul>
13511 </div>
13513 <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>
13514 <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>
13515 <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>
13516 <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>
13518 !! end
13520 !! test
13521 HTML headers vs TOC (bug 23393)
13522 (__NOEDITSECTION__ for clearer output, doesn't matter here)
13523 !! wikitext
13524 <h1>Header 1</h1>
13525 == Header 1.1 ==
13526 == Header 1.2 ==
13528 <h1>Header 2
13529 </h1>
13530 == Header 2.1 ==
13531 == Header 2.2 ==
13532 __NOEDITSECTION__
13533 !! html
13534 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
13535 <ul>
13536 <li class="toclevel-1"><a href="#Header_1"><span class="tocnumber">1</span> <span class="toctext">Header 1</span></a>
13537 <ul>
13538 <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>
13539 <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>
13540 </ul>
13541 </li>
13542 <li class="toclevel-1"><a href="#Header_2"><span class="tocnumber">2</span> <span class="toctext">Header 2</span></a>
13543 <ul>
13544 <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>
13545 <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>
13546 </ul>
13547 </li>
13548 </ul>
13549 </div>
13551 <h1><span class="mw-headline" id="Header_1">Header 1</span></h1>
13552 <h2><span class="mw-headline" id="Header_1.1">Header 1.1</span></h2>
13553 <h2><span class="mw-headline" id="Header_1.2">Header 1.2</span></h2>
13554 <h1><span class="mw-headline" id="Header_2">Header 2</span></h1>
13555 <h2><span class="mw-headline" id="Header_2.1">Header 2.1</span></h2>
13556 <h2><span class="mw-headline" id="Header_2.2">Header 2.2</span></h2>
13558 !! end
13560 !! test
13561 Single-line or multiline-comments can follow headings
13562 !! options
13563 parsoid=wt2html,wt2wt
13564 !! wikitext
13565 ==foo==<!---->
13566 ==bar==<!--c1-->
13567 ==baz==<!--
13569 c3-->
13570 !! html
13571 <h2><span class="mw-headline" id="foo">foo</span></h2>
13572 <h2><span class="mw-headline" id="bar">bar</span></h2>
13573 <h2><span class="mw-headline" id="baz">baz</span></h2>
13575 !! end
13577 !! test
13578 BUG 1219 URL next to image (broken)
13579 !! wikitext
13580 http://example.com[[Image:foobar.jpg]]
13581 !! html
13582 <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>
13583 </p>
13584 !!end
13586 !! test
13587 Bug 1186 news: in the middle of text
13588 !! wikitext
13589 http://en.wikinews.org/wiki/Wikinews:Workplace
13590 !! html
13591 <p><a rel="nofollow" class="external free" href="http://en.wikinews.org/wiki/Wikinews:Workplace">http://en.wikinews.org/wiki/Wikinews:Workplace</a>
13592 </p>
13593 !!end
13596 !! test
13597 Namespaced link must have a title
13598 !! wikitext
13599 [[Project:]]
13600 !! html
13601 <p>[[Project:]]
13602 </p>
13603 !!end
13605 !! test
13606 Namespaced link must have a title (bad fragment version)
13607 !! wikitext
13608 [[Project:#fragment]]
13609 !! html
13610 <p>[[Project:#fragment]]
13611 </p>
13612 !!end
13616 ### HTML tags and HTML attributes
13619 !! test
13620 div with no attributes
13621 !! wikitext
13622 <div>HTML rocks</div>
13623 !! html
13624 <div>HTML rocks</div>
13626 !! end
13628 !! test
13629 div with double-quoted attribute
13630 !! wikitext
13631 <div id="rock">HTML rocks</div>
13632 !! html
13633 <div id="rock">HTML rocks</div>
13635 !! end
13637 !! test
13638 div with single-quoted attribute
13639 !! wikitext
13640 <div id='rock'>HTML rocks</div>
13641 !! html
13642 <div id="rock">HTML rocks</div>
13644 !! end
13646 !! test
13647 div with unquoted attribute
13648 !! wikitext
13649 <div id=rock>HTML rocks</div>
13650 !! html
13651 <div id="rock">HTML rocks</div>
13653 !! end
13655 !! test
13656 div with illegal double attributes
13657 !! wikitext
13658 <div id="a" id="b">HTML rocks</div>
13659 !! html
13660 <div id="b">HTML rocks</div>
13662 !!end
13664 # FIXME: produce empty string instead of "class" in the PHP parser, following
13665 # the HTML5 spec.
13666 !! test
13667 div with empty attribute value, space before equals
13668 !! options
13669 parsoid
13670 !! wikitext
13671 <div class =>HTML rocks</div>
13672 !! html
13673 <div class="">HTML rocks</div>
13675 !! end
13677 !! test
13678 div with multiple empty attribute values
13679 !! options
13680 parsoid
13681 !! wikitext
13682 <div id= title=>HTML rocks</div>
13683 !! html
13684 <div id="" title="">HTML rocks</div>
13686 !! end
13688 !! test
13689 table with multiple empty attribute values
13690 !! options
13691 parsoid
13692 !! wikitext
13693 {| title= id=
13694 | hi
13696 !! html
13697 <table title="" id="">
13698 <tbody><tr><td> hi</td></tr>
13699 </tbody></table>
13700 !! end
13702 !! test
13703 div with braces in attribute value
13704 !! wikitext
13705 <div title="{}">Foo</div>
13706 !! html/php
13707 <div title="&#123;}">Foo</div>
13709 !! html/parsoid
13710 <div title="{}">Foo</div>
13711 !! end
13713 # This it very inconsistent in the PHP parser: it returns 
13714 # class="class" if there is a space between the name and the equal sign (see
13715 # 'div with empty attribute value, space before equals'), but strips the
13716 # attribute completely if the space is missing. We hope that not much content
13717 # depends on this, so are implementing the behavior below in Parsoid for
13718 # consistencies' sake.
13719 # FIXME: fix this behavior in the PHP parser?
13720 !! test
13721 div with empty attribute value, no space before equals
13722 !! options
13723 parsoid=wt2html,html2html
13724 !! wikitext
13725 <div class=>HTML rocks</div>
13726 !! html/php
13727 <div>HTML rocks</div>
13729 !! html/parsoid
13730 <div class="">HTML rocks</div>
13731 !! end
13733 !! test
13734 HTML multiple attributes correction
13735 !! wikitext
13736 <p class="error" class="awesome">Awesome!</p>
13737 !! html
13738 <p class="awesome">Awesome!</p>
13740 !!end
13742 !! test
13743 Table multiple attributes correction
13744 !! wikitext
13746 !+ class="error" class="awesome"| status
13748 !! html
13749 <table>
13750 <tr>
13751 <th class="awesome"> status
13752 </th></tr></table>
13754 !!end
13756 !! test
13757 DIV IN UPPERCASE
13758 !! wikitext
13759 <DIV ID="x">HTML ROCKS</DIV>
13760 !! html
13761 <div id="x">HTML ROCKS</div>
13763 !!end
13765 !! test
13766 Non-ASCII pseudo-tags are rendered as text
13767 !! wikitext
13768 <khyô>
13769 !! html
13770 <p>&lt;khyô&gt;
13771 </p>
13772 !! end
13774 !! test
13775 Pseudo-tag with URL 'name' renders as url link
13776 !! wikitext
13777 <http://example.com/>
13778 !! html
13779 <p>&lt;<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&gt;
13780 </p>
13781 !! end
13783 !! test
13784 text with amp in the middle of nowhere
13785 !! wikitext
13786 Remember AT&T?
13787 !! html
13788 <p>Remember AT&amp;T?
13789 </p>
13790 !! end
13792 !! test
13793 text with character entity: eacute
13794 !! wikitext
13795 I always thought &eacute; was a cute letter.
13796 !! html
13797 <p>I always thought &#233; was a cute letter.
13798 </p>
13799 !! html+tidy
13800 <p>I always thought é was a cute letter.</p>
13801 !! end
13803 !! test
13804 text with entity-escaped character entity-like string: eacute
13805 !! wikitext
13806 I always thought &amp;eacute; was a cute letter.
13807 !! html
13808 <p>I always thought &amp;eacute; was a cute letter.
13809 </p>
13810 !! end
13812 !! test
13813 text with undefined character entity: xacute
13814 !! wikitext
13815 I always thought &xacute; was a cute letter.
13816 !! html
13817 <p>I always thought &amp;xacute; was a cute letter.
13818 </p>
13819 !! end
13821 # TODO: generalize to PHP parser?
13822 !! test
13823 HTML5 tags
13824 !! options
13825 parsoid
13826 !! wikitext
13827 <data value="5">five</data>
13828 <time datetime="2000-01-01T00:00Z">The new millenium started</time>
13829 <mark>This highlighted text</mark>
13830 !! html
13831 <p><data value="5">five</data>
13832 <time datetime="2000-01-01T00:00Z">The new millenium started</time>
13833 <mark>This highlighted text</mark></p>
13834 !! end
13836 !! test
13837 HTML tag with leading space is parsed as text
13838 !! wikitext
13839 < div>foo< /div>
13840 !! html
13841 <p>&lt; div&gt;foo&lt; /div&gt;
13842 </p>
13843 !! end
13846 ### Nesting tests (see bug 41545, 50604, 51081)
13849 # This test case is fixed in Parsoid by domino 1.0.12. (bug 50604)
13850 # Note that html2wt is considerably more difficult if we use <b> in
13851 # the test case, instead of <big>
13852 !! test
13853 Ensure that HTML adoption agency algorithm is properly implemented.
13854 !! wikitext
13855 <big>X<big>Y</big>Z</big>
13856 !! html
13857 <p><big>X<big>Y</big>Z</big>
13858 </p>
13859 !! end
13861 # This was bug 41545 in the PHP parser.
13862 # Note that tidy doesn't handle this correctly.
13863 !! test
13864 Nesting of <kbd>
13865 !! wikitext
13866 <kbd>X<kbd>Y</kbd>Z</kbd>
13867 !! html
13868 <p><kbd>X<kbd>Y</kbd>Z</kbd>
13869 </p>
13870 !! end
13872 # The following cases were bug 51081 in the PHP parser.
13873 # Note that there are some other nestable tags (b, i, etc) which are
13874 # not covered; see bug 51081 for discussion.
13876 # Note that tidy doesn't handle this correctly.
13877 !! test
13878 Nesting of <em>
13879 !! wikitext
13880 <em>X<em>Y</em>Z</em>
13881 !! html
13882 <p><em>X<em>Y</em>Z</em>
13883 </p>
13884 !! end
13886 # Note that tidy doesn't handle this correctly.
13887 !! test
13888 Nesting of <strong>
13889 !! wikitext
13890 <strong>X<strong>Y</strong>Z</strong>
13891 !! html
13892 <p><strong>X<strong>Y</strong>Z</strong>
13893 </p>
13894 !! end
13896 !! test
13897 Nesting of <q>
13898 !! wikitext
13899 <q>X<q>Y</q>Z</q>
13900 !! html+tidy
13901 <p><q>X<q>Y</q>Z</q></p>
13902 !! end
13904 # Note that tidy doesn't handle this correctly.
13905 !! test
13906 Nesting of <ruby>
13907 !! wikitext
13908 <ruby>X<ruby>Y</ruby>Z</ruby>
13909 !! html
13910 <p><ruby>X<ruby>Y</ruby>Z</ruby>
13911 </p>
13912 !! end
13914 # Note that tidy doesn't handle this correctly.
13915 !! test
13916 Nesting of <bdo>
13917 !! wikitext
13918 <bdo>X<bdo>Y</bdo>Z</bdo>
13919 !! html
13920 <p><bdo>X<bdo>Y</bdo>Z</bdo>
13921 </p>
13922 !! end
13926 ### Media links
13929 !! test
13930 Media link
13931 !! wikitext
13932 [[Media:Foobar.jpg]]
13933 !! html
13934 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Media:Foobar.jpg</a>
13935 </p>
13936 !! end
13938 !! test
13939 Media link with text
13940 !! wikitext
13941 [[Media:Foobar.jpg|A neat file to look at]]
13942 !! html
13943 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">A neat file to look at</a>
13944 </p>
13945 !! end
13947 # FIXME: this is still bad HTML tag nesting
13948 !! test
13949 Media link with nasty text
13950 fixme: doBlockLevels won't wrap this in a paragraph because it contains a div
13951 !! wikitext
13952 [[Media:Foobar.jpg|Safe Link<div style=display:none>" onmouseover="alert(document.cookie)" onfoo="</div>]]
13953 !! html
13954 <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>
13956 !! html+tidy
13957 <p><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></p>
13958 !! end
13960 !! test
13961 Media link to nonexistent file (bug 1702)
13962 !! wikitext
13963 [[Media:No such.jpg]]
13964 !! html
13965 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=No_such.jpg" class="new" title="No such.jpg">Media:No such.jpg</a>
13966 </p>
13967 !! end
13969 !! test
13970 Image link to nonexistent file (bug 1850 - good)
13971 !! wikitext
13972 [[File:No_such.jpg]]
13973 !! html/php
13974 <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>
13975 </p>
13976 !! html/parsoid
13977 <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>
13978 !! end
13980 !! test
13981 :Image link to nonexistent file (bug 1850 - bad)
13982 !! wikitext
13983 [[:Image:No such.jpg]]
13984 !! html/php
13985 <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>
13986 </p>
13987 !! html/parsoid
13988 <p><a rel="mw:WikiLink" href="./File:No_such.jpg" title="File:No such.jpg">Image:No such.jpg</a></p>
13989 !! end
13993 !! test
13994 Character reference normalization in link text (bug 1938)
13995 !! wikitext
13996 [[Main Page|this&that]]
13997 !! html
13998 <p><a href="/wiki/Main_Page" title="Main Page">this&amp;that</a>
13999 </p>
14000 !!end
14002 !! article
14003 אַ
14004 !! text
14005 Test for unicode normalization
14007 The page's name is U+05d0 U+05b7, with non-canonical form U+FB2E
14008 !! endarticle
14010 !! test
14011 (bug 19451) Links should refer to the normalized form.
14012 !! wikitext
14013 [[&#xFB2E;]]
14014 [[&#x5d0;&#x5b7;]]
14015 [[&#x5d0;ַ]]
14016 [[א&#x5b7;]]
14017 [[אַ]]
14018 !! html
14019 <p><a href="/wiki/%D7%90%D6%B7" title="אַ">&#xfb2e;</a>
14020 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;&#x5b7;</a>
14021 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;ַ</a>
14022 <a href="/wiki/%D7%90%D6%B7" title="אַ">א&#x5b7;</a>
14023 <a href="/wiki/%D7%90%D6%B7" title="אַ">אַ</a>
14024 </p>
14025 !! end
14027 !! test
14028 Empty attribute crash test (bug 2067)
14029 !! wikitext
14030 <font color="">foo</font>
14031 !! html
14032 <p><font color="">foo</font>
14033 </p>
14034 !! end
14036 !! test
14037 Empty attribute crash test single-quotes (bug 2067)
14038 !! wikitext
14039 <font color=''>foo</font>
14040 !! html
14041 <p><font color="">foo</font>
14042 </p>
14043 !! end
14045 !! test
14046 Attribute test: equals, then nothing
14047 !! wikitext
14048 <font color=>foo</font>
14049 !! html
14050 <p><font>foo</font>
14051 </p>
14052 !! end
14054 !! test
14055 Attribute test: unquoted value
14056 !! wikitext
14057 <font color=x>foo</font>
14058 !! html
14059 <p><font color="x">foo</font>
14060 </p>
14061 !! end
14063 !! test
14064 Attribute test: unquoted but illegal value (hash)
14065 !! wikitext
14066 <font color=#x>foo</font>
14067 !! html
14068 <p><font color="#x">foo</font>
14069 </p>
14070 !! end
14072 !! test
14073 Attribute test: no value
14074 !! wikitext
14075 <font color>foo</font>
14076 !! html
14077 <p><font color="color">foo</font>
14078 </p>
14079 !! end
14081 !! test
14082 Bug 2095: link with three closing brackets
14083 !! wikitext
14084 [[Main Page]]]
14085 !! html/php
14086 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>]
14087 </p>
14088 !! html/parsoid
14089 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">Main Page</a>]</p>
14090 !! end
14092 !! test
14093 Bug 2095: link with pipe and three closing brackets
14094 !! wikitext
14095 [[Main Page|link]]]
14096 !! html/php
14097 <p><a href="/wiki/Main_Page" title="Main Page">link</a>]
14098 </p>
14099 !! html/parsoid
14100 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">link</a>]</p>
14101 !! end
14103 !! test
14104 Bug 2095: link with pipe and three closing brackets, version 2
14105 !! wikitext
14106 [[Main Page|[http://example.com/]]]
14107 !! html/php
14108 <p><a href="/wiki/Main_Page" title="Main Page">[http://example.com/]</a>
14109 </p>
14110 !! html/parsoid
14111 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">[http://example.com/]</a></p>
14112 !! end
14116 ### Safety
14119 !! article
14120 Template:Dangerous attribute
14121 !! text
14122 " onmouseover="alert(document.cookie)
14123 !! endarticle
14125 !! article
14126 Template:Dangerous style attribute
14127 !! text
14128 border-size: expression(alert(document.cookie))
14129 !! endarticle
14131 !! article
14132 Template:Div style
14133 !! text
14134 <div style="float: right; {{{1}}}">Magic div</div>
14135 !! endarticle
14137 !! test
14138 Bug 2304: HTML attribute safety (safe template; regression bug 2309)
14139 !! wikitext
14140 <div title="{{test}}"></div>
14141 !! html
14142 <div title="This is a test template"></div>
14144 !! end
14146 # Parsoid has enough context to handle this case
14147 !! test
14148 Bug 2304: HTML attribute safety (dangerous template; 2309)
14149 !! wikitext
14150 <div title="{{dangerous attribute}}"></div>
14151 !! html/php
14152 <div title=""></div>
14154 !! html/parsoid
14155 <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=\"{&amp;quot;pi&amp;quot;:[[]],&amp;quot;dsr&amp;quot;:[12,35,null,null]}\" data-mw=\"{&amp;quot;parts&amp;quot;:[{&amp;quot;template&amp;quot;:{&amp;quot;target&amp;quot;:{&amp;quot;wt&amp;quot;:&amp;quot;dangerous attribute&amp;quot;,&amp;quot;href&amp;quot;:&amp;quot;./Template:Dangerous_attribute&amp;quot;},&amp;quot;params&amp;quot;:{},&amp;quot;i&amp;quot;:0}}]}\">\" onmouseover=\"alert(document.cookie)&lt;/span>"}]]}'></div>
14156 !! end
14158 !! test
14159 Bug 2304: HTML attribute safety (dangerous style template; 2309)
14160 !! wikitext
14161 <div style="{{dangerous style attribute}}"></div>
14162 !! html
14163 <div style="/* insecure input */"></div>
14165 !! end
14167 !! test
14168 Bug 2304: HTML attribute safety (safe parameter; 2309)
14169 !! wikitext
14170 {{div style|width: 200px}}
14171 !! html
14172 <div style="float: right; width: 200px">Magic div</div>
14174 !! end
14176 !! test
14177 Bug 2304: HTML attribute safety (unsafe parameter; 2309)
14178 !! wikitext
14179 {{div style|width: expression(alert(document.cookie))}}
14180 !! html
14181 <div style="/* insecure input */">Magic div</div>
14183 !! end
14185 !! test
14186 Bug 2304: HTML attribute safety (unsafe breakout parameter; 2309)
14187 !! wikitext
14188 {{div style|"><script>alert(document.cookie)</script>}}
14189 !! html
14190 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
14192 !! end
14194 !! test
14195 Bug 2304: HTML attribute safety (unsafe breakout parameter 2; 2309)
14196 !! wikitext
14197 {{div style|" ><script>alert(document.cookie)</script>}}
14198 !! html
14199 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
14201 !! end
14203 !! test
14204 Bug 2304: HTML attribute safety (link)
14205 !! wikitext
14206 <div title="[[Main Page]]"></div>
14207 !! html
14208 <div title="&#91;&#91;Main Page]]"></div>
14210 !! end
14212 !! test
14213 Bug 2304: HTML attribute safety (italics)
14214 !! wikitext
14215 <div title="''foobar''"></div>
14216 !! html
14217 <div title="&#39;&#39;foobar&#39;&#39;"></div>
14219 !! end
14221 !! test
14222 Bug 2304: HTML attribute safety (bold)
14223 !! wikitext
14224 <div title="'''foobar'''"></div>
14225 !! html
14226 <div title="&#39;&#39;&#39;foobar&#39;&#39;&#39;"></div>
14228 !! end
14231 !! test
14232 Bug 2304: HTML attribute safety (ISBN)
14233 !! wikitext
14234 <div title="ISBN 1234567890"></div>
14235 !! html
14236 <div title="&#73;SBN 1234567890"></div>
14238 !! end
14240 !! test
14241 Bug 2304: HTML attribute safety (RFC)
14242 !! wikitext
14243 <div title="RFC 1234"></div>
14244 !! html
14245 <div title="&#82;FC 1234"></div>
14247 !! end
14249 !! test
14250 Bug 2304: HTML attribute safety (PMID)
14251 !! wikitext
14252 <div title="PMID 1234567890"></div>
14253 !! html
14254 <div title="&#80;MID 1234567890"></div>
14256 !! end
14258 !! test
14259 Bug 2304: HTML attribute safety (web link)
14260 !! wikitext
14261 <div title="http://example.com/"></div>
14262 !! html
14263 <div title="http&#58;//example.com/"></div>
14265 !! end
14267 !! test
14268 Bug 2304: HTML attribute safety (named web link)
14269 !! wikitext
14270 <div title="[http://example.com/ link]"></div>
14271 !! html
14272 <div title="&#91;http&#58;//example.com/ link]"></div>
14274 !! end
14276 !! test
14277 Bug 3244: HTML attribute safety (extension; safe)
14278 !! wikitext
14279 <div style="<nowiki>background:blue</nowiki>"></div>
14280 !! html
14281 <div style="background:blue"></div>
14283 !! end
14285 !! test
14286 Bug 3244: HTML attribute safety (extension; unsafe)
14287 !! wikitext
14288 <div style="<nowiki>border-left:expression(alert(document.cookie))</nowiki>"></div>
14289 !! html
14290 <div style="/* insecure input */"></div>
14292 !! end
14294 # More MSIE fun discovered by Tom Gilder
14296 !! test
14297 MSIE CSS safety test: spurious slash
14298 !! wikitext
14299 <div style="background-image:u\rl(javascript:alert('boo'))">evil</div>
14300 !! html
14301 <div style="/* insecure input */">evil</div>
14303 !! end
14305 !! test
14306 MSIE CSS safety test: hex code
14307 !! wikitext
14308 <div style="background-image:u\72l(javascript:alert('boo'))">evil</div>
14309 !! html
14310 <div style="/* insecure input */">evil</div>
14312 !! end
14314 !! test
14315 MSIE CSS safety test: comment in url
14316 !! wikitext
14317 <div style="background-image:u/**/rl(javascript:alert('boo'))">evil</div>
14318 !! html
14319 <div style="background-image:u rl(javascript:alert(&#39;boo&#39;))">evil</div>
14321 !! end
14323 !! test
14324 MSIE CSS safety test: comment in expression
14325 !! wikitext
14326 <div style="background-image:expres/**/sion(alert('boo4'))">evil4</div>
14327 !! html
14328 <div style="background-image:expres sion(alert(&#39;boo4&#39;))">evil4</div>
14330 !! end
14332 !! test
14333 CSS safety test (all browsers): vertical tab (bug 55332 / CVE-2013-4567)
14334 !! wikitext
14335 <p style="font-size: 100px; background-image:url\b(https://www.google.com/images/srpr/logo6w.png)">A</p>
14336 !! html
14337 <p style="/* invalid control char */">A</p>
14339 !! end
14341 !! test
14342 MSIE 6 CSS safety test: Fullwidth (bug 55332)
14343 !! wikitext
14344 <p style="font-size: 100px; color: expression((title='XSSed'),'red')">A</p>
14345 <div style="top:EXPRESSION(alert())">B</div>
14346 !! html
14347 <p style="/* insecure input */">A</p>
14348 <div style="/* insecure input */">B</div>
14350 !! end
14352 !! test
14353 MSIE 6 CSS safety test: IPA extensions (bug 55332)
14354 !! wikitext
14355 <div style="background-image:uʀʟ(javascript:alert())">A</div>
14356 <p style="font-size: 100px; color: expʀessɪoɴ((title='XSSed'),'red')">B</p>
14357 !! html
14358 <div style="/* insecure input */">A</div>
14359 <p style="/* insecure input */">B</p>
14361 !! end
14363 !! test
14364 MSIE 6 CSS safety test: sup/sub script (bug 55332)
14365 !! wikitext
14366 <div style="background-image:url⁽javascript:alert())">A</div>
14367 <div style="background-image:url₍javascript:alert())">B</div>
14368 <p style="font-size: 100px; color: expressioⁿ((title='XSSed'),'red')">C</p>
14369 !! html
14370 <div style="/* insecure input */">A</div>
14371 <div style="/* insecure input */">B</div>
14372 <p style="/* insecure input */">C</p>
14374 !! end
14376 !! test
14377 Opera -o-link CSS
14378 !! wikitext
14379 <div
14380 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;"
14381 style="-o-link:attr(title);-o-link-source:current">X</div>
14382 !! html
14383 <div title="data:text/html,&lt;img src=1 onerror=alert(1)&gt;" style="/* insecure input */">X</div>
14385 !! end
14387 !! test
14388 MSIE 6 CSS safety test: Repetition markers (bug 55332)
14389 !! wikitext
14390 <p style="font-size: 100px; color: expres〱ion((title='XSSed'),'red')">A</p>
14391 <p style="font-size: 100px; color: expresゝion((title='XSSed'),'red')">B</p>
14392 <p style="font-size: 100px; color: expresーion((title='XSSed'),'red')">C</p>
14393 <p style="font-size: 100px; color: expresヽion((title='XSSed'),'red')">D</p>
14394 <p style="font-size: 100px; color: expresﹽion((title='XSSed'),'red')">E</p>
14395 <p style="font-size: 100px; color: expresﹼion((title='XSSed'),'red')">F</p>
14396 <p style="font-size: 100px; color: expresーion((title='XSSed'),'red')">G</p>
14397 !! html
14398 <p style="/* insecure input */">A</p>
14399 <p style="/* insecure input */">B</p>
14400 <p style="/* insecure input */">C</p>
14401 <p style="/* insecure input */">D</p>
14402 <p style="/* insecure input */">E</p>
14403 <p style="/* insecure input */">F</p>
14404 <p style="/* insecure input */">G</p>
14406 !! end
14408 !! test
14409 Table attribute legitimate extension
14410 !! wikitext
14412 !+ style="<nowiki>color:blue</nowiki>"| status
14414 !! html
14415 <table>
14416 <tr>
14417 <th style="color:blue"> status
14418 </th></tr></table>
14420 !!end
14422 !! test
14423 Table attribute safety
14424 !! wikitext
14426 !+ style="<nowiki>border-width:expression(0+alert(document.cookie))</nowiki>"| status
14428 !! html
14429 <table>
14430 <tr>
14431 <th style="/* insecure input */"> status
14432 </th></tr></table>
14434 !! end
14436 !! test
14437 CSS line continuation 1
14438 !! wikitext
14439 <div style="background-image: u\&#10;rl(test.jpg);"></div>
14440 !! html
14441 <div style="/* insecure input */"></div>
14443 !! end
14445 !! test
14446 CSS line continuation 2
14447 !! wikitext
14448 <div style="background-image: u\&#13;rl(test.jpg); "></div>
14449 !! html
14450 <div style="/* insecure input */"></div>
14452 !! end
14454 !! article
14455 Template:Identity
14456 !! text
14457 {{{1}}}
14458 !! endarticle
14460 !! test
14461 Expansion of multi-line templates in attribute values (bug 6255)
14462 !! wikitext
14463 <div style="background: {{identity|#00FF00}}">-</div>
14464 !! html
14465 <div style="background: #00FF00">-</div>
14467 !! end
14470 !! test
14471 Expansion of multi-line templates in attribute values (bug 6255 sanity check)
14472 !! wikitext
14473 <div style="background: 
14474 #00FF00">-</div>
14475 !! html/php
14476 <div style="background: #00FF00">-</div>
14478 !! html/parsoid
14479 <div style="background: 
14480 #00FF00">-</div>
14481 !! end
14483 !! test
14484 Expansion of multi-line templates in attribute values (bug 6255 sanity check 2)
14485 !! wikitext
14486 <div style="background: &#10;#00FF00">-</div>
14487 !! html
14488 <div style="background: &#10;#00FF00">-</div>
14490 !! end
14492 !! test
14493 evil <math>-wiki-tags without Extension:Math enabled
14494 !! wikitext
14495 <math><img src="some evil external link"><script>some_evil_javascript();</script></math>
14496 !! html+tidy
14497 <p>&lt;math&gt;&lt;img src="some evil external link"&gt;&lt;script&gt;some_evil_javascript();&lt;/script&gt;&lt;/math&gt;</p>
14498 !! end
14501 ### Parser hooks (see tests/parser/parserTestsParserHook.php for the <tag> extension)
14503 !! test
14504 Parser hook: empty input
14505 !! wikitext
14506 <tag></tag>
14507 !! html
14508 <pre>
14510 array (
14512 </pre>
14514 !! end
14516 !! test
14517 Parser hook: empty input using terminated empty elements
14518 !! wikitext
14519 <tag/>
14520 !! html
14521 <pre>
14522 NULL
14523 array (
14525 </pre>
14527 !! end
14529 !! test
14530 Parser hook: empty input using terminated empty elements (space before)
14531 !! wikitext
14532 <tag />
14533 !! html
14534 <pre>
14535 NULL
14536 array (
14538 </pre>
14540 !! end
14542 !! test
14543 Parser hook: basic input
14544 !! wikitext
14545 <tag>input</tag>
14546 !! html
14547 <pre>
14548 'input'
14549 array (
14551 </pre>
14553 !! end
14556 !! test
14557 Parser hook: case insensitive
14558 !! wikitext
14559 <TAG>input</TAG>
14560 !! html
14561 <pre>
14562 'input'
14563 array (
14565 </pre>
14567 !! end
14570 !! test
14571 Parser hook: case insensitive, redux
14572 !! wikitext
14573 <TaG>input</TAg>
14574 !! html
14575 <pre>
14576 'input'
14577 array (
14579 </pre>
14581 !! end
14583 !! test
14584 Parser hook: nested tags
14585 !! options
14586 noxml
14587 !! wikitext
14588 <tag><tag></tag></tag>
14589 !! html
14590 <pre>
14591 '<tag>'
14592 array (
14594 </pre>&lt;/tag&gt;
14596 !! end
14598 !! test
14599 Parser hook: basic arguments
14600 !! wikitext
14601 <tag width=200 height = "100" depth = '50' square></tag>
14602 !! html
14603 <pre>
14605 array (
14606   'width' => '200',
14607   'height' => '100',
14608   'depth' => '50',
14609   'square' => 'square',
14611 </pre>
14613 !! end
14615 !! test
14616 Parser hook: argument containing a forward slash (bug 5344)
14617 !! wikitext
14618 <tag filename='/tmp/bla'></tag>
14619 !! html
14620 <pre>
14622 array (
14623   'filename' => '/tmp/bla',
14625 </pre>
14627 !! end
14629 !! test
14630 Parser hook: empty input using terminated empty elements (bug 2374)
14631 !! wikitext
14632 <tag foo=bar/>text
14633 !! html
14634 <pre>
14635 NULL
14636 array (
14637   'foo' => 'bar',
14639 </pre>text
14641 !! end
14643 # </tag> should be output literally since there is no matching tag that begins it
14644 !! test
14645 Parser hook: basic arguments using terminated empty elements (bug 2374)
14646 !! wikitext
14647 <tag width=200 height = "100" depth = '50' square/>
14648 other stuff
14649 </tag>
14650 !! html
14651 <pre>
14652 NULL
14653 array (
14654   'width' => '200',
14655   'height' => '100',
14656   'depth' => '50',
14657   'square' => 'square',
14659 </pre>
14660 <p>other stuff
14661 &lt;/tag&gt;
14662 </p>
14663 !! end
14666 ### (see tests/parser/parserTestsParserHook.php for the <statictag> extension)
14669 !! test
14670 Parser hook: static parser hook not inside a comment
14671 !! wikitext
14672 <statictag>hello, world</statictag>
14673 <statictag action=flush/>
14674 !! html
14675 <p>hello, world
14676 </p>
14677 !! end
14680 !! test
14681 Parser hook: static parser hook inside a comment
14682 !! wikitext
14683 <!-- <statictag>hello, world</statictag> -->
14684 <statictag action=flush/>
14685 !! html
14686 <p><br />
14687 </p>
14688 !! end
14690 # Nested template calls; this case was broken by Parser.php rev 1.506,
14691 # since reverted.
14693 !! article
14694 Template:One-parameter
14695 !! text
14696 (My parameter is: {{{1}}})
14697 !! endarticle
14699 !! article
14700 Template:Map-one-parameter
14701 !! text
14702 {{{{{1}}}|{{{2}}}}}
14703 !! endarticle
14705 !! test
14706 Nested template calls
14707 !! wikitext
14708 {{Map-one-parameter|One-parameter|param}}
14709 !! html
14710 <p>(My parameter is: param)
14711 </p>
14712 !! end
14716 ### Sanitizer
14719 # HTML+Tidy effectively strips out the empty tags completely
14720 # But since Parsoid doesn't it wraps the <s></s> tags in p-tags
14721 # which Tidy would have done for the PHP parser had there been content inside it.
14722 !! test
14723 Sanitizer: Closing of open tags
14724 !! wikitext
14725 <s></s><table></table>
14726 !! html
14727 <s></s><table></table>
14729 !! html/parsoid
14730 <p><s></s></p><table></table>
14731 !! end
14733 !! test
14734 Sanitizer: Closing of open but not closed tags
14735 !! wikitext
14736 <s>foo
14737 !! html
14738 <p><s>foo</s>
14739 </p>
14740 !! end
14742 !! test
14743 Sanitizer: Closing of closed but not open tags
14744 !! wikitext
14745 </s>
14746 !! html
14747 <p>&lt;/s&gt;
14748 </p>
14749 !! end
14751 !! test
14752 Sanitizer: Closing of closed but not open table tags
14753 !! wikitext
14754 Table not started</td></tr></table>
14755 !! html
14756 <p>Table not started&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
14757 </p>
14758 !! end
14760 !! test
14761 Sanitizer: Escaping of spaces, multibyte characters, colons & other stuff in id=""
14762 !! wikitext
14763 <span id="æ: v">byte</span>[[#æ: v|backlink]]
14764 !! html
14765 <p><span id=".C3.A6:_v">byte</span><a href="#.C3.A6:_v">backlink</a>
14766 </p>
14767 !! end
14769 # In HTML5, the restrictions are that id must contain at least one character,
14770 # and must not contain any space characters.
14771 !! test
14772 Sanitizer: Validating the contents of the id attribute (bug 4515)
14773 !! options
14774 disabled
14775 !! wikitext
14776 <br id="" /><br id="a space" />
14777 !! html
14778 Something ...
14779 !! end
14781 # In HTML5, id must be unique amongst all the ids in the element's home subtree.
14782 !! test
14783 Sanitizer: Validating id attribute uniqueness (bug 4515, bug 6301)
14784 !! options
14785 disabled
14786 !! wikitext
14787 <br id="foo" /><br id="foo" />
14788 !! html
14789 Something need to be done. foo-2 ? 
14790 !! end
14792 !! test
14793 Sanitizer: Validating that <meta> and <link> work, but only for Microdata
14794 !! wikitext
14795 <div itemscope>
14796         <meta itemprop="hello" content="world">
14797         <meta http-equiv="refresh" content="5">
14798         <meta itemprop="hello" http-equiv="refresh" content="5">
14799         <link itemprop="hello" href="{{SERVER}}">
14800         <link rel="stylesheet" href="{{SERVER}}">
14801         <link rel="stylesheet" itemprop="hello" href="{{SERVER}}">
14802 </div>
14803 !! html
14804 <div itemscope="itemscope">
14805 <p>     <meta itemprop="hello" content="world" />
14806         &lt;meta http-equiv="refresh" content="5"&gt;
14807         <meta itemprop="hello" content="5" />
14808 </p>
14809         <link itemprop="hello" href="http&#58;//example.org" />
14810         &lt;link rel="stylesheet" href="<a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>"&gt;
14811         <link itemprop="hello" href="http&#58;//example.org" />
14812 </div>
14814 !! end
14816 !! test
14817 Language converter: output gets cut off unexpectedly (bug 5757)
14818 !! options
14819 language=zh
14820 !! wikitext
14821 this bit is safe: }-
14823 but if we add a conversion instance: -{zh-cn:xxx;zh-tw:yyy}-
14825 then we get cut off here: }-
14827 all additional text is vanished
14828 !! html
14829 <p>this bit is safe: }-
14830 </p><p>but if we add a conversion instance: xxx
14831 </p><p>then we get cut off here: }-
14832 </p><p>all additional text is vanished
14833 </p>
14834 !! end
14836 !! test
14837 Self closed html pairs (bug 5487)
14838 !! options
14839 !! wikitext
14840 <center><font id="bug" />Centered text</center>
14841 <div><font id="bug2" />In div text</div>
14842 !! html
14843 <center>&lt;font id="bug" /&gt;Centered text</center>
14844 <div>&lt;font id="bug2" /&gt;In div text</div>
14846 !! end
14852 !! test
14853 Punctuation: nbsp before exclamation
14854 !! wikitext
14855 C'est grave !
14856 !! html
14857 <p>C'est grave&#160;!
14858 </p>
14859 !! end
14861 !! test
14862 Punctuation: CSS !important (bug 11874)
14863 !! wikitext
14864 <div style="width:50% !important">important</div>
14865 !! html
14866 <div style="width:50% !important">important</div>
14868 !!end
14870 !! test
14871 Punctuation: CSS ! important (bug 11874; with space after)
14872 !! wikitext
14873 <div style="width:50% ! important">important</div>
14874 !! html
14875 <div style="width:50% ! important">important</div>
14877 !!end
14880 !! test
14881 HTML bullet list, closed tags (bug 5497)
14882 !! wikitext
14883 <ul>
14884 <li>One</li>
14885 <li>Two</li>
14886 </ul>
14887 !! html/php
14888 <ul>
14889 <li>One</li>
14890 <li>Two</li>
14891 </ul>
14893 !! html/parsoid
14894 <ul data-parsoid='{"stx":"html"}'>
14895 <li data-parsoid='{"stx":"html"}'>One</li>
14896 <li data-parsoid='{"stx":"html"}'>Two</li>
14897 </ul>
14899 !! end
14901 !! test
14902 HTML bullet list, unclosed tags (bug 5497)
14903 !! wikitext
14904 <ul>
14905 <li>One
14906 <li>Two
14907 </ul>
14908 !! html/php+tidy
14909 <ul>
14910 <li>One</li>
14911 <li>Two</li>
14912 </ul>
14913 !! html/parsoid
14914 <ul data-parsoid='{"stx":"html"}'>
14915 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>One</li>
14916 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>Two</li>
14917 </ul>
14919 !! end
14921 !! test
14922 HTML ordered list, closed tags (bug 5497)
14923 !! wikitext
14924 <ol>
14925 <li>One</li>
14926 <li>Two</li>
14927 </ol>
14928 !! html/php
14929 <ol>
14930 <li>One</li>
14931 <li>Two</li>
14932 </ol>
14934 !! html/parsoid
14935 <ol data-parsoid='{"stx":"html"}'>
14936 <li data-parsoid='{"stx":"html"}'>One</li>
14937 <li data-parsoid='{"stx":"html"}'>Two</li>
14938 </ol>
14940 !! end
14942 !! test
14943 HTML ordered list, unclosed tags (bug 5497)
14944 !! options
14945 !! wikitext
14946 <ol>
14947 <li>One
14948 <li>Two
14949 </ol>
14950 !! html/php+tidy
14951 <ol>
14952 <li>One</li>
14953 <li>Two</li>
14954 </ol>
14955 !! html/parsoid
14956 <ol data-parsoid='{"stx":"html"}'>
14957 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>One</li>
14958 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>Two</li>
14959 </ol>
14961 !! end
14963 !! test
14964 HTML nested bullet list, closed tags (bug 5497)
14965 !! wikitext
14966 <ul>
14967 <li>One</li>
14968 <li>Two:
14969 <ul>
14970 <li>Sub-one</li>
14971 <li>Sub-two</li>
14972 </ul>
14973 </li>
14974 </ul>
14975 !! html
14976 <ul>
14977 <li>One</li>
14978 <li>Two:
14979 <ul>
14980 <li>Sub-one</li>
14981 <li>Sub-two</li>
14982 </ul>
14983 </li>
14984 </ul>
14986 !! end
14988 !! test
14989 HTML nested bullet list, open tags (bug 5497)
14990 !! wikitext
14991 <ul>
14992 <li>One
14993 <li>Two:
14994 <ul>
14995 <li>Sub-one
14996 <li>Sub-two
14997 </ul>
14998 </ul>
14999 !! html/php+tidy
15000 <ul>
15001 <li>One</li>
15002 <li>Two:
15003 <ul>
15004 <li>Sub-one</li>
15005 <li>Sub-two</li>
15006 </ul>
15007 </li>
15008 </ul>
15009 !! html/parsoid
15010 <ul>
15011 <li>One
15012 </li>
15013 <li>Two:
15014 <ul>
15015 <li>Sub-one
15016 </li>
15017 <li>Sub-two
15018 </li>
15019 </ul>
15020 </li>
15021 </ul>
15023 !! end
15025 !! test
15026 HTML nested ordered list, closed tags (bug 5497)
15027 !! wikitext
15028 <ol>
15029 <li>One</li>
15030 <li>Two:
15031 <ol>
15032 <li>Sub-one</li>
15033 <li>Sub-two</li>
15034 </ol>
15035 </li>
15036 </ol>
15037 !! html
15038 <ol>
15039 <li>One</li>
15040 <li>Two:
15041 <ol>
15042 <li>Sub-one</li>
15043 <li>Sub-two</li>
15044 </ol>
15045 </li>
15046 </ol>
15048 !! end
15050 !! test
15051 HTML nested ordered list, open tags (bug 5497)
15052 !! wikitext
15053 <ol>
15054 <li>One
15055 <li>Two:
15056 <ol>
15057 <li>Sub-one
15058 <li>Sub-two
15059 </ol>
15060 </ol>
15061 !! html/php
15062 <ol>
15063 <li>One
15064 <li>Two:
15065 <ol>
15066 <li>Sub-one
15067 <li>Sub-two
15068 </ol>
15069 </ol>
15071 !! html/parsoid
15072 <ol>
15073 <li>One
15074 </li>
15075 <li>Two:
15076 <ol>
15077 <li>Sub-one
15078 </li>
15079 <li>Sub-two
15080 </li>
15081 </ol>
15082 </li>
15083 </ol>
15085 !! end
15087 !! test
15088 HTML ordered list item with parameters oddity
15089 !! wikitext
15090 <ol><li id="fragment">One</li>
15091 </ol>
15092 !! html
15093 <ol><li id="fragment">One</li>
15094 </ol>
15096 !! end
15098 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
15099 !!test
15100 bug 5918: autonumbering
15101 !! wikitext
15102 [http://first/] [http://second] [ftp://ftp]
15104 ftp://inlineftp
15106 [mailto:enclosed@mail.tld With target]
15108 [mailto:enclosed@mail.tld]
15110 mailto:inline@mail.tld
15111 !! html/php
15112 <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>
15113 </p><p><a rel="nofollow" class="external free" href="ftp://inlineftp">ftp://inlineftp</a>
15114 </p><p><a rel="nofollow" class="external text" href="mailto:enclosed@mail.tld">With target</a>
15115 </p><p><a rel="nofollow" class="external autonumber" href="mailto:enclosed@mail.tld">[4]</a>
15116 </p><p><a rel="nofollow" class="external free" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a>
15117 </p>
15118 !! html/parsoid
15119 <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>
15120 <p><a rel="mw:ExtLink" href="ftp://inlineftp">ftp://inlineftp</a></p>
15121 <p><a rel="mw:ExtLink" href="mailto:enclosed@mail.tld">With target</a></p>
15122 <p><a rel="mw:ExtLink" href="mailto:enclosed@mail.tld"></a></p>
15123 <p><a rel="mw:ExtLink" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a></p>
15124 !! end
15128 # Security and HTML correctness
15129 # From Nick Jenkins' fuzz testing
15132 !! test
15133 Fuzz testing: Parser13
15134 !! wikitext
15135 {| 
15136 | http://a|
15137 !! html
15138 <table>
15139 <tr>
15140 <td>
15141 </td>
15142 </tr>
15143 </table>
15145 !! end
15147 !! test
15148 Fuzz testing: Parser14
15149 !! wikitext
15150 == onmouseover= ==
15151 http://__TOC__
15152 !! html
15153 <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>
15154 http://<div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15155 <ul>
15156 <li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
15157 </ul>
15158 </div>
15161 !! html+tidy
15162 <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>
15163 <p>http://</p>
15164 <div id="toc" class="toc">
15165 <div id="toctitle">
15166 <h2>Contents</h2>
15167 </div>
15168 <ul>
15169 <li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
15170 </ul>
15171 </div>
15172 !! end
15174 !! test
15175 Fuzz testing: Parser14-table
15176 !! wikitext
15177 ==a==
15178 {| STYLE=__TOC__
15179 !! html
15180 <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>
15181 <table style="&#95;_TOC&#95;_">
15182 <tr><td></td></tr>
15183 </table>
15185 !! html+tidy
15186 <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>
15187 <table style="__TOC__">
15188 <tr>
15189 <td></td>
15190 </tr>
15191 </table>
15192 !! end
15194 # Known to produce bogus xml (extra </td>)
15195 !! test
15196 Fuzz testing: Parser16
15197 !! options
15198 noxml
15199 !! wikitext
15201 !https://||||||
15202 !! html
15203 <table>
15204 <tr>
15205 <th>https://</th>
15206 <th></th>
15207 <th></th>
15208 <th>
15209 </td>
15210 </tr>
15211 </table>
15213 !! html+tidy
15214 <table>
15215 <tr>
15216 <th>https://</th>
15217 <th></th>
15218 <th></th>
15219 <th></th>
15220 </tr>
15221 </table>
15222 !! end
15224 !! test
15225 Fuzz testing: Parser21
15226 !! wikitext
15228 ! irc://{{ftp://a" onmouseover="alert('hello world');"
15230 !! html
15231 <table>
15232 <tr>
15233 <th> <a rel="nofollow" class="external free" href="irc://{{ftp://a">irc://{{ftp://a</a>" onmouseover="alert('hello world');"
15234 </th>
15235 <td>
15236 </td>
15237 </tr>
15238 </table>
15240 !! end
15242 !! test
15243 Fuzz testing: Parser22
15244 !! wikitext
15245 http://===r:::https://b
15248 !! html
15249 <p><a rel="nofollow" class="external free" href="http://===r:::https://b">http://===r:::https://b</a>
15250 </p>
15251 <table>
15252 <tr><td></td></tr>
15253 </table>
15255 !! end
15257 # Known to produce bad XML for now
15258 !! test
15259 Fuzz testing: Parser24
15260 !! options
15261 noxml
15262 !! wikitext
15264 {{{|
15265 <u CLASS=
15266 | {{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx--><noinclude>}}}} >
15267 <br style="onmouseover='alert(document.cookie);' " />
15269 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
15271 !! html
15272 <table>
15273 {{{|
15274 <u class="&#124;">}}}} &gt;
15275 <br style="onmouseover=&#39;alert(document.cookie);&#39;" />
15277 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
15278 <tr>
15279 <td></u>
15280 </td>
15281 </tr>
15282 </table>
15284 !! end
15286 # Note: the current result listed for this is not what the original one was,
15287 # but the original bug was JavaScript injection, which is fixed in any case.
15288 # It's not clear that the original result listed was any more correct than the
15289 # current one.  Original result:
15290 # <p>{{{| 
15291 # </p>
15292 # <li class="&#124;&#124;">
15293 # }}}blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
15294 !!test
15295 Fuzz testing: Parser25 (bug 6055)
15296 !! wikitext
15299 <LI CLASS=||
15301 }}}blah" onmouseover="alert('hello world');" align="left"'''MOVE MOUSE CURSOR OVER HERE
15302 !! html
15303 <p>&lt;LI CLASS=blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
15304 </p>
15305 !! end
15307 !!test
15308 Fuzz testing: URL adjacent extension (with space, clean)
15309 !! wikitext
15310 http://example.com <nowiki>junk</nowiki>
15311 !! html
15312 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a> junk
15313 </p>
15314 !!end
15316 !!test
15317 Fuzz testing: URL adjacent extension (no space, dirty; nowiki)
15318 !! wikitext
15319 http://example.com<nowiki>junk</nowiki>
15320 !! html
15321 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>junk
15322 </p>
15323 !!end
15325 !!test
15326 Fuzz testing: URL adjacent extension (no space, dirty; pre)
15327 !! wikitext
15328 http://example.com<pre>junk</pre>
15329 !! html
15330 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a><pre>junk</pre>
15332 !! html+tidy
15333 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a></p>
15334 <pre>
15335 junk
15336 </pre>
15337 !!end
15339 !!test
15340 Fuzz testing: image with bogus manual thumbnail
15341 !! wikitext
15342 [[Image:foobar.jpg|thumbnail= ]]
15343 !! html/php
15344 <div class="thumb tright"><div class="thumbinner" style="width:182px;">Error creating thumbnail:   <div class="thumbcaption"></div></div></div>
15346 !! html/parsoid
15347 <figure class="mw-default-size" typeof="mw:Error mw:Image/Thumb" data-parsoid='{"optList":[{"ck":"manualthumb","ak":"thumbnail= "}],"dsr":[0,32,2,2]}' 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":{},"dsr":[2,30,null,null]}'><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>
15348 !!end
15350 !! test
15351 Fuzz testing: encoded newline in generated HTML replacements (bug 6577)
15352 !! wikitext
15353 <pre dir="&#10;"></pre>
15354 !! html
15355 <pre dir="&#10;"></pre>
15357 !! end
15359 !! test
15360 Parsing optional HTML elements (Bug 6171)
15361 !! options
15362 !! wikitext
15363 <table>
15364   <tr>
15365     <td> Some tabular data</td>
15366     <td> More tabular data ...
15367     <td> And yet som tabular data</td>
15368   </tr>
15369 </table>
15370 !! html
15371 <table>
15372   <tr>
15373     <td> Some tabular data</td>
15374     <td> More tabular data ...
15375     </td><td> And yet som tabular data</td>
15376   </tr>
15377 </table>
15379 !! end
15381 !! test
15382 Correct handling of <td>, <tr> (Bug 6171)
15383 !! options
15384 !! wikitext
15385 <table>
15386   <tr>
15387     <td> Some tabular data</td>
15388     <td> More tabular data ...</td>
15389     <td> And yet som tabular data</td>
15390   </tr>
15391 </table>
15392 !! html
15393 <table>
15394   <tr>
15395     <td> Some tabular data</td>
15396     <td> More tabular data ...</td>
15397     <td> And yet som tabular data</td>
15398   </tr>
15399 </table>
15401 !! end
15404 !! test
15405 Parsing crashing regression (fr:JavaScript)
15406 !! wikitext
15407 </body></x>
15408 !! html
15409 <p>&lt;/body&gt;&lt;/x&gt;
15410 </p>
15411 !! end
15413 !! test
15414 Inline wiki vs wiki block nesting
15415 !! wikitext
15416 '''Bold paragraph
15418 New wiki paragraph
15419 !! html
15420 <p><b>Bold paragraph</b>
15421 </p><p>New wiki paragraph
15422 </p>
15423 !! end
15425 # FIXME: The current php output is documented
15426 # and desired output is the parsoid target.
15427 !! test
15428 Inline HTML vs wiki block nesting
15429 !! wikitext
15430 <b>Bold paragraph
15432 New wiki paragraph
15433 !! html/php
15434 <p><b>Bold paragraph
15435 </p><p>New wiki paragraph</b>
15436 </p>
15437 !! html/parsoid
15438 <p><b>Bold paragraph</b>
15439 </p><p>New wiki paragraph
15440 </p>
15441 !! end
15443 # Original result was this:
15444 # <p><b>bold</b><b>bold<i>bolditalics</i></b>
15445 # </p>
15446 # While that might be marginally more intuitive, maybe, the six-apostrophe
15447 # construct is clearly pathological and the result stated here (which is what
15448 # the parser actually does) is about as reasonable as anything.
15449 !!test
15450 Mixing markup for italics and bold
15451 !! options
15452 !! wikitext
15453 '''bold''''''bold''bolditalics'''''
15454 !! html
15455 <p>'<i>bold'</i><b>bold<i>bolditalics</i></b>
15456 </p>
15457 !! end
15460 !! article
15461 Xyzzyx
15462 !! text
15463 Article for special page transclusion test
15464 !! endarticle
15466 !! test
15467 Special page transclusion
15468 !! options
15469 !! wikitext
15470 {{Special:Prefixindex/Xyzzyx}}
15471 !! html
15472 <table class="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
15474 !! end
15476 !! test
15477 Special page transclusion twice (bug 5021)
15478 !! options
15479 !! wikitext
15480 {{Special:Prefixindex/Xyzzyx}}
15481 {{Special:Prefixindex/Xyzzyx}}
15482 !! html
15483 <table class="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
15484 <table class="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
15486 !! end
15488 !! test
15489 Transclusion of default MediaWiki message
15490 !! wikitext
15491 {{MediaWiki:Mainpage}}
15492 !! html
15493 <p>Main Page
15494 </p>
15495 !! end
15497 !! test
15498 Transclusion of nonexistent MediaWiki message
15499 !! wikitext
15500 {{MediaWiki:Mainpagexxx}}
15501 !! html
15502 <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>
15503 </p>
15504 !! end
15506 !! test
15507 Transclusion of MediaWiki message with underscore
15508 !! wikitext
15509 {{MediaWiki:history_short}}
15510 !! html
15511 <p>History
15512 </p>
15513 !! end
15515 !! test
15516 Transclusion of MediaWiki message with space
15517 !! wikitext
15518 {{MediaWiki:history short}}
15519 !! html
15520 <p>History
15521 </p>
15522 !! end
15524 !! test
15525 Invalid header with following text
15526 !! wikitext
15527 = x = y
15528 !! html
15529 <p>= x = y
15530 </p>
15531 !! end
15534 !! test
15535 Section extraction test (section 0)
15536 !! options
15537 section=0
15538 !! wikitext
15539 start
15540 ==a==
15541 ===aa===
15542 ====aaa====
15543 ==b==
15544 ===ba===
15545 ===bb===
15546 ====bba====
15547 ===bc===
15548 ==c==
15549 ===ca===
15550 !! html
15551 start
15552 !! end
15554 !! test
15555 Section extraction test (section 1)
15556 !! options
15557 section=1
15558 !! wikitext
15559 start
15560 ==a==
15561 ===aa===
15562 ====aaa====
15563 ==b==
15564 ===ba===
15565 ===bb===
15566 ====bba====
15567 ===bc===
15568 ==c==
15569 ===ca===
15570 !! html
15571 ==a==
15572 ===aa===
15573 ====aaa====
15574 !! end
15576 !! test
15577 Section extraction test (section 2)
15578 !! options
15579 section=2
15580 !! wikitext
15581 start
15582 ==a==
15583 ===aa===
15584 ====aaa====
15585 ==b==
15586 ===ba===
15587 ===bb===
15588 ====bba====
15589 ===bc===
15590 ==c==
15591 ===ca===
15592 !! html
15593 ===aa===
15594 ====aaa====
15595 !! end
15597 !! test
15598 Section extraction test (section 3)
15599 !! options
15600 section=3
15601 !! wikitext
15602 start
15603 ==a==
15604 ===aa===
15605 ====aaa====
15606 ==b==
15607 ===ba===
15608 ===bb===
15609 ====bba====
15610 ===bc===
15611 ==c==
15612 ===ca===
15613 !! html
15614 ====aaa====
15615 !! end
15617 !! test
15618 Section extraction test (section 4)
15619 !! options
15620 section=4
15621 !! wikitext
15622 start
15623 ==a==
15624 ===aa===
15625 ====aaa====
15626 ==b==
15627 ===ba===
15628 ===bb===
15629 ====bba====
15630 ===bc===
15631 ==c==
15632 ===ca===
15633 !! html
15634 ==b==
15635 ===ba===
15636 ===bb===
15637 ====bba====
15638 ===bc===
15639 !! end
15641 !! test
15642 Section extraction test (section 5)
15643 !! options
15644 section=5
15645 !! wikitext
15646 start
15647 ==a==
15648 ===aa===
15649 ====aaa====
15650 ==b==
15651 ===ba===
15652 ===bb===
15653 ====bba====
15654 ===bc===
15655 ==c==
15656 ===ca===
15657 !! html
15658 ===ba===
15659 !! end
15661 !! test
15662 Section extraction test (section 6)
15663 !! options
15664 section=6
15665 !! wikitext
15666 start
15667 ==a==
15668 ===aa===
15669 ====aaa====
15670 ==b==
15671 ===ba===
15672 ===bb===
15673 ====bba====
15674 ===bc===
15675 ==c==
15676 ===ca===
15677 !! html
15678 ===bb===
15679 ====bba====
15680 !! end
15682 !! test
15683 Section extraction test (section 7)
15684 !! options
15685 section=7
15686 !! wikitext
15687 start
15688 ==a==
15689 ===aa===
15690 ====aaa====
15691 ==b==
15692 ===ba===
15693 ===bb===
15694 ====bba====
15695 ===bc===
15696 ==c==
15697 ===ca===
15698 !! html
15699 ====bba====
15700 !! end
15702 !! test
15703 Section extraction test (section 8)
15704 !! options
15705 section=8
15706 !! wikitext
15707 start
15708 ==a==
15709 ===aa===
15710 ====aaa====
15711 ==b==
15712 ===ba===
15713 ===bb===
15714 ====bba====
15715 ===bc===
15716 ==c==
15717 ===ca===
15718 !! html
15719 ===bc===
15720 !! end
15722 !! test
15723 Section extraction test (section 9)
15724 !! options
15725 section=9
15726 !! wikitext
15727 start
15728 ==a==
15729 ===aa===
15730 ====aaa====
15731 ==b==
15732 ===ba===
15733 ===bb===
15734 ====bba====
15735 ===bc===
15736 ==c==
15737 ===ca===
15738 !! html
15739 ==c==
15740 ===ca===
15741 !! end
15743 !! test
15744 Section extraction test (section 10)
15745 !! options
15746 section=10
15747 !! wikitext
15748 start
15749 ==a==
15750 ===aa===
15751 ====aaa====
15752 ==b==
15753 ===ba===
15754 ===bb===
15755 ====bba====
15756 ===bc===
15757 ==c==
15758 ===ca===
15759 !! html
15760 ===ca===
15761 !! end
15763 !! test
15764 Section extraction test (nonexistent section 11)
15765 !! options
15766 section=11
15767 !! wikitext
15768 start
15769 ==a==
15770 ===aa===
15771 ====aaa====
15772 ==b==
15773 ===ba===
15774 ===bb===
15775 ====bba====
15776 ===bc===
15777 ==c==
15778 ===ca===
15779 !! html
15780 !! end
15782 !! test
15783 Section extraction test with bogus heading (section 1)
15784 !! options
15785 section=1
15786 !! wikitext
15787 ==a==
15788 ==bogus== not a legal section
15789 ==b==
15790 !! html
15791 ==a==
15792 ==bogus== not a legal section
15793 !! end
15795 !! test
15796 Section extraction test with bogus heading (section 2)
15797 !! options
15798 section=2
15799 !! wikitext
15800 ==a==
15801 ==bogus== not a legal section
15802 ==b==
15803 !! html
15804 ==b==
15805 !! end
15807 !! test
15808 Section extraction test with comment after heading (section 1)
15809 !! options
15810 section=1
15811 !! wikitext
15812 ==a==
15813 ==b== <!-- -->
15814 ==c==
15815 !! html
15816 ==a==
15817 !! end
15819 !! test
15820 Section extraction test with comment after heading (section 2)
15821 !! options
15822 section=2
15823 !! wikitext
15824 ==a==
15825 ==b== <!-- -->
15826 ==c==
15827 !! html
15828 ==b== <!-- -->
15829 !! end
15831 !! test
15832 Section extraction test with bogus <nowiki> heading (section 1)
15833 !! options
15834 section=1
15835 !! wikitext
15836 ==a==
15837 ==bogus== <nowiki>not a legal section</nowiki>
15838 ==b==
15839 !! html
15840 ==a==
15841 ==bogus== <nowiki>not a legal section</nowiki>
15842 !! end
15844 !! test
15845 Section extraction test with bogus <nowiki> heading (section 2)
15846 !! options
15847 section=2
15848 !! wikitext
15849 ==a==
15850 ==bogus== <nowiki>not a legal section</nowiki>
15851 ==b==
15852 !! html
15853 ==b==
15854 !! end
15857 # Formerly testing for bug 2587, now resolved by the use of unmarked sections
15858 # instead of respecting commented sections
15859 !! test
15860 Section extraction prefixed by comment (section 1)
15861 !! options
15862 section=1
15863 !! wikitext
15864 <!-- -->==sec1==
15865 ==sec2==
15866 !! html
15867 ==sec2==
15868 !!end
15870 !! test
15871 Section extraction prefixed by comment (section 2)
15872 !! options
15873 section=2
15874 !! wikitext
15875 <!-- -->==sec1==
15876 ==sec2==
15877 !! html
15879 !!end
15882 # Formerly testing for bug 2607, now resolved by the use of unmarked sections
15883 # instead of respecting HTML-style headings
15884 !! test
15885 Section extraction, mixed wiki and html (section 1)
15886 !! options
15887 section=1
15888 !! wikitext
15889 <h2>unmarked</h2>
15890 unmarked
15891 ==1==
15893 ==2==
15895 !! html
15896 ==1==
15898 !! end
15900 !! test
15901 Section extraction, mixed wiki and html (section 2)
15902 !! options
15903 section=2
15904 !! wikitext
15905 <h2>unmarked</h2>
15906 unmarked
15907 ==1==
15909 ==2==
15911 !! html
15912 ==2==
15914 !! end
15917 # Formerly testing for bug 3342
15918 !! test
15919 Section extraction, heading surrounded by <noinclude>
15920 !! options
15921 section=1
15922 !! wikitext
15923 <noinclude>==unmarked==</noinclude>
15924 ==marked==
15925 !! html
15926 ==marked==
15927 !!end
15929 # Test behavior of bug 19910
15930 !! test
15931 Sectiion with all-equals
15932 !! options
15933 section=2
15934 !! wikitext
15935 === 
15936 The line above must have a trailing space
15937 === <!--
15938 --> <!-- -->
15939 But just in case it doesn't...
15940 !! html
15941 === <!--
15942 --> <!-- -->
15943 But just in case it doesn't...
15944 !! end
15946 !! test
15947 Section replacement test (section 0)
15948 !! options
15949 replace=0,"xxx"
15950 !! wikitext
15951 start
15952 ==a==
15953 ===aa===
15954 ====aaa====
15955 ==b==
15956 ===ba===
15957 ===bb===
15958 ====bba====
15959 ===bc===
15960 ==c==
15961 ===ca===
15962 !! html
15965 ==a==
15966 ===aa===
15967 ====aaa====
15968 ==b==
15969 ===ba===
15970 ===bb===
15971 ====bba====
15972 ===bc===
15973 ==c==
15974 ===ca===
15975 !! end
15977 !! test
15978 Section replacement test (section 1)
15979 !! options
15980 replace=1,"xxx"
15981 !! wikitext
15982 start
15983 ==a==
15984 ===aa===
15985 ====aaa====
15986 ==b==
15987 ===ba===
15988 ===bb===
15989 ====bba====
15990 ===bc===
15991 ==c==
15992 ===ca===
15993 !! html
15994 start
15997 ==b==
15998 ===ba===
15999 ===bb===
16000 ====bba====
16001 ===bc===
16002 ==c==
16003 ===ca===
16004 !! end
16006 !! test
16007 Section replacement test (section 2)
16008 !! options
16009 replace=2,"xxx"
16010 !! wikitext
16011 start
16012 ==a==
16013 ===aa===
16014 ====aaa====
16015 ==b==
16016 ===ba===
16017 ===bb===
16018 ====bba====
16019 ===bc===
16020 ==c==
16021 ===ca===
16022 !! html
16023 start
16024 ==a==
16027 ==b==
16028 ===ba===
16029 ===bb===
16030 ====bba====
16031 ===bc===
16032 ==c==
16033 ===ca===
16034 !! end
16036 !! test
16037 Section replacement test (section 3)
16038 !! options
16039 replace=3,"xxx"
16040 !! wikitext
16041 start
16042 ==a==
16043 ===aa===
16044 ====aaa====
16045 ==b==
16046 ===ba===
16047 ===bb===
16048 ====bba====
16049 ===bc===
16050 ==c==
16051 ===ca===
16052 !! html
16053 start
16054 ==a==
16055 ===aa===
16058 ==b==
16059 ===ba===
16060 ===bb===
16061 ====bba====
16062 ===bc===
16063 ==c==
16064 ===ca===
16065 !! end
16067 !! test
16068 Section replacement test (section 4)
16069 !! options
16070 replace=4,"xxx"
16071 !! wikitext
16072 start
16073 ==a==
16074 ===aa===
16075 ====aaa====
16076 ==b==
16077 ===ba===
16078 ===bb===
16079 ====bba====
16080 ===bc===
16081 ==c==
16082 ===ca===
16083 !! html
16084 start
16085 ==a==
16086 ===aa===
16087 ====aaa====
16090 ==c==
16091 ===ca===
16092 !! end
16094 !! test
16095 Section replacement test (section 5)
16096 !! options
16097 replace=5,"xxx"
16098 !! wikitext
16099 start
16100 ==a==
16101 ===aa===
16102 ====aaa====
16103 ==b==
16104 ===ba===
16105 ===bb===
16106 ====bba====
16107 ===bc===
16108 ==c==
16109 ===ca===
16110 !! html
16111 start
16112 ==a==
16113 ===aa===
16114 ====aaa====
16115 ==b==
16118 ===bb===
16119 ====bba====
16120 ===bc===
16121 ==c==
16122 ===ca===
16123 !! end
16125 !! test
16126 Section replacement test (section 6)
16127 !! options
16128 replace=6,"xxx"
16129 !! wikitext
16130 start
16131 ==a==
16132 ===aa===
16133 ====aaa====
16134 ==b==
16135 ===ba===
16136 ===bb===
16137 ====bba====
16138 ===bc===
16139 ==c==
16140 ===ca===
16141 !! html
16142 start
16143 ==a==
16144 ===aa===
16145 ====aaa====
16146 ==b==
16147 ===ba===
16150 ===bc===
16151 ==c==
16152 ===ca===
16153 !! end
16155 !! test
16156 Section replacement test (section 7)
16157 !! options
16158 replace=7,"xxx"
16159 !! wikitext
16160 start
16161 ==a==
16162 ===aa===
16163 ====aaa====
16164 ==b==
16165 ===ba===
16166 ===bb===
16167 ====bba====
16168 ===bc===
16169 ==c==
16170 ===ca===
16171 !! html
16172 start
16173 ==a==
16174 ===aa===
16175 ====aaa====
16176 ==b==
16177 ===ba===
16178 ===bb===
16181 ===bc===
16182 ==c==
16183 ===ca===
16184 !! end
16186 !! test
16187 Section replacement test (section 8)
16188 !! options
16189 replace=8,"xxx"
16190 !! wikitext
16191 start
16192 ==a==
16193 ===aa===
16194 ====aaa====
16195 ==b==
16196 ===ba===
16197 ===bb===
16198 ====bba====
16199 ===bc===
16200 ==c==
16201 ===ca===
16202 !! html
16203 start
16204 ==a==
16205 ===aa===
16206 ====aaa====
16207 ==b==
16208 ===ba===
16209 ===bb===
16210 ====bba====
16213 ==c==
16214 ===ca===
16215 !!end
16217 !! test
16218 Section replacement test (section 9)
16219 !! options
16220 replace=9,"xxx"
16221 !! wikitext
16222 start
16223 ==a==
16224 ===aa===
16225 ====aaa====
16226 ==b==
16227 ===ba===
16228 ===bb===
16229 ====bba====
16230 ===bc===
16231 ==c==
16232 ===ca===
16233 !! html
16234 start
16235 ==a==
16236 ===aa===
16237 ====aaa====
16238 ==b==
16239 ===ba===
16240 ===bb===
16241 ====bba====
16242 ===bc===
16244 !! end
16246 !! test
16247 Section replacement test (section 10)
16248 !! options
16249 replace=10,"xxx"
16250 !! wikitext
16251 start
16252 ==a==
16253 ===aa===
16254 ====aaa====
16255 ==b==
16256 ===ba===
16257 ===bb===
16258 ====bba====
16259 ===bc===
16260 ==c==
16261 ===ca===
16262 !! html
16263 start
16264 ==a==
16265 ===aa===
16266 ====aaa====
16267 ==b==
16268 ===ba===
16269 ===bb===
16270 ====bba====
16271 ===bc===
16272 ==c==
16274 !! end
16276 !! test
16277 Section replacement test with initial whitespace (bug 13728)
16278 !! options
16279 replace=2,"xxx"
16280 !! wikitext
16281  Preformatted initial line
16282 ==a==
16283 ===a===
16284 !! html
16285  Preformatted initial line
16286 ==a==
16288 !! end
16291 !! test
16292 Section extraction, heading followed by pre with 20 spaces (bug 6398)
16293 !! options
16294 section=1
16295 !! wikitext
16296 ==a==
16297                     a
16298 !! html
16299 ==a==
16300                     a
16301 !! end
16303 !! test
16304 Section extraction, heading followed by pre with 19 spaces (bug 6398 sanity check)
16305 !! options
16306 section=1
16307 !! wikitext
16308 ==a==
16309                    a
16310 !! html
16311 ==a==
16312                    a
16313 !! end
16316 !! test
16317 Section extraction, <pre> around bogus header (bug 10309)
16318 !! options
16319 noxml section=2
16320 !! wikitext
16321 == Section One ==
16322 <pre>
16323 =======
16324 </pre>
16326 == Section Two ==
16327 stuff
16328 !! html
16329 == Section Two ==
16330 stuff
16331 !! end
16333 !! test
16334 Section replacement, <pre> around bogus header (bug 10309)
16335 !! options
16336 noxml replace=2,"xxx"
16337 !! wikitext
16338 == Section One ==
16339 <pre>
16340 =======
16341 </pre>
16343 == Section Two ==
16344 stuff
16345 !! html
16346 == Section One ==
16347 <pre>
16348 =======
16349 </pre>
16352 !! end
16356 !! test
16357 Handling of &#x0A; in URLs
16358 !! wikitext
16359 ** irc://&#x0A;a
16360 !! html/php
16361 <ul><li><ul><li> <a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a></li></ul></li></ul>
16363 !! html/parsoid
16364 <ul><li><ul><li> <a rel="mw:ExtLink" href="irc://
16365 a">irc://
16366 a</a></li></ul></li></ul>
16367 !! end
16369 !! test
16370 Handling of %0A in URLs
16371 !! wikitext
16372 ** irc://%0Aa
16373 !! html/php
16374 <ul><li><ul><li> <a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a></li></ul></li></ul>
16376 !! html/parsoid
16377 <ul><li><ul><li> <a rel="mw:ExtLink" href="irc://%0Aa">irc://%0Aa</a></li></ul></li></ul>
16378 !! end
16381 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
16382 !! test
16383 5 quotes, code coverage +1 line
16384 !! options
16385 parsoid=wt2html
16386 !! wikitext
16387 '''''
16388 !! html/php
16389 !! html/parsoid
16390 <p><b><i></i></b></p>
16391 !! end
16393 # same html as previous, but wikitext adjusted to match parsoid html2wt
16394 # note that wt2html and html2html will put the <i> before the <b>
16395 !! test
16396 5 quotes, code coverage +1 line w/ nowiki (1)
16397 !! options
16398 parsoid=wt2wt,html2wt
16399 !! wikitext
16400 '''''<nowiki/>'''''
16401 !! html/php
16402 <p><i></i>
16403 </p>
16404 !! html/parsoid
16405 <p><b><i></i></b></p>
16406 !! end
16408 # same as previous, just swapping the <i> and <b>
16409 !! test
16410 5 quotes, code coverage +1 line w/ nowiki (2)
16411 !! wikitext
16412 '''''<nowiki/>'''''
16413 !! html/php
16414 <p><i></i>
16415 </p>
16416 !! html/parsoid
16417 <p><i><b></b></i></p>
16418 !! end
16420 !! test
16421 Special:Search page linking.
16422 !! wikitext
16423 {{Special:search}}
16424 !! html
16425 <p><a href="/wiki/Special:Search" title="Special:Search">Special:Search</a>
16426 </p>
16427 !! end
16429 !! test
16430 {{!}} is a magic word
16431 !! wikitext
16432 {{!}} is a magic word there and {{!}} is still a magic word here
16433 !! html/php
16434 <p>| is a magic word there and | is still a magic word here
16435 </p>
16436 !! html/parsoid
16437 <p><span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"!","href":"./Template:!"},"params":{},"i":0}}]}' data-parsoid='{"pi":[[]]}'>|</span> is a magic word there and <span about="#mwt2" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"!","href":"./Template:!"},"params":{},"i":0}}]}' data-parsoid='{"pi":[[]]}'>|</span> is still a magic word here</p>
16438 !! end
16440 !! test
16441 Say the magic word
16442 !! options
16443 title=[[Parser test]]
16444 !! wikitext
16445 * {{PAGENAME}}
16446 * {{PAGENAMEE}}
16447 * {{FULLPAGENAME}}
16448 * {{FULLPAGENAMEE}}
16449 * {{BASEPAGENAME}}
16450 * {{BASEPAGENAMEE}}
16451 * {{SUBPAGENAME}}
16452 * {{SUBPAGENAMEE}}
16453 * {{ROOTPAGENAME}}
16454 * {{ROOTPAGENAMEE}}
16455 * {{TALKPAGENAME}}
16456 * {{TALKPAGENAMEE}}
16457 * {{SUBJECTPAGENAME}}
16458 * {{SUBJECTPAGENAMEE}}
16459 * {{NAMESPACEE}}
16460 * {{NAMESPACE}}
16461 * {{NAMESPACENUMBER}}
16462 * {{TALKSPACE}}
16463 * {{TALKSPACEE}}
16464 * {{SUBJECTSPACE}}
16465 * {{SUBJECTSPACEE}}
16466 * {{Dynamic|{{NUMBEROFUSERS}}|{{NUMBEROFPAGES}}|{{CURRENTVERSION}}|{{CONTENTLANGUAGE}}|{{DIRECTIONMARK}}|{{CURRENTTIMESTAMP}}|{{NUMBEROFARTICLES}}}}
16467 !! html
16468 <ul><li> Parser test</li>
16469 <li> Parser_test</li>
16470 <li> Parser test</li>
16471 <li> Parser_test</li>
16472 <li> Parser test</li>
16473 <li> Parser_test</li>
16474 <li> Parser test</li>
16475 <li> Parser_test</li>
16476 <li> Parser test</li>
16477 <li> Parser_test</li>
16478 <li> Talk:Parser test</li>
16479 <li> Talk:Parser_test</li>
16480 <li> Parser test</li>
16481 <li> Parser_test</li>
16482 <li> </li>
16483 <li> </li>
16484 <li> 0</li>
16485 <li> Talk</li>
16486 <li> Talk</li>
16487 <li> </li>
16488 <li> </li>
16489 <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>
16491 !! end
16492 ### Note: Above tests excludes the "{{NUMBEROFADMINS}}" magic word because it generates a MySQL error when included.
16494 !! test
16495 Gallery
16496 !! wikitext
16497 <gallery>
16498 image1.png |
16499 image2.gif|||||
16501 image3|
16502 image4    |300px| centre
16503  image5.svg| http://///////
16504 [[x|xx]]]]
16505 * image6
16506 </gallery>
16507 !! html
16508 <ul class="gallery mw-gallery-traditional">
16509                 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
16510                         <div class="thumb" style="height: 150px;">Image1.png</div>
16511                         <div class="gallerytext">
16512                         </div>
16513                 </div></li>
16514                 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
16515                         <div class="thumb" style="height: 150px;">Image2.gif</div>
16516                         <div class="gallerytext">
16517 <p>||||
16518 </p>
16519                         </div>
16520                 </div></li>
16521                 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
16522                         <div class="thumb" style="height: 150px;">Image3</div>
16523                         <div class="gallerytext">
16524                         </div>
16525                 </div></li>
16526                 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
16527                         <div class="thumb" style="height: 150px;">Image4</div>
16528                         <div class="gallerytext">
16529 <p>300px| centre
16530 </p>
16531                         </div>
16532                 </div></li>
16533                 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
16534                         <div class="thumb" style="height: 150px;">Image5.svg</div>
16535                         <div class="gallerytext">
16536 <p><a rel="nofollow" class="external free" href="http://///////">http://///////</a>
16537 </p>
16538                         </div>
16539                 </div></li>
16540                 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
16541                         <div class="thumb" style="height: 150px;">* image6</div>
16542                         <div class="gallerytext">
16543                         </div>
16544                 </div></li>
16545 </ul>
16547 !! end
16549 !! test
16550 Gallery (with options)
16551 !! wikitext
16552 <gallery widths='70px' heights='40px' perrow='2' caption='Foo [[Main Page]]' >
16553 File:Nonexistent.jpg|caption
16554 File:Nonexistent.jpg
16555 image:foobar.jpg|some '''caption''' [[Main Page]]
16556 image:foobar.jpg
16557 image:foobar.jpg|Blabla|alt=This is a foo-bar.|blabla.
16558 </gallery>
16559 !! html
16560 <ul class="gallery mw-gallery-traditional" style="max-width: 226px;_width: 226px;">
16561         <li class='gallerycaption'>Foo <a href="/wiki/Main_Page" title="Main Page">Main Page</a></li>
16562                 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
16563                         <div class="thumb" style="height: 70px;">Nonexistent.jpg</div>
16564                         <div class="gallerytext">
16565 <p>caption
16566 </p>
16567                         </div>
16568                 </div></li>
16569                 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
16570                         <div class="thumb" style="height: 70px;">Nonexistent.jpg</div>
16571                         <div class="gallerytext">
16572                         </div>
16573                 </div></li>
16574                 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
16575                         <div class="thumb" style="width: 100px;"><div style="margin:31px auto;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/70px-Foobar.jpg" width="70" height="8" /></a></div></div>
16576                         <div class="gallerytext">
16577 <p>some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
16578 </p>
16579                         </div>
16580                 </div></li>
16581                 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
16582                         <div class="thumb" style="width: 100px;"><div style="margin:31px auto;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/70px-Foobar.jpg" width="70" height="8" /></a></div></div>
16583                         <div class="gallerytext">
16584                         </div>
16585                 </div></li>
16586                 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
16587                         <div class="thumb" style="width: 100px;"><div style="margin:31px auto;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="This is a foo-bar." src="http://example.com/images/thumb/3/3a/Foobar.jpg/70px-Foobar.jpg" width="70" height="8" /></a></div></div>
16588                         <div class="gallerytext">
16589 <p>Blabla|blabla.
16590 </p>
16591                         </div>
16592                 </div></li>
16593 </ul>
16595 !! end
16597 !! test
16598 Gallery with link that has fragment
16599 !! wikitext
16600 <gallery>
16601 image:foobar.jpg|link=Main_Page
16602 image:foobar.jpg|link=Main_Page#section
16603 image:foobar.jpg|link=Main Page#section|caption
16604 </gallery>
16605 !! html
16606 <ul class="gallery mw-gallery-traditional">
16607                 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
16608                         <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" /></a></div></div>
16609                         <div class="gallerytext">
16610                         </div>
16611                 </div></li>
16612                 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
16613                         <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" /></a></div></div>
16614                         <div class="gallerytext">
16615                         </div>
16616                 </div></li>
16617                 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
16618                         <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" /></a></div></div>
16619                         <div class="gallerytext">
16620 <p>caption
16621 </p>
16622                         </div>
16623                 </div></li>
16624 </ul>
16626 !! end
16628 !! test
16629 Gallery with wikitext inside caption
16630 !! wikitext
16631 <gallery>
16632 File:foobar.jpg|[[File:foobar.jpg|20px|desc|alt=inneralt]]|alt=galleryalt
16633 File:foobar.jpg|{{Test|unamedParam|alt=param}}|alt=galleryalt
16634 </gallery>
16635 !! html
16636 <ul class="gallery mw-gallery-traditional">
16637                 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
16638                         <div class="thumb" style="width: 150px;"><div style="margin:68px auto;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="galleryalt" src="http://example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" width="120" height="14" /></a></div></div>
16639                         <div class="gallerytext">
16640 <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>
16641 </p>
16642                         </div>
16643                 </div></li>
16644                 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
16645                         <div class="thumb" style="width: 150px;"><div style="margin:68px auto;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="galleryalt" src="http://example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" width="120" height="14" /></a></div></div>
16646                         <div class="gallerytext">
16647 <p>This is a test template
16648 </p>
16649                         </div>
16650                 </div></li>
16651 </ul>
16653 !! end
16655 !! test
16656 gallery (with showfilename option)
16657 !! wikitext
16658 <gallery showfilename>
16659 File:Nonexistent.jpg|caption
16660 File:Nonexistent.jpg
16661 image:foobar.jpg|some '''caption''' [[Main Page]]
16662 File:Foobar.jpg
16663 </gallery>
16664 !! html
16665 <ul class="gallery mw-gallery-traditional">
16666                 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
16667                         <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
16668                         <div class="gallerytext">
16669 <p><a href="/wiki/File:Nonexistent.jpg" title="File:Nonexistent.jpg">Nonexistent.jpg</a><br />
16670 caption
16671 </p>
16672                         </div>
16673                 </div></li>
16674                 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
16675                         <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
16676                         <div class="gallerytext">
16677 <p><a href="/wiki/File:Nonexistent.jpg" title="File:Nonexistent.jpg">Nonexistent.jpg</a><br />
16678 </p>
16679                         </div>
16680                 </div></li>
16681                 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
16682                         <div class="thumb" style="width: 150px;"><div style="margin:68px auto;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" width="120" height="14" /></a></div></div>
16683                         <div class="gallerytext">
16684 <p><a href="/wiki/File:Foobar.jpg" title="File:Foobar.jpg">Foobar.jpg</a><br />
16685 some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
16686 </p>
16687                         </div>
16688                 </div></li>
16689                 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
16690                         <div class="thumb" style="width: 150px;"><div style="margin:68px auto;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" width="120" height="14" /></a></div></div>
16691                         <div class="gallerytext">
16692 <p><a href="/wiki/File:Foobar.jpg" title="File:Foobar.jpg">Foobar.jpg</a><br />
16693 </p>
16694                         </div>
16695                 </div></li>
16696 </ul>
16698 !! end
16700 !! test
16701 Gallery (with namespace-less filenames)
16702 !! wikitext
16703 <gallery>
16704 File:Nonexistent.jpg
16705 Nonexistent.jpg
16706 image:foobar.jpg
16707 foobar.jpg
16708 </gallery>
16709 !! html
16710 <ul class="gallery mw-gallery-traditional">
16711                 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
16712                         <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
16713                         <div class="gallerytext">
16714                         </div>
16715                 </div></li>
16716                 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
16717                         <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
16718                         <div class="gallerytext">
16719                         </div>
16720                 </div></li>
16721                 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
16722                         <div class="thumb" style="width: 150px;"><div style="margin:68px auto;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" width="120" height="14" /></a></div></div>
16723                         <div class="gallerytext">
16724                         </div>
16725                 </div></li>
16726                 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
16727                         <div class="thumb" style="width: 150px;"><div style="margin:68px auto;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" width="120" height="14" /></a></div></div>
16728                         <div class="gallerytext">
16729                         </div>
16730                 </div></li>
16731 </ul>
16733 !! end
16735 !! test
16736 HTML Hex character encoding (spells the word "JavaScript")
16737 !! options
16738 parsoid=wt2html,wt2wt,html2html
16739 !! wikitext
16740 &#x4A;&#x061;&#x0076;&#x00061;&#x000053;&#x0000063;&#114;&#x0000069;&#00000112;&#x0000000074;
16741 !! html/php
16742 <p>&#x4a;&#x61;&#x76;&#x61;&#x53;&#x63;&#114;&#x69;&#112;&#x74;
16743 </p>
16744 !! html/php+tidy
16745 <p>JavaScript</p>
16746 !! html/parsoid
16747 <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>
16748 !! end
16750 !! test
16751 HTML Hex character encoding bogus encoding (bug 26437 regression check)
16752 !! wikitext
16753 &#xsee;&#XSEE;
16754 !! html/php
16755 <p>&amp;#xsee;&amp;#XSEE;
16756 </p>
16757 !! html/parsoid
16758 <p>&amp;#xsee;&amp;#XSEE;</p>
16759 !! end
16761 !! test
16762 HTML Hex character encoding mixed case
16763 !! options
16764 parsoid=wt2html,wt2wt,html2html
16765 !! wikitext
16766 &#xEE;&#Xee;
16767 !! html/php
16768 <p>&#xee;&#xee;
16769 </p>
16770 !! html/php+tidy
16771 <p>îî</p>
16772 !! html/parsoid
16773 <p><span typeof="mw:Entity">î</span><span typeof="mw:Entity">î</span></p>
16774 !! end
16776 !! test
16777 __FORCETOC__ override
16778 !! wikitext
16779 __NEWSECTIONLINK__
16780 __FORCETOC__
16781 !! html
16782 <p><br />
16783 </p>
16784 !! end
16786 !! test
16787 ISBN code coverage
16788 !! wikitext
16789 ISBN  978-0-1234-56&#x20;789
16790 !! html
16791 <p><a href="/wiki/Special:BookSources/9780123456" class="internal mw-magiclink-isbn">ISBN 978-0-1234-56</a>&#x20;789
16792 </p>
16793 !! html+tidy
16794 <p><a href="/wiki/Special:BookSources/9780123456" class="internal mw-magiclink-isbn">ISBN 978-0-1234-56</a> 789</p>
16795 !! end
16797 !! test
16798 ISBN followed by 5 spaces
16799 !! wikitext
16800 ISBN    
16801 !! html
16802 <p>ISBN    
16803 </p>
16804 !! end
16806 !! test
16807 Double ISBN
16808 !! wikitext
16809 ISBN ISBN 1234567890
16810 !! html
16811 <p>ISBN <a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
16812 </p>
16813 !! end
16815 !! test
16816 ISBN with an X
16817 !! wikitext
16818 ISBN 3-462-04561-X
16819 !! html
16820 <p><a href="/wiki/Special:BookSources/346204561X" class="internal mw-magiclink-isbn">ISBN 3-462-04561-X</a>
16821 </p>
16822 !! end
16824 !! test
16825 ISBN with empty prefix (parsoid test)
16826 !! wikitext
16827 ISBN 1234567890
16828 !! html/parsoid
16829 <p><a href="Special:BookSources/1234567890" rel="mw:ExtLink">ISBN 1234567890</a></p>
16830 !! end
16832 !! test
16833 Bug 22905: <abbr> followed by ISBN followed by </a>
16834 !! wikitext
16835 <abbr>(fr)</abbr> ISBN 2753300917 [http://www.example.com example.com]
16836 !! html
16837 <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>
16838 </p>
16839 !! end
16841 !! test
16842 Double RFC
16843 !! wikitext
16844 RFC RFC 1234
16845 !! html
16846 <p>RFC <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc1234">RFC 1234</a>
16847 </p>
16848 !! end
16850 !! test
16851 Double RFC with a wiki link
16852 !! wikitext
16853 RFC [[RFC 1234]]
16854 !! html
16855 <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>
16856 </p>
16857 !! end
16859 !! test
16860 RFC code coverage
16861 !! wikitext
16862 RFC   983&#x20;987
16863 !! html
16864 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc983">RFC 983</a>&#x20;987
16865 </p>
16866 !! html+tidy
16867 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc983">RFC 983</a> 987</p>
16868 !! end
16870 !! test
16871 Centre-aligned image
16872 !! wikitext
16873 [[Image:foobar.jpg|centre]]
16874 !! html
16875 <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>
16877 !!end
16879 !! test
16880 None-aligned image
16881 !! wikitext
16882 [[Image:foobar.jpg|none]]
16883 !! html
16884 <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>
16886 !!end
16888 !! test
16889 Width + Height sized image (using px) (height is ignored)
16890 !! wikitext
16891 [[Image:foobar.jpg|640x480px]]
16892 !! html
16893 <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>
16894 </p>
16895 !!end
16897 !! test
16898 Width-sized image (using px, no following whitespace)
16899 !! wikitext
16900 [[Image:foobar.jpg|640px]]
16901 !! html
16902 <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>
16903 </p>
16904 !!end
16906 !! test
16907 Width-sized image (using px, with following whitespace - test regression from r39467)
16908 !! wikitext
16909 [[Image:foobar.jpg|640px ]]
16910 !! html
16911 <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>
16912 </p>
16913 !!end
16915 !! test
16916 Width-sized image (using px, with preceding whitespace - test regression from r39467)
16917 !! wikitext
16918 [[Image:foobar.jpg| 640px]]
16919 !! html
16920 <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>
16921 </p>
16922 !!end
16924 !! test
16925 Image with page parameter
16926 !! options
16927 djvu
16928 !! wikitext
16929 [[File:LoremIpsum.djvu|page=2]]
16930 !! html/php
16931 <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>
16932 </p>
16933 !! html/parsoid
16934 <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" height="3508" width="2480" data-parsoid='{"a":{"resource":"./File:LoremIpsum.djvu","height":"3508","width":"2480"},"sa":{"resource":"File:LoremIpsum.djvu"}}'/></a></span></p>
16935 !! end
16937 !! test
16938 Another italics / bold test
16939 !! wikitext
16940  ''' ''x'
16941 !! html
16942 <pre>'<i> </i>x'
16943 </pre>
16944 !!end
16946 # FIXME: The php output seems broken. It's interleaving some open/close tags.
16947 !! test
16948 dt/dd/dl test
16949 !! wikitext
16950 :;;;::
16951 !! html/php
16952 <dl><dd><dl><dt><dl><dt><dl><dt><dl><dd><dl><dd></dt></dl></dd></dl></dd></dl></dd></dl></dd></dl></dd></dl>
16954 !! html/parsoid
16955 <dl><dd><dl><dt><dl><dt><dl><dt><dl><dd><dl><dd></dd></dl></dd></dl></dt></dl></dt></dl></dt></dl></dd></dl>
16957 !!end
16960 # Images with the "|" character in external URLs in comment tags; Eats half the comment, leaves unmatched "</a>" tag.
16961 !! test
16962 Images with the "|" character in the comment
16963 !! wikitext
16964 [[File:Foobar.jpg|thumb|An [http://test/?param1=|left|&param2=|x external] URL]]
16965 !! html/php
16966 <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>
16968 !! html/parsoid
16969 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="25" width="220"/></a><figcaption>An <a rel="mw:ExtLink" href="http://test/?param1=|left|&amp;param2=|x">external</a> URL</figcaption></figure>
16970 !! end
16972 !! test
16973 [Before] HTML without raw HTML enabled ($wgRawHtml==false)
16974 !! wikitext
16975 <html><script>alert(1);</script></html>
16976 !! html
16977 <p>&lt;html&gt;&lt;script&gt;alert(1);&lt;/script&gt;&lt;/html&gt;
16978 </p>
16979 !! end
16981 !! test
16982 HTML with raw HTML ($wgRawHtml==true)
16983 !! options
16984 wgRawHtml=1
16985 !! wikitext
16986 <html><script>alert(1);</script></html>
16987 !! html
16988 <p><script>alert(1);</script>
16989 </p>
16990 !! end
16992 !! test
16993 Parents of subpages, one level up
16994 !! options
16995 subpage title=[[Subpage test/L1/L2/L3]]
16996 !! wikitext
16997 [[../|L2]]
16998 !! html
16999 <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>
17000 </p>
17001 !! end
17004 !! test
17005 Parents of subpages, one level up, not named
17006 !! options
17007 subpage title=[[Subpage test/L1/L2/L3]]
17008 !! wikitext
17009 [[../]]
17010 !! html
17011 <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>
17012 </p>
17013 !! end
17017 !! test
17018 Parents of subpages, two levels up
17019 !! options
17020 subpage title=[[Subpage test/L1/L2/L3]]
17021 !! wikitext
17022 [[../../|L1]]2
17024 [[../../|L1]]l
17025 !! html
17026 <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
17027 </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>
17028 </p>
17029 !! end
17031 !! test
17032 Parents of subpages, two levels up, without trailing slash or name.
17033 !! options
17034 subpage title=[[Subpage test/L1/L2/L3]]
17035 !! wikitext
17036 [[../..]]
17037 !! html
17038 <p>[[../..]]
17039 </p>
17040 !! end
17042 !! test
17043 Parents of subpages, two levels up, with lots of extra trailing slashes.
17044 !! options
17045 subpage title=[[Subpage test/L1/L2/L3]]
17046 !! wikitext
17047 [[../../////]]
17048 !! html
17049 <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>
17050 </p>
17051 !! end
17053 !! article
17054 Subpage test/L1/L2/L3Sibling
17055 !! text
17056 Sibling article
17057 !! endarticle
17059 !! test
17060 Transclusion of a sibling page (one level up)
17061 !! options
17062 subpage title=[[Subpage test/L1/L2/L3]]
17063 !! wikitext
17064 {{../L3Sibling}}
17065 !! html
17066 <p>Sibling article
17067 </p>
17068 !! end
17070 !! test
17071 Transclusion of a child page
17072 !! options
17073 subpage title=[[Subpage test/L1/L2]]
17074 !! wikitext
17075 {{/L3Sibling}}
17076 !! html
17077 <p>Sibling article
17078 </p>
17079 !! end
17081 !! test
17082 Non-transclusion because of too many up levels
17083 !! options
17084 subpage title=[[Subpage test/L1/L2/L3]]
17085 !! wikitext
17086 {{../../../../More than parent}}
17087 !! html
17088 <p>{{../../../../More than parent}}
17089 </p>
17090 !! end
17092 !! test
17093 Definition list code coverage
17094 !! wikitext
17095 ; title   : def
17096 ; title : def
17097 ;title: def
17098 !! html/php
17099 <dl><dt> title  &#160;</dt>
17100 <dd> def</dd>
17101 <dt> title&#160;</dt>
17102 <dd> def</dd>
17103 <dt>title</dt>
17104 <dd> def</dd></dl>
17106 !! html/parsoid
17107 <dl><dt> title  <span typeof="mw:Placeholder"> </span></dt><dd> def</dd>
17108 <dt> title<span typeof="mw:Placeholder"> </span></dt><dd> def</dd>
17109 <dt>title</dt><dd> def</dd></dl>
17110 !! end
17112 !! test
17113 Don't fall for the self-closing div
17114 !! wikitext
17115 <div>hello world</div/>
17116 !! html
17117 <div>hello world</div>
17119 !! end
17121 !! test
17122 MSGNW magic word
17123 !! wikitext
17124 {{MSGNW:msg}}
17125 !! html
17126 <p>&#91;&#91;:Template:Msg&#93;&#93;
17127 </p>
17128 !! end
17130 !! test
17131 RAW magic word
17132 !! wikitext
17133 {{RAW:QUERTY}}
17134 !! html
17135 <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>
17136 </p>
17137 !! end
17139 # This isn't needed for XHTML conformance, but would be handy as a fallback security measure
17140 !! test
17141 Always escape literal '>' in output, not just after '<'
17142 !! wikitext
17144 !! html
17145 <p>&gt;&lt;&gt;
17146 </p>
17147 !! end
17149 !! test
17150 Template caching
17151 !! wikitext
17152 {{Test}}
17153 {{Test}}
17154 !! html
17155 <p>This is a test template
17156 This is a test template
17157 </p>
17158 !! end
17161 !! article
17162 MediaWiki:Fake
17163 !! text
17164 ==header==
17165 !! endarticle
17167 !! test
17168 Inclusion of !userCanEdit() content
17169 !! wikitext
17170 {{MediaWiki:Fake}}
17171 !! html
17172 <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>
17174 !! end
17177 !! test
17178 Out-of-order TOC heading levels
17179 !! wikitext
17180 ==2==
17181 ======6======
17182 ===3===
17184 =====5=====
17185 ==2==
17186 !! html
17187 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
17188 <ul>
17189 <li class="toclevel-1 tocsection-1"><a href="#2"><span class="tocnumber">1</span> <span class="toctext">2</span></a>
17190 <ul>
17191 <li class="toclevel-2 tocsection-2"><a href="#6"><span class="tocnumber">1.1</span> <span class="toctext">6</span></a></li>
17192 <li class="toclevel-2 tocsection-3"><a href="#3"><span class="tocnumber">1.2</span> <span class="toctext">3</span></a></li>
17193 </ul>
17194 </li>
17195 <li class="toclevel-1 tocsection-4"><a href="#1"><span class="tocnumber">2</span> <span class="toctext">1</span></a>
17196 <ul>
17197 <li class="toclevel-2 tocsection-5"><a href="#5"><span class="tocnumber">2.1</span> <span class="toctext">5</span></a></li>
17198 <li class="toclevel-2 tocsection-6"><a href="#2_2"><span class="tocnumber">2.2</span> <span class="toctext">2</span></a></li>
17199 </ul>
17200 </li>
17201 </ul>
17202 </div>
17204 <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>
17205 <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>
17206 <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>
17207 <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>
17208 <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>
17209 <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>
17211 !! end
17214 !! test
17215 ISBN with a dummy number
17216 !! wikitext
17217 ISBN ---
17218 !! html
17219 <p>ISBN ---
17220 </p>
17221 !! end
17224 !! test
17225 ISBN with space-delimited number
17226 !! wikitext
17227 ISBN 92 9017 032 8
17228 !! html
17229 <p><a href="/wiki/Special:BookSources/9290170328" class="internal mw-magiclink-isbn">ISBN 92 9017 032 8</a>
17230 </p>
17231 !! end
17234 !! test
17235 ISBN with multiple spaces, no number
17236 !! wikitext
17237 ISBN  foo
17238 !! html
17239 <p>ISBN  foo
17240 </p>
17241 !! end
17244 !! test
17245 ISBN length
17246 !! wikitext
17247 ISBN 123456789
17249 ISBN 1234567890
17251 ISBN 12345678901
17252 !! html
17253 <p>ISBN 123456789
17254 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
17255 </p><p>ISBN 12345678901
17256 </p>
17257 !! end
17260 !! test
17261 ISBN with trailing year (bug 8110)
17262 !! wikitext
17263 ISBN 1-234-56789-0 - 2006
17265 ISBN 1 234 56789 0 - 2006
17266 !! html
17267 <p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1-234-56789-0</a> - 2006
17268 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1 234 56789 0</a> - 2006
17269 </p>
17270 !! end
17273 !! test
17274 anchorencode
17275 !! wikitext
17276 {{anchorencode:foo bar©#%n}}
17277 !! html
17278 <p>foo_bar.C2.A9.23.25n
17279 </p>
17280 !! end
17282 !! test
17283 anchorencode trims spaces
17284 !! wikitext
17285 {{anchorencode: __pretty__please__}}
17286 !! html
17287 <p>pretty_please
17288 </p>
17289 !! end
17291 !! test
17292 anchorencode deals with links
17293 !! wikitext
17294 {{anchorencode: [[hello|world]] [[hi]]}}
17295 !! html
17296 <p>world_hi
17297 </p>
17298 !! end
17300 !! test
17301 anchorencode deals with templates
17302 !! wikitext
17303 {{anchorencode: {{Foo}} }}
17304 !! html
17305 <p>FOO
17306 </p>
17307 !! end
17309 !! test
17310 anchorencode encodes like the TOC generator: (bug 18431)
17311 !! wikitext
17312 === _ +:.3A%3A&&amp;]] ===
17313 {{anchorencode: _ +:.3A%3A&&amp;]] }}
17314 __NOEDITSECTION__
17315 !! html
17316 <h3><span class="mw-headline" id=".2B:.3A.253A.26.26.5D.5D">_ +:.3A%3A&amp;&amp;]]</span></h3>
17317 <p>.2B:.3A.253A.26.26.5D.5D
17318 </p>
17319 !! end
17321 !! test
17322 Bug 6200: blockquotes and paragraph formatting
17323 !! wikitext
17324 <blockquote>
17326 </blockquote>
17330  baz
17331 !! html
17332 <blockquote>
17333 <p>foo
17334 </p>
17335 </blockquote>
17336 <p>bar
17337 </p>
17338 <pre>baz
17339 </pre>
17340 !! end
17342 !! test
17343 Bug 8293: Use of center tag ruins paragraph formatting
17344 !! wikitext
17345 <center>
17347 </center>
17351  baz
17352 !! html
17353 <center>
17354 <p>foo
17355 </p>
17356 </center>
17357 <p>bar
17358 </p>
17359 <pre>baz
17360 </pre>
17361 !! end
17363 !!test
17364 Parsing of overlapping (improperly nested) inline html tags
17365 !! wikitext
17366 <span><s>x</span></s>
17367 !! html/php
17368 <p><span><s>x&lt;/span&gt;</s></span>
17369 </p>
17370 !! html/parsoid
17371 <p><span><s>x</s></span>
17372 </p>
17373 !!end
17376 ### Language variants related tests
17378 !! test
17379 Self-link in language variants
17380 !! options
17381 title=[[Dunav]] language=sr
17382 !! wikitext
17383 Both [[Dunav]] and [[Дунав]] are names for this river.
17384 !! html
17385 <p>Both <strong class="selflink">Dunav</strong> and <strong class="selflink">Дунав</strong> are names for this river.
17386 </p>
17387 !!end
17389 !! article
17390 Дуна
17391 !! text
17392 content
17393 !! endarticle
17395 !! test
17396 Link to another existing title shouldn't be parsed as self-link even if it's a variant of this title
17397 !! options
17398 title=[[Duna]] language=sr
17399 !! wikitext
17400 [[Дуна]] is not a self-link while [[Duna]] and [[Dуна]] are still self-links.
17401 !! html
17402 <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.
17403 </p>
17404 !! end
17406 !! test
17407 Link to a section of a variant of this title shouldn't be parsed as self-link
17408 !! options
17409 title=[[Duna]] language=sr
17410 !! wikitext
17411 [[Dуна]] is a self-link while [[Dunа#Foo]] and [[Dуна#Foo]] are not self-links.
17412 !! html
17413 <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.
17414 </p>
17415 !! end
17417 !! test
17418 Link to pages in language variants
17419 !! options
17420 language=sr
17421 !! wikitext
17422 Main Page can be written as [[Маин Паге]]
17423 !! html
17424 <p>Main Page can be written as <a href="/wiki/Main_Page" title="Main Page">Маин Паге</a>
17425 </p>
17426 !!end
17429 !! test
17430 Multiple links to pages in language variants
17431 !! options
17432 language=sr
17433 !! wikitext
17434 [[Main Page]] can be written as [[Маин Паге]] same as [[Маин Паге]].
17435 !! html
17436 <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>.
17437 </p>
17438 !!end
17441 !! test
17442 Simple template in language variants
17443 !! options
17444 language=sr
17445 !! wikitext
17446 {{тест}}
17447 !! html
17448 <p>This is a test template
17449 </p>
17450 !! end
17453 !! test
17454 Template with explicit namespace in language variants
17455 !! options
17456 language=sr
17457 !! wikitext
17458 {{Template:тест}}
17459 !! html
17460 <p>This is a test template
17461 </p>
17462 !! end
17465 !! test
17466 Basic test for template parameter in language variants
17467 !! options
17468 language=sr
17469 !! wikitext
17470 {{парамтест|param=foo}}
17471 !! html
17472 <p>This is a test template with parameter foo
17473 </p>
17474 !! end
17477 !! test
17478 Simple category in language variants
17479 !! options
17480 language=sr cat
17481 !! wikitext
17482 [[Category:МедиаWики Усер'с Гуиде]]
17483 !! html
17484 <a href="/wiki/%D0%9A%D0%B0%D1%82%D0%B5%D0%B3%D0%BE%D1%80%D0%B8%D1%98%D0%B0:MediaWiki_User%27s_Guide" title="Категорија:MediaWiki User's Guide">MediaWiki User's Guide</a>
17485 !! end
17488 !! article
17489 Category:分类
17490 !! text
17491 blah
17492 !! endarticle
17494 !! article
17495 Category:分類
17496 !! text
17497 blah
17498 !! endarticle
17500 !! test
17501 Don't convert blue categorylinks to another variant (bug 33210)
17502 !! options
17503 language=zh cat
17504 !! wikitext
17505 [[A]][[Category:分类]]
17506 !! html
17507 <a href="/wiki/Category:%E5%88%86%E7%B1%BB" title="Category:分类">分类</a>
17508 !! end
17511 !! test
17512 Stripping -{}- tags (language variants)
17513 !! options
17514 language=sr
17515 !! wikitext
17516 Latin proverb: -{Ne nuntium necare}-
17517 !! html
17518 <p>Latin proverb: Ne nuntium necare
17519 </p>
17520 !! end
17523 !! test
17524 Prevent conversion with -{}- tags (language variants)
17525 !! options
17526 language=sr variant=sr-ec
17527 !! wikitext
17528 Latinski: -{Ne nuntium necare}-
17529 !! html
17530 <p>Латински: Ne nuntium necare
17531 </p>
17532 !! end
17535 !! test
17536 Prevent conversion of text with -{}- tags (language variants)
17537 !! options
17538 language=sr variant=sr-ec
17539 !! wikitext
17540 Latinski: -{Ne nuntium necare}-
17541 !! html
17542 <p>Латински: Ne nuntium necare
17543 </p>
17544 !! end
17547 !! test
17548 Prevent conversion of links with -{}- tags (language variants)
17549 !! options
17550 language=sr variant=sr-ec
17551 !! wikitext
17552 -{[[Main Page]]}-
17553 !! html
17554 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
17555 </p>
17556 !! end
17559 !! test
17560 -{}- tags within headlines (within html for parserConvert())
17561 !! options
17562 language=sr variant=sr-ec
17563 !! wikitext
17564 == -{Naslov}- ==
17565 !! html
17566 <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>
17568 !! end
17571 !! test
17572 Explicit definition of language variant alternatives
17573 !! options
17574 language=zh variant=zh-tw
17575 !! wikitext
17576 -{zh:China;zh-tw:Taiwan}-, not China
17577 !! html
17578 <p>Taiwan, not China
17579 </p>
17580 !! end
17583 !! test
17584 Conversion around HTML tags
17585 !! options
17586 language=sr variant=sr-ec
17587 !! wikitext
17588 -{H|span=>sr-ec:script;title=>sr-ec:src;}-
17589 <span title="La-{sr-el:L;sr-ec:C;}-tin">ski</span>
17590 !! html
17592 <span title="ЛаCтин">ски</span>
17593 </p>
17594 !! end
17597 !! test
17598 Explicit session-wise language variant mapping (A flag and - flag)
17599 !! options
17600 language=zh variant=zh-tw
17601 !! wikitext
17602 Taiwan is not China.
17603 But -{A|zh:China;zh-tw:Taiwan}- is China,
17604 (This-{-|zh:China;zh-tw:Taiwan}- should be stripped!)
17605 and -{China}- is China.
17606 !! html
17607 <p>Taiwan is not China.
17608 But Taiwan is Taiwan,
17609 (This should be stripped!)
17610 and China is China.
17611 </p>
17612 !! end
17614 !! test
17615 Explicit session-wise language variant mapping (H flag for hide)
17616 !! options
17617 language=zh variant=zh-tw
17618 !! wikitext
17619 (This-{H|zh:China;zh-tw:Taiwan}- should be stripped!)
17620 Taiwan is China.
17621 !! html
17622 <p>(This should be stripped!)
17623 Taiwan is Taiwan.
17624 </p>
17625 !! end
17627 !! test
17628 Adding explicit conversion rule for title (T flag)
17629 !! options
17630 language=zh variant=zh-tw showtitle
17631 !! wikitext
17632 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
17633 !! html
17634 Taiwan
17635 <p>Should be stripped!
17636 </p>
17637 !! end
17639 !! test
17640 Testing that changing the language variant here in the tests actually works
17641 !! options
17642 language=zh variant=zh showtitle
17643 !! wikitext
17644 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
17645 !! html
17646 China
17647 <p>Should be stripped!
17648 </p>
17649 !! end
17651 !! test
17652 Recursive conversion of alt and title attrs shouldn't clear converter state
17653 !! options
17654 language=zh variant=zh-cn showtitle
17655 !! wikitext
17656 -{H|zh-cn:Exclamation;zh-tw:exclamation;}-
17657 Should be stripped-{T|zh-cn:China;zh-tw:Taiwan}-<span title="exclamation">!</span>
17658 !! html
17659 China
17661 Should be stripped<span title="Exclamation">!</span>
17662 </p>
17663 !! end
17665 !! test
17666 Bug 24072: more test on conversion rule for title
17667 !! options
17668 language=zh variant=zh-tw showtitle
17669 !! wikitext
17670 This should be stripped-{T|zh:China;zh-tw:Taiwan}-!
17671 This won't take interferes with the title rule-{H|zh:Beijing;zh-tw:Taipei}-.
17672 !! html
17673 Taiwan
17674 <p>This should be stripped!
17675 This won't take interferes with the title rule.
17676 </p>
17677 !! end
17679 !! test
17680 Partly disable title conversion if variant == main language code
17681 !! options
17682 language=zh variant=zh title=[[ZH]] showtitle
17683 !! wikitext
17684 -{T|zh-cn:CN;zh-tw:TW}-
17685 !! html
17688 </p>
17689 !! end
17691 !! test
17692 Partly disable title conversion if variant == main language code, more
17693 !! options
17694 language=zh variant=zh title=[[ZH]] showtitle
17695 !! wikitext
17696 -{T|TW}-
17697 !! html
17700 </p>
17701 !! end
17703 !! test
17704 Raw output of variant escape tags (R flag)
17705 !! options
17706 language=zh variant=zh-tw
17707 !! wikitext
17708 Raw: -{R|zh:China;zh-tw:Taiwan}-
17709 !! html
17710 <p>Raw: zh:China;zh-tw:Taiwan
17711 </p>
17712 !! end
17714 !! test
17715 Nested using of manual convert syntax
17716 !! options
17717 language=zh variant=zh-hk
17718 !! wikitext
17719 Nested: -{zh-hans:Hi -{zh-cn:China;zh-sg:Singapore;}-;zh-hant:Hello -{zh-tw:Taiwan;zh-hk:H-{ong}- K-{}-ong;}-;}-!
17720 !! html
17721 <p>Nested: Hello Hong Kong!
17722 </p>
17723 !! end
17725 !! test
17726 Proper conversion of text in external links
17727 !! options
17728 language=sr variant=sr-ec
17729 !! wikitext
17730 http://www.google.com
17731 gopher://www.google.com
17732 [http://www.google.com http://www.google.com]
17733 [gopher://www.google.com gopher://www.google.com]
17734 [https://www.google.com irc://www.google.com]
17735 [ftp://www.google.com www.google.com/ftp://dir]
17736 [//www.google.com www.google.com]
17737 !! html
17738 <p><a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
17739 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
17740 <a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
17741 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
17742 <a rel="nofollow" class="external text" href="https://www.google.com">irc://www.google.com</a>
17743 <a rel="nofollow" class="external text" href="ftp://www.google.com">www.гоогле.цом/фтп://дир</a>
17744 <a rel="nofollow" class="external text" href="//www.google.com">www.гоогле.цом</a>
17745 </p>
17746 !! end
17748 !! test
17749 Do not convert roman numbers to language variants
17750 !! options
17751 language=sr variant=sr-ec
17752 !! wikitext
17753 Fridrih IV je car.
17754 !! html
17755 <p>Фридрих IV је цар.
17756 </p>
17757 !! end
17759 !! test
17760 Unclosed language converter markup "-{"
17761 !! options
17762 language=sr
17763 !! wikitext
17764 -{T|hello
17765 !! html
17766 <p>-{T|hello
17767 </p>
17768 !! end
17770 !! test
17771 Don't convert raw rule "-{R|=&gt;}-" to "=>"
17772 !! options
17773 language=sr
17774 !! wikitext
17775 -{R|=&gt;}-
17776 !! html
17777 <p>=&gt;
17778 </p>
17779 !!end
17781 !! test
17782 Don't break link parsing if language converter markup is in the caption.
17783 !! options
17784 language=sr variant=sr-ec
17785 !! wikitext
17786 [[Main Page|-{R|main page}-]]
17787 !! html
17788 <p><a href="/wiki/Main_Page" title="Маин Паге">main page</a>
17789 </p>
17790 !! end
17792 # FIXME: This test is currently broken in the PHP parser (bug 52661)
17793 !! test
17794 Don't break image parsing if language converter markup is in the caption.
17795 !! options
17796 language=sr
17797 !! wikitext
17798 [[File:Foobar.jpg|-{R|caption}-]]
17799 !! html/parsoid
17800 <p><a href="/wiki/File:Foobar.jpg" class="image" title="caption"><img alt="caption" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
17801 </p>
17802 !! end
17804 # FIXME: This test is currently broken in the PHP parser (bug 52661)
17805 !! test
17806 Don't break list handling if language converter markup is in the item.
17807 !! options
17808 language=zh variant=zh-cn
17809 !! wikitext
17810 ;-{zh-cn:AAA;zh-tw:BBB}-
17811 !! html/php
17812 <dl><dt><span class="error">在手动语言转换规则中检测到错误</span></dd></dl>
17814 !! html/parsoid
17815 <dl><dt>AAA
17816 </dt></dl>
17817 !! end
17819 # FIXME: This test is currently broken in the PHP parser (bug 52661)
17820 !! test
17821 Don't break table handling if language converter markup is in the cell.
17822 !! options
17823 language=sr variant=sr-ec
17824 !! wikitext
17827 | -{R|B}-
17829 !! html/php
17830 <table>
17832 <tr>
17833 <td>Б}-
17834 </td></tr></table>
17836 !! html/parsoid
17837 <table>
17839 <tr>
17840 <td> B
17841 </td></tr></table>
17843 !! end
17845 !! test
17846 Bug 529: Uncovered bullet
17847 !! wikitext
17848 * Foo {{bullet}}
17849 !! html
17850 <ul><li> Foo </li>
17851 <li> Bar</li></ul>
17853 !! end
17855 # Plain MediaWiki does not remove empty lists, but tidy actually does.
17856 # Templates in Wikipedia rely on this behavior, as tidy has always been
17857 # enabled there. These tests are normally run *without* tidy, so specify the
17858 # full output here. 
17859 # To test realistic parsing behavior, apply a tidy-like transformation to both
17860 # the expected output and your parser's output.
17861 !! test
17862 Bug 529: Uncovered bullet leaving empty list, normally removed by tidy
17863 !! wikitext
17864 ******* Foo {{bullet}}
17865 !! html
17866 <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>
17867 <li> Bar</li></ul>
17869 !! end
17871 !! test
17872 Bug 529: Uncovered table already at line-start
17873 !! wikitext
17876 {{table}}
17878 !! html
17879 <p>x
17880 </p>
17881 <table>
17882 <tr>
17883 <td> 1 </td>
17884 <td> 2
17885 </td></tr>
17886 <tr>
17887 <td> 3 </td>
17888 <td> 4
17889 </td></tr></table>
17890 <p>y
17891 </p>
17892 !! end
17894 !! test
17895 Bug 529: Uncovered bullet in parser function result
17896 !! wikitext
17897 * Foo {{lc:{{bullet}} }}
17898 !! html
17899 <ul><li> Foo </li>
17900 <li> bar</li></ul>
17902 !! end
17904 !! test
17905 Bug 5678: Double-parsed template argument
17906 !! wikitext
17907 {{lc:{{{1}}}|hello}}
17908 !! html
17909 <p>{{{1}}}
17910 </p>
17911 !! end
17913 !! test
17914 Bug 5678: Double-parsed template invocation
17915 !! wikitext
17916 {{lc:{{paramtest {{!}} param = hello }} }}
17917 !! html
17918 <p>{{paramtest | param = hello }}
17919 </p>
17920 !! end
17922 !! test
17923 Case insensitivity of parser functions for non-ASCII characters (bug 8143)
17924 !! options
17925 language=cs
17926 title=[[Main Page]]
17927 !! wikitext
17928 {{PRVNÍVELKÉ:ěščř}}
17929 {{prvnívelké:ěščř}}
17930 {{PRVNÍMALÉ:ěščř}}
17931 {{prvnímalé:ěščř}}
17932 {{MALÁ:ěščř}}
17933 {{malá:ěščř}}
17934 {{VELKÁ:ěščř}}
17935 {{velká:ěščř}}
17936 !! html
17937 <p>Ěščř
17938 Ěščř
17939 ěščř
17940 ěščř
17941 ěščř
17942 ěščř
17943 ĚŠČŘ
17944 ĚŠČŘ
17945 </p>
17946 !! end
17948 !! test
17949 Morwen/13: Unclosed link followed by heading
17950 !! wikitext
17951 [[link
17952 ==heading==
17953 !! html
17954 <p>[[link
17955 </p>
17956 <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>
17958 !! end
17960 !! test
17961 HHP2.1: Heuristics for headings in preprocessor parenthetical structures
17962 !! wikitext
17963 {{foo|
17964 =heading=
17965 !! html
17966 <p>{{foo|
17967 </p>
17968 <h1><span class="mw-headline" id="heading">heading</span></h1>
17970 !! end
17972 !! test
17973 HHP2.2: Heuristics for headings in preprocessor parenthetical structures
17974 !! wikitext
17975 {{foo|
17976 ==heading==
17977 !! html
17978 <p>{{foo|
17979 </p>
17980 <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>
17982 !! end
17984 !! test
17985 Tildes in comments
17986 !! options
17988 !! wikitext
17989 <!-- ~~~~ -->
17990 !! html
17991 <!-- ~~~~ -->
17992 !! end
17994 !! test
17995 Paragraphs inside divs (no extra line breaks)
17996 !! wikitext
17997 <div>Line one
17999 Line two</div>
18000 !! html
18001 <div>Line one
18002 Line two</div>
18004 !! end
18006 !! test
18007 Paragraphs inside divs (extra line break on open)
18008 !! wikitext
18009 <div>
18010 Line one
18012 Line two</div>
18013 !! html
18014 <div>
18015 <p>Line one
18016 </p>
18017 Line two</div>
18019 !! end
18021 !! test
18022 Paragraphs inside divs (extra line break on close)
18023 !! wikitext
18024 <div>Line one
18026 Line two
18027 </div>
18028 !! html
18029 <div>Line one
18030 <p>Line two
18031 </p>
18032 </div>
18034 !! end
18036 !! test
18037 Paragraphs inside divs (extra line break on open and close)
18038 !! wikitext
18039 <div>
18040 Line one
18042 Line two
18043 </div>
18044 !! html
18045 <div>
18046 <p>Line one
18047 </p><p>Line two
18048 </p>
18049 </div>
18051 !! end
18053 !! test
18054 Nesting tags, paragraphs on lines which begin with <div>
18055 !! wikitext
18056 <div></div><strong>A
18057 B</strong>
18058 !! html/php+tidy
18059 <p><strong>A</strong></p>
18060 <p><strong>B</strong></p>
18061 !! html/parsoid
18062 <div></div>
18063 <p><strong>A
18064 B</strong>
18065 </p>
18066 !! end
18068 # Bug 6200: <blockquote> should behave like <div> with respect to line breaks
18069 !! test
18070 Bug 6200: paragraphs inside blockquotes (no extra line breaks)
18071 !! wikitext
18072 <blockquote>Line one
18074 Line two</blockquote>
18075 !! html
18076 <blockquote>Line one
18077 Line two</blockquote>
18079 !! html+tidy
18080 <blockquote>
18081 <p>Line one Line two</p>
18082 </blockquote>
18083 !! end
18085 !! test
18086 Bug 6200: paragraphs inside blockquotes (extra line break on open)
18087 !! wikitext
18088 <blockquote>
18089 Line one
18091 Line two</blockquote>
18092 !! html
18093 <blockquote>
18094 <p>Line one
18095 </p>
18096 Line two</blockquote>
18098 !! html+tidy
18099 <blockquote>
18100 <p>Line one</p>
18101 Line two</blockquote>
18102 !! end
18104 !! test
18105 Bug 6200: paragraphs inside blockquotes (extra line break on close)
18106 !! wikitext
18107 <blockquote>Line one
18109 Line two
18110 </blockquote>
18111 !! html
18112 <blockquote>Line one
18113 <p>Line two
18114 </p>
18115 </blockquote>
18117 !! html+tidy
18118 <blockquote>
18119 <p>Line one</p>
18120 <p>Line two</p>
18121 </blockquote>
18122 !! end
18124 !! test
18125 Bug 6200: paragraphs inside blockquotes (extra line break on open and close)
18126 !! wikitext
18127 <blockquote>
18128 Line one
18130 Line two
18131 </blockquote>
18132 !! html
18133 <blockquote>
18134 <p>Line one
18135 </p><p>Line two
18136 </p>
18137 </blockquote>
18139 !! html+tidy
18140 <blockquote>
18141 <p>Line one</p>
18142 <p>Line two</p>
18143 </blockquote>
18144 !! end
18146 !! test
18147 Paragraphs inside blockquotes/divs (no extra line breaks)
18148 !! wikitext
18149 <blockquote><div>Line one
18151 Line two</div></blockquote>
18152 !! html
18153 <blockquote><div>Line one
18154 Line two</div></blockquote>
18156 !! end
18158 !! test
18159 Paragraphs inside blockquotes/divs (extra line break on open)
18160 !! wikitext
18161 <blockquote><div>
18162 Line one
18164 Line two</div></blockquote>
18165 !! html
18166 <blockquote><div>
18167 <p>Line one
18168 </p>
18169 Line two</div></blockquote>
18171 !! end
18173 !! test
18174 Paragraphs inside blockquotes/divs (extra line break on close)
18175 !! wikitext
18176 <blockquote><div>Line one
18178 Line two
18179 </div></blockquote>
18180 !! html
18181 <blockquote><div>Line one
18182 <p>Line two
18183 </p>
18184 </div></blockquote>
18186 !! end
18188 !! test
18189 Paragraphs inside blockquotes/divs (extra line break on open and close)
18190 !! wikitext
18191 <blockquote><div>
18192 Line one
18194 Line two
18195 </div></blockquote>
18196 !! html
18197 <blockquote><div>
18198 <p>Line one
18199 </p><p>Line two
18200 </p>
18201 </div></blockquote>
18203 !! end
18205 !! test
18206 Interwiki links trounced by replaceExternalLinks after early LinkHolderArray expansion
18207 !! options
18208 wgLinkHolderBatchSize=0
18209 !! wikitext
18210 [[meatball:1]]
18211 [[meatball:2]]
18212 [[meatball:3]]
18213 !! html
18214 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?1" class="extiw" title="meatball:1">meatball:1</a>
18215 <a href="http://www.usemod.com/cgi-bin/mb.pl?2" class="extiw" title="meatball:2">meatball:2</a>
18216 <a href="http://www.usemod.com/cgi-bin/mb.pl?3" class="extiw" title="meatball:3">meatball:3</a>
18217 </p>
18218 !! end
18220 !! test
18221 Free external link invading image caption
18222 !! wikitext
18223 [[Image:Foobar.jpg|thumb|http://x|hello]]
18224 !! html
18225 <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>
18227 !! end
18229 !! test
18230 Bug 15196: localised external link numbers
18231 !! options
18232 language=fa
18233 !! wikitext
18234 [http://en.wikipedia.org/]
18235 !! html/php
18236 <p><a rel="nofollow" class="external autonumber" href="http://en.wikipedia.org/">[۱]</a>
18237 </p>
18238 !! html/parsoid
18239 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/"></a></p>
18240 !! end
18242 !! test
18243 Multibyte character in padleft
18244 !! wikitext
18245 {{padleft:-Hello|7|Æ}}
18246 !! html
18247 <p>Æ-Hello
18248 </p>
18249 !! end
18251 !! test
18252 Multibyte character in padright
18253 !! wikitext
18254 {{padright:Hello-|7|Æ}}
18255 !! html
18256 <p>Hello-Æ
18257 </p>
18258 !! end
18260 !!test
18261 formatdate parser function
18262 !! wikitext
18263 {{#formatdate:2009-03-24}}
18264 !! html
18265 <p><span class="mw-formatted-date" title="2009-03-24">2009-03-24</span>
18266 </p>
18267 !! end
18269 !!test
18270 formatdate parser function, with default format
18271 !! wikitext
18272 {{#formatdate:2009-03-24|mdy}}
18273 !! html
18274 <p><span class="mw-formatted-date" title="2009-03-24">March 24, 2009</span>
18275 </p>
18276 !! end
18278 !! test
18279 Spacing of numbers in formatted dates
18280 !! wikitext
18281 {{#formatdate:January 15}}
18282 !! html
18283 <p><span class="mw-formatted-date" title="01-15">January 15</span>
18284 </p>
18285 !! end
18287 !! test
18288 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
18289 !! options
18290 language=nl title=[[MediaWiki:Common.css]]
18291 !! wikitext
18292 {{#formatdate:2009-03-24|dmy}}
18293 !! html
18294 <p><span class="mw-formatted-date" title="2009-03-24">24 March 2009</span>
18295 </p>
18296 !! end
18303 # Edit comments
18306 !! test
18307 Edit comment with link
18308 !! options
18309 comment
18310 !! wikitext
18311 I like the [[Main Page]] a lot
18312 !! html
18313 I like the <a href="/wiki/Main_Page" title="Main Page">Main Page</a> a lot
18314 !!end
18316 !! test
18317 Edit comment with link and link text
18318 !! options
18319 comment
18320 !! wikitext
18321 I like the [[Main Page|best pages]] a lot
18322 !! html
18323 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
18324 !!end
18326 !! test
18327 Edit comment with link and link text with suffix
18328 !! options
18329 comment
18330 !! wikitext
18331 I like the [[Main Page|best page]]s a lot
18332 !! html
18333 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
18334 !!end
18336 !! test
18337 Edit comment with section link (non-local, eg in history list)
18338 !! options
18339 comment title=[[Main Page]]
18340 !! wikitext
18341 /* External links */ removed bogus entries
18342 !! html
18343 <a href="/wiki/Main_Page#External_links" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
18344 !!end
18346 !! test
18347 Edit comment with section link and text before it (non-local, eg in history list)
18348 !! options
18349 comment title=[[Main Page]]
18350 !! wikitext
18351 pre-comment text /* External links */ removed bogus entries
18352 !! html
18353 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>
18354 !!end
18356 !! test
18357 Edit comment with section link (local, eg in diff view)
18358 !! options
18359 comment local title=[[Main Page]]
18360 !! wikitext
18361 /* External links */ removed bogus entries
18362 !! html
18363 <a href="#External_links">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
18364 !!end
18366 !! test
18367 Edit comment with subpage link (bug 14080)
18368 !! options
18369 comment
18370 subpage
18371 title=[[Subpage test]]
18372 !! wikitext
18373 Poked at a [[/subpage]] here...
18374 !! html
18375 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a> here...
18376 !!end
18378 !! test
18379 Edit comment with subpage link and link text (bug 14080)
18380 !! options
18381 comment
18382 subpage
18383 title=[[Subpage test]]
18384 !! wikitext
18385 Poked at a [[/subpage|neat little page]] here...
18386 !! html
18387 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">neat little page</a> here...
18388 !!end
18390 !! test
18391 Edit comment with bogus subpage link in non-subpage NS (bug 14080)
18392 !! options
18393 comment
18394 title=[[Subpage test]]
18395 !! wikitext
18396 Poked at a [[/subpage]] here...
18397 !! html
18398 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...
18399 !!end
18401 !! test
18402 Edit comment with bare anchor link (local, as on diff)
18403 !! options
18404 comment
18405 local
18406 title=[[Main Page]]
18407 !! wikitext
18408 [[#section]]
18409 !! html
18410 <a href="#section">#section</a>
18411 !! end
18413 !! test
18414 Edit comment with bare anchor link (non-local, as on history)
18415 !! options
18416 comment
18417 title=[[Main Page]]
18418 !! wikitext
18419 [[#section]]
18420 !! html
18421 <a href="/wiki/Main_Page#section" title="Main Page">#section</a>
18422 !! end
18424 !! test
18425 Anchor starting with underscore
18426 !! wikitext
18427 [[#_ref|One]]
18428 !! html
18429 <p><a href="#_ref">One</a>
18430 </p>
18431 !! end
18433 !! test
18434 Id starting with underscore
18435 !! wikitext
18436 <div id="_ref"></div>
18437 !! html
18438 <div id="_ref"></div>
18440 !! end
18442 !! test
18443 Space normalisation on autocomment (bug 22784)
18444 !! options
18445 comment
18446 title=[[Main Page]]
18447 !! wikitext
18448 /* __hello__world__ */
18449 !! html
18450 <a href="/wiki/Main_Page#hello_world" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">__hello__world__</span></span>
18451 !! end
18453 !! test
18454 percent-encoding and + signs in comments (Bug 26410)
18455 !! options
18456 comment
18457 !! wikitext
18458 [[ABC%33D% ++]] [[ABC%33D% ++|+%20]]
18459 !! html
18460 <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>
18461 !! end
18463 # Parsoid doesn't support this yet: see bug 73581
18464 # but it *should* omit the 'src' attribute if the image is bad.
18465 # PHP side of tests was disabled in
18466 # mediawiki/core:6bd31e7d95161a6e88fa86df60871051da997c3c
18467 # because of issues in the PHP parserTests infrastructure
18468 # (but the output below is indeed what the PHP side emits)
18469 !! test
18470 Bad images - basic functionality
18471 !! wikitext
18472 [[File:Bad.jpg]]
18473 !! DISABLED/html/php
18474 !! html/parsoid
18475 <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>
18476 !! end
18478 !! test
18479 Bad images - bug 16039: text after bad image disappears
18480 !! wikitext
18481 Foo bar
18482 [[File:Bad.jpg]]
18483 Bar foo
18484 !! DISABLED/html/php
18485 <p>Foo bar
18486 </p><p>Bar foo
18487 </p>
18488 !! html/parsoid
18489 <p>Foo bar
18490 <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>
18491 Bar foo</p>
18492 !! end
18494 !! test
18495 Verify that displaytitle works (bug #22501) no displaytitle
18496 !! options
18497 showtitle
18498 !! config
18499 wgAllowDisplayTitle=true
18500 wgRestrictDisplayTitle=false
18501 !! wikitext
18502 this is not the the title
18503 !! html
18504 Parser test
18505 <p>this is not the the title
18506 </p>
18507 !! end
18509 !! test
18510 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=false
18511 !! options
18512 showtitle
18513 title=[[Screen]]
18514 !! config
18515 wgAllowDisplayTitle=true
18516 wgRestrictDisplayTitle=false
18517 !! wikitext
18518 this is not the the title
18519 {{DISPLAYTITLE:whatever}}
18520 !! html
18521 whatever
18522 <p>this is not the the title
18523 </p>
18524 !! end
18526 !! test
18527 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true mismatch
18528 !! options
18529 showtitle
18530 title=[[Screen]]
18531 !! config
18532 wgAllowDisplayTitle=true
18533 wgRestrictDisplayTitle=true
18534 !! wikitext
18535 this is not the the title
18536 {{DISPLAYTITLE:whatever}}
18537 !! html
18538 Screen
18539 <p>this is not the the title
18540 </p>
18541 !! end
18543 !! test
18544 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true matching
18545 !! options
18546 showtitle
18547 title=[[Screen]]
18548 !! config
18549 wgAllowDisplayTitle=true
18550 wgRestrictDisplayTitle=true
18551 !! wikitext
18552 this is not the the title
18553 {{DISPLAYTITLE:screen}}
18554 !! html
18555 screen
18556 <p>this is not the the title
18557 </p>
18558 !! end
18560 !! test
18561 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false
18562 !! options
18563 showtitle
18564 title=[[Screen]]
18565 !! config
18566 wgAllowDisplayTitle=false
18567 !! wikitext
18568 this is not the the title
18569 {{DISPLAYTITLE:screen}}
18570 !! html
18571 Screen
18572 <p>this is not the the title
18573 <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>
18574 </p>
18575 !! end
18577 !! test
18578 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false no DISPLAYTITLE
18579 !! options
18580 showtitle
18581 title=[[Screen]]
18582 !! config
18583 wgAllowDisplayTitle=false
18584 !! wikitext
18585 this is not the the title
18586 !! html
18587 Screen
18588 <p>this is not the the title
18589 </p>
18590 !! end
18592 !! test
18593 Verify that displaytitle handles inline CSS styles (bug 26547) - rejected value
18594 !! options
18595 showtitle
18596 title=[[Screen]]
18597 !! config
18598 wgAllowDisplayTitle=true
18599 wgRestrictDisplayTitle=true
18600 !! wikitext
18601 this is not the the title
18602 {{DISPLAYTITLE:<span style="display: none;">s</span>creen}}
18603 !! html
18604 <span style="/* attempt to bypass $wgRestrictDisplayTitle */">s</span>creen
18605 <p>this is not the the title
18606 </p>
18607 !! end
18609 !! test
18610 Verify that displaytitle handles inline CSS styles (bug 26547) - accepted value
18611 !! options
18612 showtitle
18613 title=[[Screen]]
18614 !! config
18615 wgAllowDisplayTitle=true
18616 wgRestrictDisplayTitle=true
18617 !! wikitext
18618 this is not the the title
18619 {{DISPLAYTITLE:<span style="color: red;">s</span>creen}}
18620 !! html
18621 <span style="color: red;">s</span>creen
18622 <p>this is not the the title
18623 </p>
18624 !! end
18626 !! test
18627 preload: check <noinclude> and <includeonly>
18628 !! options
18629 preload
18630 !! wikitext
18631 Hello <noinclude>cruel</noinclude><includeonly>kind</includeonly> world.
18632 !! html
18633 Hello kind world.
18634 !! end
18636 !! test
18637 preload: check <onlyinclude>
18638 !! options
18639 preload
18640 !! wikitext
18641 Goodbye <onlyinclude>Hello world</onlyinclude>
18642 !! html
18643 Hello world
18644 !! end
18646 !! test
18647 preload: can pass tags through if we want to
18648 !! options
18649 preload
18650 !! wikitext
18651 <includeonly><</includeonly>includeonly>Hello world<includeonly><</includeonly>/includeonly>
18652 !! html
18653 <includeonly>Hello world</includeonly>
18654 !! end
18656 !! test
18657 preload: check that it doesn't try to do tricks
18658 !! options
18659 preload
18660 !! wikitext
18661 * <!-- Hello --> ''{{world}}'' {{<includeonly>subst:</includeonly>How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
18662 !! html
18663 * <!-- Hello --> ''{{world}}'' {{subst:How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
18664 !! end
18666 !! test
18667 Play a bit with r67090 and bug 3158
18668 !! wikitext
18669 <div style="width:50% !important">&nbsp;</div>
18670 <div style="width:50%&nbsp;!important">&nbsp;</div>
18671 <div style="width:50%&#160;!important">&nbsp;</div>
18672 <div style="border : solid;">&nbsp;</div>
18673 !! html/php
18674 <div style="width:50% !important">&#160;</div>
18675 <div style="width:50% !important">&#160;</div>
18676 <div style="width:50% !important">&#160;</div>
18677 <div style="border&#160;: solid;">&#160;</div>
18679 !! html/parsoid
18680 <div style="width:50% !important" data-parsoid='{"stx":"html"}'><span typeof="mw:Entity" data-parsoid='{"src":"&amp;nbsp;","srcContent":" "}'> </span></div>
18681 <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='{"src":"&amp;nbsp;","srcContent":" "}'> </span></div>
18682 <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='{"src":"&amp;nbsp;","srcContent":" "}'> </span></div>
18683 <div style="border : solid;" data-parsoid='{"stx":"html"}'><span typeof="mw:Entity" data-parsoid='{"src":"&amp;nbsp;","srcContent":" "}'> </span></div>
18685 !! end
18687 !! test
18688 HTML5 data attributes
18689 !! wikitext
18690 <span data-foo="bar">Baz</span>
18691 <p data-abc-def_hij="">Quuz</p>
18692 !! html
18693 <p><span data-foo="bar">Baz</span>
18694 </p>
18695 <p data-abc-def_hij="">Quuz</p>
18697 !! end
18699 !! test
18700 percent-encoding and + signs in internal links (Bug 26410)
18701 !! wikitext
18702 [[User:+%]] [[Page+title%]]
18703 [[%+]] [[%+|%20]] [[%+ ]] [[%+r]]
18704 [[%]] [[+]] [[File:%+abc%39|foo|[[bar]]]]
18705 [[%33%45]] [[%33%45+]]
18706 !! html/php
18707 <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>
18708 <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>
18709 <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>
18710 <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>
18711 </p>
18712 !! html/parsoid
18713 <p><a rel="mw:WikiLink" href="User:+%" title="User:+%">User:+%</a> <a rel="mw:WikiLink" href="Page+title%" title="Page+title%">Page+title%</a> <a rel="mw:WikiLink" href="%+" title="%+">%+</a> <a rel="mw:WikiLink" href="%+" title="%+">%20</a> <a rel="mw:WikiLink" href="%+" title="%+">%+ </a> <a rel="mw:WikiLink" href="%+r" title="%+r">%+r</a> <a rel="mw:WikiLink" href="%" title="%">%</a> <a rel="mw:WikiLink" href="+" title="+">+</a> <span class="mw-default-size" typeof="mw:Error mw:Image" data-mw='{"errors":[{"key":"missing-image","message":"This image does not exist."}],"caption":"[[bar]]"}'><a href="File:%+abc9"><img resource="./File:%25+abc9" src="./Special:FilePath/%+abc9" height="220" width="220"/></a></span> <a rel="mw:WikiLink" href="3E" title="3E">3E</a> <a rel="mw:WikiLink" href="3E+" title="3E+">3E+</a></p>
18714 !! end
18716 !! test
18717 Special characters in embedded file links (bug 27679)
18718 !! wikitext
18719 [[File:Contains & ampersand.jpg]]
18720 [[File:Does not exist.jpg|Title with & ampersand]]
18721 !! html/php
18722 <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>
18723 <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>
18724 </p>
18725 !! html/parsoid
18726 <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>
18727 <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; 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>
18728 !! end
18730 !! test
18731 Confirm that 'apos' named character reference doesn't make it to output (not legal in HTML 4)
18732 !! wikitext
18733 Text&apos;s been normalized?
18734 !! html
18735 <p>Text&#39;s been normalized?
18736 </p>
18737 !! end
18739 !! test
18740 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate free external links
18741 !! wikitext
18742 http://www.example.org/ <-- U+3000 (vim: ^Vu3000)
18743 !! html
18744 <p><a rel="nofollow" class="external free" href="http://www.example.org/">http://www.example.org/</a> &lt;-- U+3000 (vim: ^Vu3000)
18745 </p>
18746 !! end
18748 !! test
18749 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate bracketed external links
18750 !! wikitext
18751 [http://www.example.org/ ideograms]
18752 !! html
18753 <p><a rel="nofollow" class="external text" href="http://www.example.org/">ideograms</a>
18754 </p>
18755 !! end
18757 !! test
18758 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate external images links
18759 !! wikitext
18760 http://www.example.org/pic.png <-- U+3000 (vim: ^Vu3000)
18761 !! html
18762 <p><img src="http://www.example.org/pic.png" alt="pic.png" /> &lt;-- U+3000 (vim: ^Vu3000)
18763 </p>
18764 !! end
18766 !! article
18767 Mediawiki:loop1
18768 !! text
18769 {{Identical|A}}
18770 !! endarticle
18772 !! article
18773 Mediawiki:loop2
18774 !! text
18775 {{Identical|B}}
18776 !! endarticle
18778 !! article
18779 Template:Identical
18780 !! text
18781 {{int:loop1}}
18782 {{int:loop2}}
18783 !! endarticle
18785 !! test
18786 Bug 31098 Template which includes system messages which includes the template
18787 !! wikitext
18788 {{Identical}}
18789 !! html
18790 <p><span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
18791 <span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
18792 </p>
18793 !! end
18795 !! test
18796 Bug31490 Turkish: ucfirst 'blah'
18797 !! options
18798 language=tr
18799 !! wikitext
18800 {{ucfirst:blah}}
18801 !! html
18802 <p>Blah
18803 </p>
18804 !! end
18806 !! test
18807 Bug31490 Turkish: ucfirst 'ix'
18808 !! options
18809 language=tr
18810 !! wikitext
18811 {{ucfirst:ix}}
18812 !! html
18813 <p>İx
18814 </p>
18815 !! end
18817 !! test
18818 Bug31490 Turkish: lcfirst 'BLAH'
18819 !! options
18820 language=tr
18821 !! wikitext
18822 {{lcfirst:BLAH}}
18823 !! html
18824 <p>bLAH
18825 </p>
18826 !! end
18828 !! test
18829 Bug31490 Turkish: ucfırst (with a dotless i)
18830 !! options
18831 language=tr
18832 !! wikitext
18833 {{ucfırst:blah}}
18834 !! html
18835 <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>
18836 </p>
18837 !! end
18839 !! test
18840 Bug31490 ucfırst (with a dotless i) with English language
18841 !! options
18842 language=en
18843 !! wikitext
18844 {{ucfırst:blah}}
18845 !! html
18846 <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>
18847 </p>
18848 !! end
18850 !! test
18851 Bug 26375: TOC with italics
18852 !! options
18853 title=[[Main Page]]
18854 !! wikitext
18855 __TOC__
18856 == ''Lost'' episodes ==
18857 !! html
18858 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
18859 <ul>
18860 <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>
18861 </ul>
18862 </div>
18864 <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>
18866 !! end
18868 !! test
18869 Bug 26375: TOC with bold
18870 !! options
18871 title=[[Main Page]]
18872 !! wikitext
18873 __TOC__
18874 == '''should be bold''' then normal text ==
18875 !! html
18876 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
18877 <ul>
18878 <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>
18879 </ul>
18880 </div>
18882 <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>
18884 !! end
18886 !! test
18887 Bug 33845: Headings become cursive in TOC when they contain an image
18888 !! options
18889 title=[[Main Page]]
18890 !! wikitext
18891 __TOC__
18892 == Image [[Image:foobar.jpg]] ==
18893 !! html
18894 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
18895 <ul>
18896 <li class="toclevel-1 tocsection-1"><a href="#Image"><span class="tocnumber">1</span> <span class="toctext">Image</span></a></li>
18897 </ul>
18898 </div>
18900 <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>
18902 !! end
18904 !! test
18905 Bug 33845 (2): Headings become bold in TOC when they contain a blockquote
18906 !! options
18907 title=[[Main Page]]
18908 !! wikitext
18909 __TOC__
18910 == <blockquote>Quote</blockquote> ==
18911 !! html
18912 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
18913 <ul>
18914 <li class="toclevel-1 tocsection-1"><a href="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
18915 </ul>
18916 </div>
18918 <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>
18920 !! html+tidy
18921 <div id="toc" class="toc">
18922 <div id="toctitle">
18923 <h2>Contents</h2>
18924 </div>
18925 <ul>
18926 <li class="toclevel-1 tocsection-1"><a href="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
18927 </ul>
18928 </div>
18929 <h2><span class="mw-headline" id="Quote"></span></h2>
18930 <blockquote>
18931 <p><span class="mw-headline" id="Quote">Quote</span></p>
18932 </blockquote>
18933 <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>
18934 !! end
18936 !! test
18937 Unclosed tags in TOC
18938 !! options
18939 title=[[Main Page]]
18940 !! wikitext
18941 __TOC__
18942 == Proof: 2 < 3 ==
18943 <small>Hanc marginis exiguitas non caperet.</small>
18945 !! html
18946 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
18947 <ul>
18948 <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>
18949 </ul>
18950 </div>
18952 <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>
18953 <p><small>Hanc marginis exiguitas non caperet.</small>
18955 </p>
18956 !! end
18958 !! test
18959 Multiple tags in TOC
18960 !! wikitext
18961 __TOC__
18962 == <i>Foo</i> <b>Bar</b> ==
18964 == <i>Foo</i> <blockquote>Bar</blockquote> ==
18965 !! html
18966 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
18967 <ul>
18968 <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>
18969 <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>
18970 </ul>
18971 </div>
18973 <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>
18974 <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>
18976 !! html+tidy
18977 <div id="toc" class="toc">
18978 <div id="toctitle">
18979 <h2>Contents</h2>
18980 </div>
18981 <ul>
18982 <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>
18983 <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>
18984 </ul>
18985 </div>
18986 <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>
18987 <h2><span class="mw-headline" id="Foo_Bar_2"><i>Foo</i></span></h2>
18988 <blockquote>
18989 <p><span class="mw-headline" id="Foo_Bar_2">Bar</span></p>
18990 </blockquote>
18991 <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>
18992 !! end
18994 !! test
18995 Tags with parameters in TOC
18996 !! wikitext
18997 __TOC__
18998 == <sup class="in-h2">Hello</sup> ==
19000 == <sup class="a > b">Evilbye</sup> ==
19001 !! html
19002 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
19003 <ul>
19004 <li class="toclevel-1 tocsection-1"><a href="#Hello"><span class="tocnumber">1</span> <span class="toctext"><sup>Hello</sup></span></a></li>
19005 <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>
19006 </ul>
19007 </div>
19009 <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>
19010 <h2><span class="mw-headline" id="b.22.3EEvilbye"><sup> b"&gt;Evilbye</sup></span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: b&quot;>Evilbye">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
19012 !! end
19014 !! test
19015 span tags with directionality in TOC
19016 !! wikitext
19017 __TOC__
19018 == <span dir="ltr">C++</span> ==
19020 == <span dir="rtl">זבנג!</span> ==
19022 == <span style="font-style: italic">The attributes on these span tags must be deleted from the TOC</span> ==
19024 == <span style="font-style: italic" dir="ltr">All attributes on these span tags must be deleted from the TOC</span> ==
19026 == <span dir="ltr" style="font-style: italic">Attributes after dir on these span tags must be deleted from the TOC</span> ==
19027 !! html
19028 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
19029 <ul>
19030 <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>
19031 <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>
19032 <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>
19033 <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>
19034 <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>
19035 </ul>
19036 </div>
19038 <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>
19039 <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>
19040 <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>
19041 <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>
19042 <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>
19044 !! end
19046 !! test
19047 Bug 72884: bdi element in ToC
19048 !! wikitext
19049 __TOC__
19050 == <bdi>test</bdi> ==
19051 !! html
19052 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
19053 <ul>
19054 <li class="toclevel-1 tocsection-1"><a href="#test"><span class="tocnumber">1</span> <span class="toctext"><bdi>test</bdi></span></a></li>
19055 </ul>
19056 </div>
19058 <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>
19060 !! end
19062 !! article
19063 MediaWiki:Bug32057
19064 !! text
19065 == {{int:headline_sample}} ==
19066 !! endarticle
19068 !! test
19069 Bug 32057: Title needed when expanding <h> nodes.
19070 !! options
19071 title=[[Main Page]]
19072 !! wikitext
19073 {{int:Bug32057}}
19074 !! html
19075 <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>
19077 !! end
19079 !! test
19080 Strip marker in urlencode
19081 !! wikitext
19082 {{urlencode:x<nowiki/>y}}
19083 {{urlencode:x<nowiki/>y|wiki}}
19084 {{urlencode:x<nowiki/>y|path}}
19085 !! html
19086 <p>xy
19089 </p>
19090 !! end
19092 !! test
19093 Strip marker in lc
19094 !! wikitext
19095 {{lc:x<nowiki/>y}}
19096 !! html
19097 <p>xy
19098 </p>
19099 !! end
19101 !! test
19102 Strip marker in uc
19103 !! wikitext
19104 {{uc:x<nowiki/>y}}
19105 !! html
19106 <p>XY
19107 </p>
19108 !! end
19110 !! test
19111 Strip marker in formatNum
19112 !! wikitext
19113 {{formatnum:1<nowiki/>2}}
19114 {{formatnum:1<nowiki/>2|R}}
19115 !! html
19116 <p>12
19118 </p>
19119 !! end
19121 !! test
19122 Check noCommafy in formatNum
19123 !! options
19124 language=be-tarask
19125 !! wikitext
19126 {{formatnum:123456.78}}
19127 {{formatnum:123456.78|NOSEP}}
19128 !! html
19129 <p>123 456,78
19130 123456.78
19131 </p>
19132 !! end
19134 !! test
19135 Wrong option for formatNum (bug 56199)
19136 !! wikitext
19137 {{formatnum:1,234.56|Random}}
19138 {{formatnum:1,234.56|EVERYTHING}}
19139 {{formatnum:1234.56|any argument that has the string 'NOSEP'}}
19140 !! html
19141 <p>1,234.56
19142 1,234.56
19143 1,234.56
19144 </p>
19145 !! end
19147 !! test
19148 Strip marker in grammar
19149 !! options
19150 language=fi
19151 !! wikitext
19152 {{grammar:elative|foo<nowiki/>bar}}
19153 !! html
19154 <p>foobarista
19155 </p>
19156 !! end
19158 !! test
19159 Strip marker in padleft
19160 !! wikitext
19161 {{padleft:|2|x<nowiki/>y}}
19162 !! html
19163 <p>xy
19164 </p>
19165 !! end
19167 !! test
19168 Strip marker in padright
19169 !! wikitext
19170 {{padright:|2|x<nowiki/>y}}
19171 !! html
19172 <p>xy
19173 </p>
19174 !! end
19176 !! test
19177 Strip marker in anchorencode
19178 !! wikitext
19179 {{anchorencode:x<nowiki/>y}}
19180 !! html
19181 <p>xy
19182 </p>
19183 !! end
19185 !! test
19186 nowiki inside link inside heading (bug 18295)
19187 !! wikitext
19188 ==[[foo|x<nowiki>y</nowiki>z]]==
19189 !! html
19190 <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>
19192 !! end
19194 !! test
19195 new support for bdi element (bug 31817)
19196 !! wikitext
19197 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
19198 !! html
19199 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
19201 !!end
19203 !! test
19204 Ignore pipe between table row attributes
19205 !! wikitext
19207 | quux
19208 |- id=foo | style='color: red'
19209 | bar
19211 !! html
19212 <table>
19213 <tr>
19214 <td> quux
19215 </td></tr>
19216 <tr id="foo" style="color: red">
19217 <td> bar
19218 </td></tr></table>
19220 !! end
19222 !!test
19223 Gallery override link with WikiLink (bug 34852)
19224 !! wikitext
19225 <gallery>
19226 File:foobar.jpg|caption|alt=galleryalt|link=InterWikiLink
19227 </gallery>
19228 !! html
19229 <ul class="gallery mw-gallery-traditional">
19230                 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19231                         <div class="thumb" style="width: 150px;"><div style="margin:68px auto;"><a href="/wiki/InterWikiLink"><img alt="galleryalt" src="http://example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" width="120" height="14" /></a></div></div>
19232                         <div class="gallerytext">
19233 <p>caption
19234 </p>
19235                         </div>
19236                 </div></li>
19237 </ul>
19239 !! end
19241 !!test
19242 Gallery override link with absolute external link (bug 34852)
19243 !! wikitext
19244 <gallery>
19245 File:foobar.jpg|caption|alt=galleryalt|link=http://www.example.org
19246 </gallery>
19247 !! html
19248 <ul class="gallery mw-gallery-traditional">
19249                 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19250                         <div class="thumb" style="width: 150px;"><div style="margin:68px auto;"><a href="http://www.example.org"><img alt="galleryalt" src="http://example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" width="120" height="14" /></a></div></div>
19251                         <div class="gallerytext">
19252 <p>caption
19253 </p>
19254                         </div>
19255                 </div></li>
19256 </ul>
19258 !! end
19260 !!test
19261 Gallery override link with malicious javascript (bug 34852)
19262 !! wikitext
19263 <gallery>
19264 File:foobar.jpg|caption|alt=galleryalt|link=" onclick="alert('malicious javascript code!');
19265 </gallery>
19266 !! html
19267 <ul class="gallery mw-gallery-traditional">
19268                 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19269                         <div class="thumb" style="width: 150px;"><div style="margin:68px auto;"><a href="/wiki/%22_onclick%3D%22alert(%27malicious_javascript_code!%27);"><img alt="galleryalt" src="http://example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" width="120" height="14" /></a></div></div>
19270                         <div class="gallerytext">
19271 <p>caption
19272 </p>
19273                         </div>
19274                 </div></li>
19275 </ul>
19277 !! end
19279 !!test
19280 Gallery with invalid title as link (bug 43964)
19281 !! wikitext
19282 <gallery>
19283 File:foobar.jpg|link=<
19284 </gallery>
19285 !! html
19286 <ul class="gallery mw-gallery-traditional">
19287                 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19288                         <div class="thumb" style="width: 150px;"><div style="margin:68px auto;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" width="120" height="14" /></a></div></div>
19289                         <div class="gallerytext">
19290                         </div>
19291                 </div></li>
19292 </ul>
19294 !! end
19296 !!test
19297 Language parser function
19298 !! wikitext
19299 {{#language:ar}}
19300 !! html
19301 <p>العربية
19302 </p>
19303 !! end
19305 !!test
19306 Padleft and padright as substr
19307 !! wikitext
19308 {{padleft:|3|abcde}}
19309 {{padright:|3|abcde}}
19310 !! html
19311 <p>abc
19313 </p>
19314 !! end
19316 !!test
19317 Special parser function
19318 !! wikitext
19319 {{#special:RandomPage}}
19320 {{#special:BaDtItLe}}
19321 {{#special:Foobar}}
19322 !! html
19323 <p>Special:Random
19324 Special:Badtitle
19325 Special:Foobar
19326 </p>
19327 !! end
19329 !!test
19330 Bug 34939 - Case insensitive link parsing ([HttP://])
19331 !! wikitext
19332 [HttP://MediaWiki.Org/]
19333 !! html/php
19334 <p><a rel="nofollow" class="external autonumber" href="HttP://MediaWiki.Org/">[1]</a>
19335 </p>
19336 !! html/parsoid
19337 <p><a rel="mw:ExtLink" href="HttP://MediaWiki.Org/"></a></p>
19338 !! end
19340 !!test
19341 Bug 34939 - Case insensitive link parsing ([HttP:// title])
19342 !! wikitext
19343 [HttP://MediaWiki.Org/ MediaWiki]
19344 !! html
19345 <p><a rel="nofollow" class="external text" href="HttP://MediaWiki.Org/">MediaWiki</a>
19346 </p>
19347 !! end
19349 !!test
19350 Bug 34939 - Case insensitive link parsing (HttP://)
19351 !! wikitext
19352 HttP://MediaWiki.Org/
19353 !! html/php
19354 <p><a rel="nofollow" class="external free" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a>
19355 </p>
19356 !! html/parsoid
19357 <p><a rel="mw:ExtLink" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a></p>
19358 !! end
19360 !!test
19361 Disable TOC
19362 !! options
19363 notoc
19364 !! wikitext
19365 Lead
19366 == Section 1 ==
19367 == Section 2 ==
19368 == Section 3 ==
19369 == Section 4 ==
19370 == Section 5 ==
19371 !! html
19372 <p>Lead
19373 </p>
19375 <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>
19376 <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>
19377 <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>
19378 <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>
19379 <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>
19381 !! end
19385 ### Parsoid-specific tests
19386 ### Parsoid-PHP parser incompatibilities
19388 !!test
19389 1. SOL-sensitive wikitext tokens as template-args
19390 !!options
19391 parsoid=wt2html,wt2wt
19392 !! wikitext
19393 {{echo|*a}}
19394 {{echo|#a}}
19395 {{echo|:a}}
19396 !! html
19397 <span about="#mwt1" typeof="mw:Transclusion">
19398 </span><ul about="#mwt1"><li>a</li>
19399 </ul>
19400 <span about="#mwt2" typeof="mw:Transclusion">
19401 </span><ol about="#mwt2"><li>a</li>
19402 </ol>
19403 <span about="#mwt3" typeof="mw:Transclusion">
19404 </span><dl about="#mwt3"><dd>a</dd>
19405 </dl>
19406 !!end
19408 #### -----------------------------------------------------------------
19409 #### Parsoid-specific functionality tests
19410 #### -----------------------------------------------------------------
19412 # Bug 63642/66749: Formatting elt fixup around images is cleaned up.
19413 # We know wt2wt will fail, but we expect selser to pass.
19414 # Due to the nature of our testing, wt2wt and selser tests will enter the
19415 # blacklist and we'll catch selser regressions based on changes to the
19416 # blacklist entries for selser tests.
19417 !! test
19418 1. Bad treebuilder fixup of formatting elt is cleaned up
19419 !! options
19420 parsoid=wt2html,wt2wt
19421 !! wikitext
19424 <small>
19425 [[Image:Foobar.jpg|right|Test]]
19426 </small>
19428 !! html/parsoid
19429 <table>
19430 <tbody><tr><td>
19431 <small>
19432 <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" height="220" width="1941"></a><figcaption>Test</figcaption></figure>
19433 </small>
19434 </td></tr>
19435 </tbody></table>
19436 !! end
19438 !! test
19439 2. Bad treebuilder fixup of formatting elt is cleaned up
19440 !! options
19441 parsoid=wt2html,wt2wt
19442 !! wikitext
19443 '''foo[[File:Foobar.jpg|thumb|caption]]bar'''
19445 <small>[[Image:Foobar.jpg|right|300px]]</small>
19446 !! html/parsoid
19447 <p><b>foo</b></p>
19448 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="25" width="220"/></a><figcaption><b>caption</b></figcaption></figure>
19449 <p><b>bar</b></p>
19450 <small><figure class="mw-halign-right" typeof="mw:Image"><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="34" width="300"/></a></figure></small>
19451 !! end
19453 #### ----------------------------------------------------------------
19454 #### Parsoid-only testing of Parsoid's impl of <ref> and <references>
19455 #### tags. Parsoid's output for these tags differs from that of the
19456 #### PHP parser.
19457 #### ----------------------------------------------------------------
19459 !!test
19460 Ref: 1. ref-location should be replaced with an index span
19461 !!options
19462 parsoid
19463 !! wikitext
19464 A <ref>foo</ref>
19465 B <ref name="x">foo</ref>
19466 C <ref name="y" />
19467 !! html
19468 <p>A <span about="#mwt2" class="reference" id="cite_ref-1-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"html":"foo"},"attrs":{}}'><a href="#cite_note-1">[1]</a></span>
19469 B <span about="#mwt4" class="reference" id="cite_ref-x-2-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"html":"foo"},"attrs":{"name":"x"}}'><a href="#cite_note-x-2">[2]</a></span>
19470 C <span about="#mwt6" class="reference" id="cite_ref-y-3-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{"name":"y"}}'><a href="#cite_note-y-3">[3]</a></span></p>
19471 !!end
19473 !!test
19474 Ref: 2. ref-tags with identical names should all get the same index
19475 !!options
19476 parsoid
19477 !! wikitext
19478 A <ref name="x">foo</ref>
19479 B <ref name="x" />
19480 !! html
19481 <p>A <span about="#mwt2" class="reference" id="cite_ref-x-1-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"html":"foo"},"attrs":{"name":"x"}}'><a href="#cite_note-x-1">[1]</a></span>
19482 B <span about="#mwt4" class="reference" id="cite_ref-x-1-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{"name":"x"}}'><a href="#cite_note-x-1">[1]</a></span></p>
19483 !!end
19485 !!test
19486 Ref: 3. spaces in ref-names should be ignored
19487 !!options
19488 parsoid
19489 !! wikitext
19490 A <ref name="x">foo</ref>
19491 B <ref name=" x " />
19492 C <ref name= x  />
19493 !! html
19494 <p>A <span about="#mwt2" class="reference" id="cite_ref-x-1-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"html":"foo"},"attrs":{"name":"x"}}'><a href="#cite_note-x-1">[1]</a></span>
19495 B <span about="#mwt4" class="reference" id="cite_ref-x-1-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{"name":"x"}}'><a href="#cite_note-x-1">[1]</a></span>
19496 C <span about="#mwt6" class="reference" id="cite_ref-x-1-2" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{"name":"x"}}'><a href="#cite_note-x-1">[1]</a></span></p>
19497 !!end
19499 # NOTE: constructor is a predefined property in JS and constructor as a ref-name can clash with it if not handled properly)
19500 !!test
19501 Ref: 4. 'constructor' should be accepted as a valid ref-name
19502 !!options
19503 parsoid
19504 !! wikitext
19505 A <ref name="constructor">foo</ref>
19506 !! html
19507 <p>A <span about="#mwt2" class="reference" id="cite_ref-constructor-1-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"html":"foo"},"attrs":{"name":"constructor"}}'><a href="#cite_note-constructor-1">[1]</a></span></p>
19508 !!end
19510 !!test
19511 Ref: 5. body should accept generic wikitext
19512 !!options
19513 parsoid
19514 !! wikitext
19515 A <ref>
19516  This is a '''[[bolded link]]''' and this is a {{echo|transclusion}}
19517 </ref>
19519 <references />
19520 !! html
19521 <p>A <span about="#mwt2" class="reference" id="cite_ref-1-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"html":"This is a &lt;b data-parsoid=&#39;{\"dsr\":[19,40,3,3]}&#39;>&lt;a rel=\"mw:WikiLink\" href=\"./Bolded_link\" title=\"Bolded link\" data-parsoid=&#39;{\"stx\":\"simple\",\"a\":{\"href\":\"./Bolded_link\"},\"sa\":{\"href\":\"bolded link\"},\"dsr\":[22,37,2,2]}&#39;>bolded link&lt;/a>&lt;/b> and this is a &lt;span about=\"#mwt3\" typeof=\"mw:Transclusion\" data-parsoid=&#39;{\"pi\":[[{\"k\":\"1\",\"spc\":[\"\",\"\",\"\",\"\"]}]],\"dsr\":[55,76,null,null]}&#39; data-mw=&#39;{\"parts\":[{\"template\":{\"target\":{\"wt\":\"echo\",\"href\":\"./Template:Echo\"},\"params\":{\"1\":{\"wt\":\"transclusion\"}},\"i\":0}}]}&#39;>transclusion&lt;/span>\n"},"attrs":{}}'><a href="#cite_note-1">[1]</a></span></p>
19523 <ol class="references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'>
19524 <li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> This is a <b><a rel="mw:WikiLink" href="./Bolded_link" 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>
19525 </li>
19526 </ol>
19527 !!end
19529 !!test
19530 Ref: 6. indent-pres should not be output in ref-body
19531 !!options
19532 parsoid
19533 !! wikitext
19534 A <ref>
19535  foo
19536  bar
19537  baz
19538 </ref>
19540 <references />
19541 !! html
19542 <p>A <span about="#mwt2" class="reference" id="cite_ref-1-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"html":"foo\n bar\n baz\n"},"attrs":{}}'><a href="#cite_note-1">[1]</a></span></p>
19544 <ol class="references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
19545 <li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> foo
19546  bar
19547  baz
19548 </li>
19549 </ol>
19550 !!end
19552 !!test
19553 Ref: 7. No p-wrapping in ref-body
19554 !!options
19555 parsoid
19556 !! wikitext
19557 A <ref>
19567 booz
19568 </ref>
19570 <references />
19571 !! html
19572 <p>A <span about="#mwt2" class="reference" id="cite_ref-1-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"html":"foo\n\nbar\n\n\nbaz\n\n\n\nbooz\n"},"attrs":{}}'><a href="#cite_note-1">[1]</a></span></p>
19574 <ol class="references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
19575 <li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> foo
19584 booz
19585 </li>
19586 </ol>
19587 !!end
19589 !!test
19590 Ref: 8. transclusion wikitext has lower precedence
19591 !!options
19592 parsoid
19593 !! wikitext
19594 A <ref> foo {{echo|</ref> B C}}
19596 <references />
19597 !! html
19598 <p>A <span about="#mwt2" class="reference" id="cite_ref-1-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"html":"foo &lt;span typeof=\"mw:Nowiki\" data-parsoid=&#39;{\"src\":\"{{\",\"dsr\":[12,14,0,0]}&#39;>{{&lt;/span>echo|"},"attrs":{}}'><a href="#cite_note-1">[1]</a></span> B C<span typeof="mw:Nowiki">}}</span></p>
19599 <ol class="references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
19600 <li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> foo <span typeof="mw:Nowiki">{{</span>echo|</li>
19601 </ol>
19602 !!end
19604 !!test
19605 Ref: 9. unclosed comments should not leak out of ref-body
19606 !!options
19607 parsoid
19608 !! wikitext
19609 A <ref> foo <!--</ref> B C
19610 <references />
19611 !! html
19612 <p>A <span about="#mwt2" class="reference" id="cite_ref-1-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"html":"foo &lt;!---->"},"attrs":{}}'><a href="#cite_note-1">[1]</a></span> B C</p>
19613 <ol class="references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
19614 <li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> foo <!----></li>
19615 </ol>
19616 !!end
19618 !!test
19619 Ref: 10. Unclosed HTML tags should not leak out of ref-body
19620 !!options
19621 parsoid
19622 !! wikitext
19623 A <ref> <b> foo </ref> B C
19625 <references />
19626 !! html
19627 <p>A <span about="#mwt2" class="reference" id="cite_ref-1-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"html":"&lt;b data-parsoid=&#39;{\"stx\":\"html\",\"autoInsertedEnd\":true,\"dsr\":[8,16,3,0]}&#39;> foo &lt;/b>"},"attrs":{}}'><a href="#cite_note-1">[1]</a></span> B C</p>
19630 <ol class="references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
19631 <li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> <b data-parsoid='{"stx":"html","autoInsertedEnd":true}'> foo </b></li>
19632 </ol>
19633 !!end
19635 !!test
19636 Ref: 11. ref-tags acts like an inline element wrt P-wrapping
19637 !!options
19638 parsoid
19639 !! wikitext
19640 A <ref>foo</ref> B
19641 C <ref>bar</ref> D
19642 !! html
19643 <p>A <span about="#mwt2" class="reference" id="cite_ref-1-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"html":"foo"},"attrs":{}}'><a href="#cite_note-1">[1]</a></span> B
19644 C <span about="#mwt4" class="reference" id="cite_ref-2-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"html":"bar"},"attrs":{}}'><a href="#cite_note-2">[2]</a></span> D</p>
19645 !!end
19647 !!test
19648 Ref: 12. ref-tags act as trailing newline migration barrier
19649 !!options
19650 parsoid
19651 !! wikitext
19652 <!--the newline at the end of this line moves out of the p-tag-->a
19654 b<!--the newline at the end of this line stays inside the p-tag--> <ref />
19655 <ref />
19658 !! html
19659 <p><!--the newline at the end of this line moves out of the p-tag-->a</p>
19662 <p>b<!--the newline at the end of this line stays inside the p-tag--> <span about="#mwt2" class="reference" id="cite_ref-1-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{}}'><a href="#cite_note-1">[1]</a></span>
19663 <span about="#mwt4" class="reference" id="cite_ref-2-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{}}'><a href="#cite_note-2">[2]</a></span></p>
19665 <p>c</p>
19666 !!end
19668 !!test
19669 Ref: 13. ref-tags are not SOL-transparent and block indent-pres
19670 !!options
19671 parsoid
19672 !! wikitext
19673 <ref>foo</ref> A
19674 <ref>bar
19675 </ref> B
19676 !! html
19677 <p><span about="#mwt2" class="reference" id="cite_ref-1-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"html":"foo"},"attrs":{}}'><a href="#cite_note-1">[1]</a></span> A
19678 <span about="#mwt4" class="reference" id="cite_ref-2-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"html":"bar\n"},"attrs":{}}'><a href="#cite_note-2">[2]</a></span> B</p>
19679 !!end
19681 !!test
19682 Ref: 14. A nested ref-tag should be emitted as plain text
19683 !!options
19684 parsoid
19685 !! wikitext
19686 <ref>foo <ref>bar</ref> baz</ref>
19688 <references />
19689 !! html
19690 <p><span about="#mwt2" class="reference" id="cite_ref-1-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"html":"foo &amp;lt;ref>bar&amp;lt;/ref> baz"},"attrs":{}}'><a href="#cite_note-1">[1]</a></span></p>
19692 <ol class="references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'>
19693 <li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> foo &lt;ref>bar&lt;/ref> baz</li>
19694 </ol>
19695 !!end
19697 !!test
19698 Ref: 15. ref-tags with identical names should get identical indexes
19699 !!options
19700 parsoid
19701 !! wikitext
19702 A1 <ref name="a">foo</ref> A2 <ref name="a" />
19703 B1 <ref name="b" /> B2 <ref name="b">bar</ref>
19705 <references />
19706 !! html
19707 <p>A1 <span about="#mwt3" class="reference" id="cite_ref-a-1-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"html":"foo"},"attrs":{"name":"a"}}'><a href="#cite_note-a-1">[1]</a></span> A2 <span about="#mwt4" class="reference" id="cite_ref-a-1-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{"name":"a"}}'><a href="#cite_note-a-1">[1]</a></span>
19708 B1 <span about="#mwt7" class="reference" id="cite_ref-b-2-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{"name":"b"}}'><a href="#cite_note-b-2">[2]</a></span> B2 <span about="#mwt8" class="reference" id="cite_ref-b-2-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"html":"bar"},"attrs":{"name":"b"}}'><a href="#cite_note-b-2">[2]</a></span></p>
19710 <ol class="references" typeof="mw:Extension/references" about="#mwt10" data-mw='{"name":"references","attrs":{}}'><li about="#cite_note-a-1" id="cite_note-a-1"><span rel="mw:referencedBy">↑ <a href="#cite_ref-a-1-0">1.0</a> <a href="#cite_ref-a-1-1">1.1</a></span> foo</li><li about="#cite_note-b-2" id="cite_note-b-2"><span rel="mw:referencedBy">↑ <a href="#cite_ref-b-2-0">2.0</a> <a href="#cite_ref-b-2-1">2.1</a></span> bar</li>
19711 </ol>
19712 !!end
19714 ## We don't bother wt2wt-ing non-standard whitespace
19715 !!test
19716 Ref: 16. Tokenizer should accept non-standard whitespace in <ref> and </ref> tags
19717 !!options
19718 parsoid=wt2html
19719 !! wikitext
19720 A <ref >foo</ref >
19722 <references />
19723 !! html
19724 <p>A <span about="#mwt2" class="reference" id="cite_ref-1-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"html":"foo"},"attrs":{}}'><a href="#cite_note-1">[1]</a></span></p>
19726 <ol class="references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
19727 <li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> foo</li></ol>
19728 !!end
19730 !!test
19731 Ref: 17. Generate valid HTML5 id/about attributes
19732 !!options
19733 parsoid
19734 !!wikitext
19735 <ref name="a b">foo</ref>
19737 <references />
19738 !!html
19739 <p><span class="reference" id="cite_ref-a_b-1-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"html":"foo"},"attrs":{"name":"a b"}}'><a href="#cite_note-a_b-1">[1]</a></span>
19740 </p>
19742 <ol class="references" typeof="mw:Extension/references" data-mw='{"name":"references","attrs":{}}'>
19743 <li id="cite_note-a_b-1"><span rel="mw:referencedBy"><a href="#cite_ref-a_b-1-0">↑</a></span> foo</li>
19744 !!end
19746 !!test
19747 References: 1. references tag without any refs should be handled properly
19748 !!options
19749 parsoid
19750 !! wikitext
19751 <references />
19752 !! html
19753 <ol about="#mwt2" class="references" typeof="mw:Extension/references" data-mw='{"name":"references","attrs":{}}'></ol>
19754 !!end
19756 !!test
19757 References: 2. references tag with group only outputs references from that group
19758 !!options
19759 parsoid
19760 !! wikitext
19761 A <ref group="a">foo</ref>
19762 B <ref group="b">bar</ref>
19764 <references group="a" />
19765 !! html
19766 <p>A <span about="#mwt2" class="reference" id="cite_ref-1-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"html":"foo"},"attrs":{"group":"a"}}'><a href="#cite_note-1">[a 1]</a></span>
19767 B <span about="#mwt4" class="reference" id="cite_ref-2-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"html":"bar"},"attrs":{"group":"b"}}'><a href="#cite_note-2">[b 1]</a></span></p>
19769 <ol class="references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{"group":"a"}}'><li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> foo</li>
19770 </ol>
19771 !!end
19773 !!test
19774 References: 3. ref list should be cleared after processing references
19775 !!options
19776 parsoid
19777 !! wikitext
19778 A <ref>foo</ref>
19780 <references />
19782 B <ref>bar</ref>
19784 <references />
19785 !! html
19786 <p>A <span about="#mwt2" class="reference" id="cite_ref-1-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"html":"foo"},"attrs":{}}'><a href="#cite_note-1">[1]</a></span></p>
19788 <ol class="references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'><li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> foo</li>
19789 </ol>
19791 <p>B <span about="#mwt6" class="reference" id="cite_ref-2-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"html":"bar"},"attrs":{}}'><a href="#cite_note-2">[1]</a></span></p>
19793 <ol class="references" typeof="mw:Extension/references" about="#mwt8" data-mw='{"name":"references","attrs":{}}'><li about="#cite_note-2" id="cite_note-2"><span rel="mw:referencedBy"><a href="#cite_ref-2-0">↑</a></span> bar</li>
19794 </ol>
19795 !!end
19797 !!test
19798 References: 4. only referenced group should be cleared after processing references
19799 !!options
19800 parsoid
19801 !! wikitext
19802 A <ref group="a">afoo</ref>
19803 B <ref>bfoo</ref>
19805 <references group="a" />
19807 C <ref>cfoo</ref>
19809 <references />
19810 !! html
19811 <p>A <span about="#mwt2" class="reference" id="cite_ref-1-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"html":"afoo"},"attrs":{"group":"a"}}'><a href="#cite_note-1">[a 1]</a></span>
19812 B <span about="#mwt4" class="reference" id="cite_ref-2-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"html":"bfoo"},"attrs":{}}'><a href="#cite_note-2">[1]</a></span></p>
19814 <ol class="references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{"group":"a"}}'><li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> afoo</li>
19815 </ol>
19817 <p>C <span about="#mwt8" class="reference" id="cite_ref-3-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"html":"cfoo"},"attrs":{}}'><a href="#cite_note-3">[2]</a></span></p>
19819 <ol class="references" typeof="mw:Extension/references" about="#mwt10" data-mw='{"name":"references","attrs":{}}'><li about="#cite_note-2" id="cite_note-2"><span rel="mw:referencedBy"><a href="#cite_ref-2-0">↑</a></span> bfoo</li><li about="#cite_note-3" id="cite_note-3"><span rel="mw:referencedBy"><a href="#cite_ref-3-0">↑</a></span> cfoo</li>
19820 </ol>
19821 !!end
19823 !!test
19824 References: 5. ref tags in references should be processed while ignoring all other content
19825 !!options
19826 parsoid
19827 !! wikitext
19828 A <ref name="a" />
19829 B <ref name="b">bar</ref>
19831 <references>
19832 <ref name="a">foo</ref>
19833 This should just get lost.
19834 </references>
19835 !! html
19836 <p>A <span about="#mwt2" class="reference" id="cite_ref-a-1-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{"name":"a"}}'><a href="#cite_note-a-1">[1]</a></span>
19837 B <span about="#mwt4" class="reference" id="cite_ref-b-2-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"html":"bar"},"attrs":{"name":"b"}}'><a href="#cite_note-b-2">[2]</a></span></p>
19840 <ol class="references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","body":{"extsrc":"&lt;ref name=\"a\">foo&lt;/ref>\nThis should just get lost.","html":"\n&lt;span about=\"#mwt8\" class=\"reference\" rel=\"dc:references\" typeof=\"mw:Extension/ref\" data-parsoid=&#39;{\"src\":\"&amp;lt;ref name=\\\"a\\\">foo&amp;lt;/ref>\",\"dsr\":[59,82,14,6]}&#39; data-mw=&#39;{\"name\":\"ref\",\"body\":{\"html\":\"foo\"},\"attrs\":{\"name\":\"a\"}}&#39;>&lt;a href=\"#cite_note-a-1\">[1]&lt;/a>&lt;/span>\n"},"attrs":{}}'><li about="#cite_note-a-1" id="cite_note-a-1"><span rel="mw:referencedBy"><a href="#cite_ref-a-1-0">↑</a></span> foo</li><li about="#cite_note-b-2" id="cite_note-b-2"><span rel="mw:referencedBy"><a href="#cite_ref-b-2-0">↑</a></span> bar</li>
19841 </ol>
19842 !!end
19844 !!test
19845 References: 6. <references /> from a transclusion
19846 !!options
19847 parsoid
19848 !! wikitext
19849 <ref>Foo</ref> {{echo|<references />}}
19850 !! html
19851 <p><span about="#mwt3" class="reference" id="cite_ref-1-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"html":"Foo"},"attrs":{}}'><a href="#cite_note-1">[1]</a></span></p> <ol class="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"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> Foo</li></ol>
19852 !!end
19854 !! test
19855 References: 7. Multiple references tags (one without and one with nested refs) should be correctly handled
19856 !! options
19857 parsoid
19858 !! wikitext
19859 A <ref>foo bar for a</ref>
19860 B <ref group="X" name="b" />
19862 <references />
19864 <references group="X">
19865 <ref name="b">foo</ref>
19866 </references>
19867 !! html
19868 <p>A <span about="#mwt2" class="reference" id="cite_ref-1-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"html":"foo bar for a"},"attrs":{}}'><a href="#cite_note-1">[1]</a></span>
19869 B <span about="#mwt4" class="reference" id="cite_ref-b-2-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{"group":"X","name":"b"}}'><a href="#cite_note-b-2">[X 1]</a></span></p>
19871 <ol class="references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'><li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> foo bar for a</li></ol>
19873 <ol class="references" typeof="mw:Extension/references" about="#mwt8" data-mw='{"name":"references","body":{"extsrc":"&lt;ref name=\"b\">foo&lt;/ref>","html":"\n&lt;span about=\"#mwt10\" class=\"reference\" rel=\"dc:references\" typeof=\"mw:Extension/ref\" data-parsoid=&#39;{\"src\":\"&amp;lt;ref name=\\\"b\\\">foo&amp;lt;/ref>\",\"dsr\":[96,119,14,6]}&#39; data-mw=&#39;{\"name\":\"ref\",\"body\":{\"html\":\"foo\"},\"attrs\":{\"name\":\"b\"}}&#39;>&lt;a href=\"#cite_note-b-2\">[X 1]&lt;/a>&lt;/span>\n"},"attrs":{"group":"X"}}'><li about="#cite_note-b-2" id="cite_note-b-2"><span rel="mw:referencedBy"><a href="#cite_ref-b-2-0">↑</a></span> foo</li></ol>
19874 !! end
19876 !! test
19877 Entities in ref name
19878 !! options
19879 parsoid
19880 !! wikitext
19881 <ref name="test &amp; me">hi</ref>
19882 !! html
19883 <p><span about="#mwt2" class="reference" id="cite_ref-test_&amp;_me-1-0" rel="dc:references" typeof="mw:Extension/ref" data-parsoid='{"src":"&lt;ref name=\"test &amp;amp; me\">hi&lt;/ref>"}' data-mw='{"name":"ref","body":{"html":"hi"},"attrs":{"name":"test &amp; me"}}'><a href="#cite_note-test_&amp;_me-1">[1]</a></span></p>
19884 !! end
19886 # This test is wt2html only because we're permitting the serializer to produce
19887 # dirty diffs, normalizing the unclosed references to the self-closed version.
19888 !! test
19889 Generate references for unclosed references tag
19890 !! options
19891 parsoid=wt2html
19892 !! wikitext
19893 a<ref>foo</ref>
19895 <references>
19896 !! html
19897 <p>a<span about="#mwt2" class="reference" id="cite_ref-1-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"html":"foo"},"attrs":{}}'><a href="#cite_note-1">[1]</a></span></p>
19900 <ol class="references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
19901 <li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="#cite_ref-1-0">↑</a></span> foo</li></ol>
19902 !! end
19904 !! test
19905 New reference serializes on its own line
19906 !! options
19907 parsoid=wt2wt,html2wt
19908 !! wikitext
19910 <references />
19911 !! html
19912 foo<ol class="references" typeof="mw:Extension/references" about="#mwt2" data-mw='{"name":"references","attrs":{}}'></ol>
19913 !! end
19915 #--------- Test stripping of empty nodes in template content ----------
19916 !!test
19917 Empty LI and TR nodes should be stripped from template content
19918 !!wikitext
19919 {{EmptyLITest}}
19920 {{EmptyTRTest}}
19921 !!html/parsoid
19922 <ul typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyLITest","href":"./Template:EmptyLITest"},"params":{},"i":0}}]}'>
19923 <li>a</li>
19924 <li>b</li>
19925 </ul>
19926 <table typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyTRTest","href":"./Template:EmptyTRTest"},"params":{},"i":0}}]}'>
19927 <tbody>
19928 <tr>
19929 <td>foo</td>
19930 </tr>
19931 <tr>
19932 <td>bar</td>
19933 </tr>
19934 </tbody>
19935 </table>
19936 !!end
19938 !!test
19939 Empty LI and TR nodes should not be stripped from top-level content
19940 !!wikitext
19941 * a
19943 * b
19947 |foo
19949 !!html/parsoid
19950 <ul>
19951 <li> a</li>
19952 <li></li>
19953 <li> b</li>
19954 </ul>
19955 <table>
19956 <tbody>
19957 <tr></tr>
19958 <tr>
19959 <td>foo</td>
19960 </tr>
19961 </tbody>
19962 </table>
19963 !!end
19965 !!test
19966 Empty TR nodes should not be stripped if they have any attributes set
19967 !!wikitext
19968 {{EmptyTRWithHTMLAttrTest}}
19969 !!html/parsoid
19970 <table typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyTRWithHTMLAttrTest","href":"./Template:EmptyTRWithHTMLAttrTest"},"params":{},"i":0}}]}'>
19971 <tr align="center"></tr>
19972 <tr><td>foo</td></tr>
19973 <tr align="center"></tr>
19974 <tr><td>bar</td></tr>
19975 </table>
19976 !!end
19978 #### ----------------------------------------------------------------
19979 #### The following section of tests are primarily to test
19980 #### wikitext escaping capabilities of Parsoid.  Given that
19981 #### escaping can be done any number of ways, the wikitext (input)
19982 #### is always adjusted to reflect how Parsoid adds nowiki
19983 #### escape tags.
19984 ####
19985 #### We are marking several tests as parsoid-only since the
19986 #### HTML in the result section is different from what the
19987 #### PHP parser generates for it.
19988 #### ----------------------------------------------------------------
19991 #### --------------- Headings ---------------
19992 #### 0. Unnested
19993 #### 1. Nested inside html <h1>=foo=</h1>
19994 #### 2. Outside heading nest on a single line <h1>foo</h1>*bar
19995 #### 3. Nested inside html with wikitext split by html tags
19996 #### 4. No escape needed
19997 #### 5. Empty headings <h1></h1>
19998 #### 6. Heading chars in SOL context
19999 #### ----------------------------------------
20000 !! test
20001 Headings: 0. Unnested
20002 !! options
20003 parsoid
20004 !! wikitext
20005 <nowiki>=foo=</nowiki>
20007 <nowiki> =foo= </nowiki>
20008 <!--cmt-->
20009 <nowiki>=foo=</nowiki>
20011 =foo''a''<nowiki>=</nowiki>
20012 !! html
20013 <p><span typeof="mw:Nowiki">=foo=</span></p>
20015 <p><span typeof="mw:Nowiki"> =foo= </span>
20016 <!--cmt-->
20017 <span typeof="mw:Nowiki">=foo=</span></p>
20019 <p>=foo<i>a</i><span typeof="mw:Nowiki">=</span></p>
20020 !!end
20022 # New headings and existing headings are handled differently
20023 !! test
20024 Headings: 1. Nested inside html
20025 !! options
20026 parsoid=html2wt
20027 !! wikitext
20028 = =foo= =
20030 == =foo= ==
20032 === =foo= ===
20034 =<nowiki>=foo=</nowiki>=
20035 ==<nowiki>=foo=</nowiki>==
20036 ===<nowiki>=foo=</nowiki>===
20037 ====<nowiki>=foo=</nowiki>====
20038 =====<nowiki>=foo=</nowiki>=====
20039 ======<nowiki>=foo=</nowiki>======
20041 !! html
20042 <h1>=foo=</h1>
20043 <h2>=foo=</h2>
20044 <h3>=foo=</h3>
20046 <h1 data-parsoid=''>=foo=</h1>
20047 <h2 data-parsoid=''>=foo=</h2>
20048 <h3 data-parsoid=''>=foo=</h3>
20049 <h4 data-parsoid=''>=foo=</h4>
20050 <h5 data-parsoid=''>=foo=</h5>
20051 <h6 data-parsoid=''>=foo=</h6>
20052 !!end
20054 !! test
20055 Headings: 2. Outside heading nest on a single line <h1>foo</h1>*bar
20056 !! options
20057 parsoid=html2wt
20058 !! wikitext
20059 = foo =
20060 <nowiki>*</nowiki>bar
20062 = foo =
20063 =bar
20065 = foo =
20066 <nowiki>=bar=</nowiki>
20067 !! html
20068 <h1>foo</h1>*bar
20069 <h1>foo</h1>=bar
20070 <h1>foo</h1>=bar=
20071 !!end
20073 !! test
20074 Headings: 3. Nested inside html with wikitext split by html tags
20075 !! options
20076 parsoid=html2wt,wt2wt
20077 !! wikitext
20078 = ='''bold'''<nowiki>foo=</nowiki> =
20079 !! html/parsoid
20080 <h1>=<b>bold</b>foo=</h1>
20081 !!end
20083 !! test
20084 Headings: 4a. No escaping needed (testing just h1 and h2)
20085 !! wikitext
20086 = =foo =
20088 = foo= =
20090 = =foo= =
20092 = =foo= bar =
20094 == =foo ==
20096 == foo= ==
20098 = = =
20099 !! html/parsoid
20100 <h1>=foo</h1>
20101 <h1>foo=</h1>
20102 <h1> =foo= </h1>
20103 <h1>=foo= bar</h1>
20104 <h2>=foo</h2>
20105 <h2>foo=</h2>
20106 <h1>=</h1>
20107 !!end
20109 !! test
20110 Headings: 4a'. No escaping needed (Parsoid bug T84903)
20111 !! wikitext
20112 = ''=''foo= =
20113 !! html/php
20114 <h1><span class="mw-headline" id=".3Dfoo.3D"><i>=</i>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>
20116 !! html/parsoid
20117 <h1><i>=</i>foo=</h1>
20118 !! end
20120 !! test
20121 Headings: 4b. No escaping needed (inside p-tags)
20122 !! options
20123 parsoid=html2wt
20124 !! wikitext
20126 =foo= x
20127 =foo= <s></s>
20128 !! html
20129 <p>===
20130 =foo= x
20131 =foo= <s></s>
20132 </p>
20133 !!end
20135 !! test
20136 Headings: 5. Empty headings
20137 !! options
20138 parsoid
20139 !! wikitext
20140 =<nowiki/>=
20142 ==<nowiki/>==
20144 ===<nowiki/>===
20146 ====<nowiki/>====
20148 =====<nowiki/>=====
20150 ======<nowiki/>======
20151 !! html
20152 <h1></h1>
20153 <h2></h2>
20154 <h3></h3>
20155 <h4></h4>
20156 <h5></h5>
20157 <h6></h6>
20158 !!end
20160 !! test
20161 Headings: 6a. Heading chars in SOL context (with trailing spaces)
20162 !! options
20163 parsoid
20164 !! wikitext
20165 <nowiki>=a=</nowiki>
20167 <nowiki>=a=</nowiki> 
20169 <nowiki>=a=</nowiki>    
20171 <nowiki>=a=</nowiki>    
20172 !! html
20173 <p>=a=</p>
20174 <p>=a= </p>
20175 <p>=a=  </p>
20176 <p>=a=  </p>
20177 !!end
20179 !! test
20180 Headings: 6b. Heading chars in SOL context (with trailing newlines)
20181 !! options
20182 parsoid
20183 !! wikitext
20184 <nowiki>=a=
20185 b</nowiki>
20187 <nowiki>=a= 
20188 b</nowiki>
20190 <nowiki>=a=     
20191 b</nowiki>
20193 <nowiki>=a=      
20194 b</nowiki>
20195 !! html
20196 <p>=a=
20197 b</p>
20198 <p>=a= 
20199 b</p>
20200 <p>=a=  
20201 b</p>
20202 <p>=a=   
20203 b</p>
20204 </p>
20205 !!end
20207 !! test
20208 Headings: 6c. Heading chars in SOL context (leading newline break)
20209 !! options
20210 parsoid
20211 !! wikitext
20213 <nowiki>=b=</nowiki>
20214 !! html
20215 <p>a
20216 =b=</p>
20217 !!end
20219 !! test
20220 Headings: 6d. Heading chars in SOL context (with interspersed comments)
20221 !! options
20222 parsoid
20223 !! wikitext
20224 <!--c0--><nowiki>=a=</nowiki>
20226 <!--c1--><nowiki>=a=</nowiki> <!--c2-->  <!--c3-->
20227 !! html
20228 <p><!--c0-->=a=</p>
20229 <p><!--c1-->=a= <!--c2-->        <!--c3--></p>
20230 !!end
20232 !! test
20233 Headings: 6d. Heading chars in SOL context (No escaping needed)
20234 !! options
20235 parsoid=html2wt
20236 !! wikitext
20237 =a=<div>b</div>
20238 !! html
20239 =a=<div>b</div>
20240 !!end
20242 #### --------------- Lists ---------------
20243 #### 0. Outside nests (*foo, etc.)
20244 #### 1. Nested inside html <ul><li>*foo</li></ul>
20245 #### 2. Inside definition lists
20246 #### 3. Only bullets at start should be escaped
20247 #### 4. No escapes needed
20248 #### 5. No unnecessary escapes
20249 #### 6. Escape bullets in SOL position
20250 #### 7. Escape bullets in a multi-line context
20251 #### ----------------------------------------
20253 !! test
20254 Lists: 0. Outside nests
20255 !! wikitext
20256 <nowiki>*</nowiki>foo
20258 <nowiki>#</nowiki>foo
20260 <nowiki>;Foo:</nowiki>bar
20261 !! html
20262 <p>*foo
20263 </p><p>#foo
20264 </p><p>;Foo:bar
20265 </p>
20266 !!end
20268 !! test
20269 Lists: 1. Nested inside html
20270 !! wikitext
20271 *<nowiki>*foo</nowiki>
20273 *<nowiki>#foo</nowiki>
20275 *<nowiki>:foo</nowiki>
20277 *<nowiki>;foo</nowiki>
20279 #<nowiki>*foo</nowiki>
20281 #<nowiki>#foo</nowiki>
20283 #<nowiki>:foo</nowiki>
20285 #<nowiki>;foo</nowiki>
20286 !! html
20287 <ul><li>*foo</li></ul>
20288 <ul><li>#foo</li></ul>
20289 <ul><li>:foo</li></ul>
20290 <ul><li>;foo</li></ul>
20291 <ol><li>*foo</li></ol>
20292 <ol><li>#foo</li></ol>
20293 <ol><li>:foo</li></ol>
20294 <ol><li>;foo</li></ol>
20296 !!end
20298 !! test
20299 Lists: 2. Inside definition lists
20300 !! wikitext
20301 ;<nowiki>;foo</nowiki>
20303 ;<nowiki>:foo</nowiki>
20305 ;<nowiki>:foo</nowiki>
20306 :bar
20308 :<nowiki>:foo</nowiki>
20309 !! html
20310 <dl><dt>;foo</dt></dl>
20311 <dl><dt>:foo</dt></dl>
20312 <dl><dt>:foo</dt>
20313 <dd>bar</dd></dl>
20314 <dl><dd>:foo</dd></dl>
20316 !!end
20318 !! test
20319 Lists: 3. Only bullets at start of text should be escaped
20320 !! wikitext
20321 *<nowiki>*foo*bar</nowiki>
20323 *<nowiki>*foo</nowiki>''it''*bar
20324 !! html
20325 <ul><li>*foo*bar</li></ul>
20326 <ul><li>*foo<i>it</i>*bar</li></ul>
20328 !!end
20330 !! test
20331 Lists: 4. No escapes needed
20332 !! options
20333 parsoid
20334 !! wikitext
20335 *foo*bar
20337 *''foo''*bar
20339 *[[Foo]]: bar
20341 *[[Foo]]*bar
20342 !! html
20343 <ul>
20344 <li>foo*bar
20345 </li>
20346 </ul>
20347 <ul>
20348 <li><i>foo</i>*bar
20349 </li>
20350 </ul>
20351 <ul>
20352 <li><a rel="mw:WikiLink" href="Foo" title="Foo">Foo</a>: bar
20353 </li>
20354 </ul>
20355 <ul>
20356 <li><a rel="mw:WikiLink" href="Foo" title="Foo">Foo</a>*bar
20357 </li>
20358 </ul>
20359 !!end
20361 !! test
20362 Lists: 5. No unnecessary escapes
20363 !! wikitext
20364 * bar <span><nowiki>[[foo]]</nowiki></span>
20366 * =bar <span><nowiki>[[foo]]</nowiki></span>
20368 * [[bar <span><nowiki>[[foo]]</nowiki></span>
20370 * ]]bar <span><nowiki>[[foo]]</nowiki></span>
20372 * =bar <span>foo]]</span>=
20374 * <s></s>: a
20376 * ''* foo''
20377 !! html
20378 <ul><li> bar <span>[[foo]]</span></li></ul>
20379 <ul><li> =bar <span>[[foo]]</span></li></ul>
20380 <ul><li> [[bar <span>[[foo]]</span></li></ul>
20381 <ul><li> ]]bar <span>[[foo]]</span></li></ul>
20382 <ul><li> =bar <span>foo]]</span>=</li></ul>
20383 <ul><li> <s></s>: a</li></ul>
20384 <ul><li> <i>* foo</i></li></ul>
20386 !!end
20388 !! test
20389 Lists: 6. Escape bullets in SOL position
20390 !! options
20391 parsoid=html2wt
20392 !! wikitext
20393 <!--cmt--><nowiki>*</nowiki>foo
20394 !! html
20395 <p><!--cmt-->*foo</p>
20396 !!end
20398 !! test
20399 Lists: 7. Escape bullets in a multi-line context
20400 !! wikitext
20402 <nowiki>*</nowiki>b
20403 !! html
20404 <p>a
20406 </p>
20407 !!end
20409 !! test
20410 Lists: 8. Escape colons only if not present in tags
20411 !! options
20412 parsoid=html2wt
20413 !! wikitext
20414 ; <nowiki>a:b</nowiki>''c:d''
20415 !! html
20416 <dl><dt>a:b<i>c:d</i></dt></dl>
20417 !! end
20419 #### --------------- HRs ---------------
20420 #### 1. Single line
20421 #### -----------------------------------
20423 !! test
20424 HRs: 1. Single line
20425 !! wikitext
20426 ----<nowiki>----</nowiki>
20427 ----=foo=
20428 ----*foo
20429 !! html+tidy
20430 <hr />
20431 <p>----</p>
20432 <hr />
20433 <p>=foo=</p>
20434 <hr />
20435 <p>*foo</p>
20436 !! end
20438 #### --------------- Tables ---------------
20439 #### 1a. Simple example
20440 #### 1b. No escaping needed (!foo)
20441 #### 1c. No escaping needed (|foo)
20442 #### 1d. No escaping needed (|}foo)
20443 ####
20444 #### 2a. Nested in td (<td>foo|bar</td>)
20445 #### 2b. Nested in td (<td>foo||bar</td>)
20446 #### 2c. Nested in td -- no escaping needed(<td>foo!!bar</td>)
20447 ####
20448 #### 3a. Nested in th (<th>foo!bar</th>)
20449 #### 3b. Nested in th (<th>foo!!bar</th>)
20450 #### 3c. Nested in th -- no escaping needed(<th>foo||bar</th>)
20451 ####
20452 #### 4a. Escape -
20453 #### 4b. Escape +
20454 #### 4c. No escaping needed
20455 #### --------------------------------------
20457 !! test
20458 Tables: 1a. Simple example
20459 !! wikitext
20460 <nowiki>{|
20461 |}</nowiki>
20462 !! html
20463 <p>{|
20465 </p>
20466 !! end
20468 !! test
20469 Tables: 1b. No escaping needed
20470 !! wikitext
20471 !foo
20472 !! html
20473 <p>!foo
20474 </p>
20475 !! end
20477 !! test
20478 Tables: 1c. No escaping needed
20479 !! wikitext
20480 |foo
20481 !! html
20482 <p>|foo
20483 </p>
20484 !! end
20486 !! test
20487 Tables: 1d. No escaping needed
20488 !! wikitext
20489 |}foo
20490 !! html
20491 <p>|}foo
20492 </p>
20493 !! end
20495 !! test
20496 Tables: 2a. Nested in td
20497 !! options
20498 parsoid=html2wt
20499 !! html/parsoid
20500 <table><tbody><tr>
20501 <td>foo|bar</td></tr>
20502 <tr><td>x<div>a|b</div></td>
20503 </tbody></table>
20504 !! wikitext
20506 |<nowiki>foo|bar</nowiki>
20508 |x<div><nowiki>a|b</nowiki></div>
20510 !! html/php+tidy
20511 <table>
20512 <tr>
20513 <td>foo|bar</td>
20514 </tr>
20515 <tr>
20516 <td>x
20517 <div>a|b</div>
20518 </td>
20519 </tr>
20520 </table>
20521 !! end
20523 !! test
20524 Tables: 2b. Nested in td
20525 !! options
20526 parsoid=html2wt
20527 !! html/parsoid
20528 <table><tbody><tr>
20529 <td>foo||bar</td>
20530 <td>a<i>b||c</i></td>
20531 <td>a<i><div>b||c</div></i></td>
20532 </tr></tbody></table>
20533 !! wikitext
20535 |<nowiki>foo||bar</nowiki>
20536 |a''<nowiki>b||c</nowiki>''
20537 |a''<div><nowiki>b||c</nowiki></div>''
20539 !! html/php
20540 <table>
20541 <tr>
20542 <td>foo||bar
20543 </td>
20544 <td>a<i>b||c</i>
20545 </td>
20546 <td>a<i><div>b||c</div></i>
20547 </td></tr></table>
20549 !! end
20551 !! test
20552 Tables: 2c. Nested in td -- no escaping needed
20553 !! wikitext
20556 |foo!!bar
20558 !! html/*
20559 <table>
20561 <tr>
20562 <td>foo!!bar
20563 </td></tr></table>
20565 !! end
20567 !! test
20568 Tables: 3a. Nested in th
20569 !! wikitext
20572 !foo!bar
20574 !! html/*
20575 <table>
20577 <tr>
20578 <th>foo!bar
20579 </th></tr></table>
20581 !! end
20583 !! test
20584 Tables: 3b. Nested in th
20585 !! options
20586 parsoid=html2wt
20587 !! html/parsoid
20588 <table><tbody>
20589 <tr><th>foo!!bar</th>
20590 <th><i>foo|bar</i></th>
20591 <th><i>foo!!bar</i></th>
20592 <th><i><span>foo!!bar</span></i></th>
20593 </tr></tbody></table>
20594 !! wikitext
20596 !<nowiki>foo!!bar</nowiki>
20597 !''<nowiki>foo|bar</nowiki>''
20598 !''<nowiki>foo!!bar</nowiki>''
20599 !''<span><nowiki>foo!!bar</nowiki></span>''
20601 !! html/php
20602 <table>
20603 <tr>
20604 <th>foo!!bar
20605 </th>
20606 <th><i>foo|bar</i>
20607 </th>
20608 <th><i>foo!!bar</i>
20609 </th>
20610 <th><i><span>foo!!bar</span></i>
20611 </th></tr></table>
20613 !! end
20615 !! test
20616 Tables: 3c. Nested in th
20617 !! options
20618 parsoid=html2wt
20619 !! html/parsoid
20620 <table><tbody>
20621 <tr><th>foo||bar</th>
20622 <th><span typeof="mw:Nowiki">foo||bar</span></th>
20623 </tr></tbody></table>
20624 !! wikitext
20626 !<nowiki>foo||bar</nowiki>
20627 !<nowiki>foo||bar</nowiki>
20629 !! html/php
20630 <table>
20631 <tr>
20632 <th>foo||bar
20633 </th>
20634 <th>foo||bar
20635 </th></tr></table>
20637 !! end
20639 !! test
20640 Tables: 4a. Escape -
20641 !! options
20642 parsoid=html2wt
20643 !! wikitext
20646 !-bar
20649 |<nowiki>-bar</nowiki>
20651 !! html/*
20652 <table>
20654 <tr>
20655 <th>-bar
20656 </th></tr>
20657 <tr>
20658 <td>-bar
20659 </td></tr></table>
20661 !! end
20663 !! test
20664 Tables: 4b. Escape +
20665 !! options
20666 parsoid=html2wt
20667 !! wikitext
20670 !+bar
20673 |<nowiki>+bar</nowiki>
20675 !! html/*
20676 <table>
20678 <tr>
20679 <th>+bar
20680 </th></tr>
20681 <tr>
20682 <td>+bar
20683 </td></tr></table>
20685 !! end
20687 !! test
20688 Tables: 4c. No escaping needed
20689 !! wikitext
20691 |foo-bar
20692 |foo+bar
20694 |''foo''-bar
20695 |''foo''+bar
20697 |foo
20698 bar|baz
20699 +bar
20700 -bar
20703 <div>a|b</div>
20705 !! html/php
20706 <table>
20707 <tr>
20708 <td>foo-bar
20709 </td>
20710 <td>foo+bar
20711 </td></tr>
20712 <tr>
20713 <td><i>foo</i>-bar
20714 </td>
20715 <td><i>foo</i>+bar
20716 </td></tr>
20717 <tr>
20718 <td>foo
20719 <p>bar|baz
20720 +bar
20721 -bar
20722 </p>
20723 </td></tr>
20724 <tr>
20725 <td>x
20726 <div>a|b</div>
20727 </td></tr></table>
20729 !! html/parsoid
20730 <table><tbody>
20731 <tr><td>foo-bar</td><td>foo+bar</td></tr>
20732 <tr><td><i>foo</i>-bar</td><td><i>foo</i>+bar</td></tr>
20733 <tr><td>foo
20734 <p>bar|baz
20735 +bar
20736 -bar</p></td></tr>
20737 <tr><td>x
20738 <div>a|b</div></td>
20739 </tbody></table>
20740 !! end
20742 !! test
20743 Tables: 4d. No escaping needed
20744 !! wikitext
20746 |[[Foo]]-bar
20747 ||+1
20748 ||-2
20750 !! html/php
20751 <table>
20752 <tr>
20753 <td><a href="/wiki/Foo" title="Foo">Foo</a>-bar
20754 </td>
20755 <td>+1
20756 </td>
20757 <td>-2
20758 </td></tr></table>
20760 !! html/parsoid
20761 <table>
20762 <tbody><tr><td><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo</a>-bar</td>
20763 <td data-parsoid='{"startTagSrc":"|","attrSepSrc":"|"}'>+1</td>
20764 <td data-parsoid='{"startTagSrc":"|","attrSepSrc":"|"}'>-2</td></tr>
20765 </tbody></table>
20766 !! end
20768 !! test
20769 Tables: Digest broken attributes on table and tr tag
20770 !! options
20771 parsoid=wt2html
20772 !! wikitext
20773 {| || |} ++
20774 |- || || ++ --
20775 |- > [
20777 !! html
20778 <table>
20779 <tbody>
20780 <tr></tr>
20781 <tr></tr>
20782 </tbody></table>
20783 !! end
20785 #### --------------- Links ----------------
20786 #### 1. Quote marks in link text
20787 #### 2. Wikilinks: Escapes needed
20788 #### 3. Wikilinks: No escapes needed
20789 #### 4. Extlinks: Escapes needed
20790 #### 5. Extlinks: No escapes needed
20791 #### --------------------------------------
20792 !! test
20793 Links 1. Quote marks in link text
20794 !! options
20795 parsoid
20796 !! wikitext
20797 [[Foo|Foo<nowiki>''boo''</nowiki>]]
20798 !! html
20799 <a rel="mw:WikiLink" href="Foo">Foo''boo''</a>
20800 !! end
20802 !! test
20803 Links 2. WikiLinks: Escapes needed
20804 !! options
20805 parsoid
20806 !! wikitext
20807 [[Foo|[Foobar]]]
20808 [[Foo|<nowiki>Foobar]</nowiki>]]
20809 [[Foo|x [Foobar] x]]
20810 [[Foo|x <nowiki>[http://google.com g]</nowiki> x]]
20811 [[Foo|<nowiki>[[Bar]]</nowiki>]]
20812 [[Foo|<nowiki>x [[Bar]] x</nowiki>]]
20813 [[Foo|<nowiki>|Bar</nowiki>]]
20814 [[Foo|<nowiki>]]bar</nowiki>]]
20815 [[Foo|<nowiki>[[bar</nowiki>]]
20816 [[Foo|<nowiki>x [[ y</nowiki>]]
20817 [[Foo|<nowiki>x ]] y</nowiki>]]
20818 [[Foo|<nowiki>x ]] y [[ z</nowiki>]]
20819 !! html
20820 <a href="Foo" rel="mw:WikiLink">[Foobar]</a>
20821 <a href="Foo" rel="mw:WikiLink">Foobar]</a>
20822 <a href="Foo" rel="mw:WikiLink">x [Foobar] x</a>
20823 <a href="Foo" rel="mw:WikiLink">x [http://google.com g] x</a>
20824 <a href="Foo" rel="mw:WikiLink">[[Bar]]</a>
20825 <a href="Foo" rel="mw:WikiLink">x [[Bar]] x</a>
20826 <a href="Foo" rel="mw:WikiLink">|Bar</a>
20827 <a href="Foo" rel="mw:WikiLink">]]bar</a>
20828 <a href="Foo" rel="mw:WikiLink">[[bar</a>
20829 <a href="Foo" rel="mw:WikiLink">x [[ y</a>
20830 <a href="Foo" rel="mw:WikiLink">x ]] y</a>
20831 <a href="Foo" rel="mw:WikiLink">x ]] y [[ z</a>
20832 !! end
20834 !! test
20835 Links 3. WikiLinks: No escapes needed
20836 !! options
20837 parsoid
20838 !! wikitext
20839 [[Foo|[Foobar]]
20840 [[Foo|foo|bar]]
20841 !! html
20842 <a href="Foo" rel="mw:WikiLink">[Foobar</a>
20843 <a href="Foo" rel="mw:WikiLink">foo|bar</a>
20844 !! end
20846 !! test
20847 Links 4. ExtLinks: Escapes needed
20848 !! options
20849 parsoid
20850 !! wikitext
20851 [http://google.com <nowiki>[google]</nowiki>]
20852 [http://google.com <nowiki>google]</nowiki>]
20854 <nowiki>[http://google.com]</nowiki>
20856 <nowiki>[http://google.com google]</nowiki>
20858 !! html
20859 <p><a href="http://google.com" rel="mw:ExtLink">[google]</a>
20860 <a href="http://google.com" rel="mw:ExtLink">google]</a></p>
20861 <p>[http://google.com]</p>
20862 <p>[http://google.com google]</p>
20863 !! end
20865 !! test
20866 Links 5. ExtLinks: No escapes needed
20867 !! options
20868 parsoid
20869 !! wikitext
20870 [http://google.com [google]
20871 !! html
20872 <a href="http://google.com" rel="mw:ExtLink">[google</a>
20873 !! end
20875 !! test
20876 Links 6. Add <nowiki/>s between text-nodes and url-links when required (bug 64300)
20877 !! html/parsoid
20878 <p>x<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>y
20879 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>?x
20880 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>&amp;x
20881 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>'x
20882 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>,x
20883 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>.x
20884 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>;x
20885 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>:x
20886 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>;x
20887 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>!x
20888 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>=x
20889 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>(x)
20890 <a rel="mw:ExtLink" href="http://example.com(x" data-parsoid='{"stx":"url"}'>http://example.com(x</a>)
20891 </p>
20892 !! wikitext
20893 x<nowiki/>http://example.com<nowiki/>y
20894 http://example.com<nowiki/>?x
20895 http://example.com<nowiki/>&x
20896 http://example.com<nowiki/>'x
20897 http://example.com<nowiki/>,x
20898 http://example.com<nowiki/>.x
20899 http://example.com<nowiki/>;x
20900 http://example.com<nowiki/>:x
20901 http://example.com<nowiki/>;x
20902 http://example.com<nowiki/>!x
20903 http://example.com<nowiki/>=x
20904 http://example.com<nowiki/>(x)
20905 http://example.com(x<nowiki/>)
20906 !! end
20908 !! test
20909 Links 7a. Don't add spurious <nowiki/>s between text-nodes and url-links (bug 64300)
20910 !! html/parsoid
20911 <p>x
20912 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>
20914 "<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>"
20915 (<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>)
20916 (<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>) foo
20917 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>,
20918 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>, foo
20919 </p>
20920 !! wikitext
20922 http://example.com
20924 "http://example.com"
20925 (http://example.com)
20926 (http://example.com) foo
20927 http://example.com,
20928 http://example.com, foo
20929 !! end
20931 ## Parsoid currently fails wt2html on this one!
20932 !! test
20933 Links 7b. Don't add spurious <nowiki/>s between text-nodes and url-links (bug 64300)
20934 !! html/parsoid
20935 <p><a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>.,;:!?</p>
20936 !! wikitext
20937 http://example.com.,;:!?
20938 !! end
20940 !! test
20941 Links 8. Add <nowiki/>s between text-nodes and RFC-links when required (bug 64300)
20942 !! html/parsoid
20943 <p><a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>4</p>
20944 !! wikitext
20945 RFC 123<nowiki/>4
20946 !! end
20948 !! test
20949 Links 9. Don't add spurious <nowiki/>s between text-nodes and RFC-links (bug 64300)
20950 !! html/parsoid
20951 <p>x<a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>y
20952 X<a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>y
20953 <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>?foo
20954 <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>&amp;foo
20955 </p>
20956 !! wikitext
20957 xRFC 123y
20958 XRFC 123y
20959 RFC 123?foo
20960 RFC 123&foo
20961 !! end
20963 !! test
20964 Links 10. Add <nowiki/>s between text-nodes and PMID-links when required (bug 64300)
20965 !! html/parsoid
20966 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>4
20967 !! wikitext
20968 PMID 123<nowiki/>4
20969 !! end
20971 !! test
20972 Links 11. Don't add spurious <nowiki/>s between text-nodes and PMID-links (bug 64300)
20973 !! html/parsoid
20974 <p>x<a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>y
20975 X<a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>y
20976 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>?foo
20977 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>&foo
20978 </p>
20979 !! wikitext
20980 xPMID 123y
20981 XPMID 123y
20982 PMID 123?foo
20983 PMID 123&foo
20984 !! end
20986 !! test
20987 Links 12. Add <nowiki/>s between text-nodes and ISBN-links when required (bug 64300)
20988 !! html/parsoid
20989 <p><a href="./Special:BookSources/1234567890" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>1
20990 <a href="./Special:BookSources/1234567890" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>x
20991 <a href="./Special:BookSources/1234567890" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>b
20992 </p>
20993 !! wikitext
20994 ISBN 1234567890<nowiki/>1
20995 ISBN 1234567890<nowiki/>x
20996 ISBN 1234567890<nowiki/>b
20997 !! end
20999 !! test
21000 Links 12. Don't add spurious <nowiki/>s between text-nodes and ISBN-links (bug 64300)
21001 !! html/parsoid
21002 <p><a href="./Special:BookSources/1234567890" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>'s
21003 !! wikitext
21004 ISBN 1234567890's
21005 !! end
21007 !! test
21008 Links 13: Protect link-like plain text. (Parsoid bug T78425)
21009 !! options
21010 parsoid=html2wt
21011 !! html/*
21012 <p>this is not a link: http://example.com
21013 </p>
21014 !! wikitext
21015 this is not a link: <nowiki>http://example.com</nowiki>
21016 !! end
21019 #### --------------- Quotes ---------------
21020 #### 1. Quotes inside <b> and <i>
21021 #### 2. Link fragments separated by <i> and <b> tags
21022 #### 3. Link fragments inside <i> and <b>
21023 #### 4. No escaping needed
21024 #### --------------------------------------
21025 !! test
21026 1a. Quotes inside <b> and <i>
21027 !! options
21028 parsoid=html2wt,wt2wt
21029 !! wikitext
21030 ''<nowiki/>'foo'<nowiki/>''
21031 ''<nowiki>''foo''</nowiki>''
21032 ''<nowiki>'''foo'''</nowiki>''
21033 ''foo''<nowiki/>'s
21034 '''<nowiki/>'foo'<nowiki/>'''
21035 '''<nowiki>''foo''</nowiki>'''
21036 '''<nowiki>'''foo'''</nowiki>'''
21037 '''foo'<nowiki/>''bar'<nowiki/>''baz'''
21038 '''foo'''<nowiki/>'s
21039 '''foo''
21040 ''foo''<nowiki/>'
21041 ''foo'<nowiki/>''<nowiki/>'
21042 '<nowiki/>''foo''<nowiki/>'
21043 ''''foo'''
21044 '''foo'''<nowiki/>'
21045 '<nowiki/>'''foo'''<nowiki/>'
21046 ''fools'<span> errand</span>''
21047 ''<span>fool</span>'s errand''
21048 a|!*#-:;+-~[]{}b'''x''
21049 !! html/*
21050 <p><i>'foo'</i>
21051 <i>''foo''</i>
21052 <i>'''foo'''</i>
21053 <i>foo</i>'s
21054 <b>'foo'</b>
21055 <b>''foo''</b>
21056 <b>'''foo'''</b>
21057 <b>foo'<i>bar'</i>baz</b>
21058 <b>foo</b>'s
21059 '<i>foo</i>
21060 <i>foo</i>'
21061 <i>foo'</i>'
21062 '<i>foo</i>'
21063 '<b>foo</b>
21064 <b>foo</b>'
21065 '<b>foo</b>'
21066 <i>fools'<span> errand</span></i>
21067 <i><span>fool</span>'s errand</i>
21068 a|!*#-:;+-~[]{}b'<i>x</i>
21069 </p>
21070 !! end
21072 !! test
21073 1b. Quotes inside <b> and <i> with other chars
21074 !! options
21075 parsoid=html2wt,wt2wt
21076 !! wikitext
21077 '''a'' foo ''[[bar]]''
21078 ''a''' foo ''[[bar]]''
21079 ''a''' foo '''{{echo|[[bar]]}}'''
21080 [[foo]] x'''[[bar]]''
21081 !! html
21082 '<i>a</i> foo <i><a rel="mw:WikiLink" href="Bar" title="Bar">bar</a></i>
21083 <i>a'</i> foo <i><a rel="mw:WikiLink" href="Bar" title="Bar">bar</a></i>
21084 <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>
21085 <a rel="mw:WikiLink" href="Foo" title="Foo">foo</a> x'<i><a href="Bar" rel="mw:WikiLink" title="Bar">bar</a></i>
21086 !! end
21088 !! test
21089 2. Link fragments separated by <i> and <b> tags
21090 !! wikitext
21091 [[''foo''<nowiki>hello]]</nowiki>
21093 [['''foo'''<nowiki>hello]]</nowiki>
21094 !! html
21095 <p>[[<i>foo</i>hello]]
21096 </p><p>[[<b>foo</b>hello]]
21097 </p>
21098 !! end
21100 # FIXME: Escaping one or both of [[ and ]] is also acceptable --
21101 #        this is one of the shortcomings of this format
21102 !! test
21103 3. Link fragments inside <i> and <b>
21104 !! wikitext
21105 ''[[foo''<nowiki>]]</nowiki>
21107 '''[[foo'''<nowiki>]]</nowiki>
21108 !! html
21109 <p><i>[[foo</i>]]
21110 </p><p><b>[[foo</b>]]
21111 </p>
21112 !! end
21114 !! test
21115 4. No escaping needed
21116 !! wikitext
21117 '<span>''bar''</span>'
21118 '<span>'''bar'''</span>'
21119 'a:b'foo
21120 !! html
21121 <p>'<span><i>bar</i></span>'
21122 '<span><b>bar</b></span>'
21123 'a:b'foo
21124 </p>
21125 !! end
21127 #### ----------- Paragraphs ---------------
21128 #### 1. No unnecessary escapes
21129 #### --------------------------------------
21131 !! test
21132 1. No unnecessary escapes
21133 !! wikitext
21134 bar <span><nowiki>[[foo]]</nowiki></span>
21136 =bar <span><nowiki>[[foo]]</nowiki></span>
21138 [[bar <span><nowiki>[[foo]]</nowiki></span>
21140 ]]bar <span><nowiki>[[foo]]</nowiki></span>
21142 =bar <span>foo]]</span><nowiki>=</nowiki>
21143 !! html
21144 <p>bar <span>[[foo]]</span>
21145 </p><p>=bar <span>[[foo]]</span>
21146 </p><p>[[bar <span>[[foo]]</span>
21147 </p><p>]]bar <span>[[foo]]</span>
21148 </p><p>=bar <span>foo]]</span>=
21149 </p>
21150 !!end
21152 #### ----------------------- PRE --------------------------
21153 #### 1. Leading whitespace in SOL context should be escaped
21154 #### ------------------------------------------------------
21155 !! test
21156 1. Leading whitespace in SOL context should be escaped
21157 !! options
21158 parsoid
21159 !! wikitext
21160 <nowiki> </nowiki>a
21162 <nowiki> </nowiki> a
21164 <nowiki>        </nowiki>a(tab)
21166 <nowiki> </nowiki>      a
21167 <!--cmt-->
21168 <nowiki> </nowiki> a
21171 <nowiki> </nowiki>b
21174 <nowiki>        </nowiki>b
21177 <nowiki>        </nowiki> b
21178 !! html
21179 <p> a</p>
21180 <p>  a</p>
21181 <p>     a(tab)</p>
21182 <p>     a</p>
21183 <p><!--cmt-->  a</p>
21184 <p>a
21185  b</p>
21186 <p>a
21187         b</p>
21188 <p>a
21189          b</p>
21190 !! end
21192 !! test
21193 2. Leading whitespace in non-indent-pre contexts should not be escaped
21194 !! options
21195 parsoid
21196 !! wikitext
21197 foo <ref>''a''
21198  b</ref>
21199 !! html
21200 <p>foo <span about="#mwt2" class="reference" id="cite_ref-1-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"html":"&lt;i data-parsoid=&#39;{\"dsr\":[9,14,2,2]}&#39;>a&lt;/i>\n b"},"attrs":{}}'><a href="#cite_note-1">[1]</a></span></p>
21201 !! end
21203 !! test
21204 3. Leading whitespace in indent-pre suppressing contexts should not be escaped
21205 !! options
21206 parsoid
21207 !! wikitext
21208 <blockquote>
21210  <span>b</span>
21212 </blockquote>
21213 !! html
21214 <blockquote>
21217  <span>b</span>
21218  c</p>
21219 </blockquote>
21220 !! end
21222 !! test
21223 4. Leading whitespace in indent-pre suppressing contexts should not be escaped
21224 !! options
21225 parsoid
21226 !! wikitext
21227  [[File:Foobar.jpg|thumb|caption]]
21228 !! html
21229 !! html/parsoid
21230  <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="25" width="220"/></a><figcaption>caption</figcaption></figure>
21231 !! end
21233 !! test
21234 5. Nowiki escaping should account for indent-pres
21235 !! options
21236 parsoid=html2wt
21237 !! html
21238 <pre>==foo==</pre>
21239 !! wikitext
21240  ==foo==
21241 !! end
21243 #### --------------- Behavior Switches --------------------
21244 !! test
21245 1. Valid behavior switches should be escaped
21246 !! options
21247 parsoid=html2wt
21248 !! wikitext
21249 <nowiki>__TOC__</nowiki>
21250 ''<nowiki>__TOC__</nowiki>''
21251 !! html
21252 __TOC__
21253 <i>__TOC__</i>
21254 !! end
21256 !! test
21257 2. Invalid behavior switches should not be escaped
21258 !! options
21259 parsoid=html2wt
21260 !! wikitext
21261 __TOO__
21262 __|__
21263 !! html
21264 __TOO__
21265 __|__
21266 !! end
21268 #### --------------- HTML tags ---------------
21269 #### 1. a tags
21270 #### 2. other tags
21271 #### 3. multi-line html tag
21272 #### 4. extension tags
21273 #### -----------------------------------------
21274 !! test
21275 1. a tags
21276 !! options
21277 parsoid
21278 !! wikitext
21279 <a href="http://google.com">google</a>
21280 !! html
21281 &lt;a href=&quot;http://google.com&quot;&gt;google&lt;/a&gt;
21282 !! end
21284 !! test
21285 2. other tags
21286 !! wikitext
21287 <nowiki><div>foo</div>
21288 <div style="color:red">foo</div></nowiki>
21289 !! html
21290 <p>&lt;div&gt;foo&lt;/div&gt;
21291 &lt;div style=&quot;color:red&quot;&gt;foo&lt;/div&gt;
21292 </p>
21293 !! end
21295 !! test
21296 3. multi-line html tag
21297 !! wikitext
21298 <nowiki><div
21299 >foo</div
21300 ></nowiki>
21301 !! html
21302 <p>&lt;div
21303 &gt;foo&lt;/div
21304 &gt;
21305 </p>
21306 !! end
21308 !! test
21309 4. extension tags
21310 !! wikitext
21311 <nowiki><ref>foo</ref></nowiki>
21313 <nowiki><ref>bar</nowiki>
21315 baz<nowiki></ref></nowiki>
21316 !! html
21317 <p>&lt;ref&gt;foo&lt;/ref&gt;
21318 </p><p>&lt;ref&gt;bar
21319 </p><p>baz&lt;/ref&gt;
21320 </p>
21321 !! end
21323 #### --------------- Others ---------------
21324 !! test
21325 Escaping nowikis
21326 !! wikitext
21327 &lt;nowiki&gt;foo&lt;/nowiki&gt;
21328 !! html
21329 <p>&lt;nowiki&gt;foo&lt;/nowiki&gt;
21330 </p>
21331 !! end
21333 ## The quote-char in the input is necessary for triggering the bug
21334 !! test
21335 (Bug 52035) Nowiki-escaping should not get tripped by " :" in text
21336 !! options
21337 parsoid=wt2wt,html2wt
21338 !! wikitext
21339 foo's bar :
21340 !! html
21341 <p>foo's bar :</p>
21342 !! end
21344 !! test
21346 Tag-like HTML structures are passed through as text
21347 !! wikitext
21348 <x y>
21350 <x.y>
21352 <x-y>
21360 1<d e>f
21361 !! html
21362 <p>&lt;x y&gt;
21363 </p><p>&lt;x.y&gt;
21364 </p><p>&lt;x-y&gt;
21365 </p><p>1&gt;2
21366 </p><p>x&lt;y
21367 </p><p>a&gt;b
21368 </p><p>1&lt;d e&gt;f
21369 </p>
21370 !! end
21373 # This was a bug in the PHP parser (see bug 17663 and its dups,
21374 # https://bugzilla.wikimedia.org/show_bug.cgi?id=17663)
21375 !! test
21376 Tag names followed by punctuation should not be recognized as tags
21377 !! wikitext
21378 <s.ome> text
21379 !! html
21380 <p>&lt;s.ome&gt; text
21381 </p>
21382 !! end
21384 !! test
21385 HTML tag with necessary entities in attributes
21386 !! wikitext
21387 <span title="&amp;amp;">foo</span>
21388 !! html
21389 <p><span title="&amp;amp;">foo</span>
21390 </p>
21391 !! end
21393 !! test
21394 HTML tag with 'unnecessary' entity encoding in attributes
21395 !! wikitext
21396 <span title="&amp;">foo</span>
21397 !! html
21398 <p><span title="&amp;">foo</span>
21399 </p>
21400 !! end
21402 !! test
21403 HTML tag with broken attribute value quoting
21404 !! wikitext
21405 <span title="Hello world>Foo</span>
21406 !! html/php
21407 <p><span>Foo</span>
21408 </p>
21409 !! html/parsoid
21410 <p><span title="Hello world">Foo</span>
21411 </p>
21412 !! end
21414 !! test
21415 Parsoid-only: HTML tag with broken attribute value quoting
21416 !! options
21417 parsoid
21418 !! wikitext
21419 <span title="Hello world>Foo</span>
21420 !! html
21421 <p><span title="Hello world">Foo</span>
21422 </p>
21423 !! end
21425 !! test
21426 Table with broken attribute value quoting
21427 !! wikitext
21429 | title="Hello world|Foo
21431 !! html/php
21432 <table>
21433 <tr>
21434 <td>Foo
21435 </td></tr></table>
21437 !! html/parsoid
21438 <table>
21439 <tr>
21440 <td title="Hello world">Foo
21441 </td></tr></table>
21443 !! end
21445 !! test
21446 Table with broken attribute value quoting on consecutive lines
21447 !! wikitext
21449 | title="Hello world|Foo
21450 | style="color:red|Bar
21452 !! html/php
21453 <table>
21454 <tr>
21455 <td>Foo
21456 </td>
21457 <td>Bar
21458 </td></tr></table>
21460 !! html/parsoid
21461 <table><tbody>
21462 <tr>
21463 <td title="Hello world">Foo
21464 </td><td style="color: red">Bar
21465 </td></tr></tbody></table>
21467 !! end
21469 !! test
21470 Parsoid-only: Don't wrap broken template tags in <nowiki> on wt2wt (Bug 42353)
21471 !! options
21472 parsoid
21473 !! wikitext
21474 {{}}
21475 !! html
21476 {{}}
21477 !! end
21479 !! test
21480 Parsoid-only: Don't wrap broken template tags in <nowiki> on wt2wt (Bug 42353)
21481 !! options
21482 parsoid
21483 !! wikitext
21484 }}{{
21485 !! html
21486 }}{{
21487 !! end
21489 !!test
21490 Accept empty td cell attribute
21491 !! wikitext
21493 | align="center" | foo ||  |
21495 !! html
21496 <table>
21497 <tr>
21498 <td align="center"> foo </td>
21499 <td>
21500 </td></tr></table>
21502 !!end
21504 !!test
21505 Non-empty attributes in th-cells
21506 !! wikitext
21508 ! Foo !! style="color: red" | Bar
21510 !! html
21511 <table>
21512 <tr>
21513 <th> Foo </th>
21514 <th style="color: red"> Bar
21515 </th></tr></table>
21517 !!end
21519 !!test
21520 Accept empty attributes in th-cells
21521 !! wikitext
21523 !| foo !!| bar
21525 !! html
21526 <table>
21527 <tr>
21528 <th> foo </th>
21529 <th> bar
21530 </th></tr></table>
21532 !!end
21534 !!test
21535 Empty table rows go away
21536 !! wikitext
21538 | Hello
21539 | there
21540 |- class="foo"
21543 !! html
21544 <table>
21545 <tr>
21546 <td> Hello
21547 </td>
21548 <td> there
21549 </td></tr>
21551 </table>
21553 !! end
21556 ### Parsoid-centric tests for testing RTing of inter-element separators
21557 ### Edge cases not tested by existing parser tests and specific to
21558 ### Parsoid-specific serialization strategies.
21561 !!test
21562 RT-ed inter-element separators should be valid separators
21563 !! wikitext
21565 |- [[foo]]
21567 !! html
21568 <table>
21570 </table>
21572 !!end
21574 # Parsoid-only since PHP parser relies on Tidy for correct output
21575 !!test
21576 Trailing newlines in a deep dom-subtree that ends a wikitext line should be migrated out
21577 !!options
21578 parsoid
21579 !! wikitext
21581 |<small>foo
21586 |<small>foo<small>
21588 !! html
21589 <table>
21590 <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'><small data-parsoid='{"stx":"html","autoInsertedEnd":true}'>foo
21591 <p>bar</p></small></td></tr>
21592 </tbody></table>
21594 <table>
21595 <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>
21596 </tbody></table>
21597 !!end
21599 !!test
21600 Empty TD followed by TD with tpl-generated attribute
21601 !! wikitext
21605 |{{echo|style='color:red'}}|foo
21607 !! html
21608 <table>
21610 <tr>
21611 <td>
21612 </td>
21613 <td>foo
21614 </td></tr></table>
21616 !!end
21618 !!test
21619 Indented table with an empty td
21620 !! wikitext
21621  {|
21622  |-
21624  |foo
21625  |}
21626 !! html
21627 <table>
21629 <tr>
21630 <td>
21631 </td>
21632 <td>foo
21633 </td></tr></table>
21635 !!end
21637 !!test
21638 Indented block & table
21639 !! wikitext
21640  <div>foo</div>
21641  {|
21642  |foo
21643  |}
21644 !! html/php
21645  <div>foo</div>
21646 <table>
21647 <tr>
21648 <td>foo
21649 </td></tr></table>
21651 !! html/parsoid
21652  <div data-parsoid='{"stx":"html"}'>foo</div>
21653  <table><tbody>
21654  <tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'>foo</td></tr>
21655  </tbody></table>
21656 !!end
21658 !! test
21659 Indent and comment before table row
21660 !! wikitext
21662  <!--hi-->|-
21663  | there
21665 !! html/php
21666 <table>
21668 <tr>
21669 <td> there
21670 </td></tr></table>
21672 !! html/parsoid
21673 <table>
21674  <!--hi--><tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'>
21675  <td data-parsoid='{"autoInsertedEnd":true}'> there</td></tr>
21676 </tbody></table>
21677 !! end
21679 # Parsoid-specific since PHP parser doesn't handle this mixed tbl-wikitext
21680 !!test
21681 Empty TR followed by a template-generated TR
21682 !!options
21683 parsoid
21684 !! wikitext
21687 {{echo|<tr><td>foo</td></tr>}}
21689 !! html
21690 <table>
21691 <tbody>
21692 <tr></tr>
21693 <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}}]}'>
21694 <td>foo</td></tr>
21695 </tbody></table>
21696 !!end
21698 ## PHP and parsoid output differ for this, and since this is primarily
21699 ## for testing Parsoid's serializer, marking this Parsoid only
21700 !!test
21701 Empty TR followed by mixed-ws-comment line should RT correctly
21702 !!options
21703 parsoid
21704 !! wikitext
21707  <!--c-->
21709 <!--c--> <!--d-->
21711 !! html
21712 <table>
21713 <tbody>
21714 <tr></tr>
21715  <!--c-->
21716 <tr>
21717 <!--c--> </tr><!--d-->
21718 </tbody></table>
21720 !!end
21722 !!test
21723 Multi-line image caption generated by templates with/without trailing newlines
21724 !! wikitext
21725 [[File:Foobar.jpg|thumb|300x300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}]]
21726 [[File:Foobar.jpg|thumb|300x300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}\n\n]]
21727 !! html/parsoid
21728 <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" 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>
21729 <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" 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>
21730 !!end
21732 !! test
21733 New element inserted (without intervening newlines) after an old sol-transparent node should serialize correctly
21734 !! options
21735 parsoid=html2wt
21736 !! wikitext
21737 <includeonly>foo</includeonly>
21738 new para
21740 [[./Category:Foo]]
21742 = new heading =
21743 !! html
21744 <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>
21746 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid=''/><h1>new heading</h1>
21747 !! end
21749 ## PHP emits broken html for this, and since this is primarily
21750 ## a Parsoid serializer test, marking this Parsoid only
21751 !!test
21752 Improperly nested inline or quotes tags with whitespace in between
21753 !!options
21754 parsoid
21755 !! wikitext
21756 <span> <s>x</span> </s>
21757 ''' ''x''' ''
21758 !! html
21759 <p><span> <s>x</s></span><s> </s>
21760 <b> <i>x</i></b><i> </i>
21761 </p>
21762 !!end
21764 !!test
21765 Encapsulate protected attributes from wt
21766 !!options
21767 parsoid
21768 !! wikitext
21769 <div typeof="mw:placeholder stuff" data-parsoid="weird" data-parsoid-other="no" about="time" rel="mw:true">foo</div>
21770 !! html
21771 <body><div data-x-typeof="mw:placeholder stuff" data-x-data-parsoid="weird" data-x-data-parsoid-other="no" data-x-about="time" data-x-rel="mw:true">foo</div>
21772 </body>
21773 !!end
21775 ## Currently the p-wrapper is fragile in how it adds / removes transformations.
21776 ## Having nested or stray pre tags results in the attempt to add duplicates,
21777 ## causing an assertion fail. This test tries to prevent that situation.
21778 !!test
21779 Ensure ParagraphWrapper can deal with stray closing pre tags
21780 !!options
21781 parsoid=wt2html
21782 !! wikitext
21783 plain text</pre>
21784 !! html
21785 plain text
21786 !!end
21788 !!test
21789 1. Ensure fostered text content is wrapped in element nodes
21790 !!options
21791 parsoid=wt2html
21792 !! wikitext
21793 <table>hi</table><table>ho</table>
21794 !! html
21795 <p>hi</p>
21796 <table></table>
21797 <p>ho</p>
21798 <table></table>
21799 !!end
21801 !!test
21802 2. Ensure fostered text content is wrapped in element nodes (traps regressions around fostered marker on the element getting lost)
21803 !!options
21804 parsoid=wt2html,wt2wt
21805 !! wikitext
21806 <table>
21807 <tr> || ||
21808 <td> a
21809 </table>
21810 !! html
21811 <p> || ||
21812 </p><table>
21813 <tbody><tr><td> a</td></tr>
21814 </tbody></table>
21815 !!end
21817 !!test
21818 Encapsulation properly handles null DSR information from foster box
21819 !!options
21820 parsoid=wt2html,wt2wt
21821 !! wikitext
21822 {{echo|<table>foo<tr><td>bar</td></tr></table>}}
21823 !! html
21824 <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>
21825 !!end
21827 !!test
21828 1. Encapsulate foster-parented transclusion content
21829 !!options
21830 parsoid=wt2wt,wt2html
21831 !! wikitext
21832 <table>{{echo|foo<tr><td>bar</td></tr>}}</table>
21833 !! html
21834 <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>
21835 <tbody>
21836 <tr>
21837 <td>bar</td>
21838 </tr>
21839 </tbody>
21840 </table>
21841 !!end
21843 !!test
21844 2. Encapsulate foster-parented transclusion content
21845 !!options
21846 parsoid=wt2wt,wt2html
21847 !! wikitext
21848 <table><div>{{echo|foo}}</div><tr><td>bar</td></tr></table>
21849 !! html
21850 <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>
21851 <table>
21852 <tbody>
21853 <tr>
21854 <td>bar</td>
21855 </tr>
21856 </tbody>
21857 </table>
21858 !!end
21860 !!test
21861 3. Encapsulate foster-parented transclusion content
21862 !!options
21863 parsoid=wt2wt,wt2html
21864 !! wikitext
21865 <table><div><p>{{echo|foo</p></div><tr><td>}}bar</td></tr></table>
21866 !! html
21867 <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;]}">
21868 <p>foo</p>
21869 </div>
21870 <table>
21871 <tbody>
21872 <tr>
21873 <td>bar</td>
21874 </tr>
21875 </tbody>
21876 </table>
21877 !!end
21879 !!test
21880 4. Encapsulate foster-parented transclusion content
21881 !!options
21882 parsoid=wt2wt,wt2html
21883 !! wikitext
21884 <table><div><p>{{echo|foo</p></div><tr><td>}}bar</td></tr></table>
21885 !! html
21886 <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;]}">
21887 <p>foo</p>
21888 </div>
21889 <table>
21890 <tbody>
21891 <tr>
21892 <td>bar</td>
21893 </tr>
21894 </tbody>
21895 </table>
21896 !!end
21898 !!test
21899 5. Encapsulate foster-parented transclusion content
21900 !!options
21901 parsoid=wt2wt,wt2html
21902 !! wikitext
21903 <table><tr><td><div><p>{{echo|foo</p></div></td>foo}}</tr></table>
21904 !! html
21905 <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>
21906 <table>
21907 <tbody>
21908 <tr>
21909 <td>
21910 <div>
21911 <p>foo</p>
21912 </div>
21913 </td>
21914 </tr>
21915 </tbody>
21916 </table>
21917 !!end
21919 !!test
21920 6. Encapsulate foster-parented transclusion content
21921 !!options
21922 parsoid=wt2wt,wt2html
21923 !! wikitext
21924 <table><tr><td><div><p>{{echo|foo</p></div></td>foo</tr></table>}}<p>ok</p>
21925 !! html
21926 <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>
21927 <table>
21928 <tbody>
21929 <tr>
21930 <td>
21931 <div>
21932 <p>foo</p>
21933 </div>
21934 </td>
21935 </tr>
21936 </tbody>
21937 </table>
21938 <p>ok</p>
21939 !!end
21941 !!test
21942 7. Encapsulate foster-parented transclusion content
21943 !!options
21944 parsoid=wt2wt,wt2html
21945 !! wikitext
21946 <table>{{echo|<p>foo</p>}}<td>bar</td></table>
21947 !! html
21948 <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>
21949 <table>
21950 <tbody>
21951 <tr>
21952 <td>bar</td>
21953 </tr>
21954 </tbody>
21955 </table>
21956 !!end
21958 !!test
21959 8. Encapsulate foster-parented transclusion content
21960 !!options
21961 parsoid=wt2wt,wt2html
21962 !! wikitext
21963 {{echo|a
21964 }}{|{{echo|style='color:red'}}
21968 !! html
21969 <p 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\n&quot;}},&quot;i&quot;:0}}]}">a</p><p typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[&quot;{|&quot;,{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;echo&quot;,&quot;href&quot;:&quot;./Template:Echo&quot;},&quot;params&quot;:{&quot;style&quot;:{&quot;wt&quot;:&quot;'color:red'&quot;}},&quot;i&quot;:0}},&quot;\n|-\n|b\n|}&quot;]}">{{{1}}}</p><table>
21970 <tbody>
21971 <tr>
21972 <td>b</td>
21973 </tr>
21974 </tbody>
21975 </table>
21976 !!end
21978 !!test
21979 9. Encapsulate foster-parented transclusion content
21980 !!options
21981 parsoid=wt2wt,wt2html
21982 !! wikitext
21983 <table>{{echo|hi</table>hello}}
21984 !! html
21985 <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","spc":["","","",""]}]]}'>hi</p><table about="#mwt2" data-parsoid='{"stx":"html"}'></table><p about="#mwt2">hello</p>
21986 !!end
21988 !!test
21989 Table in fosterable position
21990 !!options
21991 parsoid=wt2html,wt2wt
21992 !! wikitext
21993 {{OpenTable}}
21994 <div>
21997 </div>
21999 !! html
22000 <div about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"OpenTable","href":"./Template:OpenTable"},"params":{},"i":0}},"\n&lt;div>"]}' data-parsoid='{"stx":"html","autoInsertedEnd":true,"pi":[[]]}'></div><span about="#mwt1">
22001 </span>
22002 <table about="#mwt1" data-parsoid='{"autoInsertedEnd":true}'></table>
22004 <table>
22005 </table>
22006 !!end
22008 # Parsoid only for bug 64747
22009 !! test
22010 Properly encapsulate empty-content transclusions in fosterable positions
22011 !! wikitext
22012 <table>
22013 {{#if:|
22014 <td>foo</td>
22016 </table>
22017 !! html/parsoid
22018 <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","spc":["","","",""]}]],"src":"&lt;table>\n{{#if:|\n&lt;td>foo&lt;/td>\n}}\n&lt;/table>"}'>
22020 </table>
22021 !! end
22023 !!test
22024 Support <object> element with .data attribute
22025 !!options
22026 parsoid=html2wt
22027 !! wikitext
22028 <object data="test.swf"></object>
22029 !! html
22030 <object data="test.swf"></object>
22031 !!end
22033 !! test
22034 Don't block XML namespace declaration
22035 !! wikitext
22036 <span xmlns:dct="http://purl.org/dc/terms/" property="dct:title">MediaWiki</span>
22037 !! html/php
22038 <p><span>MediaWiki</span>
22039 </p>
22040 !! html/parsoid
22041 <p><span xmlns:dct="http://purl.org/dc/terms/" data-x-property="dct:title" data-parsoid='{"stx":"html"}'>MediaWiki</span></p>
22042 !! end
22044 # -----------------------------------------------------------------
22045 # The following section of tests are primarily to spec requirements
22046 # around serialization of new/edited content.
22048 # All these tests are marked Parsoid html2wt and html2html only
22049 # ----------------------------------------------------------------
22051 # 'mi' is a localinterwiki prefix as well as a language
22052 !! test
22053 Serialize interwiki links pointing to the current wiki as plain wiki links (bug 65869)
22054 !! options
22055 parsoid=html2wt
22056 !! wikitext
22057 [[Foo]]
22058 !! html
22059 <p><a rel="mw:ExtLink" href="http://mi.wikipedia.org/wiki/Foo">Foo</a></p>
22060 !! end
22062 !! test
22063 New wiki links (href variations)
22064 !! options
22065 parsoid=html2wt
22066 !! html
22067 <a rel="mw:WikiLink" href="./Foo_bar">Foo_bar</a>
22068 <a rel="mw:WikiLink" href="Foo_bar">Foo_bar</a>
22069 <a rel="mw:WikiLink" href="Foo bar">Foo_bar</a>
22070 <a rel="mw:WikiLink" href="./Toxine_bact%C3%A9rienne">Toxine bactérienne</a>
22071 !! wikitext
22072 [[Foo_bar]]
22073 [[Foo_bar]]
22074 [[Foo_bar]]
22075 [[Toxine bactérienne]]
22076 !! end
22078 !! test
22079 New wiki links (content string variations)
22080 !! options
22081 parsoid=html2wt
22082 !! html
22083 <a rel="mw:WikiLink" href="./Foo_bar">Foo_bar</a>
22084 <a rel="mw:WikiLink" href="./Foo_bar">Foo bar</a>
22085 <a rel="mw:WikiLink" href="./Foo_bar">./Foo_bar</a>
22086 !! wikitext
22087 [[Foo_bar]]
22088 [[Foo bar]]
22089 [[Foo_bar|./Foo_bar]]
22090 !! end
22092 !! test
22093 New category links (href variations)
22094 !! options
22095 parsoid=html2wt
22096 !! html
22097 <link rel="mw:PageProp/Category" href="./Category:Toxine_bactérienne" />
22098 <link rel="mw:PageProp/Category" href="./Category:Toxine_bact%C3%A9rienne" />
22099 <link rel="mw:PageProp/Category" href="Category:Toxine_bact%C3%A9rienne" />
22100 !! wikitext
22101 [[Category:Toxine bactérienne]]
22102 [[Category:Toxine bactérienne]]
22103 [[Category:Toxine bactérienne]]
22104 !! end
22106 !! test
22107 New interlanguage links (href variations)
22108 !! options
22109 parsoid=html2wt
22110 !! html
22111 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine bactérienne" />
22112 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine_bactérienne" />
22113 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine_bact%C3%A9rienne" />
22114 !! wikitext
22115 [[es:Toxine bactérienne]]
22116 [[es:Toxine_bactérienne]]
22117 [[es:Toxine_bactérienne]]
22118 !! end
22120 !! test
22121 Image: Modifying size of an image (1)
22122 !! options
22123 parsoid={
22124   "modes": ["wt2wt"],
22125   "changes": [
22126     ["img[height]", "attr", "height", "22"],
22127     ["img[width]", "attr", "width", "200"]
22128   ]
22130 !! wikitext
22131 [[Image:Foobar.jpg|230x230px]]
22132 !! wikitext/edited
22133 [[Image:Foobar.jpg|200x200px]]
22134 !!end
22136 !! test
22137 Image: Modifying size of an image (2)
22138 !! options
22139 parsoid={
22140   "modes": ["wt2wt"],
22141   "changes": [
22142     ["img[height]", "attr", "height", "100"],
22143     ["img[width]", "attr", "width", "500"]
22144   ]
22146 !! wikitext
22147 [[Image:Foobar.jpg|230x230px]]
22148 !! wikitext/edited
22149 [[Image:Foobar.jpg|500x500px]]
22150 !!end
22152 # Change in size is ignored so long as class='mw-default-size'
22153 !! test
22154 Image: Modifying size of an image (3)
22155 !! options
22156 parsoid={
22157   "modes": ["wt2wt"],
22158   "changes": [
22159     ["figure[class]", "removeClass", "mw-default-size"],
22160     ["figure img", "attr", "height", "19"],
22161     ["figure img", "attr", "width", "170"]
22162   ]
22164 !! wikitext
22165 [[Image:Foobar.jpg|thumb]]
22166 !! wikitext/edited
22167 [[Image:Foobar.jpg|thumb|170x170px]]
22168 !!end
22170 !! test
22171 Image: Modifying alignment of an image (bug 48665)
22172 !! options
22173 parsoid={
22174   "modes": ["wt2wt"],
22175   "changes": [
22176     ["figure[class]", "removeClass", "mw-halign-right"],
22177     ["figure[class]", "addClass", "mw-halign-left"]
22178   ]
22180 !! wikitext
22181 [[Image:Foobar.jpg|thumb|caption|right]]
22182 !! wikitext/edited
22183 [[Image:Foobar.jpg|thumb|caption|left]]
22184 !! end
22186 !! test
22187 Image: Modifying mw-default-size of an frameless image (bug 62805)
22188 !! options
22189 parsoid={
22190   "modes": ["wt2wt"],
22191   "changes": [
22192     ["figure.mw-default-size", "removeClass", "mw-default-size"]
22193   ]
22195 !! wikitext
22196 [[Image:Foobar.jpg|frameless|right]]
22197 !! wikitext/edited
22198 [[Image:Foobar.jpg|frameless|right|220x220px]]
22199 !! end
22201 !! test
22202 Image: Modifying valign of an image (bug 49221)
22203 !! options
22204 parsoid={
22205   "modes": ["wt2wt"],
22206   "changes": [
22207     ["*[typeof=\"mw:Image\"]", "removeClass", "mw-valign-middle"],
22208     ["*[typeof=\"mw:Image\"]", "addClass", "mw-valign-text-top"]
22209   ]
22211 !! wikitext
22212 [[File:Foobar.jpg|20px|middle]]
22213 !! wikitext/edited
22214 [[File:Foobar.jpg|20px|text-top]]
22215 !! end
22217 !! test
22218 Image: Modifying alt attribute of an image (bug 56400)
22219 !! options
22220 parsoid={
22221   "modes": ["wt2wt"],
22222   "changes": [
22223     ["img[alt]", "attr", "alt", "some alternate edited text"]
22224   ]
22226 !! wikitext
22227 [[File:Foobar.jpg|thumb|some caption|alt=some alternate text]]
22228 !! wikitext/edited
22229 [[File:Foobar.jpg|thumb|some caption|alt=some alternate edited text]]
22230 !!end
22232 !! test
22233 Image: Modifying caption of an image
22234 !! options
22235 parsoid={
22236   "modes": ["wt2wt"],
22237   "changes": [
22238     ["figcaption", "text", "new caption"]
22239   ]
22241 !! wikitext
22242 [[Image:Foobar.jpg|thumb|original caption]]
22243 !! wikitext/edited
22244 [[Image:Foobar.jpg|thumb|new caption]]
22245 !!end
22247 !! test
22248 Image: empty alt attribute (bug 48924)
22249 !! options
22250 parsoid
22251 !! wikitext
22252 [[File:Foobar.jpg|thumb|alt=|bar]]
22253 !! html
22254 <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" 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>
22255 !! end
22257 #!! test
22258 #Image: new attributes should be serialized in wiki's language for RTL languages (bug 51852)
22259 #!! options
22260 #parsoid=html2wt
22261 #language=ar
22262 #!! wikitext
22263 #[[Imagen:Foobar.jpg|derecha|miniaturadeimagen]]
22264 #!! html
22265 #<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" height="20" width="180"/></a></figure>
22266 #!! end
22268 !! test
22269 Image: Block level image should have \n before and after
22270 !! wikitext
22272 [[File:Foobar.jpg|right|thumb|150x150px]]
22274 !! html/parsoid
22275 <p>123</p>
22276 <figure class="mw-halign-right" typeof="mw:Image/Thumb"><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="17" width="150"/></a></figure>
22277 <p>456</p>
22278 !!end
22280 !! test
22281 Image: New block level image should have \n before and after (existing content)
22282 !! wikitext
22284 [[File:Foobar.jpg|right|thumb|150x150px]]
22286 !! html/parsoid
22287 <p>123</p>
22288 <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" height="17" width="150" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"17","width":"150"},"sa":{"resource":"File:Foobar.jpg"}}'/></a></figure>
22289 <p>456</p>
22290 !!end
22292 !! test
22293 Image: upright option (parsoid)
22294 !! options
22295 parsoid
22296 !! wikitext
22297 [[File:Foobar.jpg|thumb|upright|caption]]
22298 [[File:Foobar.jpg|thumb|upright=0.5|caption]]
22299 [[File:Foobar.jpg|thumb|500x500px|upright=0.5|caption]]
22300 !! html
22301 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="19" width="170"/></a><figcaption>caption</figcaption></figure>
22302 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="12" width="110"/></a><figcaption>caption</figcaption></figure>
22303 <figure typeof="mw:Image/Thumb"><a href="File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" height="57" width="500"/></a><figcaption>caption</figcaption></figure>
22304 !!end
22306 !! test
22307 Image: upright option is ignored on inline and frame images (parsoid)
22308 !! options
22309 parsoid
22310 !! wikitext
22311 [[File:Foobar.jpg|500x500px|upright=0.5|caption]]
22312 !! html
22313 <p><span 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" height="57" width="500"/></a></span></p>
22314 !!end
22316 !! test
22317 Image: from basic HTML (1)
22318 !! options
22319 parsoid=html2wt
22320 !! html/parsoid
22321 <span typeof="mw:Image">
22322   <img src="File:Foobar.jpg" width=100 height=100 alt="Alt">
22323 </span>
22324 !! wikitext
22325 [[File:Foobar.jpg|link=|alt=Alt|100x100px]]
22326 !! end
22328 !! test
22329 Image: from basic HTML (2)
22330 !! options
22331 parsoid=html2wt
22332 !! html/parsoid
22333 <img src="File:Foobar.jpg" width=100 height=100 alt="Alt">
22334 !! wikitext
22335 [[File:Foobar.jpg|link=|alt=Alt|100x100px]]
22336 !! end
22338 !! test
22339 Image: from basic HTML (3)
22340 !! options
22341 parsoid=html2wt
22342 !! html/parsoid
22343 <a href="Main"><img src="File:Foobar.jpg" width=100 height=100 alt="Alt"></a>
22344 !! wikitext
22345 [[File:Foobar.jpg|link=Main|alt=Alt|100x100px]]
22346 !! end
22348 !! test
22349 Image: from basic HTML (4)
22350 !! options
22351 parsoid=html2wt
22352 !! html/parsoid
22353 <img src="File:Foobar.jpg">
22354 !! wikitext
22355 [[File:Foobar.jpg|link=]]
22356 !! end
22358 !! test
22359 Lists: Serialize correctly even when list content is wrapped in p-tags (like VE does)
22360 !! options
22361 parsoid=html2wt
22362 !! wikitext
22363 * foo
22364 !! html
22365 <ul>
22366 <li><p>foo</p></li>
22367 </ul>
22368 !! end
22370 !! test
22371 Lists: Serialize correctly even when list tags has unneeded whitespace between tags
22372 !! options
22373 parsoid=html2wt
22374 !! wikitext
22375 * foo
22376 !! html
22377 <ul> <li>foo</li></ul>
22378 !! end
22380 !! test
22381 Don't strip leading whitespace when handling indent-pre suppressing tags
22382 !! options
22383 parsoid=html2wt
22384 !! wikitext
22386   | indented row
22388 <blockquote>
22389  '''This is very bold of you!'''
22393  indented cell (no pre-wrapping!)
22395 </blockquote>
22397  <div>bar</div>
22398 !! html
22399 <table>
22400   <tr><td> indented row</td></tr>
22401 </table>
22402 <blockquote><p>
22403  <b>This is very bold of you!</b>
22404 </p>
22405 <table><tr><td>
22406  indented cell (no pre-wrapping!)
22407 </td></tr></table>
22408 </blockquote>
22409 <p>foo</p>
22410  <div>bar</div>
22411 !! end
22413 !! test
22414 Nowiki-wrap leading whitespace when handling indent-pre inducing tags
22415 !! options
22416 parsoid=html2wt
22417 !! wikitext
22419 <nowiki> </nowiki><span>bar</span>
22421 <span>foo2
22422 <nowiki> </nowiki></span>bar2
22424 <div>foo</div>
22425 <nowiki> </nowiki><span>bar</span>
22427 <div>
22428 <nowiki> </nowiki><span>foo</span>
22429 </div>
22430 !! html
22431 <p>foo</p>
22432  <span>bar</span>
22434 <span>foo2
22435  </span>bar2
22437 <div>foo</div>
22438  <span>bar</span>
22440 <div>
22441  <span>foo</span>
22442 </div>
22443 !! end
22445 !! test
22446 Lists: Add space after bullets
22447 !! options
22448 parsoid=html2wt
22449 !! wikitext
22450 * foo
22451 * bar
22452 * <span> baz</span>
22453 !! html
22454 <ul>
22455 <li>foo</li>
22456 <li> bar</li>
22457 <li><span> baz</span></li>
22458 </ul>
22459 !! end
22461 !! test
22462 Lists: Dont insert newlines in a serialized list item.
22463 !! options
22464 parsoid=html2wt
22465 !! wikitext
22466 * a<br>b
22467 * c
22468 !! html
22469 <ul><li>a<br>b</li><li>c</li></ul>
22470 !! end
22472 !! test
22473 Headings: Add space before/after == (Bug 51744)
22474 !! options
22475 parsoid=html2wt
22476 !! wikitext
22477 == foo ==
22479 == bar ==
22481 == baz ==
22483 == <span> baz</span> ==
22484 !! html
22485 <h2>foo</h2>
22486 <h2> bar</h2>
22487 <h2>baz </h2>
22488 <h2><span> baz</span></h2>
22489 !! end
22491 !! test
22492 Parsoid: Serialize positional parameters with = in them as named parameter
22493 !! options
22494 parsoid=html2wt
22495 !! wikitext
22496 {{echo|1 = f=oo}}
22498 {{echo|1 = f=oo|2 = bar}}
22500 <!--Orig params with data-parsoid has heuristics for handling = chars-->
22501 <!--FIXME: But maybe the heuristic needs fixing to apply to new params as well-->
22502 {{echo|<nowiki>f=oo</nowiki>|bar}}
22503 !! html
22504 <p about="#mwt1" typeof="mw:Transclusion"
22505 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"f=oo"}},"i":0}}]}'>foo</p>
22507 <p about="#mwt1" typeof="mw:Transclusion"
22508 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"f=oo"}, "2":{"wt":"bar"}},"i":0}}]}'>foo</p>
22510 <!--Orig params with data-parsoid has heuristics for handling = chars-->
22511 <!--FIXME: But maybe the heuristic needs fixing to apply to new params as well-->
22512 <p data-parsoid='{"pi":[[{"k":"1","spc":["","","",""]},{"k":"2","spc":["","","",""]}]]}' 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>
22513 !! end
22515 !! test
22516 Parsoid: Correctly serialize block-node children when they are a combination of text and p-nodes
22517 !! options
22518 parsoid=html2wt
22519 !! wikitext
22520 <div>a
22522 </div>
22523 <div>a
22525 </div>
22526 <div>
22530 </div>
22531 !! html
22532 <div>a<p>b</p></div>
22533 <div>a
22534 <p>b</p></div>
22535 <div>
22537 <p>b</p></div>
22538 !! end
22540 !! test
22541 Substrings resembling wikitext in hrefs should not get nowiki escapes
22542 !! options
22543 parsoid=html2wt
22544 !! wikitext
22545 [[Foo''bar''baz]]
22546 !! html
22547 <a rel="mw:WikiLink" href="./Foo''bar''baz">Foo''bar''baz</a>
22548 !! end
22550 #-----------------------------
22551 # I/B quote minimization tests
22552 #-----------------------------
22554 !! test
22555 1. I/B quote minimization: wikitext-only tags should be combined
22556 !! options
22557 parsoid=html2wt
22558 !! wikitext
22559 ''AB''
22561 '''AB'''
22563 ''A'''B'''''
22565 '''A''B'''''
22567 '''A''BC''D'''
22569 '''''AB'''''
22571 '''''AB'''''
22573 '''''AB'''''
22574 !! html
22575 <p><i>A</i><i>B</i></p>
22576 <p><b>A</b><b>B</b></p>
22577 <p><i>A</i><b><i>B</i></b></p>
22578 <p><b>A</b><i><b>B</b></i></p>
22579 <p><b>A</b><i><b>B</b><b>C</b></i><b>D</b></p>
22580 <p><i><b>A</b></i><i><b>B</b></i></p>
22581 <p><i><b>A</b></i><b><i>B</i></b></p>
22582 <p><b><i>A</i></b><i><b>B</b></i></p>
22583 !! end
22585 !! test
22586 2. I/B quote minimization: wikitext and html tags should not be combined
22587 !! options
22588 parsoid=html2wt
22589 !! wikitext
22590 ''A''<i>B</i>
22592 ''A''<nowiki/>'''<i>B</i>'''
22593 !! html
22594 <p><i>A</i><i data-parsoid='{"stx":"html"}'>B</i></p>
22595 <p><i>A</i><b><i data-parsoid='{"stx":"html"}'>B</i></b></p>
22596 !! end
22598 !! test
22599 3. I/B quote minimization: templated content stops minimization
22600 !! options
22601 parsoid=html2wt
22602 !! wikitext
22603 ''A''{{echo|''B''}}
22605 ''A''{{echo|'''''B'''''}}
22606 !! html
22607 <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>
22608 <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>
22609 !! end
22611 !! test
22612 4. I/B quote minimization: new content should be mimimized with adjacent old content
22613 !! options
22614 parsoid=html2wt
22615 !! wikitext
22616 ''AB''
22618 '''AB'''
22620 ''A'''B'''''
22621 !! html
22622 <p><i>A</i><i>B</i></p>
22623 <p><b>A</b><b>B</b></p>
22624 <p><i>A</i><b><i>B</i></b></p>
22625 !! end
22627 !! test
22628 5a. Merge adjacent quote nodes if they've been edited
22629 !! options
22630 parsoid={
22631   "modes": ["wt2wt"],
22632   "changes": [
22633     ["p", "contents", "remove", ":contains('b')"]
22634   ]
22636 !! wikitext
22637 ''a''b''c''
22638 !! wikitext/edited
22639 ''ac''
22640 !! end
22642 !! test
22643 5b. Merge adjacent quote nodes if they've been edited
22644 !! options
22645 parsoid={
22646   "modes": ["wt2wt"],
22647   "changes": [
22648     ["#x", "remove"]
22649   ]
22651 !! wikitext
22652 ''a''<span id="x">b</span>''c''
22653 !! wikitext/edited
22654 ''ac''
22655 !! end
22657 #------------------------------------
22658 # End of I/B quote minimization tests
22659 #------------------------------------
22661 !!test
22662 Bug 54262: New entities
22663 !! options
22664 parsoid=html2wt
22665 !! wikitext
22666 &nbsp;
22667 !! html
22668 <span typeof="mw:Entity">&nbsp;</span>
22669 !! end
22671 ## Note that there is no wikitext output for 'unknownproperty' ##
22672 ## Unknown magic words are silently dropped ##
22674 !! test
22675 Magic words
22676 !! options
22677 parsoid=html2wt
22678 !! wikitext
22679 __TOC__
22680 __NOTOC__
22681 __FORCETOC__
22682 __INDEX__
22683 __NOINDEX__
22684 __NOGALLERY__
22685 __NOEDITSECTION__
22686 __NOTITLECONVERT__
22687 __NOCONTENTCONVERT__
22688 !! html
22689 <meta property='mw:PageProp/toc' />
22690 <meta property='mw:PageProp/notoc' />
22691 <meta property='mw:PageProp/forcetoc' />
22692 <meta property='mw:PageProp/index' />
22693 <meta property='mw:PageProp/noindex' />
22694 <meta property='mw:PageProp/nogallery' />
22695 <meta property='mw:PageProp/noeditsection' />
22696 <meta property='mw:PageProp/notitleconvert' />
22697 <meta property='mw:PageProp/nocontentconvert' />
22698 <meta property='mw:PageProp/unknownproperty' />
22699 !! end
22701 !! test
22702 Consecutive <pre>s should not get merged
22703 !! options
22704 parsoid=html2wt,html2html
22705 !! wikitext
22719 !! html
22720 <pre>a</pre><pre>b</pre>
22722 <pre>c
22723 </pre><pre>
22724 d</pre>
22726 <pre>e
22728 </pre><pre>
22730 f</pre>
22731 !! end
22733 !! test
22734 Edited ISBN links not serializable as ISBN links should serialize as wikilinks
22735 !! options
22736 parsoid=html2wt
22737 !! wikitext
22738 [[Special:BookSources/1234567890|ISBN 1234567895]]
22739 !! html
22740 <a rel="mw:ExtLink" href="./Special:BookSources/1234567890">ISBN 1234567895</a>
22741 !! end
22743 !! test
22744 Edited RFC links not serializable as RFC links should serialize as extlinks
22745 !! options
22746 parsoid=html2wt
22747 !! wikitext
22748 [//tools.ietf.org/html/rfc123 New RFC]
22749 !! html
22750 <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink">New RFC</a>
22751 !! end
22753 !! test
22754 Edited PMID links not serializable as PMID links should serialize as extlinks
22755 !! options
22756 parsoid=html2wt
22757 !! wikitext
22758 [//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract New PMID]
22759 !! html
22760 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink">New PMID</a>
22761 !! end
22763 !! test
22764 Edited Redirect link should emit a non-piped wikitext link
22765 !! options
22766 parsoid=html2wt
22767 !! wikitext
22768 #REDIRECT [[Bar]]
22769 !! html
22770 <link rel="mw:PageProp/redirect" href="Bar" data-parsoid='{"src":"#REDIRECT ","a":{"href":"./Foo"},"sa":{"href":"Foo"}}'>
22771 !! end
22773 !! test
22774 T75121: Infer extension name from typeOf if data-mw is not present
22775 !! options
22776 parsoid=html2wt
22777 !! wikitext
22778 <foo />
22779 !! html
22780 <div typeOf="mw:Extension/foo"></div>
22781 !! end
22783 # -----------------------------------------------------------------
22784 # End of section for Parsoid-only html2wt tests for serialization
22785 # of new content
22786 # -----------------------------------------------------------------
22788 TODO:
22789 more images
22790 more tables
22791 character entities
22792 and much more
22793 Try for 100% code coverage